--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/group/bld.inf Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Highlevel bld.inf
+*
+*/
+
+
+
+#include "../svgt_plat/group/bld.inf"
+
+/*
+* Order is important
+*/
+
+#include "../svgtopt/group/bld.inf"
+#include "../svgtopt/SVGTPlugin/group/bld.inf"
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/layers.sysdef.xml Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
+ <!ENTITY layer_real_source_path "sf/mw/svgt" >
+]>
+
+<SystemDefinition name="svgt" schema="1.4.0">
+ <systemModel>
+ <layer name="mw_layer">
+ <module name="svgt">
+ <unit unitID="abs.svgt" mrp="" bldFile="&layer_real_source_path;/group" name="svgt" />
+ </module>
+ </layer>
+ </systemModel>
+</SystemDefinition>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/package_definition.xml Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SystemDefinition schema="3.0.0">
+ <package id="svgt" name="SVG Tiny" levels="util ui">
+ <collection id="svgt_plat" name="SVG Tiny Platform Interfaces" level="ui">
+ <component id="svgt_api" name="SVGT API" introduced="9.2" class="api" filter="s60">
+ <meta rel="Api" href="svgt_plat/svgt_api/svgt_api.metaxml"/>
+ <unit bldFile="svgt_plat/svgt_api/group"/>
+ </component>
+ <component id="nvg_api" name="NVG API" introduced="9.2" class="api" filter="s60">
+ <meta rel="Api" href="svgt_plat/nvg_api/nvg_api.metaxml"/>
+ <unit bldFile="svgt_plat/nvg_api/group"/>
+ </component>
+ </collection>
+ <collection id="svgtopt" name="SVG-T Engine" level="util">
+ <component id="svgtopt_build" filter="s60" name="SVG Engine" introduced="9.2">
+ <!-- component is at collection level. Needs to be moved down a directory -->
+ <unit bldFile="svgtopt/group"/>
+ </component>
+ <component id="svgtplugin" filter="s60" name="SVG Plugin" class="plugin" introduced="9.2">
+ <unit bldFile="svgtopt/svgtplugin/group"/>
+ </component>
+ </collection>
+ </package>
+</SystemDefinition>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/package_map.xml Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,1 @@
+<PackageMap root="sf" layer="mw"/>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgt_plat/group/bld.inf Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,22 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Includes all the Domain API specific bld.inf files, which
+* export files.
+*
+*/
+
+
+
+#include "../svgt_api/group/bld.inf"
+#include "../nvg_api/group/bld.inf"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgt_plat/nvg_api/group/bld.inf Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File that exports the files belonging to
+: NVG API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/nvg.h MW_LAYER_PLATFORM_EXPORT_PATH(nvg.h)
+../inc/MVGImageBinder.h MW_LAYER_PLATFORM_EXPORT_PATH(MVGImageBinder.h)
+../inc/NVGIcon.h MW_LAYER_PLATFORM_EXPORT_PATH(NVGIcon.h)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgt_plat/nvg_api/inc/MVGImageBinder.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder source file
+*
+*/
+
+
+
+#ifndef MVGIMAGEBINDER_H_
+#define MVGIMAGEBINDER_H_
+
+#include <e32base.h>
+
+class MVGImageBinder
+{
+public:
+ virtual ~MVGImageBinder(){}
+
+ virtual TInt BindClientBuffer(TUint aBuffer) = 0;
+ virtual TInt UnBindClientBuffer() = 0;
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgt_plat/nvg_api/inc/NVGIcon.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder header file
+*
+*/
+
+
+#ifndef NVGICON_H_
+#define NVGICON_H_
+
+#include <e32base.h>
+
+class CNvgEngine;
+
+/*!
+ * @class MNVGIcon
+ * base class for NVG icons
+ */
+class MNVGIcon
+ {
+public:
+
+ /*!
+ * @fn SetPreserveAspectRatio
+ * @brief Sets the Aspect ration for the NVG icon
+ * @return KErrNone if success, appropriate error code on failure
+ */
+ virtual TInt SetPreserveAspectRatio(TInt aPreserveAspectSetting,
+ TInt aSmilFitSetting) = 0;
+
+ /*!
+ * @fn Rotate
+ * @brief Rotates the icon
+ * @param aAngle angle of rotation
+ * @param aX x coordinate rotation center
+ * @param aY y coordinate rotation center
+ * @return KErrNone if success, appropriate error code on failure
+ */
+ virtual TInt Rotate(TReal32 aAngle, TReal32 aX, TReal32 aY) __SOFTFP = 0;
+
+ /*!
+ * @fn Draw
+ * @brief Draws the icon
+ * @param aSize size of the icon
+ * @param aNVGEngine NVG engine instance
+ * @return KErrNone if success, appropriate error code on failure
+ */
+ virtual TInt Draw(const TSize aSize, CNvgEngine * aNVGEngine) = 0;
+
+ /*!
+ * @fn ~MNVGIcon()
+ * @brief Destructs the icon
+ */
+ virtual ~MNVGIcon();
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgt_plat/nvg_api/inc/nvg.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,348 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef NVG_H
+#define NVG_H
+
+#include <e32base.h>
+#include <VG/openvg.h>
+#include <VG/vgu.h>
+
+#include <fbs.h>
+
+class TDereferencer;
+class MNVGIcon;
+class CNvgFitToViewBoxImpl;
+class MVGImageBinder;
+class TNVGEngineInternal;
+
+enum TNvgAlignStatusType
+ {
+ ENvgPreserveAspectRatio_None,
+ ENvgPreserveAspectRatio_XminYmin,
+ ENvgPreserveAspectRatio_XmidYmin,
+ ENvgPreserveAspectRatio_XmaxYmin,
+ ENvgPreserveAspectRatio_XminYmid,
+ ENvgPreserveAspectRatio_XmidYmid,
+ ENvgPreserveAspectRatio_XmaxYmid,
+ ENvgPreserveAspectRatio_XminYmax,
+ ENvgPreserveAspectRatio_XmidYmax,
+ ENvgPreserveAspectRatio_XmaxYmax
+ };
+
+enum TNvgMeetOrSliceType
+ {
+ ENvgMeet,
+ ENvgSlice
+ };
+
+enum TNvgBitEncoding
+ {
+ EEightBitEncoding = 1,
+ ESixteenBitEncoding ,
+ EThirtyTwoBitEncoding,
+ EFloatEncoding
+ };
+
+class CNvgEngine : public CBase
+ {
+public :
+ /**
+ * @brief constructor
+ * @version
+ * @param None
+ * @return None
+ */
+ IMPORT_C static CNvgEngine* NewL();
+
+ /**
+ * @berief Destructor
+ */
+ IMPORT_C ~CNvgEngine();
+
+ /**
+ * @brief Set the angle for rotation of the NVG graphic
+ * @version
+ * @param aAngle counter-clockwise rotation by a given angle (expressed in degrees)
+ * aX, aY point around which the rotation must take place
+ * @return None
+ */
+ IMPORT_C void Rotate(TReal32 aAngle, TReal32 aX, TReal32 aY) __SOFTFP;
+
+ /**
+ * @brief Gets the viewbox width and height from the NVG bytedata
+ * @version
+ * @param aBuf NVG byte data of the file
+ * @return None
+ */
+ IMPORT_C TSize ContentDimensions(const TDesC8& aBuf);
+
+ /**
+ * @brief Render NVG onto the bitmap
+ * @version
+ * @param aBuf byte data of NVG file
+ * aSize Size in pixels of the target
+ * aDstBitmap Target bitmap
+ * aMask Target mask
+ * @return None
+ */
+ IMPORT_C TInt DrawNvg(const TDesC8& aBuf, const TSize& aSize, CFbsBitmap* aDstBitmap, CFbsBitmap* aMask );
+
+ /**
+ * @brief Creates NVGIcon, openVG objects are cached
+ * @param aBuf byte data of NVG file
+ * aSize Size in pixels of the target
+ * @return NVG icon object on success, 0 on failure
+ */
+ IMPORT_C MNVGIcon * CreateNVGIcon(const TDesC8& aBuf, const TSize& aSize);
+
+ /**
+ * @brief Set the preserve aspect ratio for the NVG file
+ * @version
+ * @param
+ * @return None
+ */
+ IMPORT_C void SetPreserveAspectRatio( TNvgAlignStatusType aPreserveAspectSetting, TNvgMeetOrSliceType aSmilFitSetting );
+
+ /**
+ * @brief Reset the OpenVG handles in NVG Engine
+ * @version
+ * @param
+ * @return None
+ */
+ IMPORT_C void ResetNvgState();
+
+ /**
+ * @brief Sets the BackGround Colour for the target
+ * @version
+ * @param aRGBA8888Color colour in 32 bit RGBA format
+ * @return None
+ */
+ IMPORT_C void SetBackgroundColor( TUint32 aRGBA8888Color );
+
+ /**
+ * @fn SetVGImageBinder
+ * @brief Sets the callback for binding image to surface, nvgengine doesn't owns the implementation
+ * @param aImageBinder an implementation for MVGImageBinder, ownership is with the caller
+ */
+ void SetVGImageBinder(MVGImageBinder * aImageBinder)
+ {
+ iVGImageBinder = aImageBinder;
+ }
+
+ /**
+ * @fn OpenVGErrorToSymbianError
+ * @brief Converts OpenVg errors to symbian error type
+ */
+ static TInt OpenVGErrorToSymbianError( TInt aError );
+
+private :
+
+ /**
+ * Checks whether the given matrix is identity
+ */
+ TBool IsIdentity(VGfloat array[]);
+
+ /**
+ * Draws the nvg icon
+ */
+ void DoDrawNVGL(const TDesC8& aBuf, const TSize& aSize, CFbsBitmap* aDstBitmap, CFbsBitmap* aMask);
+
+ /**
+ * Draws the nvg-tlv icon
+ */
+ TInt DrawTLVL(const TDesC8& aBuf, const TSize& aTargetSize, CFbsBitmap* aDstBitmap, CFbsBitmap* aMask);
+
+ /**
+ * Draws the nvg-cs icon
+ */
+ TInt DrawCommandSectionL(TDereferencer * aIconData, const TSize& aTargetSize, CFbsBitmap* aDstBitmap, CFbsBitmap* aMask);
+
+ /**
+ * Constructor
+ */
+ CNvgEngine();
+
+ /**
+ * Constructor
+ */
+ void ConstructL();
+
+ /**
+ * SetPaint gradient or solid in OpenVG
+ */
+ TInt SetFillPaintL(TDereferencer * aIconData);
+
+ /**
+ * SetColor in OpenVG
+ */
+ TInt SetColorRampL(TDereferencer * aIconData);
+
+ /**
+ * Call vgDrawPath in OpenVG
+ */
+ void DrawPathL(TDereferencer * aIconData);
+
+ /**
+ * call SetTranslate in OpenVG
+ */
+ void SetTransformL(TDereferencer * aIconData, TUint32 &transVal,const VGfloat* aCurrentMatrix);
+
+ /**
+ * Set stroke color in Openvg
+ */
+ void SetStrokePaintL(TDereferencer * aIconData);
+
+ /**
+ * Sets the stroke Width
+ */
+ void SetStrokeWidth(const TUint8* aBuf);
+
+ /**
+ * Sets the miter limit
+ */
+ void SetStrokeMiterLimit(const TUint8* aBuf);
+
+
+ /**
+ * Generate Mask for modes not supported by custom binding API
+ */
+ void GenerateMask(CFbsBitmap* aMask);
+
+
+ /**
+ * To clear the background of the target
+ */
+ void ClearBackground();
+
+ /**
+ * Stores the callres matrix mode and matricies
+ */
+ void UpdateClientMatrices();
+
+ /**
+ * Restores the callres matrix mode and matricies
+ */
+ void RestoreClientMatrices();
+
+ /**
+ * Point transforms according to the given matrix
+ */
+ TPoint GetTranslatedPoint(VGfloat aTRMatrix[9], TPoint aPoint);
+
+ /**
+ * Gives the minimum of the given arguments
+ */
+ VGfloat MinVal4(VGfloat x1, VGfloat x2, VGfloat x3, VGfloat x4 );
+
+ /**
+ * Gives the maximum of the given arguments
+ */
+ VGfloat MaxVal4(VGfloat x1, VGfloat x2, VGfloat x3, VGfloat x4 );
+
+ /**
+ * Initializes the OpenVg handles
+ */
+ TInt InitializeGC();
+
+ /**
+ * Create the path handle
+ */
+ TInt CreatePathHandle(TInt16 aPathDataType, TReal32 aScale, TReal32 aBias);
+
+ /**
+ * Applies the rotation
+ */
+ void ApplyRotation();
+
+ /**
+ * Applies the scissoring
+ */
+ void ApplyScissoring(VGfloat aMatrix[], const TSize& aTargetSize);
+
+ /**
+ * Applies viewbox to viewport transformation
+ */
+ void ApplyViewboxToViewPortTransformationL(const TSize& aTargetSize, TReal32 aViewboxX, TReal32 aViewboxY,
+ TReal32 aViewboxW, TReal32 aViewboxH);
+
+ /**
+ * Executes the nvg-cs commands
+ */
+ void ExecuteNVGCSCommandLoopL(TUint16 aCommandCount, TDereferencer * aIconData, TDereferencer * aOffsetVector,
+ TDereferencer * aCommandSection, TInt aNVGVersion);
+
+private :
+
+ CFbsBitmap* iDstBimtap; //! Target Bitmap onto which the drawing will be rendered
+ TSize iCurrentBufferSize; //! Width and height of the target bitmap
+
+ VGPath iPath; //! The path elements are appended to this path
+ VGPaint iPaintFill; //! Paint handle for fill
+ VGPaint iPaintStroke; //! Paint handle for stroke
+
+ VGPaint iGradPaintFill;
+ VGPaint iGradPaintStroke;
+ VGPaint iUserStrokePaint;
+ TUint32 iUserStrokePaintColor;
+
+ TInt iFillAlpha; //! For fill alpha value
+ TInt iStrokeAlpha; //! Set alpha value for stroke
+
+ VGboolean idoFill; //! Flags for fill
+ VGboolean idoStroke; //! Flags for stroke
+
+ VGfloat * iColorRamps; //! This member variable is not used just kept for BC
+ CNvgFitToViewBoxImpl * iFitToViewBoxImpl; //! This member variable is not used just kept for BC
+
+ VGfloat iRotateAngle; //! Rotation angle in degrees
+ TBool iRotateApplied; //! Is rotation angle specified
+
+ /*
+ * caller's matrix mode and matricies, must be restored after operation
+ */
+ VGint iMatrixMode;
+ TReal32 iImageMatrix[9];
+ TReal32 iPathMatrix[9];
+ TReal32 iFillPaintMatrix[9];
+ TReal32 iStrokePaintMatrix[9];
+
+ TInt16 iLastPathDataType;
+
+ TNvgAlignStatusType iPreserveAspectSetting; //! Aspect Ratio setting
+ TNvgMeetOrSliceType iSmilFitSetting; //! SMIL Fit setting
+
+ TUint32 iBackgroundColor;
+
+ TReal32 iCentreX; //! Rotate center x-coordinate
+ TReal32 iCentreY; //! Rotate center y-coordinate
+
+ MVGImageBinder * iVGImageBinder; //! image binder
+
+ /**
+ * This class is added to maintain BC.
+ * If you want to add new member variable you can add in this class, without breaking BC.
+ * It is better to add members which are depend on macro's in this class.
+ */
+ TNVGEngineInternal *iInternal;
+
+#ifdef OPENVG_OBJECT_CACHING
+ VGPath CreatePath();
+#endif
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgt_plat/nvg_api/nvg_api.metaxml Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="037d9b8e29b74ec87f232a218c4522b9" dataversion="2.0">
+<name>NVG API</name>
+<description>This API is used to decode the NVG icons.</description>
+<type>c++</type>
+<collection>svgtopt</collection>
+<libs><lib name="nvgdecoder.lib"/>
+</libs>
+<release category="platform" sinceversion=""/>
+<attributes>
+<htmldocprovided>no</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgt_plat/svgt_api/group/bld.inf Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File that exports the files belonging to
+: SVGT API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/SVGImageLoadingObserver.h MW_LAYER_PLATFORM_EXPORT_PATH(SVGImageLoadingObserver.h)
+../inc/SVGEngineInterfaceImpl.h MW_LAYER_PLATFORM_EXPORT_PATH(SVGEngineInterfaceImpl.h)
+../inc/SvgListener.h MW_LAYER_PLATFORM_EXPORT_PATH(SVGListener.h)
+../inc/SVGErrorImpl.h MW_LAYER_PLATFORM_EXPORT_PATH(SVGErrorImpl.h)
+../inc/SvgJavaInterfaceImpl.h MW_LAYER_PLATFORM_EXPORT_PATH(SvgJavaInterfaceImpl.h)
+../inc/SVGHyperlinkListener.h MW_LAYER_PLATFORM_EXPORT_PATH(SVGHyperlinkListener.h)
+../inc/SVGAnimationListener.h MW_LAYER_PLATFORM_EXPORT_PATH(SVGAnimationListener.h)
+../inc/SVGRequestObserver.h MW_LAYER_PLATFORM_EXPORT_PATH(SVGRequestObserver.h)
+../inc/SVGRendererId.h MW_LAYER_PLATFORM_EXPORT_PATH(SVGRendererId.h)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgt_plat/svgt_api/inc/SVGAnimationListener.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine header file
+ *
+*/
+
+
+#ifndef __INC_MSVGANIMATIONLISTENER__
+#define __INC_MSVGANIMATIONLISTENER__
+
+
+/**
+ * This interface is the callback mechanism for the SVG Engine to communicate to
+ * interested clients about hyperlinks. The client (listener) is notified when
+ * a pointer has entered or exited a hyperlink and when a hyperlink is activated.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class MSvgAnimationListener
+ {
+ public:
+
+ /**
+ * Notified when a pointer enters a hyperlink element.
+ *
+ * @since 1.0
+ * @param : aUri -- URI string of hyperlink
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool AnimationStarted(TBool isAnimationIndefinite) = 0;
+
+ /**
+ * Notified when a pointer exits a hyperlink element.
+ *
+ * @since 1.0
+ * @param : aUri -- URI string of hyperlink
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool AnimationPaused() = 0;
+
+ /**
+ * This method is called to notify the client that a link has been
+ * activated.
+ *
+ * @since 1.0
+ * @param : aUri -- URI string of hyperlink
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool AnimationEnded() = 0;
+
+ };
+
+#endif /*__INC_MSVGHYPERLINKLISTENER__*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgt_plat/svgt_api/inc/SVGEngineInterfaceImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,2173 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine header file
+ *
+*/
+
+
+#ifndef SVGENGINEINTERFACEIMPL_H
+#define SVGENGINEINTERFACEIMPL_H
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+//does this need to be in a #define
+#include <e32cons.h>
+#include <w32std.h>
+#include <badesca.h>
+#include "SVGRendererId.h"
+#include "SVGListener.h"
+
+const TInt KSvgEngineUidValue=0x040039CE;
+const TUid KSvgEngineUid={KSvgEngineUidValue};
+
+typedef TUint TRenderingQuality;
+const TRenderingQuality KLowNoAA = 0;
+const TRenderingQuality KHighNoAA = 1;
+const TRenderingQuality KLowAA = 2;
+const TRenderingQuality KHighAA = 3;
+
+const TInt KInvalidEnumAttribute = -10000;
+const TReal32 KInvalidFloatAttribute = -10000;
+#define KSVGColorNone 2
+#define KSVGCurrentColor 3
+#define KSVGColorInherit 4
+#define KSVGAttributeInherit 5
+#define __TLV_ // Needed by orbit.
+
+enum TSvgErrorCode
+{
+ ESvgNoError = 0,
+ ESvgFileNotFound,
+ ESvgDocumentNotValid,
+ ESvgDocumentNotAvailable,
+ ESvgNoMemory,
+ ESvgDiskFull,
+ ESvgUnknown,
+ ESvgMissingRequiredAttribute,
+ ESvgInvalidAttributeValue,
+ ESvgbFileNotValid,
+ ESvgDRMFailure,
+ ESvgThumbNailRestriction
+};
+
+enum TSvgPreserveAspectAlignType
+ {
+ ESvgPreserveAspectRatio_None,
+ ESvgPreserveAspectRatio_Unknown,
+ ESvgPreserveAspectRatio_XmaxYmax,
+ ESvgPreserveAspectRatio_XmaxYmid,
+ ESvgPreserveAspectRatio_XmaxYmin,
+ ESvgPreserveAspectRatio_XmidYmax,
+ ESvgPreserveAspectRatio_XmidYmid, //default
+ ESvgPreserveAspectRatio_XmidYmin,
+ ESvgPreserveAspectRatio_XminYmax,
+ ESvgPreserveAspectRatio_XminYmid,
+ ESvgPreserveAspectRatio_XminYmin
+ };
+
+enum TSvgMeetOrSliceType
+ {
+ ESvgMeetOrSlice_Meet,
+ ESvgMeetOrSlice_Slice,
+ ESvgMeetOrSlice_Unknown
+ };
+
+class MSvgHyperlinkListener;
+class MSvgTextAreaListener;
+class MSvgTextListener;
+class MSvgAnimationListener;
+class MSvgListener;
+class CGfxGeneralPath;
+class CFbsBitmap;
+class CSvgEngineImpl;
+//class CSvgGcStack;
+class CSvgElementImpl;
+class MSvgEventReceiver;
+class MSvgRequestObserver;
+class CSvgTimer;
+class MXmlElement;
+class CSvgDocumentImpl;
+class CXmlElementImpl;
+class CSvgErrorImpl;
+class CSvgTextElementImpl;
+
+class CSvgBitmapFontProvider;
+class MRect
+ {
+ public:
+
+ /**
+ * Get the four points for a rectangle
+ *
+ * @since 1.0
+ * @return : void
+ */
+ virtual void GetPoints(TPoint& aPoint1, TPoint& aPoint2, TPoint& aPoint3, TPoint& aPoint4) const = 0;
+
+ virtual TBool Intersects( const MRect& aRect ) = 0;
+
+ virtual void Center( TPoint& aCenter ) = 0;
+
+ };
+
+
+class MSvgError
+ {
+ public:
+
+ /**
+ * Determine wether an error is indicated by this object.
+ *
+ * @since 1.0
+ * @return : ETrue, if ErrorCode() != ESvgNoError
+ */
+ virtual TBool HasError() = 0;
+
+ /**
+ * Determine wether an error is only a warning.
+ * This should be a state when the svg may be display, despite
+ * a conflict.
+ *
+ * @since 1.0
+ * @return ETrue if HasError() is only a warning.
+ */
+ virtual TBool IsWarning() = 0;
+
+ /**
+ * Get the error code contained by this object.
+ *
+ * @since 1.0
+ * @return : the TSvgErrorCode value
+ */
+ virtual TSvgErrorCode ErrorCode() = 0;
+
+ /**
+ * Get the error description string for this object.
+ *
+ * @since 1.0
+ * @return : error description string.
+ */
+ virtual TDesC& Description() = 0;
+
+ /**
+ * Get the system error code contained by this object. For example,
+ * If ErrorCode() is ESvgDRMFailure, SystemErrorCode() will contain
+ * the error-code returned by the system for a drm-failure.
+ *
+ * @since 1.0
+ * @return : the TSvgErrorCode value
+ */
+ virtual TInt SystemErrorCode() = 0;
+ };
+
+/**
+ * This class implements the interface for a SVGT Engine, providing methods
+ * to load svg contents and manipulate the output, such as zooming, panning
+ * and rotating the display.
+ */
+class CSvgEngineInterfaceImpl : public CBase
+ {
+ public:
+
+ IMPORT_C MSvgError* CSvgEngineInterfaceImpl::SaveSvgDom(TInt aHandle, const TDesC& aFileName, TInt aEngine = NULL);
+
+ /**
+ * Two phase construction
+ */
+ // April 27th : Add thrid new parameter for specifying the Text height
+ IMPORT_C static CSvgEngineInterfaceImpl* NewL( CFbsBitmap* aFrameBuffer,
+ MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec );
+ IMPORT_C static CSvgEngineInterfaceImpl* NewL( CFbsBitmap* aFrameBuffer,
+ MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec ,SVGRendererId aRendererType );
+
+ /**
+ * Create a new Svg Engine interface.
+ *
+ * @since 1.0
+ * @param : aFrameBuffer -- bitmap to draw resulting svg image.
+ * @param : aReqObserver -- interface for callbacks to retrieve info
+ * only client can provide, such as opening files.
+ * @param : aFontSpec -- Font spec to use for text drawing.
+ * @return : none
+ */
+ IMPORT_C static CSvgEngineInterfaceImpl* NewLC( CFbsBitmap* aFrameBuffer,
+ MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec );
+ // NGA:: overloading NewLC to include a renderer selector parameter
+ IMPORT_C static CSvgEngineInterfaceImpl* NewLC( CFbsBitmap* aFrameBuffer,
+ MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec ,SVGRendererId aRendererType );
+
+ /**
+ * Added for getting the NVG-TLV from S60SVGTEngine in QT S60 baseport.
+ * @since 1.0
+ * @return : Pointer to the tlv data
+ */
+
+ IMPORT_C const TPtrC8 TLVEncodedData() const;
+
+ /**
+ * Svg Engine interface Destructor.
+ *
+ * @since 1.0
+ * @param : None
+ * @return : none
+ */
+ IMPORT_C ~CSvgEngineInterfaceImpl();
+
+ /**
+ * Load a svg document from a file. An error is return if one is encountered.
+ * Some errors may be more like warnings, which may allow the svg content
+ * to display nevertheless.
+ *
+ * @since 1.0
+ * @param aFileName -- Name of svg file
+ * @return : Error code if any
+ */
+ IMPORT_C MSvgError* Load( const TDesC& aFileName );
+
+ /**
+ * Load a svg document from a byte array. An error is return if one is encountered.
+ * Some errors may be more like warnings, which may allow the svg content
+ * to display nevertheless.
+ *
+ * @since 1.0
+ * @param aByteData -- Byte array of svg document.
+ * @return : Error code if any
+ */
+ IMPORT_C MSvgError* Load( const TDesC8& aByteData );
+
+ /**
+ * Load a svg document from from the RFile Handle passed. An error is return if one is encountered.
+ * Some errors may be more like warnings, which may allow the svg content
+ * to display nevertheless.
+ *
+ * @since 1.0
+ * @param aFileHandle -- RFile handle of svg document.
+ * @return : Error code if any
+ **/
+ IMPORT_C MSvgError* Load( RFile& aFileHandle );
+
+ /**
+ * Destroy the currently "loaded" svg document. Prepared documents,
+ * must be destroy through DeleteDom, or the engine will destroy them
+ * in its destructor function.
+ *
+ * @since 1.0
+ * @param : none
+ * @return : none
+ */
+ IMPORT_C void Destroy();
+
+
+ /**
+ * Request the SVG Engine to begin an animation.
+ *
+ * @since 1.0
+ * @param : aEngine -- NULL to start internal svg-engine
+ * @param : aIsMainThread -- EFalse to start engine asynchronously,
+ * defaulted to EFalse.
+ * @return : none
+ */
+ IMPORT_C void Start( CSvgEngineImpl* aEngine = NULL,
+ TBool aIsMainThread = ETrue );
+
+ /**
+ * Request the SVG Engine to begin an animation.
+ * This method returns an error code.
+ * @since 1.0
+ * @param : MSvgError*& -- Pointer to Error object ,
+ * @param : aEngine -- NULL to start internal svg-engine,
+ * @return : none
+ */
+
+ IMPORT_C void Start( MSvgError*& aError,
+ CSvgEngineImpl* aEngine = NULL
+ );
+ /**
+ * Request the SVG Engine to stop an animation.
+ *
+ * @since 1.0
+ * @param : none
+ * @return : none
+ */
+ IMPORT_C void Stop( CSvgEngineImpl* aEngine = NULL );
+
+ /**
+ * Request the SVG Engine to pause an animation.
+ *
+ * @since Series 60 3.0
+ * @param : none
+ * @return : none
+ */
+ IMPORT_C void Pause( CSvgEngineImpl* aEngine = NULL );
+
+ /**
+ * Request the SVG Engine to resume an animation.
+ *
+ * @since 1.0
+ * @param : none
+ * @return : none
+ */
+ IMPORT_C void Resume( CSvgEngineImpl* aEngine = NULL );
+
+ /**
+ * Get the animation duration of a svg content, in milliseconds,
+ * for non-indefinite animations.
+ *
+ * @since 1.0
+ * @param
+ * @return the animation duration.
+ */
+ IMPORT_C TUint32 Duration( TInt aEngine = NULL );
+
+ /**
+ * Reset the view to the default values. Redraw() must be called to
+ * update the output image.
+ *
+ * @since 1.0
+ * @param
+ * @return the animation duration.
+ */
+ IMPORT_C void OriginalView( TInt aEngine = NULL );
+
+
+ /**
+ * Request the SVG Engine to zoom-in on the content given the zoom factor.
+ * The value range is greater than zero. The current zoom factor is
+ * multiplied with the given value to yield the final result. Redraw()
+ * must be called to update the output image.
+ *
+ * @since 1.0
+ * @param : aScaleFactor -- A value greater than zero.
+ * @return
+ */
+ IMPORT_C void Zoom( TReal32 aScaleFactor, TInt aEngine = NULL ) __SOFTFP;
+
+ /**
+ * Shift the center of the content in both x and y coordinates. The
+ * values are in user-coordinate values and may be negative. Redraw()
+ * must be called to update the output image.
+ *
+ * @since 1.0
+ * @param : aX -- Number of pixels to pan left (negative) or right.
+ * @param : aY -- Number of pixels to pan up (negative) or down.
+ * @return
+ */
+ IMPORT_C void Pan( TInt aX, TInt aY, TInt aEngine = NULL );
+
+ /**
+ * Shift the center of the content in both x and y coordinates. The
+ * values are in user-coordinate values and may be negative.
+ *
+ * @since 1.0
+ * @param : aX -- Number of pixels to pan left (negative) or right.
+ * @param : aY -- Number of pixels to pan up (negative) or down.
+ * @return TBool
+ */
+ IMPORT_C TBool IsPanPossible( TInt aX, TInt aY, TInt aEngine = NULL );
+
+ /**
+ * Checks the panning possibility in four directions. A efficient
+ * API for clients which want to show 4 way panning indicators.
+ * It is efficient for these clients to get the all four direction
+ * information at one go. Saves rendering time significantly per
+ * frame.
+ *
+ * @since 1.0
+ * @param : left: would contain result of whether panning of one pixel
+ * possible to left.
+ * @param : right: would contain result of whether panning of one pixel
+ * possible to right.
+ * @param : up: would contain result of whether panning of one pixel
+ * possible to up.
+ * @param : down: would contain result of whether panning of one pixel
+ * possible to down.
+ * @param :
+ * @return
+ */
+ IMPORT_C void IsPanPossibleFourWay
+ ( TBool& left, TBool& right, TBool& up, TBool& down, TInt aEngine = NULL);
+
+ /**
+ * Rotate the content about the given point by the given angle.
+ * The point is in user-coordinates. Redraw() must be called to
+ * update the output image.
+ *
+ * @since 1.0
+ * @param : aAngle -- Number of gradients to rotate.
+ * @param : aX -- X center of rotation
+ * @param : aY -- Y center of rotation.
+ * @return
+ */
+ IMPORT_C void Rotate( TReal32 aAngle,
+ TInt aX,
+ TInt aY,
+ TInt aEngine = NULL ) __SOFTFP;
+
+ /**
+ * Notify the SVG Engine that a "mouse down" event. The engine will
+ * initiate mouse-related events, such as links, if appropriate.
+ *
+ * @since 1.0
+ * @param : aX -- x coordinate of mouse event.
+ * @param : aY -- y coordinate of mouse event.
+ * @return
+ */
+ IMPORT_C TInt MouseDown( TInt aX, TInt aY, TInt aEngine = NULL );
+
+ /**
+ * Notify the SVG Engine that a "mouse up" event. The engine will
+ * initiate mouse-related events, such as links, if appropriate.
+ *
+ * @since 1.0
+ * @param : aX -- x coordinate of mouse event.
+ * @param : aY -- y coordinate of mouse event.
+ * @return
+ */
+ IMPORT_C void MouseUp( TInt aX, TInt aY, TInt aEngine = NULL );
+
+ /**
+ * Notify the SVG Engine that a "mouse move" event. The engine will
+ * initiate mouse-related events, such as links, if appropriate.
+ *
+ * @since 1.0
+ * @param : aX -- x coordinate of mouse event.
+ * @param : aY -- y coordinate of mouse event.
+ * @return
+ */
+ IMPORT_C void MouseMove( TInt aX, TInt aY, TInt aEngine = NULL );
+
+ /**
+ * Notify the SVG Engine that a "key press" event. The engine will
+ * initiate key-related events if appropriate.
+ * @since 1.0
+ * @param : aKeyCode -- key code of key event.
+ * @return
+ */
+
+ IMPORT_C void KeyPress( const TKeyEvent& aKeyEvent, TInt aEngine = NULL );
+
+ /**
+ * Retrieve the rendering quality setting. See TRenderingQuality
+ * for possible values.
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ IMPORT_C TRenderingQuality GetRenderQuality( );
+
+ /**
+ * Set the rendering quality. Low-level graphics is always set
+ * to high -- no effect from this call. Redraw() must be called to
+ * update the output image.
+ *
+ * @since 1.0
+ * @param : aQualityLevel -- rendering quality
+ * @return
+ */
+ IMPORT_C void SetRenderQuality( TRenderingQuality aQualityLevel, TInt aEngine = NULL );
+
+ /**
+ * Retrieve the reference to the svg document object.
+ *
+ * @since 1.0
+ * @param none
+ * @return current document that was Loaded or Prepare/UseDom.
+ */
+
+ //DEPRECATED API...
+ IMPORT_C CSvgDocumentImpl* SvgDocument();
+
+ /**
+ * Set the minimum delay between each frame, in milliseconds.
+ * Frames per Second = 1000 / aFrameDelay
+ *
+ * The default/minimum value is 67 milliseconds (15 fps).
+ *
+ * @since 1.0
+ * @param : aFrameDelay -- animation frame duration.
+ * @return none
+ */
+ IMPORT_C void SetAnimFrameDuration( TUint aAFDur, TInt aEngine = NULL );
+
+ /**
+ * Request for updating the off-screen image buffer with the
+ * svg content.
+ *
+ * @since 1.0
+ * @param aIsMainThread -- indicate whether this redraw request
+ * is called in the main thread (executed immediately).
+ * Otherwise, this request is to be executed asynchronously.
+ * 'Main thread' used here means the thread which instantiated
+ * this CSvgEngineInterfaceImpl object.
+ * @return none
+ */
+ IMPORT_C void Redraw( TBool aIsMainThread = ETrue, TInt aEngine = NULL );
+
+ /**
+ * Switch the debugging mode on/off.
+ *
+ * @since 1.0
+ * @param none
+ * @return none
+ */
+ IMPORT_C void SwitchDebugInfo( TInt aEngine = NULL );
+
+ /**
+ * This is the integer version of ContentDimensions.
+ * 1) Return the size of the <svg> width/height if given in non-percentage.
+ *
+ * 2) If <svg> width/height are given as percentages:
+ * A) If viewbox attribute is specified, return the viewbox width/height times the <svg> width/height percentages.
+ * B) Else return the content bounding-box size times times the <svg> width/height percentages.
+ *
+ * @since 1.0
+ * @param none
+ * @return TSize
+ */
+ IMPORT_C TSize ContentDimensions( TInt aEngine = NULL );
+
+ /**
+ * This is the floating-point version of ContentDimensions.
+ * 1) Return the size of the <svg> width/height if given in non-percentage.
+ *
+ * 2) If <svg> width/height are given as percentages:
+ * A) If viewbox attribute is specified, return the viewbox width/height times the <svg> width/height percentages.
+ * B) Else return the content bounding-box size times times the <svg> width/height percentages.
+ *
+ * @since 1.0
+ * @param none
+ * @return
+ */
+ IMPORT_C void ContentDimensions( TReal32& aWidth, TReal32& aHeight, TInt aEngine = NULL ) __SOFTFP;
+
+ /**
+ * Retrieve the content size in user-coordinates if specified as
+ * percentage.
+ *
+ * @since 3.1
+ * @param none
+ * @return TSize
+ */
+ IMPORT_C TSize ContentDimensionsInPercentage( TInt aEngine = NULL );
+
+
+ /**
+ * Set focus coordinates to the next focusable object.
+ *
+ * @since 1.0
+ * @param none
+ * @return rectangle area having the focus on an object.
+ */
+ IMPORT_C TRect FocusNext();
+
+ /**
+ * Set focus coordinates to the previous focusable object.
+ *
+ * @since 1.0
+ * @param none
+ * @return rectangle area having the focus on the previous object.
+ */
+ IMPORT_C TRect FocusPrevious();
+
+ /**
+ * Activate currently focussed object.
+ *
+ * @since 1.0
+ * @param none
+ * @return none
+ */
+ IMPORT_C void ActivateObjectInFocus();
+
+ /**
+ * Get the current animation frame time, in milliseconds.
+ *
+ * @since 1.0
+ * @param none
+ * @return current frame time.
+ */
+ IMPORT_C TInt32 MediaTime( TInt aEngine = NULL );
+
+ /**
+ * Set the current animation frame time, in millseconds.
+ *
+ * @since 1.0
+ * @param aTime -- time to forward/rewind to.
+ * @return none
+ */
+ IMPORT_C void SetMediaTime( TInt32 aTime, TInt aEngine = NULL );
+ /**
+ * Returns the Size of Viewport
+ *
+ * @since 1.0
+ * @param none
+ * @return viewport size
+ */
+ IMPORT_C TSize Size( TInt aEngine = NULL );
+
+ /**
+ * Returns the Position of Viewport
+ *
+ * @since 1.0
+ * @param none
+ * @return
+ */
+ IMPORT_C TPoint Position( TInt aEngine = NULL ) ;
+
+ /**
+ * Reset the focus list
+ * This happens in the event of new additions to EventReceiver list and/or
+ * sorting of this list
+ *
+ * @since 1.0
+ * @param aIndex - index of object to reset focus.
+ * @return
+ */
+ void ResetFocusIndex(TInt32 aIndex);
+
+ /**
+ * Generate mask bitmap from the current frame
+ *
+ * @since 1.0
+ * @param aMask - bitmap to hold masking info.
+ * @return none
+ */
+ IMPORT_C void GenerateMask( CFbsBitmap* aMask, TInt aEngine = NULL );
+
+ /**
+ * Set the color for clearing background.
+ *
+ * @since 1.0
+ * @param aRGBA8888Color - 32-bit color value
+ * @return none
+ */
+ IMPORT_C void SetBackgroundColor( TUint32 aRGBA8888Color, CSvgEngineImpl* aEngine = NULL );
+
+ /**
+ * Returns SVG Engine State
+ *
+ * @since 1.0
+ * @param none
+ * @return 0 == SVG Running and 1 == SVG Paused
+ */
+
+ IMPORT_C TInt CurrentState( TInt aEngine = NULL );
+
+ /**
+ * Returns SVG Engine Pan Position
+ *
+ * @since 1.0
+ * @param
+ * @return TPoint
+ */
+ IMPORT_C TPoint PanPosition( TInt aEngine = NULL );
+
+ /**
+ * This method is a special case Constructor method used for polymorphic
+ * DLL loading, which enforces this method to be public.
+ *
+ * @since 1.0
+ * @return
+ */
+ IMPORT_C CSvgEngineInterfaceImpl();
+
+ /**
+ * Replay the Current Animation.
+ *
+ * @since 1.0
+ * @param :
+ * @return : MSvgError* Error object specifying the error occured during operation
+ */
+ IMPORT_C MSvgError* Replay( TInt aEngine = NULL );
+
+ /**Added for DOM Caching API changes*/
+
+ /**
+ * Parses and Prepares DOM for given SVG or SVGB file.
+ * Provides a Handle to the created DOM. A prepared DOM may be
+ * delete with DeleteDom or when the engine is deleted.
+ *
+ * @param aFileName: the name of the file to be parsed
+ * @param aHandle: Handle to the created DOM.
+ * @return: MSvgError* Error object specifying the error occured during operation
+ */
+ IMPORT_C MSvgError* PrepareDom(const TDesC& aFileName, TInt& aHandle, TInt aEngine = NULL);
+
+ /**
+ * Parses and Prepares DOM for both svg and svg binary data.
+ * Provides a Handle to the created DOM. A prepared DOM may be
+ * delete with DeleteDom or when the engine is deleted.
+ *
+ * @param aByteData: Svg/SvgBinary data.
+ * @param aHandle: Handle to the created DOM.
+ * @return: MSvgError* Error object specifying the error occured during operation
+ */
+ IMPORT_C MSvgError* PrepareDom(const TDesC8& aByteData, TInt& aHandle, TInt aEngine = NULL);
+
+ /**
+ * Parses and Prepares DOM for given SVG or SVGB file.
+ * Provides a Handle to the created DOM. A prepared DOM may be
+ * delete with DeleteDom or when the engine is deleted.
+ *
+ * @param : aFileHandle -- File handle
+ * @param : aHandle -- Handle to a DOM.
+ * @return: MSvgError* Error object specifying the error occured during operation
+ */
+ IMPORT_C MSvgError* PrepareDom( RFile& aFileHandle, TInt& aHandle, TInt aEngine = NULL );
+
+ /**
+ * Defines view box for SVG content associated with
+ * handle if not set.
+ */
+
+
+ IMPORT_C void ChooseViewBoxIfNotSet(TInt aDomHandle);
+ /**
+ * Renders the DOM tree associated with the Handle (UseDom).
+ *
+ * @param : aHandle -- Handle to a DOM.
+ * @param : aBitmap -- Bitmap to draw DOM content.
+ *@param : aMaskBuffer - Buffer for mask (alpha values) of framebuffer result (optional).
+ * @return: MSvgError* Error object specifying the error occured during operation
+ */
+ IMPORT_C MSvgError* RenderDom(TInt aHandle, CFbsBitmap* aBitmap, CFbsBitmap* aMaskBuffer = NULL);
+
+ /**
+ * Deletes the DOM tree associated with the Handle.
+ *
+ * @param : aHandle -- Handle to a DOM.
+ * @return: MSvgError* Error object specifying the error occured during operation
+ */
+ IMPORT_C MSvgError* DeleteDom( TInt aHandle );
+
+ /**
+ * Enable/Disable DRM.
+ *
+ * @param : aEnable -- Flag to enable/distable DRM.
+ * @return: none
+ */
+ IMPORT_C void SetDRMMode(TBool aEnable, TInt aEngine = NULL);
+
+ /**
+ * initialization of the engine according to a particular cached DOM tree.
+ *
+ *
+ *@param : aHandle -- Handle to DOM Tree.
+ *@param : aRenderBuffer - Buffer for drawing the DOM Tree.
+ *@param : aMaskBuffer - Buffer for mask (alpha values) of framebuffer result (optional).
+ *@param : aEngine - SvgEngine handle to manager DOM (optional).
+ *@return MSvgError* Error object specifying the error occured.
+ */
+ IMPORT_C MSvgError* UseDom(TInt aHandle, CFbsBitmap* aRenderBuffer, CFbsBitmap* aMaskBuffer = NULL, TInt aEngine = NULL);
+
+ IMPORT_C MSvgError* UseDom(TInt aHandle,CFbsBitmap* aRenderBuffer, CFbsBitmap* aMaskBuffer,TSize aRenderBufferSize,TDisplayMode aRenderDisplayMode,TDisplayMode aMaskDisplayMode,TInt aEngine = NULL);
+ /**
+ * Set the SVG dimensions to the root buffer size.
+ *
+ *@param aWidth - width to set root size.
+ *@param aHeight - height to set root size.
+ *@return none
+ */
+ IMPORT_C void SetSvgDimensionToFrameBuffer(TUint aWidth, TUint aHeight, TInt aEngine = NULL);
+
+ /**
+ * Return the scaled bounding box for the whole svg document.
+ *
+ *@param none
+ *@return the scaled bounding box info.
+ */
+ IMPORT_C TRect GetSvgBoundingBox( TInt aEngine = NULL );
+
+ /**
+ * Check for interactive/non-interactive content.
+ *
+ *@param aDocument - Document Pointer
+ *@return wether document has interactive elements.
+ */
+ IMPORT_C TBool IsContentInteractive( CSvgDocumentImpl* aDocument, TInt aEngine = NULL );
+
+ /**
+ * Update the path information with the given element
+ *
+ *@param hPath - path handle
+ *@param hElement - element handle
+ *@return none
+ */
+ IMPORT_C void UpdatePath(TInt hPath, CSvgElementImpl* hElement);
+
+ /**
+ * Returns the size (number of external elements) in the given document
+ *
+ *@param aDocument - Document Pointer
+ *@return number of external elements
+ */
+ IMPORT_C TInt GetExternalListSize(CSvgDocumentImpl* aDocument);
+
+ /**
+ * Given an index number and a document handle returns an external resource uri associated
+ * with an element
+ *@param aDocument - Document Pointer index - index in external list
+ *@return URI
+ */
+ IMPORT_C void GetExternalListItemL(
+ CSvgDocumentImpl* aDocument, TInt aIndex, TPtrC16& aUri);
+
+ /**
+ * Given a document handle and a url this call attaches
+ * the given data (ldata) to every element that references that url
+ *
+ *@param aDocument - Document Pointer
+ *@param lUrl- uri string that is an external resource to be retrieved
+ *@param ldata - byte array containing the data that that external resource recieved
+ *@return none
+ * NULL if image-decoding is not initiated.
+ */
+ IMPORT_C CSvgElementImpl* AddExternalData( CSvgDocumentImpl* aDocument,
+ const TDesC& aUri,
+ const TDesC8& aData,
+ TBool aMakeCopy = EFalse,
+ TInt aSize = 0,
+ TInt aEngine = NULL );
+
+ /**
+ * Create an instance of a CSvgEngineImpl.
+ *
+ *@param : None
+ *@return Pointer to CSvgEngineImpl object if creation is succesful, otherwise
+ * the function leaves.
+ */
+ IMPORT_C CSvgEngineImpl* SvgEngineNewL();
+
+ /**
+ * Intialize the given SVG Engine.
+ *
+ *@param : aEngine -- SVG Engine.
+ *@return None
+ */
+ IMPORT_C void StartEngine( CSvgEngineImpl* aEngine );
+ IMPORT_C void RenderFrame( CSvgEngineImpl* aEngine, TUint aCurrentTime );
+
+ IMPORT_C void ViewportInit( CSvgDocumentImpl* aDocumentHandle );
+
+ /**
+ * Set the GDI context for the given SVG Engine.
+ *
+ *@param : aEngine -- SVG Engine.
+ *@param : aFrameBuffer -- Bitmap to become gdi context.
+ *@return None
+ */
+ IMPORT_C void SetGdiContextL( CSvgEngineImpl* aEngine, CFbsBitmap* aFrameBuffer );
+
+ /**
+ * Associate the given document with the given engine.
+ *
+ *@param : aEngine -- SVG Engine.
+ *@param : aDocument -- SVG Document
+ *@return None
+ */
+ IMPORT_C void SetDocument( CSvgEngineImpl* aEngine, CSvgDocumentImpl* aDocument );
+ void SvgElementAssignDocument( CSvgElementImpl* aElement, CSvgDocumentImpl* aDoc );
+
+ /**
+ * Create an empty instance of a SVG document.
+ *
+ *@param : aEngine -- SVG Engine.
+ *@param : aDocument -- SVG Document
+ *@return Svg Document if successful, otherwise the function leaves.
+ */
+ IMPORT_C CSvgDocumentImpl* SvgDocumentNewL();
+
+ /**
+ * Fill a SVG document by parsing the given byte array.
+ *
+ *@param : aEngine -- SVG Engine.
+ *@param : aDocument -- SVG Document
+ *@return None if successful, otherwise the function leaves.
+ */
+ IMPORT_C void FillDocumentL( CSvgDocumentImpl* aDocument, const TDesC16& aByteData );
+
+ /**
+ * Destroy the given SVG document
+ *
+ *@param : aDocument -- SVG document.
+ *@return None .
+ */
+ IMPORT_C void DestroyDocument( CSvgDocumentImpl* aDocument );
+
+ /**
+ * Destroy the given SVG engine
+ *
+ *@param : aEngine -- SVG Engine.
+ *@return None .
+ */
+ IMPORT_C void DestroyEngine( CSvgEngineImpl* aEngine );
+
+ /**
+ * Return the root element of the given document.
+ *
+ *@param : aDocument -- SVG document.
+ *@return root element .
+ */
+ IMPORT_C CXmlElementImpl* GetRootElement( CSvgDocumentImpl* aDocument );
+
+ /**
+ * Set a default SvgSvg root element of the given document.
+ *
+ *@param : aDocument -- SVG document.
+ *@return void.
+ */
+ IMPORT_C void InitRootElement( CSvgDocumentImpl* aDocument );
+
+ /**
+ * Return the root element of the given document.
+ *
+ *@param : aDocument -- SVG document.
+ *@param : aId -- id string to search for element.
+ *@return element with given id .
+ */
+ IMPORT_C CXmlElementImpl* GetElementById( CSvgDocumentImpl* aDocument, const TDesC& aId );
+
+ /**
+ * Return the number of ids in a given document
+ *
+ *@param : aDocument -- SVG document.
+ *@return number of ids found.
+ */
+ IMPORT_C TInt GetNumberOfIds( CSvgDocumentImpl* aDocument );
+
+ /**
+ * Return the id at from the document at index
+ *
+ *@param : aDocument -- SVG document.
+ *@param : index -- which id to return
+ *@param : myId -- id string to return by reference.
+ *@return none
+ */
+ IMPORT_C TDesC* GetId( CSvgDocumentImpl* aDocument, TInt index );
+
+ /**
+ * Return parent element of the given element.
+ *
+ *@param : aElement -- SVG element.
+ *@return element with given child.
+ */
+ IMPORT_C CXmlElementImpl* GetParentElement( CXmlElementImpl* aElement );
+
+ /**
+ * Set parent element for the given element.
+ *
+ *@param : aElement -- SVG element.
+ *@param : aParentElement -- SVG parent element.
+ *@return void
+ */
+ IMPORT_C void SetParentElement( CXmlElementImpl* aElement, CXmlElementImpl* aParentElement );
+
+ /**
+ * Set the first child for the given element.
+ *
+ *@param : aFirstChildElement -- SVG element.
+ *@param : aParentElement -- SVG parent element.
+ *@return void
+ */
+ IMPORT_C void SetFirstChildElement( CXmlElementImpl* aFirstChildElement, CXmlElementImpl* aParentElement );
+
+
+ /**
+ * Create an element of the given type.
+ *
+ *@param : aDocument -- SVG element document.
+ *@param : aElementType -- SVG element type.
+ *@return element.
+ */
+ IMPORT_C CXmlElementImpl* CreateElementL( CSvgDocumentImpl* aDocument, TInt aElementType );
+
+ /**
+ * Create an element of the given type.
+ *
+ *@param : aDocument -- SVG element document.
+ *@param : aElementType -- SVG element type.
+ *@return element.
+ */
+ IMPORT_C void DestroyElement( CXmlElementImpl* aElement );
+
+ /**
+ * Append the given child element to the given parent element.
+ *
+ *@param : aParentElement -- SVG parent element.
+ *@param : aChildElement -- SVG child element.
+ *@return None.
+ */
+ IMPORT_C void AppendChild( CXmlElementImpl* aParentElement, CXmlElementImpl* aChildElement, TBool aIsJSR226Element = EFalse);
+
+ /**
+ * Remove the given child element from the given parent element.
+ *
+ *@param : aParentElement -- SVG parent element.
+ *@param : aChildElement -- SVG child element.
+ *@return None.
+ */
+ IMPORT_C void RemoveChild( CXmlElementImpl* aParentElement, CXmlElementImpl* aChildElement);
+
+ /**
+ * Get the first child element in the given parent.
+ *
+ *@param : aParentElement -- SVG parent element.
+ *@return The first child element.
+ */
+ IMPORT_C CXmlElementImpl* GetFirstChild( CXmlElementImpl* aParentElement );
+
+ /**
+ * Get the next sibling element of the given element.
+ *
+ *@param : aElement -- SVG element.
+ *@return The next sibling element.
+ */
+ IMPORT_C CXmlElementImpl* GetNextSibling( CXmlElementImpl* aElement );
+
+ /**
+ * Set the next sibling element for the given element.
+ *
+ *@param : aElement -- SVG element.
+ *@param : aSibling -- SVG sibling element.
+ *@return None
+ */
+ IMPORT_C void SetNextSibling( CXmlElementImpl* aElement, CXmlElementImpl* aSibling );
+
+ /**
+ * Get the document that is associated with the given element.
+ *
+ *@param : aElement -- SVG element.
+ *@return svg document.
+ */
+ IMPORT_C CSvgDocumentImpl* GetOwnerDocument( CXmlElementImpl* aElement );
+
+ /**
+ * Get the element type, such as rect, circle, etc. for the given element.
+ *
+ *@param : aElement -- SVG element.
+ *@return element type
+ */
+ IMPORT_C TInt GetElementType( CXmlElementImpl* aElement );
+
+ /**
+ * Set the given request-observer for the given svg engine.
+ *
+ *@param : aElement -- SVG element.
+ *@return element type
+ */
+ IMPORT_C void SetRequestObserver( CSvgEngineImpl* aEngine, MSvgRequestObserver* aObserver );
+
+ /**
+ * Get the Bounding Box for an element.
+ *
+ *@param : aElementHandle -- SVG element.
+ *@param : aX -- X coordinate for the top left.
+ *@param : aY -- Y coordinate for the top left.
+ *@param : aWidth -- Width of the bounding rectangle.
+ *@param : aHeight -- Height for the bounding rectangle.
+ *@return None.
+ */
+ IMPORT_C void GetElementBoundingbox(CSvgElementImpl* aElementHandle,TReal32& aX ,TReal32& aY,TReal32& aWidth,TReal32& aHeight) __SOFTFP;
+
+ /**
+ * Get the unscaled Bounding Box for an element.
+ *
+ *@param : aElementHandle -- SVG element.
+ *@param : aX -- X coordinate for the top left.
+ *@param : aY -- Y coordinate for the top left.
+ *@param : aWidth -- Width of the bounding rectangle.
+ *@param : aHeight -- Height for the bounding rectangle.
+ *@return None.
+ */
+
+ IMPORT_C void GetElementUnScaledBoundingBox( CSvgElementImpl* aElementHandle,TReal32& aX ,TReal32& aY,TReal32& aWidth,TReal32& aHeight) __SOFTFP;
+
+ /**
+ * Get the Bounding Box for an element.
+ *
+ *@param : aElementHandle -- SVG element.
+ *@param : aPoint1 -- coordinate for the top left.
+ *@param : aPoint2 -- coordinate for the top right.
+ *@param : aPoint3 -- coordinate for the bottom left.
+ *@param : aPoint4 -- coordinate for the bottom right.
+ *@return None.
+ */
+ IMPORT_C void GetFourPointElementBoundingBox(CSvgTextElementImpl* aElementHandle,TPoint& aPoint1 ,TPoint& aPoint2,TPoint& aPoint3,TPoint& aPoint4);
+
+ /**
+ * Get the Float attribute for the element.
+ *
+ *@param : aElementHandle -- SVG element.
+ *@param : aAttribute Id the attribute Id corresponding to the attribute.
+ *@return The float attribute value.
+ */
+ IMPORT_C TReal32 GetElementFloatAttribute( CSvgElementImpl* aElementHandle, const TInt aAttributeId) __SOFTFP;
+
+ /**
+ * Set the Float attribute for the element.
+ *
+ *@param : aElementHandle -- SVG element.
+ *@param : aAttribute Id the attribute Id corresponding to the attribute.
+ *@param : aValue the value to for the float attribute to be set.
+ *@return None.
+ */
+ IMPORT_C void SetElementFloatAttribute( CSvgElementImpl* aElementHandle, const TInt aAttributeId, TReal32 aValue) __SOFTFP;
+
+ /**
+ * Set the Descriptor attribute for the element.
+ *
+ *@param : aElementHandle -- SVG element.
+ *@param : aAttribute Id the attribute Id corresponding to the attribute.
+ *@param : aAttributeValue the value to for the Desc attribute to be set.
+ *@return None.
+ */
+ IMPORT_C void SetElementDesAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId, const TDesC& aAttributeValue);
+
+ /**
+ * Get the Desc attribute for the element.
+ *
+ *@param : aElementHandle -- SVG element.
+ *@param : aAttribute Id the attribute Id corresponding to the attribute.
+ *@param : aValue . reference to the attribute value.
+ *@return : None.
+ */
+ IMPORT_C TInt GetElementDesAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId,TPtrC16& aValue);
+
+ /**
+ * Set the Color attribute for the element.
+ *
+ *@param : aElementHandle -- SVG element.
+ *@param : aAttribute Id the attribute Id corresponding to the attribute.
+ *@param : aColorValue The Integer value corresponding to the color.
+ *@return None.
+ */
+ IMPORT_C void SetElementColorAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId,TInt32 aColorValue);
+
+ /**
+ * Get the CoLor attribute for the element. // this basically means the fill and stroke.
+ *
+ *@param : aElementHandle -- SVG element.
+ *@param : aAttribute Id the attribute Id corresponding to the attribute.
+ *@return : Integer containing the RGB value for the color.
+ */
+ IMPORT_C TInt32 GetElementColorAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId);
+
+ /**
+ * Get the Enum attribute for the element. // this basically means the fill and stroke.
+ *
+ *@param : aElementHandle -- SVG element.
+ *@param : aAttribute Id the attribute Id corresponding to the attribute.
+ *@param : Integer containing the enum value for the attribute.
+ */
+ IMPORT_C void SetEnumAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId,TInt32 lValue);
+
+ /**
+ * Set the preserve aspect ratio setting for the current document
+ *
+ *@param : aDocumentHandle
+ *@param : TPreserveAspectRatio a preserve aspect ratio setting
+ */
+ IMPORT_C void SetPreserveAspectRatio( CSvgDocumentImpl* aDocument, TSvgPreserveAspectAlignType aPreserveAspectSetting, TSvgMeetOrSliceType aSmilFitSetting, TBool aFrameBufferOverridesViewport = EFalse );
+
+ /**
+ * Set the Enum attribute for the element. // this basically means the fill and stroke.
+ *
+ *@param : aElementHandle -- SVG element.
+ *@param : aAttribute Id the attribute Id corresponding to the attribute.
+ *@return : Integer containing the enum value for the attribute.
+ */
+ IMPORT_C TInt GetEnumAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId,TInt32& lValue);
+ /**
+ * Get the rect values.
+ *
+ *@param : aElementHandle, aX, aY, aWidth, aHeight
+ *@return TBool a viewbox existed
+ */
+ IMPORT_C TBool GetRectAttribute( CXmlElementImpl* aElementHandle,
+ float* aX, float* aY, float* aWidth, float* aHeight );
+
+ /**
+ * Set the rect values.
+ *
+ *@param : aElementHandle, aX, aY, aWidth, aHeight
+ *@return none
+ */
+ IMPORT_C void SetRectAttribute( CXmlElementImpl* aElementHandle,
+ float aX, float aY, float aWidth, float aHeight );
+
+ /**
+ * Get the matrix values.
+ *
+ *@param : aElementHandle, aAVal, aBVal, aCVal, aDVal, aEVal, aFVal
+ *@return none
+ */
+ IMPORT_C void GetMatrixAttribute( CXmlElementImpl* aElementHandle, float* aAVal,
+ float* aBVal, float* aCVal, float* aDVal,
+ float* aEVal, float* aFVal );
+
+ /**
+ * Get the matrix values for a given matrix type.
+ *
+ *@param : aElementHandle, aAVal, aBVal, aCVal, aDVal, aEVal, aFVal
+ *@return none
+ */
+ IMPORT_C void GetMatrixAttribute( CXmlElementImpl* aElementHandle, TInt aAttributeType,
+ float* aAVal, float* aBVal,
+ float* aCVal, float* aDVal,
+ float* aEVal, float* aFVal );
+
+ /**
+ * Set the matrix values.
+ *
+ *@param : aElementHandle, aAVal, aBVal, aCVal, aDVal, aEVal, aFVal
+ *@return none
+ */
+ IMPORT_C void SetMatrixAttribute( CXmlElementImpl* aElementHandle, float aAVal,
+ float aBVal, float aCVal, float aDVal,
+ float aEVal, float aFVal );
+
+ /**
+ * Get the Viewport Width .
+ *
+ *@param : aDocumentHandle
+ *@return TInt integer containing the width of the viewport. viewport means
+ * svg element.
+ */
+ IMPORT_C TInt GetViewportWidth( CSvgDocumentImpl* aDocumentHandle );
+
+ /**
+ * Get the Viewport Height.
+ *
+ *@param : aDocumentHandle
+ *@return TInt integer containing the Height of the viewport. Viewport means
+ * svg Element.
+ */
+ IMPORT_C TInt GetViewportHeight( CSvgDocumentImpl* aDocumentHandle );
+
+ /**
+ * Set the Viewport Width.
+ *
+ *@param : aDocumentHandle
+ *@param TInt integer containing the Width of the viewport. Viewport means
+ * svg Element.
+ *@return none
+ */
+ IMPORT_C void SetViewportWidth( CSvgDocumentImpl* aDocumentHandle, TInt aWidth );
+
+ /**
+ * Set the Viewport Height.
+ *
+ *@param : aDocumentHandle
+ *@param TInt integer containing the Height of the viewport. Viewport means
+ * svg Element.
+ *@return none
+ */
+ IMPORT_C void SetViewportHeight( CSvgDocumentImpl* aDocumentHandle, TInt aHeight );
+
+ /**
+ * Get the Viewport Units. This means the units in which the width and height of
+ * <svg> element are specified.
+ *
+ *@param : aDocumentHandle
+ *@return TInt integer containing the units.
+ */
+ IMPORT_C TInt GetViewportUnits( CSvgDocumentImpl* aDocumentHandle );
+
+ /**
+ * Set the end time for an animation element.
+ *
+ *@param : aElementHandle
+ *@param : aOffsetTime
+ *@return none.
+ */
+ IMPORT_C void SvgEndElementAt(CXmlElementImpl* aElementHandle , TUint32 aOffsetTime, CSvgDocumentImpl* aDocumentHandle = NULL);
+
+ /**
+ * Set the Begin time for an animation element.
+ *
+ *@param : aElementHandle
+ *@param : aOffsetTime
+ *@return none.
+ */
+ IMPORT_C void SvgBeginElementAt(CXmlElementImpl* aElementHandle , TUint32 aOffsetTime, CSvgDocumentImpl* aDocumentHandle = NULL);
+ /**
+ * Sets the Media time for a Document.
+ *
+ *@param : aDocumentHandle
+ *@param : aTimeInMilliSeconds. This represents the time in milliseconds.
+ *@return none.
+ */
+ IMPORT_C void SvgSetMediaTime(CSvgDocumentImpl* aDocumentHandle ,TUint32 aTimeInMilliSeconds);
+
+ /**
+ * Gets the Media time for a Document.
+ *
+ *@param : aDocumentHandle
+ *@return TReal32 . Media time in seconds.
+ */
+ IMPORT_C TReal32 SvgGetMediaTime(CSvgDocumentImpl* aDocumentHandle ) __SOFTFP;
+
+ /**
+ * checks whether the document has any animation elements present.
+ *
+ *@param : aDocumentHandle
+ *@return TBool . ETrue if animation present otherwise EFalse.
+ */
+ IMPORT_C TBool SvgHasAnimation(CSvgDocumentImpl* aDocumentHandle );
+
+
+ /**
+ * Return true if element is removeable (no id or children with ids)
+ *
+ *@param : aElement -- SVG element.
+ *@return true if removeable false if not removeable
+ */
+ IMPORT_C TBool IsRemoveable( CSvgElementImpl* hElement, TBool aCheckSibling = EFalse );
+
+ /**
+ * Return true if element is removeable (no id or children with ids)
+ *
+ *@param : aElement -- SVG element.
+ *@return true if removeable false if not removeable
+ */
+ IMPORT_C TBool IsElementActive( CSvgElementImpl* hElement );
+
+ /**
+ * returns the pointer to the focussed element.
+ *
+ *@param : None.
+ *@return : CXmlElementImpl* pointer to the focussed element at present.
+ */
+ IMPORT_C CXmlElementImpl* GetFocusedElement(CSvgDocumentImpl* aDocument);
+
+ /**
+ * Sets the focus on a specific element.
+ *
+ *@param : aElement.
+ *@return : None.
+ */
+ IMPORT_C void SetFocusElement(CXmlElementImpl* aElement, CSvgDocumentImpl* aDocument);
+
+ /**
+ * checks whether a given element is present in DOM.
+ *
+ *@param : aDocument. this is pointer to the document which is to be searched for the presence
+ * of the element.
+ *@param : aElement. This represents the pointer to the element.
+ *@return : TBool. True if element is present otherwise false.
+ */
+ IMPORT_C TBool SVGElementInDom(CSvgDocumentImpl* aDocument, CXmlElementImpl* aElement);
+
+ /**
+ * This API will start the animation if the focussed object is an animation element.
+ *
+ *@param : aDocument. This is a pointer to the document. ?? this may not be needed.
+ *@return : None.
+ */
+ IMPORT_C void SvgActivateAnimation(CSvgDocumentImpl* aDocument);
+
+ /**
+ * SVGElement_GetUsedElement :- This API will return a pointer to the original
+ * element which was cloned to use it. i.e.the cloned element is made a chld of the <use>
+ * element.
+ * @param : aElement :- this is handle to the cloned element. this is child of the
+ * : <use> element.
+ * @return : CXmlElementImpl* this is the pointer to the actual element, which is
+ * cloned.
+ */
+ IMPORT_C CXmlElementImpl* SVGElementGetUsedElement(CXmlElementImpl* aElement);
+
+ /**
+ * This API will add the given element to the event receiver list.
+ *
+ *@param : aElement. This is pointer to the element which is to be added.
+ *@param : aEventMask. This is the event mask.
+ *@return : None.
+ */
+ IMPORT_C void AddToEventReceiverList(CXmlElementImpl* aElement, const TUint8 aEventMask);
+
+ /**
+ * This API will remove the given element to the event receiver list.
+ *
+ *@param : aElement. This is pointer to the element which is to be removed.
+ *@param : aEventMask. This is the event mask.
+ *@return : None.
+ */
+ IMPORT_C void RemoveFromEventReceiverList(CXmlElementImpl* aElement);
+
+ /**
+ * DispatchMouseEventsAt This will send mouse events to the Engine at this points.
+ *
+ *@param : aDocumentHandle. which document should get the engine.
+ *@param : aMouseX. X coordinate for the mouseEvents
+ *@param : aMouseY. Y coordinate for the mouseEvents
+ *@return : int.
+ */
+ IMPORT_C TInt DispatchMouseEventsAt(CSvgDocumentImpl* aDocumentHandle, TInt aMouseX, TInt aMouseY, MSvgMouseListener* aListener);
+
+ /**
+ * SvgCreatePath his will create a new empty path.
+ *
+ *@param : None.
+ *@return : None.
+ */
+ IMPORT_C CGfxGeneralPath* SvgCreatePath();
+
+ /**
+ * SvgDestroyPath this will delete a path given a pointer to it.
+ *
+ *@param : aPathHandle. Path element pointer.
+ *@return : None.
+ */
+ IMPORT_C void SvgDestroyPath(CGfxGeneralPath* aPathHandle);
+
+ /**
+ * GetSegmentCount Returns the number of segments in a PATH.
+ *
+ *@param : aPathHandle. Path element pointer.
+ *@return : integer representing the number of segments.
+ */
+ IMPORT_C TInt GetSegmentCount(CGfxGeneralPath* aPathHandle);
+
+ /**
+ * GetSegmentType Returns the segment type for a specific segment in a path element.
+ *
+ *@param : aPathHandle. Path element pointer.
+ *@param : aSegmentIndex , Segment index for the specific segments.
+ *@return : integer representing the type of segments.
+ */
+ IMPORT_C TInt GetSegmentType(CGfxGeneralPath* aPathHandle, TInt aSegmentIndex);
+
+ /**
+ * GetSegmentParameter Returns the segment parameter for a specific segment in a path element.
+ *
+ *@param : aPathHandle. Path element pointer.
+ *@param : aSegmentIndex , Segment index for the specific segments.
+ *@param : aSegmentParameterIndex. This gives the segment parameter index.
+ *@return : TReal32 representing the segment parameter.
+ */
+ IMPORT_C TReal32 GetSegmentParameter(CGfxGeneralPath* aPathHandle,TInt aSegmentIndex,TInt aSegmentParameterIndex) __SOFTFP;
+
+ /**
+ * ADDMoveTo Adds a moveTo segment to a path element.
+ *
+ *@param : aPathHandle. Path element pointer.
+ *@param : aX , x coordinate for the MoveTo command.
+ *@param : aY. Y coordinate for the MoveTo command.
+ *@return : None.
+ */
+ IMPORT_C void ADDMoveTo(CGfxGeneralPath* aPathHandle, TReal32 aX,TReal32 aY) __SOFTFP;
+
+ /**
+ * ADDLineTo Adds a LineTo segment to a path element.
+ *
+ *@param : aPathHandle. Path element pointer.
+ *@param : aX , x coordinate for the LineTo command.
+ *@param : aY. Y coordinate for the LineTo command.
+ *@return : None.
+ */
+ IMPORT_C void ADDLineTo(CGfxGeneralPath* aPathHandle,TReal32 aX,TReal32 aY) __SOFTFP;
+
+ /**
+ * ADDQuadTo Adds a QuadTo segment to a path element.
+ *
+ *@param : aPathHandle. Path element pointer.
+ *@param : aX1 , X coordinate for the first control point.
+ *@param : aY1 , Y coordinate for the first control point.
+ *@param : aX2 , X coordinate for the end point.
+ *@param : aY2 , Y coordinate for the end point.
+ *@return : None.
+ */
+ IMPORT_C void ADDQuadTo(CGfxGeneralPath* aPathHandle,TReal32 aX1,TReal32 aY1,TReal32 aX2,TReal32 aY2) __SOFTFP;
+
+ /**
+ * ADDCurveTo Adds a curveTo segment to a path element.
+ *
+ *@param : aPathHandle. Path element pointer.
+ *@param : aX1 , X coordinate for the first control point.
+ *@param : aY1 , Y coordinate for the first control point.
+ *@param : aX2 , X coordinate for the second control point.
+ *@param : aY2 , Y coordinate for the second control point.
+ *@param : aX3 , X coordinate for the end point.
+ *@param : aY3 , Y coordinate for the end point.
+ *@return : None.
+ */
+ IMPORT_C void ADDCurveTo(CGfxGeneralPath* aPathHandle,TReal32 aX1,TReal32 aY1,TReal32 aX2,TReal32 aY2, TReal32 aX3, TReal32 aY3) __SOFTFP;
+
+ /**
+ * ADDCloseTo Closes a given path element.
+ *
+ *@param : aPathHandle. Path element pointer.
+ *@return : None.
+ */
+
+ IMPORT_C void ADDCloseTo(CGfxGeneralPath* aPathHandle);
+
+ /**
+ * GetPathAttribute gets a pointer to the path attribuite for a given element.
+ *
+ *@param : aElementHandle. Svg element pointer.
+ *@param : aAttributeId. This gives you the attributeId for the element to get.
+ *@return : CGfxGeneralPath* this gives you the path attribute pointer fetched.
+ */
+ IMPORT_C CGfxGeneralPath* GetPathAttribute(CXmlElementImpl* aElementHandle, TInt aAttributeId);
+
+ /**
+ * SetPathAttribute sets the path attribute for a given element.
+ *
+ *@param : aElementHandle. Svg element pointer.
+ *@param : aAttributeId. This gives you the attributeId for the element to get.
+ *@param : PathHandle this gives you the path attribute pointer fetched.
+ *@return : NONE.
+ */
+ IMPORT_C void SetPathAttribute(CSvgElementImpl* aElementHandle, TInt lSvgAttrId, CGfxGeneralPath* aPathHandle);
+
+ /**
+ * Change the frame Buffer dynamically
+ *
+ *
+ *
+ *@aRenderBuffer :- Buffer for drawing the DOM Tree.
+ */
+ IMPORT_C void SetFrameBuffer(CFbsBitmap* aRenderBuffer, TInt aEngine = NULL);
+
+ IMPORT_C void ClearFrameBuffer(CFbsBitmap* aFrameBuffer, TUint32 aClearingColor, TInt aEngine = NULL);
+
+ /**
+ * Search for all occurrences of a string in the current svg document,
+ * in the cdata of the <text> elements. The bounding-boxes are transformed,
+ * accounted for zooming/panning.
+ *
+ *
+ *@param : aSearchString -- String to search
+ *@param : aBoundingBoxes -- Array to contain the bounding boxes of texts found.
+ * The bounding boxes are already transformed so that they're related
+ * to the frame buffer origin.
+ *@param : aTexts -- Array to contain cdata of the <text> elements containing
+ * the search-string.
+ *@param : aCaseSensitive -- Flag to indicate whether to search with case-sensitivity
+ * or not, defaults to ETrue.
+ *@return ETrue if at least one occurrence is found, EFalse otherwise.
+ */
+ IMPORT_C TBool SearchForText( const TDesC& aSearchString,
+ RPointerArray<MRect>& aBoundingBoxes,
+ RArray<TPtrC>& aTexts,
+ RArray<TInt>& aElementIds,
+ TBool aCaseSensitive = ETrue,
+ TInt aEngine = NULL );
+
+ /**
+ * Add a HyperlinkListener to the SVG Engine..
+ *
+ *@param : aListener -- HyperlinkListener to receive callbacks.
+ *@return None
+ */
+ IMPORT_C void AddHyperlinkListener( MSvgHyperlinkListener* aListener, TInt aEngine = NULL );
+
+ /**
+ * Add a TextAreaListener to the SVG Engine..
+ *
+ *@param : aListener -- TextAreaListener to receive callbacks.
+ *@return None
+ */
+ IMPORT_C TBool AddTextAreaListener( MSvgTextAreaListener* aListener, TInt aEngine = NULL );
+
+ /**
+ * Remove a TextAreaListener from the SVG Engine..
+ *
+ *@param : aListener -- TextAreaListener to receive callbacks.
+ *@return None
+ */
+ IMPORT_C TBool RemoveTextAreaListener( MSvgTextAreaListener* aListener, TInt aEngine = NULL );
+
+ /**
+ * Add a TextListener to the SVG Engine..
+ *
+ *@param : aListener -- TextListener to receive callbacks.
+ *@return None
+ */
+ IMPORT_C TBool AddTextListener( MSvgTextListener* aListener, TInt aEngine = NULL );
+
+ /**
+ * Remove a TextListener from the SVG Engine..
+ *
+ *@param : aListener -- TextListener to receive callbacks.
+ *@return None
+ */
+ IMPORT_C TBool RemoveTextListener( MSvgTextListener* aListener, TInt aEngine = NULL );
+
+
+ /**
+ * Add a text string to a text area
+ *
+ *@param : aTextAreaElementId, aString
+ *@return ETrue EFalse
+ */
+ IMPORT_C TBool SetTextForTextAreaElement( TInt aTextAreaElementId, TDesC& aXmlString );
+
+ /**
+ * Get the entire text string from the specified text area
+ *
+ *@param : aTextAreaElementId, is text area editable, aString
+ *@return is text area editable
+ */
+ IMPORT_C TBool GetTextForTextAreaElement( TInt aTextAreaElementId, TBool& editable, TDes& aXmlString );
+
+ /**
+ * Add a text string to a text element
+ *
+ *@param : aTextElementId, aString
+ *@return ETrue EFalse
+ */
+ IMPORT_C TBool SetTextForTextElement( TInt aTextElementId, TDesC& aXmlString );
+
+ /**
+ * Get the entire text string from the specified text element
+ *
+ *@param : aTextElementId, is text editable, aString
+ *@return is text editable
+ */
+ IMPORT_C TBool GetTextForTextElement( TInt aTextElementId, TBool& editable, TDes& aXmlString );
+
+ /**
+ * Remove a HyperlinkListener from the SVG Engine..
+ *
+ *@param : aListener -- HyperlinkListener to receive callbacks.
+ *@return None
+ */
+ IMPORT_C void RemoveHyperlinkListener( MSvgHyperlinkListener* aListener, TInt aEngine = NULL );
+
+ /**
+ * Add a HyperlinkListener to the SVG Engine..
+ *
+ *@param : aListener -- HyperlinkListener to receive callbacks.
+ *@return None
+ */
+ IMPORT_C void AddAnimationListener( MSvgAnimationListener* aListener, TInt aEngine = NULL );
+
+ /**
+ * Remove a HyperlinkListener from the SVG Engine..
+ *
+ *@param : aListener -- HyperlinkListener to receive callbacks.
+ *@return None
+ */
+ IMPORT_C void RemoveAnimationListener( MSvgAnimationListener* aListener, TInt aEngine = NULL );
+
+ /**
+ * Return whether an element is visible on the frame buffer.
+ *
+ *@param : aElementHandle -- an SVG element identifier.
+ *@return ETrue if element is visible, EFalse otherwise.
+ */
+ IMPORT_C TBool IsElementVisible( TInt aElementHandle, TInt aEngine = NULL );
+
+ /**
+ * Set the engine to load SVG contents as thumbnails:
+ * a) Only DRM protected contents are affected by this API.
+ * b) In thumbnail mode, DRM rights in not consumed.
+ * c) In thumbnail mode, the svg contents are drawn only
+ * to frame-buffers of 64x64 or smaller.
+ *
+ *@param : aThumbNailMode -- Flag to turn on/off thumbnial mode.
+ *@return : none
+ */
+ IMPORT_C void SetThumbNailMode( TBool aThumbNailMode, TInt aEngine = NULL );
+
+ /**
+ * Set the engine to enable/disable consuming DRM rights
+ *
+ *@param : aEnable -- Flag to turn off/on consuming rights
+ *@return: none
+ */
+ IMPORT_C void SetDRMRights(TBool aEnable);
+
+ /**
+ * Adds a text element to display the frames per second if isShowOn = true
+ *
+ *@param : isShowOn specified whether or not to display fps
+ *@return : frames per second in the engine
+ */
+ IMPORT_C TReal FramesPerSecond(TBool isShowOn = EFalse, TInt aEngine = NULL) __SOFTFP;
+
+ /**
+ * Used for testing purpose.
+ *
+ *@param : aCustomOption specified whether or not to use OpenVG implementation
+ *@return : none
+ */
+ EXPORT_C void CustomOption(TBool aCustomOption = EFalse, TInt aEngine = NULL);
+
+ // return an array with all of the elements of a certain type
+ // passing in a -1 for element id will return all elements
+ IMPORT_C void FindAllElements( CSvgElementImpl* aStartElement, TInt aElementId,
+ RPointerArray<CSvgElementImpl>& aList, TInt aEngine = NULL );
+
+
+ /**
+ * Create an svg element that can be added to the a document
+ * to draw the given rectangle.
+ *
+ *@param : aRect - rectangle to request element.
+ *@return : element represent rectangle.
+ */
+ IMPORT_C CSvgElementImpl* DrawBox(TRect aRect, TInt aEngine = NULL);
+
+ /**
+ * Return the default size of the given document handle, defined
+ * by the union of the bounding boxes of the elements. This function
+ * is independent of frame-buffer or any other document.
+ *
+ * @since 1.0
+ * @param aDomHandle - Handle to svg document (thru PrepareDom)
+ * @return Size of svg content
+ */
+ IMPORT_C TSize GetUnscaledContentSize( TInt aDomHandle );
+
+ /**
+ * Generate frames, defined by the given
+ * duration, delay per seconds, etc. The calling client will be
+ * responsible for managing the bitmaps created by this method that
+ * are appended to the given bitmap arrays. The starting frame can
+ * be specified with the starting time parameter.
+ *
+ * Note: Embedded images/svg files will not be rendered, due
+ * to asynchronous image decoder.
+ *
+ * Redundant frames removal is implemented, defaulted to EFalse.
+ *
+ * aDomHandle -- Handle to the svg dom.
+ * aDimensionOfBitmaps -- Size of bitmaps to generate (same for mask)
+ * aStartTime -- Start time of first frame (in milliseconds)
+ * aDuration -- Total time of animation (in milliseconds)
+ * aMillisecondsPerFrame -- Request delay time between each frame.
+ * aColorDepth -- Color display mode for main bitmaps
+ * aMaskType -- Color display mode for mask bitmaps
+ * aBitmapFrames -- Array to hold animation bitmaps
+ * aMaskFrames -- Array to hold mask bitmaps
+ * aDelayIntervals -- Delay interval between each frame (in milliseconds)
+ * aRemoveRedundantFrames -- If ETrue, remove consecutive frames that are the same
+ * and set the correct delay.
+ * Return Non-NULL Pointer to a svg error (MSvgError*)
+ */
+ IMPORT_C MSvgError* RenderFrames( TInt aDomHandle,
+ const TSize& aDimensionOfBitmaps,
+ TUint aStartTime,
+ TUint aDuration,
+ TUint aMillisecondsPerFrame,
+ TDisplayMode aColorDepth,
+ TDisplayMode aMaskType,
+ RPointerArray<CFbsBitmap>& aBitmapFrames,
+ RPointerArray<CFbsBitmap>& aMaskFrames,
+ RArray<TUint>& aDelayIntervals,
+ TBool aRemoveRedundantFrames = EFalse );
+
+ /**
+ * Used when creating an element from the java interface
+ * initializes all of the style properties attribute array to
+ * null for a newly created element so that attributes can be added
+ * to that element
+ *
+ *@param : aElementHandle -- an SVG element identifier.
+ *@return
+ */
+ IMPORT_C void InitSvgStylePropertiesWithNullL( CSvgElementImpl* aElement );
+
+ /**
+ * Add a specific event listener to the engine
+ *
+ *@param : aListener, a listener type
+ *@return : none
+ */
+ IMPORT_C void AddListener( const MSvgListener* aListener, TSvgListenerType aType, TInt aEngine = NULL );
+
+ /**
+ * Remove a specific event listener from the engine
+ *
+ *@param : aListener, a listener type
+ *@return : none
+ */
+ IMPORT_C void RemoveListener( const MSvgListener* aListener, TSvgListenerType aType, TInt aEngine = NULL );
+
+ /**
+ * Request the given engine (or internal engine) to
+ * initialize from information in the svg-document attached
+ * to it (if any). This is used to setup the display information
+ * from the <svg> tag. Usually called from MSvgLoadingListener
+ * method when <svg> reached. If aEngine is NULL, then
+ * the internal engine is used.
+ *
+ * @since 1.0
+ * @param : aEngine -- svg engine to request initialization.
+ * A NULL value, by default, indicates to use the internal
+ * engine for initialization.
+ * @param : aIsMainThread -- indicates whether this call is
+ * made in the "main thread" or not, default to ETrue.
+ * @return : none
+ */
+ IMPORT_C void InitializeEngine( CSvgEngineImpl* aEngine = NULL,
+ TBool aIsMainThread = ETrue );
+
+ /**
+ * Set the timeout duration for fetching external data
+ * (Fetchimage calls). A value of zero,
+ * indicates no timeout (by default). This is designed mainly
+ * for SVGT Plugin.
+ * @param : aTimeoutSeconds --
+ */
+ IMPORT_C void SetDataRetrievalTimeOut( TUint aTimeoutSeconds, TInt aEngine = NULL );
+
+ /**
+ * Request canceling of parsing of the current document being
+ * parsed (through Load API). This API allows a different thread
+ * other than the loading thread to cancel a Load call.
+ * @since 1.0
+ */
+ IMPORT_C void CancelLoad( TInt aEngine = NULL );
+
+ /**
+ * Query wether a document is currently bieng parsed through
+ * the Load API. EFalse is returned when a document has completed
+ * parsing or CancelLoad has completed successfully.
+ * @since 1.0
+ */
+ IMPORT_C TBool IsLoading( TInt aEngine = NULL );
+
+ /**
+ * In _DEBUG mode all elements in the documents DOM will be printed out
+ * this method may be used in the future to regenerate the DOM tree
+ * could also be used as an encoder
+ *
+ *@param : aDocument
+ *@return : none
+ */
+ IMPORT_C void PrintAllElements( CSvgDocumentImpl* aDocument );
+
+ /**
+ * In _DEBUG mode print all of the values that are in the styles
+ * for the element
+ *
+ *@param : aElement
+ *@return : none
+ */
+ IMPORT_C void PrintElementsStyles( CSvgElementImpl* aElement );
+
+ /**
+ * Set to indicate whether the contents should be rendered
+ * or wait for all images in a content to be decoded, defaults
+ * to waiting for all images.
+ *
+ *@param : aBool -- indicates waiting for all images to finish
+ * decoding before drawing any content.
+ *@return : none
+ */
+ IMPORT_C void WaitForImages( TBool aBool = ETrue, TInt aEngine = NULL );
+
+ /**
+ * This API provides a delayed (asynchronous) assignment of image
+ * data to <image> elements. This is used when the clients
+ * returns a non-KErrNone value for FetchImage callback, so that
+ * FetchImage does not block the parsing thread.
+ *
+ *@param aUri- uri string that is passed by FetchImage,
+ * the URI of the image files.
+ *@param aData - byte array containing the image data to
+ * be decoded. This object will be managed (deleted)
+ * by svg-engine.
+ *@return none
+ */
+ IMPORT_C void AssignImageData( const TDesC& aUri, HBufC8* aData );
+
+ /**
+ * This API provides API for client to set RWindow so that svgengine
+ * is aware of the window that client is using. This will benefit
+ * video rendering.
+ *
+ *@param aWindow- RWindowBase that retrieve from CCoeControl to derived
+ * classes.
+ *@return none
+ */
+ IMPORT_C void SetClientWindow( RWindow* aWindow );
+
+ /**
+ * Method to output the currently loaded SVG content in standard SVG XML form
+ * or output a binary encoded version to a file
+ *@param aIsEncodeOn tell whether or not to output binary or standard SVG file.
+ *@return none
+ */
+ IMPORT_C void SaveSvg( TBool aIsEncodeOn, const TDesC& aFileName, TInt aEngine );
+
+ /**
+ * This method sets the volume with user input as a percentage
+ * value (unsigned between 0 and 100 )
+ *
+ * @since S60 3.1
+ * @param aPercentage percentage value of volume
+ * @return none
+ */
+ IMPORT_C void SetAudioVolume( TInt aPercentage , TInt aEngine = NULL);
+
+ /**
+ * This method mutes the volume of the SVG content
+ *
+ * @since S60 3.1
+ * @return none
+ */
+ IMPORT_C void MuteAudioVolume( TInt aEngine = NULL );
+
+ /**
+ * This API provides client the functionality to trigger focus-in
+ * event for a particular element
+ *
+ *
+ *@param aDocumentHandle- Pointer to the document of type SvgDocumentImpl
+ * aElement- Pointer to the element for which focus needs to be set
+ *
+ *@return none
+ */
+ IMPORT_C void DispatchFocusInEvent(CSvgDocumentImpl* aDocumentHandle,CSvgElementImpl *aElement);
+
+ /**
+ * This API provides client the functionality to trigger focus-in
+ * event for a particular element
+ *
+ *
+ *@param aDocumentHandle- Pointer to the document of type SvgDocumentImpl
+ * aElement- Pointer to the element for which focus needs to be set
+ *
+ *@return none
+ */
+ IMPORT_C void DispatchFocusOutEvent(CSvgDocumentImpl* aDocumentHandle,CSvgElementImpl *aElement);
+ IMPORT_C void ResetContext(TInt aEngine = NULL );
+
+
+ protected:
+ /**
+ * This method is a special case "ConstructL" method used for polymorphic
+ * DLL loading, which enforces this method to be public.
+ *
+ * @since 1.0
+ * @param : aFrameBuffer -- Bitmap to draw svg content.
+ * @param : aReqObserver -- Request observer called by svg engine.
+ * @return
+ */
+ IMPORT_C void ConstructL( CFbsBitmap* aFrameBuffer,
+ MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec );
+ //NGA :: ConstructL overload is added to include renderertype selector
+ IMPORT_C void ConstructL( CFbsBitmap* aFrameBuffer,
+ MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec ,SVGRendererId aRendererType );
+ /**
+ * This method is a special case "ConstructL" method used for polymorphic
+ * DLL loading, which enforces this method to be public.
+ *
+ * @since 1.0
+ *
+ * @return
+ */
+ IMPORT_C void ConstructL();
+ IMPORT_C void ConstructL(TFontSpec& aFontSpec);
+
+ private:
+
+ /**
+ * Adds a text element to display the frames per second if isShowOn = true
+ *
+ *@param : isShowOn specified whether or not to display fps
+ *@return : frames per second in the engine
+ */
+ TReal FramesPerSecondL( TInt aEngine = NULL );
+
+
+ /**
+ * Get the current focus object's bounding box.
+ *
+ * @since 1.0
+ * @param ETrue - Get the next object
+ * @param EFalse - Get the previous object
+ * @return
+ */
+ TRect GetFocusBbox(TBool aNextObject, TInt aEngine = NULL );
+
+ /**
+ * Checks whether the Handle is associated with a DOM
+ *
+ * @param : aHandle -- Handle to a DOM.
+ * @return: TBool boolean
+ */
+ TBool IsDomCached(TInt aHandle);
+
+ /**
+ * Request the SVG Engine to resume an animation after certain amount of time
+ *
+ * @since 1.0
+ * @param : none
+ * @return : none
+ */
+ void Resume(TInt32 aTime, TInt aEngine = NULL);
+
+ /**
+ * Utility function to clean-up after loading a file -- mainly,
+ * removing the prepared dom from Dom-list, since it's loaded and
+ * more prepared.
+ *
+ * @since 1.0
+ * @param : aDocumentHandle -- document info to handle clean up
+ * @return : none
+ */
+ void PostLoadProcessing( TInt aDocumentHandle );
+
+ //
+ /**
+ * ImageLoadingObserver interface method.
+ * Called from Image loading class to notify image loading
+ * completion.
+ *
+ * @since 1.0
+ * @param : aErrorStatus -- error status, if any
+ * @return : none
+ */
+ void ImageLoadingCompleted( TInt aErrorStatus );
+
+ /******* DOM FUNCTIONALITY / ELEMENT TRAVERSAL INTERFACE *****/
+ /**
+ * Returns the first child element node of this element. null if this element has no child elements
+ *
+ * @since 1.2
+ * @param aParentElement - a handle to a parent element
+ * @return a handle to the first child of the parent element
+ */
+ CSvgElementImpl* FirstElementChild(CSvgElementImpl* aParentElement);
+
+ /**
+ * last child element node of this element. null if this element has no child elements
+ *
+ * @since 1.2
+ * @param aParentElement - a handle to a parent element
+ * @return a handle to the first child of the parent element
+ */
+ //
+ CSvgElementImpl* LastElementChild(CSvgElementImpl* aParentElement);
+
+ /**
+ * Returns the next sibling element node of this element. null if this element has no element sibling nodes that come after this one in the document tree
+ *
+ * @since 1.2
+ * @param aSiblingElement - a handle to a sibling element
+ * @return a handle to the sibling before the sibling passed in
+ */
+ CSvgElementImpl* PreviousElementSibling(CSvgElementImpl* aSiblingElement);
+
+ /**
+ * previous sibling element node of this element. null if this element has no element sibling nodes that come before this one in the document tree.
+ *
+ * @since 1.2
+ * @param aParentElement - a handle to a sibling element
+ * @return a handle to the next sibling of the parameter element
+ */
+ CSvgElementImpl* NextElementSibling(CSvgElementImpl* aSiblingElement);
+
+ /**
+ * Return whether the two given bitmaps are the same.
+ *
+ * @since 1.0
+ * @param : aBitmapA -- Bitmap A
+ * @param : aBitmapB -- Bitmap B
+ * @return : ETrue both bitmaps are the same.
+ */
+ TBool AreBitmapsTheSame( CFbsBitmap& aBitmapA, CFbsBitmap& aBitmapB );
+
+ /**
+ * Create a new CFbsBitmap object with the specific size and color mode.
+ *
+ * @since 1.0
+ * @param : aSize -- size of bitmap to create
+ * @param : aColorMode : Color mode to create bitmap
+ * @param : aError : Error object to hold error info, if an error occurs
+ * @return : Non-Null CFbsBitmap object if no error was encounter
+ */
+ CFbsBitmap* CreateBitmapL( TSize aSize, TDisplayMode aColorMode,
+ CSvgErrorImpl& aError );
+
+
+ /**
+ * This mathod restores some style properties back to the
+ * original value of the animatied elements' iSvgStyleProperties.
+ *
+ * @since S60 3.0
+ * @return none
+ */
+ void RestoreAnimStyleProperties( TInt aEngine = NULL );
+
+ CSvgEngineImpl* ChooseEngine( TInt aEngine );
+
+ //Utility method to write out the current SVG engine framebuffer to a file
+ void ConvertBitmapToFileL(CFbsBitmap* aBitmap, const TDesC& aText);
+
+ protected:
+ // Current SvgEngine instance
+ CSvgEngineImpl* iSvgEngine;
+ // Current iSvgDocument through Load( ) method
+ CSvgDocumentImpl* iSvgLoadedDocument;
+
+ // Flag to indicate if a content is present, to perform or
+ // ignore operations.
+ TBool iFileIsLoaded;
+
+
+ // Error object to pass back to clients, maintained by this object.
+ CSvgErrorImpl* iSvgError;
+
+ // List of prepared DOMs (created by PrepareDom).
+ // Deleted by destructor or calling DeleteDom.
+ RPointerArray<CSvgDocumentImpl> iSvgDocumentPointers;
+ RPointerArray<CSvgEngineImpl> iSvgEnginePointers;
+
+ // Keeping track of rotation applied.
+ TReal32 iTotalRotation;
+
+ public:
+
+ IMPORT_C void Start(MSvgError*& aError, const TDesC8* aHeaderData ,
+ CSvgEngineImpl* aEngine = NULL );
+
+ IMPORT_C void Start( const TDesC8* aHeaderData, CSvgEngineImpl* aEngine = NULL,
+ TBool aIsMainThread = ETrue);
+ private:
+ // DRM related
+ TBool iDrmEnabled;
+
+ // Thumbnail mode
+ TBool iIsThumbNailMode;
+
+ // DRM Rights consumption
+ TBool iDrmRightsConsumptionEnabled;
+
+ // MSvgLoadingListener list
+ RPointerArray<MSvgLoadingListener> iSvgLoadingListeners;
+
+ // Keep track of elements currently having mouse pointer inside
+ // to report mouse-exit when it is moved.
+ RPointerArray<CSvgElementImpl> iSvgMouseEnteredElements;
+
+ // Flag to indicate Load or PrepareDom call.
+ TBool iIsLoadingRequest;
+
+ TBool iMouseDownFlag;
+
+ //Stores Font Type information
+ CSvgBitmapFontProvider *iSvgBitmapFontProvider;
+ };
+
+#endif // SVGENGINEINTERFACEIMPL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgt_plat/svgt_api/inc/SVGErrorImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,188 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine header file
+ *
+*/
+
+
+#ifndef SVGERROR_H
+#define SVGERROR_H
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include "SVGEngineInterfaceImpl.h"
+
+/**
+ * This class implements the interface for a MSvgError object, which contains
+ * an error code and a description of the error if one exists.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgErrorImpl : public CBase, public MSvgError
+ {
+ public:
+
+ /**
+ * Two-phase constructor. The default error code is ESvgNoError and description is
+ * "No Error"
+ *
+ * @since 1.0
+ * @return : CSvgErrorImpl object
+ */
+ static CSvgErrorImpl* NewL();
+
+ /**
+ * Two-phase constructor. The default error code is ESvgNoError and description is
+ * "No Error"
+ *
+ * @since 1.0
+ * @return : CSvgErrorImpl object
+ */
+ static CSvgErrorImpl* NewLC();
+
+ /**
+ * Destructor
+ */
+ virtual ~CSvgErrorImpl();
+
+ /**
+ * Determine wether an error is indicated by this object.
+ *
+ * @since 1.0
+ * @return : ETrue, if ErrorCode() != ESvgNoError
+ */
+ TBool HasError();
+
+ /**
+ * Determine wether an error is only a warning.
+ * This should be a state when the svg may be display, despite
+ * a conflict.
+ *
+ * @since 1.0
+ * @return ETrue if HasError() is only a warning.
+ */
+ TBool IsWarning();
+
+ /**
+ * Set the flag to indicate the error indicated by this object
+ * is only a warning.
+ *
+ * @since 1.0
+ * @return ETrue if HasError() is only a warning.
+ */
+
+ void SetIsWarning( TBool aBool );
+
+ /**
+ * Get the error code contained by this object.
+ *
+ * @since 1.0
+ * @return : the TSvgErrorCode value
+ */
+ TSvgErrorCode ErrorCode();
+
+ /**
+ * Get the error code contained by this object.
+ *
+ * @since 1.0
+ * @return : the TSvgErrorCode value
+ */
+ TInt SystemErrorCode();
+
+ /**
+ * Get the error description string for this object.
+ *
+ * @since 1.0
+ * @return : error description string.
+ */
+ TDesC& Description();
+
+ /**
+ * Set the error code.
+ *
+ * @since 1.0
+ * @param aError : error code
+ * @return
+ */
+ void SetErrorCode( TSvgErrorCode aError );
+
+ /**
+ * Set the error code.
+ *
+ * @since 1.0
+ * @param aError : error code
+ * @return
+ */
+ void SetSystemErrorCode( TInt aError );
+
+ /**
+ * Set the error description.
+ *
+ * @since 1.0
+ * @param aDescription : error description string
+ * @return
+ */
+ void SetDescription( const TDesC& aDescription );
+
+ /**
+ * Set the error description.
+ *
+ * @since 1.0
+ * @param aText1 : error description string 1
+ * @param aText2 : error description string 2
+ * @return
+ */
+ void SetDescription( const TDesC& aText1, const TDesC& aText2 );
+
+ /**
+ * Append the given text to the existing description .
+ *
+ * @since 1.0
+ * @param aDescription : error description string
+ * @param aText2 : error description string 2
+ * @return
+ */
+ void AppendDescription( const TDesC& aDescription );
+
+
+ protected:
+ /**
+ * Second phase of constructor
+ *
+ * @since 1.0
+ */
+ void ConstructL();
+
+ private:
+
+ /**
+ * Constructor. The default error code is ESvgNoError and description is
+ * "No Error"
+ *
+ * @since 1.0
+ */
+ CSvgErrorImpl();
+
+ private:
+ TSvgErrorCode iErrorCode;
+ HBufC* iDescription;
+ TBool iIsWarning;
+ TInt iSystemErrorCode;
+ };
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgt_plat/svgt_api/inc/SVGHyperlinkListener.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine header file
+ *
+*/
+
+
+#ifndef __INC_MSVGHYPERLINKLISTENER__
+#define __INC_MSVGHYPERLINKLISTENER__
+
+
+/**
+ * This interface is the callback mechanism for the SVG Engine to communicate to
+ * interested clients about hyperlinks. The client (listener) is notified when
+ * a pointer has entered or exited a hyperlink and when a hyperlink is activated.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class MSvgHyperlinkListener
+ {
+ public:
+
+ /**
+ * Notified when a pointer enters a hyperlink element.
+ *
+ * @since 1.0
+ * @param : aUri -- URI string of hyperlink
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool LinkEntered( const TDesC& aUri ) = 0;
+
+ /**
+ * Notified when a pointer exits a hyperlink element.
+ *
+ * @since 1.0
+ * @param : aUri -- URI string of hyperlink
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool LinkExited( const TDesC& aUri ) = 0;
+
+ /**
+ * This method is called to notify the client that a link has been
+ * activated.
+ *
+ * @since 1.0
+ * @param : aUri -- URI string of hyperlink
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool LinkActivated( const TDesC& aUri ) = 0;
+
+ /**
+ * This method is called to notify the client that a link has been
+ * activated. When Show is also present .
+ *
+ * @since 1.0
+ * @param : aUri -- URI string of hyperlink
+ * @param : aShow -- xlink:show value
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool LinkActivatedWithShow( const TDesC& aUri, const TDesC& aShow ) = 0;
+
+ };
+
+#endif /*__INC_MSVGHYPERLINKLISTENER__*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgt_plat/svgt_api/inc/SVGImageLoadingObserver.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Image loading observe rinterface
+ *
+*/
+
+
+#ifndef _INC_CSVGIMAGELOADINGOBSERVER_
+#define _INC_CSVGIMAGELOADINGOBSERVER_
+
+/**
+ * Helping interface used as callback for image loading.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class MSVGImageLoadingObserver
+ {
+ public:
+ /**
+ * This method is called by the CSVGImageLoaderUtil object after
+ * a request (RequestForImageL) to load an image is made.
+ * The possible values for aErrorStatus include:
+ * KErrNone = no errors,
+ * KErrCancel = loading of image has been canceled
+ *
+ * @since 1.0
+ * @param aErrorStatus : error status if any.
+ * @return
+ */
+ virtual void ImageLoadingCompleted( TInt aErrorStatus ) = 0;
+ };
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgt_plat/svgt_api/inc/SVGRendererId.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine header file
+ *
+*/
+
+#ifndef SVGRENDERERID_H
+#define SVGRENDERERID_H
+
+enum SVGRendererId
+ {
+ ESVGRendererSW = 1,
+ ESVGRendererHW = 2,
+ ESVGRendererTLV = 3
+ };
+
+#endif /* SVGRENDERERID_H */
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgt_plat/svgt_api/inc/SVGRequestObserver.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine header file
+ *
+*/
+
+
+#ifndef __INC_MSVGREQUESTOBSERVER__
+#define __INC_MSVGREQUESTOBSERVER__
+
+
+class CSvgElementImpl;
+
+
+/**
+ * This interface is the callback mechanism for the SVG Engine to communicate to
+ * interested clients and to request for external data, such as images.
+ * The callbacks will be active when the methods of this interace are implemented and
+ * the pointer to the implementation object is passed in as the second parameter
+ * of the 'ConstructL' method of the CSvgEngineInterface. A 'null' value may be
+ * passed-in if the callbacks are to be ignored.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class MSvgRequestObserver
+ {
+ public:
+
+ /**
+ * This method is called by the SVG Engine when all data for a certain
+ * step, such as animation frame, have been updated. This usually means
+ * the off-screen image (passed in to 'ConstructL' of CSvgEngineInterface)
+ * has been updated. The client usually redraws the image onto
+ * the screen.
+ *
+ * @since 1.0
+ * @param : none
+ * @return : none
+ */
+ virtual void UpdateScreen() = 0;
+
+ /**
+ * This method is for future extension, in which an external script engine
+ * could be used to evaluate a script description.
+ *
+ * @since 1.0
+ * @param : aScript -- A description of script from the "on" attribute.
+ *
+ * @param : aCallerElement -- The element that calls the script by a
+ * an event of the "on" attribute.
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool ScriptCall( const TDesC& aScript,
+ CSvgElementImpl* aCallerElement ) = 0;
+
+ /**
+ * This method is called to retrieve the file handle of an image name.
+ * The session (RFs) object passed in is guaranteed to be connected, so
+ * the client must NOT call aSession.Connect().
+ *
+ * The implementation for the client of this method is usually if not always:
+ * TInt X::FetchImage( const TDesC& aFilename, RFs& aSession, RFile& aFileHandle )
+ * {
+ * // Check for "http", get data from remote site, save to disk
+ * // Get absolute path to aFilename: absolutepath
+ * return aFileHandle.Open( aSession, absolutepath, EFileRead );
+ * }
+ *
+ * Note: Use EFileShareReadersOnly to prevent file locking.
+ *
+ * The API AssignImageData() can be used to avoid block the parsing
+ * thread due this method taking too long to return. This is
+ * accomplished by returning a non-KErrNone value (i.e. KErrNotFound),
+ * and storing the URI parameter. The image data then could be
+ * assigned the the URI in another thread/Active-Object.
+ *
+ * @since 1.0
+ * @param : aUri -- the relative path of an image file.
+ * @param : aSession -- File session used by client to open file.
+ * @param : aFileHandle -- File handle used by client to open file.
+ * @return : KErrNone if Open command successful, otherwise error-code
+ * from Open command. The SVG engine will proceed loading the file
+ * only if the return value is KErrNone.
+ */
+ virtual TInt FetchImage( const TDesC& aUri, RFs& aSession, RFile& aFileHandle ) = 0;
+
+ /**
+ * This method is called to retrieve the file handle of an svg font file.
+ * This file must be SVG 1.1 .svg file. When the engine comes acrossed
+ * a font-family name that it doesnt know it will request "fontfamilyname".svg
+ * file through this method. The client can either provide the svg file
+ * or the engine will default to system text.
+ *
+ * The usage of this method is exactly the same as the FetchImage method above
+ *
+ * @since 1.0
+ * @param : aUri -- the relative path of an image file.
+ * @param : aSession -- File session used by client to open file.
+ * @param : aFileHandle -- File handle used by client to open file.
+ * @return : KErrNone if Open command successful, otherwise error-code
+ * from Open command. The SVG engine will proceed loading the file
+ * only if the return value is KErrNone.
+ */
+ virtual TInt FetchFont( const TDesC& aUri, RFs& aSession, RFile& aFileHandle ) = 0;
+
+ /**
+ * This Method updates the presentation status
+ * @since 1.0
+ * @param : TInt32& aNoOfAnimation
+ * @return :
+ */
+ virtual void UpdatePresentation(const TInt32& aNoOfAnimation)=0;
+
+
+ };
+
+#endif /*__INC_MSvgRequestObserver__*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgt_plat/svgt_api/inc/SvgJavaInterfaceImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,2673 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine header file
+ *
+*/
+
+
+ #ifndef _INC_SVGJAVAINTERFACEIMPL_
+ #define _INC_SVGJAVAINTERFACEIMPL_
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include <SVGEngineInterfaceImpl.h>
+#include <SVGListener.h>
+
+typedef int SvgEngineHandle;
+typedef int SvgDocumentHandle;
+typedef int SvgElementHandle;
+typedef int SvgSurfaceHandle;
+typedef int SvgPathHandle;
+typedef short SvgAttrType;
+
+class CSvgEngineImpl;
+class CSvgDocumentImpl;
+class CFbsBitmap;
+
+// ***************************************************/
+//Find a way to get these values from SvgEngine and defined here in JavaInterface.
+const TInt KSvgUnknownElement = -1;
+
+const TInt KSvgSvgElement = 0;
+
+const TInt KSvgAltglyphElement = 1;
+const TInt KSvgAltglyphdefElement = 2;
+
+const TInt KSvgDefsElement = 3;
+const TInt KSvgDescElement = 4;
+
+const TInt KSvgMetadataElement = 6;
+const TInt KSvgTitleElement = 7;
+
+const TInt KSvgFontfacenameElement = 8;
+const TInt KSvgFontfacesrcElement = 9;
+const TInt KSvgFontfaceuriElement = 10;
+const TInt KSvgGElement = 11;
+const TInt KSvgGlyphrefElement = 12;
+const TInt KSvgVkernElement = 13;
+// const TInt KSvgScriptElement = 14;
+const TInt KSvgSwitchElement = 15;
+
+const TInt KSvgViewElement = 16;
+
+const TInt KSvgHkernElement = 17;
+
+const TInt KSvgAElement = 18;
+const TInt KSvgFontElement = 19;
+const TInt KSvgFontfaceElement = 20;
+const TInt KSvgGlyphElement = 21;
+const TInt KSvgImageElement = 22;
+const TInt KSvgMissingglyphElement = 23;
+const TInt KSvgStyleElement = 24;
+const TInt KSvgTextElement = 25;
+const TInt KSvgUseElement = 26;
+const TInt KSvgCircleElement = 27;
+const TInt KSvgEllipseElement = 28;
+const TInt KSvgLineElement = 29;
+const TInt KSvgPathElement = 30;
+const TInt KSvgPolygonElement = 31;
+const TInt KSvgPolylineElement = 32;
+const TInt KSvgRectElement = 33;
+const TInt KSvgAnimateElement = 34;
+const TInt KSvgAnimateColorElement = 35;
+const TInt KSvgAnimateMotionElement = 36;
+const TInt KSvgAnimateTransformElement = 37;
+const TInt KSvgSetElement = 38;
+const TInt KSvgMpathElement = 39;
+const TInt KSvgLinearGradientElement = 40;
+const TInt KSvgRadialGradientElement = 41;
+const TInt KSvgStopElement = 42;
+const TInt KSvgScriptElement = 43;
+const TInt KSvgTextAreaElement = 44;
+const TInt KSvgDiscardElement = 45;
+const TInt KSvgSolidColorElement = 46;
+const TInt KSvgAnimationElement = 47;
+const TInt KSvgVideoElement = 48;
+const TInt KSvgForeignObjectElement = 49;
+
+
+/*************************************************/
+/*************************************************/
+ const TInt KSvgUnknownAttribute = -1;
+ const TUint16 KSvgOffset =25;
+ //AA: Length or number type: range is 0 to +max & set using SetAttributeFloatL
+ const TUint16 KAtrTextLength = 0 + KSvgOffset;
+ const TUint16 KAtrWidth = 1 + KSvgOffset;
+ const TUint16 KAtrHeight = 2 + KSvgOffset;
+ const TUint16 KAtrR = 3 + KSvgOffset ;
+
+
+
+ const TUint8 KSvgCoordAttrStartIndex = 4 + KSvgOffset;
+ const TUint16 KAtrRx = 4 + KSvgOffset;
+ const TUint16 KAtrRy = 5 + KSvgOffset;
+ const TUint16 KAtrHorizAdvX = 6 + KSvgOffset;
+ const TUint16 KAtrHorizOriginX = 7 + KSvgOffset;
+ const TUint16 KAtrHorizOriginY = 8 + KSvgOffset;
+ const TUint16 KAtrAscent = 9 + KSvgOffset;
+ const TUint16 KAtrDescent = 10 + KSvgOffset;
+
+ const TUint16 KAtrAlphabetic = 11 + KSvgOffset;
+ const TUint16 KAtrUnderlinePosition = 12 + KSvgOffset;
+ const TUint16 KAtrUnderlineThickness = 13 + KSvgOffset;
+ const TUint16 KAtrOverlinePosition = 14 + KSvgOffset;
+ const TUint16 KAtrOverlineThickness = 15 + KSvgOffset;
+ const TUint16 KAtrStrikethroughPosition = 16 + KSvgOffset;
+ const TUint16 KAtrStrikethroughThickness = 17 + KSvgOffset;
+ const TUint16 KAtrUnitsPerEm = 18 + KSvgOffset;
+
+ const TUint16 KAtrWordSpacing = 19 + KSvgOffset;
+ const TUint16 KAtrLetterSpacing = 20 + KSvgOffset;
+
+
+
+ //AA: Coordinate datatype: range is -max to +max & set using SetAttributeFloatL
+ const TUint16 KAtrCx = 21 + KSvgOffset;
+ const TUint16 KAtrCy = 22 + KSvgOffset;
+ const TUint16 KAtrY = 23 + KSvgOffset;
+ const TUint16 KAtrX = 24 + KSvgOffset;
+ const TUint16 KAtrY1 = 25 + KSvgOffset;
+ const TUint16 KAtrY2 = 26 + KSvgOffset;
+ const TUint16 KAtrX1 = 27 + KSvgOffset;
+ const TUint16 KAtrX2 = 28 + KSvgOffset;
+
+ const TUint8 KSvgCoordAttrEndIndex = 28 + KSvgOffset;
+ const TUint8 KSvgDesAttrsIndex = 29 + KSvgOffset;
+
+
+ //AA: Descriptor type set using SetAttributeDesL
+ const TUint16 KAtrK = 29 + KSvgOffset;
+ const TUint8 KSvgFloatAttrEndIndex = 29 + KSvgOffset;
+ const TUint16 KAtrG1 = 30 + KSvgOffset;
+ const TUint16 KAtrG2 = 31 + KSvgOffset;
+ const TUint16 KAtrU1 = 32 + KSvgOffset;
+ const TUint16 KAtrU2 = 33 + KSvgOffset;
+ const TUint16 KAtrUnicode = 34 + KSvgOffset;
+ const TUint16 KAtrGlyphName = 35 + KSvgOffset;
+ const TUint16 KAtrLang = 36 + KSvgOffset;
+ const TUint8 KSvgDesAttrEndIndex = 36 + KSvgOffset;
+
+ const TUint16 KAtrTextDecoration = 37 + KSvgOffset;
+ const TUint16 KAtrTextAnchor = 38 + KSvgOffset;
+ const TUint16 KAtrRotate = 39 + KSvgOffset;
+ const TUint16 KAtrCdata = 40 + KSvgOffset;
+
+
+
+
+ const TUint16 KAtrTransform = 41 + KSvgOffset;
+ const TUint16 KAtrStyle = 42 + KSvgOffset;
+ const TUint16 KAtrFill = 43 + KSvgOffset;
+ const TUint16 KAtrStroke = 44 + KSvgOffset;
+ const TUint16 KAtrColor = 45 + KSvgOffset;
+ const TUint16 KAtrFrom = 46 + KSvgOffset;
+ const TUint16 KAtrTo = 47 + KSvgOffset;
+ const TUint16 KAtrBy = 48 + KSvgOffset;
+ const TUint16 KAtrAttributeName = 49 + KSvgOffset;
+
+
+
+ const TUint8 KSvgNotHandledAttrsIndex = 50 + KSvgOffset;
+
+ const TUint16 KAtrPathLength = 50 + KSvgOffset;
+ const TUint16 KAtrVersion = 51 + KSvgOffset;
+ const TUint16 KAtrStrokeWidth = 52 + KSvgOffset;
+ const TUint16 KAtrPoints = 53 + KSvgOffset;
+ const TUint16 KAtrD = 54 + KSvgOffset;
+ const TUint16 KAtrType = 55 + KSvgOffset;
+ const TUint16 KAtrStopColor = 56 + KSvgOffset;
+ const TUint16 KAtrFx = 57 + KSvgOffset;
+ const TUint16 KAtrFy = 58 + KSvgOffset;
+
+ const TUint16 KAtrOffset = 59+ KSvgOffset;
+ const TUint16 KAtrSpreadMethods = 60 + KSvgOffset;
+ const TUint16 KAtrGradientUnits = 61 + KSvgOffset;
+ const TUint16 KAtrStopOpacity = 62 + KSvgOffset;
+
+
+
+
+// special attributes for encoding
+ const TUint16 KAtrViewBox = 63 + KSvgOffset;
+ const TUint16 KAtrBaseProfile = 64 + KSvgOffset;
+ const TUint16 KAtrZoomAndPan = 65 + KSvgOffset;
+ const TUint16 KAtrPreserveAspectRatio = 66 + KSvgOffset;
+
+ const TUint8 KSvgSVGAttrEndIndex = KAtrPreserveAspectRatio;
+
+ const TUint16 KAtrId = 67 + KSvgOffset;
+ const TUint16 KAtrXmlBase = 68 + KSvgOffset;
+
+ const TUint8 KSvgIdAndXmlAttrEndIndex = 68 + KSvgOffset;
+
+ const TUint16 KAtrXmlLang = 69 + KSvgOffset;
+ const TUint16 KAtrXmlSpace = 70 + KSvgOffset;
+
+ const TUint8 KSvgLangAttrEndIndex = 70 + KSvgOffset;
+
+ const TUint16 KAtrRequiredExtensions = 71 + KSvgOffset;
+ const TUint16 KAtrRequiredFeatures = 72 + KSvgOffset;
+ const TUint16 KAtrSystemLanguage = 73 + KSvgOffset;
+
+ const TUint8 KSvgTestAttrEndIndex = 73 + KSvgOffset;
+
+ const TUint16 KAtrDx = 74 + KSvgOffset;
+ const TUint16 KAtrDy = 75 + KSvgOffset;
+ const TUint16 KAtrMedia = 76 + KSvgOffset;
+ const TUint16 KAtrTitle = 77 + KSvgOffset;
+
+ const TUint16 KAtrXlinkactuate = 78 + KSvgOffset;
+ const TUint16 KAtrXlinkarcrole = 79 + KSvgOffset;
+
+ const TUint16 KAtrXlinkrole = 80 + KSvgOffset;
+ const TUint16 KAtrXlinkshow = 81 + KSvgOffset;
+ const TUint16 KAtrXlinktitle = 82 + KSvgOffset;
+ const TUint16 KAtrXlinktype = 83 + KSvgOffset;
+ const TUint16 KAtrXlinkhref = 84 + KSvgOffset;
+
+ const TUint8 KSvgUriAttrEndIndex = 84 + KSvgOffset;
+
+ const TUint16 KAtrBegin = 85 + KSvgOffset;
+ const TUint16 KAtrDur = 86 + KSvgOffset;
+ const TUint16 KAtrRepeatCount = 87 + KSvgOffset;
+ const TUint16 KAtrRepeatDur = 88 + KSvgOffset;
+ const TUint16 KAtrEnd = 89 + KSvgOffset;
+ const TUint16 KAtrRestart = 90 + KSvgOffset;
+ const TUint16 KAtrAccumulate = 91 + KSvgOffset;
+ const TUint16 KAtrAdditive = 92 + KSvgOffset;
+ const TUint16 KAtrKeySplines = 93 + KSvgOffset;
+ const TUint16 KAtrKeyTimes = 94 + KSvgOffset;
+ const TUint16 KAtrCalcMode = 95 + KSvgOffset;
+ const TUint16 KAtrPath = 96 + KSvgOffset;
+ const TUint16 KAtrAnimateMotion = 97 + KSvgOffset;
+ const TUint16 KAtrGradientTransform = 98 + KSvgOffset;
+ const TUint16 KAtrAnimateTransformAttrId = 99 + KSvgOffset;
+ const TUint16 KAtrTarget = 100 + KSvgOffset;
+
+
+
+#define KSVG_MAX_ATTRIBUTES KAtrTarget
+#define KSVG_ATTRIBUTE_NOT_SUPPORTED KSVG_MAX_ATTRIBUTES+1
+
+ // special Ids for Animation attribute Values
+
+ const TUint16 KAnimFreeze = 110 + KSvgOffset;
+
+ // special Id for Embedded image XLink:href attribute .
+
+ const TUint16 KXlinkhrefImageEmbedded = 111 + KSvgOffset;
+
+// special Id for multiple end times.Used for the Binary compatibility of the encoder
+
+ const TUint16 KMultipleEndTime = 112 + KSvgOffset;
+
+
+
+ #define KSVG_ANIMATE_ELEMFLAG KAtrAttributeName
+ #define KSVG_SET_ELEMFLAG KAtrAttributeName
+ #define KSVG_ANIMATETRANSFORM_ELEMFLAG KAtrSVGTrf
+ #define KSVG_CIRCLE_ELEMFLAG KAtrR
+ #define KSVG_ELLIPSE_ELEMFLAG KAtrSVGElp
+ #define KSVG_RECT_ELEMFLAG KAtrSVGRec
+ #define KSVG_IMAGE_ELEMFLAG KAtrSVGRec
+ #define KSVG_HKERN_ELEMFLAG KAtrK
+ #define KSVG_PATH_ELEMFLAG KAtrD
+ #define KSVG_POLYLINE_ELEMFLAG KAtrPoints
+ #define KSVG_AMINATEMO_ELEMFLAG KAtrSVGAmo
+
+ const TUint16 KAtrSVGRec = 120 + KSvgOffset;
+ const TUint16 KAtrSVGElp = 121 + KSvgOffset;
+ const TUint16 KAtrSVGTrf = 122 + KSvgOffset;
+ const TUint16 KAtrSVGAmo = 123 + KSvgOffset;
+ const TUint16 KAtrToBy = 124 + KSvgOffset;
+ const TUint16 KAtrAdditiveSet = 125 + KSvgOffset;
+
+
+
+const TUint16 KTiny = 0;
+
+// Display Enumeration Constants. take care
+const TUint KDisplayEnumNone = 16;
+const TUint KPresentationAttrDisplay = 10;
+
+const TUint16 KAtrUnicodeRange = 135 + KSvgOffset;
+const TUint16 KAtrValues = 138 + KSvgOffset;
+
+
+// SPECIAL (APPLICATION DEFINED) ATTRIBUTE CONSTANTS
+const TUint16 KAtrData = KAtrD; // So KAtrData can still be used
+const TUint16 KAtrRadius = KAtrR; // So KAtrRadius can still be used
+
+const TUint16 KAtrRefX = 1001;
+const TUint16 KAtrRefY = 1002;
+const TUint16 KAtrAnimMotionMatrixIndex = 5000;
+const TUint16 KAtrAnimTransformMatrixIndex = 5001;
+
+const TInt KErrReferencedElementNotFound = -1000;
+const TInt KErrAnimateReferenceElementNotFound = -1001;
+
+// start of new element in encoding.
+const TUint16 KStartNewElem = 1000;
+
+// SVG TINY DEFINED ENUMERATIONS
+const TUint16 KEnumPercent = 0; // '%' sign
+const TUint16 KEnum100 = 1;
+const TUint16 KEnum200 = 2;
+const TUint16 KEnum300 = 3;
+const TUint16 KEnum400 = 4;
+const TUint16 KEnum500 = 5;
+const TUint16 KEnum600 = 6;
+const TUint16 KEnum700 = 7;
+const TUint16 KEnum800 = 8;
+const TUint16 KEnum900 = 9;
+const TUint16 KEnumAlways = 10;
+const TUint16 KEnumAuto = 11;
+const TUint16 KEnumBevel = 12;
+const TUint16 KEnumBlink = 13;
+const TUint16 KEnumBlock = 14;
+const TUint16 KEnumBold = 15;
+const TUint16 KEnumBolder = 16;
+const TUint16 KEnumButt = 17;
+const TUint16 KEnumCdata = 18;
+const TUint16 KEnumCm = 19;
+const TUint16 KEnumCompact = 20;
+const TUint16 KEnumCondensed = 21;
+const TUint16 KEnumCss = 22;
+const TUint16 KEnumDasharray = 23;
+const TUint16 KEnumDisable = 24;
+const TUint16 KEnumDiscrete = 25;
+const TUint16 KEnumEnd = 26;
+const TUint16 KEnumEvenodd = 27;
+const TUint16 KEnumExpanded = 28;
+const TUint16 KEnumExtraCondensed = 29;
+const TUint16 KEnumExtraExpanded = 30;
+const TUint16 KEnumFreeze = 31;
+const TUint16 KEnumHidden = 32;
+const TUint16 KEnumIn = 33;
+const TUint16 KEnumInherit = 34;
+const TUint16 KEnumInline = 35;
+const TUint16 KEnumInlineTable = 36;
+const TUint16 KEnumInterger = 37;
+const TUint16 KEnumItalic = 38;
+const TUint16 KEnumLenght = 39;
+const TUint16 KEnumLighter = 40;
+const TUint16 KEnumLinear = 41;
+const TUint16 KEnumLineThrough = 42;
+const TUint16 KEnumListItem = 43;
+const TUint16 KEnumMagnify = 44;
+const TUint16 KEnumMarker = 45;
+const TUint16 KEnumMiddle = 46;
+const TUint16 KEnumMiter = 47;
+const TUint16 KEnumMm = 48;
+const TUint16 KEnumNarrower = 49;
+const TUint16 KEnumNever = 50;
+const TUint16 KEnumNone = 51;
+const TUint16 KEnumNonzero = 52;
+const TUint16 KEnumNormal = 53;
+const TUint16 KEnumOblique = 54;
+const TUint16 KEnumOverline = 55;
+const TUint16 KEnumPaced = 56;
+const TUint16 KEnumPc = 57;
+const TUint16 KEnumPt = 58;
+const TUint16 KEnumPx = 59;
+const TUint16 KEnumRemove = 60;
+const TUint16 KEnumReplace = 61;
+const TUint16 KEnumRotate = 62;
+const TUint16 KEnumRound = 63;
+const TUint16 KEnumRunIn = 64;
+const TUint16 KEnumScale = 65;
+const TUint16 KEnumSemiCondensed = 66;
+const TUint16 KEnumSemiExpanded = 67;
+const TUint16 KEnumSkewX = 68;
+const TUint16 KEnumSkewY = 69;
+const TUint16 KEnumSpline = 70;
+const TUint16 KEnumSquare = 71;
+const TUint16 KEnumStart = 72;
+const TUint16 KEnumSum = 73;
+const TUint16 KEnumTable = 74;
+const TUint16 KEnumTableCaption = 75;
+const TUint16 KEnumTableCell = 76;
+const TUint16 KEnumTableColumn = 77;
+const TUint16 KEnumTableColumnGroup = 78;
+const TUint16 KEnumTableFooterGroup = 79;
+const TUint16 KEnumTableHeaderGroup = 80;
+const TUint16 KEnumTableRow = 81;
+const TUint16 KEnumTableRowGroup = 82;
+const TUint16 KEnumTranslate = 83;
+const TUint16 KEnumUltraCondensed = 84;
+const TUint16 KEnumUltraExpanded = 85;
+const TUint16 KEnumUnderline = 86;
+const TUint16 KEnumVisible = 87;
+const TUint16 KEnumWhenNotActive = 88;
+const TUint16 KEnumWider = 89;
+const TUint16 KEnumXMaxYMax = 90;
+const TUint16 KEnumXMaxYMid = 91;
+const TUint16 KEnumXMaxYMin = 92;
+const TUint16 KEnumXMidYMax = 93;
+const TUint16 KEnumXMidYMid = 94;
+const TUint16 KEnumXMidYMin = 95;
+const TUint16 KEnumXMinYMax = 96;
+const TUint16 KEnumXMinYMid = 97;
+const TUint16 KEnumXMinYMin = 98;
+const TUint16 KEnumXml = 99;
+
+
+#define KCSS_ATTR_FILL 0
+#define KCSS_ATTR_STROKE 1
+#define KCSS_ATTR_STROKEWIDTH 2
+#define KCSS_ATTR_VISIBILITY 3
+#define KCSS_ATTR_FONTFAMILY 4
+#define KCSS_ATTR_FONTSIZE 5
+#define KCSS_ATTR_FONTSTYLE 6
+#define KCSS_ATTR_FONTWEIGHT 7
+#define KCSS_ATTR_STROKE_DASHARRAY 8
+#define KCSS_ATTR_DISPLAY 9
+#define KCSS_ATTR_FILLRULE 10
+#define KCSS_ATTR_STROKE_LINECAP 11
+#define KCSS_ATTR_STROKE_LINEJOIN 12
+#define KCSS_ATTR_STROKE_DASHOFFSET 13
+#define KCSS_ATTR_STROKE_MITERLIMIT 14
+#define KCSS_ATTR_COLOR 15
+#define KCSS_ATTR_TEXTANCHOR 16
+#define KCSS_ATTR_TEXTDECORATION 17
+#define KCSS_ATTR_COLORINTERPOLATION 18
+#define KCSS_ATTR_COLORRENDERING 19
+#define KCSS_ATTR_LETTERSPACING 20
+#define KCSS_ATTR_WORDSPACING 21
+
+#define KCSS_ATTR_FILL_OPACITY 22
+#define KCSS_ATTR_STROKE_OPACITY 23
+#define KCSS_ATTR_FONT 24
+/***************************************************/
+/***************************************************/
+const TInt KSvgTypeTransform = 30;
+const TInt KSvgTypeTranslate = 31;
+const TInt KSvgTypeRotate = 32;
+const TInt KSvgTypeScale = 33;
+const TInt KSvgTypeSkewX = 34;
+const TInt KSvgTypeSkewY = 35;
+const TInt KSvgType2DMatrix = 36;
+
+/////////////EVENT MASKS////////////////////
+const TUint8 KSvgEventMaskNone = 0x0;
+const TUint8 KSvgEventMaskExternalUI = 0x1;
+const TUint8 KSvgEventMaskTimer = 0x2;
+const TUint8 KSvgEventMaskInternal = 0x4;
+const TUint8 KSvgEventMaskExternalSystem = 0x8;
+////////////////////////////////////////////////// taken from event.h
+
+
+
+
+////////////////////////////////////////////////// taken from event.h
+// these are taken from gfxgeneralPath.h
+const TUint32 KSvgSegMoveTo = 2;
+const TUint32 KSvgSegLineTo = 4;
+const TUint32 KSvgSegQuadTo = 10;
+const TUint32 KSvgSegCubicTo = 12;
+const TUint32 KSvgSegClose = 0;
+const TUint32 KSvgHorizontal = 5;
+const TUint32 KSvgVertical = 6;
+/////////////////////////////////////////////////////
+
+class MJavaError
+ {
+ public:
+ /**
+ * Dtor
+ * @since 1.0
+ */
+ virtual ~MJavaError()
+ {
+ }
+
+ /**
+ * Determine wether an error is indicated by this object.
+ *
+ * @since 1.0
+ * @return : ETrue, if ErrorCode() != ESvgNoError
+ */
+ virtual TBool HasError() const = 0;
+
+ /**
+ * Determine wether an error is only a warning.
+ * This should be a state when the svg may be display, despite
+ * a conflict.
+ *
+ * @since 1.0
+ * @return ETrue if HasError() is only a warning.
+ */
+ virtual TBool IsWarning() const = 0;
+
+ /**
+ * Get the error code contained by this object.
+ *
+ * @since 1.0
+ * @return : the TSvgErrorCode value
+ */
+ virtual TInt ErrorCode() const = 0;
+
+ /**
+ * Get the error description string for this object.
+ *
+ * @since 1.0
+ * @return : error description string.
+ */
+ virtual TDesC8& Description() = 0;
+ };
+
+
+/**
+ * This class implements the interface for a MJavaError object, which contains
+ * an error code and a description of the error if one exists.
+ *
+ * @since 1.0
+ */
+class CJavaError : public CBase, public MJavaError
+ {
+ public:
+
+ /**
+ * Two-phase constructor.
+ * Creates an integer 'handle' from C++ object for referencing them inside Java.
+ * The shift garauntees a positive integer.
+ * Unhanding the integer requires the destination type to be known and bit shifting.
+ *
+ * @since 1.0
+ * @return : CJavaError object
+ */
+ static TInt NewL( CSvgErrorImpl& aError );
+
+ /**
+ * Destructor
+ */
+ virtual ~CJavaError();
+
+ /**
+ * Determine wether an error is indicated by this object.
+ *
+ * @since 1.0
+ * @return : ETrue, if ErrorCode() != ESvgNoError
+ */
+ virtual TBool HasError() const;
+
+ /**
+ * Determine wether an error is only a warning.
+ * This should be a state when the svg may be display, despite
+ * a conflict.
+ *
+ * @since 1.0
+ * @return ETrue if HasError() is only a warning.
+ */
+ virtual TBool IsWarning() const;
+
+ /**
+ * Get the error code contained by this object.
+ *
+ * @since 1.0
+ * @return : the TSvgErrorCode value
+ */
+ virtual TInt ErrorCode() const;
+
+ /**
+ * Get the error description string for this object.
+ *
+ * @since 1.0
+ * @return : error description string.
+ */
+ virtual TDesC8& Description();
+
+ protected:
+ /**
+ * Second phase of constructor
+ *
+ * @since 1.0
+ */
+ void ConstructL( CSvgErrorImpl& aError );
+
+ /**
+ * Ctor.
+ *
+ * @since 1.0
+ */
+ CJavaError();
+
+ private:
+ TInt iErrorCode;
+ TBool iIsWarning;
+ HBufC8* iDescription;
+ };
+
+// ***********************************************************************
+// SVG Engine
+// ***********************************************************************
+/**
+ * The SVG Engine is fundamental object for 2D rendering. The rendering can
+ * only be achieved through the render method provided by the SVG Engine object.
+ * NOTE: Java MIDlet can uses multiple SVG Engine objects.
+ * NOTE: Java side cannot provide the SVG Engine object for:
+ * <ul>
+ * <li>the SVG Document operations</li>
+ * <li>the SVG Element operations</li>
+ * </ul>
+ */
+
+// *****************************************************************************
+// SVG Rendering Surface Functions
+// *****************************************************************************
+/**
+ * The SVG Rendering Surface functions are not used in java side.
+ *
+
+// ***********************************************************************
+// SVG Document
+// ***********************************************************************
+/**
+ * The SVG Document represents an XML Document.
+ * <p>The SVG Document is a subset of the Document interface defined
+ * in the <a href="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html">
+ * DOM Level 3 Core</a>.</p>
+ */
+
+// ***********************************************************************
+// SVG Element
+// ***********************************************************************
+/**
+ * Description of an SVG element in the document tree. Element's id can be set only
+ * if it does not already have an id. Elements with non-null id can be inserted, but
+ * <b>cannot be removed</b> from the DOM tree.
+ *
+ * <p>
+ * An SVG element's "traits" value can be read and manipulated. Each <i>trait</i>
+ * corresponds to an attribute or property,which is parsed and understood by the element
+ * and in most cases animatable. Unlike attributes, each element has a
+ * well-defined set of traits and attempting to access undefined trait is an error. Also unlike
+ * attributes traits are typed and their values are normalized; for instance SVG path specification
+ * is parsed and all path commands are converted to their absolute variants, it is not possible to
+ * say through the value of the trait if a path command was absolute or relative. When getting and
+ * setting trait values, accessor of the correct type must be used or exception will be thrown.
+ * </p>
+ * <p>
+ * Initial trait values come from parsing corresponding attributes. If value is not specified, but
+ * corresponing attribute (or property for environments where styling is supported) is inherited,
+ * inherited value is returned as a result of the trait query method. If it is not inherited, default
+ * value is returned. Default values are also returned in the case when there is no parent to inherit
+ * from, for ex: when you create a new element, set a trait value to 'inherit', but there is no parent for
+ * inheritance. It is important to note that the value which is returned is always a base value (i.e. before animation
+ * is applied), and this is true for both static and animated content.
+ * </p>
+ * <p>
+ * Setting a trait value has the same effect as changing a corresponding attribute, but trait
+ * setters can operate on typed values. The value which is modified is always a base value.
+ * For inheritable traits the trait value can always be set to "inherit"
+ * (but querying the value will always return the actual inherited value as explained above).
+ * </p>
+ *
+ * <h3>Traits supported in this specification, SVG Tiny 1.1 DOM</h3>
+ *
+ * <p>The table below shows the list of attributes and properties that SVG Tiny
+ * DOM 1.1 implementations must support. Each light gray section lists one or
+ * multiple elements for which the subsequent attributes or properties
+ * apply. Each attribute row lists the allowed getter and setter (s). The last
+ * column specifies the default values that must be used for each attribute or
+ * property.</p>
+ * <p><b>Note:</b> For 'REQUIRED' attributes, there are two cases:
+ *
+ * <ul>
+ * <li>i) The document is in error, if this attribute was not present at the time of loading.</li>
+ * <li>ii) When using uDOM API, the specified default value (in parenthesis) must be used.</li>
+ * </ul>
+ * </p>
+ *
+ * <table height="1586" cellpadding="2" cellspacing="2" border="1"
+ * width="825" style="border-collapse: collapse;">
+ * <tbody>
+ * <tr>
+ * <th width="150" valign="top" bgcolor="#999999"><b>Property<br>
+ * </b> </th>
+ * <th valign="top" bgcolor="#999999"><b>Trait Getter <br>[possible return value(s)]<br>
+ * </b> </th>
+ * <th bgcolor="#999999" valign="top"><b>Trait Setter <br>[allowed value(s)]<br>
+ * </b> </th>
+ * <th bgcolor="#999999" valign="top"><b>Default Values<br>
+ * </b> </th>
+ * </tr>
+ * <tr>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td bgcolor="#cccccc" colspan="4" rowspan="1" valign="top"><svg>,
+ * <rect>, <circle>, <ellipse>, <line>,
+ * <path>, <g>, <image>, <text>, <a>, and <use></td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">color <br>
+ * </td>
+ * <td valign="top">getRGBColorTrait [SVGRGBColor]<br>
+ * </td>
+ * <td valign="top">setTrait [inherit]<br>setRGBColorTrait [SVGRGBColor]<br>
+ * </td>
+ * <td valign="top" align="center">rgb(0,0,0)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">display<br>
+ * </td>
+ * <td valign="top">getTrait [inline | none ] <br>
+ * </td>
+ * <td valign="top">setTrait [inline | none | inherit ] </td>
+ * <td valign="top" align="center">"inline"<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">fill<br>
+ * </td>
+ * <td valign="top">getRGBColorTrait [null, SVGRGBColor]<br>
+ * </td>
+ * <td valign="top">setRGBColorTrait [SVGRGBColor]<br>setTrait(none | currentColor | inherit)<br>
+ * </td>
+ * <td valign="top" align="center">rgb(0,0,0)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">fill-rule<br>
+ * </td>
+ * <td valign="top">getTrait [nonzero | evenodd] <br>
+ * </td>
+ * <td valign="top">setTrait [nonzero | evenodd | inherit] </td>
+ * <td valign="top" align="center">"nonzero"<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">stroke</td>
+ * <td valign="top">getRGBColorTrait [null, SVGRGBColor]</td>
+ * <td valign="top">setRGBColorTrait [SVGRGBColor]<br>setTrait [none | currentColor | inherit]</td>
+ * <td valign="top" align="center">"none"<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top">stroke-dashoffset</td>
+ * <td valign="top">getFloatTrait </td>
+ * <td valign="top">setTrait [inherit]<br>setFloatTrait </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top">stroke-linecap</td>
+ * <td valign="top">getTrait [butt | round | square]</td>
+ * <td valign="top">setTrait [butt | round | square | inherit]</td>
+ * <td valign="top" align="center">"butt"<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top">stroke-linejoin</td>
+ * <td valign="top">getTrait [miter | round | bevel ]</td>
+ * <td valign="top">setTrait [miter | round | bevel | inherit]</td>
+ * <td valign="top" align="center">"miter"<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top">stroke-miterlimit</td>
+ * <td valign="top">getFloatTrait [ value >= 1]</td>
+ * <td valign="top">setTrait [inherit]<br>setFloatTrait [value >= 1]</td>
+ * <td valign="top" align="center">4.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top">stroke-width</td>
+ * <td valign="top">getFloatTrait [value >= 0]</td>
+ * <td valign="top">setTrait [inherit]<br> setFloatTrait [value >= 0]</td>
+ * <td valign="top" align="center">1.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top">visibility</td>
+ * <td valign="top">getTrait [visible | hidden]</td>
+ * <td valign="top">setTrait [visible | hidden | inherit]</td>
+ * <td valign="top" align="center">"visible"<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td bgcolor="#cccccc" colspan="4" rowspan="1" valign="top"><svg>, <text>, <g>, <a>, and <use>;<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top">font-family<br>
+ * </td>
+ * <td valign="top">getTrait [single, computed font-family value]<br>
+ * </td>
+ * <td valign="top">setTrait [same syntax as font-family attribute]<br>
+ * </td>
+ * <td valign="top" align="center"> User-Agent <br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">font-size<br>
+ * </td>
+ * <td valign="top">getFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top">setFloatTrait [value >= 0]<br>setTrait [inherit]<br>
+ * </td>
+ * <td valign="top" align="center"> User-Agent <br>
+ * </td> </tr>
+ * <tr>
+ * <td width="150" valign="top">font-style<br>
+ * </td>
+ * <td valign="top">getTrait [normal | italic | oblique ] </td>
+ * <td valign="top">setTrait [normal | italic | oblique | inherit] </td>
+ * <td valign="top" align="center">"normal"<br>
+ * </td> </tr>
+ * <tr>
+ * <td width="150" valign="top">font-weight<br>
+ * </td>
+ * <td valign="top">getTrait [100 | 200 | 300 <br> | 400 | 500 | 600 | 700 | 800 | 900 ] </td>
+ * <td valign="top">setTrait [normal | bold | bolder | lighter | 100 | 200 | 300 <br />
+ * | 400 | 500 | 600 | 700 | 800 | 900 | inherit] </td>
+ * <td valign="top" align="center">"normal"<br>
+ * </td> </tr>
+ * <tr>
+ * <td width="150" valign="top">text-anchor<br>
+ * </td>
+ * <td valign="top">getTrait [start | middle | end]<br>
+ * </td>
+ * <td valign="top">setTrait [start | middle | end | inherit ]<br>
+ * </td>
+ * <td valign="top" align="center">"start"<br>
+ * </td> </tr>
+ * <tr>
+ * <td width="150" colspan="4" rowspan="1" valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" bgcolor="#999999" valign="top"><b>Attribute<br>
+ * </b></td>
+ * <td bgcolor="#999999" valign="top"><b>Trait Getter<br>
+ * </b></td>
+ * <td bgcolor="#999999" valign="top"><b>Trait Setter<br>
+ * </b></td>
+ * <td bgcolor="#999999" valign="top"><b>Default Values<br>
+ * </b></td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" bgcolor="#cccccc" colspan="4" rowspan="1" valign="top">
+ * <rect>, <circle>, <ellipse>, <line>, <path>, <g>,
+ * <image>, <text>, <a>, and <use></td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">transform<br>
+ * </td>
+ * <td valign="top">getMatrixTrait [SVGMatrix]<br>
+ * </td>
+ * <td valign="top">setMatrixTrait [SVGMatrix]<br>
+ * </td>
+ * <td valign="top" align="center">Identity matrix<br>
+ * (1,0,0,1,0,0)<br>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><rect><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">height<br>
+ * </td>
+ * <td valign="top">getFloatTrait [ value >= 0]<br>
+ * </td>
+ * <td valign="top">setFloatTrait [ value >= 0]<br>
+ * </td>
+ * <td valign="top" align="center">REQUIRED<br>(0.0f)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">width<br>
+ * </td>
+ * <td valign="top">getFloatTrait [ value >= 0]</td>
+ * <td valign="top">setFloatTrait [ value >= 0]</td>
+ * <td valign="top" align="center">REQUIRED<br>(0.0f)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">x<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">y<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">rx<br>
+ * </td>
+ * <td valign="top">getFloatTrait [value >= 0]</td>
+ * <td valign="top">setFloatTrait [value >= 0]</td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">ry<br>
+ * </td>
+ * <td valign="top">getFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top">setFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><circle><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">cx<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">cy<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">r<br>
+ * </td>
+ * <td valign="top">getFloatTrait [ value >= 0]<br>
+ * </td>
+ * <td valign="top">setFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top" align="center">REQUIRED<br>(0.0f)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" bgcolor="#cccccc" colspan="4" rowspan="1" valign="top"><ellipse><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">cx<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">cy<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">rx<br>
+ * </td>
+ * <td valign="top">getFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top">setFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top" align="center">REQUIRED<br>(0.0f)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">ry<br>
+ * </td>
+ * <td valign="top">getFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top">setFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top" align="center">REQUIRED<br>(0.0f)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><line><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">x1<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">x2<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">y1<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">y2<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><path> (path-length is not supported)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">d<br>
+ * </td>
+ * <td valign="top">getPathTrait [SVGPath]<br>
+ * </td>
+ * <td valign="top">setPathTrait [SVGPath]<br>
+ * </td>
+ * <td valign="top" align="center">REQUIRED<br>(Empty SVGPath)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><image><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">x<br>
+ * </td>
+ * <td valign="top">getFloatTrait <br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">y<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">width<br>
+ * </td>
+ * <td valign="top">getFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top">setFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top" align="center">REQUIRED<br>(0.0f)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">height<br>
+ * </td>
+ * <td valign="top">getFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top">setFloatTrait [value >= 0]<br>
+ * </td>
+ * <td valign="top" align="center">REQUIRED<br>(0.0f)<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">xlink:href<br>
+ * </td>
+ * <td valign="top">getTrait NS[absolute URI]<br>
+ * </td>
+ * <td valign="top">setTraitNS [non local-URI value]<br>
+ * </td>
+ * <td valign="top" align="center">REQUIRED<br>( "" )<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><use><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">x<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">y<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top">xlink:href<br>
+ * </td>
+ * <td valign="top">getTraitNS[absolute URI]<br>
+ * </td>
+ * <td valign="top">setTraitNS<br>
+ * </td>
+ * <td valign="top" align="center">""<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <tr>
+ * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><a><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">target<br>
+ * </td>
+ * <td valign="top">getTrait<br>
+ * </td>
+ * <td valign="top">setTrait<br>
+ * </td>
+ * <td valign="top" align="center">""<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td valign="top">xlink:href<br>
+ * </td>
+ * <td valign="top">getTraitNS[absolute URI]<br>
+ * </td>
+ * <td valign="top">setTraitNS<br>
+ * </td>
+ * <td valign="top" align="center">""<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="*" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><text><br />(Notes:
+ * For 'x' and 'y', it is only possible
+ * to provide floating point scalar values; an array of x or y values is not supported. <br />
+ * 'rotate' attribute is not supported.)<br/>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">x<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">y<br>
+ * </td>
+ * <td valign="top">getFloatTrait<br>
+ * </td>
+ * <td valign="top">setFloatTrait<br>
+ * </td>
+ * <td valign="top" align="center">0.0f<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">#text<br>
+ * </td>
+ * <td valign="top">getTrait [not null]<br>
+ * </td>
+ * <td valign="top">setTrait [not null]<br>
+ * </td>
+ * <td valign="top" align="center">""<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" colspan="4" rowspan="1" bgcolor="#cccccc" valign="top"><svg><br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">version<br>
+ * </td>
+ * <td valign="top">getTrait<br>
+ * </td>
+ * <td valign="top">Not available (readonly)<br>
+ * </td>
+ * <td valign="top" align="center">"1.1"<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">baseProfile<br>
+ * </td>
+ * <td valign="top">getTrait<br>
+ * </td>
+ * <td valign="top">Not available (readonly)<br>
+ * </td>
+ * <td valign="top" align="center">"tiny"<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">viewBox<br>
+ * </td>
+ * <td valign="top">getRectTrait [null, SVGRect]<br>
+ * </td>
+ * <td valign="top">setRectTrait [SVGRect]<br>
+ * </td>
+ * <td valign="top" align="center">null<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top">zoomAndPan<br>
+ * </td>
+ * <td valign="top">getTrait [disable | magnify]<br>
+ * </td>
+ * <td valign="top">setTrait [disable | magnify]<br>
+ * </td>
+ * <td valign="top" align="center">"magnify"<br>
+ * </td>
+ * </tr>
+ * <tr>
+ * <td width="150" valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * <td valign="top"><br>
+ * </td>
+ * </tr>
+ * </tbody>
+ * </table>
+ */
+
+// ***********************************************************************
+// SVG Path
+// ***********************************************************************
+/**
+ * An SVG Path datatype is used to define the path geometry.
+ * Corresponds to SVG path specification or the "d" attribute.
+ *
+ * <p>The native implementations must support the following simplifications or
+ * canonicalization of path segments. Any simplifications should be lossless.
+ *
+ * <ul>
+ * <li>Relative commands (c, h, l, m, q, s, t, and v) must be converted to their absolute
+ * counterparts·</li>
+ * <li>Horizontal and Vertical lines (H, h, V, and v) must be converted to general
+ * lines (L and l)·</li>
+ * <li>Translate command S to command C·</li>
+ * <li>Translate command T to command Q.</li>
+ * </ul>
+ * </p>
+ */
+
+/**
+ * The CSvgJavaInterfaceImpl class specializes the CSvgEngineInterfaceImpl class
+ */
+class CSvgJavaInterfaceImpl : public CSvgEngineInterfaceImpl, public MSvgMouseListener
+{
+public:
+ /**
+ * Construct an instance of CSvgJavaInterfaceImpl
+ */
+ IMPORT_C static CSvgJavaInterfaceImpl* NewL( TFontSpec& aFontSpec );
+ IMPORT_C static CSvgJavaInterfaceImpl* NewL();
+
+ /**
+ * Destruct an instance of CSvgJavaInterfaceImpl
+ */
+ IMPORT_C ~CSvgJavaInterfaceImpl();
+
+ // ***********************************************************************
+ // SVG Engine
+ // ***********************************************************************
+ /**
+ * Create an SvgEngine instance.
+ * NOTE: Java side uses engine only during rendering phase.
+ *
+ * @since 1.0
+ * @see javax.microedition.m2g.ScalableGraphics#render()
+ * @return Pointer to CSvgEngineImpl object if creation is succesful, otherwise 0 is returned.
+ */
+ IMPORT_C SvgEngineHandle SvgEngineCreate();
+
+ /**
+ * Request to set render quality.
+ * Set the quality of rendering. It can take one of the values,
+ * <code>RENDERING_QUALITY_LOW</code> (=1) or <code>RENDERING_QUALITY_HIGH</code> (=2).
+ * Default value is <code>RENDERING_QUALITY_HIGH</code>.
+ * The implementation of these quality levels is implementation dependent and should
+ * be mapped to definitions in SVG spec (shape, text, image and color rendering)
+ *
+ * @since 1.0
+ * @see javax.microedition.m2g.ScalableGraphics#setRenderingQuality()
+ * @param aEngineHandle Engine handle.
+ * @param aQuality This value indicates the quality of rendering required.
+ */
+ IMPORT_C void SvgEngineSetRenderQuality( SvgEngineHandle aEngineHandle, TInt aQuality );
+
+ /**
+ * Request to render the SVG document.
+ *
+ * @since 1.0
+ * @see javax.microedition.m2g.ScalableGraphics#render()
+ * @param aEngineHandle Svg engine handle
+ * @param aDocumentHandle Svg document handle
+ * @param aSurfaceHandle Svg surface handle
+ * @param aSurfaceMaskHandle Mask that defines what pixels should be thrown and what not.
+ * @param aCurrentTime Current frame time. NOTE might be obsolete since the
+ */
+ IMPORT_C void SvgEngineRenderDocument(
+ SvgEngineHandle aEngineHandle, SvgDocumentHandle aDocumentHandle,
+ TInt aSurfaceHandle, TInt aSurfaceMaskHandle = NULL, TReal32 aCurrentTime = 0.0f ) __SOFTFP;
+
+ IMPORT_C void SvgEngineRenderDocumentL(
+ SvgEngineHandle aEngineHandle, SvgDocumentHandle aDocumentHandle,
+ TInt aSurfaceHandle, const TPoint& aAnchor, const TRect& aRenderArea, TReal32 aCurrentTime, TReal32 aAlpha ) __SOFTFP;
+
+ /**
+ * Request to destroy the given engine by handle.
+ * NOTE: Java MIDlet could use multiple engines.
+ *
+ * @since 1.0
+ * @param aEngineHandle Engine
+ */
+ IMPORT_C void SvgEngineDestroy( SvgEngineHandle aEngineHandle );
+
+ /*
+ * Sets the animation back to time 0 and then starts the internal engine timer
+ * NOTE: Java doesn't use this method. Java uses own timer(s).
+ *
+ * @since 1.0
+ * @param aEngineHandle Engine
+ */
+ IMPORT_C void SvgEngineStart( SvgEngineHandle aEngineHandle );
+
+ /*
+ * Stops the internal SVG engine timer
+ * NOTE: Java doesn't use this method. Java uses own timer.
+ *
+ * @since 1.0
+ * @param aEngineHandle Engine
+ */
+ IMPORT_C void SvgEngineStop( SvgEngineHandle aEngineHandle );
+
+ /*
+ * Resumes the internal SVG engine timer
+ * NOTE: Java doesn't use this method. Java uses own timer.
+ *
+ * @since 1.0
+ * @param aEngineHandle Engine
+ */
+ IMPORT_C void SvgEngineResume( SvgEngineHandle aEngineHandle );
+
+ // *****************************************************************************
+ // SVG Rendering Surface Functions
+ // *****************************************************************************
+ /**
+ * Create a Svg Rendering Surface.
+ * NOTE: Java doesn't use this method.
+ *
+ * @since 1.0
+ * @param aWidth Width
+ * @param aHeight Height
+ * @return Surface
+ */
+ IMPORT_C SvgSurfaceHandle SvgRenderingSurfaceCreate( TInt aWidth, TInt aHeight );
+
+ /**
+ * Destroy a Svg Rendering Surface.
+ * NOTE: Java doesn't use this method.
+ *
+ * @since 1.0
+ * @param aSurface Surface
+ */
+ IMPORT_C void SvgRenderingSurfaceDestroy( SvgSurfaceHandle aSurface );
+
+ /**
+ * Get a pointer to the Svg Rendering surface.
+ * NOTE: Java doesn't use this method.
+ *
+ * @since 1.0
+ * @param aSurface Surface
+ * @return CFbsBitmap object
+ */
+ IMPORT_C TUint* SvgRenderingSurfaceGetBuffer( SvgSurfaceHandle aSurface );
+
+ /**
+ * Get the width of the Svg Rendering Surface.
+ * NOTE: Java doesn't use this method.
+ *
+ * @since 1.0
+ * @param aSurface Surface
+ * @return Width
+ */
+ IMPORT_C TInt SvgRenderingSurfaceGetWidth( SvgSurfaceHandle aSurface );
+ /**
+ * Get the height of the Svg Rendering Surface.
+ * NOTE: Java doesn't use this method.
+ *
+ * @since 1.0
+ * @param aSurface Surface
+ * @return Height
+ */
+ IMPORT_C TInt SvgRenderingSurfaceGetHeight( SvgSurfaceHandle aSurface );
+
+ /**
+ * Clear the Svg Rendering Surface.
+ * NOTE: Java doesn't use this method.
+ *
+ * @since 1.0
+ * @param aSurface Surface
+ */
+ IMPORT_C void SvgRenderingSurfaceClearBuffer( SvgSurfaceHandle aSurface );
+
+ // ***********************************************************************
+ // SVG Document
+ // ***********************************************************************
+ /**
+ * Create an empty svg document.
+ * NOTE: Java doesn't use this method.
+ * Java side uses the <code>SvgDocumentCreateL</code> method to create an empty SVG document
+ * that contains a root <svg> element with default viewport size of 100x100.
+ *
+ * @since 1.0
+ * @see javax.microedition.m2g.SVGImage#createEmptyImage()
+ * @return Svg Document.
+ */
+ IMPORT_C SvgDocumentHandle SvgDocumentCreateEmpty();
+
+ /**
+ * Create a svg document by parsing the given string.
+ * The image size is determined by the content specification
+ * (eg: width/height attributes on root SVG element). The default viewport size
+ * of 100-by-100 pixels is used when the size is unspecified. This method will throw an exception
+ * when the document is in error:
+ * <ul>
+ * <li>the SVG document does not conform to the XML 1.0 specification</li>
+ * <li>an element has an attribute or property value which is not permissible according to the SVG specification </li>
+ * <li>the required or mandatory attributes according to the SVG specification are missing</li>
+ * <li>the document contains circular references on the <use> element</li>
+ * <li>the document contains <image> element(s) with local references </li>
+ * <li>the document contains elements with duplicate Id's</li>
+ * <li>the document contains animation(s) in error</li>
+ * </ul>
+ *
+ * The native engine might be invoked for any external resource referenced in the document
+ * by calling the <code>SvgDocumentRequestCompleted</code>.
+ * However, please note that data URIs (for ex: base64 encoded images
+ * like <image xlink:href="data:image/png;base64,/9j/4AAQ..."/>)
+ * are required to be decoded by the native engine.
+ * The engine must only make one call if there exist multiple resources with the same URI.
+ *
+ * If a svg document contains external resources and <code>SvgDocumentRequestCompleted</code> is not called
+ * then the engine's default implementation is used automatically, but it might not be able to load all of
+ * external resources. For example, if the svg document is loaded from a file in a Jar file,
+ * the implementation will not be able to load images that have relative
+ * URIs (ex; <image xlink:href="myImage.png" />).
+ *
+ * <p>Note that <code>SvgDocumentRequestCompleted</code> is also called when the xlink:href attribute on
+ * <image> is set or changed by the application, but the call is made only when the
+ * element is hooked into the document tree i.e. when the ancestors go all the way up to
+ * the root <svg> element. There are two cases:
+ * <ul>
+ * <li>When changing the xlink:href attribute of an existing <image> element that is already hooked or part of the tree.</li>
+ * <li>When creating a new <image>, setting its xlink:href and hooking it to the document tree.</li>
+ * </ul>
+ * </p>
+ *
+ * @since 1.0
+ * @see javax.microedition.m2g.ScalableImage#createImage()
+ * @param aString The string from which the SVG content should be read
+ * @return Svg Document if successful, otherwise the function leaves.
+ * @throws MJavaError if an error occurs while loading the content.
+ */
+ IMPORT_C SvgDocumentHandle SvgDocumentCreateL( const TPtrC16& aString );
+
+ /**
+ * Destroy the given svg document (by handle).
+ * NOTE: Java MIDlet could use multiple documents.
+ *
+ * @since 1.0
+ * @param aDocumentHandle Document handle.
+ */
+ IMPORT_C void SvgDocumentDestroy( SvgDocumentHandle aDocumentHandle );
+
+ /**
+ * Svg Document request complete.
+ * Once the requested external resource is available, the application forwards this information
+ * (data) to the SVG engine. If this method is called a second time for a same URL (uri) of a
+ * same SVG document, the engine will replace the current resource data with the new
+ * one. <b>Note:</b> Setting <code>NULL</code> for data (<code>0</code> for data_size) indicates
+ * that the requested resource could not be fetched by java side, and in this event the SVG engine
+ * will not make further attempts to load this resource.
+ *
+ * @since 1.0
+ * @see javax.microedition.m2g.ScalableImage#requestCompleted()
+ * @param hDocument SVG document handle
+ * @param uri External resource URI
+ * @param data External resource data
+ * @param data_size External resource data size
+ * @return TODO
+ */
+ EXPORT_C TInt SvgDocumentRequestCompleted( SvgDocumentHandle hDocument, const TPtrC16& aUri, const TPtrC8& );
+
+ /**
+ * Get an external item indicated in a SVG document.
+ * Java side might request an external resouce and once the requested external resource is available,
+ * java side forwards this information (<code>SvgDocumentGetExternalListItem</code>) to the SVG engine.
+ * <b>Note:</b> Returning <code>null</code> indicates that the SVG engine tryes to handle the requested resource.
+ *
+ * @since 1.0
+ * @param aDocumentHandle SVG document handle
+ * @param index External resource item index. Scale:
+ * <li>0 <= <code>index</code> < <code>SvgDocumentGetExternalListSize</code></li>
+ * @return External resource URI
+ */
+ IMPORT_C TInt SvgDocumentGetExternalListItem(SvgDocumentHandle aDocumentHandle, TInt aIndex, TPtrC16& aItem);
+
+ /**
+ * Get number of external list items in a SVG document.
+ * After the SVG document is created (see <code>SvgDocumentCreateL</code>) java side checks if
+ * the SVG document contains external item(s)
+ *
+ * @since 1.0
+ * @param aDocumentHandle SVG document handle
+ * @return Number of external resource items
+ */
+ IMPORT_C TInt SvgDocumentGetExternalListSize( SvgDocumentHandle aDocumentHandle );
+
+ /**
+ * Increments the animation or media timeline for the specified document aDocumentHandle
+ * (in seconds).
+ * This method is intended to move only forward in the timeline.
+ * It is important to note that setting large increments of time would result in
+ * skipping parts of the animation as per the SVG animation model.
+ *
+ * @since 1.0
+ * @see javax.microedition.m2g.SVGImage#incrementTime()
+ * @see org.w3c.dom.svg.SVGSVGElement#setCurrentTime()
+ * @param aDocumentHandle SVG document handle.
+ * @param seconds the value of time to be set in seconds.
+ */
+ IMPORT_C void SvgDocumentSetMediaTime( SvgDocumentHandle aDocumentHandle, TReal32 seconds ) __SOFTFP;
+
+ /**
+ * Get current animation or media timeline time for the specified document.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGSVGElement#getCurrentTime()
+ * @param aDocumentHandle SVG document handle
+ * @return Returns current animation timeline time in seconds
+ */
+ IMPORT_C TReal32 SvgDocumentGetMediaTime( SvgDocumentHandle aDocumentHandle ) __SOFTFP;
+
+ /**
+ * Get the viewport width of the given SVG document.
+ * The value returned is always in pixels. If the specified width is defined in percentages, the
+ * values are mapped to the default view port size of 100x100. If the viewport width
+ * is explicitly changed by the java application, then the percentages are ignored and the content
+ * is made to fit to this new viewport width.
+ *
+ * @since 1.0
+ * @see javax.microedition.m2g.ScalableImage#getViewportWidth()
+ * @see SvgDocumentSetViewportWidth
+ * @param aDocumentHandle SVG document handle
+ * @return the current width of the given SVG document.
+ */
+ IMPORT_C TInt SvgDocumentGetViewportWidth( SvgDocumentHandle aDocumentHandle );
+
+ /**
+ * Get the viewport height of the given SVG document.
+ * The value returned is always in pixels. If the specified height is defined in percentages, the
+ * values are mapped to the default view port size of 100x100. If the viewport height
+ * is explicitly changed by the java application, then the percentages are ignored and the content
+ * is made to fit to this new viewport height.
+ *
+ * @since 1.0
+ * @see javax.microedition.m2g.ScalableImage#getViewportHeight()
+ * @see SvgDocumentSetViewportHeight
+ * @param aDocumentHandle SVG document handle
+ * @return the current height of the given SVG document.
+ */
+ IMPORT_C TInt SvgDocumentGetViewportHeight( SvgDocumentHandle aDocumentHandle );
+
+ /**
+ * Set the new (viewport) width for the given SVG document.
+ *
+ * @since 1.0
+ * @see javax.microedition.m2g.ScalableImage#setViewportWidth()
+ * @see SvgDocumentGetViewportWidth
+ * @param aDocumentHandle SVG document handle
+ * @param aWidth The new width to be set.
+ */
+ IMPORT_C void SvgDocumentSetViewportWidth( SvgDocumentHandle aDocumentHandle, TInt aWidth );
+
+ /**
+ * Set the new (viewport) height for the given SVG document.
+ *
+ * @since 1.0
+ * @see javax.microedition.m2g.ScalableImage#setViewportHeight()
+ * @see SvgDocumentGetViewportHeight
+ * @param aDocumentHandle SVG document handle
+ * @param aHeight The new height to be set.
+ */
+ IMPORT_C void SvgDocumentSetViewportHeight( SvgDocumentHandle aDocumentHandle, TInt aHeight );
+
+ /**
+ * Set the default viewport size for the given SVG document.
+ * The default viewport size of 100-by-100 pixels is used when the size is unspecified.
+ *
+ * @since 1.0
+ * @param aDocumentHandle Document
+ */
+ IMPORT_C void SvgDocumentViewportInit( SvgDocumentHandle aDocumentHandle );
+
+ /**
+ * Get the viewport width units for the given document.
+ * NOTE: Java side is not actually need this method.
+ *
+ * @since 1.0
+ * @param aDocumentHandle Document
+ * @return <code>1</code> if pixels or <code>0</code> if percentages
+ */
+ IMPORT_C TInt SvgDocumentGetViewportWidthUnits( SvgDocumentHandle aDocumentHandle );
+
+ /**
+ * Get the viewport height units for the given document.
+ * NOTE: Java side is not actually need this method.
+ *
+ * @since 1.0
+ * @param aDocumentHandle Document
+ * @return <code>1</code> if pixels or <code>0</code> if percentages
+ */
+ IMPORT_C TInt SvgDocumentGetViewportHeightUnits( SvgDocumentHandle aDocumentHandle );
+
+ /**
+ * Return a child element of the given SVG document Node which corresponds to the top-most
+ * tag in XML file. For SVG files it must be <code>SVGSVGElement</code>.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.Document#getDocumentElement()
+ * @param aDocumentHandle SVG document handle
+ * @return The root element associated with the given SVG document.
+ */
+ IMPORT_C SvgElementHandle SvgDocumentGetRootElement( SvgDocumentHandle aDocumentHandle );
+
+ /**
+ * Get the svg element in the given SVG document with
+ * the given unique ID string.If no such element exists, this returns NULL.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.Document#getElementById()
+ * @param aDocumentHandle SVG document handle
+ * @param aId the ID of the element to be retrieved.
+ * @return An element handle that matches with the given ID or
+ * <code>NULL</code> if the ID is not present.
+ */
+ IMPORT_C SvgElementHandle SvgDocumentGetElementById( SvgDocumentHandle aDocumentHandle, const TPtrC16& aID );
+
+ /**
+ * Get the number of ids in the current SVG document.
+ * NOTE: Java doesn't use this method.
+ *
+ * @since 1.0
+ * @param aDocumentHandle SVG document handle
+ */
+ IMPORT_C TInt SvgDocumentGetNumberOfIds(SvgDocumentHandle aDocumentHandle );
+
+ /**
+ * Get an id (at index) from the current SVG document.
+ * NOTE: Java doesn't use this method.
+ *
+ * @since 1.0
+ * @param aDocumentHandle SVG document handle
+ * @param index ID index
+ * @return ID string
+ */
+ IMPORT_C TInt SvgDocumentGetId(SvgDocumentHandle aDocumentHandle, TInt index, TPtrC16& aId);
+
+ /**
+ * Set the begin animation time for the given element in the given SVG document.
+ * The new time is added to the <a href="http://www.w3.org/TR/2001/REC-smil20-20010807/smil20.html#smil-timing-Timing-BeginEnd-InstanceTimesLists">
+ * begin instance times list</a>.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGAnimationElement#beginElementAt()
+ * @param aDocumentHandle SVG document handle
+ * @param aElementHandle Element handle
+ * @param aOffsetTime The time in seconds at which to begin the element.
+ */
+ IMPORT_C void SvgDocumentBeginElementAt( SvgDocumentHandle aDocumentHandle,
+ SvgElementHandle aElementHandle,
+ TReal32 aOffsetTime ) __SOFTFP;
+
+ /**
+ * Set the end animation time for the given element in the given SVG document.
+ * The new time is added to the <a href="http://www.w3.org/TR/2001/REC-smil20-20010807/smil20.html#smil-timing-Timing-BeginEnd-InstanceTimesLists">
+ * end instance times list</a>.
+ * NOTE: Native engine checks the element is active before set the new end time.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGAnimationElement#endElementAt()
+ * @param aDocumentHandle SVG document handle
+ * @param aElementHandle Element handle
+ * @param aOffsetTime The time in seconds at which to end the element.
+ */
+ IMPORT_C void SvgDocumentEndElementAt( SvgDocumentHandle aDocumentHandle,
+ SvgElementHandle aElementHandle,
+ TReal32 aOffsetTime ) __SOFTFP;
+
+ /**
+ * Set the given element to have the focus in the given SVG document.
+ * The initial focus is always <code>null</code> and setting
+ * <code>NULL</code> will remove the current focus.
+ * NOTE: Java doesn't use this method.
+ *
+ * @since 1.0
+ * @see javax.microedition.m2g.SVGImage#focusOn()
+ * @param aDocumentHandle SVG document handle
+ * @param aElementHandle The element to set the focus on.
+
+ * changes made for Focus-in/focus-out bug(AMIA-6T8EEG)
+ */
+ IMPORT_C void SvgDocumentFocusOn( SvgDocumentHandle aDocumentHandle,
+ SvgElementHandle aElementHandle );
+
+ /**
+ * Get the element having the focus.
+ * NOTE: Java doesn't use this method.
+ *
+ * @since 1.0
+ * @see javax.microedition.m2g.SVGImage#focusOn()
+ * @param aDocumentHandle SVG document handle
+ * @return The element focused.
+ */
+ IMPORT_C SvgElementHandle SvgDocumentGetFocus( SvgDocumentHandle aDocumentHandle );
+
+ /**
+ * Activate the element that has the focus.
+ * NOTE: Java doesn't use this method.
+ *
+ * @since 1.0
+ * @see javax.microedition.m2g.SVGImage#activate()
+ * @param aDocumentHandle SVG document handle
+ */
+ IMPORT_C void SvgDocumentActivate( SvgDocumentHandle aDocumentHandle );
+
+ /**
+ * Request a mouse event at the given coordinate.
+ * This method is used to dispatch a mouse "click" event to the given
+ * document. The mouse position is given as screen coordinates <code>aMouseX, aMouseY</code>.
+ * If the aMouseX, aMouseY values are outside the viewport area or no target is available
+ * for the aMouseX, aMouseY coordinates, the event is not dispatched.
+ *
+ * @since 1.0
+ * @see javax.microedition.m2g.SVGImage#dispatchMouseEvent()
+ * @param aDocumentHandle SVG document handle
+ * @param aMouseX The x location of the mouse/pointer in viewport coordinate system.
+ * @param aMouseX The y location of the mouse/pointer in viewport coordinate system.
+ * @return Element handle to where mouse was clicked. Return null if no hit.
+ */
+ IMPORT_C SvgElementHandle SvgDocumentDispatchMouseEvent( SvgDocumentHandle aDocumentHandle,
+ TInt aMouseX, TInt aMouseY );
+
+ /**
+ * Check if document has animation.
+ * NOTE: Java doesn't use this method.
+ *
+ * @since 1.0
+ * @param aDocumentHandle SVG document handle
+ * @param TBool . ETrue if animation present otherwise EFalse.
+ */
+ IMPORT_C TInt SvgDocumentHasAnimation( SvgDocumentHandle aDocumentHandle );
+
+
+ // ***********************************************************************
+ // SVG Element
+ // ***********************************************************************
+ /**
+ * Create a new svg element based on the specified
+ * (<code>aType</code>) SVG tag name. Only the following elements must be supported:
+ * <rect>, <circle>, <ellipse>, <line>,
+ * <path> <use> <image> <text>,
+ * <a> and <g>.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.Document#createElementNS()
+ * @param aType
+ * @return handle to the newly created SVG Element.
+ */
+ IMPORT_C SvgElementHandle SvgElementCreate( SvgAttrType aType );
+
+ /**
+ * Destroy svg element of the given handle.
+ * NOTE: Java doesn't use this method.
+ *
+ * @since 1.0
+ * @param hElement Element handle
+ */
+ IMPORT_C void SvgElementDestroy( SvgElementHandle hElement );
+
+ /**
+ * Returns a parent element of the given element.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGElement#getParentNode()
+ * @param aElementHandle Element handle
+ * @return The parent element or <code>NULL</code> if there is no parent
+ * (i.e. if a element has just been created and not yet added to the tree,
+ * or if it has been removed from the tree, this is null).
+ */
+ IMPORT_C SvgElementHandle SvgElementGetParent( SvgElementHandle aElementHandle );
+
+ /**
+ * Returns the first child element node of the given element.
+ * Return <code>NULL</code> if this element has no child elements.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGElement#getFirstElementChild()
+ * @param aElementHandle Element handle
+ * @return The first child element node of the given element.
+ */
+ IMPORT_C SvgElementHandle SvgElementGetFirstElementChild( SvgElementHandle aElementHandle );
+
+ /**
+ * Returns the next sibling element of the given element.
+ * Return <code>NULL</code> if the given element has no element sibling
+ * nodes that come after this one in the document tree.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGElement#getNextElementSibling()
+ * @param aElementHandle Element handle
+ * @return The next sibling element node of this element.
+ */
+ IMPORT_C SvgElementHandle SvgElementGetNextElementSibling( SvgElementHandle aElementHandle );
+
+ /**
+ * Append the given child element to the given svg element.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.Node#appendChild()
+ * @param aElementHandle Element handle
+ * @param aChildElementHandle New child element handle
+ * @return Next sibling element
+ */
+ IMPORT_C void SvgElementAppendChild( SvgElementHandle aElementHandle,
+ SvgElementHandle aChildElementHandle );
+
+ /**
+ * Remove the given child element from the given svg element.
+ * Elements that have ids cannot be removed from the tree.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.Node#removeChild()
+ * @param aElementHandle The parent element.
+ * @param aChildElementHandle The element that is to be removed
+ * TODO @return Handle to the removed element. Return <code>NULL</NULL>
+ * if operation failed.
+ */
+ IMPORT_C SvgElementHandle SvgElementRemoveChild( SvgElementHandle aElementHandle,
+ SvgElementHandle aChildElementHandle );
+
+ /**
+ * Inserts <code>aChildElementHandle</code> before <code>aReferenceElementHandle</code>
+ * in the child list for the <code>aElementHandle</code>. If <code>aReferenceElementHandle</code>
+ * is <code>NULL</code>, <code>aChildElementHandle</code> is inserted at the end of the list.
+ * If the <code>aChildElementHandle</code> is already part of the tree, it is first removed.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.Node#insertBefore()
+ * @param aElementHandle The parent element.
+ * @param aChildElementHandle The child to add
+ * @param aReferenceElementHandle The child before which the new child should be added.
+ * @throws TODO Should throw exception if the <code>aChildElementHandle</code> would cause
+ * the SVG document to go into error, for ex: when the newChild contains a <use>
+ * element with an invalid xlink:href attribute.
+ */
+ IMPORT_C void SvgElementInsertBefore( SvgElementHandle aElementHandle,
+ SvgElementHandle aChildElementHandle,
+ SvgElementHandle aReferenceElementHandle );
+
+ /**
+ * Request element type. The following element type are supported:
+ * <a>, <animate>, <animateColor>, <animateMotion>,
+ * <animateTransform> <circle> <defs> <ellipse>,
+ * <font>, <font-face>, <font-face-name>, <font-face-src>,
+ * <foreignObject>, <g>, <glyph>, <hkern>, <image>,
+ * <line>, <metadata>, <missing-glyph>, <metadata>, <mpath>.
+ * <path>, <polygon>, <polyline>, <rect>, <set>,
+ * <svg>, <switch>, <text>, <title>, <use>.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGElement
+ * @param aElementHandle The element.
+ * @return Element type.
+ */
+ IMPORT_C TInt SvgElementGetType( SvgElementHandle aElementHandle );
+
+ /**
+ * Check if document has animation.
+ * NOTE: Java doesn't use this method.
+ *
+ * @since 1.0
+ * @param aElementHandle SVG element handle
+ * @param TBool . ETrue if animation present otherwise EFalse.
+ */
+ IMPORT_C TInt SvgElementHasAnimation( SvgElementHandle aElementHandle );
+
+ /**
+ * Get a string attribute from the given element.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGElement
+ * @param aElementHandle The element.
+ * @param aAttributeName Attribute's name
+ * @return Attribute value.
+ */
+ IMPORT_C TInt SvgElementGetStringAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aAttributeName, TPtrC16& aStrAttribute );
+
+ /**
+ * Set a string attribute in the given element.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGElement
+ * @param aElementHandle The SVG element handle.
+ * @param aAttributeName Attribute's name
+ * @param aAttributeValue Atribute's value.
+ */
+ IMPORT_C void SvgElementSetStringAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aAttributeName,
+ const TPtrC16& aAttributeValue );
+
+ /**
+ * Get a color attribute from the given element.
+ * The values are copied into the color components given.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGRGBColor
+ * @param aElementHandle The element handle.
+ * @param aAttributeName Attribute's name
+ * @param aRedValue The red value
+ * @param aGreenValue The green value
+ * @param aBlueValue The blue value
+ * @return Integer containing the RGB value for the color.
+ */
+ IMPORT_C TInt SvgElementGetColorAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aAttribute,
+ TInt* aRedValue, TInt* aGreenValue, TInt* aBlueValue );
+
+ /**
+ * Set a color attribute for the given element.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGRGBColor
+ * @param aElementHandle The element.
+ * @param aAttribute Attribute's name
+ * @param aRedValue The red value
+ * @param aGreenValue The green value
+ * @param aBlueValue The blue value
+ */
+ IMPORT_C void SvgElementSetColorAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aAttribute,
+ TInt aRedValue, TInt aGreenValue, TInt aBlueValue );
+
+
+ /**
+ * Return a attribute (trait) value as float.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGElement#getFloatTrait()
+ * @param aElementHandle The element.
+ * @param aAttribute Attribute's (or trait's) name
+ * @return The attribute (or trait) value as float for the specified name.
+ */
+ IMPORT_C TReal32 SvgElementGetFloatAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aAttribute ) __SOFTFP;
+
+ /**
+ * Set the attribute (trait) value as float.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGElement#getFloatTrait()
+ * @param aElementHandle The element handle.
+ * @param aAttribute The name of the attribute (trait) to be set.
+ * @param aFloatValue The value of the attribute (trait) to be set as float.
+ */
+ IMPORT_C void SvgElementSetFloatAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aAttribute,
+ TReal32 aFloatValue ) __SOFTFP;
+
+ /**
+ * Set enum attribute (trait) value.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGElement
+ * @param aElementHandle The element handle.
+ * @param aAttribute The name of the attribute (trait) to be set.
+ * @param aValue The value of the attribute (trait) to be set.
+ */
+ IMPORT_C void SvgElementSetEnumAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aAttribute, short aValue );
+
+ /**
+ * Get enum attribute (trait) value.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGElement
+ * @param aElementHandle The element handle.
+ * @param aAttribute The name of the attribute (trait).
+ * @return The value of the attribute (trait).
+ */
+ IMPORT_C short SvgElementGetEnumAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aAttribute );
+
+ /**
+ * Return the rectangle attribute (trait) values.
+ * NOTE: The returned values are copies of the actual attribute (trait) values and
+ * will not change if the corresponding trait changes.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGElement#getRectTrait()
+ * @param aElementHandle The element handle.
+ * @param aRectAttribute The name of the attribute (trait) to retrieve.
+ * @param aX X coordinate.
+ * @param aY Y coordinate.
+ * @param aWidth Width.
+ * @param aHeight Height.
+ * @return <code>-1</code> if failed otherwise returns positive integer.
+ */
+ IMPORT_C TInt SvgElementGetRectAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aRectAttribute,
+ TReal32* aX, TReal32* aY, TReal32* aWidth, TReal32* aHeight ) __SOFTFP;
+
+ /**
+ * Set the rectangle attribute (trait) values.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGElement#setRectTrait()
+ * @param aElementHandle The element handle.
+ * @param aRectAttribute The name of the attribute (trait) to be set.
+ * @param aX X coordinate.
+ * @param aY Y coordinate.
+ * @param aWidth Width.
+ * @param aHeight Height.
+ */
+ IMPORT_C void SvgElementSetRectAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aRectAttribute,
+ TReal32 aX, TReal32 aY, TReal32 aWidth, TReal32 aHeight ) __SOFTFP;
+
+ /**
+ * Get the matrix attribute (trait) values.
+ * NOTE: The returned values are copies of the actual attribute (trait) values and
+ * will not change if the corresponding trait changes.
+ * <pre>
+ * [aAVal aCVal aEVal]
+ * [aBVal aDVal aFVal]
+ * </pre>
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGElement#getMatrixTrait()
+ * @param aElementHandle The element handle.
+ * @param aMatrixAttribute The name of the attribute (trait) to retrieve.
+ * @param aAVal The x scaling component
+ * @param aBVal The y shearing component
+ * @param aCVal The x shearing component
+ * @param aDVal The y scaling component
+ * @param aEVal The x translation component
+ * @param aFVal The y translation component
+ * @return TODO
+ */
+ IMPORT_C TInt SvgElementGetMatrixAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aMatrixAttribute,
+ TReal32* aAVal, TReal32* aBVal, TReal32* aCVal,
+ TReal32* aDVal, TReal32* aEVal, TReal32* aFVal ) __SOFTFP;
+
+ /**
+ * Set the matrix attribute (trait) values.
+ * <pre>
+ * [aAVal aCVal aEVal]
+ * [aBVal aDVal aFVal]
+ * </pre>
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGElement#setMatrixTrait()
+ * @param aElementHandle The element handle.
+ * @param aMatrixAttribute The name of the attribute (trait) to be set.
+ * @param aAVal The x scaling component
+ * @param aBVal The y shearing component
+ * @param aCVal The x shearing component
+ * @param aDVal The y scaling component
+ * @param aEVal The x translation component
+ * @param aFVal The y translation component
+ */
+ IMPORT_C void SvgElementSetMatrixAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aMatrixAttribute,
+ TReal32 aAVal, TReal32 aBVal, TReal32 aCVal,
+ TReal32 aDVal, TReal32 aEVal, TReal32 aFVal ) __SOFTFP;
+
+ /**
+ * Get the path attribute (trait)value.
+ * NOTE: The returned values are copies of the actual attribute values and will not change if
+ * the corresponding trait changes.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGElement#getPathTrait()
+ * @see org.w3c.dom.svg.SVGPath
+ * @param aElementHandle The element handle.
+ * @param aPathAttribute The name of the attribute (trait) to retrieve.
+ * @return The handle to path object. <code>NULL</code> if not successed.
+ */
+ IMPORT_C TInt SvgElementGetPathAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aPathAttribute );
+
+ /**
+ * Set the path attribute (trait) value.
+ * NOTE: Value is a copy in the trait so subsequent changes to the given
+ * <code>aPathHandle</code> have no effect on the value of the attribute (trait).
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGElement#setPathTrait()
+ * @see org.w3c.dom.svg.SVGPath
+ * @param aElementHandle The element handle.
+ * @param aPathAttribute The name of the attribute (trait) to be set.
+ * @param aPathHandle The value of the attribute (trait) to be set as.
+ */
+ IMPORT_C void SvgElementSetPathAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aPathAttribute , SvgPathHandle aPathHandle);
+
+ /**
+ * Returns the tight bounding box in current user coordinate space.
+ * Tight bounding box is the smallest possible rectangle that includes the geometry
+ * of all contained graphics elements excluding stroke.
+ * The calculation is done in the user coordinate space of the element. When bounding box
+ * is calculated elements with display property (trait) set to none are ignored.
+ * Exact rules for the bounding box calculation are given in the
+ * <a href="http://www.w3.org/TR/SVG/coords.html#ObjectBoundingBox">SVG spec</a>.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGLocatableElement#getBBox()
+ * @param aElementHandle The element handle.
+ * @param aAttributeType The name of the attribute (trait) to retrieve.
+ * @param aX X coordinate.
+ * @param aY Y coordinate.
+ * @param aWidth Width.
+ * @param aHeight Height.
+ */
+ IMPORT_C void SvgElementGetBBox( SvgElementHandle aElementHandle,
+ SvgAttrType aAttributeType,
+ TReal32* aX, TReal32* aY, TReal32* aWidth, TReal32* aHeight ) __SOFTFP;
+
+ /**
+ * Add event listener to the given element.
+ * Note: need to replace void* with specific class
+ * NOTE: Java doesn't use this method.
+ *
+ * @since 1.0
+ * @param aElementHandle The element handle.
+ * @param aListener Listener
+ * @param aType Type
+ */
+ IMPORT_C void SvgElementAddEventListener( SvgElementHandle aElementHandle,
+ TInt aListener, SvgAttrType aType );
+
+ /**
+ * Remove event listener from the given element.
+ * Note: need to replace void* with specific class
+ * NOTE: Java doesn't use this method.
+ *
+ * @since 1.0
+ * @param aElementHandle The element handle.
+ * @param aListener Listener
+ * @param aType Type
+ */
+ IMPORT_C void SvgElementRemoveEventListener( SvgElementHandle aElementHandle,
+ TInt aListener, SvgAttrType aType );
+ /**
+ * Check if element is active.
+ * i.e. an animation element is active in these cases:
+ * <ul>
+ * <li>
+ * A media time is 1s.
+ * <pre>
+ * <rect id=<element> x=<0> y=<20> width=<20> height=<20>>
+ <animate id=<animationElement> attributeName=<x> attributeType=<XML>
+ begin=<1s> dur=<4s> end=<2s> fill=<freeze>
+ from=<0> to=<80>
+ </animate>
+ </rect>
+ * </pre>
+ * </li>
+ * <li>
+ * A media time is 2s.
+ * <pre>
+ * <rect id=<element> x=<0> y=<20> width=<20> height=<20>>
+ <animate id=<animationElement> attributeName=<x> attributeType=<XML>
+ begin=<1s> dur=<4s> end=<2s> fill=<freeze>
+ from=<0> to=<80>
+ </animate>
+ </rect>
+ * </pre>
+ * </li>
+ * </ul>
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGAnimationElement#endElementAt()
+ * @param aElementHandle The element handle.
+ * @return Positive integer if element is active.
+ */
+ IMPORT_C TInt SvgElementIsActive( SvgElementHandle aElementHandle );
+
+ /**
+ * Check if the given element is removable (no id or children with ids).
+ *
+ * @since 1.0
+ * @see org.w3c.dom.Node#removeChild()
+ * @param aElementHandle The element handle.
+ * @return Positive integer if element is removeable.
+ */
+ IMPORT_C TInt SvgElementCheckRemoveable( SvgElementHandle aElementHandle );
+
+ // ***********************************************************************
+ // SVG Path
+ // ***********************************************************************
+ /**
+ * Creates new path object that is empty.
+ * This object can be used to modify value of path traits
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGSVGElement#createSVGPath()
+ * @see org.w3c.dom.svg.SVGPath
+ * @return The newly created path object handle with empty path commands.
+ */
+ IMPORT_C SvgPathHandle SvgPathCreate();
+
+ /**
+ * Destroy the specified path path
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGPath
+ * @param aPathHandle Handle to the path to be deleted.
+ */
+ IMPORT_C void SvgPathDestroy( SvgPathHandle aPathHandle );
+
+ /**
+ * Get the segment count of the given path.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGPath#getNumberOfSegments()
+ * @param aPathHandle The path handle.
+ * @return Segment count
+ */
+ IMPORT_C TInt SvgPathGetSegmentCount( SvgPathHandle aPathHandle );
+
+ /**
+ * Returns segment command by zero-based command index.
+ * Returns one of <code>MOVE_TO</code>, <code>LINE_TO</code>,
+ * <code>CURVE_TO</code>, <code>QUAD_TO</code> or <code>CLOSE</code>.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGPath#getSegment()
+ * @param aPathHandle The path handle.
+ * @param aSegmentIndex The command index for the segment command to retrieve.
+ * @return The segment command for the specified aSegmentIndex.
+ */
+ IMPORT_C TInt SvgPathGetSegmentType( SvgPathHandle aPathHandle, TInt aSegmentIndex );
+
+ /**
+ * Returns segment parameter by zero-based command index and zero-based parametr index.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGPath#getSegmentParameter()
+ * @param aPathHandle The path handle.
+ * @param aSegmentIndex The command index for the segment command to retrieve.
+ * @param aSegmentParameterIndex The parameter index for the segment parameter to retrieve.
+ * @return the segment parameter for the specified aSegmentIndex and aSegmentParameterIndex.
+ */
+ IMPORT_C TReal32 SvgPathGetSegmentParameter( SvgPathHandle aPathHandle,
+ TInt aSegmentIndex,
+ TInt aSegmentParameterIndex ) __SOFTFP;
+
+ /**
+ * Appends 'M' (absolute move) segment to the path with the specified coordinates.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGPath#moveTo()
+ * @param aPathHandle The path handle.
+ * @param aX The x-axis coordinate for the specified point.
+ * @param aY The y-axis coordinate for the specified point.
+ */
+ IMPORT_C void SvgPathAddMoveTo( SvgPathHandle aPathHandle, TReal32 aX, TReal32 aY ) __SOFTFP;
+
+ /**
+ * Appends 'L' (absolute line) segment to the path with the specified coordinates.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGPath#moveTo()
+ * @param aPathHandle The path handle.
+ * @param aX The x-axis coordinate for the specified point.
+ * @param aY The y-axis coordinate for the specified point.
+ */
+ IMPORT_C void SvgPathAddLineTo( SvgPathHandle aPathHandle, TReal32 aX, TReal32 aY ) __SOFTFP;
+
+ /**
+ * Appends 'Q' (absolute quadratic curve) segment to the path.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGPath#quadTo()
+ * @param aPathHandle The path handle.
+ * @param aX1 the x-axis coordinate of the first control point.
+ * @param aY1 the y-axis coordinate of the first control point.
+ * @param aX2 the x-axis coordinate of the final end point.
+ * @param aY2 the y-axis coordinate of the final end point.
+ *
+ */
+ IMPORT_C void SvgPathAddQuadTo( SvgPathHandle aPathHandle,
+ TReal32 aX1, TReal32 aY1,
+ TReal32 aX2, TReal32 aY2 ) __SOFTFP;
+
+ /**
+ * Appends 'C' (absolute cubic curve) segment to the path.
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGPath#curveTo()
+ * @param aPathHandle The path handle.
+ * @param aX1 the x-axis coordinate of the first control point.
+ * @param aY1 the y-axis coordinate of the first control point.
+ * @param aX2 the x-axis coordinate of the second end point.
+ * @param aY2 the y-axis coordinate of the second end point.
+ * @param aX3 the x-axis coordinate of the final end point.
+ * @param aY3 the y-axis coordinate of the final end point.
+ *
+ */
+ IMPORT_C void SvgPathAddCurveTo( SvgPathHandle aPathHandle,
+ TReal32 aX1, TReal32 aY1,
+ TReal32 aX2, TReal32 aY2,
+ TReal32 aX3, TReal32 aY3 ) __SOFTFP;
+ /**
+ * Appends 'Z' (close path) segment to the path
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGPath#close()
+ * @param aPathHandle The path handle.
+ */
+ IMPORT_C void SvgPathAddClose( SvgPathHandle aPathHandle );
+
+ /**
+ * Update path info.
+ * NOTE: Java doesn't use this method.
+ *
+ * @since 1.0
+ * @param aElementHandle The element handle.
+ * @param aPathHandle The path handle.
+ */
+ IMPORT_C void SvgElementUpdatePath( SvgElementHandle aElementHandle, SvgPathHandle aPathHandle );
+
+ /**
+ * Find whether the element is present in a document.
+ *
+ * @since 1.0
+ * @param hDocument The SVG document handle.
+ * @param hElement The element handle.
+ * @return Positive integer if the element presents in the given SVG document.
+ */
+ IMPORT_C TInt SvgElementElementInDOM ( TInt hDocument, TInt hElement );
+
+ /**
+ * Checks whether this element is child of a use element.
+ *
+ * @since 1.0
+ * @see javax.microedition.m2g.SVGImage#dispatchMouseEvent()
+ * @param hElement The element handle.
+ * @return Postivive integer if the element is child of a use element.
+ */
+ IMPORT_C TInt SvgElementIsUsed ( TInt hElement );
+
+ /**
+ * Finds the handle to the actual cloned element.
+ *
+ * @since 1.0
+ * @see javax.microedition.m2g.SVGImage#dispatchMouseEvent()
+ * @param hElement aElement This is handle to the cloned element. this is child of the
+ * <use> element.
+ * @return Element handle to the actual element, which is cloned.
+ */
+ IMPORT_C TInt SvgElementGetUsedFromElement ( TInt hElement );
+
+ /**
+ * Gets a screen bounding box for the given element.
+ * Returns the tight bounding box in screen coordinate space. Tight bounding box is the smallest
+ * possible rectangle that includes the geometry of all contained graphics elements excluding
+ * stroke. The box coordinates are in the screen coordinate space, which is connected to the
+ * current user coordinate space by the matrix returned by <code>SvgElementGetMatrixAttribute</code>
+ * (with attribute id=<svg>).
+ *
+ * @since 1.0
+ * @see org.w3c.dom.svg.SVGLocatableElement#getScreenBBox()
+ * @see org.w3c.dom.svg.SVGLocatableElement#getScreenCTM()
+ * @param hElement The element handle.
+ */
+ IMPORT_C void SvgElementGetScreenBBox( TInt hElement, TReal32* x,TReal32* y, TReal32* w, TReal32* h ) __SOFTFP;
+
+ /**
+ * Set the focus out of the given element.
+ * The initial focus is always <code>null</code> and setting
+ * <code>NULL</code> will remove the current focus.
+ * NOTE: Java doesn't use this method.
+ *
+ * @since 1.0
+ * @see javax.microedition.m2g.SVGImage#focusOut()
+ * @param aDocumentHandle SVG document handle
+ * @param aElementHandle The element for which to set the focus out.
+
+ * changes made for Focus-in/focus-out bug(AMIA-6T8EEG)
+ */
+ IMPORT_C void CSvgJavaInterfaceImpl::SvgDocumentFocusOut( SvgDocumentHandle aDocumentHandle,
+ SvgElementHandle aElementHandle);
+
+ /*
+ * Maps the PATH segment type from SVG to JSR.
+ */
+
+ TInt MapSegmentType(TInt aSvgSegmentType);
+
+ /*
+ * LISTENER IMPLEMENTATIONS FROM THE ENGINE
+ */
+
+ TBool MouseEntered( RPointerArray<CSvgElementImpl>& aElements, TInt aX, TInt aY );
+
+ TBool MouseExited( RPointerArray<CSvgElementImpl>& aElements, TInt aX, TInt aY );
+
+ TBool MouseMoved( RPointerArray<CSvgElementImpl>& aElements, TInt aX, TInt aY );
+
+ TBool MousePressed( RPointerArray<CSvgElementImpl>& aElements, TInt aX, TInt aY );
+
+ TBool MouseReleased( RPointerArray<CSvgElementImpl>& aElements, TInt aX, TInt aY );
+
+public:
+ CSvgDocumentImpl* iTempDoc;
+
+private:
+
+ TBool IsAnimationElemId( const TInt aElementId );
+ /**
+ * Gets The corresponding JSR-to-SVG element id. Ids of the elements differ in the svg
+ * engine and the JSR-API's.
+ */
+ TInt SvgGetElementTypeMappingJSRtoSVG( SvgAttrType aType );
+ /**
+ * Gets The corresponding SVG-to-JSR element id. Ids of the elements differ in the svg
+ * engine and the JSR-API's.
+ */
+ SvgAttrType SvgGetElementTypeMappingSVGtoJSR( const TInt aElementId);
+
+ /**
+ * Gets the attribute type mapping from SVG to JSR. Attribute t
+ *
+ */
+ SvgAttrType SvgGetAttributeTypeMappingSVGtoJSR( const TInt aElementId);
+ /**
+ * Gets the attribute type mapping from JSR to SVG. Attribute t
+ *
+ */
+ TInt SvgGetAttributeTypeMappingJSRtoSVG( SvgAttrType aType );
+ /**
+ * Gets the Enumeration value mapping from JSR to SVG. Attribute t
+ *
+ */
+ TInt SvgEnumerationMappingJSRtoSVG(const TInt aAttributeId, TInt aJsrEnumValue);
+ /**
+ * Gets the Enumeration value to string mapping from JSR to SVG. Attribute t
+ *
+ */
+ TInt SvgEnumerationtoStringMappingJSRtoSVG(const TInt aAttributeId, short aJsrEnumValue, TDes& aValue);
+ /**
+ * Gets the string to enumeration value mapping from SVG to JSR. Attribute t
+ *
+ */
+ TInt SvgStringtoEnumerationMappingSVGtoJSR(const TInt aAttrbuteId , TPtrC16 aValue);
+ /**
+ * Gets the Enumeration value mapping from JSR to SVG. Attribute t
+ *
+ */
+ TInt SvgEnumerationMappingSVGtoJSR(const TInt aAttributeId, TInt32 aSvgEnumValue);
+
+private:
+ CSvgJavaInterfaceImpl();
+ void ConstructL( TFontSpec& aFontSpec );
+ void ConstructL();
+
+private:
+
+};
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgt_plat/svgt_api/inc/SvgListener.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,415 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine header file
+ *
+*/
+
+
+#ifndef __INC_MSVGLISTENER__
+#define __INC_MSVGLISTENER__
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include <mxmlattributes.h>
+
+class CSvgElementImpl;
+
+// Typedef xml attribute list to allow switching of parser without
+// having to change APIs for MLoadingListener.
+typedef MXMLAttributes MSvgAttributeList;
+
+/**
+ * This empty virtual class is defined to be the root class for
+ * SVG Listener interfaces (all pure virtual functions). The MSvgListener
+ * name will be used for parameters of AddListener and RemoveListener
+ * along with a type parameter to specific the subclass.
+ *
+ * This will allow new Listener class to be added without having to
+ * add new Add/Remove listener methods to the exported interfaces.
+ *
+ * Existing listeners (Hyperlink, etc.) and their Add/Remove methods
+ * will remain the same.
+ */
+class MSvgListener
+ {
+ };
+
+/**
+ * Enumeration to define supported listener classes for
+ * AddListener/RemoveListener methods.
+ */
+enum TSvgListenerType
+ {
+ ESvgLoadingListener = 0,
+ ESvgMouseListener,
+ ESvgHyperlinkListener,
+ ESvgTextAreaListener,
+ ESvgTextListener,
+ ESvgInteractiveElementListener,
+ ESvgViewPortListener
+
+ };
+
+/**
+ * This interface is the callback mechanism for the SVG Engine to communicate to
+ * interested clients about svg-file loading/parsing progress. The client (listener) is
+ * notified at the start and end of the document, at the start and end of an element.
+ *
+ * The ReportAllElements method controls if all elements should be reported or only
+ * the direct children of the root <svg> element is reported.
+
+ * Included in this interface are notifications for external data requests: when one is
+ * initiated, received or failed. External data requests include embedded images or svg-files.
+ *
+ * @lib SVGEngine.lib
+ * @since 3.1
+ */
+class MSvgLoadingListener : public MSvgListener
+ {
+ public:
+
+ /**
+ * Query the listener if every element is to be reported or only
+ * the children of <svg> tag.
+ *
+ * @since 1.0
+ * @return : ETrue if every element is to be reported, otherwise
+ * only the children of <svg> are reported.
+ */
+ virtual TBool ReportAllElements() = 0;
+
+ /**
+ * Query the listener if client will call 'AssignImageData' to decode images
+ * separately from parsing. This is used to avoid non-thread-safe calls in
+ * creating bitmap and decoding images, which must be executed in the main thread.
+ *
+ * @since 1.0
+ * @return : ETrue to use 'ImageDataReference' instead of 'FetchImage'.
+ */
+ virtual TBool WillAssignImageData() = 0;
+
+ /**
+ * Callback when the href:xlink attribute is encountered for the <image>
+ * element. This method is used to notify clients of image data references
+ * needed by <image> element. This method is called only when 'WillAssignImageData'
+ * returns ETrue.
+ *
+ * @since 1.0
+ * @return : none.
+ */
+ virtual void ImageDataReference( const TDesC& aUri ) = 0;
+
+ /**
+ * Notified when the start of a svg document(<svg> tag) is encountered.
+ *
+ * @since 1.0
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool DocumentStart() = 0;
+
+ /**
+ * Notified when the end of a svg document(</svg> tag) is encountered.
+ *
+ * @since 1.0
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool DocumentEnd() = 0;
+
+ /**
+ * Notified when the start of a svg element is encountered.
+ *
+ * @since 1.0
+ * @param : aTagName -- name of svg tag
+ * @param : aAttributeList -- attribute list.
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool ElementStart( const TDesC& aTagName,
+ MSvgAttributeList& aAttributeList) = 0;
+
+ /**
+ * Notified when the end of a svg element is encountered.
+ * activated.
+ *
+ * @since 1.0
+ * @param : aTagName -- name of svg tag
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool ElementEnd( const TDesC& aTagName ) = 0;
+
+ /**
+ * Notified when an external data is needed by the svg document,
+ * such as a image-file or an embedded svg-file.
+ *
+ * @since 1.0
+ * @param : aUri -- URI string of external data
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool ExternalDataRequested( const TDesC& aUri ) = 0;
+
+ /**
+ * Notified when an external data has been retrieved,
+ * such as a image-file or an embedded svg-file.
+ *
+ * @since 1.0
+ * @param : aUri -- URI string of external data
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool ExternalDataReceived( const TDesC& aUri ) = 0;
+
+ /**
+ * Notified when an external data request has failed.
+ *
+ * @since 1.0
+ * @param : aUri -- URI string of external data
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool ExternalDataRequestFailed( const TDesC& aUri ) = 0;
+
+ /**
+ * Notified when an unsupported element is encountered.
+ *
+ * @since 1.0
+ * @param : aTagName -- tag name of element
+ * @param : aAttributeList -- attribute list.
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool UnsupportedElement( const TDesC& aTagName,
+ MSvgAttributeList& aAttributeList ) = 0;
+
+ virtual void ImagesLoaded(TInt aError)=0;
+
+ };
+
+/**
+ * This interface is the callback mechanism for the SVG Engine to communicate to
+ * interested clients about mouse clicking
+ *
+ *
+ * @lib SVGEngine.lib
+ * @since 3.1
+ */
+class MSvgMouseListener : public MSvgListener
+ {
+ public:
+ /**
+ * Notified when the mouse pointer enters a visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool MouseEntered( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY ) = 0;
+
+ /**
+ * Notified when the mouse pointer exits a visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool MouseExited( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY ) = 0;
+
+ /**
+ * Notified when the mouse pointer has already entered a visible
+ * svg element and just moved but remains inside its bounding-box.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool MouseMoved( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY ) = 0;
+
+ /**
+ * Notified when the mouse pointer is pressed down on visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool MousePressed( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY ) = 0;
+
+ /**
+ * Notified when the mouse pointer is released on on visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool MouseReleased( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY ) = 0;
+
+ };
+
+/**
+ * This interface is the callback mechanism for the SVG Engine to communicate to
+ * interested clients about text area interaction.
+ *
+ * @lib SVGEngine.lib
+ * @since 3.1
+ */
+class MSvgTextAreaListener : public MSvgListener
+ {
+ public:
+ /**
+ * Notified when a pointer enters a textbox element.
+ *
+ * @since 1.0
+ * @param : aUri -- handle of a textbox
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool TextAreaEntered( TInt aTextAreaHandle ) = 0;
+
+ /**
+ * Notified when a pointer exits a textbox element.
+ *
+ * @since 1.0
+ * @param : aTextBox -- handle of a textbox
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool TextAreaExited( TInt aTextAreaHandle ) = 0;
+
+ /**
+ * This method is called to notify the client that a link has been
+ * activated.
+ *
+ * @since 1.0
+ * @param : aUri -- handle of a textbox
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool TextAreaActivated( TInt aTextAreaHandle ) = 0;
+
+ };
+
+/**
+ * This interface is the callback mechanism for the SVG Engine to communicate to
+ * interested clients about text element interaction.
+ *
+ * @lib SVGEngine.lib
+ * @since 3.1
+ */
+class MSvgTextListener : public MSvgListener
+ {
+ public:
+ /**
+ * Notified when a pointer enters a text element.
+ *
+ * @since 1.0
+ * @param : aUri -- handle of a text
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool TextEntered( TInt aTextHandle ) = 0;
+
+ /**
+ * Notified when a pointer exits a text element.
+ *
+ * @since 1.0
+ * @param : aText -- handle of a text
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool TextExited( TInt aTextHandle ) = 0;
+
+ /**
+ * This method is called to notify the client that a link has been
+ * activated.
+ *
+ * @since 1.0
+ * @param : aUri -- handle of a text
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool TextActivated( TInt aTextHandle ) = 0;
+
+ };
+ class MSvgViewPortListener : public MSvgListener
+ {
+ public:
+ /**
+ *
+ *
+ * @since 1.0
+ * @param aErrorStatus : error status if any.
+ * @return
+ */
+ virtual void GetViewPort(TInt getWidth, TInt getHeight, TBool isWidthInPer, TBool isHeightInPer, TInt &setWidth, TInt &setHeight) = 0;
+ };
+
+/**
+ * This interface is the callback mechanism for the SVG Engine to communicate to
+ * interested clients about interactive elements in the svg content.
+ *
+ * @lib SVGEngine.lib
+ * @since v3.2
+ */
+class MSvgInteractiveElementListener: public MSvgListener
+ {
+ public:
+
+ /**
+ * Notified when a pointer enters an interactive element.
+ * @Since v3.2
+ * @param : aElementIdPtr - Pointer to the xml Id of the element
+ * if exists else points to an empty string
+ * @param : aInteractonTypeList - Indicates the the type interactions
+ * possible with that element
+ * e.g: aInteractonTypeList=0x9 then "focusin" and "click"
+ * events are possible interaction types for the element *interactive events
+ * @return: For future use. Value can be ignored
+ */
+ virtual TBool InteractiveElementEntered(TPtrC aElementIdPtr, TUint16 aInteractonTypeList ) = 0;
+
+ /**
+ * Notified when a pointer exits from an interactive element.
+ * @Since v3.2
+ * @param : aElementIdPtr - Pointer to the xml Id of the element
+ * if exists else points to an empty string
+ * @return: For future use.Value can be ignored
+ */
+
+ virtual TBool InteractiveElementExited(TPtrC aElementIdPtr ) = 0;
+
+ };
+
+/**
+ * Enumeration to define supported interactive events
+ * for the elements.
+ */
+enum TSvgInteractionEvent
+ {
+ ESvgInteractiveEventFocusin = 0x1,
+ ESvgInteractiveEventFocusout = 0x2,
+ ESvgInteractiveEventActivate = 0x4,
+ ESvgInteractiveEventClick = 0x8,
+ ESvgInteractiveEventMousedown = 0x10,
+ ESvgInteractiveEventMouseup = 0x20,
+ ESvgInteractiveEventMouseover = 0x40,
+ ESvgInteractiveEventMousemove = 0x80,
+ ESvgInteractiveEventMouseout = 0x100
+ };
+
+#endif /*__INC_MSVGLISTENER__*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgt_plat/svgt_api/svgt_api.metaxml Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,19 @@
+<?xml version="1.0" ?>
+<api id="cfa6ced861c42751dd3c0e14f042b7b5" dataversion="2.0">
+ <name>SVGT API</name>
+ <description>Prrovides for parsing, decoding, manipulating, and managing of SVG content.</description>
+ <type>c++</type>
+ <collection>domain</collection>
+ <libs>
+ <lib name="SVGEngine.lib" />
+ <lib name="SVGEngineJI.lib" />
+ </libs>
+ <release category="platform"/>
+ <attributes>
+ <!-- This indicates wether the api provedes separate html documentation -->
+ <!-- or is the additional documentation generated from headers. -->
+ <!-- If you are unsuere then the value is "no" -->
+ <htmldocprovided>no</htmldocprovided>
+ <adaptation>no</adaptation>
+ </attributes>
+</api>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/BWINSCW/SVGENGINE-OpenVGU.def Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,194 @@
+EXPORTS
+ ??0CSvgEngineInterfaceImpl@@QAE@XZ @ 1 NONAME ; CSvgEngineInterfaceImpl::CSvgEngineInterfaceImpl(void)
+ ??1CSvgEngineInterfaceImpl@@UAE@XZ @ 2 NONAME ; CSvgEngineInterfaceImpl::~CSvgEngineInterfaceImpl(void)
+ ?ADDCloseTo@CSvgEngineInterfaceImpl@@QAEXPAVCGfxGeneralPath@@@Z @ 3 NONAME ; void CSvgEngineInterfaceImpl::ADDCloseTo(class CGfxGeneralPath *)
+ ?ADDCurveTo@CSvgEngineInterfaceImpl@@QAEXPAVCGfxGeneralPath@@MMMMMM@Z @ 4 NONAME ; void CSvgEngineInterfaceImpl::ADDCurveTo(class CGfxGeneralPath *, float, float, float, float, float, float)
+ ?ADDLineTo@CSvgEngineInterfaceImpl@@QAEXPAVCGfxGeneralPath@@MM@Z @ 5 NONAME ; void CSvgEngineInterfaceImpl::ADDLineTo(class CGfxGeneralPath *, float, float)
+ ?ADDMoveTo@CSvgEngineInterfaceImpl@@QAEXPAVCGfxGeneralPath@@MM@Z @ 6 NONAME ; void CSvgEngineInterfaceImpl::ADDMoveTo(class CGfxGeneralPath *, float, float)
+ ?ADDQuadTo@CSvgEngineInterfaceImpl@@QAEXPAVCGfxGeneralPath@@MMMM@Z @ 7 NONAME ; void CSvgEngineInterfaceImpl::ADDQuadTo(class CGfxGeneralPath *, float, float, float, float)
+ ?ActivateObjectInFocus@CSvgEngineInterfaceImpl@@QAEXXZ @ 8 NONAME ; void CSvgEngineInterfaceImpl::ActivateObjectInFocus(void)
+ ?AddAnimationListener@CSvgEngineInterfaceImpl@@QAEXPAVMSvgAnimationListener@@H@Z @ 9 NONAME ; void CSvgEngineInterfaceImpl::AddAnimationListener(class MSvgAnimationListener *, int)
+ ?AddExternalData@CSvgEngineInterfaceImpl@@QAEPAVCSvgElementImpl@@PAVCSvgDocumentImpl@@ABVTDesC16@@ABVTDesC8@@HHH@Z @ 10 NONAME ; class CSvgElementImpl * CSvgEngineInterfaceImpl::AddExternalData(class CSvgDocumentImpl *, class TDesC16 const &, class TDesC8 const &, int, int, int)
+ ?AddHyperlinkListener@CSvgEngineInterfaceImpl@@QAEXPAVMSvgHyperlinkListener@@H@Z @ 11 NONAME ; void CSvgEngineInterfaceImpl::AddHyperlinkListener(class MSvgHyperlinkListener *, int)
+ ?AddListener@CSvgEngineInterfaceImpl@@QAEXPBVMSvgListener@@W4TSvgListenerType@@H@Z @ 12 NONAME ; void CSvgEngineInterfaceImpl::AddListener(class MSvgListener const *, enum TSvgListenerType, int)
+ ?AddTextAreaListener@CSvgEngineInterfaceImpl@@QAEHPAVMSvgTextAreaListener@@H@Z @ 13 NONAME ; int CSvgEngineInterfaceImpl::AddTextAreaListener(class MSvgTextAreaListener *, int)
+ ?AddTextListener@CSvgEngineInterfaceImpl@@QAEHPAVMSvgTextListener@@H@Z @ 14 NONAME ; int CSvgEngineInterfaceImpl::AddTextListener(class MSvgTextListener *, int)
+ ?AddToEventReceiverList@CSvgEngineInterfaceImpl@@QAEXPAVCXmlElementImpl@@E@Z @ 15 NONAME ; void CSvgEngineInterfaceImpl::AddToEventReceiverList(class CXmlElementImpl *, unsigned char)
+ ?AppendChild@CSvgEngineInterfaceImpl@@QAEXPAVCXmlElementImpl@@0H@Z @ 16 NONAME ; void CSvgEngineInterfaceImpl::AppendChild(class CXmlElementImpl *, class CXmlElementImpl *, int)
+ ?AssignImageData@CSvgEngineInterfaceImpl@@QAEXABVTDesC16@@PAVHBufC8@@@Z @ 17 NONAME ; void CSvgEngineInterfaceImpl::AssignImageData(class TDesC16 const &, class HBufC8 *)
+ ?CancelLoad@CSvgEngineInterfaceImpl@@QAEXH@Z @ 18 NONAME ; void CSvgEngineInterfaceImpl::CancelLoad(int)
+ ?ChooseViewBoxIfNotSet@CSvgEngineInterfaceImpl@@QAEXH@Z @ 19 NONAME ; void CSvgEngineInterfaceImpl::ChooseViewBoxIfNotSet(int)
+ ?ClearFrameBuffer@CSvgEngineInterfaceImpl@@QAEXPAVCFbsBitmap@@KH@Z @ 20 NONAME ; void CSvgEngineInterfaceImpl::ClearFrameBuffer(class CFbsBitmap *, unsigned long, int)
+ ?ConstructL@CSvgEngineInterfaceImpl@@IAEXPAVCFbsBitmap@@PAVMSvgRequestObserver@@AAVTFontSpec@@@Z @ 21 NONAME ; void CSvgEngineInterfaceImpl::ConstructL(class CFbsBitmap *, class MSvgRequestObserver *, class TFontSpec &)
+ ?ConstructL@CSvgEngineInterfaceImpl@@IAEXXZ @ 22 NONAME ; void CSvgEngineInterfaceImpl::ConstructL(void)
+ ?ContentDimensions@CSvgEngineInterfaceImpl@@QAE?AVTSize@@H@Z @ 23 NONAME ; class TSize CSvgEngineInterfaceImpl::ContentDimensions(int)
+ ?ContentDimensions@CSvgEngineInterfaceImpl@@QAEXAAM0H@Z @ 24 NONAME ; void CSvgEngineInterfaceImpl::ContentDimensions(float &, float &, int)
+ ?ContentDimensionsInPercentage@CSvgEngineInterfaceImpl@@QAE?AVTSize@@H@Z @ 25 NONAME ; class TSize CSvgEngineInterfaceImpl::ContentDimensionsInPercentage(int)
+ ?CreateElementL@CSvgEngineInterfaceImpl@@QAEPAVCXmlElementImpl@@PAVCSvgDocumentImpl@@H@Z @ 26 NONAME ; class CXmlElementImpl * CSvgEngineInterfaceImpl::CreateElementL(class CSvgDocumentImpl *, int)
+ ?CurrentState@CSvgEngineInterfaceImpl@@QAEHH@Z @ 27 NONAME ; int CSvgEngineInterfaceImpl::CurrentState(int)
+ ?CustomOption@CSvgEngineInterfaceImpl@@QAEXHH@Z @ 28 NONAME ; void CSvgEngineInterfaceImpl::CustomOption(int, int)
+ ?DeleteDom@CSvgEngineInterfaceImpl@@QAEPAVMSvgError@@H@Z @ 29 NONAME ; class MSvgError * CSvgEngineInterfaceImpl::DeleteDom(int)
+ ?Destroy@CSvgEngineInterfaceImpl@@QAEXXZ @ 30 NONAME ; void CSvgEngineInterfaceImpl::Destroy(void)
+ ?DestroyDocument@CSvgEngineInterfaceImpl@@QAEXPAVCSvgDocumentImpl@@@Z @ 31 NONAME ; void CSvgEngineInterfaceImpl::DestroyDocument(class CSvgDocumentImpl *)
+ ?DestroyElement@CSvgEngineInterfaceImpl@@QAEXPAVCXmlElementImpl@@@Z @ 32 NONAME ; void CSvgEngineInterfaceImpl::DestroyElement(class CXmlElementImpl *)
+ ?DestroyEngine@CSvgEngineInterfaceImpl@@QAEXPAVCSvgEngineImpl@@@Z @ 33 NONAME ; void CSvgEngineInterfaceImpl::DestroyEngine(class CSvgEngineImpl *)
+ ?DispatchFocusInEvent@CSvgEngineInterfaceImpl@@QAEXPAVCSvgDocumentImpl@@PAVCSvgElementImpl@@@Z @ 34 NONAME ; void CSvgEngineInterfaceImpl::DispatchFocusInEvent(class CSvgDocumentImpl *, class CSvgElementImpl *)
+ ?DispatchFocusOutEvent@CSvgEngineInterfaceImpl@@QAEXPAVCSvgDocumentImpl@@PAVCSvgElementImpl@@@Z @ 35 NONAME ; void CSvgEngineInterfaceImpl::DispatchFocusOutEvent(class CSvgDocumentImpl *, class CSvgElementImpl *)
+ ?DispatchMouseEventsAt@CSvgEngineInterfaceImpl@@QAEHPAVCSvgDocumentImpl@@HHPAVMSvgMouseListener@@@Z @ 36 NONAME ; int CSvgEngineInterfaceImpl::DispatchMouseEventsAt(class CSvgDocumentImpl *, int, int, class MSvgMouseListener *)
+ ?DrawBox@CSvgEngineInterfaceImpl@@QAEPAVCSvgElementImpl@@VTRect@@H@Z @ 37 NONAME ; class CSvgElementImpl * CSvgEngineInterfaceImpl::DrawBox(class TRect, int)
+ ?Duration@CSvgEngineInterfaceImpl@@QAEKH@Z @ 38 NONAME ; unsigned long CSvgEngineInterfaceImpl::Duration(int)
+ ?FillDocumentL@CSvgEngineInterfaceImpl@@QAEXPAVCSvgDocumentImpl@@ABVTDesC16@@@Z @ 39 NONAME ; void CSvgEngineInterfaceImpl::FillDocumentL(class CSvgDocumentImpl *, class TDesC16 const &)
+ ?FindAllElements@CSvgEngineInterfaceImpl@@QAEXPAVCSvgElementImpl@@HAAV?$RPointerArray@VCSvgElementImpl@@@@H@Z @ 40 NONAME ; void CSvgEngineInterfaceImpl::FindAllElements(class CSvgElementImpl *, int, class RPointerArray<class CSvgElementImpl> &, int)
+ ?FocusNext@CSvgEngineInterfaceImpl@@QAE?AVTRect@@XZ @ 41 NONAME ; class TRect CSvgEngineInterfaceImpl::FocusNext(void)
+ ?FocusPrevious@CSvgEngineInterfaceImpl@@QAE?AVTRect@@XZ @ 42 NONAME ; class TRect CSvgEngineInterfaceImpl::FocusPrevious(void)
+ ?FramesPerSecond@CSvgEngineInterfaceImpl@@QAENHH@Z @ 43 NONAME ; double CSvgEngineInterfaceImpl::FramesPerSecond(int, int)
+ ?GenerateMask@CSvgEngineInterfaceImpl@@QAEXPAVCFbsBitmap@@H@Z @ 44 NONAME ; void CSvgEngineInterfaceImpl::GenerateMask(class CFbsBitmap *, int)
+ ?GetAttribute@CSvgSvgElementImpl@@QAEHABVTDesC16@@AAVTDes16@@@Z @ 45 NONAME ; int CSvgSvgElementImpl::GetAttribute(class TDesC16 const &, class TDes16 &)
+ ?GetElementBoundingbox@CSvgEngineInterfaceImpl@@QAEXPAVCSvgElementImpl@@AAM111@Z @ 46 NONAME ; void CSvgEngineInterfaceImpl::GetElementBoundingbox(class CSvgElementImpl *, float &, float &, float &, float &)
+ ?GetElementById@CSvgEngineInterfaceImpl@@QAEPAVCXmlElementImpl@@PAVCSvgDocumentImpl@@ABVTDesC16@@@Z @ 47 NONAME ; class CXmlElementImpl * CSvgEngineInterfaceImpl::GetElementById(class CSvgDocumentImpl *, class TDesC16 const &)
+ ?GetElementColorAttribute@CSvgEngineInterfaceImpl@@QAEJPAVCSvgElementImpl@@H@Z @ 48 NONAME ; long CSvgEngineInterfaceImpl::GetElementColorAttribute(class CSvgElementImpl *, int)
+ ?GetElementDesAttribute@CSvgEngineInterfaceImpl@@QAEHPAVCSvgElementImpl@@HAAVTPtrC16@@@Z @ 49 NONAME ; int CSvgEngineInterfaceImpl::GetElementDesAttribute(class CSvgElementImpl *, int, class TPtrC16 &)
+ ?GetElementFloatAttribute@CSvgEngineInterfaceImpl@@QAEMPAVCSvgElementImpl@@H@Z @ 50 NONAME ; float CSvgEngineInterfaceImpl::GetElementFloatAttribute(class CSvgElementImpl *, int)
+ ?GetElementType@CSvgEngineInterfaceImpl@@QAEHPAVCXmlElementImpl@@@Z @ 51 NONAME ; int CSvgEngineInterfaceImpl::GetElementType(class CXmlElementImpl *)
+ ?GetElementUnScaledBoundingBox@CSvgEngineInterfaceImpl@@QAEXPAVCSvgElementImpl@@AAM111@Z @ 52 NONAME ; void CSvgEngineInterfaceImpl::GetElementUnScaledBoundingBox(class CSvgElementImpl *, float &, float &, float &, float &)
+ ?GetEnumAttribute@CSvgEngineInterfaceImpl@@QAEHPAVCSvgElementImpl@@HAAJ@Z @ 53 NONAME ; int CSvgEngineInterfaceImpl::GetEnumAttribute(class CSvgElementImpl *, int, long &)
+ ?GetExternalListItemL@CSvgEngineInterfaceImpl@@QAEXPAVCSvgDocumentImpl@@HAAVTPtrC16@@@Z @ 54 NONAME ; void CSvgEngineInterfaceImpl::GetExternalListItemL(class CSvgDocumentImpl *, int, class TPtrC16 &)
+ ?GetExternalListSize@CSvgEngineInterfaceImpl@@QAEHPAVCSvgDocumentImpl@@@Z @ 55 NONAME ; int CSvgEngineInterfaceImpl::GetExternalListSize(class CSvgDocumentImpl *)
+ ?GetFirstChild@CSvgEngineInterfaceImpl@@QAEPAVCXmlElementImpl@@PAV2@@Z @ 56 NONAME ; class CXmlElementImpl * CSvgEngineInterfaceImpl::GetFirstChild(class CXmlElementImpl *)
+ ?GetFocusedElement@CSvgEngineInterfaceImpl@@QAEPAVCXmlElementImpl@@PAVCSvgDocumentImpl@@@Z @ 57 NONAME ; class CXmlElementImpl * CSvgEngineInterfaceImpl::GetFocusedElement(class CSvgDocumentImpl *)
+ ?GetFourPointElementBoundingBox@CSvgEngineInterfaceImpl@@QAEXPAVCSvgTextElementImpl@@AAVTPoint@@111@Z @ 58 NONAME ; void CSvgEngineInterfaceImpl::GetFourPointElementBoundingBox(class CSvgTextElementImpl *, class TPoint &, class TPoint &, class TPoint &, class TPoint &)
+ ?GetId@CSvgEngineInterfaceImpl@@QAEPAVTDesC16@@PAVCSvgDocumentImpl@@H@Z @ 59 NONAME ; class TDesC16 * CSvgEngineInterfaceImpl::GetId(class CSvgDocumentImpl *, int)
+ ?GetMatrixAttribute@CSvgEngineInterfaceImpl@@QAEXPAVCXmlElementImpl@@PAM11111@Z @ 60 NONAME ; void CSvgEngineInterfaceImpl::GetMatrixAttribute(class CXmlElementImpl *, float *, float *, float *, float *, float *, float *)
+ ?GetNextSibling@CSvgEngineInterfaceImpl@@QAEPAVCXmlElementImpl@@PAV2@@Z @ 61 NONAME ; class CXmlElementImpl * CSvgEngineInterfaceImpl::GetNextSibling(class CXmlElementImpl *)
+ ?GetNumberOfIds@CSvgEngineInterfaceImpl@@QAEHPAVCSvgDocumentImpl@@@Z @ 62 NONAME ; int CSvgEngineInterfaceImpl::GetNumberOfIds(class CSvgDocumentImpl *)
+ ?GetOwnerDocument@CSvgEngineInterfaceImpl@@QAEPAVCSvgDocumentImpl@@PAVCXmlElementImpl@@@Z @ 63 NONAME ; class CSvgDocumentImpl * CSvgEngineInterfaceImpl::GetOwnerDocument(class CXmlElementImpl *)
+ ?GetParentElement@CSvgEngineInterfaceImpl@@QAEPAVCXmlElementImpl@@PAV2@@Z @ 64 NONAME ; class CXmlElementImpl * CSvgEngineInterfaceImpl::GetParentElement(class CXmlElementImpl *)
+ ?GetPathAttribute@CSvgEngineInterfaceImpl@@QAEPAVCGfxGeneralPath@@PAVCXmlElementImpl@@H@Z @ 65 NONAME ; class CGfxGeneralPath * CSvgEngineInterfaceImpl::GetPathAttribute(class CXmlElementImpl *, int)
+ ?GetRectAttribute@CSvgEngineInterfaceImpl@@QAEHPAVCXmlElementImpl@@PAM111@Z @ 66 NONAME ; int CSvgEngineInterfaceImpl::GetRectAttribute(class CXmlElementImpl *, float *, float *, float *, float *)
+ ?GetRenderQuality@CSvgEngineInterfaceImpl@@QAEIXZ @ 67 NONAME ; unsigned int CSvgEngineInterfaceImpl::GetRenderQuality(void)
+ ?GetRootElement@CSvgEngineInterfaceImpl@@QAEPAVCXmlElementImpl@@PAVCSvgDocumentImpl@@@Z @ 68 NONAME ; class CXmlElementImpl * CSvgEngineInterfaceImpl::GetRootElement(class CSvgDocumentImpl *)
+ ?GetSegmentCount@CSvgEngineInterfaceImpl@@QAEHPAVCGfxGeneralPath@@@Z @ 69 NONAME ; int CSvgEngineInterfaceImpl::GetSegmentCount(class CGfxGeneralPath *)
+ ?GetSegmentParameter@CSvgEngineInterfaceImpl@@QAEMPAVCGfxGeneralPath@@HH@Z @ 70 NONAME ; float CSvgEngineInterfaceImpl::GetSegmentParameter(class CGfxGeneralPath *, int, int)
+ ?GetSegmentType@CSvgEngineInterfaceImpl@@QAEHPAVCGfxGeneralPath@@H@Z @ 71 NONAME ; int CSvgEngineInterfaceImpl::GetSegmentType(class CGfxGeneralPath *, int)
+ ?GetSvgBoundingBox@CSvgEngineInterfaceImpl@@QAE?AVTRect@@H@Z @ 72 NONAME ; class TRect CSvgEngineInterfaceImpl::GetSvgBoundingBox(int)
+ ?GetTextForTextAreaElement@CSvgEngineInterfaceImpl@@QAEHHAAHAAVTDes16@@@Z @ 73 NONAME ; int CSvgEngineInterfaceImpl::GetTextForTextAreaElement(int, int &, class TDes16 &)
+ ?GetTextForTextElement@CSvgEngineInterfaceImpl@@QAEHHAAHAAVTDes16@@@Z @ 74 NONAME ; int CSvgEngineInterfaceImpl::GetTextForTextElement(int, int &, class TDes16 &)
+ ?GetUnscaledContentSize@CSvgEngineInterfaceImpl@@QAE?AVTSize@@H@Z @ 75 NONAME ; class TSize CSvgEngineInterfaceImpl::GetUnscaledContentSize(int)
+ ?GetViewportHeight@CSvgEngineInterfaceImpl@@QAEHPAVCSvgDocumentImpl@@@Z @ 76 NONAME ; int CSvgEngineInterfaceImpl::GetViewportHeight(class CSvgDocumentImpl *)
+ ?GetViewportUnits@CSvgEngineInterfaceImpl@@QAEHPAVCSvgDocumentImpl@@@Z @ 77 NONAME ; int CSvgEngineInterfaceImpl::GetViewportUnits(class CSvgDocumentImpl *)
+ ?GetViewportWidth@CSvgEngineInterfaceImpl@@QAEHPAVCSvgDocumentImpl@@@Z @ 78 NONAME ; int CSvgEngineInterfaceImpl::GetViewportWidth(class CSvgDocumentImpl *)
+ ?InitRootElement@CSvgEngineInterfaceImpl@@QAEXPAVCSvgDocumentImpl@@@Z @ 79 NONAME ; void CSvgEngineInterfaceImpl::InitRootElement(class CSvgDocumentImpl *)
+ ?InitSvgStylePropertiesWithNullL@CSvgEngineInterfaceImpl@@QAEXPAVCSvgElementImpl@@@Z @ 80 NONAME ; void CSvgEngineInterfaceImpl::InitSvgStylePropertiesWithNullL(class CSvgElementImpl *)
+ ?InitializeEngine@CSvgEngineInterfaceImpl@@QAEXPAVCSvgEngineImpl@@H@Z @ 81 NONAME ; void CSvgEngineInterfaceImpl::InitializeEngine(class CSvgEngineImpl *, int)
+ ?IsContentInteractive@CSvgEngineInterfaceImpl@@QAEHPAVCSvgDocumentImpl@@H@Z @ 82 NONAME ; int CSvgEngineInterfaceImpl::IsContentInteractive(class CSvgDocumentImpl *, int)
+ ?IsElementActive@CSvgEngineInterfaceImpl@@QAEHPAVCSvgElementImpl@@@Z @ 83 NONAME ; int CSvgEngineInterfaceImpl::IsElementActive(class CSvgElementImpl *)
+ ?IsElementVisible@CSvgEngineInterfaceImpl@@QAEHHH@Z @ 84 NONAME ; int CSvgEngineInterfaceImpl::IsElementVisible(int, int)
+ ?IsLoading@CSvgEngineInterfaceImpl@@QAEHH@Z @ 85 NONAME ; int CSvgEngineInterfaceImpl::IsLoading(int)
+ ?IsPanPossible@CSvgEngineInterfaceImpl@@QAEHHHH@Z @ 86 NONAME ; int CSvgEngineInterfaceImpl::IsPanPossible(int, int, int)
+ ?IsPanPossibleFourWay@CSvgEngineInterfaceImpl@@QAEXAAH000H@Z @ 87 NONAME ; void CSvgEngineInterfaceImpl::IsPanPossibleFourWay(int &, int &, int &, int &, int)
+ ?IsRemoveable@CSvgEngineInterfaceImpl@@QAEHPAVCSvgElementImpl@@H@Z @ 88 NONAME ; int CSvgEngineInterfaceImpl::IsRemoveable(class CSvgElementImpl *, int)
+ ?KeyPress@CSvgEngineInterfaceImpl@@QAEXABUTKeyEvent@@H@Z @ 89 NONAME ; void CSvgEngineInterfaceImpl::KeyPress(struct TKeyEvent const &, int)
+ ?Load@CSvgEngineInterfaceImpl@@QAEPAVMSvgError@@AAVRFile@@@Z @ 90 NONAME ; class MSvgError * CSvgEngineInterfaceImpl::Load(class RFile &)
+ ?Load@CSvgEngineInterfaceImpl@@QAEPAVMSvgError@@ABVTDesC16@@@Z @ 91 NONAME ; class MSvgError * CSvgEngineInterfaceImpl::Load(class TDesC16 const &)
+ ?Load@CSvgEngineInterfaceImpl@@QAEPAVMSvgError@@ABVTDesC8@@@Z @ 92 NONAME ; class MSvgError * CSvgEngineInterfaceImpl::Load(class TDesC8 const &)
+ ?MediaTime@CSvgEngineInterfaceImpl@@QAEJH@Z @ 93 NONAME ; long CSvgEngineInterfaceImpl::MediaTime(int)
+ ?MouseDown@CSvgEngineInterfaceImpl@@QAEHHHH@Z @ 94 NONAME ; int CSvgEngineInterfaceImpl::MouseDown(int, int, int)
+ ?MouseMove@CSvgEngineInterfaceImpl@@QAEXHHH@Z @ 95 NONAME ; void CSvgEngineInterfaceImpl::MouseMove(int, int, int)
+ ?MouseUp@CSvgEngineInterfaceImpl@@QAEXHHH@Z @ 96 NONAME ; void CSvgEngineInterfaceImpl::MouseUp(int, int, int)
+ ?NewL@CSvgEngineInterfaceImpl@@SAPAV1@PAVCFbsBitmap@@PAVMSvgRequestObserver@@AAVTFontSpec@@@Z @ 97 NONAME ; class CSvgEngineInterfaceImpl * CSvgEngineInterfaceImpl::NewL(class CFbsBitmap *, class MSvgRequestObserver *, class TFontSpec &)
+ ?NewLC@CSvgEngineInterfaceImpl@@SAPAV1@PAVCFbsBitmap@@PAVMSvgRequestObserver@@AAVTFontSpec@@@Z @ 98 NONAME ; class CSvgEngineInterfaceImpl * CSvgEngineInterfaceImpl::NewLC(class CFbsBitmap *, class MSvgRequestObserver *, class TFontSpec &)
+ ?OriginalView@CSvgEngineInterfaceImpl@@QAEXH@Z @ 99 NONAME ; void CSvgEngineInterfaceImpl::OriginalView(int)
+ ?Pan@CSvgEngineInterfaceImpl@@QAEXHHH@Z @ 100 NONAME ; void CSvgEngineInterfaceImpl::Pan(int, int, int)
+ ?PanPosition@CSvgEngineInterfaceImpl@@QAE?AVTPoint@@H@Z @ 101 NONAME ; class TPoint CSvgEngineInterfaceImpl::PanPosition(int)
+ ?Pause@CSvgEngineInterfaceImpl@@QAEXPAVCSvgEngineImpl@@@Z @ 102 NONAME ; void CSvgEngineInterfaceImpl::Pause(class CSvgEngineImpl *)
+ ?Position@CSvgEngineInterfaceImpl@@QAE?AVTPoint@@H@Z @ 103 NONAME ; class TPoint CSvgEngineInterfaceImpl::Position(int)
+ ?PrepareDom@CSvgEngineInterfaceImpl@@QAEPAVMSvgError@@AAVRFile@@AAHH@Z @ 104 NONAME ; class MSvgError * CSvgEngineInterfaceImpl::PrepareDom(class RFile &, int &, int)
+ ?PrepareDom@CSvgEngineInterfaceImpl@@QAEPAVMSvgError@@ABVTDesC16@@AAHH@Z @ 105 NONAME ; class MSvgError * CSvgEngineInterfaceImpl::PrepareDom(class TDesC16 const &, int &, int)
+ ?PrepareDom@CSvgEngineInterfaceImpl@@QAEPAVMSvgError@@ABVTDesC8@@AAHH@Z @ 106 NONAME ; class MSvgError * CSvgEngineInterfaceImpl::PrepareDom(class TDesC8 const &, int &, int)
+ ?PrintAllElements@CSvgEngineInterfaceImpl@@QAEXPAVCSvgDocumentImpl@@@Z @ 107 NONAME ; void CSvgEngineInterfaceImpl::PrintAllElements(class CSvgDocumentImpl *)
+ ?PrintElementsStyles@CSvgEngineInterfaceImpl@@QAEXPAVCSvgElementImpl@@@Z @ 108 NONAME ; void CSvgEngineInterfaceImpl::PrintElementsStyles(class CSvgElementImpl *)
+ ?Redraw@CSvgEngineInterfaceImpl@@QAEXHH@Z @ 109 NONAME ; void CSvgEngineInterfaceImpl::Redraw(int, int)
+ ?RemoveAnimationListener@CSvgEngineInterfaceImpl@@QAEXPAVMSvgAnimationListener@@H@Z @ 110 NONAME ; void CSvgEngineInterfaceImpl::RemoveAnimationListener(class MSvgAnimationListener *, int)
+ ?RemoveChild@CSvgEngineInterfaceImpl@@QAEXPAVCXmlElementImpl@@0@Z @ 111 NONAME ; void CSvgEngineInterfaceImpl::RemoveChild(class CXmlElementImpl *, class CXmlElementImpl *)
+ ?RemoveFromEventReceiverList@CSvgEngineInterfaceImpl@@QAEXPAVCXmlElementImpl@@@Z @ 112 NONAME ; void CSvgEngineInterfaceImpl::RemoveFromEventReceiverList(class CXmlElementImpl *)
+ ?RemoveHyperlinkListener@CSvgEngineInterfaceImpl@@QAEXPAVMSvgHyperlinkListener@@H@Z @ 113 NONAME ; void CSvgEngineInterfaceImpl::RemoveHyperlinkListener(class MSvgHyperlinkListener *, int)
+ ?RemoveListener@CSvgEngineInterfaceImpl@@QAEXPBVMSvgListener@@W4TSvgListenerType@@H@Z @ 114 NONAME ; void CSvgEngineInterfaceImpl::RemoveListener(class MSvgListener const *, enum TSvgListenerType, int)
+ ?RemoveTextAreaListener@CSvgEngineInterfaceImpl@@QAEHPAVMSvgTextAreaListener@@H@Z @ 115 NONAME ; int CSvgEngineInterfaceImpl::RemoveTextAreaListener(class MSvgTextAreaListener *, int)
+ ?RemoveTextListener@CSvgEngineInterfaceImpl@@QAEHPAVMSvgTextListener@@H@Z @ 116 NONAME ; int CSvgEngineInterfaceImpl::RemoveTextListener(class MSvgTextListener *, int)
+ ?RenderDom@CSvgEngineInterfaceImpl@@QAEPAVMSvgError@@HPAVCFbsBitmap@@0@Z @ 117 NONAME ; class MSvgError * CSvgEngineInterfaceImpl::RenderDom(int, class CFbsBitmap *, class CFbsBitmap *)
+ ?RenderFrame@CSvgEngineInterfaceImpl@@QAEXPAVCSvgEngineImpl@@I@Z @ 118 NONAME ; void CSvgEngineInterfaceImpl::RenderFrame(class CSvgEngineImpl *, unsigned int)
+ ?RenderFrames@CSvgEngineInterfaceImpl@@QAEPAVMSvgError@@HABVTSize@@IIIW4TDisplayMode@@1AAV?$RPointerArray@VCFbsBitmap@@@@2AAV?$RArray@I@@H@Z @ 119 NONAME ; class MSvgError * CSvgEngineInterfaceImpl::RenderFrames(int, class TSize const &, unsigned int, unsigned int, unsigned int, enum TDisplayMode, enum TDisplayMode, class RPointerArray<class CFbsBitmap> &, class RPointerArray<class CFbsBitmap> &, class RArray<unsigned int> &, int)
+ ?Replay@CSvgEngineInterfaceImpl@@QAEPAVMSvgError@@H@Z @ 120 NONAME ; class MSvgError * CSvgEngineInterfaceImpl::Replay(int)
+ ?Resume@CSvgEngineInterfaceImpl@@QAEXPAVCSvgEngineImpl@@@Z @ 121 NONAME ; void CSvgEngineInterfaceImpl::Resume(class CSvgEngineImpl *)
+ ?RootElement@CSvgDocumentImpl@@QAEPAVMXmlElement@@XZ @ 122 NONAME ; class MXmlElement * CSvgDocumentImpl::RootElement(void)
+ ?Rotate@CSvgEngineInterfaceImpl@@QAEXMHHH@Z @ 123 NONAME ; void CSvgEngineInterfaceImpl::Rotate(float, int, int, int)
+ ?SVGElementGetUsedElement@CSvgEngineInterfaceImpl@@QAEPAVCXmlElementImpl@@PAV2@@Z @ 124 NONAME ; class CXmlElementImpl * CSvgEngineInterfaceImpl::SVGElementGetUsedElement(class CXmlElementImpl *)
+ ?SVGElementInDom@CSvgEngineInterfaceImpl@@QAEHPAVCSvgDocumentImpl@@PAVCXmlElementImpl@@@Z @ 125 NONAME ; int CSvgEngineInterfaceImpl::SVGElementInDom(class CSvgDocumentImpl *, class CXmlElementImpl *)
+ ?SaveSvg@CSvgEngineInterfaceImpl@@QAEXHABVTDesC16@@H@Z @ 126 NONAME ; void CSvgEngineInterfaceImpl::SaveSvg(int, class TDesC16 const &, int)
+ ?SaveSvgDom@CSvgEngineInterfaceImpl@@QAEPAVMSvgError@@HABVTDesC16@@H@Z @ 127 NONAME ; class MSvgError * CSvgEngineInterfaceImpl::SaveSvgDom(int, class TDesC16 const &, int)
+ ?SearchForText@CSvgEngineInterfaceImpl@@QAEHABVTDesC16@@AAV?$RPointerArray@VMRect@@@@AAV?$RArray@VTPtrC16@@@@AAV?$RArray@H@@HH@Z @ 128 NONAME ; int CSvgEngineInterfaceImpl::SearchForText(class TDesC16 const &, class RPointerArray<class MRect> &, class RArray<class TPtrC16> &, class RArray<int> &, int, int)
+ ?SetAnimFrameDuration@CSvgEngineInterfaceImpl@@QAEXIH@Z @ 129 NONAME ; void CSvgEngineInterfaceImpl::SetAnimFrameDuration(unsigned int, int)
+ ?SetBackgroundColor@CSvgEngineInterfaceImpl@@QAEXKPAVCSvgEngineImpl@@@Z @ 130 NONAME ; void CSvgEngineInterfaceImpl::SetBackgroundColor(unsigned long, class CSvgEngineImpl *)
+ ?SetClientWindow@CSvgEngineInterfaceImpl@@QAEXPAVRWindow@@@Z @ 131 NONAME ; void CSvgEngineInterfaceImpl::SetClientWindow(class RWindow *)
+ ?SetDRMMode@CSvgEngineInterfaceImpl@@QAEXHH@Z @ 132 NONAME ; void CSvgEngineInterfaceImpl::SetDRMMode(int, int)
+ ?SetDataRetrievalTimeOut@CSvgEngineInterfaceImpl@@QAEXIH@Z @ 133 NONAME ; void CSvgEngineInterfaceImpl::SetDataRetrievalTimeOut(unsigned int, int)
+ ?SetDocument@CSvgEngineInterfaceImpl@@QAEXPAVCSvgEngineImpl@@PAVCSvgDocumentImpl@@@Z @ 134 NONAME ; void CSvgEngineInterfaceImpl::SetDocument(class CSvgEngineImpl *, class CSvgDocumentImpl *)
+ ?SetElementColorAttribute@CSvgEngineInterfaceImpl@@QAEXPAVCSvgElementImpl@@HJ@Z @ 135 NONAME ; void CSvgEngineInterfaceImpl::SetElementColorAttribute(class CSvgElementImpl *, int, long)
+ ?SetElementDesAttribute@CSvgEngineInterfaceImpl@@QAEXPAVCSvgElementImpl@@HABVTDesC16@@@Z @ 136 NONAME ; void CSvgEngineInterfaceImpl::SetElementDesAttribute(class CSvgElementImpl *, int, class TDesC16 const &)
+ ?SetElementFloatAttribute@CSvgEngineInterfaceImpl@@QAEXPAVCSvgElementImpl@@HM@Z @ 137 NONAME ; void CSvgEngineInterfaceImpl::SetElementFloatAttribute(class CSvgElementImpl *, int, float)
+ ?SetEnumAttribute@CSvgEngineInterfaceImpl@@QAEXPAVCSvgElementImpl@@HJ@Z @ 138 NONAME ; void CSvgEngineInterfaceImpl::SetEnumAttribute(class CSvgElementImpl *, int, long)
+ ?SetFirstChildElement@CSvgEngineInterfaceImpl@@QAEXPAVCXmlElementImpl@@0@Z @ 139 NONAME ; void CSvgEngineInterfaceImpl::SetFirstChildElement(class CXmlElementImpl *, class CXmlElementImpl *)
+ ?SetFocusElement@CSvgEngineInterfaceImpl@@QAEXPAVCXmlElementImpl@@PAVCSvgDocumentImpl@@@Z @ 140 NONAME ; void CSvgEngineInterfaceImpl::SetFocusElement(class CXmlElementImpl *, class CSvgDocumentImpl *)
+ ?SetFrameBuffer@CSvgEngineInterfaceImpl@@QAEXPAVCFbsBitmap@@H@Z @ 141 NONAME ; void CSvgEngineInterfaceImpl::SetFrameBuffer(class CFbsBitmap *, int)
+ ?SetGdiContextL@CSvgEngineInterfaceImpl@@QAEXPAVCSvgEngineImpl@@PAVCFbsBitmap@@@Z @ 142 NONAME ; void CSvgEngineInterfaceImpl::SetGdiContextL(class CSvgEngineImpl *, class CFbsBitmap *)
+ ?SetMatrixAttribute@CSvgEngineInterfaceImpl@@QAEXPAVCXmlElementImpl@@MMMMMM@Z @ 143 NONAME ; void CSvgEngineInterfaceImpl::SetMatrixAttribute(class CXmlElementImpl *, float, float, float, float, float, float)
+ ?SetMediaTime@CSvgEngineInterfaceImpl@@QAEXJH@Z @ 144 NONAME ; void CSvgEngineInterfaceImpl::SetMediaTime(long, int)
+ ?SetNextSibling@CSvgEngineInterfaceImpl@@QAEXPAVCXmlElementImpl@@0@Z @ 145 NONAME ; void CSvgEngineInterfaceImpl::SetNextSibling(class CXmlElementImpl *, class CXmlElementImpl *)
+ ?SetParentElement@CSvgEngineInterfaceImpl@@QAEXPAVCXmlElementImpl@@0@Z @ 146 NONAME ; void CSvgEngineInterfaceImpl::SetParentElement(class CXmlElementImpl *, class CXmlElementImpl *)
+ ?SetPathAttribute@CSvgEngineInterfaceImpl@@QAEXPAVCSvgElementImpl@@HPAVCGfxGeneralPath@@@Z @ 147 NONAME ; void CSvgEngineInterfaceImpl::SetPathAttribute(class CSvgElementImpl *, int, class CGfxGeneralPath *)
+ ?SetPreserveAspectRatio@CSvgEngineInterfaceImpl@@QAEXPAVCSvgDocumentImpl@@W4TSvgPreserveAspectAlignType@@W4TSvgMeetOrSliceType@@H@Z @ 148 NONAME ; void CSvgEngineInterfaceImpl::SetPreserveAspectRatio(class CSvgDocumentImpl *, enum TSvgPreserveAspectAlignType, enum TSvgMeetOrSliceType, int)
+ ?SetRectAttribute@CSvgEngineInterfaceImpl@@QAEXPAVCXmlElementImpl@@MMMM@Z @ 149 NONAME ; void CSvgEngineInterfaceImpl::SetRectAttribute(class CXmlElementImpl *, float, float, float, float)
+ ?SetRenderQuality@CSvgEngineInterfaceImpl@@QAEXIH@Z @ 150 NONAME ; void CSvgEngineInterfaceImpl::SetRenderQuality(unsigned int, int)
+ ?SetRequestObserver@CSvgEngineInterfaceImpl@@QAEXPAVCSvgEngineImpl@@PAVMSvgRequestObserver@@@Z @ 151 NONAME ; void CSvgEngineInterfaceImpl::SetRequestObserver(class CSvgEngineImpl *, class MSvgRequestObserver *)
+ ?SetSvgDimensionToFrameBuffer@CSvgEngineInterfaceImpl@@QAEXIIH@Z @ 152 NONAME ; void CSvgEngineInterfaceImpl::SetSvgDimensionToFrameBuffer(unsigned int, unsigned int, int)
+ ?SetTextForTextAreaElement@CSvgEngineInterfaceImpl@@QAEHHAAVTDesC16@@@Z @ 153 NONAME ; int CSvgEngineInterfaceImpl::SetTextForTextAreaElement(int, class TDesC16 &)
+ ?SetTextForTextElement@CSvgEngineInterfaceImpl@@QAEHHAAVTDesC16@@@Z @ 154 NONAME ; int CSvgEngineInterfaceImpl::SetTextForTextElement(int, class TDesC16 &)
+ ?SetThumbNailMode@CSvgEngineInterfaceImpl@@QAEXHH@Z @ 155 NONAME ; void CSvgEngineInterfaceImpl::SetThumbNailMode(int, int)
+ ?SetViewportHeight@CSvgEngineInterfaceImpl@@QAEXPAVCSvgDocumentImpl@@H@Z @ 156 NONAME ; void CSvgEngineInterfaceImpl::SetViewportHeight(class CSvgDocumentImpl *, int)
+ ?SetViewportWidth@CSvgEngineInterfaceImpl@@QAEXPAVCSvgDocumentImpl@@H@Z @ 157 NONAME ; void CSvgEngineInterfaceImpl::SetViewportWidth(class CSvgDocumentImpl *, int)
+ ?Size@CSvgEngineInterfaceImpl@@QAE?AVTSize@@H@Z @ 158 NONAME ; class TSize CSvgEngineInterfaceImpl::Size(int)
+ ?Start@CSvgEngineInterfaceImpl@@QAEXPAVCSvgEngineImpl@@H@Z @ 159 NONAME ; void CSvgEngineInterfaceImpl::Start(class CSvgEngineImpl *, int)
+ ?StartEngine@CSvgEngineInterfaceImpl@@QAEXPAVCSvgEngineImpl@@@Z @ 160 NONAME ; void CSvgEngineInterfaceImpl::StartEngine(class CSvgEngineImpl *)
+ ?Stop@CSvgEngineInterfaceImpl@@QAEXPAVCSvgEngineImpl@@@Z @ 161 NONAME ; void CSvgEngineInterfaceImpl::Stop(class CSvgEngineImpl *)
+ ?SvgActivateAnimation@CSvgEngineInterfaceImpl@@QAEXPAVCSvgDocumentImpl@@@Z @ 162 NONAME ; void CSvgEngineInterfaceImpl::SvgActivateAnimation(class CSvgDocumentImpl *)
+ ?SvgBeginElementAt@CSvgEngineInterfaceImpl@@QAEXPAVCXmlElementImpl@@KPAVCSvgDocumentImpl@@@Z @ 163 NONAME ; void CSvgEngineInterfaceImpl::SvgBeginElementAt(class CXmlElementImpl *, unsigned long, class CSvgDocumentImpl *)
+ ?SvgCreatePath@CSvgEngineInterfaceImpl@@QAEPAVCGfxGeneralPath@@XZ @ 164 NONAME ; class CGfxGeneralPath * CSvgEngineInterfaceImpl::SvgCreatePath(void)
+ ?SvgDestroyPath@CSvgEngineInterfaceImpl@@QAEXPAVCGfxGeneralPath@@@Z @ 165 NONAME ; void CSvgEngineInterfaceImpl::SvgDestroyPath(class CGfxGeneralPath *)
+ ?SvgDocument@CSvgEngineInterfaceImpl@@QAEPAVCSvgDocumentImpl@@XZ @ 166 NONAME ; class CSvgDocumentImpl * CSvgEngineInterfaceImpl::SvgDocument(void)
+ ?SvgDocumentNewL@CSvgEngineInterfaceImpl@@QAEPAVCSvgDocumentImpl@@XZ @ 167 NONAME ; class CSvgDocumentImpl * CSvgEngineInterfaceImpl::SvgDocumentNewL(void)
+ ?SvgEndElementAt@CSvgEngineInterfaceImpl@@QAEXPAVCXmlElementImpl@@KPAVCSvgDocumentImpl@@@Z @ 168 NONAME ; void CSvgEngineInterfaceImpl::SvgEndElementAt(class CXmlElementImpl *, unsigned long, class CSvgDocumentImpl *)
+ ?SvgEngineNewL@CSvgEngineInterfaceImpl@@QAEPAVCSvgEngineImpl@@XZ @ 169 NONAME ; class CSvgEngineImpl * CSvgEngineInterfaceImpl::SvgEngineNewL(void)
+ ?SvgGetMediaTime@CSvgEngineInterfaceImpl@@QAEMPAVCSvgDocumentImpl@@@Z @ 170 NONAME ; float CSvgEngineInterfaceImpl::SvgGetMediaTime(class CSvgDocumentImpl *)
+ ?SvgHasAnimation@CSvgEngineInterfaceImpl@@QAEHPAVCSvgDocumentImpl@@@Z @ 171 NONAME ; int CSvgEngineInterfaceImpl::SvgHasAnimation(class CSvgDocumentImpl *)
+ ?SvgSetMediaTime@CSvgEngineInterfaceImpl@@QAEXPAVCSvgDocumentImpl@@K@Z @ 172 NONAME ; void CSvgEngineInterfaceImpl::SvgSetMediaTime(class CSvgDocumentImpl *, unsigned long)
+ ?SwitchDebugInfo@CSvgEngineInterfaceImpl@@QAEXH@Z @ 173 NONAME ; void CSvgEngineInterfaceImpl::SwitchDebugInfo(int)
+ ?UpdatePath@CSvgEngineInterfaceImpl@@QAEXHPAVCSvgElementImpl@@@Z @ 174 NONAME ; void CSvgEngineInterfaceImpl::UpdatePath(int, class CSvgElementImpl *)
+ ?UseDom@CSvgEngineInterfaceImpl@@QAEPAVMSvgError@@HPAVCFbsBitmap@@0H@Z @ 175 NONAME ; class MSvgError * CSvgEngineInterfaceImpl::UseDom(int, class CFbsBitmap *, class CFbsBitmap *, int)
+ ?ViewportInit@CSvgEngineInterfaceImpl@@QAEXPAVCSvgDocumentImpl@@@Z @ 176 NONAME ; void CSvgEngineInterfaceImpl::ViewportInit(class CSvgDocumentImpl *)
+ ?WaitForImages@CSvgEngineInterfaceImpl@@QAEXHH@Z @ 177 NONAME ; void CSvgEngineInterfaceImpl::WaitForImages(int, int)
+ ?Zoom@CSvgEngineInterfaceImpl@@QAEXMH@Z @ 178 NONAME ; void CSvgEngineInterfaceImpl::Zoom(float, int)
+ ?Start@CSvgEngineInterfaceImpl@@QAEXAAPAVMSvgError@@PAVCSvgEngineImpl@@@Z @ 179 NONAME ; void CSvgEngineInterfaceImpl::Start(class MSvgError * &, class CSvgEngineImpl *)
+ ?MuteAudioVolume@CSvgEngineInterfaceImpl@@QAEXH@Z @ 180 NONAME ; void CSvgEngineInterfaceImpl::MuteAudioVolume(int)
+ ?SetAudioVolume@CSvgEngineInterfaceImpl@@QAEXHH@Z @ 181 NONAME ; void CSvgEngineInterfaceImpl::SetAudioVolume(int, int)
+ ?SetDRMRights@CSvgEngineInterfaceImpl@@QAEXH@Z @ 182 NONAME ; void CSvgEngineInterfaceImpl::SetDRMRights(int)
+ ?GetMatrixAttribute@CSvgEngineInterfaceImpl@@QAEXPAVCXmlElementImpl@@HPAM11111@Z @ 183 NONAME ; void CSvgEngineInterfaceImpl::GetMatrixAttribute(class CXmlElementImpl *, int, float *, float *, float *, float *, float *, float *)
+ ?ConstructL@CSvgEngineInterfaceImpl@@IAEXPAVCFbsBitmap@@PAVMSvgRequestObserver@@AAVTFontSpec@@W4SVGRendererId@@@Z @ 184 NONAME ; void CSvgEngineInterfaceImpl::ConstructL(class CFbsBitmap *, class MSvgRequestObserver *, class TFontSpec &, SVGRendererId)
+ ?NewL@CSvgEngineInterfaceImpl@@SAPAV1@PAVCFbsBitmap@@PAVMSvgRequestObserver@@AAVTFontSpec@@W4SVGRendererId@@@Z @ 185 NONAME ; class CSvgEngineInterfaceImpl * CSvgEngineInterfaceImpl::NewL(class CFbsBitmap *, class MSvgRequestObserver *, class TFontSpec &, SVGRendererId))
+ ?NewLC@CSvgEngineInterfaceImpl@@SAPAV1@PAVCFbsBitmap@@PAVMSvgRequestObserver@@AAVTFontSpec@@W4SVGRendererId@@@Z @ 186 NONAME ; class CSvgEngineInterfaceImpl * CSvgEngineInterfaceImpl::NewLC(class CFbsBitmap *, class MSvgRequestObserver *, class TFontSpec &, SVGRendererId))
+ ?UseDom@CSvgEngineInterfaceImpl@@QAEPAVMSvgError@@HPAVCFbsBitmap@@0VTSize@@W4TDisplayMode@@2H@Z @ 187 NONAME ; class MSvgError * CSvgEngineInterfaceImpl::UseDom(int, class CFbsBitmap *, class CFbsBitmap *, class TSize, enum TDisplayMode, enum TDisplayMode, int)
+ ?Start@CSvgEngineInterfaceImpl@@QAEXAAPAVMSvgError@@PBVTDesC8@@PAVCSvgEngineImpl@@@Z @ 188 NONAME ; void CSvgEngineInterfaceImpl::Start(class MSvgError * &, class TDesC8 const *, class CSvgEngineImpl *)
+ ?Start@CSvgEngineInterfaceImpl@@QAEXPBVTDesC8@@PAVCSvgEngineImpl@@H@Z @ 189 NONAME ; void CSvgEngineInterfaceImpl::Start(class TDesC8 const *, class CSvgEngineImpl *, int)
+ ?ResetContext@CSvgEngineInterfaceImpl@@QAEXH@Z @ 190 NONAME ; void CSvgEngineInterfaceImpl::ResetContext(int)
+ ?ConstructL@CSvgEngineInterfaceImpl@@IAEXAAVTFontSpec@@@Z @ 191 NONAME ; void CSvgEngineInterfaceImpl::ConstructL(class TFontSpec &)
+ ?TLVEncodedData@CSvgEngineInterfaceImpl@@QBE?BVTPtrC8@@XZ @ 192 NONAME ; class TPtrC8 const CSvgEngineInterfaceImpl::TLVEncodedData(void) const
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/eabi/SVGENGINE-OpenVGU.def Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,391 @@
+EXPORTS
+ _ZN16CSvgDocumentImpl11RootElementEv @ 1 NONAME
+ _ZN18CSvgSvgElementImpl12GetAttributeERK7TDesC16R6TDes16 @ 2 NONAME
+ _ZN23CSvgEngineInterfaceImpl10ADDCloseToEP15CGfxGeneralPath @ 3 NONAME
+ _ZN23CSvgEngineInterfaceImpl10ADDCurveToEP15CGfxGeneralPathffffff @ 4 NONAME
+ _ZN23CSvgEngineInterfaceImpl10CancelLoadEi @ 5 NONAME
+ _ZN23CSvgEngineInterfaceImpl10ConstructLEP10CFbsBitmapP19MSvgRequestObserverR9TFontSpec @ 6 NONAME
+ _ZN23CSvgEngineInterfaceImpl10ConstructLEv @ 7 NONAME
+ _ZN23CSvgEngineInterfaceImpl10PrepareDomER5RFileRii @ 8 NONAME
+ _ZN23CSvgEngineInterfaceImpl10PrepareDomERK6TDesC8Rii @ 9 NONAME
+ _ZN23CSvgEngineInterfaceImpl10PrepareDomERK7TDesC16Rii @ 10 NONAME
+ _ZN23CSvgEngineInterfaceImpl10SaveSvgDomEiRK7TDesC16i @ 11 NONAME
+ _ZN23CSvgEngineInterfaceImpl10SetDRMModeEii @ 12 NONAME
+ _ZN23CSvgEngineInterfaceImpl10UpdatePathEiP15CSvgElementImpl @ 13 NONAME
+ _ZN23CSvgEngineInterfaceImpl11AddListenerEPK12MSvgListener16TSvgListenerTypei @ 14 NONAME
+ _ZN23CSvgEngineInterfaceImpl11AppendChildEP15CXmlElementImplS1_i @ 15 NONAME
+ _ZN23CSvgEngineInterfaceImpl11PanPositionEi @ 16 NONAME
+ _ZN23CSvgEngineInterfaceImpl11RemoveChildEP15CXmlElementImplS1_ @ 17 NONAME
+ _ZN23CSvgEngineInterfaceImpl11RenderFrameEP14CSvgEngineImplj @ 18 NONAME
+ _ZN23CSvgEngineInterfaceImpl11SetDocumentEP14CSvgEngineImplP16CSvgDocumentImpl @ 19 NONAME
+ _ZN23CSvgEngineInterfaceImpl11StartEngineEP14CSvgEngineImpl @ 20 NONAME
+ _ZN23CSvgEngineInterfaceImpl11SvgDocumentEv @ 21 NONAME
+ _ZN23CSvgEngineInterfaceImpl12CurrentStateEi @ 22 NONAME
+ _ZN23CSvgEngineInterfaceImpl12CustomOptionEii @ 23 NONAME
+ _ZN23CSvgEngineInterfaceImpl12GenerateMaskEP10CFbsBitmapi @ 24 NONAME
+ _ZN23CSvgEngineInterfaceImpl12IsRemoveableEP15CSvgElementImpli @ 25 NONAME
+ _ZN23CSvgEngineInterfaceImpl12OriginalViewEi @ 26 NONAME
+ _ZN23CSvgEngineInterfaceImpl12RenderFramesEiRK5TSizejjj12TDisplayModeS3_R13RPointerArrayI10CFbsBitmapES7_R6RArrayIjEi @ 27 NONAME
+ _ZN23CSvgEngineInterfaceImpl12SetMediaTimeEli @ 28 NONAME
+ _ZN23CSvgEngineInterfaceImpl12ViewportInitEP16CSvgDocumentImpl @ 29 NONAME
+ _ZN23CSvgEngineInterfaceImpl13DestroyEngineEP14CSvgEngineImpl @ 30 NONAME
+ _ZN23CSvgEngineInterfaceImpl13FillDocumentLEP16CSvgDocumentImplRK7TDesC16 @ 31 NONAME
+ _ZN23CSvgEngineInterfaceImpl13FocusPreviousEv @ 32 NONAME
+ _ZN23CSvgEngineInterfaceImpl13GetFirstChildEP15CXmlElementImpl @ 33 NONAME
+ _ZN23CSvgEngineInterfaceImpl13IsPanPossibleEiii @ 34 NONAME
+ _ZN23CSvgEngineInterfaceImpl13SearchForTextERK7TDesC16R13RPointerArrayI5MRectER6RArrayI7TPtrC16ERS7_IiEii @ 35 NONAME
+ _ZN23CSvgEngineInterfaceImpl13SvgCreatePathEv @ 36 NONAME
+ _ZN23CSvgEngineInterfaceImpl13SvgEngineNewLEv @ 37 NONAME
+ _ZN23CSvgEngineInterfaceImpl13WaitForImagesEii @ 38 NONAME
+ _ZN23CSvgEngineInterfaceImpl14CreateElementLEP16CSvgDocumentImpli @ 39 NONAME
+ _ZN23CSvgEngineInterfaceImpl14DestroyElementEP15CXmlElementImpl @ 40 NONAME
+ _ZN23CSvgEngineInterfaceImpl14GetElementByIdEP16CSvgDocumentImplRK7TDesC16 @ 41 NONAME
+ _ZN23CSvgEngineInterfaceImpl14GetElementTypeEP15CXmlElementImpl @ 42 NONAME
+ _ZN23CSvgEngineInterfaceImpl14GetNextSiblingEP15CXmlElementImpl @ 43 NONAME
+ _ZN23CSvgEngineInterfaceImpl14GetNumberOfIdsEP16CSvgDocumentImpl @ 44 NONAME
+ _ZN23CSvgEngineInterfaceImpl14GetRootElementEP16CSvgDocumentImpl @ 45 NONAME
+ _ZN23CSvgEngineInterfaceImpl14GetSegmentTypeEP15CGfxGeneralPathi @ 46 NONAME
+ _ZN23CSvgEngineInterfaceImpl14RemoveListenerEPK12MSvgListener16TSvgListenerTypei @ 47 NONAME
+ _ZN23CSvgEngineInterfaceImpl14SetFrameBufferEP10CFbsBitmapi @ 48 NONAME
+ _ZN23CSvgEngineInterfaceImpl14SetGdiContextLEP14CSvgEngineImplP10CFbsBitmap @ 49 NONAME
+ _ZN23CSvgEngineInterfaceImpl14SetNextSiblingEP15CXmlElementImplS1_ @ 50 NONAME
+ _ZN23CSvgEngineInterfaceImpl14SvgDestroyPathEP15CGfxGeneralPath @ 51 NONAME
+ _ZN23CSvgEngineInterfaceImpl15AddExternalDataEP16CSvgDocumentImplRK7TDesC16RK6TDesC8iii @ 52 NONAME
+ _ZN23CSvgEngineInterfaceImpl15AddTextListenerEP16MSvgTextListeneri @ 53 NONAME
+ _ZN23CSvgEngineInterfaceImpl15AssignImageDataERK7TDesC16P6HBufC8 @ 54 NONAME
+ _ZN23CSvgEngineInterfaceImpl15DestroyDocumentEP16CSvgDocumentImpl @ 55 NONAME
+ _ZN23CSvgEngineInterfaceImpl15FindAllElementsEP15CSvgElementImpliR13RPointerArrayIS0_Ei @ 56 NONAME
+ _ZN23CSvgEngineInterfaceImpl15FramesPerSecondEii @ 57 NONAME
+ _ZN23CSvgEngineInterfaceImpl15GetSegmentCountEP15CGfxGeneralPath @ 58 NONAME
+ _ZN23CSvgEngineInterfaceImpl15InitRootElementEP16CSvgDocumentImpl @ 59 NONAME
+ _ZN23CSvgEngineInterfaceImpl15IsElementActiveEP15CSvgElementImpl @ 60 NONAME
+ _ZN23CSvgEngineInterfaceImpl15SVGElementInDomEP16CSvgDocumentImplP15CXmlElementImpl @ 61 NONAME
+ _ZN23CSvgEngineInterfaceImpl15SetClientWindowEP7RWindow @ 62 NONAME
+ _ZN23CSvgEngineInterfaceImpl15SetFocusElementEP15CXmlElementImplP16CSvgDocumentImpl @ 63 NONAME
+ _ZN23CSvgEngineInterfaceImpl15SvgDocumentNewLEv @ 64 NONAME
+ _ZN23CSvgEngineInterfaceImpl15SvgEndElementAtEP15CXmlElementImplmP16CSvgDocumentImpl @ 65 NONAME
+ _ZN23CSvgEngineInterfaceImpl15SvgGetMediaTimeEP16CSvgDocumentImpl @ 66 NONAME
+ _ZN23CSvgEngineInterfaceImpl15SvgHasAnimationEP16CSvgDocumentImpl @ 67 NONAME
+ _ZN23CSvgEngineInterfaceImpl15SvgSetMediaTimeEP16CSvgDocumentImplm @ 68 NONAME
+ _ZN23CSvgEngineInterfaceImpl15SwitchDebugInfoEi @ 69 NONAME
+ _ZN23CSvgEngineInterfaceImpl16ClearFrameBufferEP10CFbsBitmapmi @ 70 NONAME
+ _ZN23CSvgEngineInterfaceImpl16GetEnumAttributeEP15CSvgElementImpliRl @ 71 NONAME
+ _ZN23CSvgEngineInterfaceImpl16GetOwnerDocumentEP15CXmlElementImpl @ 72 NONAME
+ _ZN23CSvgEngineInterfaceImpl16GetParentElementEP15CXmlElementImpl @ 73 NONAME
+ _ZN23CSvgEngineInterfaceImpl16GetPathAttributeEP15CXmlElementImpli @ 74 NONAME
+ _ZN23CSvgEngineInterfaceImpl16GetRectAttributeEP15CXmlElementImplPfS2_S2_S2_ @ 75 NONAME
+ _ZN23CSvgEngineInterfaceImpl16GetRenderQualityEv @ 76 NONAME
+ _ZN23CSvgEngineInterfaceImpl16GetViewportUnitsEP16CSvgDocumentImpl @ 77 NONAME
+ _ZN23CSvgEngineInterfaceImpl16GetViewportWidthEP16CSvgDocumentImpl @ 78 NONAME
+ _ZN23CSvgEngineInterfaceImpl16InitializeEngineEP14CSvgEngineImpli @ 79 NONAME
+ _ZN23CSvgEngineInterfaceImpl16IsElementVisibleEii @ 80 NONAME
+ _ZN23CSvgEngineInterfaceImpl16PrintAllElementsEP16CSvgDocumentImpl @ 81 NONAME
+ _ZN23CSvgEngineInterfaceImpl16SetEnumAttributeEP15CSvgElementImplil @ 82 NONAME
+ _ZN23CSvgEngineInterfaceImpl16SetParentElementEP15CXmlElementImplS1_ @ 83 NONAME
+ _ZN23CSvgEngineInterfaceImpl16SetPathAttributeEP15CSvgElementImpliP15CGfxGeneralPath @ 84 NONAME
+ _ZN23CSvgEngineInterfaceImpl16SetRectAttributeEP15CXmlElementImplffff @ 85 NONAME
+ _ZN23CSvgEngineInterfaceImpl16SetRenderQualityEji @ 86 NONAME
+ _ZN23CSvgEngineInterfaceImpl16SetThumbNailModeEii @ 87 NONAME
+ _ZN23CSvgEngineInterfaceImpl16SetViewportWidthEP16CSvgDocumentImpli @ 88 NONAME
+ _ZN23CSvgEngineInterfaceImpl17ContentDimensionsERfS0_i @ 89 NONAME
+ _ZN23CSvgEngineInterfaceImpl17ContentDimensionsEi @ 90 NONAME
+ _ZN23CSvgEngineInterfaceImpl17GetFocusedElementEP16CSvgDocumentImpl @ 91 NONAME
+ _ZN23CSvgEngineInterfaceImpl17GetSvgBoundingBoxEi @ 92 NONAME
+ _ZN23CSvgEngineInterfaceImpl17GetViewportHeightEP16CSvgDocumentImpl @ 93 NONAME
+ _ZN23CSvgEngineInterfaceImpl17SetViewportHeightEP16CSvgDocumentImpli @ 94 NONAME
+ _ZN23CSvgEngineInterfaceImpl17SvgBeginElementAtEP15CXmlElementImplmP16CSvgDocumentImpl @ 95 NONAME
+ _ZN23CSvgEngineInterfaceImpl18GetMatrixAttributeEP15CXmlElementImplPfS2_S2_S2_S2_S2_ @ 96 NONAME
+ _ZN23CSvgEngineInterfaceImpl18RemoveTextListenerEP16MSvgTextListeneri @ 97 NONAME
+ _ZN23CSvgEngineInterfaceImpl18SetBackgroundColorEmP14CSvgEngineImpl @ 98 NONAME
+ _ZN23CSvgEngineInterfaceImpl18SetMatrixAttributeEP15CXmlElementImplffffff @ 99 NONAME
+ _ZN23CSvgEngineInterfaceImpl18SetRequestObserverEP14CSvgEngineImplP19MSvgRequestObserver @ 100 NONAME
+ _ZN23CSvgEngineInterfaceImpl19AddTextAreaListenerEP20MSvgTextAreaListeneri @ 101 NONAME
+ _ZN23CSvgEngineInterfaceImpl19GetExternalListSizeEP16CSvgDocumentImpl @ 102 NONAME
+ _ZN23CSvgEngineInterfaceImpl19GetSegmentParameterEP15CGfxGeneralPathii @ 103 NONAME
+ _ZN23CSvgEngineInterfaceImpl19PrintElementsStylesEP15CSvgElementImpl @ 104 NONAME
+ _ZN23CSvgEngineInterfaceImpl20AddAnimationListenerEP21MSvgAnimationListeneri @ 105 NONAME
+ _ZN23CSvgEngineInterfaceImpl20AddHyperlinkListenerEP21MSvgHyperlinkListeneri @ 106 NONAME
+ _ZN23CSvgEngineInterfaceImpl20DispatchFocusInEventEP16CSvgDocumentImplP15CSvgElementImpl @ 107 NONAME
+ _ZN23CSvgEngineInterfaceImpl20GetExternalListItemLEP16CSvgDocumentImpliR7TPtrC16 @ 108 NONAME
+ _ZN23CSvgEngineInterfaceImpl20IsContentInteractiveEP16CSvgDocumentImpli @ 109 NONAME
+ _ZN23CSvgEngineInterfaceImpl20IsPanPossibleFourWayERiS0_S0_S0_i @ 110 NONAME
+ _ZN23CSvgEngineInterfaceImpl20SetAnimFrameDurationEji @ 111 NONAME
+ _ZN23CSvgEngineInterfaceImpl20SetFirstChildElementEP15CXmlElementImplS1_ @ 112 NONAME
+ _ZN23CSvgEngineInterfaceImpl20SvgActivateAnimationEP16CSvgDocumentImpl @ 113 NONAME
+ _ZN23CSvgEngineInterfaceImpl21ActivateObjectInFocusEv @ 114 NONAME
+ _ZN23CSvgEngineInterfaceImpl21ChooseViewBoxIfNotSetEi @ 115 NONAME
+ _ZN23CSvgEngineInterfaceImpl21DispatchFocusOutEventEP16CSvgDocumentImplP15CSvgElementImpl @ 116 NONAME
+ _ZN23CSvgEngineInterfaceImpl21DispatchMouseEventsAtEP16CSvgDocumentImpliiP17MSvgMouseListener @ 117 NONAME
+ _ZN23CSvgEngineInterfaceImpl21GetElementBoundingboxEP15CSvgElementImplRfS2_S2_S2_ @ 118 NONAME
+ _ZN23CSvgEngineInterfaceImpl21GetTextForTextElementEiRiR6TDes16 @ 119 NONAME
+ _ZN23CSvgEngineInterfaceImpl21SetTextForTextElementEiR7TDesC16 @ 120 NONAME
+ _ZN23CSvgEngineInterfaceImpl22AddToEventReceiverListEP15CXmlElementImplh @ 121 NONAME
+ _ZN23CSvgEngineInterfaceImpl22GetElementDesAttributeEP15CSvgElementImpliR7TPtrC16 @ 122 NONAME
+ _ZN23CSvgEngineInterfaceImpl22GetUnscaledContentSizeEi @ 123 NONAME
+ _ZN23CSvgEngineInterfaceImpl22RemoveTextAreaListenerEP20MSvgTextAreaListeneri @ 124 NONAME
+ _ZN23CSvgEngineInterfaceImpl22SetElementDesAttributeEP15CSvgElementImpliRK7TDesC16 @ 125 NONAME
+ _ZN23CSvgEngineInterfaceImpl22SetPreserveAspectRatioEP16CSvgDocumentImpl27TSvgPreserveAspectAlignType19TSvgMeetOrSliceTypei @ 126 NONAME
+ _ZN23CSvgEngineInterfaceImpl23RemoveAnimationListenerEP21MSvgAnimationListeneri @ 127 NONAME
+ _ZN23CSvgEngineInterfaceImpl23RemoveHyperlinkListenerEP21MSvgHyperlinkListeneri @ 128 NONAME
+ _ZN23CSvgEngineInterfaceImpl23SetDataRetrievalTimeOutEji @ 129 NONAME
+ _ZN23CSvgEngineInterfaceImpl24GetElementColorAttributeEP15CSvgElementImpli @ 130 NONAME
+ _ZN23CSvgEngineInterfaceImpl24GetElementFloatAttributeEP15CSvgElementImpli @ 131 NONAME
+ _ZN23CSvgEngineInterfaceImpl24SVGElementGetUsedElementEP15CXmlElementImpl @ 132 NONAME
+ _ZN23CSvgEngineInterfaceImpl24SetElementColorAttributeEP15CSvgElementImplil @ 133 NONAME
+ _ZN23CSvgEngineInterfaceImpl24SetElementFloatAttributeEP15CSvgElementImplif @ 134 NONAME
+ _ZN23CSvgEngineInterfaceImpl25GetTextForTextAreaElementEiRiR6TDes16 @ 135 NONAME
+ _ZN23CSvgEngineInterfaceImpl25SetTextForTextAreaElementEiR7TDesC16 @ 136 NONAME
+ _ZN23CSvgEngineInterfaceImpl27RemoveFromEventReceiverListEP15CXmlElementImpl @ 137 NONAME
+ _ZN23CSvgEngineInterfaceImpl28SetSvgDimensionToFrameBufferEjji @ 138 NONAME
+ _ZN23CSvgEngineInterfaceImpl29ContentDimensionsInPercentageEi @ 139 NONAME
+ _ZN23CSvgEngineInterfaceImpl29GetElementUnScaledBoundingBoxEP15CSvgElementImplRfS2_S2_S2_ @ 140 NONAME
+ _ZN23CSvgEngineInterfaceImpl30GetFourPointElementBoundingBoxEP19CSvgTextElementImplR6TPointS3_S3_S3_ @ 141 NONAME
+ _ZN23CSvgEngineInterfaceImpl31InitSvgStylePropertiesWithNullLEP15CSvgElementImpl @ 142 NONAME
+ _ZN23CSvgEngineInterfaceImpl3PanEiii @ 143 NONAME
+ _ZN23CSvgEngineInterfaceImpl4LoadER5RFile @ 144 NONAME
+ _ZN23CSvgEngineInterfaceImpl4LoadERK6TDesC8 @ 145 NONAME
+ _ZN23CSvgEngineInterfaceImpl4LoadERK7TDesC16 @ 146 NONAME
+ _ZN23CSvgEngineInterfaceImpl4NewLEP10CFbsBitmapP19MSvgRequestObserverR9TFontSpec @ 147 NONAME
+ _ZN23CSvgEngineInterfaceImpl4SizeEi @ 148 NONAME
+ _ZN23CSvgEngineInterfaceImpl4StopEP14CSvgEngineImpl @ 149 NONAME
+ _ZN23CSvgEngineInterfaceImpl4ZoomEfi @ 150 NONAME
+ _ZN23CSvgEngineInterfaceImpl5GetIdEP16CSvgDocumentImpli @ 151 NONAME
+ _ZN23CSvgEngineInterfaceImpl5NewLCEP10CFbsBitmapP19MSvgRequestObserverR9TFontSpec @ 152 NONAME
+ _ZN23CSvgEngineInterfaceImpl5PauseEP14CSvgEngineImpl @ 153 NONAME
+ _ZN23CSvgEngineInterfaceImpl5StartEP14CSvgEngineImpli @ 154 NONAME
+ _ZN23CSvgEngineInterfaceImpl6RedrawEii @ 155 NONAME
+ _ZN23CSvgEngineInterfaceImpl6ReplayEi @ 156 NONAME
+ _ZN23CSvgEngineInterfaceImpl6ResumeEP14CSvgEngineImpl @ 157 NONAME
+ _ZN23CSvgEngineInterfaceImpl6RotateEfiii @ 158 NONAME
+ _ZN23CSvgEngineInterfaceImpl6UseDomEiP10CFbsBitmapS1_i @ 159 NONAME
+ _ZN23CSvgEngineInterfaceImpl7DestroyEv @ 160 NONAME
+ _ZN23CSvgEngineInterfaceImpl7DrawBoxE5TRecti @ 161 NONAME
+ _ZN23CSvgEngineInterfaceImpl7MouseUpEiii @ 162 NONAME
+ _ZN23CSvgEngineInterfaceImpl7SaveSvgEiRK7TDesC16i @ 163 NONAME
+ _ZN23CSvgEngineInterfaceImpl8DurationEi @ 164 NONAME
+ _ZN23CSvgEngineInterfaceImpl8KeyPressERK9TKeyEventi @ 165 NONAME
+ _ZN23CSvgEngineInterfaceImpl8PositionEi @ 166 NONAME
+ _ZN23CSvgEngineInterfaceImpl9ADDLineToEP15CGfxGeneralPathff @ 167 NONAME
+ _ZN23CSvgEngineInterfaceImpl9ADDMoveToEP15CGfxGeneralPathff @ 168 NONAME
+ _ZN23CSvgEngineInterfaceImpl9ADDQuadToEP15CGfxGeneralPathffff @ 169 NONAME
+ _ZN23CSvgEngineInterfaceImpl9DeleteDomEi @ 170 NONAME
+ _ZN23CSvgEngineInterfaceImpl9FocusNextEv @ 171 NONAME
+ _ZN23CSvgEngineInterfaceImpl9IsLoadingEi @ 172 NONAME
+ _ZN23CSvgEngineInterfaceImpl9MediaTimeEi @ 173 NONAME
+ _ZN23CSvgEngineInterfaceImpl9MouseDownEiii @ 174 NONAME
+ _ZN23CSvgEngineInterfaceImpl9MouseMoveEiii @ 175 NONAME
+ _ZN23CSvgEngineInterfaceImpl9RenderDomEiP10CFbsBitmapS1_ @ 176 NONAME
+ _ZN23CSvgEngineInterfaceImplC1Ev @ 177 NONAME
+ _ZN23CSvgEngineInterfaceImplC2Ev @ 178 NONAME
+ _ZN23CSvgEngineInterfaceImplD0Ev @ 179 NONAME
+ _ZN23CSvgEngineInterfaceImplD1Ev @ 180 NONAME
+ _ZN23CSvgEngineInterfaceImplD2Ev @ 181 NONAME
+ _ZTI10TGfxLine2D @ 182 NONAME ; #<TI>#
+ _ZTI11CGfx2dGcVGR @ 183 NONAME ; #<TI>#
+ _ZTI11CSvgDecoder @ 184 NONAME ; #<TI>#
+ _ZTI13CSvgErrorImpl @ 185 NONAME ; #<TI>#
+ _ZTI13CSvgTestsImpl @ 186 NONAME ; #<TI>#
+ _ZTI13TGfxEllipse2D @ 187 NONAME ; #<TI>#
+ _ZTI14CGfx2dGcOpenVG @ 188 NONAME ; #<TI>#
+ _ZTI14CSvgEngineImpl @ 189 NONAME ; #<TI>#
+ _ZTI14CSvgSchemaData @ 190 NONAME ; #<TI>#
+ _ZTI14TSvgTimerEvent @ 191 NONAME ; #<TI>#
+ _ZTI14TSvgUiKeyEvent @ 192 NONAME ; #<TI>#
+ _ZTI15CGfxGeneralPath @ 193 NONAME ; #<TI>#
+ _ZTI15CSvgElementImpl @ 194 NONAME ; #<TI>#
+ _ZTI15CSvgFontHashMap @ 195 NONAME ; #<TI>#
+ _ZTI15CSvgFontMapItem @ 196 NONAME ; #<TI>#
+ _ZTI15CXmlElementImpl @ 197 NONAME ; #<TI>#
+ _ZTI15TGfxRectangle2D @ 198 NONAME ; #<TI>#
+ _ZTI16CClrCssValueImpl @ 199 NONAME ; #<TI>#
+ _ZTI16CIntCssValueImpl @ 200 NONAME ; #<TI>#
+ _ZTI16CStrCssValueImpl @ 201 NONAME ; #<TI>#
+ _ZTI16CSvgAElementImpl @ 202 NONAME ; #<TI>#
+ _ZTI16CSvgDocumentImpl @ 203 NONAME ; #<TI>#
+ _ZTI16CSvgEventHandler @ 204 NONAME ; #<TI>#
+ _ZTI16CSvgGElementImpl @ 205 NONAME ; #<TI>#
+ _ZTI16CSvgImageHashMap @ 206 NONAME ; #<TI>#
+ _ZTI16CSvgImageMapItem @ 207 NONAME ; #<TI>#
+ _ZTI16TSvgUiMouseEvent @ 208 NONAME ; #<TI>#
+ _ZTI17CGfxLineIteratorP @ 209 NONAME ; #<TI>#
+ _ZTI17CSvgAnimationBase @ 210 NONAME ; #<TI>#
+ _ZTI17CSvgLangSpaceImpl @ 211 NONAME ; #<TI>#
+ _ZTI17CSvgMemoryManager @ 212 NONAME ; #<TI>#
+ _ZTI17TGfxGradientPaint @ 213 NONAME ; #<TI>#
+ _ZTI17TSvgFourPointRect @ 214 NONAME ; #<TI>#
+ _ZTI17TSvgInternalEvent @ 215 NONAME ; #<TI>#
+ _ZTI18CFloatCssValueImpl @ 216 NONAME ; #<TI>#
+ _ZTI18CPaintCssValueImpl @ 217 NONAME ; #<TI>#
+ _ZTI18CSvgContentHandler @ 218 NONAME ; #<TI>#
+ _ZTI18CSvgSetElementImpl @ 219 NONAME ; #<TI>#
+ _ZTI18CSvgSvgElementImpl @ 220 NONAME ; #<TI>#
+ _ZTI18CSvgUseElementImpl @ 221 NONAME ; #<TI>#
+ _ZTI18TSvgTimerEventPrep @ 222 NONAME ; #<TI>#
+ _ZTI19CSvgDefsElementImpl @ 223 NONAME ; #<TI>#
+ _ZTI19CSvgDescElementImpl @ 224 NONAME ; #<TI>#
+ _ZTI19CSvgEventAttributes @ 225 NONAME ; #<TI>#
+ _ZTI19CSvgFontElementImpl @ 226 NONAME ; #<TI>#
+ _ZTI19CSvgLineElementImpl @ 227 NONAME ; #<TI>#
+ _ZTI19CSvgPathElementImpl @ 228 NONAME ; #<TI>#
+ _ZTI19CSvgRectElementImpl @ 229 NONAME ; #<TI>#
+ _ZTI19CSvgStopElementImpl @ 230 NONAME ; #<TI>#
+ _ZTI19CSvgTextElementImpl @ 231 NONAME ; #<TI>#
+ _ZTI19CVectorCssValueImpl @ 232 NONAME ; #<TI>#
+ _ZTI20CGfxEllipseIteratorP @ 233 NONAME ; #<TI>#
+ _ZTI20CSvgAnimTimingParser @ 234 NONAME ; #<TI>#
+ _ZTI20CSvgFitToViewBoxImpl @ 235 NONAME ; #<TI>#
+ _ZTI20CSvgGlyphElementImpl @ 236 NONAME ; #<TI>#
+ _ZTI20CSvgHkernElementImpl @ 237 NONAME ; #<TI>#
+ _ZTI20CSvgImageElementImpl @ 238 NONAME ; #<TI>#
+ _ZTI20CSvgMpathElementImpl @ 239 NONAME ; #<TI>#
+ _ZTI20CSvgStyleElementImpl @ 240 NONAME ; #<TI>#
+ _ZTI20CSvgTitleElementImpl @ 241 NONAME ; #<TI>#
+ _ZTI20CSvgUriReferenceImpl @ 242 NONAME ; #<TI>#
+ _ZTI20TGfxRectangularShape @ 243 NONAME ; #<TI>#
+ _ZTI20TGfxRoundRectangle2D @ 244 NONAME ; #<TI>#
+ _ZTI21CSvgCircleElementImpl @ 245 NONAME ; #<TI>#
+ _ZTI21CSvgScriptElementImpl @ 246 NONAME ; #<TI>#
+ _ZTI21CSvgTransformListImpl @ 247 NONAME ; #<TI>#
+ _ZTI21CSvgTransformableImpl @ 248 NONAME ; #<TI>#
+ _ZTI21TSvgScreenUpdateEvent @ 249 NONAME ; #<TI>#
+ _ZTI22CGfxRectangleIteratorP @ 250 NONAME ; #<TI>#
+ _ZTI22CSvgAnimTimeController @ 251 NONAME ; #<TI>#
+ _ZTI22CSvgAnimateElementImpl @ 252 NONAME ; #<TI>#
+ _ZTI22CSvgDiscardElementImpl @ 253 NONAME ; #<TI>#
+ _ZTI22CSvgEllipseElementImpl @ 254 NONAME ; #<TI>#
+ _ZTI23CSvgEngineInterfaceImpl @ 255 NONAME ; #<TI>#
+ _ZTI23CSvgFontFaceElementImpl @ 256 NONAME ; #<TI>#
+ _ZTI23CSvgGradientElementImpl @ 257 NONAME ; #<TI>#
+ _ZTI23CSvgMetadataElementImpl @ 258 NONAME ; #<TI>#
+ _ZTI23CSvgPolylineElementImpl @ 259 NONAME ; #<TI>#
+ _ZTI23CSvgTextAreaElementImpl @ 260 NONAME ; #<TI>#
+ _ZTI23TGfxLinearGradientPaint @ 261 NONAME ; #<TI>#
+ _ZTI23TGfxRadialGradientPaint @ 262 NONAME ; #<TI>#
+ _ZTI24CGfxGeneralPathIteratorP @ 263 NONAME ; #<TI>#
+ _ZTI24CSvgAnimationElementImpl @ 264 NONAME ; #<TI>#
+ _ZTI25CSvgDOMImplementationImpl @ 265 NONAME ; #<TI>#
+ _ZTI25CSvgSolidColorElementImpl @ 266 NONAME ; #<TI>#
+ _ZTI26CGfxFlatteningPathIterator @ 267 NONAME ; #<TI>#
+ _ZTI27CGfxRoundRectangleIteratorP @ 268 NONAME ; #<TI>#
+ _ZTI27CSvgMissingGlyphElementImpl @ 269 NONAME ; #<TI>#
+ _ZTI27CSvgPreserveAspectRatioImpl @ 270 NONAME ; #<TI>#
+ _ZTI28CSvgAnimateMotionElementImpl @ 271 NONAME ; #<TI>#
+ _ZTI28CSvgForeignObjectElementImpl @ 272 NONAME ; #<TI>#
+ _ZTI29CSvgLinearGradientElementImpl @ 273 NONAME ; #<TI>#
+ _ZTI29CSvgRadialGradientElementImpl @ 274 NONAME ; #<TI>#
+ _ZTI31CSvgAnimateTransformElementImpl @ 275 NONAME ; #<TI>#
+ _ZTI9CSvgTimer @ 276 NONAME ; #<TI>#
+ _ZTI9TGfxColor @ 277 NONAME ; #<TI>#
+ _ZTIN20CSvgImageElementImpl19CSvgImageLoaderUtilE @ 278 NONAME ; #<TI>#
+ _ZTV10TGfxLine2D @ 279 NONAME ; #<VT>#
+ _ZTV11CGfx2dGcVGR @ 280 NONAME ; #<VT>#
+ _ZTV11CSvgDecoder @ 281 NONAME ; #<VT>#
+ _ZTV13CSvgErrorImpl @ 282 NONAME ; #<VT>#
+ _ZTV13CSvgTestsImpl @ 283 NONAME ; #<VT>#
+ _ZTV13TGfxEllipse2D @ 284 NONAME ; #<VT>#
+ _ZTV14CGfx2dGcOpenVG @ 285 NONAME ; #<VT>#
+ _ZTV14CSvgEngineImpl @ 286 NONAME ; #<VT>#
+ _ZTV14CSvgSchemaData @ 287 NONAME ; #<VT>#
+ _ZTV14TSvgTimerEvent @ 288 NONAME ; #<VT>#
+ _ZTV14TSvgUiKeyEvent @ 289 NONAME ; #<VT>#
+ _ZTV15CGfxGeneralPath @ 290 NONAME ; #<VT>#
+ _ZTV15CSvgElementImpl @ 291 NONAME ; #<VT>#
+ _ZTV15CSvgFontHashMap @ 292 NONAME ; #<VT>#
+ _ZTV15CSvgFontMapItem @ 293 NONAME ; #<VT>#
+ _ZTV15CXmlElementImpl @ 294 NONAME ; #<VT>#
+ _ZTV15TGfxRectangle2D @ 295 NONAME ; #<VT>#
+ _ZTV16CClrCssValueImpl @ 296 NONAME ; #<VT>#
+ _ZTV16CIntCssValueImpl @ 297 NONAME ; #<VT>#
+ _ZTV16CStrCssValueImpl @ 298 NONAME ; #<VT>#
+ _ZTV16CSvgAElementImpl @ 299 NONAME ; #<VT>#
+ _ZTV16CSvgDocumentImpl @ 300 NONAME ; #<VT>#
+ _ZTV16CSvgEventHandler @ 301 NONAME ; #<VT>#
+ _ZTV16CSvgGElementImpl @ 302 NONAME ; #<VT>#
+ _ZTV16CSvgImageHashMap @ 303 NONAME ; #<VT>#
+ _ZTV16CSvgImageMapItem @ 304 NONAME ; #<VT>#
+ _ZTV16TSvgUiMouseEvent @ 305 NONAME ; #<VT>#
+ _ZTV17CGfxLineIteratorP @ 306 NONAME ; #<VT>#
+ _ZTV17CSvgAnimationBase @ 307 NONAME ; #<VT>#
+ _ZTV17CSvgLangSpaceImpl @ 308 NONAME ; #<VT>#
+ _ZTV17CSvgMemoryManager @ 309 NONAME ; #<VT>#
+ _ZTV17TGfxGradientPaint @ 310 NONAME ; #<VT>#
+ _ZTV17TSvgFourPointRect @ 311 NONAME ; #<VT>#
+ _ZTV17TSvgInternalEvent @ 312 NONAME ; #<VT>#
+ _ZTV18CFloatCssValueImpl @ 313 NONAME ; #<VT>#
+ _ZTV18CPaintCssValueImpl @ 314 NONAME ; #<VT>#
+ _ZTV18CSvgContentHandler @ 315 NONAME ; #<VT>#
+ _ZTV18CSvgSetElementImpl @ 316 NONAME ; #<VT>#
+ _ZTV18CSvgSvgElementImpl @ 317 NONAME ; #<VT>#
+ _ZTV18CSvgUseElementImpl @ 318 NONAME ; #<VT>#
+ _ZTV18TSvgTimerEventPrep @ 319 NONAME ; #<VT>#
+ _ZTV19CSvgDefsElementImpl @ 320 NONAME ; #<VT>#
+ _ZTV19CSvgDescElementImpl @ 321 NONAME ; #<VT>#
+ _ZTV19CSvgEventAttributes @ 322 NONAME ; #<VT>#
+ _ZTV19CSvgFontElementImpl @ 323 NONAME ; #<VT>#
+ _ZTV19CSvgLineElementImpl @ 324 NONAME ; #<VT>#
+ _ZTV19CSvgPathElementImpl @ 325 NONAME ; #<VT>#
+ _ZTV19CSvgRectElementImpl @ 326 NONAME ; #<VT>#
+ _ZTV19CSvgStopElementImpl @ 327 NONAME ; #<VT>#
+ _ZTV19CSvgTextElementImpl @ 328 NONAME ; #<VT>#
+ _ZTV19CVectorCssValueImpl @ 329 NONAME ; #<VT>#
+ _ZTV20CGfxEllipseIteratorP @ 330 NONAME ; #<VT>#
+ _ZTV20CSvgAnimTimingParser @ 331 NONAME ; #<VT>#
+ _ZTV20CSvgFitToViewBoxImpl @ 332 NONAME ; #<VT>#
+ _ZTV20CSvgGlyphElementImpl @ 333 NONAME ; #<VT>#
+ _ZTV20CSvgHkernElementImpl @ 334 NONAME ; #<VT>#
+ _ZTV20CSvgImageElementImpl @ 335 NONAME ; #<VT>#
+ _ZTV20CSvgMpathElementImpl @ 336 NONAME ; #<VT>#
+ _ZTV20CSvgStyleElementImpl @ 337 NONAME ; #<VT>#
+ _ZTV20CSvgTitleElementImpl @ 338 NONAME ; #<VT>#
+ _ZTV20CSvgUriReferenceImpl @ 339 NONAME ; #<VT>#
+ _ZTV20TGfxRectangularShape @ 340 NONAME ; #<VT>#
+ _ZTV20TGfxRoundRectangle2D @ 341 NONAME ; #<VT>#
+ _ZTV21CSvgCircleElementImpl @ 342 NONAME ; #<VT>#
+ _ZTV21CSvgScriptElementImpl @ 343 NONAME ; #<VT>#
+ _ZTV21CSvgTransformListImpl @ 344 NONAME ; #<VT>#
+ _ZTV21CSvgTransformableImpl @ 345 NONAME ; #<VT>#
+ _ZTV21TSvgScreenUpdateEvent @ 346 NONAME ; #<VT>#
+ _ZTV22CGfxRectangleIteratorP @ 347 NONAME ; #<VT>#
+ _ZTV22CSvgAnimTimeController @ 348 NONAME ; #<VT>#
+ _ZTV22CSvgAnimateElementImpl @ 349 NONAME ; #<VT>#
+ _ZTV22CSvgDiscardElementImpl @ 350 NONAME ; #<VT>#
+ _ZTV22CSvgEllipseElementImpl @ 351 NONAME ; #<VT>#
+ _ZTV23CSvgEngineInterfaceImpl @ 352 NONAME ; #<VT>#
+ _ZTV23CSvgFontFaceElementImpl @ 353 NONAME ; #<VT>#
+ _ZTV23CSvgGradientElementImpl @ 354 NONAME ; #<VT>#
+ _ZTV23CSvgMetadataElementImpl @ 355 NONAME ; #<VT>#
+ _ZTV23CSvgPolylineElementImpl @ 356 NONAME ; #<VT>#
+ _ZTV23CSvgTextAreaElementImpl @ 357 NONAME ; #<VT>#
+ _ZTV23TGfxLinearGradientPaint @ 358 NONAME ; #<VT>#
+ _ZTV23TGfxRadialGradientPaint @ 359 NONAME ; #<VT>#
+ _ZTV24CGfxGeneralPathIteratorP @ 360 NONAME ; #<VT>#
+ _ZTV24CSvgAnimationElementImpl @ 361 NONAME ; #<VT>#
+ _ZTV25CSvgDOMImplementationImpl @ 362 NONAME ; #<VT>#
+ _ZTV25CSvgSolidColorElementImpl @ 363 NONAME ; #<VT>#
+ _ZTV26CGfxFlatteningPathIterator @ 364 NONAME ; #<VT>#
+ _ZTV27CGfxRoundRectangleIteratorP @ 365 NONAME ; #<VT>#
+ _ZTV27CSvgMissingGlyphElementImpl @ 366 NONAME ; #<VT>#
+ _ZTV27CSvgPreserveAspectRatioImpl @ 367 NONAME ; #<VT>#
+ _ZTV28CSvgAnimateMotionElementImpl @ 368 NONAME ; #<VT>#
+ _ZTV28CSvgForeignObjectElementImpl @ 369 NONAME ; #<VT>#
+ _ZTV29CSvgLinearGradientElementImpl @ 370 NONAME ; #<VT>#
+ _ZTV29CSvgRadialGradientElementImpl @ 371 NONAME ; #<VT>#
+ _ZTV31CSvgAnimateTransformElementImpl @ 372 NONAME ; #<VT>#
+ _ZTV9CSvgTimer @ 373 NONAME ; #<VT>#
+ _ZTV9TGfxColor @ 374 NONAME ; #<VT>#
+ _ZTVN20CSvgImageElementImpl19CSvgImageLoaderUtilE @ 375 NONAME ; #<VT>#
+ _ZN23CSvgEngineInterfaceImpl5StartERP9MSvgErrorP14CSvgEngineImpl @ 376 NONAME
+ _ZN23CSvgEngineInterfaceImpl12SetDRMRightsEi @ 377 NONAME
+ _ZN23CSvgEngineInterfaceImpl14SetAudioVolumeEii @ 378 NONAME
+ _ZN23CSvgEngineInterfaceImpl15MuteAudioVolumeEi @ 379 NONAME
+ _ZN23CSvgEngineInterfaceImpl18GetMatrixAttributeEP15CXmlElementImpliPfS2_S2_S2_S2_S2_ @ 380 NONAME
+ _ZN23CSvgEngineInterfaceImpl10ConstructLER9TFontSpec @ 381 NONAME
+ _ZN23CSvgEngineInterfaceImpl12ResetContextEi @ 382 NONAME
+ _ZN23CSvgEngineInterfaceImpl10ConstructLEP10CFbsBitmapP19MSvgRequestObserverR9TFontSpec13SVGRendererId @ 383 NONAME
+ _ZN23CSvgEngineInterfaceImpl4NewLEP10CFbsBitmapP19MSvgRequestObserverR9TFontSpec13SVGRendererId @ 384 NONAME
+ _ZN23CSvgEngineInterfaceImpl5NewLCEP10CFbsBitmapP19MSvgRequestObserverR9TFontSpec13SVGRendererId @ 385 NONAME
+ _ZN23CSvgEngineInterfaceImpl5StartEPK6TDesC8P14CSvgEngineImpli @ 386 NONAME
+ _ZN23CSvgEngineInterfaceImpl5StartERP9MSvgErrorPK6TDesC8P14CSvgEngineImpl @ 387 NONAME
+ _ZN23CSvgEngineInterfaceImpl6UseDomEiP10CFbsBitmapS1_5TSize12TDisplayModeS3_i @ 388 NONAME
+ _ZNK23CSvgEngineInterfaceImpl14TLVEncodedDataEv @ 389 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/group/SVGEngine.mmp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,285 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This mmp file generates makefile for SVG Engine
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+ALWAYS_BUILD_AS_ARM
+OPTION_REPLACE ARMCC --cpu 5T -O3 -Otime
+TARGET svgengine.dll
+TARGETTYPE dll
+
+
+VENDORID VID_DEFAULT
+
+UID 0x1000008D 0x101F856E
+
+
+ #if defined( ARMCC )
+ deffile ../eabi/SVGENGINE-OpenVG.def
+ #elif defined( WINSCW )
+ deffile ../BWINSCW/SVGENGINE-OpenVG.def
+ #elif defined( WINS )
+ deffile ../bwins/SVGENGINE-OpenVG.def
+ #else
+ deffile ../bmarm/SVGENGINE-OpenVG.def
+ #endif
+
+CAPABILITY CAP_GENERAL_DLL DRM
+
+SOURCEPATH ../src
+
+//SOURCE SVGEngineMain.cpp
+SOURCE SVGEngineImpl.cpp
+SOURCE SVGEngineInterfaceImpl.cpp
+SOURCE SVGTimer.cpp
+SOURCE SVGEventHandler.cpp
+SOURCE SVGEvent.cpp
+SOURCE SVGContentHandler.cpp
+SOURCE SvgBitmapFontProvider.cpp
+//SOURCE SVGXmlParser.cpp
+SOURCE SVGAttributeVerifier.cpp
+SOURCE SVGErrorImpl.cpp
+SOURCE Svgdecoder.cpp
+SOURCE SVGFourPointRect.cpp
+
+SOURCEPATH ../../SVGImpl/src
+
+SOURCE SVGElementImpl.cpp
+SOURCE SVGDocumentImpl.cpp
+SOURCE SVGDOMImplementationImpl.cpp
+
+// Structure Elements
+SOURCE Svgsvgelementimpl.cpp
+SOURCE SVGGElementImpl.cpp
+SOURCE SVGUseElementImpl.cpp
+SOURCE SVGStyleElementImpl.cpp
+SOURCE SVGForeignObjectElementImpl.cpp
+SOURCE SVGTitleElementImpl.cpp
+SOURCE SVGMetadataElementImpl.cpp
+SOURCE SVGDefsElementImpl.cpp
+SOURCE SVGDescElementImpl.cpp
+
+// Hyper linking
+SOURCE SVGAElementImpl.cpp
+SOURCE SVGUriReferenceImpl.cpp
+
+// Basic Shape Elements
+SOURCE SVGLineElementImpl.cpp
+SOURCE SVGRectElementImpl.cpp
+SOURCE SVGCircleElementImpl.cpp
+SOURCE SVGEllipseElementImpl.cpp
+SOURCE SVGPolylineElementImpl.cpp
+SOURCE SVGPathElementImpl.cpp
+SOURCE SVGMpathElementImpl.cpp
+
+// Text and Image Elements
+SOURCE SVGTextElementImpl.cpp
+SOURCE SVGTextAreaElementImpl.cpp
+SOURCE SVGImageElementImpl.cpp
+
+//Font Elements
+SOURCE SVGFontElementImpl.cpp
+SOURCE SVGFontFaceElementImpl.cpp
+SOURCE SVGGlyphElementImpl.cpp
+SOURCE SVGMissingGlyphElementImpl.cpp
+SOURCE SvgHkernelementimpl.cpp
+
+// Animation Elements
+SOURCE SVGAnimationBase.cpp
+SOURCE SVGSetElementImpl.cpp
+SOURCE SVGAnimateElementImpl.cpp
+SOURCE SVGAnimateTransformElementImpl.cpp
+SOURCE SVGAnimateMotionElementImpl.cpp
+SOURCE SVGDiscardElementImpl.cpp
+SOURCE SVGAnimationElementImpl.cpp
+
+// Gradient Elements
+SOURCE SVGLinearGradientElementImpl.cpp
+SOURCE SVGGradientElementImpl.cpp
+SOURCE SVGRadialGradientElementImpl.cpp
+SOURCE SVGStopElementImpl.cpp
+
+SOURCE SVGSolidColorElementImpl.cpp
+SOURCE SVGScriptElementImpl.cpp
+
+// CSS Classes
+SOURCE SVGClrCssValueImpl.cpp
+SOURCE SVGPaintCssValueImpl.cpp
+SOURCE SVGIntCssValueImpl.cpp
+SOURCE SVGFloatCssValueImpl.cpp
+SOURCE SVGStrCssValueImpl.cpp
+SOURCE SVGVectorCssValueImpl.cpp
+//SOURCE SVGCssStyleDeclarationImpl.cpp
+SOURCE SVGEventAttributes.cpp
+
+// Transform Classes
+SOURCE SVGTransformListImpl.cpp
+SOURCE SVGTransformableImpl.cpp
+
+// Switch Related Classes
+SOURCE SVGTestsImpl.cpp
+
+// XML Language Space Class
+SOURCE SVGLangSpaceImpl.cpp
+
+// Viewbox Classes
+SOURCE SVGFitToViewBoxImpl.cpp
+SOURCE SVGPreserveAspectRatioImpl.cpp
+
+// Utility Classes
+SOURCE SVGPointLexer.cpp
+SOURCE SVGSchemaData.cpp
+SOURCE SVGPathDataParser.cpp
+SOURCE SVGAnimTimeController.cpp
+SOURCE SVGStringTokenizer.cpp
+SOURCE SVGRelToAbsPath.cpp
+SOURCE SVGAnimTimingParser.cpp
+SOURCE SVGImageHashMap.cpp
+SOURCE SVGFontHashMap.cpp
+SOURCE SVGMemoryManager.cpp
+SOURCE SVGColor.cpp
+SOURCE SVGTokenizer.cpp
+
+// Media Element Classes
+SOURCE SVGAudioElementImpl.cpp
+SOURCE SVGMediaAnimationElementImpl.cpp
+SOURCE SVGMediaElementBase.cpp
+SOURCE SVGTimeContainer.cpp
+SOURCE SVGLockedRealTimeEntity.cpp
+
+SOURCEPATH ../../Xmldomimpl/src
+
+SOURCE SVGXmlElementImpl.cpp
+
+
+USERINCLUDE ../inc
+USERINCLUDE ../../Xmldomimpl/inc
+USERINCLUDE ../../SVGImpl/inc/SVGDOM
+USERINCLUDE ../../SVGImpl/inc
+USERINCLUDE ../../../VGRenderer/inc
+
+// This is a SYSTEMINCLUDE macro containing the middleware
+// layer specific include directories
+MW_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE /epoc32/include/libc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY cone.lib
+LIBRARY euser.lib
+LIBRARY bafl.lib
+LIBRARY efsrv.lib
+LIBRARY fbscli.lib
+LIBRARY estor.lib
+LIBRARY gdi.lib
+
+// LIBRARY for image converter utilities
+//LIBRARY mediaclientimage.lib
+LIBRARY imageconversion.lib
+
+// LIBRARY for xml parser utilities
+LIBRARY xmlinterface.lib
+
+
+// CXML parser
+//LIBRARY cxmlparser.lib
+// For CnvUtfConverter class
+LIBRARY charconv.lib
+
+//#include <oem/DRM.mmp>
+//#if !defined(__DRM_FULL)
+
+//LIBRARY drmparsers.lib drmdcf.lib drmrights.lib drmserverinterfaces.lib
+//LIBRARY drmcommon.lib
+
+LIBRARY estlib.lib
+//#endif
+
+// Base64 Encoding
+LIBRARY imut.lib
+
+// GZip library
+LIBRARY ezlib.lib
+
+// CAF library: for DRM
+LIBRARY caf.lib
+
+LIBRARY mediaclientaudio.lib
+// Added for localized bidirectional textArea wrapping support
+LIBRARY avkon.lib
+
+//--------------------------------------------
+// graphics LIBRARY information--------
+//LIBRARY gfx2d.lib
+//--------------------------------------------
+SOURCEPATH ../../../gfx2d/src
+SOURCE GfxMath.c
+SOURCE GfxFloatFixPt.cpp
+SOURCE Gfxtrignometric.cpp
+/* this file is needed for ADS, RVCT, or GCC builds (mem operation wrappers) */
+SOURCE RastSymbianWrapper.cpp
+
+// GFXGC source files
+SOURCEPATH ../../../gfx2d/src/GfxGc
+SOURCE GfxStroke.cpp
+SOURCE GfxColor.cpp
+SOURCE GfxRenderingHints.cpp
+SOURCE GfxGradientPaint.cpp
+SOURCE Gfx2dGcOpenVG.cpp
+SOURCE Gfx2dGc.cpp
+
+
+// GFXGEOM source files
+SOURCEPATH ../../../gfx2d/src/GfxGeom
+SOURCE GfxEllipse2D.cpp
+SOURCE GfxEllipseIteratorP.cpp
+SOURCE GfxFlatteningPathIterator.cpp
+SOURCE GfxGeneralPath.cpp
+SOURCE GfxGeneralPathIteratorP.cpp
+SOURCE GfxRectangle2D.cpp
+SOURCE GfxRectangleIteratorP.cpp
+SOURCE GfxRectangularShape.cpp
+SOURCE GfxRoundRectangle2D.cpp
+SOURCE GfxRoundRectangleIteratorP.cpp
+SOURCE GfxLine2D.cpp
+SOURCE GfxLineIteratorP.cpp
+SOURCE GfxAffineTransform.cpp
+SOURCE GfxPoint2D.cpp
+
+// GFXIMAGE source files
+SOURCEPATH ../../../gfx2d/src/GfxImage
+SOURCE GfxImageTransformer.cpp
+
+// Internal Rendering Engine source files
+SOURCEPATH ../../../gfx2d/src/GfxRenderer
+SOURCE GfxRendererInfoP.cpp
+
+
+USERINCLUDE ../../../gfx2d/inc
+
+
+LIBRARY vgrenderer.lib
+
+
+LIBRARY eikcore.lib
+LIBRARY bitgdi.lib
+LIBRARY hal.lib
+//--------------------------------------------
+// end of graphics LIBRARY information--------
+//--------------------------------------------
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/group/SVGEngineS90.iby Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IBY file for SVGT Engine
+*
+*/
+
+
+#ifndef SVGTENGINE_IBY
+#define SVGTENGINE_IBY
+
+file=ABI_DIR\BUILD_DIR\SVGEngine.dll System\Libs\SVGEngine.dll
+file=ABI_DIR\BUILD_DIR\Svgrecog.mdl System\recogs\Svgrecog.mdl
+
+#endif
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/inc/SVGAttributeVerifier.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGATTRIBUTEVERIFIER_
+#define _INC_CSVGATTRIBUTEVERIFIER_
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+
+#include <badesca.h>
+
+#define KSVG_COORDINATE_TYPE 2
+#define KSVG_LENGTH_TYPE 1
+const TInt KMax16BitValue = 32765;
+
+/**
+ * This class provides methods to verify attributes values, to reorder
+ * the attributes and to check for required attributes for specific elements,
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgAttributeVerifier : public CBase
+{
+ public:
+
+
+ /**
+ * Parse the given string for a decimal value.
+ *
+ * @since 1.0
+ * @param aNumberString : decimal value string
+ * @param aValueStorage : value storage
+ * @return ETrue if string is a valid decimal value.
+ */
+ static TBool ParseForDecimalValue( const TDesC& aNum2Str, TReal32& aValue, const TDesC& aAttrValue, TBool isSvgElement );
+
+ /**
+ * Verify the range of the value of an attribute based on its type
+ * The string value is converted into the required type and passed back to
+ * the calling function
+ * @since 1.0
+ * @param aValues : value of the attribute
+ * @param aConvVal : reference parameter to return the converted value
+ * @param aDatatype : flag to determine the type of datatype
+ * @return ETrue if string is a valid decimal value and lies in a valid range.
+ */
+
+ static TBool ValidAttrValue (
+ const TDesC& aValue,
+ TReal32& aConvVal,
+ TUint8 aDatatype,
+ const TDesC& aAttrValue,
+ TBool isSvgElement
+ );
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/inc/SVGContentHandler.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,563 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine header file
+ *
+*/
+
+
+#ifndef CSVGCONTENTHANDLER_H
+#define CSVGCONTENTHANDLER_H
+
+
+#include <e32base.h>
+#include <s32strm.h>
+
+#include "GfxColor.h"
+#include "SVGEngineInterfaceImpl.h"
+#include "SVGAttributeVerifier.h"
+#include "SVGErrorImpl.h"
+
+#include "mxmlattributes.h"
+#include "mxmlcontenthandler.h"
+
+#include "SVGSchemaData.h"
+#include "SVGDocumentImpl.h"
+
+/**
+ * SMIL2 parser class
+ */
+class CSvgElementImpl;
+class CSvgScriptElementImpl;
+class CSvgImageElementImpl;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgContentHandler : public CBase, public MXMLContentHandler
+ {
+ public:
+ /**
+ * Parser phase one constructor
+ *
+ * Takes the player interface object as a parameter. This interface
+ * is used by the parser for reporting parse errors and for getting values
+ * of the content control attributes. It is also passed to the created
+ * presentation object.
+ */
+
+ /**
+ * Two phase constructor
+ *
+ * @since 1.0
+ * @param None
+ * @return An isntance of this class
+ */
+ static CSvgContentHandler* NewL( TBool aRemoveFalseSwitchElements = ETrue );
+
+ /**
+ * Two phase constructor
+ *
+ * @since 1.0
+ * @param None
+ * @return An instance of this class
+ */
+ static CSvgContentHandler* NewLC();
+
+
+ /**
+ * Part of two phase construction
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ virtual void ConstructL( TBool aRemoveFalseSwitchElements = ETrue );
+
+ /**
+ * Destructor.
+ */
+
+ /**
+ * Destructor
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ virtual ~CSvgContentHandler();
+
+
+
+
+ /**
+ *
+ * Parses the given encrypted SVG source, constructing the presentation objects.
+ * This is a variant of ParseL and processes encrypted SVG sources.
+ *
+ * @since 1.0
+ * @param aDocument - The document object to which this document is constructed
+ * @param aSvgFileName - The URI to the encrypted SVG source
+ * @param aSuccess - An error code that signals successful/unsuccessful parsing
+ * @return Instance of the root element of the SVG document.
+ */
+ CSvgElementImpl* ParseByteData( CSvgDocumentImpl* aDocument,
+ const TDesC8& aByteData,
+ CSvgErrorImpl& aError );
+
+ /*
+ * Parse the given 16 bit string of SVG
+ * This method is used primarily for JSR226 to avoid conversion of strings
+ *
+ */
+ CSvgElementImpl* Parse16BitData( CSvgDocumentImpl* aDocument,
+ const TDesC16& aSvgString,
+ CSvgErrorImpl& aError );
+
+
+
+ CSvgElementImpl* ParseFile( CSvgDocumentImpl* aDocument,
+ const TDesC& aFileName,
+ CSvgErrorImpl& aError );
+ /*************** MXMLContentHandler interface methods **************/
+
+ /**
+ * A callback that signals start of a document
+ *
+ * @since 1.0
+ * @param
+ * @return A value that indicates success/failure
+ */
+ TInt StartDocument();
+
+ /**
+ * A callback that signals end of a document
+ *
+ * @since 1.0
+ * @param
+ * @return A value that indicates success/failure
+ */
+ TInt EndDocument();
+
+ /**
+ * Returns reader index
+ * @since Series60 3.1
+ * @param aIndex - reader index
+ */
+ void ReaderIndex(NW_Uint32 aIndex);
+
+ /**
+ * A callback that signals beginning of an element
+ *
+ * @since 1.0
+ * @param aURI -
+ * @param aLocalName -
+ * @param aName - Name of the element
+ * @param aAttributeList - a list that keeps track of the attributes found for this element
+ * @return A value that indicates success/failure
+ */
+ TInt StartElement( TDesC& aURI, TDesC& aLocalName,
+ TDesC& aName, MXMLAttributes* aAttributeList );
+ /**
+ * A callback that signals end of an element
+ *
+ * @since 1.0
+ * @param aURI -
+ * @param aLocalName -
+ * @param aName - Name of the element
+ * @return A value that indicates success/failure
+ */
+ TInt EndElement( TDesC& aURI, TDesC& aLocalName, TDesC& aName );
+
+ /**
+ * Callback that signals characters inside an XML document
+ *
+ * @since 1.0
+ * @param aBuf - A string buffer that will contain the characters
+ * @param aStart - An index indicating the starting position of the characters
+ * @param aLenght - AN offset indicating the terminal position of the characters
+ * @return A value that indicates success/failure
+ */
+ TInt Charecters( TDesC& aBuf, TInt aStart, TInt aLength );
+
+ /**
+ * A callback that signals a XML comment
+ *
+ * @since 1.0
+ * @param aComment - A string buffer that cintains the comment
+ * @return A value that indicates success/failure
+ */
+
+ TInt Comment( TDesC& aComment );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return A value that indicates success/failure
+ */
+ TInt ProcessingInstructions( TDesC& aTarget, TDesC& aData );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return A value that indicates success/failure
+ */
+ TInt IgnoreWhiteSpace( TDesC& aString );
+
+ /**
+ * A callback that signals beginning of an entity element
+ *
+ * @since 1.0
+ * @param aName - A string buffer that will contain the entity name
+ * @return A value that indicates success/failure
+ */
+ TInt StartEntity( TDesC& aName );
+
+ /**
+ * A callback that signals end of an entity element
+ *
+ * @since 1.0
+ * @param aName - A string buffer that will contain the entity name
+ * @return A value that indicates success/failure
+ */
+ TInt EndEntity( TDesC& aName );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return A value that indicates success/failure
+ */
+ TInt SkippedEntity( TDesC& aName );
+
+ /**
+ * A callback that signals beginning of a CDATA section
+ *
+ * @since 1.0
+ * @param
+ * @return A value that indicates success/failure
+ */
+ TInt StartCDATA();
+
+ /**
+ * A callback that signals end of a CDATA section
+ *
+ * @since 1.0
+ * @param
+ * @return A value that indicates success/failure
+ */
+ TInt EndCDATA();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return A value that indicates success/failure
+ */
+ TInt Error( TInt aErrorCode, TInt aSeverity );
+
+ void DataBuffer(const TDesC16& aBuf);
+
+ /**
+ * Request to cancel parsing.
+ */
+ void CancelParsing();
+
+ protected:
+
+
+ /**
+ * Method to verify the value of the attribute based on its type. If the value is
+ * valid then this method sets the value to the corresponding attribtue in the
+ * current element
+ * @since 1.0
+ * @aAttrName - name of the attribute
+ * @aAttrValue - value of the attribute
+ * @return
+ */
+
+ TBool ProcessNConvertAttrL( const TDesC& aName, const TDesC& aAttrName, const TDesC& aAttrValue );
+
+
+
+ /**
+ * Parse for a color from the given string.
+ *
+ * @since 1.0
+ * @param aString : color string to parse for color value
+ * @param aTransparent : transparent flag.
+ * @return parsed color.
+ */
+ TGfxColor ParseColor( const TDesC& aString,
+ TBool& aTransparent );
+ /**
+ * Process for a color from the given attribute name and value.
+ *
+ * @since 1.0
+ * @param aName : attribute name
+ * @param aValue : attribute value.
+ * @return true if attribute is processes as a color attribute.
+ */
+ TBool ProcessColorAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+
+ /**
+ * Process a for style info.
+ *
+ * @since 1.0
+ * @param aName : attribute name
+ * @param aValue : attribute value
+ * @return true if a style info is processed.
+ */
+ TBool ProcessStyleL( const TDesC& aValue );
+
+ /**
+ * Process a for transform info.
+ *
+ * @since 1.0
+ * @param aName : attribute name
+ * @param aValue : attribute value
+ * @return true if a transform info is processed.
+ */
+ TBool ProcessTransformL( const TDesC& aName,
+ const TDesC& aValue );
+
+ /**
+ * Process a for unit info.
+ *
+ * @since 1.0
+ * @param aName : attribute name
+ * @param aValue : attribute value
+ * @return true if a unit info is processed.
+ */
+ TBool ProcessUnitsL( const TDesC& aName,
+ const TDesC& aValue );
+
+ /**
+ * Convert any xml entity characters in the given string list to unicode characters.
+ *
+ * @since 1.0
+ * @param aArray : array of strings to search for xml entities characters.
+ * @return
+ */
+ void ConvertEntitiesToCharsL( CDesCArrayFlat& aArray );
+
+ /**
+ * Convert any xml entity characters in the given string to unicode characters.
+ *
+ * @since 1.0
+ * @param aString : string to search for xml entities characters.
+ * @return non-NULL if at least one entity character is encountered.
+ */
+ HBufC* ConvertEntitiesToCharsL( const TDesC& aString );
+
+ /**
+ * Find the given character in the given string at the starting index.
+ *
+ * @since 1.0
+ * @param aString : string to find character.
+ * @param aStartIndex : starting index.
+ * @param aChar : character to search.
+ * @return index of first character encounterd, if found, -1 otherwise.
+ */
+ TInt Find( const TDesC& aString, TInt aStartIndex, TChar aChar );
+
+ /**
+ * Create a substring from the given string.
+ *
+ * @since 1.0
+ * @param aString : string to create a substring.
+ * @param aStartIndex : starting index.
+ * @param aEndIndex : endind index.
+ * @return substring from starting and ending indices.
+ */
+ HBufC* SubstringL( const TDesC& aString, TInt aStartIndex, TInt aEndIndex );
+
+ /**
+ * Convert the given string (xml entity character) to an unicode character.
+ *
+ * @since 1.0
+ * @param aChar : character object to store unicode character.
+ * @param aString : xml entity character string.
+ * @return true if there was a conversion.
+ */
+ TBool ConvertEntityToChar( TChar& aChar, const TDesC& aString );
+
+ /**
+ * Append a substring to the given string at given indices.
+ *
+ * @since 1.0
+ * @param aDest : string to append substring to.
+ * @param aSource : string to append substring from.
+ * @param aStartIndex : starting index for substring.
+ * @param aEndIndex : ending index for substring.
+ * @return
+ */
+ void Append( TDes& aDest, const TDesC& aSource, TInt aStartIndex, TInt aEndIndex );
+
+ /**
+ * Convert the given string (xml entity character) an unicode character.
+ *
+ * @since 1.0
+ * @param aChar : character object to store unicode character.
+ * @param aString : xml decimal entity character string.
+ * @return true if a conversion was made.
+ */
+ TBool ConvertDecimalStringToChar( TChar& aChar, const TDesC& aString );
+
+ /**
+ * Convert the given string (xml entity character) an unicode character.
+ *
+ * @since 1.0
+ * @param aChar : character object to store unicode character.
+ * @param aString : xml hexadecimal entity character string.
+ * @return true if a conversion was made.
+ */
+ TBool ConvertHexStringToChar( TChar& aChar, const TDesC& aString );
+
+
+ void FilterCharactersL( TDesC& aString );
+
+ // Leaveable StartElementL function called by StartElement
+ TInt StartElementL( TDesC& aURI, TDesC& aLocalName,
+ TDesC& aName, MXMLAttributes* aAttributeList );
+
+
+ void AppendToCData( const TDesC& aText );
+
+ TBool ExtractStyleValuePair( const TDesC& aString, TPtrC& aName, TPtrC& aValue );
+
+ void SetForwardReferences(CSvgErrorImpl& aError);
+
+ void RemoveFalseSwitchCasesOrMakeInvisible();
+ void RemoveFalseElementsOrMakeInvisible();
+ TBool VerifyReqExReqFtrSysL( CSvgElementImpl* aElement );
+
+ // Initiate image loading for <image> elements
+ void LoadImages();
+
+ /**
+ * Find out the system language for the client environment based on
+ * SVG source hint
+ *
+ * @since 1.0
+ * @param aValue - A string buffer that contains the System Language hint
+ * @return None
+ */
+ void SystemLanguage( TPtr aValue );
+
+ /**
+ * Private constructor
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgContentHandler();
+
+ /**
+ * Check for possible svg elements placed inside entity references.
+ * If so, attempt to parse as part of the document.
+ * If parsing was successful, return ETrue, otherwise return EFalse.
+ *
+ * @since 1.0
+ * @param
+ * @return If parsing was successful
+ */
+ TBool ParseEntity( const TDesC& aEntity );
+
+ /**
+ * Post parsing processing, such as removing false switch elements.
+ *
+ * @since 1.0
+ * @param
+ * @return none
+ */
+ void PostParseProcessing();
+
+ /**
+ * Removes references of element. Usually called before the element is
+ * deleted.
+ *
+ * @since s60 3.2
+ * @param aElement Pointer of element that is about to be deleted.
+ * @return none
+ */
+ void RemoveInternalReferences( CSvgElementImpl* aElement );
+
+ private:
+
+ CSvgElementImpl*iRootElement; // SVG Element
+ CSvgElementImpl*iCurrentElement; // Latest discovered element
+ CSvgElementImpl*iCurrentParentElement; // Parent element for the current depth
+ CSvgDocumentImpl* iDocument; // The document object to which this SVG source is processed
+
+
+
+ // Various booleans that indicate success/failure or true/false for various attributes
+ TBool iIsColorAnim;
+ // Indicating begin or end attribute.
+ TBool iBeginEndAtr;
+
+
+ // Various buffers that hold animation time values
+ TPtrC iFromVal;
+ TPtrC iToVal;
+ TPtrC iByVal;
+ TPtrC iValues;
+ TPtrC iTimes;
+ TPtrC iSplines;
+
+ HBufC* iSystemLanguage;
+
+ // Various attributes that hold document "depth" information
+ TInt iIgnoreDepth;
+ TBool iIsSvgElement;
+
+ CSvgErrorImpl* iSvgError;
+
+ /*Added to support forward references in Use and animtion elements */
+ RPointerArray<CSvgElementImpl>* iUseElementArray;
+ RPointerArray<CSvgElementImpl>* iAnimRefElementArray;
+
+ //array to keep track of switch elements
+ //so we can go back at the end of parsing and remove the elements
+ //that dont evaluate to true from memory
+ RPointerArray<CSvgElementImpl>* iSwitchElementArray;
+ RPointerArray<CSvgElementImpl>* iReqFetAttSysArray;
+ RPointerArray<CSvgElementImpl>* iAnimationElementArray;
+ // CData container -- used to append pieces of cdata from XML parser
+ // callbacks: Charecters & StartEntity
+ HBufC* iCData;
+
+ // Reference to loading listeners
+ const RPointerArray<MSvgLoadingListener>* iLoadingListeners;
+
+ TBool iCancelRequested;
+
+ RPointerArray<CSvgImageElementImpl> iImageElements;
+ TBool iRemoveFalseSwitchElements;
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/inc/SVGEngineImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,970 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine header file
+ *
+*/
+
+
+#ifndef __INC_CSVGENGINEIMPL__
+#define __INC_CSVGENGINEIMPL__
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include <fbs.h>
+
+
+#include "SVGEngineInterfaceImpl.h"
+#include "GfxAffineTransform.h"
+#include "SVGEvent.h"
+#include "SVGDocumentImpl.h"
+#include "SVGRequestObserver.h"
+#include "SVGImageElementImpl.h"
+#include "SVGFourPointRect.h"
+#include "SVGListener.h"
+#include "SVGFontHashMap.h"
+#include "SvgBitmapFontProvider.h"
+#include <SVGRendererId.h>
+
+// Svg Engine states
+enum TSvgEngineState
+ {
+ ESVGEngineRunning,
+ ESVGEnginePaused,
+ ESVGEngineNotStarted,
+ ESVGEngineStopped
+ };
+typedef TUint8 TAnimStatus;
+
+
+class CSvgSchemaData;
+class CSvgElementImpl;
+class MXmlDOMImplementation;
+class CGfx2dGc;
+
+class CSvgEventHandler;
+class MSvgEventReceiver;
+class CSvgErrorImpl;
+class CSvgAElementImpl;
+class CSvgTextAreaElementImpl;
+class CSvgTextElementImpl;
+
+class CSvgExternalDataHandler;
+class MSvgDataRequester;
+
+// temporary for debugging
+class CSvgTimer;
+// temporary for debugging
+
+//This includes the main rendering loop.
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgEngineImpl : public CBase, public MSVGImageLoadingObserver
+ {
+ public: // Constructor & Destructor
+
+ static CSvgEngineImpl* NewL(CSvgBitmapFontProvider *aSvgBitmapFontProvider);
+
+ static CSvgEngineImpl* NewLC(CSvgBitmapFontProvider *aSvgBitmapFontProvider);
+
+ void ConstructL(CSvgBitmapFontProvider *aSvgBitmapFontProvider);
+
+ /**
+ * Two phase constructor
+ *
+ * @since 1.0
+ * @param aFrameBuffer - Pointer to a buffer where the SVG document raster is drawn
+ * @param aReqObserver - Pointer to a client side object that implements the MSvgRequestObserver interface
+ * @return An instance of the SVG Engine
+ */
+ static CSvgEngineImpl* NewL( CFbsBitmap* aFrameBuffer,
+ MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec, CSvgBitmapFontProvider *aSvgBitmapFontProvider );
+
+ /**
+ * Two phase constructor
+ *
+ * @since 1.0
+ * @param aFrameBuffer - Pointer to a buffer where the SVG document raster is drawn
+ * @param aReqObserver - Pointer to a client side object that implements the MSvgRequestObserver interface
+ * @return An instance of the SVG Engine
+ */
+ static CSvgEngineImpl* NewLC( CFbsBitmap* aFrameBuffer,
+ MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec, CSvgBitmapFontProvider *aSvgBitmapFontProvider );
+
+ /**
+ * Destructor
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+
+ virtual ~CSvgEngineImpl();
+
+ static CSvgEngineImpl* NewL( CFbsBitmap* aFrameBuffer,
+ MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec, CSvgBitmapFontProvider *aSvgBitmapFontProvider,SVGRendererId aRendererType );
+ static CSvgEngineImpl* NewLC( CFbsBitmap* aFrameBuffer,
+ MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec, CSvgBitmapFontProvider *aSvgBitmapFontProvider,SVGRendererId aRendererType );
+ public: // New Functions
+ /**
+ * Get the NVG-TLV data
+ *
+ * @since 1.0
+ * @return descriptor pointing to the encoded data.
+ */
+ const TPtrC8 TLVEncodedData() const;
+
+ /**
+ * Kick off the process of rasterizing the SVG document elements
+ *
+ * @since 1.0
+ * @param aRootElement - Root element of the SVG document
+ * @return None
+ */
+ void DrawElementsL( CSvgElementImpl* aRootElement);
+ /**
+ * Kick off the process of placing graphical objects in their positions for rasterization
+ *
+ * @since 1.0
+ * @param aRootElement - Root element of the SVG document
+ * @return None
+ */
+ void UpdateCTM(CSvgDocumentImpl* aSvgDocument );
+
+
+ /**
+ * Invalidate the current raster and hence kick off another round of rasterization
+ * process
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ void RedrawL();
+
+
+ /**
+ * Destroy the current representation of the SVG document
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ void Destroy();
+
+ /**
+ * An acessor to the document object that represents the current SVG source
+ *
+ * @since 1.0
+ * @param None
+ * @return Pointer to the document object instance.
+ */
+ CSvgDocumentImpl* Document();
+
+ /**
+ * Overwrite the current path information in the given element
+ *
+ *
+ * @param hPath - handle to a path
+ * @param hElement - handle to a path element
+ * @return none
+ */
+ void UpdatePath( CGfxGeneralPath* hPath, CSvgElementImpl* hElement );
+
+ /**
+ * Kick off the processing of SVG source, and animation time frames
+ *
+ * @since 1.0
+ * @param None
+ * @return A boolean value that indicates success/failure
+ */
+
+ TBool StartFrameLoopL();
+
+ /**
+ * Obtain an image source embedded within a SVG source (JPEG, PNG)
+ *
+ * @since 1.0
+ * @param aUri - A string buffer with the URI of the image source
+ * @param aFileName - A string buffer with the contents of the image source
+ * @return ETrue - Success, EFalse - Failure
+ *
+ */
+ TBool FetchImage( const TDesC& aUri, RFs& aSession, RFile& aFileHandle );
+
+ /**
+ * Return the animation duration for the given document, if NULL (default)
+ * then use the document attached to engine. The value 0xFFFFFFFF is
+ * return is the animation is indefinite.
+ *
+ * @since 1.0
+ * @param aDocumentElement - document to find animation duration.
+ * @return An integer containing the aniamtion duration value
+ */
+ TUint32 Duration( CSvgDocumentImpl* aDocumentElement = NULL );
+
+ /**
+ * Accessor for the Graphics Context object
+ *
+ * @since 1.0
+ * @param None
+ * @return A pointer to the Graphics Context object
+ */
+ CGfx2dGc* GraphicsContext();
+
+ /**
+ * Internally render SVG source into a buffer (rasterization)
+ *
+ * @since 1.0
+ * @param aSvgData - A string buffer containing the SVG source
+ * @param aFrameBuffer - A bitmap passed by the client that will contain the raster
+ * @param aPreserveAspectRatio - The aspect ratio (see SVG spec for more) for the raster
+ * @return TBool - ETrue/EFalse indicate presence/absence of the resource
+ */
+ TInt RenderFileToBuffer( const TDesC8& aSvgData,
+ CFbsBitmap* aFrameBuffer,
+ CFbsBitmap* aMask,
+ TBool aPreserveAspectRatio );
+
+
+ void RenderFileL( const TDesC8& aSvgData,
+ CFbsBitmap* aFrameBuffer,
+ CFbsBitmap* aMask,
+ TBool aPreserveAspectRatio);
+
+
+ /**
+ * A private method that toggles debug info for developers
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ void SwitchDebugInfo(TBool debug);
+
+ /**
+ * A private method that switch between OpenVG and VGR implementation
+ *
+ * @since 1.0
+ * @param TBool aCustomOption ETrue set OpenVG
+ * @return None
+ */
+ void CustomOption( TBool aCustomOption );
+
+ /**
+ * This method is for future extension, in which an external script engine
+ * could be used to evaluate a script description.
+ *
+ * @since 1.0
+ * @param : aScript -- A description of script from the "on" attribute.
+ *
+ * @param : aCallerElement -- The element that calls the script by a
+ * an event of the "on" attribute.
+ * @return : For future use. Value is ignored.
+ */
+ TBool ScriptCall( const TDesC& aScript,
+ CSvgElementImpl* aCallerElement );
+
+ /**
+ * Set the URI information in the Engine
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void LinkRequest( const TDesC& aUri );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void LinkRequestWithShow(const TDesC& aUri, const TDesC& aLinkShow);
+
+ /**
+ * Accessor for the current engine time
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that represents the current engine time
+ */
+ TInt32 CurrentTIme();
+
+ /**
+ * Set SVG Dimensions to Frame buffer size
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that represents the current engine time
+ */
+
+ void SetSvgDimensionToFrameBufferL(TUint aWidth, TUint aHeight);
+
+ /**
+ * Generate mask bitmap from alpha channel of the framebuffer
+ *
+ * @since
+ * @param
+ * @return
+ */
+ void GenerateMask( CFbsBitmap* aMask );
+
+ /**
+ * Set background color
+ *
+ * @since
+ * @param
+ * @return
+ */
+ void SetBackgroundColor(TUint32 aRGBA8888Color);
+
+ /**
+ * Returns SVG Engine State
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that represents SVG Engine state
+ */
+ TSvgEngineState SVGEngineState();
+
+ /**
+ * Sets SVG Engine state
+ *
+ * @since 1.0
+ * @param An integer that represents SVG Engine state
+ * @return void
+ */
+ void SetSVGEngineState(TSvgEngineState aState);
+
+ /**
+ * Sets the GDI context from the Bitmap.
+ *
+ * @since 1.0
+ * @param : aFrameBuffer -- Bitmap to draw svg content.
+ * @param : aReqObserver -- Request observer called by svg engine.
+ * @return
+ */
+ void SetGdiContextL(CFbsBitmap* aCurrentBitmap, CFbsBitmap* aMask = NULL);
+
+ void SetGdiContextL(CFbsBitmap* aCurrentBitmap, CFbsBitmap* aMask,TSize aCurrentBitmapSize,TDisplayMode aRenderDspMode,TDisplayMode aMaskDspMode);
+ /**
+ * Start the Engine so that the first frame is drawn when the call is finished.
+ *
+ *
+ * @param : aError
+ * @return: None
+ */
+ void StartEngine(CSvgErrorImpl* aError = NULL);
+ void RenderFrame( TUint aCurrentTime );
+
+ /**
+ * Set the Document
+ *
+ *
+ * @param : CSvgDocumentImpl* aDocument
+ * @return: None
+ */
+ void SetDocument(CSvgDocumentImpl* aDocument);
+
+ /**
+ * Given a document handle and a url this call attaches
+ * the given data (ldata) to every element that references that url
+ *@param aDocument - Document Pointer
+ *@param lUrl- uri string that is an external resource to be retrieved
+ *@param ldata - byte array containing the data that that external resource recieved
+ *@return none
+ */
+
+ void ChangeDuration( TUint32 aTimerDuration );
+
+ void Resume(TInt32 aTime);
+
+ void SeekEngine( TUint32 aTime);
+
+ void SetMediaTime(TUint32 aTimeInMilliSeconds);
+
+ /**
+ * Initializes the SVG Engine primarily with width and height informtion
+ * This is based on the attribute specifications for the root 'svg' element
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ void InitializeEngineL();
+
+ /**
+ * Get all the bounding-boxes for the given text and the contexts include
+ * the text was found. The bounding-boxes are transformed, taking zooming/panning
+ * in account.
+ *
+ * @param : aString -- String to search in the document.
+ * @param : aBoundingBoxes -- Array to hold bounding-boxes info.
+ * @param : aTexts -- Array to hold complete text of cdata where aString was found.
+ * @return: None
+ */
+ /*
+ void FindBBoxesForHorizontalText( const TDesC& aString,
+ RArray<TRect>& aBoundingBoxes,
+ RArray<TPtrC>& aTexts,
+ RArray<TInt>& aElementIds,
+ TBool aCaseSensitive );
+ */
+ /**
+ * Get all the bounding-boxes for the given text and the contexts include
+ * the text was found. The bounding-boxes are transformed, taking zooming/panning
+ * in account.
+ *
+ * @param : aString -- String to search in the document.
+ * @param : aBoundingBoxes -- Array to hold bounding-boxes info.
+ * @param : aTexts -- Array to hold complete text of cdata where aString was found.
+ * @return: None
+ */
+ void FindBBoxesForRotatedText( const TDesC& aString,
+ RPointerArray<MRect>& aBoundingBoxes,
+ RArray<TPtrC>& aTexts,
+ RArray<TInt>& aElementIds,
+ TBool aCaseSensitive );
+
+ /**
+ * Process the given coordinate to determine if it is inside/outside a
+ * hyperlink; then, notify the hyperlink listeners.
+ *
+ * @param : aX -- x coordinate
+ * @param : aY -- y coordinate
+ * @return: None
+ */
+ void CheckForHyperlinkMouseover( TInt aX, TInt aY );
+
+ /**
+ * Add a hyperlink listener.
+ *
+ * @param : aListener -- hyperlink listener
+ * @param : aY -- y coordinate
+ * @return: None
+ */
+ void AddHyperlinkListener( MSvgHyperlinkListener* aListener );
+
+ /**
+ * Add a textbox listener.
+ *
+ * @param : aListener -- textbox listener
+ * @return: None
+ */
+ void AddTextAreaListener( MSvgTextAreaListener* aListener );
+
+ /**
+ * Remove a textbox listener.
+ *
+ * @param : aListener -- textbox listener
+ * @return: None
+ */
+ void RemoveTextAreaListener( MSvgTextAreaListener* aListener );
+
+ void NotifyTextAreaEntered( CSvgTextAreaElementImpl* aTextAreaElement );
+
+ void NotifyTextAreaExited( CSvgTextAreaElementImpl* aTextAreaElement );
+
+ void AddTextListener( MSvgTextListener* aListener );
+
+ void RemoveTextListener( MSvgTextListener* aListener );
+
+ void NotifyTextEntered( CSvgTextElementImpl* aTextElement );
+
+ void NotifyTextExited( CSvgTextElementImpl* aTextElement );
+
+ /**
+ * Add an interactive element listener.
+ * @since v3.2
+ * @param : aListener - interactive element listener
+ * @return: None
+ */
+ void AddInteractiveElementListener( MSvgInteractiveElementListener* aListener );
+
+ /**
+ * Notify the client when the pointer enters an interactive element.
+ * @since v3.2
+ * @param : aElement - The element which has some animation
+ * @return: None
+ */
+ void NotifyInteractiveElementEntered(CSvgElementImpl* aElement);
+
+ /**
+ * Notify the client when the pointer exists an interactive element.
+ * @since v3.2
+ * @param : aElement - The element which has some animation
+ * @return: None
+ */
+ void NotifyInteractiveElementExited(CSvgElementImpl* aElement);
+
+ /**
+ * Remove an interactive element listener.
+ * @since v3.2
+ * @param : aListener - interactive element listener
+ * @return: None
+ */
+ void RemoveInteractiveElementListener( MSvgInteractiveElementListener* aListener );
+
+ /**
+ * Add a hyperlink listener.
+ *
+ * @param : aListener -- hyperlink listener
+ * @param : aY -- y coordinate
+ * @return: None
+ */
+ void RemoveHyperlinkListener( MSvgHyperlinkListener* aListener );
+
+ void NotifyElementActivatedLinkEntered( CSvgElementImpl* aElement);
+
+ void NotifyElementActivatedLinkExited( CSvgElementImpl* aElement);
+ /**
+ * Add a hyperlink listener.
+ *
+ * @param : aListener -- hyperlink listener
+ * @param : aY -- y coordinate
+ * @return: None
+ */
+ void AddAnimationListener( MSvgAnimationListener* aListener );
+
+ /**
+ * Add a hyperlink listener.
+ *
+ * @param : aListener -- hyperlink listener
+ * @param : aY -- y coordinate
+ * @return: None
+ */
+ void RemoveAnimationListener( MSvgAnimationListener* aListener );
+
+ void NotifyAnimationStarted();
+
+ void NotifyAnimationPaused();
+
+ void NotifyAnimationEnded();
+
+ //ViewPort Listener
+ void GetViewPort(TInt getWidth, TInt getHeight, TBool isWidthInPer, TBool isHeightInPer, TInt &setWidth, TInt &setHeight);
+
+ // Return ETrue if the given element (id) is visible on the frame buffer.
+ TBool IsElementVisible( TInt aElementId );
+
+ /**
+ * Get Size
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ TSize GetSize();
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void UpdatePresentation(const TInt32& aParam);
+
+ /**
+ * Return the data pointed to by the given URI string,
+ * from an external source. Calling client takes ownership
+ * of returned HBufC8 pointer.
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ HBufC8* FetchExternalDataL( const TDesC& aUri );
+
+
+ void AddViewPortListener(MSvgViewPortListener* aListener);
+
+ void RemoveViewPortListener(MSvgViewPortListener* aListener);
+
+ /**
+ * This method sets the volume with user input as a percentage
+ * value (unsigned between 0 and 100 ) for the currently loaded
+ * document
+ *
+ * @since S60 3.1
+ * @param aPercentage percentage value of volume
+ * @return none
+ */
+ void SetAudioVolume( TInt aPercentage );
+ TBool IsSVGEnginePaused();
+
+ void SetBitmapHeader(const TDesC* aHeaderData);
+ public: // Functions from base classes
+ // From CSvgElementImpl
+ /**
+ * Process various events received by the client for the SVG image
+ *
+ * @since 1.0
+ * @param aSvgDocument Pointer to the SVG Document on which event is
+ * to be processed.
+ * @param aEvent - Pointer to the object that contains SVG event information (implements MSvgEvent interface)
+ * @return None
+ */
+ void ProcessEventL( CSvgDocumentImpl* aSvgDocument, MSvgEvent* aEvent,
+ TBool aRedraw = ETrue );
+
+ /**
+ * Returns false only when document was loaded/prepared with in thumbnail mode
+ * and the frame buffer is larger than 80x80
+ * Probably move 80x80 size to .mmp file (compiler option)
+ *
+ * @since 1.0
+ * @return EFalse if thumb nail restrictions apply to the current document.
+ */
+ TBool PassesThumbNailRestriction();
+
+ /**
+ * Obtain a font source embedded within an SVG source
+ *
+ * @since 1.0
+ * @param aUri - A string buffer with the URI of the font source
+ * @param aFileHandle
+ * @return ETrue - Success, EFalse - Failure
+ *
+ */
+ TBool FetchFont( const TDesC& aUri, RFs& aSession, RFile& aFileHandle );
+
+ /**
+ * Set to ETrue to ignore notification to UpdateScreen in RequestObserver
+ *
+ * @param : aBool -- flag to indicate ignore UpdateScreen call
+ * @return: None
+ */
+ void SetIgnoreUpdateScreen( TBool aBool );
+
+ /**
+ * Add a MSvgMouseListener to this SvgEngine
+ *
+ * @param : aListener -- listener to add to listener list
+ * @return: None
+ */
+ void AddMouseListener( const MSvgMouseListener* aListener );
+
+ /**
+ * Remove a MSvgMouseListener to this SvgEngine
+ *
+ * @param : aListener -- listener to remove from listener list
+ * @return: None
+ */
+ void RemoveMouseListener( const MSvgMouseListener* aListener );
+
+ /**
+ * Return number of mouselisteners.
+ *
+ * @return: mouse-listener count
+ */
+ TInt MouseListenerCount();
+
+ /**
+ * Return the (first) viewable element at the given point.
+ * visible svg element.
+ *
+ * @param : aElements -- list to contain viewable elements with bounding-boxes containing
+ * the given point.
+ * @param : aX -- x coordinate
+ * @param : aY -- y coordinate
+ * @return: NULL, if none, lowest-level element containing point.
+ */
+ void GetViewableElementsAtPoint(CSvgDocumentImpl* aSvgDocument, RPointerArray<CSvgElementImpl>& aElements, TInt aX, TInt aY );
+
+ /**
+ * Find all elements in the subtree for "viewable" elements, including the given
+ * starting node element. Viewable element are concrete elements that are drawn,
+ * such as <rect>, <circle>, <path>, etc.
+ * This function only checks for containing of the elements' bounding-boxes.
+ *
+ * @param : aStartElement -- starting node to search in subtree.
+ * @param : aElementList -- List to containing "viewable" elements.
+ * @return: None
+ */
+ void FindAllViewableElements( CSvgElementImpl* aStartElement, RPointerArray<CSvgElementImpl>& iElementList );
+
+ /**
+ * Find all elements in the subtree for non-viewable elements, including the given
+ * starting node element. Viewable element are abstract elements that are not drawn,
+ * such as <g>, <animate>, <animateMotion>, etc.
+ *
+ * @param : aStartElement -- starting node to search in subtree.
+ * @param : aElementList -- List to containing non-viewable elements.
+ * @return: None
+ */
+ void FindAllNonViewableElements( CSvgElementImpl* aStartElement, RPointerArray<CSvgElementImpl>& iElementList );
+
+ /**
+ * Send to mouse listeners of a mouse-pressed event.
+ *
+ * @param : aElements -- elements affected by mouse-event.
+ * @param : aX -- X-cooordinate of mouse-event.
+ * @param : aY -- X-cooordinate of mouse-event.
+ * @return: None
+ */
+ void NotifyMousePressed( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Send to mouse listeners of a mouse-released event.
+ *
+ * @param : aElements -- elements affected by mouse-event.
+ * @param : aX -- X-cooordinate of mouse-event.
+ * @param : aY -- X-cooordinate of mouse-event.
+ * @return: None
+ */
+ void NotifyMouseReleased( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Send to mouse listeners of a mouse-entered event.
+ *
+ * @param : aElements -- elements affected by mouse-event.
+ * @param : aX -- X-cooordinate of mouse-event.
+ * @param : aY -- X-cooordinate of mouse-event.
+ * @return: None
+ */
+ void NotifyMouseEntered( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+ /**
+ * Send to mouse listeners of a mouse-exited event.
+ *
+ * @param : aElements -- elements affected by mouse-event.
+ * @param : aX -- X-cooordinate of mouse-event.
+ * @param : aY -- X-cooordinate of mouse-event.
+ * @return: None
+ */
+ void NotifyMouseExited( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Send to mouse listeners of a mouse-moved event.
+ *
+ * @param : aElements -- elements affected by mouse-event.
+ * @param : aX -- X-cooordinate of mouse-event.
+ * @param : aY -- X-cooordinate of mouse-event.
+ * @return: None
+ */
+ void NotifyMouseMoved( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ void NotifyHyperlinkEntered( CSvgAElementImpl* aAElementHandle );
+ void NotifyHyperlinkEntered( const TDesC& aUri );
+
+ void NotifyHyperlinkExited( CSvgAElementImpl* aAElementHandle );
+ void NotifyHyperlinkExited( const TDesC& aUri );
+
+ void NotifyHyperlinkActivated( CSvgAElementImpl* aAElementHandle );
+ void NotifyHyperlinkActivated( const TDesC& aUri );
+
+ void NotifyHyperlinkActivatedWithShow( const TDesC& aUri, const TDesC& aShow );
+
+ void NotifyTextAreaActivated( CSvgTextAreaElementImpl* aTextArea);
+
+ void NotifyTextActivated( CSvgTextElementImpl* aTextElement);
+
+
+ /**
+ * Returns whether engine is ready to render
+ * Used by SvgTimer
+ */
+ TBool ReadyToRender();
+
+ /**
+ * Reset animation timer to the beginning.
+ */
+ void ResetTimer();
+
+ /**
+ *Save Svg File After doing the text editing
+ */
+ void SaveSvgL( const TDesC& aFileName );
+
+ /*
+ *Write the buffer to the stream - saving the file -svg -text editing
+ */
+ TInt WriteToStream(RFileWriteStream &aStream,TPtrC aWriteBuffer);
+
+ /*
+ *Function to process the <text> tag and do the needful
+ */
+
+ HBufC* TextTagProcessingL(TPtrC* aCData, TInt &aStartOffset, TInt aOrgLength,
+ TBool aEndingWithTag);
+
+ /*
+ *Function to process the <textArea> tag and do the needful
+ */
+ HBufC* TextAreaTagProcessingL(TPtrC* aCData, TInt &aStartOffset, TInt aOrgLength,
+ TBool aEndingWithTag);
+
+ void ImageLoadingCompleted( TInt /*aErrorStatus*/ );
+ /*
+ * Function used to set the Rendering Quality
+ */
+
+ void SetRenderingQuality( const TInt32 aRenderQuality);
+ void CSvgEngineImpl::ResetContext();
+
+ private:
+
+ /**
+ * Private constructor
+ *
+ * @since 1.0
+ * @return
+ */
+ CSvgEngineImpl();
+
+ /**
+ * Private constructor
+ *
+ * @since 1.0
+ * @param aFrameBuffer - Pointer to a buffer where the SVG document raster is drawn
+ * @param aReqObserver - Pointer to a client side object that implements the MSvgRequestObserver interface
+ * @return
+ */
+ CSvgEngineImpl( CFbsBitmap* aFrameBuffer,
+ MSvgRequestObserver* aReqObserver );
+
+ /**
+ * A private constructor that constructs heap objects
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ void ConstructL(TFontSpec& aFontSpec, CSvgBitmapFontProvider *aSvgBitmapFontProvider );
+
+ void ConstructL(TFontSpec& aFontSpec, CSvgBitmapFontProvider *aSvgBitmapFontProvider,SVGRendererId aRendererType );
+ //
+ void InitializeEventReceiverListL(CSvgElementImpl *aElement);
+
+ /**
+ * Initiate the process of opening embedded links in the SVG source
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ void DoHyperLinkingL();
+
+ /**
+ * FInd out whether a given element is animation type
+ *
+ * @since 1.0
+ * @param aElement - A pointer to an element
+ * @return Boolean returning a True/False
+ */
+ TBool IsAnimationElement( CSvgElementImpl* aElement );
+
+ /**
+ * A complex method that does color calculations for anti aliasing
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ void FilteredBlitXRGB4444() const;
+
+ /**
+ * A complex method that does color calculations for anti aliasing
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void FilteredBlitRGB565() const;
+
+
+
+ // opacity set routines
+ CFbsBitmap* CreateOpacityFrameBufferL();
+ void CopyBuffer( TUint32* aSrc, TUint32* aDest, const TSize aSize );
+
+
+ void FindEditableElements( CSvgElementImpl* aStartElement,
+ RPointerArray<CSvgElementImpl>& aList );
+ //for SaveSvgL
+ TBool IsEndedWithCompleteTextTag(TDes &bufferptr,TInt EndOffset);
+
+ public:
+ CSvgElementImpl* iTextAreaHandle;
+
+ RPointerArray<TSvgFourPointRect> iSvgTextBoundingBoxes;
+
+ CSvgTimer* iTimer;
+ MSvgRequestObserver* iRequestObserver;
+
+ CFbsBitmap* iFrameBuffer;
+ CFbsBitmap* iMask;
+
+ TSize iFrameBufferSize; //NGA
+ TDisplayMode iRenderDspMode;
+ TDisplayMode iMaskDspMode;
+ TFontSpec iBitmapFontSpec;
+ CSvgFontHashMap* iFontHashMap;
+private:
+
+ CSvgDocumentImpl* iSvgDocument;
+ CGfx2dGc* iGfxContext;
+ TPtrC iLinkUri;
+ TUint32 iBackgroundColor;
+ TPtrC iLinkShow;
+ TBool iShowDebugInfo;
+
+ TGfxRectangle2D iClipRect;
+ TSvgEngineState iSvgEngineState;
+ TAnimStatus iAnimationState;
+ TBufC<1> NullString;
+ CSvgErrorImpl* iSvgError;
+ // Pointer/Hyperlink related
+ RPointerArray<MSvgHyperlinkListener> iHyperlinkListeners;
+ RPointerArray<MSvgTextAreaListener> iTextAreaListeners;
+ RPointerArray<MSvgTextListener> iTextListeners;
+ CSvgElementImpl* iMouseoverElement;
+ //Animation related
+ RPointerArray<MSvgAnimationListener> iAnimationListeners;
+
+ //ViewPort
+ MSvgViewPortListener* iViewPortListener;
+ // MSvgMouseListener list
+ RPointerArray<MSvgMouseListener> iSvgMouseListeners;
+
+ //MSvgInteractiveElementListener list
+ RPointerArray<MSvgInteractiveElementListener> iInteractiveElementListeners;
+
+ // flag to prevent calling updatescreen (when ETrue)
+ TBool iIgnoreUpdateScreen;
+
+ TUint iTimeoutSeconds;
+ TInt iRenderQuality; // Rendering Quality
+
+ //Stores Font Type information as passed by CSvgEngineInterfaceImpl
+ CSvgBitmapFontProvider *iSvgBitmapFontProvider;
+ public:
+ TBool iCustomOption;
+ TBool iFrameBufferOverridesViewport;
+ TBool iClientDefinedViewPort;
+ CDesC16ArrayFlat* iSvgNames;
+ };
+
+#endif //__INC_CSVGENGINEIMPL__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/inc/SVGEvent.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,681 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine header file
+ *
+*/
+
+
+#ifndef __INC_SVGEVENT_H__
+#define __INC_SVGEVENT_H__
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include "GfxFloatFixPt.h"
+
+
+
+
+//*******************************************************
+// constants
+const TUint8 KSvgEventMaskNone = 0x0;
+const TUint8 KSvgEventMaskExternalUI = 0x1;
+const TUint8 KSvgEventMaskTimer = 0x2;
+const TUint8 KSvgEventMaskInternal = 0x4;
+const TUint8 KSvgEventMaskExternalSystem = 0x8;
+
+enum TSvgEngineEventType
+ {
+ ESvgEngineEventTimerPrep,
+ ESvgEngineEventTimer,
+ ESvgEngineInternalEvent,
+
+ ESvgEngineEventMouseDown,
+ ESvgEngineEventMouseUp,
+ ESvgEngineEventMouseMove,
+ ESvgEngineEventKeyPress,
+ ESvgEngineEventScreenUpdate
+ };
+
+enum TSvgEvent
+ {
+ // 26 events defined in SVG spec
+ ESvgEventFocusin = 0,
+ ESvgEventFocusout = 1,
+ ESvgEventActivate = 2,
+ ESvgEventClick = 3,
+ ESvgEventMousedown = 4,
+ ESvgEventMouseup = 5,
+ ESvgEventMouseover = 6,
+ ESvgEventMousemove = 7,
+ ESvgEventMouseout = 8,
+ ESvgEventDOMSubtreeModified = 9,
+ ESvgEventDOMNodeInserted = 10,
+ ESvgEventDOMNodeRemoved = 11,
+ ESvgEventDOMNodeRemovedFromDocument = 12,
+ ESvgEventDOMNodeInsertedIntoDocument = 13,
+ ESvgEventDOMAttrModified = 14,
+ ESvgEventDOMCharacterDataModified = 15,
+ ESvgEventSVGLoad = 16,
+ ESvgEventSVGUnload = 17,
+ ESvgEventSVGAbort = 18,
+ ESvgEventSVGError = 19,
+ ESvgEventSVGResize = 20,
+ ESvgEventSVGScroll = 21,
+ ESvgEventSVGZoom = 22,
+ ESvgEventBeginEvent = 23,
+ ESvgEventEndEvent = 24,
+ ESvgEventRepeatEvent = 25,
+
+ // Extension for implementation
+ ESvgEventKey = 100,
+ ESvgEventWallClock = 101,
+ ESvgEventNone = -1
+ };
+
+class CSvgElementImpl;
+
+class MSvgEvent
+ {
+ public:
+ /**
+ * Accessor that returns the event mask
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the event mask
+ */
+ virtual TUint8 EventMask() = 0;
+
+ /**
+ * Accessor for the event type
+ *
+ * @since 1.0
+ * @param None
+ * @return A TSvgEngineEventType that is the event type
+ */
+ virtual TSvgEngineEventType EventType() = 0;
+ };
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class MSvgTimerEvent : public MSvgEvent
+ {
+ public:
+
+ /**
+ * Accessor that returns the time of the event
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the time of the event
+ */
+ virtual TUint32 Time() = 0;
+
+ /**
+ * Accessor that returns the begin time of the event
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the begin time of the event
+ */
+ virtual TInt32 BeginTime() = 0;
+
+ /**
+ * Accessor that sets time of the event
+ *
+ * @since 1.0
+ * @param TInt32 An integer that is the begin time of the event
+ * @return none
+ */
+ virtual void SetTime(TInt32 aTime) = 0;
+
+ /**
+ * Accessor that sets the begin time of the event
+ *
+ * @since 1.0
+ * @param aTime - An integer that is the begin time
+ * @return None
+ */
+ virtual void SetBeginTime( TInt32 aTime ) = 0;
+
+ };
+
+// An internal event specialization
+class MSvgInternalEvent : public MSvgEvent
+ {
+ public:
+
+virtual TBool UserSeek() = 0;
+ /**
+ * Return a pointer the element that is the target for the event
+ *
+ * @since 1.0
+ * @param None
+ * @return A pointer to the target element
+ */
+ virtual CSvgElementImpl* ObjectAddress() = 0;
+
+ /**
+ * Return the event description
+ *
+ * @since 1.0
+ * @param None
+ * @return A TSvgEvent type
+ */
+ virtual TSvgEvent SvgEvent() = 0;
+
+ /**
+ * Accessor that returns the time of the event
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the time of the event
+ */
+ virtual TInt32 Time() = 0;
+
+ /**
+ * Accessor that sets the time of the event
+ *
+ * @since 1.0
+ * @param aTime - An integer that is the time of the event
+ * @return
+ */
+ virtual void SetTime( TInt32 aTime ) = 0;
+
+ /**
+ * Accessor that returns the begin time of the event
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the begin time of the event
+ */
+ virtual TInt32 BeginTime() = 0;
+
+ /**
+ * Accessor that sets the begin time of the event
+ *
+ * @since 1.0
+ * @param aTime - An integer that is the begin time
+ * @return None
+ */
+ virtual void SetBeginTime( TInt32 aTime ) = 0;
+
+ };
+
+// A UI Mouse event specialization
+class MSvgUiMouseEvent : public MSvgEvent
+ {
+ public:
+
+ /**
+ * Accessor for the x coordinate of the mouse event
+ *
+ * @since 1.0
+ * @param None
+ * @return A fixed point that is the x coordinate of the event
+ */
+ virtual TFloatFixPt X() = 0;
+
+ /**
+ * Accessor for the y coordinate of the mouse event
+ *
+ * @since 1.0
+ * @param None
+ * @return A fixed point that is the y coordinate of the event
+ */
+ virtual TFloatFixPt Y() = 0;
+ };
+
+// A UI Key event specialization
+class MSvgUiKeyEvent : public MSvgEvent
+ {
+ public:
+
+ /**
+ * Accessor that returns the key code of the event
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TUint32 KeyCode() = 0;
+
+ /**
+ * Accessor that returns the time of the event
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the time of the event
+ */
+ virtual TInt32 Time() = 0;
+
+ /**
+ * Accessor that sets the time of the event
+ *
+ * @since 1.0
+ * @param aTime - An integer that is the time of the event
+ * @return
+ */
+ virtual void SetTime( TInt32 aTime ) = 0;
+
+ /**
+ * Accessor that returns the begin time of the event
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the begin time of the event
+ */
+ virtual TInt32 BeginTime() = 0;
+
+ /**
+ * Accessor that sets the begin time of the event
+ *
+ * @since 1.0
+ * @param aTime - An integer that is the begin time
+ * @return None
+ */
+ virtual void SetBeginTime( TInt32 aTime ) = 0;
+
+ };
+
+
+//*******************************************************
+
+class TSvgUiMouseEvent : public MSvgUiMouseEvent
+ {
+ public:
+
+ /**
+ * Constructor
+ *
+ * @since 1.0
+ * @param aEtype - A TSvgEngineEventType representing the event type
+ * @param aX - x coordinate of the event
+ * @param aY - y coordinate of the event
+ * @return
+ */
+ TSvgUiMouseEvent( TSvgEngineEventType aEtype, TFloatFixPt aX, TFloatFixPt aY );
+
+ /**
+ * Accessor that returns the event mask
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the event mask
+ */
+ TUint8 EventMask();
+
+ /**
+ * Accessor for the event type
+ *
+ * @since 1.0
+ * @param None
+ * @return A TSvgEngineEventType that is the event type
+ */
+ TSvgEngineEventType EventType();
+
+ /**
+ * Accessor for the x coordinate of the mouse event
+ *
+ * @since 1.0
+ * @param None
+ * @return A fixed point that is the x coordinate of he event
+ */
+ TFloatFixPt X();
+
+ /**
+ * Accessor for the y coordinate of the mouse event
+ *
+ * @since 1.0
+ * @param None
+ * @return A fixed point that is the y coordinate of the event
+ */
+ TFloatFixPt Y();
+
+ public:
+ TSvgEngineEventType iEtype;
+ TFloatFixPt iX;
+ TFloatFixPt iY;
+ };
+
+class TSvgUiKeyEvent : public MSvgUiKeyEvent
+ {
+ public:
+
+ /**
+ * Accessor that returns the key code of the event
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TSvgUiKeyEvent( TUint32 aKeyCode );
+
+ /**
+ * Accessor that returns the event mask
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the event mask
+ */
+ TUint8 EventMask();
+
+ /**
+ * Accessor for the event type
+ *
+ * @since 1.0
+ * @param None
+ * @return A TSvgEngineEventType that is the event type
+ */
+ TSvgEngineEventType EventType();
+
+ /**
+ * Accessor that returns the key code of the event
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TUint32 KeyCode();
+
+ /**
+ * Accessor that returns the time of the event
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the time of the event
+ */
+ TInt32 Time();
+
+ /**
+ * Accessor that sets the time of the event
+ *
+ * @since 1.0
+ * @param aTime - An integer that is the time of the event
+ * @return None
+ */
+ void SetTime( TInt32 aTime );
+
+ /**
+ * Accessor that returns the begin time of the event
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the begin time of the event
+ */
+ TInt32 BeginTime();
+
+ /**
+ * Accessor that sets the begin time of the event
+ *
+ * @since 1.0
+ * @param aTime - An integer that is the begin time
+ * @return None
+ */
+ void SetBeginTime( TInt32 aTime );
+
+ private:
+ TUint32 iKeyCode;
+ TInt32 iTime;
+ TInt32 iBeginTime;
+ };
+
+
+//
+class TSvgTimerEventPrep : public MSvgTimerEvent
+ {
+ public:
+
+ /**
+ * Constructor
+ *
+ * @since 1.0
+ * @param aTime - An integer that is the event time
+ * @return None
+ */
+ TSvgTimerEventPrep( TUint32 aTime );
+
+ /**
+ * Accessor that returns the event mask
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the event mask
+ */
+ TUint8 EventMask();
+
+ /**
+ * Accessor for the event type
+ *
+ * @since 1.0
+ * @param None
+ * @return A TSvgEngineEventType that is the event type
+ */
+ TSvgEngineEventType EventType();
+
+ /**
+ * Accessor that returns the time of the event
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the time of the event
+ */
+ TUint32 Time();
+
+ private:
+ TInt32 iTime;
+ };
+
+class TSvgTimerEvent : public MSvgTimerEvent
+ {
+ public:
+
+ /**
+ * Constructor
+ *
+ * @since 1.0
+ * @param aTime - An integer that is the time of the event
+ * @return None
+ */
+ TSvgTimerEvent( TUint32 aTime );
+
+ /**
+ * Accessor that returns the event mask
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the event mask
+ */
+ TUint8 EventMask();
+
+ /**
+ * Accessor for the event type
+ *
+ * @since 1.0
+ * @param None
+ * @return A TSvgEngineEventType that is the event type
+ */
+ TSvgEngineEventType EventType();
+
+ /**
+ * Accessor that returns the time of the event
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the time of the event
+ */
+ TUint32 Time();
+
+ /**
+ * Accessor that sets time of the event
+ *
+ * @since 1.0
+ * @param TInt32 An integer that is the begin time of the event
+ * @return none
+ */
+ void SetTime(TInt32 aTime);
+
+
+ /**
+ * Accessor that returns the begin time of the event
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the begin time of the event
+ */
+ TInt32 BeginTime();
+
+ /**
+ * Accessor that sets the begin time of the event
+ *
+ * @since 1.0
+ * @param aTime - An integer that is the begin time
+ * @return None
+ */
+ void SetBeginTime( TInt32 aTime );
+
+ private:
+ TInt32 iTime;
+ TInt32 iBeginTime;
+ };
+
+class TSvgInternalEvent : public MSvgInternalEvent
+ {
+ public:
+
+ /**
+ * Constructor
+ *
+ * @since 1.0
+ * @param aEvent - A TSvgEvent type
+ * @param aElement - A pointer to the target element
+ * @return None
+ */
+ TSvgInternalEvent( TSvgEvent aEvent, CSvgElementImpl* aElement );
+
+ TSvgInternalEvent( TSvgEvent aEvent, CSvgElementImpl* aElement, TInt32 aTime );
+
+ TBool UserSeek();
+ /**
+ * Accessor that returns the event mask
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the event mask
+ */
+ TUint8 EventMask();
+
+ /**
+ * Accessor for the event type
+ *
+ * @since 1.0
+ * @param None
+ * @return A TSvgEngineEventType that is the event type
+ */
+ TSvgEngineEventType EventType();
+
+ /**
+ * Return a pointer the element that is the target for the event
+ *
+ * @since 1.0
+ * @param None
+ * @return A pointer to the target element
+ */
+ CSvgElementImpl* ObjectAddress();
+
+ /**
+ * Return the event description
+ *
+ * @since 1.0
+ * @param None
+ * @return A TSvgEvent type
+ */
+ TSvgEvent SvgEvent();
+
+ /**
+ * Accessor that returns the time of the event
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the time of the event
+ */
+ TInt32 Time();
+
+ /**
+ * Accessor that sets the time of the event
+ *
+ * @since 1.0
+ * @param aTime - An integer that is the time of the event
+ * @return
+ */
+ void SetTime( TInt32 aTime );
+
+ /**
+ * Accessor that returns the begin time of the event
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the begin time of the event
+ */
+ TInt32 BeginTime();
+
+ /**
+ * Accessor that sets the begin time of the event
+ *
+ * @since 1.0
+ * @param aTime - An integer that is the begin time
+ * @return None
+ */
+ void SetBeginTime( TInt32 aTime );
+
+ private:
+ TSvgEvent iEvent;
+ TBool iRepeatOnBegin;
+ CSvgElementImpl*iElement;
+ TInt32 iTime;
+ TInt32 iBeginTime;
+ TBool IsUserSeek;
+ };
+
+class TSvgScreenUpdateEvent : public MSvgEvent
+ {
+ public:
+ /**
+ * Accessor that returns the event mask
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the event mask
+ */
+ TUint8 EventMask();
+
+ /**
+ * Accessor for the event type
+ *
+ * @since 1.0
+ * @param None
+ * @return A TSvgEngineEventType that is the event type
+ */
+ TSvgEngineEventType EventType();
+ };
+
+
+#endif /* __INC_SvgEvent_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/inc/SVGEventHandler.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,262 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine header file
+ *
+*/
+
+
+#ifndef __INC_CSVGEVENTHANDLER__
+#define __INC_CSVGEVENTHANDLER__
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include "SVGEvent.h"
+
+
+
+class MSvgElement;
+class MSvgEventReceiver;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgEventHandler : public CBase
+ {
+ private:
+ class TEventReceiverListItem
+ {
+ public:
+ MSvgEventReceiver* iElement;
+ TUint32 iBeginTime;
+ TUint32 iAbsoluteEnd;
+ MSvgEventReceiver* iTargetElement;
+ TUint8 iEventMask;
+ TUint16 iSubEventMask;
+ TUint8 iWasDeleted;
+ };
+
+ public:
+
+ /**
+ * Two phase constructor
+ *
+ * @since 1.0
+ * @param None
+ * @return An instance of the CSVgEventHandler class
+ */
+ static CSvgEventHandler* NewLC();
+
+ /**
+ * Two phase constructor
+ *
+ * @since 1.0
+ * @param None
+ * @return An instance of the CSVgEventHandler class
+ */
+ static CSvgEventHandler* NewL();
+
+ /**
+ * Destructor
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ ~CSvgEventHandler();
+
+ public:
+ TInt32 Count();
+
+ TInt32 AnimationElementsCount();
+
+ void ResetTimes();
+ /**
+ * Process events received from the client
+ *
+ * @since 1.0
+ * @param aEvent - An object containing event information (implements MSvgEvent interface)
+ * @return A boolean indicating success/failure in handling the event
+ */
+ TBool ProcessEventL( MSvgEvent* aEvent );
+
+ /**
+ * Add an object to the list of objects that are notified of an event
+ *
+ * @since 1.0
+ * @param aElement - An SVG element that wants to be registered for an event (implements MSvgEventReceiver interface)
+ * @param aEventMask - A bit mask that indicates the types of events an object listens for
+ * @return None
+ */
+ void AddToEventReceiverListL( MSvgEventReceiver* aElement,
+ TUint8 aEventMask,
+ TUint32 aBeginTime = 0,
+ TUint32 aEndTime = 0);
+
+ /**
+ * Add an object to the list of objects that are notified of an event
+ *
+ * @since 3.2
+ * @param aElement - An SVG element that wants to be registered for an event (implements MSvgEventReceiver interface)
+ * @param aEvent - An SVG Event that the target element needs to generate
+ * @param aEventMask - A bit mask that indicates the types of events an object listens for
+ * @return None
+ */
+ void AddToEventReceiverListL( MSvgEventReceiver* aElement,
+ TSvgEvent aEvent,
+ TUint8 aEventMask,
+ TUint32 aBeginTime = 0,
+ TUint32 aEndTime = 0);
+
+ /**
+ * Remove an object from the list of objects that are notified of an event
+ *
+ * @since 1.0
+ * @param aElement - An SVG element that wants to be unregistered for an event (implements MSvgEventReceiver interface)
+ * @return None
+ */
+ void RemoveFromEventReceiverList( MSvgEventReceiver* aElement );
+
+ void ClearNullsFromEventReceiverList();
+
+ /**
+ * Provide the event end time information to the Event Handler
+ *
+ * @since 1.0
+ * @param aElement - An element that, ultimately, processes the event (eg. an animation element)
+ * @param aTime - The end time for an event on the target element
+ * @param aTargetElement - The element for which the event is processed
+ * @return
+ */
+ void AddEventBeginTime(MSvgEventReceiver* aElement,
+ TUint32 aTime, MSvgEventReceiver* aTargetElement );
+
+
+ /**
+ * Reset the status of the event handler and all the event receivers
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ void Reset();
+ void SetCurrentTime(TInt32 aTime);
+ void Reset(MSvgEvent* aEvent);
+
+ /**
+ * An internal method that sorts the events in a time scale
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ void SortEventList();
+
+ /**
+ * Standard active object DoCancel method
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ void DoCancel();
+
+ /**
+ * Standard avtive object RunL method
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void RunL();
+
+ /**
+ * returns the next (or prev) focussable object starting with a given index
+ * search wraps around to start or end
+ *
+ * @since 1.0
+ * @param aIndex - search for a focussable object with this index
+ * @param aNext - Etrue (next) EFalse (prev) (go forward or backward for search)
+ * @param aEventMask - Event mask for event types the client is interested in
+ * @param aNewIndex - Return the actual index where the object was found
+ * @return The focussable object or NULL if not found
+ */
+
+ MSvgEventReceiver* GetEventReceiver(TInt32 aIndex, TBool aNext, TUint8 aMask, TInt32& aNewIndex);
+
+ void ReInitialize();
+ void DeactivateAnimations();
+
+ /**
+ * EventMask: Return the event mask of the registered element
+ *
+ * @param MSvgEventReceiver the target element.
+ * @returns: TUnit8, the event mask
+ */
+ TUint8 EventMask(MSvgEventReceiver* aElement);
+
+ /**
+ * Checks whether the element is interactive or not and if
+ * interactive updates aSubEventMask.
+ * @since v3.2
+ * @param CSvgElementImpl the element.
+ * @param aSubEventMask - contains the list of interactive events
+ * that the element can respond to.
+ * It is a bitmask using TSvgInteractionEvent
+ * @returns: ETrue if interactive otherwise EFalse.
+ */
+ TBool CheckInteractivityAndGetSubEventMask(CSvgElementImpl* aElement,
+ TUint16& aSubEventMask);
+ /**
+ * Checks whether the aSubEventMask is has a valid value set
+ * @since v3.2
+ * @param : aSubEventMask - The bitmap mask which contains the list
+ * of interactive events if any with the element.
+ * @return: Etrue - if aSubEventMask has some valid bits set else EFalse.
+ */
+ TBool IsValidSubEventMask(TUint16 aSubEventMask);
+
+ private:
+
+ /**
+ * Private constructor
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ CSvgEventHandler();
+
+ /**
+ * A private constructor that constructs heap objects
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ void ConstructL();
+
+ CArrayFixFlat<TEventReceiverListItem>* iEventReceiverList;
+ TUint8 iInProcess;
+ TInt32 iCurrentTime;
+ public:
+ void DoAnimProcL(MSvgEvent* aEvent);
+ };
+
+#endif //__INC_CSVGEventHandler__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/inc/SVGEventReceiver.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine header file
+ *
+*/
+
+
+#ifndef __INC_MSVGEVENTRECEIVER__
+#define __INC_MSVGEVENTRECEIVER__
+
+
+
+
+class MSvgEvent;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class MSvgEventReceiver
+ {
+ public:
+
+ /**
+ * Receive and process and event
+ *
+ * @since 1.0
+ * @param aEvent - A event that matches the event mask registered for
+ * @return A boolean that indicates success/failure of event processing
+ */
+ virtual TBool ReceiveEventL( MSvgEvent* aEvent ) = 0;
+
+ /**
+ * Receive and process and event
+ *
+ * @since 3.2
+ * @param aEvent - A event that matches the event mask registered for
+ * @param aSubEventMask - The mask that tells which interactive event is
+ * associated with the element.
+ * @return A boolean that indicates success/failure of event processing
+ */
+ virtual TBool ReceiveEventL( MSvgEvent* aEvent, const TUint16 aSubEventMask ) = 0;
+
+ /**
+ * Reset the state of the target element
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ virtual void ResetReferenceElementL() = 0;
+
+ virtual void ResetReferenceAttrSet() = 0;
+
+ virtual void Reset(MSvgEvent* aEvent) = 0;
+ virtual void ReInitializeAnimation() = 0;
+ virtual void DeactivateAnimation() = 0;
+ /*
+ * This function is specifically introduced to take care of AnimProcL
+ *
+ *@param None.
+ * @return TBool. representing whether the AnimProcL was sucessful or some error
+ * was encountered.
+ */
+ virtual TBool DoAnimProcL(MSvgEvent* aEvent) = 0;
+
+
+ };
+
+#endif /*__INC_MSvgEventReceiver__*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/inc/SVGFourPointRect.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine header file
+ *
+*/
+
+
+#ifndef SVGFOURPOINTRECT_H
+#define SVGFOURPOINTRECT_H
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include "SVGEngineInterfaceImpl.h"
+#include "GfxFloatFixPt.h"
+#include "GfxRectangle2D.h"
+
+/**
+ * This class implements the interface for a MRect object
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class TSvgFourPointRect: public MRect
+ {
+ public:
+
+ /**
+ * Construct a rectangle.
+ *
+ * @since 1.0
+ * @return
+ */
+ TSvgFourPointRect();
+ TSvgFourPointRect(TPoint aPoint1, TPoint aPoint2, TPoint aPoint3, TPoint aPoint4);
+ TSvgFourPointRect( TGfxRectangle2D aRect );
+ TSvgFourPointRect(TGfxPoint2D aPoint1, TGfxPoint2D aPoint2, TGfxPoint2D aPoint3, TGfxPoint2D aPoint4);
+ TSvgFourPointRect( TFloatFixPt aX, TFloatFixPt aY, TFloatFixPt aWidth, TFloatFixPt aHeight );
+
+ void SetRectPoints( TFloatFixPt aX, TFloatFixPt aY, TFloatFixPt aWidth, TFloatFixPt aHeight );
+ void SetRectPoints(TPoint aPoint1, TPoint aPoint2, TPoint aPoint3, TPoint aPoint4);
+ void SetRectPoints(TGfxPoint2D aPoint1, TGfxPoint2D aPoint2, TGfxPoint2D aPoint3, TGfxPoint2D aPoint4);
+ void SetRectPoints( TGfxRectangle2D aRect );
+
+ //IMPLEMENTED FOR MRect
+ void GetPoints(TPoint& aPoint1, TPoint& aPoint2, TPoint& aPoint3, TPoint& aPoint4) const;
+
+ void GetPoints(TGfxPoint2D& aPoint1, TGfxPoint2D& aPoint2, TGfxPoint2D& aPoint3, TGfxPoint2D& aPoint4);
+ void GetTRect(TRect& aRect);
+ void GetTRect(TGfxRectangle2D& aRect);
+
+
+ //IMPLEMENTED FOR MRect
+ /**
+ * Determine if the given rectangle intersects with this rectangle.
+ *
+ * @since 1.0
+ * @param aRect : rectangle to check for intersection.
+ * @return true, if intersection occurs.
+ */
+ TBool Intersects( const MRect& aRect );
+
+ //IMPLEMENTED FOR MRect
+ /**
+ * Determine the center point of this rectangle
+ *
+ * @since 1.0
+ * @param aCenter the center point
+ * @return
+ */
+
+ void Center(TPoint& aCenter);
+
+ /**
+ * Determine if the given point is contained within this rectangle.
+ *
+ * @since 1.0
+ * @param aRect : rectangle to check for intersection.
+ * @return true, if points is contained within rectangle
+ */
+ // IMPORT_C TBool Contains( TGfxPoint2D aPoint );
+
+ /* Return shape type */
+ // inline virtual TInt ShapeType () { return ERect; };
+
+ TGfxPoint2D iPoint1;
+ TGfxPoint2D iPoint2;
+ TGfxPoint2D iPoint3;
+ TGfxPoint2D iPoint4;
+ };
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/inc/SVGTimer.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,225 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine header file
+ *
+*/
+
+
+#ifndef __INC_CSVGTIMER__
+#define __INC_CSVGTIMER__
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "GfxFloatFixPt.h"
+
+// Maximum frame rate: 15 fps
+const TUint32 KMinFrameDelay = 33; // milliseconds
+const TUint32 KMinSleepDuration = 1; // milliseconds
+
+// Minimum sleep duration in msecs
+const TUint32 KMinSleepDurationInMsecs = 1000;
+
+class CSvgEngineImpl;
+class CSvgTimeContainer;
+
+/**
+ * A Timer class that wraps Symbian CTimer class
+ * All the essential functionality is same
+ * Adds additional capabilities such as frames, frames per second information,
+ * ability to specify/change duration etc.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgTimer : public CTimer
+ {
+ public:
+
+ /**
+ * Two phase constructor
+ *
+ * @since 1.0
+ * @param aTimeContainer - Pointer to the Time Container
+ * @return An instance of the CSvgTimer
+ */
+ static CSvgTimer* NewLC( CSvgTimeContainer*
+ aTimeContainer );
+
+ /**
+ * Two phase constructor
+ *
+ * @since 1.0
+ * @param aTimeContainer - Pointer to the Time Container
+ * @return An instance of the CSvgTimer
+ */
+ static CSvgTimer* NewL( CSvgTimeContainer*
+ aTimeContainer );
+
+ /**
+ * Destructor
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ ~CSvgTimer();
+
+ public:
+ // Defined as pure virtual by CActive;
+
+ /**
+ * Standard Active Object DoCancel
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ void DoCancel();
+
+ /**
+ * Standard Active Object RunL
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void RunL();
+
+
+ /**
+ * Reset the time
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ void ResetTime();
+
+ /**
+ * CHange the duration of the timer
+ *
+ * @since 1.0
+ * @param aTimerDuration - An integer that is the new duration
+ * @return None
+ */
+ void ChangeFrameDuration( TUint32 aTimerDuration );
+
+
+ /**
+ * Return the frames per second information
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the number of frames per second
+ */
+ TUint Fps();
+
+ /**
+ * Resume function
+ *
+ * @since 1.0
+ * @param aTime Time in msecs to resume after(Must be Positive)
+ * @return An integer that is the number of frames per second
+ */
+ void SVGResume( TInt32 aTime );
+
+ /**
+ * Pause function
+ *
+ * @since 1.0
+ * @param None
+ * @return An integer that is the number of frames per second
+ */
+ void SVGStop();
+
+ /**
+ * Set Start Time for animation
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ void SetStartTime();
+
+ /**
+ * Set the timer to forward/rewind animation
+ *
+ * @since 1.0
+ * @param aTime - in microseconds
+ * @return None
+ */
+ void SetSeekTime( TUint32 aTime );
+
+ /**
+ * Set whether each frame generated should be time-base or
+ * frame-based.
+ *
+ * @since 1.0
+ * @param aKeepStrictFrameDuration - if ETrue then
+ * every cycle of RunL will generate a frame with the elapsed
+ * time set by ChangeFrameDuration().
+ * @return None
+ */
+ void SetStrictFrameDuration( TBool aKeepStrictFrameDuration );
+
+ protected:
+
+ /**
+ * Private constructor
+ *
+ * @since 1.0
+ * @param aSvgEngine - A pointer to the SVG Engine
+ * @return None
+ */
+ CSvgTimer( CSvgTimeContainer*
+ aTimeContainer );
+ /**
+ * A private constructor that constructs heap objects
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ void ConstructL();
+
+ private:
+ static TUint32 GetElapsedMilliseconds( TTime& aStart, TTime& aEnd );
+
+ /**
+ * Request svg engine to generate frame at the given time in
+ * milliseconds
+ *
+ * @since 1.0
+ * @param aTime - milliseconds
+ * @return None
+ */
+ TUint32 GenerateFrameL( TUint32 aTime );
+
+
+ CSvgTimeContainer* iTimeContainer;
+
+ TUint32 iTime; // in millisecond
+ TUint32 iFrameDuration; // in millisecond
+ TTime iPreviousFrameTime;
+
+ TUint32 iFrames; // for debug. counting FPS
+
+ // Frame-based or time-based (default)
+ TBool iIsStrictFrameDuration;
+
+ TBool iFirstFrameDrawn;
+ };
+
+#endif //__INC_CSVGTIMER__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/inc/SvgBitmapFontProvider.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Bitmap Font Provider header file
+ *
+*/
+
+
+#ifndef SVGBITMAPFONTPROVIDER_H
+#define SVGBITMAPFONTPROVIDER_H
+
+
+#include <fbs.h>
+#include <gdi.h>
+
+/**
+ * Class description
+ */
+NONSHARABLE_CLASS( CSvgBitmapFontProvider ) : public CBase
+ {
+
+ private:
+
+ /*
+ * First Step of two phase construction for this class
+ *
+ */
+ CSvgBitmapFontProvider( const TFontSpec& aFontSpec ) ;
+
+ /*
+ * Second Step of two phase construction for this class
+ *
+ */
+ void ConstructL();
+
+
+ public:
+
+ /*
+ * Destructor
+ *
+ */
+ ~CSvgBitmapFontProvider();
+
+ /*
+ * Creates & returns object of this class
+ *
+ */
+ static CSvgBitmapFontProvider* NewL( const TFontSpec& aFontSpec );
+
+ /*
+ * Creates & returns object of this class
+ *
+ */
+ static CSvgBitmapFontProvider* NewLC( const TFontSpec& aFontSpec );
+
+ /**
+ * Releases a Font
+ *
+ * @since 1.0
+ * @param aFont - Pointer to the font of type CFont* to be released
+ */
+ void ReleaseFont(CFont* aFont);
+
+ /**
+ * Releases a Font
+ *
+ * @since 1.0
+ * @param aFont - Pointer to the font where the new font information has to be filed in
+ * @param aFontSpec - Object representing Font Specification(s)
+ */
+ TInt GetNearestFontToDesignHeightInTwips(CFont*& aFont, TFontSpec aFontSpec);
+
+
+ //Data Members
+ private:
+ CFbsTypefaceStore *iTypeFaceStore;
+ TFontSpec iFontSpec;
+ };
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/inc/Svgdecoder.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,386 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef SVGDECODER_H
+#define SVGDECODER_H
+
+#include <stdio.h>
+#include <e32std.h>
+#include <string.h>
+#include <e32base.h>
+#include <f32file.h>
+#include <s32file.h>
+
+#include "SVGPaintCssValueImpl.h"
+#include "SVGPathElementImpl.h"
+#include "GfxGeneralPath.h"
+#include "SVGSvgElementImpl.h"
+#include "SVGImageElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGErrorImpl.h"
+
+enum TGfxEncodedSegType
+ {
+ EGfxEncodedSegMoveTo,
+ EGfxEncodedSegLineTo,
+ EGfxEncodedSegQuadTo,
+ EGfxEncodedSegCubicTo,
+ EGfxEncodedSegClose
+ };
+
+
+class CSvgDecoder : public CBase
+{
+public:
+
+ /**
+ * Two phase constructor
+ *
+ * @since 1.0
+ * @param None
+ * @return An isntance of this class
+ */
+ static CSvgDecoder* NewL(const TDesC& aFileName);
+
+ /**
+ * Two phase constructor
+ *
+ * @since 1.0
+ * @param None
+ * @return An isntance of this class
+ */
+ static CSvgDecoder* NewL(const TDesC8& aByteData);
+
+ /**
+ * Reads a Descriptor's data
+ *
+ * @since 1.0
+ * @param
+ * @return the created descriptor
+ */
+ TDesC& DecodeTDesCLC();
+
+ /**
+ * Reads a Descriptor's data. Used only for image element with
+ * Embedde image.
+ * @since 1.0
+ * @param
+ * @return the created descriptor
+ */
+ TDesC& DecodeImageEmbeddedTDesCLC();
+
+ /**
+ * start of the decoder
+ *
+ * @since 1.0
+ * @param
+ * @return the root element
+ */
+ CSvgElementImpl* StartDecodingL(CSvgDocumentImpl *aDocument, CSvgErrorImpl& aError);
+
+
+ /**
+ * Read Data of a particular attribute
+ *
+ * @since 1.0
+ * @param Attribute Id
+ * @return A value that indicates success/failure
+ */
+ TInt DecodeAttributeL(const TUint16 aName);
+
+
+ /**
+ * Read Data of a presentation attribute
+ *
+ * @since 1.0
+ * @param Attribute Id
+ * @return A value that indicates success/failure
+ */
+ TBool DecodePresentationAttributeL(const TUint16 aName);
+
+ /**
+ * Read Data of a SVGT attribute
+ *
+ * @since 1.0
+ * @param Attribute Id
+ * @return A value that indicates success/failure
+ */
+ TBool DecodeSVGTAttributeL(const TUint16 aName);
+
+ /**
+ * Read Data of a SVGT attribute
+ *
+ * @since 1.0
+ * @param Attribute Id
+ * @return A value that indicates success/failure
+ */
+ TBool DecodeAnimationAttributeL(const TUint16 aName);
+
+
+ /**
+ * Read Data of a SVGT attribute
+ *
+ * @since 1.0
+ * @param Attribute Id
+ * @return A value that indicates success/failure
+ */
+ TBool DecodeSvgElementAttributeL(const TUint16 aName);
+
+ /**
+ * Read Data of a SVGT attribute
+ *
+ * @since 1.0
+ * @param Attribute Id
+ * @return A value that indicates success/failure
+ */
+ TBool DecodeLangSpaceAttributeL(const TUint16 aName);
+
+ /**
+ * Read Data of an attribute
+ *
+ * @since 1.0
+ * @param Attribute Id
+ * @return A value that indicates success/failure
+ */
+ TBool DecodeTransformAttributeL(const TUint16 aName);
+
+ /**
+ * Read Data of an attribute
+ *
+ * @since 1.0
+ * @param Attribute Id
+ * @return A value that indicates success/failure
+ */
+ TBool DecodeTestAttributeL(const TUint16 aName);
+
+ /**
+ * Read Data of an attribute
+ *
+ * @since 1.0
+ * @param Attribute Id
+ * @return A value that indicates success/failure
+ */
+ TBool DecodeIdAndXmlAttributeL(const TUint16 aName);
+
+ /**
+ * Read Data of an attribute
+ *
+ * @since 1.0
+ * @param Attribute Id
+ * @return A value that indicates success/failure
+ */
+ TBool DecodeUriRefAttributeL(const TUint16 aName);
+
+
+
+ /**
+ * Decode attributes for Discard element
+ *
+ * @since 1.2
+ * @param Attribute Id
+ * @return A value that indicates success/failure
+ */
+ TBool DecodeDiscardAttributeL (const TUint16& aName);
+
+
+ /**
+ * Read Data of an attribute
+ *
+ * @since 1.0
+ * @param Attribute Id
+ * @return A value that indicates success/failure
+ */
+
+ void SetPaintValueL (CCssValue*& aValue);
+
+ /**
+ * Read Data of an attribute
+ *
+ * @since 1.0
+ * @param Attribute Id
+ * @return A value that indicates success/failure
+ */
+ TBool DecodeColorCssValueL(const TUint16 aName);
+
+ /**
+ * Read Data of an attribute
+ *
+ * @since 1.0
+ * @param Attribute Id
+ * @return A value that indicates success/failure
+ */
+ TBool DecodeFloatCssValueL(const TUint16 aName);
+
+ /**
+ * Read Data of an attribute
+ *
+ * @since 1.0
+ * @param Attribute Id
+ * @return A value that indicates success/failure
+ */
+ TBool DecodeIntCssValueL(const TUint16 aName);
+
+ /**
+ * Read Data of an attribute
+ *
+ * @since 1.0
+ * @param Attribute Id
+ * @return A value that indicates success/failure
+ */
+ TBool DecodeStringCssValueL(const TUint16 aName);
+
+ /**
+ * Read a Des attribute value
+ *
+ * @since 1.0
+ * @param Attribute Id
+ * @return A value that indicates success/failure
+ */
+ TBool DecodeAttributeDesL(const TUint16 aName);
+
+ /**
+ * Read a path attribute value
+ *
+ * @since 1.0
+ * @param Attribute Id
+ * @return A value that indicates success/failure
+ */
+ TBool DecodeAttributePathL(const TUint16 aName);
+
+ void DecodeAnimationPathL(CGfxGeneralPath*& aPath);
+
+ /**
+ * Read a float attribute value
+ *
+ * @since 1.0
+ * @param Attribute Id
+ * @return A value that indicates success/failure
+ */
+ TBool DecodeAttributeFloatL(const TUint16 aName);
+
+ /**
+ * Read a Int attribute value
+ *
+ * @since 1.0
+ * @param Attribute Id
+ * @return A value that indicates success/failure
+ */
+ TBool DecodeAttributeIntL(const TUint16 aName);
+
+ // checks whether required attributes are present.
+ void CheckRequiredAttributesL(const TUint8 aName);
+
+
+ /**
+ * Destructor
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ ~CSvgDecoder();
+
+ void RemoveFalseSwitchCases();
+ void RemoveFalseElements();
+ TBool VerifyReqExReqFtrSysL( CSvgElementImpl* aElement );
+
+ /**
+ * Find out the system language for the client environment based on
+ * SVG source hint
+ *
+ * @since 1.0
+ * @param aValue - A string buffer that contains the System Language hint
+ * @return None
+ */
+ void SystemLanguage( TPtr aValue );
+
+private:
+
+ // Default constructor
+ CSvgDecoder();
+
+ /**
+ * Part of two phase construction
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ void ConstructL(const TDesC& aFileName);
+
+ // to read from a descriptor
+ void ConstructL(const TDesC8& aByteData);
+
+ /**
+ * Removes references of element. Usually called before the element is
+ * deleted.
+ *
+ * @since s60 3.2
+ * @param aElement Pointer of element that is about to be deleted.
+ * @return none
+ */
+ void RemoveInternalReferences( CSvgElementImpl* aElement );
+
+private: // Data
+
+ //All the functions in the class RReadStream that are used for reading data can Leave.
+ RReadStream iStream;
+ RFileReadStream iFStream;
+ RDesReadStream iDStream;
+ RFs iFs;
+
+ CSvgElementImpl*iRootElement; // SVG Element
+ CSvgElementImpl*iCurrentElement; // Latest discovered element
+ CSvgElementImpl*iCurrentParentElement; // Parent element for the current depth
+ CSvgDocumentImpl* iDocument; // The document object to which this SVG source is processed
+
+ // Various attributes that hold document "depth" information
+ TInt iIgnoreDepth;
+ TBool iIsSvgElement;
+
+ // Various booleans that indicate success/failure or true/false for various attributes
+ TBool iIsAnimElement;
+
+ CSvgErrorImpl* iSvgError;
+
+ /* Added to support forward references in USE, Animation and Animate elements*/
+ RPointerArray<CSvgElementImpl>* iUseElementArray;
+ RPointerArray<CSvgElementImpl>* iAnimationElementArray;
+ RPointerArray<CSvgElementImpl>* iAnimRefElementArray;
+
+ //array to keep track of switch elements
+ //so we can go back at the end of parsing and remove the elements
+ //that dont evaluate to true from memory
+ RPointerArray<CSvgElementImpl>* iSwitchElementArray;
+ RPointerArray<CSvgElementImpl>* iReqFetAttSysArray;
+
+ //variable to tell if the encoder was encoding fixed points or floats
+ TBool iIsFixPt;
+ TBool iIsRGB;
+
+ RPointerArray<CSvgImageElementImpl> iImageElements;
+ // Embedded Images Need to be kept track cause loadimage is not called on them
+ // iImageElements has only images that have uri
+ // Document needs to be set with the total images so that it can perform a
+ // callback to the client and indicate that all image loading is complete
+ TInt iEmbeddedImagesCount;
+};
+
+
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/src/SVGAttributeVerifier.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,209 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#include "SVGAttributeVerifier.h"
+#include <limits.h>
+#include <hal.h>
+#include <hal_data.h>
+// --------------------------------------------------------------------------
+// TBool CSvgAttributeVerifier::ParseForDecimalValue( const TDesC& aNum2Str, TReal32& aValue )
+// ---------------------------------------------------------------------------
+TBool CSvgAttributeVerifier::ParseForDecimalValue( const TDesC& aNum2Str, TReal32& aValue, const TDesC& aAttrValue, TBool isSvgElement )
+ {
+ TLex parser( aNum2Str );
+ parser.SkipSpace();
+ TInt result = parser.Val( aValue, '.' );
+ TChar chr;
+ TBool numUnits = EFalse ;
+ TPtrC16 remChars = parser.Remainder();
+
+ TInt dimInTwips ;
+ TInt dimInPixels;
+ const TReal32 TwipsInCentimeters = 566.929133858268 ;
+ const TReal32 TwipsInInches = 1440 ;
+ const TReal32 TwipsInPt = 20 ;
+ const TReal32 TwipsInPc = 240 ;
+
+ _LIT(Kcm,"cm");
+ _LIT(Kmm,"mm");
+ _LIT(Kin,"in");
+ _LIT(KPx,"px");
+ _LIT(KPt,"pt");
+ _LIT(KPc,"pc");
+ _LIT(KPer,"%");
+
+ _LIT(KWidth, "width");
+ _LIT(KHeight, "height");
+
+ if(isSvgElement)
+ {
+ if(aAttrValue == KWidth)
+ {
+ if(remChars == Kcm)
+ {
+ numUnits = ETrue;
+ HAL::Get( HALData::EDisplayXTwips, dimInTwips );
+ HAL::Get( HALData::EDisplayXPixels, dimInPixels );
+
+ aValue *= (dimInPixels*TwipsInCentimeters)/dimInTwips ;
+
+ }
+ else if(remChars == Kmm)
+ {
+ numUnits = ETrue;
+ HAL::Get( HALData::EDisplayXTwips, dimInTwips );
+ HAL::Get( HALData::EDisplayXPixels, dimInPixels );
+
+ aValue *= (dimInPixels*TwipsInCentimeters/10)/dimInTwips ;
+ }
+ else if(remChars == Kin)
+ {
+ numUnits = ETrue;
+
+ HAL::Get( HALData::EDisplayXTwips, dimInTwips );
+ HAL::Get( HALData::EDisplayXPixels, dimInPixels );
+ aValue *= (dimInPixels*TwipsInInches)/dimInTwips ;
+ }
+ else if(remChars == KPt)
+ {
+ numUnits = ETrue;
+
+ HAL::Get( HALData::EDisplayXTwips, dimInTwips );
+ HAL::Get( HALData::EDisplayXPixels, dimInPixels );
+ aValue *= (dimInPixels*TwipsInPt)/dimInTwips ;
+ }
+ else if(remChars == KPc)
+ {
+ numUnits = ETrue;
+
+ HAL::Get( HALData::EDisplayXTwips, dimInTwips );
+ HAL::Get( HALData::EDisplayXPixels, dimInPixels );
+ aValue *= (dimInPixels*TwipsInPc)/dimInTwips ;
+ }
+ else if(remChars == KPx || remChars == KPer)
+ {
+ numUnits = ETrue;
+ }
+ }
+ else if(aAttrValue == KHeight)
+ {
+ if(remChars == Kcm)
+ {
+ numUnits = ETrue;
+
+ HAL::Get( HALData::EDisplayYTwips, dimInTwips );
+ HAL::Get( HALData::EDisplayYPixels, dimInPixels );
+
+ aValue *= (dimInPixels*TwipsInCentimeters)/dimInTwips ;
+ }
+ else if(remChars == Kmm)
+ {
+ numUnits = ETrue;
+
+ HAL::Get( HALData::EDisplayYTwips, dimInTwips );
+ HAL::Get( HALData::EDisplayYPixels, dimInPixels );
+
+ aValue *= (dimInPixels*TwipsInCentimeters/10)/dimInTwips ;
+ }
+ else if(remChars == Kin)
+ {
+ numUnits = ETrue;
+
+ HAL::Get( HALData::EDisplayYTwips, dimInTwips );
+ HAL::Get( HALData::EDisplayYPixels, dimInPixels );
+ aValue *= (dimInPixels*TwipsInInches)/dimInTwips ;
+ }
+ else if(remChars == KPt)
+ {
+ numUnits = ETrue;
+
+ HAL::Get( HALData::EDisplayYTwips, dimInTwips );
+ HAL::Get( HALData::EDisplayYPixels, dimInPixels );
+ aValue *= (dimInPixels*TwipsInPt)/dimInTwips ;
+ }
+ else if(remChars == KPc)
+ {
+ numUnits = ETrue;
+
+ HAL::Get( HALData::EDisplayYTwips, dimInTwips );
+ HAL::Get( HALData::EDisplayYPixels, dimInPixels );
+ aValue *= (dimInPixels*TwipsInPc)/dimInTwips ;
+ }
+ else if(remChars == KPx || remChars == KPer)
+ {
+ numUnits = ETrue;
+ }
+ }
+ }
+
+
+ if(!numUnits)
+ while(!(parser.Eos()))
+ {
+ chr=parser.Get();
+ if(!chr.IsDigit())
+ {
+ aValue=0;
+ return result==KErrNotFound;
+ }
+ parser.Inc();
+ }
+
+ if (result != KErrNone)
+ {
+ aValue= 0;
+ }
+ parser.SkipSpace();
+ return result == KErrNone;
+ }
+
+
+
+
+// --------------------------------------------------------------------------
+// TBool CSvgAttributeVerifier::ValidAttrValue( const TDesC& aValue,
+// ---------------------------------------------------------------------------
+TBool CSvgAttributeVerifier::ValidAttrValue( const TDesC& aValue,
+ TReal32& aConvVal,
+ TUint8 aDatatype,
+ const TDesC& aAttrValue,
+ TBool isSvgElement)
+ {
+ TReal32 lMinValue = (TReal32)(aDatatype==KSVG_LENGTH_TYPE ? 0 : -KMax16BitValue);
+ // invalid number string
+ if ( !ParseForDecimalValue( aValue, aConvVal, aAttrValue, isSvgElement) )
+ {
+ aConvVal=0;
+ return EFalse;
+ }
+ // less than minimum value
+ else if ( aConvVal > KMax16BitValue )
+ {
+ aConvVal = KMax16BitValue;
+ return EFalse;
+ }
+ // greater than maximum value
+ else if ( aConvVal < lMinValue )
+ {
+ aConvVal = lMinValue;
+ return EFalse;
+ }
+ // number string is valid and within range
+ return ETrue;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/src/SVGContentHandler.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,2994 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine source file
+ *
+*/
+
+
+#include "SVGContentHandler.h"
+#include "SVGSchemaData.h"
+#include "SVGDocumentImpl.h"
+#include "SVGEngineImpl.h"
+
+#include "SVGSvgElementImpl.h"
+#include "SVGStringTokenizer.h"
+
+#include "SVGUseElementImpl.h"
+#include "SVGAnimationElementImpl.h"
+#include "rxmlreader.h"
+
+#include "SVGPaintCssValueImpl.h"
+#include "SVGPathElementImpl.h"
+#include "GfxGeneralPath.h"
+
+#include "SVGUriReferenceImpl.h"
+#include "SVGGradientElementImpl.h"
+#include "SVGAnimationBase.h"
+
+#include "SVGTextAreaElementImpl.h"
+#include "SVGTextElementImpl.h"
+#include "SVGScriptElementImpl.h"
+#include "SVGImageElementImpl.h"
+#include "SVGMediaElementBase.h"
+
+#include "SVGFontFaceElementImpl.h"
+#include <languages.hrh>
+
+//#ifdef RD_SVGT_MEDIAANIMATION_SUPPORT
+#include "SVGMediaAnimationElementImpl.h"
+//#endif
+_LIT(WIDTH, "width");
+_LIT(HEIGHT, "height");
+_LIT(BEGIN, "begin");
+_LIT(END, "end");
+_LIT(MOUSEDOWN, "mousedown");
+_LIT(MOUSEUP, "mouseup");
+_LIT(MOUSEOVER, "mouseover");
+_LIT(MOUSEMOVE, "mousemove");
+_LIT(MOUSEOUT, "mouseout");
+_LIT(FOCUSIN, "focusin");
+_LIT(FOCUSOUT, "focusout");
+_LIT(ACTIVATE, "activate");
+_LIT(CLICK, "click");
+
+_LIT(FILL, "fill");
+_LIT(STROKE, "stroke");
+_LIT(COLOR, "color");
+_LIT(STOP_COLOR, "stop-color");
+_LIT(ACCESS,"accessKey");
+_LIT(OFFSET, "offset");
+_LIT(ZEROVALUE, "0");
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+CSvgContentHandler::CSvgContentHandler() : iRootElement( NULL ),
+ iIsColorAnim( EFalse ),
+ iRemoveFalseSwitchElements( ETrue )
+ {
+ iCancelRequested = EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+CSvgContentHandler::~CSvgContentHandler()
+ {
+ if(iUseElementArray)
+ {
+ iUseElementArray->Reset();
+ iUseElementArray->Close();
+ delete iUseElementArray;
+ iUseElementArray = NULL;
+ }
+ if(iAnimRefElementArray)
+ {
+ iAnimRefElementArray->Reset();
+ iAnimRefElementArray->Close();
+ delete iAnimRefElementArray;
+ iAnimRefElementArray = NULL;
+ }
+ if(iSwitchElementArray)
+ {
+ iSwitchElementArray->Reset();
+ iSwitchElementArray->Close();
+ delete iSwitchElementArray;
+ iSwitchElementArray = NULL;
+ }
+ if (iReqFetAttSysArray)
+ {
+ iReqFetAttSysArray->Reset();
+ iReqFetAttSysArray->Close();
+ delete iReqFetAttSysArray;
+ iReqFetAttSysArray = NULL;
+ }
+ if(iAnimationElementArray)
+ {
+ iAnimationElementArray->Reset();
+ iAnimationElementArray->Close();
+ delete iAnimationElementArray;
+ }
+ if(iCData)
+ {
+ delete iCData;
+ iCData = NULL;
+ }
+ if ( iSystemLanguage )
+ {
+ delete iSystemLanguage;
+ iSystemLanguage = NULL;
+ }
+
+ iImageElements.Close();
+ }
+// ---------------------------------------------------------------------------
+// CSvgContentHandler* CSvgContentHandler::NewL()
+// ---------------------------------------------------------------------------
+CSvgContentHandler* CSvgContentHandler::NewL( TBool aRemoveFalseSwitchElements )
+ {
+ CSvgContentHandler* self = new( ELeave ) CSvgContentHandler();
+ CleanupStack::PushL( self );
+ self->ConstructL( aRemoveFalseSwitchElements );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// --------------------------------------------------------------------------
+// CSvgContentHandler* CSvgContentHandler::NewLC()
+// ---------------------------------------------------------------------------
+CSvgContentHandler* CSvgContentHandler::NewLC()
+ {
+ CSvgContentHandler* self = new( ELeave ) CSvgContentHandler();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+
+
+// --------------------------------------------------------------------------
+// void CSvgContentHandler::ConstructL()
+// ---------------------------------------------------------------------------
+void CSvgContentHandler::ConstructL( TBool aRemoveFalseSwitchElements )
+ {
+ /*Arrays added to support Forward referencing in Animation and Use elements*/
+ iUseElementArray = new (ELeave)RPointerArray<CSvgElementImpl> (1);
+
+ iAnimRefElementArray = new (ELeave)RPointerArray<CSvgElementImpl> (1);
+
+ // added to hold switch element handles so we can go back and delete false children of the switch
+ iSwitchElementArray = new (ELeave)RPointerArray<CSvgElementImpl> (1);
+
+ // Arrays added to reset event listeners for animation element
+ iAnimationElementArray = new (ELeave)RPointerArray<CSvgElementImpl> (1);
+
+ //added to hold elements with required features, attributes, or sys language
+ //so we can go back and delete the ones that dont pass at the start.
+ iReqFetAttSysArray = new (ELeave)RPointerArray<CSvgElementImpl> (1);
+ // Create a 1KB buffer for CData -- this will expand as needed
+ iCData = HBufC::NewL( 1024 );
+
+ iSystemLanguage = HBufC::NewL( 5 );
+
+ iRemoveFalseSwitchElements = aRemoveFalseSwitchElements;
+ }
+
+
+
+
+
+// --------------------------------------------------------------------------
+// CSvgElementImpl* CSvgContentHandler::ParseByteData( CSvgDocumentImpl* aDocument,
+// const TDesC8& aByteData,
+// CSvgErrorImpl& aError )
+// ---------------------------------------------------------------------------
+CSvgElementImpl* CSvgContentHandler::ParseByteData( CSvgDocumentImpl* aDocument,
+ const TDesC8& aByteData,
+ CSvgErrorImpl& aError )
+ {
+ iDocument = aDocument;
+
+ iSvgError = &aError;
+ aError.SetErrorCode( ESvgNoError );
+
+
+
+ // Create XML reader
+ RXMLReader xmlReader;
+ TInt error = KErrNone;
+ TRAP( error, xmlReader.CreateL() );
+ if ( error != KErrNone )
+ {
+ _LIT(OUTMEMORY, "Out of memory");
+ aError.SetErrorCode( ESvgNoMemory );
+ aError.SetDescription( OUTMEMORY );
+ aError.SetIsWarning( EFalse );
+ return iRootElement;
+ }
+
+ // Parse content
+ xmlReader.SetContentHandler( this );
+ TRAPD( parseError, xmlReader.ParseL( aByteData ) );
+ xmlReader.Destroy();
+ if ( !iCancelRequested && parseError != KErrNone )
+ {
+ if ( iSvgError->HasError() )
+ return iRootElement;
+
+ aError.SetErrorCode( ESvgUnknown );
+ if ( parseError == -4 )
+ {
+ _LIT(OUTMEMORY, "Out of memory");
+ aError.SetDescription( OUTMEMORY );
+ }
+ else
+ {
+ _LIT(STRING, "Parsing SVG document failed.");
+ aError.SetDescription( STRING );
+ }
+ aError.SetIsWarning( EFalse );
+ aError.SetSystemErrorCode( parseError );
+ return iRootElement;
+ }
+ if ( iRootElement == NULL )
+ {
+ _LIT(STRING, "Invalid SVG Document.");
+ aError.SetErrorCode( ESvgDocumentNotValid );
+ aError.SetDescription( STRING );
+ aError.SetIsWarning( EFalse );
+ return iRootElement;
+ }
+ else if ( !iCancelRequested )
+ {
+ SetForwardReferences(aError);
+ PostParseProcessing();
+ }
+
+ return iRootElement;
+ }
+
+// --------------------------------------------------------------------------
+// CSvgElementImpl* CSvgContentHandler::Parse16BitData( CSvgDocumentImpl* aDocument,
+// const TDesC8& aByteData,
+// CSvgErrorImpl& aError )
+// ---------------------------------------------------------------------------
+CSvgElementImpl* CSvgContentHandler::Parse16BitData( CSvgDocumentImpl* aDocument,
+ const TDesC16& aSvgString,
+ CSvgErrorImpl& aError )
+ {
+ iDocument = aDocument;
+
+ iSvgError = &aError;
+ aError.SetErrorCode( ESvgNoError );
+
+ // Create XML reader
+ RXMLReader xmlReader;
+ TInt error = KErrNone;
+ TRAP( error, xmlReader.CreateL() );
+ if ( error != KErrNone )
+ {
+ _LIT(OUTMEMORY, "Out of memory");
+ aError.SetErrorCode( ESvgNoMemory );
+ aError.SetDescription( OUTMEMORY );
+ aError.SetIsWarning( EFalse );
+ return iRootElement;
+ }
+
+ // Parse content
+ xmlReader.SetContentHandler( this );
+
+ //-------------------------------------------------------------------
+ //THIS IS TEMPORARY
+ //convert to 8 bit here temporary until I get 16 bit parsing method...
+ //TRAPD( parseError, xmlReader.ParseXML( aSvgString ) );
+
+ //convert 16 to 8 bit characters
+ HBufC8* lString8 = NULL;
+ lString8 = HBufC8::New( aSvgString.Length() );
+
+
+ if(NULL==lString8)
+ {
+ _LIT(OUTMEMORY, "Out of memory");
+ aError.SetErrorCode( ESvgNoMemory );
+ aError.SetDescription( OUTMEMORY );
+ aError.SetIsWarning( EFalse );
+ return iRootElement;
+ }
+
+ lString8->Des().Copy(aSvgString);
+ TRAPD( parseError, xmlReader.ParseL( *lString8 ) );
+ delete lString8 ;
+ //-------------------------------------------------------------------
+
+ xmlReader.Destroy();
+ if ( !iCancelRequested && parseError != KErrNone )
+ {
+ if ( iSvgError->HasError() )
+ return iRootElement;
+
+ aError.SetErrorCode( ESvgUnknown );
+ if ( parseError == -4 )
+ {
+ _LIT(OUTMEMORY, "Out of memory");
+ aError.SetDescription( OUTMEMORY );
+ }
+ else
+ {
+ _LIT(STRING, "Parsing SVG document failed.");
+ aError.SetDescription( STRING );
+ }
+ aError.SetIsWarning( EFalse );
+ aError.SetSystemErrorCode( parseError );
+ return iRootElement;
+ }
+ if ( iRootElement == NULL )
+ {
+ _LIT(STRING, "Invalid SVG Document.");
+ aError.SetErrorCode( ESvgDocumentNotValid );
+ aError.SetDescription( STRING );
+ aError.SetIsWarning( EFalse );
+ return iRootElement;
+ }
+ else if ( !iCancelRequested )
+ {
+ //POST PARSING PROCESSING
+ SetForwardReferences(aError);
+ RemoveFalseElementsOrMakeInvisible();
+ RemoveFalseSwitchCasesOrMakeInvisible();
+ if ( !iSvgError->HasError())
+ {
+ LoadImages();
+ }
+ }
+
+ return iRootElement;
+ }
+
+// --------------------------------------------------------------------------
+// CSvgElementImpl* CSvgContentHandler::ParseFile( CSvgDocumentImpl* aDocument,
+// ---------------------------------------------------------------------------
+CSvgElementImpl* CSvgContentHandler::ParseFile( CSvgDocumentImpl* aDocument,
+ const TDesC& aFileName,
+ CSvgErrorImpl& aError )
+ {
+ iDocument = aDocument;
+
+ iSvgError = &aError;
+ aError.SetErrorCode( ESvgNoError );
+
+ RFs session;
+ TInt serror = session.Connect ();
+ if( serror != KErrNone)
+ {
+ _LIT(STRING, "Cannot create a session to read the file.");
+ aError.SetErrorCode ( ESvgUnknown );
+ aError.SetDescription( STRING );
+ aError.SetIsWarning( EFalse );
+ return NULL;
+ }
+
+ // Create XML reader
+ RXMLReader xmlReader;
+ TInt error = KErrNone;
+ TRAP( error, xmlReader.CreateL() );
+ if ( !iCancelRequested && error != KErrNone )
+ {
+ _LIT(OUTMEMORY, "Out of memory");
+ aError.SetErrorCode( ESvgNoMemory );
+ aError.SetDescription( OUTMEMORY );
+ aError.SetIsWarning( EFalse );
+ return iRootElement;
+ }
+
+ // Parse content
+ xmlReader.SetContentHandler( this );
+ TRAP( error, xmlReader.ParseL( session, aFileName) );
+ xmlReader.Destroy();
+ if ( error != KErrNone || iRootElement == NULL )
+ {
+ _LIT(STRING, "Invalid SVG Document.");
+ aError.SetErrorCode( ESvgDocumentNotValid );
+ aError.SetDescription( STRING );
+ aError.SetIsWarning( EFalse );
+ }
+ else if ( !iCancelRequested )
+ {
+ SetForwardReferences(aError);
+ PostParseProcessing();
+ }
+
+ session.Close();
+ return iRootElement;
+ }
+
+void CSvgContentHandler::PostParseProcessing()
+{
+
+ // This situation occurs when parsing is done in a separate thread then the draw thread
+ // Wait for drawing to complete or invalid element pointer may occur during drawing
+ if ( iDocument->iIsRendering )
+ {
+ TInt waitCount = 0;
+ // total of 1 seconds
+ while ( waitCount++ < 200000 && iDocument->iIsRendering )
+ {
+ User::After( 50 ); // 50 microseconds
+ }
+
+ // Cannot wait any longer, prevent being stuck here
+ if ( iDocument->iIsRendering )
+ {
+ return;
+ }
+ }
+
+ iDocument->iIsPruningTree = ETrue;
+
+ RemoveFalseElementsOrMakeInvisible();
+ RemoveFalseSwitchCasesOrMakeInvisible();
+
+ iDocument->iIsPruningTree = EFalse;
+ iDocument->SetImageElementsCount(iImageElements.Count());
+ if ( (!iSvgError->HasError()) || iSvgError->IsWarning() )
+ {
+ LoadImages();
+ }
+}
+
+// --------------------------------------------------------------------------
+// TInt CSvgContentHandler::RemoveInternalReferences( CSvgElementImpl* )
+// ---------------------------------------------------------------------------
+void CSvgContentHandler::RemoveInternalReferences( CSvgElementImpl* aElement )
+ {
+ // Remove the references of aElement in content handler's lists
+
+ // Use Elements
+ TInt lIndex = 0;
+ if ( aElement->ElemID() == KSvgUseElement )
+ {
+ lIndex = iUseElementArray->Find( aElement );
+ if ( lIndex != KErrNotFound )
+ {
+ iUseElementArray->Remove( lIndex );
+ }
+ }
+ else if ( aElement->ElemID() == KSvgImageElement )
+ {
+ // Image elements
+ lIndex = iImageElements.Find( (CSvgImageElementImpl* )aElement );
+ if ( lIndex != KErrNotFound )
+ {
+ iImageElements.Remove( lIndex );
+ }
+ }
+ else if ( aElement->ElemID() == KSvgSwitchElement )
+ {
+ // Switch Elements
+ lIndex = iSwitchElementArray->Find( aElement );
+ if ( lIndex != KErrNotFound )
+ {
+ iSwitchElementArray->Remove( lIndex );
+ }
+ }
+ else if ( aElement->IsAnimatedElement() )
+ {
+ // Animation elements include animate* elements, set,
+ // "animation", audio elements etc.
+ lIndex = iAnimationElementArray->Find( aElement );
+ if ( lIndex != KErrNotFound )
+ {
+ iAnimationElementArray->Remove( lIndex );
+ }
+ lIndex = iAnimRefElementArray->Find( aElement );
+ if ( lIndex != KErrNotFound )
+ {
+ iAnimRefElementArray->Remove( lIndex );
+ }
+ }
+ // Elements with test attributes - requiredFeatures,
+ // requiredExtensions, systemLanguage
+ lIndex = iReqFetAttSysArray->Find( aElement );
+ if ( lIndex != KErrNotFound )
+ {
+ iReqFetAttSysArray->Remove( lIndex );
+ }
+
+ // Remove Internal references of subtree elements as well
+ CSvgElementImpl* lChild = ( CSvgElementImpl* )aElement->FirstChild();
+ while ( lChild != NULL )
+ {
+ RemoveInternalReferences( lChild );
+ lChild = ( CSvgElementImpl* )lChild->NextSibling();
+ }
+
+ }
+
+/************* Start of MXMLContentHandler methods ************/
+
+// --------------------------------------------------------------------------
+// TInt CSvgContentHandler::StartDocument()
+// ---------------------------------------------------------------------------
+TInt CSvgContentHandler::StartDocument()
+ {
+ if ( iCancelRequested )
+ {
+ return EFalse;
+ }
+ iDocument->NotifyDocumentStart();
+ iBeginEndAtr = EFalse;
+ return ETrue;
+ }
+
+// --------------------------------------------------------------------------
+// TInt CSvgContentHandler::EndDocument()
+// ---------------------------------------------------------------------------
+TInt CSvgContentHandler::EndDocument()
+ {
+ if ( iCancelRequested )
+ {
+ return EFalse;
+ }
+ iDocument->NotifyDocumentEnd();
+ return ETrue;
+ }
+
+// --------------------------------------------------------------------------
+// TInt CSvgContentHandler::StartElement( TDesC& aURI,
+// ---------------------------------------------------------------------------
+TInt CSvgContentHandler::StartElement( TDesC& aURI,
+ TDesC& aLocalName,
+ TDesC& aName,
+ MXMLAttributes *aAttributeList )
+ {
+ if ( iCancelRequested )
+ {
+ return EFalse;
+ }
+
+ // Clear cdata buffer
+ iCData->Des().Zero();
+
+ TInt result = EFalse;
+ TRAPD( error, result = StartElementL( aURI, aLocalName, aName, aAttributeList ) );
+ if ( error != KErrNone )
+ {
+ _LIT(STRING, "Parsing SVG Content Failed -- Element: ");
+ iSvgError->SetDescription( STRING, aName );
+ iSvgError->SetErrorCode( ESvgUnknown );
+ iSvgError->SetSystemErrorCode( error );
+ iSvgError->SetIsWarning( EFalse );
+ return EFalse;
+ }
+ return result;
+ }
+
+// --------------------------------------------------------------------------
+// TInt CSvgContentHandler::StartElementL( TDesC& /* aURI */,
+// ---------------------------------------------------------------------------
+TInt CSvgContentHandler::StartElementL( TDesC& /* aURI */,
+ TDesC& /* aLocalName */,
+ TDesC& aName,
+ MXMLAttributes *aAttributeList )
+ {
+ if ( iRootElement == NULL && aName != _L( "svg" ) )
+ {
+ iSvgError->SetDescription( _L( "Invalid SVG document: Missing Root <svg> Element." ) );
+ iSvgError->SetErrorCode( ESvgUnknown );
+ iSvgError->SetSystemErrorCode( KErrNone );
+ iSvgError->SetIsWarning( EFalse );
+ return EFalse;
+ }
+ if ( iRootElement != NULL && aName == _L( "svg" ) )
+ {
+ iSvgError->SetDescription( _L( "Invalid SVG document: Nested <svg> Element." ) );
+ iSvgError->SetErrorCode( ESvgUnknown );
+ iSvgError->SetSystemErrorCode( KErrNone );
+ iSvgError->SetIsWarning( EFalse );
+ return EFalse;
+ }
+
+ if ( iIgnoreDepth > 0 )
+ {
+ iIgnoreDepth++;
+ return ETrue;
+ }
+ MXmlElement* newElement;
+
+ newElement = iDocument->CreateElementL( aName );
+
+ if ( newElement != NULL)
+ {
+ iIsSvgElement = ETrue;
+ }
+ else
+ {
+ iDocument->NotifyUnsupportedElement( aName, *aAttributeList );
+ iIsSvgElement = EFalse;
+ iIgnoreDepth = 1;
+ return ETrue;
+ }
+
+ iCurrentElement = ( CSvgElementImpl * ) newElement;
+
+ // Set flag to indicate element is incomplete
+ if ( iDocument->GetLoadingListeners() &&
+ iDocument->GetLoadingListeners()->Count() > 0 )
+ {
+ iCurrentElement->SetAllAttributesAdded( EFalse );
+ }
+
+ _LIT( KElmSvg, "svg" );
+ if ( aName == KElmSvg && !iRootElement )
+ {
+ iDocument->AppendChildL( newElement );
+ iRootElement = iCurrentElement;
+ }
+ // for all other elements
+ else
+ {
+ iCurrentParentElement->AppendChildL( newElement );
+ }
+
+
+ // create separate lists for names and values
+ TInt lCount = aAttributeList->GetLength();
+ for ( TInt i =0 ; i< lCount ;i++)
+
+ {
+
+ ProcessNConvertAttrL( aName,
+ aAttributeList->GetName( i ),
+ aAttributeList->GetValue( i ) );
+ }
+
+ TInt elementID = iCurrentElement->ElemID();
+
+ //keep lists so invalid ones can be removed at the end of parsing
+ //all elements that have required features, extensions, sys language
+ if (iCurrentElement->HasAnyTests())
+ {
+ iReqFetAttSysArray->AppendL(iCurrentElement);
+ }
+ else if (elementID == KSvgSwitchElement)
+ {
+ iSwitchElementArray->AppendL(iCurrentElement);
+ }
+
+ if ( iBeginEndAtr )
+ {
+ ((CSvgDocumentImpl*)iDocument)->iIsInteractive = ETrue;
+ }
+
+ if(iIsColorAnim)
+ {
+ ProcessColorAttributeL(_L("from"),iFromVal);
+ ProcessColorAttributeL(_L("to"),iToVal);
+ ProcessColorAttributeL(_L("by"),iByVal);
+ }
+ else
+ {
+ if(iFromVal.Length())
+ {
+ iCurrentElement->SetAttributeL(_L("from"),iFromVal );
+ }
+ if(iToVal.Length())
+ {
+ iCurrentElement->SetAttributeL(_L("to"),iToVal );
+ }
+ if(iByVal.Length())
+ {
+ iCurrentElement->SetAttributeL(_L("by"),iByVal );
+ }
+ }
+ if(iValues.Length())
+ {
+ iCurrentElement->SetAttributeL(_L("values"),iValues );
+ }
+ if(iTimes.Length())
+ {
+ iCurrentElement->SetAttributeL(_L("keyTimes"), iTimes);
+ }
+ if(iSplines.Length())
+ {
+ iCurrentElement->SetAttributeL(_L("keySplines"), iSplines);
+ }
+ if (elementID == KSvgUseElement)
+ {
+ ((CSvgUseElementImpl *)iCurrentElement)->SetReferenceElementL();
+ }
+ // font-face-src is currently not implemented. Hence such a font is removed
+ // from the font hash-map in order to avoid creating iSvgFont pointer
+ // while drawing the text.
+ if (elementID == KSvgFontfacesrcElement )
+ {
+ //Get the font-face element which is the parent of font-face-src
+ CSvgFontFaceElementImpl* currentFontFaceElem =
+ (CSvgFontFaceElementImpl*)(iCurrentElement)->ParentNode();
+
+ const TDesC* lFontFamily=currentFontFaceElem->GetFontFamily();
+
+ currentFontFaceElem->RemoveFontFamily(*lFontFamily);
+
+ }
+// comment out for future AnimationElement
+// else if (elementID == KSvgAnimationElement)
+// {
+// ((CSvgAnimationElementImpl *)iCurrentElement)->SetReferenceElementL();
+// if(((CSvgAnimationElementImpl *)iCurrentElement)->RecursionVariable())
+// {
+// iSvgError->SetErrorCode( ESvgDocumentNotValid );
+// iSvgError->SetIsWarning( EFalse );
+// iSvgError->SetDescription( _L( "Invalid Document \n" ) );
+// iSvgError->AppendDescription( _L("Animation element in loop") );
+// return EFalse;
+// }
+// User::LeaveIfError(iAnimationElementArray->Append(iCurrentElement));
+// }
+
+ // For DOM reuse
+ if ( iCurrentElement->IsAnimatedElement() )
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetOriginalValues_DOMReuse() ;
+ iAnimationElementArray->AppendL(iCurrentElement);
+ }
+
+
+ if ( elementID >= KSvgLinearGradientElement &&
+ elementID <= KSvgStopElement )
+ {
+ iCurrentElement->SetAttributeIntL(KCSS_ATTR_DISPLAY,0);
+ }
+
+ // special case: <animationMotion> may have <mpath> child instead
+ // of "path" attribute.
+
+ if ( elementID == KSvgMpathElement &&
+ iCurrentParentElement->ElemID() == KSvgAnimateMotionElement &&
+ iSvgError->ErrorCode() == ESvgMissingRequiredAttribute &&
+ iSvgError->IsWarning()
+ )
+ {
+ iSvgError->SetErrorCode( ESvgNoError );
+ // add to event receiver list will have only one copy
+ ((CSvgDocumentImpl*)iDocument)->AddToEventReceiverListL( iCurrentParentElement, KSvgEventMaskTimer );
+ }
+
+
+ if ( iCurrentElement->iReqAttrFlag != 0)
+ {
+ iSvgError->SetErrorCode( ESvgMissingRequiredAttribute );
+ iSvgError->SetIsWarning( ETrue );
+ iSvgError->SetDescription( _L( "Missing required attribute \"" ) );
+ switch(iCurrentElement->iReqAttrFlag)
+ {
+ case KAtrSVGRec:
+ iSvgError->AppendDescription( WIDTH );
+ iSvgError->AppendDescription( _L( "\" and \"" ) );
+ iSvgError->AppendDescription(_L("height"));
+ break;
+ case KAtrSVGElp:
+ iSvgError->AppendDescription( _L("Rx") );
+ iSvgError->AppendDescription( _L( "\" and \"" ) );
+ iSvgError->AppendDescription(_L("Ry"));
+ break;
+ case KAtrSVGTrf:
+ iSvgError->AppendDescription( _L("attributeName") );
+ iSvgError->AppendDescription( _L( "\" and \"" ) );
+ iSvgError->AppendDescription(_L("type"));
+ break;
+ case KSVG_ANIMATE_ELEMFLAG:
+ iSvgError->AppendDescription( _L("attributeName") );
+ break;
+ case KSVG_CIRCLE_ELEMFLAG:
+ iSvgError->AppendDescription( _L("r") );
+ break;
+ case KSVG_HKERN_ELEMFLAG:
+ iSvgError->AppendDescription( _L("k") );
+ break;
+ case KSVG_PATH_ELEMFLAG:
+ iSvgError->AppendDescription( _L("d") );
+ break;
+ case KSVG_POLYLINE_ELEMFLAG:
+ iSvgError->AppendDescription( _L("points") );
+ break;
+ case KAtrType:
+ iSvgError->AppendDescription( _L("type") );
+ break;
+ case KAtrRy:
+ iSvgError->AppendDescription( _L("Ry") );
+ break;
+ case KAtrRx:
+ iSvgError->AppendDescription( _L("Rx") );
+ break;
+ case KAtrWidth:
+ iSvgError->AppendDescription( _L("width") );
+ break;
+ case KAtrHeight:
+ iSvgError->AppendDescription( _L("height") );
+ break;
+ case KAtrXlinkhref:
+ iSvgError->AppendDescription (_L("Xlink:href"));
+ break;
+ case KAtrSVGAmo:
+ iSvgError->AppendDescription( _L("path") );
+ ((CSvgDocumentImpl*)iDocument)->RemoveFromEventReceiverList( iCurrentElement );
+ break;
+ case KAtrToBy:
+ iSvgError->AppendDescription( _L("to/by") );
+ ((CSvgDocumentImpl*)iDocument)->RemoveFromEventReceiverList( iCurrentElement );
+ break;
+ }
+ iSvgError->AppendDescription( _L( "\" for <" ) );
+ // access schema data to get the name of the attribute which is missing
+ // currently the error msg doesnt not report the name of the attribute
+ iSvgError->AppendDescription( aName );
+ iSvgError->AppendDescription( _L( ">." ) );
+
+ TInt32 displayValue = KDisplayEnumNone;
+ TInt lRetValue = ((CSvgElementImpl*)iCurrentElement)->GetAttributeIntL( KCSS_ATTR_DISPLAY, displayValue );
+ // turn off element if the display attribute is not declared OR if declared its value is "!none"
+ if( (lRetValue == KErrNoAttribute)||(displayValue != KDisplayEnumNone ) )
+ {
+ ((CSvgElementImpl*)iCurrentElement)->SetPropertyL(KCSS_ATTR_DISPLAY,_L("none"));
+
+ // the following boolean is added to show that the element is explicitly
+ // "turned off" due to the absence of the required attribute for the element,
+ // this element can again be "turned on" when the required attribute is present.
+ ((CSvgElementImpl*)iCurrentElement)->SetTurnOff( ETrue );
+ }
+
+ }
+
+ if ( elementID == KSvgImageElement )
+ {
+ iImageElements.Append( (CSvgImageElementImpl*)iCurrentElement );
+ }
+ else if ( elementID == KSvgGElement && !((CSvgDocumentImpl*)iDocument)->iHasGroupOpacity)
+ {
+ if ( ((CSvgDocumentImpl*)iDocument)->isGroupOpacity( iCurrentElement ))
+ {
+ ((CSvgDocumentImpl*)iDocument)->iHasGroupOpacity = ETrue;
+ }
+ }
+
+ // Check for invalid child element of leave elements
+ if ( KSvgRectElement == elementID && iCurrentElement->ParentNode() &&
+ KSvgRectElement == ((CSvgElementImpl*)iCurrentElement->ParentNode())->ElemID() )
+ {
+ _LIT( KMsg, "Invalid child of <rect> element: " );
+ iDocument->SetError( KErrNotFound, KMsg, aName );
+ }
+
+ // Notify Loading Listeners of element-start
+ // Send info if element is <svg> or immediate child of <svg>
+ TBool isRootOrChild = (elementID == KSvgSvgElement);
+
+ if (iCurrentElement->ParentNode())
+ {
+ isRootOrChild = (iCurrentElement->ElemID() == KSvgSvgElement) || (((CSvgElementImpl*)iCurrentElement->ParentNode())->ElemID() == KSvgSvgElement);
+ }
+
+ // Update CTM for new element (if there is a LoadingListener)
+ if ( iDocument->GetLoadingListeners() &&
+ iDocument->GetLoadingListeners()->Count() > 0 )
+ {
+ iCurrentElement->UpdateCTM();
+ iCurrentElement->SetAllAttributesAdded( ETrue );
+ }
+
+ iDocument->NotifyElementStart( aName, *aAttributeList, isRootOrChild );
+
+ // Current element becomes new parent for higher depths
+ iCurrentParentElement = iCurrentElement;
+ return ETrue;
+ }
+
+// --------------------------------------------------------------------------
+// TInt CSvgContentHandler::EndElement( TDesC& /* aURI */, TDesC& /* aLocalName */, TDesC& aTagName )
+// ---------------------------------------------------------------------------
+TInt CSvgContentHandler::EndElement( TDesC& /* aURI */, TDesC& /* aLocalName */, TDesC& aTagName )
+ {
+ if ( iCancelRequested )
+ {
+ return EFalse;
+ }
+
+// iCurrentElement = NULL; //will do it in ReaderIndex
+
+ if ( iIgnoreDepth > 0 )
+ {
+ iIgnoreDepth--;
+ if ( iIgnoreDepth == 0 )
+ {
+ iIsSvgElement = ETrue;
+ }
+ return ETrue;
+ }
+ // Notify Loading Listeners of element-end
+ // Send info if element is <svg> or immediate child of <svg>
+ TBool isRootOrChild = ( iRootElement == iCurrentParentElement ) ||
+ ( iRootElement == iCurrentParentElement->ParentNode() );
+ iDocument->NotifyElementEnd( aTagName, isRootOrChild );
+
+ if ( iCurrentParentElement != iRootElement )
+ {
+ // Depth is decreased, so the current parent should be one level up
+ iCurrentParentElement = ( CSvgElementImpl * )
+ iCurrentParentElement->ParentNode();
+ }
+
+ if( ((CSvgElementImpl*)iCurrentElement->ParentNode()) != NULL )
+ {
+ if((((((CSvgElementImpl*)iCurrentElement->ParentNode())->ElemID()) == KSvgRadialGradientElement) ||
+ ((((CSvgElementImpl*)iCurrentElement->ParentNode())->ElemID()) == KSvgLinearGradientElement) ) &&
+ ( ((CSvgElementImpl*)iCurrentElement)->ElemID() == KSvgStopElement))
+ {
+ CSvgGradientElementImpl *parent = ((CSvgGradientElementImpl *)iCurrentElement->ParentNode());
+
+ if(parent)
+ {
+
+ // Initialize the offset value to 0 if its still -1.
+ TFloatFixPt lOffsetValue;
+ TFloatFixPt lDefaultOffsetValue(-1);
+ TBuf<6> lAttributeName;
+ TBuf<1> lValueBuffer;
+
+ lAttributeName.Append(OFFSET);
+ lValueBuffer.Append(ZEROVALUE);
+
+ ((CSvgStopElementImpl*)iCurrentElement)->GetOffset( lOffsetValue );
+
+ // Offset Value of -1 indicates that Offset Attribute is not declared in
+ // stop element.
+ if( lOffsetValue == lDefaultOffsetValue )
+ {
+ // Deliberately calling SetAttributeL in place of SetAttributeFloatL as the latter inturn
+ // calls UpdateOffsetValues which should be called on any Stop element once it is added to
+ // to the Stop element array Owned by parent Gradient element.
+ TRAP_IGNORE( ((CSvgStopElementImpl*)iCurrentElement)->SetAttributeL( lAttributeName, lValueBuffer ) );
+ }
+
+ // The function not only adds the element in Stop element array but also
+ // adjusts the offset values of all the previously added elements such that
+ // each gradient offset value is greater than the previous gradient stop's
+ // offset value. It calls UpdateOffsetValues to adjust the values.
+ ((CSvgGradientElementImpl *)parent)->AddStopElementInArray((CSvgStopElementImpl*)iCurrentElement);
+ }
+ }
+ }
+
+
+ iIsColorAnim = EFalse;
+ iFromVal.Set( TPtrC() );
+ iToVal.Set( TPtrC() );
+ iByVal.Set( TPtrC() );
+ iValues.Set(TPtrC() );
+ iTimes.Set( TPtrC() );
+ iSplines.Set( TPtrC());
+ return ETrue;
+ }
+
+// this method is called by xml-parser for cdata
+// --------------------------------------------------------------------------
+// TInt CSvgContentHandler::Charecters( TDesC& aBuf, TInt aStart , TInt aLength )
+// ---------------------------------------------------------------------------
+TInt CSvgContentHandler::Charecters( TDesC& aBuf, TInt aStart , TInt aLength )
+ {
+ if ( iCancelRequested )
+ {
+ return EFalse;
+ }
+
+ AppendToCData( aBuf );
+ if ( !iCurrentElement )
+ {
+ return ETrue;
+ }
+
+ TUint8 id = iCurrentElement->ElemID();
+ if ( id == KSvgTextElement || id == KSvgTextAreaElement || id == KSvgDescElement || id == KSvgTitleElement || id == KSvgMetadataElement)
+ {
+
+ if(id == KSvgTextElement)
+ {
+ ((CSvgTextElementImpl*)iCurrentElement)->SetFileOffset(aStart);
+ ((CSvgTextElementImpl*)iCurrentElement)->SetOrgLength(aLength);
+ }
+ else if (id == KSvgTextAreaElement)
+ {
+ // KSvgTextAreaElement
+ ((CSvgTextAreaElementImpl*)iCurrentElement)->SetFileOffset(aStart);
+ ((CSvgTextAreaElementImpl*)iCurrentElement)->SetOrgLength(aLength);
+ }
+
+ //First get the elements previous text & append the new text
+ TPtrC elementText;
+ iCurrentElement->GetAttributeDes(KAtrCdata , elementText);
+ iCData->Des().Zero();
+ AppendToCData(elementText);
+ AppendToCData(aBuf);
+ TRAPD( error, iCurrentElement->SetAttributeDesL( KAtrCdata, *iCData ) );
+ if (error != KErrNone)
+ {
+ //do something here.
+ }
+ }
+ else if ( id == KSvgScriptElement )
+ {
+ RDebug::Printf("Calling SetScriptL\n" );
+ TRAPD( error2, ((CSvgScriptElementImpl*)iCurrentElement)->SetScriptL( *iCData ) );
+ if (error2 != KErrNone)
+ {
+ //do something here
+ }
+ }
+
+ return ETrue;
+ }
+// --------------------------------------------------------------------------
+// void CSvgContentHandler::DataBuffer( const TDesC16& aBuf)
+// ---------------------------------------------------------------------------
+void CSvgContentHandler::DataBuffer( const TDesC16& aBuf)
+ {
+
+ if(iRootElement && !((CSvgSvgElementImpl *)iRootElement)->iContent )
+ {
+
+ ((CSvgSvgElementImpl *)iRootElement)->iContent = HBufC::New(aBuf.Length());
+ if( ((CSvgSvgElementImpl *)iRootElement)->iContent == NULL)
+ return;
+ else
+ ((CSvgSvgElementImpl *)iRootElement)->iContent->Des().Copy(aBuf);
+ }
+ return;
+
+ }
+
+// --------------------------------------------------------------------------
+// TInt CSvgContentHandler::Comment( TDesC& /* aComment */ )
+// ---------------------------------------------------------------------------
+TInt CSvgContentHandler::Comment( TDesC& /* aComment */ )
+ {
+ return !iCancelRequested;
+ }
+
+// --------------------------------------------------------------------------
+// TInt CSvgContentHandler::ProcessingInstructions( TDesC& /* aTarget */, TDesC& /* aData */ )
+// ---------------------------------------------------------------------------
+TInt CSvgContentHandler::ProcessingInstructions( TDesC& /* aTarget */, TDesC& /* aData */ )
+ {
+ return !iCancelRequested;
+ }
+
+// --------------------------------------------------------------------------
+// TInt CSvgContentHandler::IgnoreWhiteSpace( TDesC& /* aString */ )
+// ---------------------------------------------------------------------------
+TInt CSvgContentHandler::IgnoreWhiteSpace( TDesC& /* aString */ )
+ {
+ return !iCancelRequested;
+ }
+
+// ---------------------------------------------------------------------------
+// Called by XML parser when a valid '&...;' is encountered
+// The entity character must be appended to call previous called of "Charecters"
+// & 'StartEntity".
+// ---------------------------------------------------------------------------
+TInt CSvgContentHandler::StartEntity( TDesC& aName )
+ {
+ // Parse entity for possible svg subtree
+ // ParseEntity return ETrue if it has valid subtree and parsing successful.
+ // Otherwise append entity as part of CData.
+ if ( ParseEntity( aName ) )
+ {
+ return ETrue;
+ }
+
+ if ( iCancelRequested )
+ {
+ return EFalse;
+ }
+
+ // content generated with tool uses 0x2019 for apostrophe
+ if ( aName.Length() == 1 && aName[0] == 0x2019 )
+ {
+ AppendToCData( _L( "'" ) );
+ }
+ else
+ {
+ AppendToCData( aName );
+ }
+ // Set CData attribute
+
+ if (!iCurrentElement)
+ {
+ return ETrue;
+ }
+
+ TUint8 id = iCurrentElement->ElemID();
+
+ if ( (id == KSvgTextElement) || (id == KSvgTextAreaElement) || (id == KSvgTitleElement) || (id == KSvgDescElement) || (id == KSvgMetadataElement))
+ {
+ TRAPD( error, iCurrentElement->SetAttributeDesL( KAtrCdata, *iCData ) );
+ if ( error != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgContentHandler::StartEntity error occurred.");
+ #endif
+ }
+ }
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+// Check to see if entity may be needed for parsing
+// If so, attemp to parse it as parse of the document
+// Return ETrue if parse was successfull, EFalse otherwise.
+// ---------------------------------------------------------------------------
+TBool CSvgContentHandler::ParseEntity( const TDesC& aEntity )
+{
+ // Look for '<' and '>' to narrow possibility of svg entity
+ TInt startPos = aEntity.Locate( TChar( '<' ) );
+ if ( startPos == KErrNotFound )
+ {
+ return EFalse;
+ }
+
+ TInt endPos = aEntity.LocateReverse( TChar( '>' ) );
+ if ( endPos == KErrNotFound || endPos < startPos )
+ {
+ return EFalse;
+ }
+
+ // Create XML parser
+ RXMLReader xmlReader;
+ TInt error = KErrNone;
+ TRAP( error, xmlReader.CreateL() );
+ if ( error != KErrNone )
+ {
+ return EFalse;
+ }
+
+ // Copy entity string to byte-array
+ // Enclosed within <g> element to ensure all elements are parsed
+ _LIT8( KBeginTag, "<g>" );
+ _LIT8( KEndTag, "</g>" );
+ HBufC8* buf8 = NULL;
+ // create length + room for KBeginTag & KEndTag
+ buf8 = HBufC8::New( aEntity.Length() + 7 );
+ if ( buf8 == NULL )
+ {
+ xmlReader.Destroy();
+ return EFalse;
+ }
+ TPtr8 des = buf8->Des();
+ des.Copy( KBeginTag );
+ des.Append( aEntity );
+ des.Append( KEndTag );
+
+ // Parse content
+ xmlReader.SetContentHandler( this );
+ TRAPD( parseError, xmlReader.ParseL( *buf8 ) );
+
+ // Cleanup
+ delete buf8;
+ xmlReader.Destroy();
+
+ return parseError == KErrNone;
+}
+
+
+// ---------------------------------------------------------------------------
+// Called by XML parser when a valid '&...;' is encountered
+// ---------------------------------------------------------------------------
+TInt CSvgContentHandler::EndEntity( TDesC& /*aName*/ )
+ {
+ return !iCancelRequested;
+ }
+
+// --------------------------------------------------------------------------
+// TInt CSvgContentHandler::SkippedEntity( TDesC& /*aName*/ )
+// ---------------------------------------------------------------------------
+TInt CSvgContentHandler::SkippedEntity( TDesC& /*aName*/ )
+ {
+ return !iCancelRequested;
+ }
+
+// --------------------------------------------------------------------------
+// TInt CSvgContentHandler::StartCDATA()
+// ---------------------------------------------------------------------------
+TInt CSvgContentHandler::StartCDATA()
+ {
+ return !iCancelRequested;
+ }
+
+// --------------------------------------------------------------------------
+// TInt CSvgContentHandler::EndCDATA()
+// ---------------------------------------------------------------------------
+TInt CSvgContentHandler::EndCDATA()
+ {
+ return !iCancelRequested;
+ }
+
+// --------------------------------------------------------------------------
+// TInt CSvgContentHandler::Error( TInt /* aErrorCode */, TInt /* aSeverity */ )
+// ---------------------------------------------------------------------------
+TInt CSvgContentHandler::Error( TInt /* aErrorCode */, TInt /* aSeverity */ )
+ {
+ return EFalse;
+ }
+
+/************* End of MXMLContentHandler methods ************/
+
+// --------------------------------------------------------------------------
+// void CSvgContentHandler::AppendToCData( const TDesC& aText )
+// ---------------------------------------------------------------------------
+void CSvgContentHandler::AppendToCData( const TDesC& aText )
+{
+
+ // Check to see if appending will overflow
+ if ( iCData->Des().MaxLength() < iCData->Length() + aText.Length() )
+ {
+ HBufC* newBuf = HBufC::NewMax( iCData->Length() + aText.Length() );
+ // Fail to allocate new buffer
+ if ( newBuf == NULL )
+ return;
+
+ newBuf->Des().Copy( *iCData );
+
+ delete iCData;
+ iCData = newBuf;
+ }
+
+ iCData->Des().Append( aText );
+}
+
+
+
+// --------------------------------------------------------------------------
+// TBool CSvgContentHandler::ProcessColorAttributeL( const TDesC& aName,
+// ---------------------------------------------------------------------------
+TBool CSvgContentHandler::ProcessColorAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+ TUint32 tempColor;
+ if( aValue.Length() )
+ {
+ if(aValue == _L("freeze") )
+ {
+ iCurrentElement->SetAttributeL( aName, aValue);
+ return ETrue;
+ }
+ if ( aValue == _L( "inherit" ) )
+ {
+ return EFalse;
+ }
+ if ( aValue != _L( "none" ) && aValue != _L( "currentColor" ) && aValue.Left(3)!=_L("url") )
+
+ {
+ TBufC<24> lColBuf;
+ TSvgColor tColor(KGfxColorNull);
+ if ( tColor.GetStringL( aValue, tempColor ) == EFalse )
+ {
+ TInt32 defColor = 0;//default color
+ ( ( CSvgElementImpl * ) iCurrentElement->ParentNode() )->GetAttributeIntL( KAtrFill,
+ defColor );
+ _LIT( KFixptFormat, "%d" );
+ ( lColBuf.Des() ).Format( KFixptFormat, defColor );
+ }
+ else
+ {
+ _LIT( KFixptFormat, "%d" );
+ ( lColBuf.Des() ).Format( KFixptFormat, tempColor );
+ }
+ iCurrentElement->SetAttributeL( aName, lColBuf);
+ }
+ else
+ {
+ iCurrentElement->SetAttributeL( aName, aValue);
+ }
+ return ETrue;
+ }
+ return EFalse;
+
+ }
+
+
+// --------------------------------------------------------------------------
+// TBool CSvgContentHandler::ProcessStyleL( const TDesC& aValue )
+// ---------------------------------------------------------------------------
+TBool CSvgContentHandler::ProcessStyleL( const TDesC& aValue )
+ {
+ TPtrC remaining;
+ remaining.Set( aValue );
+ TPtrC name;
+ TPtrC value;
+
+ TInt semicolonIndex = remaining.Find( _L( ";" ) );
+ while ( semicolonIndex != KErrNotFound )
+ {
+ // make substring, excluding ';'
+ TPtrC nameValuePair;
+ nameValuePair.Set( remaining.Ptr(), semicolonIndex );
+
+ // Extract name, value
+ if ( ExtractStyleValuePair( nameValuePair, name, value ) )
+ {
+ // store property
+ TInt attributeID = (((CSvgDocumentImpl*)iDocument)->SchemaData())->GetPresentationAttributeId( name );
+ if ( attributeID != KErrNotFound )
+ iCurrentElement->SetPropertyL( attributeID, value );
+ else
+ iCurrentElement->SetAttributeL( name, value );
+ }
+
+ // shorten remaining, start at first character after semicolon
+ remaining.Set( (TUint16*)&remaining.Ptr()[semicolonIndex+1],
+ remaining.Length() - nameValuePair.Length() - 1 );
+ semicolonIndex = remaining.Find( _L( ";" ) );
+ }
+
+ // process remaining pair if exists
+ if ( ExtractStyleValuePair( remaining, name, value ) )
+ {
+ // store property
+ TInt attributeID = (((CSvgDocumentImpl*)iDocument)->SchemaData())->GetPresentationAttributeId( name );
+ if ( attributeID != KErrNotFound )
+ iCurrentElement->SetPropertyL( attributeID, value );
+ else
+ iCurrentElement->SetAttributeL( name, value );
+ }
+
+ return ETrue;
+}
+
+
+// --------------------------------------------------------------------------
+// TBool CSvgContentHandler::ProcessTransformL( const TDesC& /*aName*/,
+// ---------------------------------------------------------------------------
+TBool CSvgContentHandler::ProcessTransformL( const TDesC& /*aName*/,
+ const TDesC& aValue )
+ {
+
+ _LIT( KCb, ")" );
+ _LIT(KTransform ,"transform");
+
+ // Prepare the style value string for parsing
+ // Should be like transform=matrix( 1 0 0 1 6 6 )
+ // Notice the space after and not before ( and the space before )
+
+ HBufC* tFinal = HBufC::NewLC( aValue.Length() + 1000 );
+ TPtr tPf = tFinal->Des();
+
+ // 1. Copy to a temp buffer
+ HBufC* tBufC = HBufC::NewLC( aValue.Length() );// In case we need room for two extra spaces
+ TPtr tPtr = tBufC->Des();
+ tPtr.Copy( aValue );
+
+ // 2. Replace "funny" chars to spaces
+ tPtr.TrimAll();
+
+ TStringTokenizer lTokenizer ( tPtr, KCb );
+ while ( lTokenizer.HasMoreTokens() )
+ {
+ TPtrC lToken ( lTokenizer.NextToken( KCb ) );
+
+ TInt pos;
+ _LIT( KSp, " " );
+
+ HBufC* tBufC2 = HBufC::NewLC( lToken.Length() + 4 );
+ TPtr tPtr2 = tBufC2->Des();
+ tPtr2.Copy( lToken );
+ const TUint16* lValStr = tPtr2.Ptr();
+
+ // Remove spaces between transformation type keyword and (
+ pos = tPtr2.Locate( '(' );
+ while ( lValStr[pos - 1] == ' ' )
+ {
+ tPtr2.Delete( pos - 1, 1 );
+ lValStr = tPtr2.Ptr();
+ pos = tPtr2.Locate( '(' );
+ }
+
+ // Add space after (
+ pos = tPtr2.Locate( '(' );
+ if ( pos != KErrNotFound &&
+ pos < ( tPtr2.Length() - 1 ) &&
+ lValStr[pos + 1] != ' ' )
+ {
+ tPtr2.Insert( pos + 1, KSp );
+ lValStr = tPtr2.Ptr();
+ }
+
+ // Replace ',' with space
+ pos = tPtr2.Locate( ',' );
+ while ( pos != KErrNotFound )
+ {
+ tPtr2.Replace( pos, 1, KSp );
+ lValStr = tPtr2.Ptr();
+ pos = tPtr2.Locate( ',' );
+ }
+
+ // Add space at end
+ tPtr2.Append( KSp );
+ // Add ) to end
+ tPtr2.Append( KCb );
+ // Add space at end
+ tPtr2.Append( KSp );
+
+ const TUint16* lVal2 = tPtr2.Ptr();
+
+ tPf.Append( lVal2, tPtr2.Length() );
+ CleanupStack::PopAndDestroy( 1 ); // tBufC2
+ }
+
+ iCurrentElement->SetTransform(KTransform,tPf);
+
+ CleanupStack::PopAndDestroy( 2 ); // tBufC & TFinal
+ return ETrue;
+ }
+
+// --------------------------------------------------------------------------
+// TBool CSvgContentHandler::ProcessUnitsL( const TDesC& /*aName*/, const TDesC& /*aValue*/ )
+// ---------------------------------------------------------------------------
+TBool CSvgContentHandler::ProcessUnitsL( const TDesC& /*aName*/, const TDesC& /*aValue*/ )
+ {
+ return ETrue;
+ }
+
+/************** XML Entity Character Methods ****************/
+
+// --------------------------------------------------------------------------
+// void CSvgContentHandler::ConvertEntitiesToCharsL( CDesCArrayFlat& aArray )
+// ---------------------------------------------------------------------------
+void CSvgContentHandler::ConvertEntitiesToCharsL( CDesCArrayFlat& aArray )
+ {
+
+ TInt lCount = aArray.Count();
+ for ( TInt i = 0; i < lCount; i++ )
+ {
+ HBufC* substituteString = ConvertEntitiesToCharsL( aArray[i] );
+
+ if ( substituteString != NULL )
+ {
+ CleanupStack::PushL( substituteString );
+ aArray.Delete( i );
+ aArray.InsertL( i, *substituteString );
+ CleanupStack::PopAndDestroy(substituteString);
+ }
+ }
+ }
+
+// --------------------------------------------------------------------------
+// HBufC* CSvgContentHandler::ConvertEntitiesToCharsL( const TDesC& aString )
+// ---------------------------------------------------------------------------
+HBufC* CSvgContentHandler::ConvertEntitiesToCharsL( const TDesC& aString )
+ {
+ // no entity, return NULL
+ TInt pos = Find( aString, 0, '&' );
+ if ( pos == -1 )
+ {
+ return NULL;
+ }
+
+ HBufC* substituteString = HBufC::NewLC( aString.Length() );
+ TPtr ptr = substituteString->Des();
+
+ TInt endPos = 0;
+ TChar substituteChar = ' ';
+ while ( pos != -1 )
+ {
+ // copy up to pos
+ Append( ptr, aString, endPos, pos );
+
+ // no entity ending character, copy to end of string
+ endPos = Find( aString, pos, ';' );
+ if ( endPos == -1 )
+ {
+ endPos = aString.Length()-1;
+ }
+
+ endPos++;
+ HBufC* entity = SubstringL( aString, pos, endPos );
+ // entity is converted to char
+ if ( ConvertEntityToChar( substituteChar, *entity ) )
+ {
+ ptr.Append( substituteChar );
+ }
+ // no such entity, copy original string
+ else
+ {
+ ptr.Append( *entity );
+ }
+ delete entity;
+ pos = Find( aString, endPos, '&' );
+ }
+
+ // check end leftover
+ if ( endPos < aString.Length() )
+ {
+ Append( ptr, aString, endPos, aString.Length() );
+ }
+
+ CleanupStack::Pop( substituteString );
+ return substituteString;
+ }
+
+// --------------------------------------------------------------------------
+// TInt CSvgContentHandler::Find( const TDesC& aString, TInt aStartIndex, TChar aChar )
+// ---------------------------------------------------------------------------
+TInt CSvgContentHandler::Find( const TDesC& aString, TInt aStartIndex, TChar aChar )
+ {
+
+ TInt lCount = aString.Length();
+ for ( TInt i = aStartIndex; i < lCount; i++ )
+ {
+ if ( aString[i] == (TUint16)aChar )
+ {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+
+// --------------------------------------------------------------------------
+// HBufC* CSvgContentHandler::SubstringL( const TDesC& aString, TInt aStartIndex, TInt aEndIndex )
+// ---------------------------------------------------------------------------
+HBufC* CSvgContentHandler::SubstringL( const TDesC& aString, TInt aStartIndex, TInt aEndIndex )
+ {
+ HBufC* substring = HBufC::NewL( aEndIndex - aStartIndex );
+ TPtr ptr = substring->Des();
+
+ TInt lCount = aString.Length();
+ for ( TInt i = aStartIndex; i < aEndIndex && i < lCount ; i++ )
+ {
+ ptr.Append( aString[i] );
+ }
+
+ return substring;
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgContentHandler::Append( TDes& aDest, const TDesC& aSource, TInt aStartIndex, TInt aEndIndex )
+// ---------------------------------------------------------------------------
+void CSvgContentHandler::Append( TDes& aDest, const TDesC& aSource, TInt aStartIndex, TInt aEndIndex )
+ {
+
+ TInt lCount = aSource.Length();
+ for ( TInt i = aStartIndex; i < aEndIndex && i < lCount; i++ )
+ {
+ aDest.Append( aSource[i] );
+ }
+ }
+
+// --------------------------------------------------------------------------
+// TBool CSvgContentHandler::ConvertEntityToChar( TChar& aChar, const TDesC& aString )
+// ---------------------------------------------------------------------------
+TBool CSvgContentHandler::ConvertEntityToChar( TChar& aChar, const TDesC& aString )
+ {
+ if ( aString == _L( "&" ) )
+ {
+ aChar = '&';
+ }
+ else if ( aString == _L( """ ) )
+ {
+ aChar = '"';
+ }
+ else if ( aString == _L( "'" ) )
+ {
+ aChar = '\'';
+ }
+ else if ( aString == _L( "<" ) )
+ {
+ aChar = '<';
+ }
+ else if ( aString == _L( ">" ) )
+ {
+ aChar = '>';
+ }
+ // need to check for '&#xx'
+ else if ( ConvertHexStringToChar( aChar, aString ) )
+ {
+ }
+ else if ( ConvertDecimalStringToChar( aChar, aString ) )
+ {
+ }
+
+ return ETrue;
+ }
+
+// --------------------------------------------------------------------------
+// TBool CSvgContentHandler::ConvertDecimalStringToChar( TChar& aChar, const TDesC& aString )
+// ---------------------------------------------------------------------------
+TBool CSvgContentHandler::ConvertDecimalStringToChar( TChar& aChar, const TDesC& aString )
+ {
+ TLex parser( aString );
+ // skip '&'
+ parser.Inc();
+ if ( !parser.Eos() && parser.Peek() == '#' )
+ {
+ parser.Inc();
+ TUint value = 0;
+ if ( parser.Val( value, EDecimal ) == KErrNone )
+ {
+ aChar = value;
+ return ETrue;
+ }
+ }
+ return EFalse;
+ }
+
+// --------------------------------------------------------------------------
+// TBool CSvgContentHandler::ConvertHexStringToChar( TChar& aChar, const TDesC& aString )
+// ---------------------------------------------------------------------------
+TBool CSvgContentHandler::ConvertHexStringToChar( TChar& aChar, const TDesC& aString )
+ {
+ TLex parser( aString );
+ // skip '&'
+ parser.Inc();
+ if ( !parser.Eos() && parser.Peek() == '#' )
+ {
+ parser.Inc();
+ if ( !parser.Eos() && ( parser.Peek() == 'x' || parser.Peek() == 'X' ) )
+ {
+ parser.Inc();
+ TUint value = 0;
+ if ( parser.Val( value, EHex ) == KErrNone )
+ {
+ aChar = value;
+ return ETrue;
+ }
+ }
+ }
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+// Filter entity characters for cdata characters
+// ---------------------------------------------------------------------------
+void CSvgContentHandler::FilterCharactersL( TDesC& aString )
+ {
+ HBufC* filteredValue = ConvertEntitiesToCharsL( aString );
+
+ if ( filteredValue == NULL )
+ {
+ iCurrentElement->SetAttributeDesL( KAtrCdata, aString );
+ }
+ else
+ {
+ CleanupStack::PushL( filteredValue );
+ iCurrentElement->SetAttributeDesL( KAtrCdata, *filteredValue );
+ CleanupStack::PopAndDestroy(filteredValue);
+ }
+
+ }
+
+// ---------------------------------------------------------------------------
+// File Offset for the closing tag
+// ---------------------------------------------------------------------------
+void CSvgContentHandler::ReaderIndex(NW_Uint32 aIndex)
+ {
+ if ( iCurrentElement )
+ {
+ TUint8 id = iCurrentElement->ElemID();
+ TInt OrgLength;
+ if ( id == KSvgTextElement || id == KSvgTextAreaElement)
+ {
+ if(id==KSvgTextElement)
+ {
+ OrgLength = ((CSvgTextElementImpl *)iCurrentElement)->GetOrgLength();
+ if(!OrgLength)
+ ((CSvgTextElementImpl *)iCurrentElement)->SetFileOffset(aIndex);
+ }
+ else
+ {
+ OrgLength = ((CSvgTextAreaElementImpl *)iCurrentElement)->GetOrgLength();
+ if(!OrgLength)
+ ((CSvgTextAreaElementImpl *)iCurrentElement)->SetFileOffset(aIndex);
+ }
+ }
+ }
+ // Set the current element pointer back to parent as we are
+ // going up the tree now.
+ iCurrentElement = iCurrentParentElement;
+ }
+
+
+// --------------------------------------------------------------------------
+// TBool CSvgContentHandler::ProcessNConvertAttrL( const TDesC& aName, const TDesC& aAttrName,const TDesC& aAttrValue )
+// ---------------------------------------------------------------------------
+TBool CSvgContentHandler::ProcessNConvertAttrL( const TDesC& aName, const TDesC& aAttrName,const TDesC& aAttrValue )
+ {
+
+ TInt tmpAttrID = 0;
+ TBool isSvgElement = EFalse ;
+
+ if (
+ (iCurrentElement->ElemID() == KSvgSvgElement)
+ && ( aAttrName == WIDTH )
+ )
+ {
+ TInt lFindValue = aAttrValue.Locate('%');
+ isSvgElement = ETrue ;
+ if (lFindValue != KErrNotFound)
+ {
+ ((CSvgSvgElementImpl *)iCurrentElement)->iWidthInPercentage = ETrue;
+ TLex lLex(aAttrValue);
+ TReal32 attValue=0;
+ if (lLex.Val(attValue, '.' ) == KErrNone)
+ {
+ ((CSvgSvgElementImpl *)iCurrentElement)->iWidthInUserCoordinate = attValue;
+ }
+ }
+ else
+ {
+ ((CSvgSvgElementImpl *)iCurrentElement)->iWidthInPercentage = EFalse;
+ }
+
+ }
+ if (
+ (iCurrentElement->ElemID() == KSvgSvgElement)
+ && ( aAttrName == HEIGHT )
+ )
+ {
+ TInt lFindValue = aAttrValue.Locate('%');
+ isSvgElement = ETrue ;
+ if (lFindValue != KErrNotFound)
+ {
+ ((CSvgSvgElementImpl *)iCurrentElement)->iHeightInPercentage = ETrue;
+ TLex lLex(aAttrValue);
+ TReal32 attValue=0;
+ if (lLex.Val(attValue, '.' ) == KErrNone)
+ {
+ ((CSvgSvgElementImpl *)iCurrentElement)->iHeightInUserCoordinate = attValue;
+ }
+ }
+ else
+ {
+ ((CSvgSvgElementImpl *)iCurrentElement)->iHeightInPercentage = EFalse;
+ }
+ }
+ //#ifdef RD_SVGT_MEDIAANIMATION_SUPPORT
+ if (aName ==_L("animation") )
+ {
+
+ _LIT(KX, "x");
+ _LIT(KY, "y");
+ if(aAttrName == WIDTH || aAttrName == HEIGHT )
+ {
+ TLex lLex(aAttrValue);
+ TReal32 attValue=0;
+ if (lLex.Val(attValue, '.' ) == KErrNone)
+ {
+ if ( attValue < 0 )//if values are negative then default to 0
+ attValue = 0;
+ if( aAttrName == WIDTH )
+ ((CSvgMediaAnimationElementImpl *)iCurrentElement)->SetWidth(attValue);
+ else
+ ((CSvgMediaAnimationElementImpl *)iCurrentElement)->SetHeight(attValue);
+
+ }
+ return ETrue;
+ }
+
+ if(!(aAttrName == KX) && !(aAttrName == KY ))
+ {
+ HBufC* tBufC = HBufC::NewLC( aAttrValue.Length() );
+ TPtr tPtr ( tBufC->Des() );
+ tPtr.Copy( aAttrValue );
+ tPtr.TrimAll();
+ iCurrentElement->SetAttributeL(aAttrName,tPtr );
+ CleanupStack::PopAndDestroy( 1 ); // tBufC
+ return ETrue;
+ }
+
+
+ }
+ //endif
+ if ( !iBeginEndAtr && ( aAttrName == BEGIN || aAttrName == END ) )
+ {
+
+ if ( ( aAttrValue.Find( MOUSEDOWN ) != KErrNotFound ) ||
+ ( aAttrValue.Find( MOUSEUP ) != KErrNotFound ) ||
+ ( aAttrValue.Find( MOUSEOVER ) != KErrNotFound ) ||
+ ( aAttrValue.Find( MOUSEMOVE ) != KErrNotFound ) ||
+ ( aAttrValue.Find( MOUSEOUT ) != KErrNotFound ) ||
+ ( aAttrValue.Find( FOCUSIN ) != KErrNotFound ) ||
+ ( aAttrValue.Find( FOCUSOUT ) != KErrNotFound ) ||
+ ( aAttrValue.Find( ACTIVATE ) != KErrNotFound ) ||
+ ( aAttrValue.Find( CLICK ) != KErrNotFound ) ||
+ ( aAttrValue.Find( ACCESS ) != KErrNotFound ) )
+
+ iBeginEndAtr = ETrue;
+ }
+
+ if( iCurrentElement->ElemID() < KSvgAnimateElement || iCurrentElement->ElemID() > KSvgSetElement )
+ {
+ tmpAttrID = (( ( CSvgDocumentImpl* ) iDocument )->SchemaData())->GetPresentationAttributeId(aAttrName);
+ if( tmpAttrID != KErrNotFound )
+ {
+ iCurrentElement->SetPropertyL( tmpAttrID, aAttrValue);
+ return ETrue;
+ }
+ }
+
+ tmpAttrID = (( ( CSvgDocumentImpl* ) iDocument )->SchemaData())->GetSVGTAttributeId(aAttrName);
+
+ if ( iCurrentElement->ElemID() == KSvgTextAreaElement && aAttrName == _L("editable") )
+ {
+ ((CSvgTextAreaElementImpl*)iCurrentElement)->SetEditable( aAttrValue );
+ }
+ if ( iCurrentElement->ElemID() == KSvgTextElement && aAttrName == _L("editable") )
+ {
+ ((CSvgTextElementImpl*)iCurrentElement)->SetEditable( aAttrValue );
+ }
+
+ if ( iCurrentElement->ElemID() >= KSvgMediaElemsStartIndex &&
+ iCurrentElement->ElemID() <= KSvgMediaElemsEndIndex )
+ {
+ TBool lIsAttrProcessed = ETrue;
+ switch ( tmpAttrID )
+ {
+ case KAtrSyncBehavior:
+ ((CSvgMediaElementBase* )iCurrentElement)->SetSyncBehavior(
+ aAttrValue );
+ break;
+ case KAtrSyncTolerance:
+ ((CSvgMediaElementBase* )iCurrentElement)->SetSyncTolerance(
+ aAttrValue );
+ break;
+ case KAtrSyncMaster:
+ ((CSvgMediaElementBase* )iCurrentElement)->SetSyncMaster(
+ aAttrValue );
+ break;
+ default:
+ lIsAttrProcessed = EFalse;
+ }
+ if ( lIsAttrProcessed )
+ {
+ return ETrue;
+ }
+ }
+
+ if ( iCurrentElement->ElemID() == KSvgSvgElement )
+ {
+ TBool lIsAttrProcessed = ETrue;
+ switch ( tmpAttrID )
+ {
+ case KAtrSyncBehaviorDefault:
+ ((CSvgSvgElementImpl* )iCurrentElement)->SetSyncBehaviorDefault(
+ aAttrValue );
+ break;
+ case KAtrSyncToleranceDefault:
+ ((CSvgSvgElementImpl* )iCurrentElement)->SetSyncToleranceDefault(
+ aAttrValue );
+ break;
+ default:
+ lIsAttrProcessed = EFalse;
+ }
+ if ( lIsAttrProcessed )
+ {
+ return ETrue;
+ }
+ }
+
+ if ( iCurrentElement->ElemID() == KSvgMediaAnimationElement &&
+ tmpAttrID == KAtrInitialVisibility )
+ {
+ // Merge with the animation->SetInitialVisibility here.
+ return ETrue;
+ }
+
+
+ if((tmpAttrID == KAtrOffset)|| ((tmpAttrID >= KSvgNotHandledAttrsIndex
+ || (tmpAttrID==KAtrRotate && iCurrentElement->ElemID()==KSvgAnimateMotionElement)) && (tmpAttrID != KAtrValues )
+ && (tmpAttrID != KAtrKeySplines) && ( tmpAttrID != KAtrKeyTimes))
+ &&(tmpAttrID != KAtrFx)&& (tmpAttrID != KAtrFy)&& (tmpAttrID != KAtrGradientTransform)
+ && (aName !=_L("animation") ) )
+ {
+ HBufC* tBufC = HBufC::NewLC( aAttrValue.Length() );
+ TPtr tPtr ( tBufC->Des() );
+ tPtr.Copy( aAttrValue );
+ tPtr.TrimAll();
+ TInt errorCode = iCurrentElement->SetAttributeL(aAttrName,tPtr );
+ if(errorCode == KErrReferencedElementNotFound)
+ {
+ //Error Code returned By USE Element when Forward reference element not Found
+ iUseElementArray->AppendL(iCurrentElement);
+ }
+ if(errorCode == KErrAnimateReferenceElementNotFound )
+ {
+ //Error Code returned By Animation Element when Forward reference element not Found
+ iAnimRefElementArray->AppendL(iCurrentElement);
+ }
+
+ CleanupStack::PopAndDestroy( 1 );
+
+ }
+ else if( tmpAttrID == KAtrAttributeName )
+ {
+ if( aAttrValue == FILL || aAttrValue == STROKE || aAttrValue == COLOR
+ || aAttrValue == STOP_COLOR )
+ {
+ iIsColorAnim = ETrue;
+ }
+ HBufC* tBufC = HBufC::NewLC( aAttrValue.Length() );
+ TPtr tPtr ( tBufC->Des() );
+ tPtr.Copy( aAttrValue );
+ tPtr.TrimAll();
+ iCurrentElement->SetAttributeL(aAttrName,tPtr );
+ CleanupStack::PopAndDestroy( 1 );
+ }
+ else if( tmpAttrID == KAtrValues )
+ {
+ iValues.Set(TPtrC( aAttrValue ) );
+ }
+ else if( tmpAttrID == KAtrKeyTimes )
+ {
+ iTimes.Set(TPtrC( aAttrValue ));
+ }
+ else if( tmpAttrID == KAtrKeySplines )
+ {
+ iSplines.Set(TPtrC (aAttrValue));
+ }
+ else if( tmpAttrID == KAtrTransform &&
+ (iCurrentElement->ElemID() != KSvgRadialGradientElement && iCurrentElement->ElemID()
+ != KSvgLinearGradientElement)
+ )
+ {
+ ProcessTransformL(aAttrName,aAttrValue );
+ }
+ //Added the below else-if block to support the % values for X1,Y1,X2,Y2 of LinearGradient element.
+ else if( tmpAttrID >= KAtrY1 && tmpAttrID <= KAtrX2 && iCurrentElement->ElemID() == KSvgLinearGradientElement )
+ {
+ iCurrentElement->SetAttributeL( aAttrName , aAttrValue);
+ }
+ else if (tmpAttrID == KAtrGradientTransform &&
+ (iCurrentElement->ElemID() == KSvgRadialGradientElement || iCurrentElement->ElemID()
+ == KSvgLinearGradientElement))
+ {
+ ProcessTransformL(aAttrName,aAttrValue );
+
+ }
+ else if( tmpAttrID == KAtrStyle )
+ {
+ ProcessStyleL(aAttrValue);
+ }
+
+ else if( tmpAttrID == KAtrFrom)
+ {
+ iFromVal.Set( TPtrC( aAttrValue ) );
+ }
+ else if( tmpAttrID == KAtrTo)
+ {
+ iToVal.Set( TPtrC( aAttrValue ) );
+ }
+ else if ( tmpAttrID == KAtrBy )
+ {
+ iByVal.Set( TPtrC( aAttrValue ) );
+ }
+ else if (( tmpAttrID >= KSvgDesAttrsIndex ||
+ (iCurrentElement->ElemID() == KSvgTextElement &&
+ (tmpAttrID == KAtrX || tmpAttrID == KAtrY))) && (tmpAttrID != KAtrFx)&& (tmpAttrID != KAtrFy)
+ &&(aName !=_L("animation") ) )
+
+
+ {
+ iCurrentElement->SetAttributeDesL( tmpAttrID, aAttrValue);
+ }
+ else if ( iCurrentElement->ElemID() == KSvgScriptElement )
+ {
+ iCurrentElement->SetAttributeL( aAttrName, aAttrValue);
+ }
+ else
+ {
+ // check if the datatype is lenth.datatype or coordinate.datatype
+ TUint8 datatype = ( (TUint8) (tmpAttrID < KSvgCoordAttrStartIndex ? KSVG_LENGTH_TYPE : KSVG_COORDINATE_TYPE) );
+ TReal32 convertedValue;
+ if( CSvgAttributeVerifier::ValidAttrValue(aAttrValue, convertedValue, datatype, aAttrName, isSvgElement) )
+ {
+ //check for valid width height
+ //specific checking for svgElement width height
+ //particularly the case when width height values
+ //in percentages cannot be greater than 100
+ if( iCurrentElement->ElemID() == KSvgSvgElement )
+ {
+ if(
+ (aAttrName == WIDTH )
+ &&(((CSvgSvgElementImpl *)iCurrentElement)->iWidthInPercentage)
+ )
+ {
+ if(convertedValue > 100)
+ convertedValue = 100;
+ }
+
+ if(
+ (aAttrName == HEIGHT)
+ &&(((CSvgSvgElementImpl *)iCurrentElement)->iHeightInPercentage)
+ )
+ {
+ if(convertedValue > 100)
+ convertedValue = 100;
+ }
+ }
+ if((tmpAttrID < KSvgDesAttrsIndex) || (tmpAttrID == KAtrFy || tmpAttrID == KAtrFx))
+ {
+ iCurrentElement->SetAttributeFloatL( tmpAttrID, ((TFloatFixPt) convertedValue));
+ }
+ else
+ {
+ iCurrentElement->SetAttributeIntL( tmpAttrID, (TInt) convertedValue );
+ }
+ }
+ else
+ {
+ //if invalid width height specified then
+ //set width/height values as zero
+ if(
+ ( iCurrentElement->ElemID() == KSvgSvgElement )
+ &&(aAttrName == WIDTH || aAttrName == HEIGHT)
+ )
+ {
+ convertedValue = 0;
+ iCurrentElement->SetAttributeFloatL( tmpAttrID, (TFloatFixPt) convertedValue );
+ }
+ _LIT(STRING1, "Invalid \"");
+ _LIT(STRING2, "\" value for <");
+ _LIT(STRING3, "> : \"");
+ _LIT(STRING4, "\"" );
+ iSvgError->SetErrorCode( ESvgInvalidAttributeValue );
+ iSvgError->SetIsWarning( ETrue );
+ iSvgError->SetDescription( STRING1 );
+ iSvgError->AppendDescription( aAttrName);
+ iSvgError->AppendDescription( STRING2 );
+ iSvgError->AppendDescription( aName );
+ iSvgError->AppendDescription( STRING3 );
+ iSvgError->AppendDescription( aAttrValue );
+ iSvgError->AppendDescription( STRING4 );
+ }
+ return ETrue;
+ }
+ return ETrue;
+ }
+
+// --------------------------------------------------------------------------
+// TBool CSvgContentHandler::ExtractStyleValuePair( const TDesC& aString, TPtrC& aName, TPtrC& aValue )
+// ---------------------------------------------------------------------------
+TBool CSvgContentHandler::ExtractStyleValuePair( const TDesC& aString, TPtrC& aName, TPtrC& aValue )
+{
+ // find pair divide char index ":"
+ TInt colonIndex = aString.Find( _L( ":" ) );
+
+ // ':' not found
+ if ( colonIndex == KErrNotFound )
+ return EFalse;
+
+ // Skip front white spaces
+ TInt end = aString.Length();
+ TInt frontIndex = 0;
+ while ( frontIndex < end && TChar( aString[frontIndex] ).IsSpace() )
+ frontIndex++;
+
+ // skip back white spaces
+ TInt backIndex = colonIndex - 1;
+ while ( backIndex > frontIndex && TChar( aString[backIndex] ).IsSpace() )
+ backIndex--;
+
+ aName.Set( (TUint16*)&aString.Ptr()[frontIndex], backIndex - frontIndex + 1 );
+
+ // parse for value
+ // skip front spaces
+ frontIndex = colonIndex + 1;
+ while ( frontIndex < end && TChar( aString[frontIndex] ).IsSpace() )
+ frontIndex++;
+
+ // assuming ';' is not passed in at the end
+ // start from end and skip spaces
+ backIndex = end - 1;
+ while ( backIndex > frontIndex && TChar( aString[backIndex] ).IsSpace() )
+ backIndex--;
+
+ aValue.Set( (TUint16*)&aString.Ptr()[frontIndex], backIndex - frontIndex + 1 );
+
+ return ETrue;
+}
+
+// --------------------------------------------------------------------------
+// void CSvgContentHandler::SetForwardReferences(CSvgErrorImpl& aError)
+// ---------------------------------------------------------------------------
+void CSvgContentHandler::SetForwardReferences(CSvgErrorImpl& aError)
+{
+ /*Once the whole DOM is constructed, Forward references need to be set*/
+ /*For USE elements*/
+ TInt lCount = iUseElementArray->Count();
+ TInt lIndex = 0;
+ TInt error = KErrNone;
+
+ while(lIndex < lCount)
+ {
+ TPtrC tPtr2 = ((CSvgElementImpl*)iUseElementArray->operator[](lIndex ))->Href();
+ if(((CSvgUseElementImpl *)iUseElementArray->operator[](lIndex ))->SetRefElemById(tPtr2) != KErrNotFound)
+ {
+ TRAP(error ,((CSvgUseElementImpl *)iUseElementArray->operator[](lIndex ))->SetReferenceElementL());
+ }
+ else
+ {
+ aError.SetErrorCode( ESvgInvalidAttributeValue );
+ _LIT(STRING1, "Invalid attribute \n");
+ _LIT(STRING2, "USE element has invalid xlink:href attribute");
+ aError.SetDescription( STRING1 );
+ aError.AppendDescription( STRING2 );
+ aError.SetIsWarning( EFalse );
+ break;
+ }
+
+ lIndex ++;
+ }
+
+ /*For Animation Elements*/
+ lCount = iAnimRefElementArray->Count();
+ lIndex = 0;
+ while(lIndex < lCount)
+ {
+ TPtrC tPtr2 = ((CSvgElementImpl*)iAnimRefElementArray->operator[](lIndex ))->Href();
+ ((CSvgAnimationBase *)iAnimRefElementArray->operator[](lIndex ))->SetRefElemById(tPtr2);
+ lIndex ++;
+ }
+
+
+ /*For Animation elements */
+ lCount = iAnimationElementArray->Count();
+ lIndex = 0;
+ while(lIndex < lCount)
+ {
+// ((CSvgAnimationElementImpl *)iAnimationElementArray->operator[](lIndex))->ResetEventListener();
+ ((CSvgAnimationBase *)iAnimationElementArray->operator[](lIndex))->CheckBeginTime();
+ lIndex ++;
+ }
+
+}
+
+//---------------------------------------------------
+//Removal of elements that dont pass
+//required extensions, required features, and system language
+//requirements
+//will flag as invisible if remove flag not turned on
+//switch statement is special case were only the first one
+//that passes these requirements will be used so toss the rest
+//---------------------------------------------------
+void CSvgContentHandler::RemoveFalseElementsOrMakeInvisible()
+ {
+ if ( iReqFetAttSysArray == NULL )
+ {
+ // Error Case
+ return;
+ }
+
+ //loop through the list of elements with required features, attributes, or sys language
+ TInt reqFetAttSysArrayCnt = iReqFetAttSysArray->Count();
+ // Start processing from the end of the list so to follow the LIFO principle (process
+ // from leaf node to root of DOM tree).
+ while ( reqFetAttSysArrayCnt > 0 )
+ {
+ // Access the last element in the array
+ CSvgElementImpl* lCurElement = ( CSvgElementImpl* )
+ iReqFetAttSysArray->operator[]( reqFetAttSysArrayCnt - 1 );
+
+ if ( lCurElement != NULL )
+ {
+ // Save the parent node as this would be required for removing
+ // this element from the DOM tree
+ CSvgElementImpl* lParent = ( CSvgElementImpl* )
+ lCurElement->ParentNode();
+
+ if ( lParent == NULL )
+ {
+ iReqFetAttSysArray->Reset();
+ return;
+ }
+
+ //just a normal element check it and remove it if it doesnt pass
+ TBool lResult = EFalse;
+ TRAPD(error, lResult = VerifyReqExReqFtrSysL( lCurElement ));
+ if ( error == KErrNone && !lResult )
+ {
+ if ( iRemoveFalseSwitchElements )
+ {
+ // Remove references of this element in Content Handler
+ // This function removes the element from the iReqFetAttSysArray as well
+ RemoveInternalReferences( lCurElement );
+ lParent->RemoveChild( lCurElement);
+ delete lCurElement;
+ lCurElement = NULL;
+ }
+ else
+ {
+ //if not removing elements then at least set to false
+ TRAP_IGNORE(
+ lCurElement->SetAttributeIntL(
+ KCSS_ATTR_VISIBILITY, 1 ) );
+ // Remove the element from the iReqFetAttSysArray
+ iReqFetAttSysArray->Remove( reqFetAttSysArrayCnt - 1 );
+ } // if ( iRemoveFalseSwitchElements )
+ }
+ else
+ {
+ // Remove the element from the iReqFetAttSysArray
+ iReqFetAttSysArray->Remove( reqFetAttSysArrayCnt - 1 );
+ } // if ( error == KErrNone && !lResult )
+ }
+ else
+ {
+ // Remove the element from the iReqFetAttSysArray
+ iReqFetAttSysArray->Remove( reqFetAttSysArrayCnt - 1 );
+ } // if ( lCurElement != NULL )
+
+ // Update the array count
+ reqFetAttSysArrayCnt = iReqFetAttSysArray->Count();
+ } // while ( reqFetAttSysArrayCnt > 0 )
+ // Reset the array as it is no longer required.
+ iReqFetAttSysArray->Reset();
+ }
+
+
+
+// --------------------------------------------------------------------------
+// void CSvgContentHandler::RemoveStyleProperties()
+// ---------------------------------------------------------------------------
+/*
+
+//MEMORY MANAGER now in charge of style deletion
+void CSvgContentHandler::RemoveStyleProperties(CSvgElementImpl* aElement)
+ {
+ CSvgElementImpl* child = (CSvgElementImpl*)aElement->FirstChild();
+ while ( child != NULL )
+ {
+ child->DeleteStyleProperties(child);
+ RemoveStyleProperties( child );
+ child = (CSvgElementImpl*)child->NextSibling();
+ }
+ }
+*/
+
+
+// --------------------------------------------------------------------------
+// void CSvgContentHandler::RemoveFalseSwitchCases()
+// ---------------------------------------------------------------------------
+void CSvgContentHandler::RemoveFalseSwitchCasesOrMakeInvisible()
+ {
+ if ( iSwitchElementArray == NULL )
+ {
+ // Error Case
+ return;
+ }
+
+ TInt switchEleArrayCnt = iSwitchElementArray->Count();
+
+ while ( switchEleArrayCnt > 0 )
+ {
+ TBool foundTrue = EFalse;
+ CSvgElementImpl* curSwitchElem =
+ (CSvgElementImpl*)iSwitchElementArray->operator[]( switchEleArrayCnt - 1 );
+ // Remove the switch element from the array. This is done here as
+ // below statements could result in iSwitchElementArray getting modified
+ // in RemoveInternalReferences.
+ iSwitchElementArray->Remove( switchEleArrayCnt - 1 );
+ if ( curSwitchElem != NULL )
+ {
+ //get the first child...which is where the first
+ CSvgElementImpl* curCaseElem = (CSvgElementImpl*)curSwitchElem->FirstChild();
+
+ while ( curCaseElem != NULL )
+ {
+ CSvgElementImpl* nextCaseElem = (CSvgElementImpl*)curCaseElem->NextSibling();
+ // foundTrue is set to TRUE when an element whose test passes is found. The
+ // subsequent elements are to be removed.
+ if ( foundTrue )
+ {
+ if ( iRemoveFalseSwitchElements )
+ {
+ //already found the true case in the switch delete the rest
+ // Remove references of this element in Content Handler
+ // This function removes the element from the
+ // iSwitchElementArray as well
+ RemoveInternalReferences( curCaseElem );
+ curSwitchElem->RemoveChild( curCaseElem );
+ delete ( CXmlElementImpl* )curCaseElem;
+ curCaseElem = NULL;
+ }
+ else
+ {
+ //not removing elements from tree just make invisible
+ TRAP_IGNORE( curCaseElem->SetAttributeIntL( KCSS_ATTR_VISIBILITY, 1 ) );
+ }
+ }
+ else
+ {
+ // Not yet found an element whose test passes,
+ // perform the test on the current element to check
+ // whether it does.
+ TBool result= EFalse;
+ TRAPD( error, result= VerifyReqExReqFtrSysL( curCaseElem ) );
+ if ( error == KErrNone )
+ {
+ if ( !result )
+ {
+ if ( iRemoveFalseSwitchElements )
+ {
+ // this element doesnt meet the switch requirements
+ // delete it and its children
+ // Remove references of this element in Content Handler
+ // This function removes the element from the
+ // iSwitchElementArray as well
+ RemoveInternalReferences( curCaseElem );
+ curSwitchElem->RemoveChild( curCaseElem );
+ delete ( CXmlElementImpl* )curCaseElem;
+ curCaseElem = NULL;
+ }
+ else
+ {
+ //not removing elements from tree just make invisible
+ TRAP_IGNORE( curCaseElem->SetAttributeIntL(
+ KCSS_ATTR_VISIBILITY, 1 ) );
+ }
+ }
+ else
+ {
+ //one evaluated to true so keep it but go ahead and delete the rest in the switch
+ //should only be one child for switch in end
+ foundTrue = ETrue;
+ }
+ }
+ } // if ( foundTrue )
+
+ // Check the next case element
+ curCaseElem = nextCaseElem;
+ } // while ( curCaseElem != NULL )
+ } // if ( curSwitchElem != NULL )
+ // Update the count of elements
+ switchEleArrayCnt = iSwitchElementArray->Count();
+ } // while ( switchEleArrayCnt > 0 )
+ // Reset the array as it is no longer required.
+ iSwitchElementArray->Reset();
+ }
+
+//---------------------------------------------------
+//Check to see
+//required extensions, required features, and system language
+//requirements
+//---------------------------------------------------
+TBool CSvgContentHandler::VerifyReqExReqFtrSysL( CSvgElementImpl* aElement )
+{
+ const CDesCArrayFlat* tempTestArray = NULL; // 'const' keyword added due to S60 (CW) build team recommendation
+
+ TBool doDraw = ETrue;
+
+ // First check for requiredExtensions
+ aElement->GetRequiredExtensions( tempTestArray );
+
+ if ( tempTestArray && tempTestArray->MdcaCount() )
+ {
+ // Check for all entries in requiredExtensions
+
+ TInt lCount = tempTestArray->MdcaCount();
+
+ for ( TInt i = 0; i < lCount; i++ )
+ {
+ TPtrC tmpPtr = tempTestArray->MdcaPoint( i );
+ if ( tmpPtr.Length() )
+ {
+ doDraw = EFalse;
+ break;
+ }
+ else if ( aElement->HasExtension( tmpPtr ) == EFalse )
+ {
+ doDraw = EFalse;
+ break;
+ }
+ }
+ }
+
+ // Second, check for requiredFeatures
+ aElement->GetRequiredFeatures( tempTestArray );
+ if ( tempTestArray && tempTestArray->MdcaCount() && doDraw)
+ {
+ // Check for all entries in requiredFeatures
+ TInt lCount = tempTestArray->MdcaCount();
+ for ( TInt i = 0; i < lCount; i++ )
+ {
+ TPtrC tmpPtr = tempTestArray->MdcaPoint( i );
+ if ( aElement->HasFeature( tmpPtr ) == EFalse )
+ {
+ doDraw = EFalse;
+ break;
+ }
+ }
+ }
+
+ //set up so it only gets it once...
+ //just fetch it one time...
+ if (iSystemLanguage->Length() == 0)
+ {
+ SystemLanguage( iSystemLanguage->Des() );
+ }
+
+ // Third, check for systemLanguage
+ // SYSTEM LANGUAGE DOESNT NEED TO BE STORED IN SEPERATE ARRAY INDEXES
+ // COULD HAVE JUST STORED IT AS ONE BIG STRING AND USE FINDF without the loop
+ TBool lIsNotEmptyString = aElement->GetSystemLanguage( tempTestArray );
+
+ if (!lIsNotEmptyString)
+ {
+ //system language was empty string so dont draw
+ return EFalse;
+ }
+
+ TBool doDrawSystem = EFalse;
+ if ( tempTestArray && tempTestArray->MdcaCount() && doDraw)
+ {
+ TInt lCount = tempTestArray->MdcaCount();
+
+ for ( TInt i = 0; i < lCount; i++ )
+ {
+ TPtrC tmpPtr = tempTestArray->MdcaPoint( i );
+
+ //tmpPtr is the language that was on the element
+ //match entire content specified string to system systemlanguage
+ if ( tmpPtr.FindF( iSystemLanguage->Des() ) == 0 )
+ {
+ doDrawSystem = ETrue;
+ break;
+ }
+
+ //match just the prefix of the system systemlanugage to the content specified syslang
+ if ( iSystemLanguage->Des().Left(2).FindF(tmpPtr) == 0 )
+ {
+ doDrawSystem = ETrue;
+ break;
+ }
+ }
+
+ if (doDrawSystem == EFalse)
+ {
+ doDraw = EFalse;
+ }
+ }
+
+ return doDraw;
+}
+
+// --------------------------------------------------------------------------
+// void CSvgContentHandler::SystemLanguage( TPtr aValue )
+// ---------------------------------------------------------------------------
+void CSvgContentHandler::SystemLanguage( TPtr aValue )
+ {
+ _LIT( KEn, "en" );
+ _LIT( KFr, "fr" );
+ _LIT( KDe, "de" );
+ _LIT( KEs, "es" );
+
+ _LIT( KAf, "af" );
+ _LIT( KAm, "am" );
+ _LIT( KAr, "ar" );
+ _LIT( KBg, "bg" );
+ _LIT( KBn, "bn" );
+ _LIT( KBo, "bo" );
+ _LIT( KCa, "ca" );
+ _LIT( KCs, "cs" );
+ _LIT( KCy, "cy" );
+ _LIT( KDa, "da" );
+ _LIT( KEl, "el" );
+ _LIT( KEt, "et" );
+ _LIT( KFa, "fa" );
+ _LIT( KFi, "fi" );
+ _LIT( KGa, "ga" );
+ _LIT( KGd, "gd" );
+ _LIT( KGu, "gu" );
+ _LIT( KHe, "he" );
+ _LIT( KHi, "hi" );
+ _LIT( KHu, "hu" );
+ _LIT( KHr, "hr" );
+ _LIT( KHy, "hy" );
+ _LIT( KId, "id" );
+ _LIT( KIs, "is" );
+ _LIT( KIt, "it" );
+ _LIT( KJa, "ja" );
+ _LIT( KKa, "ka" );
+ _LIT( KKk, "kk" );
+ _LIT( KKm, "km" );
+ _LIT( KKn, "kn" );
+ _LIT( KKo, "ko" );
+ _LIT( KLo, "lo" );
+ _LIT( KLt, "lt" );
+ _LIT( KLv, "lv" );
+ _LIT( KMk, "mk" );
+ _LIT( KMl, "ml" );
+ _LIT( KMn, "mn" );
+ _LIT( KMo, "mo" );
+ _LIT( KMr, "mr" );
+ _LIT( KMs, "ms" );
+ _LIT( KMy, "my" );
+ _LIT( KNo, "no" );
+ _LIT( KNl, "nl" );
+ _LIT( KPa, "pa" );
+ _LIT( KPl, "pl" );
+ _LIT( KPt, "pt" );
+ _LIT( KRo, "ro" );
+ _LIT( KRu, "ru" );
+ _LIT( KSi, "si" );
+ _LIT( KSk, "sk" );
+ _LIT( KSl, "sl" );
+ _LIT( KSo, "so" );
+ _LIT( KSr, "sr" );
+ _LIT( KSq, "sq" );
+ _LIT( KSv, "sv" );
+ _LIT( KSw, "sw" );
+ _LIT( KTa, "ta" );
+ _LIT( KTe, "te" );
+ _LIT( KTh, "th" );
+ _LIT( KTi, "ti" );
+ _LIT( KTk, "tk" );
+ _LIT( KTl, "tl" );
+ _LIT( KTr, "tr" );
+ _LIT( KUk, "uk" );
+ _LIT( KUr, "ur" );
+ _LIT( KVi, "vi" );
+ //_LIT( KZh, "zh" );
+ _LIT( KZu, "zu" );
+
+ _LIT( KEnB, "en-UK");
+ _LIT( KEnUS, "en-US");
+ _LIT( KZhTW, "zh-TW");
+ _LIT( KZhHK, "zh-HK");
+ _LIT( KZhCN, "zh-CN");
+ _LIT( KFrCA, "fr-CA");
+ _LIT( KPtBR, "pt-BR");
+ _LIT( KEnTW, "en-TW");
+ _LIT( KEnHK, "en-HK");
+ _LIT( KEnCN, "en-CN");
+ _LIT( KEnJP, "en-JP");
+ _LIT( KEnTH, "en-TH");
+ _LIT( KEsAR, "es-AR");
+ _LIT( KMsAP, "ms-AP");
+ _LIT( KEnAP, "en-AP" ); // KLangApacEnglish
+ _LIT( KIdAP, "id-AP" ); // KLangApacIndonesian
+ _LIT( KEu, "eu" ); // KLangBasque
+ _LIT( KGl, "gl" ); // KLangGalician
+
+
+ _LIT(KDefault, "qqqqq");
+
+ switch ( User::Language() )
+ {
+ case ELangTest:
+ aValue = KEn;
+ break;
+
+ case ELangEnglish:
+ aValue = KEnB;
+ break;
+ case ELangAmerican:
+ aValue = KEnUS;
+ break;
+ case ELangAustralian:
+ case ELangNewZealand:
+ case ELangCanadianEnglish:
+ case ELangSouthAfricanEnglish:
+ case ELangInternationalEnglish:
+ aValue = KEn;
+ break;
+
+ case ELangFrench:
+ case ELangSwissFrench:
+ case ELangBelgianFrench:
+ aValue = KFr;
+ break;
+
+ case ELangGerman:
+ case ELangAustrian:
+ case ELangSwissGerman:
+ aValue = KDe;
+ break;
+
+ case ELangSpanish:
+ case ELangInternationalSpanish:
+ aValue = KEs;
+ break;
+
+ case ELangLatinAmericanSpanish:
+ aValue = KEsAR;
+ break;
+
+ case ELangItalian:
+ case ELangSwissItalian:
+ aValue = KIt;
+ break;
+
+ case ELangSwedish:
+ case ELangFinlandSwedish:
+ aValue = KSv;
+ break;
+
+ case ELangDanish:
+ aValue = KDa;
+ break;
+
+ case ELangNorwegian:
+ case ELangNorwegianNynorsk:
+ aValue = KNo;
+ break;
+
+ case ELangFinnish:
+ aValue = KFi;
+ break;
+
+ case ELangBrazilianPortuguese:
+ aValue = KPtBR;
+ break;
+
+ case ELangPortuguese:
+ aValue = KPt;
+ break;
+
+ case ELangTurkish:
+ case ELangCyprusTurkish:
+ aValue = KTr;
+ break;
+
+ case ELangIcelandic:
+ aValue = KIs;
+ break;
+
+ case ELangRussian:
+ case ELangBelarussian:
+ aValue = KRu;
+ break;
+
+ case ELangHungarian:
+ aValue = KHu;
+ break;
+
+ case ELangDutch:
+ case ELangBelgianFlemish:
+ aValue = KNl;
+ break;
+
+ case ELangCzech:
+ aValue = KCs;
+ break;
+
+ case ELangSlovak:
+ aValue = KSk;
+ break;
+
+ case ELangPolish:
+ aValue = KPl;
+ break;
+
+ case ELangSlovenian:
+ aValue = KSl;
+ break;
+
+ case ELangPrcChinese:
+ aValue = KZhCN;
+ break;
+ case ELangTaiwanChinese:
+ aValue = KZhTW;
+ break;
+ case ELangHongKongChinese:
+ aValue = KZhHK;
+ break;
+
+ case ELangJapanese:
+ aValue = KJa;
+ break;
+
+ case ELangThai:
+ aValue = KTh;
+ break;
+
+ case ELangAfrikaans:
+ aValue = KAf;
+ break;
+
+ case ELangAlbanian:
+ aValue = KSq;
+ break;
+
+ case ELangAmharic:
+ aValue = KAm;
+ break;
+
+ case ELangArabic:
+ aValue = KAr;
+ break;
+
+ case ELangArmenian:
+ aValue = KHy;
+ break;
+
+ case ELangTagalog:
+ aValue = KTl;
+ break;
+
+ case ELangBengali:
+ aValue = KBn;
+ break;
+
+ case ELangBulgarian:
+ aValue = KBg;
+ break;
+
+ case ELangBurmese:
+ aValue = KMy;
+ break;
+
+ case ELangCatalan:
+ aValue = KCa;
+ break;
+
+ case ELangCroatian:
+ aValue = KHr;
+ break;
+
+ case ELangEstonian:
+ aValue = KEt;
+ break;
+
+ case ELangFarsi:
+ aValue = KFa;
+ break;
+
+ case ELangCanadianFrench:
+ aValue = KFrCA;
+ break;
+
+ case ELangScotsGaelic:
+ aValue = KGd;
+ break;
+
+ case ELangGeorgian:
+ aValue = KKa;
+ break;
+
+ case ELangGreek:
+ case ELangCyprusGreek:
+ aValue = KEl;
+ break;
+
+ case ELangGujarati:
+ aValue = KGu;
+ break;
+
+ case ELangHebrew:
+ aValue = KHe;
+ break;
+
+ case ELangHindi:
+ aValue = KHi;
+ break;
+
+ case ELangIndonesian:
+ aValue = KId;
+ break;
+
+ case ELangIrish:
+ aValue = KGa;
+ break;
+
+ case ELangKannada :
+ aValue = KKn;
+ break;
+
+
+ case ELangKazakh:
+ aValue = KKk;
+ break;
+
+ case ELangKhmer:
+ aValue = KKm;
+ break;
+
+ case ELangKorean:
+ aValue = KKo;
+ break;
+
+ case ELangLao:
+ aValue = KLo;
+ break;
+
+ case ELangLatvian:
+ aValue = KLv;
+ break;
+
+ case ELangLithuanian:
+ aValue = KLt;
+ break;
+
+ case ELangMacedonian:
+ aValue = KMk;
+ break;
+
+ case ELangMalay:
+ aValue = KMs;
+ break;
+
+ case ELangMalayalam:
+ aValue = KMl;
+ break;
+
+ case ELangMarathi:
+ aValue = KMr;
+ break;
+
+ case ELangMoldavian:
+ aValue = KMo;
+ break;
+
+ case ELangMongolian:
+ aValue = KMn;
+ break;
+
+ case ELangPunjabi:
+ aValue = KPa;
+ break;
+
+ case ELangRomanian:
+ aValue = KRo;
+ break;
+
+ case ELangSerbian:
+ aValue = KSr;
+ break;
+
+ case ELangSinhalese:
+ aValue = KSi;
+ break;
+
+ case ELangSomali:
+ aValue = KSo;
+ break;
+
+ case ELangSwahili:
+ aValue = KSw;
+ break;
+
+ case ELangTamil:
+ aValue = KTa;
+ break;
+
+ case ELangTelugu:
+ aValue = KTe;
+ break;
+
+ case ELangTibetan:
+ aValue = KBo;
+ break;
+
+ case ELangTigrinya:
+ aValue = KTi;
+ break;
+
+ case ELangTurkmen:
+ aValue = KTk;
+ break;
+
+ case ELangUkrainian:
+ aValue = KUk;
+ break;
+
+ case ELangUrdu:
+ aValue = KUr;
+ break;
+
+ case ELangVietnamese:
+ aValue = KVi;
+ break;
+
+ case ELangWelsh:
+ aValue = KCy;
+ break;
+
+ case ELangZulu:
+ aValue = KZu;
+ break;
+
+ // from \\epoc32\\include\\oem\\languages.hrh
+
+ case KLangTaiwanEnglish:
+ aValue = KEnTW;
+ break;
+
+ case KLangHongKongEnglish:
+ aValue = KEnHK;
+ break;
+
+ case KLangPrcEnglish:
+ aValue = KEnCN;
+ break;
+
+ case KLangJapaneseEnglish:
+ aValue = KEnJP;
+ break;
+
+ case KLangThaiEnglish:
+ aValue = KEnTH;
+ break;
+
+ case KLangApacMalay:
+ aValue = KMsAP;
+ break;
+
+ case KLangApacEnglish:
+ {
+ aValue = KEnAP;
+ break;
+ }
+ case KLangApacIndonesian:
+ {
+ aValue = KIdAP;
+ break;
+ }
+ case KLangBasque:
+ {
+ aValue = KEu;
+ break;
+ }
+ case KLangGalician:
+ {
+ aValue = KGl;
+ break;
+ }
+
+ // Cingular English
+ case 6154:
+ aValue = KEnUS;
+ break;
+
+ default:
+ {
+ aValue = KDefault;
+ }
+
+ break;
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgContentHandler::CancelParsing()
+// ---------------------------------------------------------------------------
+void CSvgContentHandler::CancelParsing()
+ {
+ iCancelRequested = ETrue;
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgContentHandler::LoadImages()
+// ---------------------------------------------------------------------------
+void CSvgContentHandler::LoadImages()
+ {
+ TInt imageEleCnt = iImageElements.Count();
+ for ( TInt i = 0; i < imageEleCnt; i++ )
+ {
+ TRAPD( error, iImageElements[i]->LoadUriL() );
+ if ( error != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("LoadUriL failed: %d\n", error );
+ #endif
+ }
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/src/SVGEngineImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,3190 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine source file
+ *
+*/
+
+
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include <utf.h>
+#include <s32mem.h>
+
+#include "SVGDOMImplementationImpl.h"
+#include "SVGElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSvgElementImpl.h"
+#include "SVGUseElementImpl.h"
+#include "SVGAnimationElementImpl.h"
+#include "SVGTextElementImpl.h"
+
+#include "SVGAudioElementImpl.h"
+
+
+#include "Gfx2dGcOpenVG.h"
+
+#include "SVGSchemaData.h"
+#include "SVGPathElementImpl.h"
+#include "SVGAnimationBase.h"
+#include "SVGElementTimeControl.h"
+
+#include "SVGRequestObserver.h"
+#include "SVGHyperlinkListener.h"
+#include "SVGListener.h"
+#include "SVGAnimationListener.h"
+#include "SVGAElementImpl.h"
+#include "SVGTextAreaElementImpl.h"
+
+#include "SVGTimer.h"
+#include "SVGEventHandler.h"
+#include "SVGEngineImpl.h"
+#include "SVGErrorImpl.h"
+
+#include "SVGFloatCssValueImpl.h"
+#include "SVGTimeContainer.h"
+#include "SVGMediaAnimationElementImpl.h"
+
+// Constants
+// length of </text>
+const TInt KClosingTextTagLength = 7;
+// Length of </textArea>
+const TInt KClosingTextAreaTagLength = 11;
+// Length of <
+const TInt KClosingBracesLength = 1;
+// Number of chars to be converted at a time to Unicode
+const TInt KMaxConversionChars = 20;
+_LIT(KClosingTextTag,"</text>");
+_LIT(KClosingTextAreaTag,"</textArea>");
+_LIT(KClosingBraces,">");
+
+// ---------------------------------------------------------------------------
+// Two phase constructor for this class
+// JSR 226 API
+// ---------------------------------------------------------------------------
+CSvgEngineImpl* CSvgEngineImpl::NewL(CSvgBitmapFontProvider *aSvgBitmapFontProvider)
+ {
+ CSvgEngineImpl* self = new ( ELeave ) CSvgEngineImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL(aSvgBitmapFontProvider);
+ CleanupStack::Pop();
+ return self;
+ }
+
+
+// --------------------------------------------------------------------------
+// CSvgEngineImpl* CSvgEngineImpl::NewLC()
+// ---------------------------------------------------------------------------
+CSvgEngineImpl* CSvgEngineImpl::NewLC(CSvgBitmapFontProvider *aSvgBitmapFontProvider)
+ {
+ CSvgEngineImpl* self = new ( ELeave ) CSvgEngineImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL(aSvgBitmapFontProvider);
+ return self;
+ }
+
+// --------------------------------------------------------------------------
+// CSvgEngineImpl::CSvgEngineImpl() : iTextAreaHandle( NULL ),
+// ---------------------------------------------------------------------------
+CSvgEngineImpl::CSvgEngineImpl() : iTextAreaHandle( NULL ),
+ iRequestObserver( NULL ),
+ iFrameBuffer( NULL ),
+ iFrameBufferSize(TSize(0,0)),
+ iFontHashMap ( NULL ),
+ iSvgDocument( NULL ),
+ iBackgroundColor(0x00000000),
+ iShowDebugInfo( EFalse ),
+ iSvgEngineState(ESVGEngineNotStarted),
+ iTimeoutSeconds( 0 ),
+ iRenderQuality(2), // Set To Rendering quality "high"
+ iCustomOption( ETrue ),
+ iFrameBufferOverridesViewport( EFalse ),
+ iClientDefinedViewPort(EFalse)
+
+ {
+ }
+
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::ConstructL()
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::ConstructL(CSvgBitmapFontProvider *aSvgBitmapFontProvider)
+ {
+ iGfxContext = NULL;
+
+ iSvgBitmapFontProvider = aSvgBitmapFontProvider ;
+ // create CSvgErrorImpl object
+ iSvgError = CSvgErrorImpl::NewL();
+
+ iFontHashMap = CSvgFontHashMap::NewL();
+
+ SetIgnoreUpdateScreen( EFalse );
+
+ // The iCustomOption need to be initialized for JSR
+
+ iCustomOption = ETrue;
+
+ }
+
+
+
+// ---------------------------------------------------------------------------
+// Two phase constructor for this class
+// Accepts a frame buffer and a MSvgRequestObserver object from the client
+// Buffer is used for rasterization of SVG content
+// Observer object, if provided, is used for notifying the client on updates
+// ---------------------------------------------------------------------------
+CSvgEngineImpl* CSvgEngineImpl::NewL( CFbsBitmap* aFrameBuffer,
+ MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec, CSvgBitmapFontProvider* aSvgBitmapFontProvider )
+ {
+ CSvgEngineImpl* self = new ( ELeave ) CSvgEngineImpl( aFrameBuffer,
+ aReqObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL(aFontSpec, aSvgBitmapFontProvider);
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Two phase constructor for this class
+// Accepts a frame buffer and a MSvgRequestObserver object from the client
+// Buffer is used for rasterization of SVG content
+// Observer object, if provided, is used for notifying the client on updates
+// ---------------------------------------------------------------------------
+CSvgEngineImpl* CSvgEngineImpl::NewLC( CFbsBitmap* aFrameBuffer,
+ MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec, CSvgBitmapFontProvider* aSvgBitmapFontProvider )
+ {
+ CSvgEngineImpl* self = new ( ELeave ) CSvgEngineImpl( aFrameBuffer, aReqObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL(aFontSpec, aSvgBitmapFontProvider);
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Symbian style private method that is used to construct heap objects
+// Builds the Graphics device objects with the client's frame buffer info
+// Builds the event handler object
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::ConstructL( TFontSpec& aFontSpec, CSvgBitmapFontProvider* aSvgBitmapFontProvider)
+ {
+ iBitmapFontSpec = aFontSpec;
+// iGfxContext is created through CSvgEngineInterfaceImpl::ConstructL
+ // iGfxContext = CGfx2dGcVGR::NewL( iFrameBuffer->SizeInPixels(), iBitmapFontSpec );
+ iSvgBitmapFontProvider = aSvgBitmapFontProvider ;
+
+ iGfxContext = CGfx2dGcOpenVG::NewL( iFrameBuffer->SizeInPixels(), iBitmapFontSpec, iSvgBitmapFontProvider );
+ // create CSvgErrorImpl object
+ iSvgError = CSvgErrorImpl::NewL();
+ iFontHashMap = CSvgFontHashMap::NewL();
+ iSvgNames = new (ELeave) CDesC16ArrayFlat(5);
+ }
+
+// ---------------------------------------------------------------------------
+CSvgEngineImpl* CSvgEngineImpl::NewL( CFbsBitmap* aFrameBuffer,
+ MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec, CSvgBitmapFontProvider* aSvgBitmapFontProvider ,SVGRendererId aRendererType)
+ {
+ CSvgEngineImpl* self = new ( ELeave ) CSvgEngineImpl( aFrameBuffer,
+ aReqObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL(aFontSpec, aSvgBitmapFontProvider,aRendererType);
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Two phase constructor for this class
+// Accepts a frame buffer and a MSvgRequestObserver object from the client
+// Buffer is used for rasterization of SVG content
+// Observer object, if provided, is used for notifying the client on updates.
+//This contains the renderer selector parameter
+// ---------------------------------------------------------------------------
+CSvgEngineImpl* CSvgEngineImpl::NewLC( CFbsBitmap* aFrameBuffer,
+ MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec, CSvgBitmapFontProvider* aSvgBitmapFontProvider,SVGRendererId aRendererType )
+ {
+ CSvgEngineImpl* self = new ( ELeave ) CSvgEngineImpl( aFrameBuffer, aReqObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL(aFontSpec, aSvgBitmapFontProvider,aRendererType);
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Symbian style private method that is used to construct heap objects
+// Builds the Graphics device objects with the client's frame buffer info
+// Builds the event handler object.
+//This contains the renderer selector parameter NGA
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::ConstructL( TFontSpec& aFontSpec, CSvgBitmapFontProvider* aSvgBitmapFontProvider,SVGRendererId aRendererType)
+ {
+ iBitmapFontSpec = aFontSpec;
+// iGfxContext is created through CSvgEngineInterfaceImpl::ConstructL
+ // iGfxContext = CGfx2dGcVGR::NewL( iFrameBuffer->SizeInPixels(), iBitmapFontSpec );
+ iSvgBitmapFontProvider = aSvgBitmapFontProvider ;
+
+ iGfxContext = CGfx2dGcOpenVG::NewL( iFrameBufferSize, iBitmapFontSpec, iSvgBitmapFontProvider ,aRendererType);
+ // create CSvgErrorImpl object
+ iSvgError = CSvgErrorImpl::NewL();
+ iFontHashMap = CSvgFontHashMap::NewL();
+ iSvgNames = new (ELeave) CDesC16ArrayFlat(5);
+ }
+
+
+// ---------------------------------------------------------------------------
+// Private constructor
+// Initializes private attributes
+// ---------------------------------------------------------------------------
+CSvgEngineImpl::CSvgEngineImpl( CFbsBitmap* aFrameBuffer,
+ MSvgRequestObserver* aReqObserver ) : iTextAreaHandle( NULL ),
+ iRequestObserver( aReqObserver ),
+ iFrameBuffer( aFrameBuffer ),
+ iFrameBufferSize(TSize(0,0)),
+ iFontHashMap ( NULL),
+ iSvgDocument( NULL ),
+ iBackgroundColor(0x00000000),
+ iShowDebugInfo( EFalse ),
+ iSvgEngineState(ESVGEngineNotStarted),
+ iCustomOption( ETrue ),
+ iFrameBufferOverridesViewport( EFalse )
+
+
+ {
+ if(aFrameBuffer && aFrameBuffer->Handle()>0)
+ {
+ iFrameBufferSize = aFrameBuffer->SizeInPixels();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+CSvgEngineImpl::~CSvgEngineImpl()
+ {
+ Destroy();
+
+ if ( iFontHashMap )
+ {
+ delete iFontHashMap;
+ iFontHashMap = NULL;
+ }
+
+ iSvgTextBoundingBoxes.ResetAndDestroy();
+ iSvgTextBoundingBoxes.Close();
+
+ if ( iGfxContext )
+ {
+ delete iGfxContext;
+ iGfxContext = NULL;
+ }
+ if ( iSvgError )
+ {
+ delete iSvgError;
+ iSvgError = NULL;
+ }
+ if (iTextAreaHandle)
+ {
+ delete iTextAreaHandle;
+ iTextAreaHandle = NULL;
+ }
+
+ iTextAreaListeners.Close();
+ iTextListeners.Close();
+ iHyperlinkListeners.Close();
+ iAnimationListeners.Close();
+ iSvgMouseListeners.Close();
+ iInteractiveElementListeners.Close();
+ delete iSvgNames;
+ }
+
+// ---------------------------------------------------------------------------
+// Draws aRootElement and calls itself for children.
+// Handles switch element differently, as it only draws one of its children.
+// ---------------------------------------------------------------------------
+
+void CSvgEngineImpl::DrawElementsL( CSvgElementImpl* aRootElement)
+ {
+ if ( aRootElement != NULL)
+ {
+ TInt32 displayValue = 0;
+ // while we have next elements
+ CSvgElementImpl* newElement = aRootElement;
+ while( newElement != NULL )
+ {
+ if(newElement->GetAttributeIntL( KCSS_ATTR_DISPLAY, displayValue ) == KErrNoAttribute)
+ {
+ newElement = ( CSvgElementImpl* ) newElement->FirstChild();
+ while ( newElement != NULL )
+ {
+ DrawElementsL( newElement );
+ newElement = ( CSvgElementImpl * ) newElement->NextSibling();
+ }
+ return;
+ }
+
+ if(displayValue != KDisplayEnumNone) // is it a hidden element
+ {
+ CCssValue* CssValue = NULL;
+ TReal32 opacity = 1;
+
+ // check visisbility
+ TInt32 visbilityValue = 0;
+ TInt visibility = newElement->GetAttributeIntL( KCSS_ATTR_VISIBILITY, visbilityValue );
+
+ newElement->FindProperty( KCSS_ATTR_GROUP_OPACITY, CssValue, newElement );
+ if ( CssValue )
+ {
+ opacity = ((CFloatCssValueImpl*)CssValue)->Value();
+ }
+
+ if( opacity != 1 && !newElement->IsInherited( KCSS_ATTR_GROUP_OPACITY ) )
+ {
+ iGfxContext->BindToImageL();
+ // Group opacity
+ if ( newElement->ElemID() == KSvgGElement && newElement->FirstChild() )
+ {
+ // recurse with right context.
+ DrawElementsL( ( CSvgElementImpl* )newElement->FirstChild());
+ }
+ // Element opacity
+ else
+ {
+ TBool canDraw = ETrue;
+ if( (visibility == KErrNone) && (visbilityValue == 0) )
+ {
+ canDraw = newElement->DrawL( iGfxContext, NULL ) ;
+ }
+ if( canDraw && newElement->FirstChild() )
+ {
+ DrawElementsL( ( CSvgElementImpl* )newElement->FirstChild() );
+ }
+ }
+
+ // Blend opacity context buffer with parent's gfx context buffer
+ iGfxContext->UnbindFromImageL( opacity );
+ }
+ else // no opacity or is inherited from above....
+ {
+ TBool canDraw = ETrue;
+ if( (visibility == KErrNone) && (visbilityValue == 0) )
+ {
+ canDraw = newElement->DrawL(iGfxContext, NULL );
+ }
+ if( canDraw && newElement->FirstChild() )
+ {
+ DrawElementsL( ( CSvgElementImpl* )newElement->FirstChild());
+ }
+ }
+ }
+ newElement = ( CSvgElementImpl * )newElement->NextSibling();
+
+ }// end while....
+ }
+ }
+
+//--------------------------------------------------------------------
+//CFbsBitmap* CSvgEngineImpl::CreateOpacityFrameBufferL()
+//--------------------------------------------------------------------
+CFbsBitmap* CSvgEngineImpl::CreateOpacityFrameBufferL()
+{
+ CFbsBitmap* bitmap = new ( ELeave ) CFbsBitmap();
+
+ if ( iFrameBuffer != NULL )
+ {
+/*NGA reverse*/if ( bitmap->Create( iFrameBufferSize, EColor16MU ) != KErrNone )
+ {
+ delete bitmap;
+ bitmap = NULL;
+ }
+ }
+ return bitmap;
+ }
+
+// ---------------------------------------------------------------------------
+// Copy 32-bit buffer
+// ---------------------------------------------------------------------------
+
+void CSvgEngineImpl::CopyBuffer( TUint32* aSrc, TUint32* aDest, const TSize aSize )
+ {
+ if ( aSrc && aDest )
+ {
+ Mem::Copy( aDest, aSrc, aSize.iWidth * aSize.iHeight * sizeof( TUint32 ) );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Positions the root element and calls itself (recursively) for all the
+// descendant elements
+// CTM stands for 'Current Transformation Matrix'.
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::UpdateCTM(CSvgDocumentImpl* aSvgDocument)
+ {
+
+ if (aSvgDocument)
+ {
+ ((CSvgElementImpl*)aSvgDocument->RootElement())->UpdateCTM();
+ }
+
+
+ }
+
+// ---------------------------------------------------------------------------
+// Initializes the SVG Engine primarily with width and height informtion
+// This is based on the attribute specifications for the root 'svg' element
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::InitializeEngineL()
+ {
+ // VIEWBOX
+ // If x, y, w, h of outmost svg not defined, then put default values: 0 0 100% 100%
+ // return;
+ // Set locale, so that there is no thousands separator
+
+ if( !iSvgDocument )
+ return;
+
+ iSvgDocument->iInitialDrawFlag = ETrue;
+ if(!((CSvgSvgElementImpl *)(iSvgDocument->RootElement()))->iIsWidthSet)
+ {
+ ((CSvgSvgElementImpl *)(iSvgDocument->RootElement()))->iIsWidthSet = ETrue;
+ }
+ if(!((CSvgSvgElementImpl *)(iSvgDocument->RootElement()))->iIsHeightSet)
+ {
+ ((CSvgSvgElementImpl *)(iSvgDocument->RootElement()))->iIsHeightSet = ETrue;
+ }
+
+ TLocale locale; // locale object
+ locale.SetCurrencyTriadsAllowed( EFalse ); // change setting
+ TSize lSize = GetSize();
+ iSvgDocument->iReqExReqFtrSysLTested = EFalse;
+ if ( iSvgDocument->RootElement() != NULL &&
+ ((CSvgElementImpl*)iSvgDocument->RootElement())->ElemID() == KSvgSvgElement )
+
+ {
+ // Scale width & height to fit to screen size
+ CSvgSvgElementImpl* el = ( CSvgSvgElementImpl* )
+ (iSvgDocument->RootElement());
+ TFloatFixPt width, height;
+ TInt widthInt, heightInt;
+ TFloatFixPt scrnW( lSize.iWidth ), scrnH( lSize.iHeight );
+ TFloatFixPt zero ( 0 );
+
+ if ( iFrameBufferOverridesViewport )
+ {
+ //special case for Aknicon
+ //the don't care what the contents viewport is they just want it to scale to the framebuffer's size
+ width = scrnW;
+ height= scrnH;
+ }
+ else
+ {
+ //bitmap from the client overrides width height specified in svg
+
+ if(iViewPortListener != NULL)
+ {
+ TInt tempWidth=0,tempHeight=0;
+ iViewPortListener->GetViewPort(
+ ((CSvgSvgElementImpl *)(iSvgDocument->RootElement()))->iWidthInUserCoordinate,
+ ((CSvgSvgElementImpl *)(iSvgDocument->RootElement()))->iHeightInUserCoordinate,
+ ((CSvgSvgElementImpl *)(iSvgDocument->RootElement()))->iWidthInPercentage,
+ ((CSvgSvgElementImpl *)(iSvgDocument->RootElement()))->iHeightInPercentage,
+ tempWidth,
+ tempHeight);
+
+ width = (TFloatFixPt) tempWidth;
+ height = (TFloatFixPt) tempHeight;
+
+ //used in SetWindowViewportTrans of svgSvgElementImpl
+ iClientDefinedViewPort = ETrue;
+
+ }
+ else
+ {
+
+ TReal32 per = 100;
+ if(((CSvgSvgElementImpl *)(iSvgDocument->RootElement()))->iWidthInPercentage)
+ {
+ width = ( TFloatFixPt ) (( lSize.iWidth/per ) * ((CSvgSvgElementImpl *)(iSvgDocument->RootElement()))->iWidthInUserCoordinate);
+ }
+ else
+ {
+ width = (TFloatFixPt) (((CSvgSvgElementImpl *)(iSvgDocument->RootElement()))->iWidthInUserCoordinate);
+ }
+
+ if(((CSvgSvgElementImpl *)(iSvgDocument->RootElement()))->iHeightInPercentage)
+ {
+ height = ( TFloatFixPt ) (( lSize.iHeight/per ) * ((CSvgSvgElementImpl *)(iSvgDocument->RootElement()))->iHeightInUserCoordinate);
+ }
+ else
+ {
+ height = (TFloatFixPt) (((CSvgSvgElementImpl *)(iSvgDocument->RootElement()))->iHeightInUserCoordinate);
+ }
+
+ //default to XmidYmid_meet
+ TSvgPreserveAspectAlignType lPreserverAspectAlignment = ESvgPreserveAspectRatio_XmidYmid;
+ TSvgMeetOrSliceType lMeetOrSlice = ESvgMeetOrSlice_Meet;
+
+ MSvgPreserveAspectRatio* aPreserveAspectRatio;
+ el->GetPreserveAspectRatio(aPreserveAspectRatio);
+
+ if (aPreserveAspectRatio)
+ {
+ lPreserverAspectAlignment = aPreserveAspectRatio->GetAlign();
+ lMeetOrSlice = aPreserveAspectRatio->GetMeetOrSlice();
+
+ //el->SetPreserveAspectRatioL( lPreserverAspectAlignment, lMeetOrSlice);
+ if( lPreserverAspectAlignment == ESvgPreserveAspectRatio_None && lMeetOrSlice == ESvgMeetOrSlice_Meet )
+ {
+ width = scrnW;
+ height = scrnH;
+ }
+ }
+
+ if( lMeetOrSlice == ESvgMeetOrSlice_Meet && !(lPreserverAspectAlignment == ESvgPreserveAspectRatio_None) )
+ {
+ widthInt = ( TInt ) width;
+ heightInt = ( TInt ) height;
+
+ // to avoid division by zero.
+ TInt rh = lSize.iWidth ;
+ if (widthInt != 0)
+ {
+ rh = heightInt* lSize.iWidth / widthInt;
+ }
+
+ if ( rh <= lSize.iHeight )
+ {
+ width = scrnW;
+ height = TFloatFixPt( rh );
+ }
+ else
+ {
+ // to avoid division by zero.
+ if (heightInt != 0)
+ {
+ width = TFloatFixPt( ((TReal32)(widthInt * lSize.iHeight)) / heightInt );
+ }
+ height = scrnH;
+ }
+ }
+ else if( lMeetOrSlice == ESvgMeetOrSlice_Slice )
+ {
+ widthInt = ( TInt ) width;
+ heightInt = ( TInt ) height;
+
+ // to avoid division by zero.
+ TInt rh = lSize.iWidth ;
+ if (widthInt != 0)
+ {
+ rh = heightInt* lSize.iWidth / widthInt;
+ }
+
+ if ( rh <= lSize.iHeight )
+ {
+ // to avoid division by zero.
+ if (heightInt != 0)
+ {
+ width = TFloatFixPt( ((TReal32)(widthInt * lSize.iHeight)) / heightInt );
+ }
+ height = scrnH;
+
+ }
+ else
+ {
+ width = scrnW;
+ height = TFloatFixPt( rh );
+ }
+ }
+ else
+ {
+ }
+ }//Normal viewer| end of else
+ }
+
+ if ( ( width <= zero ) || ( height <= zero ) ) //.
+ {
+ width = 0;
+ height = 0;
+ return;
+ }
+ // Set initial viewport
+ el->SetAttributeFloatL( KAtrX, zero );
+ el->SetAttributeFloatL( KAtrY, zero );
+ el->SetAttributeFloatL( KAtrWidth, width );
+ el->SetAttributeFloatL( KAtrHeight, height );
+ }
+ }
+
+
+
+
+
+// ---------------------------------------------------------------------------
+// This method is called after the SVG file is read and all elements are
+// constructed
+// It also looks for rendering properties such as Anti Aliasing at this
+// point
+// It calibrates the system for rasterization quality based on contents
+// ---------------------------------------------------------------------------
+TBool CSvgEngineImpl::StartFrameLoopL()
+ {
+ if( iRequestObserver != NULL )
+ {
+ if(iSvgDocument != NULL && iSvgDocument->iEventHandler != NULL)
+ {
+ iRequestObserver->UpdatePresentation(
+ iSvgDocument->iEventHandler->AnimationElementsCount());
+ }
+ }
+ if(iSvgDocument != NULL)
+ {
+ if ( iSvgDocument->RootElement() )
+ {
+ InitializeEngineL(); // set the viewport and viewbox
+ return ETrue;
+ }
+ }
+ return EFalse;
+ }
+// ---------------------------------------------------------------------------
+// UpdatePresentation()
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::UpdatePresentation(const TInt32& aParam)
+ {
+ if( iRequestObserver != NULL )
+ {
+ iRequestObserver->UpdatePresentation (aParam);
+ }
+ }
+
+
+//---------------------------------------------------------------------------
+// SetRenderingQuality
+//
+// @param : aRenderQuality
+// The function is called from JSR226 API. Specific to M2G/JSR226 only.
+//---------------------------------------------------------------------------
+void CSvgEngineImpl::SetRenderingQuality( const TInt32 aRenderQuality)
+{
+ // Bydefault iRenderQuality is set to 2 i.e. Rendering Quality high.
+
+ if( iRenderQuality != aRenderQuality )
+ {
+ iRenderQuality = aRenderQuality;
+
+ if( iGfxContext )
+ {
+ iGfxContext->SetAntialiasingMode( iRenderQuality );
+ }
+ }
+}
+
+
+// ---------------------------------------------------------------------------
+// Invalidate the current raster (and frame buffer) and
+// update the buffer with new raster.
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::RedrawL()
+ {
+ // Clear the frame buffer
+ if( iGfxContext && iSvgDocument)
+ {
+ // Set Clipping rectangle
+ CSvgSvgElementImpl* el = ( CSvgSvgElementImpl* ) (iSvgDocument->RootElement());
+ if ( !el )
+ {
+ return; // No DOM tree, nothing to draw.
+ }
+
+
+
+ // If viewBox has been set and width or height is zero
+ // Do not render the content
+ TGfxRectangle2D viewBoxRect;
+ if(el->GetViewBox(viewBoxRect))
+ {
+ if(viewBoxRect.iWidth == TFloatFixPt(0) ||
+ viewBoxRect.iHeight == TFloatFixPt(0))
+ {
+ return;
+ }
+ }
+
+ iGfxContext->SetupContextL();
+ iGfxContext->Clear(iBackgroundColor);
+ iGfxContext->SetFillOpacity( 1.0f );
+ iGfxContext->SetStrokeOpacity( 1.0f );
+
+ TFloatFixPt width, height;
+ el->GetAttributeFloat( KAtrWidth, width );
+ el->GetAttributeFloat( KAtrHeight, height );
+ TGfxRectangle2D clipRect ( 0, 0, width, height );
+ iGfxContext->SetClip( clipRect );
+ iClipRect = clipRect;
+
+ UpdateCTM(iSvgDocument);
+
+ iSvgDocument->iIsRendering = ETrue;
+ DrawElementsL( (CSvgElementImpl*)iSvgDocument->RootElement());
+ iSvgDocument->iIsRendering = EFalse;
+
+ iGfxContext->Flush();
+
+ // Get the redering result onto CFbsBitmap.
+ if(iFrameBufferSize.iWidth > 0)
+ iGfxContext->UpdateFramebufferL( iFrameBuffer, iMask,iFrameBufferSize,iRenderDspMode,iMaskDspMode );
+ else
+ iGfxContext->UpdateFramebufferL( iFrameBuffer, iMask );
+
+ if ( !iIgnoreUpdateScreen && iRequestObserver != NULL )
+ {
+ iRequestObserver->UpdateScreen();
+ }
+ if ( iSvgDocument->iInitSortList )
+ {
+ iSvgDocument->SortEventList();
+ }
+ else
+ {
+ iSvgDocument->iInitSortList=EFalse;
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Delete the objects associated with the last loaded SVG file
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::Destroy()
+ {
+ //if ( iSvgDocument )
+ // {
+ // Stop timer and reset time
+ // iSvgDocument->TimeContainer()->UserStop();
+ // iSvgDocument->TimeContainer()->UserResetTime();
+ // }
+ }
+
+
+// ---------------------------------------------------------------------------
+// Set the URI information
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::LinkRequest( const TDesC& aUri )
+ {
+ iLinkUri.Set( aUri );
+ }
+// ---------------------------------------------------------------------------
+// Set the Link:Show information
+// ---------------------------------------------------------------------------
+
+
+void CSvgEngineImpl::LinkRequestWithShow(const TDesC& aUri ,const TDesC& aLinkShow )
+ {
+ iLinkUri.Set( aUri );
+ iLinkShow.Set( aLinkShow );
+ }
+
+// ---------------------------------------------------------------------------
+// Initiate the process of getting an svg font from the client
+// ---------------------------------------------------------------------------
+TBool CSvgEngineImpl::FetchFont( const TDesC& aUri, RFs& aSession, RFile& aFileHandle )
+ {
+ if ( iRequestObserver == NULL )
+ {
+ return EFalse;
+ }
+ else
+ {
+ if (iRequestObserver->FetchFont( aUri, aSession, aFileHandle ) == KErrNone)
+ {
+ return ETrue;
+ }
+ return EFalse;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Initiate the process of getting an embedded image from the client
+// ---------------------------------------------------------------------------
+TBool CSvgEngineImpl::FetchImage( const TDesC& aUri, RFs& aSession, RFile& aFileHandle )
+ {
+ if ( iRequestObserver == NULL )
+ {
+ return EFalse;
+ }
+ else
+ {
+ if (iRequestObserver->FetchImage( aUri, aSession, aFileHandle ) == KErrNone)
+ {
+ return ETrue;
+ }
+ return EFalse;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for Graphics Context object
+// ---------------------------------------------------------------------------
+CGfx2dGc* CSvgEngineImpl::GraphicsContext()
+ {
+ return iGfxContext;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the Engine's current time
+// ---------------------------------------------------------------------------
+TInt32 CSvgEngineImpl::CurrentTIme()
+ {
+ if ( iSvgDocument )
+ {
+ return iSvgDocument->CurrentTime();
+ }
+ return KErrGeneral;
+ }
+
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::ImageLoadingCompleted( TInt /* aErrorStatus */ )
+// ---------------------------------------------------------------------------
+// ImageLoadingObserver interface
+void CSvgEngineImpl::ImageLoadingCompleted( TInt /* aErrorStatus */ )
+{
+ TRAP_IGNORE(RedrawL());
+ //aErrorStatus = 0;
+}
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::UpdatePath( CGfxGeneralPath* hPath, CSvgElementImpl* hElement )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::UpdatePath( CGfxGeneralPath* hPath, CSvgElementImpl* hElement )
+{
+ if ((hElement != NULL) && (hElement->ElemID() == KSvgPathElement))
+ {
+ TRAPD(error,hElement->SetAttributePathL(KAtrData, hPath));
+ if ( error != KErrNone )
+ {
+ // Error Processing
+ return;
+ }
+ }
+
+}
+
+// ---------------------------------------------------------------------------
+// Accessor for the document object for the currently loaded SVG source
+// ---------------------------------------------------------------------------
+CSvgDocumentImpl* CSvgEngineImpl::Document()
+ {
+ return iSvgDocument;
+ }
+
+// ---------------------------------------------------------------------------
+// Restrict Thumbnail documents
+// Do not render to frame buffer when is in thumbnail mode and
+// frame buffer size width or height is larger than 80x80.
+// ---------------------------------------------------------------------------
+TBool CSvgEngineImpl::PassesThumbNailRestriction()
+{
+ if ( iSvgDocument && iFrameBuffer && iSvgDocument->IsThumbNailOnly() )
+ {
+ TSize size = iFrameBuffer->SizeInPixels();
+ if ( size.iWidth > 80 || size.iHeight > 80 )
+ {
+ return EFalse;
+ }
+ }
+ return ETrue;
+}
+
+//***************************************************************
+// Event handling
+// ---------------------------------------------------------------------------
+// Initiate the process of handling an event from the client for the
+// SVG source
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::ProcessEventL( CSvgDocumentImpl* aSvgDocument,
+ MSvgEvent* aEvent, TBool aRedraw )
+ {
+ // Check for Thumbnail restrictions
+ if ( !PassesThumbNailRestriction() )
+ {
+ return;
+ }
+
+ // Timer event
+ //if(!aEvent || !iGfxContext)
+ if(!aEvent)
+ return;
+ if ( aEvent->EventType() == ESvgEngineEventTimer )
+ {
+ // Update current time
+ if ( aSvgDocument )
+ {
+ aSvgDocument->SetCurrentTime(
+ ( ( MSvgTimerEvent * ) aEvent )->Time() );
+ }
+ }
+
+ if( aSvgDocument && aSvgDocument->iEventHandler)
+ {
+ if (( aSvgDocument->iEventHandler->ProcessEventL( aEvent ) ||
+ aSvgDocument->iInitialDrawFlag) && aEvent->EventType() == ESvgEngineEventTimer )
+ {
+
+ if(aSvgDocument->iInitSortList)
+ {
+ aSvgDocument->SortEventList();
+ aSvgDocument->iInitSortList = EFalse;
+ }
+ aSvgDocument->iInitialDrawFlag = EFalse;
+ aSvgDocument->iEventHandler->DoAnimProcL(aEvent);
+
+ if (aRedraw)
+ {
+ // Redraw is performed for iSvgDocument
+ RedrawL();
+ }
+ }
+ else
+ {
+ // this is to keep the dom in its final state.
+ if(aEvent->EventType() == ESvgEngineEventTimer)
+ {
+ aSvgDocument->iEventHandler->DoAnimProcL(aEvent);
+ }
+
+ }
+
+ // Process Link
+ if ( aEvent->EventMask() == KSvgEventMaskExternalUI )
+ {
+ if ( iLinkUri.Length() > 0 )
+ {
+ DoHyperLinkingL();
+ // reset link description
+ iLinkUri.Set( NullString );
+ }
+ }
+ }
+
+// Show FPS debug info. note. only write data to STI port
+#ifdef _DEBUG
+
+ if ( aEvent->EventType() == ESvgEngineInternalEvent )
+ {
+ MSvgInternalEvent* evt = ( MSvgInternalEvent* ) aEvent;
+ if (evt->SvgEvent() == ESvgEventEndEvent)
+ {
+ iAnimationState = KAnimFinished;
+ return;
+ }
+ else
+ if (evt->SvgEvent() == ESvgEventBeginEvent)
+ {
+ iAnimationState = KAnimActive;
+ return;
+ }
+
+ }
+
+ // time display for debug
+ if ( iShowDebugInfo && iGfxContext && aEvent->EventType() == ESvgEngineEventTimer
+ && iAnimationState != KAnimFinished /*&& iTimer*/)
+ {
+ TInt fps = iSvgDocument->TimeContainer()->UserFps() / 10; //iTimer->Fps() / 10;
+ _LIT(msg, "\n%3d.%d\n");
+ RDebug::Print(msg, fps, iSvgDocument->TimeContainer()->UserFps()
+ - fps * 10 );
+
+ }
+#endif //_DEBUG
+
+ }
+
+
+// ---------------------------------------------------------------------------
+// This method is for future extension, in which an external script engine
+// could be used to evaluate a script description.
+// ---------------------------------------------------------------------------
+TBool CSvgEngineImpl::ScriptCall( const TDesC& aScript,
+ CSvgElementImpl* aCallerElement )
+ {
+ if ( iRequestObserver == NULL )
+ {
+ return EFalse;
+ }
+ else
+ {
+ return iRequestObserver->ScriptCall( aScript, aCallerElement );
+ }
+ }
+
+
+//***************************************************************
+//
+// ---------------------------------------------------------------------------
+// Obtain the longest duration for an animation given document
+// NULL will assume the attached document.
+// ---------------------------------------------------------------------------
+TUint32 CSvgEngineImpl::Duration( CSvgDocumentImpl* aDocument )
+ {
+ if ( aDocument == NULL )
+ {
+ if ( iSvgDocument == NULL )
+ {
+ return 0;
+ }
+ return iSvgDocument->AnimationDuration();
+ }
+ return aDocument->AnimationDuration();
+ }
+
+//*******************************************************/
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::SwitchDebugInfo()
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::SwitchDebugInfo(TBool debug)
+ {
+ iShowDebugInfo = debug;
+ }
+
+void CSvgEngineImpl::CustomOption(TBool aCustomOption )
+ {
+ iCustomOption = aCustomOption;
+ delete iGfxContext;
+ iGfxContext = NULL;
+
+/*NGA reverse*/ TRAP_IGNORE( iGfxContext = CGfx2dGcOpenVG::NewL( iFrameBufferSize, iBitmapFontSpec, iSvgBitmapFontProvider ));
+
+
+ }
+
+
+
+
+// ---------------------------------------------------------------------------
+// Initiate the process of opening and reading an embedded hyperlink
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::DoHyperLinkingL()
+ {
+
+ if( iSvgDocument == NULL )
+ return;
+
+ // Not full support of XPointer
+
+ _LIT( KTmpHttp, "http:" );
+ _LIT( KTmpFile, "file:" );
+ _LIT( KTmpHash, "#" );
+ _LIT( KTmpSvgView, "SvgView" );
+ if ( iLinkUri.Left( 1 ) == KTmpHash )
+ {
+ // internal linking
+ // Extract id
+ TLex lex ( iLinkUri );
+ lex.Inc(); // skip '#'
+ lex.Mark();
+ while ( !lex.Eos() && lex.Peek().IsAlpha() )
+ lex.Inc();
+ TPtrC targetId = lex.MarkedToken();
+ if ( targetId == KTmpSvgView )
+ {
+ // need to parse next token = {viewBoxSpec| preserveAspectRatioSpec
+ // |transformSpec|zoomAndPanSpec|viewTargetSpec}
+
+ // Not yet supported
+ }
+ else
+ {
+
+ CSvgElementImpl*targetElement = ( CSvgElementImpl* )
+ iSvgDocument->GetElementById( targetId );
+ if ( targetElement == NULL )
+ return;
+
+ if ( targetElement->IsAnimatedElement( ) )
+ {
+ // start animation
+ ( ( CSvgAnimationBase * ) targetElement )->BeginElementL();
+ }
+ else
+ {
+ }
+ }
+ }
+ else if ( iLinkUri.Length() >= 5 )
+ {
+ if ( iLinkUri.Left( 5 ) == KTmpHttp || iLinkUri.Left( 5 ) == KTmpFile )
+ {
+ // notify observer of desire to follow http link
+ NotifyHyperlinkActivated( iLinkUri );
+ }
+ else
+ {
+ // notify observer of desire to follow link
+ if ( iLinkShow.Length() > 0 )
+ NotifyHyperlinkActivatedWithShow( iLinkUri, iLinkShow );
+ else
+ NotifyHyperlinkActivated( iLinkUri );
+ }
+ }
+ else if ( iLinkUri.Length() > 0 )
+ {
+ // notify observer of desire to follow link
+ if ( iLinkShow.Length() > 0 )
+ NotifyHyperlinkActivatedWithShow( iLinkUri, iLinkShow );
+ else
+ NotifyHyperlinkActivated( iLinkUri );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Dump a completed raster to the off screen buffer provided by the
+// client
+// ---------------------------------------------------------------------------
+TInt CSvgEngineImpl::RenderFileToBuffer( const TDesC8& aSvgData,
+ CFbsBitmap* aFrameBuffer,
+ CFbsBitmap* aMask,
+ TBool aPreserveAspectRatio )
+ {
+ if ( !iGfxContext )
+ {
+ return EFalse;
+ }
+
+ CFbsBitmap* OrgFrameBuffer;
+ CFbsBitmap* OrgMask;
+ OrgFrameBuffer = iFrameBuffer;
+ OrgMask = iMask;
+ CSvgDocumentImpl* lsvgorgdoc = iSvgDocument;
+ // We have moved all the leaving functions into RenderFileL
+ TRAPD(err,RenderFileL(aSvgData,aFrameBuffer,aMask,aPreserveAspectRatio));
+ // No matter what...whether the RenderFileL returns properly or leave we need to set the
+ //GDI context back to the original frame buffer and mask... and set back the engine to
+ //how it was before all this happened..
+
+ SetDocument(lsvgorgdoc);
+ lsvgorgdoc->SetEngine(this);
+ // the setGDIContextL error is a very serious error and if it occurs then
+ // there is no way of recovery.
+ TRAP_IGNORE(SetGdiContextL(OrgFrameBuffer,OrgMask));
+ //So we are propagating the more probable error of the two which is the leaving of
+ // RenderFileL.
+ return err;
+ }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// Helper leaving function for the function RenderFileToBuffer.
+// The actual rendering happens in this function..while the calling function uses this to
+// render the file.
+// ---------------------------------------------------------------------------
+
+
+void CSvgEngineImpl::RenderFileL( const TDesC8& aSvgData,
+ CFbsBitmap* aFrameBuffer,
+ CFbsBitmap* aMask,
+ TBool aPreserveAspectRatio)
+
+{
+ CFont *lFont = iGfxContext->Font();
+ TFontSpec lFontSpec = lFont->FontSpecInTwips();
+
+ TSize imageSize;
+ imageSize = aFrameBuffer->SizeInPixels();
+ //iFrameBuffer = aFrameBuffer;
+
+ SetGdiContextL(aFrameBuffer, aMask);
+ CSvgDocumentImpl* lSvgDocument = CSvgDocumentImpl::NewLC(iSvgBitmapFontProvider);
+ SetDocument(lSvgDocument);
+ lSvgDocument->SetEngine(this);
+
+ // fileHandle is valid from client
+ lSvgDocument->Load( aSvgData, *iSvgError );
+ if ( iSvgError->HasError() && !iSvgError->IsWarning() )
+ {
+ CleanupStack::PopAndDestroy(1);
+ return;
+ }
+
+ StartFrameLoopL();
+ CSvgSvgElementImpl* lRoot = (CSvgSvgElementImpl*)lSvgDocument->RootElement();
+ _LIT( KPreserveAspectRatio, "preserveAspectRatio" );
+
+ if(lRoot)
+ {
+ if ( aPreserveAspectRatio )
+ {
+ _LIT( KXMidYMid, "xMidYMid" );
+ lRoot->SetAttributeL( KPreserveAspectRatio, KXMidYMid );
+ lRoot->SetWidth( imageSize.iWidth );
+ lRoot->SetHeight( imageSize.iHeight );
+ }
+ else {
+ _LIT( KNone, "none" );
+ lRoot->SetAttributeL( KPreserveAspectRatio, KNone );
+ lRoot->SetWidth( imageSize.iWidth );
+ lRoot->SetHeight( imageSize.iHeight );
+ }
+ RedrawL();
+ }
+ CleanupStack::PopAndDestroy( 1 );
+}
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// Generate a mask bitmap from alpha channel of the framebuffer.
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::GenerateMask(CFbsBitmap* aMask)
+ {
+ if ( iGfxContext )
+ {
+ iGfxContext->GenerateMask( aMask );
+ }
+ }
+
+//
+// ---------------------------------------------------------------------------
+// set background color
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::SetBackgroundColor(TUint32 aRGBA8888Color)
+ {
+ iBackgroundColor = aRGBA8888Color;
+ }
+
+//
+// ---------------------------------------------------------------------------
+// Get Size of render buffer
+// ---------------------------------------------------------------------------
+TSize CSvgEngineImpl::GetSize()
+ {
+ return iFrameBufferSize;
+
+
+
+ }
+
+
+//
+// ---------------------------------------------------------------------------
+// Return SVG Engine State
+// ---------------------------------------------------------------------------
+
+TSvgEngineState CSvgEngineImpl::SVGEngineState()
+ {
+ return iSvgEngineState;
+ }
+
+//
+// ---------------------------------------------------------------------------
+// Set SVG Engine State
+// ---------------------------------------------------------------------------
+
+void CSvgEngineImpl::SetSVGEngineState(TSvgEngineState aState)
+ {
+ iSvgEngineState = aState;
+ if( iSvgEngineState == ESVGEnginePaused )
+ {
+ if ( iSvgDocument )
+ {
+ iSvgDocument->TimeContainer()->UserPause();
+ NotifyAnimationPaused();
+ }
+ }
+ else if( iSvgEngineState == ESVGEngineRunning )
+ {
+ if (iSvgDocument && iSvgDocument->IsAnimationFile())
+ {
+ iSvgDocument->TimeContainer()->UserResume();
+ }
+ }
+ else if(iSvgEngineState == ESVGEngineStopped )
+ {
+ if ( iSvgDocument )
+ {
+ iSvgDocument->TimeContainer()->UserStop();
+ }
+
+ }
+ }
+
+void CSvgEngineImpl::SeekEngine( TUint32 aTime)
+ {
+ iSvgEngineState = ESVGEngineRunning;
+ if ( iSvgDocument )
+ {
+ iSvgDocument->TimeContainer()->UserSeek( aTime );
+ }
+ }
+
+void CSvgEngineImpl::ResetTimer()
+ {
+ if ( iSvgDocument )
+ {
+ iSvgDocument->TimeContainer()->UserResetTime();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// SetGdiContext File
+// ---------------------------------------------------------------------------
+
+void CSvgEngineImpl::SetGdiContextL(CFbsBitmap* aCurrentBitmap, CFbsBitmap* aMask)
+ {
+ // Handle for both Non-NULL and NULL parameter
+ iFrameBuffer = aCurrentBitmap;
+ iMask = aMask;
+
+ if ( aCurrentBitmap )
+ {
+ if ( !iGfxContext )
+ {
+ iGfxContext = CGfx2dGcOpenVG::NewL( iFrameBuffer->SizeInPixels(), iBitmapFontSpec, iSvgBitmapFontProvider );
+
+ // The API is called Only in case of JSR226. Incase if the midlet developer
+ // has changed the RedenderQuality of the midlet.ByDefualt the value of
+ // iRenderQuality is 2 i.e. VG_RENDERING_QUALITY_BETTER.
+ iGfxContext->SetAntialiasingMode( iRenderQuality );
+ }
+ else
+ {
+ iGfxContext->ChangeBufferSizeL( iFrameBuffer->SizeInPixels() );
+ }
+ }
+ else if ( iGfxContext )
+ {
+ iGfxContext->ChangeBufferSizeL( TSize( 0,0 ) );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// void CSvgEngineImpl::StartEngine(CSvgErrorImpl* aError)
+// ---------------------------------------------------------------------------
+
+void CSvgEngineImpl::StartEngine(CSvgErrorImpl* aError)
+ {
+ if ( !iFrameBuffer || !iSvgDocument )
+ {
+ return;
+ }
+
+ iMouseoverElement = NULL;
+ if ( ((iFrameBufferSize.iHeight <= 0 )||(iFrameBufferSize.iWidth <= 0 )) &&(( iFrameBuffer->SizeInPixels().iWidth == 0 ) ||
+ ( iFrameBuffer->SizeInPixels().iHeight == 0) ))
+ {
+ return;
+ }
+
+ TBool initialized = EFalse;
+
+ TRAPD( initError, initialized = StartFrameLoopL() );
+
+ if ( initError != KErrNone || !initialized )
+ {
+ return;
+ }
+
+ // Get the Engine State to Running
+ SetSVGEngineState(ESVGEngineRunning);
+
+ // Document is an animation
+ if( iSvgDocument->IsAnimationFile() )
+ {
+ { // Atleast first frame should get drawn
+ TRAPD(error, RedrawL() );
+ {
+ if ( error != KErrNone && aError != NULL )
+ {
+ if( error == KErrNoMemory )
+ {
+ CSvgDocumentImpl::PrepareError( *aError, ESvgNoMemory, error,
+ _L( "Unable to Draw: " ),
+ _L( "" ) );
+ return;
+ }
+
+ CSvgDocumentImpl::PrepareError( *aError, ESvgUnknown, error,
+ _L( "Unable to Draw: " ),
+ _L( "" ) );
+ return;
+ }
+ }
+
+ }
+
+ iSvgDocument->TimeContainer()->UserPlay();
+ iSvgDocument->iAnimationResetNeeded = ETrue;
+ }
+ // Static svg file
+ else
+ {
+ TRAPD(error, RedrawL() );
+ {
+ if ( error != KErrNone && aError != NULL )
+ {
+ if( error == KErrNoMemory )
+ {
+ CSvgDocumentImpl::PrepareError( *aError, ESvgNoMemory, error,
+ _L( "Unable to Draw: " ),
+ _L( "" ) );
+ return;
+ }
+
+ CSvgDocumentImpl::PrepareError( *aError, ESvgUnknown, error,
+ _L( "Unable to Draw: " ),
+ _L( "" ) );
+ return;
+ }
+ }
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::RenderFrame( TUint aCurrentTime )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::RenderFrame( TUint aCurrentTime )
+ {
+ if ( !iFrameBuffer || !iSvgDocument ||
+ iFrameBuffer->SizeInPixels().iWidth == 0 || iFrameBuffer->SizeInPixels().iHeight == 0 )
+ {
+ return;
+ }
+
+ if ( aCurrentTime == 0 )
+ {
+ SeekEngine( 0 );
+ }
+
+ iMouseoverElement = NULL;
+
+ CSvgSvgElementImpl* rootElement = (CSvgSvgElementImpl*)iSvgDocument->RootElement();
+
+ if (rootElement == NULL)
+ {
+ return;
+ }
+
+ TGfxRectangle2D viewBoxRect;
+ if (rootElement->GetViewBox(viewBoxRect))
+ {
+ //viewbox has been defined or set already
+ if (viewBoxRect.iWidth == TFloatFixPt(0) || viewBoxRect.iHeight == TFloatFixPt(0))
+ {
+ //viewbox has no area so dont render
+ return;
+ }
+ }
+
+ if( iRequestObserver && iSvgDocument->iEventHandler )
+ {
+ iRequestObserver->UpdatePresentation( iSvgDocument->iEventHandler->AnimationElementsCount() );
+ }
+
+ iSvgDocument->iInitialDrawFlag = ETrue;
+
+ // Fix for animation element for testApp
+ TSvgTick lTick;
+ lTick.iRealTimeTick = aCurrentTime;
+ lTick.iParentTcTick = 0;
+ iSvgDocument->TimeContainer()->ParentTimeContainerTick(lTick) ;
+ // Fix for animation element for testApp
+ }
+
+
+// ---------------------------------------------------------------------------
+// Set SvgEngine Document
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::SetDocument(CSvgDocumentImpl* aDocument)
+ {
+ iSvgDocument = aDocument;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Change the duration of the timer
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::ChangeDuration( TUint32 aTimerDuration )
+ {
+ if ( iSvgDocument )
+ {
+ iSvgDocument->TimeContainer()->UserChangeFrameDuration(
+ aTimerDuration );
+
+ // Check if there is animation element in the parent svg
+ RPointerArray<CSvgElementImpl> lAnimationEleList;
+ iSvgDocument->FindAllElements((CSvgElementImpl* )iSvgDocument->RootElement(),
+ KSvgMediaAnimationElement, lAnimationEleList );
+ TInt lAnimationEleCnt = lAnimationEleList.Count();
+ for ( TInt lCurAnimationEle = 0;
+ lCurAnimationEle < lAnimationEleCnt; lCurAnimationEle++ )
+ {
+ CSvgMediaAnimationElementImpl* lAnimationElement =
+ (CSvgMediaAnimationElementImpl* )lAnimationEleList[ lCurAnimationEle ];
+ CSvgDocumentImpl* lChildDoc = lAnimationElement->GetChildDocument();
+ if ( lChildDoc )
+ {
+ lChildDoc->TimeContainer()->UserChangeFrameDuration(
+ aTimerDuration ); // Change Frame duration for child svg
+ }
+ }
+ lAnimationEleList.Close();
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::Resume(TInt32 aTime)
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::Resume(TInt32 aTime)
+ {
+ if ( iSvgDocument )
+ {
+ iSvgDocument->TimeContainer()->UserResume( aTime );
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::FindBBoxesForRotatedText( const TDesC& aSearchString,
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::FindBBoxesForRotatedText( const TDesC& aSearchString,
+ RPointerArray<MRect>& aBoundingBoxes,
+ RArray<TPtrC>& aTexts,
+ RArray<TInt>& aElementIds,
+ TBool aCaseSensitive )
+{
+ if ( iSvgDocument == NULL )
+ return;
+
+ if ( iSvgTextBoundingBoxes.Count() > 0 )
+ {
+ iSvgTextBoundingBoxes.ResetAndDestroy();
+ }
+
+ // Find all text elements
+ HBufC* searchStr = aSearchString.AllocLC();
+ TPtr searchStrPtr = searchStr->Des();
+ RPointerArray<CSvgElementImpl> textElements;
+ iSvgDocument->FindAllElements( (CSvgElementImpl* )iSvgDocument->RootElement(),
+ KSvgTextElement, textElements );
+ // Himanshu: Find all animation elements
+ RPointerArray<CSvgElementImpl> lAllAnimationElements;
+ iSvgDocument->FindAllElements( (CSvgElementImpl*)iSvgDocument->RootElement(),
+ KSvgMediaAnimationElement,
+ lAllAnimationElements );
+ TInt lAllAnimationEleCnt = lAllAnimationElements.Count();
+ for ( TInt i = 0; i < lAllAnimationEleCnt; i++ )
+ {
+ CSvgMediaAnimationElementImpl* element = (CSvgMediaAnimationElementImpl*)lAllAnimationElements[i];
+ CSvgDocumentImpl* ldoc = element->GetChildDocument();
+ if(ldoc)
+ {
+ // Find all text elements in child document
+ ldoc->FindAllElements( (CSvgElementImpl*)ldoc->RootElement(),
+ KSvgTextElement,
+ textElements );
+ }
+
+ }
+ lAllAnimationElements.Close();
+
+ TSvgFourPointRect boundingBox;
+ TInt textEleCnt = textElements.Count();
+ for ( TInt i = 0; i < textEleCnt; i++ )
+ {
+ CSvgTextElementImpl* textElement = (CSvgTextElementImpl*)textElements[i];
+ TPtrC remainder( textElement->GetText() );
+
+ TInt index = ( aCaseSensitive ) ? remainder.Find( aSearchString ) :
+ remainder.FindF( aSearchString );
+
+ // continue to next element if nothing found
+ if ( index == KErrNotFound )
+ continue;
+
+ searchStrPtr.Copy( remainder.Mid(index,aSearchString.Length()) );
+ // Get the bounding box for the whole text element
+ textElement->GetFourPointBBox( boundingBox );
+
+ // Get bounding box for every occurrence
+ TReal32 textAdvance = (TReal32)(textElement->TextAdvance( *searchStr, index ));
+ TReal32 leftAdvance = 0.0f;
+ //TReal32 aHeight = textElement->Ascent() + textElement->Descent();
+
+ while ( index != KErrNotFound )
+ {
+ // Calculate boundingbox for searched-text
+ // indeterminate results with a string only one character long
+ leftAdvance = leftAdvance + (TReal32)(textElement->TextAdvance( remainder.Left( index )));
+
+ // need to setup slope calculation here to determine where the new
+ // four point rect should be for partial pieces of text
+
+ // need to do something for both vertical and horizontal text 0 and na slopes
+
+ TReal32 dy = (TReal32)boundingBox.iPoint2.iY - (TReal32)boundingBox.iPoint1.iY;
+ TReal32 dx = (TReal32)boundingBox.iPoint2.iX - (TReal32)boundingBox.iPoint1.iX;
+
+ double aSlopeRan;
+ Math::ATan(aSlopeRan, dy, dx);
+
+ double aSinVal;
+ Math::Sin(aSinVal, aSlopeRan);
+
+ double aCosVal;
+ Math::Cos(aCosVal, aSlopeRan);
+
+
+ TReal32 x1 = aCosVal * leftAdvance + (TReal32)boundingBox.iPoint1.iX;
+ TReal32 x3 = aCosVal * leftAdvance + (TReal32)boundingBox.iPoint3.iX;
+ TReal32 y1 = aSinVal * leftAdvance + (TReal32)boundingBox.iPoint1.iY;
+ TReal32 y3 = aSinVal * leftAdvance + (TReal32)boundingBox.iPoint3.iY;
+
+ TReal32 x2 = aCosVal * textAdvance + x1;
+ TReal32 x4 = aCosVal * textAdvance + x3;
+
+ TReal32 y2 = aSinVal * textAdvance + y1;
+ TReal32 y4 = aSinVal * textAdvance + y3;
+
+ TSvgFourPointRect* bbox = NULL;
+
+ TRAP_IGNORE( bbox = new (ELeave) TSvgFourPointRect( TPoint(x1, y1),
+ TPoint(x2, y2),
+ TPoint(x3, y3),
+ TPoint(x4, y4)) );
+
+ if ( !bbox )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("Four Point Rect Failed: Out of Memory");
+ #endif
+ return;
+ }
+
+ // store bound box pointers to go back to client
+ aBoundingBoxes.Append( (MRect*)bbox );
+
+ iSvgTextBoundingBoxes.Append( bbox );
+
+ // store point to text
+ aTexts.Append( TPtrC( textElement->GetText() ) );
+ aElementIds.Append( (TInt)textElement );
+
+ remainder.Set( remainder.Right( remainder.Length() - index - aSearchString.Length() ) );
+ leftAdvance = leftAdvance + textAdvance;
+ index = ( aCaseSensitive ) ? remainder.Find( aSearchString ) :
+ remainder.FindF( aSearchString );
+ }
+ }
+ CleanupStack::PopAndDestroy(searchStr);
+ textElements.Close();
+}
+
+//this is the old 2point rect way that only works for horizontal text
+/*void CSvgEngineImpl::FindBBoxesForHorizontalText( const TDesC& aSearchString,
+ RArray<TRect>& aBoundingBoxes,
+ RArray<TPtrC>& aTexts,
+ RArray<TInt>& aElementIds,
+ TBool aCaseSensitive )
+{
+ if ( iSvgDocument == NULL )
+ return;
+
+ // Find all text elements
+ RPointerArray<CSvgElementImpl> textElements;
+ iSvgDocument->FindAllElements( (CSvgElementImpl* )iSvgDocument->RootElement(),
+ KSvgTextElement, textElements );
+
+ TGfxRectangle2D boundingBox;
+ for ( TInt i = 0; i < textElements.Count(); i++ )
+ {
+ CSvgTextElementImpl* textElement = (CSvgTextElementImpl*)textElements[i];
+ TPtrC remainder( textElement->GetText() );
+
+ TInt index = ( aCaseSensitive ) ? remainder.Find( aSearchString ) :
+ remainder.FindF( aSearchString );
+
+ // continue to next element if nothing found
+ if ( index == KErrNotFound )
+ continue;
+
+ // Get the bounding box for the whole text element
+ textElement->GetBBox( boundingBox );
+
+ // Get bounding box for every occurrence
+ TFloatFixPt textAdvance = textElement->TextAdvance( aSearchString, index );
+ TFloatFixPt leftAdvance = 0.0f;
+ while ( index != KErrNotFound )
+ {
+ // Calculate boundingbox for searched-text
+ leftAdvance = leftAdvance + textElement->TextAdvance( remainder.Left( index ), index );
+
+ TRect bbox( (TInt)boundingBox.iX + (TInt)leftAdvance,
+ (TInt)boundingBox.iY,
+ (TInt)boundingBox.iX + (TInt)leftAdvance + (TInt)textAdvance,
+ (TInt)boundingBox.iY + (TInt)boundingBox.iHeight );
+
+ // store bound box
+ aBoundingBoxes.Append( bbox );
+
+ // store point to text
+ aTexts.Append( TPtrC( textElement->GetText() ) );
+ aElementIds.Append( (TInt)textElement );
+
+ remainder.Set( remainder.Right( remainder.Length() - index - aSearchString.Length() ) );
+ leftAdvance = leftAdvance + textAdvance;
+ index = ( aCaseSensitive ) ? remainder.Find( aSearchString ) :
+ remainder.FindF( aSearchString );
+ }
+ }
+ textElements.Close();
+}
+*/
+
+/************************ HyperLinking Functions ***********************/
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::CheckForHyperlinkMouseover( TInt aX, TInt aY )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::CheckForHyperlinkMouseover( TInt aX, TInt aY )
+{
+ if ( iHyperlinkListeners.Count() == 0 )
+ return;
+
+ if ( iSvgDocument == NULL )
+ return;
+
+ // Gather <a> elements if first time
+ RPointerArray<CSvgElementImpl> iAElementList;
+ if ( iAElementList.Count() == 0 )
+ {
+ iSvgDocument->FindAllElements( (CSvgElementImpl* )iSvgDocument->RootElement(),
+ KSvgAElement, iAElementList );
+ }
+
+ // find the bounding box containing point
+ TGfxPoint2D point( aX, aY );
+ TGfxRectangle2D boundingBox;
+ TInt aEleListCnt = iAElementList.Count();
+ for ( TInt i = 0; i < aEleListCnt; i++ )
+ {
+ CSvgElementImpl* element = iAElementList[i];
+ CSvgGElementImpl::GetGroupBounding( boundingBox, element );
+ if ( boundingBox.Contains( point ) )
+ {
+ // no existing mouse over element: notify HyperlinkEntered
+ if ( iMouseoverElement == NULL )
+ {
+ NotifyHyperlinkEntered( element->Href() );
+ }
+ // otherwise: notify HyperlinkExited, HyperlinkEntered
+ else if ( iMouseoverElement != element )
+ {
+ NotifyHyperlinkExited( iMouseoverElement->Href() );
+ NotifyHyperlinkEntered( element->Href() );
+ }
+ iMouseoverElement = element;
+ return;
+ }
+ }
+
+ // no bounding box containing point: notify HyperlinkExited
+ if ( iMouseoverElement != NULL )
+ {
+ NotifyHyperlinkExited( iMouseoverElement->Href() );
+ iMouseoverElement = NULL;
+ }
+
+ iAElementList.Close();
+}
+
+/*-------------------------Animation Listeners-----------------------------*/
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::AddAnimationListener( MSvgAnimationListener* aListener )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::AddAnimationListener( MSvgAnimationListener* aListener )
+{
+ if ( aListener != NULL && iAnimationListeners.Find( aListener ) == KErrNotFound )
+ iAnimationListeners.Append( aListener );
+
+}
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::RemoveAnimationListener( MSvgAnimationListener* aListener )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::RemoveAnimationListener( MSvgAnimationListener* aListener )
+{
+ TInt index = iAnimationListeners.Find( aListener );
+ if ( index != KErrNotFound )
+ iAnimationListeners.Remove( index );
+}
+
+/*-------------------------Animation listener notification to client-------*/
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyAnimationStarted()
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyAnimationStarted()
+{
+
+ TBool isAnimationIndefinite = EFalse;
+ if ( ( iSvgDocument == NULL ) || ( iSvgDocument->RootElement() == NULL ) ||
+ ( iAnimationListeners.Count() == 0 ) )
+ {
+ return;
+ }
+
+ RPointerArray<CSvgElementImpl> AnimationElementList;
+
+ iSvgDocument->FindAllElements( (CSvgElementImpl* )iSvgDocument->RootElement(),
+ KSvgSetElement, AnimationElementList );
+ iSvgDocument->FindAllElements( (CSvgElementImpl* )iSvgDocument->RootElement(),
+ KSvgAnimateElement, AnimationElementList );
+ iSvgDocument->FindAllElements( (CSvgElementImpl* )iSvgDocument->RootElement(),
+ KSvgAnimateMotionElement, AnimationElementList );
+ iSvgDocument->FindAllElements( (CSvgElementImpl* )iSvgDocument->RootElement(),
+ KSvgAnimateTransformElement, AnimationElementList );
+ iSvgDocument->FindAllElements( (CSvgElementImpl* )iSvgDocument->RootElement(),
+ KSvgAnimateColorElement, AnimationElementList );
+
+ if ( AnimationElementList.Count() != 0 )
+ {
+ TInt animationEleListCnt = AnimationElementList.Count();
+ for ( TInt i=0; i < animationEleListCnt; i++ )
+ {
+ CSvgElementImpl * element = AnimationElementList[i];
+ if ( ((CSvgAnimationBase *)element)->CompleteDuration() == KTimeIndefinite )
+ {
+ isAnimationIndefinite = ETrue;
+ break;
+ }
+ }
+
+ }
+ AnimationElementList.Close();
+
+ TInt animationListenersCnt = iAnimationListeners.Count();
+ for ( TInt i = 0; i < animationListenersCnt; i++ )
+ iAnimationListeners[i]->AnimationStarted( isAnimationIndefinite );
+
+
+}
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyAnimationPaused()
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyAnimationPaused()
+{
+ TInt animationListenersCnt = iAnimationListeners.Count();
+ for ( TInt i = 0; i < animationListenersCnt; i++ )
+ iAnimationListeners[i]->AnimationPaused();
+}
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyAnimationEnded()
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyAnimationEnded()
+{
+ if ( ( iSvgDocument == NULL ) || ( iSvgDocument->RootElement() == NULL ) ||
+ ( iAnimationListeners.Count() == 0 ) )
+ {
+ return;
+ }
+ #if 0
+ RPointerArray<CSvgElementImpl> AnimationElementList;
+
+ FindAllElements( (CSvgElementImpl* )iSvgDocument->RootElement(),
+ KSvgSetElement, AnimationElementList );
+ FindAllElements( (CSvgElementImpl* )iSvgDocument->RootElement(),
+ KSvgAnimateElement, AnimationElementList );
+ FindAllElements( (CSvgElementImpl* )iSvgDocument->RootElement(),
+ KSvgAnimateMotionElement, AnimationElementList );
+ FindAllElements( (CSvgElementImpl* )iSvgDocument->RootElement(),
+ KSvgAnimateTransformElement, AnimationElementList );
+ FindAllElements( (CSvgElementImpl* )iSvgDocument->RootElement(),
+ KSvgAnimateColorElement, AnimationElementList );
+
+ if ( AnimationElementList.Count() != 0 )
+ {
+ TInt animationEleListCnt = AnimationElementList.Count();
+ for ( TInt i=0; i < animationEleListCnt; i++ )
+ {
+ CSvgElementImpl * element = AnimationElementList[i];
+ if ( ((CSvgAnimationBase *)element)->iAnimStatus == KAnimActive )
+ {
+ AnimationElementList.Close();
+ return;
+ }
+ }
+
+ }
+ AnimationElementList.Close();
+#endif
+
+ TInt animationListenersCnt = iAnimationListeners.Count();
+ for ( TInt i = 0; i < animationListenersCnt; i++ )
+ iAnimationListeners[i]->AnimationEnded();
+
+}
+
+/*------------------Register Client Text Area listeners----------------------------*/
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::AddTextAreaListener( MSvgTextAreaListener* aListener )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::AddTextAreaListener( MSvgTextAreaListener* aListener )
+{
+ if ( aListener != NULL && iTextAreaListeners.Find( aListener ) == KErrNotFound )
+ {
+ iTextAreaListeners.Append( aListener );
+ }
+}
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::RemoveTextAreaListener( MSvgTextAreaListener* aListener )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::RemoveTextAreaListener( MSvgTextAreaListener* aListener )
+{
+ TInt index = iTextAreaListeners.Find( aListener );
+ if ( index != KErrNotFound )
+ {
+ iTextAreaListeners.Remove( index );
+ }
+}
+
+/*----------------Text Area listener notification to client--------------*/
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyTextAreaEntered( CSvgTextAreaElementImpl* aTextAreaHandle )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyTextAreaEntered( CSvgTextAreaElementImpl* aTextAreaHandle )
+{
+ TInt textAreaListenersCnt = iTextAreaListeners.Count();
+ for (TInt i=0; i < textAreaListenersCnt; i++)
+ {
+ iTextAreaListeners[i]->TextAreaEntered( (TInt)aTextAreaHandle);
+ }
+}
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyTextAreaExited( CSvgTextAreaElementImpl* aTextAreaHandle )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyTextAreaExited( CSvgTextAreaElementImpl* aTextAreaHandle )
+{
+ TInt textAreaListenersCnt = iTextAreaListeners.Count();
+ for (TInt i=0; i < textAreaListenersCnt; i++)
+ {
+ iTextAreaListeners[i]->TextAreaExited( (TInt)aTextAreaHandle);
+ }
+}
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyTextAreaActivated( CSvgTextAreaElementImpl* aTextAreaHandle )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyTextAreaActivated( CSvgTextAreaElementImpl* aTextAreaHandle )
+{
+ TInt textAreaListenersCnt = iTextAreaListeners.Count();
+ for (TInt i=0; i < textAreaListenersCnt; i++)
+ {
+ iTextAreaListeners[i]->TextAreaActivated( (TInt)aTextAreaHandle );
+ }
+}
+
+/*------------------Register Client Text listeners----------------------------*/
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::AddTextListener( MSvgTextListener* aListener )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::AddTextListener( MSvgTextListener* aListener )
+{
+ if ( aListener != NULL && iTextListeners.Find( aListener ) == KErrNotFound )
+ {
+ iTextListeners.Append( aListener );
+ }
+}
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::RemoveTextListener( MSvgTextListener* aListener )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::RemoveTextListener( MSvgTextListener* aListener )
+{
+ TInt index = iTextListeners.Find( aListener );
+ if ( index != KErrNotFound )
+ {
+ iTextListeners.Remove( index );
+ }
+}
+
+/*----------------Text listener notification to client--------------*/
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyTextEntered( CSvgTextElementImpl* aTextHandle )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyTextEntered( CSvgTextElementImpl* aTextHandle )
+{
+ TInt textListenersCnt = iTextListeners.Count();
+ for (TInt i=0; i < textListenersCnt; i++)
+ {
+ iTextListeners[i]->TextEntered( (TInt)aTextHandle);
+ }
+}
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyTextExited( CSvgTextElementImpl* aTextHandle )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyTextExited( CSvgTextElementImpl* aTextHandle )
+{
+ TInt textListenersCnt = iTextListeners.Count();
+ for (TInt i=0; i < textListenersCnt; i++)
+ {
+ iTextListeners[i]->TextExited( (TInt)aTextHandle);
+ }
+}
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyTextActivated( CSvgTextElementImpl* aTextHandle )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyTextActivated( CSvgTextElementImpl* aTextHandle )
+{
+ TInt textListenersCnt = iTextListeners.Count();
+ for (TInt i=0; i < textListenersCnt; i++)
+ {
+ iTextListeners[i]->TextActivated( (TInt)aTextHandle );
+ }
+}
+
+/*---------------------Register Client Hyperlink listeners----------------------------*/
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::AddHyperlinkListener( MSvgHyperlinkListener* aListener )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::AddHyperlinkListener( MSvgHyperlinkListener* aListener )
+{
+ if ( aListener != NULL && iHyperlinkListeners.Find( aListener ) == KErrNotFound )
+ iHyperlinkListeners.Append( aListener );
+}
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::RemoveHyperlinkListener( MSvgHyperlinkListener* aListener )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::RemoveHyperlinkListener( MSvgHyperlinkListener* aListener )
+{
+ TInt index = iHyperlinkListeners.Find( aListener );
+ if ( index != KErrNotFound )
+ iHyperlinkListeners.Remove( index );
+}
+
+void CSvgEngineImpl::AddViewPortListener(MSvgViewPortListener* aListener)
+{
+ if ( aListener != NULL )
+ {
+ iViewPortListener = aListener ;
+ }
+
+}
+
+
+void CSvgEngineImpl::RemoveViewPortListener(MSvgViewPortListener*
+ /* aListener */ )
+{
+ if(iViewPortListener != NULL)
+ {
+ iViewPortListener = NULL;
+ }
+}
+/*----------------Hyperlink listener notification to client--------------*/
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyHyperlinkEntered( CSvgAElementImpl* aAElementHandle )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyHyperlinkEntered( CSvgAElementImpl* aAElementHandle )
+{
+ TInt hyperLinkListenersCnt = iHyperlinkListeners.Count();
+ for ( TInt i = 0; i < hyperLinkListenersCnt; i++ )
+ {
+ if (aAElementHandle)
+ {
+ iHyperlinkListeners[i]->LinkEntered( aAElementHandle->Href() );
+ }
+ }
+}
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyHyperlinkEntered( const TDesC& aUri )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyHyperlinkEntered( const TDesC& aUri )
+{
+ TInt hyperLinkListenersCnt = iHyperlinkListeners.Count();
+ for ( TInt i = 0; i < hyperLinkListenersCnt; i++ )
+ {
+ iHyperlinkListeners[i]->LinkEntered( aUri );
+ }
+}
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyHyperlinkExited( CSvgAElementImpl* aAElementHandle )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyHyperlinkExited( CSvgAElementImpl* aAElementHandle )
+{
+ TInt hyperLinkListenersCnt = iHyperlinkListeners.Count();
+ for ( TInt i = 0; i < hyperLinkListenersCnt; i++ )
+ {
+ if (aAElementHandle)
+ {
+ iHyperlinkListeners[i]->LinkExited( aAElementHandle->Href() );
+ }
+ }
+}
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyHyperlinkExited( const TDesC& aUri )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyHyperlinkExited( const TDesC& aUri )
+{
+ TInt hyperLinkListenersCnt = iHyperlinkListeners.Count();
+ for ( TInt i = 0; i < hyperLinkListenersCnt; i++ )
+ {
+ iHyperlinkListeners[i]->LinkExited( aUri );
+ }
+}
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyHyperlinkActivated( CSvgAElementImpl* aAElementHandle )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyHyperlinkActivated( CSvgAElementImpl* aAElementHandle )
+{
+ if ( !aAElementHandle ||
+ aAElementHandle->Href().Length() == 0 ||
+ aAElementHandle->Href()[0] == '#' )
+ {
+ return;
+ }
+
+ TInt hyperLinkListenersCnt = iHyperlinkListeners.Count();
+ for ( TInt i = 0; i < hyperLinkListenersCnt; i++ )
+ {
+ iHyperlinkListeners[i]->LinkActivated( aAElementHandle->Href() );
+ }
+}
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyHyperlinkActivated( const TDesC& aUri )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyHyperlinkActivated( const TDesC& aUri )
+{
+ TInt hyperLinkListenersCnt = iHyperlinkListeners.Count();
+ for ( TInt i = 0; i < hyperLinkListenersCnt; i++ )
+ {
+ iHyperlinkListeners[i]->LinkActivated( aUri );
+ }
+}
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyHyperlinkActivatedWithShow( const TDesC& aUri, const TDesC& aShow )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyHyperlinkActivatedWithShow( const TDesC& aUri, const TDesC& aShow )
+{
+ TInt hyperLinkListenersCnt = iHyperlinkListeners.Count();
+ for ( TInt i = 0; i < hyperLinkListenersCnt; i++ )
+ iHyperlinkListeners[i]->LinkActivatedWithShow( aUri, aShow );
+}
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyElementActivatedLinkEntered( CSvgElementImpl* aElement)
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyElementActivatedLinkEntered( CSvgElementImpl* aElement)
+ {
+ if(iMouseoverElement == NULL)
+ {
+ const TDesC* myId = aElement->Id();
+
+ if (myId)
+ NotifyHyperlinkEntered( *(myId));
+ iMouseoverElement = aElement;
+ }
+ }
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyElementActivatedLinkExited( CSvgElementImpl* aElement)
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyElementActivatedLinkExited( CSvgElementImpl* aElement)
+ {
+ if(iMouseoverElement == aElement )
+ {
+ const TDesC* myId = aElement->Id();
+
+ if (myId)
+ NotifyHyperlinkExited( *(myId));
+ iMouseoverElement = NULL;
+ }
+ }
+void CSvgEngineImpl::GetViewPort(TInt getWidth, TInt getHeight, TBool isWidthInPer, TBool isHeightInPer, TInt &setWidth, TInt &setHeight)
+{
+ if(iViewPortListener != NULL)
+ {
+ iViewPortListener->GetViewPort(getWidth, getHeight, isWidthInPer, isHeightInPer, setWidth, setHeight);
+ }
+}
+
+/*------------------Register Client Interactive Element listeners------------*/
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::AddInteractiveElementListener(
+// MSvgInteractiveElementListener* aListener )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::AddInteractiveElementListener(
+ MSvgInteractiveElementListener* aListener )
+ {
+ if (
+ aListener != NULL &&
+ iInteractiveElementListeners.Find( aListener ) == KErrNotFound )
+ {
+ iInteractiveElementListeners.Append( aListener );
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::RemoveInteractiveElementListener(
+// MSvgInteractiveElementListener* aListener )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::RemoveInteractiveElementListener(
+ MSvgInteractiveElementListener* aListener )
+ {
+ TInt index = iInteractiveElementListeners.Find( aListener );
+ if ( index != KErrNotFound )
+ {
+ iInteractiveElementListeners.Remove( index );
+ }
+ }
+
+/*-----------Interactive Element listener notification to client------------*/
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyInteractiveElementEntered(CSvgElementImpl* aElement)
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyInteractiveElementEntered(
+ CSvgElementImpl* aElement)
+ {
+ TUint16 lsubeventmask=0;
+ TBool linteractivity;
+ linteractivity=this->iSvgDocument->iEventHandler->
+ CheckInteractivityAndGetSubEventMask(aElement,lsubeventmask);
+ if(linteractivity)
+ {
+ TInt linteractiveElementListenersCnt = iInteractiveElementListeners.Count();
+ for ( TInt i = 0; i < linteractiveElementListenersCnt; i++ )
+ {
+ const TDesC* myId = aElement->Id();
+ TPtrC16 ptr;
+ if(myId)
+ {
+ ptr.Set(*myId);
+ }
+ else
+ {
+ _LIT(KEmptyString,"");
+ ptr.Set( KEmptyString);
+ }
+ iInteractiveElementListeners[i]->InteractiveElementEntered(
+ ptr,lsubeventmask );
+ }
+ }
+ }
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyInteractiveElementExited(CSvgElementImpl* aElement)
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyInteractiveElementExited(CSvgElementImpl* aElement)
+ {
+ TInt linteractiveElementListenersCnt = iInteractiveElementListeners.Count();
+ for ( TInt i = 0; i < linteractiveElementListenersCnt; i++ )
+ {
+ const TDesC* myId = aElement->Id();
+ TPtrC16 ptr;
+ if(myId)
+ {
+ ptr.Set(*myId);
+ }
+ else
+ {
+ _LIT(KEmptyString,"");
+ ptr.Set(KEmptyString);
+ }
+ iInteractiveElementListeners[i]->InteractiveElementExited(ptr);
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Set SVG Dimension to frame buffer size
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::SetSvgDimensionToFrameBufferL(TUint aWidth, TUint aHeight)
+ {
+ if (iSvgDocument == NULL ) return;
+ if (iSvgDocument->RootElement() != NULL)
+ {
+ CSvgElementImpl* theElement = (CSvgElementImpl*)(iSvgDocument->RootElement());
+ ((CSvgSvgElementImpl*)theElement)->iWidthInUserCoordinate = 0;
+ ((CSvgSvgElementImpl*)theElement)->iHeightInUserCoordinate = 0;
+ TFloatFixPt wFix( (TInt)aWidth );
+ TFloatFixPt hFix( (TInt)aHeight );
+ theElement->SetAttributeFloatL(KAtrWidth, wFix );
+ theElement->SetAttributeFloatL(KAtrHeight, hFix );
+ }
+
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::SetMediaTime(TUint32 aTimeInMilliSeconds)
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::SetMediaTime(TUint32 aTimeInMilliSeconds)
+ {
+ // Set Current Time in the document
+ if(iSvgDocument != NULL)
+ {
+ //iSvgDocument->SetCurrentTime( aTimeInMilliSeconds );
+
+ iSvgDocument->iAnimationResetNeeded = ETrue;
+ }
+ if(this->iSvgDocument && this->iSvgDocument->iEventHandler)
+ {
+ this->iSvgDocument->iEventHandler->SetCurrentTime(aTimeInMilliSeconds);
+ }
+ // Find all animation elements in the document
+ RPointerArray<CSvgElementImpl> lAnimationEleList;
+ if(iSvgDocument)
+ {
+ iSvgDocument->FindAllElements((CSvgElementImpl* )iSvgDocument->RootElement(),
+ KSvgMediaAnimationElement, lAnimationEleList );
+ TInt lAnimationEleCnt = lAnimationEleList.Count();
+ for ( TInt lCurAnimationEle = 0;
+ lCurAnimationEle < lAnimationEleCnt; lCurAnimationEle++ )
+ {
+ CSvgMediaAnimationElementImpl* lAnimationElement =
+ (CSvgMediaAnimationElementImpl* )lAnimationEleList[ lCurAnimationEle ];
+ CSvgDocumentImpl* lChildDoc = lAnimationElement->GetChildDocument();
+ if ( lChildDoc )
+ {
+ lChildDoc->iAnimationResetNeeded = ETrue;
+ if ( lChildDoc->iEventHandler )
+ {
+ lChildDoc->iEventHandler->SetCurrentTime(aTimeInMilliSeconds);
+ }
+
+ }
+ }
+ lAnimationEleList.Close();
+
+ }
+ this->SetSVGEngineState(ESVGEnginePaused);
+ this->SeekEngine(aTimeInMilliSeconds);
+
+ }
+
+// --------------------------------------------------------------------------
+// TBool CSvgEngineImpl::IsElementVisible( TInt aElementId )
+// ---------------------------------------------------------------------------
+TBool CSvgEngineImpl::IsElementVisible( TInt aElementId )
+ {
+ if ( aElementId == 0 || iFrameBuffer == NULL )
+ {
+ return EFalse;
+ }
+
+ CSvgElementImpl* element = (CSvgElementImpl*)aElementId;
+
+ TInt32 visibleAttribute = -1;
+
+ TRAPD(error,element->GetAttributeIntL( KCSS_ATTR_VISIBILITY, visibleAttribute ));
+ if (error != KErrNone)
+ {
+ // error processing
+ }
+
+
+ return visibleAttribute == 0;
+ }
+
+// Set whether to call request observer's UpdateScreen method
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::SetIgnoreUpdateScreen( TBool aBool )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::SetIgnoreUpdateScreen( TBool aBool )
+{
+ iIgnoreUpdateScreen = aBool;
+}
+
+/*---------------------------MouseListener---------------------------*/
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::AddMouseListener( const MSvgMouseListener* aListener )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::AddMouseListener( const MSvgMouseListener* aListener )
+ {
+ TInt index = iSvgMouseListeners.Find( aListener );
+ if ( aListener != NULL && index == KErrNotFound )
+ {
+ iSvgMouseListeners.Append( aListener );
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::RemoveMouseListener( const MSvgMouseListener* aListener )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::RemoveMouseListener( const MSvgMouseListener* aListener )
+ {
+ TInt index = iSvgMouseListeners.Find( aListener );
+ if ( index != KErrNotFound )
+ {
+ iSvgMouseListeners.Remove( index );
+ }
+ }
+
+// --------------------------------------------------------------------------
+// TInt CSvgEngineImpl::MouseListenerCount()
+// ---------------------------------------------------------------------------
+TInt CSvgEngineImpl::MouseListenerCount()
+ {
+ return iSvgMouseListeners.Count();
+ }
+
+/*-------------MouseListener Notifications back to client---------------------------*/
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyMousePressed( RPointerArray<CSvgElementImpl>& aElements,
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyMousePressed( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY )
+ {
+ TInt svgMouseListenersCnt = iSvgMouseListeners.Count();
+ for ( TInt i = 0; i < svgMouseListenersCnt; i++ )
+ {
+ iSvgMouseListeners[i]->MousePressed( aElements, aX, aY );
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyMouseReleased( RPointerArray<CSvgElementImpl>& aElements,
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyMouseReleased( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY )
+ {
+ TInt svgMouseListenersCnt = iSvgMouseListeners.Count();
+ for ( TInt i = 0; i < svgMouseListenersCnt; i++ )
+ {
+ iSvgMouseListeners[i]->MouseReleased( aElements, aX, aY );
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyMouseEntered( RPointerArray<CSvgElementImpl>& aElements,
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyMouseEntered( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY )
+ {
+ TInt svgMouseListenersCnt = iSvgMouseListeners.Count();
+ for ( TInt i = 0; i < svgMouseListenersCnt; i++ )
+ {
+ iSvgMouseListeners[i]->MouseEntered( aElements, aX, aY );
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyMouseExited( RPointerArray<CSvgElementImpl>& aElements,
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyMouseExited( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY )
+ {
+ TInt svgMouseListenersCnt = iSvgMouseListeners.Count();
+ for ( TInt i = 0; i < svgMouseListenersCnt; i++ )
+ {
+ iSvgMouseListeners[i]->MouseExited( aElements, aX, aY );
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::NotifyMouseMoved( RPointerArray<CSvgElementImpl>& aElements,
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::NotifyMouseMoved( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY )
+ {
+ TInt svgMouseListenersCnt = iSvgMouseListeners.Count();
+ for ( TInt i = 0; i < svgMouseListenersCnt; i++ )
+ {
+ iSvgMouseListeners[i]->MouseMoved( aElements, aX, aY );
+ }
+ }
+
+/*---------------------------------------------------------------------*/
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::GetViewableElementsAtPoint( RPointerArray<CSvgElementImpl>& aElements, TInt aX, TInt aY )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::GetViewableElementsAtPoint( CSvgDocumentImpl* aSvgDocument, RPointerArray<CSvgElementImpl>& aElements, TInt aX, TInt aY )
+ {
+ if ( aSvgDocument == NULL )
+ return;
+
+ //JSR226 Change this could slow down event handling but it seems to be required to work
+ UpdateCTM(aSvgDocument);
+
+ // Gather all "viewable" elements
+ RPointerArray<CSvgElementImpl> iViewableElementList;
+ if ( iViewableElementList.Count() == 0 )
+ {
+ FindAllViewableElements( (CSvgElementImpl* )aSvgDocument->RootElement(),
+ iViewableElementList );
+ }
+
+ // find the bounding box containing point
+ TGfxPoint2D point( aX, aY );
+ TGfxRectangle2D boundingBox;
+ TInt viewableEleListCnt = iViewableElementList.Count();
+ for ( TInt i = 0; i < viewableEleListCnt; i++ )
+ {
+ CSvgElementImpl* element = iViewableElementList[i];
+ element->GetBBox( boundingBox );
+ if ( boundingBox.Contains( point ) )
+ {
+ aElements.Append( element );
+ }
+ }
+ // Display of list
+ iViewableElementList.Close();
+ }
+
+// Return all viewable elements
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::FindAllViewableElements( CSvgElementImpl* aStartElement,
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::FindAllViewableElements( CSvgElementImpl* aStartElement,
+ RPointerArray<CSvgElementImpl>& iElementList )
+ {
+ if ( aStartElement == NULL )
+ return;
+ // The child elements of the defs element should not be viewable. skip the
+ // tree traversing if the element id is defs element
+ if(aStartElement->ElemID() == KSvgDefsElement)
+ return;
+
+ CSvgElementImpl* child = (CSvgElementImpl*)aStartElement->FirstChild();
+ while ( child != NULL )
+ {
+ // add to list if child is found
+ TInt32 displayValue = 0;
+ TRAP_IGNORE(child->GetAttributeIntL( KCSS_ATTR_DISPLAY, displayValue ));
+ if ( child->IsViewable() && child->IsVisible() && displayValue != KDisplayEnumNone )
+ {
+ //JSR226 CHANGE do we care if multiple signals are sent to some elements - would be faster without this check
+ if ( iElementList.Find( child ) == KErrNotFound )
+ {
+ iElementList.Append( child );
+ }
+ }
+ // find in grandchildren
+ FindAllViewableElements( child, iElementList );
+ child = (CSvgElementImpl*)child->NextSibling();
+ }
+ }
+
+// Return all non-viewable elements
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::FindAllNonViewableElements( CSvgElementImpl* aStartElement,
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::FindAllNonViewableElements( CSvgElementImpl* aStartElement,
+ RPointerArray<CSvgElementImpl>& iElementList )
+ {
+ if ( aStartElement == NULL )
+ return;
+
+ CSvgElementImpl* child = (CSvgElementImpl*)aStartElement->FirstChild();
+ while ( child != NULL )
+ {
+ // add to list if child is found
+ if ( !child->IsViewable() && !child->IsVisible() )
+ iElementList.Append( child );
+
+ // find in grandchildren
+ FindAllNonViewableElements( child, iElementList );
+ child = (CSvgElementImpl*)child->NextSibling();
+ }
+ }
+
+/**
+ * Return the data pointed to by the given URI string,
+ * from an external source.
+ */
+// --------------------------------------------------------------------------
+// HBufC8* CSvgEngineImpl::FetchExternalDataL( const TDesC& aUri )
+// ---------------------------------------------------------------------------
+HBufC8* CSvgEngineImpl::FetchExternalDataL( const TDesC& aUri )
+ {
+ if ( iRequestObserver == NULL )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgEngineImpl::FetchExternalData--requestobserver is NULL\n");
+ #endif //_DEBUG
+ return NULL;
+ }
+ // Connect session
+ RFs session;
+ TInt connectError = session.Connect();
+ if ( connectError != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgEngineImpl::FetchExternalData--session.Connect() failed: %d\n", connectError );
+ #endif //_DEBUG
+ return NULL;
+ }
+
+ RFile fileHandle;
+ // Check for FetchImage error code
+ TInt fetchError = iRequestObserver->FetchImage( aUri, session, fileHandle );
+ if ( fetchError != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgEngineImpl::FetchExternalData--FetchImage error: %d\n", fetchError );
+ #endif //_DEBUG
+ session.Close();
+ return NULL;
+ }
+
+ // Read file size
+ TInt fileSize = 0;
+ TInt sizeError = fileHandle.Size( fileSize );
+ if ( sizeError != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgEngineImpl::FetchExternalData--fileHandle.Size error: %d\n", sizeError );
+ #endif //_DEBUG
+ session.Close();
+ return NULL;
+ }
+
+ // Allocate memory for file
+ HBufC8* data = HBufC8::NewL( fileSize );
+ TPtr8 des = data->Des();
+ TInt readError = fileHandle.Read( des );
+ if ( readError != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgEngineImpl::FetchExternalData--fileHandle.Read error: %d\n", readError );
+ #endif //_DEBUG
+ session.Close();
+ delete data;
+ return NULL;
+ }
+
+ // Successful
+ session.Close();
+ return data;
+ }
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::SetAudioVolume( TInt aPercentage );
+// --------------------------------------------------------------------------
+void CSvgEngineImpl::SetAudioVolume( TInt aPercentage )
+ {
+
+ if ( !iSvgDocument )
+ {
+ return;
+ }
+ // Locate all the active audio elements
+ RPointerArray<CSvgElementImpl> lAudioElementList;
+
+ iSvgDocument->FindAllElements(
+ (CSvgElementImpl* )iSvgDocument->RootElement(),
+ KSvgAudioElement, lAudioElementList );
+ // Set the volume on each audio element
+ TInt lAudEleCnt = lAudioElementList.Count();
+ for ( TInt lCurAudioEle = 0; lCurAudioEle < lAudEleCnt; lCurAudioEle++ )
+ {
+ CSvgAudioElementImpl* lAudioElement = (CSvgAudioElementImpl*)lAudioElementList[ lCurAudioEle ];
+ lAudioElement->SetVolume( aPercentage );
+ }
+ lAudioElementList.Close();
+ }
+
+// --------------------------------------------------------------------------
+// TBool CSvgEngineImpl::ReadyToRender()
+// ---------------------------------------------------------------------------
+TBool CSvgEngineImpl::ReadyToRender()
+ {
+ return iSvgDocument != NULL;
+ }
+
+// --------------------------------------------------------------------------
+// TBool CSvgEngineImpl::IsEndedWithCompleteTextTag( TDes &BufferPtr,
+// TInt EndOffset)
+// ---------------------------------------------------------------------------
+TBool CSvgEngineImpl::IsEndedWithCompleteTextTag(TDes &aBufferPtr,TInt aEndOffset)
+ {
+ TChar KOpeningBrace = '<';
+ TChar KSlash = '/';
+
+ // This function searches the buffer in reverse order from the end offset
+ // to check whether the last element had a complete text tag.
+ // eg. of complete text tags
+ // <text>Hello</text>
+ // <text></text>
+ // eg. of an incomplete text tag
+ // <text />
+
+ TPtrC currentSelectionPtr = aBufferPtr.Left( aEndOffset );
+ TInt OpeningBracePos = currentSelectionPtr.LocateReverse( KOpeningBrace );
+ TInt SlashPos = currentSelectionPtr.LocateReverse( KSlash );
+ TBool retVal = EFalse;
+
+ // In case of a complete text tag the opening brace is one position behind
+ // slash.
+ if ( SlashPos == ( OpeningBracePos + 1 ) )
+ {
+ retVal = ETrue;
+ }
+
+ return retVal;
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::SaveSvgL( const TDesC& aFileName )
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::SaveSvgL( const TDesC& aFileName )
+ {
+ RFs lFs;
+ RFileWriteStream lStream;
+ TInt error ;
+ TChar KOpeningBrace = '<';
+ TChar KSlash = '/';
+ // Connect to File Server to write the changed content to a file
+ CleanupClosePushL(lFs);
+ User::LeaveIfError(lFs.Connect() );
+
+ TBool isOpened = EFalse;
+ error = lFs.IsFileOpen( aFileName, isOpened ) ;
+ // dont leave if file doesnt exist or there is no error
+ if(error!= KErrNone && error!=KErrNotFound)
+ {
+ //usually will come here with KErrNotFound
+ //since file wont exist
+ User::Leave(error);
+ }
+
+ if ( isOpened )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf( "Cannot SaveSvgL: File is still opened: ");
+ RDebug::RawPrint( aFileName );
+ #endif
+ CleanupStack::PopAndDestroy(1);
+ return;
+ }
+
+ // Try to create the write stream using the file name
+ if ( lStream.Create( lFs, aFileName, EFileWrite ) != KErrNone )
+ {
+ // If creation fails, file exists already, try to open the
+ // existing file
+ User::LeaveIfError( lStream.Open(lFs, aFileName, EFileWrite) );
+ }
+ CleanupClosePushL(lStream);
+
+ // Array to store list of all editable elements
+ RPointerArray<CSvgElementImpl> lTextElementList;
+
+ FindEditableElements( (CSvgElementImpl* )iSvgDocument->RootElement(),
+ lTextElementList );
+ CleanupClosePushL(lTextElementList);
+ TInt index=0, startoffset = 0, endoffset = 0;
+
+ // The content of the file is stored in the root <svg> node
+ HBufC* lBufferContent = ((CSvgSvgElementImpl* )iSvgDocument->RootElement())->iContent;
+
+
+
+ // While there are remaining editable elements do
+ while(index < lTextElementList.Count())
+ {
+ TBool EndedWithCompleteTextTag= true;
+ TInt OrgLength;
+
+ if ( lTextElementList[index]->ElemID() == KSvgTextElement )
+ {
+ // If the element is a <text> element invoke element specific function
+ // to retrieve the offset and original length
+ endoffset = ((CSvgTextElementImpl *)lTextElementList[index])->iOffset;
+ OrgLength = ((CSvgTextElementImpl *)lTextElementList[index])->GetOrgLength();
+ }
+ else
+ {
+ // If the element is a <textArea> element invoke element specific function
+ // to retrieve the offset and original length
+ endoffset = ((CSvgTextAreaElementImpl *)lTextElementList[index])->iOffset;
+ OrgLength = ((CSvgTextAreaElementImpl *)lTextElementList[index])->GetOrgLength();
+ }
+
+ // These are the cases which have to be processed
+ // a. Text Element: No Closing Tag: <text ... />
+ // b. Text Element: No CData : <text ...></text>
+ // c. Text Element: CData : <text ...>Sample Text</text>
+ // d. TextArea Element: No Closing Tag: <textArea ... />
+ // e. TextArea Element: No CData: <textArea ...></textArea>
+ // f. TextArea Element: CData: <textArea ...>Sample TextArea</textArea>
+ // -> for a,b,d,e the endoffset represents the offset after the closing braces.
+ // for e.g. <text ... />
+ // ^
+ // <text></text>
+ // ^
+ // -> for c,f the EndOffset represents the offset to the first character in
+ // content.
+ // <text>Hello</text>
+ //
+ // ^
+ if(!OrgLength)
+ {
+ //case a,b,d,e
+ TPtr BufferPtr=lBufferContent->Des();
+ EndedWithCompleteTextTag = IsEndedWithCompleteTextTag(BufferPtr,endoffset);
+ if ( EndedWithCompleteTextTag )
+ {
+ // case b,e
+ if(endoffset < startoffset)
+ {
+ User::Leave(KErrNotFound);
+ }
+ TPtrC lPtrtoPresentText = lBufferContent->Mid( startoffset, ( endoffset - startoffset ) );
+ //end offset modified ot point to <text></text>
+ // ^
+ endoffset = startoffset + lPtrtoPresentText.LocateReverse( KOpeningBrace );
+ }
+ else
+ {
+ //case a,d
+ if(endoffset < startoffset)
+ {
+ User::Leave(KErrNotFound);
+ }
+ TPtrC lPtrtoPresentText = lBufferContent->Mid( startoffset, ( endoffset - startoffset ) );
+ endoffset = startoffset + lPtrtoPresentText.LocateReverse( KSlash );
+ //end offset modified ot point to <text/>
+ // ^
+ }
+ }
+ if(endoffset < startoffset)
+ {
+ User::Leave(KErrNotFound);
+ }
+ TPtrC lPtrtoWrBuffer = lBufferContent->Mid( startoffset, ( endoffset - startoffset ) );
+ TInt lWrBufLength = lPtrtoWrBuffer .Length();
+ User::LeaveIfError(WriteToStream(lStream,lPtrtoWrBuffer));
+ // If it was a text element ...
+ if ( lTextElementList[index]->ElemID() == KSvgTextElement )
+ {
+ HBufC *lBufTextContent= NULL;
+ //make startoffset point to opening tag '<' or '/' in case of a,d
+ TPtrC lPtrtoTextContent= ( (CSvgTextElementImpl* ) lTextElementList[ index ] )->GetText();
+ startoffset = endoffset + ( (CSvgTextElementImpl* ) lTextElementList[ index ] )->iOrgLength;
+ lBufTextContent = TextTagProcessingL(&lPtrtoTextContent,
+ startoffset,OrgLength,EndedWithCompleteTextTag);
+ CleanupStack::PushL(lBufTextContent);
+ TPtr lTempPtr(lBufTextContent->Des());
+ lPtrtoTextContent.Set(lTempPtr);
+ User::LeaveIfError(WriteToStream(lStream,lPtrtoTextContent));
+ CleanupStack::PopAndDestroy(lBufTextContent);
+ }
+ else
+ {
+ HBufC *lBufTextAreaContent= NULL;
+ HBufC* lBufPresentText = NULL;
+ TInt textlength = ((CSvgTextAreaElementImpl *)lTextElementList[index])->GetLength();
+ lBufTextAreaContent = HBufC::NewLC( textlength );
+
+ TPtr lPtrtoGetTextAreaContent = lBufTextAreaContent->Des();
+ ((CSvgTextAreaElementImpl *)lTextElementList[index])->GetText( lPtrtoGetTextAreaContent );
+ TPtrC lPtrtoTextAreaContent=lPtrtoGetTextAreaContent;
+ startoffset = endoffset + ((CSvgTextAreaElementImpl *)lTextElementList[index])->iOrgLength;
+ lBufPresentText = TextAreaTagProcessingL(&lPtrtoTextAreaContent,startoffset,OrgLength,EndedWithCompleteTextTag);
+ CleanupStack::PushL(lBufPresentText);
+ TPtr lTempPtr(lBufPresentText->Des());
+ lPtrtoTextAreaContent.Set(lTempPtr);
+ User::LeaveIfError(WriteToStream(lStream,lPtrtoTextAreaContent));
+ CleanupStack::PopAndDestroy(lBufPresentText);
+ CleanupStack::PopAndDestroy(lBufTextAreaContent);
+ }
+ index++;
+ }
+
+ // Done using the list, close the list to avoid a memory leak
+ CleanupStack::PopAndDestroy(&lTextElementList);
+
+ // After processing all the editable text elements, are there any characters in the buffer
+ if( startoffset < lBufferContent->Length() )
+ {
+ TPtrC lPtrtoRemainText = lBufferContent->Mid(startoffset,(lBufferContent->Length()-startoffset));
+ User::LeaveIfError(WriteToStream(lStream,lPtrtoRemainText));
+ }
+
+ // Close the stream
+ CleanupStack::PopAndDestroy(&lStream);
+
+ // Close the file server session
+ CleanupStack::PopAndDestroy(&lFs);
+ }
+
+//-----------------------------------------------------------------------------
+//Function to process the text and add tags at the end
+//HBufC* CSvgEngineImpl::TextTagProcessing(TPtr* aCData, TInt aStartOffset, TInt aOrgLength,
+// TBool aEndingWithTag)
+//-----------------------------------------------------------------------------
+
+HBufC* CSvgEngineImpl::TextTagProcessingL(TPtrC* aCData,
+ TInt &aStartOffset, TInt aOrgLength,TBool aEndingWithTag)
+ {
+ HBufC * lTextContentBuffer = NULL;
+ TPtrC lPtrToTextContent(*aCData) ;
+ //Ending with complete text tag and original length is 0
+ if( aEndingWithTag && aOrgLength == 0 )
+ {//case b
+ lTextContentBuffer = HBufC::NewLC(aCData->Length()
+ + KClosingTextTagLength );
+ TPtr lPtrToTempBuf(lTextContentBuffer->Des());//point to buffer
+ lPtrToTempBuf.Append(*aCData);//append cdata
+ lPtrToTempBuf.Append(KClosingTextTag);//append closing text tag
+ aStartOffset += KClosingTextTagLength;
+ }
+ else if( !aEndingWithTag && aOrgLength == 0 )
+ {//case a
+ lTextContentBuffer = HBufC::NewLC(aCData->Length()
+ + KClosingTextTagLength
+ + KClosingBracesLength );
+ TPtr lPtrToTempBuf(lTextContentBuffer->Des());//point to buffer
+ lPtrToTempBuf.Append(KClosingBraces);
+ lPtrToTempBuf.Append(*aCData);//append cdata
+ lPtrToTempBuf.Append(KClosingTextTag);//append closing text tag
+ aStartOffset += 2;// the length of /> which is 2 characters.
+ }
+ else if(aEndingWithTag && aOrgLength!= 0)
+ {
+ lTextContentBuffer = HBufC::NewLC(aCData->Length()
+ + KClosingTextTagLength );
+ TPtr lPtrToTempBuf(lTextContentBuffer->Des());//point to buffer
+ lPtrToTempBuf.Append(*aCData);//append cdata
+ lPtrToTempBuf.Append(KClosingTextTag);//append closing text tag
+ aStartOffset += KClosingTextTagLength ;
+ }
+ else
+ {
+ //i.e !aEndingWithTag && OrgLength!=0
+ //this case should never occur
+ //becoz there is no possibility of
+ //the quoted kind of text content definition in xml as shown below
+ //"<text /> this is a text content"
+ }
+ // Pop the buffer from the cleanup stack as ownership is transferred
+ // to caller
+ CleanupStack::Pop(lTextContentBuffer);
+ return lTextContentBuffer;
+
+ }
+
+//-----------------------------------------------------------------------------
+//Function to process the text and add tags at the end
+//HBufC* CSvgEngineImpl::TextAreaTagProcessing(TPtr* aCData, TInt aStartOffset, TInt aOrgLength,
+// TBool aEndingWithTag)
+//-----------------------------------------------------------------------------
+
+HBufC* CSvgEngineImpl::TextAreaTagProcessingL(TPtrC* aCData, TInt &aStartOffset, TInt aOrgLength,
+ TBool aEndingWithTag)
+ {
+ HBufC * lTextAreaContentBuffer = NULL;
+ TPtrC lPtrToTextAreaContent(*aCData) ;
+
+
+ //Ending with complete text tag and original length is 0
+ if( aEndingWithTag && aOrgLength == 0 )
+ {//case e
+ lTextAreaContentBuffer = HBufC::NewLC(aCData->Length()
+ + KClosingTextAreaTagLength);
+ TPtr lPtrToTempBuf(lTextAreaContentBuffer->Des());//point to buffer
+ lPtrToTempBuf.Append(*aCData);//append cdata
+ lPtrToTempBuf.Append(KClosingTextAreaTag);//append closing text tag
+ aStartOffset += KClosingTextAreaTagLength;
+ }
+ else if( !aEndingWithTag && aOrgLength == 0 )
+ {//case d
+ lTextAreaContentBuffer = HBufC::NewLC(aCData->Length()
+ + KClosingBracesLength
+ + KClosingTextAreaTagLength );
+ TPtr lPtrToTempBuf(lTextAreaContentBuffer->Des());//point to buffer
+ lPtrToTempBuf.Append(KClosingBraces);
+ lPtrToTempBuf.Append(*aCData);//append cdata
+ lPtrToTempBuf.Append(KClosingTextAreaTag);//append closing text tag
+ aStartOffset += 2;// the length of /> which is 2 characters.
+ }
+ else if(aEndingWithTag && aOrgLength!= 0)
+ {//case f
+ lTextAreaContentBuffer = HBufC::NewLC(aCData->Length()
+ + KClosingTextAreaTagLength );
+ TPtr lPtrToTempBuf(lTextAreaContentBuffer->Des());//point to buffer
+ lPtrToTempBuf.Append(*aCData);//append cdata
+ lPtrToTempBuf.Append(KClosingTextAreaTag);//append closing text tag
+ aStartOffset += KClosingTextAreaTagLength;
+ }
+ else
+ {
+ //i.e !aEndingWithTag && OrgLength!=0
+ //this case should never occur
+ //becoz there is no possibility of
+ //the quoted kind of text content definition in xml as shown below
+ //"<textArea /> this is a text content"
+ }
+ // Pop the buffer from the cleanup stack as ownership is transferred
+ // to caller
+ CleanupStack::Pop(lTextAreaContentBuffer);
+ return lTextAreaContentBuffer;
+
+ }
+
+
+//-----------------------------------------------------------------------------
+//Function to Write the buffer to the stream.
+//In SaveSVGL while editing text - used to write partial buffers into the stream.
+//TInt CSvgEngineImpl::WriteToStream(RFileWriteStream* aStream,TPtrC aWriteBuffer)
+//-----------------------------------------------------------------------------
+TInt CSvgEngineImpl::WriteToStream(RFileWriteStream &aStream,TPtrC aWriteBuffer)
+ {
+ // Create a small output buffer
+ TBuf8<KMaxConversionChars> outputBuffer;
+
+ for(;;) // conversion loop
+ {
+ // Start conversion. When the output buffer is full, return the
+ // number of characters that were not converted
+ const TInt returnValue = CnvUtfConverter::ConvertFromUnicodeToUtf8(
+ outputBuffer, // Destination
+ aWriteBuffer ); // Source
+
+
+ // check to see that the descriptor isn’t corrupt - return with
+ // err if it is
+ if ( returnValue == CnvUtfConverter::EErrorIllFormedInput )
+ {
+ return( KErrCorrupt );
+ }
+ else
+ {
+ if ( returnValue < 0 ) // future-proof against "TError" expanding
+ {
+ return( KErrGeneral );
+ }
+ }
+
+ // Store the converted contents of the output buffer into the stream
+ TRAPD( err1, aStream.WriteL( outputBuffer ) );
+ if ( err1 )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgEngineImpl::WriteToStream error trapped=%d", err1);
+ return err1;
+ #endif
+ }
+
+ // Finish conversion if there are no unconverted characters in the
+ // remainder buffer
+ if ( returnValue == 0 )
+ {
+ break;
+ }
+
+ // Remove the converted source text from the remainder buffer.
+ // The remainder buffer is then fed back into loop
+ aWriteBuffer.Set( aWriteBuffer.Right( returnValue ));
+ }
+ return KErrNone;
+ }
+
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::FindEditableElements( CSvgElementImpl* aStartElement,
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::FindEditableElements( CSvgElementImpl* aStartElement,
+ RPointerArray<CSvgElementImpl>& aList )
+ {
+ if ( aStartElement == NULL )
+ {
+ return;
+ }
+
+ CSvgElementImpl* child = (CSvgElementImpl*)aStartElement->FirstChild();
+ while ( child != NULL )
+ {
+ // add to list if child is found
+ if ( child->ElemID() == KSvgTextElement || child->ElemID() == KSvgTextAreaElement )
+ aList.Append( child );
+
+ // find in grandchildren if element is not a textArea
+ if ( child->ElemID() != KSvgTextAreaElement )
+ {
+ FindEditableElements( child, aList );
+ }
+ child = (CSvgElementImpl*)child->NextSibling();
+ }
+}
+TBool CSvgEngineImpl::IsSVGEnginePaused()
+{
+ return (iSvgEngineState == ESVGEnginePaused );
+
+}
+
+// --------------------------------------------------------------------------
+// void CSvgEngineImpl::ResetContext()
+// ---------------------------------------------------------------------------
+void CSvgEngineImpl::ResetContext()
+{
+ if( iGfxContext )
+ {
+ iGfxContext->DestroyContext();
+ }
+}
+
+void CSvgEngineImpl::SetBitmapHeader(const TDesC* aHeaderData)
+ {
+ if (iGfxContext)
+ {
+ ((CGfx2dGcOpenVG *)iGfxContext)->SetBitmapHeader(aHeaderData);
+ }
+ }
+//NGA
+// ---------------------------------------------------------------------------
+// SetGdiContext File
+// ---------------------------------------------------------------------------
+
+void CSvgEngineImpl::SetGdiContextL(CFbsBitmap* aCurrentBitmap, CFbsBitmap* aMask,TSize aCurrentBitmapSize,TDisplayMode aRenderDspMode,TDisplayMode aMaskDspMode)
+
+ {
+ // Handle for both Non-NULL and NULL parameter
+ iFrameBufferSize = aCurrentBitmapSize;
+ iRenderDspMode = aRenderDspMode;
+ iMaskDspMode = aMaskDspMode;
+ iFrameBuffer = aCurrentBitmap;
+ iMask = aMask;
+
+ if ( aCurrentBitmapSize.iWidth > 0 && aCurrentBitmapSize.iHeight > 0 )
+ {
+ if ( !iGfxContext )
+ {
+ iGfxContext = CGfx2dGcOpenVG::NewL( aCurrentBitmapSize, iBitmapFontSpec, iSvgBitmapFontProvider,1 );
+ }
+ else
+ {
+ iGfxContext->ChangeBufferSizeL( aCurrentBitmapSize );
+ }
+ }
+ else if ( iGfxContext )
+ {
+ iGfxContext->ChangeBufferSizeL( TSize( 1, 1 ) );
+ }
+ }
+const TPtrC8 CSvgEngineImpl::TLVEncodedData() const
+ {
+ return (iGfxContext->TLVEncodedData());
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/src/SVGEngineInterfaceImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,5758 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine source file
+ *
+*/
+
+
+#include "SVGEngineImpl.h"
+#include "SVGEngineInterfaceImpl.h"
+
+#include "GfxAffineTransform.h"
+
+#include "SVGTimer.h"
+#include "SVGSvgElementImpl.h"
+//#include "SVGTransformableImpl.h"
+//#include "SVGSchemaData.h"
+
+//#include "GfxPoint2D.h"
+//#include "GfxRectangle2D.h"
+
+#include "SVGErrorImpl.h"
+
+// added for JSR support
+#include "SVGRectElementImpl.h"
+#include "SVGAnimationBase.h"
+#include "e32math.h"
+
+//#include "SVGFourPointRect.h"
+#include "SVGTextElementImpl.h"
+#include "SVGTextAreaElementImpl.h"
+#include "SVGListener.h"
+#include "SVGUseElementImpl.h"
+//#include "SvgEventHandler.h"
+#include "SVGMediaAnimationElementImpl.h"
+#include <AknUtils.h>
+#include <avkon.hrh>
+#include "SvgBitmapFontProvider.h"
+#include "SvgStopElementImpl.h"
+#include "SVGGradientElementImpl.h"
+#include <utf.h>
+
+#define SvgUnitPixels 1
+#define SvgUnitPercent 2
+#define KBackgroundColor 0xffffffff
+_LIT(OFFSET, "offset");
+_LIT(ZEROVALUE, "0");
+
+// --------------------------------------------------------------------------
+// EXPORT_C CSvgEngineInterfaceImpl* CSvgEngineInterfaceImpl::NewL( CFbsBitmap* aFrameBuffer,
+// ---------------------------------------------------------------------------
+EXPORT_C CSvgEngineInterfaceImpl* CSvgEngineInterfaceImpl::NewL( CFbsBitmap* aFrameBuffer,
+ MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec )
+ {
+ CSvgEngineInterfaceImpl* self = new ( ELeave ) CSvgEngineInterfaceImpl;
+ CleanupStack::PushL( self );
+ self->ConstructL( aFrameBuffer, aReqObserver,aFontSpec );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// --------------------------------------------------------------------------
+EXPORT_C CSvgEngineInterfaceImpl* CSvgEngineInterfaceImpl::NewL( CFbsBitmap* aFrameBuffer,
+
+ MSvgRequestObserver* aReqObserver, TFontSpec& aFontSpec ,SVGRendererId aRendererType)
+
+ {
+
+ CSvgEngineInterfaceImpl* self = new ( ELeave ) CSvgEngineInterfaceImpl;
+
+ CleanupStack::PushL( self );
+
+ self->ConstructL( aFrameBuffer, aReqObserver,aFontSpec,aRendererType );
+
+ CleanupStack::Pop();
+
+
+
+ return self;
+
+ }
+// EXPORT_C CSvgEngineInterfaceImpl* CSvgEngineInterfaceImpl::NewLC( CFbsBitmap* aFrameBuffer,
+// ---------------------------------------------------------------------------
+EXPORT_C CSvgEngineInterfaceImpl* CSvgEngineInterfaceImpl::NewLC( CFbsBitmap* aFrameBuffer,
+ MSvgRequestObserver* aReqObserver,TFontSpec& aFontSpec )
+ {
+ CSvgEngineInterfaceImpl* self = new ( ELeave ) CSvgEngineInterfaceImpl;
+ CleanupStack::PushL( self );
+ self->ConstructL( aFrameBuffer, aReqObserver,aFontSpec );
+
+ return self;
+ }
+
+// --------------------------------------------------------------------------
+EXPORT_C CSvgEngineInterfaceImpl* CSvgEngineInterfaceImpl::NewLC( CFbsBitmap* aFrameBuffer,
+
+ MSvgRequestObserver* aReqObserver,TFontSpec& aFontSpec ,SVGRendererId aRendererType)
+
+ {
+
+ CSvgEngineInterfaceImpl* self = new ( ELeave ) CSvgEngineInterfaceImpl;
+
+ CleanupStack::PushL( self );
+
+ self->ConstructL( aFrameBuffer, aReqObserver,aFontSpec,aRendererType );
+
+
+
+ return self;
+
+ }
+// EXPORT_C CSvgEngineInterfaceImpl::CSvgEngineInterfaceImpl()
+// ---------------------------------------------------------------------------
+EXPORT_C CSvgEngineInterfaceImpl::CSvgEngineInterfaceImpl()
+ {
+ iIsLoadingRequest = EFalse;
+ iMouseDownFlag = EFalse;
+ iDrmRightsConsumptionEnabled = ETrue;
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::ConstructL( CFbsBitmap* aFrameBuffer,
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::ConstructL( CFbsBitmap* aFrameBuffer,
+ MSvgRequestObserver* aReqObserver,TFontSpec& aFontSpec )
+ {
+ iSvgBitmapFontProvider = CSvgBitmapFontProvider::NewL( aFontSpec );
+ iSvgEngine = CSvgEngineImpl::NewL( aFrameBuffer, aReqObserver,aFontSpec, iSvgBitmapFontProvider );
+ iSvgEnginePointers.Append(iSvgEngine);
+
+ SetDRMMode( ETrue );
+ SetThumbNailMode( EFalse );
+
+ iFileIsLoaded = EFalse;
+
+ iTotalRotation= 0;
+ iSvgError = CSvgErrorImpl::NewL();
+
+// Not needed since no more VGR. Causes issues when multiple
+// contexts are created by multiple engines...
+// CustomOption(ETrue);
+ }
+
+//NGA :: Renderer selector included
+
+// --------------------------------------------------------------------------
+
+// EXPORT_C void CSvgEngineInterfaceImpl::ConstructL( CFbsBitmap* aFrameBuffer,
+
+// ---------------------------------------------------------------------------
+
+EXPORT_C void CSvgEngineInterfaceImpl::ConstructL( CFbsBitmap* aFrameBuffer,
+
+ MSvgRequestObserver* aReqObserver,TFontSpec& aFontSpec,SVGRendererId aRendererType )
+
+ {
+
+ iSvgBitmapFontProvider = CSvgBitmapFontProvider::NewL( aFontSpec );
+
+ iSvgEngine = CSvgEngineImpl::NewL( aFrameBuffer, aReqObserver,aFontSpec, iSvgBitmapFontProvider ,aRendererType);
+
+ iSvgEnginePointers.Append(iSvgEngine);
+
+
+
+ SetDRMMode( ETrue );
+
+ SetThumbNailMode( EFalse );
+
+
+
+ iFileIsLoaded = EFalse;
+
+
+
+ iTotalRotation= 0;
+
+ iSvgError = CSvgErrorImpl::NewL();
+
+
+
+// Not needed since no more VGR. Causes issues when multiple
+
+// contexts are created by multiple engines...
+
+// CustomOption(ETrue);
+
+ }
+// EXPORT_C void CSvgEngineInterfaceImpl::ConstructL()
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::ConstructL()
+ {
+ iSvgEngine = NULL;
+
+ iFileIsLoaded = EFalse;
+ iTotalRotation= 0;
+ iSvgError = CSvgErrorImpl::NewL();
+
+ //Added to populated the font spec with variant default font
+ const TInt KApacFontId = EApacPlain16;
+ const TInt KLatintFontId = ELatinBold12;
+ TInt fontId = KLatintFontId;
+
+ switch ( AknLayoutUtils::Variant() )
+ {
+ case EApacVariant:
+ {
+ fontId = KApacFontId;
+ }
+ break;
+ case EEuropeanVariant:
+ default:
+ break;
+ }
+
+ const CFont* font = AknLayoutUtils::FontFromId( fontId );
+ TFontSpec spec = font->FontSpecInTwips();
+ iSvgBitmapFontProvider = CSvgBitmapFontProvider::NewL( spec );
+
+// Not needed since no more VGR. Causes issues when multiple
+// contexts are created by multiple engines...
+// CustomOption(ETrue);
+
+ }
+
+EXPORT_C void CSvgEngineInterfaceImpl::ConstructL(TFontSpec& aFontSpec)
+ {
+ iSvgEngine = NULL;
+ iFileIsLoaded = EFalse;
+ iTotalRotation= 0;
+ iSvgError = CSvgErrorImpl::NewL();
+ iSvgBitmapFontProvider = CSvgBitmapFontProvider::NewL( aFontSpec );
+ }
+// --------------------------------------------------------------------------
+// EXPORT_C CSvgEngineInterfaceImpl::~CSvgEngineInterfaceImpl()
+// ---------------------------------------------------------------------------
+EXPORT_C CSvgEngineInterfaceImpl::~CSvgEngineInterfaceImpl()
+ {
+ iSvgDocumentPointers.ResetAndDestroy();
+ iSvgDocumentPointers.Close();
+
+ iSvgEnginePointers.ResetAndDestroy();
+ iSvgEnginePointers.Close();
+
+ delete iSvgBitmapFontProvider ;
+ //delete iTimer;
+ if(iSvgError)
+ {
+ delete iSvgError;
+ iSvgError = NULL;
+ }
+
+ iSvgLoadingListeners.Close();
+ iSvgMouseEnteredElements.Close();
+
+ }
+
+//DEPRECATED API
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::Destroy()
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::Destroy()
+ {
+ DestroyDocument(iSvgLoadedDocument);
+ iSvgLoadedDocument = NULL;
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgEngineInterfaceImpl::PostLoadProcessing( TInt aDocumentHandle )
+// ---------------------------------------------------------------------------
+void CSvgEngineInterfaceImpl::PostLoadProcessing( TInt /* aDocumentHandle */ )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//Deprecated for platform security
+// ---------------------------------------------------------------------------
+EXPORT_C MSvgError* CSvgEngineInterfaceImpl::Load( const TDesC& aFileName )
+ {
+ TInt documentHandle = 0;
+ iTotalRotation = 0;
+ iSvgError->SetErrorCode( ESvgNoError );
+
+ // Destroy current loaded document.
+ DestroyDocument(iSvgLoadedDocument);
+
+ iIsLoadingRequest = ETrue;
+ TRAPD( error, iSvgEngine->iSvgNames->AppendL(aFileName));
+
+ if( error != KErrNone )
+ {
+ _LIT( KErrorMsg, "Failed to Append filename" );
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, error,KErrorMsg, aFileName );
+ return iSvgError;
+ }
+
+ PrepareDom( aFileName, documentHandle );
+ iIsLoadingRequest = EFalse;
+
+ if ( iSvgError->HasError() && !iSvgError->IsWarning() )
+ {
+ return iSvgError;
+ }
+
+ PostLoadProcessing( documentHandle );
+
+ iSvgLoadedDocument = (CSvgDocumentImpl*)documentHandle;
+ return iSvgError;
+}
+
+// ---------------------------------------------------------------------------
+// Modified Load function to take RFile aHandle.
+// ---------------------------------------------------------------------------
+EXPORT_C MSvgError* CSvgEngineInterfaceImpl::Load( RFile& aFileHandle)
+ {
+ TInt documentHandle = 0;
+ iTotalRotation = 0;
+ iSvgError->SetErrorCode( ESvgNoError );
+
+ // Destroy current loaded document.
+ DestroyDocument(iSvgLoadedDocument);
+
+ TFileName fileName;
+ aFileHandle.Name(fileName);
+ iSvgEngine->iSvgNames->AppendL(fileName);
+ iIsLoadingRequest = ETrue;
+ PrepareDom( aFileHandle, documentHandle );
+ iIsLoadingRequest = EFalse;
+
+ if ( iSvgError->HasError() && !iSvgError->IsWarning() )
+ {
+ return iSvgError;
+ }
+
+ PostLoadProcessing( documentHandle );
+ iSvgLoadedDocument = (CSvgDocumentImpl*)documentHandle;
+ return iSvgError;
+ }
+
+// ---------------------------------------------------------------------------
+// Modified Load function which in turn calls the generic LoadL function
+// ---------------------------------------------------------------------------
+EXPORT_C MSvgError* CSvgEngineInterfaceImpl::Load( const TDesC8& aByteData )
+ {
+ TInt documentHandle = 0;
+ iTotalRotation = 0;
+ iSvgError->SetErrorCode( ESvgNoError );
+
+ // Destroy current loaded document.
+ DestroyDocument(iSvgLoadedDocument);
+
+ iIsLoadingRequest = ETrue;
+ PrepareDom( aByteData, documentHandle );
+ iIsLoadingRequest = EFalse;
+
+ if ( iSvgError->HasError() && !iSvgError->IsWarning() )
+ {
+ return iSvgError;
+ }
+
+ PostLoadProcessing( documentHandle );
+ iSvgLoadedDocument = (CSvgDocumentImpl*)documentHandle;
+ return iSvgError;
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::Start( CSvgEngineImpl* aEngine
+// , TBool /*aIsMainThread*/ )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::Start( CSvgEngineImpl* aEngine,
+ TBool /*aIsMainThread*/ )
+ {
+
+ if ( ChooseEngine((TInt)aEngine) )
+ {
+ iSvgEngine->SetMediaTime(0);
+ iSvgEngine->ResetTimer();
+ iSvgEngine->StartEngine();
+ }
+ }
+
+
+// -----------------------------------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::Start( CSvgEngineImpl* aEngine,TBool /*aIsMainThread*/ )
+// -----------------------------------------------------------------------------------------------------
+
+EXPORT_C void CSvgEngineInterfaceImpl::Start( MSvgError*& aError,
+ CSvgEngineImpl* aEngine
+ )
+ {
+
+ if ( ChooseEngine((TInt)aEngine) )
+ {
+ iSvgEngine->SetMediaTime(0);
+ iSvgEngine->ResetTimer();
+ iSvgEngine->StartEngine(iSvgError);
+ }
+
+ aError = iSvgError;
+ }
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::Pause( CSvgEngineImpl* aEngine )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::Pause( CSvgEngineImpl* aEngine )
+ {
+ if ( ChooseEngine((TInt)aEngine) )
+ {
+ iSvgEngine->SetSVGEngineState(ESVGEnginePaused);
+ }
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::Stop( CSvgEngineImpl* aEngine )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::Stop( CSvgEngineImpl* aEngine )
+ {
+ if ( ChooseEngine((TInt)aEngine) )
+ {
+ iSvgEngine->SetSVGEngineState(ESVGEngineStopped);
+
+ if (iSvgEngine->Document() && iSvgEngine->Document()->IsAnimationFile())
+ {
+ // restore some properties that changed during animation
+ // RestoreAnimStyleProperties();
+ }
+ }
+ }
+
+// Store properties that were changed during animation
+//
+// --------------------------------------------------------------------------
+// void CSvgEngineInterfaceImpl::RestoreAnimStyleProperties()
+// ---------------------------------------------------------------------------
+void CSvgEngineInterfaceImpl::RestoreAnimStyleProperties( TInt aEngine )
+ {
+ if ( ChooseEngine(aEngine) && iSvgEngine->Document())
+ {
+ RPointerArray<CSvgElementImpl> all_elements;
+ iSvgEngine->Document()->FindAllElements(
+ (CSvgElementImpl* )iSvgEngine->Document()->RootElement(), -1, all_elements );
+
+ TInt allEleCnt = all_elements.Count();
+ for (TInt i=0; i < allEleCnt; i++ )
+ {
+ // make sure that this is an animation element.
+ if( all_elements[i]->IsAnimatedElement() )
+ {
+ CSvgAnimationBase*
+ lAnimationBasePtr = (CSvgAnimationBase*)all_elements[i];
+ if ( !lAnimationBasePtr->IsFillFreeze() )
+ {
+ TRAPD(err, lAnimationBasePtr->ResetAttrValueL());
+ if ( err != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgEngineInterfaceImpl::RestoreAnimStylePropertiesL() failed");
+ #endif
+ }
+ }
+
+
+ }
+ }
+ all_elements.Close();
+ }
+ }
+
+
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::Resume( CSvgEngineImpl* aEngine )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::Resume( CSvgEngineImpl* aEngine )
+ {
+ if ( ChooseEngine((TInt)aEngine) )
+ {
+ iSvgEngine->SetSVGEngineState(ESVGEngineRunning);
+ }
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C TUint32 CSvgEngineInterfaceImpl::Duration()
+// ---------------------------------------------------------------------------
+EXPORT_C TUint32 CSvgEngineInterfaceImpl::Duration( TInt aEngine )
+ {
+
+ if ( ChooseEngine(aEngine) )
+ {
+ return ( iSvgEngine->Duration() );
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::OriginalView()
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::OriginalView( TInt aEngine )
+ {
+ MSvgTransformList* trList;
+ iTotalRotation= 0;
+ if ( ChooseEngine(aEngine) && iSvgEngine->Document() )
+ {
+ CSvgSvgElementImpl* lRoot = ( CSvgSvgElementImpl* )
+ iSvgEngine->Document()->RootElement();
+ if ( lRoot && lRoot->GetZoomAndPan() == ESvgZoomAndPanMagnify )
+ {
+ lRoot->GetTransform( trList );
+ trList->ReplaceItem( TGfxAffineTransform(), 0 );
+ }
+ }
+ }
+
+//
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetRenderQuality( TRenderingQuality aQualityLevel )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetRenderQuality( TRenderingQuality aQualityLevel, TInt aEngine )
+ {
+
+ if( ChooseEngine(aEngine) )
+ {
+ iSvgEngine->SetRenderingQuality(aQualityLevel);
+ }
+
+ }
+
+
+// --------------------------------------------------------------------------
+// EXPORT_C TRenderingQuality CSvgEngineInterfaceImpl::GetRenderQuality()
+// ---------------------------------------------------------------------------
+EXPORT_C TRenderingQuality CSvgEngineInterfaceImpl::GetRenderQuality()
+ {
+ return ( KLowAA );
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetAnimFrameDuration( TUint aAFDur )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetAnimFrameDuration( TUint aAFDur, TInt aEngine )
+ {
+ if (ChooseEngine(aEngine))
+ {
+ iSvgEngine->ChangeDuration( aAFDur );
+ }
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::Redraw( TBool aIsMainThread )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::Redraw( TBool /*aIsMainThread*/, TInt aEngine )
+ {
+ if ( !ChooseEngine(aEngine) )
+ {
+ return;
+ }
+
+ CSvgDocumentImpl* document = iSvgEngine->Document();
+ if ( !document )
+ {
+ return;
+ }
+
+ // This situation occurs when parsing is done in a separate thread then the draw thread
+ // Wait for pruning to complete or invalid element pointer may occur during drawing
+ if ( document->iIsPruningTree )
+ {
+ TInt waitCount = 0;
+ while ( waitCount++ < 100 && document->iIsPruningTree )
+ {
+ User::After( 10000 ); // 10 millseconds
+ }
+
+ // Cannot wait any longer, prevent being stuck here
+ if ( document->iIsPruningTree )
+ {
+ return;
+ }
+ }
+
+ TRAPD(redrawError, iSvgEngine->RedrawL() );
+ if( redrawError != KErrNone )
+ {
+ document->iIsRendering = EFalse;
+ }
+
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SwitchDebugInfo( TInt aEngine )
+// ----------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SwitchDebugInfo( TInt aEngine )
+ {
+ if (ChooseEngine( aEngine ))
+ {
+
+ }
+ }
+
+
+//*****************************
+// UI event
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::MouseDown( TInt aX, TInt aY )
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CSvgEngineInterfaceImpl::MouseDown( TInt aX, TInt aY, TInt aEngine )
+ {
+
+ if ( iMouseDownFlag || !ChooseEngine(aEngine) )
+ {
+ return NULL;
+ }
+
+ iMouseDownFlag = ETrue;
+
+
+ TSvgUiMouseEvent uiev ( ESvgEngineEventMouseDown, aX, aY );
+ TRAPD( error, iSvgEngine->ProcessEventL( iSvgEngine->Document(), &uiev ) );
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KProcessEventFailed, "CSvgEngineInterfaceImpl::MouseDown: ProcessEventL error.");
+ RDebug::Print(KProcessEventFailed);
+ #endif //_DEBUG
+ }
+ // Process for MousePress
+ TInt listenerCount = iSvgEngine->MouseListenerCount();
+
+ if (iSvgEngine->Document())
+ {
+ listenerCount += iSvgEngine->Document()->MouseInternalListenerCount();
+ }
+ if ( listenerCount == 0 )
+ {
+ return 0;
+ }
+ RPointerArray<CSvgElementImpl> viewableElements;
+ TInt topClickedElement = 0;
+
+ iSvgEngine->GetViewableElementsAtPoint(iSvgEngine->Document(),viewableElements, aX, aY );
+ if ( viewableElements.Count() > 0 )
+ {
+ iSvgEngine->NotifyMousePressed( viewableElements, aX, aY );
+ if ( iSvgEngine->Document() )
+ {
+ iSvgEngine->Document()->NotifyInternalMousePressed( viewableElements, aX, aY );
+ }
+
+ topClickedElement = (TInt)viewableElements[viewableElements.Count()-1];
+ }
+ viewableElements.Close();
+
+ return topClickedElement;
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::MouseUp( TInt aX, TInt aY )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::MouseUp( TInt aX, TInt aY, TInt aEngine )
+ {
+ iMouseDownFlag = EFalse;
+
+ if (!ChooseEngine( aEngine ))
+ {
+ return;
+ }
+
+ TSvgUiMouseEvent uiev ( ESvgEngineEventMouseUp, aX, aY );
+ TRAPD( error, iSvgEngine->ProcessEventL( iSvgEngine->Document(), &uiev ) );
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KProcessEventFailed, "CSvgEngineInterfaceImpl::MouseUp: ProcessEventL error.");
+ RDebug::Print(KProcessEventFailed);
+ #endif //_DEBUG
+ }
+
+ // Process for MouseRelease
+ TInt listenerCount = iSvgEngine->MouseListenerCount();
+
+ if (iSvgEngine->Document())
+ {
+ listenerCount += iSvgEngine->Document()->MouseInternalListenerCount();
+ }
+ if ( listenerCount == 0 )
+ {
+ return;
+ }
+ RPointerArray<CSvgElementImpl> viewableElements;
+ iSvgEngine->GetViewableElementsAtPoint(iSvgEngine->Document(), viewableElements, aX, aY );
+ if ( viewableElements.Count() > 0 )
+ {
+ iSvgEngine->NotifyMouseReleased( viewableElements, aX, aY );
+ if ( iSvgEngine->Document() )
+ {
+ iSvgEngine->Document()->NotifyInternalMouseReleased( viewableElements, aX, aY );
+ }
+ }
+ viewableElements.Close();
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::MouseMove( TInt aX, TInt aY )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::MouseMove( TInt aX, TInt aY, TInt aEngine )
+ {
+
+ if (!ChooseEngine( aEngine ))
+ {
+ return;
+ }
+ RPointerArray<CSvgElementImpl> viewableElements;
+ iSvgEngine->GetViewableElementsAtPoint(iSvgEngine->Document(), viewableElements, aX, aY );
+ if( iSvgEngine->Document() && viewableElements.Count() )
+ {
+ iSvgEngine->Document()->SetCurFocusObject(viewableElements[viewableElements.Count()-1]);
+ }
+
+ TSvgUiMouseEvent uiev ( ESvgEngineEventMouseMove, aX, aY );
+ TRAPD( error, iSvgEngine->ProcessEventL( iSvgEngine->Document(), &uiev ) );
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KProcessEventFailed, "CSvgEngineInterfaceImpl::MouseMove: ProcessEventL error.");
+ RDebug::Print(KProcessEventFailed);
+ #endif //_DEBUG
+ }
+
+ // Process for Mouse enter/exit
+ TInt listenerCount = iSvgEngine->MouseListenerCount();
+
+ if (iSvgEngine->Document())
+ {
+ listenerCount += iSvgEngine->Document()->MouseInternalListenerCount();
+ }
+ if ( listenerCount == 0 )
+ {
+ viewableElements.Close();
+ return;
+ }
+ // Get list of elements containing pointer (bounding-box)
+ RPointerArray<CSvgElementImpl> enteringElements;
+ RPointerArray<CSvgElementImpl> stillInsideElements;
+ iSvgEngine->GetViewableElementsAtPoint(iSvgEngine->Document(), viewableElements, aX, aY );
+
+ // check for mouse entering of elements
+ TInt viewableEleCnt = viewableElements.Count();
+ for ( TInt i = 0; i < viewableEleCnt; i++ )
+ {
+ // If an element is in the view-list but NOT in the entered-list
+ // then, it's copied to the entered-list
+ // otherwise, ignore (still inside)
+ if ( iSvgMouseEnteredElements.Find( viewableElements[i] ) == KErrNotFound )
+ {
+ enteringElements.Append( viewableElements[i] );
+ }
+ else
+ {
+ stillInsideElements.Append( viewableElements[i] );
+ }
+ }
+
+ // check for mouse exiting of elements
+ RPointerArray<CSvgElementImpl> exitingElements;
+ TInt svgMouseEnteredEleCnt = iSvgMouseEnteredElements.Count();
+ for ( TInt i = 0; i < svgMouseEnteredEleCnt; i++ )
+ {
+ // If an element is in the entered-list but not the view-list
+ // then, it's copied to the exiting list
+ // otherwise, ignore (
+ if ( viewableElements.Find( iSvgMouseEnteredElements[i] ) == KErrNotFound )
+ {
+ exitingElements.Append( iSvgMouseEnteredElements[i] );
+ }
+ }
+
+ // Remove exiting elements from entered list
+ TInt exitingEleCnt = exitingElements.Count();
+ for ( TInt i = 0; i < exitingEleCnt; i++ )
+ {
+ TInt index = iSvgMouseEnteredElements.Find( exitingElements[i] );
+ if ( index != KErrNotFound )
+ {
+ iSvgMouseEnteredElements.Remove( index );
+ }
+ }
+
+ // Add entering elements to entered-list
+ TInt enteringEleCnt = enteringElements.Count();
+ for ( TInt i = 0; i < enteringEleCnt; i++ )
+ {
+ iSvgMouseEnteredElements.Append( enteringElements[i] );
+ }
+
+ // Notify exiting
+ if ( exitingElements.Count() > 0 )
+ {
+ iSvgEngine->NotifyMouseExited( exitingElements, aX, aY );
+ if ( iSvgEngine->Document() )
+ {
+ iSvgEngine->Document()->NotifyInternalMouseExited( exitingElements, aX, aY );
+ }
+ }
+
+ // Notify entering
+ if ( enteringElements.Count() > 0 )
+ {
+ iSvgEngine->NotifyMouseEntered( enteringElements, aX, aY );
+ if ( iSvgEngine->Document() )
+ {
+ iSvgEngine->Document()->NotifyInternalMouseEntered( enteringElements, aX, aY );
+ }
+ }
+
+ // Notify moved
+ if ( stillInsideElements.Count() > 0 )
+ {
+ iSvgEngine->NotifyMouseMoved( stillInsideElements, aX, aY );
+ if ( iSvgEngine->Document() )
+ {
+ iSvgEngine->Document()->NotifyInternalMouseMoved( stillInsideElements, aX, aY );
+ }
+ }
+
+ exitingElements.Close();
+ enteringElements.Close();
+ stillInsideElements.Close();
+ viewableElements.Close();
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::KeyPress( const TKeyEvent &aKeyEvent )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::KeyPress( const TKeyEvent &aKeyEvent, TInt aEngine )
+ {
+
+ if (!ChooseEngine( aEngine ))
+ {
+ return;
+ }
+
+ TSvgUiKeyEvent uiev ( aKeyEvent.iCode );
+ TRAPD( error, iSvgEngine->ProcessEventL( iSvgEngine->Document(), &uiev ) );
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KProcessEventFailed, "CSvgEngineInterfaceImpl::KeyPress: ProcessEventL error.");
+ RDebug::Print(KProcessEventFailed);
+ #endif //_DEBUG
+ }
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C CSvgDocumentImpl* CSvgEngineInterfaceImpl::SvgDocument()
+// ---------------------------------------------------------------------------
+EXPORT_C CSvgDocumentImpl* CSvgEngineInterfaceImpl::SvgDocument()
+ {
+ //this method is a bad idea and should be removed
+ return iSvgLoadedDocument;
+ }
+
+
+//*****************************
+//
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::Zoom( TReal32 aScaleFactor )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::Zoom( TReal32 aScaleFactor, TInt aEngine ) __SOFTFP
+ {
+ TGfxAffineTransform zT;
+ MSvgTransformList* trList = NULL;
+ TFloatFixPt cx,cy;
+ if( ChooseEngine( aEngine ) && iSvgEngine->Document() && iSvgEngine->GraphicsContext())
+ {
+ CSvgSvgElementImpl* lRoot = ( CSvgSvgElementImpl* )
+ iSvgEngine->Document()->RootElement();
+ if ( lRoot )
+ {
+ if ( lRoot->GetZoomAndPan() == ESvgZoomAndPanMagnify )
+ {
+ // Calculate screen center in svg element's coordinate system
+ TSize devSize = iSvgEngine->GraphicsContext()->DeviceBounds();
+
+ TGfxRectangle2D devbound;
+ lRoot->GetBBox( devbound );
+
+ cx = TFloatFixPt(devSize.iWidth/2);
+ cy = TFloatFixPt(devSize.iHeight/2);
+
+ lRoot->GetTransform( trList );
+ if( trList )
+ {
+ zT = trList->GetItem( 0 );
+ zT.UserZoom(aScaleFactor,cx,cy);
+ trList->ReplaceItem( zT, 0 );
+
+ lRoot->SetTransform(trList);
+ }
+
+
+ }
+ }
+ }
+ }
+
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::Pan( TInt aX, TInt aY )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::Pan( TInt aX, TInt aY, TInt aEngine )
+
+ {
+ TInt32 PanX = aX;
+ TInt32 PanY = aY;
+ TGfxAffineTransform pT;
+ MSvgTransformList* trList = NULL;
+
+ if( ChooseEngine( aEngine ) && iSvgEngine->Document() )
+ {
+
+ CSvgSvgElementImpl* lRoot = ( CSvgSvgElementImpl* )
+ iSvgEngine->Document()->RootElement();
+ if ( lRoot )
+ {
+ if ( lRoot->GetZoomAndPan() == ESvgZoomAndPanMagnify )
+ {
+
+ // Do panning
+ lRoot->GetTransform( trList );
+ if( trList )
+ {
+ pT = trList->GetItem( 0 );
+
+
+ pT.UserPan( PanX , PanY );
+
+ trList->ReplaceItem( pT, 0 );
+
+ lRoot->SetTransform(trList);
+ }
+ }
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Panning indicator
+// ---------------------------------------------------------------------------
+
+EXPORT_C TBool CSvgEngineInterfaceImpl::IsPanPossible( TInt aX, TInt aY, TInt aEngine )
+
+ {
+ if( !ChooseEngine( aEngine ) || (iSvgEngine->Document() == NULL) )
+ {
+ return EFalse;
+ }
+
+ CSvgSvgElementImpl* lRoot = ( CSvgSvgElementImpl* )
+ iSvgEngine->Document()->RootElement();
+ if ( lRoot == NULL)
+ return EFalse;
+ if ( lRoot->GetZoomAndPan() != ESvgZoomAndPanMagnify )
+ return EFalse;
+
+ // Get the clipping size
+ TFloatFixPt clipWidthFP, clipHeightFP;
+ TInt clipWidth, clipHeight;
+ lRoot->GetAttributeFloat( KAtrWidth, clipWidthFP );
+ lRoot->GetAttributeFloat( KAtrHeight, clipHeightFP );
+ clipWidth = ( TInt ) clipWidthFP;
+ clipHeight = ( TInt ) clipHeightFP;
+ // Get bounding box of svg element
+ TFloatFixPt zero ( 0 );
+ TGfxRectangle2D bound;
+ lRoot->GetBBox( bound );
+ TInt32 xmax = ( bound.iX + bound.iWidth );
+ TInt32 ymax = ( bound.iY + bound.iHeight );
+
+ // check them
+ if ( xmax <= clipWidth && aX < 0 )
+ aX = 0;
+ if ( bound.iX >= zero && aX > 0 )
+ aX = 0;
+ if ( ymax <= clipHeight && aY < 0 )
+ aY = 0;
+ if ( bound.iY >= zero && aY > 0 )
+ aY = 0;
+ // Do panning
+ if ( ( aY == 0 ) && ( aX == 0 ) )
+ return EFalse;
+ else
+ return ETrue;
+
+ }
+
+// ---------------------------------------------------------------------------
+// Panning indicator
+// ---------------------------------------------------------------------------
+
+EXPORT_C void CSvgEngineInterfaceImpl::IsPanPossibleFourWay
+ ( TBool& left, TBool& right, TBool& up, TBool& down, TInt aEngine )
+
+ {
+
+ left = right = up = down = EFalse;
+
+ if( !ChooseEngine( aEngine ) || (iSvgEngine->Document() == NULL) )
+ {
+ return ;
+ }
+
+ CSvgSvgElementImpl* lRoot = ( CSvgSvgElementImpl* )
+ iSvgEngine->Document()->RootElement();
+ if ( lRoot == NULL)
+ return ;
+ if ( lRoot->GetZoomAndPan() != ESvgZoomAndPanMagnify )
+ return ;
+
+ // Get the clipping size
+ TFloatFixPt clipWidthFP, clipHeightFP;
+ TInt clipWidth, clipHeight;
+ lRoot->GetAttributeFloat( KAtrWidth, clipWidthFP );
+ lRoot->GetAttributeFloat( KAtrHeight, clipHeightFP );
+ clipWidth = ( TInt ) clipWidthFP;
+ clipHeight = ( TInt ) clipHeightFP;
+ //the svg element has no width or height no reason to pan.
+ if (clipWidth <= 0 || clipHeight <= 0)
+ {
+ return;
+ }
+ // Get bounding box of svg element
+ TFloatFixPt zero ( 0 );
+ TGfxRectangle2D bound;
+ lRoot->GetBBox( bound );
+ //fix if no width or heigth is there.
+ if((TInt32)bound.iWidth <=0 ||(TInt32) bound.iHeight <=0 )
+ return;
+ TInt32 xmax = ( bound.iX + bound.iWidth );
+ TInt32 ymax = ( bound.iY + bound.iHeight );
+
+ // check the panning in four directions now.
+ TInt aX,aY;
+ // Check in Left direction
+ aX = 1; aY = 0;
+ if ( xmax <= clipWidth && aX < 0 )
+ aX = 0;
+ if ( bound.iX >= zero && aX > 0 )
+ aX = 0;
+ if ( ymax <= clipHeight && aY < 0 )
+ aY = 0;
+ if ( bound.iY >= zero && aY > 0 )
+ aY = 0;
+ // Do panning
+ if ( ( aY == 0 ) && ( aX == 0 ) )
+ left = EFalse;
+ else
+ left = ETrue;
+
+ // Check in Right direction
+ aX = -1; aY = 0;
+ if ( xmax <= clipWidth && aX < 0 )
+ aX = 0;
+ if ( bound.iX >= zero && aX > 0 )
+ aX = 0;
+ if ( ymax <= clipHeight && aY < 0 )
+ aY = 0;
+ if ( bound.iY >= zero && aY > 0 )
+ aY = 0;
+ // Do panning
+ if ( ( aY == 0 ) && ( aX == 0 ) )
+ right = EFalse;
+ else
+ right = ETrue;
+
+ // Check in Up direction
+ aX = 0; aY = 1;
+ if ( xmax <= clipWidth && aX < 0 )
+ aX = 0;
+ if ( bound.iX >= zero && aX > 0 )
+ aX = 0;
+ if ( ymax <= clipHeight && aY < 0 )
+ aY = 0;
+ if ( bound.iY >= zero && aY > 0 )
+ aY = 0;
+ // Do panning
+ if ( ( aY == 0 ) && ( aX == 0 ) )
+ up = EFalse;
+ else
+ up = ETrue;
+
+ // Check in down direction
+ aX = 0; aY = -1;
+ if ( xmax <= clipWidth && aX < 0 )
+ aX = 0;
+ if ( bound.iX >= zero && aX > 0 )
+ aX = 0;
+ if ( ymax <= clipHeight && aY < 0 )
+ aY = 0;
+ if ( bound.iY >= zero && aY > 0 )
+ aY = 0;
+ // Do panning
+ if ( ( aY == 0 ) && ( aX == 0 ) )
+ down = EFalse;
+ else
+ down = ETrue;
+
+ }
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::Rotate( TReal32 aAngle,
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::Rotate( TReal32 aAngle,
+ TInt aX,
+ TInt aY,
+ TInt aEngine ) __SOFTFP
+
+ {
+ TGfxAffineTransform rT;
+ MSvgTransformList* trList = NULL;
+
+ if( ChooseEngine( aEngine ) && iSvgEngine->Document() )
+ {
+ CSvgSvgElementImpl* lRoot = ( CSvgSvgElementImpl* )
+ iSvgEngine->Document()->RootElement();
+
+ if ( lRoot )
+ {
+ if ( lRoot->GetZoomAndPan() == ESvgZoomAndPanMagnify )
+ {
+ lRoot->GetTransform( trList );
+ if( trList )
+ {
+ rT = trList->GetItem( 0 );
+
+ rT.UserRotate( aAngle, aX, aY );
+ trList->ReplaceItem( rT, 0 );
+ iTotalRotation += aAngle;
+ }
+ lRoot->SetTransform(trList); //added
+ }
+ }
+ }
+ }
+
+// ==========================================================================
+// ContentDimensions integer value version
+//1) Return the size of the <svg> width/height if given in non-percentage.
+//
+//2) If <svg> width/height are given as percentages:
+// A) If viewbox attribute is specified, return the viewbox width/height times the <svg> width/height percentages.
+// B) Return the content bounding-box size times times the <svg> width/height percentages.
+// ==========================================================================
+EXPORT_C TSize CSvgEngineInterfaceImpl::ContentDimensions( TInt aEngine )
+ {
+ if ( !ChooseEngine( aEngine ) || !iSvgEngine->Document() )
+ {
+ return TSize( 0, 0 );
+ }
+
+ CSvgSvgElementImpl* svgElement = (CSvgSvgElementImpl* )iSvgEngine->Document()->RootElement();
+
+ if ( !svgElement )
+ {
+ return TSize( 0, 0 );
+ }
+
+ // width/height are given as user-units
+ if ( !( svgElement->iWidthInPercentage ) && !(svgElement->iHeightInPercentage))
+ {
+ return TSize( (TInt)svgElement->iWidthInUserCoordinate,
+ (TInt)svgElement->iHeightInUserCoordinate );
+ }
+
+ // width/height are given as percentages
+ TInt percentWidth = (TInt)svgElement->iWidthInUserCoordinate;
+ TInt percentHeight = (TInt)svgElement->iHeightInUserCoordinate;
+ // Multiply percentages with viewbox if available
+ TGfxRectangle2D viewBox;
+ if ( svgElement->GetViewBox( viewBox ) )
+ {
+ TInt tempWidth = 0, tempHeight = 0;
+
+ if( svgElement->iWidthInPercentage )
+ {
+ tempWidth = ((TReal32)viewBox.iWidth) * percentWidth / 100.0;
+ }
+ else
+ {
+ tempWidth = viewBox.iWidth;
+ }
+
+ if( svgElement->iHeightInPercentage )
+ {
+ tempHeight = ((TReal32)viewBox.iHeight) * percentHeight / 100.0;
+ }
+ else
+ {
+ tempHeight = viewBox.iHeight;
+ }
+ return TSize(tempWidth, tempHeight);
+ }
+ // return the <svg> bounding box
+ else
+ {
+ TSize bbSize = GetSvgBoundingBox().Size();
+ if( svgElement->iWidthInPercentage )
+ {
+ bbSize.iWidth = ((TReal32)bbSize.iWidth) * percentWidth / 100.0;
+ }
+ else
+ {
+ bbSize.iWidth = bbSize.iWidth;
+ }
+
+ if( svgElement->iHeightInPercentage )
+ {
+ bbSize.iHeight = ((TReal32)bbSize.iHeight) * percentHeight / 100.0;
+ }
+ else
+ {
+ bbSize.iHeight = bbSize.iHeight;
+ }
+ return bbSize;
+ }
+ }
+
+// ==========================================================================
+// ContentDimensions floating-point value version
+//1) Return the size of the <svg> width/height if given in non-percentage.
+//
+//2) If <svg> width/height are given as percentages:
+// A) If viewbox attribute is specified, return the viewbox width/height times the <svg> width/height percentages.
+// B) Return the content bounding-box size times times the <svg> width/height percentages.
+// ==========================================================================
+EXPORT_C void CSvgEngineInterfaceImpl::ContentDimensions( TReal32& aWidth, TReal32& aHeight, TInt aEngine ) __SOFTFP
+ {
+ aWidth = 0.0;
+ aHeight = 0.0;
+ if ( !ChooseEngine( aEngine ) || !iSvgEngine->Document() )
+ {
+ return;
+ }
+
+ CSvgSvgElementImpl* svgElement = (CSvgSvgElementImpl* )iSvgEngine->Document()->RootElement();
+
+ if ( !svgElement )
+ {
+ return;
+ }
+
+ // width/height are given as user-units
+ if ( !( svgElement->iWidthInPercentage ) && !( svgElement->iHeightInPercentage) )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("content size: %.4fx%.4f",
+ svgElement->iWidthInUserCoordinate,
+ svgElement->iHeightInUserCoordinate );
+
+ #endif
+ aWidth = svgElement->iWidthInUserCoordinate;
+ aHeight = svgElement->iHeightInUserCoordinate;
+ return;
+ }
+
+ // width/height are given as percentages
+ TReal32 percentWidth = svgElement->iWidthInUserCoordinate;
+ TReal32 percentHeight = svgElement->iHeightInUserCoordinate;
+
+ // Multiply percentages with viewbox if available
+ TGfxRectangle2D viewBox;
+ if ( svgElement->GetViewBox( viewBox ) )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("viewbox is defined: %.4fx%.4f",
+ ((TReal32)viewBox.iWidth) * percentWidth / 100.0,
+ ((TReal32)viewBox.iHeight) * percentHeight / 100.0 );
+
+ #endif
+ if( svgElement->iWidthInPercentage )
+ {
+ aWidth = ((TReal32)viewBox.iWidth) * percentWidth / 100.0;
+ }
+ else
+ {
+ aWidth = viewBox.iWidth;
+ }
+
+ if( svgElement->iHeightInPercentage )
+ {
+ aHeight = ((TReal32)viewBox.iHeight) * percentHeight / 100.0;
+ }
+ else
+ {
+ aHeight = viewBox.iHeight;
+ }
+ return;
+ }
+ // return the <svg> bounding box
+ else
+ {
+ CSvgSvgElementImpl* lRoot = ( CSvgSvgElementImpl* )iSvgEngine->Document()->RootElement();
+ if( lRoot )
+ {
+ TReal32 x, y;
+ GetElementBoundingbox( lRoot, x, y, aWidth, aHeight );
+ if(svgElement->iWidthInPercentage )
+ {
+ aWidth = aWidth * percentWidth / 100.0;
+ }
+ if(svgElement->iHeightInPercentage )
+ {
+ aHeight = aHeight * percentHeight / 100.0;
+ }
+ }
+ }
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C TSize CSvgEngineInterfaceImpl::ContentDimensions()
+// ---------------------------------------------------------------------------
+EXPORT_C TSize CSvgEngineInterfaceImpl::ContentDimensionsInPercentage( TInt aEngine )
+ {
+ TSize lSize;
+
+ if( ChooseEngine( aEngine ) && (iSvgEngine->Document() != NULL) )
+ {
+ CSvgSvgElementImpl* rootElement = ( CSvgSvgElementImpl* )
+ iSvgEngine->Document()->RootElement();
+
+ if ( rootElement != NULL )
+ {
+ if(rootElement->iWidthInPercentage)
+ {
+ lSize.iWidth = ( TFloatFixPt ) ( rootElement->iWidthInUserCoordinate );
+ }
+ else
+ {
+ lSize.iWidth = -1;
+ }
+ if(rootElement->iHeightInPercentage)
+ {
+ lSize.iHeight = ( TFloatFixPt ) ( rootElement->iHeightInUserCoordinate );
+ }
+ else
+ {
+ lSize.iHeight = -1;
+ }
+ }
+
+ }
+ return lSize;
+ }
+// --------------------------------------------------------------------------
+// EXPORT_C TRect CSvgEngineInterfaceImpl::FocusNext()
+// ---------------------------------------------------------------------------
+EXPORT_C TRect CSvgEngineInterfaceImpl::FocusNext()
+ {
+ if(iSvgEngine->Document())
+ iSvgEngine->Document()->IncCurFocusIndex();
+ return (GetFocusBbox(ETrue));
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C TRect CSvgEngineInterfaceImpl::FocusPrevious()
+// ---------------------------------------------------------------------------
+EXPORT_C TRect CSvgEngineInterfaceImpl::FocusPrevious()
+ {
+ if(iSvgEngine->Document())
+ iSvgEngine->Document()->DecCurFocusIndex();
+ return (GetFocusBbox(EFalse));
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::ActivateObjectInFocus()
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::ActivateObjectInFocus()
+ {
+ TGfxRectangle2D lBbox;
+
+ if( iSvgEngine->Document() && iSvgEngine->Document()->GetCurFocusObject() )
+ {
+ iSvgEngine->Document()->GetCurFocusObject()->GetBBox( lBbox );
+ // Send mouse down and mouse up events to the engine
+ // This will send message back to the application to handle the activation
+ MouseDown( lBbox.CenterX(), lBbox.CenterY() );
+ MouseUp( lBbox.CenterX(), lBbox.CenterY() );
+ }
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C TInt32 CSvgEngineInterfaceImpl::MediaTime()
+// ---------------------------------------------------------------------------
+EXPORT_C TInt32 CSvgEngineInterfaceImpl::MediaTime( TInt aEngine )
+ {
+ if (ChooseEngine( aEngine ))
+ {
+ return iSvgEngine->CurrentTIme();
+ }
+
+ return 0;
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetMediaTime(TInt32 aTime)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetMediaTime(TInt32 aTime, TInt aEngine )
+ {
+
+ // Time given is in milliseconds whereas the time needed by timer is microseconds
+ // Resume(aTime * 1000);
+ if ( ChooseEngine( aEngine ) )
+ {
+ iSvgEngine->SetMediaTime(aTime* 1000);
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgEngineInterfaceImpl::ResetFocusIndex(TInt32 aIndex)
+// ---------------------------------------------------------------------------
+void CSvgEngineInterfaceImpl::ResetFocusIndex(TInt32 /*aIndex*/)
+ {
+ //iSvgEngine->Document()->SetCurIndex(TInt32 aVal); aIndex;
+ }
+
+
+// --------------------------------------------------------------------------
+// TRect CSvgEngineInterfaceImpl::GetFocusBbox( TBool aNextObj )
+// ---------------------------------------------------------------------------
+TRect CSvgEngineInterfaceImpl::GetFocusBbox( TBool aNextObj, TInt aEngine )
+ {
+ TGfxRectangle2D lBbox;
+ TInt32 lNewIndex;
+
+ if( ChooseEngine( aEngine ) && iSvgEngine->Document() )
+ {
+ // Obtain the current focussable object starting with the current index
+
+ // The GetEventReceiverElement function takes in parameters as the
+ //current focus objects index and whether we are going next or previous
+ // and the mask of the kind of input that we are accepting..
+ // It returns the value of the new index through the lNewIndex.
+ iSvgEngine->Document()->SetCurFocusObject (
+ iSvgEngine->Document()->GetEventReceiverElement(
+ iSvgEngine->Document()->GetCurFocusIndex(),
+ aNextObj, KSvgEventMaskExternalUI,
+ lNewIndex ));
+ // Update the index to where the focussable object was found
+ iSvgEngine->Document()->SetCurFocusIndex(lNewIndex);
+
+ if( iSvgEngine->Document()->GetCurFocusObject() )
+ {
+ iSvgEngine->Document()->GetCurFocusObject()->GetBBox(lBbox);
+
+ // Send a mouse move event to the engine
+ MouseMove( lBbox.CenterX(), lBbox.CenterY() );
+ }
+ }
+
+ return TRect( lBbox.iX, lBbox.iY, lBbox.iX + lBbox.iWidth, lBbox.iY + lBbox.iHeight );
+ }
+
+
+// --------------------------------------------------------------------------
+// void CSvgEngineInterfaceImpl::Resume(TInt32 aTime)
+// ---------------------------------------------------------------------------
+void CSvgEngineInterfaceImpl::Resume(TInt32 aTime, TInt aEngine )
+ {
+ if ( ChooseEngine( aEngine ) )
+ {
+ iSvgEngine->Resume(aTime);
+ }
+ }
+// --------------------------------------------------------------------------
+// EXPORT_C TSize CSvgEngineInterfaceImpl::Size()
+// ---------------------------------------------------------------------------
+EXPORT_C TSize CSvgEngineInterfaceImpl::Size( TInt aEngine )
+ {
+ TSize lSize(0,0);
+
+ if( ChooseEngine( aEngine ) )
+ {
+ CSvgDocumentImpl* lSvgDocument = iSvgEngine->Document();
+ if( lSvgDocument )
+ {
+ CSvgSvgElementImpl* lSvgRootElement = (CSvgSvgElementImpl *)lSvgDocument->RootElement();
+ if( lSvgRootElement )
+ {
+ lSize.iWidth = (TInt)lSvgRootElement->Width();
+ lSize.iHeight = (TInt)lSvgRootElement->Height();
+ }
+ }
+ }
+ return lSize;
+ }
+// --------------------------------------------------------------------------
+// EXPORT_C TPoint CSvgEngineInterfaceImpl::Position()
+// ---------------------------------------------------------------------------
+EXPORT_C TPoint CSvgEngineInterfaceImpl::Position( TInt aEngine )
+ {
+ TPoint lPoint(0,0);
+
+ if(ChooseEngine( aEngine ))
+ {
+ CSvgDocumentImpl* lSvgDocument = iSvgEngine->Document();
+ if( lSvgDocument )
+ {
+ CSvgSvgElementImpl* lSvgRootElement = (CSvgSvgElementImpl *)lSvgDocument->RootElement();
+ if( lSvgRootElement )
+ {
+ lPoint.iX = (TInt)lSvgRootElement->X();
+ lPoint.iY = (TInt)lSvgRootElement->Y();
+ }
+ }
+ }
+ return lPoint;
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::GenerateMask(CFbsBitmap* aMask)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::GenerateMask(CFbsBitmap* aMask, TInt aEngine )
+ {
+ if ( ChooseEngine( aEngine ) )
+ {
+ iSvgEngine->GenerateMask(aMask);
+ }
+ }
+
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetBackgroundColor(TUint32 aRGBA8888Color, CSvgEngineImpl* aEngine)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetBackgroundColor(TUint32 aRGBA8888Color, CSvgEngineImpl* aEngine)
+ {
+ if (ChooseEngine( (TInt)aEngine ))
+ {
+ iSvgEngine->SetBackgroundColor(aRGBA8888Color);
+ }
+ }
+
+
+// --------------------------------------------------------------------------
+// EXPORT_C TInt CSvgEngineInterfaceImpl::CurrentState()
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CSvgEngineInterfaceImpl::CurrentState( TInt aEngine )
+ {
+ if (ChooseEngine(aEngine))
+ {
+ return (TInt) iSvgEngine->SVGEngineState();
+ }
+
+ return 0;
+ }
+
+
+
+// --------------------------------------------------------------------------
+// EXPORT_C TPoint CSvgEngineInterfaceImpl::PanPosition()
+// ---------------------------------------------------------------------------
+EXPORT_C TPoint CSvgEngineInterfaceImpl::PanPosition( TInt aEngine )
+ {
+ TPoint lPoint;
+
+ if( ChooseEngine(aEngine) && iSvgEngine->Document() )
+ {
+ CSvgSvgElementImpl* lRoot = ( CSvgSvgElementImpl* )
+ iSvgEngine->Document()->RootElement();
+ if ( lRoot )
+ {
+ MSvgTransformList* trList = NULL;
+
+ lRoot->GetTransform( trList );
+
+ if( trList )
+ {
+ TGfxAffineTransform pT = trList->GetItem( 0 );
+
+ lPoint.iX = (TInt) pT.TranslateX();
+ lPoint.iY = (TInt) pT.TranslateY();
+ }
+ }
+ }
+
+ return lPoint;
+ }
+
+
+
+// --------------------------------------------------------------------------
+// EXPORT_C MSvgError* CSvgEngineInterfaceImpl::Replay()
+// ---------------------------------------------------------------------------
+EXPORT_C MSvgError* CSvgEngineInterfaceImpl::Replay( TInt aEngine )
+ {
+
+ iTotalRotation = 0;
+
+ if( ChooseEngine(aEngine) )
+ {
+ iSvgEngine->SetMediaTime( 0 );
+ return NULL;
+ }
+ return iSvgError;
+ }
+
+/*SVGT DOM API Caching APIs*/
+// --------------------------------------------------------------------------
+// EXPORT_C MSvgError* CSvgEngineInterfaceImpl::PrepareDom(const TDesC& aFileName, TInt& aHandle)
+// ---------------------------------------------------------------------------
+EXPORT_C MSvgError* CSvgEngineInterfaceImpl::PrepareDom(const TDesC& aFileName, TInt& aHandle, TInt aEngine)
+{
+ // Create session to open file
+ RFs session;
+ CSvgDocumentImpl::OpenSession( session, *iSvgError );
+ if ( iSvgError->HasError() )
+ {
+ return iSvgError;
+ }
+
+ // Open file handle
+ RFile fileHandle;
+ TInt openError = fileHandle.Open( session, aFileName, EFileRead );
+ if ( openError != KErrNone )
+ {
+ _LIT(msg, "Fail to open file for reading: ");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, openError,
+ msg, aFileName );
+ }
+ else
+ {
+ PrepareDom( fileHandle, aHandle, aEngine );
+ }
+ session.Close();
+ return iSvgError;
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C MSvgError* CSvgEngineInterfaceImpl::PrepareDom( RFile& aFileHandle, TInt& aHandle )
+// ---------------------------------------------------------------------------
+EXPORT_C MSvgError* CSvgEngineInterfaceImpl::PrepareDom( RFile& aFileHandle, TInt& aHandle, TInt aEngine )
+ {
+ // reset to start of file
+ TInt zero = 0;
+ aFileHandle.Seek( ESeekStart, zero );
+
+ TInt fileSize = 0;
+ TInt sizeError = aFileHandle.Size( fileSize );
+ if ( sizeError != KErrNone )
+ {
+ _LIT( KErrorMsg, "Failed to Load Svg Content: Read File Size Error." );
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, sizeError,
+ KErrorMsg, KNullDesC );
+ return iSvgError;
+ }
+
+ //It is the fix for ESMA-7PN9WU
+ //file size should be more than 2 bytes
+ if ( fileSize < 2)
+ {
+ _LIT( KErrorMsg, "File is empty" );
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, sizeError,
+ KErrorMsg, KNullDesC );
+ return iSvgError;
+ }
+
+ HBufC8* binaryBuffer=NULL;
+
+ binaryBuffer = HBufC8::New ( fileSize );
+ if (!binaryBuffer)
+ {
+ _LIT( KErrorMsg, "Failed to Load Svg Content: Out of memory");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgNoMemory, KErrNoMemory,
+ KErrorMsg, KNullDesC );
+ return iSvgError;
+ }
+
+ TPtr8 binaryBufferPtr = binaryBuffer->Des();
+ TInt readError = aFileHandle.Read(binaryBufferPtr, fileSize);
+ if ( readError != KErrNone )
+ {
+ _LIT( KErrorMsg, "Failed to Load Svg Content: Read File Data Error");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgNoMemory, readError,
+ KErrorMsg, KNullDesC );
+ delete binaryBuffer;
+ return iSvgError;
+ }
+
+ // For files which are in UTF-16 or unicode format the first 2 bytes
+ // will be FF and FE. In UTF-16 and unicode format every single character
+ // is represented by two bytes.
+ TInt hichar = (CEditableText::EReversedByteOrderMark & 0xFF00)>>8;
+ TInt lochar = CEditableText::EReversedByteOrderMark & 0x00FF;
+ TInt bytesPerChar = 1;
+
+ if(binaryBufferPtr[0] == hichar && binaryBufferPtr[1] == lochar)
+ {
+ bytesPerChar = 2;
+
+ HBufC* dataBuffer=NULL;
+
+ dataBuffer = HBufC::New(fileSize/bytesPerChar);
+ if ( !dataBuffer)
+ {
+ _LIT( KErrorMsg, "Failed to Load Svg Content: Out of memory");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgNoMemory, KErrNoMemory,
+ KErrorMsg, KNullDesC );
+ delete binaryBuffer;
+ return iSvgError;
+ }
+
+ TPtr dataBufferPtr = dataBuffer->Des();
+
+ // Skip two bytes and set the pointer to the next location
+ // from where the actual data starts.
+ dataBufferPtr.Set((TUint16*)binaryBufferPtr.Ptr()+1,
+ fileSize/bytesPerChar-1,
+ fileSize/bytesPerChar-1);
+
+ HBufC8* outputBuffer= NULL;
+ outputBuffer=HBufC8::New(fileSize);
+ if(!outputBuffer)
+ {
+ _LIT( KErrorMsg, "Failed to Load Svg Content: Out of memory");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgNoMemory, KErrNoMemory,
+ KErrorMsg, KNullDesC );
+ delete dataBuffer;
+ delete binaryBuffer;
+ return iSvgError;
+ }
+ TPtr8 outputBufferptr=outputBuffer->Des();
+ CnvUtfConverter::ConvertFromUnicodeToUtf8(
+ outputBufferptr, // Destination
+ dataBufferPtr );
+ PrepareDom( *outputBuffer, aHandle, aEngine );
+ delete outputBuffer;
+ delete dataBuffer;
+ }
+ else
+ {
+ PrepareDom( *binaryBuffer, aHandle, aEngine );
+ }
+
+ delete binaryBuffer;
+ return iSvgError;
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C MSvgError* CSvgEngineInterfaceImpl::PrepareDom(const TDesC8& aByteData, TInt& aHandle)
+// ---------------------------------------------------------------------------
+EXPORT_C MSvgError* CSvgEngineInterfaceImpl::PrepareDom(const TDesC8& aByteData, TInt& aHandle, TInt aEngine )
+ {
+ aHandle = 0;
+
+ // Clear Error
+ iSvgError->SetErrorCode( ESvgNoError );
+
+ if( !ChooseEngine(aEngine) )
+ {
+ _LIT(KEngineFailed, "SvgEngine Internal Failure: SvgEngineImpl not present.");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, KErrNone,
+ KEngineFailed, KNullDesC );
+ return iSvgError;
+ }
+
+ CSvgDocumentImpl* newDocument = NULL;
+ // Pass EFalse to document creation to indicate it has no parent
+ TRAPD( error, newDocument = CSvgDocumentImpl::NewL( iSvgBitmapFontProvider, EFalse ) );
+
+ // Check for error
+ if(error != KErrNone)
+ {
+ _LIT(KEngineFailed, "Failed to Create Svg Document: Out of Memory");
+ #ifdef _DEBUG
+ RDebug::Print(KEngineFailed);
+ #endif //_DEBUG
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgNoMemory, error,
+ KEngineFailed, KNullDesC );
+ return iSvgError;
+ }
+
+ iSvgDocumentPointers.Append(newDocument);
+
+ // Set appropriate flags to documents
+ newDocument->SetWasPrepared( !iIsLoadingRequest );
+ newDocument->SetDRMMode( iDrmEnabled );
+ newDocument->SetThumbNailMode( iIsThumbNailMode );
+ newDocument->SetDRMRights( iDrmRightsConsumptionEnabled);
+
+ CSvgDocumentImpl* currentDocument = iSvgEngine->Document();
+
+ // Hook engine to document
+ iSvgEngine->SetDocument( newDocument );
+ newDocument->SetEngine( iSvgEngine );
+ newDocument->SetLoadingListeners( &iSvgLoadingListeners );
+
+ // Parse document
+ newDocument->Load( aByteData, *iSvgError );
+
+ // Put back the document that was attached to document,
+ // since this is preparing the dom tree only
+ if ( !iIsLoadingRequest )
+ {
+ iSvgEngine->SetDocument( currentDocument );
+ }
+
+ #ifdef _DEBUG
+ if ( newDocument->GetError() && newDocument->GetError()->HasError() )
+ {
+ RDebug::Printf("Load warning: ");
+ RDebug::RawPrint( newDocument->GetError()->Description() );
+ }
+ #endif
+
+ iFileIsLoaded = !iSvgError->HasError() || iSvgError->IsWarning();
+
+ // Parsing error or out of memory
+ if ( !iFileIsLoaded )
+ {
+ DestroyDocument(newDocument);
+ return iSvgError;
+ }
+
+ aHandle = (TInt)newDocument;
+
+ return iSvgError;
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C MSvgError* CSvgEngineInterfaceImpl::RenderDom(TInt aHandle, CFbsBitmap* aRenderBuffer)
+// ---------------------------------------------------------------------------
+EXPORT_C MSvgError* CSvgEngineInterfaceImpl::RenderDom(TInt aHandle, CFbsBitmap* aRenderBuffer, CFbsBitmap* aMaskBuffer)
+ {
+ UseDom( aHandle, aRenderBuffer, aMaskBuffer );
+
+ if ( !iSvgError->HasError() || iSvgError->IsWarning() )
+ {
+ iSvgEngine->StartEngine();
+ iFileIsLoaded = ETrue;
+ }
+
+ return iSvgError;
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C MSvgError* CSvgEngineInterfaceImpl::DeleteDom(TInt aHandle)
+// ---------------------------------------------------------------------------
+EXPORT_C MSvgError* CSvgEngineInterfaceImpl::DeleteDom(TInt aHandle)
+ {
+ // Clear Error
+ iSvgError->SetErrorCode( ESvgNoError );
+
+ DestroyDocument((CSvgDocumentImpl*)aHandle);
+
+ return iSvgError;
+ }
+
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetDRMMode(TBool aEnable)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetDRMMode(TBool aEnable, TInt aEngine)
+ {
+ iDrmEnabled = aEnable;
+ if( ChooseEngine( aEngine ) && iSvgEngine->Document())
+ iSvgEngine->Document()->SetDRMMode(aEnable);
+ }
+
+//---------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetDRMRights(TBool aEnable)
+//---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetDRMRights(TBool aEnable)
+ {
+ iDrmRightsConsumptionEnabled = aEnable;
+ if ( iSvgEngine && iSvgEngine->Document())
+ {
+ iSvgEngine->Document()->SetDRMRights(aEnable);
+ }
+
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C MSvgError* CSvgEngineInterfaceImpl::UseDom(TInt aHandle, CFbsBitmap* aRenderBuffer)
+// ---------------------------------------------------------------------------
+EXPORT_C MSvgError* CSvgEngineInterfaceImpl::UseDom(TInt aHandle, CFbsBitmap* aRenderBuffer, CFbsBitmap* aMask, TInt aEngine)
+ {
+ // Clear Error
+ iSvgError->SetErrorCode( ESvgNoError );
+
+ // Check for engine: Should not occur
+ if( !ChooseEngine( aEngine ) )
+ {
+ _LIT(KEngineFailed, "SvgEngine Internal Failure: SvgEngineImpl not present.");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, KErrNone,
+ KEngineFailed, KNullDesC );
+ return iSvgError;
+ }
+
+ // Check for valid DOM
+ if( !IsDomCached( aHandle ) )
+ {
+ _LIT(KEngineFailed, "Invalid DOM, Use Prepare() to create DOM");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, KErrNone,
+ KEngineFailed, KNullDesC );
+ return iSvgError;
+ }
+
+ iTotalRotation = 0;
+
+ iFileIsLoaded = EFalse;
+
+ // Switch GDI context
+ TRAPD( gdiError, iSvgEngine->SetGdiContextL( aRenderBuffer, aMask ) );
+ if ( gdiError != KErrNone )
+ {
+ if ( gdiError == KErrNoMemory )
+ {
+ _LIT(KEngineGDIFailed, "SVG Engine Set Gdi Context Failed");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgNoMemory, KErrNoMemory,
+ KEngineGDIFailed, KNullDesC );
+ return iSvgError;
+ }
+ _LIT(KEngineGDIFailed, "SVG Engine Set Gdi Context Failed");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, KErrNone,
+ KEngineGDIFailed, KNullDesC );
+ return iSvgError;
+ }
+
+ CSvgDocumentImpl* document = (CSvgDocumentImpl*)aHandle;
+
+ CSvgDocumentImpl* lExistDoc = iSvgEngine->Document();
+
+ if (lExistDoc != document)
+ {
+ //this is a new document so swap it out...
+ iSvgEngine->SetDocument( document );
+ document->SetEngine( iSvgEngine );
+ document->ReInitialize();
+ }
+
+ if (lExistDoc == iSvgLoadedDocument)
+ {
+ DestroyDocument(iSvgLoadedDocument);
+ iSvgLoadedDocument = NULL;
+ }
+
+ // Check for thumbnail restrictions
+ if ( !iSvgEngine->PassesThumbNailRestriction() )
+ {
+ _LIT( KThumbNailRestriction, "Frame buffer is larger than allowable size for thumbnail mode." );
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgThumbNailRestriction, KErrNone,
+ KThumbNailRestriction, KNullDesC );
+ return iSvgError;
+ }
+
+ iFileIsLoaded = ETrue;
+
+ return iSvgError;
+ }
+
+// ---------------------------------------------------------------------------
+// Is DOM cached
+// ---------------------------------------------------------------------------
+TBool CSvgEngineInterfaceImpl::IsDomCached(TInt aHandle)
+ {
+ return iSvgDocumentPointers.Find( (CSvgDocumentImpl*)aHandle ) != KErrNotFound;
+ }
+
+//---------------------------------------------------------------------------=
+//Resize the view to the rendering buffer
+//---------------------------------------------------------------------------=
+EXPORT_C void CSvgEngineInterfaceImpl::SetSvgDimensionToFrameBuffer(TUint aWidth, TUint aHeight, TInt aEngine)
+{
+
+ if ( ChooseEngine(aEngine) )
+ {
+ TRAPD(error,iSvgEngine->SetSvgDimensionToFrameBufferL(aWidth, aHeight) );
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KSetFrameBufferFailed,
+ "CSvgEngineInterfaceImpl::SetSvgDimensionToFrameBuffer: SetSvgDimensionToFrameBufferL error.");
+ RDebug::Print(KSetFrameBufferFailed);
+ #endif //_DEBUG
+ }
+ }
+
+
+}
+
+//---------------------------------------------------------------------------=
+//Check if content is interactive
+//---------------------------------------------------------------------------=
+
+EXPORT_C TBool CSvgEngineInterfaceImpl::IsContentInteractive(CSvgDocumentImpl* aDocument, TInt aEngine )
+{
+ if ( ( aDocument == NULL ) || ( !ChooseEngine(aEngine) ) || ( aDocument->RootElement() == NULL ) )
+ return EFalse;
+
+ return aDocument->IsDocumentContentInteractive();
+ /* RPointerArray<CSvgElementImpl> elements;
+ aDocument->FindAllElements( (CSvgElementImpl* )aDocument->RootElement(),
+ KSvgAElement, elements );
+ if ( elements.Count() != 0 )
+ {
+ elements.Close();
+ return ETrue;
+ }
+ elements.Close();
+
+ if ( aDocument->iIsInteractive )
+ return ETrue;
+ else
+ return EFalse;*/
+}
+
+//---------------------------------------------------------------------------=
+//Copies a new path vector into the the given element's path
+//---------------------------------------------------------------------------=
+
+EXPORT_C void CSvgEngineInterfaceImpl::UpdatePath(TInt hPath, CSvgElementImpl* hElement)
+{
+ if ((hElement != NULL) && (hElement->ElemID() == KSvgPathElement))
+ {
+ TRAPD(error,hElement->SetAttributePathL(KAtrData, (CGfxGeneralPath*)hPath ));
+ if ( error != KErrNone )
+ {
+ // Error Processing
+ return;
+ }
+ }
+}
+
+//---------------------------------------------------------------------------=
+//Returns the number of external resources in an svg document (A elements,IMG elements)
+//---------------------------------------------------------------------------=
+
+EXPORT_C TInt CSvgEngineInterfaceImpl::GetExternalListSize(CSvgDocumentImpl* aDocument)
+{
+ if ( ( aDocument == NULL ) || ( aDocument->RootElement() == NULL ) )
+ return 0;
+
+ TInt sum = 0;
+
+ RPointerArray<CSvgElementImpl> a_elements;
+ RPointerArray<CSvgElementImpl> image_elements;
+
+ aDocument->FindAllElements( (CSvgElementImpl* )aDocument->RootElement(),
+ KSvgAElement, a_elements );
+ if ( a_elements.Count() != 0 )
+ {
+ sum = sum + a_elements.Count();
+ }
+ a_elements.Close();
+
+ aDocument->FindAllElements( (CSvgElementImpl* )aDocument->RootElement(),
+ KSvgImageElement, image_elements );
+ if ( image_elements.Count() != 0 )
+ {
+ sum = sum + image_elements.Count();
+ }
+ image_elements.Close();
+
+ return sum;
+
+}
+
+//---------------------------------------------------------------------------=
+//Returns the uri of an external resource in an svg document (A elements,IMG elements)
+//---------------------------------------------------------------------------=
+
+EXPORT_C void CSvgEngineInterfaceImpl::GetExternalListItemL(
+ CSvgDocumentImpl* aDocument, TInt aIndex, TPtrC16& aUri)
+ {
+ TDesC* uri = NULL;
+ if ( ( aDocument != NULL ) && ( aDocument->RootElement() != NULL ) )
+ {
+ RPointerArray<CSvgElementImpl> a_elements;
+ RPointerArray<CSvgElementImpl> image_elements;
+ RPointerArray<CSvgElementImpl> all_externals;
+ // Find & add all <a> elements
+ aDocument->FindAllElements( (CSvgElementImpl* )aDocument->RootElement(),
+ KSvgAElement, a_elements );
+ for (TInt i=0; i < a_elements.Count(); i++ )
+ {
+ all_externals.Append(a_elements[i]);
+ }
+ // Find & add all <image> elements
+ aDocument->FindAllElements( (CSvgElementImpl* )aDocument->RootElement(),
+ KSvgImageElement, image_elements );
+ for ( TInt i=0; i < image_elements.Count(); i++ )
+ {
+ all_externals.Append( image_elements[ i ] );
+ }
+ // Get element according to the given index
+ if ( aIndex < all_externals.Count() )
+ {
+
+ CSvgElementImpl* myElement = (CSvgElementImpl*)all_externals[ aIndex ];
+ if ( myElement )
+ {
+ if ( (myElement->ElemID() ==
+ KSvgImageElement) && ( ( ( CSvgImageElementImpl* ) myElement )->iIsBase64 ) )
+ {
+ //do nothing because this is base64.
+ //want to return null for aValue
+ }
+ // Get an external resource uri
+ else
+ {
+ uri = myElement->HrefPointer();
+ // Check if the uri is already downloaded
+ if( ( uri != NULL ) && ( uri->Length() >= 0 ) )
+ {
+ TDesC* duplicateUri = NULL;
+ for ( int index = aIndex - 1; index >= 0; index-- )
+ {
+ myElement = (CSvgElementImpl*)all_externals[ index ];
+ if (myElement)
+ {
+ duplicateUri = myElement->HrefPointer();
+ if ( ( duplicateUri != NULL ) && ( *uri == *duplicateUri ) )
+ {
+ // External resource is already downloaded. Don't have
+ // to equest it again
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ image_elements.Close();
+ a_elements.Close();
+ all_externals.Close();
+ }
+ if( uri != NULL )
+ {
+ // Allocate heap memory
+ /*TInt length = uri->Length() + 1;
+ TUint16* result = new ( ELeave ) TUint16[ length ];
+ TPtr16 resultPtr( result, length );
+ resultPtr.Copy( *uri );
+ resultPtr.ZeroTerminate();
+ return CONST_CAST( TUint16*, resultPtr.Ptr() );*/
+
+ aUri.Set(*uri);
+
+ }
+ return;
+ }
+
+
+//---------------------------------------------------------------------------=
+// Finds the element with the corresponding uri and then adds the data that was
+// passed in by an external resource handler
+//---------------------------------------------------------------------------=
+// This code was copied from the CSvgEngineImpl
+EXPORT_C CSvgElementImpl* CSvgEngineInterfaceImpl::AddExternalData(
+ CSvgDocumentImpl* aDocument,
+ const TDesC& aUri,
+ const TDesC8& aData,
+ TBool aMakeCopy,
+ TInt aSize,
+ TInt aEngine )
+ {
+ // Use the internal engine's document if parameter is NULL
+ if ( aDocument == NULL )
+ {
+ if ( ChooseEngine( aEngine) )
+ {
+ aDocument = iSvgEngine->Document();
+ }
+ }
+
+ // Check whether document, root element are valid and URI is of
+ // non-zero length
+ if ( ( aDocument == NULL ) || ( aDocument->RootElement() == NULL ) ||
+ ( aUri.Length() == 0 ) )
+ {
+ return NULL;
+ }
+
+ // Find all <image> elements in current document
+ RPointerArray<CSvgElementImpl> lAllImageElements;
+ RPointerArray<CSvgElementImpl> lMatchingImageElements;
+ aDocument->FindAllElements( (CSvgElementImpl*)aDocument->RootElement(),
+ KSvgImageElement,
+ lAllImageElements,
+ ESvgSearchExcludeUseSubtree ); // Ignore the
+ // cloned image elements
+ // under use element
+
+ // Set Owner Document to default Doc
+ for ( TInt lIndex = 0; lIndex < lAllImageElements.Count(); lIndex++ )
+ {
+ lAllImageElements[ lIndex ]->SetOwnerDocument( aDocument );
+ } // for ( TInt lIndex = 0; ...
+
+ // Search for Image elements inside child document as well
+ // First create a list of animation elements.
+ RPointerArray<CSvgElementImpl> lAllAnimationElements;
+ aDocument->FindAllElements( ( CSvgElementImpl* )aDocument->RootElement(),
+ KSvgMediaAnimationElement,
+ lAllAnimationElements );
+ // Each animation element has a child document, append the list of image elements
+ // found in the child document to lAllImageElements
+ TInt lAllAnimationEleCnt = lAllAnimationElements.Count();
+ for ( TInt i = 0; i < lAllAnimationEleCnt; i++ )
+ {
+ CSvgMediaAnimationElementImpl* element =
+ ( CSvgMediaAnimationElementImpl* )lAllAnimationElements[i];
+ CSvgDocumentImpl* ldoc = element->GetChildDocument();
+ if ( ldoc )
+ {
+ RPointerArray<CSvgElementImpl> lChildImageElements;
+ ldoc->FindAllElements( (CSvgElementImpl*)ldoc->RootElement(),
+ KSvgImageElement,
+ lChildImageElements,
+ ESvgSearchExcludeUseSubtree ); // Ignore the
+ // cloned image elements
+ // under use element
+ // Set Owner Document to child Doc
+ for ( TInt lIndex = 0; lIndex < lChildImageElements.Count(); lIndex++ )
+ {
+ lChildImageElements[ lIndex ]->SetOwnerDocument( ldoc );
+ // Also append the image elements into the image list
+ lAllImageElements.Append( lChildImageElements[ lIndex ] );
+ } // for ( TInt lIndex = 0; ...
+ lChildImageElements.Close();
+ }
+ } // for ( TInt i = 0; i < lAllAnimationEleCnt; i++ )
+
+ lAllAnimationElements.Close();
+ // lAllImageElements now contains image elements in parent as well as child documents
+ // Generate a list with only those image elements with same URI
+ TInt lAllImageEleCnt = lAllImageElements.Count();
+ for ( TInt i = 0; i < lAllImageEleCnt; i++ )
+ {
+ CSvgImageElementImpl* element = ( CSvgImageElementImpl* )
+ lAllImageElements[ i ];
+ TPtrC href = element->Href();
+ if ( href == aUri )
+ {
+ lMatchingImageElements.Append( element );
+ }
+ }
+ lAllImageElements.Close();
+
+ // Return if no <image> element matching URI
+ if ( lMatchingImageElements.Count() == 0 )
+ {
+ lMatchingImageElements.Close();
+ return NULL;
+ }
+
+ // Only first <image> element owns the imageData and all other image
+ // elements refer to this data for decoding.
+ CSvgImageElementImpl* firstElement = ( CSvgImageElementImpl* )
+ lMatchingImageElements[0];
+
+ // This loop decodes the imageData for every image element which has
+ // the same URI.
+ // Two image elements could have the same URI, yet they may have different sizes
+ // hence every image element decodes the same imageData.
+ TInt lImageEleCnt = lMatchingImageElements.Count();
+ for (TInt j=0; j < lImageEleCnt; j++)
+ {
+ CSvgImageElementImpl* lImageElement = ( CSvgImageElementImpl* )
+ lMatchingImageElements[j];
+
+ // Create bitmap if needed
+ CFbsBitmap* bitmap = lImageElement->GetBitmap();
+ if ( bitmap == NULL )
+ {
+ // Can't use ELeave because that this function can't leave
+ bitmap = new CFbsBitmap();
+ // Check if bitmap was allocated
+ if ( !bitmap )
+ {
+ #ifdef _DBEUG
+ RDebug::Printf("ERROR IN BITAMP CREATION: new (ELeave) CFbsBitmap(): %d", bitmapError);
+ #endif
+ // Return firstElement so that the image data is not deleted.
+ // The data needs to be valid as this is happening inside a
+ // loop and previous image elements which have started decoding
+ // this image data should not get affected.
+ return firstElement;
+ }
+
+ // Create minimum bitmap size
+ TInt createError = bitmap->Create( TSize( 1, 1 ), EColor64K );
+ if ( createError != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf( "ERROR IN BITAMP CREATION: bitmap->Create: %d", createError );
+ #endif
+ delete bitmap;
+ // Return firstElement so that the image data is not deleted.
+ // The data needs to be valid as this is happening inside a
+ // loop and previous image elements which have started decoding
+ // this image data should not get affected.
+ return firstElement;
+ }
+ // Transfer ownership of bitmap to image element
+ lImageElement->SetBitmap( bitmap );
+ } // if ( !bitmap )
+
+ if ( aMakeCopy )
+ {
+ // Make a copy of the image data and transfer ownership for this
+ // data to the particular image element
+ HBufC8* lImageDataCopy = NULL;
+ TRAPD( error, lImageDataCopy = HBufC8::NewL( aData.Length() ) );
+
+ if ( error != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf( "Failed to copy Image: Out of memory" );
+ #endif
+
+ return NULL;
+ }
+ // copy the data into the image element
+ lImageDataCopy->Des().Copy(aData);
+
+ if (aData.Length() == 0 || aSize == 0)
+ {
+ // No data available, cleanup allocated memory
+ delete lImageDataCopy;
+ delete lImageElement->iBitmap;
+ lImageElement->iBitmap = NULL;
+ }
+ else
+ {
+ // Begin image decoding (asynchronously).
+ TInt lImgDecErr = lImageElement->StartImageDecoding(
+ *lImageDataCopy,
+ ETrue ); // ETrue means Sync decoding
+ if ( lImgDecErr != KErrNone )
+ {
+ // No error processing
+ }
+ lImageElement->AssignImageData( lImageDataCopy );
+ }
+
+ }
+ else // if ( aMakeCopy )
+ {
+ // Do not make a copy of the imageData.
+ // Begin image decoding (asynchronously).
+ // An asynchronous approach was chosen as AddExternalData is called
+ // to asynchronously notify the engine of availability of image
+ // data.
+ // The underlying ImageDecoder is an asynchronous API and an
+ // ActiveSchedulerWait object is used to make it synchronous. In
+ // this case the client Active objects get a chance to execute.
+ // While decoding is in progress, if the client exits it used to
+ // delete the engine and the document but async service provider is
+ // not yet complete. When the async service provider completes
+ // it would cause the access violation error as it would
+ // try to use image element object which has been deleted.
+ TInt lImgDecErr = lImageElement->StartImageDecoding( aData,
+ EFalse ); // EFalse means async decoding
+
+ if ( lImgDecErr != KErrNone )
+ {
+ // No error processing
+ }
+ } // if ( aMakeCopy )
+ } // for (TInt j=0; j < lImageEleCnt; j++)
+
+ lMatchingImageElements.Close();
+
+ return firstElement;
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::AssignImageData( const TDesC& aUri,
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::AssignImageData( const TDesC& aUri,
+ HBufC8* aData )
+ {
+ CSvgImageElementImpl* element =
+ (CSvgImageElementImpl*)AddExternalData( NULL, aUri, *aData, EFalse );
+ if ( element == NULL )
+ {
+ // delete image data now -- due to failure
+ delete aData;
+ }
+ else
+ {
+ // <image> element will delete it after decoding
+ element->AssignImageData( aData );
+ }
+ }
+
+/********************** Wrapper functions for new avoid new exports *******************/
+// --------------------------------------------------------------------------
+// EXPORT_C CSvgEngineImpl* CSvgEngineInterfaceImpl::SvgEngineNewL()
+// ---------------------------------------------------------------------------
+EXPORT_C CSvgEngineImpl* CSvgEngineInterfaceImpl::SvgEngineNewL()
+{
+ //this is the JSR side creating the engine
+ iSvgEngine = CSvgEngineImpl::NewL(iSvgBitmapFontProvider);
+ iSvgEnginePointers.Append(iSvgEngine);
+ return iSvgEngine;
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::StartEngine( CSvgEngineImpl* aEngine )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::StartEngine( CSvgEngineImpl* aEngine )
+{
+ if( ChooseEngine ( (TInt)aEngine ) )
+ {
+ iSvgEngine->StartEngine();
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::RenderFrame( CSvgEngineImpl* aEngine, TUint aCurrentTime )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::RenderFrame( CSvgEngineImpl* aEngine, TUint aCurrentTime )
+{
+ if( ChooseEngine ( (TInt)aEngine ) )
+ {
+ iSvgEngine->RenderFrame( aCurrentTime );
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::ViewportInit( CSvgDocumentImpl* aDocumentHandle )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::ViewportInit( CSvgDocumentImpl* aDocumentHandle )
+{
+ if( !aDocumentHandle )
+ return;
+
+ aDocumentHandle->iInitialDrawFlag = ETrue;
+
+
+ TSize Size = TSize(100, 100); // default viewport size
+ aDocumentHandle->iReqExReqFtrSysLTested = EFalse;
+ if ( aDocumentHandle->RootElement() != NULL &&
+ ((CSvgElementImpl*)aDocumentHandle->RootElement())->ElemID() == KSvgSvgElement )
+
+ {
+ // Scale width & height to fit to screen size
+ CSvgSvgElementImpl* el = ( CSvgSvgElementImpl* )
+ (aDocumentHandle->RootElement());
+ TFloatFixPt width, height;
+ TFloatFixPt scrnW( Size.iWidth ), scrnH( Size.iHeight );
+ TFloatFixPt zero ( 0 );
+ if (((CSvgSvgElementImpl *)(aDocumentHandle->RootElement()))->iWidthInPercentage)
+ {
+ // since we are mapping the percentage to a viewport that is 100x100 the percentage value can be used directly
+ width = ( TFloatFixPt ) (((CSvgSvgElementImpl *)(aDocumentHandle->RootElement()))->iWidthInUserCoordinate);
+ }
+ else
+ {
+ width = (TFloatFixPt) (((CSvgSvgElementImpl *)(aDocumentHandle->RootElement()))->iWidthInUserCoordinate);
+ }
+
+ if (((CSvgSvgElementImpl *)(aDocumentHandle->RootElement()))->iHeightInPercentage)
+ {
+ height = ( TFloatFixPt ) (((CSvgSvgElementImpl *)(aDocumentHandle->RootElement()))->iHeightInUserCoordinate);
+ }
+ else
+ {
+ height = (TFloatFixPt) (((CSvgSvgElementImpl *)(aDocumentHandle->RootElement()))->iHeightInUserCoordinate);
+ }
+ if ( ( width <= zero ) && ( height <= zero ) )
+ {
+ width = 0;
+ height = 0;
+ return;
+ }
+
+ // Set initial viewport
+ TInt err;
+ TRAP(err, el->SetAttributeFloatL( KAtrX, zero ));
+ TRAP(err, el->SetAttributeFloatL( KAtrY, zero ));
+ TRAP(err, el->SetAttributeFloatL( KAtrWidth, width ));
+ TRAP(err, el->SetAttributeFloatL( KAtrHeight, height ));
+ }
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetGdiContextL( CSvgEngineImpl* aEngine, CFbsBitmap* aFrameBuffer )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetGdiContextL( CSvgEngineImpl* aEngine, CFbsBitmap* aFrameBuffer )
+{
+ if( aEngine )
+ {
+ aEngine->SetGdiContextL( aFrameBuffer );
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetDocument( CSvgEngineImpl* aEngine, CSvgDocumentImpl* aDocument )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetDocument( CSvgEngineImpl* aEngine, CSvgDocumentImpl* aDocument )
+{
+ iTotalRotation = 0;
+ if( aEngine && aDocument)
+ {
+ aEngine->SetDocument( aDocument );
+ aDocument->SetEngine( aEngine );
+
+ // costly calls per frame
+ SvgElementAssignDocument((CSvgElementImpl*)aDocument->RootElement(), aDocument);
+
+ ((CSvgElementImpl*)aDocument->RootElement())->InitAllSvgStyleProperties((CSvgElementImpl*)aDocument->RootElement());
+
+ }
+}
+
+// --------------------------------------------------------------------------
+// void CSvgEngineInterfaceImpl::SvgElementAssignDocument( CSvgElementImpl* aElement, CSvgDocumentImpl* aDoc )
+// ---------------------------------------------------------------------------
+void CSvgEngineInterfaceImpl::SvgElementAssignDocument( CSvgElementImpl* aElement, CSvgDocumentImpl* aDoc )
+{
+ if ( aElement == NULL )
+ return;
+
+ aElement->SetOwnerDocument( aDoc );
+
+ CSvgElementImpl* child = (CSvgElementImpl*)aElement->FirstChild();
+ if ( child )
+ {
+ SvgElementAssignDocument( child, aDoc );
+ }
+
+ CSvgElementImpl* sibling = (CSvgElementImpl*)aElement->NextSibling();
+ if ( sibling )
+ {
+ SvgElementAssignDocument( sibling, aDoc );
+ }
+}
+
+
+// --------------------------------------------------------------------------
+// EXPORT_C CSvgDocumentImpl* CSvgEngineInterfaceImpl::SvgDocumentNewL()
+// ---------------------------------------------------------------------------
+EXPORT_C CSvgDocumentImpl* CSvgEngineInterfaceImpl::SvgDocumentNewL()
+{
+ CSvgDocumentImpl* document = CSvgDocumentImpl::NewL(iSvgBitmapFontProvider);
+ iSvgDocumentPointers.Append(document);
+
+ return document;
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::FillDocumentL( CSvgDocumentImpl* aDocument, const TDesC16& aSvgString )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::FillDocumentL( CSvgDocumentImpl* aDocument, const TDesC16& aSvgString )
+{
+ if( aDocument )
+ {
+ aDocument->SetDRMMode( iDrmEnabled );
+ SetThumbNailMode( iIsThumbNailMode );
+ SetDRMRights( iDrmRightsConsumptionEnabled );
+ aDocument->Load16BitString(aSvgString, *iSvgError, EFalse );
+ if ( aDocument->HasError() )
+ {
+ iSvgError->SetErrorCode( aDocument->GetError()->ErrorCode() );
+ iSvgError->SetSystemErrorCode( aDocument->GetError()->SystemErrorCode() );
+ iSvgError->SetDescription( aDocument->GetError()->Description() );
+ User::Leave( iSvgError->SystemErrorCode() );
+ }
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::DestroyDocument( CSvgDocumentImpl* aDocument )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::DestroyDocument( CSvgDocumentImpl* aDocument )
+{
+ if (aDocument )
+ {
+ TInt index = iSvgDocumentPointers.Find( aDocument );
+ if ( index != KErrNotFound )
+ {
+ //make sure document isnt attached to an engine
+ TInt svgEnginePointersCnt = iSvgEnginePointers.Count();
+ for (TInt i=0; i < svgEnginePointersCnt; i++)
+ {
+ CSvgEngineImpl* engine = iSvgEnginePointers[i];
+ CSvgDocumentImpl* docAttachedToEngine = engine->Document();
+
+ if (docAttachedToEngine == aDocument)
+ {
+ //remove document attachment to engine
+ engine->SetDocument(NULL);
+ }
+ }
+
+ delete aDocument;
+ iSvgDocumentPointers.Remove( index );
+ }
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::DestroyEngine( CSvgEngineImpl* aEngine )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::DestroyEngine( CSvgEngineImpl* aEngine )
+{
+ if (aEngine)
+ {
+ TInt index = iSvgEnginePointers.Find( aEngine );
+ if ( index != KErrNotFound )
+ {
+ //make sure no document has this engine attached
+ TInt svgDocPointersCnt = iSvgDocumentPointers.Count();
+ for (TInt i=0; i < svgDocPointersCnt; i++)
+ {
+ CSvgDocumentImpl* document = iSvgDocumentPointers[i];
+ CSvgEngineImpl* engineAttachedToDocument = document->Engine();
+
+ if (engineAttachedToDocument == aEngine)
+ {
+ //remove engine from document it is attached to
+ document->SetEngine(NULL);
+ }
+ }
+
+ //make sure there is no handle to this left around
+ if (iSvgEngine == aEngine)
+ {
+ iSvgEngine = NULL;
+ }
+
+ delete aEngine;
+ iSvgEnginePointers.Remove( index );
+ }
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C CXmlElementImpl* CSvgEngineInterfaceImpl::GetRootElement( CSvgDocumentImpl* aDocument )
+// ---------------------------------------------------------------------------
+EXPORT_C CXmlElementImpl* CSvgEngineInterfaceImpl::GetRootElement( CSvgDocumentImpl* aDocument )
+{
+ if( aDocument )
+ {
+ return (CXmlElementImpl*)aDocument->RootElement();
+ }
+ else
+ return NULL;
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::InitRootElement( CSvgDocumentImpl* aDocument )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::InitRootElement( CSvgDocumentImpl* aDocument )
+{
+ if( aDocument )
+ {
+ TRAPD(error,aDocument->AppendChildL(CreateElementL(aDocument,KSvgSvgElement)));
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KAppendChildFailed,
+ "CSvgEngineInterfaceImpl::InitRootElement: AppendChildL error.");
+ RDebug::Print(KAppendChildFailed);
+ #endif //_DEBUG
+ }
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C CXmlElementImpl* CSvgEngineInterfaceImpl::GetElementById( CSvgDocumentImpl* aDocument, const TDesC& aId )
+// ---------------------------------------------------------------------------
+EXPORT_C CXmlElementImpl* CSvgEngineInterfaceImpl::GetElementById( CSvgDocumentImpl* aDocument, const TDesC& aId )
+{
+ if( aDocument )
+ {
+ return (CXmlElementImpl*)aDocument->GetElementById( aId );
+ }
+ else
+ return NULL;
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C TInt CSvgEngineInterfaceImpl::GetNumberOfIds( CSvgDocumentImpl* aDocument )
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CSvgEngineInterfaceImpl::GetNumberOfIds( CSvgDocumentImpl* aDocument )
+{
+ if ( aDocument )
+ return (aDocument->GetNumberOfIds( aDocument->RootElement()));
+ else
+ return 0;
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C TDesC* CSvgEngineInterfaceImpl::GetId(CSvgDocumentImpl* aDocument, TInt index)
+// ---------------------------------------------------------------------------
+EXPORT_C TDesC* CSvgEngineInterfaceImpl::GetId(CSvgDocumentImpl* aDocument, TInt index)
+{
+ if ( aDocument )
+ return (aDocument->GetId(index));
+ else
+ return NULL;
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C CXmlElementImpl* CSvgEngineInterfaceImpl::GetParentElement( CXmlElementImpl* aElement )
+// ---------------------------------------------------------------------------
+EXPORT_C CXmlElementImpl* CSvgEngineInterfaceImpl::GetParentElement( CXmlElementImpl* aElement )
+{
+ if( aElement )
+ return (CXmlElementImpl*)aElement->ParentNode();
+ else
+ return NULL;
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetParentElement( CXmlElementImpl* aElement, CXmlElementImpl* aParentElement )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetParentElement( CXmlElementImpl* aElement, CXmlElementImpl* aParentElement )
+{
+ if( aElement )
+ aElement->SetParentNode( aParentElement );
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetFirstChildElement( CXmlElementImpl* aElement, CXmlElementImpl* aParentElement )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetFirstChildElement( CXmlElementImpl* aFirstChildElement, CXmlElementImpl* aParentElement )
+{
+ if( aFirstChildElement && aParentElement )
+ aParentElement->SetFirstChild( aFirstChildElement );
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C CXmlElementImpl* CSvgEngineInterfaceImpl::CreateElementL( CSvgDocumentImpl* aDocument, TInt aElementType )
+// ---------------------------------------------------------------------------
+EXPORT_C CXmlElementImpl* CSvgEngineInterfaceImpl::CreateElementL( CSvgDocumentImpl* aDocument, TInt aElementType )
+{
+ if( aDocument )
+ return (CXmlElementImpl*)aDocument->CreateElementL( (TUint8)aElementType );
+ else
+ return NULL;
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::DestroyElement( CXmlElementImpl* aElement )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::DestroyElement( CXmlElementImpl* aElement )
+{
+ delete aElement;
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::AppendChild( CXmlElementImpl* aParentElement, CXmlElementImpl* aChildElement, TBool aIsJSR226Element)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::AppendChild( CXmlElementImpl* aParentElement, CXmlElementImpl* aChildElement, TBool aIsJSR226Element)
+{
+ // Note: AppendChildL does not have any leaveble calls
+ if( aParentElement && aChildElement )
+ {
+
+ MXmlElement* childExisted = NULL;
+ // Avoid appending child to parent twice
+ if ( aChildElement->ParentNode() == aParentElement )
+ {
+ //mark the first copy of the element that is already
+ //appended as a child that to be removed
+ MXmlElement* child = aParentElement->FirstChild();
+ if ( child == aChildElement )
+ {
+ childExisted = child;
+ }
+ while ( child && !childExisted )
+ {
+ child = child->NextSibling();
+ if ( child == aChildElement )
+ {
+ //mark the first copy of the element that is already
+ //appended as a child that to be removed
+ childExisted = child;
+ break;
+ }
+ }
+ }
+
+ if ( childExisted )
+ {
+ aParentElement->RemoveChild( childExisted );
+ }
+
+ TRAPD( error, aParentElement->AppendChildL( aChildElement, aIsJSR226Element ) );
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KAppendChildFailed,
+ "CSvgEngineInterfaceImpl::AppendChild: AppendChildL error.");
+ RDebug::Print(KAppendChildFailed);
+ #endif //_DEBUG
+ }
+
+ if ( aChildElement->ElemID() == KSvgUseElement)
+ {
+ //we need to set the forward references up now
+ ((CSvgUseElementImpl*)aChildElement)->SetRefElemById( ((CSvgUseElementImpl*)aChildElement)->Href() );
+
+ TRAP_IGNORE( ((CSvgUseElementImpl *)aChildElement)->SetReferenceElementL() );
+ }
+
+
+ // If aChildElement is a Stop element then add it to Gradient's stop element array.
+ TInt lParentId = ((CXmlElementImpl*)aParentElement)->ElemID();
+ TInt lChildId = ((CXmlElementImpl*)aChildElement)->ElemID();
+
+ if( ( ( ( lParentId == KSvgRadialGradientElement )||
+ ( lParentId == KSvgLinearGradientElement ) ) &&
+ ( lChildId == KSvgStopElement ) ) )
+
+ {
+ // Initialize the offset value to 0 if its still -1.
+ TFloatFixPt lOffsetValue;
+ TFloatFixPt lDefaultOffsetValue(-1);
+ TBuf<6> lAttributeName;
+ TBuf<1> lValueBuffer;
+
+ lAttributeName.Append(OFFSET);
+ lValueBuffer.Append(ZEROVALUE);
+
+ ((CSvgStopElementImpl*)aChildElement)->GetOffset( lOffsetValue );
+
+ // Offset Value of -1 indicates that Offset Attribute is not declared in
+ // stop element.
+ if( lOffsetValue == lDefaultOffsetValue )
+ {
+ // Deliberately calling SetAttributeL in place of SetAttributeFloatL as the latter inturn
+ // calls UpdateOffsetValues which should be called on any Stop element once it is added to
+ // to the Stop element array Owned by parent Gradient element.
+ TRAP_IGNORE(((CSvgStopElementImpl*)aChildElement)->SetAttributeL( lAttributeName, lValueBuffer ));
+ }
+
+ // The function not only adds the element in Stop element array but also
+ // Adjusts the offset values of all the previously added elements such that
+ // each gradient offset value is greater than the previous gradient stop's
+ // offset value.It calls UpdateOffsetValues to adjust the values.
+ ((CSvgGradientElementImpl*)aParentElement)->AddStopElementInArray((CSvgStopElementImpl*)aChildElement);
+
+ }
+
+ //CTM needs to be updated after appending child so it gets propogated to new children
+ ((CSvgElementImpl*)aParentElement)->UpdateCTM();
+
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::RemoveChild( CXmlElementImpl* aParentElement, CXmlElementImpl* aChildElement)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::RemoveChild( CXmlElementImpl* aParentElement, CXmlElementImpl* aChildElement)
+{
+ if( aParentElement && aChildElement )
+ {
+ aParentElement->RemoveChild( aChildElement );
+
+ if( ((CXmlElementImpl*)aChildElement)->ElemID() == KSvgTextElement )
+ {
+ ((CSvgTextElementImpl*)aChildElement)->FreeFontData();
+ }
+
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C CXmlElementImpl* CSvgEngineInterfaceImpl::GetFirstChild( CXmlElementImpl* aParentElement )
+// ---------------------------------------------------------------------------
+EXPORT_C CXmlElementImpl* CSvgEngineInterfaceImpl::GetFirstChild( CXmlElementImpl* aParentElement )
+{
+ if( aParentElement )
+ return (CXmlElementImpl*)aParentElement->FirstChild();
+ else
+ return NULL;
+}
+// --------------------------------------------------------------------------
+// EXPORT_C CXmlElementImpl* CSvgEngineInterfaceImpl::GetNextSibling( CXmlElementImpl* aElement )
+// ---------------------------------------------------------------------------
+EXPORT_C CXmlElementImpl* CSvgEngineInterfaceImpl::GetNextSibling( CXmlElementImpl* aElement )
+{
+ if( aElement )
+ return (CXmlElementImpl*)aElement->NextSibling();
+ else
+ return NULL;
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetNextSibling( CXmlElementImpl* aElement, CXmlElementImpl* aSibling )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetNextSibling( CXmlElementImpl* aElement, CXmlElementImpl* aSibling )
+{
+ if( aElement && aSibling )
+ aElement->SetNextSibling( aSibling );
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C CSvgDocumentImpl* CSvgEngineInterfaceImpl::GetOwnerDocument( CXmlElementImpl* aElement )
+// ---------------------------------------------------------------------------
+EXPORT_C CSvgDocumentImpl* CSvgEngineInterfaceImpl::GetOwnerDocument( CXmlElementImpl* aElement )
+{
+ if( aElement)
+ return (CSvgDocumentImpl*)aElement->OwnerDocument();
+ else
+ return NULL;
+}
+// --------------------------------------------------------------------------
+// EXPORT_C TInt CSvgEngineInterfaceImpl::GetElementType( CXmlElementImpl* aElement )
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CSvgEngineInterfaceImpl::GetElementType( CXmlElementImpl* aElement )
+{
+ if( aElement )
+ return aElement->ElemID();
+ else
+ return -1;
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetRequestObserver( CSvgEngineImpl* aEngine, MSvgRequestObserver* aObserver )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetRequestObserver( CSvgEngineImpl* aEngine, MSvgRequestObserver* aObserver )
+{
+ if( aEngine )
+ aEngine->iRequestObserver = aObserver;
+}
+// --------------------------------------------------------------------------
+// EXPORT_C TInt CSvgEngineInterfaceImpl::GetElementDesAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId,TDes& aValue)
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CSvgEngineInterfaceImpl::GetElementDesAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId, TPtrC16& aValue)
+{
+ return aElementHandle->GetAttributeDes(aAttributeId, aValue);
+}
+// --------------------------------------------------------------------------
+// EXPORT_C TReal32 CSvgEngineInterfaceImpl::GetElementFloatAttribute( CSvgElementImpl* aElementHandle, const TInt aAttributeId)
+// ---------------------------------------------------------------------------
+EXPORT_C TReal32 CSvgEngineInterfaceImpl::GetElementFloatAttribute( CSvgElementImpl* aElementHandle, const TInt aAttributeId) __SOFTFP
+{
+
+ TFloatFixPt lValue ;
+
+ //hack for JSR 226 so it can return the original base value when the attribute is animated
+ //instead of returning the animated value in the element class
+ if ( aElementHandle->HasAnimation() )
+ {
+ TInt lResult = ((CSvgAnimationBase*)aElementHandle->iHasAnimationBase)->GetAttributeFloat( aAttributeId, lValue);
+
+ if(lResult != KErrNoAttribute)
+ {
+ return lValue;
+ }
+ }
+
+ TInt lResult = aElementHandle->GetAttributeFloat( aAttributeId, lValue);
+ if(lResult == KErrNoAttribute)
+ {
+ return KInvalidFloatAttribute;
+ }
+ return lValue;
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetElementFloatAttribute( CSvgElementImpl* aElementHandle, const TInt aAttributeId, TReal32 aValue)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetElementFloatAttribute( CSvgElementImpl* aElementHandle, const TInt aAttributeId, TReal32 aValue) __SOFTFP
+{
+ TFloatFixPt lValue = TFloatFixPt(aValue);
+ TRAPD(error,aElementHandle->SetAttributeFloatL(aAttributeId,lValue));
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KSetAttributeFloatFailed,
+ "CSvgEngineInterfaceImpl::SetElementFloatAttribute: SetElementFloatAttribute error.");
+ RDebug::Print(KSetAttributeFloatFailed);
+ #endif //_DEBUG
+ }
+
+ //hack for JSR 226 so it can return the original base value when the attribute is animated
+ //instead of returning the animated value in the element class
+ if ( aElementHandle->HasAnimation() )
+ {
+ TRAP_IGNORE( ((CSvgAnimationBase*)aElementHandle->iHasAnimationBase)->SetAttributeFloatL( aAttributeId, lValue) );
+ }
+
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetElementDesAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId, TDesC& lAttributeValue)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetElementDesAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId, const TDesC& lAttributeValue)
+{
+
+ const TDesC* ReferenceElementID = NULL;
+
+ // Incase if the xlink-href attribute is set for USE element from JSR226 we need to
+ // create a clone tree under the USE element explicitly same as done in Content handler.
+ if( aElementHandle->ElemID() == KSvgUseElement && aAttributeId == KAtrXlinkhref )
+ {
+ // Check if the USE element is already refereing to some element. If 'YES' we need to
+ // remove the previously refered element.
+ CSvgElementImpl* lReferenceElement = ((CSvgUseElementImpl*)aElementHandle)->GetReferenceElementL();
+
+ if( lReferenceElement != NULL)
+ {
+ // Get the ID of this element.
+ ReferenceElementID = lReferenceElement->Id();
+
+ // Get the first child of USE element and compare its ID with previously
+ // refered element's ID. If they are same remove the referenced element branch
+ // from the USE element. Else, continue finding some element under 'USE' element
+ // that has same ID as the previously refered element has.
+ CSvgElementImpl* ChildOfUseElement = (CSvgElementImpl*)aElementHandle->FirstChild();
+
+ while( ChildOfUseElement && ReferenceElementID )
+ {
+ const TDesC16* UseElementChildID = ChildOfUseElement->Id();
+
+ // Compare the Child ID with reference element's ID
+ if( UseElementChildID && ( ReferenceElementID->Compare(*UseElementChildID) == 0 ))
+ {
+ // delete the same child and get out of the loop.
+ aElementHandle->RemoveChild(ChildOfUseElement);
+ break;
+ }
+
+ ChildOfUseElement = (CSvgUseElementImpl*)ChildOfUseElement->NextSibling();
+ }
+ }
+ }
+
+ TRAPD(error,aElementHandle->SetAttributeDesL(aAttributeId,lAttributeValue));
+
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KSetAttributeDesFailed,
+ "CSvgEngineInterfaceImpl::SetElementDesAttribute: SetAttributeDesL error.");
+ RDebug::Print(KSetAttributeDesFailed);
+ #endif //_DEBUG
+ }
+
+ if( ( aElementHandle->ElemID() == KSvgUseElement ) && aAttributeId == KAtrXlinkhref )
+ {
+ // Create a new branch under the USE element
+ TRAP(error,((CSvgUseElementImpl *)aElementHandle)->SetReferenceElementL());
+
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KSetReferenceElementLFailed,
+ "CSvgUseElementImpl::SetReferenceElementL: SetReferenceElementL error.");
+ RDebug::Print(KSetReferenceElementLFailed);
+ #endif //_DEBUG
+ }
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl:: GetElementBoundingbox(CSvgElementImpl* aElementHandle,TReal32& aX ,TReal32& aY,TReal32& aWidth,TReal32& aHeight)
+// this is used for ScreenBbox (actual bbox of an element on the screen)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl:: GetElementBoundingbox(CSvgElementImpl* aElementHandle,TReal32& aX ,TReal32& aY,TReal32& aWidth,TReal32& aHeight) __SOFTFP
+{
+ if (aElementHandle)
+ {
+ //updates CTM from root
+ aElementHandle->UpdateCTM();
+
+ TGfxRectangle2D bbox;
+ aElementHandle->GetBBox(bbox);
+ aX = (TReal32)bbox.iX;
+ aY = (TReal32)bbox.iY;
+ aWidth = (TReal32)bbox.iWidth;
+ aHeight = (TReal32)bbox.iHeight;
+ }
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl:: GetElementUnScaledBoundingBox(CSvgElementImpl* aElementHandle,TReal32& aX ,TReal32& aY,TReal32& aWidth,TReal32& aHeight)
+// this is used for UserBBox (unscaled bbox)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::GetElementUnScaledBoundingBox( CSvgElementImpl* aElementHandle,TReal32& aX ,TReal32& aY,TReal32& aWidth,TReal32& aHeight) __SOFTFP
+{
+ if (aElementHandle)
+ {
+ //updates CTM from root
+ aElementHandle->UpdateCTM();
+
+ TGfxRectangle2D bbox;
+ aElementHandle->GetUnscaledBBox(bbox);
+ aX = (TReal32)bbox.iX;
+ aY = (TReal32)bbox.iY;
+ aWidth = (TReal32)bbox.iWidth;
+ aHeight = (TReal32)bbox.iHeight;
+ }
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::GetFourPointElementBoundingBox(CSvgTextElementImpl* aTextElementHandle, TPoint& aPoint1, TPoint& aPoint2, TPoint& aPoint3, TPoint& aPoint4)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::GetFourPointElementBoundingBox(CSvgTextElementImpl* aTextElementHandle, TPoint& aPoint1, TPoint& aPoint2, TPoint& aPoint3, TPoint& aPoint4)
+{
+ TSvgFourPointRect fourPointRect;
+
+ //updates CTM from root
+ aTextElementHandle->UpdateCTM();
+
+ if (aTextElementHandle)
+ {
+ aTextElementHandle->GetFourPointBBox(fourPointRect);
+ }
+
+ fourPointRect.GetPoints(aPoint1, aPoint2, aPoint3, aPoint4);
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl:: SetElementColorAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId,TInt32 lColorValue)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl:: SetElementColorAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId,TInt32 lColorValue)
+{
+ TRAPD(error, aElementHandle->SetAttributeIntL(aAttributeId,lColorValue));
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KSetAttributeIntFailed,
+ "CSvgEngineInterfaceImpl::SetElementColorAttribute: SetAttributeIntL( error.");
+ RDebug::Print(KSetAttributeIntFailed);
+ #endif //_DEBUG
+ }
+
+}
+// --------------------------------------------------------------------------
+// EXPORT_C TInt32 CSvgEngineInterfaceImpl::GetElementColorAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId)
+// ---------------------------------------------------------------------------
+EXPORT_C TInt32 CSvgEngineInterfaceImpl::GetElementColorAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId)
+{
+ TInt lResult = KErrNone;
+ TInt32 lValue = KErrNone;
+ TRAPD(error,lResult = aElementHandle->GetAttributeIntL( aAttributeId, lValue));
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KGetAttributeIntFailed,
+ "CSvgEngineInterfaceImpl::GetElementColorAttribute: GetElementColorAttribute( error.");
+ RDebug::Print(KGetAttributeIntFailed);
+ #endif //_DEBUG
+ }
+
+ if (lResult == KErrInvalidAttribute && error == KErrNone)
+ {
+ //attribute requested was invalid return an error
+ return KInvalidEnumAttribute;
+ }
+ else if ( lResult == KErrNone && error == KErrNone)
+ {
+ //got the attribute ok.
+ return lValue;
+ }
+ else if(lResult == KErrNoAttribute && error == KErrNone)
+ {
+ //everything went ok that element just didnt have the attribute requested
+ return KErrNoAttribute;
+ }
+ else
+ {
+ return KInvalidEnumAttribute;
+ }
+
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetPreserveApsectRatio( TPreserveAspectRatio aType )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetPreserveAspectRatio( CSvgDocumentImpl* aDocument, TSvgPreserveAspectAlignType aPreserveAspectRatioSetting, TSvgMeetOrSliceType aMeetSliceType, TBool aFrameBuffOverridesViewport)
+{
+ if ( !aDocument )
+ {
+ aDocument = iSvgLoadedDocument;
+
+ if ( !aDocument )
+ {
+ if (iSvgEngine)
+ {
+ aDocument = iSvgEngine->Document();
+ }
+ }
+
+ if ( !aDocument )
+ return;
+ }
+
+ if (iSvgEngine)
+ {
+ iSvgEngine->iFrameBufferOverridesViewport = aFrameBuffOverridesViewport;
+ }
+
+ CSvgSvgElementImpl* el = ( CSvgSvgElementImpl* )(aDocument->RootElement());
+
+ if (el == NULL)
+ {
+ return;
+ }
+
+ TRAPD(error, el->SetPreserveAspectRatioL( aPreserveAspectRatioSetting, aMeetSliceType));
+
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KSetPreserveAspectRatioFailed,
+ "CSvgEngineInterfaceImpl::SetPreserveAspectRatio: error.");
+ RDebug::Print(KSetPreserveAspectRatioFailed);
+ #endif //_DEBUG
+ }
+
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetEnumAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId,TInt32 lValue)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetEnumAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId,TInt32 lValue)
+ {
+
+ if(aAttributeId == KAtrPreserveAspectRatio)
+ {
+ // convert in to desc and Call set attribute
+ _LIT( KNone, "none" );
+ _LIT( KXMidYMid, "xMidYMid" );
+ _LIT( KPreserveAspectRatio, "preserveAspectRatio" );
+ if(!lValue)
+ {
+ TRAPD(error,aElementHandle->SetAttributeL(KPreserveAspectRatio,KNone));
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KSetAttributeFailed,
+ "CSvgEngineInterfaceImpl::SetEnumAttribute: SetAttributeL error.");
+ RDebug::Print(KSetAttributeFailed);
+ #endif //_DEBUG
+ }
+ }
+ if(lValue == 1)
+ {
+ TRAPD(error,aElementHandle->SetAttributeL(KPreserveAspectRatio,KXMidYMid));
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KSetAttributeFailed,
+ "CSvgEngineInterfaceImpl::SetEnumAttribute: SetAttributeL error.");
+ RDebug::Print(KSetAttributeFailed);
+ #endif //_DEBUG
+ }
+ }
+ return ;
+ }
+ if( aAttributeId == KAtrZoomAndPan)
+ {
+ if( aElementHandle->ElemID() == KSvgSvgElement )
+ {
+ ((CSvgSvgElementImpl*)aElementHandle)->SetZoomAndPan((TSvgZoomAndPanType)lValue);
+ }
+ return;
+ }
+ // for fill and stroke if the value is specified as enum need to
+ // convert it in to "string"
+ // also check that it is not a animation elements.
+ // get enum for these values is not possible.
+ if((aAttributeId == KCSS_ATTR_FILL || aAttributeId == KCSS_ATTR_STROKE)
+ && ! ( aElementHandle->IsAnimatedElement() ))
+ {
+ if(lValue == 2)
+ {
+ _LIT( KNone, "none" );
+ TRAPD(error,aElementHandle->SetPropertyL(aAttributeId,KNone));
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KSetPropertyFailed,
+ "CSvgEngineInterfaceImpl::SetEnumAttribute: SetPropertyL error.");
+ RDebug::Print(KSetPropertyFailed);
+ #endif //_DEBUG
+ }
+ return;
+ }
+ if(lValue == 3)
+ {
+ _LIT( KCurrentColor, "currentColor" );
+ TRAPD(error,aElementHandle->SetPropertyL(aAttributeId,KCurrentColor));
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KSetPropertyFailed,
+ "CSvgEngineInterfaceImpl::SetEnumAttribute: SetPropertyL error.");
+ RDebug::Print(KSetPropertyFailed);
+ #endif //_DEBUG
+ }
+ return;
+ }
+ if(lValue == 4)
+ {
+ if (!(aElementHandle->StyleInParent(aElementHandle, aAttributeId)))
+ {
+ aElementHandle->RemoveAttribute(aAttributeId);
+ }
+ return;
+ }
+ }
+
+ TRAPD(error, aElementHandle->SetAttributeIntL(aAttributeId,lValue));
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KSetAttributeIntFailed,
+ "CSvgEngineInterfaceImpl::SetEnumAttribute: SetAttributeIntL error.");
+ RDebug::Print(KSetAttributeIntFailed);
+ #endif //_DEBUG
+ }
+ }
+
+
+// --------------------------------------------------------------------------
+// EXPORT_C TInt CSvgEngineInterfaceImpl::GetEnumAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId,TInt32& aValue)
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CSvgEngineInterfaceImpl::GetEnumAttribute(CSvgElementImpl* aElementHandle,const TInt aAttributeId,TInt32& aValue)
+{
+
+ if(aAttributeId == KAtrPreserveAspectRatio)
+ {
+ // convert in to desc and Call set attribute
+
+ if(aElementHandle->ElemID() == KSvgSvgElement)
+ {
+ MSvgPreserveAspectRatio *lTestObject;
+ ((CSvgSvgElementImpl*)aElementHandle)->GetPreserveAspectRatio(lTestObject);
+ if(lTestObject != NULL)
+ {
+ aValue = (TInt32)lTestObject->GetAlign();
+ return KErrNone;
+ }
+ return KInvalidEnumAttribute;
+ }
+ if(aElementHandle->ElemID() == KSvgImageElement)
+ {
+ _LIT( KNone, "none" );
+ _LIT( KXMidYMid, "xMidYMid" );
+ TPtrC16 lParValue;
+ aElementHandle->GetAttributeDes( KAtrPreserveAspectRatio, lParValue );
+ if(lParValue == KNone)
+ {
+ aValue = 0;
+ return KErrNone;
+ }
+ if(lParValue == KXMidYMid)
+ {
+ aValue = 1;
+ return KErrNone;
+ }
+ return KInvalidEnumAttribute;
+ }
+
+ }
+ if( aAttributeId == KAtrZoomAndPan)
+ {
+ if( aElementHandle->ElemID() == KSvgSvgElement )
+ {
+ aValue = (TInt32)((CSvgSvgElementImpl*)aElementHandle)->GetZoomAndPan();
+ return KErrNone;
+ }
+ return KInvalidEnumAttribute;
+ }
+ TInt lResult = KErrNone;
+ TRAPD(error, lResult = aElementHandle->GetAttributeIntL(aAttributeId,aValue));
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KGetAttributeIntFailed,
+ "CSvgEngineInterfaceImpl::GetEnumAttribute: GetAttributeIntL error.");
+ RDebug::Print(KGetAttributeIntFailed);
+ #endif //_DEBUG
+ }
+ if(lResult == KErrNoAttribute)
+ {
+ return KInvalidEnumAttribute;
+ }
+ return KErrNone;
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetRectAttribute( CXmlElementImpl* aElementHandle,
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetRectAttribute( CXmlElementImpl* aElementHandle,
+ float aX, float aY, float aWidth, float aHeight )
+{
+ if ( aElementHandle->ElemID() == KSvgRectElement )
+ {
+ CSvgRectElementImpl* rect = (CSvgRectElementImpl*)aElementHandle;
+ rect->SetRectValues(TFloatFixPt(aX), TFloatFixPt(aY), TFloatFixPt(aWidth), TFloatFixPt(aHeight));
+ }
+ // added as a part of update of get and set API's.
+ if ( aElementHandle->ElemID() == KSvgSvgElement)
+ {
+ // for svg element it must be viewBox.
+ TGfxRectangle2D viewBox(aX, aY,aWidth,aHeight);
+ CSvgSvgElementImpl *lSvgSvgElement = (CSvgSvgElementImpl*)(aElementHandle);
+ TRAPD(error,lSvgSvgElement->SetViewBoxL( viewBox));
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KSetRectAttributeFailed,
+ "CSvgEngineInterfaceImpl::SetRectAttribute: SetViewBoxL error.");
+ RDebug::Print(KSetRectAttributeFailed);
+ #endif //_DEBUG
+ }
+
+ //CTM must be updated since viewbox changed
+ lSvgSvgElement->UpdateCTM();
+
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C TBool CSvgEngineInterfaceImpl::GetRectAttribute( CXmlElementImpl* aElementHandle,
+// ---------------------------------------------------------------------------
+EXPORT_C TBool CSvgEngineInterfaceImpl::GetRectAttribute( CXmlElementImpl* aElementHandle,
+ float* aX, float* aY, float* aWidth, float* aHeight )
+{
+ // added as a part of update of get and set API's.
+ TBool viewBoxExisted = EFalse;
+
+ if ( aElementHandle->ElemID() == KSvgSvgElement)
+ {
+ // for svg element it must be viewBox.
+ TGfxRectangle2D viewBox;
+ CSvgSvgElementImpl *lSvgSvgElemet = (CSvgSvgElementImpl*)(aElementHandle);
+
+ viewBoxExisted = lSvgSvgElemet->GetViewBox(viewBox);
+ *aX = viewBox.iX;
+ *aY = viewBox.iY;
+ *aWidth = viewBox.iWidth;
+ *aHeight = viewBox.iHeight;
+ }
+ else if ( aElementHandle->ElemID() == KSvgRectElement )
+ {
+ CSvgRectElementImpl* rect = (CSvgRectElementImpl*)aElementHandle;
+ *aX = rect->X();
+ *aY = rect->Y();
+ *aWidth = rect->Width();
+ *aHeight = rect->Height();
+ }
+ else
+ {
+ aX = NULL;
+ }
+
+ return viewBoxExisted;
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::GetMatrixAttribute( CXmlElementImpl* aElementHandle, float* aAVal,
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::GetMatrixAttribute( CXmlElementImpl* aElementHandle, float* aAVal,
+ float* aBVal, float* aCVal, float* aDVal,
+ float* aEVal, float* aFVal )
+{
+ //this should have been taken care of in the set only -
+ //what about updating from the root all the way down here.
+ //((CSvgElementImpl*)aElementHandle)->UpdateCTM();
+
+ const TGfxAffineTransform& matrix = ((CSvgElementImpl*)aElementHandle)->GetCTM();
+
+ *aAVal = matrix.iM00;
+ *aBVal = matrix.iM10;
+ *aCVal = matrix.iM01;
+ *aDVal = matrix.iM11;
+ *aEVal = matrix.iM02;
+ *aFVal = matrix.iM12;
+}
+
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::GetMatrixAttribute( CXmlElementImpl* aElementHandle, float* aAVal,
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::GetMatrixAttribute( CXmlElementImpl* aElementHandle, TInt aAttributeType,
+ float* aAVal, float* aBVal,
+ float* aCVal, float* aDVal,
+ float* aEVal, float* aFVal )
+{
+ if( aAttributeType == KAtrTransform)
+ {
+ MSvgTransformList* trList;
+ ((CSvgElementImpl*)aElementHandle)->GetTransform( trList );
+ TGfxAffineTransform matrix =
+ trList->Consolidate( ((CSvgElementImpl*)aElementHandle)->IsOverwriteTransforms() );
+
+ *aAVal = matrix.iM00;
+ *aBVal = matrix.iM10;
+ *aCVal = matrix.iM01;
+ *aDVal = matrix.iM11;
+ *aEVal = matrix.iM02;
+ *aFVal = matrix.iM12;
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetMatrixAttribute( CXmlElementImpl* aElementHandle, float aAVal,
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetMatrixAttribute( CXmlElementImpl* aElementHandle, float aAVal,
+ float aBVal, float aCVal, float aDVal,
+ float aEVal, float aFVal )
+{
+ if ((CSvgElementImpl*)aElementHandle)
+ {
+ TGfxAffineTransform matrix;
+ matrix.SetTransform( TReal32(aAVal), TReal32(aBVal), TReal32(aCVal),
+ TReal32(aDVal), TReal32(aEVal), TReal32(aFVal) );
+ MSvgTransformList* trList;
+ ((CSvgElementImpl*)aElementHandle)->GetTransform( trList );
+ trList->ReplaceItem( matrix, 0 );
+
+ // we need to update the CTM on this element and below it....
+
+ ((CSvgElementImpl*)aElementHandle)->UpdateCTM();
+ }
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::ClearFrameBuffer(CFbsBitmap* aFrameBuffer, TUint32 aClearingColor)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::ClearFrameBuffer(CFbsBitmap* /* aFrameBuffer */,
+ TUint32 /* aClearingColor */,
+ TInt /* aEngine */ )
+{
+}
+
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl:: SetFrameBuffer(CFbsBitmap* aRenderBuffer)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl:: SetFrameBuffer(CFbsBitmap* aRenderBuffer, TInt aEngine)
+ {
+ if( ChooseEngine ( aEngine ) )
+ {
+ iSvgEngine->SetSVGEngineState(ESVGEnginePaused);
+ TRAPD( error1,iSvgEngine->SetGdiContextL(aRenderBuffer));
+
+ if( error1 == KErrNone )
+ {
+
+ TRAPD( error2, iSvgEngine->InitializeEngineL()); // set the viewport and viewbox
+ if (error2 != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KSetFrameBufferFailed,
+ "CSvgEngineInterfaceImpl::SetFrameBuffer: InitializeEngineL error.");
+ RDebug::Print(KSetFrameBufferFailed);
+ #endif //_DEBUG
+ }
+
+ if( iSvgEngine->Document() )
+ {
+ if( iSvgEngine->Document()->IsAnimationFile() ) // If it is animation file
+ {
+ iSvgEngine->SetSVGEngineState(ESVGEngineRunning);
+ }
+ else
+ {
+ // If static file, just redraw it
+ TSvgTimerEvent tmev( 0 );
+ TRAPD( error2,iSvgEngine->ProcessEventL(
+ iSvgEngine->Document(), &tmev ));
+ if (error2 != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KRedrawFailed, "CSvgEngineInterfaceImpl::SetFrameBuffer: Redraw error.");
+ RDebug::Print(KRedrawFailed);
+ #endif //_DEBUG
+ }
+ }
+ }
+ }
+ }
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C TBool CSvgEngineInterfaceImpl::SearchForText( const TDesC& aSearchString,
+// ---------------------------------------------------------------------------
+EXPORT_C TBool CSvgEngineInterfaceImpl::SearchForText( const TDesC& aSearchString,
+ RPointerArray<MRect>& aBoundingBoxes,
+ RArray<TPtrC>& aTexts,
+ RArray<TInt>& aElementIds,
+ TBool aCaseSensitive,
+ TInt aEngine )
+{
+ if ( !ChooseEngine ( aEngine ) )
+ {
+ return EFalse;
+ }
+
+ TInt initialCount = aBoundingBoxes.Count();
+
+ iSvgEngine->FindBBoxesForRotatedText( aSearchString, aBoundingBoxes, aTexts, aElementIds, aCaseSensitive );
+
+ return aBoundingBoxes.Count() > initialCount;
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C TBool CSvgEngineInterfaceImpl::AddTextListener( MSvgTextListener* aListener)
+// ---------------------------------------------------------------------------
+EXPORT_C TBool CSvgEngineInterfaceImpl::AddTextListener( MSvgTextListener* aListener, TInt aEngine )
+{
+ if ( ChooseEngine ( aEngine ) )
+ {
+ iSvgEngine->AddTextListener( aListener );
+ }
+
+ return ETrue;
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C TBool CSvgEngineInterfaceImpl::RemoveTextListener( MSvgTextListener* aListener)
+// ---------------------------------------------------------------------------
+EXPORT_C TBool CSvgEngineInterfaceImpl::RemoveTextListener( MSvgTextListener* aListener, TInt aEngine )
+{
+ if ( ChooseEngine ( aEngine ) )
+ {
+ iSvgEngine->RemoveTextListener( aListener );
+ }
+
+ return ETrue;
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C TBool CSvgEngineInterfaceImpl::SetTextForTextElement( TInt aTextElementId, TDesC& aXmlString )
+// ---------------------------------------------------------------------------
+EXPORT_C TBool CSvgEngineInterfaceImpl::SetTextForTextElement( TInt aTextElementId, TDesC& aXmlString )
+{
+ TRAPD(err, ((CSvgTextElementImpl*)aTextElementId)->SetTextL(aXmlString));
+ if ( err != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgEngineInterfaceImpl::SetTextForTextElement failed");
+ #endif
+ return EFalse;
+ }
+
+ return ETrue;
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C TBool CSvgEngineInterfaceImpl::GetTextForTextElement( TInt aTextElementId, TBool& aEditable, TDes& aXmlString )
+// ---------------------------------------------------------------------------
+EXPORT_C TBool CSvgEngineInterfaceImpl::GetTextForTextElement( TInt aTextElementId, TBool& aEditable, TDes& aXmlString )
+{
+ if(aXmlString.MaxLength() < ((CSvgTextElementImpl*)aTextElementId)->GetText().Length() )
+ {
+ aXmlString = ((CSvgTextElementImpl*)aTextElementId)->GetText().Left( aXmlString.MaxLength() );
+ }
+ else
+ {
+ aXmlString = ((CSvgTextElementImpl*)aTextElementId)->GetText();
+ }
+
+ aEditable = ((CSvgTextElementImpl*)aTextElementId)->IsEditable();
+
+ return aEditable;
+}
+
+
+// --------------------------------------------------------------------------
+// EXPORT_C TBool CSvgEngineInterfaceImpl::AddTextAreaListener( MSvgTextAreaListener* aListener)
+// ---------------------------------------------------------------------------
+EXPORT_C TBool CSvgEngineInterfaceImpl::AddTextAreaListener( MSvgTextAreaListener* aListener, TInt aEngine )
+{
+ if ( ChooseEngine ( aEngine ) )
+ {
+ iSvgEngine->AddTextAreaListener( aListener );
+ }
+
+ return ETrue;
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C TBool CSvgEngineInterfaceImpl::RemoveTextAreaListener( MSvgTextAreaListener* aListener)
+// ---------------------------------------------------------------------------
+EXPORT_C TBool CSvgEngineInterfaceImpl::RemoveTextAreaListener( MSvgTextAreaListener* aListener, TInt aEngine )
+{
+ if ( ChooseEngine ( aEngine ) )
+ {
+ iSvgEngine->RemoveTextAreaListener( aListener );
+ }
+
+ return ETrue;
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C TBool CSvgEngineInterfaceImpl::SetTextForTextAreaElement( TInt aTextAreaElementId, TDesC& aXmlString )
+// ---------------------------------------------------------------------------
+EXPORT_C TBool CSvgEngineInterfaceImpl::SetTextForTextAreaElement( TInt aTextAreaElementId, TDesC& aXmlString )
+{
+ TRAPD(err, ((CSvgTextAreaElementImpl*)aTextAreaElementId)->SetTextL(aXmlString));
+
+ if ( err != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgEngineInterfaceImpl::SetTextForTextElement failed");
+ #endif
+ return EFalse;
+ }
+
+ return ETrue;
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C TBool CSvgEngineInterfaceImpl::GetTextForTextAreaElement( TInt aTextAreaElementId, TBool& aEditable, TDes& aXmlString )
+// ---------------------------------------------------------------------------
+EXPORT_C TBool CSvgEngineInterfaceImpl::GetTextForTextAreaElement( TInt aTextAreaElementId, TBool& aEditable, TDes& aXmlString )
+{
+ ((CSvgTextAreaElementImpl*)aTextAreaElementId)->GetText( aXmlString );
+
+ aEditable = ((CSvgTextAreaElementImpl*)aTextAreaElementId)->IsEditable();
+
+ return aEditable;
+}
+
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::AddHyperlinkListener( MSvgHyperlinkListener* aListener )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::AddHyperlinkListener( MSvgHyperlinkListener* aListener, TInt aEngine )
+{
+ if ( ChooseEngine ( aEngine ) )
+ {
+ iSvgEngine->AddHyperlinkListener( aListener );
+ }
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::RemoveHyperlinkListener( MSvgHyperlinkListener* aListener )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::RemoveHyperlinkListener( MSvgHyperlinkListener* aListener, TInt aEngine )
+{
+ if ( ChooseEngine ( aEngine ) )
+ {
+ iSvgEngine->RemoveHyperlinkListener( aListener );
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::AddAnimationListener( MSvgAnimationListener* aListener )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::AddAnimationListener( MSvgAnimationListener* aListener, TInt aEngine )
+{
+ if ( ChooseEngine ( aEngine ) )
+ {
+ iSvgEngine->AddAnimationListener( aListener );
+ }
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::RemoveAnimationListener( MSvgAnimationListener* aListener )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::RemoveAnimationListener( MSvgAnimationListener* aListener, TInt aEngine )
+{
+ if ( ChooseEngine ( aEngine ) )
+ {
+ iSvgEngine->RemoveAnimationListener( aListener );
+ }
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C TInt CSvgEngineInterfaceImpl::GetViewportWidth( CSvgDocumentImpl* aDocumentHandle )
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CSvgEngineInterfaceImpl::GetViewportWidth( CSvgDocumentImpl* aDocumentHandle )
+{
+ TFloatFixPt width = 0;
+ CSvgSvgElementImpl* el = (CSvgSvgElementImpl*)(aDocumentHandle->RootElement());
+
+ if ( el != NULL )
+ {
+ width = el->Width( );
+
+ // this means the values were provided in % and the Engine is not initialized.
+ if((TInt)(width) == -1)
+ {
+ return (TInt)(el->iWidthInUserCoordinate);
+ }
+ }
+
+
+ return (TInt)width;
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C TInt CSvgEngineInterfaceImpl::GetViewportHeight( CSvgDocumentImpl* aDocumentHandle )
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CSvgEngineInterfaceImpl::GetViewportHeight( CSvgDocumentImpl* aDocumentHandle )
+{
+ TFloatFixPt height = 0;
+ CSvgSvgElementImpl* el = (CSvgSvgElementImpl*)(aDocumentHandle->RootElement());
+
+ if ( el != NULL )
+ {
+ height = el->Height( );
+
+ // this means the values were provided in % and the Engine is not initialized.
+ if((TInt)(height) == -1)
+ {
+ return (TInt)(el->iHeightInUserCoordinate);
+ }
+ }
+
+ return (TInt)height;
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetViewportWidth( CSvgDocumentImpl* aDocumentHandle, TInt aWidth )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetViewportWidth( CSvgDocumentImpl* aDocumentHandle, TInt aWidth )
+{
+ CSvgSvgElementImpl* el = (CSvgSvgElementImpl*)( aDocumentHandle->RootElement());
+ if ( el != NULL )
+ {
+ TRAP_IGNORE( el->SetAttributeFloatL( KAtrWidth, (TFloatFixPt)aWidth ) );
+ el->iWidthInPercentage = EFalse;
+ }
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetViewportHeight( CSvgDocumentImpl* aDocumentHandle, TInt aHeight )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetViewportHeight( CSvgDocumentImpl* aDocumentHandle, TInt aHeight )
+{
+ CSvgSvgElementImpl* el = (CSvgSvgElementImpl*)( aDocumentHandle->RootElement());
+ if ( el != NULL )
+ {
+ TRAP_IGNORE( el->SetAttributeFloatL( KAtrHeight, (TFloatFixPt)aHeight ) );
+ el->iHeightInPercentage = EFalse;
+ }
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C TInt CSvgEngineInterfaceImpl::GetViewportUnits( CSvgDocumentImpl* aDocumentHandle )
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CSvgEngineInterfaceImpl::GetViewportUnits( CSvgDocumentImpl* aDocumentHandle )
+{
+ if (
+ ((CSvgSvgElementImpl*)aDocumentHandle->RootElement() )->iWidthInPercentage
+ && ((CSvgSvgElementImpl*)aDocumentHandle->RootElement() )->iHeightInPercentage
+ )
+ {
+ return SvgUnitPercent;
+ }
+ else
+ {
+ return SvgUnitPixels;
+ }
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SvgBeginElementAt(CXmlElementImpl* aElementHandle , TUint32 aTimeInMilliSeconds, CSvgDocumentImpl* aDocumentHandle)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SvgBeginElementAt(
+ CXmlElementImpl* aElementHandle ,
+ TUint32 aTimeInMilliSeconds,
+ CSvgDocumentImpl* /* aDocumentHandle */ )
+ {
+ if ( ((CSvgElementImpl*)aElementHandle)->IsAnimatedElement() )
+ {
+ // do this only when this is an animation element.
+ CSvgAnimationBase* lAnimationBasePtr = (CSvgAnimationBase*)aElementHandle;
+ TRAPD( err, lAnimationBasePtr->SetBeginByEventL( lAnimationBasePtr,
+ aTimeInMilliSeconds, ETrue ));
+
+ lAnimationBasePtr->SaveBeginTimeToList(aTimeInMilliSeconds);
+ if ( err != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgEngineInterfaceImpl::SvgBeginElementAt SetBeginByEventL() failed");
+ #endif
+ }
+ }
+ }
+
+//---------------------------------------------------------------------------=
+//Old begine element at...
+//---------------------------------------------------------------------------=
+/*EXPORT_C void CSvgEngineInterfaceImpl::SvgBeginElementAt(CXmlElementImpl* aElementHandle , TUint32 aTimeInMilliSeconds)
+{
+ if ( aElementHandle->ElemID() >= KSvgAnimElemsStartIndex &&
+ aElementHandle->ElemID() <= KSvgAnimElemsEndIndex
+ )
+ {
+ // do this only when this is an animation element.
+ CSvgAnimationBase* lAnimationBasePtr = (CSvgAnimationBase*)aElementHandle;
+ lAnimationBasePtr->SetBeginTime(aTimeInMilliSeconds);
+ // what if the animation has already started. reflect the change in the end Time.
+ TUint32 lSimpleDuration = lAnimationBasePtr->SimpleDuration();
+ if( lSimpleDuration )
+ {
+ lAnimationBasePtr->SetEndTime(lSimpleDuration);
+ }
+ // should we change the animation status.
+ // if the animation has finished then it will not start here again
+ // Reset the status and reset the repeatCount.
+
+ }
+}*/
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SvgEndElementAt(CXmlElementImpl* aElementHandle , TUint32 aTimeInMilliSeconds, CSvgDocumentImpl* aDocumentHandle)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SvgEndElementAt( CXmlElementImpl* aElementHandle , TUint32 aTimeInMilliSeconds, CSvgDocumentImpl* aDocumentHandle )
+{
+ if ( ((CSvgElementImpl*)aElementHandle)->IsAnimatedElement() )
+ {
+ // do this only when this is an animation element.
+ CSvgAnimationBase* lAnimationBasePtr = (CSvgAnimationBase*)aElementHandle;
+ lAnimationBasePtr->SetEndByEvent(lAnimationBasePtr, aTimeInMilliSeconds);
+
+ //this may be more efficient then SetMediaTime below because it only does this element.
+ //lAnimationBasePtr->ReInitializeAnimation();
+
+ SvgSetMediaTime(aDocumentHandle, SvgGetMediaTime(aDocumentHandle) );
+
+ }
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SvgSetMediaTime(CSvgDocumentImpl* aDocumentHandle ,TUint32 aTimeInMilliSeconds)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SvgSetMediaTime(CSvgDocumentImpl* aDocumentHandle ,TUint32 aTimeInMilliSeconds)
+{
+ if(aDocumentHandle && aDocumentHandle->Engine())
+ {
+ aDocumentHandle->Engine()->SetMediaTime(aTimeInMilliSeconds);
+ //Reset the document only if time is 0. This change is just to meet JSR request.
+ if(aTimeInMilliSeconds == 0 && !aDocumentHandle->Engine()->iTimer)
+ {
+ TSvgTimerEvent timeEvent( aTimeInMilliSeconds );
+ aDocumentHandle->Reset( &timeEvent );
+ }
+ }
+ else if (aDocumentHandle && !aDocumentHandle->Engine())
+ {
+ //JSR226 Change in question
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgEngineInterfaceImpl::SvgSetMediaTime--doc doesnt know its engine!");
+ #endif
+
+ //creating a fake engine for the JSR 226 to be able to get valid numbers
+ //before rendering. Don't try this at home kids
+
+ CSvgEngineImpl* fakeEngine = NULL;
+
+ TRAP_IGNORE( fakeEngine = CSvgEngineImpl::NewL(iSvgBitmapFontProvider) );
+
+ if (fakeEngine == NULL)
+ {
+ return;
+ }
+
+ aDocumentHandle->SetEngine(fakeEngine );
+ fakeEngine ->SetDocument(aDocumentHandle);
+
+ aDocumentHandle->Engine()->SetMediaTime(aTimeInMilliSeconds);
+
+ TSvgTimerEvent timeEvent( aTimeInMilliSeconds );
+
+ //AJD I think this needs to be down in the event handler where it sets the time...
+ fakeEngine ->Document()->Reset( &timeEvent );
+
+ TRAPD( error3, fakeEngine ->ProcessEventL(
+ aDocumentHandle, &timeEvent, EFalse ));
+
+ if( error3 != KErrNone)
+ {
+ // Error Processing
+ }
+
+ fakeEngine ->UpdateCTM(aDocumentHandle);
+
+ aDocumentHandle->SetEngine(NULL);
+ fakeEngine ->SetDocument(NULL);
+
+ delete fakeEngine ;
+
+ //store off time on document because this was with a fake engine
+ //because at this point it hasn't rendered
+ aDocumentHandle->iTimeForJSR226 = aTimeInMilliSeconds;
+ }
+ else
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgEngineInterfaceImpl::SvgSetMediaTime-- engine or doc null!");
+ #endif
+ }
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C TReal32 CSvgEngineInterfaceImpl::SvgGetMediaTime(CSvgDocumentImpl* aDocumentHandle )
+// ---------------------------------------------------------------------------
+EXPORT_C TReal32 CSvgEngineInterfaceImpl::SvgGetMediaTime(CSvgDocumentImpl* aDocumentHandle ) __SOFTFP
+{
+ // returns time in milliseconds
+ if(aDocumentHandle && aDocumentHandle->Engine())
+ {
+ return (TReal32)(aDocumentHandle->Engine()->CurrentTIme());
+ }
+ else
+ {
+ if (aDocumentHandle && !aDocumentHandle->Engine())
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgEngineInterfaceImpl::SvgGetMediaTime--doc doesnt know its engine!");
+ #endif
+
+ return ( (TReal32)(aDocumentHandle->iTimeForJSR226) );
+ }
+ else
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgEngineInterfaceImpl::SvgGetMediaTime-- engine or doc null!");
+ #endif
+ }
+ }
+
+ return 0;
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C TBool CSvgEngineInterfaceImpl::SvgHasAnimation(CSvgDocumentImpl* aDocumentHandle )
+// ---------------------------------------------------------------------------
+EXPORT_C TBool CSvgEngineInterfaceImpl::SvgHasAnimation(CSvgDocumentImpl* aDocumentHandle )
+{
+ if (aDocumentHandle)
+ {
+ return aDocumentHandle->IsAnimationFile();
+ }
+
+ return EFalse;
+}
+// --------------------------------------------------------------------------
+// EXPORT_C CXmlElementImpl* CSvgEngineInterfaceImpl::GetFocusedElement(CSvgDocumentImpl* aDocument)
+// ---------------------------------------------------------------------------
+EXPORT_C CXmlElementImpl* CSvgEngineInterfaceImpl::GetFocusedElement(CSvgDocumentImpl* aDocument)
+{
+ if(aDocument)
+ {
+ return aDocument->GetFocusElement();
+ }
+
+ return 0;
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetFocusElement(CXmlElementImpl* aElement , CSvgDocumentImpl* aDocument)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetFocusElement(CXmlElementImpl* aElement , CSvgDocumentImpl* aDocument)
+{
+ if(aDocument)
+ {
+ aDocument->SetFocusElement(aElement);
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C TBool CSvgEngineInterfaceImpl::SVGElementInDom(CSvgDocumentImpl* aDocument, CXmlElementImpl* aElement)
+// ---------------------------------------------------------------------------
+EXPORT_C TBool CSvgEngineInterfaceImpl::SVGElementInDom(CSvgDocumentImpl* aDocument, CXmlElementImpl* aElement)
+{
+ if (aDocument)
+ {
+ return aDocument->SvgElementPresent((CSvgElementImpl*) aElement);
+ }
+
+ return EFalse;
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SvgActivateAnimation(CSvgDocumentImpl* aDocument)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SvgActivateAnimation(CSvgDocumentImpl* aDocument)
+{
+ // this means that if the focus element is an animation element
+ // than the animation element should begin. // SVGACTIVATEANIMATION.
+ if(aDocument)
+ {
+ CXmlElementImpl* lCurrentFocusElement= aDocument->GetFocusElement();
+ if(lCurrentFocusElement)
+ {
+ // Get the element ID
+ TInt lId = lCurrentFocusElement->ElemID() ;
+
+ // make sure that this is an animation element.
+ if( ((CSvgElementImpl*)lCurrentFocusElement)->IsAnimatedElement() )
+ {
+ // now we have to start the animations
+ // get the current media time for the engine and set
+ // the animations to begine at this time only.
+ SvgBeginElementAt( (CXmlElementImpl*) lCurrentFocusElement , (TUint32)SvgGetMediaTime(aDocument), aDocument);
+
+ //dont need this anymore because it is done in begin element at now
+ //CSvgAnimationBase* lAnimationBasePtr = (CSvgAnimationBase*)lCurrentFocusElement;
+ //lAnimationBasePtr->ReInitializeAnimation();
+ }
+
+ }
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C CXmlElementImpl* CSvgEngineInterfaceImpl::SVGElementGetUsedElement(CXmlElementImpl* aElement)
+// ---------------------------------------------------------------------------
+EXPORT_C CXmlElementImpl* CSvgEngineInterfaceImpl::SVGElementGetUsedElement(CXmlElementImpl* aElement)
+{
+ // this is for the reason that id's are not cloned.
+ // should there be a check for the element type for the parent element.
+ if(aElement && aElement->ParentNode())
+ {
+ if(aElement->OwnerDocument())
+ {
+ // get the xlink:href of the use element
+ TPtrC refElemId = ( ((CSvgElementImpl*)(aElement->ParentNode()))->Href() );
+
+ return (CXmlElementImpl*)((CSvgDocumentImpl*)(aElement->OwnerDocument()))->GetElementById(refElemId);
+ }
+ }
+ return 0;
+
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C TBool CSvgEngineInterfaceImpl::IsRemoveable( CSvgElementImpl* hElement )
+// ---------------------------------------------------------------------------
+EXPORT_C TBool CSvgEngineInterfaceImpl::IsRemoveable( CSvgElementImpl* aElement, TBool aCheckSibling )
+{
+ if ( !aElement )
+ {
+ return ETrue;
+ }
+
+ if ( aElement->Id() )
+ {
+ return EFalse;
+ }
+
+ CSvgElementImpl* child = (CSvgElementImpl*)aElement->FirstChild();
+ if ( !IsRemoveable( child, ETrue ) )
+ {
+ return EFalse;
+ }
+
+ if (aCheckSibling)
+ {
+ return IsRemoveable( (CSvgElementImpl*)aElement->NextSibling(), ETrue );
+ }
+
+ return ETrue;
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C TBool CSvgEngineInterfaceImpl::IsElementActive( CSvgElementImpl* hElement )
+// ---------------------------------------------------------------------------
+EXPORT_C TBool CSvgEngineInterfaceImpl::IsElementActive( CSvgElementImpl* hElement )
+{
+ if (hElement)
+ {
+ return (hElement->IsAnimating());
+ }
+
+ return EFalse;
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::AddToEventReceiverList(CXmlElementImpl* aElement, const TUint8 aEventMask)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::AddToEventReceiverList(CXmlElementImpl* aElement, const TUint8 aEventMask)
+{
+ TRAPD(error,((CSvgDocumentImpl*)(aElement->OwnerDocument()))->AddToEventReceiverListL((CSvgElementImpl*)aElement, aEventMask));
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KAddToEventReceiverListFailed,
+ "CSvgEngineInterfaceImpl::AddToEventReceiverList: AddToEventReceiverList error.");
+ RDebug::Print(KAddToEventReceiverListFailed);
+ #endif //_DEBUG
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::RemoveFromEventReceiverList(CXmlElementImpl* aElement)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::RemoveFromEventReceiverList(CXmlElementImpl* aElement)
+{
+ if ( aElement )
+ {
+ ((CSvgDocumentImpl*)(aElement->OwnerDocument()))->RemoveFromEventReceiverList((CSvgElementImpl*)aElement );
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C int CSvgEngineInterfaceImpl::DispatchMouseEventsAt(CSvgDocumentImpl* aDocumentHandle, TInt aX, TInt aY)
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CSvgEngineInterfaceImpl::DispatchMouseEventsAt(CSvgDocumentImpl* aDocumentHandle, TInt aX, TInt aY, MSvgMouseListener* aListener)
+{
+ if(aDocumentHandle)
+ {
+ CSvgEngineImpl *lEngine= aDocumentHandle->Engine();
+
+ TBool fakeEngine = EFalse;
+
+ if (!lEngine)
+ {
+ fakeEngine = ETrue;
+ //no engine with the document pass in so use a fake one
+ TRAPD(error, lEngine = SvgEngineNewL());
+ if (error != KErrNone)
+ {
+ delete lEngine;
+ return 0;
+ }
+
+ if ( fakeEngine && lEngine && aListener )
+ {
+ lEngine->AddMouseListener( (MSvgMouseListener*)aListener );
+ }
+
+ aDocumentHandle->SetEngine(lEngine);
+ lEngine->SetDocument(aDocumentHandle);
+ }
+
+ TInt topSelectedElement = 0;
+
+ // Framework generates MouseDown,MouseMove and MouseUp
+ // The order needs to be maintained
+ topSelectedElement = MouseDown( aX, aY, (TInt)lEngine);
+ MouseMove(aX, aY, (TInt)lEngine);
+ MouseUp(aX, aY, (TInt)lEngine);
+
+ //TSize lSize = ContentDimensions( (TInt)lEngine );
+
+ if (fakeEngine )
+ {
+ DestroyEngine(lEngine);
+ aDocumentHandle->SetEngine(NULL) ;
+ }
+
+ //this code was to make sure the click was on the screen, but this isn't the right way to do that
+ //at all since the screen can be scaled but from negative coordinates...etc.
+
+ //if ( (aX < lSize.iWidth) && (aX > 0 ) && (aY < lSize.iHeight) && (aY > 0))
+ //{
+ //really should return a handle to the element that was clicked here
+ return topSelectedElement ;
+ //}
+ }
+
+ return 0;
+}
+
+//Triggers the Focusin event for the SvgElement passed as a paramenter
+EXPORT_C void CSvgEngineInterfaceImpl::DispatchFocusInEvent(CSvgDocumentImpl* aDocumentHandle,CSvgElementImpl *aElement)
+{
+ if(aDocumentHandle)
+ {
+ CSvgEngineImpl *lEngine = aDocumentHandle->Engine();
+ TBool fakeEngine = EFalse;
+
+ if (!lEngine)
+ {
+ lEngine = SvgEngineNewL() ;
+ fakeEngine = ETrue ;
+ //Set Engine for the document
+ aDocumentHandle->SetEngine(lEngine );
+ }
+ //Set document Handle for the engine
+ lEngine->SetDocument(aDocumentHandle);
+ //sets the focus as well as the mouse inside the element on which
+ //this function is called
+ TGfxRectangle2D boundingBox;
+ aElement->GetBBox( boundingBox );
+ MouseMove (boundingBox.CenterX() , boundingBox.CenterY());
+
+ if(fakeEngine)
+ {
+ DestroyEngine(lEngine) ;
+ aDocumentHandle->SetEngine(NULL) ;
+ }
+ }
+}
+
+//Triggers the Focusout event for the SvgElement passed as a paramenter
+EXPORT_C void CSvgEngineInterfaceImpl::DispatchFocusOutEvent(CSvgDocumentImpl* aDocumentHandle,CSvgElementImpl* /*aElement */)
+{
+ if(aDocumentHandle)
+ {
+ CSvgEngineImpl *lEngine = aDocumentHandle->Engine();
+ TBool fakeEngine = EFalse;
+
+ if (!lEngine)
+ {
+ lEngine = SvgEngineNewL() ;
+ fakeEngine = ETrue ;
+ //Set Engine for the document
+ aDocumentHandle->SetEngine(lEngine );
+ }
+ //Set document Handle for the engine
+ lEngine->SetDocument(aDocumentHandle);
+
+ // Move the mouse outside the screen so that mouse is exitting
+ // from all the elements in the DOM tree.
+ // After this, "focus out" internal event is generated by the
+ // element which is in focus.
+ MouseMove( KMINFLOATFIXVALUE, KMINFLOATFIXVALUE );
+
+ if(fakeEngine)
+ {
+ DestroyEngine(lEngine) ;
+ aDocumentHandle->SetEngine(NULL) ;
+ }
+ }
+}
+
+
+// --------------------------------------------------------------------------
+// EXPORT_C CGfxGeneralPath* CSvgEngineInterfaceImpl::SvgCreatePath()
+// ---------------------------------------------------------------------------
+EXPORT_C CGfxGeneralPath* CSvgEngineInterfaceImpl::SvgCreatePath()
+{
+ CGfxGeneralPath* path = NULL;
+ TRAPD(error , path = CGfxGeneralPath::NewL());
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KCreateCGfxGeneralPathFailed,
+ "CSvgEngineInterfaceImpl::SvgCreatePath: Can't create CGfxGeneralPath.");
+ RDebug::Print(KCreateCGfxGeneralPathFailed);
+ #endif //_DEBUG
+ }
+ return path;
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SvgDestroyPath(CGfxGeneralPath* aPathHandle)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SvgDestroyPath(CGfxGeneralPath* aPathHandle)
+{
+ if (aPathHandle)
+ {
+ delete aPathHandle;
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C TInt CSvgEngineInterfaceImpl::GetSegmentCount(CGfxGeneralPath* aPathHandle)
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CSvgEngineInterfaceImpl::GetSegmentCount(CGfxGeneralPath* aPathHandle)
+{
+ if(aPathHandle)
+ {
+ return (aPathHandle)->GetSegmentCount();
+ }
+
+ return 0;
+}
+// --------------------------------------------------------------------------
+// EXPORT_C TInt CSvgEngineInterfaceImpl::GetSegmentType(CGfxGeneralPath* aPathHandle, TInt aSegmentIndex)
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CSvgEngineInterfaceImpl::GetSegmentType(CGfxGeneralPath* aPathHandle, TInt aSegmentIndex)
+{
+ if(aPathHandle)
+ {
+ return ( aPathHandle)->GetSegmentType(aSegmentIndex);
+ }
+
+ return 0; // this should be verified that this is an error code.
+}
+// --------------------------------------------------------------------------
+// EXPORT_C TReal32 CSvgEngineInterfaceImpl::GetSegmentParameter(CGfxGeneralPath* aPathHandle,TInt aSegmentIndex,TInt aSegmentParameterIndex)
+// ---------------------------------------------------------------------------
+EXPORT_C TReal32 CSvgEngineInterfaceImpl::GetSegmentParameter(CGfxGeneralPath* aPathHandle,TInt aSegmentIndex,TInt aSegmentParameterIndex) __SOFTFP
+{
+
+ if(aPathHandle)
+ {
+ return (aPathHandle)->GetSegmentParameter( aSegmentIndex, aSegmentParameterIndex);
+ }
+ return 0; // this should be treated as error.
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::ADDMoveTo(CGfxGeneralPath* aPathHandle, TReal32 aX,TReal32 aY)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::ADDMoveTo(CGfxGeneralPath* aPathHandle, TReal32 aX,TReal32 aY) __SOFTFP
+{
+ if(aPathHandle)
+ {
+ TFloatFixPt lX = TFloatFixPt(aX);
+ TFloatFixPt lY = TFloatFixPt(aY);
+ TRAPD(error ,aPathHandle->MoveToL( lX, lY, ETrue));
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KMoveToFailed,
+ "CSvgEngineInterfaceImpl::ADDMoveTo: MoveToL error.");
+ RDebug::Print(KMoveToFailed);
+ #endif //_DEBUG
+ }
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::ADDLineTo(CGfxGeneralPath* aPathHandle,TReal32 aX,TReal32 aY)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::ADDLineTo(CGfxGeneralPath* aPathHandle,TReal32 aX,TReal32 aY) __SOFTFP
+{
+ if(aPathHandle)
+ {
+ TFloatFixPt lX = TFloatFixPt(aX);
+ TFloatFixPt lY = TFloatFixPt(aY);
+ TRAPD(error , aPathHandle->LineToL( lX, lY, ETrue));
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KLineToLFailed,
+ "CSvgEngineInterfaceImpl::ADDLineTo: LineToL error.");
+ RDebug::Print(KLineToLFailed);
+ #endif //_DEBUG
+ }
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::ADDQuadTo(CGfxGeneralPath* aPathHandle,TReal32 aX1,TReal32 aY1,TReal32 aX2,TReal32 aY2)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::ADDQuadTo(CGfxGeneralPath* aPathHandle,TReal32 aX1,TReal32 aY1,TReal32 aX2,TReal32 aY2) __SOFTFP
+{
+ if(aPathHandle)
+ {
+
+ TFloatFixPt lX1 = TFloatFixPt(aX1);
+ TFloatFixPt lY1 = TFloatFixPt(aY1);
+ TFloatFixPt lX2 = TFloatFixPt(aX2);
+ TFloatFixPt lY2 = TFloatFixPt(aY2);
+ TRAPD(error ,aPathHandle->QuadToL( lX1, lY1, lX2, lY2, ETrue ));
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KQuadToLLFailed,
+ "CSvgEngineInterfaceImpl::ADDQuadTo: QuadToL error.");
+ RDebug::Print(KQuadToLLFailed);
+ #endif //_DEBUG
+ }
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::ADDCurveTo(CGfxGeneralPath* aPathHandle,TReal32 aX1,TReal32 aY1,TReal32 aX2,TReal32 aY2, TReal32 aX3, TReal32 aY3)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::ADDCurveTo(CGfxGeneralPath* aPathHandle,TReal32 aX1,TReal32 aY1,TReal32 aX2,TReal32 aY2, TReal32 aX3, TReal32 aY3) __SOFTFP
+{
+
+ if(aPathHandle)
+ {
+
+ TFloatFixPt lX1 = TFloatFixPt(aX1);
+ TFloatFixPt lY1 = TFloatFixPt(aY1);
+ TFloatFixPt lX2 = TFloatFixPt(aX2);
+ TFloatFixPt lY2 = TFloatFixPt(aY2);
+ TFloatFixPt lX3 = TFloatFixPt(aX3);
+ TFloatFixPt lY3 = TFloatFixPt(aY3);
+
+ TRAPD(error ,aPathHandle->CubicToL( lX1,
+ lY1,
+ lX2,
+ lY2,
+ lX3,
+ lY3,
+ ETrue ));
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KCubicToLFailed,
+ "CSvgEngineInterfaceImpl::ADDCurveTo: CubicToL error.");
+ RDebug::Print(KCubicToLFailed);
+ #endif //_DEBUG
+ }
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::ADDCloseTo(CGfxGeneralPath* aPathHandle)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::ADDCloseTo(CGfxGeneralPath* aPathHandle)
+{
+ if(aPathHandle)
+ {
+ TRAPD(error ,aPathHandle->ClosePathL());
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(KClosePathLFailed,
+ "CSvgEngineInterfaceImpl::ADDCloseTo: ClosePathL error.");
+ RDebug::Print(KClosePathLFailed);
+ #endif //_DEBUG
+ }
+ }
+}
+// --------------------------------------------------------------------------
+// EXPORT_C CGfxGeneralPath* CSvgEngineInterfaceImpl::GetPathAttribute(CXmlElementImpl* aElementHandle, TInt aAttributeId)
+// ---------------------------------------------------------------------------
+EXPORT_C CGfxGeneralPath* CSvgEngineInterfaceImpl::GetPathAttribute(CXmlElementImpl* aElementHandle, TInt aAttributeId)
+{
+ if(aElementHandle)
+ {
+
+ CGfxGeneralPath* path =
+ ((CSvgElementImpl*)aElementHandle)->GetPathAttribute(aAttributeId);
+
+ if( path )
+ {
+ CGfxGeneralPath* lClonePath = NULL;
+ TInt error = KErrNone;
+ TRAP(error,lClonePath = path->CloneL());
+ return lClonePath;
+ }
+
+ }
+
+ return NULL;
+}
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetPathAttribute(CSvgElementImpl* aElementHandle, TInt lSvgAttrId, CGfxGeneralPath* aPathHandle)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetPathAttribute(CSvgElementImpl* aElementHandle, TInt lSvgAttrId, CGfxGeneralPath* aPathHandle)
+{
+ if(aElementHandle)
+ {
+ if(aPathHandle)
+ {
+ CGfxGeneralPath* clone = NULL;
+ TInt error = KErrNone;
+ TRAP(error,clone = aPathHandle->CloneL());
+ aElementHandle->SetPathAttribute(lSvgAttrId, clone);
+ }
+ }
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C TRect CSvgEngineInterfaceImpl::GetSvgBoundingBox()
+// ---------------------------------------------------------------------------
+EXPORT_C TRect CSvgEngineInterfaceImpl::GetSvgBoundingBox( TInt aEngine )
+{
+ TRect lBBox(TSize(0,0));
+
+ if( ChooseEngine(aEngine) )
+ {
+ if( iSvgEngine->Document() )
+ {
+ CSvgSvgElementImpl* lRoot = ( CSvgSvgElementImpl* )
+ iSvgEngine->Document()->RootElement();
+ if(lRoot)
+ {
+ TGfxRectangle2D bbox;
+ lRoot->GetBBox(bbox );
+
+ TInt lX = (TInt)bbox.iX;
+ TInt lY = (TInt)bbox.iY;
+ TInt lWidth = (TInt)bbox.iWidth;
+ TInt lHeight = (TInt)bbox.iHeight;
+ lBBox.SetRect(TPoint(lX, lY),TSize(lWidth, lHeight));
+ }
+
+ }
+
+ }
+ return lBBox;
+}
+
+//---------------------------------------------------------------------------=
+//Getting BoundingBox of Root Element
+//---------------------------------------------------------------------------
+EXPORT_C TSize CSvgEngineInterfaceImpl::GetUnscaledContentSize( TInt aDomHandle )
+ {
+ TSize size( 0, 0 );
+ if ( IsDomCached( aDomHandle ) )
+ {
+ CSvgDocumentImpl* document = (CSvgDocumentImpl*)aDomHandle;
+ CSvgSvgElementImpl* root = (CSvgSvgElementImpl*)document->RootElement();
+ if ( root )
+ {
+ TGfxRectangle2D bbox;
+ root->GetUnscaledBBox( bbox );
+ size.iWidth = (TInt)bbox.iWidth;
+ size.iHeight = (TInt)bbox.iHeight;
+ }
+ }
+ return size;
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C TBool CSvgEngineInterfaceImpl::IsElementVisible( TInt aElementHandle )
+// ---------------------------------------------------------------------------
+EXPORT_C TBool CSvgEngineInterfaceImpl::IsElementVisible( TInt aElementHandle, TInt aEngine )
+{
+ if (ChooseEngine( aEngine ))
+ {
+ return iSvgEngine->IsElementVisible( aElementHandle );
+ }
+ else
+ {
+ return EFalse;
+ }
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetThumbNailMode( TBool aThumbNailMode )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetThumbNailMode( TBool aThumbNailMode, TInt aEngine )
+{
+ iIsThumbNailMode = aThumbNailMode;
+ if ( ChooseEngine(aEngine) && iSvgEngine->Document() )
+ {
+ iSvgEngine->Document()->SetThumbNailMode( aThumbNailMode );
+ }
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::CustomOption( TBool aThumbNailMode )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::CustomOption(TBool aCustomOption, TInt aEngine )
+ {
+ if ( ChooseEngine(aEngine) )
+ {
+ iSvgEngine->CustomOption(aCustomOption);
+ }
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C TReal CSvgEngineInterfaceImpl::FramesPerSecond(TBool aShowOn)
+// ---------------------------------------------------------------------------
+EXPORT_C TReal CSvgEngineInterfaceImpl::FramesPerSecond(TBool aShowOn, TInt aEngine ) __SOFTFP
+ {
+
+ //take the width in here..
+ CSvgDocumentImpl* doc = SvgDocument();
+
+ if (aShowOn && ChooseEngine(aEngine) && iSvgEngine->Document() )
+ {
+ TReal ret = 0.0;
+ TRAPD( error, ret = FramesPerSecondL() );
+ if ( error != KErrNone )
+ {
+ RDebug::Printf("CSvgEngineInterfaceImpl::FramesPerSecond() Error in FramesPerSecondL");
+ }
+
+ return ret;
+ }
+ else
+ {
+ _LIT(fps, "fps");
+ if (iSvgEngine && iSvgEngine->Document() && iSvgEngine->Document()->iPerfText && GetElementById(doc, fps))
+ {
+ RemoveChild( (CXmlElementImpl*)iSvgEngine->Document()->RootElement(), (CXmlElementImpl*) iSvgEngine->Document()->iPerfText);
+ delete iSvgEngine->Document()->iPerfText;
+ iSvgEngine->Document()->iPerfText = NULL;
+ }
+
+ if ((iSvgEngine) && ( iSvgEngine->iTimer ))
+ {
+ return (iSvgEngine->iTimer->Fps() / 10);
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ }
+
+// --------------------------------------------------------------------------
+// TReal CSvgEngineInterfaceImpl::FramesPerSecondL()
+// ---------------------------------------------------------------------------
+TReal CSvgEngineInterfaceImpl::FramesPerSecondL( TInt aEngine )
+ {
+
+ if (!ChooseEngine( aEngine ))
+ {
+ return 0;
+ }
+
+ CSvgDocumentImpl* doc = SvgDocument();
+
+ TSize svgSize = ContentDimensions();
+ TBuf<10> fps;
+ _LIT(msg, "FPS: ");
+ _LIT(FPS, "fps");
+ fps.Append(msg);
+
+ fps.AppendNum((iSvgEngine->iTimer->Fps() / 10));
+
+ if (!iSvgEngine->Document()->iPerfText || !(GetElementById(doc, FPS)))
+ {
+ TRAPD(err, iSvgEngine->Document()->iPerfText = (CSvgElementImpl*)doc->CreateElementL(25));
+ if (err)
+ {
+ #ifdef _DEBUG
+ _LIT( KErrMsg, "CSvgEngineInterfaceImpl::FramesPerSecond() Error in CreateElementL" );
+ RDebug::Print(KErrMsg);
+ #endif //_DEBUG
+ }
+ AppendChild((CXmlElementImpl*)doc->RootElement(), (CXmlElementImpl*)iSvgEngine->Document()->iPerfText);
+ }
+
+ const TGfxAffineTransform& tmtx = ((CSvgSvgElementImpl* )iSvgEngine->Document()->RootElement())->GetCTM();
+ TGfxPoint2D whPt(svgSize.iWidth,svgSize.iHeight), whDstPt(1,1);
+ tmtx.Transform(&whPt,&whDstPt,1);
+
+ //<text x="x" y ="y" font-family="verdana" font-size="6" fill= "grey">Testing 'text' element: </text>
+ iSvgEngine->Document()->iPerfText->SetAttributeDesL(KAtrCdata,fps);
+ iSvgEngine->Document()->iPerfText->SetAttributeDesL(KAtrId, FPS);
+ iSvgEngine->Document()->iPerfText->SetAttributeFloatL(KAtrX, (float)whDstPt.iX * (float).95);
+ iSvgEngine->Document()->iPerfText->SetAttributeFloatL(KAtrY, (float)whDstPt.iY * (float).05);
+ iSvgEngine->Document()->iPerfText->SetAttributeFloatL(KAtrWidth, ((float).05 * (float)whDstPt.iX));
+ iSvgEngine->Document()->iPerfText->SetAttributeFloatL(KAtrHeight,((float).05 * (float)whDstPt.iY));
+
+ _LIT(RED, "red");
+ iSvgEngine->Document()->iPerfText->SetPropertyL( KCSS_ATTR_STROKE, RED);
+ iSvgEngine->Document()->iPerfText->SetPropertyL( KCSS_ATTR_FILL, RED);
+
+ return (iSvgEngine->iTimer->Fps() / 10);
+ }
+
+//---------------------------------------------------------------------------=
+////debugging method to draw a rectangle on the screen
+//---------------------------------------------------------------------------=
+// --------------------------------------------------------------------------
+// EXPORT_C CSvgElementImpl* CSvgEngineInterfaceImpl::DrawBox(TRect aRect)
+// ---------------------------------------------------------------------------
+EXPORT_C CSvgElementImpl* CSvgEngineInterfaceImpl::DrawBox(TRect aRect, TInt aEngine)
+{
+ if (!ChooseEngine( aEngine ))
+ {
+ return NULL;
+ }
+
+ CSvgElementImpl* lBox = NULL;
+ TRAPD(err, lBox = (CSvgElementImpl*)CreateElementL(SvgDocument(), KSvgRectElement));
+ if (err)
+ {
+ _LIT(msg1, "DrawBox error: ");
+ _LIT(msg2, "Can't create element");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, err, msg1, msg2);
+ return lBox;
+ }
+
+ AppendChild((CXmlElementImpl*)iSvgEngine->Document()->RootElement(), (CXmlElementImpl*)lBox);
+
+ if (lBox)
+ {
+ //<rect fill="none" x="lBbox.iX" y="lBbox.iY" width="iBbox.iWidth" height="iBbox.iHeight" stroke="blue"/>
+ //fill
+ _LIT(NONE, "none");
+ TRAPD(err, lBox->SetPropertyL( KCSS_ATTR_FILL, NONE));
+ if (err)
+ {
+ #ifdef _DEBUG
+ _LIT( KErrMsg, "CSvgEngineInterfaceImpl::DrawBox) Error in SetPropertyL" );
+ RDebug::Print(KErrMsg);
+ #endif //_DEBUG
+ }
+
+ //stroke
+ _LIT(BLUE, "blue");
+ TRAP(err, lBox->SetPropertyL( KCSS_ATTR_STROKE, BLUE));
+ if (err)
+ {
+ #ifdef _DEBUG
+ _LIT( KErrMsg, "CSvgEngineInterfaceImpl::DrawBox) Error in SetPropertyL" );
+ RDebug::Print(KErrMsg);
+ #endif //_DEBUG
+ }
+
+ //x
+ TRAP(err, lBox->SetAttributeFloatL( KAtrX, ((TFloatFixPt)(float) aRect.iTl.iX)));
+ if (err)
+ {
+ #ifdef _DEBUG
+ _LIT( KErrMsg, "CSvgEngineInterfaceImpl::DrawBox) Error in SetPropertyL" );
+ RDebug::Print(KErrMsg);
+ #endif //_DEBUG
+ }
+
+ //y
+ TRAP(err, lBox->SetAttributeFloatL( KAtrY, ((TFloatFixPt)(float) aRect.iTl.iY)));
+ if (err)
+ {
+ #ifdef _DEBUG
+ _LIT( KErrMsg, "CSvgEngineInterfaceImpl::DrawBox) Error in SetPropertyL" );
+ RDebug::Print(KErrMsg);
+ #endif //_DEBUG
+ }
+
+ //width
+ TRAP(err, lBox->SetAttributeFloatL( KAtrWidth, ((TFloatFixPt)(float) aRect.Width())));
+ if (err)
+ {
+ #ifdef _DEBUG
+ _LIT( KErrMsg, "CSvgEngineInterfaceImpl::DrawBox) Error in SetPropertyL" );
+ RDebug::Print(KErrMsg);
+ #endif //_DEBUG
+ }
+ //height
+ TRAP(err, lBox->SetAttributeFloatL( KAtrHeight, ((TFloatFixPt)(float) aRect.Height())));
+ if (err)
+ {
+ #ifdef _DEBUG
+ _LIT( KErrMsg, "CSvgEngineInterfaceImpl::DrawBox) Error in SetPropertyL" );
+ RDebug::Print(KErrMsg);
+ #endif //_DEBUG
+ }
+ }
+
+ return lBox;
+}
+
+//---------------------------------------------------------------------------=
+//Returns array of pointers to all elements of a certain type or all elements if aElementId = -1
+//---------------------------------------------------------------------------=
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::FindAllElements( CSvgElementImpl* aStartElement, TInt aElementId,
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::FindAllElements( CSvgElementImpl* aStartElement, TInt aElementId,
+ RPointerArray<CSvgElementImpl>& aList, TInt aEngine )
+{
+ if ( ChooseEngine(aEngine) && iSvgEngine->Document())
+ {
+ iSvgEngine->Document()->FindAllElements(aStartElement, aElementId, aList);
+ }
+}
+
+//---------------------------------------------------------------------------=
+////DOM Element Traversal
+//---------------------------------------------------------------------------=
+
+//---------------------------------------------------------------------------=
+//Returns the first child element node of this element. null if this element has no child elements.
+//---------------------------------------------------------------------------=
+CSvgElementImpl* CSvgEngineInterfaceImpl::FirstElementChild(CSvgElementImpl* aParentElement)
+{
+ if ( aParentElement )
+ {
+ return (CSvgElementImpl*)aParentElement->FirstChild();
+ }
+
+ return NULL;
+}
+
+//---------------------------------------------------------------------------=
+//last child element node of this element. null if this element has no child elements.
+//---------------------------------------------------------------------------=
+CSvgElementImpl* CSvgEngineInterfaceImpl::LastElementChild(CSvgElementImpl* aParentElement)
+{
+ if ( aParentElement )
+ {
+ return (CSvgElementImpl*)aParentElement->LastChild();
+ }
+
+ return NULL;
+
+}
+
+//---------------------------------------------------------------------------=
+//Returns the next sibling element node of this element. null if this element has no element sibling nodes that come after this one in the document tree.
+//---------------------------------------------------------------------------=
+CSvgElementImpl* CSvgEngineInterfaceImpl::PreviousElementSibling(CSvgElementImpl* aSiblingElement)
+{
+ if ( aSiblingElement )
+ {
+ return (CSvgElementImpl*)aSiblingElement->PreviousSibling();
+ }
+
+ return NULL;
+}
+
+//---------------------------------------------------------------------------=
+//previous sibling element node of this element. null if this element has no element sibling nodes that come before this one in the document tree.
+//---------------------------------------------------------------------------=
+CSvgElementImpl* CSvgEngineInterfaceImpl::NextElementSibling(CSvgElementImpl* aSiblingElement)
+{
+ if ( aSiblingElement )
+ {
+ return (CSvgElementImpl*)aSiblingElement->NextSibling();
+ }
+
+ return NULL;
+}
+
+
+//---------------------------------------------------------------------------=
+// Precondition: bitmap A & B has same dimension and display mode.
+// Return ETrue if both bitmaps are the same, bit for bit.
+// Used by RenderFrames
+//---------------------------------------------------------------------------=
+TBool CSvgEngineInterfaceImpl::AreBitmapsTheSame( CFbsBitmap& aBitmapA, CFbsBitmap& aBitmapB )
+{
+
+ TInt bitsPerPixel = TDisplayModeUtils::NumDisplayModeBitsPerPixel( aBitmapA.DisplayMode() );
+ TSize size = aBitmapA.SizeInPixels();
+
+ // Number of bytes of each scan line
+ // This is aligned to a 4 byte(DWORD) boundary for performance reasons.
+ TInt scanLineLength = CFbsBitmap::ScanLineLength( size.iWidth, aBitmapA.DisplayMode() );
+
+ aBitmapA.LockHeap();
+ aBitmapB.LockHeap();
+ TUint32* dataA = aBitmapA.DataAddress();
+ TUint32* dataB = aBitmapB.DataAddress();
+ aBitmapA.UnlockHeap();
+ aBitmapB.UnlockHeap();
+ TInt dwords = scanLineLength / 4;
+ TInt bytesLeftOver = scanLineLength - ( 4 * dwords );
+
+ TInt sizeHeight = size.iHeight;
+ for ( TInt y = 0; y < sizeHeight; y++ )
+ {
+ // compare 4 bytes are at time
+ TInt i = 0;
+ for ( ; i < dwords; i++ )
+ if ( dataA[i] != dataB[i] )
+ return EFalse;
+
+ // compare left over bytes
+ if ( bytesLeftOver > 0 )
+ {
+ TUint8* bytesA = (TUint8*)dataA[i];
+ TUint8* bytesB = (TUint8*)dataB[i];
+ for ( TInt k = 0; k < bytesLeftOver; k++ )
+ if ( bytesA[k] != bytesB[k] )
+ return EFalse;
+ // next scanline
+ dataA = &dataA[dwords+1];
+ dataB = &dataB[dwords+1];
+ }
+ else
+ {
+ // next scanline
+ dataA = &dataA[dwords];
+ dataB = &dataB[dwords];
+ }
+ }
+ return ETrue;
+}
+
+//---------------------------------------------------------------------------=
+// Create a bitmap with the specified size, colormode.
+// Used by RenderFrames
+//---------------------------------------------------------------------------=
+CFbsBitmap* CSvgEngineInterfaceImpl::CreateBitmapL( TSize aSize, TDisplayMode aColorMode,
+ CSvgErrorImpl& aError )
+{
+ CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();
+ CleanupStack::PushL(bitmap);
+
+ User::LeaveIfError( bitmap->Create( aSize, aColorMode ));
+
+ CleanupStack::Pop(); // bitmap
+
+ aError.SetErrorCode( ESvgNoError );
+ return bitmap;
+}
+
+//---------------------------------------------------------------------------=
+// Generate animation frames
+//---------------------------------------------------------------------------=
+
+EXPORT_C MSvgError* CSvgEngineInterfaceImpl::RenderFrames(
+ TInt aDomHandle,
+ const TSize& aDimensionOfBitmaps,
+ TUint aStartTime,
+ TUint aDuration,
+ TUint aMillisecondsPerFrame,
+ TDisplayMode aColorDepth,
+ TDisplayMode aMaskType,
+ RPointerArray<CFbsBitmap>& aBitmapFrames,
+ RPointerArray<CFbsBitmap>& aMaskFrames,
+ RArray<TUint>& aDelayIntervals,
+ TBool aRemoveRedundantFrames )
+{
+ iSvgError->SetErrorCode( ESvgNoError );
+
+ //-----------------------------------------------------
+ // Validate parameters
+ //-----------------------------------------------------
+ if ( aDimensionOfBitmaps.iWidth < 1 || aDimensionOfBitmaps.iHeight < 1 )
+ {
+ TBuf<100> buf;
+ buf.AppendNum( aDimensionOfBitmaps.iWidth );
+ _LIT(X, "x");
+ buf.Append( X );
+ buf.AppendNum( aDimensionOfBitmaps.iHeight );
+ _LIT(msg, "RenderFrames: Invalid bitmap dimensions: ");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, KErrNone, msg, buf );
+ return iSvgError;
+ }
+ if ( aMillisecondsPerFrame == 0 )
+ {
+ _LIT(msg1, "RenderFrames: Invalid delay per frame: 0");
+ _LIT(msg2, "");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, KErrNone, msg1, msg2);
+ return iSvgError;
+ }
+ if ( !( aMaskType == EGray2 || aMaskType == EGray256 ) )
+ {
+ _LIT(msg1, "RenderFrames: Unsupported Mask Type.");
+ _LIT(msg2, "Must be EGray2 or EGray256");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, KErrNone, msg1, msg2);
+ return iSvgError;
+ }
+
+ if ( !IsDomCached( aDomHandle ) )
+ {
+ _LIT(msg1, "RenderFrames: Invalid Dom Handle.");
+ _LIT(msg2, "");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, KErrNone, msg1, msg2);
+ return iSvgError;
+ }
+
+ // Create separate svg engine for operation, leaving intact
+ // default engine.
+ CSvgEngineImpl* svgEngine = NULL;
+ TRAPD( engineError, svgEngine = CSvgEngineImpl::NewL( iSvgEngine->iFrameBuffer,
+ iSvgEngine->iRequestObserver,
+ iSvgEngine->iBitmapFontSpec, iSvgBitmapFontProvider ) );
+ CleanupStack::PushL(svgEngine);
+ if ( engineError != KErrNone )
+ {
+ _LIT(msg1, "RenderFrames: Failed to instantiate SvgEngine.");
+ _LIT(msg2, "");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, engineError, msg1, msg2);
+ return iSvgError;
+ }
+ svgEngine->SetBackgroundColor(KBackgroundColor);
+ // Initialize engine with document
+ CSvgDocumentImpl* document = (CSvgDocumentImpl*)aDomHandle;
+
+ if(!document)
+ {
+ _LIT(msg1, "RenderFrames: Failed to get document.");
+ _LIT(msg2, "");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgDocumentNotAvailable, KErrUnknown, msg1, msg2);
+ return iSvgError;
+ }
+
+ // Before changing the engine, if the current engine is valid
+ // and it is pointing to this document set the engine's document to NULL
+ if (document->Engine() )
+ {
+ CSvgEngineImpl* lCurEngine = document->Engine();
+ lCurEngine->SetDocument( NULL );
+ }
+
+
+ svgEngine->SetDocument( document );
+ document->SetEngine( svgEngine );
+
+ svgEngine->SetIgnoreUpdateScreen( ETrue );
+
+ // Flag to indicate content is an animation
+ TBool isAnimationContent = SvgHasAnimation( document );
+
+ CFbsBitmap* bitmap = NULL;
+ TBool usePreviousBitmap = EFalse;
+ TBool engineInitialized = EFalse;
+
+ for ( TUint time = 0; time <= aDuration; time += aMillisecondsPerFrame )
+ {
+ //-----------------------------------------------------
+ // Create bitmap if needed
+ //-----------------------------------------------------
+ if ( !usePreviousBitmap )
+ {
+ TRAPD(err, bitmap = CreateBitmapL( aDimensionOfBitmaps,
+ aColorDepth, *iSvgError ));
+ if ( err != KErrNone )
+ {
+ _LIT(msg1, "RenderFrames: Failed to create bitmap.");
+ _LIT(msg2, "");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, engineError, msg1, msg2);
+ break;
+ }
+ //-----------------------------------------------------
+ // Set the bitmap to render with the dom
+ //-----------------------------------------------------
+ TRAPD( setGdiError, svgEngine->SetGdiContextL( bitmap ) );
+ if ( setGdiError != KErrNone )
+ {
+ // Delete the bitmap
+ delete bitmap;
+ bitmap = NULL;
+
+ CleanupStack::PopAndDestroy(svgEngine);
+
+ if ( setGdiError == KErrNoMemory )
+ {
+ _LIT(msg1, "RenderFrames: Set Bitmap to SVG Engine failed.");
+ _LIT(msg2, "");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgNoMemory, setGdiError, msg1, msg2);
+ return iSvgError;
+ }
+
+ _LIT(msg1, "RenderFrames: Set Bitmap to SVG Engine failed.");
+ _LIT(msg2, "");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, setGdiError, msg1, msg2);
+ return iSvgError;
+ }
+ // Need to initialize after new bitmap is set
+ // for engine to set viewbox, etc.
+ if ( !engineInitialized )
+ {
+ TRAPD( initError, svgEngine->InitializeEngineL() );
+ if ( initError != KErrNone )
+ {
+ _LIT(msg1, "RenderFrames: Initializing Svg Engine failed.");
+ _LIT(msg2, "");
+ CSvgDocumentImpl::PrepareError(
+ *iSvgError, ESvgUnknown, initError, msg1, msg2);
+ break;
+ }
+ engineInitialized = ETrue;
+ }
+ }
+
+ //-----------------------------------------------------
+ // draw to bitmap
+ //-----------------------------------------------------
+ TSvgTimerEvent timeEvent( aStartTime + time );
+ TRAPD( renderError, svgEngine->ProcessEventL(
+ document, &timeEvent ) );
+ if ( renderError != KErrNone )
+ {
+ _LIT(msg1, "RenderFrames: Rendering image failed.");
+ _LIT(msg2, "");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, renderError,msg1, msg2);
+ break;
+ }
+ //-----------------------------------------------------
+ // compare new bitmap with previous bitmap to combine delay time
+ // if images are the same
+ //-----------------------------------------------------
+ usePreviousBitmap = aRemoveRedundantFrames &&
+ ( aBitmapFrames.Count() > 0 ) &&
+ AreBitmapsTheSame( *bitmap, *aBitmapFrames[aBitmapFrames.Count()-1] );
+
+ //-----------------------------------------------------
+ // Use previous bitmap: add delay time
+ //-----------------------------------------------------
+ if ( usePreviousBitmap )
+ {
+ TInt index = aDelayIntervals.Count() - 1;
+ aDelayIntervals[index] += aMillisecondsPerFrame;
+ // In case this is the very last frame and it's the same with previous frame,
+ // then destroy it
+ if ( time + aMillisecondsPerFrame > aDuration )
+ {
+ delete bitmap;
+ bitmap = NULL;
+ }
+ continue;
+ }
+ //-----------------------------------------------------
+ // add new bitmap to array: bitmap is different than previous
+ //-----------------------------------------------------
+ TInt bitmapAppendError = aBitmapFrames.Append( bitmap );
+ if ( bitmapAppendError != KErrNone )
+ {
+ _LIT(msg1, "RenderFrames: Failed to append new bitmap to frames.");
+ _LIT(msg2, "");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, bitmapAppendError, msg1, msg2);
+ break;
+ }
+
+ // Set the bitmap NULL as the ownership is transferred to
+ // aBitmapFrames
+ bitmap = NULL;
+
+ //-----------------------------------------------------
+ // Render mask
+ //-----------------------------------------------------
+ // Create Mask
+ CFbsBitmap* maskBitmap = NULL;
+ TRAPD( err, maskBitmap = CreateBitmapL( aDimensionOfBitmaps, aMaskType, *iSvgError ));
+ if ( err != KErrNone || maskBitmap == NULL )
+ {
+ break;
+ }
+ GenerateMask( maskBitmap );
+ TInt appendMaskError = aMaskFrames.Append( maskBitmap );
+ if ( appendMaskError != KErrNone )
+ {
+ _LIT(msg1, "RenderFrames: Failed to append new mask to mask frames.");
+ _LIT(msg2, "");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, appendMaskError, msg1, msg2);
+ delete maskBitmap;
+ break;
+ }
+
+ // Set the mask NULL as the ownership is transferred to
+ // aMaskFrames
+ maskBitmap = NULL;
+
+ //-----------------------------------------------------
+ // Append delay interval
+ //-----------------------------------------------------
+ TUint delay = ( aDuration - time < aMillisecondsPerFrame ) ?
+ aDuration - time : aMillisecondsPerFrame;
+ TInt appendIntervalError = aDelayIntervals.Append( delay );
+ if ( appendIntervalError != KErrNone )
+ {
+ _LIT(msg1, "RenderFrames: Failed to append delay interval to list.");
+ _LIT(msg2, "");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, appendIntervalError,msg1, msg2);
+ break;
+ }
+
+ // Only process one frame for non-animation content
+ if ( !isAnimationContent )
+ {
+ // Set the duration for the whole frame for non-animation
+ if ( aDelayIntervals.Count() > 0 )
+ {
+ aDelayIntervals[0] = aDuration;
+ }
+ break;
+ }
+ }
+ // Cleanup the bitmap
+ delete bitmap;
+ //remove engine from document it is attached to
+ document->SetEngine( NULL );
+ // Delete the engine
+ iSvgDocumentPointers.ResetAndDestroy();
+ iSvgDocumentPointers.Close();
+ CleanupStack::PopAndDestroy(svgEngine);
+ return iSvgError;
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::AddListener(
+// const MSvgListener* aListener,
+// TSvgListenerType aType )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::AddListener(
+ const MSvgListener* aListener,
+ TSvgListenerType aType,
+ TInt aEngine )
+ {
+ if ( aListener == NULL )
+ {
+ return;
+ }
+
+ ChooseEngine( aEngine );
+
+ TInt index = 0;
+ // Loading listeners
+ switch( aType )
+ {
+ case ESvgLoadingListener:
+ index = iSvgLoadingListeners.Find(
+ (MSvgLoadingListener*)aListener );
+ if ( index == KErrNotFound )
+ {
+ iSvgLoadingListeners.Append( (MSvgLoadingListener*)aListener );
+ }
+ break;
+ // Mouse listeners
+ case ESvgMouseListener:
+ if ( iSvgEngine != NULL )
+ {
+ iSvgEngine->AddMouseListener( (MSvgMouseListener*)aListener );
+ }
+ break;
+ case ESvgTextAreaListener:
+ if ( iSvgEngine != NULL )
+ {
+ iSvgEngine->AddTextAreaListener(
+ (MSvgTextAreaListener*)aListener );
+ }
+ break;
+ case ESvgTextListener:
+ if ( iSvgEngine != NULL )
+ {
+ iSvgEngine->AddTextListener( (MSvgTextListener*)aListener );
+ }
+ break;
+ case ESvgViewPortListener:
+ if ( iSvgEngine != NULL )
+ {
+ iSvgEngine->AddViewPortListener(
+ (MSvgViewPortListener*)aListener );
+ }
+ break;
+ case ESvgInteractiveElementListener:
+ if ( iSvgEngine != NULL )
+ {
+ iSvgEngine->AddInteractiveElementListener(
+ (MSvgInteractiveElementListener*)aListener );
+ }
+ break;
+
+
+ default:
+ break;
+ }
+ }
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::RemoveListener( const MSvgListener* aListener, TSvgListenerType aType )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::RemoveListener( const MSvgListener* aListener, TSvgListenerType aType, TInt aEngine )
+ {
+
+ ChooseEngine(aEngine);
+
+ // Loading listeners
+ if ( aType == ESvgLoadingListener )
+ {
+ TInt index = iSvgLoadingListeners.Find( (MSvgLoadingListener*)aListener );
+ if ( index != KErrNotFound )
+ {
+ iSvgLoadingListeners.Remove( index );
+ }
+ }
+ // Mouse listeners
+ else if ( aType == ESvgMouseListener )
+ {
+ if ( iSvgEngine != NULL )
+ {
+ iSvgEngine->RemoveMouseListener( (MSvgMouseListener*)aListener );
+ }
+ }
+ // Text area listeners
+ else if ( aType == ESvgTextAreaListener )
+ {
+ if ( iSvgEngine != NULL )
+ {
+ iSvgEngine->RemoveTextAreaListener( (MSvgTextAreaListener*)aListener );
+ }
+ }
+ else if ( aType == ESvgTextListener )
+ {
+ if ( iSvgEngine != NULL )
+ {
+ iSvgEngine->RemoveTextListener( (MSvgTextListener*)aListener );
+ }
+
+ }
+ else if ( aType == ESvgInteractiveElementListener )
+ {
+ if ( iSvgEngine != NULL )
+ {
+ iSvgEngine->RemoveInteractiveElementListener( (MSvgInteractiveElementListener*)aListener );
+ }
+ }
+ }
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::InitSvgStylePropertiesWithNullL( CSvgElementImpl* aElement )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::InitSvgStylePropertiesWithNullL( CSvgElementImpl* aElement )
+{
+ if ( aElement )
+ {
+ aElement->InitSvgStylePropertiesWithNullL();
+ }
+}
+
+//---------------------------------------------------------------------------=
+// Initialize engine with <svg> information in attached document.
+//---------------------------------------------------------------------------=
+EXPORT_C void CSvgEngineInterfaceImpl::InitializeEngine(
+ CSvgEngineImpl* aEngine,
+ TBool /*aIsMainThread*/ )
+ {
+ if ( ChooseEngine( (TInt)aEngine ) )
+ {
+
+ TRAPD( error, iSvgEngine->InitializeEngineL() );
+ if ( error != KErrNone )
+ {
+ return;
+ }
+
+ iSvgEngine->SetMediaTime( 0 );
+ // pause is so progressive parsing doesnt animate
+ // before everything is there. This could be removed to
+ // load and animate on the fly
+ iSvgEngine->SetSVGEngineState( ESVGEnginePaused );
+
+ }
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetDataRetrievalTimeOut( TUint aTimeoutSeconds )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetDataRetrievalTimeOut( TUint /*aTimeoutSeconds*/, TInt /*aEngine*/ )
+{
+// Function is no more required
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::CancelLoad()
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::CancelLoad( TInt aEngine )
+ {
+ if ( ChooseEngine(aEngine) )
+ {
+ if ( iSvgEngine->Document() )
+ {
+ iSvgEngine->Document()->CancelParsing();
+ }
+ }
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C TBool CSvgEngineInterfaceImpl::IsLoading()
+// ---------------------------------------------------------------------------
+EXPORT_C TBool CSvgEngineInterfaceImpl::IsLoading( TInt aEngine )
+ {
+ if ( ChooseEngine(aEngine) )
+ {
+ if ( iSvgEngine->Document() )
+ {
+ return iSvgEngine->Document()->IsParsing();
+ }
+ }
+
+ return EFalse;
+ }
+
+//---------------------------------------------------------------------------
+//Print all of the elements in the DOM tree and most of their attributes (only works in _DEBUG mode)
+//---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::PrintAllElements( CSvgDocumentImpl* aDocument )
+{
+ if (aDocument)
+ {
+ aDocument->PrintAllElements((CSvgElementImpl*)aDocument->RootElement());
+ }
+ else if (iSvgEngine && iSvgEngine->Document())
+ {
+ iSvgEngine->Document()->PrintAllElements((CSvgElementImpl*) iSvgEngine->Document()->RootElement());
+ }
+}
+
+//---------------------------------------------------------------------------
+//Print all of the styles that the element has access to (only works in _DEBUG mode)
+//---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::PrintElementsStyles( CSvgElementImpl* aElement )
+{
+ if (aElement)
+ {
+ aElement->PrintStyleProperties();
+ }
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::WaitForImages( TBool aBool )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::WaitForImages( TBool /* aBool */, TInt /* aEngine */ )
+ {
+ // Method is obsolete: image loading is synchronous now
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SetClientWindow( RWindow* /*aWindow*/ )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetClientWindow( RWindow* /*aWindow*/ )
+ {
+
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C MSvgError* CSvgEngineInterfaceImpl::SaveSvgDom(TInt aHandle, const TDesC& aFileName)
+// ---------------------------------------------------------------------------
+EXPORT_C MSvgError* CSvgEngineInterfaceImpl::SaveSvgDom(TInt /*aHandle*/, const TDesC& aFileName, TInt aEngine)
+ {
+
+ if (!ChooseEngine(aEngine))
+ {
+ return iSvgError;
+ }
+
+ //UseDom( aHandle, NULL );
+
+ TRAPD(error, iSvgEngine->SaveSvgL(aFileName));
+
+ if (error != KErrNone)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgEngineInterfaceImpl: SaveSvgL threw an exception while saving");
+ #endif
+ }
+
+ return iSvgError;
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::SaveSvg( TBool aIsEncodeOn, const TDesC& aFileName, TInt aEngine )
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SaveSvg( TBool /*aIsEncodeOn*/, const TDesC& /*aFileName*/, TInt aEngine )
+ {
+
+ if (!ChooseEngine(aEngine))
+ {
+
+ }
+
+ //UseDom( aHandle, NULL );
+
+ //TRAPD(error, iSvgEngine->SaveSvgL(aFileName));
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C void SetAudioVolume( TInt aPercentage , TInt aEngine );
+// --------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetAudioVolume( TInt aPercentage ,
+ TInt aEngine )
+ {
+ if ( ChooseEngine(aEngine) )
+ {
+ iSvgEngine->SetAudioVolume( aPercentage );
+ }
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C void MuteAudioVolume();
+// --------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::MuteAudioVolume( TInt aEngine )
+ {
+ if ( ChooseEngine(aEngine) )
+ {
+ iSvgEngine->SetAudioVolume( 0 );
+ }
+ }
+
+// --------------------------------------------------------------------------
+// TInt CSvgEngineInterfaceImpl::ChooseEngine( CSvgEngineImpl* aEngine )
+// ---------------------------------------------------------------------------
+CSvgEngineImpl* CSvgEngineInterfaceImpl::ChooseEngine( TInt aEngine )
+ {
+ if (aEngine)
+ {
+ iSvgEngine = (CSvgEngineImpl*)aEngine;
+ return (CSvgEngineImpl*)aEngine;
+ }
+ else if (iSvgEngine)
+ {
+ return iSvgEngine;
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
+// --------------------------------------------------------------------------
+// EXPORT_C MSvgError* CSvgEngineInterfaceImpl::ChooseViewBox(TInt aDomHandle)
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::ChooseViewBoxIfNotSet(TInt aDomHandle)
+ {
+ if ( IsDomCached( aDomHandle ) )
+ {
+ CSvgDocumentImpl* document = (CSvgDocumentImpl*)aDomHandle;
+ CSvgSvgElementImpl* root = (CSvgSvgElementImpl*)document->RootElement();
+ if ( root )
+ {
+ if(!root->ViewBoxDefined())
+ {
+ // If viewbox is missing in the content, the content
+ // rendering in the frame buffer is many time as expected
+ // Some part of the content can get clipped, since content
+ // doesn't scale proportionately to the framebuffer.
+ TGfxRectangle2D bbox;
+ root->GetUnscaledBBox( bbox );
+ TFloatFixPt lDefault= TFloatFixPt(0);
+ if(bbox.iWidth > lDefault && bbox.iHeight > lDefault)
+ {
+ TRAP_IGNORE( root->SetViewBoxL( bbox ) );
+ }
+ }
+ }
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgEngineInterfaceImpl::ConvertBitmapToFileL(CFbsBitmap* aBitmap, const TDesC& aText)
+//
+// Utility function to dump out the svg engine framebuffer
+// ---------------------------------------------------------------------------
+void CSvgEngineInterfaceImpl::ConvertBitmapToFileL(CFbsBitmap* aBitmap, const TDesC& /*aText*/)
+{
+ //set size for bitmap
+ //if it is new
+ /*TInt aWidth = 200, aHeight = 200;
+
+ aBitmap = new(ELeave)CFbsBitmap();
+ CleanupStack::PushL(aBitmap);
+ User::LeaveIfError(aBitmap->Create(TSize(aWidth, aHeight), EColor64K));
+ */
+
+ //draw text on bitmap here!!
+ /*CFbsBitmapDevice* bitDevice = CFbsBitmapDevice::NewL(aBitmap);
+ CFbsBitGc* bitGc;
+ User::LeaveIfError(bitDevice->CreateContext(bitGc));
+
+ CleanupStack::Pop(aBitmap);
+
+ bitGc->SetPenColor(KRgbBlack);
+ bitGc->UseFont( LatinBold19() ); // a font has to be set otherwise it panics!
+ bitGc->SetPenStyle(CGraphicsContext::ESolidPen);
+ bitGc->DrawText(aText, TPoint(10, 10));
+ */
+
+ RFs fs;
+ User::LeaveIfError( fs.Connect() );
+
+ // constructing encoder
+ CImageEncoder* imgEncoder = CImageEncoder::FileNewL( fs, _L("svg_engine_bitmap.bmp"), _L8("image/bmp"),
+ CImageEncoder::EOptionAlwaysThread );
+
+ // Following settings are for JPG file format
+ // TJpegImageData* imageData = new (ELeave) TJpegImageData;
+ // Set some format specific data
+ // imageData->iSampleScheme = TJpegImageData::EColor444;
+ // imageData->iQualityFactor = 95;
+
+ // Following settings are for BMP file format
+ TBmpImageData* imgData = new(ELeave) TBmpImageData;
+ imgData->iBitsPerPixel = 24;
+
+ CFrameImageData* lFrameImageData = CFrameImageData::NewL();
+
+ // frameData - ownership passed to lFrameImageData after AppendImageData
+ User::LeaveIfError(lFrameImageData->AppendImageData(imgData)); // or append imageData for jpg file
+
+ // Do the convert
+ TRequestStatus iRequesStatus;
+ imgEncoder->Convert( &iRequesStatus, *aBitmap, lFrameImageData);
+ User::WaitForRequest( iRequesStatus );
+
+ fs.Close();
+ delete lFrameImageData;
+ //delete aBitmap;
+ delete imgEncoder;
+ //delete bitGc;
+ //delete bitDevice;
+}
+
+// --------------------------------------------------------------------------
+// EXPORT_C void CSvgEngineInterfaceImpl::ResetContext( TInt aEngine )
+// --------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::ResetContext( TInt aEngine )
+{
+ if ( ChooseEngine((TInt)aEngine) )
+ {
+ iSvgEngine->ResetContext();
+ }
+}
+
+
+EXPORT_C void CSvgEngineInterfaceImpl::Start(MSvgError*& aError, const TDesC8* aHeaderData ,
+ CSvgEngineImpl* aEngine )
+ {
+ if (aHeaderData)
+ {
+ iSvgEngine->SetBitmapHeader((const TDesC16 *)aHeaderData);
+ }
+ Start(aError, aEngine);
+ }
+
+EXPORT_C void CSvgEngineInterfaceImpl::Start( const TDesC8* aHeaderData, CSvgEngineImpl* aEngine,
+ TBool aIsMainThread)
+ {
+
+ if (aHeaderData)
+ {
+ iSvgEngine->SetBitmapHeader((const TDesC16 *)aHeaderData);
+ }
+ Start(aEngine, aIsMainThread);
+ }
+// Get the NVG-TLV data
+// --------------------------------------------------------------------------
+// EXPORT_C TPtr CSvgEngineInterfaceImpl::TLVEncodedData()
+// ---------------------------------------------------------------------------
+EXPORT_C const TPtrC8 CSvgEngineInterfaceImpl::TLVEncodedData() const
+ {
+ return (iSvgEngine->TLVEncodedData());
+ }
+//NGA
+// --------------------------------------------------------------------------
+// EXPORT_C MSvgError* CSvgEngineInterfaceImpl::UseDom(TInt aHandle, TSize aRenderBufferSize,TDisplayMode aRenderDisplayMode,TDisplayMode aMaskDisplayMode,TInt aEngine = NULL)
+// ---------------------------------------------------------------------------
+EXPORT_C MSvgError* CSvgEngineInterfaceImpl::UseDom(TInt aHandle,CFbsBitmap* aRenderBuffer, CFbsBitmap* aMaskBuffer,TSize aRenderBufferSize,TDisplayMode aRenderDisplayMode,TDisplayMode aMaskDisplayMode,TInt aEngine)
+ {
+ // Clear Error
+ iSvgError->SetErrorCode( ESvgNoError );
+
+ // Check for engine: Should not occur
+ if( !ChooseEngine( aEngine ) )
+ {
+ _LIT(KEngineFailed, "SvgEngine Internal Failure: SvgEngineImpl not present.");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, KErrNone,
+ KEngineFailed, KNullDesC );
+ return iSvgError;
+ }
+
+ // Check for valid DOM
+ if( !IsDomCached( aHandle ) )
+ {
+ _LIT(KEngineFailed, "Invalid DOM, Use Prepare() to create DOM");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, KErrNone,
+ KEngineFailed, KNullDesC );
+ return iSvgError;
+ }
+
+ iTotalRotation = 0;
+
+ iFileIsLoaded = EFalse;
+
+ // Switch GDI context
+ TRAPD( gdiError, iSvgEngine->SetGdiContextL( aRenderBuffer, aMaskBuffer,aRenderBufferSize,aRenderDisplayMode,aMaskDisplayMode ) );//Modify this setgdi context
+ if ( gdiError != KErrNone )
+ {
+ if ( gdiError == KErrNoMemory )
+ {
+ _LIT(KEngineGDIFailed, "SVG Engine Set Gdi Context Failed");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgNoMemory, KErrNoMemory,
+ KEngineGDIFailed, KNullDesC );
+ return iSvgError;
+ }
+ _LIT(KEngineGDIFailed, "SVG Engine Set Gdi Context Failed");
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, KErrNone,
+ KEngineGDIFailed, KNullDesC );
+ return iSvgError;
+ }
+
+ CSvgDocumentImpl* document = (CSvgDocumentImpl*)aHandle;
+
+ CSvgDocumentImpl* lExistDoc = iSvgEngine->Document();
+
+ if (lExistDoc != document)
+ {
+ //this is a new document so swap it out...
+ iSvgEngine->SetDocument( document );
+ document->SetEngine( iSvgEngine );
+ document->ReInitialize();
+ }
+
+ if (lExistDoc == iSvgLoadedDocument)
+ {
+ DestroyDocument(iSvgLoadedDocument);
+ iSvgLoadedDocument = NULL;
+ }
+
+ // Check for thumbnail restrictions
+ if ( !iSvgEngine->PassesThumbNailRestriction() )
+ {
+ _LIT( KThumbNailRestriction, "Frame buffer is larger than allowable size for thumbnail mode." );
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgThumbNailRestriction, KErrNone,
+ KThumbNailRestriction, KNullDesC );
+ return iSvgError;
+ }
+
+ iFileIsLoaded = ETrue;
+
+ return iSvgError;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/src/SVGEngineMain.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,19 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine source file
+ *
+*/
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/src/SVGErrorImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,172 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine source file
+ *
+*/
+
+
+#include "SVGErrorImpl.h"
+
+
+// ---------------------------------------------------------------------------
+// Two-phase constructor
+// ---------------------------------------------------------------------------
+CSvgErrorImpl* CSvgErrorImpl::NewL()
+ {
+ CSvgErrorImpl* self = NewLC();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Two-phase constructor
+// ---------------------------------------------------------------------------
+CSvgErrorImpl* CSvgErrorImpl::NewLC()
+ {
+ CSvgErrorImpl* self = new ( ELeave ) CSvgErrorImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+CSvgErrorImpl::~CSvgErrorImpl()
+ {
+ if(iDescription)
+ {
+ delete iDescription;
+ iDescription = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// return Etrue if an error is indicated by this object.
+// ---------------------------------------------------------------------------
+TBool CSvgErrorImpl::HasError()
+{
+ return iErrorCode != ESvgNoError;
+}
+
+// ---------------------------------------------------------------------------
+// return Etrue if the error indicated by this object is only a warning.
+// ---------------------------------------------------------------------------
+TBool CSvgErrorImpl::IsWarning()
+{
+ return iIsWarning;
+}
+
+// ---------------------------------------------------------------------------
+// Set the state that the error indicated by this object is only a warning.
+// ---------------------------------------------------------------------------
+void CSvgErrorImpl::SetIsWarning( TBool aBool )
+{
+ iIsWarning = aBool;
+}
+
+// ---------------------------------------------------------------------------
+// Get the error code.
+// ---------------------------------------------------------------------------
+TSvgErrorCode CSvgErrorImpl::ErrorCode()
+{
+ return iErrorCode;
+}
+
+// ---------------------------------------------------------------------------
+// Set the error code.
+// ---------------------------------------------------------------------------
+void CSvgErrorImpl::SetErrorCode( TSvgErrorCode aErrorCode )
+{
+ iErrorCode = aErrorCode;
+}
+// ---------------------------------------------------------------------------
+// Get the error description.
+// ---------------------------------------------------------------------------
+TDesC& CSvgErrorImpl::Description()
+{
+ return *iDescription;
+}
+
+// ---------------------------------------------------------------------------
+// Set the given string as the description
+// ---------------------------------------------------------------------------
+void CSvgErrorImpl::SetDescription( const TDesC& aDescription )
+{
+ delete iDescription;
+ iDescription = NULL;
+ TRAPD( error, iDescription = aDescription.AllocL() );
+ if ( error != KErrNone )
+ {
+ // ignore trap error
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Set the given strings as the description
+// ---------------------------------------------------------------------------
+void CSvgErrorImpl::SetDescription( const TDesC& aText1, const TDesC& aText2 )
+{
+ delete iDescription;
+ iDescription = NULL;
+ TRAPD( error, iDescription = HBufC::NewL( aText1.Length() + aText2.Length() ) );
+ if ( error == KErrNone )
+ {
+ iDescription->Des().Append( aText1 );
+ iDescription->Des().Append( aText2 );
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Append the given string to the description
+// ---------------------------------------------------------------------------
+void CSvgErrorImpl::AppendDescription( const TDesC& aDescription )
+{
+ iDescription = iDescription->ReAlloc( iDescription->Length() + aDescription.Length() );
+ iDescription->Des().Append( aDescription );
+}
+
+TInt CSvgErrorImpl::SystemErrorCode()
+{
+ return iSystemErrorCode;
+}
+
+void CSvgErrorImpl::SetSystemErrorCode( TInt aErrorCode )
+{
+ iSystemErrorCode = aErrorCode;
+}
+
+// ---------------------------------------------------------------------------
+// Second phase of construction
+// ---------------------------------------------------------------------------
+void CSvgErrorImpl::ConstructL()
+{
+ iDescription = HBufC::NewL( 1 );
+}
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+CSvgErrorImpl::CSvgErrorImpl()
+{
+ SetIsWarning( ETrue );
+ SetErrorCode( ESvgNoError );
+ SetSystemErrorCode( KErrNone );
+}
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/src/SVGEvent.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,336 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine source file
+ *
+*/
+
+
+#include "SVGEvent.h"
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// Initialized with x, y coordinates info and event type
+// ---------------------------------------------------------------------------
+TSvgUiMouseEvent::TSvgUiMouseEvent( TSvgEngineEventType aEtype, TFloatFixPt aX, TFloatFixPt aY ) :
+ iEtype( aEtype ), iX( aX ), iY( aY )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TUint8 TSvgUiMouseEvent::EventMask()
+ {
+ return KSvgEventMaskExternalUI;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the event type
+// ---------------------------------------------------------------------------
+TSvgEngineEventType TSvgUiMouseEvent::EventType()
+ {
+ return iEtype;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for x coordinate
+// ---------------------------------------------------------------------------
+TFloatFixPt TSvgUiMouseEvent::X()
+ {
+ return iX;
+ }
+// ---------------------------------------------------------------------------
+// Accessor for y coordinate
+// ---------------------------------------------------------------------------
+TFloatFixPt TSvgUiMouseEvent::Y()
+ {
+ return iY;
+ }
+
+/*********************************************/
+// ---------------------------------------------------------------------------
+// Constructor
+// Initialized for the key code
+// ---------------------------------------------------------------------------
+TSvgUiKeyEvent::TSvgUiKeyEvent( TUint32 aKeyCode ) : iKeyCode( aKeyCode )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the event mask
+// ---------------------------------------------------------------------------
+TUint8 TSvgUiKeyEvent::EventMask()
+ {
+ return KSvgEventMaskExternalUI;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the event type
+// ---------------------------------------------------------------------------
+TSvgEngineEventType TSvgUiKeyEvent::EventType()
+ {
+ return ESvgEngineEventKeyPress;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the key code of this event
+// ---------------------------------------------------------------------------
+TUint32 TSvgUiKeyEvent::KeyCode()
+ {
+ return iKeyCode;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the time of the event
+// ---------------------------------------------------------------------------
+TInt32 TSvgUiKeyEvent::Time()
+ {
+ return iTime;
+ }
+
+// ---------------------------------------------------------------------------
+// Set accessor for the time of the event
+// ---------------------------------------------------------------------------
+void TSvgUiKeyEvent::SetTime( TInt32 aTime )
+ {
+ iTime = aTime;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the begin time of the event
+// ---------------------------------------------------------------------------
+TInt32 TSvgUiKeyEvent::BeginTime()
+ {
+ return iBeginTime;
+ }
+
+// ---------------------------------------------------------------------------
+// Set accessor for the begin time of the event
+// ---------------------------------------------------------------------------
+void TSvgUiKeyEvent::SetBeginTime( TInt32 aTime )
+ {
+ iBeginTime = aTime;
+ }
+
+/**********************************************/
+// ---------------------------------------------------------------------------
+// Constructor
+// Initialized for the time of the event
+// ---------------------------------------------------------------------------
+TSvgTimerEventPrep::TSvgTimerEventPrep( TUint32 aTime ) : iTime( aTime )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the event mask
+// ---------------------------------------------------------------------------
+TUint8 TSvgTimerEventPrep::EventMask()
+ {
+ return KSvgEventMaskTimer;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the event type
+// ---------------------------------------------------------------------------
+TSvgEngineEventType TSvgTimerEventPrep::EventType()
+ {
+ return ESvgEngineEventTimerPrep;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the time of the event
+// ---------------------------------------------------------------------------
+TUint32 TSvgTimerEventPrep::Time()
+ {
+ return (TUint32) iTime;
+ }
+
+/*********************************************/
+
+// ---------------------------------------------------------------------------
+// Constructor
+// Initialized for the time span of the event
+// ---------------------------------------------------------------------------
+TSvgTimerEvent::TSvgTimerEvent( TUint32 aTime ) : iTime( aTime )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the event mask
+// ---------------------------------------------------------------------------
+TUint8 TSvgTimerEvent::EventMask()
+ {
+ return KSvgEventMaskTimer;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the event type
+// ---------------------------------------------------------------------------
+TSvgEngineEventType TSvgTimerEvent::EventType()
+ {
+ return ESvgEngineEventTimer;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the time of the event
+// ---------------------------------------------------------------------------
+TUint32 TSvgTimerEvent::Time()
+ {
+ return (TUint32)iTime;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Accessor for the time of the event
+// ---------------------------------------------------------------------------
+void TSvgTimerEvent::SetTime(TInt32 aTime)
+ {
+ iTime = aTime;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Accessor for the begin time of the event
+// ---------------------------------------------------------------------------
+TInt32 TSvgTimerEvent::BeginTime()
+ {
+ return iBeginTime;
+ }
+
+// ---------------------------------------------------------------------------
+// Set accessor for the begin time of the event
+// ---------------------------------------------------------------------------
+void TSvgTimerEvent::SetBeginTime( TInt32 aTime )
+ {
+ iBeginTime = aTime;
+ }
+
+
+/*********************************************/
+
+// ---------------------------------------------------------------------------
+// Constructor
+// Initialized with the event and the SVG element that is registered for this
+// event
+// ---------------------------------------------------------------------------
+TSvgInternalEvent::TSvgInternalEvent( TSvgEvent aEvent, CSvgElementImpl* aElement ) :
+ iEvent( aEvent ),
+ iElement( aElement ),
+ IsUserSeek( EFalse)
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// Initialized with the event, the SVG element that is registered for this
+// event and the eventtime
+// For SetMediaTime implementation.
+// ---------------------------------------------------------------------------
+TSvgInternalEvent::TSvgInternalEvent( TSvgEvent aEvent, CSvgElementImpl* aElement, TInt32 aTime ) :
+ iEvent( aEvent ),
+ iElement( aElement ),
+ iTime(aTime),
+ IsUserSeek(ETrue)
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// is the event generated in a user seek
+// ---------------------------------------------------------------------------
+TBool TSvgInternalEvent::UserSeek()
+ {
+ return IsUserSeek;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the event mask
+// ---------------------------------------------------------------------------
+TUint8 TSvgInternalEvent::EventMask()
+ {
+ return KSvgEventMaskInternal;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the event type
+// ---------------------------------------------------------------------------
+TSvgEngineEventType TSvgInternalEvent::EventType()
+ {
+ return ESvgEngineInternalEvent;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the registered object (a SVG element)
+// ---------------------------------------------------------------------------
+CSvgElementImpl* TSvgInternalEvent::ObjectAddress()
+ {
+ return iElement;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the SVG Event
+// ---------------------------------------------------------------------------
+TSvgEvent TSvgInternalEvent::SvgEvent()
+ {
+ return iEvent;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the time of the event
+// ---------------------------------------------------------------------------
+TInt32 TSvgInternalEvent::Time()
+ {
+ return iTime;
+ }
+
+// ---------------------------------------------------------------------------
+// Set accessor for the time of the event
+// ---------------------------------------------------------------------------
+void TSvgInternalEvent::SetTime( TInt32 aTime )
+ {
+ iTime = aTime;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the begin time of the event
+// ---------------------------------------------------------------------------
+TInt32 TSvgInternalEvent::BeginTime()
+ {
+ return iBeginTime;
+ }
+
+// ---------------------------------------------------------------------------
+// Set accessor for the begin time of the event
+// ---------------------------------------------------------------------------
+void TSvgInternalEvent::SetBeginTime( TInt32 aTime )
+ {
+ iBeginTime = aTime;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the event mask
+// ---------------------------------------------------------------------------
+TUint8 TSvgScreenUpdateEvent::EventMask()
+ {
+ return KSvgEventMaskNone;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the event type
+// ---------------------------------------------------------------------------
+TSvgEngineEventType TSvgScreenUpdateEvent::EventType()
+ {
+ return ESvgEngineEventScreenUpdate;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/src/SVGEventHandler.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,690 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine source file
+ *
+*/
+
+
+#include "SVGEventHandler.h"
+#include "SVGEventReceiver.h"
+
+#include "SVGElementImpl.h"
+#include "SVGListener.h"
+#include "SVGAnimationBase.h"
+// ---------------------------------------------------------------------------
+// Two phase constructor
+// ---------------------------------------------------------------------------
+CSvgEventHandler* CSvgEventHandler::NewLC()
+ {
+ CSvgEventHandler* self = new ( ELeave ) CSvgEventHandler();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+//
+// ---------------------------------------------------------------------------
+// Two phase constructor
+// ---------------------------------------------------------------------------
+CSvgEventHandler* CSvgEventHandler::NewL()
+ {
+ CSvgEventHandler* self = NewLC();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Private method to build heap objects
+// ---------------------------------------------------------------------------
+void CSvgEventHandler::ConstructL()
+ {
+ iEventReceiverList = new ( ELeave ) CArrayFixFlat<TEventReceiverListItem>( 20 );
+ }
+
+//
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+CSvgEventHandler::CSvgEventHandler() : iInProcess( 0 ), iCurrentTime( 0 )
+ {
+ }
+
+//
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+CSvgEventHandler::~CSvgEventHandler()
+ {
+ if ( iEventReceiverList )
+ {
+ delete iEventReceiverList;
+ iEventReceiverList = NULL;
+ }
+ }
+
+
+
+// --------------------------------------------------------------------------
+// void CSvgEventHandler::Reset()
+// Reset the status of the event handler and all the event receivers
+// ---------------------------------------------------------------------------
+void CSvgEventHandler::Reset()
+ {
+ // Need to wait if other thread is changing tree.
+ if( iEventReceiverList )
+ {
+ iEventReceiverList->Reset();
+ }
+ }
+
+//
+// --------------------------------------------------------------------------
+// TBool CSvgEventHandler::ProcessEventL( MSvgEvent* aEvent )
+// Process events received from the client
+// ---------------------------------------------------------------------------
+TBool CSvgEventHandler::ProcessEventL( MSvgEvent* aEvent )
+ {
+ TBool redrawNeeded = EFalse;
+ if ( aEvent->EventType() == ESvgEngineEventScreenUpdate )
+ return ETrue; // No element will recieve this event
+
+ if ( iEventReceiverList->Count() <= 0 )
+ return redrawNeeded; // No receiver is available
+
+ // Timer event
+ if ( aEvent->EventType() == ESvgEngineEventTimer )
+ {
+ // Update current time
+ iCurrentTime = ( ( MSvgTimerEvent * ) aEvent )->Time();
+ // call reset-reference-element to animation elements
+ TInt eventReceiverListCnt = iEventReceiverList->Count();
+ for ( TInt j = 0; j < eventReceiverListCnt; j++ )
+ {
+ if ( !(( *iEventReceiverList )[j].iWasDeleted) && 0 !=
+ ( aEvent->EventMask() |
+ ( *iEventReceiverList )[j].iEventMask ) )
+ {
+ if( (*iEventReceiverList )[j].iTargetElement )
+ {
+ (*iEventReceiverList )[j].iTargetElement->ResetReferenceAttrSet();
+ }
+
+ }
+ }
+ eventReceiverListCnt = iEventReceiverList->Count();
+ for ( TInt i = 0; i < eventReceiverListCnt; i++ )
+ {
+ if ( !(( *iEventReceiverList )[i].iWasDeleted) && 0 !=
+ ( aEvent->EventMask() |
+ ( *iEventReceiverList )[i].iEventMask ) )
+ {
+ ( *iEventReceiverList )[i].iElement->ResetReferenceElementL();
+ }
+ }
+ }
+ // Internal event & key event need time to be added
+ if ( aEvent->EventType() == ESvgEngineInternalEvent &&
+ ! (( MSvgInternalEvent * )aEvent)->UserSeek() )
+ {
+ ( ( MSvgInternalEvent * ) aEvent )->SetTime( iCurrentTime );
+ }
+ if ( aEvent->EventType() == ESvgEngineEventKeyPress )
+ {
+ ( ( MSvgUiKeyEvent * ) aEvent )->SetTime( iCurrentTime );
+ }
+
+ // Sending events to elements
+ for ( TInt i = 0; i < iEventReceiverList->Count(); i++ )
+ {
+ if ( !(( *iEventReceiverList )[i].iWasDeleted) && 0 !=
+ ( aEvent->EventMask() | ( *iEventReceiverList )[i].iEventMask ) )
+ {
+ // Send event to list[i].iElement
+
+ //check if the subeventmask is some valid bits set
+ if( IsValidSubEventMask(( *iEventReceiverList )[i].iSubEventMask))
+ {
+ if(
+ ( *iEventReceiverList )[i].iElement->
+ ReceiveEventL(aEvent,
+ ( *iEventReceiverList )[i].iSubEventMask ) )
+ {
+ redrawNeeded=ETrue;
+ }
+
+ }
+ else if ( ( *iEventReceiverList )[i].iElement->ReceiveEventL( aEvent) )
+ redrawNeeded = ETrue;
+
+ }
+ }
+
+ ClearNullsFromEventReceiverList();
+
+ return redrawNeeded;
+ }
+
+// -------------------------------------------------------------------------
+// TBool IsValidSubEventMask(TUint16 aSubEventMask)
+//
+// Checks whether aSubEventMask contains some valid bits set for
+// interactive events
+//
+// Returns: True if any valid bit is set else false.
+//
+// --------------------------------------------------------------------------
+TBool CSvgEventHandler::IsValidSubEventMask(TUint16 aSubEventMask)
+ {
+ TUint16 temp=0x1FF;
+ temp=temp&aSubEventMask;
+ if(temp==aSubEventMask)
+ {
+ return ETrue;
+ }
+ else
+ {
+ return EFalse;
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgEventHandler::AddToEventReceiverListL( MSvgEventReceiver* aElement,
+//
+// AddToEventReceiverListL: Add an object to the list of objects that are
+// notified of an event.
+//
+// Returns: none
+//
+// ---------------------------------------------------------------------------
+void CSvgEventHandler::AddToEventReceiverListL( MSvgEventReceiver* aElement,
+ TUint8 aEventMask,
+ TUint32 aBeginTime,
+ TUint32 aEndTime)
+ {
+ // check to see if receiver is already in list and simply return
+ TInt eventReceiverListCnt = iEventReceiverList->Count();
+ for ( TInt i = 0; i < eventReceiverListCnt; i++ )
+ {
+ if ( !(( *iEventReceiverList )[i].iWasDeleted) && (*iEventReceiverList)[i].iElement == aElement )
+ {
+ return;
+ }
+ }
+
+ TEventReceiverListItem listitem;
+ listitem.iSubEventMask=0xFFFF;
+ listitem.iElement = aElement;
+ listitem.iEventMask = aEventMask;
+ listitem.iAbsoluteEnd = aEndTime;
+ listitem.iTargetElement = NULL;
+ listitem.iBeginTime = aBeginTime;
+ listitem.iWasDeleted = 0;
+ iEventReceiverList->AppendL( listitem );
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgEventHandler::AddToEventReceiverListL( MSvgEventReceiver* aElement,
+//
+// AddToEventReceiverListL: Add an object to the list of objects that are
+// notified of an event.
+//
+// Returns: none
+//
+// ---------------------------------------------------------------------------
+void CSvgEventHandler::AddToEventReceiverListL( MSvgEventReceiver* aElement,
+ TSvgEvent aEvent,
+ TUint8 aEventMask,
+ TUint32 aBeginTime,
+ TUint32 aEndTime)
+ {
+ TEventReceiverListItem listitem;
+ listitem.iElement = aElement;
+ listitem.iSubEventMask=0xFFFF;
+ TSvgInteractionEvent lsubeventtype;
+ switch(aEvent)
+ {
+ case ESvgEventFocusin:
+ lsubeventtype=ESvgInteractiveEventFocusin;
+ break;
+
+ case ESvgEventFocusout:
+ lsubeventtype=ESvgInteractiveEventFocusout;
+ break;
+
+ case ESvgEventActivate:
+ lsubeventtype=ESvgInteractiveEventActivate;
+ break;
+
+ case ESvgEventClick:
+ lsubeventtype=ESvgInteractiveEventClick;
+ break;
+
+ case ESvgEventMousedown:
+ lsubeventtype=ESvgInteractiveEventMousedown;
+ break;
+
+ case ESvgEventMouseup:
+ lsubeventtype=ESvgInteractiveEventMouseup;
+ break;
+
+ case ESvgEventMouseover:
+ lsubeventtype=ESvgInteractiveEventMouseover;
+ break;
+
+ case ESvgEventMousemove:
+ lsubeventtype=ESvgInteractiveEventMousemove;
+ break;
+
+ case ESvgEventMouseout:
+ lsubeventtype=ESvgInteractiveEventMouseout;
+ break;
+
+ default:
+ lsubeventtype=(TSvgInteractionEvent)0;
+ break;
+ }
+ // check to see if receiver is already in list and just update the
+ // iSubEventMask and return
+ TInt eventReceiverListCnt = iEventReceiverList->Count();
+ for ( TInt i = 0; i < eventReceiverListCnt; i++ )
+ {
+ if ( !(( *iEventReceiverList )[i].iWasDeleted) && (*iEventReceiverList)[i].iElement == aElement )
+ {
+
+ (*iEventReceiverList)[i].iSubEventMask=
+ ( *iEventReceiverList)[i].iSubEventMask | lsubeventtype;
+
+ return;
+ }
+ }
+ listitem.iSubEventMask=listitem.iSubEventMask & lsubeventtype;
+ listitem.iEventMask = aEventMask;
+ listitem.iAbsoluteEnd = aEndTime;
+ listitem.iTargetElement = NULL;
+ listitem.iBeginTime = aBeginTime;
+ listitem.iWasDeleted = 0;
+ iEventReceiverList->AppendL( listitem );
+ }
+// --------------------------------------------------------------------------
+// TUint16 CSvgEventHandler::CheckInteractivityAndGetSubEventMask
+// (CSvgElementImpl* aElement,
+//
+// CheckInteractivityAndGetSubEventMask: Check whether the element
+// is interactive or not and get the iSubEventmask
+//
+// Returns: ETrue if interactive else False
+//
+// ---------------------------------------------------------------------------
+TBool CSvgEventHandler::CheckInteractivityAndGetSubEventMask(
+ CSvgElementImpl* aElement, TUint16& aSubEventMask )
+ {
+ TInt eventReceiverListCnt = iEventReceiverList->Count();
+ for ( TInt i = 0; i < eventReceiverListCnt; i++ )
+ {
+ if((*iEventReceiverList)[i].iElement==aElement &&
+ IsValidSubEventMask((*iEventReceiverList)[i].iSubEventMask) )
+ {
+ aSubEventMask=(*iEventReceiverList)[i].iSubEventMask;
+ return ETrue;
+ }
+ }
+ return EFalse;
+ }
+
+// --------------------------------------------------------------------------
+// TUint8 CSvgEventHandler::EventMask(MSvgEventReceiver* aElement)
+// EventMask: Return the event mask of the registered element
+//
+// Returns: TUnit8, the event mask
+//
+// ---------------------------------------------------------------------------
+TUint8 CSvgEventHandler::EventMask(MSvgEventReceiver* aElement)
+ {
+
+ TInt eventReceiverListCnt = iEventReceiverList->Count();
+ for ( TInt i = 0; i < eventReceiverListCnt; i++ )
+ {
+ if ( !(( *iEventReceiverList )[i].iWasDeleted) && (*iEventReceiverList)[i].iElement == aElement )
+ {
+ return (*iEventReceiverList)[i].iEventMask;
+ }
+ }
+ return 0;
+ }
+
+
+
+//
+// --------------------------------------------------------------------------
+// void CSvgEventHandler::RemoveFromEventReceiverList( MSvgEventReceiver* aElement )
+// Remove an object to the list of objects that are notified of an event
+// ---------------------------------------------------------------------------
+void CSvgEventHandler::RemoveFromEventReceiverList( MSvgEventReceiver* aElement )
+ {
+ TInt eventReceiverListCnt = iEventReceiverList->Count();
+ for ( TInt i = 0; i < eventReceiverListCnt; i++ )
+ {
+ if ( !(( *iEventReceiverList )[i].iWasDeleted) && (*iEventReceiverList)[i].iElement == aElement )
+ {
+ //just setting to NULL for now because this could be called inside of ReceiveEvent
+ //loop that already has the iEventReceiverList count.
+
+ (*iEventReceiverList)[i].iWasDeleted = 1;
+ //iEventReceiverList->Delete( i );
+ break;
+ }
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgEventHandler::ClearNullsFromEventReceiverList( )
+// Remove a null object
+// ---------------------------------------------------------------------------
+void CSvgEventHandler::ClearNullsFromEventReceiverList()
+ {
+ TInt eventReceiverListCnt = iEventReceiverList->Count();
+ for ( TInt i = 0; i < eventReceiverListCnt; i++ )
+ {
+ if ( (*iEventReceiverList)[i].iWasDeleted )
+ {
+ iEventReceiverList->Delete( i );
+ i = i - 1;
+ eventReceiverListCnt = eventReceiverListCnt - 1;
+ }
+ }
+ }
+
+
+// --------------------------------------------------------------------------
+// void CSvgEventHandler::AddEventBeginTime(MSvgEventReceiver* aElement, TUint32 aTime, MSvgEventReceiver* aTargetElement )
+// Provide the event end time information to the Event Handler
+// ---------------------------------------------------------------------------
+void CSvgEventHandler::AddEventBeginTime(MSvgEventReceiver* aElement, TUint32 aTime, MSvgEventReceiver* aTargetElement )
+ {
+
+ TInt eventReceiverListCnt = iEventReceiverList->Count();
+ for ( TInt i = 0; i < eventReceiverListCnt; i++ )
+ {
+ if( !(( *iEventReceiverList )[i].iWasDeleted) && aElement == iEventReceiverList->operator[](i).iElement && (iEventReceiverList->operator[](i).iEventMask == KSvgEventMaskTimer ))
+ {
+ iEventReceiverList->operator[](i).iBeginTime = aTime;
+ iEventReceiverList->operator[](i).iTargetElement = aTargetElement;
+ break;
+ }
+ }
+ }
+// --------------------------------------------------------------------------
+// TInt32 CSvgEventHandler::Count()
+// gives the number of elements in the eent receiver list
+// ---------------------------------------------------------------------------
+TInt32 CSvgEventHandler::Count()
+ {
+ if(!iEventReceiverList) return 0;
+ return iEventReceiverList->Count();
+ }
+// --------------------------------------------------------------------------
+// void CSvgEventHandler::SortEventList()
+// An internal method that sorts the events in a time scale
+// ---------------------------------------------------------------------------
+void CSvgEventHandler::SortEventList()
+ {
+
+ ClearNullsFromEventReceiverList();
+
+ // this algorithm is slighlty modified to use insertion sort.
+ TInt i, j, tmpItemIndex;
+ TInt eventReceiverListCnt = iEventReceiverList->Count();
+ for (i=1; i < eventReceiverListCnt; i++)
+ {
+
+ TEventReceiverListItem tmpitem;
+ j = i;
+ tmpitem.iElement = iEventReceiverList->operator[](i).iElement;
+ tmpitem.iEventMask = iEventReceiverList->operator[](i).iEventMask;
+ tmpitem.iAbsoluteEnd = iEventReceiverList->operator[](i).iAbsoluteEnd;
+ tmpitem.iTargetElement = iEventReceiverList->operator[](i).iTargetElement;
+ tmpitem.iBeginTime = iEventReceiverList->operator[](i).iBeginTime;
+ tmpitem.iWasDeleted = iEventReceiverList->operator[](i).iWasDeleted;
+ tmpItemIndex = i;
+
+ while (j > 0)
+ {
+ if( (tmpitem.iTargetElement == iEventReceiverList->operator[](j-1).iTargetElement ) &&
+ (tmpitem.iEventMask == iEventReceiverList->operator[](j-1).iEventMask) )
+
+
+ {
+ if(tmpitem.iBeginTime <
+ iEventReceiverList->operator[](j-1).iBeginTime)
+ {
+
+ iEventReceiverList->operator[](tmpItemIndex).iElement = iEventReceiverList->operator[](j-1).iElement;
+ iEventReceiverList->operator[](tmpItemIndex).iEventMask = iEventReceiverList->operator[](j-1).iEventMask;
+ iEventReceiverList->operator[](tmpItemIndex).iAbsoluteEnd = iEventReceiverList->operator[](j-1).iAbsoluteEnd;
+ iEventReceiverList->operator[](tmpItemIndex).iTargetElement = iEventReceiverList->operator[](j-1).iTargetElement;
+ iEventReceiverList->operator[](tmpItemIndex).iBeginTime = iEventReceiverList->operator[](j-1).iBeginTime;
+ tmpItemIndex = j-1;
+ j = j - 1;
+ }
+ else
+ {
+ break;
+ }
+ }
+ else
+ {
+ j--;
+ }
+ }
+ iEventReceiverList->operator[](tmpItemIndex).iElement = tmpitem.iElement;
+ iEventReceiverList->operator[](tmpItemIndex).iEventMask = tmpitem.iEventMask;
+ iEventReceiverList->operator[](tmpItemIndex).iAbsoluteEnd = tmpitem.iAbsoluteEnd;
+ iEventReceiverList->operator[](tmpItemIndex).iTargetElement = tmpitem.iTargetElement;
+ iEventReceiverList->operator[](tmpItemIndex).iBeginTime = tmpitem.iBeginTime;
+
+ }
+
+ }
+
+
+// ---------------------------------------------------------------------------
+// returns the next (or prev) focussable object starting with a given index
+// search wraps around to start or end
+// ---------------------------------------------------------------------------
+MSvgEventReceiver* CSvgEventHandler::GetEventReceiver( TInt32 aIndex, TBool aNext, TUint8 aMask, TInt32& aNewIndex )
+ {
+ // Check underflow
+ if ( aIndex < 0 || !iEventReceiverList->Count() )
+ {
+ return NULL;
+ }
+
+ // This will ensure we loop around to start
+ if( aIndex >= iEventReceiverList->Count() )
+ {
+ aIndex = iEventReceiverList->Count() - 1;
+ }
+
+ // Search forward or backward
+ if( aNext )
+ {
+ while( aIndex < iEventReceiverList->Count() )
+ {
+ if( !(( *iEventReceiverList )[aIndex].iWasDeleted) && iEventReceiverList->operator[]( aIndex ).iEventMask & aMask )
+ {
+ aNewIndex = aIndex;
+ return iEventReceiverList->operator[]( aIndex ).iElement;
+ }
+
+ aIndex++;
+ }
+ }
+ else
+ {
+ while( aIndex >= 0 )
+ {
+ if( !(( *iEventReceiverList )[aIndex].iWasDeleted) && iEventReceiverList->operator[]( aIndex ).iEventMask & aMask )
+ {
+ aNewIndex = aIndex;
+ return iEventReceiverList->operator[]( aIndex ).iElement;
+ }
+
+ aIndex--;
+ }
+ }
+
+ return NULL;
+ }
+// --------------------------------------------------------------------------
+// void CSvgEventHandler::Reset(MSvgEvent* aEvent)
+// ---------------------------------------------------------------------------
+void CSvgEventHandler::Reset(MSvgEvent* aEvent)
+ {
+
+ this->DeactivateAnimations();
+
+ TInt eventReceiverListCnt = iEventReceiverList->Count();
+ for ( TInt j = 0; j < eventReceiverListCnt; j++ )
+ {
+ if ( !(( *iEventReceiverList )[j].iWasDeleted) && 0 !=
+ ( aEvent->EventMask() |
+ ( *iEventReceiverList )[j].iEventMask ) )
+ {
+ if( (*iEventReceiverList )[j].iTargetElement )
+ {
+ (*iEventReceiverList )[j].iTargetElement->ResetReferenceAttrSet();
+ }
+
+ }
+ }
+
+ eventReceiverListCnt = iEventReceiverList->Count();
+ for ( TInt i = 0; i < eventReceiverListCnt; i++ )
+ {
+ if (!(( *iEventReceiverList )[i].iWasDeleted))
+ {
+ // Send event to list[i].iElement
+ ( *iEventReceiverList )[i].iElement->Reset( aEvent );
+ }
+
+ if (iEventReceiverList->Count() != eventReceiverListCnt)
+ {
+ //get a new count because the list changed size in the reset call above
+ eventReceiverListCnt = iEventReceiverList->Count();
+ //start back over at zero so we make sure all elements get their reset called
+ i = 0;
+ }
+ }
+}
+
+// --------------------------------------------------------------------------
+// void CSvgEventHandler::ReInitialize()
+// ---------------------------------------------------------------------------
+void CSvgEventHandler::ReInitialize()
+ {
+ TInt eventReceiverListCnt = iEventReceiverList->Count();
+ for ( TInt i = 0; i < eventReceiverListCnt; i++ )
+ {
+ if (!(( *iEventReceiverList )[i].iWasDeleted))
+ {
+ iEventReceiverList->operator[](i).iBeginTime = 0;
+ ( *iEventReceiverList )[i].iElement->ReInitializeAnimation();
+ }
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgEventHandler::DeactivateAnimations()
+// ---------------------------------------------------------------------------
+void CSvgEventHandler::DeactivateAnimations()
+{
+TInt eventReceiverListCnt = iEventReceiverList->Count();
+for ( TInt i = 0; i < eventReceiverListCnt; i++ )
+ {
+ if (!(( *iEventReceiverList )[i].iWasDeleted))
+ {
+ iEventReceiverList->operator[](i).iBeginTime = 0;
+ ( *iEventReceiverList )[i].iElement->DeactivateAnimation();
+ }
+ }
+}
+// --------------------------------------------------------------------------
+// void CSvgEventHandler::SetCurrentTime(TInt32 aTime)
+// ---------------------------------------------------------------------------
+void CSvgEventHandler::SetCurrentTime(TInt32 aTime)
+{
+iCurrentTime = aTime;
+}
+// --------------------------------------------------------------------------
+// void CSvgEventHandler::DoAnimProcL(MSvgEvent* aEvent)
+// ---------------------------------------------------------------------------
+void CSvgEventHandler::DoAnimProcL(MSvgEvent* aEvent)
+{
+if(aEvent->EventType() != ESvgEngineEventTimer)return;
+TInt eventReceiverListCnt = iEventReceiverList->Count();
+for ( TInt i = 0; i < eventReceiverListCnt; i++ )
+ {
+ if (!(( *iEventReceiverList )[i].iWasDeleted))
+ {
+ ( *iEventReceiverList )[i].iElement->DoAnimProcL(aEvent);
+ }
+ }
+}
+
+// --------------------------------------------------------------------------
+// TInt32 CSvgEventHandler::AnimationElementsCount()
+// ---------------------------------------------------------------------------
+TInt32 CSvgEventHandler::AnimationElementsCount()
+ {
+ TInt32 lCount = 0;
+ if(iEventReceiverList)
+ {
+ TInt aEventReceiverListCnt = iEventReceiverList->Count();
+ for(TInt i=0; i < aEventReceiverListCnt; i++)
+ {
+ if (!(( *iEventReceiverList )[i].iWasDeleted))
+ {
+ CSvgElementImpl* lElem= NULL;
+ lElem = (CSvgElementImpl*) (*iEventReceiverList)[i].iElement;
+ if(lElem != NULL)
+ {
+ if( lElem->IsAnimatedElement() )
+ {
+ lCount++;
+ }
+ }
+ }
+ }
+ }
+ return lCount;
+
+ }
+void CSvgEventHandler::ResetTimes()
+ {
+ TInt eventReceiverListCnt = iEventReceiverList->Count();
+ for ( TInt i = 0; i < eventReceiverListCnt; i++ )
+ {
+ if (!(( *iEventReceiverList )[i].iWasDeleted) )
+ {
+ CSvgElementImpl* lElem= NULL;
+ lElem = (CSvgElementImpl*) (*iEventReceiverList)[i].iElement;
+
+ if( lElem->IsAnimatedElement() )
+ {
+ CSvgAnimationBase *temp = (CSvgAnimationBase *)((*iEventReceiverList )[i].iElement);
+ temp->ResetTimes();
+ }
+ }
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/src/SVGFourPointRect.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,431 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine header file
+ *
+*/
+
+
+#include "SVGFourPointRect.h"
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+TSvgFourPointRect::TSvgFourPointRect( )
+{
+ iPoint1.iX = 0;
+ iPoint1.iY = 0;
+
+ iPoint2.iX = 0;
+ iPoint2.iY = 0;
+
+ iPoint3.iX = 0;
+ iPoint3.iY = 0;
+
+ iPoint4.iX = 0;
+ iPoint4.iY = 0;
+}
+
+
+// --------------------------------------------------------------------------
+// TSvgFourPointRect::TSvgFourPointRect( TGfxRectangle2D aRect )
+// ---------------------------------------------------------------------------
+TSvgFourPointRect::TSvgFourPointRect( TGfxRectangle2D aRect )
+{
+ iPoint1.iX = aRect.iX;
+ iPoint1.iY = aRect.iY;
+
+ iPoint2.iX = aRect.iX + aRect.iWidth;
+ iPoint2.iY = aRect.iY;
+
+ iPoint3.iX = aRect.iX;
+ iPoint3.iY = aRect.iY + aRect.iHeight;
+
+ iPoint4.iX = aRect.iX + aRect.iWidth;
+ iPoint4.iY = aRect.iY + aRect.iHeight;
+
+}
+
+// --------------------------------------------------------------------------
+// void TSvgFourPointRect::SetRectPoints( TGfxRectangle2D aRect )
+// ---------------------------------------------------------------------------
+void TSvgFourPointRect::SetRectPoints( TGfxRectangle2D aRect )
+{
+ iPoint1.iX = aRect.iX;
+ iPoint1.iY = aRect.iY;
+
+ iPoint2.iX = aRect.iX + aRect.iWidth;
+ iPoint2.iY = aRect.iY;
+
+ iPoint3.iX = aRect.iX;
+ iPoint3.iY = aRect.iY + aRect.iHeight;
+
+ iPoint4.iX = aRect.iX + aRect.iWidth;
+ iPoint4.iY = aRect.iY + aRect.iHeight;
+
+}
+
+// --------------------------------------------------------------------------
+// TSvgFourPointRect::TSvgFourPointRect( TFloatFixPt aX, TFloatFixPt aY, TFloatFixPt aWidth, TFloatFixPt aHeight )
+// ---------------------------------------------------------------------------
+TSvgFourPointRect::TSvgFourPointRect( TFloatFixPt aX, TFloatFixPt aY, TFloatFixPt aWidth, TFloatFixPt aHeight )
+{
+ iPoint1.iX = aX;
+ iPoint1.iY = aY;
+
+ iPoint2.iX = aX + aWidth;
+ iPoint2.iY = aY;
+
+ iPoint3.iX = aX;
+ iPoint3.iY = aY + aHeight;
+
+ iPoint4.iX = aX + aWidth;
+ iPoint4.iY = aY + aHeight;
+}
+
+// --------------------------------------------------------------------------
+// void TSvgFourPointRect::SetRectPoints( TFloatFixPt aX, TFloatFixPt aY, TFloatFixPt aWidth, TFloatFixPt aHeight )
+// ---------------------------------------------------------------------------
+void TSvgFourPointRect::SetRectPoints( TFloatFixPt aX, TFloatFixPt aY, TFloatFixPt aWidth, TFloatFixPt aHeight )
+{
+ iPoint1.iX = aX;
+ iPoint1.iY = aY;
+
+ iPoint2.iX = aX + aWidth;
+ iPoint2.iY = aY;
+
+ iPoint3.iX = aX;
+ iPoint3.iY = aY + aHeight;
+
+ iPoint4.iX = aX + aWidth;
+ iPoint4.iY = aY + aHeight;
+}
+
+
+
+
+// --------------------------------------------------------------------------
+// TSvgFourPointRect::TSvgFourPointRect(TGfxPoint2D aPoint1, TGfxPoint2D aPoint2, TGfxPoint2D aPoint3, TGfxPoint2D aPoint4)
+// ---------------------------------------------------------------------------
+TSvgFourPointRect::TSvgFourPointRect(TGfxPoint2D aPoint1, TGfxPoint2D aPoint2, TGfxPoint2D aPoint3, TGfxPoint2D aPoint4)
+{
+ iPoint1 = aPoint1;
+ iPoint2 = aPoint2;
+ iPoint3 = aPoint3;
+ iPoint4 = aPoint4;
+}
+
+
+// --------------------------------------------------------------------------
+// void TSvgFourPointRect::SetRectPoints(TGfxPoint2D aPoint1, TGfxPoint2D aPoint2, TGfxPoint2D aPoint3, TGfxPoint2D aPoint4)
+// ---------------------------------------------------------------------------
+void TSvgFourPointRect::SetRectPoints(TGfxPoint2D aPoint1, TGfxPoint2D aPoint2, TGfxPoint2D aPoint3, TGfxPoint2D aPoint4)
+{
+ iPoint1 = aPoint1;
+ iPoint2 = aPoint2;
+ iPoint3 = aPoint3;
+ iPoint4 = aPoint4;
+}
+
+// --------------------------------------------------------------------------
+// TSvgFourPointRect::TSvgFourPointRect(TPoint aPoint1, TPoint aPoint2, TPoint aPoint3, TPoint aPoint4)
+// ---------------------------------------------------------------------------
+TSvgFourPointRect::TSvgFourPointRect(TPoint aPoint1, TPoint aPoint2, TPoint aPoint3, TPoint aPoint4)
+{
+ iPoint1.iX = TFloatFixPt(aPoint1.iX);
+ iPoint2.iX = TFloatFixPt(aPoint2.iX);
+ iPoint3.iX = TFloatFixPt(aPoint3.iX);
+ iPoint4.iX = TFloatFixPt(aPoint4.iX);
+ iPoint1.iY = TFloatFixPt(aPoint1.iY);
+ iPoint2.iY = TFloatFixPt(aPoint2.iY);
+ iPoint3.iY = TFloatFixPt(aPoint3.iY);
+ iPoint4.iY = TFloatFixPt(aPoint4.iY);
+
+}
+
+// --------------------------------------------------------------------------
+// void TSvgFourPointRect::SetRectPoints(TPoint aPoint1, TPoint aPoint2, TPoint aPoint3, TPoint aPoint4)
+// ---------------------------------------------------------------------------
+void TSvgFourPointRect::SetRectPoints(TPoint aPoint1, TPoint aPoint2, TPoint aPoint3, TPoint aPoint4)
+{
+ iPoint1.iX = TFloatFixPt(aPoint1.iX);
+ iPoint2.iX = TFloatFixPt(aPoint2.iX);
+ iPoint3.iX = TFloatFixPt(aPoint3.iX);
+ iPoint4.iX = TFloatFixPt(aPoint4.iX);
+ iPoint1.iY = TFloatFixPt(aPoint1.iY);
+ iPoint2.iY = TFloatFixPt(aPoint2.iY);
+ iPoint3.iY = TFloatFixPt(aPoint3.iY);
+ iPoint4.iY = TFloatFixPt(aPoint4.iY);
+
+}
+
+
+// --------------------------------------------------------------------------
+// void TSvgFourPointRect::GetPoints(TPoint& aPoint1, TPoint& aPoint2, TPoint& aPoint3, TPoint& aPoint4) const
+// ---------------------------------------------------------------------------
+void TSvgFourPointRect::GetPoints(TPoint& aPoint1, TPoint& aPoint2, TPoint& aPoint3, TPoint& aPoint4) const
+{
+ aPoint1.iX = (TInt)iPoint1.iX;
+ aPoint1.iY = (TInt)iPoint1.iY;
+
+ aPoint2.iX = (TInt)iPoint2.iX;
+ aPoint2.iY = (TInt)iPoint2.iY;
+
+ aPoint3.iX = (TInt)iPoint3.iX;
+ aPoint3.iY = (TInt)iPoint3.iY;
+
+ aPoint4.iX = (TInt)iPoint4.iX;
+ aPoint4.iY = (TInt)iPoint4.iY;
+}
+
+// --------------------------------------------------------------------------
+// void TSvgFourPointRect::GetPoints(TGfxPoint2D& aPoint1, TGfxPoint2D& aPoint2, TGfxPoint2D& aPoint3, TGfxPoint2D& aPoint4)
+// ---------------------------------------------------------------------------
+void TSvgFourPointRect::GetPoints(TGfxPoint2D& aPoint1, TGfxPoint2D& aPoint2, TGfxPoint2D& aPoint3, TGfxPoint2D& aPoint4)
+{
+ aPoint1 = iPoint1;
+ aPoint2 = iPoint2;
+ aPoint3 = iPoint3;
+ aPoint4 = iPoint4;
+}
+
+
+// --------------------------------------------------------------------------
+// void TSvgFourPointRect::GetTRect(TRect& aRect)
+// ---------------------------------------------------------------------------
+void TSvgFourPointRect::GetTRect(TRect& aRect)
+{
+
+ TFloatFixPt lMaxX = iPoint1.iX;
+
+ if (iPoint2.iX > lMaxX)
+ {
+ lMaxX = iPoint2.iX;
+ }
+ if (iPoint3.iX > lMaxX)
+ {
+ lMaxX = iPoint3.iX;
+ }
+ if (iPoint4.iX > lMaxX)
+ {
+ lMaxX = iPoint4.iX;
+ }
+
+ TFloatFixPt lMaxY = iPoint1.iY;
+
+ if (iPoint2.iY > lMaxY)
+ {
+ lMaxY = iPoint2.iY;
+ }
+ if (iPoint3.iY > lMaxY)
+ {
+ lMaxY = iPoint3.iY;
+ }
+ if (iPoint4.iY > lMaxY)
+ {
+ lMaxY = iPoint4.iY;
+ }
+
+ TFloatFixPt lMinX = iPoint1.iX;
+
+ if (iPoint2.iX < lMinX)
+ {
+ lMinX = iPoint2.iX;
+ }
+ if (iPoint3.iX < lMinX)
+ {
+ lMinX = iPoint3.iX;
+ }
+ if (iPoint4.iX < lMinX)
+ {
+ lMinX = iPoint4.iX;
+ }
+
+ TFloatFixPt lMinY = iPoint1.iY;
+
+ if (iPoint2.iY < lMinY)
+ {
+ lMinY = iPoint2.iY;
+ }
+ if (iPoint3.iY < lMinY)
+ {
+ lMinY = iPoint3.iY;
+ }
+ if (iPoint4.iY < lMinY)
+ {
+ lMinY = iPoint4.iY;
+ }
+
+ aRect.iBr.iX = lMaxX;
+ aRect.iBr.iY = lMaxY;
+ aRect.iTl.iX = lMinX;
+ aRect.iTl.iY = lMinY;
+
+}
+
+
+// --------------------------------------------------------------------------
+// void TSvgFourPointRect::GetTRect(TGfxRectangle2D& aRect)
+// ---------------------------------------------------------------------------
+void TSvgFourPointRect::GetTRect(TGfxRectangle2D& aRect)
+{
+
+ TFloatFixPt lMaxX = iPoint1.iX;
+
+ if (iPoint2.iX > lMaxX)
+ {
+ lMaxX = iPoint2.iX;
+ }
+ if (iPoint3.iX > lMaxX)
+ {
+ lMaxX = iPoint3.iX;
+ }
+ if (iPoint4.iX > lMaxX)
+ {
+ lMaxX = iPoint4.iX;
+ }
+
+ TFloatFixPt lMaxY = iPoint1.iY;
+
+ if (iPoint2.iY > lMaxY)
+ {
+ lMaxY = iPoint2.iY;
+ }
+ if (iPoint3.iY > lMaxY)
+ {
+ lMaxY = iPoint3.iY;
+ }
+ if (iPoint4.iY > lMaxY)
+ {
+ lMaxY = iPoint4.iY;
+ }
+
+ TFloatFixPt lMinX = iPoint1.iX;
+
+ if (iPoint2.iX < lMinX)
+ {
+ lMinX = iPoint2.iX;
+ }
+ if (iPoint3.iX < lMinX)
+ {
+ lMinX = iPoint3.iX;
+ }
+ if (iPoint4.iX < lMinX)
+ {
+ lMinX = iPoint4.iX;
+ }
+
+ TFloatFixPt lMinY = iPoint1.iY;
+
+ if (iPoint2.iY < lMinY)
+ {
+ lMinY = iPoint2.iY;
+ }
+ if (iPoint3.iY < lMinY)
+ {
+ lMinY = iPoint3.iY;
+ }
+ if (iPoint4.iY < lMinY)
+ {
+ lMinY = iPoint4.iY;
+ }
+
+ aRect.iX = lMinX;
+ aRect.iY = lMinY;
+ aRect.iWidth = lMaxX - lMinX;
+ aRect.iHeight = lMaxY - lMinY;
+
+}
+
+// --------------------------------------------------------------------------
+// void TSvgFourPointRect::Center(TPoint& aCenter)
+// ---------------------------------------------------------------------------
+void TSvgFourPointRect::Center(TPoint& aCenter)
+{
+ TFloatFixPt lMaxX = iPoint1.iX;
+
+ if (iPoint2.iX > lMaxX)
+ {
+ lMaxX = iPoint2.iX;
+ }
+ if (iPoint3.iX > lMaxX)
+ {
+ lMaxX = iPoint3.iX;
+ }
+ if (iPoint4.iX > lMaxX)
+ {
+ lMaxX = iPoint4.iX;
+ }
+
+ TFloatFixPt lMaxY = iPoint1.iY;
+
+ if (iPoint2.iY > lMaxY)
+ {
+ lMaxY = iPoint2.iY;
+ }
+ if (iPoint3.iY > lMaxY)
+ {
+ lMaxY = iPoint3.iY;
+ }
+ if (iPoint4.iY > lMaxY)
+ {
+ lMaxY = iPoint4.iY;
+ }
+
+ TFloatFixPt lMinX = iPoint1.iX;
+
+ if (iPoint2.iX < lMinX)
+ {
+ lMinX = iPoint2.iX;
+ }
+ if (iPoint3.iX < lMinX)
+ {
+ lMinX = iPoint3.iX;
+ }
+ if (iPoint4.iX < lMinX)
+ {
+ lMinX = iPoint4.iX;
+ }
+
+ TFloatFixPt lMinY = iPoint1.iY;
+
+ if (iPoint2.iY < lMinY)
+ {
+ lMinY = iPoint2.iY;
+ }
+ if (iPoint3.iY < lMinY)
+ {
+ lMinY = iPoint3.iY;
+ }
+ if (iPoint4.iY < lMinY)
+ {
+ lMinY = iPoint4.iY;
+ }
+
+ aCenter.iX = (( lMaxX - lMinX ) / TFloatFixPt(2) ) + lMinX;
+ aCenter.iY = (( lMaxY - lMinY ) / TFloatFixPt(2) ) + lMinY;
+}
+
+// --------------------------------------------------------------------------
+// TBool TSvgFourPointRect::Intersects(const MRect& aFourPointRect)
+// ---------------------------------------------------------------------------
+TBool TSvgFourPointRect::Intersects(const MRect& aFourPointRect)
+{
+ TGfxRectangle2D rect;
+ TGfxRectangle2D thisRect;
+
+ GetTRect(thisRect);
+ ((TSvgFourPointRect&)aFourPointRect).GetTRect(rect);
+
+ return ( thisRect.Intersects(rect) );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/src/SVGTimer.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,314 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine source file
+ *
+*/
+
+
+#include "SVGTimer.h"
+#include "SVGEngineImpl.h"
+#include "GfxAffineTransform.h"
+#include "GfxPoint2D.h"
+#include "SVGTimeContainer.h"
+
+// ---------------------------------------------------------------------------
+// Two phase constructor
+// ---------------------------------------------------------------------------
+CSvgTimer* CSvgTimer::NewLC( CSvgTimeContainer* aTimeContainer )
+ {
+ CSvgTimer* self = new ( ELeave ) CSvgTimer( aTimeContainer );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+//
+// ---------------------------------------------------------------------------
+// Two phase constructor
+// ---------------------------------------------------------------------------
+CSvgTimer* CSvgTimer::NewL( CSvgTimeContainer* aTimeContainer )
+ {
+ CSvgTimer* self = NewLC( aTimeContainer );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Private method that builds the heap objects or performs leavable actions
+// during object construction
+// ---------------------------------------------------------------------------
+void CSvgTimer::ConstructL()
+ {
+ // Call the base class ConstructL
+ CTimer::ConstructL();
+ // Add to active scheduler
+ CActiveScheduler::Add( this );
+ }
+
+//
+// ---------------------------------------------------------------------------
+// Constructor
+// Initialized with a pointer to the time container
+// ---------------------------------------------------------------------------
+CSvgTimer::CSvgTimer( CSvgTimeContainer* aTimeContainer ) :
+ CTimer( CActive::EPriorityStandard ),
+ iTimeContainer( aTimeContainer )
+ {
+ ChangeFrameDuration( KMinFrameDelay );
+ SetStrictFrameDuration( EFalse );
+ ResetTime();
+ }
+
+//
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+CSvgTimer::~CSvgTimer()
+ {
+ Cancel();
+ }
+
+// ---------------------------------------------------------------------------
+// Reset the time
+// ---------------------------------------------------------------------------
+void CSvgTimer::ResetTime()
+ {
+ iTime = 0;
+ iFrames = 0;
+ iFirstFrameDrawn = EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+// Change the duration of the timer in milliseconds
+// ---------------------------------------------------------------------------
+void CSvgTimer::ChangeFrameDuration( TUint32 aFrameDuration )
+ {
+ // If delay duration is less then minimum-delay, set to minimum-delay
+ if ( aFrameDuration < KMinFrameDelay )
+ {
+ aFrameDuration = KMinFrameDelay;
+ }
+ iFrameDuration = aFrameDuration;
+ }
+
+// ---------------------------------------------------------------------------
+// Return the frames per 10-seconds
+// ---------------------------------------------------------------------------
+TUint CSvgTimer::Fps()
+ {
+ if ( iTime == 0 )
+ {
+ return 0;
+ }
+ // iTime is in milliseconds
+ return ( 10000 * iFrames ) / iTime ;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Standard Active Object DoCancel
+// ---------------------------------------------------------------------------
+void CSvgTimer::DoCancel()
+ {
+ CTimer::DoCancel();
+ }
+
+// ---------------------------------------------------------------------------
+// Standard Active Object RunL
+// ---------------------------------------------------------------------------
+void CSvgTimer::RunL()
+ {
+ // Check if timed entity not null
+ if ( !iTimeContainer )
+ {
+ return;
+ }
+
+#if 0
+ // Check engine and document
+ if ( !iSvgEngine || !iSvgEngine->Document() )
+ {
+ return;
+ }
+
+ // wait for images to finish decoding
+ if ( !iSvgEngine->ReadyToRender() )
+ {
+ CActive::Deque();
+ CActiveScheduler::Add( this );
+ CTimer::After( 10 * 1000 );
+ return;
+ }
+#endif
+ /********************** Generate first frame ********************/
+ if ( !iFirstFrameDrawn )
+ {
+ iFirstFrameDrawn = ETrue;
+ }
+ else
+ {
+ /********************** After first frame ********************/
+ TTime currentTime;
+ currentTime.HomeTime();
+ TUint32 elapsedTime = GetElapsedMilliseconds( iPreviousFrameTime, currentTime );
+
+ // Cap elapsed time, if needed
+ if ( iIsStrictFrameDuration &&
+ elapsedTime > iFrameDuration )
+ {
+ elapsedTime = iFrameDuration;
+ }
+
+ // Generate frame
+ iTime += elapsedTime;
+ }
+
+ // Mark time of new frame
+ iPreviousFrameTime.HomeTime();
+
+ // Generate new frame
+ TUint32 sleepTime = GenerateFrameL( iTime );
+
+ // Sleep to next frame
+ if (
+ ( iTimeContainer->Document()->Engine()->SVGEngineState() == ESVGEngineRunning )
+ && ( iTimeContainer->GetCurTick().iParentTcTick < iTimeContainer->Document()->AnimationDuration() )
+ )
+
+ {
+ // Dequeue to move this ActiveObject to the end of the list
+ // to share processor with other AOs.
+ CActive::Deque();
+ CActiveScheduler::Add( this );
+ CTimer::After( 1000 * sleepTime );
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgTimer::SVGStop()
+// ---------------------------------------------------------------------------
+void CSvgTimer::SVGStop()
+ {
+ if ( IsActive() )
+ {
+ Cancel(); // stop current timer
+ }
+ iFirstFrameDrawn = EFalse;
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgTimer::SVGResume()
+// ---------------------------------------------------------------------------
+void CSvgTimer::SVGResume( TInt32 aTime )
+ {
+ if ( !IsActive() )
+ {
+ if ( aTime < 0 )
+ {
+ // Error, ( negative time ) set to default
+ aTime = 1000;
+ }
+
+ CTimer::After( aTime ); // invoke initial timer event
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgTimer::SetStartTime()
+// Reset animation time to zero
+// ---------------------------------------------------------------------------
+void CSvgTimer::SetStartTime()
+ {
+ SetSeekTime( 0 );
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgTimer::SetSeekTime( TUint32 aTime )
+// ---------------------------------------------------------------------------
+void CSvgTimer::SetSeekTime( TUint32 aTime )
+ {
+ // update the current time.
+ iFirstFrameDrawn = EFalse;
+#if 0
+ // the current home time needs to be updated.
+ if ( iSvgEngine && iSvgEngine->Document() && aTime != iTime )
+ {
+ TSvgTimerEvent timeEvent( aTime );
+ iSvgEngine->Document()->Reset( &timeEvent );
+ }
+#endif
+ iTime = aTime;
+
+ if ( !IsActive() )
+ {
+ CTimer::After( 1000 );
+ }
+
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgTimer::SetStrictFrameDuration( TBool aKeepStrictFrameDuration )
+// ---------------------------------------------------------------------------
+void CSvgTimer::SetStrictFrameDuration( TBool aKeepStrictFrameDuration )
+ {
+ iIsStrictFrameDuration = aKeepStrictFrameDuration;
+ }
+
+// --------------------------------------------------------------------------
+// TUint32 CSvgTimer::GenerateFrameL( TUint32 aTime )
+// ---------------------------------------------------------------------------
+TUint32 CSvgTimer::GenerateFrameL( TUint32 aTime )
+ {
+ TTime startTime;
+ startTime.HomeTime();
+ TSvgTick lTick;
+ lTick.iRealTimeTick = aTime;
+ lTick.iParentTcTick = 0;
+
+ iTimeContainer->ParentTimeContainerTick( lTick );
+
+#if 0
+ // Request to drawn frame at given time
+ TSvgTimerEvent timeEvent( aTime );
+ iSvgEngine->ProcessEventL( iSvgEngine->Document(), &timeEvent );
+#endif
+ TTime endTime;
+ endTime.HomeTime();
+
+ TUint32 elapsedTime = GetElapsedMilliseconds( startTime, endTime );
+
+ // Calculate sleep time to next frame
+ TUint32 sleepTime = KMinSleepDuration;
+ if ( elapsedTime < iFrameDuration )
+ {
+ sleepTime = iFrameDuration - elapsedTime;
+ if ( sleepTime < KMinSleepDuration )
+ {
+ sleepTime = KMinSleepDuration;
+ }
+ }
+
+ iFrames++;
+ return sleepTime;
+ }
+
+// --------------------------------------------------------------------------
+// TUint32 CSvgTimer::GetElapsedMilliseconds( TTime& aStart, TTime& aEnd )
+// ---------------------------------------------------------------------------
+TUint32 CSvgTimer::GetElapsedMilliseconds( TTime& aStart, TTime& aEnd )
+ {
+ TTimeIntervalMicroSeconds interval64 = aEnd.MicroSecondsFrom( aStart );
+ // in milliseconds
+ return I64INT( interval64.Int64() ) / 1000;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/src/SvgBitmapFontProvider.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#include "SvgBitmapFontProvider.h"
+
+
+// ---------------------------------------------------------------------------
+// Two phase constructor for this class
+//
+// ---------------------------------------------------------------------------
+CSvgBitmapFontProvider* CSvgBitmapFontProvider::NewL( const TFontSpec& aFontSpec )
+ {
+ CSvgBitmapFontProvider* self = NewLC( aFontSpec );
+ CleanupStack::Pop();
+ return self;
+ }
+
+
+// --------------------------------------------------------------------------
+// CSvgBitmapFontProvider* CSvgBitmapFontProvider::NewLC()
+// ---------------------------------------------------------------------------
+CSvgBitmapFontProvider* CSvgBitmapFontProvider::NewLC( const TFontSpec& aFontSpec )
+ {
+ CSvgBitmapFontProvider* self = new ( ELeave ) CSvgBitmapFontProvider( aFontSpec );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+
+//----------------------------------------------------------------------------
+// First Step of two phase construction for this class
+//----------------------------------------------------------------------------
+CSvgBitmapFontProvider::CSvgBitmapFontProvider( const TFontSpec& aFontSpec ):
+ iTypeFaceStore(NULL),
+ iFontSpec(aFontSpec)
+ {
+
+ }
+
+// --------------------------------------------------------------------------
+// CSvgBitmapFontProvider::ConstructL()
+// ---------------------------------------------------------------------------
+void CSvgBitmapFontProvider::ConstructL()
+ {
+ iTypeFaceStore = CFbsTypefaceStore::NewL(NULL);
+ }
+
+// --------------------------------------------------------------------------
+// CSvgBitmapFontProvider::ConstructL()
+// ---------------------------------------------------------------------------
+CSvgBitmapFontProvider::~CSvgBitmapFontProvider()
+ {
+ delete iTypeFaceStore ;
+ }
+
+// --------------------------------------------------------------------------
+// CSvgBitmapFontProvider::ReleaseFont(CFont* aFont)
+// ---------------------------------------------------------------------------
+void CSvgBitmapFontProvider::ReleaseFont(CFont* aFont)
+{
+ iTypeFaceStore->ReleaseFont(aFont);
+}
+
+// --------------------------------------------------------------------------
+// CSvgBitmapFontProvider::GetNearestFontToDesignHeightInTwips(CFont* aFont, TFontSpec aFontSpec)
+// ---------------------------------------------------------------------------
+TInt CSvgBitmapFontProvider::GetNearestFontToDesignHeightInTwips(CFont*& aFont, TFontSpec aFontSpec)
+{
+ TName fontTypefaceName(aFontSpec.iTypeface.iName);
+
+ TInt matchLength = fontTypefaceName.Length();
+
+ TInt typefaceCount = iTypeFaceStore->NumTypefaces();
+ TTypefaceSupport typefaceSupport;
+
+ TInt i;
+ for(i=0; i<typefaceCount; i++)
+ {
+ iTypeFaceStore->TypefaceSupport(typefaceSupport, i);
+ TInt findResult = typefaceSupport.iTypeface.iName.Find(fontTypefaceName.Ptr(), matchLength);
+ if(!findResult)
+ {
+ fontTypefaceName = typefaceSupport.iTypeface.iName;
+ break;
+ }
+ }
+
+ //If the element typeface couldn't find && didn't set the typeface name.
+ if(( i == typefaceCount) && (iFontSpec.iTypeface.iName.Length()))
+ {
+ fontTypefaceName = iFontSpec.iTypeface.iName;
+ }
+
+ aFontSpec.iTypeface.iName = fontTypefaceName;
+ return iTypeFaceStore->GetNearestFontToDesignHeightInTwips(aFont, aFontSpec);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGEngine/src/Svgdecoder.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,4422 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine source file
+ *
+*/
+
+#include <e32def.h>
+#include <e32base.h>
+#include <s32mem.h>
+#include "Svgdecoder.h"
+#include "SVGClrCssValueImpl.h"
+#include "SVGFloatCssValueImpl.h"
+#include "SVGIntCssValueImpl.h"
+#include "SVGStrCssValueImpl.h"
+#include "SVGVectorCssValueImpl.h"
+#include "GfxAffineTransform.h"
+#include "SVGTextElementImpl.h"
+#include "SVGFontFaceElementImpl.h"
+#include "SvgStopElementImpl.h"
+#include "SVGUseElementImpl.h"
+#include "SVGAnimationBase.h"
+#include "SVGAnimateMotionElementImpl.h"
+#include "SVGMpathElementImpl.h"
+#include "SVGGradientElementImpl.h"
+#include "SVGDiscardElementImpl.h"
+#include "SVGMediaElementBase.h"
+#include "SVGMediaAnimationElementImpl.h"
+#include "SVGTimedEntityInterface.h"
+#include "SVGAudioElementImpl.h"
+
+#include "SVGDocumentImpl.h"
+#include "SVGEngineImpl.h"
+#include "SVGMemoryManager.h"
+
+#include <languages.hrh>
+
+_LIT(OFFSET, "offset");
+_LIT(ZEROVALUE, "0");
+
+// --------------------------------------------------------------------------
+// CSvgDecoder* CSvgDecoder::NewL(const TDesC& aFileName )
+// ---------------------------------------------------------------------------
+CSvgDecoder* CSvgDecoder::NewL(const TDesC& aFileName )
+{
+ CSvgDecoder *self = new (ELeave) CSvgDecoder();
+
+ CleanupStack::PushL(self);
+
+ self->ConstructL(aFileName);
+
+ CleanupStack::Pop();
+
+ return self;
+}
+
+
+// --------------------------------------------------------------------------
+// void CSvgDecoder::ConstructL(const TDesC& aFileName)
+// ---------------------------------------------------------------------------
+void CSvgDecoder::ConstructL(const TDesC& aFileName)
+{
+ User::LeaveIfError(iFs.Connect() );
+ User::LeaveIfError (iFStream.Open(iFs, aFileName, EFileRead));
+ iStream= iFStream;
+
+ /*Arrays Added For forward referencing in USE and Animate elements*/
+ iUseElementArray = new (ELeave)RPointerArray<CSvgElementImpl> (1);
+ iUseElementArray->Reset();
+
+ iAnimRefElementArray = new (ELeave)RPointerArray<CSvgElementImpl> (1);
+ iAnimRefElementArray->Reset();
+}
+
+
+// --------------------------------------------------------------------------
+// CSvgDecoder* CSvgDecoder::NewL(const TDesC8& aByteData )
+// ---------------------------------------------------------------------------
+CSvgDecoder* CSvgDecoder::NewL(const TDesC8& aByteData )
+{
+ CSvgDecoder *self = new (ELeave) CSvgDecoder();
+
+ CleanupStack::PushL(self);
+
+ self->ConstructL(aByteData);
+
+ CleanupStack::Pop();
+
+ return self;
+}
+
+
+// --------------------------------------------------------------------------
+// void CSvgDecoder::ConstructL(const TDesC8& aByteData)
+// ---------------------------------------------------------------------------
+void CSvgDecoder::ConstructL(const TDesC8& aByteData)
+{
+ iDStream.Open(aByteData);
+ iStream= iDStream;
+
+ iUseElementArray = new (ELeave)RPointerArray<CSvgElementImpl> (1);
+ iUseElementArray->Reset();
+
+ iAnimRefElementArray = new (ELeave)RPointerArray<CSvgElementImpl> (1);
+ iAnimRefElementArray->Reset();
+
+ // added to hold switch element handles so we can go back and delete false children of the switch
+ iSwitchElementArray = new (ELeave)RPointerArray<CSvgElementImpl> (1);
+ iSwitchElementArray->Reset();
+
+ // Arrays added to reset event listeners for animation element
+ iAnimationElementArray = new (ELeave)RPointerArray<CSvgElementImpl> (1);
+ iAnimationElementArray->Reset();
+
+ //added to hold elements with required features, attributes, or sys language
+ //so we can go back and delete the ones that dont pass at the start.
+ iReqFetAttSysArray = new (ELeave)RPointerArray<CSvgElementImpl> (1);
+ iReqFetAttSysArray->Reset();
+}
+
+
+// --------------------------------------------------------------------------
+// CSvgDecoder::CSvgDecoder()
+// ---------------------------------------------------------------------------
+CSvgDecoder::CSvgDecoder()
+ :iRootElement( NULL ),
+ iIsAnimElement(EFalse),
+ iIsFixPt(EFalse),
+ iIsRGB(EFalse),
+ iEmbeddedImagesCount(0)
+
+{
+}
+
+
+// --------------------------------------------------------------------------
+// CSvgDecoder::~CSvgDecoder()
+// ---------------------------------------------------------------------------
+CSvgDecoder::~CSvgDecoder()
+{
+ iStream.Close();
+ iDStream.Close();
+ iFStream.Close();
+
+ iFs.Close();
+
+ if(iUseElementArray)
+ {
+ iUseElementArray->Reset();
+ iUseElementArray->Close();
+ delete iUseElementArray;
+ iUseElementArray = NULL;
+ }
+
+ if(iAnimRefElementArray)
+ {
+ iAnimRefElementArray->Reset();
+ iAnimRefElementArray->Close();
+ delete iAnimRefElementArray;
+ iAnimRefElementArray = NULL;
+ }
+
+ if(iSwitchElementArray)
+ {
+ iSwitchElementArray->Close();
+ delete iSwitchElementArray;
+ }
+ if (iReqFetAttSysArray)
+ {
+ iReqFetAttSysArray->Close();
+ delete iReqFetAttSysArray;
+ }
+ if(iAnimationElementArray)
+ {
+ iAnimationElementArray->Reset();
+ iAnimationElementArray->Close();
+ delete iAnimationElementArray;
+ }
+
+ iImageElements.Close();
+
+}
+
+
+// --------------------------------------------------------------------------
+// TDesC& CSvgDecoder::DecodeTDesCLC()
+// ---------------------------------------------------------------------------
+TDesC& CSvgDecoder::DecodeTDesCLC()
+{
+
+ TUint8 lUniCodeLen = 2;
+
+ TUint8 uStrLen;
+ iStream >> uStrLen ;
+ HBufC *lBuf = NULL;
+
+ if (uStrLen)
+ {
+
+ lBuf = HBufC::NewLC(uStrLen/lUniCodeLen);
+ TPtr lTmp= lBuf->Des();
+ iStream.ReadL (lTmp, (TInt) (uStrLen/lUniCodeLen));
+ }
+
+ else
+ {
+ lBuf = HBufC::NewLC(0);
+ }
+
+ return (TDesC &) *lBuf;
+}
+
+// --------------------------------------------------------------------------
+// TDesC& CSvgDecoder::DecodeImageEmbeddedTDesCLC()
+// ---------------------------------------------------------------------------
+TDesC& CSvgDecoder::DecodeImageEmbeddedTDesCLC()
+{
+
+// TUint8 lUniCodeLen = 2;
+
+ TInt32 lImageSize;
+ iStream >> lImageSize ;
+
+ HBufC *lBuf = NULL;
+ HBufC8* lBuffer =NULL;
+
+ if (lImageSize)
+ {
+ lBuffer = HBufC8::NewLC(lImageSize);
+ TPtr8 lTemp= lBuffer->Des();
+ iStream.ReadL (lTemp, (TInt) (lImageSize));
+
+ lBuf = HBufC::NewLC(lImageSize);
+ TPtr lTmp= lBuf->Des();
+ lTmp.Copy(lTemp);
+ }
+
+ else
+ {
+ lBuffer = HBufC8::NewLC(0);
+ lBuf = HBufC::NewLC(0);
+ }
+
+
+ return (TDesC &) *lBuf;
+}
+
+
+
+// ==========================================================================
+// Decodig Attribute
+// ==========================================================================
+TInt CSvgDecoder::DecodeAttributeL(const TUint16 aName)
+ {
+
+ if( DecodePresentationAttributeL (aName) ||
+ DecodeSVGTAttributeL (aName) ||
+ DecodeSvgElementAttributeL (aName) ||
+ DecodeIdAndXmlAttributeL ( aName ) ||
+ DecodeUriRefAttributeL ( aName ) ||
+ DecodeAnimationAttributeL (aName) ||
+ DecodeTransformAttributeL (aName) ||
+ DecodeLangSpaceAttributeL (aName) ||
+ DecodeTestAttributeL ( aName ) ||
+ DecodeDiscardAttributeL ( aName )
+ )
+ {
+ return KErrNone;
+ }
+ else
+ {
+ return KErrNotFound;
+ }
+ }
+
+
+
+// --------------------------------------------------------------------------
+// TBool CSvgDecoder::DecodePresentationAttributeL(const TUint16 aName)
+// ---------------------------------------------------------------------------
+TBool CSvgDecoder::DecodePresentationAttributeL(const TUint16 aName)
+ {
+
+ if(aName<=KCSS_MAX_ATTR)
+ {
+
+ if (aName== KCSS_ATTR_FILL )
+ {
+
+ CCssValue* tParentValue = NULL;
+ CCssValue* tValue = NULL;
+
+ iCurrentElement->FindProperty (KCSS_ATTR_FILL,tValue);
+
+ if(iCurrentElement!= iRootElement)
+ {
+ iCurrentParentElement->FindProperty (KCSS_ATTR_FILL,tParentValue);
+ }
+
+ if (tParentValue == tValue || tValue == NULL)
+ {
+ if (iDocument)
+ {
+ tValue = iDocument->iMemoryManager->GetCssPaintObjectL(iCurrentElement);
+ }
+ SetPaintValueL (tValue);
+ iCurrentElement->SetPresentationAttribute (KCSS_ATTR_FILL,tValue);
+ }
+ else
+ {
+ SetPaintValueL (tValue);
+ }
+
+ return ETrue;
+ }
+
+ if (aName== KCSS_ATTR_STROKE || aName== KCSS_ATTR_COLOR)
+ {
+ return DecodeColorCssValueL(aName);
+ }
+
+ if (aName== KCSS_ATTR_GROUP_OPACITY)
+ {
+ iDocument->iHasGroupOpacity = ETrue;
+ return DecodeFloatCssValueL(aName);
+ }
+ if (aName== KCSS_ATTR_FILL_OPACITY ||
+ aName== KCSS_ATTR_STROKE_OPACITY ||
+ aName== KCSS_ATTR_STROKEWIDTH ||
+ aName== KCSS_ATTR_FONTSIZE ||
+ aName== KCSS_ATTR_STROKE_MITERLIMIT ||
+ aName== KCSS_ATTR_STROKE_DASHOFFSET
+ )
+
+ {
+ return DecodeFloatCssValueL(aName);
+ }
+
+ if (aName== KCSS_ATTR_VISIBILITY ||
+ aName== KCSS_ATTR_FONTSTYLE ||
+ aName== KCSS_ATTR_FONTWEIGHT ||
+ aName== KCSS_ATTR_DISPLAY ||
+ aName== KCSS_ATTR_TEXTANCHOR ||
+ aName== KCSS_ATTR_TEXTDECORATION
+ )
+
+ {
+ return DecodeIntCssValueL(aName);
+ }
+
+ if (aName== KCSS_ATTR_FONTFAMILY ||
+ aName== KCSS_ATTR_FILLRULE ||
+ aName== KCSS_ATTR_STROKE_LINECAP ||
+ aName== KCSS_ATTR_STROKE_LINEJOIN
+ )
+
+ {
+ return DecodeStringCssValueL(aName);
+ }
+
+
+ if (aName== KCSS_ATTR_STROKE_DASHARRAY)
+ {
+ CArrayFix<TFloatFixPt>* lArrayFix;
+ TInt8 lCount;
+ iStream >> lCount;
+ if (lCount)
+ {
+ lArrayFix= new ( ELeave ) CArrayFixFlat<TFloatFixPt>( lCount );
+ }
+ else
+ {
+ lArrayFix= new ( ELeave ) CArrayFixFlat<TFloatFixPt>( 1 );
+ }
+
+ CleanupStack::PushL(lArrayFix); //cleanup
+
+ TFloatFixPt lTempFix;
+ TReal32 lTempReal;
+
+ for(TInt8 i=0; i<lCount; i++)
+ {
+ if (iIsFixPt)
+ {
+ //was encoded as fixed point
+ lTempFix.iValue = iStream.ReadInt32L();
+ lArrayFix->AppendL( lTempFix );
+ }
+ else
+ {
+ //was encoded as floats
+
+ iStream >> lTempReal;
+ lArrayFix->AppendL( (TFloatFixPt) lTempReal);
+ }
+ }
+
+ CCssValue* tParentValue = NULL;
+ CCssValue* tValue = NULL;
+
+ iCurrentElement->FindProperty ((TInt8)aName,tValue);
+
+ if(iCurrentElement!= iRootElement)
+ {
+ iCurrentParentElement->FindProperty ((TInt8)aName,tParentValue);
+ }
+
+ if ( tParentValue == tValue || tValue == NULL )
+ {
+ // This attribute is inherited from parent, or not
+ // defined in parent
+ if ( iDocument )
+ {
+ // Create a new Vector object and clone lArrayFix
+ tValue = iDocument->iMemoryManager->GetCssVectorObjectL( lArrayFix );
+ // Associate tValue with the current element
+ iCurrentElement->SetPresentationAttribute ( ( TInt8 ) aName,tValue );
+ }
+ // tValue contains a copy of lArrayFix, hence lArrayFix is not needed
+ // anymore.
+ // tValue is owned by the element.
+ CleanupStack::PopAndDestroy( lArrayFix ); //cleanup
+ }
+ else
+ {
+ // stroke dash array was already present in the element
+ // SetValueL function takes ownership of lArrayFix
+ ((CVectorCssValueImpl*)tValue)->SetValueL ( lArrayFix );
+ // No need to destroy lArrayFix as it is now owned
+ // by the element.
+ CleanupStack::Pop( lArrayFix ); //cleanup
+ }
+
+
+ return ETrue;
+
+ }
+
+ else
+ {
+ return ETrue;
+ }
+
+ }
+
+ else
+ {
+ return EFalse;
+ }
+
+ }
+
+
+// --------------------------------------------------------------------------
+// TBool CSvgDecoder::DecodeSVGTAttributeL(const TUint16 aName)
+// ---------------------------------------------------------------------------
+TBool CSvgDecoder::DecodeSVGTAttributeL(const TUint16 aName)
+ {
+
+ if( (iCurrentElement->ElemID() == KSvgSvgElement) &&
+ ( aName== KAtrWidth || aName== KAtrHeight ) )
+ {
+ TUint8 lFlag;
+
+ iStream >> lFlag ;
+
+ if (iIsFixPt)
+ {
+ TFloatFixPt lAtrValue;
+ lAtrValue.iValue = iStream.ReadInt32L();
+
+ // Flag is used to ckech whether height and width are percentage or not.
+ if(lFlag)
+ {
+ if(aName == KAtrWidth)
+ {
+ ((CSvgSvgElementImpl *)iCurrentElement)->iWidthInPercentage = ETrue;
+ ((CSvgSvgElementImpl *)iCurrentElement)->iWidthInUserCoordinate = lAtrValue;
+ }
+ else if(aName == KAtrHeight)
+ {
+ ((CSvgSvgElementImpl *)iCurrentElement)->iHeightInPercentage = ETrue;
+ ((CSvgSvgElementImpl *)iCurrentElement)->iHeightInUserCoordinate = lAtrValue;
+ }
+ }
+ else
+ {
+ if(aName == KAtrWidth)
+ {
+ ((CSvgSvgElementImpl *)iCurrentElement)->iWidthInPercentage = EFalse;
+ }
+ else if(aName == KAtrHeight)
+ {
+ ((CSvgSvgElementImpl *)iCurrentElement)->iHeightInPercentage = EFalse;
+ }
+ iCurrentElement->SetAttributeFloatL( (TInt)aName, lAtrValue );
+ }
+ }
+ else
+ {
+ TReal32 lAtrValue;
+ iStream >> lAtrValue;
+
+ // Flag is used to ckech whether height and width are percentage or not.
+ if(lFlag)
+ {
+ if(aName == KAtrWidth)
+ {
+ ((CSvgSvgElementImpl *)iCurrentElement)->iWidthInPercentage = ETrue;
+ ((CSvgSvgElementImpl *)iCurrentElement)->iWidthInUserCoordinate = lAtrValue;
+ }
+ else if (aName == KAtrHeight)
+ {
+ ((CSvgSvgElementImpl *)iCurrentElement)->iHeightInPercentage = ETrue;
+ ((CSvgSvgElementImpl *)iCurrentElement)->iHeightInUserCoordinate = lAtrValue;
+ }
+
+ }
+ else
+ {
+ if(aName == KAtrWidth)
+ {
+ ((CSvgSvgElementImpl *)iCurrentElement)->iWidthInPercentage = EFalse;
+ }
+ else if(aName == KAtrHeight)
+ {
+ ((CSvgSvgElementImpl *)iCurrentElement)->iHeightInPercentage = EFalse;
+ }
+ iCurrentElement->SetAttributeFloatL( (TInt)aName, (TFloatFixPt)lAtrValue );
+ }
+ }
+
+ return ETrue;
+ }
+
+ if(iCurrentElement->ElemID() == KSvgTextElement)
+ {
+ if (aName== KAtrX || aName== KAtrY)
+ {
+ CArrayFixFlat<TFloatFixPt>* lArrayFix;
+ TInt8 lCount;
+ iStream >> lCount;
+ if (lCount)
+ {
+ lArrayFix= new ( ELeave ) CArrayFixFlat<TFloatFixPt>( lCount );
+ }
+ else
+ {
+ lArrayFix= new ( ELeave ) CArrayFixFlat<TFloatFixPt>( 1 );
+ }
+
+ CleanupStack::PushL(lArrayFix); //cleanup
+
+ for(TInt8 i=0; i<lCount; i++)
+ {
+ if (iIsFixPt)
+ {
+ TFloatFixPt lTemp;
+ lTemp.iValue = iStream.ReadInt32L();
+ lArrayFix->AppendL( lTemp );
+ }
+ else
+ {
+ TReal32 lTemp;
+ iStream >> lTemp ;
+ lArrayFix->AppendL( (TFloatFixPt) lTemp);
+ }
+
+ }
+
+ ((CSvgTextElementImpl*)iCurrentElement)->SetXYArray(aName,lArrayFix);
+ CleanupStack::Pop(lArrayFix); //cleanup
+ return ETrue;
+ }
+ }
+
+
+ if( aName<KSvgFloatAttrEndIndex ||
+ aName== KAtrFx ||
+ aName== KAtrFy ||
+ aName== KAtrOffset ||
+ aName== KAtrStopOpacity
+ )
+ {
+
+ return DecodeAttributeFloatL(aName);
+ }
+
+ else if(aName == KAtrK)
+ {
+ iCurrentElement->iReqAttrFlag =0;
+ return DecodeAttributeFloatL(aName);
+ }
+
+ else if( aName<= KSvgDesAttrEndIndex ||
+ aName== KAtrMedia ||
+ aName== KAtrTitle
+ )
+ {
+
+ return DecodeAttributeDesL(aName);
+ }
+ else if (aName== KAtrVolume)
+ {
+ if (iIsFixPt)
+ {
+ TFloatFixPt lTemp;
+ lTemp.iValue = iStream.ReadInt32L();
+ TBuf<16> lTemp2;
+ _LIT(KAudioLevelFormat, "%f");
+ lTemp2.Format(KAudioLevelFormat, (float)lTemp );
+ //lTemp2.AppendNum((float)lTemp );
+ ((CSvgAudioElementImpl *)iCurrentElement)->SetAttributeL (_L("volume"),lTemp2);
+ }
+ else
+ {
+ TReal32 lTemp;
+ iStream >> lTemp;
+ TBuf<16> lTemp2;
+ _LIT(KAudioLevelFormat, "%f");
+ lTemp2.Format(KAudioLevelFormat, (float)lTemp );
+ //lTemp2.AppendNum(lTemp);
+ ((CSvgAudioElementImpl *)iCurrentElement)->SetAttributeL (_L("volume"),lTemp2);
+ }
+ return ETrue;
+ }
+ else if (aName== KAtrAudioLevel)
+ {
+ if (iIsFixPt)
+ {
+ TFloatFixPt lTemp;
+ lTemp.iValue = iStream.ReadInt32L();
+ TBuf<16> lTemp2;
+ _LIT(KAudioLevelFormat, "%f");
+ lTemp2.Format(KAudioLevelFormat, (float)lTemp );
+ //lTemp2.AppendNum((float)lTemp );
+ ((CSvgAudioElementImpl *)iCurrentElement)->SetAttributeL (_L("audio-level"),lTemp2);
+ }
+ else
+ {
+ TReal32 lTemp;
+ iStream >> lTemp;
+ TBuf<16> lTemp2;
+ _LIT(KAudioLevelFormat, "%f");
+ lTemp2.Format(KAudioLevelFormat, (float)lTemp );
+ //lTemp2.AppendNum(lTemp);
+ ((CSvgAudioElementImpl *)iCurrentElement)->SetAttributeL (_L("audio-level"),lTemp2);
+ }
+ return ETrue;
+ }
+
+ switch( aName )
+ {
+ case KAtrType:
+ {
+ if(iCurrentElement->ElemID()== KSvgAnimateTransformElement)
+ {
+ if (iCurrentElement->iReqAttrFlag == KAtrSVGTrf)
+ {
+ iCurrentElement->iReqAttrFlag=KAtrAttributeName;
+ }
+ else
+ {
+ iCurrentElement->iReqAttrFlag= 0;
+ }
+ TUint8 lType, lSize;
+ iStream >> lType;
+ ((CSvgAnimationBase*)iCurrentElement)->SetAttributeType(lType);
+ iStream >> lSize;
+ ((CSvgAnimateTransformElementImpl*)iCurrentElement)->SetMatrixDataSize(lSize);
+ return ETrue;
+ }
+ else if(iCurrentElement->ElemID()== KSvgAudioElement)
+ {
+ TPtrC lPtr(DecodeTDesCLC());
+ ((CSvgAudioElementImpl*)iCurrentElement)->SetAttributeL(_L("type"),lPtr);
+ CleanupStack::PopAndDestroy( 1 );
+ return ETrue;
+ }
+ else
+ {
+ return DecodeAttributeDesL(aName);
+ }
+ }
+
+ case KAtrCdata:
+ {
+ if ( iCurrentElement->ElemID() == KSvgTextElement )
+ {
+ // DecodeTDesCLC() allocates the string on the cleanup stack
+ // and advances the file pointer beyond the CData
+ // SetTextL() makes a copy of the CData in the text element.
+ ( ( CSvgTextElementImpl* )iCurrentElement )->SetTextL(
+ DecodeTDesCLC() );
+ }
+ else
+ {
+ // Skip the CData
+ DecodeTDesCLC();
+ }
+ // Free the CData allocated inside DecodeTDesCLC()
+ CleanupStack::PopAndDestroy( 1 );
+ return ETrue;
+ }
+
+ case KAtrD:
+ case KAtrPoints:
+ {
+ iCurrentElement->iReqAttrFlag = 0;
+ return DecodeAttributePathL(aName);
+ }
+
+ case KAtrSpreadMethods:
+ case KAtrGradientUnits:
+ {
+ return DecodeAttributeIntL(aName);
+ }
+
+ case KAtrRotate:
+ {
+ // for AnimateMotion Element
+ if (iCurrentElement->ElemID()== KSvgAnimateMotionElement)
+ {
+ TInt16 lRotate;
+ iStream >> lRotate;
+ ((CSvgAnimateMotionElementImpl*)iCurrentElement)->SetAnimRotate(lRotate);
+ }
+
+ // For Text Element
+ else
+ {
+ TInt8 lCount;
+ CArrayFixFlat<TReal32>* lArray;
+ iStream >> lCount;
+ if(lCount)
+ {
+ lArray= new ( ELeave ) CArrayFixFlat<TReal32>( lCount );
+ CleanupStack::PushL(lArray); //cleanup
+ for (TInt i=0; i<lCount; i++)
+ {
+ TReal32 lTemp;
+ iStream >> lTemp;
+ lArray->AppendL((TReal32) lTemp);
+ }
+
+ if ( iCurrentElement->ElemID() == KSvgTextElement )
+ {
+ ((CSvgTextElementImpl*)iCurrentElement)->SetRotateArray (lArray);
+ }
+
+ CleanupStack::Pop(lArray); //cleanup
+ }
+ }
+
+ return ETrue;
+ }
+
+ case KAtrStopColor:
+ {
+ TUint32 lColor;
+ iStream >> lColor;
+ // Shift from XBGR to XRGB
+ if(!iIsRGB)
+ {
+ lColor = ( lColor & 0xFF000000) |
+ ( (lColor & 0x00FF0000) >> 16 ) |
+ ( lColor & 0x0000FF00 ) |
+ ( (lColor & 0x000000FF) << 16 );
+ }
+
+ if ( iCurrentElement->ElemID() == KSvgStopElement )
+ {
+ ((CSvgStopElementImpl*)iCurrentElement)->SetStopColorL(lColor);
+ }
+
+ return ETrue;
+ }
+
+ default:
+ {
+ return EFalse;
+ }
+ }
+ }
+
+// --------------------------------------------------------------------------
+// TBool CSvgDecoder::DecodeAnimationAttributeL(const TUint16 aName)
+// ---------------------------------------------------------------------------
+TBool CSvgDecoder::DecodeAnimationAttributeL(const TUint16 aName)
+ {
+
+ if (aName== KAtrAttributeName)
+ {
+ TUint16 lAtrId;
+ TUint8 lType;
+ iStream >> lAtrId;
+
+ // For Animate Transform element
+ if (iCurrentElement->ElemID()== KSvgAnimateTransformElement)
+ {
+ // Attribute Id of the animate transform has been changed. For binary compatibility
+ if (lAtrId == KAtrTransform )
+ {
+ lAtrId= KAtrAnimateTransformAttrId;
+ }
+ ((CSvgAnimationBase*)iCurrentElement)->SetAttributeId(lAtrId);
+
+ if (iCurrentElement->iReqAttrFlag == KAtrSVGTrf)
+ {
+ iCurrentElement->iReqAttrFlag=KAtrType;
+ }
+ else
+ {
+ iCurrentElement->iReqAttrFlag= 0;
+ }
+ }
+
+ //For other animation elements
+ else
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetAttributeId(lAtrId);
+ iCurrentElement->iReqAttrFlag= 0;
+ iStream >> lType;
+ ((CSvgAnimationBase*)iCurrentElement)->SetAttributeType(lType);
+ ((CSvgAnimationBase*)iCurrentElement)->GetAttrValueL();
+ }
+ return ETrue;
+ }
+
+ if (aName== KAtrBegin)
+ {
+ // Although discard element belongs to animation, the discard element isn't
+ // necessary inherited from giant AnimationBase, so handle attribute separately.
+ //
+ if ( iCurrentElement->ElemID() == KSvgDiscardElement /*||
+ iCurrentElement->ElemID() == KSvgMediaAnimationElement*/ )
+ {
+ return EFalse;
+ }
+
+ TInt8 lCheck, lCount;
+ iStream >> lCheck;
+ // Flag is used to check for Indefinite value.
+ if(lCheck)
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetAbsoluteBeginTime(KTimeIndefinite);
+ ((CSvgAnimationBase*)iCurrentElement)->SetBeginTime(KTimeIndefinite);
+ }
+ else
+ {
+ CArrayFixFlat<CSvgAnimationBase::TEventListItem>* lEventList;
+ RArray<TInt32>* lTimeList;
+ // event list
+ iStream >> lCount;
+ if (lCount)
+ {
+ lEventList= new (ELeave) CArrayFixFlat<CSvgAnimationBase::TEventListItem>(lCount);
+ }
+ else
+ {
+ lEventList= new (ELeave) CArrayFixFlat<CSvgAnimationBase::TEventListItem>(1);
+ }
+
+ CleanupStack::PushL(lEventList); //cleanup
+
+ for( TInt i=0; i<lCount; i++)
+ {
+ CSvgAnimationBase::TEventListItem lItem;
+ TInt32 lTime;
+ iStream >> lTime;
+ lItem.iTime= lTime;
+
+ TInt32 lOffset;
+ iStream >> lOffset;
+ lItem.iOffset= lOffset;
+
+ if (iIsFixPt)
+ {
+ TFloatFixPt temp;
+ temp.iValue = iStream.ReadInt32L();
+ lItem.iRepeatValue = (TReal32)temp;
+ }
+ else
+ {
+ TReal32 lValue;
+ iStream >> lValue;
+ lItem.iRepeatValue= lValue;
+ }
+
+
+ TPtrC lPtr(DecodeTDesCLC());
+ // check for the use of unique Id of the target element
+ if(lPtr == _L("unid"))
+ {
+ lItem.iTargetElement = (((CSvgAnimationBase*)iCurrentElement)->GetTargetElem());
+ lItem.iReferenceElemeId= NULL;
+ }
+ else
+ {
+ // get element by id and append its pointer.
+
+ // there can be an issue if the id is not found. in case of forward reference.
+ // for this we will store the id if it is not found at this time.
+ lItem.iTargetElement = (CSvgElementImpl*)iDocument->GetElementById( lPtr );
+ if( lItem.iTargetElement == NULL)
+ {
+ // this indicates that this is a forward reference in case of begin.
+
+ lItem.iReferenceElemeId = lPtr.AllocL();
+ }
+ else
+ {
+ // otherwise the element is found and we
+ // do not need to keep iReferenceElemeId so
+ // make it NULL;
+ lItem.iReferenceElemeId = NULL;
+ }
+ }
+
+ CleanupStack::PopAndDestroy( 1 );
+
+ TUint16 lCode;
+ iStream >> lCode;
+ lItem.iAccessKeyCode= lCode;
+
+ TInt8 lEvent;
+ iStream >> lEvent;
+ lItem.iEvent= (TSvgEvent) lEvent;
+
+ switch(lItem.iEvent)
+ {
+ case ESvgEventKey:
+ case ESvgEventNone:
+ {
+ lItem.iTargetElement =NULL;
+ break;
+ }
+ }
+ lEventList->AppendL((CSvgAnimationBase::TEventListItem) lItem);
+ }
+
+ ((CSvgAnimationBase*)iCurrentElement)->SetEventList(lEventList);
+ CleanupStack::Pop(lEventList); //cleanup
+
+ //begin time list
+ iStream >> lCount;
+ if (lCount)
+ {
+ lTimeList= new (ELeave) RArray<TInt32>(lCount);
+ }
+ else
+ {
+ lTimeList= new (ELeave) RArray<TInt32>(1);
+ }
+
+ // For proper cleanup
+ ((CSvgAnimationBase*)iCurrentElement)->SetBeginTimeList(lTimeList);
+ lTimeList->AppendL(NULL);
+ lTimeList->Remove(0);
+
+ for( TInt i=0; i<lCount; i++)
+ {
+ TInt32 lTime;
+ iStream >> lTime;
+ lTimeList->AppendL( (TInt32) lTime);
+ }
+
+ TInt32 lTime;
+ iStream >> lTime;
+ ((CSvgAnimationBase*)iCurrentElement)->SetAbsoluteBeginTime(lTime);
+ iStream >> lTime;
+ ((CSvgAnimationBase*)iCurrentElement)->SetBeginTime(lTime);
+
+
+ iStream >> lCheck;
+ // flag to ckeck Adding to the Reciever EventList
+ if(lCheck)
+ {
+ iDocument->AddToEventReceiverListL( iCurrentElement,
+ KSvgEventMaskExternalUI );
+ }
+ }
+ return ETrue;
+ }
+
+
+ if (aName== KAtrEnd) //End Time
+ {
+ TInt8 lCheck;
+ iStream >> lCheck;
+
+ // Flag is used to check for Indefinite value
+ if(lCheck)
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetEndTime(KTimeIndefinite);
+ }
+ else
+ {
+ CArrayFixFlat<CSvgAnimationBase::TEventListItem>* lTimeList;
+ // event list
+
+ lTimeList= new (ELeave) CArrayFixFlat<CSvgAnimationBase::TEventListItem>(1);
+ CleanupStack::PushL(lTimeList); //cleanup
+
+ CSvgAnimationBase::TEventListItem lItem;
+ TInt8 lEvent;
+ iStream >> lEvent;
+ lItem.iEvent = (TSvgEvent) lEvent;
+
+ if (iIsFixPt)
+ {
+ TFloatFixPt temp;
+ temp.iValue = iStream.ReadInt32L();
+ lItem.iRepeatValue = (TReal32)temp;
+ }
+ else
+ {
+ TReal32 lValue;
+ iStream >> lValue;
+ lItem.iRepeatValue= lValue;
+ }
+
+
+ TPtrC lPtr( DecodeTDesCLC() );
+
+ if (lPtr == _L("unid") )
+ {
+ lItem.iTargetElement = ((CSvgAnimationBase*)iCurrentElement)->GetTargetElem();
+ lItem.iReferenceElemeId = NULL;
+ }
+ else
+ {
+ // get element by id and append its pointer.
+ lItem.iTargetElement = ( CSvgElementImpl * )
+ iDocument->GetElementById( lPtr );
+ if(lItem.iTargetElement == NULL)
+ {
+ lItem.iReferenceElemeId = lPtr.AllocL();
+ }
+ else
+ {
+ // Set the iEndReferenceElemeId to NULL:
+ lItem.iReferenceElemeId = NULL;
+ }
+ }
+
+ CleanupStack::PopAndDestroy( 1 );
+
+ switch ( lItem.iEvent )
+ {
+ case ESvgEventKey:
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetEndTime(KTimeIndefinite ); // same as indefinite
+
+ TUint16 lCode;
+ iStream >> lCode;
+ lItem.iAccessKeyCode= lCode;
+ lItem.iTargetElement =NULL;
+ iDocument->AddToEventReceiverListL( iCurrentElement,
+ KSvgEventMaskExternalUI );
+ break;
+ }
+ case ESvgEventWallClock:
+ // not supported yet
+ break;
+ case ESvgEventNone:
+ {
+ TInt32 lTime;
+ iStream >> lTime;
+ lItem.iTime= lTime;
+ ((CSvgAnimationBase*)iCurrentElement)->AddEndTime(lTime);
+ lItem.iTargetElement =NULL;
+ break;
+ }
+ default:
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetEndTime( KTimeIndefinite ); // same as indifinite
+ TInt32 lOffset;
+ iStream >> lOffset;
+ lItem.iOffset= lOffset;
+
+ lItem.iTime = KTimeIndefinite;
+ iDocument->AddToEventReceiverListL( iCurrentElement,
+ KSvgEventMaskInternal );
+ }
+
+ }
+ lTimeList->AppendL( (CSvgAnimationBase::TEventListItem) lItem);
+ ((CSvgAnimationBase*)iCurrentElement)->SetEndTimeList( lTimeList);
+ CleanupStack::Pop(lTimeList); //cleanup
+
+ }
+
+ return ETrue;
+ }
+
+////////// for multiple end times
+
+ if (aName== KMultipleEndTime)
+ {
+ TInt8 lCount;
+
+ CArrayFixFlat<CSvgAnimationBase::TEventListItem>* lTimeList;
+ // event list
+ iStream >> lCount;
+ if (lCount)
+ {
+ lTimeList= new (ELeave) CArrayFixFlat<CSvgAnimationBase::TEventListItem>(lCount);
+ }
+ else
+ {
+ lTimeList= new (ELeave) CArrayFixFlat<CSvgAnimationBase::TEventListItem>(1);
+ }
+
+ CleanupStack::PushL(lTimeList); //cleanup
+
+ for( TInt i=0; i<lCount; i++)
+ {
+ CSvgAnimationBase::TEventListItem lItem;
+ TInt32 lTime;
+ iStream >> lTime;
+ lItem.iTime= lTime;
+
+ TInt32 lOffset;
+ iStream >> lOffset;
+ lItem.iOffset= lOffset;
+
+ if (iIsFixPt)
+ {
+ TFloatFixPt temp;
+ temp.iValue = iStream.ReadInt32L();
+ lItem.iRepeatValue = (TReal32)temp;
+ }
+ else
+ {
+ TReal32 lValue;
+ iStream >> lValue;
+ lItem.iRepeatValue= lValue;
+ }
+
+
+ TPtrC lPtr(DecodeTDesCLC());
+ // check for the use of unique Id of the target element
+ if(lPtr == _L("unid"))
+ {
+ lItem.iTargetElement = (((CSvgAnimationBase*)iCurrentElement)->GetTargetElem());
+ lItem.iReferenceElemeId= NULL;
+ }
+ else
+ {
+ // get element by id and append its pointer.
+ // there can be an issue if the id is not found. in case of forward reference.
+ // for this we will store the id if it is not found at this time.
+ lItem.iTargetElement = (CSvgElementImpl*)iDocument->GetElementById( lPtr );
+ if( lItem.iTargetElement == NULL)
+ {
+ // this indicates that this is a forward reference in case of begin.
+
+ lItem.iReferenceElemeId = lPtr.AllocL();
+ }
+ else
+ {
+ // otherwise the element is found and we
+ // do not need to keep iReferenceElemeId so
+ // make it NULL;
+ lItem.iReferenceElemeId = NULL;
+ }
+ }
+
+ CleanupStack::PopAndDestroy( 1 );
+
+ TUint16 lCode;
+ iStream >> lCode;
+ lItem.iAccessKeyCode= lCode;
+
+ TInt8 lEvent;
+ iStream >> lEvent;
+ lItem.iEvent= (TSvgEvent) lEvent;
+
+ switch ( lItem.iEvent )
+ {
+ case ESvgEventKey:
+ lItem.iTargetElement =NULL;
+ ((CSvgAnimationBase*)iCurrentElement)->SetEndTime( KTimeIndefinite ); // same as indefinite
+
+ iDocument->AddToEventReceiverListL( iCurrentElement,
+ KSvgEventMaskExternalUI );
+ break;
+
+ case ESvgEventWallClock:
+ // not supported yet
+ break;
+
+ case ESvgEventNone:
+ lItem.iTargetElement =NULL;
+ // Simple Offset-value
+ ((CSvgAnimationBase*)iCurrentElement)->AddEndTime( lItem.iTime );
+
+ break;
+
+ default:
+ // <id>.<event> +/- <offeset>
+ ((CSvgAnimationBase*)iCurrentElement)->SetEndTime( KTimeIndefinite ); // same as indifinite
+
+ iDocument->AddToEventReceiverListL( iCurrentElement,
+ KSvgEventMaskInternal );
+ }
+
+ lTimeList->AppendL((CSvgAnimationBase::TEventListItem) lItem);
+ }
+
+ ((CSvgAnimationBase*)iCurrentElement)->SetEndTimeList(lTimeList);
+ CleanupStack::Pop(lTimeList); //cleanup
+
+
+
+
+ return ETrue;
+ }
+
+
+ if (aName== KAtrDur)
+ {
+ TInt32 lTime;
+ TInt8 lCheck;
+ iStream >> lTime;
+ ((CSvgAnimationBase*)iCurrentElement)->SetDurationTime(lTime);
+ iStream >> lCheck;
+ // Flag is used to check for Indefinite value
+ if(lCheck)
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetBeginTime(KTimeIndefinite);
+ }
+ return ETrue;
+ }
+
+ if (aName== KAtrFrom)
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetFromFlag();
+
+ //For Animate Transform element
+ if(iCurrentElement->ElemID()== KSvgAnimateTransformElement)
+ {
+ CSvgAnimateTransformElementImpl::TMatrixData lMatrix;
+
+ if (iIsFixPt)
+ {
+ for (TInt i=0; i<3; i++)
+ {
+ lMatrix.iData[i].iValue = iStream.ReadInt32L();
+ }
+ }
+ else
+ {
+ TReal32 lTemp;
+ for (TInt i=0; i<3; i++)
+ {
+ iStream >> lTemp;
+ lMatrix.iData[i]= (TFloatFixPt) lTemp;
+ }
+ }
+
+ ((CSvgAnimateTransformElementImpl*)iCurrentElement)->SetMatrixData(0,lMatrix);
+ }
+
+ // for other Animation elements
+ else
+ {
+
+ TUint8 lType;
+ iStream >>lType;
+ ((CSvgAnimationBase*)iCurrentElement)->SetAttributeType(lType);
+ switch ( lType )
+ {
+ case KSvgTypeOpacity:
+ case KSvgTypeLength:
+ {
+ if (iIsFixPt)
+ {
+ TFloatFixPt lValue;
+ lValue.iValue = iStream.ReadInt32L();
+ ((CSvgAnimationBase*)iCurrentElement)->SetFromFloat(lValue);
+ }
+ else
+ {
+ TReal32 lValue;
+ iStream >> lValue;
+ ((CSvgAnimationBase*)iCurrentElement)->SetFromFloat((TFloatFixPt)lValue);
+ }
+
+ break;
+ }
+ case KSvgTypeList:
+ case KSvgTypePath:
+ {
+ CGfxGeneralPath* lPath;
+ DecodeAnimationPathL(lPath);
+ ((CSvgAnimationBase*)iCurrentElement)->SetFromPathL(lPath);
+ break;
+ }
+ case KSvgTypeColor:
+ {
+ TInt32 lColor;
+ iStream >> lColor;
+ // Shift from XBGR to XRGB
+ if(!iIsRGB)
+ {
+ lColor = ( lColor & 0xFF000000) |
+ ( (lColor & 0x00FF0000) >> 16 ) |
+ ( lColor & 0x0000FF00 ) |
+ ( (lColor & 0x000000FF) << 16 );
+ }
+ ((CSvgAnimationBase*)iCurrentElement)->SetFromInt(lColor);
+ break;
+ }
+ case KSvgTypeTextAnchor:
+ case KSvgTypeGradientUnits:
+ case KSvgTypeSpreadMethod:
+ case KSvgTypeInteger:
+ case KSvgTypeDisplay:
+ case KSvgTypeVisibility:
+ {
+ TInt32 lTemp;
+ iStream >> lTemp;
+ ((CSvgAnimationBase*)iCurrentElement)->SetFromInt(lTemp);
+ break;
+ }
+
+ // viewBox attribute
+ case KSvgTypeViewBox:
+ {
+
+ if (iIsFixPt)
+ {
+ TGfxRectangle2D temp;
+ temp.iX.iValue = iStream.ReadInt32L();
+
+ temp.iY.iValue = iStream.ReadInt32L();
+ temp.iWidth.iValue = iStream.ReadInt32L();
+ temp.iHeight.iValue = iStream.ReadInt32L();
+
+ ((CSvgAnimationBase*)iCurrentElement)->SetFromViewBox(temp);
+ }
+ else
+ {
+ TReal32 lValue;
+ TGfxRectangle2D temp;
+
+ this->iStream >> lValue;
+ temp.iX = (TFloatFixPt) lValue;
+ this->iStream >> lValue;
+ temp.iY = (TFloatFixPt) lValue;
+ this->iStream >> lValue;
+ temp.iWidth = (TFloatFixPt) lValue;
+ this->iStream >> lValue;
+ temp.iHeight = (TFloatFixPt) lValue;
+
+ ((CSvgAnimationBase*)iCurrentElement)->SetFromViewBox(temp);
+ }
+ break;
+ }
+ }
+ }
+ return ETrue;
+ }
+
+ if (aName== KAtrTo)
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetToFlag();
+
+ // For Animate Transform
+ if(iCurrentElement->ElemID()== KSvgAnimateTransformElement)
+ {
+ if( ((CSvgAnimationBase*)iCurrentElement)->GetFromFlag() )
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetAdditive(KAdditiveSum);
+ }
+ CSvgAnimateTransformElementImpl::TMatrixData lMatrix;
+
+ if (iIsFixPt)
+ {
+ for (TInt i=0; i<3; i++)
+ {
+ lMatrix.iData[i].iValue = iStream.ReadInt32L();
+ }
+ }
+ else
+ {
+ TReal32 lTemp;
+ for (TInt i=0; i<3; i++)
+ {
+ iStream >> lTemp;
+ lMatrix.iData[i]= (TFloatFixPt) lTemp;
+ }
+ }
+
+ ((CSvgAnimateTransformElementImpl*)iCurrentElement)->SetMatrixData(1,lMatrix);
+ ((CSvgAnimateTransformElementImpl*)iCurrentElement)->SetAccumMatrix();
+ }
+
+ // for Other Animation Elements
+ else
+ {
+ TUint8 lType;
+ iStream >>lType;
+ ((CSvgAnimationBase*)iCurrentElement)->SetAttributeType(lType);
+ switch ( lType )
+ {
+ case KSvgTypeOpacity:
+ case KSvgTypeLength:
+ {
+
+ if (iIsFixPt)
+ {
+ TFloatFixPt lValue;
+ lValue.iValue = iStream.ReadInt32L();
+ ((CSvgAnimationBase*)iCurrentElement)->SetToFloat(lValue);
+ }
+ else
+ {
+ TReal32 lValue;
+ iStream >> lValue;
+ ((CSvgAnimationBase*)iCurrentElement)->SetToFloat((TFloatFixPt)lValue);
+ }
+
+ break;
+ }
+ case KSvgTypeList:
+ case KSvgTypePath:
+ {
+ CGfxGeneralPath* lPath;
+ DecodeAnimationPathL(lPath);
+ ((CSvgAnimationBase*)iCurrentElement)->SetToPath(lPath);
+ break;
+ }
+ case KSvgTypeColor:
+ {
+ TInt32 lColor;
+ iStream >> lColor;
+ // Shift from XBGR to XRGB
+ if(!iIsRGB)
+ {
+ lColor = ( lColor & 0xFF000000) |
+ ( (lColor & 0x00FF0000) >> 16 ) |
+ ( lColor & 0x0000FF00 ) |
+ ( (lColor & 0x000000FF) << 16 );
+ }
+ ((CSvgAnimationBase*)iCurrentElement)->SetToInt(lColor);
+ break;
+ }
+ case KSvgTypeTextAnchor:
+ case KSvgTypeGradientUnits:
+ case KSvgTypeSpreadMethod:
+ case KSvgTypeInteger:
+ case KSvgTypeDisplay:
+ case KSvgTypeVisibility:
+ {
+ TInt32 lTemp;
+ iStream >> lTemp;
+ ((CSvgAnimationBase*)iCurrentElement)->SetToInt(lTemp);
+ break;
+ }
+
+ // viewBox attribute
+ case KSvgTypeViewBox:
+ {
+ if (iIsFixPt)
+ {
+ TGfxRectangle2D temp;
+ temp.iX.iValue = iStream.ReadInt32L();
+ temp.iY.iValue = iStream.ReadInt32L();
+ temp.iWidth.iValue = iStream.ReadInt32L();
+ temp.iHeight.iValue = iStream.ReadInt32L();
+
+ ((CSvgAnimationBase*)iCurrentElement)->SetToViewBox(temp);
+ }
+ else
+ {
+ TReal32 lValue;
+ TGfxRectangle2D temp;
+
+ this->iStream >> lValue;
+ temp.iX = (TFloatFixPt) lValue;
+ this->iStream >> lValue;
+ temp.iY = (TFloatFixPt) lValue;
+ this->iStream >> lValue;
+ temp.iWidth = (TFloatFixPt) lValue;
+ this->iStream >> lValue;
+ temp.iHeight = (TFloatFixPt) lValue;
+
+ ((CSvgAnimationBase*)iCurrentElement)->SetToViewBox(temp);
+ }
+
+ break;
+ }
+
+ }
+ }
+ return ETrue;
+
+ }
+
+ if (aName== KAtrBy) //by
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetByFlag();
+
+ // For Animate Transform
+ if(iCurrentElement->ElemID()== KSvgAnimateTransformElement)
+ {
+ if( ((CSvgAnimationBase*)iCurrentElement)->GetFromFlag() )
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetAdditive(KAdditiveSum);
+ }
+ CSvgAnimateTransformElementImpl::TMatrixData lMatrix;
+
+ if (iIsFixPt)
+ {
+ for (TInt i=0; i<3; i++)
+ {
+ lMatrix.iData[i].iValue = iStream.ReadInt32L();
+ }
+ }
+ else
+ {
+ TReal32 lTemp;
+ for (TInt i=0; i<3; i++)
+ {
+ iStream >> lTemp;
+ lMatrix.iData[i]= (TFloatFixPt) lTemp;
+ }
+ }
+
+ ((CSvgAnimateTransformElementImpl*)iCurrentElement)->SetMatrixData(1,lMatrix);
+ }
+
+ // for Other Animation Elements
+ else
+ {
+ TUint8 lType;
+ iStream >>lType;
+ ((CSvgAnimationBase*)iCurrentElement)->SetAttributeType(lType);
+ switch ( lType )
+ {
+ case KSvgTypeOpacity:
+ case KSvgTypeLength:
+ {
+ if (iIsFixPt)
+ {
+ TFloatFixPt lValue;
+ lValue.iValue = iStream.ReadInt32L();
+
+ ((CSvgAnimationBase*)iCurrentElement)->SetToFloat( lValue );
+ if( ((CSvgAnimationBase*)iCurrentElement)->GetFromFlag() )
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetAdditive(KAdditiveSum);
+ ((CSvgAnimationBase*)iCurrentElement)->SetFromFlag();
+ ((CSvgAnimationBase*)iCurrentElement)->SetFromFloat((TFloatFixPt)0);
+ }
+ }
+ else
+ {
+ TReal32 lValue;
+ iStream >> lValue;
+
+ ((CSvgAnimationBase*)iCurrentElement)->SetToFloat((TFloatFixPt)lValue);
+ if( ((CSvgAnimationBase*)iCurrentElement)->GetFromFlag() )
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetAdditive(KAdditiveSum);
+ ((CSvgAnimationBase*)iCurrentElement)->SetFromFlag();
+ ((CSvgAnimationBase*)iCurrentElement)->SetFromFloat((TFloatFixPt)0);
+ }
+ }
+
+ break;
+ }
+ case KSvgTypeList:
+ case KSvgTypePath:
+ {
+ CGfxGeneralPath* lPath;
+ DecodeAnimationPathL(lPath);
+ ((CSvgAnimationBase*)iCurrentElement)->SetToPath(lPath);
+ break;
+ }
+
+ case KSvgTypeColor:
+ {
+ TInt32 lColor;
+ iStream >> lColor;
+ // Shift from XBGR to XRGB
+ if(!iIsRGB)
+ {
+ lColor = ( lColor & 0xFF000000) |
+ ( (lColor & 0x00FF0000) >> 16 ) |
+ ( lColor & 0x0000FF00 ) |
+ ( (lColor & 0x000000FF) << 16 );
+ }
+ ((CSvgAnimationBase*)iCurrentElement)->SetToInt(lColor);
+ if( ((CSvgAnimationBase*)iCurrentElement)->GetFromFlag() )
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetFromInt((TInt32)0);
+ }
+ break;
+ }
+ case KSvgTypeTextAnchor:
+ case KSvgTypeGradientUnits:
+ case KSvgTypeSpreadMethod:
+ case KSvgTypeInteger:
+ {
+ TInt32 lTemp;
+ iStream >> lTemp;
+ ((CSvgAnimationBase*)iCurrentElement)->SetToInt(lTemp);
+ if( ((CSvgAnimationBase*)iCurrentElement)->GetFromFlag() )
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetAdditive(KAdditiveSum);
+ ((CSvgAnimationBase*)iCurrentElement)->SetFromFlag();
+ ((CSvgAnimationBase*)iCurrentElement)->SetFromInt((TInt32)0);
+ }
+ break;
+ }
+
+ case KSvgTypeDisplay:
+ case KSvgTypeVisibility:
+ {
+ TInt32 lTemp;
+ iStream >> lTemp;
+ ((CSvgAnimationBase*)iCurrentElement)->SetToInt(lTemp);
+ break;
+ }
+
+ // viewBox attribute
+ case KSvgTypeViewBox:
+ {
+ if (iIsFixPt)
+ {
+ TGfxRectangle2D temp;
+ temp.iX.iValue = iStream.ReadInt32L();
+ temp.iY.iValue = iStream.ReadInt32L();
+ temp.iWidth.iValue = iStream.ReadInt32L();
+ temp.iHeight.iValue = iStream.ReadInt32L();
+
+ ((CSvgAnimationBase*)iCurrentElement)->SetToViewBox(temp);
+ }
+ else
+ {
+ TReal32 lValue;
+ TGfxRectangle2D temp;
+
+ iStream >> lValue;
+ temp.iX = (TFloatFixPt) lValue;
+ iStream >> lValue;
+ temp.iY = (TFloatFixPt) lValue;
+ iStream >> lValue;
+ temp.iWidth = (TFloatFixPt) lValue;
+ iStream >> lValue;
+ temp.iHeight = (TFloatFixPt) lValue;
+
+ ((CSvgAnimationBase*)iCurrentElement)->SetToViewBox(temp);
+ }
+
+ if( ((CSvgAnimationBase*)iCurrentElement)->GetFromFlag() )
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetAdditive(KAdditiveSum);
+ ((CSvgAnimationBase*)iCurrentElement)->SetFromFlag();
+ ((CSvgAnimationBase*)iCurrentElement)->SetFromViewBox
+ (TGfxRectangle2D( 0, 0, 0, 0 ) );
+ }
+ break;
+ }
+ }
+ }
+ return ETrue;
+
+ }
+
+
+ if (aName== KAtrValues) // values
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetFromFlag();
+ ((CSvgAnimationBase*)iCurrentElement)->SetValuesFlag();
+
+ // For Animate Transform
+ if(iCurrentElement->ElemID()== KSvgAnimateTransformElement)
+ {
+ TUint16 lCount;
+ RArray<CSvgAnimateTransformElementImpl::TMatrixData>* lValues= NULL;
+
+ iStream >>lCount;
+ if (lCount)
+ {
+ lValues= new (ELeave) RArray<CSvgAnimateTransformElementImpl::TMatrixData>(lCount);
+ }
+ else
+ {
+ lValues= new (ELeave) RArray<CSvgAnimateTransformElementImpl::TMatrixData>(1);
+ }
+
+ // for proper cleanup
+ ((CSvgAnimateTransformElementImpl*)iCurrentElement)->SetTransformValues(lValues);
+ CSvgAnimateTransformElementImpl::TMatrixData lMatrix1;
+ lValues->AppendL(lMatrix1);
+ lValues->Remove(0);
+
+ for (TInt i=0; i<lCount; i++)
+ {
+ CSvgAnimateTransformElementImpl::TMatrixData lMatrix;
+
+ if (iIsFixPt)
+ {
+ for (TInt i=0; i<3; i++)
+ {
+ lMatrix.iData[i].iValue = iStream.ReadInt32L();
+ }
+ }
+ else
+ {
+ TReal32 lTemp;
+ for (TInt i=0; i<3; i++)
+ {
+ iStream >> lTemp;
+ lMatrix.iData[i]= (TFloatFixPt) lTemp;
+ }
+ }
+
+ lValues->AppendL( (CSvgAnimateTransformElementImpl::TMatrixData) lMatrix);
+ }
+ if(iCurrentElement->ElemID()== KSvgAnimateTransformElement)
+ {
+ ((CSvgAnimateTransformElementImpl*)iCurrentElement)->SetAccumMatrix();
+ }
+ }
+
+
+ // For other Animation elements
+ else
+ {
+ TUint8 lType;
+ iStream >>lType;
+ ((CSvgAnimationBase*)iCurrentElement)->SetAttributeType(lType);
+ switch ( lType )
+ {
+ case KSvgTypeOpacity:
+ case KSvgTypeLength:
+ {
+ RArray<TFloatFixPt>* lArray;
+ TUint16 lCount;
+ iStream >> lCount;
+ if (lCount)
+ {
+ lArray= new (ELeave) RArray<TFloatFixPt>(lCount);
+ }
+ else
+ {
+ lArray= new (ELeave) RArray<TFloatFixPt>(1);
+ }
+
+ // for proper cleanup
+ ((CSvgAnimationBase*)iCurrentElement)->SetFloatValuesArray(lArray);
+ lArray->AppendL(NULL);
+ lArray->Remove(0);
+
+ TFloatFixPt lValueFix;
+ TReal32 lValueFloat;
+
+ for(TInt i=0; i<lCount; i++)
+ {
+
+ if(iIsFixPt)
+ {
+ lValueFix.iValue = iStream.ReadInt32L();
+ lArray->AppendL( lValueFix );
+ }
+ else
+ {
+ iStream >> lValueFloat;
+ lArray->AppendL((TFloatFixPt) lValueFloat);
+ }
+
+ }
+ break;
+ }
+ case KSvgTypeList:
+ case KSvgTypePath:
+ {
+ TUint16 lCount;
+ RPointerArray<CGfxGeneralPath>* lArray;
+ iStream >> lCount;
+ if (lCount)
+ {
+ lArray= new (ELeave) RPointerArray<CGfxGeneralPath>(lCount);
+ }
+ else
+ {
+ lArray= new (ELeave) RPointerArray<CGfxGeneralPath>(1);
+ }
+
+ // for proper cleanup
+ ((CSvgAnimationBase*)iCurrentElement)->ResetFloatValuesArray();
+ ((CSvgAnimationBase*)iCurrentElement)->SetPathValuesArray(lArray);
+ lArray->AppendL(NULL);
+ lArray->Remove(0);
+ for(TInt i=0; i<lCount; i++)
+ {
+ CGfxGeneralPath* lPath;
+ DecodeAnimationPathL(lPath);
+ lArray->AppendL( (CGfxGeneralPath*)lPath );
+ }
+ break;
+ }
+
+ case KSvgTypeColor:
+ {
+ RArray<TInt32>* lArray;
+ TUint16 lCount;
+ iStream >> lCount;
+ if (lCount)
+ {
+ lArray= new (ELeave) RArray<TInt32>(lCount);
+ }
+ else
+ {
+ lArray= new (ELeave) RArray<TInt32>(1);
+ }
+
+ // for proper cleanup
+ ((CSvgAnimationBase*)iCurrentElement)->ResetFloatValuesArray();
+ ((CSvgAnimationBase*)iCurrentElement)->SetIntValuesArray(lArray);
+ lArray->AppendL(NULL);
+ lArray->Remove(0);
+
+ for(TInt i=0; i<lCount; i++)
+ {
+ TInt32 lColor;
+ iStream >> lColor;
+ if(!iIsRGB)
+ {
+ lColor = ( lColor & 0xFF000000) |
+ ( (lColor & 0x00FF0000) >> 16 ) |
+ ( lColor & 0x0000FF00 ) |
+ ( (lColor & 0x000000FF) << 16 );
+ }
+ lArray->AppendL((TInt32) lColor);
+ }
+ break;
+ }
+
+ case KSvgTypeGradientUnits:
+ case KSvgTypeSpreadMethod:
+ case KSvgTypeInteger:
+ case KSvgTypeDisplay:
+ case KSvgTypeVisibility:
+ case KSvgTypeTextAnchor:
+ {
+ RArray<TInt32>* lArray;
+ TUint16 lCount;
+ iStream >> lCount;
+ if (lCount)
+ {
+ lArray= new (ELeave) RArray<TInt32>(lCount);
+ }
+ else
+ {
+ lArray= new (ELeave) RArray<TInt32>(1);
+ }
+
+ // for proper cleanup
+ ((CSvgAnimationBase*)iCurrentElement)->ResetFloatValuesArray();
+ ((CSvgAnimationBase*)iCurrentElement)->SetIntValuesArray(lArray);
+ lArray->AppendL(NULL);
+ lArray->Remove(0);
+
+ for(TInt i=0; i<lCount; i++)
+ {
+ TInt32 lValue;
+ iStream >> lValue;
+ lArray->AppendL((TInt32) lValue);
+ }
+ break;
+ }
+
+ // viewBox
+ case KSvgTypeViewBox:
+ {
+ RArray<TGfxRectangle2D>* lArray;
+ TUint16 lCount;
+ iStream >> lCount;
+ if (lCount)
+ {
+ lArray= new (ELeave) RArray<TGfxRectangle2D>(lCount);
+ }
+ else
+ {
+ lArray= new (ELeave) RArray<TGfxRectangle2D>(1);
+ }
+ TGfxRectangle2D temp1;
+ // for proper cleanup
+ ((CSvgAnimationBase*)iCurrentElement)->SetViewBoxValuesArray(lArray);
+ lArray->AppendL(temp1);
+ lArray->Remove(0);
+
+
+ TGfxRectangle2D temp;
+ TReal32 lValueFloat;
+ for(TInt i=0; i<lCount; i++)
+ {
+
+ if (iIsFixPt)
+ {
+ temp.iX.iValue = iStream.ReadInt32L();
+ temp.iY.iValue = iStream.ReadInt32L();
+ temp.iWidth.iValue = iStream.ReadInt32L();
+ temp.iHeight.iValue = iStream.ReadInt32L();
+
+ lArray->AppendL((TGfxRectangle2D) temp);
+ }
+ else
+ {
+ iStream >> lValueFloat;
+ temp.iX = (TFloatFixPt) lValueFloat;
+ iStream >> lValueFloat;
+ temp.iY = (TFloatFixPt) lValueFloat;
+ iStream >> lValueFloat;
+ temp.iWidth = (TFloatFixPt) lValueFloat;
+ iStream >> lValueFloat;
+ temp.iHeight = (TFloatFixPt) lValueFloat;
+
+ lArray->AppendL((TGfxRectangle2D) temp);
+ }
+ }
+ break;
+ }
+ }
+ }
+ return ETrue;
+
+ }
+
+ // Used to set the Fill attribute of Animation elements
+ if (aName== KAnimFreeze)
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetAnimFreeze();
+ return ETrue;
+ }
+
+ if (aName== KAtrRepeatDur)
+ {
+ TUint32 lDur;
+ iStream >> lDur;
+ ((CSvgAnimationBase*)iCurrentElement)->SetRepeatDuration(lDur);
+ return ETrue;
+ }
+
+ if (aName== KAtrRepeatCount)
+ {
+
+ if (iIsFixPt)
+ {
+ TFloatFixPt lCount;
+ lCount.iValue = iStream.ReadInt32L();
+ ((CSvgAnimationBase*)iCurrentElement)->SetRepeatCount(lCount.iValue);
+ }
+ else
+ {
+ TReal32 lCount;
+ iStream >> lCount;
+ ((CSvgAnimationBase*)iCurrentElement)->SetRepeatCount(lCount);
+ }
+
+ return ETrue;
+ }
+
+ if (aName== KAtrRestart)
+ {
+ TUint8 lMode;
+ iStream >> lMode;
+ ((CSvgAnimationBase*)iCurrentElement)->SetRestartMode((TRestartMode)lMode);
+ return ETrue;
+ }
+
+ if (aName== KAtrAccumulate)
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetAccumulate(KAccumSum);
+ return ETrue;
+ }
+
+ if (aName== KAtrAdditive)
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetAdditive(KAdditiveSum);
+ return ETrue;
+ }
+
+ if (aName== KAtrCalcMode)
+ {
+ TUint8 lMode;
+ iStream >> lMode;
+ ((CSvgAnimationBase*)iCurrentElement)->SetCalcMode((TAnimCalcMode) lMode);
+ return ETrue;
+ }
+
+ if (aName== KAtrKeyTimes)
+ {
+ TUint16 lCount;
+ RArray<CSvgAnimTimeController::TKeyTime>* lArray;
+ iStream >> lCount;
+ if (lCount)
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetKeyTimeFlag();
+ lArray= new (ELeave) RArray<CSvgAnimTimeController::TKeyTime>(lCount);
+ }
+ else
+ {
+ lArray= new (ELeave) RArray<CSvgAnimTimeController::TKeyTime>(1);
+ }
+ CSvgAnimTimeController::TKeyTime lTime1;
+ // for proper cleanup
+ ((CSvgAnimationBase*)iCurrentElement)->SetKeyTimeArray(lArray);
+ lArray->AppendL(lTime1);
+ lArray->Remove(0);
+
+ for (TInt i=0; i<lCount; i++)
+ {
+ TUint8 lTemp;
+ CSvgAnimTimeController::TKeyTime lTime;
+ iStream >> lTemp;
+ lTime.iX = (TUint16) (lTemp);
+ iStream >> lTemp;
+ lTime.iY = (TUint16) (lTemp);
+ lArray->AppendL( (CSvgAnimTimeController::TKeyTime) lTime);
+ }
+ return ETrue;
+ }
+
+ if (aName== KAtrKeySplines)
+ {
+ TUint16 lCount;
+ RArray<CSvgAnimTimeController::TKeyTime>* lArray;
+ RArray<TUint32>* lAnimArray;
+
+ // keyTime Array
+ iStream >> lCount;
+ if (lCount)
+ {
+ lArray= new (ELeave) RArray<CSvgAnimTimeController::TKeyTime>(lCount);
+ }
+ else
+ {
+ lArray= new (ELeave) RArray<CSvgAnimTimeController::TKeyTime>(1);
+ }
+ CSvgAnimTimeController::TKeyTime lTime1;
+ // for proper cleanup
+ ((CSvgAnimationBase*)iCurrentElement)->SetKeyTimeArray(lArray);
+ lArray->AppendL(lTime1);
+ lArray->Remove(0);
+ for (TInt i=0; i<lCount; i++)
+ {
+ TUint8 lTemp;
+ CSvgAnimTimeController::TKeyTime lTime;
+ iStream >> lTemp;
+ lTime.iX = (TUint16) (lTemp);
+ iStream >> lTemp;
+ lTime.iY = (TUint16) (lTemp);
+ lArray->AppendL( (CSvgAnimTimeController::TKeyTime) lTime);
+ }
+
+ //AnimTime Array
+ iStream >> lCount;
+ if (lCount)
+ {
+ lAnimArray = new (ELeave) RArray<TUint32>(lCount);
+ }
+ else
+ {
+ lAnimArray= new (ELeave) RArray<TUint32>(1);
+ }
+
+ ((CSvgAnimationBase*)iCurrentElement)->SetAnimTimeArray(lAnimArray);
+ lAnimArray->AppendL(NULL);
+ lAnimArray->Remove(0);
+
+ for (TInt i=0; i<lCount; i++)
+ {
+ TUint8 lTemp;
+ iStream >> lTemp;
+ lAnimArray->AppendL( (TUint32) lTemp);
+ }
+ return ETrue;
+ }
+
+
+ // Animate motion Element is handled here
+ if (aName== KAtrAnimateMotion)
+ {
+ DecodeAttributePathL(KAtrAnimateMotion);
+ TUint8 lFlag;
+ iStream >> lFlag;
+ if(lFlag == KAtrAdditiveSet)
+ {
+ iCurrentElement->iReqAttrFlag= 0;
+ ((CSvgAnimationBase*)iCurrentElement)->SetAdditive(KAdditiveSum);
+ return ETrue;
+ }
+ iCurrentElement->iReqAttrFlag= lFlag;
+ return ETrue;
+ }
+
+ if (aName== KAtrXlinkhref)
+ {
+ _LIT( KXlink, "xlink:href" );
+ TPtrC lPtr(DecodeTDesCLC());
+ CSvgMediaAnimationElementImpl* mediaElement = static_cast<CSvgMediaAnimationElementImpl*>(iCurrentElement);
+ mediaElement->SetAttributeL(KXlink, lPtr);
+ CleanupStack::PopAndDestroy(1);
+ return ETrue;
+ }
+
+ if( aName == KAtrSyncBehavior )
+ {
+ TUint8 syncBehavior;
+ iStream>>syncBehavior;
+ ((CSvgMediaElementBase*)iCurrentElement)->SetSyncBehavior( (TSvgSyncBehaviour) syncBehavior );
+ return ETrue;
+ }
+ else if( aName == KAtrSyncTolerance)
+ {
+ TUint8 syncTolerance;
+ iStream>>syncTolerance;
+ ((CSvgMediaElementBase*)iCurrentElement)->SetSyncTolerance( syncTolerance, EFalse );
+ return ETrue;
+ }
+ else if( aName == KAtrSyncMaster )
+ {
+ TUint8 syncMaster ;
+ iStream>>syncMaster ;
+ ((CSvgMediaElementBase*)iCurrentElement)->SetSyncMaster( syncMaster );
+ return ETrue;
+ }
+
+ return EFalse;
+ }
+
+
+
+// --------------------------------------------------------------------------
+// TBool CSvgDecoder::DecodeSvgElementAttributeL(const TUint16 aName)
+// ---------------------------------------------------------------------------
+TBool CSvgDecoder::DecodeSvgElementAttributeL(const TUint16 aName)
+ {
+ if ( ( aName<= KSvgSVGAttrEndIndex) ||
+ ( aName == KAtrSyncBehaviorDefault ) || // To support backward compatibility
+ ( aName == KAtrSyncToleranceDefault ))
+ {
+
+ if (aName== KAtrViewBox)
+ {
+ TGfxRectangle2D lRect;
+
+ if (iIsFixPt)
+ {
+ lRect.iX.iValue = iStream.ReadInt32L();
+ lRect.iY.iValue = iStream.ReadInt32L();
+ lRect.iWidth.iValue = iStream.ReadInt32L();
+ lRect.iHeight.iValue = iStream.ReadInt32L();
+
+ ((CSvgSvgElementImpl *)iCurrentElement)->SetViewBoxL(lRect);
+ }
+ else
+ {
+ TReal32 lTemp;
+
+ iStream >> lTemp;
+ lRect.iX= (TFloatFixPt) lTemp;
+ iStream >> lTemp;
+ lRect.iY= (TFloatFixPt) lTemp;
+ iStream >> lTemp;
+ lRect.iWidth= (TFloatFixPt) lTemp;
+ iStream >> lTemp;
+ lRect.iHeight= (TFloatFixPt) lTemp;
+
+ ((CSvgSvgElementImpl *)iCurrentElement)->SetViewBoxL(lRect);
+ }
+ return ETrue;
+ }
+
+ if (aName== KAtrBaseProfile)
+ {
+ ((CSvgSvgElementImpl *)iCurrentElement)->SetBaseProfileL(DecodeTDesCLC());
+ CleanupStack::PopAndDestroy( 1 );
+ return ETrue;
+ }
+
+ if (aName== KAtrVersion)
+ {
+
+ if (iIsFixPt)
+ {
+ TFloatFixPt lTemp;
+ lTemp.iValue = iStream.ReadInt32L();
+ TBuf<16> lTemp2;
+ lTemp2.AppendNum( (float)lTemp );
+ ((CSvgSvgElementImpl *)iCurrentElement)->SetVersion (lTemp2);
+ }
+ else
+ {
+ TReal32 lTemp;
+ iStream >> lTemp;
+ TBuf<16> lTemp2;
+ lTemp2.AppendNum(lTemp);
+ ((CSvgSvgElementImpl *)iCurrentElement)->SetVersion (lTemp2);
+ }
+
+ return ETrue;
+
+ /*
+ ((CSvgSvgElementImpl *)iCurrentElement)->SetVersion (DecodeTDesCLC());
+ CleanupStack::PopAndDestroy( 1 );
+ return ETrue;
+ */
+ }
+
+ if (aName== KAtrZoomAndPan)
+ {
+ TInt8 lTemp;
+ iStream >> lTemp;
+ TSvgZoomAndPanType lType= (TSvgZoomAndPanType) lTemp;
+ ((CSvgSvgElementImpl *)iCurrentElement)->SetZoomAndPan(lType);
+ return ETrue;
+ }
+
+ if (aName== KAtrPreserveAspectRatio)
+ {
+ if (iCurrentElement->ElemID()== KSvgSvgElement)
+ {
+ TInt8 lTemp;
+ iStream >> lTemp;
+ TSvgPreserveAspectAlignType lAType= (TSvgPreserveAspectAlignType) lTemp;
+ iStream >> lTemp;
+ TSvgMeetOrSliceType lMType= (TSvgMeetOrSliceType) lTemp;
+ ((CSvgSvgElementImpl *)iCurrentElement)->SetPreserveAspectRatioL(lAType, lMType);
+ return ETrue;
+ }
+ else if(iCurrentElement->ElemID()== KSvgMediaAnimationElement)
+ {
+ TInt8 lTemp;
+ iStream >> lTemp;
+ TSvgPreserveAspectAlignType lAType= (TSvgPreserveAspectAlignType) lTemp;
+ iStream >> lTemp;
+ TSvgMeetOrSliceType lMType= (TSvgMeetOrSliceType) lTemp;
+ ((CSvgMediaAnimationElementImpl*)iCurrentElement)->SetPreserveAspectRatioL(lAType, lMType);
+ return ETrue;
+ }
+ else
+ {
+ ((CSvgImageElementImpl *)iCurrentElement)->SetParL(DecodeTDesCLC());
+ CleanupStack::PopAndDestroy( 1 );
+ return ETrue;
+ }
+ }
+
+ if( aName == KAtrSyncBehaviorDefault )
+ {
+ TUint8 syncBehaviorDefault;
+ iStream>>syncBehaviorDefault;
+ ((CSvgSvgElementImpl*)iCurrentElement)->SetSyncBehaviorDefault( (TSvgSyncBehaviour) syncBehaviorDefault );
+ return ETrue;
+ }
+ else if( aName == KAtrSyncToleranceDefault )
+ {
+ TUint8 syncToleranceDefault;
+ iStream>>syncToleranceDefault;
+ ((CSvgSvgElementImpl*)iCurrentElement)->SetSyncToleranceDefault( syncToleranceDefault );
+ return ETrue;
+ }
+ else
+ {
+ return EFalse;
+ }
+ }
+
+ else
+ {
+ return EFalse;
+ }
+ }
+
+
+
+// --------------------------------------------------------------------------
+// TBool CSvgDecoder::DecodeLangSpaceAttributeL(const TUint16 aName)
+// ---------------------------------------------------------------------------
+TBool CSvgDecoder::DecodeLangSpaceAttributeL(const TUint16 aName)
+ {
+ if (aName<= KSvgLangAttrEndIndex)
+ {
+
+ if (aName== KAtrXmlLang)
+ {
+ iCurrentElement->SetXMLLangL (DecodeTDesCLC());
+ CleanupStack::PopAndDestroy( 1 );
+ return ETrue;
+ }
+
+ if (aName== KAtrXmlSpace)
+ {
+ iCurrentElement->SetXMLSpaceL (DecodeTDesCLC());
+ CleanupStack::PopAndDestroy( 1 );
+ return ETrue;
+ }
+
+ else
+ {
+ return EFalse;
+ }
+ }
+
+ else
+ {
+ return EFalse;
+ }
+ }
+
+
+
+// --------------------------------------------------------------------------
+// TBool CSvgDecoder::DecodeTransformAttributeL(const TUint16 aName)
+// ---------------------------------------------------------------------------
+TBool CSvgDecoder::DecodeTransformAttributeL(const TUint16 aName)
+ {
+
+ if (aName== KAtrTransform)
+ {
+
+ if (iIsFixPt)
+ {
+ TUint32 lTemp1;
+ TGfxAffineTransform lTransform;
+
+ lTransform.iM00.iValue = iStream.ReadInt32L();
+ lTransform.iM01.iValue = iStream.ReadInt32L();
+ lTransform.iM02.iValue = iStream.ReadInt32L();
+ lTransform.iM10.iValue = iStream.ReadInt32L();
+ lTransform.iM11.iValue = iStream.ReadInt32L();
+ lTransform.iM12.iValue = iStream.ReadInt32L();
+ iStream >> lTemp1;
+ lTransform.iTransType= (TGfxTransformType) lTemp1;
+
+ iCurrentElement->SetTransformList(lTransform);
+ }
+ else
+ {
+ TReal32 lTemp;
+ TUint32 lTemp1;
+ TGfxAffineTransform lTransform;
+
+ iStream >> lTemp;
+ lTransform.iM00= (TFloatFixPt) lTemp;
+ iStream >> lTemp;
+ lTransform.iM01= (TFloatFixPt) lTemp;
+ iStream >> lTemp;
+ lTransform.iM02= (TFloatFixPt) lTemp;
+ iStream >> lTemp;
+ lTransform.iM10= (TFloatFixPt) lTemp;
+ iStream >> lTemp;
+ lTransform.iM11= (TFloatFixPt) lTemp;
+ iStream >> lTemp;
+ lTransform.iM12= (TFloatFixPt) lTemp;
+ iStream >> lTemp1;
+ lTransform.iTransType= (TGfxTransformType) lTemp1;
+
+ iCurrentElement->SetTransformList(lTransform);
+ }
+
+ return ETrue;
+ }
+
+ else if ( aName== KAtrGradientTransform)
+ {
+
+ if (iIsFixPt)
+ {
+ SVGReal lMatrix[2][3];
+
+ TFloatFixPt lTemp;
+ lTemp.iValue = iStream.ReadInt32L();
+ lMatrix[0][0]= lTemp.iValue;
+ lTemp.iValue = iStream.ReadInt32L();
+ lMatrix[0][1]= lTemp.iValue;
+ lTemp.iValue = iStream.ReadInt32L();
+ lMatrix[0][2]= lTemp.iValue;
+ lTemp.iValue = iStream.ReadInt32L();
+ lMatrix[1][0]= lTemp.iValue;
+ lTemp.iValue = iStream.ReadInt32L();
+ lMatrix[1][1]= lTemp.iValue;
+ lTemp.iValue = iStream.ReadInt32L();
+ lMatrix[1][2]= lTemp.iValue;
+
+ ((CSvgGradientElementImpl*)iCurrentElement)->SetGradientTransMatrix(lMatrix);
+ }
+ else
+ {
+ TReal32 lTemp;
+ SVGReal lMatrix[2][3];
+
+ iStream >> lTemp;
+ lMatrix[0][0]= (SVGReal) lTemp;
+ iStream >> lTemp;
+ lMatrix[0][1]= (SVGReal) lTemp;
+ iStream >> lTemp;
+ lMatrix[0][2]= (SVGReal) lTemp;
+ iStream >> lTemp;
+ lMatrix[1][0]= (SVGReal) lTemp;
+ iStream >> lTemp;
+ lMatrix[1][1]= (SVGReal) lTemp;
+ iStream >> lTemp;
+ lMatrix[1][2]= (SVGReal) lTemp;
+
+ ((CSvgGradientElementImpl*)iCurrentElement)->SetGradientTransMatrix(lMatrix);
+ }
+
+ return ETrue;
+ }
+
+
+
+ else
+ {
+ return EFalse;
+ }
+ }
+
+
+
+// --------------------------------------------------------------------------
+// TBool CSvgDecoder::DecodeTestAttributeL(const TUint16 aName)
+// ---------------------------------------------------------------------------
+TBool CSvgDecoder::DecodeTestAttributeL(const TUint16 aName)
+ {
+ if(aName<= KSvgTestAttrEndIndex)
+ {
+
+ if (
+ aName== KAtrRequiredFeatures ||
+ aName== KAtrRequiredExtensions ||
+ aName== KAtrSystemLanguage
+ )
+ {
+ CDesCArrayFlat* lFeatures;
+ TInt8 lCount;
+ iStream >> lCount;
+ if(lCount)
+ {
+ lFeatures= new ( ELeave ) CDesCArrayFlat( lCount );
+ }
+ else
+ {
+ lFeatures= new ( ELeave ) CDesCArrayFlat( 1 );
+ }
+
+ CleanupStack::PushL(lFeatures); //cleanup
+
+ for(TInt8 i=0; i<lCount; i++)
+ {
+ lFeatures->AppendL((const TDesC&)DecodeTDesCLC());
+ CleanupStack::PopAndDestroy( 1 );
+ }
+
+ iCurrentElement->CreateSvgTestL(aName); //instantiates iSvgTest
+ if (aName== KAtrRequiredFeatures)
+ {
+ iCurrentElement->SetRequiredFeatures (lFeatures);
+ }
+ else if (aName== KAtrRequiredExtensions)
+ {
+ iCurrentElement->SetRequiredExtensions (lFeatures);
+ }
+ else
+ {
+ iCurrentElement->SetSystemLanguage (lFeatures);
+ }
+
+ CleanupStack::Pop(lFeatures); //cleanup
+
+ return ETrue;
+ }
+
+ else
+ {
+ return EFalse;
+ }
+ }
+
+ else
+ {
+ return EFalse;
+ }
+ }
+
+
+
+
+// --------------------------------------------------------------------------
+// TBool CSvgDecoder::DecodeIdAndXmlAttributeL(const TUint16 aName)
+// ---------------------------------------------------------------------------
+TBool CSvgDecoder::DecodeIdAndXmlAttributeL(const TUint16 aName)
+ {
+
+ if (aName== KAtrId)
+ {
+ iCurrentElement->SetIdandXmlbaseL( _L("id"), DecodeTDesCLC());
+ CleanupStack::PopAndDestroy( 1 );
+ return ETrue;
+ }
+
+ if (aName== KAtrXmlBase)
+ {
+ iCurrentElement->SetIdandXmlbaseL( _L("xml:base"), DecodeTDesCLC());
+ CleanupStack::PopAndDestroy( 1 );
+ return ETrue;
+ }
+
+ else
+ {
+ return EFalse;
+ }
+ }
+
+
+
+
+// --------------------------------------------------------------------------
+// TBool CSvgDecoder::DecodeUriRefAttributeL(const TUint16 aName)
+// ---------------------------------------------------------------------------
+TBool CSvgDecoder::DecodeUriRefAttributeL(const TUint16 aName)
+ {
+ if (aName<= KSvgUriAttrEndIndex)
+ {
+ if (aName== KAtrXlinkhref)
+ {
+ // Although discard element belongs to animation, the discard element isn't
+ // necessary inherited from giant AnimationBase, so handle attribute separately.
+ //
+ if ( iCurrentElement->ElemID() == KSvgDiscardElement || iCurrentElement->ElemID() == KSvgMediaAnimationElement )
+ return EFalse;
+
+ TPtrC lPtr(DecodeTDesCLC());
+ /*Code modified for Forward refrence support in animation*/
+ iCurrentElement->SetUriRefDesL (aName, lPtr );
+ // For Animation Elements
+ if(iIsAnimElement)
+ {
+ CSvgElementImpl* lElement;
+ lElement= (CSvgElementImpl*) iDocument->GetElementById(lPtr);
+ if(lElement)
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetTarget(lElement);
+ }
+ else
+ {
+ if (!iAnimRefElementArray)
+ {
+ iAnimRefElementArray = new (ELeave)RPointerArray<CSvgElementImpl> (1);
+ }
+ iAnimRefElementArray->AppendL((CSvgElementImpl*)iCurrentElement);
+ }
+
+ CleanupStack::PopAndDestroy( 1 );
+ return ETrue;
+ }
+
+
+ //Only for Image Element
+ if (iCurrentElement->ElemID() == KSvgImageElement)
+ {
+ ((CSvgImageElementImpl*)iCurrentElement)->SetUriL(lPtr);
+ iImageElements.Append((CSvgImageElementImpl*)iCurrentElement);
+ }
+ CleanupStack::PopAndDestroy( 1 );
+
+ // setting reference element of use Element
+ if (iCurrentElement->ElemID() == KSvgUseElement)
+ {
+ if( ((CSvgUseElementImpl*)iCurrentElement)->SetRefElemById
+ (DecodeTDesCLC()) != KErrNone)
+ {
+ // if it is null reallocate the memeory again.
+ if (!iUseElementArray)
+ {
+ iUseElementArray = new (ELeave)RPointerArray<CSvgElementImpl> (1);
+ }
+ iUseElementArray->AppendL((CSvgElementImpl*)iCurrentElement);
+ }
+ CleanupStack::PopAndDestroy( 1 );
+ return ETrue;
+ }
+// for future animation element
+// else if (iCurrentElement->ElemID() == KSvgAnimationElement)
+// {
+// if( ((CSvgAnimationElementImpl*)iCurrentElement)->SetRefElemById
+// (DecodeTDesCLC()) == KErrNone)
+// {
+ // if it is null reallocate the memeory again.
+// if (!iAnimationElementArray)
+// {
+// iAnimationElementArray = new (ELeave)RPointerArray<CSvgElementImpl> (1);
+// }
+// User::LeaveIfError(iAnimationElementArray->Append((CSvgElementImpl*)iCurrentElement));
+// }
+// CleanupStack::PopAndDestroy( 1 );
+// return ETrue;
+// }
+
+ // setting Path of Mpath element
+ if (iCurrentElement->ElemID() == KSvgMpathElement)
+ {
+ iCurrentElement->iReqAttrFlag =0;
+ TInt8 lCheck;
+ iStream >> lCheck;
+ // Flag is used to check the validity of reference element
+ if (lCheck)
+ {
+ ((CSvgMpathElementImpl*)iCurrentElement)->SetAttributePathByIdL(DecodeTDesCLC());
+ CleanupStack::PopAndDestroy( 1 );
+ }
+ }
+
+ return ETrue;
+ }
+
+ else if (aName== KAtrXlinkactuate ||
+ aName== KAtrXlinkarcrole ||
+ aName== KAtrXlinkrole ||
+ aName== KAtrXlinktitle ||
+ aName== KAtrXlinktype ||
+ aName== KAtrXlinkshow
+ )
+ {
+ iCurrentElement->SetUriRefDesL (aName, DecodeTDesCLC() );
+ CleanupStack::PopAndDestroy( 1 );
+ return ETrue;
+ }
+
+ else
+ {
+ return EFalse;
+ }
+ }
+
+ else if (aName== KXlinkhrefImageEmbedded)
+ {
+ TPtrC lPtr(DecodeImageEmbeddedTDesCLC());
+
+ iCurrentElement->SetUriRefDesL (aName, lPtr );
+
+ //Only for Image Element
+ if (iCurrentElement->ElemID() == KSvgImageElement)
+ {
+ // Keep track of embedded images
+ iEmbeddedImagesCount++;
+ ((CSvgImageElementImpl*)iCurrentElement)->SetUriL(lPtr);
+ ((CSvgImageElementImpl*)iCurrentElement)->LoadUriL();
+ }
+ CleanupStack::PopAndDestroy( 2 );
+ return ETrue;
+ }
+ else
+ {
+ return EFalse;
+ }
+ }
+
+
+// --------------------------------------------------------------------------
+// TBool CSvgDecoder::DecodeDiscardAttributeL (const TUint16& aName)
+// ---------------------------------------------------------------------------
+TBool CSvgDecoder::DecodeDiscardAttributeL (const TUint16& aName)
+ {
+ if ( iCurrentElement->ElemID() != KSvgDiscardElement )
+ return EFalse;
+
+ TInt8 lCheck;
+ TInt16 lTemp;
+
+ if (aName== KAtrBegin)
+ {
+ // Flag is used to check for SyncValue flag.
+ iStream >> lCheck;
+ if ( lCheck )
+ {
+ ((CSvgDiscardElementImpl*)iCurrentElement)->SetSyncValueDefined(ETrue);
+ }
+ else
+ {
+ ((CSvgDiscardElementImpl*)iCurrentElement)->SetSyncValueDefined(EFalse);
+ }
+
+ // Flag is used to check for EventValue flag.
+ iStream >> lCheck;
+ if ( lCheck )
+ {
+ ((CSvgDiscardElementImpl*)iCurrentElement)->SetEventValueDefined(ETrue);
+ }
+ else
+ {
+ ((CSvgDiscardElementImpl*)iCurrentElement)->SetEventValueDefined(EFalse);
+ }
+
+
+ // Flag is used to check for SyncElement's id.
+ iStream >> lCheck;
+ if ( lCheck )
+ {
+ TPtrC lPtr(DecodeTDesCLC());
+ ((CSvgDiscardElementImpl*)iCurrentElement)->SetBeginSyncElementId(lPtr);
+ CleanupStack::PopAndDestroy( 1 );
+ }
+
+
+ iStream >> lTemp;
+ ((CSvgDiscardElementImpl*)iCurrentElement)->SetAbsoluteBeginTime(lTemp);
+
+ iStream >> lTemp;
+ ((CSvgDiscardElementImpl*)iCurrentElement)->SetRefBeginTime(lTemp);
+
+ iStream >> lTemp;
+ ((CSvgDiscardElementImpl*)iCurrentElement)->SetKeyValue(lTemp);
+
+ iStream >> lTemp;
+ ((CSvgDiscardElementImpl*)iCurrentElement)->SetBeginReferenceEvent((TSvgEvent)lTemp);
+
+ }
+ else
+ if (aName== KAtrXlinkhref)
+ {
+ // Flag is used to check for HrefValue flag.
+ iStream >> lCheck;
+ if ( lCheck )
+ {
+ ((CSvgDiscardElementImpl*)iCurrentElement)->SetHrefValueDefined(ETrue);
+ TPtrC lPtr(DecodeTDesCLC());
+ ((CSvgDiscardElementImpl*)iCurrentElement)->SetTargetId(lPtr);
+ CleanupStack::PopAndDestroy( 1 );
+ }
+ else
+ ((CSvgDiscardElementImpl*)iCurrentElement)->SetHrefValueDefined(EFalse);
+
+ }
+
+ return ETrue;
+ }
+
+
+
+// --------------------------------------------------------------------------
+// TBool CSvgDecoder::DecodeAttributeFloatL(const TUint16 aName)
+// ---------------------------------------------------------------------------
+TBool CSvgDecoder::DecodeAttributeFloatL(const TUint16 aName)
+ {
+ if (iIsFixPt)
+ {
+ TFloatFixPt lTemp;
+ lTemp.iValue = iStream.ReadInt32L();
+ iCurrentElement->SetAttributeFloatL( (TInt)aName, lTemp );
+ }
+ else
+ {
+ TReal32 lTemp;
+ iStream >> lTemp;
+ iCurrentElement->SetAttributeFloatL( (TInt)aName, (TFloatFixPt)lTemp );
+ }
+
+ return ETrue;
+ }
+
+
+
+// --------------------------------------------------------------------------
+// TBool CSvgDecoder::DecodeAttributeIntL(const TUint16 aName)
+// ---------------------------------------------------------------------------
+TBool CSvgDecoder::DecodeAttributeIntL(const TUint16 aName)
+ {
+ TInt8 lTemp;
+ iStream >> lTemp;
+ iCurrentElement->SetAttributeIntL( (TInt)aName, (TInt32)lTemp );
+ return ETrue;
+ }
+
+
+// --------------------------------------------------------------------------
+// TBool CSvgDecoder::DecodeAttributePathL(const TUint16 aName)
+// ---------------------------------------------------------------------------
+TBool CSvgDecoder::DecodeAttributePathL(const TUint16 aName)
+ {
+ CGfxGeneralPath* lPath;
+ DecodeAnimationPathL(lPath);
+
+ iCurrentElement->SetAttributePathRef( (TInt)aName, lPath);
+
+ return ETrue;
+ }
+
+
+// --------------------------------------------------------------------------
+// void CSvgDecoder::DecodeAnimationPathL(CGfxGeneralPath*& aPath)
+// ---------------------------------------------------------------------------
+void CSvgDecoder::DecodeAnimationPathL(CGfxGeneralPath*& aPath)
+ {
+
+ aPath = CGfxGeneralPath::NewLC();
+
+ {
+ const TInt KLargePathTypeCount = 4*256;
+
+ TUint16 typeCount = 0;
+ iStream >> typeCount;
+
+ /******************************************************************/
+ // Path Type
+ /******************************************************************/
+ RArray<TUint32>* pathTypeArray = NULL;
+ // Put path-type-array to path to handle cleanup
+ if ( typeCount == 0 )
+ {
+ pathTypeArray = new (ELeave)RArray<TUint32>( 1 );
+ aPath->SetPointTypeArrayRef( pathTypeArray );
+ }
+ else
+ {
+ pathTypeArray = new (ELeave)RArray<TUint32>( typeCount );
+ aPath->SetPointTypeArrayRef( pathTypeArray );
+ }
+
+ // Occurs only for very large paths
+ if ( typeCount > KLargePathTypeCount )
+ {
+ TUint8* byteData = new (ELeave) TUint8[typeCount];
+ CleanupArrayDeletePushL( byteData );
+
+ iStream.ReadL( byteData, typeCount );
+
+ for ( TInt i = 0; i < typeCount; i++ )
+ {
+
+ if(byteData[i] == EGfxEncodedSegMoveTo)
+ {
+ byteData[i] = EGfxSegMoveTo;
+ }
+ else if(byteData[i] == EGfxEncodedSegLineTo )
+ {
+ byteData[i] = EGfxSegLineTo;
+ }
+ else if(byteData[i] == EGfxEncodedSegQuadTo)
+ {
+ byteData[i] = EGfxSegQuadTo;
+ }
+ else if(byteData[i] == EGfxEncodedSegCubicTo)
+ {
+ byteData[i] = EGfxSegCubicTo;
+ }
+ else if(byteData[i] == EGfxEncodedSegClose)
+ {
+ byteData[i] = EGfxSegClose;
+ }
+ // Path will close RArray if Leave occurs
+ pathTypeArray->AppendL( byteData[i] );
+ }
+ //Transfering ownership to Path
+ aPath->PathSegmentTypeArray(byteData);
+ aPath->Count(typeCount);
+ CleanupStack::Pop( 1 );
+ //delete [] byteData;
+ }
+ else
+ {
+ TUint8 *byteData = new (ELeave) TUint8[KLargePathTypeCount];
+ CleanupArrayDeletePushL( byteData );
+ iStream.ReadL( byteData, typeCount );
+ for ( TInt i = 0; i < typeCount; i++ )
+ {
+
+ if(byteData[i] == EGfxEncodedSegMoveTo)
+ {
+ byteData[i] = EGfxSegMoveTo;
+ }
+ else if(byteData[i] == EGfxEncodedSegLineTo )
+ {
+ byteData[i] = EGfxSegLineTo;
+ }
+ else if(byteData[i] == EGfxEncodedSegQuadTo)
+ {
+ byteData[i] = EGfxSegQuadTo;
+ }
+ else if(byteData[i] == EGfxEncodedSegCubicTo)
+ {
+ byteData[i] = EGfxSegCubicTo;
+ }
+ else if(byteData[i] == EGfxEncodedSegClose)
+ {
+ byteData[i] = EGfxSegClose;
+ }
+ // Path will close RArray if Leave occurs
+ pathTypeArray->AppendL( byteData[i] );
+ }
+ aPath->PathSegmentTypeArray(byteData);
+ aPath->Count(typeCount);
+ CleanupStack::Pop( 1 );
+ }
+ }
+
+ /******************************************************************/
+ // Path Points
+ /******************************************************************/
+ {
+ const TInt KLargePathPointsCount = 256;
+
+ TUint16 valueCount = 0;
+ iStream >> valueCount;
+
+ RArray<TFloatFixPt>* pathPointsArray = NULL;
+
+ if ( valueCount == 0 )
+ {
+ pathPointsArray = new (ELeave)RArray<TFloatFixPt>( 1 );
+ aPath->SetPointCoordsArrayRef( pathPointsArray );
+ }
+ else
+ {
+ pathPointsArray = new (ELeave)RArray<TFloatFixPt>( valueCount );
+ aPath->SetPointCoordsArrayRef( pathPointsArray );
+ }
+
+ if ( valueCount > KLargePathPointsCount )
+ {
+ if (iIsFixPt)
+ {
+ TFloatFixPt* fixedData = new (ELeave) TFloatFixPt[valueCount];
+ CleanupArrayDeletePushL( fixedData );
+
+ TInt byteCount = sizeof( TFloatFixPt ) * valueCount;
+ iStream.ReadL( (TUint8*)fixedData, byteCount );
+
+ for ( TInt i = 0; i < valueCount; i++ )
+ {
+ // Path will close RArray if Leave occurs
+ pathPointsArray->AppendL( fixedData[i] );
+ }
+
+ CleanupStack::Pop( 1 ); // fixedData
+ delete [] fixedData;
+ }
+ else
+ {
+ TReal32* real32Data = new (ELeave) TReal32[valueCount];
+ CleanupArrayDeletePushL( real32Data );
+
+ TInt byteCount = sizeof( TReal32 ) * valueCount;
+ iStream.ReadL( (TUint8*)real32Data, byteCount );
+
+ for ( TInt i = 0; i < valueCount; i++ )
+ {
+ // Path will close RArray if Leave occurs
+ pathPointsArray->AppendL( (TFloatFixPt)real32Data[i] );
+ }
+
+ CleanupStack::Pop( 1 ); // real32Data
+ delete [] real32Data;
+ }
+ }
+ else
+ {
+ if (iIsFixPt)
+ {
+ TFloatFixPt fixedData[KLargePathPointsCount];
+ TInt byteCount = sizeof( TFloatFixPt ) * valueCount;
+ iStream.ReadL( (TUint8*)fixedData, byteCount );
+
+ for ( TInt i = 0; i < valueCount; i++ )
+ {
+ pathPointsArray->AppendL( fixedData[i] );
+ }
+ }
+ else
+ {
+ TReal32 real32Data[KLargePathPointsCount];
+ TInt byteCount = sizeof( TReal32 ) * valueCount;
+ iStream.ReadL( (TUint8*)real32Data, byteCount );
+
+ for ( TInt i = 0; i < valueCount; i++ )
+ {
+ pathPointsArray->AppendL( (TFloatFixPt)real32Data[i] );
+ }
+ }
+ }
+
+ }
+
+ CleanupStack::Pop( 1 ); // aPath
+ }
+
+
+// --------------------------------------------------------------------------
+// TBool CSvgDecoder::DecodeAttributeDesL(const TUint16 aName)
+// ---------------------------------------------------------------------------
+TBool CSvgDecoder::DecodeAttributeDesL(const TUint16 aName)
+ {
+ iCurrentElement->SetAttributeDesL ((TInt)aName, DecodeTDesCLC());
+ CleanupStack::PopAndDestroy( 1 );
+ return ETrue;
+ }
+
+// --------------------------------------------------------------------------
+// TBool CSvgDecoder::DecodeStringCssValueL(const TUint16 aName)
+// ---------------------------------------------------------------------------
+TBool CSvgDecoder::DecodeStringCssValueL(const TUint16 aName)
+ {
+
+ CCssValue* tParentValue = NULL;
+ CCssValue* tValue = NULL;
+
+ iCurrentElement->FindProperty ((TInt8)aName,tValue);
+
+ TPtrC lPtr(DecodeTDesCLC());
+
+ if(iCurrentElement->ElemID() == KSvgFontfaceElement)
+ {
+ ((CSvgFontFaceElementImpl *)iCurrentElement)->SetFontFamilyL(lPtr);
+ }
+
+ if(iCurrentElement!= iRootElement)
+ {
+ iCurrentParentElement->FindProperty ((TInt8)aName,tParentValue);
+ }
+
+ if (tParentValue == tValue || tValue == NULL)
+ {
+
+ if (iDocument)
+ {
+ tValue = iDocument->iMemoryManager->GetCssStrObjectL( lPtr );
+ }
+
+
+
+ CleanupStack::PopAndDestroy( 1 );// cleanup : for lPtr
+ iCurrentElement->SetPresentationAttribute ((TInt8)aName,tValue);
+ }
+ else
+ {
+ ((CStrCssValueImpl*)tValue)->SetValueL ( lPtr );
+ CleanupStack::PopAndDestroy( 1 );
+ }
+
+ return ETrue;
+ }
+
+
+
+// --------------------------------------------------------------------------
+// TBool CSvgDecoder::DecodeIntCssValueL(const TUint16 aName)
+// ---------------------------------------------------------------------------
+TBool CSvgDecoder::DecodeIntCssValueL(const TUint16 aName)
+ {
+
+ TInt32 lInt32;
+ iStream >> lInt32;
+
+ CCssValue* tParentValue = NULL;
+ CCssValue* tValue = NULL;
+
+ iCurrentElement->FindProperty ((TInt8)aName,tValue);
+
+ if(iCurrentElement!= iRootElement)
+ {
+ iCurrentParentElement->FindProperty ((TInt8)aName,tParentValue);
+ }
+
+ if (tParentValue == tValue || tValue == NULL)
+ {
+
+ if (iDocument)
+ {
+ tValue = iDocument->iMemoryManager->GetCssIntObjectL( (TInt)lInt32 );
+ }
+
+ iCurrentElement->SetPresentationAttribute ((TInt8)aName,tValue);
+ }
+ else
+ {
+ ((CIntCssValueImpl*)tValue)->SetValueL ((TInt)lInt32);
+ }
+
+ return ETrue;
+ }
+
+
+// --------------------------------------------------------------------------
+// TBool CSvgDecoder::DecodeFloatCssValueL(const TUint16 aName)
+// ---------------------------------------------------------------------------
+TBool CSvgDecoder::DecodeFloatCssValueL(const TUint16 aName)
+ {
+
+ if (iIsFixPt)
+ {
+ TFloatFixPt lFixed;
+ lFixed.iValue = iStream.ReadInt32L();
+
+ CCssValue* tParentValue = NULL;
+ CCssValue* tValue = NULL;
+
+ iCurrentElement->FindProperty ((TInt8)aName,tValue);
+
+ if(iCurrentElement!= iRootElement)
+ {
+ iCurrentParentElement->FindProperty ((TInt8)aName,tParentValue);
+ }
+
+ if (tParentValue == tValue || tValue == NULL)
+ {
+ if (iDocument)
+ {
+ tValue = iDocument->iMemoryManager->GetCssFloatObjectL( lFixed );
+ }
+
+ iCurrentElement->SetPresentationAttribute ((TInt8)aName,tValue);
+ }
+ else
+ {
+ ((CFloatCssValueImpl*)tValue)->SetValueL ( lFixed );
+ }
+ }
+ else
+ {
+ TReal32 lFlt32;
+ iStream >> lFlt32;
+
+ CCssValue* tParentValue = NULL;
+ CCssValue* tValue = NULL;
+
+ iCurrentElement->FindProperty ((TInt8)aName,tValue);
+
+ if(iCurrentElement!= iRootElement)
+ {
+ iCurrentParentElement->FindProperty ((TInt8)aName,tParentValue);
+ }
+
+ if (tParentValue == tValue || tValue == NULL)
+ {
+ if (iDocument)
+ {
+ tValue = iDocument->iMemoryManager->GetCssFloatObjectL((TFloatFixPt)lFlt32);
+ }
+
+ iCurrentElement->SetPresentationAttribute ((TInt8)aName,tValue);
+ }
+ else
+ {
+ ((CFloatCssValueImpl*)tValue)->SetValueL ((TFloatFixPt)lFlt32);
+ }
+ }
+
+ return ETrue;
+ }
+
+
+// --------------------------------------------------------------------------
+// TBool CSvgDecoder::DecodeColorCssValueL(const TUint16 aName)
+// ---------------------------------------------------------------------------
+TBool CSvgDecoder::DecodeColorCssValueL(const TUint16 aName)
+ {
+ TUint32 lColor;
+ iStream >> lColor;
+
+ // Shift from XBGR to XRGB
+ if(!iIsRGB)
+ {
+ lColor = ( lColor & 0xFF000000) |
+ ( (lColor & 0x00FF0000) >> 16 ) |
+ ( lColor & 0x0000FF00 ) |
+ ( (lColor & 0x000000FF) << 16 );
+ }
+
+ CCssValue* tParentValue = NULL;
+ CCssValue* tValue = NULL;
+
+ iCurrentElement->FindProperty ((TInt8)aName,tValue);
+
+ if(iCurrentElement!= iRootElement)
+ {
+ iCurrentParentElement->FindProperty ((TInt8)aName,tParentValue);
+ }
+
+ if (tParentValue == tValue || tValue == NULL)
+ {
+ if ( iDocument )
+ {
+ tValue = iDocument->iMemoryManager->GetCssClrObjectL();
+
+ CleanupStack::PushL(tValue); //cleanup
+
+ ((CClrCssValueImpl*)tValue)->CloneRGBValueL (lColor);
+ iCurrentElement->SetPresentationAttribute ((TInt8)aName,tValue);
+ CleanupStack::Pop(tValue); //cleanup
+ }
+ }
+ else
+ {
+ ((CClrCssValueImpl*)tValue)->CloneRGBValueL (lColor);
+ }
+
+ return ETrue;
+ }
+
+
+
+// --------------------------------------------------------------------------
+// void CSvgDecoder::SetPaintValueL (CCssValue*& aValue)
+// ---------------------------------------------------------------------------
+void CSvgDecoder::SetPaintValueL (CCssValue*& aValue)
+ {
+ TUint8 lCheckGradient;
+ iStream >> lCheckGradient;
+
+ if( lCheckGradient)
+ {
+ ((CPaintCssValueImpl *)aValue)->SetUrlflag();
+ ((CPaintCssValueImpl *)aValue)->SetUrlIdL( DecodeTDesCLC() );
+ CleanupStack::PopAndDestroy( 1 );
+ }
+ else
+ {
+ TUint32 lColor;
+ iStream >> lColor;
+ // Shift from XBGR to ARGB
+ if(!iIsRGB)
+ {
+ lColor = ( lColor & 0xFF000000) |
+ ( (lColor & 0x00FF0000) >> 16 ) |
+ ( lColor & 0x0000FF00 ) |
+ ( (lColor & 0x000000FF) << 16 );
+ }
+ ((CPaintCssValueImpl *)aValue)->CloneRGBValueL (lColor);
+ }
+ }
+
+
+
+
+
+// ==========================================================================
+// Start Decoding
+// ==========================================================================
+CSvgElementImpl* CSvgDecoder::StartDecodingL(CSvgDocumentImpl *aDocument,
+ CSvgErrorImpl& aError )
+ {
+
+ iDocument= aDocument;
+
+ iSvgError = &aError;
+ aError.SetErrorCode( ESvgNoError );
+
+ TUint32 lValidBinary;
+ iStream >> lValidBinary;
+
+ if (lValidBinary != KBinaryFile &&
+ lValidBinary != KBinaryFile2 &&
+ lValidBinary != KBinaryFile3 &&
+ lValidBinary != KBinaryFile4)
+ {
+ iSvgError->SetErrorCode ( ESvgbFileNotValid );
+ iSvgError->SetDescription( _L( "Not a valid binary file." ) );
+ iSvgError->SetIsWarning( EFalse );
+ return NULL;
+ }
+
+ if (lValidBinary == KBinaryFile2)
+ {
+ iIsFixPt = ETrue;
+ iIsRGB = EFalse;
+ }
+
+ if (lValidBinary == KBinaryFile3)
+ {
+ iIsFixPt = ETrue;
+ iIsRGB = ETrue;
+ }
+
+ if(lValidBinary == KBinaryFile4)
+ {
+ iIsFixPt = EFalse;
+ iIsRGB = ETrue;
+ }
+
+ TUint8 lElemId;
+ TUint16 lAttrName;
+
+ MXmlElement* newElement;
+
+ iStream >> lElemId;
+ while (lElemId != KEndSvgFile)
+ {
+
+ // checks end of element
+ while (lElemId==KEndElemIndex)
+ {
+ if ( iCurrentParentElement != iRootElement )
+ {
+ // Depth is decreased, so the current parent should be one level up
+ iCurrentParentElement = ( CSvgElementImpl * )
+ iCurrentParentElement->ParentNode();
+ }
+
+ iStream >> lElemId;
+ }
+
+ // checks for Cdata
+ if (lElemId == KCDataPresent)
+ {
+ iCurrentElement= iCurrentParentElement;
+ DecodeAttributeL((TUint16)KAtrCdata);
+ iStream >> lElemId;
+ continue;
+ }
+
+
+
+ //checks end of file.
+ if (lElemId == KEndSvgFile)
+ {
+ break;
+ }
+
+
+ newElement = iDocument->CreateElementL( lElemId );
+
+ if( newElement == NULL)
+ {
+ User::Leave(KErrCorrupt);
+ }
+
+ iCurrentElement = ( CSvgElementImpl * ) newElement;
+
+
+ if ( lElemId == KSvgSvgElement && !iRootElement )
+ {
+ iRootElement = iCurrentElement;
+
+ //CleanupStack::PushL(iRootElement);
+ iDocument->AppendChildL( newElement );
+ //CleanupStack::Pop(iRootElement);
+
+ }
+ // for all other elements
+ else
+ {
+ iCurrentParentElement->AppendChildL( newElement );
+ }
+
+ // Setting target element for animations
+ if( iCurrentElement->IsAnimatedElement() )
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetTarget( iCurrentParentElement);
+ // For media elements do not set iIsAnimElement as
+ // the Xlink:Href is for external files rather
+ // than internal elements
+ if (!( iCurrentElement->ElemID() >= KSvgMediaElemsStartIndex &&
+ iCurrentElement->ElemID() <= KSvgMediaElemsEndIndex ) )
+ {
+ iIsAnimElement= ETrue;
+ }
+ }
+
+
+ iStream >> lAttrName;
+
+ // for attribute list.
+ while (lAttrName!= KStartNewElem)
+ {
+ DecodeAttributeL(lAttrName);
+ iStream >> lAttrName;
+ }
+ if( iCurrentElement->ElemID() == KSvgStopElement)
+ {
+ if( ((CSvgElementImpl*)iCurrentElement->ParentNode()) != NULL )
+ {
+ if((((((CSvgElementImpl*)iCurrentElement->ParentNode())->ElemID()) == KSvgRadialGradientElement) ||
+ ((((CSvgElementImpl*)iCurrentElement->ParentNode())->ElemID()) == KSvgLinearGradientElement) ) )
+ {
+ CSvgGradientElementImpl *parent = ((CSvgGradientElementImpl *)iCurrentElement->ParentNode());
+
+ if(parent)
+ {
+ // Initialize the offset value to 0 if its still -1.
+ TFloatFixPt lOffsetValue;
+ TFloatFixPt lDefaultOffsetValue(-1);
+ TBuf<6> lAttributeName;
+ TBuf<1> lValueBuffer;
+
+ lAttributeName.Append(OFFSET);
+ lValueBuffer.Append(ZEROVALUE);
+
+ ((CSvgStopElementImpl*)iCurrentElement)->GetOffset( lOffsetValue );
+
+ // Offset Value of -1 indicates that Offset Attribute is not declared in
+ // stop element.
+ if( lOffsetValue == lDefaultOffsetValue )
+ {
+ // Deliberately calling SetAttributeL in place of SetAttributeFloatL as the latter inturn
+ // calls UpdateOffsetValues which should be called on any Stop element once it is added to
+ // to the Stop element array Owned by parent Gradient element.
+ ((CSvgStopElementImpl*)iCurrentElement)->SetAttributeL( lAttributeName, lValueBuffer );
+ }
+
+ // The function not only adds the element in Stop element array but also
+ // adjusts the offset values of all the previously added elements such that
+ // each gradient offset value is greater than the previous gradient stop's
+ // offset value.It calls UpdateOffsetValues to adjust the values.
+ ((CSvgGradientElementImpl *)parent)->AddStopElementInArray((CSvgStopElementImpl*)iCurrentElement);
+ }
+ }
+ }
+ }
+
+
+ if (iCurrentElement->ElemID() == KSvgUseElement)
+ {
+ ((CSvgUseElementImpl *)iCurrentElement)->SetReferenceElementL();
+ }
+/* else if (iCurrentElement->ElemID() == KSvgAnimationElement)
+ {
+ ((CSvgAnimationElementImpl *)iCurrentElement)->SetReferenceElementL();
+ if(((CSvgAnimationElementImpl *)iCurrentElement)->RecursionVariable())
+ {
+ iSvgError->SetErrorCode( ESvgDocumentNotValid );
+ iSvgError->SetIsWarning( EFalse );
+ iSvgError->SetDescription( _L( "Invalid Document \n" ) );
+ iSvgError->AppendDescription( _L("Animation element in loop") );
+ return iRootElement;
+ }
+ }
+*/
+ if (iCurrentElement->HasAnyTests())
+ {
+ iReqFetAttSysArray->AppendL(iCurrentElement);
+ }
+
+ if (iCurrentElement->ElemID() == KSvgSwitchElement)
+ {
+ iSwitchElementArray->AppendL(iCurrentElement);
+ }
+
+ // For DOM reuse
+ if( iCurrentElement->IsAnimatedElement() )
+ {
+ ((CSvgAnimationBase*)iCurrentElement)->SetOriginalValues_DOMReuse() ;
+ iAnimationElementArray->AppendL(iCurrentElement);
+ }
+
+
+ if( iCurrentElement->ElemID() >= KSvgLinearGradientElement &&
+ iCurrentElement->ElemID() <= KSvgStopElement )
+ {
+ iCurrentElement->SetAttributeIntL(KCSS_ATTR_DISPLAY,0);
+ }
+
+ if ( iCurrentElement->ElemID() == KSvgMpathElement &&
+ iCurrentParentElement->ElemID() == KSvgAnimateMotionElement &&
+ iSvgError->ErrorCode() == ESvgMissingRequiredAttribute &&
+ iSvgError->IsWarning()
+ )
+
+
+ {
+ iSvgError->SetErrorCode( ESvgNoError );
+ // add to event receiver list will have only one copy
+ iDocument->AddToEventReceiverListL( iCurrentParentElement, KSvgEventMaskTimer );
+ }
+
+ CheckRequiredAttributesL( lElemId);
+ iIsAnimElement= EFalse;
+
+ iCurrentParentElement = iCurrentElement;
+
+ iStream >> lElemId;
+
+ }
+ //Load Images
+
+ TInt lImageElementCnt = iImageElements.Count();
+ TInt lTotalImagesCount = lImageElementCnt + iEmbeddedImagesCount;
+ iDocument->SetImageElementsCount(lTotalImagesCount);
+ for( TInt index = 0 ; index < lImageElementCnt ; index++)
+ {
+ iImageElements[index]->LoadUriL();
+ }
+
+ if(iUseElementArray)
+ {
+ // support for forward reference in use element
+ TInt lCount = iUseElementArray->Count();
+ TInt lIndex= 0;
+ while(lIndex < lCount)
+ {
+ TPtrC tPtr2 = ((CSvgElementImpl*)iUseElementArray->operator[](lIndex))->Href();
+ TInt Pos1= tPtr2.Locate('#');
+ HBufC* tBufC = HBufC::NewLC( tPtr2.Length() );
+ TPtr tPtr3 ( tBufC->Des() );
+ tPtr3.Copy( tPtr2 );
+ tPtr3.TrimAll();
+ // remove '#'
+ if(Pos1 != KErrNotFound)
+ {
+ tPtr3.Delete(Pos1,1);
+ }
+ if(((CSvgUseElementImpl *)iUseElementArray->operator[](lIndex))->SetRefElemById(tPtr3) != KErrNotFound)
+ {
+ ((CSvgUseElementImpl *)iUseElementArray->operator[](lIndex))->SetReferenceElementL();
+
+ }
+ lIndex++;
+ CleanupStack::PopAndDestroy( 1 );
+ }
+ }
+ // support for forward reference in use element
+ if(iAnimRefElementArray)
+ {
+ TInt lCount = iAnimRefElementArray->Count();
+ TInt lIndex= 0;
+ while(lIndex < lCount)
+ {
+ TPtrC tPtr2 = ((CSvgElementImpl*)iAnimRefElementArray->operator[](lIndex))->Href();
+ ((CSvgAnimationBase *)iAnimRefElementArray->operator[](lIndex))->SetRefElemById(tPtr2);
+ lIndex++;
+ }
+ }
+
+ // For Animation elements
+ if (iAnimationElementArray)
+ {
+ TInt lCount = iAnimationElementArray->Count();
+ TInt lIndex = 0;
+ while(lIndex < lCount)
+ {
+ ((CSvgAnimationBase *)iAnimationElementArray->operator[](lIndex))->CheckBeginTime();
+ lIndex ++;
+ }
+ }
+ // Reset iCurrentElement, as it is no longer used
+ iCurrentElement = NULL;
+ RemoveFalseElements();
+ RemoveFalseSwitchCases();
+
+ return iRootElement;
+ }
+
+
+
+// --------------------------------------------------------------------------
+// void CSvgDecoder::CheckRequiredAttributesL(const TUint8 aName )
+// ---------------------------------------------------------------------------
+void CSvgDecoder::CheckRequiredAttributesL(const TUint8 aName )
+ {
+
+
+ if( iCurrentElement->iReqAttrFlag != 0)
+
+ {
+
+ iSvgError->SetErrorCode( ESvgMissingRequiredAttribute );
+ iSvgError->SetIsWarning( ETrue );
+ iSvgError->SetDescription( _L( "Missing required attribute \"" ) );
+ switch(iCurrentElement->iReqAttrFlag)
+ {
+ case KSVG_PATH_ELEMFLAG:
+ iSvgError->AppendDescription( _L("d") );
+ break;
+ case KAtrWidth:
+ iSvgError->AppendDescription( _L("width") );
+ break;
+ case KAtrHeight:
+ iSvgError->AppendDescription( _L("height") );
+ break;
+ case KSVG_POLYLINE_ELEMFLAG:
+ iSvgError->AppendDescription( _L("points") );
+ break;
+ case KAtrRy:
+ iSvgError->AppendDescription( _L("Ry") );
+ break;
+ case KAtrRx:
+ iSvgError->AppendDescription( _L("Rx") );
+ break;
+ case KAtrSVGRec:
+ iSvgError->AppendDescription( _L("width") );
+ iSvgError->AppendDescription( _L( "\" and \"" ) );
+ iSvgError->AppendDescription(_L("height"));
+ break;
+ case KAtrSVGElp:
+ iSvgError->AppendDescription( _L("Rx") );
+ iSvgError->AppendDescription( _L( "\" and \"" ) );
+ iSvgError->AppendDescription(_L("Ry"));
+ break;
+ case KAtrSVGTrf:
+ iSvgError->AppendDescription( _L("attributeName") );
+ iSvgError->AppendDescription( _L( "\" and \"" ) );
+ iSvgError->AppendDescription(_L("type"));
+ break;
+ case KSVG_ANIMATE_ELEMFLAG:
+ iSvgError->AppendDescription( _L("attributeName") );
+ break;
+ case KSVG_CIRCLE_ELEMFLAG:
+ iSvgError->AppendDescription( _L("r") );
+ break;
+ case KSVG_HKERN_ELEMFLAG:
+ iSvgError->AppendDescription( _L("k") );
+ break;
+ case KAtrType:
+ iSvgError->AppendDescription( _L("type") );
+ break;
+ case KAtrXlinkhref:
+ iSvgError->AppendDescription (_L("Xlink:href"));
+ break;
+ case KAtrSVGAmo:
+ iSvgError->AppendDescription( _L("path") );
+ ((CSvgDocumentImpl*)iDocument)->RemoveFromEventReceiverList( iCurrentElement );
+ break;
+ case KAtrToBy:
+ iSvgError->AppendDescription( _L("to/by") );
+ ((CSvgDocumentImpl*)iDocument)->RemoveFromEventReceiverList( iCurrentElement );
+ break;
+ }
+ iSvgError->AppendDescription( _L( "\" for <" ) );
+ // access schema data to get the name of the attribute which is missing
+ // currently the error msg doesnt not report the name of the attribute
+
+ TBuf<20> lElemName = _L("svg");
+ ((CSvgDocumentImpl*)iDocument)->SchemaData()->GetSVGElementName(aName,lElemName);
+ iSvgError->AppendDescription( lElemName );
+ iSvgError->AppendDescription( _L( ">." ) );
+ // turn off element
+
+ ((CSvgElementImpl*)iCurrentElement)->SetTurnOff( ETrue );
+
+ ((CSvgElementImpl*)iCurrentElement)->SetPropertyL(KCSS_ATTR_DISPLAY,_L("none"));
+
+
+ }
+ }
+
+//---------------------------------------------------
+//Removal of elements that dont pass
+//required extensions, required features, and system language
+//requirements
+//switch statement is special case were only the first one
+//that passes these requirements will be used so toss the rest
+//---------------------------------------------------
+void CSvgDecoder::RemoveFalseElements()
+ {
+ if (iReqFetAttSysArray == NULL)
+ {
+ // Error Case
+ return;
+ }
+
+ //loop through the list of elements with required features, attributes, or sys language
+ TInt reqFetSysArrayCnt = iReqFetAttSysArray->Count();
+ while ( reqFetSysArrayCnt > 0 )
+ {
+ CSvgElementImpl* lCurElement = ( CSvgElementImpl* )
+ iReqFetAttSysArray->operator[]( reqFetSysArrayCnt - 1 );
+
+ if ( lCurElement != NULL )
+ {
+ CSvgElementImpl* lCurParent = ( CSvgElementImpl* )
+ lCurElement->ParentNode();
+
+ //just a normal element check it and remove it if it doesnt pass
+ TBool lResult = EFalse;
+ TRAPD( error, lResult = VerifyReqExReqFtrSysL( lCurElement ) );
+ if ( error == KErrNone && !lResult )
+ {
+ // Remove internal references to the element about to be
+ // removed
+ // This function would also remove the lCurElement from
+ // iReqFetAttSysArray.
+ RemoveInternalReferences( lCurElement );
+ //element doesnt have proper required extension, attributes, or system language
+ lCurParent->RemoveChild( lCurElement );
+ delete (CXmlElementImpl*)lCurElement;
+ lCurElement = NULL;
+ }
+ else
+ {
+ // Remove the last element from the array as it is processed
+ iReqFetAttSysArray->Remove( reqFetSysArrayCnt - 1 );
+ } // if ( error == KErrNone && !lResult )
+ }
+ else
+ {
+ // Remove the last element from the array as it is processed
+ iReqFetAttSysArray->Remove( reqFetSysArrayCnt - 1 );
+ } // if ( lCurElement != NULL )
+ // Update the count of elements in the array
+ reqFetSysArrayCnt = iReqFetAttSysArray->Count();
+ } // while ( reqFetSysArrayCnt > 0 )
+ // Clear the array as it is no longer required.
+ iReqFetAttSysArray->Reset();
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgDecoder::RemoveFalseSwitchCases()
+// ---------------------------------------------------------------------------
+void CSvgDecoder::RemoveFalseSwitchCases()
+ {
+ if (iSwitchElementArray == NULL)
+ {
+ // Error Case
+ return;
+ }
+
+ TInt switchEleArrayCnt = iSwitchElementArray->Count();
+ while ( switchEleArrayCnt > 0 )
+ {
+ TBool foundTrue = EFalse;
+ CSvgElementImpl* curSwitchElem = ( CSvgElementImpl* )
+ iSwitchElementArray->operator[]( switchEleArrayCnt - 1 );
+
+ if ( curSwitchElem != NULL )
+ {
+ //get the first child...which is where the first
+ CSvgElementImpl* curCaseElem = (CSvgElementImpl*)curSwitchElem->FirstChild();
+
+ while ( curCaseElem != NULL )
+ {
+ CSvgElementImpl* nextCaseElem = (CSvgElementImpl*)curCaseElem->NextSibling();
+ // foundTrue is set to TRUE when an element whose test passes is found. The
+ // subsequent elements are to be removed.
+ if ( foundTrue )
+ {
+ // Remove internal references of the element from
+ // decoder's lists
+ RemoveInternalReferences( curCaseElem );
+ //already found the true case in the switch delete the rest
+ curSwitchElem->RemoveChild( curCaseElem );
+ delete ( CXmlElementImpl* )curCaseElem;
+ curCaseElem = NULL;
+ }
+ else
+ {
+ TBool lResult = EFalse;
+ TRAPD(error, lResult = VerifyReqExReqFtrSysL(curCaseElem));
+ if ( error == KErrNone && !lResult )
+ {
+ // Remove internal references of the element from
+ // decoder's lists
+ RemoveInternalReferences( curCaseElem );
+ //this element doesnt meet the switch requirements delete it and its children
+ curSwitchElem->RemoveChild(curCaseElem);
+ delete (CXmlElementImpl*)curCaseElem;
+ curCaseElem = NULL;
+ }
+ else
+ {
+ //one evaluated to true so keep it but go ahead and delete the rest in the switch
+ //should only be one child for switch in end
+ foundTrue = ETrue;
+ } // if ( error == KErrNone && !lResult )
+ } // if ( foundTrue )
+ // Proceed checking the next sibling
+ curCaseElem = nextCaseElem;
+ } // while ( curCaseElem != NULL )
+ } // if ( curSwitchElem != NULL )
+ // Remove the last switch element which was processed
+ iSwitchElementArray->Remove( switchEleArrayCnt - 1 );
+ // Update the count of the array
+ switchEleArrayCnt = iSwitchElementArray->Count();
+ } // while ( switchEleArrayCnt > 0 )
+ // Clear the array as it is no longer needed
+ iSwitchElementArray->Reset();
+ }
+
+//---------------------------------------------------
+//Check to see
+//required extensions, required features, and system language
+//requirements
+//---------------------------------------------------
+TBool CSvgDecoder::VerifyReqExReqFtrSysL( CSvgElementImpl* aElement )
+{
+ const CDesCArrayFlat* tempTestArray = NULL; // 'const' keyword added due to S60 (CW) build team recommendation
+
+ TBool doDraw = ETrue;
+
+ // First check for requiredExtensions
+ aElement->GetRequiredExtensions( tempTestArray );
+
+ if ( tempTestArray && tempTestArray->MdcaCount() )
+ {
+ // Check for all entries in requiredExtensions
+
+ TInt lCount = tempTestArray->MdcaCount();
+
+ for ( TInt i = 0; i < lCount; i++ )
+ {
+ TPtrC tmpPtr = tempTestArray->MdcaPoint( i );
+ if ( tmpPtr.Length() )
+ {
+ doDraw = EFalse;
+ break;
+ }
+ else if ( aElement->HasExtension( tmpPtr ) == EFalse )
+ {
+ doDraw = EFalse;
+ break;
+ }
+ }
+ }
+
+ // Second, check for requiredFeatures
+ aElement->GetRequiredFeatures( tempTestArray );
+ if ( tempTestArray && tempTestArray->MdcaCount() && doDraw)
+ {
+ // Check for all entries in requiredFeatures
+ TInt lCount = tempTestArray->MdcaCount();
+ for ( TInt i = 0; i < lCount; i++ )
+ {
+ TPtrC tmpPtr = tempTestArray->MdcaPoint( i );
+ if ( aElement->HasFeature( tmpPtr ) == EFalse )
+ {
+ doDraw = EFalse;
+ break;
+ }
+ }
+ }
+
+ TBufC<5> iSystemLanguage;
+ SystemLanguage( iSystemLanguage.Des() );
+
+ // Third, check for systemLanguage
+ // Future enhancement: System language doesnt need to be stored in seperate array indexes
+ // could have just stored it as one big string and use findf without the loop
+ aElement->GetSystemLanguage( tempTestArray );
+ TBool doDrawSystem = EFalse;
+ if ( tempTestArray && tempTestArray->MdcaCount() && doDraw)
+ {
+ TInt lCount = tempTestArray->MdcaCount();
+
+ for ( TInt i = 0; i < lCount; i++ )
+ {
+ TPtrC tmpPtr = tempTestArray->MdcaPoint( i );
+
+ if ( tmpPtr.FindF( iSystemLanguage ) >= 0 )
+ {
+ doDrawSystem = ETrue;
+ break;
+ }
+ }
+
+ if (doDrawSystem == EFalse)
+ {
+ doDraw = EFalse;
+ }
+ }
+
+ return doDraw;
+}
+
+// --------------------------------------------------------------------------
+// void CSvgDecoder::SystemLanguage( TPtr aValue )
+// ---------------------------------------------------------------------------
+void CSvgDecoder::SystemLanguage( TPtr aValue )
+ {
+ _LIT( KEn, "en" );
+ _LIT( KFr, "fr" );
+ _LIT( KDe, "de" );
+ _LIT( KEs, "es" );
+
+ _LIT( KAf, "af" );
+ _LIT( KAm, "am" );
+ _LIT( KAr, "ar" );
+ _LIT( KBg, "bg" );
+ _LIT( KBn, "bn" );
+ _LIT( KBo, "bo" );
+ _LIT( KCa, "ca" );
+ _LIT( KCs, "cs" );
+ _LIT( KCy, "cy" );
+ _LIT( KDa, "da" );
+ _LIT( KEl, "el" );
+ _LIT( KEt, "et" );
+ _LIT( KFa, "fa" );
+ _LIT( KFi, "fi" );
+ _LIT( KGa, "ga" );
+ _LIT( KGd, "gd" );
+ _LIT( KGu, "gu" );
+ _LIT( KHe, "he" );
+ _LIT( KHi, "hi" );
+ _LIT( KHu, "hu" );
+ _LIT( KHr, "hr" );
+ _LIT( KHy, "hy" );
+ _LIT( KId, "id" );
+ _LIT( KIs, "is" );
+ _LIT( KIt, "it" );
+ _LIT( KJa, "ja" );
+ _LIT( KKa, "ka" );
+ _LIT( KKk, "kk" );
+ _LIT( KKm, "km" );
+ _LIT( KKn, "kn" );
+ _LIT( KKo, "ko" );
+ _LIT( KLo, "lo" );
+ _LIT( KLt, "lt" );
+ _LIT( KLv, "lv" );
+ _LIT( KMk, "mk" );
+ _LIT( KMl, "ml" );
+ _LIT( KMn, "mn" );
+ _LIT( KMo, "mo" );
+ _LIT( KMr, "mr" );
+ _LIT( KMs, "ms" );
+ _LIT( KMy, "my" );
+ _LIT( KNo, "no" );
+ _LIT( KNl, "nl" );
+ _LIT( KPa, "pa" );
+ _LIT( KPl, "pl" );
+ _LIT( KPt, "pt" );
+ _LIT( KRo, "ro" );
+ _LIT( KRu, "ru" );
+ _LIT( KSi, "si" );
+ _LIT( KSk, "sk" );
+ _LIT( KSl, "sl" );
+ _LIT( KSo, "so" );
+ _LIT( KSr, "sr" );
+ _LIT( KSq, "sq" );
+ _LIT( KSv, "sv" );
+ _LIT( KSw, "sw" );
+ _LIT( KTa, "ta" );
+ _LIT( KTe, "te" );
+ _LIT( KTh, "th" );
+ _LIT( KTi, "ti" );
+ _LIT( KTk, "tk" );
+ _LIT( KTl, "tl" );
+ _LIT( KTr, "tr" );
+ _LIT( KUk, "uk" );
+ _LIT( KUr, "ur" );
+ _LIT( KVi, "vi" );
+ //_LIT( KZh, "zh" );
+ _LIT( KZu, "zu" );
+
+ _LIT( KEnB, "en-UK");
+ _LIT( KEnUS, "en-US");
+ _LIT( KZhTW, "zh-TW");
+ _LIT( KZhHK, "zh-HK");
+ _LIT( KZhCN, "zh-CN");
+ _LIT( KFrCA, "fr-CA");
+ _LIT( KPtBR, "pt-BR");
+ _LIT( KEnTW, "en-TW");
+ _LIT( KEnHK, "en-HK");
+ _LIT( KEnCN, "en-CN");
+ _LIT( KEnJP, "en-JP");
+ _LIT( KEnTH, "en-TH");
+ _LIT( KEsAR, "es-AR");
+ _LIT( KMsAP, "ms-AP");
+ _LIT( KEnAP, "en-AP" ); // KLangApacEnglish
+ _LIT( KIdAP, "id-AP" ); // KLangApacIndonesian
+ _LIT( KEu, "eu" ); // KLangBasque
+ _LIT( KGl, "gl" ); // KLangGalician
+
+ _LIT(KDefault, "qqqqq");
+
+ switch ( User::Language() )
+ {
+ case ELangTest:
+ aValue = KEn;
+ break;
+
+ case ELangEnglish:
+ aValue = KEnB;
+ break;
+ case ELangAmerican:
+ aValue = KEnUS;
+ break;
+ case ELangAustralian:
+ case ELangNewZealand:
+ case ELangCanadianEnglish:
+ case ELangSouthAfricanEnglish:
+ case ELangInternationalEnglish:
+ aValue = KEn;
+ break;
+
+ case ELangFrench:
+ case ELangSwissFrench:
+ case ELangBelgianFrench:
+ aValue = KFr;
+ break;
+
+ case ELangGerman:
+ case ELangAustrian:
+ case ELangSwissGerman:
+ aValue = KDe;
+ break;
+
+ case ELangSpanish:
+ case ELangInternationalSpanish:
+ aValue = KEs;
+ break;
+
+ case ELangLatinAmericanSpanish:
+ aValue = KEsAR;
+ break;
+
+ case ELangItalian:
+ case ELangSwissItalian:
+ aValue = KIt;
+ break;
+
+ case ELangSwedish:
+ case ELangFinlandSwedish:
+ aValue = KSv;
+ break;
+
+ case ELangDanish:
+ aValue = KDa;
+ break;
+
+ case ELangNorwegian:
+ case ELangNorwegianNynorsk:
+ aValue = KNo;
+ break;
+
+ case ELangFinnish:
+ aValue = KFi;
+ break;
+
+ case ELangBrazilianPortuguese:
+ aValue = KPtBR;
+ break;
+
+ case ELangPortuguese:
+ aValue = KPt;
+ break;
+
+ case ELangTurkish:
+ case ELangCyprusTurkish:
+ aValue = KTr;
+ break;
+
+ case ELangIcelandic:
+ aValue = KIs;
+ break;
+
+ case ELangRussian:
+ case ELangBelarussian:
+ aValue = KRu;
+ break;
+
+ case ELangHungarian:
+ aValue = KHu;
+ break;
+
+ case ELangDutch:
+ case ELangBelgianFlemish:
+ aValue = KNl;
+ break;
+
+ case ELangCzech:
+ aValue = KCs;
+ break;
+
+ case ELangSlovak:
+ aValue = KSk;
+ break;
+
+ case ELangPolish:
+ aValue = KPl;
+ break;
+
+ case ELangSlovenian:
+ aValue = KSl;
+ break;
+
+ case ELangPrcChinese:
+ aValue = KZhCN;
+ break;
+ case ELangTaiwanChinese:
+ aValue = KZhTW;
+ break;
+ case ELangHongKongChinese:
+ aValue = KZhHK;
+ break;
+
+ case ELangJapanese:
+ aValue = KJa;
+ break;
+
+ case ELangThai:
+ aValue = KTh;
+ break;
+
+ case ELangAfrikaans:
+ aValue = KAf;
+ break;
+
+ case ELangAlbanian:
+ aValue = KSq;
+ break;
+
+ case ELangAmharic:
+ aValue = KAm;
+ break;
+
+ case ELangArabic:
+ aValue = KAr;
+ break;
+
+ case ELangArmenian:
+ aValue = KHy;
+ break;
+
+ case ELangTagalog:
+ aValue = KTl;
+ break;
+
+ case ELangBengali:
+ aValue = KBn;
+ break;
+
+ case ELangBulgarian:
+ aValue = KBg;
+ break;
+
+ case ELangBurmese:
+ aValue = KMy;
+ break;
+
+ case ELangCatalan:
+ aValue = KCa;
+ break;
+
+ case ELangCroatian:
+ aValue = KHr;
+ break;
+
+ case ELangEstonian:
+ aValue = KEt;
+ break;
+
+ case ELangFarsi:
+ aValue = KFa;
+ break;
+
+ case ELangCanadianFrench:
+ aValue = KFrCA;
+ break;
+
+ case ELangScotsGaelic:
+ aValue = KGd;
+ break;
+
+ case ELangGeorgian:
+ aValue = KKa;
+ break;
+
+ case ELangGreek:
+ case ELangCyprusGreek:
+ aValue = KEl;
+ break;
+
+ case ELangGujarati:
+ aValue = KGu;
+ break;
+
+ case ELangHebrew:
+ aValue = KHe;
+ break;
+
+ case ELangHindi:
+ aValue = KHi;
+ break;
+
+ case ELangIndonesian:
+ aValue = KId;
+ break;
+
+ case ELangIrish:
+ aValue = KGa;
+ break;
+
+ case ELangKannada :
+ aValue = KKn;
+ break;
+
+
+ case ELangKazakh:
+ aValue = KKk;
+ break;
+
+ case ELangKhmer:
+ aValue = KKm;
+ break;
+
+ case ELangKorean:
+ aValue = KKo;
+ break;
+
+ case ELangLao:
+ aValue = KLo;
+ break;
+
+ case ELangLatvian:
+ aValue = KLv;
+ break;
+
+ case ELangLithuanian:
+ aValue = KLt;
+ break;
+
+ case ELangMacedonian:
+ aValue = KMk;
+ break;
+
+ case ELangMalay:
+ aValue = KMs;
+ break;
+
+ case ELangMalayalam:
+ aValue = KMl;
+ break;
+
+ case ELangMarathi:
+ aValue = KMr;
+ break;
+
+ case ELangMoldavian:
+ aValue = KMo;
+ break;
+
+ case ELangMongolian:
+ aValue = KMn;
+ break;
+
+ case ELangPunjabi:
+ aValue = KPa;
+ break;
+
+ case ELangRomanian:
+ aValue = KRo;
+ break;
+
+ case ELangSerbian:
+ aValue = KSr;
+ break;
+
+ case ELangSinhalese:
+ aValue = KSi;
+ break;
+
+ case ELangSomali:
+ aValue = KSo;
+ break;
+
+ case ELangSwahili:
+ aValue = KSw;
+ break;
+
+ case ELangTamil:
+ aValue = KTa;
+ break;
+
+ case ELangTelugu:
+ aValue = KTe;
+ break;
+
+ case ELangTibetan:
+ aValue = KBo;
+ break;
+
+ case ELangTigrinya:
+ aValue = KTi;
+ break;
+
+ case ELangTurkmen:
+ aValue = KTk;
+ break;
+
+ case ELangUkrainian:
+ aValue = KUk;
+ break;
+
+ case ELangUrdu:
+ aValue = KUr;
+ break;
+
+ case ELangVietnamese:
+ aValue = KVi;
+ break;
+
+ case ELangWelsh:
+ aValue = KCy;
+ break;
+
+ case ELangZulu:
+ aValue = KZu;
+ break;
+
+ // from \\epoc32\\include\\oem\\languages.hrh
+
+ case KLangTaiwanEnglish:
+ aValue = KEnTW;
+ break;
+
+ case KLangHongKongEnglish:
+ aValue = KEnHK;
+ break;
+
+ case KLangPrcEnglish:
+ aValue = KEnCN;
+ break;
+
+ case KLangJapaneseEnglish:
+ aValue = KEnJP;
+ break;
+
+ case KLangThaiEnglish:
+ aValue = KEnTH;
+ break;
+
+ case KLangApacMalay:
+ aValue = KMsAP;
+ break;
+
+ case KLangApacEnglish:
+ {
+ aValue = KEnAP;
+ break;
+ }
+ case KLangApacIndonesian:
+ {
+ aValue = KIdAP;
+ break;
+ }
+ case KLangBasque:
+ {
+ aValue = KEu;
+ break;
+ }
+ case KLangGalician:
+ {
+ aValue = KGl;
+ break;
+ }
+
+ // Cingular English
+ case 6154:
+ aValue = KEnUS;
+ break;
+
+ default:
+ aValue = KDefault;
+ break;
+ }
+ }
+
+// --------------------------------------------------------------------------
+// TInt CSvgDecoder::RemoveInternalReferences( CSvgElementImpl* )
+// ---------------------------------------------------------------------------
+void CSvgDecoder::RemoveInternalReferences( CSvgElementImpl* aElement )
+ {
+ // Remove the references of aElement in content handler's lists
+
+ // Use Elements
+ TInt lIndex = 0;
+ if ( aElement->ElemID() == KSvgUseElement )
+ {
+ lIndex = iUseElementArray->Find( aElement );
+ if ( lIndex != KErrNotFound )
+ {
+ iUseElementArray->Remove( lIndex );
+ }
+ }
+ else if ( aElement->ElemID() == KSvgSwitchElement )
+ {
+ // Switch Elements
+ lIndex = iSwitchElementArray->Find( aElement );
+ if ( lIndex != KErrNotFound )
+ {
+ iSwitchElementArray->Remove( lIndex );
+ }
+ }
+ else if ( aElement->IsAnimatedElement() )
+ {
+ // Animation elements include animate* elements, set,
+ // "animation", audio elements etc.
+ lIndex = iAnimationElementArray->Find( aElement );
+ if ( lIndex != KErrNotFound )
+ {
+ iAnimationElementArray->Remove( lIndex );
+ }
+ lIndex = iAnimRefElementArray->Find( aElement );
+ if ( lIndex != KErrNotFound )
+ {
+ iAnimRefElementArray->Remove( lIndex );
+ }
+ }
+ // Elements with test attributes - requiredFeatures,
+ // requiredExtensions, systemLanguage
+ lIndex = iReqFetAttSysArray->Find( aElement );
+ if ( lIndex != KErrNotFound )
+ {
+ iReqFetAttSysArray->Remove( lIndex );
+ }
+
+ // Remove Internal references of subtree elements as well
+ CSvgElementImpl* lChild = ( CSvgElementImpl* )aElement->FirstChild();
+ while ( lChild != NULL )
+ {
+ RemoveInternalReferences( lChild );
+ lChild = ( CSvgElementImpl* )lChild->NextSibling();
+ }
+
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGAElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,256 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGAELEMENTIMPL_
+#define _INC_CSVGAELEMENTIMPL_
+
+//
+#include "GfxFloatFixPt.h"
+#include "SVGElementImpl.h"
+#include "SVGListener.h"
+
+class CSvgDocumentImpl;
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgAElementImpl : public CSvgElementImpl,
+ public MSvgMouseListener
+ {
+ public:
+
+ // Constructor/deconstructor
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgAElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgAElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgAElementImpl();
+
+ private:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgAElementImpl( CSvgDocumentImpl* aDoc );
+
+ public:
+
+ // From MXmlElement API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+ TBool SetTargetL( const TDesC& aName, const TDesC& aValue );
+
+ const TDesC& Target();
+
+ void GetBBox( TGfxRectangle2D& aBbox );
+ void GetUnscaledBBox( TGfxRectangle2D& aBbox );
+
+ // From CSvgElementImpl
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL( MXmlElement* aParentElement);
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+
+ // From MEventReceiver
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool ReceiveEventL( MSvgEvent* aEvent );
+ void Reset(MSvgEvent* aEvent);
+ TInt SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue );
+ TInt GetAttributeDes( const TInt aNameId, TPtrC16& aValue );
+
+ /**
+ * Return wether an svg element is displayable, such as <rect>, <circle>, or
+ * an abstract element, such as <g>, <animate>.
+ *
+ * @since 1.0
+ * @param None
+ * @return ETrue if element is viewable.
+ */
+ TBool IsViewable() { return ETrue; }
+
+ /**
+ * Notified when the mouse pointer enters a visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ TBool MouseEntered( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Notified when the mouse pointer exits a visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ TBool MouseExited( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Notified when the mouse pointer is pressed down on visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ TBool MousePressed( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Notified when the mouse pointer is released on on visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ TBool MouseReleased( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Notified when the mouse pointer is released on on visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ TBool MouseMoved( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ void Print( TBool aIsEncodeOn );
+
+ private:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void AddEventReceiverSubtreeL( CSvgElementImpl* aElement );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool IsChild( CSvgElementImpl* aSubtree,
+ CSvgElementImpl* aElement );
+ private:
+ TBool iInitDone;
+ HBufC* iTarget;
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGAnimTimeController.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,458 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGANIMTIMECONTROLLER_
+#define _INC_CSVGANIMTIMECONTROLLER_
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "GfxFloatFixPt.h"
+
+#include "SVGEngineImpl.h"
+#include "SVGEvent.h"
+
+
+
+const TInt KTimeMax = 255;
+const TUint32 KTimeIndefinite = 0x7fffffff;
+typedef TUint8 TAnimCalcMode;
+const TAnimCalcMode KAnimCalcModeDiscrete = 0;
+const TAnimCalcMode KAnimCalcModeLinear = 1;
+const TAnimCalcMode KAnimCalcModePaced = 2;
+const TAnimCalcMode KAnimCalcModeSpline = 3;
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgAnimTimeController : public CBase
+ {
+ public:
+ void AddToInitialList(TInt aBeginTime);
+
+ void SetBeginTimeList(RArray<TInt32>*& aList);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgAnimTimeController* CSvgAnimTimeController::NewL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ ~CSvgAnimTimeController();
+ private:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgAnimTimeController();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL();
+
+ public:
+
+
+ //For Dur as media for audio and vedio elements
+ void SetOrgDurationTime(TInt32 aValue);
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetBeginTime( TInt32 aBeginTime );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ResetBeginTime( TInt32 aBeginTime );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetDurationTime( TInt32 aDurationTime );
+
+ /**
+ * Need method description
+ *
+ * Himanshu: added to adjust the duration time in case there is a negative begin time
+ *
+ *
+ */
+ TInt32 GetDurationTime( );
+
+ /**
+ * Need method description
+ *
+ * Himanshu: added to adjust the end time in case there is a negative begin time
+ *
+ *
+ */
+ TInt32 GetEndTime( );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetEndTime( TInt32 aEndTime );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetRepeatDurationTime( TUint32 aRepeatDurationTime );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetCalMode( TAnimCalcMode aCalcMode )
+ {
+ iCalcMode = aCalcMode;
+ }
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ResetKeyTime()
+ {
+ iKeyTime->Reset();
+ }
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void CreateKeyTime( TInt32 aKeyTimeCount );
+ void CreateKeyTimeForEnumeration( TInt32 aKeyTimeCount );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void PrepareTimeL( const RArray<TFloatFixPt>* aValues );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TUint32 BeginTime()
+ {
+ return iBeginTime;
+ }
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TUint32 DurationTime()
+ {
+ return iDurationTime;
+ }
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+
+ TUint32 EndTime()
+ {
+ return iEndTime;
+ }
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TUint32 RepeatDurationTime()
+ {
+ return iRepeatDurationTime;
+ }
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TAnimCalcMode CalMode()
+ {
+ return iCalcMode;
+ }
+
+
+ void CalculateAnimTimes();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void AddBeginTime( TInt32 aBeginTime );
+ void AddEndTime( TInt32 aEndTime );
+ void GetNextEndTime(TInt32 aBeginTime);
+ void SetNextBeginTime(TInt32 aCurTime);
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TUint32 GetBeginTime( TInt32 aIndex );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt BeginTimesCount();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ // void AddBeginEvent( TSvgEvent aBeginEvent );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ // TSvgEvent GetBeginEvent( TInt32 aIndex );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void AddKeyTime( TFloatFixPt aTimerTime );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void AddKeySplineL( TFloatFixPt aX1, TFloatFixPt aY1, TFloatFixPt aX2, TFloatFixPt aY2 );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetAnimTime( TInt32 aTimerTime,
+ TInt32& aAnimTime,
+ TInt32& aValueIndex,
+ TInt32& aSubAnimTime );
+ void GetAnimTimeForEnumeration( TInt32 aTimerTime,
+ TInt32& aAnimTime,
+ TInt32& aValueIndex,
+ TBool aKeyTimesPresent
+ );
+
+ void CopyL(CSvgAnimTimeController* newElement);
+ void SetEndTimesIndefinite();
+ TUint32 GetOriginalEndTime();
+ void ReInitializeForSeek();
+
+ /**
+ * Sets the calc mode to spline mode
+ *
+ * @since S60 v3.1
+ * @param aIsSplineCalcMode Indicates whether the
+ * calcMode is of type "spline"
+ * @return none.
+ */
+ void SetIsSplineCalcMode( TBool aIsSplineCalcMode );
+
+ /**
+ * Returns ETrue if the calc mode is in spline mode
+ *
+ * @since S60 v3.1
+ * @return TBool ETrue if spline mode, EFalse otherwise.
+ */
+ TBool IsSplineCalcMode() const;
+
+ /**
+ * Sets the spline parameter string for later processing
+ * (when calc mode is set)
+ *
+ * @since S60 v3.1
+ * @param aIsSplineCalcMode Indicates whether the
+ * calcMode is of type "spline"
+ * @return none.
+ */
+ void SetSplineValueL( const TDesC& aSplineValue );
+
+ /**
+ * Returns the string corresponding to the Spline parameters.
+ *
+ * @since S60 v3.1
+ * @return TPtrC Pointer to Spline param string.
+ */
+ TPtrC SplineValue() const;
+#if defined(__WINS__)
+ public:
+ CSvgEngineImpl* iEngine;
+#endif
+
+
+ class TKeyTime
+ {
+ public:
+ TUint16 iY;
+ TUint16 iX;
+ };
+
+ private:
+
+ TAnimCalcMode iCalcMode;
+
+ TUint32 iBeginTime;
+ TUint32 iInitialBeginTime;
+ TUint32 iDurationTime;
+ TUint32 iOrgDurationTime;
+ TUint32 iEndTime;
+ TUint32 iInitialEndTime;
+ TUint32 iOrgEndTime;
+ TUint32 iRepeatDurationTime;
+ TUint32 iNewActiveDurationTime;
+
+ // Key time
+ RArray<TKeyTime>* iKeyTime;
+ RArray<TUint32>* iAnimTime;
+ TUint16 iSplineIndex;
+
+ RArray<TInt32>* iBeginTimeList;
+ RArray<TInt32>* iInitialBeginTimeList;
+ RArray<TInt32>* iEndTimeList;
+ RArray<TInt32>* iInitialEndTimeList;
+
+ TUint32 iModifiedEndTime;
+ // Indicates whether the calc mode is spline or otherwise
+ TBool iIsSplineCalcMode;
+ // Stores the spline parameters as a string
+ HBufC* iSplines;
+
+ public:
+ // for decoder.
+ void SetKeyTimeArray(RArray<TKeyTime>*& aArray);
+ void SetAnimTimeArray(RArray<TUint32>*& aArray);
+ // for DOM tree Reusage
+ void SetOriginalValues_DOMReuse();
+ void ReInitialize();
+
+ void SetModifiedEndTime(TUint32 aTime);
+
+ void Reset();
+ void SaveBeginTime();
+ void SaveEndTime();
+ void ResetBeginTime();
+ void ResetEndTime();
+ TInt32 LastEndTime();
+ TInt32 LastBeginTime();
+ };
+
+
+#endif //_INC_CSvgAnimTimeController_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGAnimTimingParser.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,209 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_TSVGANIMTIMINGPARSER_
+#define _INC_TSVGANIMTIMINGPARSER_
+
+#include <e32base.h>
+
+#include "SVGEvent.h"
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgAnimTimingParser : public CBase
+ {
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgAnimTimingParser* NewL( const TDesC& aTimingDes, CSvgElementImpl* aElement );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgAnimTimingParser* NewLC( const TDesC& aTimingDes, CSvgElementImpl* aElement );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ ~CSvgAnimTimingParser();
+ private:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgAnimTimingParser();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TDesC& aTimingDes, CSvgElementImpl* aElement );
+
+
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void Parse( TDes& aIdValue,
+ TSvgEvent& aEvent,
+ TInt32& aClockValue,
+ TReal32& aRepeatValue,
+ TBool aBeginAttribute);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ParseEvent( TInt32 aEventNumber,
+ TDes& aIdValue,
+ TSvgEvent& aEvent,
+ TInt32& aClockValue );
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ inline TUint WallClockValue()
+ {
+ return iWallClockValue;
+ }
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ inline TUint16 AccekeyValue()
+ {
+ return iAccessKeyValue;
+ }
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ inline TUint RepeatValue()
+ {
+ return iRepeatCount;
+ }
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ParseClockValue( TLex& aLex, TInt32& aClockValue );
+
+
+ private:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ParseWallclockValue( TLex& aLex ); // Not yet implemented
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TSvgEvent DesToEventId( const TDesC& aEventDes );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SkipUntilNumEnd( TLex& aLex );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SkipAlphaNumeric( TLex& aLex );
+
+ private:
+ TUint iWallClockValue;
+ TUint16 iAccessKeyValue; // A Unicode character
+ TUint iRepeatCount;
+
+ TPtr iTimingDes;
+ HBufC* iBuf;
+ CSvgElementImpl* iElement;
+ };
+
+
+#endif // _INC_TSvgAnimTimingParser_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGAnimateElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,254 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGANIMATEELEMENTIMPL_
+#define _INC_CSVGANIMATEELEMENTIMPL_
+
+#include "SVGAnimationBase.h"
+
+
+
+
+class CSvgDocumentImpl;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgAnimateElementImpl : public CSvgAnimationBase
+ {
+ public:
+
+ // Constructor/deconstructor
+
+ TBool iIsInheritedAttribute;
+
+ void InitAnimationL();
+
+ void Reset(MSvgEvent* aEvent);
+ void DeactivateAnimation();
+ void SetToOriginalL();
+
+ // for calculation of interpolated values for viewBox animation.
+ void DoViewBoxAnimProcL(MSvgTimerEvent* aEvent);
+ TBool DoAnimProcL(MSvgEvent* aEvent);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgAnimateElementImpl* NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgAnimateElementImpl* NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgAnimateElementImpl();
+
+ // Dom Reuse
+ void ReInitializeAnimation();
+
+ void SetOriginalValues_DOMReuse();
+ CGfxGeneralPath* GetPathAttribute(TInt aAttributeId);
+ void SetPathAttribute(TInt aAttributeId, CGfxGeneralPath* aPathHandle);
+
+ protected:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgAnimateElementImpl( CSvgDocumentImpl* aDoc );
+
+
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeIntL( const TInt aNameId, const TInt32 aValue);
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeIntL( const TInt aNameId, TInt32& aValue );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeFloatL(const TInt aNameId, TFloatFixPt aValue );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat(const TInt aNameId, TFloatFixPt& aValue );
+
+ // From MEventReceiver
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool ReceiveEventL( MSvgEvent* aEvent );
+ // From MEventReceiver
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ResetReferenceElementL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void CopyL(CSvgAnimateElementImpl* aDestElement );
+
+ void Print( TBool aIsEncodeOn );
+
+ private:
+ // From CSvgAnimationBase
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+ virtual TBool AnimProcL( MSvgTimerEvent* aEvent );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ResetAnimationL();
+
+ // Utility method to blend between two paths and give a current path
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void BlendPathL( TInt32 aAlpha,
+ CGfxGeneralPath* aFromPath,
+ CGfxGeneralPath* aToPath,
+ CGfxGeneralPath*& aBlendPath );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void AddPathsL( CGfxGeneralPath*& aPathResult,
+ CGfxGeneralPath* aPath1 );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void CopyPathsL( CGfxGeneralPath*& aPathResult,
+ CGfxGeneralPath* aPath1 );
+ };
+
+
+#endif /* _INC_CSvgAnimateElementImpl_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGAnimateMotionElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,359 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGANIMATEMOTIONELEMENTIMPL_
+#define _INC_CSVGANIMATEMOTIONELEMENTIMPL_
+
+#include "SVGAnimateTransformElementImpl.h"
+
+
+
+#include "GfxAffineTransform.h"
+#include "GfxLine2D.h"
+
+
+
+
+
+const TInt16 KAnimMotionRotateAuto = -100;
+const TInt16 KAnimMotionRotateAutoReverse = -200;
+
+
+class CSvgDocumentImpl;
+class CGfxGeneralPath;
+class CGfxFlatteningPathIterator;
+
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgAnimateMotionElementImpl : public CSvgAnimationBase
+ {
+ public:
+
+ // Constructor/deconstructor
+
+ TBool DoAnimProcL(MSvgEvent* aEvent);
+ void SetAnimRotate(TInt16 aRotate);
+ void SetAccumulateValuesForSetMediaTime();
+
+ TInt SetAttributePathRef( const TInt aNameId,
+ CGfxGeneralPath*& aValue );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgAnimateMotionElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgAnimateMotionElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ // Dom Reuse
+ void ReInitializeAnimation();
+
+ void SetOriginalValues_DOMReuse();
+ CGfxGeneralPath* GetPathAttribute(TInt aAttributeId);
+ void SetPathAttribute(TInt aAttributeId, CGfxGeneralPath* aPathHandle);
+
+ private:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+
+ public:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgAnimateMotionElementImpl();
+
+ private:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgAnimateMotionElementImpl( CSvgDocumentImpl* aDoc );
+
+
+ public:
+
+ void Reset(MSvgEvent* aEvent);
+ void DeactivateAnimation();
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeIntL( const TInt aNameId, const TInt32 aValue);
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeIntL( const TInt aNameId, TInt32& aValue );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeFloatL(const TInt aNameId, TFloatFixPt aValue );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat(const TInt aNameId, TFloatFixPt& aValue );
+ // From MXmlElement API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+ // From MEventReceiver
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool ReceiveEventL( MSvgEvent* aEvent );
+ // From MEventReceiver
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ResetReferenceElementL();
+
+ // From CSvgAnimationBaseImpl
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt GetAttributePath( const TInt aNameId,
+ CGfxGeneralPath*& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt SetAttributePathL( const TInt aNameId,
+ CGfxGeneralPath* aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void CopyL(CSvgAnimateMotionElementImpl* aDestElement );
+
+ void Print( TBool aIsEncodeOn );
+
+ protected:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetAccumulateValues();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ApplyAccumulateValuesL();
+
+ TGfxAffineTransform iFillMatrix;
+
+ private:
+
+ // From CSvgAnimationBase
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool AnimProcL( MSvgTimerEvent* aEvent );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void InitAnimationL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetToOriginalL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetFillValueL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void ResetAnimationL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetToInitialValueL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetToEndValueL();
+
+ private:
+ CGfxGeneralPath* iMotionPath;
+ CGfxFlatteningPathIterator* iPathIterator;
+ TGfxAffineTransform iIdentTransform;
+
+ TFloatFixPt iSubLength;
+ TFloatFixPt iCurrentPos;
+ TFloatFixPt iSubPos;
+ TGfxLine2D iCurrentSeg;
+ TInt16 iAnimMotionRotate;
+ TGfxAffineTransform iEndMatrix;
+ //TBool iIsValues;
+ TFloatFixPt iToFloatX;
+ TFloatFixPt iToFloatY;
+ TFloatFixPt iFromFloatX;
+ TFloatFixPt iFromFloatY;
+ TFloatFixPt iOrgFromFloatX;
+ TFloatFixPt iOrgFromFloatY;
+ // for DOM Reuse
+ TFloatFixPt iOrgToFloatX;
+ TFloatFixPt iOrgToFloatY;
+ // Used to remember that Path values have been set
+ TBool iPathSeen;
+ public:
+ TBool iIsMotionPath;
+
+
+ TReal32 iPrevRotate;
+ };
+
+
+#endif /* _INC_CSvgAnimateMotionElementImpl_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGAnimateTransformElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,319 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGANIMATETRANSFORMELEMENTIMPL_
+#define _INC_CSVGANIMATETRANSFORMELEMENTIMPL_
+
+#include "SVGAnimationBase.h"
+
+
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgAnimateTransformElementImpl : public CSvgAnimationBase
+ {
+ public:
+
+ // Constructor/deconstructor
+
+ void SetMatrixDataSize(TUint8 aValue);
+ TBool DoAnimProcL(MSvgEvent* aEvent);
+ void SetAccumMatrix();
+ CGfxGeneralPath* GetPathAttribute(TInt aAttributeId);
+ void SetPathAttribute(TInt aAttributeId, CGfxGeneralPath* aPathHandle);
+ void Reset(MSvgEvent* aEvent);
+ void SetAccumulateValuesForSetMediaTime();
+ void DeactivateAnimation();
+ /**
+
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgAnimateTransformElementImpl* NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgAnimateTransformElementImpl* NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ // Dom Reuse
+ void ReInitializeAnimation();
+
+ void SetOriginalValues_DOMReuse();
+
+
+ protected:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void ConstructL( const TUint8 aElemID);
+
+
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgAnimateTransformElementImpl();
+
+ protected:
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgAnimateTransformElementImpl( CSvgDocumentImpl* aDoc );
+
+
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeIntL( const TInt aNameId, const TInt32 aValue);
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+ TInt GetAttributeIntL( const TInt aNameId, TInt32& aValue );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeFloatL(const TInt aNameId, TFloatFixPt aValue );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat(const TInt aNameId, TFloatFixPt& aValue );
+ // From MXmlElement API
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+ // From MEventReceiver
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool ReceiveEventL( MSvgEvent* aEvent );
+ // From MEventReceiver
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ResetReferenceElementL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void CopyL( CSvgAnimateTransformElementImpl* aDestElement );
+
+ public:
+ class TMatrixData
+ {
+ public:
+ TFloatFixPt iData[3];
+ };
+
+ TBool SetMatrixData( TInt aIndex, TMatrixData& aMatrix);
+ void SetTransformValues(RArray<TMatrixData>*& aValues);
+ // for DOM reusage
+
+ void SetTransValues_DOMReuse();
+
+ void Print( TBool aIsEncodeOn );
+
+ protected:
+ TGfxAffineTransform iFillMatrix;
+ RArray<TMatrixData>*iTransformValues;
+ RArray<TMatrixData>* iOrgTransformValues;
+ TUint8 iMatrixDataSize;
+ TGfxAffineTransform iEndMatrix;
+ TMatrixData iAccumMatrixData;
+
+ // DOM_Reuse
+ TBool iMultipleRendering;
+
+
+ protected:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void DesToMatrixData( const TDesC& aDes,
+ TMatrixData& aMatrixData );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void InitAnimationL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetAccumulateValues();
+
+ protected:
+ // From CSvgAnimationBase
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+ virtual TBool AnimProcL( MSvgTimerEvent* aEvent );
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetToOriginalL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetFillValueL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void ResetAnimationL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetToInitialValueL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetToEndValueL();
+ };
+
+
+#endif /* _INC_CSvgAnimateTransformElementImpl_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGAnimationBase.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,732 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGANIMATIONBASE_
+#define _INC_CSVGANIMATIONBASE_
+
+#include <e32math.h>
+#include "SVGElementImpl.h"
+#include "SVGEventReceiver.h"
+#include "SVGEvent.h"
+#include "SVGSchemaData.h"
+#include "SVGAnimTimeController.h"
+
+#include "GfxFloatFixPt.h"
+#include "GfxRectangle2D.h"
+#include "GfxGeneralPath.h"
+
+#include "SVGSvgElementImpl.h"
+
+
+
+const TUint32 KRmask = 0xff0000;
+const TUint32 KGmask = 0x00ff00;
+const TUint32 KBmask = 0x0000ff;
+
+const TInt KBeginElementOffsetRatio = 66;
+
+//
+typedef TUint8 TAnimStatus;
+const TAnimStatus KAnimNotActive = 0;
+const TAnimStatus KAnimActive = 1;
+const TAnimStatus KAnimEnd = 2;
+const TAnimStatus KAnimFinished = 3;
+
+typedef TUint8 TAnimFill;
+const TAnimFill KAnimFillRemove = 0;
+const TAnimFill KAnimFillFreeze = 1;
+
+typedef TUint8 TAccumulate;
+const TAccumulate KAccumNone = 0;
+const TAccumulate KAccumSum = 1;
+
+typedef TUint8 TAdditive;
+const TAdditive KAdditiveReplace = 0;
+const TAdditive KAdditiveSum = 1;
+const TAdditive KAdditivePass = 2;
+
+typedef TUint8 TRestartMode;
+const TAccumulate KRestartAlways = 0;
+const TAccumulate KRestartWhenNotActive = 1;
+const TAccumulate KRestartNever = 2;
+
+
+const TUint16 KRepeatCountMax = 0xffff;
+
+class CSvgDocumentImpl;
+class MXmlElementOpt;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgAnimationBase : public CSvgElementImpl
+ {
+ public:
+ friend class CSvgAnimTimeController;
+ // function used by decoder to set the begin time list.
+ void SaveBeginTimeToList(TInt aTimeInMilliseconds);
+
+ void AddEndTime( TInt32 aEndTime );
+ void SetBeginTimeList(RArray<TInt32>*& aList);
+
+ void SetBeginTime(TInt32 aTime);
+
+ void SetAbsoluteBeginTime(TInt32 aTime);
+
+ void SetDurationTime(TInt32 aTime);
+
+ TBool GetFromFlag();
+ TUint16 GetAttributeId();
+
+ void SetFromFlag();
+ void SetFromInt(TInt32 aValue);
+ void SetFromFloat(TFloatFixPt aValue);
+ void SetFromPathL(CGfxGeneralPath*& aPath);
+ void SetFromViewBox(TGfxRectangle2D aValue);
+
+ void SetToFlag();
+ void SetToInt(TInt32 aValue);
+ void SetToFloat(TFloatFixPt aValue);
+ void SetToPath(CGfxGeneralPath*& aPath);
+ void SetToViewBox(TGfxRectangle2D aValue);
+
+ void SetByFlag();
+
+ CSvgElementImpl*& GetTargetElem();
+
+ void SetAnimFreeze();
+
+ void SetValuesFlag();
+ void SetIntValuesArray( RArray<TInt32>*& aArray);
+ void SetFloatValuesArray( RArray<TFloatFixPt>*& aArray);
+ void SetPathValuesArray( RPointerArray<CGfxGeneralPath>*& aArray);
+ void SetViewBoxValuesArray( RArray<TGfxRectangle2D>*& aArray);
+ void ResetFloatValuesArray();
+
+ void SetRepeatCount(TReal32 aCount);
+ void SetRepeatDuration(TUint32 aDur);
+
+ void SetEndTime(TInt32 aTime);
+
+ void SetRestartMode(TRestartMode aMode);
+ void SetAccumulate(TAccumulate aValue);
+ void SetAdditive(TAdditive aValue);
+
+ void SetCalcMode(TAnimCalcMode aMode);
+
+ void SetKeyTimeArray(RArray<CSvgAnimTimeController::TKeyTime>*& aArray);
+ void SetAnimTimeArray(RArray<TUint32>*& aArray);
+ void SetKeyTimeFlag();
+ CGfxGeneralPath* GetPathAttribute(TInt aAttributeId);
+ void SetPathAttribute(TInt aAttributeId, CGfxGeneralPath* aPathHandle);
+
+ /*Function added for Forward reference support*/
+ TInt SetRefElemById(const TDesC& aName);
+ void CheckBeginTime();
+ // functions added for JSR-226
+
+
+
+/**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeIntL( const TInt aNameId,
+ const TInt32 aValue );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeIntL( const TInt aNameId,
+ TInt32& aValue );
+
+
+// End of functions for Decoder
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgAnimationBase();
+
+ class TEventListItem
+ {
+ public:
+
+ TInt32 iTime;
+ TInt32 iOffset;
+ TReal32 iRepeatValue;
+ CSvgElementImpl* iTargetElement;
+ HBufC* iReferenceElemeId;
+ TUint16 iAccessKeyCode;
+ TUint16 iDummy; // Series 60 3.0 Byte Alignment
+ TSvgEvent iEvent;
+
+ };
+ CArrayFixFlat<TEventListItem>* iEventList;
+ CArrayFixFlat<TEventListItem>* iEndTimeList;
+
+ // for decoder
+ void SetEventList(CArrayFixFlat<TEventListItem>*& aEventList);
+
+ void SetEndTimeList(CArrayFixFlat<TEventListItem>*& aTimeList);
+ TBool IsSelfDependentForBegin();
+
+
+ void SetFromValuesL();
+ // From SVG DOM / MSvgAnimationElement
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TUint32 SimpleDuration();
+ TUint32 CompleteDuration();
+ // From SVG DOM / MElementTimeControl
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool BeginElementL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool BeginElementAtL( TFloatFixPt aOffset );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool EndElement();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool EndElementAt( TFloatFixPt aOffset );
+
+
+ // From MXmlElement API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+ // From CSvgElementImpl
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void ReInitializeAnimation();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetAttrValueL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetTarget( CSvgElementImpl* );
+
+ void SetAttributeId(const TUint16 aAtrId);
+
+ // this is made a leaving function
+ void ResetL(MSvgEvent* aEvent,CSvgAnimationBase* aElement);
+
+ void SetAttributeType(const TUint8 aAtrType);
+ virtual void SetOriginalValues_DOMReuse();
+
+ TAnimStatus GetAnimStatus();
+ void DeactivateAnimation(CSvgAnimationBase* aElement);
+ void CheckForEndTimesAndFreezeL(CSvgAnimationBase* aElement);
+ virtual void SetAccumulateValuesForSetMediaTime();
+
+ TInt32 GetAbsoluteBeginTime();
+ TInt32 GetEndTime();
+ void ResetAttrValueL();
+
+ /**
+ * Need method description
+ *returns if the animation element has fill value freeze or not
+ * @since 3.2
+ * @param none
+ * @return return True if animation element has fill value as freeze
+ */
+ TBool IsFillFreeze();
+
+ void ResetTimes();
+
+
+ protected:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgAnimationBase( CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void ConstructL( const TUint8 aElemID );
+
+
+
+ protected:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static TFloatFixPt BlendFloat( TInt32 aAlpha,
+ TFloatFixPt aV1,
+ TFloatFixPt aV2 );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static TInt32 BlendInt( TInt32 aAlpha,
+ TInt32 aV1,
+ TInt32 aV2 );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static TUint32 BlendColor( TInt32 aAlpha,
+ TUint32 aV1,
+ TUint32 aV2 );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static TUint32 AddColor( TUint32 aV1, TUint32 aV2 );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static TUint32 SubtractColor( TUint32 aV1,
+ TUint32 aV2 );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool ReceiveEventProcL( MSvgEvent* aEvent,
+ CSvgAnimationBase* aAnimElement );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool AnimProcL( MSvgTimerEvent* aEvent ) = 0;
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetToOriginalL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetFillValueL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetToInitialValueL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetToEndValueL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void InitAnimationL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void ResetAnimationL() = 0;
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetAccumulateValues();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool IsElementAttrs( const TDesC& aAttrName );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool IsPresentationAttrs( const TDesC& aAttrName );
+
+ public:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetBeginByEventL( CSvgAnimationBase* aAnimElement,
+ TInt32 aOffset, TBool aAddTime = EFalse);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetEndByEvent( CSvgAnimationBase* aAnimElement,
+ TInt32 aOffset );
+
+ void StoreRepeatId( const TDesC& aValue, TBool RepeatWasInBeginAtt );
+
+ void NotifyAnimationsRepeatingOnThisOneL( const TDesC* aId );
+
+ protected:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt32 GetNumberOfEvents(const TDesC& aValue);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt32 Duration();
+
+ void CopyL(CSvgAnimationBase* aAnimationBase);
+
+
+ // to parse a viewBox attribute value.
+ TBool ParseViewBoxValue(const TDesC& aValue, TGfxRectangle2D& aRect);
+
+ private:
+ /**
+ * This function computes the distance between colours for the purpose
+ * of animateColor element. Colours are treated as a 3D
+ * point with r, g, b acting as axes. It modifies the iValuesFloat
+ * array and each index contains the cummulative length(from start
+ * colour) of the segment with same index
+ *
+ * @since s60 v3.1
+ * @param none.
+ * @return none.
+ */
+ void FindColorDistanceL();
+
+ public:
+ TAnimStatus iAnimStatus; // before start, during animation, or end
+
+ HBufC* iRepeatId;
+ TBool iRepeatInBegin;
+
+ protected:
+
+ // basic animation attributes
+ CSvgAnimTimeController* iAnimTime;
+ CSvgElementImpl* iTargetElement; // default is parent element
+
+ CGfxGeneralPath* iEndPath;
+ RArray<TFloatFixPt>* iValuesFloat;
+ CGfxGeneralPath* iOrgPath;
+ CGfxGeneralPath* iFromPath;
+ CGfxGeneralPath* iToPath;
+ CGfxGeneralPath* iOrgFromPath;
+ RPointerArray<CGfxGeneralPath>* iValuesPath;
+ RArray<TInt32>* iValuesInt;
+
+ TInt32 iEndOffset;
+ TReal32 iRepeatCount;
+
+ TReal32 iRepeatEndValue;
+
+ TInt32 iAbsoluteBeginTime;
+
+ // properties that will be modified over time
+ TInt32 iPropInt;
+ TFloatFixPt iPropFloat;
+
+ // origianl value and animation value
+
+ TInt32 iAttributeFlag;
+ TInt32 iEndInt;
+
+ TInt32 iOrgInt;
+ TInt32 iFromInt;
+ TInt32 iToInt;
+ TInt32 iOrgFromInt;
+
+ // for DOM Reuse
+ TBool iIsBeginSet;
+
+ TFloatFixPt iOrgFloat;
+ TFloatFixPt iFromFloat;
+ TFloatFixPt iToFloat;
+ TFloatFixPt iOrgFromFloat;
+ TFloatFixPt iEndFloat;
+
+ //viewBox Animation
+
+ TGfxRectangle2D iOrgViewBox;
+ TGfxRectangle2D iFromViewBox;
+ TGfxRectangle2D iToViewBox;
+ TGfxRectangle2D iOrgFromViewBox;
+ RArray<TGfxRectangle2D>* iValuesViewBox;
+ TGfxRectangle2D iEndViewBox;
+ ////////
+
+ TInt iBeginTimeIndex;
+
+
+
+ // TUint16 iEndAccessKeyCode;
+
+ TUint16 iCurrentRepeatCount;
+ // target attribute
+ TUint16 iAttrId;
+ TUint16 iDataType;
+
+ /* CSvgElementImpl* iEndSyncElementId;*/
+
+
+
+ TUint8 iInitDone;
+ TUint8 iTargetSet;
+ TUint8 iNoFrom;
+ TUint8 iHaveTo;
+ TUint8 iHaveBy;
+ TUint8 iHaveValues;
+
+
+
+ /* TSvgEvent iEndReferenceEvent;*/
+
+
+ TAnimFill iFill;
+ TUint8 iHadBegun;
+ TRestartMode iAnimRestart;
+ TAccumulate iAccumulate;
+ TAdditive iAdditive;
+ TAdditive iAdditiveOrg;
+
+
+
+
+
+ //deleted by memory manager so dont do it yourself
+ CPaintCssValueImpl* iFromPaint;
+ CPaintCssValueImpl* iToPaint;
+
+ TUint8 iOverrideTime;
+
+
+ TUint8 iRepeatCountSet;
+
+ TBool iDoFreeze;
+
+ //DOM Reusage
+
+ TBool iCheckFirstAnim;
+
+
+
+ TBool iKeyTimesPresent;
+
+ // these are kept only up to the loading time. after that this memory is freed.
+
+
+ /*HBufC* iEndReferenceElemeId;*/
+ TBool iIsUserSeek;
+ TInt iEndTimeIndex;
+ // TBool iHasEnded;
+
+ TBool iIsEndEventSent;
+ TInt iNegativeBeginTime; // Himanshu: stores negative begin value;
+ static const TInt KIndefiniteAnimationDuration = 2147483647;
+ };
+
+
+#endif /* _INC_CSvgAnimationBase_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGAnimationElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,372 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_CSVGANIMATIONELEMENTIMPL__
+#define __INC_CSVGANIMATIONELEMENTIMPL__
+
+// INCLUDES
+#include "SVGAnimationBase.h"
+#include "SVGElementImpl.h"
+
+// FORWARD DECLARATIONS
+class CSvgDocumentImpl;
+
+
+/**
+ * The animation elements specifies an SVG document or an SVG document fragment
+ * providing synchronized animated vector graphics.
+ *
+ * This element also supports all Run-time synchronization attributes and SVG
+ * Timing attributes.
+ *
+ * @lib SVGEngine.lib
+ * @since Series 60 3.1
+ */
+class CSvgAnimationElementImpl : public CSvgAnimationBase
+ {
+ public: // Constructor/deconstructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CSvgAnimationElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Two-phased constructor.
+ */
+ static CSvgAnimationElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSvgAnimationElementImpl();
+
+ public: // From CSvgAnimationBase
+
+ /**
+ * Execute animation of its children when instructed.
+ *
+ * @since Series 60 3.1
+ * @param MSvgTimerEvent* aEvent
+ * @return TBool
+ */
+
+ virtual TBool AnimProcL( MSvgTimerEvent* aEvent );
+
+ /**
+ * Cleanup animation work to its children
+ *
+ * @since Series 60 3.1
+ * @param none
+ * @return none
+ */
+ void ResetAnimationL();
+
+
+ public: // From MXmlElement API
+
+ /**
+ * SetAttributeL: Called by Contenthandler or decoder to set attributes that
+ * are floating type.
+ *
+ * @since Series 60 3.1
+ * @param TDesC& id of the attribute
+ * @param TDesC& aValue value of the attribute
+ * @return TInt error code
+ */
+
+ TInt SetAttributeFloatL( const TInt aNameId, const TFloatFixPt aValue );
+
+
+ /**
+ * SetAttributeFloatL: Called by Contenthandler or decoder to set attributes
+ * that are string type.
+ *
+ * @since Series 60 3.1
+ * @param TDesC& id of the attribute
+ * @param TDesC& aValue value of the attribute
+ * @return TInt error code
+ */
+ TInt SetAttributeL( const TDesC& aName, const TDesC& aValue );
+
+
+ /**
+ * GetAttributeFloat: returns value of the floating attribute
+ * that are string type.
+ *
+ * @since Series 60 3.1
+ * @param TDesC& id of the attribute
+ * @param TDesC& aValue value of the attribute
+ * @return TInt error code
+ */
+ TInt GetAttributeFloat( const TInt aNameId, TFloatFixPt& aValue );
+
+ public: // From MEventReceiver
+
+ /**
+ * ReceiveEventL: This function will be called whenever the registered
+ * event was happened.
+ *
+ * @since Series 60 3.1
+ * @param MSvgEvent* aEvent
+ * @return TBool ETrue if redraw is needed
+ */
+ TBool ReceiveEventL( MSvgEvent* aEvent );
+
+
+ /**
+ * CloneL: Clone the animation element
+ *
+ * @since Series 60 3.1
+ * @param MXmlElement* new parent element
+ * @return MXmlElement*
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ public: // New functions
+
+ /**
+ * Getter function for iPreservRatio
+ *
+ *
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param none
+ * @return TDesC& TargetId the target element's id
+ */
+ const TDesC& PreservRatio();
+
+
+ /**
+ * X: Returns the x coordinate of the defined region
+ *
+ * @since Series 60 3.1
+ * @param none
+ * @return TFixPt
+ */
+ TFloatFixPt X();
+
+
+ /**
+ * Y: Returns the y coordinate of the defined region
+ *
+ * @since Series 60 3.1
+ * @param none
+ * @return TFixPt
+ */
+ TFloatFixPt Y();
+
+
+ /**
+ * Width: Returns the width of the defined region
+ *
+ * @since Series 60 3.1
+ * @param none
+ * @return TFixPt
+ */
+ TFloatFixPt Width();
+
+
+ /**
+ * Height: Returns the height of the defined region
+ *
+ * @since Series 60 3.1
+ * @param none
+ * @return TFixPt
+ */
+ TFloatFixPt Height();
+
+
+ /**
+ * SetReferenceElementL: Clone the referenced element.
+ *
+ * @since Series 60 3.1
+ * @param none
+ * @return none
+ */
+ void SetReferenceElementL();
+
+ /**
+ * SetRefElemById: Sets the referenced id.
+ *
+ * @since Series 60 3.1
+ * @param TDesC& the referenced id
+ * @return TInt error code
+ */
+ TInt SetRefElemById(const TDesC& aName);
+
+ /**
+ * SetRecursionVariable: Set the flag to indicate if the element
+ * has been cloned or not.
+ *
+ * @since Series 60 3.1
+ * @param TBool flag ETrue if the element has been cloned
+ * @return none
+ */
+ void SetRecursionVariable(TBool aIsRecursion);
+
+ /**
+ * RecursionVariable: Returns the flag indicates that if the element
+ * has been cloned.
+ *
+ * @since Series 60 3.1
+ * @param none
+ * @return TBool
+ */
+ TBool RecursionVariable();
+
+
+ /**
+ * ResetEventListener: Reset all event listener for it's children
+ * and add to it's own event handler
+ *
+ * @since Series 60 3.1
+ * @param none
+ * @return void
+ */
+ void ResetEventListener();
+
+
+ /**
+ * RemoveEventListener: Remove all event listener for it's children.
+ *
+ * @since Series 60 3.1
+ * @param none
+ * @return void
+ */
+ void RemoveEventListener();
+
+
+
+ /**
+ * FindAllAnimationElements: Find and store all animation elements
+ * under the element.
+ *
+ * @since Series 60 3.1
+ * @param none
+ * @return void
+ */
+ void FindAllAnimationElements( CSvgElementImpl* aElement,
+ RPointerArray<CSvgElementImpl>* aList );
+
+
+ /**
+ * Check to see if the target element is animation element
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param CSvgElementImpl* Target element
+ * @return ETrue if the target element is animation element.
+ */
+ TBool IsAnimationElement(CSvgElementImpl* aElement);
+
+
+ /**
+ * Return the id of referenced target
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param none
+ * @return TDesC& id
+ */
+ //const TDesC& GetUriRefId();
+
+ /**
+ * Return the flag if the URI of the reference id is set
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param none
+ * @return ETrue if the id of the target element is been set.
+ */
+ TBool IsUriRefSet();
+
+ void Print( TBool aIsEncodeOn );
+
+ protected:
+
+ /**
+ * Copy content to an element
+ *
+ * @since Series 60 3.1
+ * @param CSvgAnimationElementImpl new element
+ * @return none
+ */
+ void CopyL( CSvgAnimationElementImpl* aDestElement );
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CSvgAnimationElementImpl( CSvgDocumentImpl* aDoc );
+
+ /**
+ * Symbian 2nd phase constructor
+ *
+ * Mainly initialize the element and subscribe events to be listen.
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+ private: //New Functions
+
+
+ private:
+
+ // The x-axis coordinate of one corner of the rectangular region into
+ // which the animation is placed.
+ TFloatFixPt iX;
+
+ // The y-axis coordinate of one corner of the rectangular region into
+ // which the animation is placed.
+ TFloatFixPt iY;
+
+ // The width of the rectangular region into which the animation is placed.
+ TFloatFixPt iWidth;
+
+ // The height of the rectangular region into which the animation is placed.
+ TFloatFixPt iHeight;
+
+ // Referenced (target) element
+ CSvgElementImpl* iReferencedElement;
+
+ // Flag if recursion is set
+ TBool iUseInRecursion;
+
+ // A container that holds animation elements' reference of its children
+ RPointerArray<CSvgElementImpl>* iMyAnimationElementList;
+
+ // a separated Event Handler from DocumentImpl
+ CSvgEventHandler *iAnimationEventHandler;
+
+ // flag indicates if the event list's sorting has initial state or not.
+ TBool iInitSortList;
+
+ // flag indicates if engine has started or not.
+ TBool iEngineStart;
+
+ // value of PreserveAspectRatio
+ HBufC* iPreservRatio;
+
+ };
+
+#endif // __INC_CSVGANIMATIONELEMENTIMPL__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGAudioElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,387 @@
+/*
+* Copyright (c) 2005 - 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef C_SVGAUDIOELEMENTIMPL_H
+#define C_SVGAUDIOELEMENTIMPL_H
+
+#include "SVGMediaElementBase.h"
+#include "SVGRequestObserver.h"
+#include <mdaaudiosampleplayer.h>
+
+class CSvgDocumentImpl;
+class MXmlDocument;
+
+/**
+ * Class description:
+ * This class provides the implementation for the audio
+ * element as mentioned in the svg-t 1.2 specification.
+ * @lib SVGEngine.lib
+ * @since S60 3.2
+ */
+NONSHARABLE_CLASS( CSvgAudioElementImpl ) : public CSvgMediaElementBase,
+ public MMdaAudioPlayerCallback
+ {
+ public:
+ /**
+ * Deep Copy of the parent
+ *
+ * @since S60 3.2
+ * @param element to be copied
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ /**
+ * Create new element of audioelementimpl
+ *
+ * @since S60 3.2
+ * @param
+ * @return
+ */
+ static CSvgAudioElementImpl* NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Create new element of audioimpl
+ *
+ * @since S60 3.2
+ * @param
+ * @return
+ */
+ static CSvgAudioElementImpl* NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ private:
+ /**
+ * Create new element of audioelementimpl
+ *
+ * @since S60 3.2
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID,CSvgDocumentImpl* aDoc );
+
+ public:
+ void CSvgAudioElementImpl::SetUriL( const TDesC& aUri );
+
+ /**
+ * Constructor for AudioElement
+ *
+ * @since S60 3.2
+ * @param SvgDocument
+ * @return None
+ */
+ CSvgAudioElementImpl( CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * Destructor for Audioelement
+ *
+ * @since S60 3.2
+ * @param None
+ * @return None
+ */
+ virtual ~CSvgAudioElementImpl();
+
+
+
+
+ /**
+ * Need method description
+ *
+ * @since S60 3.2
+ * @param
+ * @return
+ */
+ void LoadUriL();
+
+ // From MXmlElement API
+
+
+ /**
+ * Sets attributes of audio element
+ *
+ * @since S60 3.2
+ * @param name of attribute and value to be set to attribute
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName, const TDesC& aValue );
+
+ /**
+ * Sets attributes of audio element
+ *
+ * @since S60 3.2
+ * @param name of attribute and value to be set to attribute
+ * @return
+ */
+ TInt SetAttributeDesL( const TInt aNameId, const TDesC& aValue );
+
+
+ /**
+ * Get attributes of audio element
+ *
+ * @since S60 3.2
+ * @param name of attribute and value to be set to attribute
+ * @return
+ */
+ TInt GetAttributeFloat( const TInt aNameId, TFloatFixPt& aValue );
+
+ /**
+ * Sets attributes of audio element
+ *
+ * @since S60 3.2
+ * @param name of attribute and value to be set to attribute
+ * @return
+ */
+ TInt SetAttributeFloatL( const TInt aNameId, TFloatFixPt aValue );
+
+
+ /**
+ * From CSvgMediaElementBase
+ * ReceiveEventL: This function will be called whenever the registered
+ * event was happened.
+ *
+ * @since S60 3.2
+ * @param MSvgEvent* aEvent
+ * @return TBool ETrue if redraw is needed
+ */
+ TBool ReceiveEventL( MSvgEvent* aEvent );
+
+ /**
+ * From CSvgMediaElementBase
+ *
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void ResetAnimationL();
+
+ /**
+ * From CSvgMediaElementBase
+ *
+ * @since S60 3.2
+ * @param MSvgEvent* aEvent
+ * @return none.
+ */
+ void Reset( MSvgEvent* aEvent );
+
+ /**
+ * Call AnimaProcL
+ *
+ * @since S60 3.2
+ * @param MsvgEvent
+ * @return Boolean indicating successfull completion of the event
+ */
+ TBool DoAnimProcL(MSvgEvent* aEvent);
+
+
+ /**
+ * Return wether an svg element is displayable, such as <rect>,
+ * <circle>, or an abstract element, such as <g>, <animate>.
+ *
+ * @since S60 3.2
+ * @param None
+ * @return ETrue if element is viewable.
+ */
+ TBool IsViewable() { return EFalse; }
+
+ /*
+ * Set the volume of the Audio Player to the specified level
+ *
+ * @since S60 3.2
+ * @param TInt Volume
+ * @return none
+ */
+ void SetVolume(TInt aVolume);
+ void Print( TBool aIsEncodeOn );
+
+ protected:
+
+ /**
+ * Need method description
+ *
+ * @since S60 3.2
+ * @param CSvgAudioElementImpl
+ * @return None
+ */
+ void CopyL( CSvgAudioElementImpl* aDestElement );
+
+ private:
+ /*
+ * From MsvgAnimationBase
+ */
+ virtual TBool AnimProcL( MSvgTimerEvent* aEvent );
+ /*
+ * From MsvgAnimationBase
+ */
+ virtual void InitAnimationL();
+
+ /*
+ * From CMdaAudioPlayerUtility
+ * Callback from Audio Player indicating the audio has finished
+ * initialisation
+ * @ since S60 3.2
+ */
+ virtual void MapcInitComplete( TInt aError,
+ const TTimeIntervalMicroSeconds& aDuration );
+ /*
+ * From CMdaAudioPlayerUtility
+ * Callback from Audio Player indicating the audio has finished
+ * playing
+ * @ since S60 3.2
+ */
+ virtual void MapcPlayComplete(TInt aError);
+
+ private:
+ // From base classes
+
+ /**
+ * From CSvgMediaElementBase
+ * When the timed entity acts as timing master in the time container,
+ * the time container gets the timed entity clock using this method
+ * and feeds to rest of timed entities.
+ * @since S60 3.2
+ * @param aEntityCurTime Current Entity Time in msecs.
+ * @return none.
+ */
+ void GetEntityCurrentTime( TUint32& aEntityCurTime );
+
+
+ /**
+ * From CSvgMediaElementBase
+ * Check if timed entity can provide timing ticks to rest of time
+ * container elements. This behavior could change dynamically.
+ * For example, if audio clip is over, the audio element can't generate
+ * ticks for others.
+ * @since S60 3.2
+ * @param none.
+ * @return TBool True if can generate timing tick.
+ */
+ TBool CanGenerateTick();
+
+ /**
+ * From CSvgMediaElementBase
+ * If the timed entity needs to be in sync with the time container and
+ * it has slipped beyond the sync tolerance limit, the method is called to
+ * bring the element in sync with the time container.
+ * @since S60 3.2
+ * @param aSynctime Time for resync in msecs.
+ * @return none.
+ */
+ void ResyncTimedEntity( TUint32 aSynctime );
+
+ /**
+ * From CSvgMediaElementBase
+ * This would be used for pausing the timed entity while other locked
+ * timed entities get loaded.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void PauseTimedEntity();
+
+ /**
+ * From CSvgMediaElementBase
+ * This would be used for resuming the timed entity once all locked
+ * timed entities get loaded.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void ResumeTimedEntity();
+
+ /**
+ * From CSvgMediaElementBase
+ * This would be used for stoping the timed entity once all locked
+ * timed entities get loaded.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void StopTimedEntity();
+
+
+ /*
+ * From MSvgTimedEntityInterface
+ * Would return the type of object
+ * @param none
+ * @return type of object
+ */
+ TSvgObjectType ObjectType();
+
+ CSvgTimeContainer* GetChildTimeContainer();
+
+
+ void DeactivateAnimation();
+
+
+ private:
+
+ //Audio Player Utility
+ CMdaAudioPlayerUtility* iAudioPlayer;
+
+ enum TPlayerState
+ {
+ EPlayerStateIdle,
+ EPlayerStatePlayInit,
+ EPlayerStatePlaying,
+ EPlayerStatePaused,
+ EPlayerStateStop,
+ EPlayerProhibit,
+ EPlayerStateComplete,
+
+ };
+
+ //Current status of player
+ TPlayerState iAudioStatus;
+ //Current Volume of the player
+ TReal32 iVolume;
+ TInt iPercentLevelVolume;
+ // Media duration in usecs
+ TTimeIntervalMicroSeconds iMediaDuration;
+ // Indicates whether time container issued a pause command
+ enum TcCommandStatus
+ {
+ ESvgTEPausedState,
+ ESvgTEStoppedState,
+ ESvgTEPlayingState
+ };
+
+ //Current Command on the player
+ TcCommandStatus iTcCommandState;
+ // Offset in msecs from document start since the audio
+ // element became active
+ TUint32 iAudioStartOffset;
+
+ //Flag indicating if duration is specified as media
+ TBool iDurMedia;
+
+ HBufC* iUri;
+
+ //Indicates the length of the clip that has already played
+ //Introduced to ensure that getentitycurrent time returns correct value
+ //At the end of a clip getPosition returns zero
+ //because of some bug in audio player
+ TTimeIntervalMicroSeconds iStoredPos;
+
+ };
+
+#endif //C_SVGAUDIOELEMENTIMPL_H
+// ---------------------------------------------------------------------------
+// End of file
+// ---------------------------------------------------------------------------
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGCircleElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,266 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGCIRCLEELEMENTIMPL_
+#define _INC_CSVGCIRCLEELEMENTIMPL_
+
+#include "SVGElementImpl.h"
+#include "GfxEllipse2D.h"
+
+
+
+class CSvgDocumentImpl;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgCircleElementImpl : public CSvgElementImpl
+ {
+ public:
+
+ // Constructor/deconstructor
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgCircleElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgCircleElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ private:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+ public:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgCircleElementImpl();
+
+ // From SVG DOM
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Cx();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Cy();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt R();
+
+ // SVG Implementation
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetCx( TFloatFixPt aCx );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetCy( TFloatFixPt aCy );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetR( TFloatFixPt aR );
+
+
+ // From MXmlElement
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetBBox( TGfxRectangle2D& aBbox );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetUnscaledBBox( TGfxRectangle2D& /*aBbox*/ );
+
+ // From MXmlElementOpt API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue );
+
+ /**
+ * Return wether an svg element is displayable, such as <rect>, <circle>, or
+ * an abstract element, such as <g>, <animate>.
+ *
+ * @since 1.0
+ * @param None
+ * @return ETrue if element is viewable.
+ */
+ TBool IsViewable() { return ETrue; }
+
+ private:
+
+ TGfxEllipse2D iCircle;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgCircleElementImpl( CSvgDocumentImpl* aDoc );
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ void Print( TBool aIsEncodeOn );
+
+ protected:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void CopyL( CSvgCircleElementImpl* aDestElement );
+
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGClrCssValueImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_CCLRCSSVALUEIMPL__
+#define __INC_CCLRCSSVALUEIMPL__
+
+
+#include "SVGCssValue.h"
+
+#include "SVGColor.h"
+
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+
+class CClrCssValueImpl : public CCssValue
+
+ {
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ ~CClrCssValueImpl();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CClrCssValueImpl( );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetValueL( const TDesC &aValue );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetValueL( const TInt &aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TSvgColor* Value();
+
+ void SetL(CClrCssValueImpl* aValueToMimic);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+ TInt CloneRGBValueL(const TInt& aValue);
+
+
+
+ TBool IsEqual(CCssValue* aValue);
+
+ void Print();
+
+ private:
+
+
+
+
+
+ TSvgColor* iValue;
+ };
+
+#endif /* __INC_CCLRCSSVALUEIMPL__ */
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGColor.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_TSVGCOLOR_
+#define _INC_TSVGCOLOR_
+
+#include <e32std.h>
+#include <fbs.h>
+
+#include "GfxColor.h"
+
+
+
+const TUint32 KSvgCurrentColor = 0x2ffffff;
+
+class MXmlElement;
+
+//Subclass of TGfxColor
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class TSvgColor : public TGfxColor
+ {
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TSvgColor( TUint32 aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TSvgColor( TInt aRed, TInt aGreen, TInt aBlue );
+
+
+ public:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+ TBool GetStringL( const TDesC& aColorValue, TUint32 &aColor);
+
+
+ private:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TUint32 MapColorToInt( const TDesC& aColorName );
+
+
+ private:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TUint32 ProcessRGBL( const TDesC& aColorValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool ProcessRGBPercentageL( const TDesC& aColorValue,
+ TInt& color );
+
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGDOM/SVGCssValue.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_MCSSVALUE__
+#define __INC_MCSSVALUE__
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+
+class CCssValue:public CBase
+
+ {
+ public:
+
+
+ virtual void Print() = 0;
+
+ //AJD would be nice if this would have been an overloaded == operator
+ virtual TBool IsEqual(CCssValue* aValue) = 0;
+ };
+
+#endif /* __INC_MCSSVALUE__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGDOM/SVGElementTimeControl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_MELEMENTTIMECONTROL_
+#define _INC_MELEMENTTIMECONTROL_
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class MElementTimeControl
+ {
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool BeginElementL() = 0;
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool BeginElementAtL( TFloatFixPt aOffset ) = 0;
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool EndElement() = 0;
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool EndElementAt( TFloatFixPt aOffset ) = 0;
+ };
+
+#endif /* _INC_MElementTimeControl_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGDOM/SVGFitToViewBox.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_MSVGFITTOVIEWBOX__
+#define __INC_MSVGFITTOVIEWBOX__
+
+
+
+
+class MSvgPreserveAspectRatio;
+class TGfxRectangle2D;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class MSvgFitToViewBox
+ {
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetPreserveAspectRatio( MSvgPreserveAspectRatio*& aTransformList ) = 0;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool GetViewBox( TGfxRectangle2D& aViewBox ) = 0;
+ };
+
+#endif /* __INC_MSVGFITTOVIEWBOX__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGDOM/SVGLangSpace.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_MSVGLANGSPACE_
+#define _INC_MSVGLANGSPACE_
+
+#include <e32base.h>
+#include <badesca.h>
+
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class MSvgLangSpace
+ {
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual const TDesC& XMLLang() = 0;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt SetXMLLangL( const TDesC& aXMLLang ) = 0;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual const TDesC& XMLSpace() = 0;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt SetXMLSpaceL( const TDesC& aXMLSpace ) = 0;
+ };
+
+#endif /* _INC_MSVGLANGSPACE_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGDOM/SVGLocatable.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+
+#ifndef __INC_MSVGLOCATABLE__
+#define __INC_MSVGLOCATABLE__
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+
+#include "GfxAffineTransform.h"
+#include "GfxRectangle2D.h"
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class MSvgLocatable
+ {
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual const TGfxAffineTransform& GetCTM() = 0;
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetCTM( TGfxAffineTransform& aTr ) = 0;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetBBox( TGfxRectangle2D& aBbox ) = 0;
+ };
+
+#endif /* __INC_MSVGLOCATABLE__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGDOM/SVGPreserveAspectRatio.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_MSVGPRESERVEASPECTRATIO__
+#define __INC_MSVGPRESERVEASPECTRATIO__
+
+#include "SVGEngineInterfaceImpl.h"
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class MSvgPreserveAspectRatio
+ {
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TSvgPreserveAspectAlignType GetAlign() = 0;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TSvgMeetOrSliceType GetMeetOrSlice() = 0;
+ };
+
+#endif /* __INC_MSVGPRESERVEASPECTRATIO__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGDOM/SVGStyleElement.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_MSVGSTYLEELEMENT__
+#define __INC_MSVGSTYLEELEMENT__
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class MSvgStyleElement : public MSvgElement
+ {
+ public:
+ };
+
+#endif /* __INC_MSVGSTYLEELEMENT__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGDOM/SVGTests.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_MSVGTESTS__
+#define __INC_MSVGTESTS__
+
+#include <e32base.h>
+#include <badesca.h>
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class MSvgTests
+ {
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetRequiredFeatures( const CDesCArrayFlat*& aRequiredFeatures ) = 0;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetRequiredExtensions( const CDesCArrayFlat*& aRequiredExtensions ) = 0;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool GetSystemLanguage( const CDesCArrayFlat*& aSystemLanguage ) = 0;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool HasExtension( const TDesC& aExtension ) = 0;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool HasFeature( const TDesC& aFeature ) = 0;
+
+ virtual TBool HasAnyTests() = 0;
+ };
+
+#endif /* __INC_MSVGTESTS__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGDOM/SVGTransformList.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_MSVGTRANSFORMLIST__
+#define __INC_MSVGTRANSFORMLIST__
+
+class TGfxAffineTransform;
+
+// This interface was implemented instead of using RPointerArray directly,
+// because it also includes Consolidate and CreateTransformFromMatrix
+// methods, which is not in RPointerArray.
+// Note: not all methods of interface implemented.
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class MSvgTransformList
+ {
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool AppendItemL( TGfxAffineTransform& aNewItem ) = 0;
+
+ // Not in SVG DOM, temporary only. Should be fixed when SVGImpl uses CTransformList
+ // instead of MTransformList internally.
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool AppendItemL( TGfxAffineTransform& aTransform,
+ TInt32 aAdditive,
+ TInt32 animMotion ) = 0;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetAdditive( TInt32 additive, TInt32 index ) = 0;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void Clear() = 0;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TGfxAffineTransform Consolidate(TBool aOverwriteTrans) = 0;
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TGfxAffineTransform GetItem( TInt index ) = 0;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt NumberOfItems() = 0;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TGfxAffineTransform InitializeL( TGfxAffineTransform& newItem ) = 0;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TGfxAffineTransform ReplaceItem( TGfxAffineTransform newItem,
+ int index ) = 0;
+ };
+
+#endif /* __INC_MSVGTRANSFORMLIST__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGDOM/SVGTransformable.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_MSVGTRANSFORMABLE__
+#define __INC_MSVGTRANSFORMABLE__
+
+#include "SVGLocatable.h"
+#include "SVGTransformList.h"
+
+class TGfxAffineTransform;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class MSvgTransformable : public MSvgLocatable
+ {
+ public:
+
+ /**
+ * Gets transformation list. The first entry should be the original
+ * transformation, and the other entries should be the matrices
+ * appended for animations on the element (if any).
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetTransform( MSvgTransformList*& aTransformList ) = 0;
+
+ // Temporarily, non-DOM method. This could go to the implementation.
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetTransform( MSvgTransformList*& aTransformList ) = 0;
+ };
+
+#endif /* __INC_MSVGTRANSFORMABLE__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGDOM/SVGUriReference.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_MSVGURIREFERENCE__
+#define __INC_MSVGURIREFERENCE__
+
+#include <e32base.h>
+#include <badesca.h>
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class MSvgUriReference
+ {
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual const TDesC& Href() = 0 ;
+ };
+
+#endif /* __INC_MSVGURIReference__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGDOM/SVGZoomAndPan.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_MSVGZOOMANDPAN__
+#define __INC_MSVGZOOMANDPAN__
+
+
+enum TSvgZoomAndPanType
+ {
+ ESvgZoomAndPanDisable,
+ ESvgZoomAndPanMagnify,
+ ESvgZoomAndPanUnknown
+ };
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class MSvgZoomAndPan
+ {
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TSvgZoomAndPanType GetZoomAndPan() = 0;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetZoomAndPan( TSvgZoomAndPanType aZoomAndPan ) = 0;
+ };
+
+#endif /* __INC_MSVGZOOMANDPAN__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGDOMImplementationImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGDOMIMPLEMENTATIONIMPL_
+#define _INC_CSVGDOMIMPLEMENTATIONIMPL_
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include "SVGXmlDOMImplementation.h"
+#include "SvgBitmapFontProvider.h"
+
+class MXmlDocumentType;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgDOMImplementationImpl : public CBase, public MXmlDOMImplementation
+ {
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlDocument* CreateDocumentL( const TDesC& aNamespaceUri,
+ const TDesC& aQualifiedName/*, MXmlDocumentType* aDocType*/ );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgDOMImplementationImpl* NewL(CSvgBitmapFontProvider *aSvgBitmapFontProvider);
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgDOMImplementationImpl* NewLC(CSvgBitmapFontProvider *aSvgBitmapFontProvider);
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgDOMImplementationImpl();
+
+ private:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgDOMImplementationImpl(CSvgBitmapFontProvider *aSvgBitmapFontProvider);
+ private:
+
+ //Stores Font Type information as passed by CSvgEngineInterfaceImpl
+ CSvgBitmapFontProvider *iSvgBitmapFontProvider;
+ };
+
+#endif /* _INC_CSVGDOMIMPLEMENTATIONIMPL_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGDefsElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGDEFSELEMENTIMPL_
+#define _INC_CSVGDEFSELEMENTIMPL_
+
+#include "SVGElementImpl.h"
+#include "GfxFloatFixPt.h"
+
+class CSvgDocumentImpl;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgDefsElementImpl : public CSvgElementImpl
+ {
+ public:
+
+ // Constructor/deconstructor
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgDefsElementImpl* NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgDefsElementImpl* NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgDefsElementImpl();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+ // From CSvgElementImpl
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+
+ // From MXmlElementOpt API
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeInt( const TInt aNameId,
+ TInt32& aValue );
+
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue);
+ void Print( TBool aIsEncodeOn );
+
+ private:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgDefsElementImpl( CSvgDocumentImpl* aDoc );
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGDescElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGDESCELEMENTIMPL_
+#define _INC_CSVGDESCELEMENTIMPL_
+
+#include "SVGElementImpl.h"
+#include "GfxFloatFixPt.h"
+
+class CSvgDocumentImpl;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgDescElementImpl : public CSvgElementImpl
+ {
+ public:
+
+ // Constructor/deconstructor
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgDescElementImpl* NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgDescElementImpl* NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgDescElementImpl();
+
+ // From MXmlElement API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+ TInt SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue );
+
+ TInt GetAttributeDes( const TInt aNameId, TPtrC16& aValue );
+
+ // From CSvgElementImpl
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ void CopyL( CSvgDescElementImpl* aDestElement );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+
+ void SetTextL( const TDesC& aText );
+
+ void Print( TBool aIsEncodeOn );
+
+ private:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgDescElementImpl( CSvgDocumentImpl* aDoc );
+
+
+
+ HBufC* iText;
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGDiscardElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,401 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_CSVGDISCARDELEMENTIMPL__
+#define __INC_CSVGDISCARDELEMENTIMPL__
+
+// INCLUDES
+#include "SVGElementImpl.h"
+
+// FORWARD DECLARATIONS
+class CSvgDocumentImpl;
+class CSvgEngineImpl;
+
+
+/**
+ * The Discard element allows content authors to specifiy the time at which particular
+ * elements are to be discarded, therefore reducing the CPU and memory resources.
+ *
+ * The class does not export any function to other non SVG compoents.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.2
+ */
+class CSvgDiscardElementImpl : public CSvgElementImpl
+ {
+ public: // Constructor/deconstructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CSvgDiscardElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Two-phased constructor.
+ */
+ static CSvgDiscardElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSvgDiscardElementImpl();
+
+ public: // From CSvgElementImpl
+
+
+ /**
+ * ReceiveEventL: This function will be called whenever the registered
+ * event was happened.
+ *
+ * The call flow is like:
+ *
+ * _______
+ * | UI |------------------
+ * ------- |
+ * v
+ * ________ ________ ______________
+ * | Timer|-------------> |Engine|-------------->|EventHandler|--------
+ * -------- ProcessEvenL -------- ProcessEventL -------------- ReceiveEventL
+ *
+ *
+ * _____________ ________________
+ * --->|ElementImpl| --------------> |DiscardElement|
+ * ------------- ReceiveEventL ----------------
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param aEvent
+ * @return ETrue if redraw is needed.
+ *
+ */
+ TBool ReceiveEventL( MSvgEvent* aEvent );
+
+ /**
+ * Clone the discard element
+ *
+ * @since 1.0
+ * @param MXmlElement* new parent element
+ * @return MXmlElement*
+ */
+ MXmlElement* CloneL( MXmlElement* aParentElement);
+
+
+ /**
+ * SetAttributeL: Attribute can only be xlink:href or begin
+ * If it is xlink::href, it refers to the element that is to be discard.
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param aName Name of the attribute
+ * aValue conent of the attribute
+ * @return KErrNone if no error.
+ */
+ TInt SetAttributeL( const TDesC& aName, const TDesC& aValue );
+
+ public:
+ // Setter
+ /**
+ * Setter function for iTargetId
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param TDesC& Descriptor of the target element.
+ * @return void
+ */
+ void SetTargetId(const TDesC& aTargetId);
+
+ /**
+ * Setter function for iSyncValueDefined
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param TBool flag if Sync type of begine time is defined.
+ * @return void
+ */
+ void SetSyncValueDefined(TBool aSyncValueDefined);
+
+ /**
+ * Setter function for iEventValueDefined
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param TBool flag if event type of begin time is defined.
+ * @return void
+ */
+ void SetEventValueDefined(TBool aEventValueDefined);
+
+ /**
+ * Setter function for iHrefValueDefined
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param TBool flag if xlink:href is defined.
+ * @return void
+ */
+ void SetHrefValueDefined(TBool aHrefValueDefined);
+
+ /**
+ * Setter function for iBeginSyncElementId
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param TDesC& Descriptor of the referenced target element
+ * @return void
+ */
+ void SetBeginSyncElementId(const TDesC& aBeginSyncElementId);
+
+ /**
+ * Setter function for iAbsoluteBeginTime
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param TInt the value of Absolute begin time
+ * @return void
+ */
+ void SetAbsoluteBeginTime(TInt aAbsoluteBeginTime);
+
+ /**
+ * Setter function for iRefBeginTime
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param TInt the value of reference begin time
+ * @return void
+ */
+ void SetRefBeginTime(TInt aRefBeginTime);
+
+ /**
+ * Setter function for iKeyValue
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param TInt the value of key code from user
+ * @return void
+ */
+ void SetKeyValue(TInt aKeyValue);
+
+ /**
+ * Setter function for iBeginReferenceEvent
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param TSvgEvent the SVG event generated either by Timer
+ * or UI.
+ * @return void
+ */
+ void SetBeginReferenceEvent(TSvgEvent aBeginReferenceEvent);
+
+ // Getter
+
+ /**
+ * Getter function for iTargetId
+ *
+ * Target element to be removed. The id may be identified at
+ * parsing stage after SetAttributeL. But if the xlink:href
+ * does not specified, the value of TargetId could be NULL and
+ * Target element will be parent. Or, if the specified target id
+ * is not valid, then the discard element will remove itself.
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param none
+ * @return TDesC& TargetId the target element's id
+ */
+ const TDesC& TargetId();
+
+ /**
+ * Getter function for iBeginSyncElementId
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param none
+ * @return TDesC& iBeginSyncElementId the reference element's id
+ */
+ const TDesC& BeginSyncElementId();
+
+ /**
+ * Getter function for iAbsoluteBeginTime
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param none
+ * @return TInt iAbsoluteBeginTime
+ */
+ TInt AbsoluteBeginTime();
+
+ /**
+ * Getter function for iSyncValueDefined
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param none
+ * @return TBool iSyncValueDefined
+ */
+ TBool IsSyncValueDefined();
+
+ /**
+ * Getter function for iEventValueDefined
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param none
+ * @return TBool iEventValueDefined
+ */
+ TBool IsEventValueDefined();
+
+ /**
+ * Getter function for iHrefValueDefined
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param none
+ * @return TBool iHrefValueDefined
+ */
+ TBool IsHrefValueDefined();
+
+ /**
+ * Getter function for iRefBeginTime
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param none
+ * @return TInt iRefBeginTime
+ */
+ TInt RefBeginTime();
+
+ /**
+ * Getter function for iKeyValue
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param none
+ * @return TInt iKeyValue
+ */
+ TInt KeyValue();
+
+ /**
+ * Getter function for iBeginReferenceEvent
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param none
+ * @return TSvgEvent iBeginReferenceEvent
+ */
+ TSvgEvent BeginReferenceEvent();
+
+ void Print( TBool aIsEncodeOn );
+
+ protected: // From CSvgElementImpl
+
+ /**
+ * Copy content to an element
+ *
+ * @since 1.0
+ * @param CSvgDiscardElementImpl new element
+ * @return none
+ */
+ void CopyL( CSvgDiscardElementImpl* aDestElement );
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CSvgDiscardElementImpl( CSvgDocumentImpl* aDoc );
+
+ /**
+ * Symbian 2nd phase constructor
+ *
+ * Mainly initialize the element and subscribe events to be listen.
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+ private: //New Functions
+
+ /**
+ * Find the target element to be remmoved.
+ *
+ * If no target was found, the discard element is ignored and
+ * will be removed later to save memory.
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param none
+ * @return ETrue if target is found.
+ */
+ TBool FindTargetElementL();
+
+ /**
+ * Check to see if the target element is animation element
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param CSvgElementImpl* Target element
+ * @return ETrue if the target element is animation element.
+ */
+ //TBool IsAnimationElement(CSvgElementImpl* aElement);
+
+ /**
+ * Check to see if the target element contains any animation element
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param CSvgElementImpl* Target element
+ * @return ETrue if the target element contains at least one
+ * animation element.
+ */
+ //TBool HasAnimationElements(CSvgElementImpl* aElement);
+
+ /**
+ * Remove target element
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param none
+ * @return void
+ */
+ void RemoveTargetElement();
+
+
+
+ private:
+
+ // Target element to be removed.
+ CSvgElementImpl* iTargetElement;
+
+ // Time to be removed
+ TInt32 iAbsoluteBeginTime;
+
+ // Flag if the element needs to be removed.
+ TBool iRemoveMyself;
+
+ // Used in xlink:xhref to identify element to be removed.
+ HBufC* iTargetId;
+
+ // Flag to identify xlink:xhref is used
+ TBool iHrefValueDefined;
+
+ // Used in Syncbased begin time to identify element to be removed.
+ TBuf<30> iBeginSyncElementId;
+
+ // Used in Syncbased begin time to identify the event
+ TSvgEvent iBeginReferenceEvent;
+
+ // Flag to identity Sync-base begin time is used
+ TBool iSyncValueDefined;
+
+ // Flag to identity event-based begin time is used
+ TBool iEventValueDefined;
+
+ // Time to be used in Sync-based and event-based begin time
+ TInt32 iRefBeginTime;
+
+ // The element that is been referenced in sync-based and event-based
+ CSvgElementImpl* iRefTargetElement;
+
+ // Flag to identify referenced begin time is used
+ TBool iRefBeginTimeSet;
+
+ // Accesskey's scancode
+ TInt iKeyValue;
+ };
+
+#endif // __INC_CSVGDISCARDELEMENTIMPL__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGDocumentImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,1113 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef SVGDOCUMENTIMPL_H
+#define SVGDOCUMENTIMPL_H
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include <gdi.h>
+class CSvgEngineImpl;
+class CSvgEventHandler;
+class CSvgErrorImpl;
+class CSvgElementImpl;
+class MSvgEventReceiver;
+#include "SVGXmlDocument.h"
+#include "SVGEvent.h"
+
+#include "SVGEngineInterfaceImpl.h"
+#include "SVGImageLoadingObserver.h" // MSVGImageLoadingObserver
+#include "SVGErrorImpl.h"
+#include "Gfx2dGcOpenVG.h"
+
+//#include "SVGImageHashMap.h"
+#include "SVGFontHashMap.h"
+#include "SVGMemoryManager.h"
+#include "SVGTimedEntityInterface.h"
+
+#include "SvgBitmapFontProvider.h"
+class MXmlElement;
+class CSvgSchemaData;
+class CSvgContentHandler;
+
+class CSvgAnimationBase;
+class CSvgTimeContainer;
+
+/**
+ * Enumeration to define search query constraints for FindAllElements
+ */
+enum TSvgSearchFlags
+ {
+ ESvgSearchAllElements = 0,
+ ESvgSearchExcludeUseSubtree = 0x2,
+ };
+/**
+ * An SVG document that represents a SVG element tree..
+ */
+class CSvgDocumentImpl : public CBase,
+ public MXmlDocument,
+ public MSVGImageLoadingObserver,
+ public MSvgTimedEntityInterface
+ {
+ public:
+ /**
+ * Two Phase constructor for SVG document
+ * @since 1.0
+ * @param aHasParent - Indicates whether document has a
+ * parent document or not
+ * aSyncBehavDefault - Indicates default synchronised behaviour
+ * for runtime synchronisation.
+ * aSyncTolDefault - Indicates the synchronised tolerance in
+ * msecs for runtime synchronisation.
+ * @return CSvgDocumentImpl*
+ */
+ void Reset(MSvgEvent* aEvent);
+
+ static CSvgDocumentImpl* NewL(CSvgBitmapFontProvider* aSvgBitmapFontProvider,
+ const TBool aHasParent = EFalse,
+ const TSvgSyncBehaviour aSyncBehavDefault = KSvgDefaultSyncBehaviour,
+ const TInt32 aSyncTolDefault = KSvgDefaultSyncTolerance );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param aHasParent - Indicates whether document has a
+ * parent document or not
+ * aSyncBehavDefault - Indicates default synchronised behaviour
+ * for runtime synchronisation.
+ * aSyncTolDefault - Indicates the synchronised tolerance in
+ * msecs for runtime synchronisation.
+ * @return
+ */
+ static CSvgDocumentImpl* NewLC(CSvgBitmapFontProvider* aSvgBitmapFontProvider,
+ const TBool aHasParent = EFalse,
+ const TSvgSyncBehaviour aSyncBehavDefault = KSvgDefaultSyncBehaviour,
+ const TInt32 aSyncTolDefault = KSvgDefaultSyncTolerance );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgDocumentImpl();
+
+ public:
+ /**
+ * ImageLoadingObserver interface method.
+ * Called from Image loading class to notify image loading
+ * completion.
+ *
+ * @since 1.0
+ * @param : aErrorStatus -- error status, if any
+ * @return : none
+ */
+ virtual void ImageLoadingCompleted( TInt aErrorStatus );
+
+ // Pointer/Hyperlink related
+ void FindAllElements( CSvgElementImpl* aStartElement, TInt aElementId,
+ RPointerArray<CSvgElementImpl>& aList,
+ TSvgSearchFlags aFlags = ESvgSearchAllElements );
+
+ TBool SvgElementPresent(CSvgElementImpl* aElement);
+ TBool SearchByPointer(CSvgElementImpl* aParent, CSvgElementImpl* aElement);
+ CXmlElementImpl* GetFocusElement();
+ void SetFocusElement(CXmlElementImpl* aElement );
+ // From MXmlDocument
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CreateElementL( const TDesC& aTagName );
+
+ MXmlElement* CreateElementL( const TUint8 aTagName );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt CreateAttribute( const TDesC& aName );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* GetElementById( const TDesC& aElementId );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetNumberOfIds(MXmlElement* aElement);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TDesC* GetId( TInt index );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void FindAllIds( CSvgElementImpl* aStartElement, RPointerArray<TDesC>& aList );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* AppendChildL( MXmlElement* aAppendChild );
+
+ // From MSvgDocument
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+ /**
+ * Get URL
+ */
+ TDesC& GetUrl(); // method of CSvgDocumentImpl
+
+ /**
+ * get root element
+ */
+ IMPORT_C MXmlElement* RootElement(); // method of CSvgDocumentImpl
+
+ // Class functions
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgSchemaData* SchemaData();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetUri( const TDesC& aUri );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetUri( TDes& aUri );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetEngine( CSvgEngineImpl* aEngine );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgEngineImpl* Engine();
+
+ /**
+ * Add an object to the list of objects that are notified of an event
+ *
+ * @since 1.0
+ * @param aElement - An SVG element that wants to be registered for an event (implements MSvgEventReceiver interface)
+ * @param aEventMask - A bit mask that indicates the types of events an object listens for
+ * @return None
+ */
+ void AddToEventReceiverListL( MSvgEventReceiver* aElement,
+ TUint8 aEventMask );
+
+ /**
+ * Add an object to the list of objects that are notified of an event
+ * Has an additional parameter aEvent which is used to check for interactive events
+ *
+ * @since v3.2
+ * @param aElement - An SVG element that wants to be registered for an event (implements MSvgEventReceiver interface)
+ * @param aEvent - An SVG Event that the target element needs to generate
+ * @param aEventMask - A bit mask that indicates the types of events an object listens for
+ * @return None
+ */
+ void AddToEventReceiverListL( MSvgEventReceiver* aElement,
+ TSvgEvent aEvent,
+ TUint8 aEventMask );
+
+ /**
+ * Removed an object to the list of objects that are notified of an event
+ *
+ * @since 1.0
+ * @param aElement - An SVG element that wants to be registered for an event (implements MSvgEventReceiver interface)
+ * @return None
+ */
+ void RemoveFromEventReceiverList( MSvgEventReceiver* aElement );
+
+ /**
+ * Provide the event end time information to the Event Handler
+ *
+ * @since 1.0
+ * @param aElement - An element that, ultimately, processes the event (eg. an animation element)
+ * @param aTime - The end time for an event on the target element
+ * @param aTargetElement - The element for which the event is processed
+ * @return
+ */
+ void AddEventBeginTime(MSvgEventReceiver* aElement, TUint32 aTime, MSvgEventReceiver* aTargetElement );
+
+
+
+ /**
+ * An internal method that sorts the events in a time scale
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ void SortEventList();
+
+ /**
+ * returns the next (or prev) focussable object starting with a given index
+ *
+ * @since 1.0
+ * @param aIndex - search for a focussable object with this index
+ * @param aNext - Etrue (next) EFalse (prev) (go forward or backward for search)
+ * @param aEventMask - Event mask for event types the client is interested in
+ * @param aNewIndex - Return the actual index where the object was found
+ * @return The focussable object or NULL if not found
+ */
+ CSvgElementImpl* GetEventReceiverElement(TInt32 aIndex, TBool aNext, TUint8 aEventMask, TInt32& aNewIndex);
+
+ /**
+ * Checks whether the current loaded file is animatable or static
+ *
+ *
+ *
+ * @param : None
+ * @return: TBool boolean
+ */
+
+ TBool IsAnimationFile();
+
+ /**
+ * Checks whether the aSubEventMask is has a valid value set
+ * @since v3.2
+ * @param : aSubEventMask - The bitmap mask which contains the list
+ * of interactive events if any with the element.
+ * @return: Etrue - if aSubEventMask has some valid bits set else EFalsee
+ */
+ TBool IsValidSubEventMask(TUint16 aSubEventMask);
+
+ /**
+ * Sets DRM Check Enable/Disable
+ *
+ *
+ * @param : TBool : aEnable Boolean
+ * @return: None
+ */
+ void SetDRMMode(TBool aEnable);
+
+ void ReInitialize();
+
+ /**
+ * Load a svg content from the given filename
+ *
+ * @param : aFileName : filename of content (binary or text content)
+ * @param : aError : error object to store error-info
+ * @return: None
+ */
+ void Load( const TDesC& aFileName, CSvgErrorImpl& aError );
+
+ /**
+ * Load a svg content from the given byte-array
+ *
+ * @param : aByteData : byte-array content (binary or text content)
+ * @param : aError : error object to store error-info
+ * @return: None
+ */
+ void Load( const TDesC8& aByteData, CSvgErrorImpl& aError, TBool aRemoveFalseSwitchElements = ETrue );
+
+ /**
+ * Load a svg content from JSR226 that is already TDesc16
+ *
+ * @param : aSvgString
+ * @param : aError : error object to store error-info
+ * @return: None
+ */
+ void Load16BitString( const TDesC16& aSvgString, CSvgErrorImpl& aError, TBool aRemoveFalseSwitchElements = ETrue );
+
+ /**
+ * Load a svg content from the given file-handle
+ *
+ * @param : aFileHandle : file-handle content (binary or text content)
+ * @param : aError : error object to store error-info
+ * @return: None
+ */
+ void Load( RFile& aFileHandle, CSvgErrorImpl& aError );
+
+ /**
+ * Set the document to be in thumbnailmode, which will not consume the DRM right
+ * if the Svg content is DRM encrypted.
+ *
+ * @param : aThumbNailMode : thumbnail mode flag.
+ * @return:
+ */
+ void SetThumbNailMode( TBool aThumbNailMode );
+
+
+ /**
+ * Set the document to disable/enable consuming drm rights
+ * @param aEnable: ETrue for disabling consumption of drm rights
+ * @return : none
+ */
+ void SetDRMRights(TBool aEnable);
+ /**
+ * Return whether the loaded document is a thumbnail only. ETrue is returned only
+ * when the loaded content is DRM protected AND SetThumbNailMode is called with ETrue.
+ *
+ * @return:
+ */
+ TBool IsThumbNailOnly();
+
+ /**
+ * Set the flag to indicate this document was prepared (PrepareDom) or loaded (Load).
+ *
+ * @return: None
+ */
+ void SetWasPrepared( TBool aBool );
+
+ /**
+ * Return whether this document was prepared (PrepareDom) or loaded (Load).
+ *
+ * @return: Prepared or Loaded.
+ */
+ TBool WasPrepared();
+
+ /**
+ * Set the list of MSvgLoadingListener for this document to send
+ * back notification of parsing progress. NULL is also valid.
+ * @param : aList : Pointer to list
+ * @return : none
+ */
+ void SetLoadingListeners( const RPointerArray<MSvgLoadingListener>* aList );
+
+ /**
+ * Set the list of MSvgLoadingListener for this document to send
+ * back notification of parsing progress. NULL is also valid.
+ * @param : aList : Pointer to list
+ * @return : none
+ */
+ const RPointerArray<MSvgLoadingListener>* GetLoadingListeners();
+
+ /**
+ * Add a MSvgMouseListener to this SvgEngine
+ *
+ * @param : aListener -- listener to add to listener list
+ * @return: None
+ */
+ void AddInternalMouseListener( const MSvgMouseListener* aListener );
+
+ /**
+ * Remove a MSvgMouseListener to this SvgEngine
+ *
+ * @param : aListener -- listener to remove from listener list
+ * @return: None
+ */
+ void RemoveInternalMouseListener( const MSvgMouseListener* aListener );
+
+ /**
+ * Return number of mouselisteners.
+ *
+ * @return: mouse-listener count
+ */
+ TInt MouseInternalListenerCount();
+
+ /**
+ * Send to mouse listeners of a mouse-pressed event.
+ *
+ * @param : aElements -- elements affected by mouse-event.
+ * @param : aX -- X-cooordinate of mouse-event.
+ * @param : aY -- X-cooordinate of mouse-event.
+ * @return: None
+ */
+ void NotifyInternalMousePressed( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Send to mouse listeners of a mouse-released event.
+ *
+ * @param : aElements -- elements affected by mouse-event.
+ * @param : aX -- X-cooordinate of mouse-event.
+ * @param : aY -- X-cooordinate of mouse-event.
+ * @return: None
+ */
+ void NotifyInternalMouseReleased( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Send to mouse listeners of a mouse-entered event.
+ *
+ * @param : aElements -- elements affected by mouse-event.
+ * @param : aX -- X-cooordinate of mouse-event.
+ * @param : aY -- X-cooordinate of mouse-event.
+ * @return: None
+ */
+ void NotifyInternalMouseEntered( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+ /**
+ * Send to mouse listeners of a mouse-exited event.
+ *
+ * @param : aElements -- elements affected by mouse-event.
+ * @param : aX -- X-cooordinate of mouse-event.
+ * @param : aY -- X-cooordinate of mouse-event.
+ * @return: None
+ */
+ void NotifyInternalMouseExited( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+
+ /**
+ * Send to mouse listeners of a mouse-moved event.
+ *
+ * @param : aElements -- elements affected by mouse-event.
+ * @param : aX -- X-cooordinate of mouse-event.
+ * @param : aY -- X-cooordinate of mouse-event.
+ * @return: None
+ */
+ void NotifyInternalMouseMoved( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ // LoadingListeners notification
+ /**
+ * Send to loading listeners of a document start event.
+ *
+ * @return: None
+ */
+ void NotifyDocumentStart();
+
+ /**
+ * Send to loading listeners of a document end event.
+ *
+ * @return: None
+ */
+ void NotifyDocumentEnd();
+
+ /**
+ * Send to loading listeners of an element start event.
+ *
+ * @param : aTagName -- name of element tag.
+ * @param : aIsSvgChild -- flag to indicate element is <svg> or child
+ * of <svg> tag.
+ * @return: None
+ */
+ void NotifyElementStart( const TDesC& aTagName,
+ MSvgAttributeList& aAttributeList,
+ TBool aIsSvgChild );
+
+ /**
+ * Send to loading listeners of an element end event.
+ *
+ * @param : aTagName -- name of element tag.
+ * @param : aIsSvgChild -- flag to indicate element is <svg> or child
+ * of <svg> tag.
+ * @return: None
+ */
+ void NotifyElementEnd( const TDesC& aTagName, TBool aIsSvgChild );
+
+ /**
+ * Send to loading listeners of an unsupported element event.
+ *
+ * @param : aTagName -- name of element tag.
+ * @return: None
+ */
+ void NotifyUnsupportedElement( const TDesC& aTagName,
+ MSvgAttributeList& aAttributeList );
+
+ /**
+ * Send to loading listeners of an external data request.
+ *
+ * @param : aUri -- URI of data request.
+ * @return: None
+ */
+ void NotifyExternalDataRequested( const TDesC& aUri );
+
+ /**
+ * Send to loading listeners of a succesfful external data reception.
+ *
+ * @param : aUri -- URI of data request.
+ * @return: None
+ */
+ void NotifyExternalDataReceived( const TDesC& aUri );
+
+ /**
+ * Send to loading listeners of a failed external data request.
+ *
+ * @param : aUri -- URI of data request.
+ * @return: None
+ */
+ void NotifyExternalDataRequestFailed( const TDesC& aUri );
+
+
+ /**
+ * return the animation duration in milliseconds.
+ * @return : duration of animation
+ */
+ TUint32 AnimationDuration();
+
+ /**
+ * return wether animation is indefinite.
+ */
+ TUint32 IsIndefiniteAnimation();
+
+ /**
+ * Called by AppendChild/RemoveChild to notify owner document
+ * of changes.
+ */
+ void ElementAppendedOrRemoved();
+
+ /**
+ * Cancel loading of document if it is currently parsing.
+ */
+ void CancelParsing();
+
+ /**
+ * Return whether document is currently parsing.
+ */
+ TBool IsParsing();
+
+ /**
+ * return whether this document has an error set.
+ */
+ TBool HasError();
+
+ /**
+ * return the error reference. May be NULL. Call HasError first.
+ */
+ MSvgError* GetError();
+
+ /**
+ * Set the error type and error message for this document.
+ * Will note override existing error.
+ */
+ void SetError( TInt aErrorType, const TDesC& aMsg1, const TDesC& aMsg2 );
+
+ void SetIsWarning( TBool aIsWarning = ETrue );
+ //-------------------------------------------------------------------
+ // Utility Functions
+ //-------------------------------------------------------------------
+ /**
+ * Fill the given error object with the appropriate error codes, messages.
+ *
+ * @param : aError : Error object to fill code/message.
+ * @param : aSvgErrorCode : Svg related error code.
+ * @param : aSystemError : Symbian error code.
+ * @param : aMsg1 : Message string
+ * @param : aMsg2 : Second message string, if needed, appended to first string.
+ * @return: None
+ */
+ static void PrepareError( CSvgErrorImpl& aError,
+ TSvgErrorCode aSvgErrorCode, TInt aSystemError,
+ const TDesC& aMsg1, const TDesC& aMsg2 );
+
+ static void OpenSession( RFs& aSession, CSvgErrorImpl& aError );
+
+ // ------------------------------------------------------------------
+ // Opacity
+ // ------------------------------------------------------------------
+ TBool isGroupOpacity( CSvgElementImpl* aElement );
+
+ void PrintAllElements( CSvgElementImpl* aStartElement);
+
+ void QueueFontReleaseReq(CFont* aFont);
+
+
+ /**
+ * Accessor funciton for SyncBehaviorDefault value
+ * @since S60 3.2
+ * @param none
+ * @return TSvgSyncBehavior indicating default value.
+ */
+ TSvgSyncBehaviour SyncBehaviorDefault();
+
+ /**
+ * Accessor funciton for SyncToleranceDefault value
+ * @since S60 3.2
+ * @param none
+ * @return TUint32 indicating default value in msecs.
+ */
+ TUint32 SyncToleranceDefault();
+
+ /**
+ * Set Function for the document's current time
+ * @since S60 3.2
+ * @param aCurTime Current Time to be set in msecs
+ * @return none.
+ */
+ void SetCurrentTime( const TInt32 aCurTime );
+
+ /**
+ * Accessor Function for the document's current time
+ * @since S60 3.2
+ * @param none.
+ * @return TInt32 Current Time to be set in msecs.
+ */
+ TInt32 CurrentTime();
+
+ void DocumentTransform(TGfxAffineTransform& aTr);
+ TGfxAffineTransform GetDocumentTransform();
+
+ /**
+ * Set the Synchronised behaviour for the time container
+ * @since S60 3.2
+ * @param aValue canSlip | locked | independent
+ * @return none.
+ */
+ void SetTCSyncBehavior( const TSvgSyncBehaviour aValue );
+
+ /**
+ * Set the Synchronised Tolerance for the time container
+ * @since S60 3.2
+ * @param aValue Clock-value
+ * @return none.
+ */
+ void SetTCSyncTolerance( const TUint32 aValue );
+
+ /**
+ * Set the time container as Synchronised Master
+ * @since S60 3.2
+ * @param aValue true | false
+ * @return none.
+ */
+ void SetTCSyncMaster( const TBool aValue );
+
+ /**
+ * Accessor for the time container.
+ * @since Series 3.2
+ * @param none.
+ * @return CSvgTimeContainer*
+ */
+ CSvgTimeContainer* TimeContainer();
+
+
+ //Get function(s)
+ CSvgBitmapFontProvider* GetBitmapFontProvider() ;
+
+ void SetImageElementsCount(TInt aCnt);
+
+ TInt GetImageElementsCount();
+
+ /* Return the value of the current focus index.
+ @return: current focus index
+ */
+ TInt32 GetCurFocusIndex();
+
+ /* Set the value fo the current focus index
+ @param: aVal : Value that has to be set as the focus index.
+ @return: none.
+ */
+ void SetCurFocusIndex(TInt32 aVal);
+
+ /* Decrement the value of the current focus index
+ @return: decremented focus index value.
+ */
+ TInt32 DecCurFocusIndex();
+
+ /* Increment the value of the current focus index
+ @return: Incremented focus index value.
+ */
+ TInt32 IncCurFocusIndex();
+
+ /* Return the pointer to the current focus element
+ @return: current focus element
+ */
+ CSvgElementImpl* GetCurFocusObject();
+
+ /* Set the value of the current focus element to aElement.
+ @param: aElement : Element that has to be set as the focus element
+ @return: none.
+ */
+ void SetCurFocusObject(CSvgElementImpl* aElement);
+
+ /*
+ From MSvgTimedEntityInterface
+ Would return the type of object
+ @param none
+ @return type of object
+ */
+ TSvgObjectType ObjectType();
+
+
+
+ /**
+ * Prepare a list of media elements in DOM tree in
+ * postorder
+ * @since Series 3.2
+ * @param aRoot Root Node of tree
+ * @param aPostOrderList List of nodes which
+ * will contain the elements.
+ * @return None.
+ */
+ void ParsePostOrderMediaElements( CSvgElementImpl* aRoot,
+ RPointerArray<CSvgElementImpl>& aPostOrderList);
+
+ /**
+ * Finds if Animation element is there.
+ *
+ * @since Series 3.2
+ * @param none
+ * @return True if animation element is present.
+ */
+ TBool SvgHasAnimationElement();
+
+ /**
+ * Finds if Document content is Interactive
+ *
+ * @since Series 3.2
+ * @param none
+ * @return True if Document content is Interactive
+ */
+ TBool IsDocumentContentInteractive();
+
+ private:
+ /**
+ * Constructor
+ * @param aHasParent - Indicates whether document has a parent or not
+ * aSyncBehavDefault - Indicates default synchronised behaviour
+ * for runtime synchronisation.
+ * aSyncTolDefault - Indicates the synchronised tolerance in
+ * msecs for runtime synchronisation.
+ */
+ CSvgDocumentImpl( CSvgBitmapFontProvider* aSvgBitmapFontProvider, const TBool aHasParent,
+ const TSvgSyncBehaviour aSyncBehavDefault,
+ const TInt32 aSyncTolDefault );
+
+ /**
+ * 2-phase construction
+ */
+ void ConstructL();
+
+ /**
+ * search element by ID
+ */
+ MXmlElement* SearchElementById( MXmlElement* aElement,
+ const TDesC& aId );
+
+ public:
+ TBool iInitSortList;
+ TBool iReqExReqFtrSysLTested;
+ TBool iInitialDrawFlag;
+ CSvgEventHandler *iEventHandler;
+ TBool iIsInteractive;
+ TBool iFinishedParsing;
+ TBool iHasGroupOpacity;
+ //for debugging and performance checking
+ CSvgElementImpl* iPerfText;
+
+ TUint32 iTimeForJSR226;
+
+// CSvgImageHashMap* iImageHashMap;
+ CSvgFontHashMap* iFontHashMap;
+ CSvgMemoryManager* iMemoryManager;
+
+ RPointerArray<CSvgAnimationBase> iSvgAnimations;
+
+ TInt iImageElementCnt;
+
+ private: // From MSvgTimedEntityInterface
+ /**
+ * From MSvgTimedEntityInterface
+ * The parent time container provides the timing clock to
+ * the timed entity (audio, video, animation, document)
+ * using this routine.
+ * @since Series 3.2
+ * @param aTick Current tick information
+ * @return none.
+ */
+ void ParentTimeContainerTick( TSvgTick aTick );
+
+ /**
+ * From MSvgTimedEntityInterface
+ * Returns the sync behavior of the entity.
+ * @since Series 3.2
+ * @param none.
+ * @return TSvgSyncBehaviour Element's Sync Behaviour.
+ */
+ TSvgSyncBehaviour GetEntitySyncBehavior();
+
+ /**
+ * From MSvgTimedEntityInterface
+ * When the timed entity acts as timing master in the time container,
+ * the time container gets the timed entity clock using this method
+ * and feeds to rest of timed entities.
+ * @since Series 3.2
+ * @param aEntityCurTime Current Entity Time in msecs.
+ * @return none.
+ */
+ void GetEntityCurrentTime( TUint32& aEntityCurTime );
+
+ /**
+ * From MSvgTimedEntityInterface
+ * Returns the configured sync master value(as per DOM tree) as specified
+ * in the SVG content.
+ * @since Series 3.2
+ * @param aIsSyncMaster Indicates whether the element is configured as
+ * Sync Master.
+ * @return none.
+ */
+ void GetCnfSyncMasterStatus( TBool& aIsSyncMaster );
+
+ /**
+ * From MSvgTimedEntityInterface
+ * Check if timed entity is going to act as timing master in the
+ * time container. This behavior could change dynamically.
+ * @since Series 3.2
+ * @param aIsSyncMaster Indicates whether the element is currrently Sync Master.
+ * @return none.
+ */
+ void GetCurSyncMasterStatus( TBool& isSyncMaster );
+
+ /**
+ * From MSvgTimedEntityInterface
+ * If some other element is resolved as syncMaster in the time container group,
+ * this element can not act as sync master.
+ * @since Series 3.2
+ * @param aSyncMasterStatus Indicates whether the element is currrently
+ * Sync Master.
+ * @return none.
+ */
+ void SetCurSyncMasterStatus( TBool aSyncMasterStatus );
+
+ /**
+ * From MSvgTimedEntityInterface
+ * Check if timed entity can provide timing ticks to rest of time
+ * container elements. This behavior could change dynamically.
+ * For example, if audio clip is over, the audio element can't generate
+ * ticks for others.
+ * @since Series 3.2
+ * @param none.
+ * @return TBool True if can generate timing tick.
+ */
+ TBool CanGenerateTick();
+
+ /**
+ * Check if timed entity can use its parent's tick. Usually only the
+ * parent document should return true for this function.
+ * All other elements return false
+ * @since Series 3.2
+ * @param none.
+ * @return TBool True if can use parent's timing tick.
+ */
+ TBool CanUseParentTick();
+
+ /**
+ * From MSvgTimedEntityInterface
+ * If the timed entity needs to be in sync with the time container and
+ * it has slipped beyond the sync tolerance limit, the method is called to
+ * bring the element in sync with the time container.
+ * @since Series 3.2
+ * @param aSynctime Time for resync in msecs.
+ * @return none.
+ */
+ void ResyncTimedEntity( TUint32 aSynctime );
+
+ /**
+ * From MSvgTimedEntityInterface
+ * This would be used for pausing the timed entity while other locked
+ * timed entities get loaded.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void PauseTimedEntity();
+
+ /**
+ * From MSvgTimedEntityInterface
+ * This would be used for resuming the timed entity once all locked
+ * timed entities get loaded.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void ResumeTimedEntity();
+
+ /**
+ * From MSvgTimedEntityInterface
+ * This would be used for stopping the timed entity.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void StopTimedEntity();
+
+
+ CSvgTimeContainer* GetChildTimeContainer();
+
+
+ private:
+ void Load( RFs& aSession, RFile& aFileHandle, CSvgErrorImpl& aError );
+
+ void ProcessDRMError( TInt errorCode, CSvgErrorImpl& aError );
+
+ TBool IsGzipContent( RFile& aFile );
+ TBool IsGzipContent( const TDesC8& aByteArray );
+
+ TBool IsDRMContent( RFile& aFileHandle );
+ TBool IsDRMContent( const TDesC8& aByteData );
+
+ TBool IsBinarySvg( const TDesC8& aByteArray );
+
+ TBool ProcessGZipContent( RFs& aSession,
+ RFile& aFileHandle,
+ TFileName& aFileName,
+ CSvgErrorImpl& aError );
+
+ TBool ProcessGZipContent( RFs& aSession,
+ TFileName& aZippedFileName,
+ TFileName& aUnzippedFileName ,
+ CSvgErrorImpl& aError );
+
+ HBufC8* ProcessDRMContentL( RFile& aFileHandle, CSvgErrorImpl& aError );
+
+ void ProcessSvgContentL( const TDesC8& aByteArray, CSvgErrorImpl& aError, TBool aRemoveFalseSwitchElements = ETrue );
+
+ void Process16BitSvgContentL( const TDesC16& aByteArray, CSvgErrorImpl& aError, TBool aRemoveFalseSwitchElements = ETrue );
+
+ TInt GetProcessPrivatePath( RFs& aSession, TFileName& aPath );
+
+ TInt CreateProcessPrivateDirectory( RFs& aSession, TFileName& aPath );
+
+ TInt WriteToTempFile( RFs& aSession, const TDesC8& aByteArray,
+ TFileName& aFilename, CSvgErrorImpl& aError );
+
+ TInt WriteToTempFile( RFs& aSession, RFile& aFileHandle,
+ TFileName& aFilename, CSvgErrorImpl& aError );
+
+ void LoadingCompleted();
+
+ TUint32 SubtreeDuration( CSvgElementImpl* aRootElement );
+
+ public:
+ TBool iAnimationResetNeeded;
+
+ // Flag set to ETrue when content-handler is removing false switch statements
+ TBool iIsPruningTree;
+ TBool iIsRendering;
+
+ private:
+ CSvgEngineImpl* iEngine;
+
+ TBuf<256> iUri;
+ CSvgElementImpl* iRootElement;
+
+ CSvgSchemaData* iSchemaData;
+
+ TBool iDrmEnable;
+
+ //flag used for DOM_Reuse
+ TBool iMultipleRendering;
+
+ TBool iHasGradientElement;
+
+ TBool iIsThumbNailMode;
+ TBool iIsDRMProtected;
+ //The value that holds the index of the current focus element.
+ TInt32 iCurObjIdx;
+ // pointer to the current focus element object.
+ CSvgElementImpl* iCurrentFocusObject;
+ // DRM Rights consumption
+ TBool iDrmRightsConsumptionEnabled;
+
+ // Flag to indicate this dom was Loaded or Prepared.
+ TBool iWasPrepared;
+
+ const RPointerArray<MSvgLoadingListener>* iLoadingListeners;
+
+ // MSvgMouseListener list
+ RPointerArray<MSvgMouseListener> iSvgMouseListeners;
+
+ TBool iCheckedAnimationDuration;
+ TUint iAnimationDuration;
+
+ CSvgContentHandler* iXmlHandler;
+
+ CSvgErrorImpl* iError;
+
+ // Time container for document for run time sync
+ CSvgTimeContainer* iTimeContainer;
+ // Indicates if this document a top-level document
+ TBool iHasParent;
+
+ // Default run time sync behaviour
+ TSvgSyncBehaviour iSyncBehaviorDefault;
+
+ // Default synchronised tolerance value in msecs
+ TUint32 iSyncToleranceDefault;
+
+
+ static const TInt KIndefiniteAnimationDuration = 2147483647;
+ TGfxAffineTransform iTransformMatrix;
+
+ //Stores Font Type information as passed by CSvgEngineInterfaceImpl
+ CSvgBitmapFontProvider *iSvgBitmapFontProvider;
+ };
+
+#endif // SVGDOCUMENTIMPL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,869 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGELEMENTIMPL_
+#define _INC_CSVGELEMENTIMPL_
+
+
+
+#include "GfxAffineTransform.h"
+#include "SVGColor.h"
+
+#include "SVGTransformableImpl.h"
+#include "SVGTestsImpl.h"
+#include "SVGLangSpaceImpl.h"
+#include "SVGUriReferenceImpl.h"
+#include "SVGEventReceiver.h"
+#include "SVGEvent.h"
+
+#define SVG_FONTS_INCLUDE // Macro to include SVG FONTS Functionality
+
+class CGfx2dGc;
+class CSvgTransformListImpl;
+class MSvgTransformList;
+
+#include "SVGXmlElementImpl.h"
+#include "SVGTransformable.h"
+#include "SVGTests.h"
+#include "SVGLangSpace.h"
+#include "SVGXmlElementOpt.h"
+#include "SVGUriReference.h"
+
+#include "GfxFloatFixPt.h"
+#include "GfxAffineTransform.h"
+#include "SVGSchemaData.h"
+
+class CCssValue;
+
+
+const float KGradiansPerDegree = 3.1415926f / 180.0f;
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+
+
+
+class CSvgElementImpl : public CXmlElementImpl,
+ public MSvgTransformable,
+ public MSvgTests,
+ public MXmlElementOpt,
+ public MSvgLangSpace,
+ public MSvgUriReference,
+ public MSvgEventReceiver
+
+ {
+ public:
+
+
+ virtual TBool DoAnimProcL(MSvgEvent* aEvent);
+ void PointToParent(const TInt aAttrId);
+ TBool IsInherited(const TInt aAttrId);
+
+ TBool HasAnimation();
+
+ TInt32 AnimateTransformMatrixIndexL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool DrawL( CGfx2dGc* agc,
+ CSvgElementImpl* aElement );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool StyleInParent(CSvgElementImpl* aElement, TInt aAttrIndex);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void DrawShapeL( CGfx2dGc* aGc,
+ MGfxShape& aShape,
+ CSvgElementImpl* aElement );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void DrawShapeL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void PropagateToChildren(CCssValue* aOldvalue,CCssValue* aNewValue, const TInt aNameId);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ const TDesC* Id();
+
+
+ virtual CGfxGeneralPath* GetPathAttribute(TInt aAttributeId);
+ virtual void SetPathAttribute(TInt aSvgAttrId, CGfxGeneralPath* aPathHandle);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt SetIdandXmlbaseL( const TDesC& aPropertyName,
+ const TDesC& aValue );
+
+
+ // need to move to CXmlElementImpl
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual MXmlElement* AppendChildL( MXmlElement* aElement, TBool aIsJSR226Element = EFalse );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt SetAttributeL( const TDesC& aName ,
+ const TDesC& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+ virtual TInt RemoveAttribute( const TInt aAttrId );
+
+
+
+ // From MXmlElementOpt API
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt GetAttributeIntL( const TInt aNameId,
+ TInt32& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt SetAttributeIntL( const TInt aNameId,
+ const TInt32 aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt GetAttributePath( const TInt aNameId,
+ CGfxGeneralPath*& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt SetAttributePathL( const TInt aNameId,
+ CGfxGeneralPath* aValue );
+
+ //used in decoder to avoid local copying.
+ virtual TInt SetAttributePathRef( const TInt aNameId,
+ CGfxGeneralPath*& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt GetAttributeDes( const TInt aNameId,
+ TPtrC16& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+ void GetSvgStylePropertiesArray( RPointerArray<CCssValue>*& aSvgStyleProperties);
+
+ // From MSvgLocatable/MSvgTransformable
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool IsTransformable();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetTransform( MSvgTransformList*& aTransformList );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetTransform( MSvgTransformList*& aTransformList );
+
+ virtual void SetTransformList(TGfxAffineTransform& aTr);
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual const TGfxAffineTransform& GetCTM();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetCTM( TGfxAffineTransform& aTr );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetBBox( TGfxRectangle2D& /*aBbox*/ );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetUnscaledBBox( TGfxRectangle2D& /*aBbox*/ );
+
+ // From MSvgStylable
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+ void SetPresentationAttribute( const TInt8 aPropertyId,
+ CCssValue*& aCssValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool SetPropertyL( const TInt& aAttrId,
+ const TDesC& aValue);
+ /**
+ * This method sets a property value that takes a float
+ *
+ * @since 1.0
+ * @param const TInt& (attribute ID), TReal32 (float value)
+ * @return TBool
+ */
+ TBool SetPropertyFloatL( const TInt& aAttrId,
+ TReal32 aValue);
+ // From MSvgTests
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetRequiredFeatures( const CDesCArrayFlat*& aRequiredFeatures );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetRequiredExtensions( const CDesCArrayFlat*& aRequiredExtensions );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool GetSystemLanguage( const CDesCArrayFlat*& aSystemLanguage );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool HasExtension( const TDesC& aExtension );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool HasFeature( const TDesC& aFeature );
+
+ virtual TBool HasAnyTests();
+
+ // From MSvgLangSpace.h
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual const TDesC& XMLLang();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt SetXMLLangL( const TDesC& aXMLLang );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual const TDesC& XMLSpace();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt SetXMLSpaceL( const TDesC& aXMLSpace );
+
+ // TKC: Shouldn't this be a wrapper to CSVGTransformableImpl
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool SetTransform( const TDesC& aAttributeName,
+ const TDesC& aValue );
+
+ // TKC Wrapper to CSvgTestsImpl
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool SetTestAttributeL( const TDesC& aPropertyName,
+ const TDesC& aValue );
+
+ // SSB Wrapper to CSvgLangSpace
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool SetLangSpaceAttributeL( const TDesC& aPropertyName,
+ const TDesC& aValue );
+
+ // SSB Wrapper to CSvgUriReferenceImpl
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool SetXlinkAttributeL( const TDesC& aPropertyName,
+ const TDesC& aValue );
+ // From MSvgLangSpace.h
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual const TDesC& Href();
+
+ virtual TDesC* HrefPointer();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual const TDesC& XlinkShow();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgElementImpl();
+
+ // From MSvgEventReceiver
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+ virtual TBool ReceiveEventL( MSvgEvent* aEvent);
+
+ /**
+ * Receives events and generates suitable internal events
+ * for engine based on aSubEventMask
+ *
+ * @since v3.2
+ * @param aEvent - The event of type TSvgEngineEventType
+ * @param aSubEventMask - contains the list of interactive events
+ * that the element can respond to.
+ * @return ETrue if the aEvent is of type TSvgEngineEventType and
+ * event processing needs redraw else EFalse.
+ */
+
+ virtual TBool ReceiveEventL( MSvgEvent* aEvent, const TUint16 aSubEventMask );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void ResetReferenceElementL();
+
+ // Internal methods
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TSvgColor* CurrentColor();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetGCL( CGfx2dGc* aGc);
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt32 AnimateMotionMatrixIndexL();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+
+ void FindProperty( const TInt8 aPropertyId,
+ CCssValue*& aCssValue,
+ CSvgElementImpl* aElement );
+
+ void FindProperty( const TInt8 aPropertyId,
+ CCssValue*& aCssValue);
+ void CreateSvgTestL(const TUint16 aAttrName);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void CloneSvgStylePropertiesL( CSvgElementImpl* aNewChild,
+ CSvgElementImpl* aParentElement);
+
+ TInt SetUriRefDesL( const TUint16 aNameId,
+ const TDesC& aValue );
+
+ /**
+ * Return wether an svg element is displayable, such as <rect>, <circle>, or
+ * an abstract element, such as <g>, <animate>.
+ *
+ * @since 1.0
+ * @param None
+ * @return ETrue is element is viewable.
+ */
+ virtual TBool IsViewable() { return EFalse; }
+
+ TBool IsVisible();
+
+ TFloatFixPt GetCurrentScale( );
+
+ virtual void UpdateCTM();
+
+
+ protected:
+ // Internal methods
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void InitializeL( TUint8 aElemID );
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgElementImpl();
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TBool IsDrawable();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+
+ TInt InitSvgStyleProperties();
+
+
+ public:
+
+ void InitAllSvgStyleProperties(CSvgElementImpl* aElement);
+ void InitSvgJSRStyleProperties(CSvgElementImpl* aParentElement);
+ void PrintStyleProperties();
+ virtual void Print( TBool aIsEncodeOn ) = 0;
+
+ TBool GetDefaultAttributeL( const TInt aNameId, CCssValue*& aValue );
+
+ // functions for encoding
+
+ virtual void SetRequiredFeatures( CDesCArrayFlat*& aRequiredFeatures );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetRequiredExtensions( CDesCArrayFlat*& aRequiredExtensions );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void SetSystemLanguage( CDesCArrayFlat*& aSystemLanguage );
+
+ /**
+ * Initialize all style property values with NULL.
+ *
+ * @since 1.0
+ * @return none
+ */
+ void InitSvgStylePropertiesWithNullL();
+
+ virtual void DeactivateAnimation();
+
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ void ResetReferenceAttrSet();
+
+ void Reset(MSvgEvent* aEvent);
+
+ virtual void ReInitializeAnimation();
+
+ void SetIsAnimating( TBool aBool );
+ TBool IsAnimating();
+
+ void SetTurnOff( TBool aBool );
+ TBool WasTurnedOff();
+
+ void SetOverwriteTransforms( TBool aBool );
+ TBool IsOverwriteTransforms();
+
+ void SetAllAttributesAdded( TBool aBool );
+ TBool AreAllAttributesAdded();
+
+ void SetMouseDown( TBool aBool );
+ TBool IsMouseDown();
+
+ void SetMouseIn( TBool aBool );
+ TBool IsMouseIn();
+
+ TBool IsAnimatedElement( );
+
+ /**
+ * Check whether the internal event can be generated
+ *
+ * @since v3.2
+ * @param aSubEventMask - The bit field that contains the list of events
+ * registered for the element
+ * @param aEvent - The internal event to be generated
+ * @return ETrue if the element is registered for the aEvent otherwise EFalse.
+ */
+ TBool CanGenerateInternalEvent(TUint16 aSubEventmask, TSvgEvent aEvent);
+
+ TBool IsSVGEnginePaused();
+ protected:
+ void CopyL( CSvgElementImpl* aDestElement );
+
+ public:
+
+ // Additive
+ RArray<TUint32>* iAnimateAttrSet;
+
+ TInt iAnimateTransformMatrixIndex;
+
+ TInt iHasAnimationBase;
+
+ protected:
+ // Internal variables
+
+ HBufC* iId;
+
+ RPointerArray<CCssValue>* iSvgStyleProperties;
+ CSvgTransformableImpl* iSvgTransformable;
+
+ CSvgTestsImpl* iSvgTests;
+
+ CSvgLangSpaceImpl* iSvgLangSpace;
+
+ CSvgUriReferenceImpl* iSvgUriReferenceImpl;
+
+ private:
+ // Enumeration for boolean bits: boolean variables use bitfield to reduce memory usage
+ enum TElementBooleanBits
+ {
+ KAnimatingBit = 0x00000001,
+ KWasTurnedOffBit = 0x00000002,
+ KOverwriteTransformsBit = 0x00000004,
+ KAllAttributesAddedBit = 0x00000008,
+ KMouseDownBit = 0x00000010,
+ KMouseInBit = 0x00000020
+
+ };
+
+ // variable to track TBool members with bitwise operations
+ TUint32 iBooleanFlags;
+
+ public:
+ TInt16 iAnimateMotionMatrixIndex;
+
+ TUint16 iReqAttrFlag;
+
+
+
+
+
+
+ };
+
+#endif /* _INC_CSVGELEMENTIMPL_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGEllipseElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,290 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef CSVGELLIPSEELEMENTIMPL_H
+#define CSVGELLIPSEELEMENTIMPL_H
+
+#include "SVGElementImpl.h"
+#include "GfxEllipse2D.h"
+
+
+class CSvgDocumentImpl;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgEllipseElementImpl : public CSvgElementImpl
+ {
+ public: // Constructor/deconstructor
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgEllipseElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgEllipseElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ private:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgEllipseElementImpl();
+
+ public: // New functions
+ // From SVG DOM
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Rx();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Ry();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Cx();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Cy();
+
+ // SVG Implementation
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetRx( TFloatFixPt aRx );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetRy( TFloatFixPt aRy );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetCx( TFloatFixPt aCx );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetCy( TFloatFixPt aCy );
+
+ // Utility methods
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ /**
+ * Return wether an svg element is displayable, such as <rect>, <circle>, or
+ * an abstract element, such as <g>, <animate>.
+ *
+ * @since 1.0
+ * @param None
+ * @return ETrue if element is viewable.
+ */
+ TBool IsViewable() { return ETrue; }
+
+ public: // From base classes
+
+ // From CSvgElementImpl
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetBBox( TGfxRectangle2D& aBbox );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetUnscaledBBox( TGfxRectangle2D& /*aBbox*/ );
+
+ // From MXmlElement API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+
+ // From MXmlElementOpt API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue );
+
+ void Print( TBool aIsEncodeOn );
+
+ protected: // New functions
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void CopyL( CSvgEllipseElementImpl* aDestElement );
+
+ protected: // From base classes
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CSvgEllipseElementImpl( CSvgDocumentImpl* aDoc );
+
+
+ private: // Data
+
+ TGfxEllipse2D iEllipse;
+
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGEventAttributes.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_SVGEVENTATTRIBUTE_
+#define _INC_SVGEVENTATTRIBUTE_
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+/**
+ * This is group all 'on' attributes into one class.
+ * CSvgElementImpl only has to hold one pointer to this class,
+ * thus saving memory for most instances of svg elements, which
+ * usually do not have these 'on' attributes.
+ */
+class CSvgEventAttributes : public CBase
+{
+public:
+ /**
+ * Constructor
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ CSvgEventAttributes();
+
+ /**
+ * Destructor
+ *
+ * @since 1.0
+ * @param None
+ * @return None
+ */
+ virtual ~CSvgEventAttributes();
+
+ /**
+ * Get the 'onclick' attribute value
+ *
+ * @since 1.0
+ * @param None
+ * @return 'onclick' value
+ */
+ const HBufC* OnClick();
+
+ /**
+ * Set the 'onclick' attribute value
+ *
+ * @since 1.0
+ * @param aString -- string to set value
+ * @return none
+ */
+ void SetOnClickL( const TDesC& aString );
+
+ /**
+ * Get the 'onload' attribute value
+ *
+ * @since 1.0
+ * @param None
+ * @return 'onclick' value
+ */
+ const HBufC* OnLoad();
+
+ /**
+ * Set the 'onload' attribute value
+ *
+ * @since 1.0
+ * @param aString -- string to set value
+ * @return none
+ */
+ void SetOnLoadL( const TDesC& aString );
+
+ /**
+ * Get the 'onmousemove' attribute value
+ *
+ * @since 1.0
+ * @param None
+ * @return 'onclick' value
+ */
+ const HBufC* OnMouseMove();
+
+ /**
+ * Set the 'onmousemove' attribute value
+ *
+ * @since 1.0
+ * @param aString -- string to set value
+ * @return none
+ */
+ void SetOnMouseMoveL( const TDesC& aString );
+
+private:
+ HBufC* iOnClick;
+ HBufC* iOnLoad;
+ HBufC* iOnMouseMove;
+};
+
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGFitToViewBoxImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,187 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_CSVGFITTOVIEWBOXIMPL__
+#define __INC_CSVGFITTOVIEWBOXIMPL__
+
+
+#include "GfxRectangle2D.h"
+
+#include "SVGPreserveAspectRatioImpl.h"
+#include "SVGFitToViewBox.h"
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgFitToViewBoxImpl : public CBase, public MSvgFitToViewBox
+ {
+ public:
+
+ // Constructor/deconstructor
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgFitToViewBoxImpl* NewL();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgFitToViewBoxImpl* NewLC();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgFitToViewBoxImpl();
+
+ // From SVG DOM
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetPreserveAspectRatio( MSvgPreserveAspectRatio*& aAspectRatio );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool GetViewBox( TGfxRectangle2D& aViewBox );
+
+ // Class-specified
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetPreserveAspectRatioL( TSvgPreserveAspectAlignType aAlign,
+ TSvgMeetOrSliceType aMeetslice );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetViewBoxL( TGfxRectangle2D aViewBox );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool ViewBoxDefined();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool SetViewBoxL( const TDesC& aAttributeName,
+ const TDesC& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetWindowViewportTrans( TGfxRectangle2D aXYWH,
+ TGfxAffineTransform& aTr,
+ TSize aSize );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgFitToViewBoxImpl* CloneL();
+
+ private:
+
+ TGfxRectangle2D iViewBox;
+
+ CSvgPreserveAspectRatioImpl* iAspectRatio;
+
+ TBool iViewBoxDefined;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgFitToViewBoxImpl();
+ };
+
+#endif /* #ifndef __INC_CSVGFITTOVIEWBOXIMPL__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGFloatCssValueImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+
+#ifndef __INC_CFLOATCSSVALUEIMPL__
+#define __INC_CFLOATCSSVALUEIMPL__
+
+
+#include "SVGCssValue.h"
+
+#include "GfxFloatFixPt.h"
+
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+
+
+
+class CFloatCssValueImpl : public CCssValue
+
+ {
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ ~CFloatCssValueImpl();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetValueL( const TDesC& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetValueL( const TFloatFixPt& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Value();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CFloatCssValueImpl();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CFloatCssValueImpl( float aValue );
+
+
+ TBool IsEqual(CCssValue* aValue);
+ void Print();
+
+ private:
+
+
+
+
+ TFloatFixPt iValue;
+ };
+
+#endif /* __INC_CFLOATCSSVALUEIMPL__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGFontElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,199 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGFONTELEMENTIMPL_
+#define _INC_CSVGFONTELEMENTIMPL_
+
+#include "SVGElementImpl.h"
+#include "GfxFloatFixPt.h"
+
+
+
+
+#ifdef SVG_FONTS_INCLUDE
+
+class CSvgDocumentImpl;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgFontElementImpl : public CSvgElementImpl
+ {
+ public:
+
+ // Constructor/deconstructor
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgFontElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgFontElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ private:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgFontElementImpl();
+
+ // From SVG DOM:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt GetHorzOrgX();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt GetHorzOrgY();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt GetHorzAdvX();
+
+ // SVG Implementation:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+ // From MXmlElementOpt API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+
+ void Print( TBool aIsEncodeOn );
+
+ private:
+
+ TFloatFixPt iHorzOrgX;
+ TFloatFixPt iHorzOrgY;
+ TFloatFixPt iHorzAdvX;
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgFontElementImpl( CSvgDocumentImpl* aDoc );
+ };
+
+#endif /* SVG_FONTS_INCLUDE */
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGFontFaceElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,395 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGFONTFACEELEMENTIMPL_
+#define _INC_CSVGFONTFACEELEMENTIMPL_
+
+#include "SVGElementImpl.h"
+#include "GfxFloatFixPt.h"
+
+
+
+
+
+#ifdef SVG_FONTS_INCLUDE
+
+class CSvgDocumentImpl;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgFontFaceElementImpl : public CSvgElementImpl
+ {
+ public:
+
+ // Constructor/deconstructor
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgFontFaceElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgFontFaceElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ private:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+ TInt SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue );
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgFontFaceElementImpl();
+
+ // From SVG DOM: Empty
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ const TDesC* GetFontFamily( );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt GetAscent();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt GetDescent();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt GetUnitsPerEm();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt GetAlphabetic();
+
+ // SVG Implementation:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetFontFamilyL( const TDesC& aFontFamily );
+
+
+ /**
+ * Removes the font-family from hash map, called in case the
+ * font-face has font-face-src
+ *
+ * @since 3.2
+ * @param: aFontFamily-- font-family name
+ * @return none
+ */
+
+ void RemoveFontFamily(const TDesC& aFontFamily);
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetUnicodeRangeL( const TDesC& aUnicodeRange );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetAscent( TFloatFixPt aAscent );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetDescent( TFloatFixPt aDescent );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetUnitsPerEm( TFloatFixPt aUnitsPerEm );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetAlphabetic( TFloatFixPt aAlphabetic );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetUnderlinePosition( TFloatFixPt aUnderlinePosition );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetUnderlineThickness( TFloatFixPt aUnderlineThickness );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetOverlinePosition( TFloatFixPt aOverlinePosition );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetOverlineThickness( TFloatFixPt aOverlineThickness );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetStrikethroughPosition( TFloatFixPt aStrikethroughPosition );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetStrikethroughThickness( TFloatFixPt aStrikethroughThickness );
+
+ // From MXmlElement API
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool IsAttributeValid( const TDesC& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+ // From CSvgElementImpl
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+
+ // From MXmlElementOpt API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeDes( const TInt aNameId,
+ TPtrC16& aValue );
+ void Print( TBool aIsEncodeOn );
+
+ private:
+
+ TFloatFixPt iAscent;
+
+ TFloatFixPt iDescent;
+
+ TFloatFixPt iUnitsPerEm;
+
+ TFloatFixPt iAlphabetic;
+
+ TFloatFixPt iUnderlinePosition;
+
+ TFloatFixPt iUnderlineThickness;
+
+ TFloatFixPt iOverlinePosition;
+
+ TFloatFixPt iOverlineThickness;
+
+ TFloatFixPt iStrikethroughPosition;
+
+ TFloatFixPt iStrikethroughThickness;
+
+ HBufC* iFontFamily;
+
+ HBufC* iUnicodeRange;
+
+
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgFontFaceElementImpl( CSvgDocumentImpl* aDoc );
+ };
+
+#endif /* SVG_FONTS_INCLUDE */
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGFontHashMap.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __FONTHASHMAP_H__
+#define __FONTHASHMAP_H__
+
+#include <e32std.h>
+#include "SVGFontElementImpl.h"
+
+ class CSvgFontMapItem: public CBase
+ {
+ public:
+
+ enum TSvgFontType
+ {
+ ESvgSystemFont,
+ ESvgSvgFont,
+ ESvgExternalDocumentFont
+ };
+
+ static CSvgFontMapItem* NewL();
+
+ static CSvgFontMapItem* NewLC();
+
+ CSvgFontMapItem();
+
+ ~CSvgFontMapItem();
+
+ void ConstructL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgFontElementImpl* GetFontPtr();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ const TDesC& GetFontFamilyName();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetFontPtr( CSvgFontElementImpl* aFontPtr );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void CopyFontFamilyName( const TDesC& aFontFamilyName );
+
+ TInt IncrementReferenceCount( );
+
+ TInt DecrementReferenceCount( );
+
+ void Print();
+
+ public:
+ CSvgFontElementImpl* iFontPtr;
+ CSvgDocumentImpl* iFontDocumentPtr;
+ HBufC* iFontFamilyName;
+ TInt iFontReferenceCount;
+ TSvgFontType iFontType;
+ };
+
+class CSvgFontHashMap : public CBase
+ {
+ public:
+
+ static CSvgFontHashMap* NewL();
+
+ static CSvgFontHashMap* NewLC();
+
+ CSvgFontHashMap();
+
+ ~CSvgFontHashMap();
+
+ void ConstructL();
+
+ //IMAGE MAPPING METHODS
+ TBool AddReferenceToFontL( const TDesC& aFontFamilyName );
+
+ TBool AddFontL ( CSvgFontElementImpl* aImage, const TDesC& aFontFamilyName );
+
+ TBool RemoveReferenceFromFontL( const TDesC& aFontFamilyName );
+
+ CSvgFontElementImpl* GetFontPtr( const TDesC& aFontFamilyName );
+
+ TBool HasFontFamilyName( const TDesC& aFontFamilyName );
+
+ //FONT MAPPING METHODS
+
+ TBool AddFontDocument(CSvgDocumentImpl* newFontDocument, const TDesC& aFontFamily);
+
+ void DeleteFontDocument(const TDesC& aFontFamily);
+
+ TBool HasFontDocument(CSvgDocumentImpl* aDoc);
+
+ void PrintFontHashMap();
+
+ private:
+
+ CSvgFontMapItem* GetFontMapItem( const TDesC& aFontFamilyName );
+
+ RPointerArray<CSvgFontMapItem> iSvgFontMapItems;
+
+ RPointerArray<CSvgDocumentImpl> iFontDocumentPointers;
+
+ //data item used in the FontHashMap
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGForeignObjectElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,228 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGFOREIGNOBJECTELEMENTIMPL_
+#define _INC_CSVGFOREIGNOBJECTELEMENTIMPL_
+
+#include "SVGElementImpl.h"
+#include "GfxFloatFixPt.h"
+
+class CSvgDocumentImpl;
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgForeignObjectElementImpl : public CSvgElementImpl
+ {
+ public:
+
+ // Constructor/deconstructor
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgForeignObjectElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgForeignObjectElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgForeignObjectElementImpl();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgElementImpl* SvgElementImpl();
+
+ // From MXmlElement API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+ // From CSvgElementImpl
+ TInt SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue );
+
+ TInt SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue );
+
+ void SetCdataL( const TDesC& aCdata );
+
+ TFloatFixPt X();
+ TFloatFixPt Y();
+ TFloatFixPt Width();
+ TFloatFixPt Height();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+
+ /**
+ * Return wether an svg element is displayable, such as <rect>, <circle>, or
+ * an abstract element, such as <g>, <animate>.
+ *
+ * @since 1.0
+ * @param None
+ * @return ETrue if element is viewable.
+ */
+ TBool IsViewable() { return ETrue; }
+
+ /**
+ * Notified when the mouse pointer enters a visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ TBool MouseEntered( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Notified when the mouse pointer exits a visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ TBool MouseExited( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Notified when the mouse pointer exits a visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ TBool MouseMoved( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Notified when the mouse pointer is pressed down on visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ TBool MousePressed( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Notified when the mouse pointer is released on on visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ TBool MouseReleased( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ private:
+
+ HBufC* iCdata;
+
+ TFloatFixPt iX;
+ TFloatFixPt iY;
+ TFloatFixPt iWidth;
+ TFloatFixPt iHeight;
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgForeignObjectElementImpl( CSvgDocumentImpl* aDoc );
+
+ void Print( TBool aIsEncodeOn );
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGGElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,243 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGGELEMENTIMPL_
+#define _INC_CSVGGELEMENTIMPL_
+
+#include "SVGElementImpl.h"
+#include "GfxFloatFixPt.h"
+
+
+
+
+class CSvgDocumentImpl;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgGElementImpl : public CSvgElementImpl
+ {
+ public:
+
+ // Constructor/deconstructor
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgGElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgGElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ private:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgGElementImpl();
+
+ // From MXmlElement API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+ // From CSvgElementImpl
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetBBox( TGfxRectangle2D& aBbox );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetUnscaledBBox( TGfxRectangle2D& /*aBbox*/ );
+
+ // From MXmlElementOpt API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ // Utilities (not exported)
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static void GetGroupBounding( TGfxRectangle2D& aBbox,
+ CSvgElementImpl* aStartElement );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static void GetGroupBoundingUnscaled( TGfxRectangle2D& aBbox,
+ CSvgElementImpl* aStartElement );
+ private:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static void GetGroupBoundingInternal( TFloatFixPt& aXmin,
+ TFloatFixPt& aYmin,
+ TFloatFixPt& aXmax,
+ TFloatFixPt& aYmax,
+ CSvgElementImpl* aStartElement );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static void GetGroupBoundingInternalUnscaled( TFloatFixPt& aXmin,
+ TFloatFixPt& aYmin,
+ TFloatFixPt& aXmax,
+ TFloatFixPt& aYmax,
+ CSvgElementImpl* aStartElement );
+ private:
+
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgGElementImpl( CSvgDocumentImpl* aDoc );
+
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ void Print( TBool aIsEncodeOn );
+
+ protected:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void CopyL( CSvgGElementImpl* aDestElement );
+
+
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGGlyphElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,310 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGGLYPHELEMENTIMPL_
+#define _INC_CSVGGLYPHELEMENTIMPL_
+
+#include "SVGElementImpl.h"
+#include "GfxFloatFixPt.h"
+
+#include "GfxGeneralPath.h"
+
+
+
+
+#ifdef SVG_FONTS_INCLUDE
+
+class CSvgDocumentImpl;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgGlyphElementImpl : public CSvgElementImpl
+ {
+ public:
+
+ // Constructor/deconstructor
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgGlyphElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgGlyphElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ private:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgGlyphElementImpl();
+
+ // From SVG DOM
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetUnicode( TDes& aUnicode );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt GetHorzAdvX();
+
+ // SVG Implementation
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetUnicodeL( const TDesC& aUnicode );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetGlyphNameL( const TDesC& aGlyphName );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetLangCodeL( const TDesC& aLangCode );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetPath( const TDesC& aPath );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeDesL( const TInt aNameId, const TDesC& aValue );
+
+
+ // From MXmlElementOpt API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributePath( const TInt aNameId,
+ CGfxGeneralPath*& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributePathL( const TInt aNameId,
+ CGfxGeneralPath* aValue );
+
+ TInt SetAttributePathRef( const TInt aNameId,
+ CGfxGeneralPath*& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeDes( const TInt aNameId,
+ TPtrC16& aValue );
+
+ // From MXmlElement API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+ // From CSvgElementImpl
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetBBox( TGfxRectangle2D& aBbox );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetUnscaledBBox( TGfxRectangle2D& /*aBbox*/ );
+
+ CGfxGeneralPath* GetPathAttribute(TInt aAttributeId);
+ void SetPathAttribute(TInt aAttributeId, CGfxGeneralPath* aPathHandle);
+
+ void Print( TBool aIsEncodeOn );
+
+ private:
+
+ HBufC* iUnicode;
+
+ HBufC* iGlyphName;
+
+ TFloatFixPt iHorzAdvX;
+
+ HBufC* iLangCode;
+
+ // TInt16 iPathLength;
+
+ CGfxGeneralPath* iShape;
+
+ TBool iOwnedPath;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgGlyphElementImpl( CSvgDocumentImpl* aDoc );
+ };
+
+#endif /* SVG_FONTS_INCLUDE */
+
+#endif /* _INC_CSVGGLYPHELEMENTIMPL_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGGradientElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#ifndef SVGGRADIENTELEMENTIMPL_H
+#define SVGGRADIENTELEMENTIMPL_H
+
+#include "SVGElementImpl.h"
+#include "SvgStopElementImpl.h"
+#include "GfxGradientPaint.h"
+
+//
+class CSvgDocumentImpl;
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgGradientElementImpl : public CSvgElementImpl
+ {
+ public:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgGradientElementImpl( CSvgDocumentImpl* aDoc );
+
+ /**
+ * The function not only adds the element in Stop element array but also
+ * adjusts the offset values of all the previously added elements such that
+ * offset value.
+ *
+ * @param : aStopEl -- Pointer to stop element.
+ * @return: none
+ */
+ void AddStopElementInArray(CSvgStopElementImpl *aStopEl);
+
+ /**
+ * Adjusts the offset values of all the previously added elements such that
+ * each gradient offset value is greater than the previous gradient stop's
+ * each gradient offset value is greater than the previous gradient stop's
+ * offset value.
+ *
+ * @param : aStopEl -- Pointer to stop element.
+ * @return: none
+ */
+ void UpdateOffsetValues(CSvgStopElementImpl *aStopEl);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,const TDesC& aValue );
+ TInt SetAttributeIntL( const TInt aNameId,
+ const TInt32 aValue );
+ TInt GetAttributeIntL(const TInt aNameId, TInt32& aValue );
+
+ void SetGradientTransMatrix(SVGReal aMatrix[2][3]);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual MGfxPaint *PaintAttribute() = 0;
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ ~CSvgGradientElementImpl();
+
+ RPointerArray<CSvgStopElementImpl> *iSvgStopElementArray;
+
+ protected:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL(const TUint8 aElemID);
+
+ protected:
+
+ TGfxGradientPaint* iGradientPaint;
+
+ RArray<TSvgStopData> *iStopElementData;
+ };
+
+#endif /* SVGGRADIENTELEMENTIMPL_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGImageElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,628 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGIMAGEELEMENTIMPL_
+#define _INC_CSVGIMAGEELEMENTIMPL_
+
+#include <imageconversion.h>
+
+#include "SVGElementImpl.h"
+#include "GfxRectangle2D.h"
+#include "SVGRequestObserver.h"
+
+#include "SVGImageLoadingObserver.h" // MSVGImageLoadingObserver
+
+class CFbsBitmap;
+class CSvgDocumentImpl;
+class MXmlDocument;
+
+/**
+ * This class is for internal use to receive notification from other
+ * <image> elements. This case is when an <image> element is Cloned
+ * by a <use> element
+ */
+class MSvgImageElementListener
+{
+ public:
+ /**
+ * Inform the listener that the image is decoded and update its
+ * bitmap pointers
+ *
+ * @since s60 3.0
+ * @return : None.
+ */
+ virtual void BitmapDecoded( CFbsBitmap* aBitmap, CFbsBitmap* aMask ) = 0;
+
+ /**
+ * Inform the listener to reset its reference to the referred element
+ * @since s60 3.1
+ * @return : None.
+ */
+ virtual void ResetReference() = 0;
+};
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgImageElementImpl : public CSvgElementImpl,
+ public MSVGImageLoadingObserver,
+ public MSvgImageElementListener
+
+ {
+ public:
+
+ /**
+ * Helper class to load images asynchronously. To load an image:
+ * 1. Instantiate CSvgImageLoaderUtil with NewL/NewLC, passing
+ * a MSVGImageLoadingObserver, which implements the 'ImageLoadingCompleted'
+ * method, and a file name. This method is called by the CSvgImageLoaderUtil
+ * object when loading is complete. The error code passed-in will indicate
+ * a successful load or not.
+ * 2. Set the output mode with 'SetDisplayMode' the default is EColor64K, see
+ * TDisplayMode for more options.
+ * 3. Call one of the 'RequestForImageL' method.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+ class CSvgImageLoaderUtil : public CActive
+ {
+ public:
+ /**
+ * Constructor
+ *
+ * @since 1.0
+ * @param aObserver : callback object when image loading completes.
+ * @param aFileHandle : file handle of image to load.
+ * @param aSyncLoading : Perform Synchronous loading(ETrue) or not
+ * @return
+ */
+ static CSvgImageLoaderUtil* NewL( MSVGImageLoadingObserver* aObserver,
+ RFile& aFileHandle,
+ TBool aSyncLoading );
+
+ /**
+ * Constructor
+ *
+ * @since 1.0
+ * @param aObserver : callback object when image loading completes.
+ * @param aEncodedData : encode 8-bit data buffer
+ * @param aSyncLoading : Perform Synchronous loading(ETrue) or not
+ * @return
+ */
+ static CSvgImageLoaderUtil* NewL( MSVGImageLoadingObserver* aObserver,
+ const TDesC8& aEncodedData,
+ TBool aSyncLoading );
+
+ /**
+ * Destructor
+ *
+ * @since 1.0
+ * @return
+ */
+ ~CSvgImageLoaderUtil();
+
+ /**
+ * Set the output mode, the default value is EColor64K.
+ *
+ * @since 1.0
+ * @param aDisplayMode : output mode.
+ * @return
+ */
+ void SetDisplayMode( TDisplayMode aDisplayMode );
+
+ /**
+ * Request for the image and size the bitmap to the size of the image.
+ *
+ * @since 1.0
+ * @param aBitmap : bitmap to store the pixels
+ * @param aMask : bitmap to store the Mask pixels
+ * @param aHasAlpha : Alpha value indicator, Used to create Mask
+ * @param aFrameInfo : TFrameInfo structure
+ * @return
+ */
+ void RequestForImageL( CFbsBitmap& aBitmap,
+ CFbsBitmap& aMask,
+ TBool aHasAlpha,
+ TFrameInfo aFrameInfo );
+
+ /**
+ * From CActive Handles cancelling of asynchronous requests
+ *
+ * @param aBitmap : bitmap to store the pixels
+ * @since 2.0
+ */
+ void DoCancel();
+
+ /**
+ * From CActive Called when asynchronous request is completed
+ *
+ * @since 2.0
+ */
+ void RunL();
+
+ /**
+ * From CActive Called when asynchronous request is completed
+ *
+ * @since 2.0
+ * @param aError : error code
+ */
+ TInt RunError( TInt aError );
+
+ /**
+ * Return wether image decoding is synchronous or asynchronous.
+ * @since 3.1
+ * @param None
+ * @return ETrue if image decoding is synchrounous else EFalse
+ */
+ TBool IsSynchronousLoading();
+
+ /**
+ * Returns the FrameInfo of Image. Function is called once the Decoder is
+ * created.
+ * @since 3.2
+ * @param None
+ * @return TFrameInfo structure.
+ */
+
+ TFrameInfo GetFrameInfo();
+ private:
+ /**
+ * Constructor
+ *
+ * @since 1.0
+ */
+ CSvgImageLoaderUtil();
+
+ /**
+ * Construct this object with leavable calls.
+ *
+ * @since 1.0
+ * @param aObserver : callback object when image loading completes.
+ * @param aFileHandle : file handle of image to load.
+ * @param aSyncLoading : Perform Synchronous loading(ETrue) or not
+ */
+ void ConstructL( MSVGImageLoadingObserver* aObserver,
+ RFile& aFileHandle,
+ TBool aSyncLoading );
+
+ /**
+ * Phase two of construction.
+ *
+ * @since 1.0
+ * @param aObserver : callback object when image loading completes.
+ * @param aEncodedData : encode 8-bit data buffer
+ * @param aSyncLoading : Perform Synchronous loading(ETrue) or not
+ */
+ void ConstructL( MSVGImageLoadingObserver* aObserver,
+ const TDesC8& aEncodedData,
+ TBool aSyncLoading );
+
+
+ private:
+ MSVGImageLoadingObserver* iObserver;
+ CImageDecoder* iImageDecoder;
+ TDisplayMode iDisplayMode;
+ CActiveSchedulerWait* iActiveSchedulerWait;
+ TBool iIsSyncLoading;
+ HBufC8* iImageByteData;
+ };
+
+ public:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgImageElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgImageElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+ private:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgImageElementImpl();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ const TDesC& Par();
+
+ TInt CheckRequiredAttributes();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetParL( const TDesC& aName );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ImageLoadingCompleted( TInt aErrorStatus );
+
+ // From SVG DOM
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt X();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Y();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Width();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Height();
+
+ // SVG Implementation
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetWidth( TFloatFixPt aWidth );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetHeight( TFloatFixPt aHeight );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetUriL( const TDesC& aUri );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void LoadUriL();
+
+ // From MXmlElement API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetBBox( TGfxRectangle2D& aBbox );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetUnscaledBBox( TGfxRectangle2D& /*aBbox*/ );
+
+ // From MXmlElementOpt API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgImageElementImpl( CSvgDocumentImpl* aDoc );
+
+ TInt GetAttributeDes( const TInt aNameId,
+ TPtrC16& aValue );
+
+ /**
+ * Return wether an svg element is displayable, such as <rect>, <circle>, or
+ * an abstract element, such as <g>, <animate>.
+ *
+ * @since 1.0
+ * @param None
+ * @return ETrue if element is viewable.
+ */
+ TBool IsViewable() { return ETrue; }
+
+ // Adding/Removing listener interested in image decoding notification
+ void AddImageElementListener( MSvgImageElementListener* aListener );
+ void RemoveImageElementListener( MSvgImageElementListener* aListener );
+
+ // MSvgImageElementListener method
+ void BitmapDecoded( CFbsBitmap* aBitmap, CFbsBitmap* aMask );
+ void ResetReference();
+
+ void Print( TBool aIsEncodeOn );
+
+ CFbsBitmap* GetBitmap();
+
+ void SetBitmap( CFbsBitmap* aBitmap );
+
+ // Assigned image data for this object to manage delete
+ // after image-decoding or destructing.
+ void AssignImageData( HBufC8* aData );
+
+ /**
+ * Starts the image decoding. This is the version that accepts
+ * descriptor data of the image content. Image can be SVG/ any format
+ * supported by CImageDecoder
+ * @since s60 3.2
+ * @param aImageData Image Data Descriptor
+ * @param aSyncLoading ETrue=Sync Loading
+ * @return TInt errorcode
+ */
+ TInt StartImageDecoding( const TDesC8& aImageData,
+ TBool aSyncLoading );
+
+ /**
+ * Starts the image decoding. This is the version that accepts
+ * file handle of the image content. Image can be SVG/ any format
+ * supported by CImageDecoder
+ * @since s60 3.2
+ * @param aImageFile Image File handle
+ * @param aBitmap Bitmap Pointer
+ * @param aSyncLoading ETrue=Sync Loading
+ * @return TInt errorcode
+ */
+ TInt StartImageDecoding( RFile& aImageFile,
+ CFbsBitmap* aBitmap,
+ TBool aSyncLoading );
+ /**
+ * Informs the image element that it is referring to a
+ * particular element. This is used in case an image element
+ * is cloned.
+ * @since s60 3.2
+ * @param aImageElement Image Element Pointer
+ * @return None.
+ */
+ void SetReferenceElement( CSvgImageElementImpl* aImageElement );
+
+ /**
+ * Get function for reference element
+ * @since s60 3.2
+ * @param none
+ * @return Image Element Pointer.
+ */
+
+ CSvgImageElementImpl* ReferenceElement();
+
+ private:
+ /**
+ * Notify the listeners (MSvgImageElementListener) when
+ * Image decoding is completed
+ * @since s60 3.0
+ * @param None.
+ * @return None.
+ */
+ void NotifyImageDecoded();
+ /**
+ * Notify the listeners (MSvgImageElementListener) to dereference
+ * the reference element. This function can be called for eg.
+ * when the reference element is getting deleted.
+ * @since s60 3.2
+ * @param None.
+ * @return None.
+ */
+ void NotifyResetReference();
+ void PrepareImageWithMask();
+ protected:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void CopyL( CSvgImageElementImpl* aDestElement );
+
+ void PrepareImageFromSvgFile(const TDesC8& aImageData);
+
+
+ private:
+ /**
+ * Process an encoded image in the xlink:href attribute value.
+ *
+ * @since 1.0
+ * @param aXlinkHrefValue : the string of the xlink:href attribute value.
+ * @return
+ */
+ void ProcessEncodedImageL( const TDesC& aXlinkHrefValue );
+
+
+ private:
+ TGfxRectangle2D iImgRect;
+ HBufC* iPar;
+ TBool iBitmapOrgReady;
+ CSvgImageLoaderUtil* iImageLoader;
+ TBool iRenderImage;
+
+ TBool iUsedImage;
+
+ HBufC8* iImageData;
+
+ RPointerArray<MSvgImageElementListener> iImageElementListeners;
+ // Indicates whether the URI for xlink:href attribute is set.
+ TBool iIsUriSet;
+ TBool iImageDecodingDone;
+ public:
+ CFbsBitmap* iBitmap;
+ CFbsBitmap* iMask;
+ TBool iBitmapReady;
+ TBool iBitmapLoadCalled;
+ TInt iDownloadWait;
+ TFileName iFullPathFileName;
+ CPeriodic* iImageDownloadTimer;
+
+ RFs iSession;
+ TBool iSessionConnected;
+ TBool iIsBase64;
+
+ TBool iIsSvgFile;
+ // Image Reference Element - used in clone scenario
+ CSvgImageElementImpl* iRefElement;
+ };
+
+
+
+
+#endif /*_INC_CSVGIMAGEELEMENTIMPL_INCLUDED */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGImageHashMap.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __IMAGEHASHMAP_H__
+#define __IMAGEHASHMAP_H__
+
+#include <e32std.h>
+#include "fbs.h"
+
+ class CSvgImageMapItem: public CBase
+ {
+ public:
+
+ enum TSvgImageType
+ {
+ ESvgBase64Image,
+ ESvgExternalImage
+ };
+
+ static CSvgImageMapItem* NewL();
+
+ static CSvgImageMapItem* NewLC();
+
+ CSvgImageMapItem();
+
+ ~CSvgImageMapItem();
+
+ void ConstructL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CFbsBitmap* GetImagePtr();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ const TDesC& GetImageName();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetImagePtr( CFbsBitmap* aImagePtr );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void CopyImageNameL( const TDesC& aImageName );
+
+ TInt IncrementReferenceCount( );
+
+ TInt DecrementReferenceCount( );
+
+ void SetImageDecodingStatus( TBool aThisImageIsDecoding );
+
+ TBool GetImageDecodingStatus( );
+
+ void Print();
+
+ public:
+ CFbsBitmap* iImagePtr;
+ HBufC* iImageName;
+ TInt iImageReferenceCount;
+ TBool iImageDecodingStatus;
+ TSvgImageType iImageType;
+ };
+
+class CSvgImageHashMap : public CBase
+ {
+ public:
+
+ static CSvgImageHashMap* NewL();
+
+ static CSvgImageHashMap* NewLC();
+
+ CSvgImageHashMap();
+
+ ~CSvgImageHashMap();
+
+ void ConstructL();
+
+ //IMAGE MAPPING METHODS
+ TBool AddImageL ( CFbsBitmap* aImage, const TDesC& aImageName );
+
+ TBool RemoveReferenceFromImageL( const TDesC& aImageName );
+
+ CFbsBitmap* GetImagePtr( const TDesC& aImageName );
+
+ CSvgImageMapItem* GetImageMapItem( const TDesC& aImageName );
+
+ TBool HasImageName( const TDesC& aImageName );
+
+ void PrintImageHashMap();
+
+ private:
+ RPointerArray<CSvgImageMapItem> iSvgImageMapItems;
+
+ //data item used in the ImageHashMap
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGIntCssValueImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_CINTCSSVALUEIMPL__
+#define __INC_CINTCSSVALUEIMPL__
+
+
+#include "SVGCssValue.h"
+
+
+
+
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+
+class CIntCssValueImpl : public CCssValue
+
+ {
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ ~CIntCssValueImpl();
+
+ CIntCssValueImpl();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetValueL( const TDesC& aValue );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetValueL( const TInt& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt Value();
+
+
+
+
+
+
+ TBool IsEqual(CCssValue* aValue);
+
+ void Print();
+
+ private:
+ TInt32 iValue;
+
+
+
+ };
+
+#endif /* __INC_CINTCSSVALUEIMPL__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGLangSpaceImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGLANGSPACEIMPL_
+#define _INC_CSVGLANGSPACEIMPL_
+
+#include "SVGLangSpace.h"
+
+
+
+/**
+ * Class description
+ *
+ * SVG elements' superclass.
+ *
+ */
+class CSvgLangSpaceImpl : public CBase
+ {
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ const TDesC& XMLLang();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetXMLLangL( const TDesC& aXMLLang );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ const TDesC& XMLSpace();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetXMLSpaceL( const TDesC& aXMLSpace );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool SetLangSpaceAttributeL( const TDesC& aPropertyName,
+ const TDesC& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgLangSpaceImpl();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgLangSpaceImpl* NewL();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgLangSpaceImpl* NewLC();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgLangSpaceImpl* CloneL();
+
+ protected:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL();
+
+ HBufC* iXMLLang;
+
+ HBufC* iXMLSpace;
+ };
+
+#endif /* _INC_CSVGELEMENTIMPL_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGLineElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,203 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGLINEELEMENTIMPL_
+#define _INC_CSVGLINEELEMENTIMPL_
+
+#include "SVGElementImpl.h"
+#include "GfxLine2D.h"
+
+
+
+
+class CSvgDocumentImpl;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgLineElementImpl : public CSvgElementImpl
+ {
+ public:
+
+ // Constructor/deconstructor
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgLineElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgLineElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ private:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgLineElementImpl();
+
+ // From MXmlElement API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetBBox( TGfxRectangle2D& aBbox );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetUnscaledBBox( TGfxRectangle2D& /*aBbox*/ );
+
+ // From MXmlElementOpt API
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue );
+
+ /**
+ * Return wether an svg element is displayable, such as <rect>, <circle>, or
+ * an abstract element, such as <g>, <animate>.
+ *
+ * @since 1.0
+ * @param None
+ * @return ETrue if element is viewable.
+ */
+ TBool IsViewable() { return ETrue; }
+
+ private:
+ TGfxLine2D iLine;
+
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgLineElementImpl( CSvgDocumentImpl* aDoc );
+
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ void Print( TBool aIsEncodeOn );
+
+ protected:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void CopyL( CSvgLineElementImpl* aDestElement );
+
+ };
+
+#endif /* _INC_CSVGLINEELEMENT_3C61A6080051_INCLUDED */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGLinearGradientElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#ifndef SVGLINEARGRADIENTELEMENTIMPL_H
+#define SVGLINEARGRADIENTELEMENTIMPL_H
+
+#include "SVGGradientElementImpl.h"
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgLinearGradientElementImpl : public CSvgGradientElementImpl
+{
+ public:
+
+ // Constructor/deconstructor
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgLinearGradientElementImpl* NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgLinearGradientElementImpl* NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MGfxPaint *PaintAttribute();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgLinearGradientElementImpl();
+
+ // From SVG DOM
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue );
+ TInt SetAttributeIntL( const TInt aNameId,
+ const TInt32 aValue );
+ TInt GetAttributeIntL( const TInt aNameId, TInt32& aValue );
+
+
+ // From MXmlElement API
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+ void Print( TBool aIsEncodeOn );
+
+ private:
+ TGfxLinearGradientPaint iGfxLinearPaint;
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgLinearGradientElementImpl( CSvgDocumentImpl* aDoc );
+ /*
+ * To add support for % values for x1,x2,y1,y2
+ */
+ TBool IsValidValue( const TDesC& aValue );
+
+ };
+
+#endif /* SVGLINEARGRADIENTELEMENTIMPL_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGLockedRealTimeEntity.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "SVGTimedEntityInterface.h"
+#include "SVGTimeContainer.h"
+
+class CSvgDocumentImpl;
+
+NONSHARABLE_CLASS( CSvgLockedRealTimeEntity ): public CSvgMediaElementBase
+{
+
+ public:
+ static CSvgLockedRealTimeEntity* NewL(CSvgDocumentImpl* aDoc);
+
+ void ConstructL(CSvgDocumentImpl* aDoc);
+
+ CSvgLockedRealTimeEntity(CSvgDocumentImpl* aDoc);
+
+ ~CSvgLockedRealTimeEntity();
+
+
+
+ //from svgelementimpl
+ void Print(TInt aValue) ;
+
+
+ public: // from svgtimedentityinterface
+
+ /**
+ * The parent time container provides the timing clock to
+ * the timed entity (audio, video, animation, document)
+ * using this routine.
+ * @since S60 3.2
+ * @param aTick Current tick information
+ * @return none.
+ */
+ void ParentTimeContainerTick( TSvgTick aTick );
+ /**
+ * Returns the sync behavior of the entity.
+ * @since S60 3.2
+ * @param none.
+ * @return TSvgSyncBehaviour Element's Sync Behaviour.
+ */
+ TSvgSyncBehaviour GetEntitySyncBehavior();
+
+ /**
+ * When the timed entity acts as timing master in the time container,
+ * the time container gets the timed entity clock using this method
+ * and feeds to rest of timed entities.
+ * @since S60 3.2
+ * @param aEntityCurTime Current Entity Time in msecs.
+ * @return none.
+ */
+ void GetEntityCurrentTime( TUint32&
+ aEntityCurTime );
+ /**
+ * Returns the configured sync master value(as per DOM tree) as specified
+ * in the SVG content.
+ * @since S60 3.2
+ * @param aIsSyncMaster Indicates whether the element is configured as
+ * Sync Master.
+ * @return none.
+ */
+ void GetCnfSyncMasterStatus( TBool& aIsSyncMaster );
+
+ /**
+ * Check if timed entity is going to act as timing master in the
+ * time container. This behavior could change dynamically.
+ * @since S60 3.2
+ * @param aIsSyncMaster Indicates whether the element is currrently Sync Master.
+ * @return none.
+ */
+ void GetCurSyncMasterStatus( TBool& isSyncMaster );
+
+
+ /** If some other element is resolved as syncMaster in the time container group,
+ * this element can not act as sync master.
+ * @since S60 3.2
+ * @param aSyncMasterStatus Indicates whether the element is currrently
+ * Sync Master.
+ * @return none.
+ */
+ void SetCurSyncMasterStatus( TBool aSyncMasterStatus );
+
+ /**
+ * Check if timed entity can provide timing ticks to rest of time
+ * container elements. This behavior could change dynamically.
+ * For example, if audio clip is over, the audio element can't generate
+ * ticks for others.
+ * @since S60 3.2
+ * @param none.
+ * @return TBool True if can generate timing tick.
+ */
+ TBool CanGenerateTick();
+
+ /**
+ * Check if timed entity can use its parent's tick. Usually only the
+ * parent document should return true for this function.
+ * All other elements return false
+ * @since S60 3.2
+ * @param none.
+ * @return TBool True if can use parent's timing tick.
+ */
+ TBool CanUseParentTick();
+
+ /**
+ * If the timed entity needs to be in sync with the time container and
+ * it has slipped beyond the sync tolerance limit, the method is called to
+ * bring the element in sync with the time container.
+ * @since S60 3.2
+ * @param aSynctime Time for resync in msecs.
+ * @return none.
+ */
+ void ResyncTimedEntity( TUint32 aSynctime );
+
+ /**
+ * This would be used for pausing the locked timed entity while other locked
+ * timed entities get loaded.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void PauseTimedEntity();
+
+ /**
+ * This would be used for resuming the locked timed entity once all locked
+ * timed entities get loaded.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void ResumeTimedEntity();
+
+ /**
+ * This would be used for stopping the timed entity.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void StopTimedEntity() ;
+
+
+ /* Return the type of class
+ @Return Type Enumeration of object type
+ @Parameters none
+ */
+ TSvgObjectType ObjectType();
+
+ CSvgTimeContainer* GetChildTimeContainer() ;
+
+ TBool AnimProcL( MSvgTimerEvent* aEvent );
+ void ResetAnimationL();
+
+ private:
+
+ // Current Tick stored here so that it can be accessed by
+ // timed entities which are offset
+ TSvgTick iStoredTick;
+
+ CSvgDocumentImpl* iOwnerDocument;
+
+ TBool iIsPaused;
+
+ TBool iSyncMasterCurrent;
+};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGMediaAnimationElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,688 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This class provides the functionality for the animation
+ element as specified in the SVG 1.2 specification
+ *
+*/
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#ifndef C_SVGMediaAnimationElementImpl_H
+#define C_SVGMediaAnimationElementImpl_H
+
+#include "SVGMediaElementBase.h"
+#include "SVGTimeContainer.h"
+#include "SVGListener.h"
+
+class CSvgDocumentImpl;
+class MXmlDocument;
+class CSvgFitToViewBoxImpl;
+class CSvgErrorImpl;
+
+NONSHARABLE_CLASS( CSvgMediaAnimationElementImpl ):
+ public CSvgMediaElementBase,
+ public MSvgMouseListener,
+ public MSvgTimeContainerObserver
+ {
+
+ public:
+ /**
+ * Two Phase Constructor
+ *
+ * since S60 3.2
+ * @param animation element id and document pointer
+ * @return Animation element object
+ */
+ static CSvgMediaAnimationElementImpl* NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+ /**
+ * Two Phase Constructor
+ *
+ * since S60 3.2
+ * @param animation element id and document pointer
+ * @return Animation element object
+ */
+
+ static CSvgMediaAnimationElementImpl* NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+ /**
+ * Set the Synchronised behaviour for the animation element
+ * @since S60 3.2
+ * @param aValue "canSlip" | "locked" | "independent" | "default"
+ * @return none.
+ */
+ virtual void SetSyncBehavior( const TDesC& aValue );
+
+ /**
+ * Set the Synchronised Tolerance for the animation element
+ * @since S60 3.2
+ * @param aValue Clock-value | "default"
+ * @return none.
+ */
+ virtual void SetSyncTolerance( const TDesC& aValue );
+
+ /**
+ * Set the animation element as Synchronised Master
+ * @since S60 3.2
+ * @param aValue "true" | "false"
+ * @return none.
+ */
+ virtual void SetSyncMaster( const TDesC& aValue );
+
+
+ private:
+
+ /**
+ * Two Phase Constructor
+ *
+ * since S60 3.2
+ * @param animation element id and document pointer
+ * @return Animation element object
+ */
+ void ConstructL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Constructor
+ *
+ * since S60 3.2
+ * @param aDoc a document pointer
+ * @return none
+ */
+ CSvgMediaAnimationElementImpl( CSvgDocumentImpl* aDoc );
+ public:
+ /**
+ * A method to (deep) clone the current element
+ *
+ * since S60 3.2
+ * @param None
+ * @return An MXmlElement pointer to the object that is a copy of
+ * the current element
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ /**
+ * Destructor
+ *
+ * since S60 3.2
+ * @param none
+ * @return none
+ */
+ virtual ~CSvgMediaAnimationElementImpl();
+
+ // From MXmlElement API
+
+
+ /**
+ * Set attribute interface for Animation element
+ *
+ * since S60 3.2
+ * @param aName - A string buffer containing the name of the attribute
+ * @param aValue - A string buffer containing the value of the attribute
+ * @return An integer containing success/failure for this action
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+ /**
+ * Set attribute interface for Animation element
+ *
+ * since S60 3.2
+ * @param aName - A string buffer containing the name of the attribute
+ * @return An integer containing success/failure for this action
+ */
+ TInt SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue );
+
+
+ /**
+ * Returns x-y or width-height attributes for Animation element
+ *
+ * since S60 3.2
+ * @param
+ * @return An integer containing success/failure for this action
+ */
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+
+ /**
+ * Sets x-y or width-height attributes for Animatione element
+ *
+ * since S60 3.2
+ * @param
+ * @return An integer containing success/failure for this action
+ */
+ TInt SetAttributeFloatL( const TInt aNameId,
+ TFloatFixPt aValue );
+
+
+ /**
+ * ReceiveEventL: This function will be called whenever the registered
+ * event was happened.
+ *
+ * @since Series 60 3.1
+ * @param MSvgEvent* aEvent
+ * @return TBool ETrue if redraw is needed
+ */
+ TBool ReceiveEventL( MSvgEvent* aEvent );
+
+ /**
+ * Resets the animation element,starts from initial position
+ *
+ * since S60 3.2
+ * @param none
+ * @return none
+ */
+ void ResetAnimationL();
+
+ /**
+ * Need method description
+ *
+ * since S60 3.2
+ * @param MSvgEvent
+ * @return none
+ */
+ void Reset( MSvgEvent* aEvent );
+
+ /**
+ * Calls AnimProcL of animation element
+ *
+ * since S60 3.2
+ * @param
+ * @return TBool ETrue if child svg document is there
+ */
+ TBool DoAnimProcL(MSvgEvent* aEvent);
+
+
+ /**
+ * Return wether an svg element is displayable, such as <rect>, <circle>, or
+ * an abstract element, such as <g>, <animate>.
+ *
+ * since S60 3.2
+ * @param None
+ * @return ETrue if element is viewable.
+ */
+ TBool IsViewable();
+
+ /**
+ *
+ * since S60 3.2
+ * @param TBool
+ * @return none
+ */
+ void Print( TBool aIsEncodeOn );
+
+ /**
+ * Draws the child svg in the animation element
+ * since S60 3.2
+ * @param GraphicsContext and SVGElement
+ * @return ETrue if draw is successful else EFalse
+ */
+ TBool DrawL( CGfx2dGc* aGc, CSvgElementImpl* aElement );
+
+ /**
+ * Sets the initial CTM on animation element
+ * since S60 3.2
+ * @param none
+ * @return none
+ */
+ void SetInitialCTM();
+
+ /**
+ * Accessor function for obtaining the child SVG document
+ * @since S60 3.2
+ * @param none.
+ * @return CSvgDocumentImpl* Pointer to the document else NULL
+ */
+ CSvgDocumentImpl* GetChildDocument();
+
+ /**
+ *
+ * since S60 3.2
+ * @param align variabel to indicate alignment method, aMeetSlice which
+ is for new viewport.
+ * @return none
+ */
+ void SetPreserveAspectRatioL( TSvgPreserveAspectAlignType aAlign,
+ TSvgMeetOrSliceType aMeetSlice );
+
+ /**
+ * Sets the width of animation element
+ * since S60 3.2
+ * @param aValue a Width attribute value from Svg file
+ * @return
+ */
+ void SetWidth(TReal32 aValue);
+
+ /**
+ * Sets the height of animation element
+ * since S60 3.2
+ * @param aValue a Height attribute value from Svg file
+ * @return none
+ */
+ void SetHeight(TReal32 aValue);
+
+ /**
+ * prepares child svg document
+ * since S60 3.2
+ * @param aFileHandle for child svg
+ * @return MSvgError object
+ */
+ MSvgError* PrepareDomChildSvg( RFile& aFileHandle, TInt& aHandle, TInt aEngine);
+
+ /**
+ * prepares child svg document
+ * @param aFileHandle for child svg
+ * @return MSvgError object
+ */
+ MSvgError* PrepareDomChildSvg (const TDesC& aFileName,TInt& aHandle, TInt aEngine);
+
+ /**
+ * prepares child svg document
+ * since S60 3.2
+ * @param aFileHandle for child svg
+ * @return MSvgError object
+ */
+ MSvgError* PrepareDomChildSvg(const TDesC8& aByteData, TInt& aHandle, TInt aEngine );
+
+ public: // From CSvgMediaElementBase
+ /**
+ * From MSvgTimedEntityInterface
+ * The parent time container provides the timing clock to
+ * the timed entity (audio, video, animation, document)
+ * using this routine.
+ * @since Series 3.2
+ * @param aTick Current tick information
+ * @return none.
+ */
+ void ParentTimeContainerTick( TSvgTick aTick );
+
+ /**
+ * From MSvgTimedEntityInterface
+ * When the timed entity acts as timing master in the time container,
+ * the time container gets the timed entity clock using this method
+ * and feeds to rest of timed entities.
+ * @since Series 3.2
+ * @param aEntityCurTime Current Entity Time in msecs.
+ * @return none.
+ */
+ void GetEntityCurrentTime( TUint32&
+ aEntityCurTime );
+
+ /**
+ * From MSvgTimedEntityInterface
+ * If some other element is resolved as syncMaster in the time container group,
+ * this element can not act as sync master.
+ * @since Series 3.2
+ * @param aSyncMasterStatus Indicates whether the element is currrently
+ * Sync Master.
+ * @return none.
+ */
+ void SetCurSyncMasterStatus( TBool aSyncMasterStatus );
+
+ /**
+ * From MSvgTimedEntityInterface
+ * Check if timed entity can provide timing ticks to rest of time
+ * container elements. This behavior could change dynamically.
+ * For example, if audio clip is over, the audio element can't generate
+ * ticks for others.
+ * @since Series 3.2
+ * @param none.
+ * @return TBool True if can generate timing tick.
+ */
+ TBool CanGenerateTick();
+
+ /**
+ * From MSvgTimedEntityInterface
+ * If the timed entity needs to be in sync with the time container and
+ * it has slipped beyond the sync tolerance limit, the method is called to
+ * bring the element in sync with the time container.
+ * @since Series 3.2
+ * @param aSynctime Time for resync in msecs.
+ * @return none.
+ */
+ void ResyncTimedEntity( TUint32 aSynctime );
+
+ /**
+ * From CSvgMediaElementBase
+ * This would be used for pausing the timed entity while other locked
+ * timed entities get loaded.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void PauseTimedEntity();
+
+ /**
+ * From CSvgMediaElementBase
+ * This would be used for resuming the timed entity once all locked
+ * timed entities get loaded.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void ResumeTimedEntity();
+
+ /**
+ * From CSvgMediaElementBase
+ * This would be used for stoping the timed entity once all locked
+ * timed entities get loaded.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void StopTimedEntity();
+
+
+ /*
+ From MSvgTimedEntityInterface
+ Would return the type of object
+ @param none
+ @return type of object
+ */
+ TSvgObjectType ObjectType();
+
+ /*
+ From MSvgTimedEntityInterface
+ Return CSvgTimeContainer object
+ @param none
+ @return CSvgTimeContainer
+ */
+ CSvgTimeContainer* GetChildTimeContainer();
+
+ private: // From MSvgTimeContainerObserver
+ /**
+ * From MSvgTimeContainerObserver
+ * Indicates that all locked elements in child container are ready
+ * to render.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void TimeContainerReady();
+
+ /**
+ * From MSvgTimeContainerObserver
+ * Indicates that at least one locked element in child container
+ * is not ready to render.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void TimeContainerNotReady();
+
+ private:
+ // From CSvgAnimationBase
+
+ /**
+ *
+ *
+ *
+ * @since S60 3.2
+ * @param MSvgTimerEvent.
+ * @return TBool.
+ */
+ virtual TBool AnimProcL( MSvgTimerEvent* aEvent );
+
+ /**
+ * Creates key times and set animation time according to calcmode
+ * Sets first begin time, adds target element to event listener
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ virtual void InitAnimationL();
+
+ /**
+ *
+ * @since S60 3.2
+ * @param MSvgPreserveAspectRatio.
+ * @return none.
+ */
+ void GetPreserveAspectRatio( MSvgPreserveAspectRatio*& aAspectRatio );
+
+ /**
+ * X co-ordinate is returned
+ *
+ * since S60 3.2
+ * @param none
+ * @return X position of Animation element
+ */
+
+ TFloatFixPt X();
+
+
+ /**
+ * Y co-ordinate is returned
+ *
+ * since S60 3.2
+ * @param none
+ * @return Y position of Animation element
+ */
+ TFloatFixPt Y();
+
+
+ /**
+ * Width is returned
+ *
+ * since S60 3.2
+ * @param none
+ * @return Width of Animation element
+ */
+ TFloatFixPt Width();
+
+
+ /**
+ * Height is returned
+ *
+ * since S60 3.2
+ * @param none
+ * @return Height of Animation element
+ */
+ TFloatFixPt Height();
+
+
+ /**
+ *
+ *
+ * since S60 3.2
+ * @param TGfxRectangle2D
+ * @return
+ */
+ void GetBBox( TGfxRectangle2D& aBbox );
+
+ /**
+ *
+ *
+ * since S60 3.2
+ * @param TSvgFourPointRect
+ * @return none
+ */
+ void GetFourPointBBox(TSvgFourPointRect& aFourPointBbox);
+
+
+ /**
+ *
+ *
+ * since S60 3.2
+ * @param none
+ * @return
+ */
+ void GetUnscaledBBox( TGfxRectangle2D& aBbox );
+
+
+ /**
+ * Notified when the mouse pointer enters a visible svg element.
+ *
+ * since S60 3.2
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool MouseEntered( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Notified when the mouse pointer exits a visible svg element.
+ *
+ * since S60 3.2
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool MouseExited( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+
+ /**
+ * Notified when the mouse pointer has already entered a visible
+ * svg element and just moved but remains inside its bounding-box.
+ *
+ * since S60 3.2
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool MouseMoved( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Notified when the mouse pointer is pressed down on visible svg element.
+ *
+ * since S60 3.2
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool MousePressed( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Notified when the mouse pointer is released on on visible svg element.
+ *
+ * since S60 3.2
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ virtual TBool MouseReleased( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+
+ /**
+ * updates the CTM
+ *
+ * since S60 3.2
+ * @param none
+ * @return none
+ */
+ virtual void UpdateCTM();
+
+
+ /**
+ *
+ *
+ * since S60 3.2
+ * @param none
+ * @return none
+ */
+ void DeactivateAnimation();
+
+ protected:
+
+ /**
+ * does a deep copy of mediaanimation element
+ *
+ * since S60 3.2
+ * @param CSvgMediaAnimationElementImpl element
+ * @return none
+ */
+ void CopyL( CSvgMediaAnimationElementImpl* aDestElement );
+ private:
+ // DRM related
+ TBool iDrmEnabled;
+
+ // Thumbnail mode
+ TBool iIsThumbNailMode;
+
+ // MSvgLoadingListener list
+ RPointerArray<MSvgLoadingListener> iSvgLoadingListeners;
+
+ // Keep track of elements currently having mouse pointer inside
+ // to report mouse-exit when it is moved.
+ RPointerArray<CSvgElementImpl> iSvgMouseEnteredElements;
+
+ // Flag to indicate Load or PrepareDom call.
+ TBool iIsLoadingRequest;
+
+ TBool iMouseDownFlag;
+
+ TBool iFileIsLoaded; //checks for parsing error
+
+
+
+ TFloatFixPt iScale;
+ CSvgFitToViewBoxImpl* iViewBoxImpl;
+ TFloatFixPt iX;
+ TFloatFixPt iY;
+ TBool iIsFocusable; // To be implemented
+ // TBool iInitialVisibility; // InitialVisibility of the Animatin element
+ // Referenced (target) element
+ CSvgElementImpl* iReferencedElement;
+
+
+ CSvgErrorImpl* iSvgError; // error object
+ CSvgDocumentImpl* iNewDocument; // Document pointer for child svg
+ TGfxAffineTransform iOriginalRootTr; // For Transform
+ TBool iIsOriginalRootTrSet;
+ TFloatFixPt iWidth;
+ TFloatFixPt iHeight;
+
+ enum TAnimationState // State of animation element
+ {
+ EPlayerStateIdle,
+ EPlayerStatePlaying,
+ EPlayerStatePaused,
+ EPlayerStateStop,
+ EPlayerProhibit
+ };
+
+ TAnimationState iAnimationStatus;
+
+ enum TAnimationVisible // Visibility State of animation element
+ {
+ EAnimationNotVisible,
+ EAnimationInitialised,
+ EAnimationVisible
+ };
+
+ TAnimationVisible iInitialVisibility;
+ // Save the tick at the time animation starts
+ TSvgTick iBeginTick;
+ // Indicates whether time container issued a pause command
+ TBool iIsSyncPauseIssued;
+ TBool iDurMediaTime; // if duration is media
+ HBufC* iChildSvgName ;
+
+
+ };
+
+#endif // C_SVGMediaAnimationElementImpl_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGMediaElementBase.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,378 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVGT Media Elements common implementation
+*
+*/
+
+
+
+#ifndef CSVGMEDIAELEMENTBASE_H
+#define CSVGMEDIAELEMENTBASE_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32def.h>
+#include "SVGAnimationBase.h"
+#include "SVGTimedEntityInterface.h"
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// CLASS DECLARATION
+
+/**
+* Base class for media elements.
+* The base class providing the run time synchronization property handling
+* functionality. The media elements like audio, video, animation derive
+* from this class.
+*
+* @lib SVGTEngine.lib
+* @since S60 3.2
+*/
+NONSHARABLE_CLASS( CSvgMediaElementBase ) :
+ public CSvgAnimationBase,
+ public MSvgTimedEntityInterface
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSvgMediaElementBase();
+
+ public: // New functions
+
+ /**
+ * Set the Synchronised behaviour for the media element
+ * @since S60 3.2
+ * @param aValue "canSlip" | "locked" | "independent" | "default"
+ * @return none.
+ */
+ virtual void SetSyncBehavior( const TDesC& aValue );
+
+ /**
+ * Set the Synchronised Tolerance for the media element
+ * @since S60 3.2
+ * @param aValue Clock-value | "default"
+ * @return none.
+ */
+ virtual void SetSyncTolerance( const TDesC& aValue );
+
+ /**
+ * Set the media element as Synchronised Master
+ * @since S60 3.2
+ * @param aValue "true" | "false"
+ * @return none.
+ */
+ virtual void SetSyncMaster( const TDesC& aValue );
+
+ /**
+ * Set the Synchronised behaviour for the media element
+ * @since S60 3.2
+ * @param aValue canSlip | locked | independent | default
+ * @return none.
+ */
+ virtual void SetSyncBehavior(
+ const TSvgSyncBehaviour aValue );
+
+ /**
+ * Set the Synchronised Tolerance for the media element
+ * @since S60 3.2
+ * @param aValue Clock-value
+ * aUseDefault True/False indicates use default from
+ * parent svg element.
+ * @return none.
+ */
+ virtual void SetSyncTolerance( const TInt32 aValue ,
+ const TBool aUseDefault);
+
+ /**
+ * Set the media element as Synchronised Master
+ * @since S60 3.2
+ * @param aValue true | false
+ * @return none.
+ */
+ virtual void SetSyncMaster( const TBool aValue );
+
+ /**
+ * Accessor for the Synchronised behaviour for the media element
+ * @since S60 3.2
+ * @param none.
+ * @return TSvgSyncBehavior "canSlip" | "locked" | "independent" | "default"
+ */
+ virtual TSvgSyncBehaviour SyncBehavior();
+
+ /**
+ * Accessor for the Synchronised Tolerance for the media element
+ * @since S60 3.2
+ * @param none.
+ * @return Clock-value.
+ */
+ virtual TInt32 SyncTolerance();
+
+ /**
+ * Accessor for the media element is a Synchronised Master
+ * @since S60 3.2
+ * @param none.
+ * @return TBool "true" | "false"
+ */
+ virtual TBool SyncMaster();
+
+ /**
+ * ?member_description.
+ * @since Series ?XX ?SeriesXX_version
+ * @param ?arg1 ?description
+ * @return ?description
+ */
+ //?type ?member_function( ?type ?arg1 );
+
+ public: // Functions from base classes
+
+ /**
+ * From CSvgAnimationBase Called by Contenthandler/decoder to set
+ * attributes
+ * @since S60 3.2
+ * @param aName Name of attribute
+ * @param aValue Value of attribute
+ * @return TInt Error Code
+ */
+ TInt SetAttributeL( const TDesC& aName, const TDesC& aValue );
+
+
+ protected: // New functions
+
+ /**
+ * C++ default constructor.
+ */
+ CSvgMediaElementBase( CSvgDocumentImpl* aDoc );
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL( const TUint8 aElemID );
+
+ /**
+ * ?member_description.
+ * @since Series ?XX ?SeriesXX_version
+ * @param ?arg1 ?description
+ * @return ?description
+ */
+ //?type ?member_function( ?type ?arg1 );
+
+ protected: // Functions from base classes
+ /**
+ * From MSvgTimedEntityInterface
+ * The parent time container provides the timing clock to
+ * the timed entity (audio, video, animation, document)
+ * using this routine.
+ * @since Series 3.2
+ * @param aTick Current tick information
+ * @return none.
+ */
+ void ParentTimeContainerTick( TSvgTick aTick );
+
+
+ public:
+
+ /**
+ * From MSvgTimedEntityInterface
+ * Returns the sync behavior of the entity.
+ * @since Series 3.2
+ * @param none.
+ * @return TSvgSyncBehaviour Element's Sync Behaviour.
+ */
+ TSvgSyncBehaviour GetEntitySyncBehavior();
+ /**
+ * From MSvgTimedEntityInterface
+ * Returns the configured sync master value(as per DOM tree) as specified
+ * in the SVG content.
+ * @since Series 3.2
+ * @param aIsSyncMaster Indicates whether the element is configured as
+ * Sync Master.
+ * @return none.
+ */
+ void GetCnfSyncMasterStatus( TBool& aIsSyncMaster );
+ /**
+ * From MSvgTimedEntityInterface
+ * Check if timed entity can provide timing ticks to rest of time
+ * container elements. This behavior could change dynamically.
+ * For example, if audio clip is over, the audio element can't generate
+ * ticks for others.
+ * @since Series 3.2
+ * @param none.
+ * @return TBool True if can generate timing tick.
+ */
+ TBool CanGenerateTick();
+
+
+ protected:
+
+ /**
+ * From MSvgTimedEntityInterface
+ * When the timed entity acts as timing master in the time container,
+ * the time container gets the timed entity clock using this method
+ * and feeds to rest of timed entities.
+ * @since Series 3.2
+ * @param aEntityCurTime Current Entity Time in msecs.
+ * @return none.
+ */
+ void GetEntityCurrentTime( TUint32&
+ aEntityCurTime );
+
+
+
+ /**
+ * From MSvgTimedEntityInterface
+ * Check if timed entity is going to act as timing master in the
+ * time container. This behavior could change dynamically.
+ * @since Series 3.2
+ * @param aIsSyncMaster Indicates whether the element is currrently Sync Master.
+ * @return none.
+ */
+ void GetCurSyncMasterStatus( TBool& isSyncMaster );
+
+ /**
+ * From MSvgTimedEntityInterface
+ * If some other element is resolved as syncMaster in the time container group,
+ * this element can not act as sync master.
+ * @since Series 3.2
+ * @param aSyncMasterStatus Indicates whether the element is currrently
+ * Sync Master.
+ * @return none.
+ */
+ void SetCurSyncMasterStatus( TBool aSyncMasterStatus );
+
+ /**
+ * From MSvgTimedEntityInterface
+ * Check if timed entity can use its parent's tick. Usually only the
+ * parent document should return true for this function.
+ * All other elements return false
+ * @since Series 3.2
+ * @param none.
+ * @return TBool True if can use parent's timing tick.
+ */
+ TBool CanUseParentTick();
+
+ /**
+ * From MSvgTimedEntityInterface
+ * If the timed entity needs to be in sync with the time container and
+ * it has slipped beyond the sync tolerance limit, the method is called to
+ * bring the element in sync with the time container.
+ * @since Series 3.2
+ * @param aSynctime Time for resync in msecs.
+ * @return none.
+ */
+ void ResyncTimedEntity( TUint32 aSynctime );
+
+ /**
+ * From MSvgTimedEntityInterface
+ * This would be used for pausing the timed entity while other locked
+ * timed entities get loaded.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void PauseTimedEntity();
+
+ /**
+ * From MSvgTimedEntityInterface
+ * This would be used for resuming the timed entity once all locked
+ * timed entities get loaded.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void ResumeTimedEntity();
+
+ /**
+ * From MSvgTimedEntityInterface
+ * This would be used for stopping the timed entity.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void StopTimedEntity();
+
+
+ /*
+ From MSvgTimedEntityInterface
+ Would return the type of object
+ @param none
+ @return type of object
+ */
+ TSvgObjectType ObjectType();
+
+
+ CSvgTimeContainer* GetChildTimeContainer();
+
+ /**
+ * From ?base_class ?member_description
+ */
+ //?type ?member_function();
+
+ private:
+
+
+ // Prohibit copy constructor if not deriving from CBase.
+ // CSvgMediaElementBase( const CSvgMediaElementBase& );
+ // Prohibit assigment operator if not deriving from CBase.
+ // CSvgMediaElementBase& operator=( const CSvgMediaElementBase& );
+
+ public: // Data
+ // ?one_line_short_description_of_data
+ //?data_declaration;
+
+ protected: // Data
+ // ?one_line_short_description_of_data
+ //?data_declaration;
+ // The media element's sync behavior with respect to its parent
+ // time container.
+ TSvgSyncBehaviour iSyncBehavior;
+ // Boolean indicating whether the media element is configured
+ // (as per DOM tree) as a Sync Master
+ TBool iSyncMasterConfig;
+ // Boolean indicating whether media element is currently the Sync Master
+ // in the time container
+ TBool iSyncMasterCurrent;
+ // Sync Tolerance configured for the media element (in msecs)
+ TUint32 iSyncTolerance;
+ // how much out-of-sync is this media element (in msecs)
+ TUint32 iSyncOffset;
+
+
+ private: // Data
+ // ?one_line_short_description_of_data
+ //?data_declaration;
+
+ // Reserved pointer for future extension
+ //TAny* iReserved;
+ };
+
+#endif // CSVGMEDIAELEMENTBASE_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGMemoryManager.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,166 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __MEMORYMANAGER_H__
+#define __MEMORYMANAGER_H__
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include "GfxFloatFixPt.h"
+
+//forward declerations
+class CCssValue;
+
+class CPaintCssValueImpl;
+class CFloatCssValueImpl;
+class CIntCssValueImpl;
+class CStrCssValueImpl;
+class CVectorCssValueImpl;
+class CClrCssValueImpl;
+
+class CSvgElementImpl;
+
+class CSvgMemoryManager : public CBase
+ {
+ public:
+
+ static CSvgMemoryManager* NewL();
+
+ static CSvgMemoryManager* NewLC();
+
+ CSvgMemoryManager();
+
+ ~CSvgMemoryManager();
+
+ void ConstructL();
+
+ void Print();
+
+ //this really shouldnt require the CSvgElementImpl to be passed to it
+ //but our paint class is so messed up
+ CCssValue* CloneCssValueL(CCssValue* aValue);
+
+//----------------------------------------------------------
+// CPaintCssValueImpl
+//----------------------------------------------------------
+ public:
+ CPaintCssValueImpl* GetCssPaintObjectL( CSvgElementImpl* aElementImpl = NULL );
+ CPaintCssValueImpl* GetCssPaintObjectL( const TDesC& aValue, CSvgElementImpl* aElementImpl );
+
+ private:
+ void AllocateCssPaintBlockL( );
+
+ //each of the pointers in this contains a block of #granularity Paints
+ RPointerArray<CPaintCssValueImpl> iCPaintCssValueImplArrays;
+
+ CPaintCssValueImpl* iCPaintCssValueImplArray;
+ TInt iCurrentPaintObjectIndex;
+ static const TUint KCssPaintBlockSize;
+
+//----------------------------------------------------------
+// CFloatCssValueImpl
+//----------------------------------------------------------
+ public:
+ CFloatCssValueImpl* GetCssFloatObjectL( float aFloat = 0.0 );
+ CFloatCssValueImpl* GetCssFloatObjectL( CFloatCssValueImpl* aFloatValue );
+ CFloatCssValueImpl* GetCssFloatObjectL( const TDesC& aValueString );
+
+ private:
+ void AllocateCssFloatBlockL( );
+
+ //each of the pointers in this contains a block of #granularity Floats
+ RPointerArray<CFloatCssValueImpl> iCFloatCssValueImplArrays;
+
+ CFloatCssValueImpl* iCFloatCssValueImplArray;
+ TInt iCurrentFloatObjectIndex;
+ static const TUint KCssFloatBlockSize;
+
+//----------------------------------------------------------
+// CClrCssValueImpl
+//----------------------------------------------------------
+ public:
+ CClrCssValueImpl* GetCssClrObjectL( );
+ CClrCssValueImpl* GetCssClrObjectL( const TDesC& aValueString );
+
+ private:
+ void AllocateCssClrBlockL( );
+
+ //each of the pointers in this contains a block of #granularity Clrs
+ RPointerArray<CClrCssValueImpl> iCClrCssValueImplArrays;
+
+ CClrCssValueImpl* iCClrCssValueImplArray;
+ TInt iCurrentClrObjectIndex;
+ static const TUint KCssClrBlockSize;
+
+//----------------------------------------------------------
+// CIntCssValueImpl
+//----------------------------------------------------------
+ public:
+ CIntCssValueImpl* GetCssIntObjectL( TInt aInitValue = 0 );
+ CIntCssValueImpl* GetCssIntObjectL( const TDesC& aValueString );
+ CIntCssValueImpl* GetCssIntObjectL( CIntCssValueImpl* aIntValue );
+
+ private:
+ void AllocateCssIntBlockL( );
+
+ //each of the pointers in this contains a block of #granularity Ints
+ RPointerArray<CIntCssValueImpl> iCIntCssValueImplArrays;
+
+ CIntCssValueImpl* iCIntCssValueImplArray;
+ TInt iCurrentIntObjectIndex;
+ static const TUint KCssIntBlockSize;
+
+//----------------------------------------------------------
+// CStrCssValueImpl
+//----------------------------------------------------------
+ public:
+ CStrCssValueImpl* GetCssStrObjectL( const TDesC& aValueString );
+
+ private:
+ void AllocateCssStrBlockL( );
+
+ //each of the pointers in this contains a block of #granularity Strs
+ RPointerArray<CStrCssValueImpl> iCStrCssValueImplArrays;
+
+ CStrCssValueImpl* iCStrCssValueImplArray;
+ TInt iCurrentStrObjectIndex;
+ static const TUint KCssStrBlockSize;
+
+//----------------------------------------------------------
+// CVectorCssValueImpl
+//----------------------------------------------------------
+ public:
+ CVectorCssValueImpl* GetCssVectorObjectL( const TDesC& aValueString );
+ CVectorCssValueImpl* GetCssVectorObjectL( CArrayFix<TFloatFixPt>* aValue );
+
+ private:
+ void AllocateCssVectorBlockL( );
+
+ //each of the pointers in this contains a block of #granularity Vector
+ RPointerArray<CVectorCssValueImpl> iCVectorCssValueImplArrays;
+
+ CVectorCssValueImpl* iCVectorCssValueImplArray;
+ TInt iCurrentVectorObjectIndex;
+ static const TUint KCssVectorBlockSize;
+
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGMetadataElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,157 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGMETADATAELEMENTIMPL_
+#define _INC_CSVGMETADATAELEMENTIMPL_
+
+#include "SVGElementImpl.h"
+#include "GfxFloatFixPt.h"
+
+class CSvgDocumentImpl;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgMetadataElementImpl : public CSvgElementImpl
+ {
+ public:
+
+ // Constructor/deconstructor
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgMetadataElementImpl* NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgMetadataElementImpl* NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgMetadataElementImpl();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgElementImpl* SvgElementImpl();
+
+ // From MXmlElement API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+ TInt SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue );
+
+ TInt GetAttributeDes( const TInt aNameId, TPtrC16& aValue );
+
+ // From CSvgElementImpl
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ void CopyL( CSvgMetadataElementImpl* aDestElement );
+
+ void Print( TBool aIsEncodeOn );
+
+ void SetTextL( const TDesC& aText );
+
+ private:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgMetadataElementImpl( CSvgDocumentImpl* aDoc );
+
+
+
+
+ HBufC* iText;
+
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGMissingGlyphElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,221 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGMISSINGGLYPHELEMENTIMPL_
+#define _INC_CSVGMISSINGGLYPHELEMENTIMPL_
+
+#include "SVGElementImpl.h"
+#include "GfxFloatFixPt.h"
+
+
+
+#ifdef SVG_FONTS_INCLUDE
+
+class CSvgDocumentImpl;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgMissingGlyphElementImpl : public CSvgElementImpl
+ {
+ public:
+
+ // Constructor/deconstructor
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgMissingGlyphElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgMissingGlyphElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ private:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgMissingGlyphElementImpl();
+
+ // From SVG DOM:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt GetHorzAdvX();
+
+ // SVG Implementation:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetPath( const TDesC& aPath );
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeFloatL( const TInt aNameId, const TFloatFixPt aValue );
+
+ // From MXmlElement API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+ // From MXmlElementOpt API
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributePath( const TInt aNameId,
+ CGfxGeneralPath*& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributePathL( const TInt aNameId,
+ CGfxGeneralPath* aValue );
+
+ TInt SetAttributePathRef( const TInt aNameId,
+ CGfxGeneralPath*& aValue );
+
+ CGfxGeneralPath* GetPathAttribute(TInt aAttributeId);
+ void SetPathAttribute(TInt aAttributeId, CGfxGeneralPath* aPathHandle);
+
+ void Print( TBool aIsEncodeOn );
+
+ private:
+
+ TFloatFixPt iHorzAdvX;
+
+ // TInt16 iPathLength;
+
+ CGfxGeneralPath* iShape;
+
+
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgMissingGlyphElementImpl( CSvgDocumentImpl* aDoc );
+ };
+
+#endif /* SVG_FONTS_INCLUDE */
+
+#endif /* #ifndef _INC_CSVGMISSINGGLYPHElementIMPL_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGMpathElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,185 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_CSVGMPATHELEMENTIMPL__
+#define __INC_CSVGMPATHELEMENTIMPL__
+
+#include "SVGElementImpl.h"
+
+
+
+class CGfxGeneralMpath;
+class CSvgDocumentImpl;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgMpathElementImpl : public CSvgElementImpl
+ {
+ public:
+
+ // Constructor/deconstructor
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgMpathElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgMpathElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ private:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ ~CSvgMpathElementImpl();
+
+ // From MXmlElement API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+ // From MXmlElementOpt API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributePath( const TInt aNameId,
+ CGfxGeneralPath*& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributePathL( const TInt aNameId,
+ CGfxGeneralPath* aValue );
+
+ void SetAttributePathByIdL(const TDesC& aId);
+
+ /**
+ * Return wether an svg element is displayable, such as <rect>, <circle>, or
+ * an abstract element, such as <g>, <animate>.
+ *
+ * @since 1.0
+ * @param None
+ * @return ETrue if element is viewable.
+ */
+ TBool IsViewable() { return ETrue; }
+
+ private:
+
+ CGfxGeneralPath* iShape;
+ HBufC* iParsedHref;
+ TBool iNeedTarget;
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgMpathElementImpl( CSvgDocumentImpl* aDoc );
+
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ void Print( TBool aIsEncodeOn );
+
+ protected:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void CopyL( CSvgMpathElementImpl* aDestElement );
+
+ };
+
+#endif /* _INC_CSVGMPATHELEMENT_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGPaintCssValueImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_CPAINTCSSVALUEIMPL__
+#define __INC_CPAINTCSSVALUEIMPL__
+
+
+#include "SVGCssValue.h"
+#include "SVGElementImpl.h"
+
+#include "SVGMemoryManager.h"
+
+class MGfxPaint;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+
+class CPaintCssValueImpl : public CCssValue
+
+ {
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ ~CPaintCssValueImpl();
+
+
+ CPaintCssValueImpl( );
+
+
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetValueL( const TDesC& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetValueL( const TInt& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MGfxPaint* Value();
+
+ void GetColorFromSolidColorElement(CSvgElementImpl* aReferencedElement);
+
+ //void SetL( CPaintCssValueImpl* aValue );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+ TInt CloneRGBValueL(const TInt& aValue);
+
+
+ void SetUrlflag();
+ TBool GetUrlflag();
+
+ void SetUrlIdL(const TDesC& aValue);
+ HBufC* GetUrlId();
+
+
+ TBool IsEqual(CCssValue* aValue);
+ TBool IsDefaultSet();
+
+ void SetElement(CSvgElementImpl* aElement);
+ CSvgElementImpl* GetElement();
+
+ void Print();
+
+ //this data should all be private
+ HBufC* iUrlId;
+ MGfxPaint* iValue;
+
+ //For Gradient Support
+ TBool iUrlFlag;
+ TInt32 iValueType; //0 for TGfxColor
+ //1 for TLinearGradientPaint
+ //2 for TRadialGradientPaint
+
+
+ CSvgElementImpl* iSvgElementImpl;
+ TBool iDefaultSet;
+
+ private: // Data
+ // Indicates whether the iValue field is owned by CSvgPaintCssValueImpl
+ TBool iIsValueOwned;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ //void ConstructL( const TDesC& aValue, CSvgElementImpl* aSvgElementImpl );
+
+
+ //void ConstructL( CSvgElementImpl* aSvgElementImpl );
+
+ };
+
+#endif /* __INC_CPAINTCSSVALUEIMPL__ */
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGPathDataParser.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __TSVGPATHDATAPARSER_H__
+#define __TSVGPATHDATAPARSER_H__
+
+#include <e32std.h>
+
+#include "GfxFloatFixPt.h"
+#include "GfxGeneralPath.h"
+
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class TSvgPathDataParser
+ {
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static void ParsePathData( const TDesC& aData,
+ CGfxGeneralPath* aPath );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static void ParsePointDataL( const TDesC& aData,
+ CGfxGeneralPath* aPath );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static TFloatFixPt PathLengthL( CGfxGeneralPath* aPath );
+
+ private:
+ /**
+ * Leavable ParsePathData method.
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+ static void ParsePathDataL( const TDesC& aData,
+ CGfxGeneralPath* aPath );
+
+
+ };
+
+
+#endif /* __TSvgPathDataParser_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGPathElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,216 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_CSVGPATHELEMENTIMPL__
+#define __INC_CSVGPATHELEMENTIMPL__
+
+#include "SVGElementImpl.h"
+#include "GfxGeneralPath.h"
+
+class CSvgDocumentImpl;
+
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgPathElementImpl : public CSvgElementImpl
+ {
+ public:
+
+ // Constructor/deconstructor
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgPathElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgPathElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ private:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ ~CSvgPathElementImpl();
+
+ // From MXmlElement API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetBBox( TGfxRectangle2D& aBbox );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetUnscaledBBox( TGfxRectangle2D& /*aBbox*/ );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributePath( const TInt aNameId,
+ CGfxGeneralPath*& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributePathL( const TInt aNameId,
+ CGfxGeneralPath* aValue );
+
+ TInt SetAttributePathRef( const TInt aNameId,
+ CGfxGeneralPath*& aValue );
+ CGfxGeneralPath* GetPathAttribute(TInt aAttributeId);
+ void SetPathAttribute(TInt aAttributeId, CGfxGeneralPath* aPathHandle);
+
+ /**
+ * Return wether an svg element is displayable, such as <rect>, <circle>, or
+ * an abstract element, such as <g>, <animate>.
+ *
+ * @since 1.0
+ * @param None
+ * @return ETrue if element is viewable.
+ */
+ TBool IsViewable() { return ETrue; }
+
+ CGfxGeneralPath* iShape;
+
+ private:
+
+
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgPathElementImpl( CSvgDocumentImpl* aDoc );
+
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ void Print( TBool aIsEncodeOn );
+
+ protected:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void CopyL( CSvgPathElementImpl* aDestElement );
+
+ };
+
+#endif /* _INC_CSVGPATHELEMENT_3C61A657011D_INCLUDED */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGPointLexer.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+// TSvgPointLexer:
+// Parse a text string and returns a set of coordinates and the last character
+// before the coordinates. e.g. " M100, 30.2" -> 'M', 100.0 and 30.2
+//
+#ifndef __TSVGPOINTLEXER_H__
+#define __TSVGPOINTLEXER_H__
+
+#include <e32std.h>
+#include "GfxFloatFixPt.h"
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class TSvgPointLexer
+ {
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TSvgPointLexer( const TDesC& aDes );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt32 GetNextPoint( TChar& aCommand, TFloatFixPt& aX, TFloatFixPt& aY );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt32 GetNext( TChar& aCommand, TFloatFixPt& aVal );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool GetNextWithNumOfPoints( TFloatFixPt *aVal, TInt NoOfPoints);
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool GetCommand(TUint8 &a);
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool IsDone()
+ {
+ // skip any space to see that this is the last character. ADDED BY RAVINDER
+ iLex.SkipSpace();
+ // END OF ADDITION.
+ return iLex.Eos();
+ };
+
+ void Cleanup();
+ private:
+ TLex iLex;
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TChar SkipUntilNum();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool SkipToNumEndWithoutLex(TReal32 &aNum);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool SkipToNumEnd();
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool iNegativeNumber;
+ TUint16 *iData;
+ TUint16 *iDataEnd;
+
+ HBufC* iDataCopy;
+ };
+
+#endif // __TSvgPointLexer_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGPolylineElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,213 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_CSVGPOLYLINEELEMENTIMPL__
+#define __INC_CSVGPOLYLINEELEMENTIMPL__
+
+#include "SVGElementImpl.h"
+#include "GfxGeneralPath.h"
+
+
+
+class CSvgDocumentImpl;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgPolylineElementImpl : public CSvgElementImpl
+ {
+ public:
+
+ // Constructor/deconstructor
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgPolylineElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgPolylineElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ private:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgPolylineElementImpl();
+
+ // From MXmlElement API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetBBox( TGfxRectangle2D& aBbox );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetUnscaledBBox( TGfxRectangle2D& /*aBbox*/ );
+
+ // From MXmlElementOpt API
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributePath( const TInt aNameId,
+ CGfxGeneralPath*& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributePathL( const TInt aNameId,
+ CGfxGeneralPath* aValue );
+
+ TInt SetAttributePathRef( const TInt aNameId,
+ CGfxGeneralPath*& aValue );
+
+ /**
+ * Return wether an svg element is displayable, such as <rect>, <circle>, or
+ * an abstract element, such as <g>, <animate>.
+ *
+ * @since 1.0
+ * @param None
+ * @return ETrue if element is viewable.
+ */
+ TBool IsViewable() { return ETrue; }
+
+ private:
+
+ CGfxGeneralPath* iShape;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgPolylineElementImpl( CSvgDocumentImpl* aDoc );
+
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ void Print( TBool aIsEncodeOn );
+
+ protected:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void CopyL( CSvgPolylineElementImpl* aDestElement );
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGPresentationAttrsImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,389 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGPRESENTATIONATTRSIMPL_
+#define _INC_CSVGPRESENTATIONATTRSIMPL_
+
+#include "GfxColor.h"
+
+
+/**
+ * Class description
+ *
+ ***
+ *** THIS CLASS IS NO LONGER IN USE
+ ***
+ */
+class CSvgPresentationAttrsImpl : public CBase
+ {
+ private:
+ // 'fill'
+ TGfxColor aFill;
+
+ // 'stroke'
+ TGfxColor aStroke;
+
+ // 'stroke-width
+ TFixPt aStrokeWidth;
+
+ // 'visibility'
+ TInt8 aVisibility;
+
+ // 'color'
+ TGfxColor aColor;
+
+ // 'font-family'
+ // TText aFontFamily;
+
+ // 'font-size'
+ TInt8 aFontSize;
+
+ // 'font-style'
+ //TText aFontStyle;
+
+ // 'font-weight'
+ TInt8 aFontWeight;
+
+ // 'stroke-dasharray'
+ TInt8* aStrokeDasharray;
+
+ // 'display'
+ TInt16 aDisplay;
+
+ // 'fill-rule'
+ TInt8 aFillRule;
+
+ // 'stroke-linecap'
+ TInt8 aStrokeLinecap;
+
+ // 'stroke-linejoin'
+ TInt8 aStrokeLinejoin;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgPresentationAttrsImpl();
+
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgPresentationAttrsImpl* NewLC();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgPresentationAttrsImpl* NewL();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TGfxColor Fill();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetFill( TGfxColor );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TGfxColor Stroke();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetStroke( TGfxColor );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFixPt StrokeWidth();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetStrokeWidth( TFixPt );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt8 Visibility();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetVisibility( TInt8 );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TGfxColor Color();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetColor();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ //TPtr FontFamily();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ //void SetFontFamily(TPtr);
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt8 FontSize();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetFontSize();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt8 FontWeight();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetFontWeight();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ // TInt8* StrokeDasharray();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ // void SetStrokeDasharray(TInt8*);
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt16 Display();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetDisplay( TInt16 );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt8 FillRule();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetFillRule( TInt8 );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt8 StrokeLinecap();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetStrokeLinecap( TInt8 );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt8 StrokeLinejoin();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetStrokeLinejoin( TInt8 );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ ~CSvgPresentationAttrsImpl();
+ };
+
+#endif /* _INC_CSVGPRESENTATIONATTRSIMPL_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGPreserveAspectRatioImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_CSVGPRESERVEASPECTRATIOIMPL__
+#define __INC_CSVGPRESERVEASPECTRATIOIMPL__
+
+#include "SVGPreserveAspectRatio.h"
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgPreserveAspectRatioImpl : public CBase, public MSvgPreserveAspectRatio
+ {
+ public:
+
+ // Constructor/deconstructor
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgPreserveAspectRatioImpl* NewL();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgPreserveAspectRatioImpl* NewLC();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgPreserveAspectRatioImpl();
+
+ // From SVG DOM
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TSvgPreserveAspectAlignType GetAlign();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TSvgMeetOrSliceType GetMeetOrSlice();
+
+ // Class-specified
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetAlign( TSvgPreserveAspectAlignType aType );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetMeetOrSlice( TSvgMeetOrSliceType aType );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgPreserveAspectRatioImpl* CloneL();
+
+ private:
+
+ TSvgMeetOrSliceType iMeetOrSlice;
+
+ TSvgPreserveAspectAlignType iAlign;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgPreserveAspectRatioImpl();
+ };
+
+#endif /* #ifndef __INC_CSVGPRESERVEASPECTRATIOIMPL__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGRadialGradientElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#ifndef CSVGRADIALGRADIENTELEMENTIMPL_H
+#define CSVGRADIALGRADIENTELEMENTIMPL_H
+
+#include "SVGGradientElementImpl.h"
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgRadialGradientElementImpl : public CSvgGradientElementImpl
+ {
+ public:
+
+ // Constructor/deconstructor
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgRadialGradientElementImpl* NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MGfxPaint *PaintAttribute();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgRadialGradientElementImpl* NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgRadialGradientElementImpl();
+
+ // From SVG DOM
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue );
+
+ // From MXmlElement API
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName, const TDesC& aValue );
+
+ void Print( TBool aIsEncodeOn );
+
+ private:
+ TGfxRadialGradientPaint iGfxRadialPaint;
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgRadialGradientElementImpl( CSvgDocumentImpl* aDoc );
+ };
+
+#endif /* CSVGRADIALGRADIENTELEMENTIMPL_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGRectElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,278 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGRECTELEMENTIMPL_
+#define _INC_CSVGRECTELEMENTIMPL_
+
+#include "SVGElementImpl.h"
+#include "GfxFloatFixPt.h"
+#include "GfxRoundRectangle2D.h"
+
+
+
+class CSvgDocumentImpl;
+class TSvgFourPointRect;
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgRectElementImpl : public CSvgElementImpl
+ {
+ public:
+
+ // Constructor/deconstructor
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgRectElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgRectElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ private:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgRectElementImpl();
+
+ // From SVG DOM
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt X();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Y();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Width();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Height();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Rx();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Ry();
+
+ // SVG Implementation
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue );
+
+ // From MXmlElement API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetBBox( TGfxRectangle2D& aBbox );
+
+ void GetFourPointBBox( TSvgFourPointRect& aFourPointBBox);
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetUnscaledBBox( TGfxRectangle2D& /*aBbox*/ );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetRectValues(TFloatFixPt aX, TFloatFixPt aY, TFloatFixPt aWidth, TFloatFixPt aHeight);
+
+ /**
+ * Return wether an svg element is displayable, such as <rect>, <circle>, or
+ * an abstract element, such as <g>, <animate>.
+ *
+ * @since 1.0
+ * @param None
+ * @return ETrue if element is viewable.
+ */
+ TBool IsViewable() { return ETrue; }
+
+ private:
+
+ TGfxRoundRectangle2D iRectangle;
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgRectElementImpl( CSvgDocumentImpl* aDoc );
+
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ void Print( TBool aIsEncodeOn );
+
+ protected:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void CopyL( CSvgRectElementImpl* aDestElement );
+
+ };
+
+#endif /* _INC_CSVGLINEELEMENT_3C61A6080051_INCLUDED */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGRelToAbsPath.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __TSVGRELTOABSPATH_H__
+#define __TSVGRELTOABSPATH_H__
+
+#include <e32std.h>
+
+
+/**
+ * Class description
+ *
+ * Converts relative paths to absolute paths
+ *
+ */
+class TSvgRelToAbsPath
+ {
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static TInt GetFullPath( TParse& aParse,
+ const TText8* upath,
+ RFs& aSession,
+ TDes* aFileName );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static TInt GetFullFile( TFileName& aName,
+ const TText8* upath,
+ RFs& aSession );
+ };
+
+#endif // __TStringTokenizer_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGSchemaData.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,742 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#include <e32std.h>
+#include <bautils.h>
+#include <badesca.h>
+
+#include <fbs.h>
+#include <f32file.h>
+#include <s32file.h>
+
+
+
+#ifndef _INC_CSVGSCHEMADATA_
+#define _INC_CSVGSCHEMADATA_
+
+ /*Added for binay Bytedata identification*/
+ const TUint32 KBinaryFile = 66737868;
+ const TUint32 KBinaryFile2 = 66737869;
+ const TUint32 KBinaryFile3 = 66737870;
+
+ // Added for RGB & Float
+ const TUint32 KBinaryFile4 = 66737871;
+
+ const TUint16 KSvgOffset =25;
+
+ //AA: Length or number type: range is 0 to +max & set using SetAttributeFloatL
+ const TUint16 KAtrTextLength = 0 + KSvgOffset;
+ const TUint16 KAtrWidth = 1 + KSvgOffset;
+ const TUint16 KAtrHeight = 2 + KSvgOffset;
+ const TUint16 KAtrR = 3 + KSvgOffset ;
+
+
+
+ const TUint8 KSvgCoordAttrStartIndex = 4 + KSvgOffset;
+ const TUint16 KAtrRx = 4 + KSvgOffset;
+ const TUint16 KAtrRy = 5 + KSvgOffset;
+ const TUint16 KAtrHorizAdvX = 6 + KSvgOffset;
+ const TUint16 KAtrHorizOriginX = 7 + KSvgOffset;
+ const TUint16 KAtrHorizOriginY = 8 + KSvgOffset;
+ const TUint16 KAtrAscent = 9 + KSvgOffset;
+ const TUint16 KAtrDescent = 10 + KSvgOffset;
+
+ const TUint16 KAtrAlphabetic = 11 + KSvgOffset;
+ const TUint16 KAtrUnderlinePosition = 12 + KSvgOffset;
+ const TUint16 KAtrUnderlineThickness = 13 + KSvgOffset;
+ const TUint16 KAtrOverlinePosition = 14 + KSvgOffset;
+ const TUint16 KAtrOverlineThickness = 15 + KSvgOffset;
+ const TUint16 KAtrStrikethroughPosition = 16 + KSvgOffset;
+ const TUint16 KAtrStrikethroughThickness = 17 + KSvgOffset;
+ const TUint16 KAtrUnitsPerEm = 18 + KSvgOffset;
+
+ const TUint16 KAtrWordSpacing = 19 + KSvgOffset;
+ const TUint16 KAtrLetterSpacing = 20 + KSvgOffset;
+
+
+
+ //AA: Coordinate datatype: range is -max to +max & set using SetAttributeFloatL
+ const TUint16 KAtrCx = 21 + KSvgOffset;
+ const TUint16 KAtrCy = 22 + KSvgOffset;
+ const TUint16 KAtrY = 23 + KSvgOffset;
+ const TUint16 KAtrX = 24 + KSvgOffset;
+ const TUint16 KAtrY1 = 25 + KSvgOffset;
+ const TUint16 KAtrY2 = 26 + KSvgOffset;
+ const TUint16 KAtrX1 = 27 + KSvgOffset;
+ const TUint16 KAtrX2 = 28 + KSvgOffset;
+
+ const TUint8 KSvgCoordAttrEndIndex = 28 + KSvgOffset;
+ const TUint8 KSvgDesAttrsIndex = 29 + KSvgOffset;
+
+
+ //AA: Descriptor type set using SetAttributeDesL
+ const TUint16 KAtrK = 29 + KSvgOffset;
+ const TUint8 KSvgFloatAttrEndIndex = 29 + KSvgOffset;
+ const TUint16 KAtrG1 = 30 + KSvgOffset;
+ const TUint16 KAtrG2 = 31 + KSvgOffset;
+ const TUint16 KAtrU1 = 32 + KSvgOffset;
+ const TUint16 KAtrU2 = 33 + KSvgOffset;
+ const TUint16 KAtrUnicode = 34 + KSvgOffset;
+ const TUint16 KAtrGlyphName = 35 + KSvgOffset;
+ const TUint16 KAtrLang = 36 + KSvgOffset;
+ const TUint8 KSvgDesAttrEndIndex = 36 + KSvgOffset;
+
+ const TUint16 KAtrTextDecoration = 37 + KSvgOffset;
+ const TUint16 KAtrTextAnchor = 38 + KSvgOffset;
+ const TUint16 KAtrRotate = 39 + KSvgOffset;
+ const TUint16 KAtrCdata = 40 + KSvgOffset;
+
+
+
+
+ const TUint16 KAtrTransform = 41 + KSvgOffset;
+ const TUint16 KAtrStyle = 42 + KSvgOffset;
+ const TUint16 KAtrFill = 43 + KSvgOffset;
+ const TUint16 KAtrStroke = 44 + KSvgOffset;
+ const TUint16 KAtrColor = 45 + KSvgOffset;
+ const TUint16 KAtrFrom = 46 + KSvgOffset;
+ const TUint16 KAtrTo = 47 + KSvgOffset;
+ const TUint16 KAtrBy = 48 + KSvgOffset;
+ const TUint16 KAtrAttributeName = 49 + KSvgOffset;
+
+
+
+ const TUint8 KSvgNotHandledAttrsIndex = 50 + KSvgOffset;
+
+ const TUint16 KAtrPathLength = 50 + KSvgOffset;
+ const TUint16 KAtrVersion = 51 + KSvgOffset;
+ const TUint16 KAtrStrokeWidth = 52 + KSvgOffset;
+ const TUint16 KAtrPoints = 53 + KSvgOffset;
+ const TUint16 KAtrD = 54 + KSvgOffset;
+ const TUint16 KAtrType = 55 + KSvgOffset;
+ const TUint16 KAtrStopColor = 56 + KSvgOffset;
+ const TUint16 KAtrFx = 57 + KSvgOffset;
+ const TUint16 KAtrFy = 58 + KSvgOffset;
+
+ const TUint16 KAtrOffset = 59+ KSvgOffset;
+ const TUint16 KAtrSpreadMethods = 60 + KSvgOffset;
+ const TUint16 KAtrGradientUnits = 61 + KSvgOffset;
+ const TUint16 KAtrStopOpacity = 62 + KSvgOffset;
+
+
+
+
+// special attributes for encoding
+ const TUint16 KAtrViewBox = 63 + KSvgOffset;
+ const TUint16 KAtrBaseProfile = 64 + KSvgOffset;
+ const TUint16 KAtrZoomAndPan = 65 + KSvgOffset;
+ const TUint16 KAtrPreserveAspectRatio = 66 + KSvgOffset;
+
+ const TUint8 KSvgSVGAttrEndIndex = KAtrPreserveAspectRatio;
+
+ const TUint16 KAtrId = 67 + KSvgOffset;
+ const TUint16 KAtrXmlBase = 68 + KSvgOffset;
+
+ const TUint8 KSvgIdAndXmlAttrEndIndex = 68 + KSvgOffset;
+
+ const TUint16 KAtrXmlLang = 69 + KSvgOffset;
+ const TUint16 KAtrXmlSpace = 70 + KSvgOffset;
+
+ const TUint8 KSvgLangAttrEndIndex = 70 + KSvgOffset;
+
+ const TUint16 KAtrRequiredExtensions = 71 + KSvgOffset;
+ const TUint16 KAtrRequiredFeatures = 72 + KSvgOffset;
+ const TUint16 KAtrSystemLanguage = 73 + KSvgOffset;
+
+ const TUint8 KSvgTestAttrEndIndex = 73 + KSvgOffset;
+
+ const TUint16 KAtrDx = 74 + KSvgOffset;
+ const TUint16 KAtrDy = 75 + KSvgOffset;
+ const TUint16 KAtrMedia = 76 + KSvgOffset;
+ const TUint16 KAtrTitle = 77 + KSvgOffset;
+
+ const TUint16 KAtrXlinkactuate = 78 + KSvgOffset;
+ const TUint16 KAtrXlinkarcrole = 79 + KSvgOffset;
+
+ const TUint16 KAtrXlinkrole = 80 + KSvgOffset;
+ const TUint16 KAtrXlinkshow = 81 + KSvgOffset;
+ const TUint16 KAtrXlinktitle = 82 + KSvgOffset;
+ const TUint16 KAtrXlinktype = 83 + KSvgOffset;
+ const TUint16 KAtrXlinkhref = 84 + KSvgOffset;
+
+ const TUint8 KSvgUriAttrEndIndex = 84 + KSvgOffset;
+
+ const TUint16 KAtrBegin = 85 + KSvgOffset;
+ const TUint16 KAtrDur = 86 + KSvgOffset;
+ const TUint16 KAtrRepeatCount = 87 + KSvgOffset;
+ const TUint16 KAtrRepeatDur = 88 + KSvgOffset;
+ const TUint16 KAtrEnd = 89 + KSvgOffset;
+ const TUint16 KAtrRestart = 90 + KSvgOffset;
+ const TUint16 KAtrAccumulate = 91 + KSvgOffset;
+ const TUint16 KAtrAdditive = 92 + KSvgOffset;
+ const TUint16 KAtrKeySplines = 93 + KSvgOffset;
+ const TUint16 KAtrKeyTimes = 94 + KSvgOffset;
+ const TUint16 KAtrCalcMode = 95 + KSvgOffset;
+ const TUint16 KAtrPath = 96 + KSvgOffset;
+ const TUint16 KAtrAnimateMotion = 97 + KSvgOffset;
+ const TUint16 KAtrGradientTransform = 98 + KSvgOffset;
+ const TUint16 KAtrAnimateTransformAttrId = 99 + KSvgOffset;
+ const TUint16 KAtrTarget = 100 + KSvgOffset;
+ const TUint16 KAtrSolidOpacity = 101 + KSvgOffset;
+ const TUint16 KAtrSyncBehaviorDefault = 102 + KSvgOffset;
+ const TUint16 KAtrSyncToleranceDefault = 103 + KSvgOffset;
+ const TUint16 KAtrSyncBehavior = 104 + KSvgOffset;
+ const TUint16 KAtrSyncTolerance = 105 + KSvgOffset;
+ const TUint16 KAtrSyncMaster = 106 + KSvgOffset;
+ const TUint16 KAtrInitialVisibility = 107 + KSvgOffset;
+ const TUint16 KAtrVolume = 108 + KSvgOffset;
+ const TUint16 KAtrAudioLevel = 109 + KSvgOffset;
+
+
+#define KSVG_MAX_ATTRIBUTES KAtrAudioLevel
+#define KSVG_ATTRIBUTE_NOT_SUPPORTED KSVG_MAX_ATTRIBUTES+1
+
+ // special Ids for Animation attribute Values
+
+ const TUint16 KAnimFreeze = 110 + KSvgOffset;
+
+ // special Id for Embedded image XLink:href attribute .
+
+ const TUint16 KXlinkhrefImageEmbedded = 111 + KSvgOffset;
+
+// special Id for multiple end times.Used for the Binary compatibility of the encoder
+
+ const TUint16 KMultipleEndTime = 112 + KSvgOffset;
+ const TUint16 KAtrMediaAnimationId = 113 + KSvgOffset;
+
+ const TUint16 KAtrAudioId = 114 + KSvgOffset;
+
+
+ #define KSVG_ANIMATE_ELEMFLAG KAtrAttributeName
+ #define KSVG_SET_ELEMFLAG KAtrAttributeName
+ #define KSVG_ANIMATETRANSFORM_ELEMFLAG KAtrSVGTrf
+ #define KSVG_CIRCLE_ELEMFLAG KAtrR
+ #define KSVG_ELLIPSE_ELEMFLAG KAtrSVGElp
+ #define KSVG_RECT_ELEMFLAG KAtrSVGRec
+ #define KSVG_IMAGE_ELEMFLAG KAtrSVGRec
+ #define KSVG_HKERN_ELEMFLAG KAtrK
+ #define KSVG_PATH_ELEMFLAG KAtrD
+ #define KSVG_POLYLINE_ELEMFLAG KAtrPoints
+ #define KSVG_AMINATEMO_ELEMFLAG KAtrSVGAmo
+
+ const TUint16 KAtrSVGRec = 120 + KSvgOffset;
+ const TUint16 KAtrSVGElp = 121 + KSvgOffset;
+ const TUint16 KAtrSVGTrf = 122 + KSvgOffset;
+ const TUint16 KAtrSVGAmo = 123 + KSvgOffset;
+ const TUint16 KAtrToBy = 124 + KSvgOffset;
+ const TUint16 KAtrAdditiveSet = 125 + KSvgOffset;
+
+
+
+const TUint16 KTiny = 0;
+
+// Display Enumeration Constants. take care
+const TUint KDisplayEnumNone = 16;
+const TUint KPresentationAttrDisplay = 10;
+
+const TUint16 KAtrUnicodeRange = 135 + KSvgOffset;
+const TUint16 KAtrValues = 138 + KSvgOffset;
+
+
+// SPECIAL (APPLICATION DEFINED) ATTRIBUTE CONSTANTS
+const TUint16 KAtrData = KAtrD; // So KAtrData can still be used
+const TUint16 KAtrRadius = KAtrR; // So KAtrRadius can still be used
+
+const TUint16 KAtrRefX = 1001;
+const TUint16 KAtrRefY = 1002;
+const TUint16 KAtrAnimMotionMatrixIndex = 5000;
+const TUint16 KAtrAnimTransformMatrixIndex = 5001;
+
+//error values added for forwward reference support in animation and use elements
+const TInt KErrReferencedElementNotFound = -1000;
+const TInt KErrAnimateReferenceElementNotFound = -1001;
+
+// start of new element in encoding.
+const TUint16 KStartNewElem = 1000;
+
+// SVG TINY DEFINED ENUMERATIONS
+const TUint16 KEnumPercent = 0; // '%' sign
+const TUint16 KEnum100 = 1;
+const TUint16 KEnum200 = 2;
+const TUint16 KEnum300 = 3;
+const TUint16 KEnum400 = 4;
+const TUint16 KEnum500 = 5;
+const TUint16 KEnum600 = 6;
+const TUint16 KEnum700 = 7;
+const TUint16 KEnum800 = 8;
+const TUint16 KEnum900 = 9;
+const TUint16 KEnumAlways = 10;
+const TUint16 KEnumAuto = 11;
+const TUint16 KEnumBevel = 12;
+const TUint16 KEnumBlink = 13;
+const TUint16 KEnumBlock = 14;
+const TUint16 KEnumBold = 15;
+const TUint16 KEnumBolder = 16;
+const TUint16 KEnumButt = 17;
+const TUint16 KEnumCdata = 18;
+const TUint16 KEnumCm = 19;
+const TUint16 KEnumCompact = 20;
+const TUint16 KEnumCondensed = 21;
+const TUint16 KEnumCss = 22;
+const TUint16 KEnumDasharray = 23;
+const TUint16 KEnumDisable = 24;
+const TUint16 KEnumDiscrete = 25;
+const TUint16 KEnumEnd = 26;
+const TUint16 KEnumEvenodd = 27;
+const TUint16 KEnumExpanded = 28;
+const TUint16 KEnumExtraCondensed = 29;
+const TUint16 KEnumExtraExpanded = 30;
+const TUint16 KEnumFreeze = 31;
+const TUint16 KEnumHidden = 32;
+const TUint16 KEnumIn = 33;
+const TUint16 KEnumInherit = 34;
+const TUint16 KEnumInline = 35;
+const TUint16 KEnumInlineTable = 36;
+const TUint16 KEnumInterger = 37;
+const TUint16 KEnumItalic = 38;
+const TUint16 KEnumLenght = 39;
+const TUint16 KEnumLighter = 40;
+const TUint16 KEnumLinear = 41;
+const TUint16 KEnumLineThrough = 42;
+const TUint16 KEnumListItem = 43;
+const TUint16 KEnumMagnify = 44;
+const TUint16 KEnumMarker = 45;
+const TUint16 KEnumMiddle = 46;
+const TUint16 KEnumMiter = 47;
+const TUint16 KEnumMm = 48;
+const TUint16 KEnumNarrower = 49;
+const TUint16 KEnumNever = 50;
+const TUint16 KEnumNone = 51;
+const TUint16 KEnumNonzero = 52;
+const TUint16 KEnumNormal = 53;
+const TUint16 KEnumOblique = 54;
+const TUint16 KEnumOverline = 55;
+const TUint16 KEnumPaced = 56;
+const TUint16 KEnumPc = 57;
+const TUint16 KEnumPt = 58;
+const TUint16 KEnumPx = 59;
+const TUint16 KEnumRemove = 60;
+const TUint16 KEnumReplace = 61;
+const TUint16 KEnumRotate = 62;
+const TUint16 KEnumRound = 63;
+const TUint16 KEnumRunIn = 64;
+const TUint16 KEnumScale = 65;
+const TUint16 KEnumSemiCondensed = 66;
+const TUint16 KEnumSemiExpanded = 67;
+const TUint16 KEnumSkewX = 68;
+const TUint16 KEnumSkewY = 69;
+const TUint16 KEnumSpline = 70;
+const TUint16 KEnumSquare = 71;
+const TUint16 KEnumStart = 72;
+const TUint16 KEnumSum = 73;
+const TUint16 KEnumTable = 74;
+const TUint16 KEnumTableCaption = 75;
+const TUint16 KEnumTableCell = 76;
+const TUint16 KEnumTableColumn = 77;
+const TUint16 KEnumTableColumnGroup = 78;
+const TUint16 KEnumTableFooterGroup = 79;
+const TUint16 KEnumTableHeaderGroup = 80;
+const TUint16 KEnumTableRow = 81;
+const TUint16 KEnumTableRowGroup = 82;
+const TUint16 KEnumTranslate = 83;
+const TUint16 KEnumUltraCondensed = 84;
+const TUint16 KEnumUltraExpanded = 85;
+const TUint16 KEnumUnderline = 86;
+const TUint16 KEnumVisible = 87;
+const TUint16 KEnumWhenNotActive = 88;
+const TUint16 KEnumWider = 89;
+const TUint16 KEnumXMaxYMax = 90;
+const TUint16 KEnumXMaxYMid = 91;
+const TUint16 KEnumXMaxYMin = 92;
+const TUint16 KEnumXMidYMax = 93;
+const TUint16 KEnumXMidYMid = 94;
+const TUint16 KEnumXMidYMin = 95;
+const TUint16 KEnumXMinYMax = 96;
+const TUint16 KEnumXMinYMid = 97;
+const TUint16 KEnumXMinYMin = 98;
+const TUint16 KEnumXml = 99;
+
+// Temporary
+const TInt KSvgTinyArraySize = 210;
+
+/* List of Elements */
+
+
+//const TUint8 KSvgAnimElemsStartIndex = 34;
+//const TUint8 KSvgAnimElemsEndIndex = 38;
+
+const TUint8 KSvgNoBoundBoxElemsStartIndex = 0;
+const TUint8 KSvgNoBoundBoxElemsEndIndex = 18;
+
+const TUint8 KSvgAllGElemsStartIndex = 3;
+const TUint8 KSvgAllGElemsSubStartIndex = 4;
+const TUint8 KSvgAllGElemsEndIndex = 7;
+
+/* Media Elements bound indexes */
+const TUint8 KSvgMediaElemsStartIndex = 47;
+const TUint8 KSvgMediaElemsEndIndex = 48;
+
+const TUint8 KSvgSvgElement = 0;
+
+const TUint8 KSvgAltglyphElement = 1;
+const TUint8 KSvgAltglyphdefElement = 2;
+
+const TUint8 KSvgDefsElement = 3;
+const TUint8 KSvgDescElement = 4;
+
+const TUint8 KSvgMetadataElement = 6;
+const TUint8 KSvgTitleElement = 7;
+
+const TUint8 KSvgFontfacenameElement = 8;
+const TUint8 KSvgFontfacesrcElement = 9;
+const TUint8 KSvgFontfaceuriElement = 10;
+const TUint8 KSvgGElement = 11;
+const TUint8 KSvgGlyphrefElement = 12;
+const TUint8 KSvgVkernElement = 13;
+// Moved to end of element type list to use its own class
+// Types 1-16 uses CSvgGElementImpl as container
+// const TUint8 KSvgScriptElement = 14;
+const TUint8 KSvgSwitchElement = 15;
+
+const TUint8 KSvgViewElement = 16;
+
+const TUint8 KSvgHkernElement = 17;
+
+const TUint8 KSvgAElement = 18;
+const TUint8 KSvgFontElement = 19;
+const TUint8 KSvgFontfaceElement = 20;
+const TUint8 KSvgGlyphElement = 21;
+const TUint8 KSvgImageElement = 22;
+const TUint8 KSvgMissingglyphElement = 23;
+const TUint8 KSvgStyleElement = 24;
+const TUint8 KSvgTextElement = 25;
+const TUint8 KSvgUseElement = 26;
+const TUint8 KSvgCircleElement = 27;
+const TUint8 KSvgEllipseElement = 28;
+const TUint8 KSvgLineElement = 29;
+const TUint8 KSvgPathElement = 30;
+const TUint8 KSvgPolygonElement = 31;
+const TUint8 KSvgPolylineElement = 32;
+const TUint8 KSvgRectElement = 33;
+const TUint8 KSvgAnimateElement = 34;
+const TUint8 KSvgAnimateColorElement = 35;
+const TUint8 KSvgAnimateMotionElement = 36;
+const TUint8 KSvgAnimateTransformElement = 37;
+const TUint8 KSvgSetElement = 38;
+const TUint8 KSvgMpathElement = 39;
+const TUint8 KSvgLinearGradientElement = 40;
+const TUint8 KSvgRadialGradientElement = 41;
+const TUint8 KSvgStopElement = 42;
+const TUint8 KSvgScriptElement = 43;
+const TUint8 KSvgTextAreaElement = 44;
+const TUint8 KSvgDiscardElement = 45;
+const TUint8 KSvgSolidColorElement = 46;
+//const TUint8 KSvgAnimationElement = 47;
+const TUint8 KSvgMediaAnimationElement = 47;
+const TUint8 KSvgAudioElement = 48;
+const TUint8 KSvgForeignObjectElement = 49;
+
+// signs the present of Cdata
+const TUint8 KCDataPresent = 253;
+// end of element index
+const TUint8 KEndElemIndex = 254;
+const TUint8 KEndSvgFile = 255;
+
+
+
+
+/* List of Data Types */
+const TInt KSvgTypeInteger = 0;
+const TInt KSvgTypeNumber = 1;
+const TInt KSvgTypeColor = 2;
+const TInt KSvgTypeLength = 3;
+//const TInt KSvgTypeStr = 4;
+//const TInt KSvgTypeTime = 5;
+//const TInt KSvgTypeCor = 6;
+
+const TInt KSvgTypePath = 7;
+const TInt KSvgTypeId = 8;
+const TInt KSvgTypeUriId = 9;
+const TInt KSvgTypeValue = 10;
+const TInt KSvgTypeRDur = 11;
+const TInt KSvgTypeRCount = 12;
+const TInt KSvgTypeList = 13;
+const TInt KSvgTypeStyle = 14;
+const TInt KSvgTypeViewBox = 15;
+const TInt KSvgTypePAR = 16;
+const TInt KSvgTypeCorl = 17;
+
+
+/* Transform Types */
+
+const TInt KSvgTypeTransform = 30;
+const TInt KSvgTypeTranslate = 31;
+const TInt KSvgTypeRotate = 32;
+const TInt KSvgTypeScale = 33;
+const TInt KSvgTypeSkewX = 34;
+const TInt KSvgTypeSkewY = 35;
+const TInt KSvgType2DMatrix = 36;
+
+/* Only Enumarated SVGT ATTRIBUTES */
+const TInt KSvgTypeEnum = 49;
+const TInt KSvgTypeAccumulate = 50;
+const TInt KSvgTypeAdditive = 51;
+const TInt KSvgTypeCalcMode = 52;
+const TInt KSvgTypeDisplay = 53;
+const TInt KSvgTypeFill = 54;
+const TInt KSvgTypeFillRule = 55;
+const TInt KSvgTypeFontFamily = 56;
+const TInt KSvgTypeFontSize = 57;// Break in series due to redefinition originally
+const TInt KSvgTypeFontStyle = 59;
+const TInt KSvgTypeFontWeight = 60;
+const TInt KSvgTypeRestart = 61;
+const TInt KSvgTypeStrokeDasharray = 62;
+const TInt KSvgTypeStrokeDashoffset = 63;
+
+const TInt KSvgTypeStrokeLinecap = 64;
+const TInt KSvgTypeStrokeLinejoin= 65;
+const TInt KSvgTypeStrokeMiterlimit = 66;
+const TInt KSvgTypeStrokeWidth = 67;
+const TInt KSvgTypeType = 68;
+const TInt KSvgTypeVisibility = 69;
+const TInt KSvgTypeZoomAndPan = 70;
+const TInt KSvgTypeAttributeType = 71;
+const TInt KSvgTypeTo = 72;
+const TInt KSvgTypeTextAnchor = 73;
+const TInt KSvgTypeTextDecoration= 74;
+const TInt KSvgTypeAlignmentBaseline = 75;
+const TInt KSvgTypeBaselineShift = 76;
+const TInt KSvgTypeClipRule = 77;
+const TInt KSvgTypeColorInterpolation = 78;
+const TInt KSvgTypeCursor = 79;
+const TInt KSvgTypeDirection = 80;
+const TInt KSvgTypeDominantBaseline = 81;
+const TInt KSvgTypeFontStretch = 82;
+const TInt KSvgTypeFontVariant = 83;
+const TInt KSvgTypeImageRendering= 84;
+const TInt KSvgTypeOverflow = 85;
+const TInt KSvgTypePointerEvents = 86;
+const TInt KSvgTypeShapeRendering= 87;
+const TInt KSvgTypeTextRendering = 88;
+const TInt KSvgTypeUnicodeBidi = 89;
+const TInt KSvgTypeWritingMode = 90;
+const TInt KSvgTypeMaskUnits = 91;
+const TInt KSvgTypeMode = 92;
+const TInt KSvgTypeOperator = 93;
+const TInt KSvgTypeMethod = 94;
+const TInt KSvgTypeSpacing = 95;
+const TInt KSvgTypeRenderingIntent= 96;
+const TInt KSvgTypeSpreadMethod = 97;
+const TInt KSvgTypeOpacity = 98;
+const TInt KSvgTypeGradientUnits = 99;
+
+
+
+
+#define KCSS_ATTR_FILL 0
+#define KCSS_ATTR_STROKE 1
+#define KCSS_ATTR_STROKEWIDTH 2
+#define KCSS_ATTR_VISIBILITY 3
+#define KCSS_ATTR_FONTFAMILY 4
+#define KCSS_ATTR_FONTSIZE 5
+#define KCSS_ATTR_FONTSTYLE 6
+#define KCSS_ATTR_FONTWEIGHT 7
+#define KCSS_ATTR_STROKE_DASHARRAY 8
+#define KCSS_ATTR_DISPLAY 9
+#define KCSS_ATTR_FILLRULE 10
+#define KCSS_ATTR_STROKE_LINECAP 11
+#define KCSS_ATTR_STROKE_LINEJOIN 12
+#define KCSS_ATTR_STROKE_DASHOFFSET 13
+#define KCSS_ATTR_STROKE_MITERLIMIT 14
+#define KCSS_ATTR_COLOR 15
+#define KCSS_ATTR_TEXTANCHOR 16
+#define KCSS_ATTR_TEXTDECORATION 17
+#define KCSS_ATTR_COLORINTERPOLATION 18
+#define KCSS_ATTR_COLORRENDERING 19
+#define KCSS_ATTR_LETTERSPACING 20
+#define KCSS_ATTR_WORDSPACING 21
+
+#define KCSS_ATTR_FILL_OPACITY 22
+#define KCSS_ATTR_STROKE_OPACITY 23
+#define KCSS_ATTR_GROUP_OPACITY 24
+
+#define KCSS_ATTR_FONT 25
+#define KCSS_MAX_ATTR 25
+
+const TInt KInherit = 5;
+// number of color names supported by SVGT
+const TInt KMaxColors = 17;
+
+enum TAttributeType
+ {
+ EInteger = 0,
+ EFloat,
+ EString,
+ EList,
+ EUndefinedType
+ };
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgSchemaData : public CBase
+ {
+ private:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgSchemaData();
+ public:
+
+ /**
+ * Need method description - GetSVGTAttributeId
+ *
+ * @since 1.0
+ * @param aAttrName
+ * @return
+ */
+ static TUint16 GetSVGTAttributeId(const TDesC& aAttrName);
+
+ /**
+ * Need method description - GetSVGElementId
+ *
+ * @since 1.0
+ * @param aElement
+ * @return
+ */
+ static TInt GetSVGElementId(const TDesC& aElement);
+
+ /**
+ * Need method description - GetPresentationAttributeId
+ *
+ * @since 1.0
+ * @param aElement
+ * @return
+ */
+ static TInt GetPresentationAttributeId(const TDesC& aElement);
+
+ /**
+ * Get the type of the given attribute string
+ *
+ * @since 1.0
+ * @param aAttrName
+ * @return type for attribute-name
+ */
+ static TAttributeType GetAttributeType( const TDesC& aAttrName );
+
+ /**
+ * Need method description - FindSpreadMethod
+ * returns the integer enum value for the spread method type
+ * @since 1.0
+ * @param aElement
+ * @return
+ */
+ TInt FindSpreadMethod(const TDesC& aElement);
+ /**
+ * Need method description - FindFontStyle
+ *
+ * @since 1.0
+ * @param aElement
+ * @return
+ */
+ TInt FindFontStyle(const TDesC& aElement);
+
+ /**
+ * Need method description - FindFontWeightEnum
+ *
+ * @since 1.0
+ * @param aElement
+ * @return
+ */
+ TInt FindFontWeightEnum(const TDesC& aElement);
+ /**
+ * Need method description - FindTextAnchorEnum
+ *
+ * @since 1.0
+ * @param aElement
+ * @return
+ */
+ TInt FindTextAnchorEnum(const TDesC& aElement);
+
+ /**
+ * Need method description - FindTextDecorationEnum
+ *
+ * @since 1.0
+ * @param aElement
+ * @return
+ */
+ TInt FindTextDecorationEnum(const TDesC& aElement);
+
+
+ // Accessors
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgSchemaData* NewL();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgSchemaData* NewLC();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ ~CSvgSchemaData();
+
+ void GetSVGElementName(const TUint8 aElement, TDes& aElemName);
+
+
+
+};
+#endif
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGScriptElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef CSVGSCRIPTELEMENTIMPL_H
+#define CSVGSCRIPTELEMENTIMPL_H
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include "SVGElementImpl.h"
+#include "SVGDocumentImpl.h"
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgScriptElementImpl : public CSvgElementImpl
+ {
+ public: // Constructor/deconstructor
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgScriptElementImpl* NewL( TUint8 aElementId, CSvgDocumentImpl* aDocument );
+
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgScriptElementImpl();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName, const TDesC& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetScriptL( const TDesC& aScriptString );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ const HBufC8* GetScript();
+
+ void Print( TBool aIsEncodeOn );
+
+ private:
+
+ /**
+ * Constructor
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgScriptElementImpl( CSvgDocumentImpl* aDocument );
+
+ /**
+ * Constructor
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( TUint8 aElementId );
+
+ void FetchExternalScriptL();
+
+ private:
+ CSvgDocumentImpl* iDocument;
+ HBufC8* iScript;
+ HBufC* iXLink;
+
+
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGSetElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,201 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGSETELEMENTIMPL_
+#define _INC_CSVGSETELEMENTIMPL_
+
+#include "SVGAnimationBase.h"
+
+
+
+
+class CSvgDocumentImpl;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgSetElementImpl : public CSvgAnimationBase
+ {
+ public:
+ TBool DoAnimProcL(MSvgEvent* aEvent);
+ // Constructor/deconstructor
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgSetElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgSetElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ void ReInitializeAnimation();
+
+ void Reset(MSvgEvent* aEvent);
+ void DeactivateAnimation();
+
+ private:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgSetElementImpl();
+
+ private:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgSetElementImpl( CSvgDocumentImpl* aDoc );
+
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeIntL( const TInt aNameId, const TInt32 aValue);
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeIntL( const TInt aNameId, TInt32& aValue );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeFloatL(const TInt aNameId, TFloatFixPt aValue );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat(const TInt aNameId, TFloatFixPt& aValue );
+ // From MXmlElement API
+
+ // From MEventReceiver
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool ReceiveEventL( MSvgEvent* aEvent );
+ // From MEventReceiver
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ResetReferenceElementL();
+ CGfxGeneralPath* GetPathAttribute(TInt aAttributeId);
+ void SetPathAttribute(TInt aAttributeId, CGfxGeneralPath* aPathHandle);
+
+
+ void InitAnimationL();
+ void SetToOriginalL();
+
+ void Print( TBool aIsEncodeOn );
+
+ private:
+
+
+
+ // this tells that the style attribute is inherited one.
+ // this will be used by the SetMediaTime to repoint it to the parent.
+
+ TBool iIsInheritedAttribute;
+
+
+
+ private:
+ // From CSvgAnimationBase
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+ virtual TBool AnimProcL( MSvgTimerEvent* aEvent );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ResetAnimationL();
+ };
+
+
+#endif /* _INC_CSvgSetElementImpl_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGSolidColorElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#ifndef SVGSOLIDCOLORELEMENTIMPL_H
+#define SVGSOLIDCOLORELEMENTIMPL_H
+
+// INCLUDES
+#include "SVGElementImpl.h"
+
+// FORWARD DECLARATIONS
+class CSvgDocumentImpl;
+
+/**
+ * The solidColor element is a paint server that provides a single color with opacity.
+ * It can be referenced like the other paint servers
+ *
+ * The class does not export any function to other non SVG compoents.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.2
+ */
+class CSvgSolidColorElementImpl : public CSvgElementImpl
+ {
+ public:
+
+ // Constructor/deconstructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CSvgSolidColorElementImpl* NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+
+ /**
+ * Two-phased constructor.
+ */
+ static CSvgSolidColorElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * C++ default constructor.
+ */
+ CSvgSolidColorElementImpl( CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * SetAttributeL: Attribute can only be solid-color which is the same as
+ * the "fill" attribute
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param aName Name of the attribute
+ * aValue conent of the attribute
+ * @return KErrNone if no error.
+ */
+
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+ /**
+ * SetAttributeFloatL: Attribute can only be solid-opacity which is the same as
+ * the "fill-opacity" attribute
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param aName Name of the attribute
+ * aValue conent of the attribute
+ * @return KErrNone if no error.
+ */
+ TInt SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue );
+
+ TInt GetAttributeFloat(const TInt aNameId, TFloatFixPt& aValue);
+
+ /**
+ * ApplyOpacitytoElement: Applies solid-opacity to appropriate element
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param aElement element pointer
+ *
+ * @return void.
+ */
+ void ApplyOpacitytoElement(CSvgElementImpl* aElement);
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSvgSolidColorElementImpl();
+
+ void Print( TBool aIsEncodeOn );
+
+ TFloatFixPt iSolidOpacity;
+
+ private:
+ /**
+ * Symbian 2nd phase constructor
+ *
+ * Mainly initialize the element and subscribe events to be listen.
+ *
+ * @since Series 60 3.1 SVGTiny 1.2
+ * @param
+ * @return
+ */
+ void ConstructL(const TUint8 aElemID);
+
+ };
+
+#endif /* SVGSOLIDCOLORELEMENTIMPL_H */
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGStrCssValueImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_CSTRCSSVALUEIMPL__
+#define __INC_CSTRCSSVALUEIMPL__
+
+
+#include "SVGCssValue.h"
+
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+
+
+class CStrCssValueImpl : public CCssValue
+
+ {
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ ~CStrCssValueImpl();
+
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetValueL( const TDesC& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ const TDesC& Value();
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetL(CStrCssValueImpl* aValue);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CStrCssValueImpl();
+
+
+ TBool IsEqual(CCssValue* aValue);
+
+ void Print();
+
+ private:
+
+
+
+
+
+ HBufC* iCssText;
+
+
+ };
+
+#endif /* __INC_CSTRCSSVALUEIMPL__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGStringTokenizer.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __TSTRINGTOKENIZER_H__
+#define __TSTRINGTOKENIZER_H__
+
+#include <e32std.h>
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class TStringTokenizer
+ {
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TStringTokenizer( const TDesC& aSrc, const TDesC& aDelim );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TPtrC NextToken();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TPtrC NextToken( const TDesC& aDelim );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool HasMoreTokens();
+
+ private:
+ TLex iSrc;
+ TPtrC iDelim;
+
+ private:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool isDeliminator( TChar aChar, const TDesC& aDelim );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SkipDeliminator( const TDesC& aDelim );
+ };
+
+#endif // __TStringTokenizer_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGStyleElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,203 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGSTYLEELEMENTIMPL_
+#define _INC_CSVGSTYLEELEMENTIMPL_
+
+#include "SVGElementImpl.h"
+#include "GfxFloatFixPt.h"
+
+
+
+class CSvgDocumentImpl;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgStyleElementImpl : public CSvgElementImpl
+ {
+ public:
+
+ // Constructor/deconstructor
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgStyleElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgStyleElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ private:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgStyleElementImpl();
+
+ // SVG Implementation:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetTypeL( const TDesC& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetMediaL( const TDesC& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetTitleL( const TDesC& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetStyleL( const TDesC& aValue );
+
+ // From MXmlElement API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+ // From CSvgElementImpl
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+
+ // From MXmlElementOpt API
+
+ TInt SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+
+ void Print( TBool aIsEncodeOn );
+
+ private:
+
+ HBufC* iType;
+
+ HBufC* iMedia;
+
+ HBufC* iTitle;
+
+ HBufC* iStyle;
+
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgStyleElementImpl( CSvgDocumentImpl* aDoc );
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGSvgElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,471 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_CSVGSVGELEMENT__
+#define __INC_CSVGSVGELEMENT__
+
+#include "SVGElementImpl.h"
+#include "GfxRectangle2D.h"
+#include "GfxAffineTransform.h"
+#include "SVGFitToViewBoxImpl.h"
+#include "SVGGElementImpl.h"
+#include "SVGZoomAndPan.h"
+#include "SVGTimedEntityInterface.h"
+
+
+class CSvgViewSpec;
+class CSvgTestAttrs;
+class CSvgExternalResourcesRequiredAttrs;
+class CSvgPresentationAttrs;
+class CSvgAngle;
+class CSvgMatrix;
+class CSvgDocumentImpl;
+class TGfxAffineTransform;
+class CSvgElementImpl;
+class MXmlDocument;
+
+
+/**
+ * Class description
+ */
+class CSvgSvgElementImpl : public CSvgElementImpl, public MSvgZoomAndPan
+ {
+ public:
+
+ CSvgSvgElementImpl();
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgSvgElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgSvgElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ private:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+ public:
+
+
+ /**
+ * Destructor
+ */
+ virtual ~CSvgSvgElementImpl();
+
+
+ // From SVG DOM
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt X();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Y();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Width();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Height();
+
+ /**
+ * Accessor funciton for SyncBehaviorDefault value
+ *
+ * @since S60 3.2
+ * @param none
+ * @return TSvgSyncBehavior indicating default value.
+ */
+ TSvgSyncBehaviour SyncBehaviorDefault();
+
+ /**
+ * Accessor funciton for SyncToleranceDefault value
+ *
+ * @since S60 3.2
+ * @param none
+ * @return TUint32 indicating default value in msecs.
+ */
+ TUint32 SyncToleranceDefault();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* GetElementById( const TDesC& aElementId );
+
+ TInt SetAttributeDesL( const TInt aNameId, TDesC& aValue );
+
+ TInt GetAttributeDes( const TInt aNameId, TPtrC16& aValue );
+
+
+ // SVG Implementation
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetWidth( TFloatFixPt aWidth );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetHeight( TFloatFixPt aHeight );
+
+
+
+
+ // From MXmlElement API
+
+
+ /**
+ * get attribute of CSvgSvgElementImpl
+ */
+ IMPORT_C TInt GetAttribute( const TDesC& aName,
+ TDes& aValue );
+
+
+ /**
+ * set attribute
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+ // From MXmlElementOpt API
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue );
+
+
+ // From CSvgElementImpl
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetBBox( TGfxRectangle2D& aBbox );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetUnscaledBBox( TGfxRectangle2D& /*aBbox*/ );
+
+ // From MSvgZoomAndPan
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TSvgZoomAndPanType GetZoomAndPan();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetZoomAndPan( TSvgZoomAndPanType aZoomAndPan );
+
+ // From MSvgFitToViewBox
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetPreserveAspectRatio( MSvgPreserveAspectRatio*& aAspectRatio );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetPreserveAspectRatioL ( TSvgPreserveAspectAlignType aAlign,
+ TSvgMeetOrSliceType aMeetslice );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool GetViewBox( TGfxRectangle2D& aViewBox );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetViewBoxL( TGfxRectangle2D aViewBox );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool ViewBoxDefined();
+
+ // From CSvgFitToViewBoxImpl
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetWindowViewportTrans( TGfxRectangle2D aXYWH,
+ TGfxAffineTransform& aTr );
+
+
+
+ // For Baseprofile
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ const TDesC& BaseProfile();
+ // For Version
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ const TDesC& Version();
+
+
+
+ /**
+ * Constructor
+ */
+ CSvgSvgElementImpl( CSvgDocumentImpl* aDoc );
+
+ /**
+ * set base profile
+ */
+ void SetBaseProfileL( const TDesC& aValue );
+
+
+ /**
+ * set version
+ */
+ void SetVersion( const TDesC& aValue );
+
+ /**
+ * set synchronised behaviour default
+ * @since S60 3.2
+ * @param aValue canSlip | independent | locked | inherit
+ * @return
+ */
+ void SetSyncBehaviorDefault( const
+ TDesC& aValue );
+
+ /**
+ * set synchronised tolerance default
+ * @since S60 3.2
+ * @param aValue Clock-value | "inherit"
+ * @return none.
+ */
+ void SetSyncToleranceDefault( const
+ TDesC& aValue );
+
+ /**
+ * set synchronised behaviour default
+ * @since S60 3.2
+ * @param aValue canSlip | independent | locked | inherit
+ * @return
+ */
+ void SetSyncBehaviorDefault( const
+ TSvgSyncBehaviour aValue );
+
+ /**
+ * set synchronised tolerance default
+ * @since S60 3.2
+ * @param aValue Clock-value
+ * aInheritValue true/false, should tolerance default
+ * @return none.
+ */
+ void SetSyncToleranceDefault( const
+ TInt32 aValue, TBool aInheritValue = EFalse );
+
+ void Print( TBool aIsEncodeOn );
+
+
+
+ private:
+ TSvgZoomAndPanType iZoomAndPan;
+
+ TFloatFixPt iX;
+ TFloatFixPt iY;
+ TFloatFixPt iWidth;
+ TFloatFixPt iHeight;
+
+ CSvgFitToViewBoxImpl* iViewBoxImpl;
+
+ HBufC* iVersion;
+
+ HBufC* iBaseProfile;
+
+ // Default run time sync behaviour
+ TSvgSyncBehaviour iSyncBehaviorDefault;
+
+ // Default synchronised tolerance value in msecs
+ TUint32 iSyncToleranceDefault;
+
+ public:
+ // to support "%" for svg element in case of multiple
+ // render buffers of different sizes
+ TReal32 iWidthInUserCoordinate;
+ TReal32 iHeightInUserCoordinate;
+ TBool iWidthInPercentage;
+ TBool iHeightInPercentage;
+
+ TBool iIsWidthSet;
+ TBool iIsHeightSet;
+ HBufC* iContent;
+ };
+
+
+#endif /* __INC_CSVGSVGELEMENT__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGTestsImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,222 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_CSVGTESTSIMPL__
+#define __INC_CSVGTESTSIMPL__
+
+#include <e32base.h>
+#include <badesca.h>
+#include "SVGTests.h"
+
+/// Implements SvgTests interface. Elements implementing this interface should
+/// provide wrappers. Note that not all SVG elements implement this interface
+/// in SVG DOM.
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgTestsImpl : public CBase, public MSvgTests
+ {
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgTestsImpl* NewL();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgTestsImpl* NewLC();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ ~CSvgTestsImpl();
+
+ // From MSvgTests
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetRequiredFeatures( const CDesCArrayFlat*& aRequiredFeatures );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetRequiredExtensions( const CDesCArrayFlat*& aRequiredExtensions );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool GetSystemLanguage( const CDesCArrayFlat*& aSystemLanguage );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool HasExtension( const TDesC& aExtension );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool HasFeature( const TDesC& aFeature );
+
+ TBool HasAnyTests();
+
+ // Implementation
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool SetSystemLanguageAttribute( const TDesC& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+ TBool SetRequiredExtensionAttribute( const TDesC& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+ TBool SetRequiredFeatureAttribute( const TDesC& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool SetTestAttributeL( const TDesC& aPropertyName,
+ const TDesC& aValue );
+
+
+ // functions for encoding
+
+ void SetRequiredFeatures( CDesCArrayFlat*& aRequiredFeatures );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetRequiredExtensions( CDesCArrayFlat*& aRequiredExtensions );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetSystemLanguage( CDesCArrayFlat*& aSystemLanguage );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgTestsImpl* CloneL();
+
+ private:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL();
+
+ CDesCArrayFlat* iRequiredFeatures;
+
+ CDesCArrayFlat* iRequiredExtensions;
+
+ CDesCArrayFlat* iSystemLanguage;
+
+ TBool iSystemLanguageEmpty;
+ };
+
+#endif /* __INC_CSVGTESTSIMPL__ */
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGTextAreaElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,370 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGTEXTAREAELEMENTIMPL_
+#define _INC_CSVGTEXTAREAELEMENTIMPL_
+
+#include "SVGElementImpl.h"
+#include "GfxFloatFixPt.h"
+#include "GfxRoundRectangle2D.h"
+#include "SVGListener.h"
+
+class CSvgDocumentImpl;
+class CSvgRectElementImpl;
+class CSvgTextElementImpl;
+class CSvgLineElementImpl;
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgTextAreaElementImpl : public CSvgElementImpl,
+ public MSvgMouseListener
+ {
+ public:
+
+ // Constructor/deconstructor
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgTextAreaElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgTextAreaElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgTextAreaElementImpl();
+
+ // From SVG DOM
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt X();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Y();
+ TInt GetLength();
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Width();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Height();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Rx();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Ry();
+
+ // SVG Implementation
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat( const TInt aNameId, TFloatFixPt& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeFloatL( const TInt aNameId, const TFloatFixPt aValue );
+
+ TInt SetAttributeDesL( const TInt aNameId, const TDesC& aValue );
+
+ TInt GetAttributeDes( const TInt aNameId, TPtrC16& aValue );
+
+ // From MXmlElement API
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName, const TDesC& aValue );
+
+ void SetEditable( const TDesC& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc, CSvgElementImpl* aElement );
+
+
+ TBool DrawTextElements( CGfx2dGc* aGc, CSvgElementImpl* aElement );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetBBox( TGfxRectangle2D& aBbox );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetUnscaledBBox( TGfxRectangle2D& /*aBbox*/ );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetTextAreaDimensions(TFloatFixPt aX, TFloatFixPt aY, TFloatFixPt aWidth, TFloatFixPt aHeight);
+
+ void SetTextL( const TDesC& aText ); // This is temporary API until CDATA is implemented
+
+ void GetText( TDes& allText );
+
+ TBool IsEditable( );
+
+ void LocalizedArrangeTextL( CGfx2dGc* aGc );
+
+ void RemoveText( const TDesC& aString );
+
+ void InitializeL( );
+
+ /**
+ * Return wether an svg element is displayable, such as <rect>, <circle>, or
+ * an abstract element, such as <g>, <animate>.
+ *
+ * @since 1.0
+ * @param None
+ * @return ETrue if element is viewable.
+ */
+ TBool IsViewable() { return ETrue; }
+
+ /**
+ * Notified when the mouse pointer enters a visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ TBool MouseEntered( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Notified when the mouse pointer exits a visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ TBool MouseExited( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Notified when the mouse pointer exits a visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ TBool MouseMoved( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Notified when the mouse pointer is pressed down on visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ TBool MousePressed( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Notified when the mouse pointer is released on on visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ TBool MouseReleased( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+ inline TInt FileOffset() const
+ {
+ return iOffset;
+ }
+
+ inline void SetFileOffset(TInt aOffset)
+ {
+ if( !FileOffset() )
+ iOffset = aOffset;
+ };
+
+ inline void SetOrgLength(TInt aOrgLength)
+ {
+ if(! GetOrgLength())
+ iOrgLength = aOrgLength;
+ };
+
+ inline TInt GetOrgLength()
+ {
+ return iOrgLength;
+ }
+
+ void Print( TBool aIsEncodeOn );
+
+ private:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgTextAreaElementImpl( CSvgDocumentImpl* aDoc );
+
+ private:
+ CSvgRectElementImpl* iInnerRectangle;
+ CSvgRectElementImpl* iBorderRectangle;
+
+ HBufC* iAllText;
+ RPointerArray<CSvgTextElementImpl>* iTextElementsArray;
+
+ TBool iEditable;
+ TBool iInitialized;
+ TBool iNeedTextRearrange;
+
+ TInt iCursorPosition;
+ CSvgLineElementImpl* iCursorElement;
+ TGfxRectangle2D iLastBBox;
+ //TBool iScrollBar;
+ //TInt iScrollLocation;
+public:
+ TInt iOffset;
+ TInt iOrgLength;
+
+ protected:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void CopyL( CSvgTextAreaElementImpl* aDestElement );
+
+ };
+
+#endif /* _INC_CSVGLINEELEMENT_3C61A6080051_INCLUDED */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGTextElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,596 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGTEXTELEMENTIMPL_
+#define _INC_CSVGTEXTELEMENTIMPL_
+
+#include "SVGElementImpl.h"
+#include "SVGLangSpaceImpl.h"
+#include "SVGFourPointRect.h"
+#include "SVGListener.h"
+#include "GfxPoint2D.h"
+
+
+
+
+class CSvgErrorImpl;
+
+class CSvgDocumentImpl;
+class MXmlDocument;
+
+enum TTextAnchor
+{
+ EStartAnchor = 0,
+ EMiddleAnchor,
+ EEndAnchor
+};
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgTextElementImpl : public CSvgElementImpl,
+ public MSvgMouseListener
+ {
+ public:
+
+ // Constructor/deconstructor
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgTextElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgTextElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ private:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+
+ public:
+
+ void UpdateCurrentScaledFont();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ ~CSvgTextElementImpl();
+ // From SVG DOM
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt32 NumberOfChars();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetX( CArrayFix<TFloatFixPt>* aX );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetY( CArrayFix<TFloatFixPt>* aY );
+
+ // SVG Implementation
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool IsNumberAttributeValid( const TDesC& aValue );
+
+
+ void SetTextL( const TDesC& aText ); // This is temporary API until CDATA is implemented
+
+ TDesC& GetText();
+
+ TBool LoadExternalSVGFontL( const TDesC& aText );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetX( CArrayFix<TFloatFixPt>* aX );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetY( CArrayFix<TFloatFixPt>* aX );
+
+
+ void SetXYArray(TUint16 aAtrId, CArrayFixFlat<TFloatFixPt>*& aX );
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetTextDecoration( const TDesC& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetTextAnchor( const TDesC& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetFontFamilyL( const TDesC& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetRotateL( const TDesC& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+
+
+ /**
+ * Using generic function instead of SetArrayXL or SetArrrayYL
+ *
+ * @since 1.0
+ * aValue - the string containing the coordinates
+ * aIsX - Flag to determine whether it is X or Y coordinate values
+ */
+
+ void SetArrayL( const TDesC& aValue , const TBool aIsX);
+
+
+
+ // From MXmlElement API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+ // From MXmlElementOpt API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeDes( const TInt aNameId,
+ TPtrC16& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue );
+
+ // From CSvgElementImpl
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+
+ void CopyL( CSvgTextElementImpl* aDestElement );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+
+
+
+ /**
+ * Scale the stroke width in order to nullify the effect of scaling
+ * appiled on the glyph
+ *
+ * @since 3.2
+ * @param aGc- Graphics context
+ * @return none
+ */
+ void ScaleStrokeWidth(CGfx2dGc* aGc);
+
+
+// void GetCurrentFontScaled(CFont*& aFont, TFontSpec& aFontSpec);
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetBBox( TGfxRectangle2D& aBbox );
+ void GetFourPointBBox( TSvgFourPointRect& aFourPointBBox );
+ void GetBBoxForSVGText( TGfxRectangle2D& aBbox );
+ void GetBBoxForSVGText( TSvgFourPointRect& aFourPointBbox,const TGfxAffineTransform& aTransform);
+ void GetBBoxForSystemText( TGfxRectangle2D& aBbox );
+ void GetBBoxForSystemText( TSvgFourPointRect& aFourPointBbox );
+ void CreateSVGFontL();
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void GetUnscaledBBox( TGfxRectangle2D& aBbox );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ //Local Function(s)
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool IsWithinUnicodeRange( const TDesC& aUnicodeRange,
+ const TDesC& aCharacter );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetUKernPairsL( const TDesC& aU1,
+ const TDesC& aU2 );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetGKernPairsL( const TDesC& aG1,
+ const TDesC& aG2 );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool IsKerningRequired( const TDesC& aPrevGlyphName,
+ const TDesC& aCurrGlyphName,
+ const TDesC& aPrevUnicode,
+ const TDesC& aCurrUnicode);
+
+ // function for decoding
+ void SetRotateArray(CArrayFixFlat<TReal32>*& aRotate);
+ void FreeFontData();
+
+ /**
+ * Return the font size for this text element.
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt FontSize();
+
+ TFloatFixPt TextAdvance( const TDesC& aText, TInt aIndex = 0);
+ TFloatFixPt Ascent();
+ TFloatFixPt Descent();
+ TTextAnchor TextAnchor();
+ void CacheGlyphsForText();
+ TBool IsMostBasicLatin();
+ TBool HasFont();
+ void SetFont(CFont* aBitmapFont = NULL, CSvgElementImpl* aSVGFont = NULL);
+
+ void SetEditable( const TDesC& aValue );
+
+ void Print( TBool aIsEncodeOn );
+ const CFont* Font() const;
+
+ /**
+ * Return wether an svg element is displayable, such as <rect>, <circle>, or
+ * an abstract element, such as <g>, <animate>.
+ *
+ * @since 1.0
+ * @param None
+ * @return ETrue if element is viewable.
+ */
+ TBool IsViewable() { return ETrue; }
+
+ TBool IsEditable();
+
+ /**
+ * Notified when the mouse pointer enters a visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ TBool MouseEntered( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Notified when the mouse pointer exits a visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ TBool MouseExited( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Notified when the mouse pointer exits a visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ TBool MouseMoved( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+
+ /**
+ * Notified when the mouse pointer is pressed down on visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ TBool MousePressed( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ /**
+ * Notified when the mouse pointer is released on on visible svg element.
+ *
+ * @since 1.0
+ * param : aElements -- SVG elements containing the mouse point.
+ * param : aX -- x coordinate of mouse pointer.
+ * param : aY -- y coordinate of mouse pointer.
+ * @return : For future use. Value is ignored.
+ */
+ TBool MouseReleased( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY );
+
+ inline TInt FileOffset() const
+ {
+ return iOffset;
+ }
+
+ inline void SetFileOffset(TInt aOffset)
+ {
+ if(! FileOffset())
+ iOffset = aOffset;
+ };
+
+ inline void SetOrgLength(TInt aOrgLength)
+ {
+ if(!GetOrgLength())
+ iOrgLength = aOrgLength;
+ };
+
+ inline TInt GetOrgLength()
+ {
+ return iOrgLength;
+ }
+ TFloatFixPt GetTotalTextAdvance(const TFloatFixPt& alK,const TFloatFixPt& alUnitsPerEmInverse,const TFloatFixPt& alFontSize,const TFloatFixPt& alMissingGlyphHorzAdvX,const TFloatFixPt& alFontHorzAdvX);
+
+ CFont* iBitmapFont;
+ TFontSpec iBitmapFontSpec; //New
+
+ private:
+
+ void GetScaledFont( TFloatFixPt aHeight,
+ const TDesC& aTypefaceName,
+ CFont*& aFont,
+ TFontSpec& aFontSpec );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgTextElementImpl( CSvgDocumentImpl* aDoc );
+
+ TBool FetchSvgFontL(const TDesC& aUri, CSvgDocumentImpl* aNewFontDoc);
+ //TBool LoadDefaultSvgFont(CSvgDocumentImpl* aNewFontDoc);
+
+
+private:
+ // Text element specific instance variables
+ HBufC* iText;
+ TFloatFixPt iScale;
+ TGfxPoint2D iPoint;
+ TReal iLetterSpacing;
+ TReal iWordSpacing;
+ TReal iRotate;
+ CDesCArrayFlat* iFamilies;
+ CArrayFixFlat<TFloatFixPt>* iArrayX;
+ CArrayFixFlat<TFloatFixPt>* iArrayY;
+ CArrayFixFlat<TReal32>* iArrayRotate;
+ TInt8 iTextAnchor;
+ TInt8 iTextDecoration;
+
+ RPointerArray<CSvgElementImpl> iGlyphElements;
+
+ HBufC* iG1;
+ HBufC* iG2;
+
+ HBufC* iU1;
+ HBufC* iU2;
+
+ TBool iNeedToCacheGlyphs;
+ TBool iUseDefaultSVGFont;
+ TBool iTriedLoadingSVGFonts;
+
+ CWsScreenDevice* iWsScreenDevice; //New
+ CSvgElementImpl* iSVGFont;
+
+ CSvgElementImpl* iFontFaceElement;
+ CSvgElementImpl* iMissingGlyphElement;
+ CSvgElementImpl* iHkernElement;
+
+ TGfxRectangle2D iSVGBbox;
+ TBool iEditable;
+
+public:
+ TInt iOffset;
+ TInt iOrgLength;
+ TSize iBoundingBox;
+ CFont* iFont;
+
+ CGfx2dGc* iGfx2dGc;
+ };
+
+#endif /* _INC_CSVGTEXTELEMENT_3C61A6080051_INCLUDED */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGTimeContainer.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,683 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Defines an encapsulation for timed entities belonging to a
+* logical group
+*
+*/
+
+
+
+#ifndef CSVGTIMECONTAINER_H
+#define CSVGTIMECONTAINER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+#include <e32def.h>
+#include "SVGTimedEntityInterface.h"
+#include "SVGTimer.h"
+
+
+
+#include "SVGMediaElementBase.h"
+
+
+
+
+//User state
+enum TSvgEntityUserState
+{
+ ESvgUserRunning,
+ ESvgUserPaused,
+ ESvgUserStopped
+};
+
+//Media state
+enum TSvgEntityMediaState
+{
+ ESvgMediaIdle,
+ ESvgMediaNotReady,
+ ESvgMediaReady
+};
+
+
+
+// FORWARD DECLARATIONS
+class CSvgDocumentImpl;
+
+class CSvgLockedRealTimeEntity;
+// CLASS DECLARATION
+/**
+ * Defines a timed entity list item. It stores the timed entity pointer and
+ * state(NotReady/Ready).
+ */
+class TSvgTimedEntityListItem
+ {
+ public:
+
+ // Pointer to timed entity
+ MSvgTimedEntityInterface* iTimedEntity;
+ // Indicates the user state of the timed entity ( Running/Paused/Stopped)
+ TSvgEntityUserState iUserState;
+ // Indicates the Media state of the timed entity (Ready/NotReady/Idle)
+ TSvgEntityMediaState iMediaState;
+ // Indicates the sync status of the timed entity (True = Paused/False = Playing)
+ TBool iIsSyncPaused;
+
+
+ };
+
+/**
+* This interface can be to observe the time container state changes.
+* For eg. by animation element to observe the child time container state
+* changes and propogate the same to parent time container.
+* @lib SVGTEngine.lib
+* @since S60 3.2
+*/
+class MSvgTimeContainerObserver
+ {
+ public: // New functions
+ /**
+ * Indicates that all locked elements are ready to render.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ virtual void TimeContainerReady() = 0;
+
+ /**
+ * Indicates that at least one locked element is not ready to render.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ virtual void TimeContainerNotReady() = 0;
+ };
+/**
+* Defines an encapsulation for timed entities belonging to a logical group.
+* The time container decides the timing clock fed to the timed entities belonging
+* to it based on which entity has been resolved as timing master within the group.
+* The time container could belong to another parent time container. The child
+* container behaves as a timed entity from point of view of the parent time
+* container.
+*
+* @lib SVGTEngine.lib
+* @since S60 3.2
+*/
+NONSHARABLE_CLASS( CSvgTimeContainer ) : public CBase,
+ public MSvgTimedEntityInterface
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ * @param aOwnerDoc Owner SVG Document
+ * aHasParent Indicates whether this timecontainer is the top level
+ * container
+ * aSyncBehavior Sync Behaviour of this container wrt to parent
+ * aIsSyncMaster Is this TC a sync master wrt to parent
+ * aSyncTolerance Tolerance configured for the TC (in msecs)
+ * @return CSvgTimeContainer* Pointer to constructed object
+ */
+ static CSvgTimeContainer* NewL( CSvgDocumentImpl* aOwnerDoc,
+ const TBool aHasParent,
+ const TSvgSyncBehaviour aSyncBehavior = ESvgSyncLocked,
+ const TBool aIsSyncMaster = EFalse,
+ const TUint32 aSyncTolerance = KSvgDefaultSyncTolerance );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CSvgTimeContainer();
+
+ public: // New functions
+ /**
+ * Resolves the sync master within the time container and returns
+ * the same.
+ * @since S60 3.2
+ * @param none.
+ * @return MSvgTimedEntityInterface* Pointer to Sync Master Implementation
+ */
+ MSvgTimedEntityInterface* GetSyncMasterForTimeContainer();
+
+ /**
+ * Add a timed entity to the time container.
+ * @since S60 3.2
+ * @param aTimedEntity An SVG Timed entity that should be added to this
+ * container(that implements the
+ * MSvgTimedEntityInterface)
+ * @return None
+ */
+ void AddTimedEntityL( MSvgTimedEntityInterface* aTimedEntity );
+
+ /**
+ * Removes the timed entity from the time container.
+ * @since S60 3.2
+ * @param aTimedEntity An SVG Timed entity that should be added to this
+ * container(that implements the
+ * MSvgTimedEntityInterface)
+ * @return None
+ */
+ void DelTimedEntity( MSvgTimedEntityInterface* aTimedEntity );
+
+
+ /**
+ * Removes all the timed entities from the time container.
+ * @since S60 3.2
+ * @param None
+ * @return None
+ */
+ void CleanupTimedEntities( );
+ /**
+ * Set Function for the TC's current time
+ * @since S60 3.2
+ * @param aCurTime Current Time to be set in msecs
+ * @return none.
+ */
+ void SetCurrentTime( const TInt32 aCurTime );
+
+ /**
+ * Accessor Function for the TC's current time
+ * @since S60 3.2
+ * @param none.
+ * @return TInt32 Current Time to be set in msecs.
+ */
+ TInt32 CurrentTime();
+
+ /**
+ * Set the Synchronised behaviour for the time container
+ * @since S60 3.2
+ * @param aValue canSlip | locked | independent
+ * @return none.
+ */
+ void SetSyncBehavior( const TSvgSyncBehaviour aValue );
+
+ /**
+ * Set the Synchronised Tolerance for the time container
+ * @since S60 3.2
+ * @param aValue Clock-value in milliseconds
+ * @return none.
+ */
+ void SetSyncTolerance( const TUint32 aValue );
+
+ /**
+ * Set the time container as Synchronised Master
+ * @since S60 3.2
+ * @param aValue true | false
+ * @return none.
+ */
+ void SetSyncMaster( const TBool aValue );
+
+ /**
+ * Accessor function to get the current tick in the TC
+ * @since S60 3.2
+ * @param none.
+ * @return TSvgTick Current tick information.
+ */
+ TSvgTick GetCurTick();
+
+ /**
+ * Accessor function to get the owner svg doc of the TC
+ * @since S60 3.2
+ * @param none.
+ * @return CSvgDocumentImpl* Document Pointer
+ */
+ CSvgDocumentImpl* Document();
+
+ /**
+ * Informing the time container that timed entity is not ready
+ * @since S60 3.2
+ * @param aTimeDuration time duration in msecs.
+ * @return none.
+ */
+ void TimedEntityNotReady( MSvgTimedEntityInterface* aTimedEntity );
+
+ /**
+ * Informing the time container that timed entity is ready
+ * @since S60 3.2
+ * @param aTimeDuration time duration in msecs.
+ * @return none.
+ */
+ void TimedEntityReady( MSvgTimedEntityInterface* aTimedEntity );
+
+
+ /**
+ * Sets the observer for the time container state changes.
+ * @since Series 3.2
+ * @param aTCObserver Time container observer(NULL if not used)
+ * @return none.
+ */
+ void SetTcObserver( MSvgTimeContainerObserver* aTCObserver );
+
+ /**
+ * Called to handle user/client generated stop event
+ * @since Series 3.2
+ * @param none.
+ * @return none.
+ */
+ void UserStop();
+
+ /**
+ * Called to handle user/client generated resume event
+ * @since Series 3.2
+ * @param aTime Time in msecs to resume after.
+ * @return none.
+ */
+ void UserResume( TInt32 aTime = KMinSleepDurationInMsecs );
+
+ /**
+ * Called to handle user/client generated play event
+ * @since Series 3.2
+ * @param none.
+ * @return none.
+ */
+ void UserPlay();
+
+ /**
+ * Called to handle user/client generated pause event
+ * @since Series 3.2
+ * @param none.
+ * @return none.
+ */
+ void UserPause();
+
+ /**
+ * Called to handle user/client generated seek event
+ * @since Series 3.2
+ * @param aTime Time expressed in msecs.
+ * @return none.
+ */
+ void UserSeek( TInt aTime );
+
+ /**
+ * Resets the time variables in the timer
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void UserResetTime();
+
+ /**
+ * Changes the frame duration in the timer
+ * @since S60 3.2
+ * @param aTimeDuration time duration in msecs.
+ * @return none.
+ */
+ void UserChangeFrameDuration( TUint32 aTimerDuration );
+
+ /**
+ * Debug api to obtain FPS info
+ * @since S60 3.2
+ * @param none.
+ * @return TUint FPS info.
+ */
+ TUint UserFps();
+
+
+ /**Element to resume after it gets a goahead from sync
+ * @since S60 3.2
+ * @param TSvgTimedEntityListItem
+ * @return none
+ */
+ void SyncResumeElement(TSvgTimedEntityListItem* aTimedEntity);
+
+ /**Element to pause after it gets Paused due to sync
+ * @since S60 3.2
+ * @param TSvgTimedEntityListItem
+ * @return none
+ */
+ void SyncPauseElement(TSvgTimedEntityListItem* aTimedEntity);
+
+ /**User calls resume
+ * @since S60 3.2
+ * @param TSvgTimedEntityListItem
+ * @return none
+ */
+ void UserResumeElement(TSvgTimedEntityListItem* aTimedEntity);
+
+ /**User Stop is called
+ * @since S60 3.2
+ * @param TSvgTimedEntityListItem
+ * @return none
+ */
+ void UserStopElement(TSvgTimedEntityListItem* aTimedEntity);
+
+ /**User Pause
+ * @since S60 3.2
+ * @param TSvgTimedEntityListItem
+ * @return none
+ */
+ void UserPauseElement(TSvgTimedEntityListItem* aTimedEntity);
+
+ /**To pause tc
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void SyncPause();
+
+ /**to resume tc
+ * @since S60 3.2
+ * @param none
+ * @return none
+ */
+ void SyncResume();
+
+
+ public: // Functions from base classes
+ /**
+ * From MSvgTimedEntityInterface
+ * The parent time container provides the timing clock to
+ * the timed entity (audio, video, animation, document)
+ * using this routine.
+ * @since Series 3.2
+ * @param aTick Current tick information
+ * @return none.
+ */
+ void ParentTimeContainerTick( TSvgTick aTick );
+
+ /**
+ * From MSvgTimedEntityInterface
+ * Returns the sync behavior of the entity.
+ * @since Series 3.2
+ * @param none.
+ * @return TSvgSyncBehaviour Element's Sync Behaviour.
+ */
+ TSvgSyncBehaviour GetEntitySyncBehavior();
+
+ /**
+ * From MSvgTimedEntityInterface
+ * When the timed entity acts as timing master in the time container,
+ * the time container gets the timed entity clock using this method
+ * and feeds to rest of timed entities.
+ * @since Series 3.2
+ * @param aEntityCurTime Current Entity Time in msecs.
+ * @return none.
+ */
+ void GetEntityCurrentTime( TUint32& aEntityCurTime );
+
+ /**
+ * From MSvgTimedEntityInterface
+ * Returns the configured sync master value(as per DOM tree) as specified
+ * in the SVG content.
+ * @since Series 3.2
+ * @param aIsSyncMaster Indicates whether the element is configured as
+ * Sync Master.
+ * @return none.
+ */
+ void GetCnfSyncMasterStatus( TBool& aIsSyncMaster );
+
+ /**
+ * From MSvgTimedEntityInterface
+ * Check if timed entity is going to act as timing master in the
+ * time container. This behavior could change dynamically.
+ * @since Series 3.2
+ * @param aIsSyncMaster Indicates whether the element is currrently Sync Master.
+ * @return none.
+ */
+ void GetCurSyncMasterStatus( TBool& isSyncMaster );
+
+ /**
+ * From MSvgTimedEntityInterface
+ * If some other element is resolved as syncMaster in the time container group,
+ * this element can not act as sync master.
+ * @since Series 3.2
+ * @param aSyncMasterStatus Indicates whether the element is currrently
+ * Sync Master.
+ * @return none.
+ */
+ void SetCurSyncMasterStatus( TBool aSyncMasterStatus );
+
+ /**
+ * From MSvgTimedEntityInterface
+ * Check if timed entity can provide timing ticks to rest of time
+ * container elements. This behavior could change dynamically.
+ * For example, if audio clip is over, the audio element can't generate
+ * ticks for others.
+ * @since Series 3.2
+ * @param none.
+ * @return TBool True if can generate timing tick.
+ */
+ TBool CanGenerateTick();
+
+ /**
+ * Check if timed entity can use its parent's tick. Usually only the
+ * parent document should return true for this function.
+ * All other elements return false
+ * @since Series 3.2
+ * @param none.
+ * @return TBool True if can use parent's timing tick.
+ */
+ TBool CanUseParentTick();
+
+ /**
+ * From MSvgTimedEntityInterface
+ * If the timed entity needs to be in sync with the time container and
+ * it has slipped beyond the sync tolerance limit, the method is called to
+ * bring the element in sync with the time container.
+ * @since Series 3.2
+ * @param aSynctime Time for resync in msecs.
+ * @return none.
+ */
+ void ResyncTimedEntity( TUint32 aSynctime );
+
+ /**
+ * From MSvgTimedEntityInterface
+ * This would be used for pausing the timed entity while other locked
+ * timed entities get loaded.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void PauseTimedEntity();
+
+ /**
+ * From MSvgTimedEntityInterface
+ * This would be used for resuming the timed entity once all locked
+ * timed entities get loaded.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void ResumeTimedEntity();
+
+ /**
+ * From MSvgTimedEntityInterface
+ * This would be used for stopping the timed entity.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ void StopTimedEntity();
+
+
+ /*
+ * From MSvgTimedEntityInterface
+ * Would return the type of object
+ * @param none
+ * @return type of object
+ */
+ TSvgObjectType ObjectType();
+
+
+ /*
+ * From MsvgTimedEntityInterface
+ * @param none
+ * @return CSvgTimeContainer
+ */
+ CSvgTimeContainer* GetChildTimeContainer();
+
+ protected: // New functions
+
+
+
+ protected: // Functions from base classes
+
+
+
+ private:
+
+ /**
+ * C++ default constructor.
+ * @param aOwnerDoc Owner SVG Document
+ * aHasParent Indicates whether this timecontainer is the top level
+ * container
+ * aSyncBehavior Sync Behaviour of this container wrt to parent
+ * aIsSyncMaster Is this TC a sync master wrt to parent
+ * aSyncTolerance Tolerance configured for the TC (in msecs)
+ */
+ CSvgTimeContainer( CSvgDocumentImpl* aOwnerDoc,
+ const TBool aHasParent, const TSvgSyncBehaviour aSyncBehavior,
+ const TBool aIsSyncMaster, const TUint32 aSyncTolerance );
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ // Prohibit copy constructor if not deriving from CBase.
+ // CSvgTimeContainer( const CSvgTimeContainer& );
+ // Prohibit assigment operator if not deriving from CBase.
+ // CSvgTimeContainer& operator=( const CSvgTimeContainer& );
+
+ /**
+ * Propogate tick to all elements in time container
+ * @param aTick Tick information to be propogated
+ */
+ void PropogateTickToContainerElements( TSvgTick& aTick );
+
+ /**
+ * Rearrange the timed entities as per post order
+ * @param aPostOrderList - List of CSvgElementImpl( which are Media
+ * Elements) in post order
+ */
+ void RearrangeTimedEntityList( RPointerArray<CSvgElementImpl>&
+ aPostOrderList );
+
+ /**
+ * Pauses the time container's locked entities. Called by
+ * animation element to indicate that the PauseTimedEntity()
+ * is called on it.
+ * @since Series 3.2
+ * @param none.
+ * @return none.
+ */
+ void PauseLockedEntities();
+
+ /**
+ * Resumes the time container's locked entities. Called by
+ * animation element to indicate that the ResumeTimedEntity()
+ * is called on it.
+ * @since Series 3.2
+ * @param none.
+ * @return none.
+ */
+ void ResumeLockedEntities();
+
+
+ public: // Data
+ // ?one_line_short_description_of_data
+ //?data_declaration;
+
+ /*
+ * Sets the time continer user state to the specified state
+ * @param user state to be set
+ * @return None
+ */
+ void SetUserState(TSvgEntityUserState state);
+
+ /*
+ * Sets the time continer media state to the specified state
+ * @param media state to be set
+ * @return None
+ */
+ void SetMediaState(TSvgEntityMediaState state);
+
+ /*
+ * Sets the time continer Sync state to the specified state
+ * @param sync state to be set
+ * @return None
+ */
+ void SetSyncState(TBool state);
+
+ protected: // Data
+ // ?one_line_short_description_of_data
+ //?data_declaration;
+ private:
+
+
+ private: // Data
+ // The time container's sync behavior with respect to its parent
+ // time container.
+ TSvgSyncBehaviour iTcSyncBehavior;
+ // Sync Tolerance configured for the time container (in msecs)
+ TUint32 iTcSyncTolerance;
+ // The time container's sync Master behavior defined in SVG file.
+ TBool iTcSyncMasterConfig;
+ // Is the timer container acting as timing master for parent
+ // time container currently?
+ TBool iTcSyncMasterCurrent;
+ // Sync Behavior default value for the timed entities within the
+ // time container, if they do not have the sync behavior defined for
+ // them.
+ TSvgSyncBehaviour iTcSyncBehaviorDefault;
+ // Sync Tolerance limit default value (in msecs) for the timed
+ // entities within the time container, if they do not have the sync
+ // tolerance defined for them.
+ TUint32 iTcSyncToleranceDefault;
+ // Pointer to the timed entity acting as the timing master within the
+ // time container. The sync master element could change dynamically.
+ MSvgTimedEntityInterface* iTcSyncMaster;
+ // The list of the timed entities belonging to this time container.
+ RArray<TSvgTimedEntityListItem> iTcTimedEntities;
+ // The flag defining whether the time container has a parent time
+ // container to which it belongs.
+ TBool iIsParentTcPresent;
+ // If there is no parent time container to which the time container
+ // belongs, then the time container creates its own timing clock by
+ // installing this timer.
+ CSvgTimer* iTimer;
+ // Current time in msecs
+ TInt32 iCurrentTime;
+ // Current Tick stored here so that it can be accessed by
+ // timed entities which are offset
+ TSvgTick iCurrentTick;
+ // Owner SVG Document Impl
+ CSvgDocumentImpl* iOwnerDoc;
+ // Time container observer implementation pointer
+ MSvgTimeContainerObserver* iObserver;
+ // Time container Media state information
+ TSvgEntityMediaState iMediaState;
+ //Time Container User state information
+ TSvgEntityUserState iUserState;
+ //Sync information abt the timecontainer
+ TBool iIsSyncPaused;
+
+ // The Locked real time entity is a special timed entity
+ // and the list item entry is owned by the time container
+ TSvgTimedEntityListItem iLrteListItem;
+
+ // Locked real time entity pointer - owned
+ CSvgLockedRealTimeEntity* iLrte;
+
+ // Reserved pointer for future extension
+ //TAny* iReserved;
+
+
+
+ };
+
+#endif // CSVGTIMECONTAINER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGTimedEntityInterface.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,224 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This is the interface that is to be implemented by
+* all media elements.
+*
+*/
+
+
+
+#ifndef MSVGTIMEDENTITYINTERFACE_H
+#define MSVGTIMEDENTITYINTERFACE_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32def.h>
+
+// MACROS
+//#define ?macro ?macro_def
+
+// DATA TYPES
+enum TSvgSyncBehaviour
+ {
+ ESvgSyncDefault = 0,
+ ESvgSyncCanSlip,
+ ESvgSyncLocked,
+ ESvgSyncIndependent
+ };
+
+
+
+enum TSvgObjectType
+{
+ ESvgInvalidReference = 0,
+ ESvgAudioElement,
+ ESvgMediaAnimationElement,
+ ESvgDocumentElement,
+ ESvgLockedRealTimeEntity
+};
+
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+// Default Sync Behaviour is locked
+const TSvgSyncBehaviour KSvgDefaultSyncBehaviour = ESvgSyncLocked;
+// Default Sync Tolerance is 2 sec
+const TUint32 KSvgDefaultSyncTolerance = 2*1000;
+
+// CLASS DECLARATION
+class CSvgTimeContainer;
+/**
+* This class stores the current tick timestamp and the parent time container tick.
+* This is used to propogate the tick from sync master to the rest of the members
+* in the time container (or) if the syncmaster cannot generate a tick then the
+* real time tick is used.
+*
+* @lib SVGTEngine.lib
+* @since S60 3.2
+*/
+class TSvgTick
+ {
+ public: // Data
+ // Real time tick expressed in msecs from start of timer
+ TUint32 iRealTimeTick;
+ // Parent time container tick expressed in msecs
+ TUint32 iParentTcTick;
+ };
+
+
+/**
+* Interface exported by all media elements.
+* This interface class specifies the interface for implementing
+* runtime synchronisation. This interface is inherited by
+* media elements such as audio/animation which provide element
+* specific processing.
+* Since the root SVG possesses an implicit time container the
+* document also needs to implement this interface.
+*
+* @lib SVGTEngine.lib
+* @since S60 3.2
+*/
+class MSvgTimedEntityInterface
+ {
+ public: // New functions
+ /**
+ * The parent time container provides the timing clock to
+ * the timed entity (audio, video, animation, document)
+ * using this routine.
+ * @since S60 3.2
+ * @param aTick Current tick information
+ * @return none.
+ */
+ virtual void ParentTimeContainerTick( TSvgTick aTick ) = 0;
+
+ /**
+ * Returns the sync behavior of the entity.
+ * @since S60 3.2
+ * @param none.
+ * @return TSvgSyncBehaviour Element's Sync Behaviour.
+ */
+ virtual TSvgSyncBehaviour GetEntitySyncBehavior() = 0;
+
+ /**
+ * When the timed entity acts as timing master in the time container,
+ * the time container gets the timed entity clock using this method
+ * and feeds to rest of timed entities.
+ * @since S60 3.2
+ * @param aEntityCurTime Current Entity Time in msecs.
+ * @return none.
+ */
+ virtual void GetEntityCurrentTime( TUint32&
+ aEntityCurTime ) = 0;
+
+ /**
+ * Returns the configured sync master value(as per DOM tree) as specified
+ * in the SVG content.
+ * @since S60 3.2
+ * @param aIsSyncMaster Indicates whether the element is configured as
+ * Sync Master.
+ * @return none.
+ */
+ virtual void GetCnfSyncMasterStatus( TBool& aIsSyncMaster ) = 0;
+
+ /**
+ * Check if timed entity is going to act as timing master in the
+ * time container. This behavior could change dynamically.
+ * @since S60 3.2
+ * @param aIsSyncMaster Indicates whether the element is currrently Sync Master.
+ * @return none.
+ */
+ virtual void GetCurSyncMasterStatus( TBool& isSyncMaster ) = 0;
+
+ /**
+ * If some other element is resolved as syncMaster in the time container group,
+ * this element can not act as sync master.
+ * @since S60 3.2
+ * @param aSyncMasterStatus Indicates whether the element is currrently
+ * Sync Master.
+ * @return none.
+ */
+ virtual void SetCurSyncMasterStatus( TBool aSyncMasterStatus ) = 0;
+
+ /**
+ * Check if timed entity can provide timing ticks to rest of time
+ * container elements. This behavior could change dynamically.
+ * For example, if audio clip is over, the audio element can't generate
+ * ticks for others.
+ * @since S60 3.2
+ * @param none.
+ * @return TBool True if can generate timing tick.
+ */
+ virtual TBool CanGenerateTick() = 0;
+
+ /**
+ * Check if timed entity can use its parent's tick. Usually only the
+ * parent document should return true for this function.
+ * All other elements return false
+ * @since S60 3.2
+ * @param none.
+ * @return TBool True if can use parent's timing tick.
+ */
+ virtual TBool CanUseParentTick() = 0;
+
+ /**
+ * If the timed entity needs to be in sync with the time container and
+ * it has slipped beyond the sync tolerance limit, the method is called to
+ * bring the element in sync with the time container.
+ * @since S60 3.2
+ * @param aSynctime Time for resync in msecs.
+ * @return none.
+ */
+ virtual void ResyncTimedEntity( TUint32 aSynctime ) = 0;
+
+ /**
+ * This would be used for pausing the locked timed entity while other locked
+ * timed entities get loaded.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ virtual void PauseTimedEntity() = 0;
+
+ /**
+ * This would be used for resuming the locked timed entity once all locked
+ * timed entities get loaded.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ virtual void ResumeTimedEntity() = 0;
+
+ /**
+ * This would be used for stopping the timed entity.
+ * @since S60 3.2
+ * @param none.
+ * @return none.
+ */
+ virtual void StopTimedEntity() = 0;
+
+
+ /* Return the type of class
+ @Return Type Enumeration of object type
+ @Parameters none
+ */
+ virtual TSvgObjectType ObjectType() = 0;
+
+
+ virtual CSvgTimeContainer* GetChildTimeContainer() = 0;
+
+ };
+
+#endif // MSVGTIMEDENTITYINTERFACE_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGTitleElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGTITLEELEMENTIMPL_
+#define _INC_CSVGTITLEELEMENTIMPL_
+
+#include "SVGElementImpl.h"
+#include "GfxFloatFixPt.h"
+
+class CSvgDocumentImpl;
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgTitleElementImpl : public CSvgElementImpl
+ {
+ public:
+
+ // Constructor/deconstructor
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgTitleElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgTitleElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgTitleElementImpl();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+ TInt SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue );
+
+ TInt GetAttributeDes( const TInt aNameId, TPtrC16& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ void CopyL( CSvgTitleElementImpl* aDestElement );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+
+ void Print( TBool aIsEncodeOn );
+
+ void SetTextL( const TDesC& aText );
+
+ private:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgTitleElementImpl( CSvgDocumentImpl* aDoc );
+
+
+
+ HBufC* iText;
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGTokenizer.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine header file
+ *
+*/
+
+
+#ifndef __INC_TTokenizer__
+#define __INC_TTokenizer__
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+class TTokenizer
+{
+public:
+ TTokenizer( const TPtrC& aString );
+
+ TBool IsAtEnd();
+ TInt EndIndex();
+
+ TUint16 NextChar();
+ void Advance( TInt count = 1 );
+
+ TBool SkipWhiteSpace();
+ TBool SkipInteger();
+ TBool SkipDecimal();
+ TBool SkipHex();
+
+ TBool SkipUntilEnd( );
+ TBool SkipUntil( TUint16 aChar );
+
+ TBool StartsWith( const TDesC& aString );
+
+ TPtrC SkippedString();
+
+ TPtrC Remainder();
+
+ static TBool IsWhiteSpace( TUint16 aChar );
+ static TBool IsDigit( TUint16 aChar );
+ static TBool IsHexDigit( TUint16 aChar );
+
+ static TInt IndexOf( const TDesC& aString, TUint16 aChar );
+
+ // return a trim string at both ends
+ static TPtrC Trim( const TDesC& aString );
+
+ static TBool ParseDecimal( const TDesC& aString, TReal32& aValue, TPtrC& aRemainder );
+
+
+
+private:
+ TPtrC iString;
+ TInt iCurrentIndex;
+ TInt iPreviousIndex;
+
+};
+
+
+#endif //__INC_TTokenizer__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGTransformListImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,211 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_CSVGTRANSFORMLISTIMPL__
+#define __INC_CSVGTRANSFORMLISTIMPL__
+
+
+#include "SVGTransformList.h"
+
+class TGfxAffineTransform;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgTransformListImpl : public CBase, public MSvgTransformList
+ {
+ public:
+
+ // Constructor/deconstructor
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgTransformListImpl* NewL();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgTransformListImpl* NewLC();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgTransformListImpl();
+
+ // From SVG DOM
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool AppendItemL( TGfxAffineTransform& aNewItem );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool AppendItemL( TGfxAffineTransform& aNewItem,
+ TInt32 aAdditive,
+ TInt32 aSourceAnimMotion );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void Clear();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TGfxAffineTransform Consolidate(TBool aOverwrite);
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TGfxAffineTransform GetItem( TInt index );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt NumberOfItems();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TGfxAffineTransform InitializeL( TGfxAffineTransform& newItem );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TGfxAffineTransform ReplaceItem( TGfxAffineTransform newItem,
+ int index );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetAdditive( TInt32 additive,
+ TInt32 index );
+
+ private:
+
+ RArray<TGfxAffineTransform> iTransformations;
+
+ // -1 do nothing 1 ETrue: Additive. 0 EFalse: Replace
+ RArray<TInt32> iTransformAdditive;
+
+
+ // 1 animmotion, 2 animtransf, 0 else ETrue: Set by animMotion, EFalse: other (e.g. animTransform)
+ RArray<TInt32> iTransformTypes;
+
+ TBool iAvoidConsolidation;
+ TGfxAffineTransform iConsolidatedMatrix;
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgTransformListImpl();
+
+ public:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgTransformListImpl* CloneL();
+
+ void SetAvoidConsolidation(TBool aAvoidConsolidation);
+ };
+
+#endif /* __INC_CSVGTRANSFORMLISTIMPL__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGTransformableImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,167 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_CSVGTRANSFORMABLEIMPL__
+#define __INC_CSVGTRANSFORMABLEIMPL__
+
+#include "SVGTransformable.h"
+#include "SVGTransformListImpl.h"
+
+class TGfxAffineTransform;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgTransformableImpl : public CBase, public MSvgTransformable
+ {
+ public:
+
+ // Constructor/deconstructor
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgTransformableImpl* NewL();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgTransformableImpl* NewLC();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgTransformableImpl();
+
+ // From MSvgTransformable
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetTransform( MSvgTransformList*& aTransformList );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetTransform( MSvgTransformList*& aTransformList );
+
+
+ void SetTransformList(TGfxAffineTransform& aTr);
+
+ // From MSvgLocatable
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ const TGfxAffineTransform& GetCTM();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetCTM( TGfxAffineTransform& aTr );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetBBox( TGfxRectangle2D& /*aBbox*/ )
+ {
+ }
+
+ private:
+
+ TGfxAffineTransform iCTM;
+
+ CSvgTransformListImpl* iTransform;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgTransformableImpl();
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgTransformableImpl* CloneL();
+
+ };
+
+#endif /* __INC_MSVGTRANSFORMABLE__ */
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGUriReferenceImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,201 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_CSVGURIREFERENCEIMPL__
+#define __INC_CSVGURIREFERENCEIMPL__
+
+#include <e32base.h>
+#include <badesca.h>
+
+#include "SVGUriReference.h"
+
+/// Implements Xlink interface. Elements implementing this interface should
+/// provide wrappers. Note that not all SVG elements implement this interface
+/// in SVG DOM.
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgUriReferenceImpl : public CBase, public MSvgUriReference
+ {
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgUriReferenceImpl* NewL();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgUriReferenceImpl* NewLC();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ ~CSvgUriReferenceImpl();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ const TDesC& XlinkActuate();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ const TDesC& XlinkArcrole();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ const TDesC& XlinkRole();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ const TDesC& XlinkShow();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ const TDesC& XlinkTitle();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ const TDesC& XlinkType();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ const TDesC& XlinkHref();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ const TDesC& Href(); // for the SVG DOM
+
+ TDesC* HrefPointer();
+
+ // Implementation
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool SetXlinkAttributeL( const TDesC& aPropertyName,
+ const TDesC& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgUriReferenceImpl* CloneL();
+
+ TInt SetUriRefDesL( const TUint16 aPropertyName,
+ const TDesC& aValue );
+
+
+ private:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL();
+
+ HBufC* iXlinkActuate;
+ HBufC* iXlinkArcrole;
+ HBufC* iXlinkRole;
+ HBufC* iXlinkShow;
+ HBufC* iXlinkTitle;
+ HBufC* iXlinkType;
+ HBufC* iXlinkHref;
+ };
+
+#endif /* __INC_CSVGURIReferenceImpl__ */
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGUseElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,257 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGUSEELEMENTIMPL_
+#define _INC_CSVGUSEELEMENTIMPL_
+
+//#include "SVGStructuralElementImpl.h"
+#include "SVGElementImpl.h"
+#include "GfxFloatFixPt.h"
+#include "SVGSchemaData.h"
+
+
+class CSvgDocumentImpl;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgUseElementImpl : public CSvgElementImpl
+ {
+ public:
+
+ // Constructor/deconstructor
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgUseElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgUseElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ private:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgUseElementImpl();
+
+ // From SVG DOM: Empty
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt X();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Y();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Width();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt Height();
+
+ // SVG Implementation: Empty
+
+
+ // From MXmlElement API
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetBBox( TGfxRectangle2D& aBbox );
+ void GetBoundingBox(TGfxRectangle2D& aBbox);
+ void GetUnscaledBBox( TGfxRectangle2D& aBbox );
+
+ TInt SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue );
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+ // From CSvgElementImpl
+
+ TInt SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue );
+
+ TInt GetAttributeDes( const TInt aNameId, TPtrC16& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void CopyL( CSvgUseElementImpl* aDestElement );
+
+ void Print( TBool aIsEncodeOn );
+
+ /**
+ * Return wether an svg element is displayable, such as <rect>, <circle>, or
+ * an abstract element, such as <g>, <animate>.
+ *
+ * @since 1.0
+ * @param None
+ * @return ETrue if element is viewable.
+ */
+ TBool IsViewable();
+
+ CSvgElementImpl* GetReferenceElementL();
+ private:
+
+ TFloatFixPt iX;
+ //TBool iXSet;
+
+ TFloatFixPt iY;
+ //TBool iYSet;
+
+ TFloatFixPt iWidth;
+
+ TFloatFixPt iHeight;
+
+ CSvgElementImpl* ireferenceEl;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgUseElementImpl( CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+// void DeepClone( MXmlElement* );
+
+
+ public:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void SetReferenceElementL( );
+
+ TInt SetRefElemById(const TDesC& aName);
+
+ CSvgUseElementImpl* iUseElementThatUsesThisUse;
+
+ HBufC* iUseHRef;
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGVectorCssValueImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef __INC_CVECTORCSSVALUEIMPL__
+#define __INC_CVECTORCSSVALUEIMPL__
+
+
+#include "SVGCssValue.h"
+
+#include "GfxFloatFixPt.h"
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+
+class CVectorCssValueImpl : public CCssValue
+
+ {
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ ~CVectorCssValueImpl();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetValueL( const TDesC& aValue );
+
+ void SetValueL( CArrayFix<TFloatFixPt>*& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void Value( CArrayFix<TFloatFixPt>*& );
+
+ CArrayFix<TFloatFixPt>* Value( );
+
+
+ void CloneValueL( CArrayFix<TFloatFixPt>*& aValue );
+ CVectorCssValueImpl(CArrayFix<TFloatFixPt>* aValue );
+
+
+ TBool IsEqual(CCssValue* aValue);
+
+ void Print();
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CVectorCssValueImpl( );
+ private:
+
+
+
+
+ CArrayFix<TFloatFixPt>* iValue;
+ };
+
+#endif /* __INC_CVECTORCSSVALUEIMPL__ */
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SVGXmlElementOpt.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,137 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_MXMLELEMENTOPT_
+#define _INC_MXMLELEMENTOPT_
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+const TInt KErrInvalidAttribute = -11;
+const TInt KErrNoAttribute = -10;
+
+class CGfxGeneralPath;
+class TFloatFixPt;
+class MSvgStylable;
+class CSvgElementImpl;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class MXmlElementOpt
+ {
+ public:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt GetAttributeIntL( const TInt aNameId, TInt32& aValue ) = 0;
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt SetAttributeIntL( const TInt aNameId,
+ const TInt32 aValue ) = 0;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt GetAttributeFloat( const TInt aNameId, TFloatFixPt& aValue ) = 0;
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue ) = 0;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt GetAttributePath( const TInt aNameId,
+ CGfxGeneralPath*& aValue ) = 0;
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt SetAttributePathL( const TInt aNameId,
+ CGfxGeneralPath* aValue ) = 0;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt GetAttributeDes( const TInt aNameId, TPtrC16& aValue ) = 0;
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual TInt SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue ) = 0;
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+
+ };
+
+#endif /* _INC_MXmlElementOpt_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SvgDefaultFont.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,289 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+const char strSVGFont[] = \
+ "<?xml version=\"1.0\" standalone=\"no\"?> <!DOCTYPE svg PUBLIC \"-//W3C//DTD S"\
+ "VG 20000629//EN\" \"svg-20000629.dtd\" > <svg width=\"800\" height=\"600\"> "\
+ " <font id=\"DefaultFont\" font-family=\"DefaultFont\" horiz-adv-x=\"936\"> <font-face font-family=\"DefaultFont\""\
+ " units-per-em=\"2048\" panose-1=\"2 11 5 3 3 4 4 3 2 4\" ascent=\"2080\" "\
+ " descent=\"-440\" baseline=\"0\"/> <missing-glyph horiz-adv-x=\"1024\"><path"\
+ " d=\"M51 0V1536H973V0H51zM179 128H845V1408H179V128z\"/></missing-glyph> <glyph"\
+ " unicode=\" \" horiz-adv-x=\"502\"></glyph> <glyph unicode=\"!\" horiz-adv-x=\""\
+ "600\"><path d=\"M301 -16Q245 -16 205 24T164 121Q164 177 204 217T301 258Q357 258"\
+ " 396 218T436 121Q436 64 397 24T301 -16zM180 1491H416L387 418H211L180 1491z\"/><"\
+ "/glyph> <glyph unicode=\""\" horiz-adv-x=\"842\"><path d=\"M506 1583H725L"\
+ "692 1071H541L506 1583zM117 1583H336L303 1071H152L117 1583z\"/></glyph> <glyph "\
+ "unicode=\"#\" horiz-adv-x=\"1360\"><path d=\"M1274 897H1028L985 584H1221V444H96"\
+ "7L903 0H745L807 444H473L410 0H252L313 444H86V584H332L377 897H139V1034H395L459 1"\
+ "491H618L555 1034H889L954 1491H1112L1049 1034H1274V897zM870 897H535L492 584H827L"\
+ "870 897z\"/></glyph> <glyph unicode=\"$\" horiz-adv-x=\"1053\"><path d=\"M911 "\
+ "1423V1274Q738 1309 627 1309Q319 1309 319 1116Q319 1059 363 1006T581 864Q721 793"\
+ " 795 745T922 621T975 442Q975 284 882 179T623 45V-152H440V35Q292 35 98 84V242Q27"\
+ "8 184 436 184Q758 184 758 397Q758 463 708 524T451 688Q250 787 176 882T102 1090Q"\
+ "102 1231 191 1326T440 1448V1642H623V1460Q763 1460 911 1423z\"/></glyph> <glyph"\
+ " unicode=\"%\" horiz-adv-x=\"1890\"><path d=\"M438 1501Q610 1501 695 1397T780 1"\
+ "069Q780 819 695 718T434 616Q259 616 173 719T86 1069Q86 1285 174 1393T438 1501zM"\
+ "434 735Q526 735 568 813T610 1069Q610 1250 567 1316T434 1382Q343 1382 300 1316T2"\
+ "56 1069Q256 890 299 813T434 735zM1282 1491H1460L610 0H432L1282 1491zM1462 874Q1"\
+ "634 874 1719 771T1804 442Q1804 192 1719 91T1458 -10Q1283 -10 1197 93T1110 442Q1"\
+ "110 658 1198 766T1462 874zM1458 109Q1550 109 1592 187T1634 442Q1634 623 1591 68"\
+ "9T1458 756Q1367 756 1324 689T1280 442Q1280 263 1323 186T1458 109z\"/></glyph> "\
+ "<glyph unicode=\"&\" horiz-adv-x=\"1350\"><path d=\"M1057 0L969 111Q813 -16"\
+ " 588 -16Q355 -16 232 87T109 381Q109 514 176 614T412 817Q305 956 269 1032T233 11"\
+ "76Q233 1337 337 1422T623 1507Q786 1507 882 1431T979 1225Q979 1112 908 1014T672 "\
+ "805L1016 371Q1092 485 1135 670L1292 637Q1237 394 1114 248L1309 0H1057zM580 924Q"\
+ "680 993 729 1063T778 1225Q778 1288 734 1328T616 1368Q438 1368 438 1200Q438 1097"\
+ " 580 924zM877 227L506 698Q328 577 328 393Q328 272 408 202T606 131Q766 131 877 2"\
+ "27z\"/></glyph> <glyph unicode=\"'\" horiz-adv-x=\"453\"><path d=\"M117 1"\
+ "583H336L303 1071H152L117 1583z\"/></glyph> <glyph unicode=\"(\" horiz-adv-x=\""\
+ "700\"><path d=\"M643 -190V-340Q342 -340 231 -125T119 631Q119 1164 229 1381T643 "\
+ "1599V1450Q462 1450 399 1290T336 631Q336 284 360 122T446 -115T643 -190z\"/></gly"\
+ "ph> <glyph unicode=\")\" horiz-adv-x=\"700\"><path d=\"M57 1450V1599Q362 1599 "\
+ "472 1382T582 631Q582 263 534 58T376 -244T57 -340V-190Q246 -190 305 -28T365 631Q"\
+ "365 1128 302 1289T57 1450z\"/></glyph> <glyph unicode=\"*\" horiz-adv-x=\"1012"\
+ "\"><path d=\"M633 1061L950 895L870 758L567 952L588 594H424L444 952L141 758L61 8"\
+ "95L379 1061L61 1225L141 1364L444 1169L424 1528H588L567 1169L870 1364L950 1225L6"\
+ "33 1061z\"/></glyph> <glyph unicode=\"+\" horiz-adv-x=\"1198\"><path d=\"M1065"\
+ " 657H688V283H508V657H135V838H508V1212H688V838H1065V657z\"/></glyph> <glyph uni"\
+ "code=\",\" horiz-adv-x=\"453\"><path d=\"M223 -12Q162 -10 126 25T90 117Q90 175 "\
+ "129 213T227 252Q291 252 326 203T362 76Q362 -23 311 -115T166 -272L92 -201Q206 -1"\
+ "19 223 -12z\"/></glyph> <glyph unicode=\"-\" horiz-adv-x=\"715\"><path d=\"M62"\
+ "3 729V526H92V729H623z\"/></glyph> <glyph unicode=\".\" horiz-adv-x=\"455\"><pa"\
+ "th d=\"M227 -16Q171 -16 131 24T90 121Q90 177 130 217T227 258Q284 258 324 218T36"\
+ "5 121Q365 64 325 24T227 -16z\"/></glyph> <glyph unicode=\"/\" horiz-adv-x=\"75"\
+ "8\"><path d=\"M553 1583H741L205 -334H16L553 1583z\"/></glyph> <glyph unicode=\""\
+ "0\" horiz-adv-x=\"1198\"><path d=\"M608 1507Q844 1507 960 1330T1077 764Q1077 33"\
+ "8 960 161T600 -16Q357 -16 239 160T121 764Q121 1135 242 1321T608 1507zM600 127Q7"\
+ "31 127 794 279T858 764Q858 1077 794 1220T600 1364Q469 1364 405 1222T340 764Q340"\
+ " 430 404 279T600 127z\"/></glyph> <glyph unicode=\"1\" horiz-adv-x=\"1198\"><p"\
+ "ath d=\"M1071 143V0H209V143H539V1303L209 1227V1370L641 1503H756V143H1071z\"/></"\
+ "glyph> <glyph unicode=\"2\" horiz-adv-x=\"1198\"><path d=\"M1038 152V0H125V88Q"\
+ "125 249 186 372T330 578T542 760Q725 902 770 971T815 1112Q815 1238 743 1298T518 "\
+ "1358Q358 1358 168 1290V1446Q355 1507 557 1507Q797 1507 917 1410T1038 1118Q1038 "\
+ "1019 974 914T680 629Q561 536 491 470T375 324T326 152H1038z\"/></glyph> <glyph "\
+ "unicode=\"3\" horiz-adv-x=\"1198\"><path d=\"M262 860Q599 860 692 925T786 1135Q"\
+ "786 1246 716 1302T504 1358Q358 1358 184 1307V1458Q358 1507 547 1507Q771 1507 89"\
+ "1 1414T1012 1141Q1012 1017 942 923T748 791Q887 764 961 670T1036 438Q1036 204 89"\
+ "6 94T506 -16Q314 -16 145 33V186Q347 133 500 133Q649 133 730 207T811 420Q811 525"\
+ " 763 589T605 685T262 717V860z\"/></glyph> <glyph unicode=\"4\" horiz-adv-x=\"1"\
+ "198\"><path d=\"M1124 487V338H969V0H752V338H74V479L768 1503H969V487H1124zM260 4"\
+ "87H752V1206L260 487z\"/></glyph> <glyph unicode=\"5\" horiz-adv-x=\"1198\"><pa"\
+ "th d=\"M410 1341V938Q438 942 541 942Q783 942 911 824T1040 487Q1040 235 902 110T"\
+ "489 -16Q333 -16 152 33V186Q356 133 469 133Q647 133 730 213T813 481Q813 639 723 "\
+ "712T446 786Q314 786 201 772V1491H989V1341H410z\"/></glyph> <glyph unicode=\"6\""\
+ " horiz-adv-x=\"1198\"><path d=\"M973 1485V1335Q876 1358 768 1358Q588 1358 480 1"\
+ "227T350 852Q475 975 662 975Q862 975 971 852T1081 514Q1081 270 959 127T608 -16Q3"\
+ "69 -16 250 160T131 688Q131 1058 293 1282T748 1507Q854 1507 973 1485zM608 127Q73"\
+ "5 127 799 217T864 508Q864 660 801 745T614 831Q489 831 419 750T348 541Q348 343 4"\
+ "14 235T608 127z\"/></glyph> <glyph unicode=\"7\" horiz-adv-x=\"1198\"><path d="\
+ "\"M1059 1491V1376Q845 1028 731 684T600 0H379Q401 332 515 666T836 1337H109V1491H"\
+ "1059z\"/></glyph> <glyph unicode=\"8\" horiz-adv-x=\"1198\"><path d=\"M371 778"\
+ "Q135 865 135 1122Q135 1300 260 1403T598 1507Q805 1507 933 1405T1061 1122Q1061 8"\
+ "66 827 778Q1090 698 1090 406Q1090 206 959 95T598 -16Q369 -16 238 94T106 406Q106"\
+ " 701 371 778zM594 844Q717 844 783 911T850 1104Q850 1234 787 1299T598 1364Q472 1"\
+ "364 409 1299T346 1104Q346 983 411 914T594 844zM598 127Q736 127 805 201T874 424Q"\
+ "874 558 802 630T596 702Q465 702 394 628T322 420Q322 279 392 203T598 127z\"/></g"\
+ "lyph> <glyph unicode=\"9\" horiz-adv-x=\"1198\"><path d=\"M221 8V156Q321 133 4"\
+ "32 133Q630 133 730 252T852 639Q723 516 539 516Q341 516 230 644T119 977Q119 1227"\
+ " 241 1367T600 1507Q834 1507 951 1330T1069 799Q1069 406 918 195T473 -16Q360 -16 "\
+ "221 8zM586 659Q711 659 781 740T852 950Q852 1138 785 1251T600 1364Q462 1364 399 "\
+ "1276T336 983Q336 832 397 746T586 659z\"/></glyph> <glyph unicode=\":\" horiz-a"\
+ "dv-x=\"522\"><path d=\"M262 -16Q206 -16 166 24T125 121Q125 177 165 217T262 258Q"\
+ "318 258 357 218T397 121Q397 64 358 24T262 -16zM262 745Q206 745 166 786T125 885Q"\
+ "125 941 165 980T262 1020Q319 1020 358 981T397 885Q397 828 358 787T262 745z\"/><"\
+ "/glyph> <glyph unicode=\";\" horiz-adv-x=\"524\"><path d=\"M258 -12Q199 -12 16"\
+ "2 23T125 117Q125 175 164 213T260 252Q325 252 361 203T397 76Q397 -26 345 -118T19"\
+ "9 -272L125 -201Q241 -120 258 -12zM264 745Q208 745 168 786T127 885Q127 941 167 9"\
+ "80T264 1020Q321 1020 360 981T399 885Q399 828 360 787T264 745z\"/></glyph> <gly"\
+ "ph unicode=\"<\" horiz-adv-x=\"1198\"><path d=\"M1065 281L135 655V836L1065 1"\
+ "217V1036L317 745L1065 461V281z\"/></glyph> <glyph unicode=\"=\" horiz-adv-x=\""\
+ "1198\"><path d=\"M1065 860H135V1040H1065V860zM1065 598V418H135V598H1065z\"/></g"\
+ "lyph> <glyph unicode=\">\" horiz-adv-x=\"1198\"><path d=\"M1065 655L135 281"\
+ "V461L881 745L135 1036V1217L1065 836V655z\"/></glyph> <glyph unicode=\"?\" hori"\
+ "z-adv-x=\"897\"><path d=\"M330 -16Q273 -16 233 24T193 121Q193 178 233 218T330 2"\
+ "58Q386 258 425 218T465 121Q465 64 426 24T330 -16zM51 1307V1456Q225 1507 354 150"\
+ "7Q569 1507 683 1416T797 1147Q797 1074 762 995T594 779Q493 675 460 626T426 512V4"\
+ "18H231V524Q231 629 278 705T422 877Q523 977 548 1031T573 1135Q573 1356 322 1356Q"\
+ "211 1356 51 1307z\"/></glyph> <glyph unicode=\"@\" horiz-adv-x=\"1870\"><path "\
+ "d=\"M1059 1126H1331Q1264 689 1264 539Q1264 409 1290 368T1380 326Q1477 326 1531 "\
+ "425T1585 702Q1585 1010 1426 1184T985 1358Q690 1358 499 1177T307 678Q307 445 387"\
+ " 286T623 46T1001 -35Q1092 -35 1218 -13T1419 37V-111Q1344 -141 1212 -163T981 -18"\
+ "6Q588 -186 355 35T121 668Q121 1059 366 1283T981 1507Q1348 1507 1552 1296T1757 7"\
+ "13Q1757 460 1646 327T1362 193Q1274 193 1209 249T1128 403Q1031 193 844 193Q713 1"\
+ "93 627 290T541 557Q541 820 685 973T1059 1126zM1098 678L1139 989H1040Q901 989 80"\
+ "6 880T711 575Q711 326 883 326Q961 326 1020 429T1098 678z\"/></glyph> <glyph un"\
+ "icode=\"A\" horiz-adv-x=\"1223\"><path d=\"M836 489L600 1264L362 489H836zM985 0"\
+ "L881 342H317L211 0H10L502 1491H741L1210 0H985z\"/></glyph> <glyph unicode=\"B\""\
+ " horiz-adv-x=\"1235\"><path d=\"M627 0H166V1491H643Q874 1491 990 1401T1106 1130"\
+ "Q1106 1014 1045 922T868 786Q1151 718 1151 420Q1151 213 1016 107T627 0zM385 846H"\
+ "602Q743 846 814 912T885 1110Q885 1228 818 1287T618 1346H385V846zM385 145H602Q77"\
+ "1 145 848 212T926 426Q926 569 848 635T602 702H385V145z\"/></glyph> <glyph unic"\
+ "ode=\"C\" horiz-adv-x=\"991\"><path d=\"M678 -16Q400 -16 258 185T115 762Q115 11"\
+ "10 259 1308T682 1507Q807 1507 938 1473V1321Q821 1358 705 1358Q527 1358 436 1203"\
+ "T344 770Q344 462 438 298T715 133Q817 133 938 170V20Q797 -16 678 -16z\"/></glyph"\
+ "> <glyph unicode=\"D\" horiz-adv-x=\"1307\"><path d=\"M385 1346V145H584Q773 14"\
+ "5 870 295T967 770Q967 1058 870 1202T580 1346H385zM166 1491H614Q903 1491 1047 13"\
+ "11T1192 772Q1192 386 1043 193T594 0H166V1491z\"/></glyph> <glyph unicode=\"E\""\
+ " horiz-adv-x=\"1036\"><path d=\"M166 0V1491H977V1341H385V881H881V731H385V150H98"\
+ "3V0H166z\"/></glyph> <glyph unicode=\"F\" horiz-adv-x=\"1008\"><path d=\"M166 "\
+ "0V1491H975V1341H385V836H862V686H385V0H166z\"/></glyph> <glyph unicode=\"G\" ho"\
+ "riz-adv-x=\"1255\"><path d=\"M659 -16Q387 -16 251 179T115 764Q115 1118 280 1312"\
+ "T756 1507Q935 1507 1073 1464V1315Q930 1358 764 1358Q556 1358 450 1207T344 772Q3"\
+ "44 450 428 290T682 129Q778 129 845 192T913 354V664H657V807H1133V0H1020L981 127Q"\
+ "843 -16 659 -16z\"/></glyph> <glyph unicode=\"H\" horiz-adv-x=\"1317\"><path d"\
+ "=\"M1151 1491V0H932V737H385V0H166V1491H385V883H932V1491H1151z\"/></glyph> <gly"\
+ "ph unicode=\"I\" horiz-adv-x=\"713\"><path d=\"M102 0V150H246V1341H102V1491H610"\
+ "V1341H465V150H610V0H102z\"/></glyph> <glyph unicode=\"J\" horiz-adv-x=\"702\">"\
+ "<path d=\"M618 1491V1341H475V25Q475 -326 115 -326Q60 -326 -82 -301V-150Q35 -172"\
+ " 66 -172Q174 -172 215 -121T256 33V1341H113V1491H618z\"/></glyph> <glyph unicod"\
+ "e=\"K\" horiz-adv-x=\"1161\"><path d=\"M610 809L1149 0H895L385 770V0H166V1491H3"\
+ "85V799L913 1491H1141L610 809z\"/></glyph> <glyph unicode=\"L\" horiz-adv-x=\"9"\
+ "99\"><path d=\"M166 0V1491H385V150H967V0H166z\"/></glyph> <glyph unicode=\"M\""\
+ " horiz-adv-x=\"1556\"><path d=\"M1391 1491V0H1174V1092L827 508H721L375 1092V0H1"\
+ "66V1491H330L774 729L1223 1491H1391z\"/></glyph> <glyph unicode=\"N\" horiz-adv"\
+ "-x=\"1395\"><path d=\"M1069 0L375 1130V0H166V1491H342L1020 391V1491H1229V0H1069"\
+ "z\"/></glyph> <glyph unicode=\"O\" horiz-adv-x=\"1348\"><path d=\"M674 133Q841"\
+ " 133 922 277T1004 745Q1004 1070 922 1214T674 1358Q507 1358 426 1214T344 745Q344"\
+ " 414 426 274T674 133zM674 -16Q394 -16 255 174T115 745Q115 1118 257 1312T678 150"\
+ "7Q953 1507 1093 1314T1233 745Q1233 370 1092 177T674 -16z\"/></glyph> <glyph un"\
+ "icode=\"P\" horiz-adv-x=\"1188\"><path d=\"M385 1348V684H561Q714 684 793 771T87"\
+ "2 1024Q872 1180 806 1264T584 1348H385zM166 1491H629Q863 1491 980 1376T1098 1030"\
+ "Q1098 802 956 671T575 539H385V0H166V1491z\"/></glyph> <glyph unicode=\"Q\" hor"\
+ "iz-adv-x=\"1348\"><path d=\"M674 133Q841 133 922 277T1004 745Q1004 1070 922 121"\
+ "4T674 1358Q507 1358 426 1214T344 745Q344 414 426 274T674 133zM543 -4Q329 39 222"\
+ " 226T115 745Q115 1120 256 1313T676 1507Q952 1507 1092 1313T1233 745Q1233 400 11"\
+ "17 211T768 -10Q799 -128 858 -161T1040 -195V-334H985Q790 -334 686 -267T543 -4z\""\
+ "/></glyph> <glyph unicode=\"R\" horiz-adv-x=\"1184\"><path d=\"M782 680L1155 0"\
+ "H907L575 645H385V0H166V1491H627Q852 1491 964 1390T1077 1085Q1077 925 1003 824T7"\
+ "82 680zM385 791H588Q721 791 787 864T854 1085Q854 1215 792 1280T606 1346H385V791"\
+ "z\"/></glyph> <glyph unicode=\"S\" horiz-adv-x=\"1038\"><path d=\"M436 -16Q253"\
+ " -16 88 33V188Q270 133 432 133Q591 133 670 192T750 369Q750 445 698 513T444 684Q"\
+ "240 787 166 889T92 1112Q92 1236 153 1324T330 1460T592 1507Q739 1507 895 1473V13"\
+ "21Q743 1358 614 1358Q468 1358 390 1305T311 1149Q311 1080 342 1033T423 952T566 8"\
+ "71Q696 803 775 750T911 614T969 422Q969 193 824 89T436 -16z\"/></glyph> <glyph "\
+ "unicode=\"T\" horiz-adv-x=\"1112\"><path d=\"M446 0V1335H33V1491H1079V1335H666V"\
+ "0H446z\"/></glyph> <glyph unicode=\"U\" horiz-adv-x=\"1317\"><path d=\"M662 -1"\
+ "6Q418 -16 290 109T162 479V1491H381V438Q381 283 450 206T659 129Q797 129 866 206T"\
+ "936 438V1491H1155V479Q1155 243 1023 114T662 -16z\"/></glyph> <glyph unicode=\""\
+ "V\" horiz-adv-x=\"1161\"><path d=\"M455 0L10 1491H238L590 246L958 1491H1153L694"\
+ " 0H455z\"/></glyph> <glyph unicode=\"W\" horiz-adv-x=\"1864\"><path d=\"M373 0"\
+ "L29 1491H260L516 291L842 1491H1073L1368 291L1649 1491H1839L1460 0H1237L938 1223"\
+ "L602 0H373z\"/></glyph> <glyph unicode=\"X\" horiz-adv-x=\"1147\"><path d=\"M1"\
+ "2 0L457 756L31 1491H279L582 946L889 1491H1100L686 791L1139 0H891L561 598L223 0H"\
+ "12z\"/></glyph> <glyph unicode=\"Y\" horiz-adv-x=\"1067\"><path d=\"M412 0V532"\
+ "L10 1491H248L541 748L858 1491H1061L631 535V0H412z\"/></glyph> <glyph unicode=\""\
+ "Z\" horiz-adv-x=\"1026\"><path d=\"M47 0V106L698 1341H84V1491H965V1384L313 150H"\
+ "956V0H47z\"/></glyph> <glyph unicode=\"[\" horiz-adv-x=\"717\"><path d=\"M659 "\
+ "-197V-334H166V1583H659V1446H377V-197H659z\"/></glyph> <glyph unicode=\"\\\" ho"\
+ "riz-adv-x=\"758\"><path d=\"M205 1583L741 -334H553L16 1583H205z\"/></glyph> <g"\
+ "lyph unicode=\"]\" horiz-adv-x=\"717\"><path d=\"M551 1583V-334H57V-197H340V144"\
+ "6H57V1583H551z\"/></glyph> <glyph unicode=\"^\" horiz-adv-x=\"1198\"><path d=\""\
+ "M698 1491L1063 729H870L600 1303L328 729H135L500 1491H698z\"/></glyph> <glyph u"\
+ "nicode=\"_\" horiz-adv-x=\"762\"><path d=\"M768 -154V-287H-4V-154H768z\"/></gly"\
+ "ph> <glyph unicode=\"`\" horiz-adv-x=\"682\"><path d=\"M315 1599L535 1272H358L"\
+ "109 1599H315z\"/></glyph> <glyph unicode=\"a\" horiz-adv-x=\"1122\"><path d=\""\
+ "M754 567H616Q453 567 372 508T291 330Q291 236 343 184T487 131Q610 131 682 203T75"\
+ "4 399V567zM805 170Q681 -16 440 -16Q270 -16 172 73T74 324Q74 510 209 602T754 694"\
+ "V823Q754 928 694 981T512 1034Q379 1034 172 981V1130Q372 1180 543 1180Q752 1180 "\
+ "861 1088T971 815V0H848L805 170z\"/></glyph> <glyph unicode=\"b\" horiz-adv-x=\""\
+ "1214\"><path d=\"M375 586V141Q441 133 563 133Q729 133 809 242T889 610Q889 823 8"\
+ "27 929T641 1036Q522 1036 464 973T390 817T375 586zM375 1055Q498 1180 684 1180Q89"\
+ "9 1180 1006 1036T1114 604Q1114 317 973 154T582 -10Q320 -10 158 10V1583H375V1055"\
+ "z\"/></glyph> <glyph unicode=\"c\" horiz-adv-x=\"928\"><path d=\"M606 -16Q356 "\
+ "-16 228 140T100 596Q100 866 238 1023T637 1180Q758 1180 866 1145V999Q758 1034 64"\
+ "5 1034Q487 1034 407 919T326 592Q326 373 407 251T645 129Q780 129 874 162V25Q733 "\
+ "-16 606 -16z\"/></glyph> <glyph unicode=\"d\" horiz-adv-x=\"1217\"><path d=\"M"\
+ "848 598Q848 848 782 943T584 1038Q455 1038 391 933T326 596Q326 342 389 236T584 1"\
+ "29Q718 129 783 225T848 598zM893 158Q756 -16 545 -16Q330 -16 215 143T100 588Q100"\
+ " 870 218 1025T557 1180Q735 1180 842 1069V1583H1059V0H936L893 158z\"/></glyph> "\
+ "<glyph unicode=\"e\" horiz-adv-x=\"1114\"><path d=\"M330 666H807Q807 873 751 96"\
+ "2T586 1051Q467 1051 404 960T330 666zM625 -16Q362 -16 231 134T100 584Q100 853 22"\
+ "7 1016T586 1180Q799 1180 909 1044T1020 535H330Q330 332 409 231T647 129Q782 129 "\
+ "973 182V35Q799 -16 625 -16z\"/></glyph> <glyph unicode=\"f\" horiz-adv-x=\"639"\
+ "\"><path d=\"M717 1575V1430Q625 1460 555 1460Q483 1460 451 1430T410 1342T401 11"\
+ "63H621V1026H401V0H184V1026H43V1163H184Q184 1436 267 1517T518 1599Q619 1599 717 "\
+ "1575z\"/></glyph> <glyph unicode=\"g\" horiz-adv-x=\"1210\"><path d=\"M840 633"\
+ "Q840 835 779 936T594 1038Q459 1038 392 944T324 633Q324 422 388 317T582 211Q708 "\
+ "211 774 290T840 633zM836 188Q744 66 539 66Q319 66 210 203T100 616Q100 877 222 1"\
+ "028T569 1180Q781 1180 885 1022L932 1163H1053V55Q1053 -134 926 -237T582 -340Q396"\
+ " -340 172 -285V-135Q410 -190 563 -190Q690 -190 749 -148T822 -37T836 162V188z\"/"\
+ "></glyph> <glyph unicode=\"h\" horiz-adv-x=\"1231\"><path d=\"M375 1051Q500 11"\
+ "80 692 1180Q885 1180 982 1085T1079 801V0H862V778Q862 906 810 970T653 1034Q523 1"\
+ "034 449 947T375 717V0H158V1583H375V1051z\"/></glyph> <glyph unicode=\"i\" hori"\
+ "z-adv-x=\"561\"><path d=\"M186 0V1026H43V1163H403V0H186zM293 1327Q242 1327 206 "\
+ "1363T170 1450Q170 1501 206 1537T293 1573Q342 1573 379 1536T416 1450Q416 1400 38"\
+ "0 1364T293 1327z\"/></glyph> <glyph unicode=\"j\" horiz-adv-x=\"561\"><path d="\
+ "\"M186 -8V1026H43V1163H403V0Q403 -174 326 -257T80 -340Q-23 -340 -131 -315V-170Q"\
+ "-35 -190 41 -190Q125 -190 155 -149T186 -8zM293 1327Q242 1327 206 1363T170 1450Q"\
+ "170 1501 206 1537T293 1573Q342 1573 379 1536T416 1450Q416 1400 380 1364T293 132"\
+ "7z\"/></glyph> <glyph unicode=\"k\" horiz-adv-x=\"1096\"><path d=\"M616 653L10"\
+ "96 0H836L375 633V0H158V1583H375V637L827 1163H1071L616 653z\"/></glyph> <glyph "\
+ "unicode=\"l\" horiz-adv-x=\"532\"><path d=\"M158 0V1583H375V0H158z\"/></glyph> "\
+ " <glyph unicode=\"m\" horiz-adv-x=\"1890\"><path d=\"M281 1163L324 991Q444 1180"\
+ " 682 1180Q923 1180 1014 1001Q1126 1180 1364 1180Q1548 1180 1643 1085T1739 805V0"\
+ "H1522V791Q1522 912 1472 973T1323 1034Q1198 1034 1128 947T1057 717V0H840V788Q840"\
+ " 911 790 972T641 1034Q517 1034 446 946T375 717V0H158V1163H281z\"/></glyph> <gl"\
+ "yph unicode=\"n\" horiz-adv-x=\"1231\"><path d=\"M324 991Q446 1180 692 1180Q885"\
+ " 1180 982 1085T1079 801V0H862V764Q862 899 810 966T653 1034Q523 1034 449 947T375"\
+ " 717V0H158V1163H281L324 991z\"/></glyph> <glyph unicode=\"o\" horiz-adv-x=\"12"\
+ "14\"><path d=\"M606 121Q746 121 817 232T889 606Q889 792 816 917T606 1042Q468 10"\
+ "42 397 928T326 606Q326 373 397 247T606 121zM606 -16Q353 -16 227 138T100 600Q100"\
+ " 868 232 1024T606 1180Q851 1180 982 1026T1114 596Q1114 297 985 141T606 -16z\"/>"\
+ "</glyph> <glyph unicode=\"p\" horiz-adv-x=\"1214\"><path d=\"M375 641V160Q457 "\
+ "131 567 131Q733 131 811 239T889 606Q889 820 826 927T637 1034Q506 1034 441 936T3"\
+ "75 641zM326 997Q459 1180 690 1180Q902 1180 1008 1035T1114 598Q1114 303 975 147T"\
+ "567 -10Q467 -10 375 10V-334H158V1163H281L326 997z\"/></glyph> <glyph unicode=\""\
+ "q\" horiz-adv-x=\"1217\"><path d=\"M848 571Q848 851 783 945T584 1040Q452 1040 3"\
+ "89 933T326 573Q326 341 390 235T584 129Q715 129 781 225T848 571zM842 94Q731 -16 "\
+ "557 -16Q336 -16 218 139T100 575Q100 861 221 1020T567 1180Q669 1180 743 1146T891"\
+ " 1024L936 1163H1059V-334H842V94z\"/></glyph> <glyph unicode=\"r\" horiz-adv-x="\
+ "\"758\"><path d=\"M158 0V1163H281L330 969Q430 1174 676 1174Q712 1174 725 1171V9"\
+ "77Q703 979 647 979Q507 979 441 913T375 705V0H158z\"/></glyph> <glyph unicode=\""\
+ "s\" horiz-adv-x=\"879\"><path d=\"M375 -16Q249 -16 59 23V176Q251 127 367 127Q59"\
+ "6 127 596 303Q596 356 559 401T377 512Q190 598 137 677T84 852Q84 1013 204 1096T4"\
+ "92 1180Q651 1180 772 1143V997Q630 1040 508 1040Q299 1040 299 877Q299 815 349 77"\
+ "6T502 692Q695 608 752 523T809 334Q809 161 697 73T375 -16z\"/></glyph> <glyph u"\
+ "nicode=\"t\" horiz-adv-x=\"725\"><path d=\"M449 -16Q309 -16 244 48T178 250V1026"\
+ "H20V1104L336 1421H395V1163H686V1026H395V285Q395 204 421 167T524 129Q591 129 705"\
+ " 158V20Q564 -16 449 -16z\"/></glyph> <glyph unicode=\"u\" horiz-adv-x=\"1231\""\
+ "><path d=\"M907 172Q786 -16 539 -16Q345 -16 249 78T152 362V1163H369V399Q369 264"\
+ " 421 197T578 129Q707 129 781 216T856 446V1163H1073V0H950L907 172z\"/></glyph> "\
+ "<glyph unicode=\"v\" horiz-adv-x=\"1051\"><path d=\"M385 0L12 1163H244L532 178L"\
+ "836 1163H1040L645 0H385z\"/></glyph> <glyph unicode=\"w\" horiz-adv-x=\"1706\""\
+ "><path d=\"M342 0L27 1163H250L489 176L752 1163H989L1235 176L1491 1163H1683L1354"\
+ " 0H1092L854 926L600 0H342z\"/></glyph> <glyph unicode=\"x\" horiz-adv-x=\"1034"\
+ "\"><path d=\"M6 0L406 592L35 1163H274L528 754L795 1163H999L627 614L1026 0H786L5"\
+ "06 457L211 0H6z\"/></glyph> <glyph unicode=\"y\" horiz-adv-x=\"1051\"><path d="\
+ "\"M369 35L12 1163H246L532 178L836 1163H1040L637 -43Q581 -209 500 -274T287 -340Q"\
+ "200 -340 90 -315V-168Q184 -190 260 -190Q353 -190 401 -150T489 35H369z\"/></glyp"\
+ "h> <glyph unicode=\"z\" horiz-adv-x=\"1006\"><path d=\"M59 0V131L676 1014H100V"\
+ "1163H938V1034L319 150H950V0H59z\"/></glyph> <glyph unicode=\"{\" horiz-adv-x=\""\
+ "729\"><path d=\"M672 -334H489Q372 -334 296 -259T219 -57V383Q219 460 181 503T68 "\
+ "555V694Q143 703 181 746T219 866V1307Q219 1433 295 1508T489 1583H672V1446H575Q50"\
+ "9 1446 470 1408T430 1300V860Q430 766 395 707T289 625Q359 601 394 542T430 389V-5"\
+ "1Q430 -119 469 -158T575 -197H672V-334z\"/></glyph> <glyph unicode=\"|\" horiz-"\
+ "adv-x=\"758\"><path d=\"M469 1583V-334H289V1583H469z\"/></glyph> <glyph unicod"\
+ "e=\"}\" horiz-adv-x=\"729\"><path d=\"M57 1583H240Q357 1583 433 1508T510 1307V8"\
+ "66Q510 789 548 746T662 694V555Q586 546 548 503T510 383V-57Q510 -184 434 -259T24"\
+ "0 -334H57V-197H154Q221 -197 260 -158T299 -51V389Q299 483 334 542T440 625Q369 64"\
+ "8 334 707T299 860V1300Q299 1369 260 1407T154 1446H57V1583z\"/></glyph> <glyph "\
+ "unicode=\"~\" horiz-adv-x=\"1198\"><path d=\"M1081 909L1130 741Q1008 524 838 52"\
+ "4Q782 524 726 552T595 639Q504 709 457 728T371 748Q227 748 115 537L68 705Q148 84"\
+ "5 221 889T375 934Q424 934 477 913T632 813Q706 756 752 734T844 711Q985 711 1081 "\
+ "909z\"/></glyph></font></svg>";
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SvgHkernelementimpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,198 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef _INC_CSVGHKERNELEMENTIMPL_
+#define _INC_CSVGHKERNELEMENTIMPL_
+
+#include "SVGElementImpl.h"
+#include "GfxFloatFixPt.h"
+
+
+
+#ifdef SVG_FONTS_INCLUDE
+
+class CSvgDocumentImpl;
+
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgHkernElementImpl : public CSvgElementImpl
+ {
+ public:
+
+ // Constructor/deconstructor
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgHkernElementImpl*NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgHkernElementImpl*NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+ private:
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+ public:
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgHkernElementImpl();
+
+ // SVG Implementation:
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TFloatFixPt GetK();
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeDesL( const TInt aNameId, const TDesC& aValue );
+
+ TInt SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue );
+
+
+ // From MXmlElement API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TBool DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* aElement );
+ // From MXmlElementOpt API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt GetAttributeDes( const TInt aNameId,
+ TPtrC16& aValue );
+
+ void Print( TBool aIsEncodeOn );
+
+
+ private:
+
+ TFloatFixPt iK;
+
+ HBufC* iG1;
+
+ HBufC* iG2;
+
+ HBufC* iU1;
+
+ HBufC* iU2;
+
+
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgHkernElementImpl( CSvgDocumentImpl* aDoc );
+ };
+
+#endif /* SVG_FONTS_INCLUDE */
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/inc/SvgStopElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#ifndef CSVGSTOPELEMENTIMPL_H
+#define CSVGSTOPELEMENTIMPL_H
+
+#include "SVGElementImpl.h"
+
+class CSvgDocumentImpl;
+
+/**
+ * Class description goes here.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+
+class CSvgStopElementImpl : public CSvgElementImpl
+
+ {
+ public:
+
+ // Constructor/deconstructor
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgStopElementImpl* NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CSvgStopElementImpl* NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CSvgStopElementImpl();
+
+ // From SVG DOM
+
+ // From MXmlElement API
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TInt SetAttributeL( const TDesC& aName, const TDesC& aValue );
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void GetStopColor(TUint32 &aVal){aVal=iStopColor;}
+ void GetOffset(TFloatFixPt &aOffset){aOffset = iOffset;}
+ void GetStopOpacity(TFloatFixPt &aStopOpacity){aStopOpacity = iStopOpacity;}
+ void SetStopColorL(TUint32 &aVal);
+ TInt GetAttributeFloat(const TInt aNameId, TFloatFixPt& aValue);
+ TInt SetAttributeFloatL(const TInt aNameId,const TFloatFixPt aValue);
+ TInt GetAttributeIntL( const TInt aNameId, TInt32& aValue );
+ TInt SetAttributeIntL( const TInt aNameId,
+ const TInt32 aValue );
+
+ void Print( TBool aIsEncodeOn );
+ TBool IsValidValue(const TDesC& aValue);
+ TFloatFixPt iOffset;
+
+ TBool IsValidElement() const;
+ private:
+
+ TFloatFixPt iStopOpacity;
+ TUint32 iStopColor;
+ TBool iValidOffsetValue; // Will be set to false if the value is improper.
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void ConstructL( const TUint8 aElemID );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgStopElementImpl( CSvgDocumentImpl* aDoc );
+
+ public:
+
+ protected:
+
+ };
+
+#endif /* CSVGSTOPELEMENTIMPL_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGAElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,490 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "SVGAElementImpl.h"
+#include "SVGElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGEngineImpl.h"
+
+#include "GfxAffineTransform.h"
+#include "SVGGElementImpl.h"
+
+_LIT(TARGET, "target");
+_LIT(NEW, "new");
+
+// ---------------------------------------------------------------------------
+// Two phase construction
+// ---------------------------------------------------------------------------
+CSvgAElementImpl* CSvgAElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgAElementImpl* self = new ( ELeave ) CSvgAElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL(aElemID);
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgAElementImpl* CSvgAElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgAElementImpl* self = new ( ELeave ) CSvgAElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL(aElemID);
+
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAElementImpl::ConstructL( const TUint8 aElemID)
+ {
+ CSvgElementImpl::InitializeL( aElemID);
+
+ iSvgStyleProperties = new(ELeave) RPointerArray<CCssValue>(KCSS_MAX_ATTR);
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+ iSvgStyleProperties->Remove( 0 );
+
+ iSvgTransformable = CSvgTransformableImpl::NewL();
+
+ iSvgUriReferenceImpl = CSvgUriReferenceImpl::NewL();
+ iTarget = HBufC::NewL( 0 );
+
+ if (OwnerDocument())
+ {
+ ((CSvgDocumentImpl*)OwnerDocument())->AddInternalMouseListener( this );
+ }
+
+
+ }
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgAElementImpl::~CSvgAElementImpl()
+{
+ if(iSvgUriReferenceImpl)
+ {
+ delete iSvgUriReferenceImpl;
+ iSvgUriReferenceImpl = NULL;
+ }
+
+ if(iSvgStyleProperties)
+ {
+ iSvgStyleProperties->Close();
+ delete iSvgStyleProperties;
+ iSvgStyleProperties = NULL;
+ }
+ if (iTarget)
+ {
+ delete iTarget;
+ iTarget = NULL;
+ }
+
+ if (OwnerDocument())
+ {
+ ((CSvgDocumentImpl*)OwnerDocument())->RemoveInternalMouseListener( this );
+ }
+}
+
+// Private
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+CSvgAElementImpl::CSvgAElementImpl( CSvgDocumentImpl* aDoc ) : iInitDone( EFalse )
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+
+// *******************************************************
+// From MXmlElement
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgAElementImpl::SetAttributeL( const TDesC& aName, const TDesC& aValue )
+ {
+ if ( this->SetXlinkAttributeL( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+ if ( SetTargetL( aName, aValue ))
+ {
+ return KErrNone;
+ }
+
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+TBool CSvgAElementImpl::SetTargetL( const TDesC& aName, const TDesC& aValue )
+ {
+ if ( aName == TARGET )
+ {
+ if(iTarget)
+ {
+ delete iTarget;
+ iTarget = NULL;
+ }
+ iTarget = aValue.AllocL();
+ }
+ else
+ {
+ return EFalse;
+ }
+
+ return ETrue;
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TDesC& CSvgAElementImpl::Target( )
+{
+ if (iTarget)
+ {
+ return *iTarget;
+ }
+ else
+ {
+ return KNullDesC;
+ }
+}
+
+// *******************************************************
+// From CSvgElementImpl
+
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgAElementImpl::CloneL(MXmlElement*)
+ {
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgAElementImpl::DrawL( CGfx2dGc* /* aGc */,
+ CSvgElementImpl* /* aElement */ )
+ {
+ if ( !iInitDone )
+ {
+ // Add child elemenets as mouse event receiver to engine
+ // so that child elements can fire ui internal event
+ AddEventReceiverSubtreeL( this );
+
+ // Add this as internal event receiver
+ ((CSvgDocumentImpl*)iOwnerDocument)->AddToEventReceiverListL( this, KSvgEventMaskInternal);
+
+
+ iInitDone = ETrue;
+ }
+
+ return ETrue;
+ }
+
+
+// *******************************************************
+// From MSvgEventReceiver
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgAElementImpl::ReceiveEventL( MSvgEvent* aEvent )
+ {
+
+ if( CSvgElementImpl::IsSVGEnginePaused())
+ {
+ return EFalse;
+ }
+ // Receive internal UI click event on child elements only
+ if ( aEvent->EventType() != ESvgEngineInternalEvent )
+ {
+ return EFalse;
+ }
+
+ // Link activation process
+ MSvgInternalEvent* evt = ( MSvgInternalEvent* ) aEvent;
+
+ if ( !IsChild( this, evt->ObjectAddress() ) )
+ {
+ return EFalse;
+ }
+
+//////
+
+ CSvgEngineImpl* engine = ( ( CSvgDocumentImpl* ) OwnerDocument() )->Engine();
+ // Process the UI event on its child elements and propagate that event to its dependents
+ switch ( evt->SvgEvent() )
+ {
+
+ case ESvgEventMousedown:
+ case ESvgEventMouseup:
+ case ESvgEventClick:
+ case ESvgEventActivate:
+ case ESvgEventMouseover:
+ case ESvgEventMousemove:
+ case ESvgEventFocusin:
+ case ESvgEventMouseout:
+ case ESvgEventFocusout:
+ {
+ TSvgInternalEvent lEvt ( evt->SvgEvent(),
+ ( CSvgElementImpl* )
+ this );
+ engine->ProcessEventL(
+ ( CSvgDocumentImpl* ) OwnerDocument(), &lEvt );
+ }
+ break;
+
+ default:
+ break;
+ }
+
+///////
+
+
+ // To activate only on mouse click event
+ if ( evt->SvgEvent() != ESvgEventClick )
+ {
+ return EFalse;
+ }
+
+ // Linking behavior
+
+ TPtrC n(XlinkShow());
+
+ if (n == NEW)
+ {
+ engine->LinkRequestWithShow( Href(),XlinkShow() ); // ssb iHrefUri->Des());
+ }
+ else
+ {
+ engine->LinkRequest( Href() ); // ssb iHrefUri->Des());
+ }
+
+
+
+ return EFalse;
+ }
+
+
+// *******************************************************
+// Private methods
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAElementImpl::AddEventReceiverSubtreeL( CSvgElementImpl* aElement )
+ {
+ CSvgElementImpl*element = ( CSvgElementImpl* ) aElement->FirstChild();
+ while ( element != NULL )
+ {
+
+ ((CSvgDocumentImpl*)iOwnerDocument)->AddToEventReceiverListL( element,
+ KSvgEventMaskExternalUI);
+
+ AddEventReceiverSubtreeL( element );
+ element = ( CSvgElementImpl * ) element->NextSibling();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgAElementImpl::IsChild( CSvgElementImpl* aSubtree,
+ CSvgElementImpl* aElement )
+ {
+ CSvgElementImpl*element = ( CSvgElementImpl* ) aSubtree->FirstChild();
+ if ( element != NULL )
+ {
+ do
+ {
+ if ( element == aElement || IsChild( element, aElement ) )
+ {
+ return ETrue;
+ }
+ element = ( CSvgElementImpl * ) element->NextSibling();
+ }
+ while ( element != NULL );
+ }
+ return EFalse;
+ }
+void CSvgAElementImpl::Reset(MSvgEvent* /*aEvent*/)
+{
+}
+
+TInt CSvgAElementImpl::SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue )
+ {
+ _LIT( KXlinkHref, "xlink:href" );
+ _LIT( KTarget, "target");
+
+ switch ( aNameId )
+ {
+ case KAtrXlinkhref:
+ SetAttributeL(KXlinkHref, aValue );
+ break;
+ case KAtrTarget:
+ SetAttributeL(KTarget, aValue );
+ break;
+ default:
+ return CSvgElementImpl::SetAttributeDesL( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+TInt CSvgAElementImpl::GetAttributeDes( const TInt aNameId,
+ TPtrC16& aValue )
+{
+ if(aNameId == KAtrXlinkhref)
+ {
+ aValue.Set( Href() );
+ return KErrNone;
+ }
+ if (aNameId == KAtrTarget)
+ {
+ aValue.Set( Target() );
+ return KErrNone;
+ }
+ return CSvgElementImpl::GetAttributeDes( aNameId, aValue );
+}
+
+/*** FROM MSvgMouseListener ***/
+// ---------------------------------------------------------------------------
+// mouse entered
+// ---------------------------------------------------------------------------
+TBool CSvgAElementImpl::MouseEntered( RPointerArray<CSvgElementImpl>& aElements,
+ TInt /*aX*/, TInt /*aY*/ )
+{
+ CSvgEngineImpl* lEngine = ( ( CSvgDocumentImpl* ) OwnerDocument() )->Engine();
+
+ TInt lEleCnt = aElements.Count();
+ for (TInt i = 0; i < lEleCnt; i++ )
+ {
+ if ( aElements[i] == this )
+ {
+ lEngine->NotifyHyperlinkEntered(this);
+ return ETrue;
+ }
+ }
+
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+// Notified when the mouse pointer exits a visible svg element.
+// ---------------------------------------------------------------------------
+TBool CSvgAElementImpl::MouseExited( RPointerArray<CSvgElementImpl>& aElements,
+ TInt /*aX*/, TInt /*aY*/ )
+{
+ CSvgEngineImpl* lEngine = ( ( CSvgDocumentImpl* ) OwnerDocument() )->Engine();
+
+ TInt lEleCnt = aElements.Count();
+ for (TInt i = 0; i < lEleCnt; i++ )
+ {
+ if ( aElements[i] == this )
+ {
+ lEngine->NotifyHyperlinkExited(this);
+ return ETrue;
+ }
+ }
+
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+// Notified when the mouse pointer is pressed down on visible svg element.
+// ---------------------------------------------------------------------------
+TBool CSvgAElementImpl::MouseMoved( RPointerArray<CSvgElementImpl>& /*aElements*/,
+ TInt /*aX*/, TInt /*aY*/ )
+{
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+// Notified when the mouse pointer is pressed down on visible svg element.
+// ---------------------------------------------------------------------------
+TBool CSvgAElementImpl::MousePressed( RPointerArray<CSvgElementImpl>& /*aElements*/,
+ TInt /*aX*/, TInt /*aY*/ )
+{
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+// Notified when the mouse pointer is released on on visible svg element.
+// ---------------------------------------------------------------------------
+TBool CSvgAElementImpl::MouseReleased( RPointerArray<CSvgElementImpl>& aElements,
+ TInt /*aX*/, TInt /*aY*/ )
+{
+ CSvgEngineImpl* lEngine = ( ( CSvgDocumentImpl* ) OwnerDocument() )->Engine();
+
+ TInt lEleCnt = aElements.Count();
+ for (TInt i = 0; i < lEleCnt; i++ )
+ {
+ if ( aElements[i] == this )
+ {
+ lEngine->NotifyHyperlinkActivated(this);
+ return ETrue;
+ }
+ }
+
+ return EFalse;
+}
+
+void CSvgAElementImpl::GetUnscaledBBox( TGfxRectangle2D& aBbox )
+{
+ CSvgGElementImpl::GetGroupBoundingUnscaled( aBbox, this );
+}
+
+void CSvgAElementImpl::GetBBox( TGfxRectangle2D& aBbox )
+{
+ CSvgGElementImpl::GetGroupBounding( aBbox, this );
+}
+
+void CSvgAElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<a xlink:href=\"hmm\">"/*, Href()*/);
+ #endif
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGAnimTimeController.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,1127 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include "SVGAnimTimeController.h"
+#include "SVGAnimationBase.h"
+
+#include "GfxGeneralPath.h"
+#include "GfxFlatteningPathIterator.h"
+
+ #ifdef SVG_FLOAT_BUILD
+#define MULT255(x) (255*(x))
+ #else
+#define MULT255(x) (((x)<<8) - (x))
+ #endif
+
+_LIT( KEmptyString,"" );
+
+// ---------------------------------------------------------------------------
+// Two phase construction
+// ---------------------------------------------------------------------------
+CSvgAnimTimeController* CSvgAnimTimeController::NewL()
+ {
+ CSvgAnimTimeController* self = new ( ELeave ) CSvgAnimTimeController();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgAnimTimeController::~CSvgAnimTimeController()
+ {
+ if ( iKeyTime )
+ {
+ iKeyTime->Close();
+ delete iKeyTime;
+ iKeyTime = NULL;
+ }
+
+ if ( iAnimTime )
+ {
+ iAnimTime->Close();
+ delete iAnimTime;
+ iAnimTime = NULL;
+ }
+
+ if ( iBeginTimeList )
+ {
+ iBeginTimeList->Close();
+ delete iBeginTimeList;
+ iBeginTimeList = NULL;
+ }
+ if ( iInitialBeginTimeList )
+ {
+ iInitialBeginTimeList->Close();
+ delete iInitialBeginTimeList;
+ iInitialBeginTimeList = NULL;
+ }
+ if ( iEndTimeList )
+ {
+ iEndTimeList->Close();
+ delete iEndTimeList;
+ iEndTimeList = NULL;
+ }
+ if ( iInitialEndTimeList )
+ {
+ iInitialEndTimeList->Close();
+ delete iInitialEndTimeList;
+ iInitialEndTimeList = NULL;
+ }
+ delete iSplines;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgAnimTimeController::CSvgAnimTimeController() : iCalcMode( KAnimCalcModeLinear ),
+ iBeginTime( 0 ),
+ iInitialBeginTime(0),
+ iDurationTime( KTimeIndefinite ),
+ iEndTime( KTimeIndefinite ),
+ iInitialEndTime(KTimeIndefinite),
+ iRepeatDurationTime( KTimeIndefinite ),
+ iNewActiveDurationTime( 0 ),
+ iSplineIndex( 0 ),
+ iModifiedEndTime( 0 ),
+ iIsSplineCalcMode( EFalse )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimTimeController::ConstructL()
+ {
+ iKeyTime = new ( ELeave ) RArray<TKeyTime>( 1 );
+ iAnimTime = new ( ELeave ) RArray<TUint32>( 1 );
+ for ( TInt32 i = 0; i < KTimeMax + 1; i++ )
+ {
+ iAnimTime->AppendL(0);
+ }
+ iBeginTimeList = new ( ELeave ) RArray<TInt32>( 1 );
+ iInitialBeginTimeList = new ( ELeave ) RArray<TInt32>( 1 );
+ iEndTimeList = new (ELeave) RArray<TInt32>(1);
+ iInitialEndTimeList = new (ELeave) RArray<TInt32>(1);
+ }
+
+
+// *******************************************************
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimTimeController::SetBeginTime( TInt32 aBeginTime )
+ {
+ iBeginTime = aBeginTime; // msec
+ }
+
+
+
+void CSvgAnimTimeController::SetOrgDurationTime(TInt32 aValue)
+{
+ iOrgDurationTime = aValue;
+}
+
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimTimeController::AddBeginTime( TInt32 aBeginTime )
+ {
+ if ( aBeginTime < 0 )
+ {
+ aBeginTime = 0; //Himanshu: to check the negative begin value
+ }
+ iBeginTimeList->Append( aBeginTime );
+ iBeginTimeList->SortSigned();
+ }
+void CSvgAnimTimeController::AddEndTime( TInt32 aEndTime )
+ {
+ iEndTimeList->Append( aEndTime );
+ iEndTimeList->SortSigned();
+ iEndTime = iEndTimeList->operator[](0);
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TUint32 CSvgAnimTimeController::GetBeginTime( TInt32 aIndex )
+ {
+
+ if(aIndex >= 0 && aIndex < iBeginTimeList->Count())
+ {
+
+ return (TUint32) (iBeginTimeList->operator[](aIndex));
+ }
+ else
+ {
+
+ return 0;
+
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimTimeController::ResetBeginTime( TInt32 aBeginTime )
+ {
+ iBeginTime = aBeginTime; // msec
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimTimeController::SetDurationTime( TInt32 aDurationTime )
+ {
+ iDurationTime = aDurationTime; // msec
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt32 CSvgAnimTimeController::GetDurationTime()
+ {
+ return iDurationTime; // msec
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimTimeController::SetEndTime( TInt32 aEndTime )
+ {
+ iEndTime = aEndTime; // msec
+ if (aEndTime != (TInt32)KTimeIndefinite)
+ iModifiedEndTime= aEndTime;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt32 CSvgAnimTimeController::GetEndTime()
+ {
+ return iEndTime; // msec
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimTimeController::SetRepeatDurationTime( TUint32 aRepeatDurationTime )
+ {
+ iRepeatDurationTime = aRepeatDurationTime;
+
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimTimeController::GetAnimTime( TInt32 aTimerTime,
+ TInt32& aAnimTime,
+ TInt32& aValueIndex,
+ TInt32& aSubAnimTime )
+ {
+ if(iDurationTime == KTimeIndefinite || iDurationTime == 0)
+ {
+ aValueIndex = 0;
+ aSubAnimTime= 0;
+ aAnimTime=0;
+ return;
+ }
+ TInt32 x = 0;
+
+ if( iNewActiveDurationTime > 0 )//"repeatDur" <= "Dur"
+ {
+ x = MULT255( aTimerTime - iBeginTime ) / iNewActiveDurationTime;
+ }
+ else
+ {
+
+ x = MULT255( aTimerTime - iBeginTime ) / iDurationTime;
+
+ }
+
+ if ( x > KTimeMax )
+ {
+ x = KTimeMax;
+ }
+ else
+ {
+ if ( x < 0 )
+ {
+ x = 0;
+ }
+ }
+
+ TInt32 kcount = iKeyTime->Count();
+
+ if ( kcount == 0 )// || iCalcMode == KAnimCalcModePaced)
+ {
+ aValueIndex = 0;
+ aSubAnimTime = 0;
+ aAnimTime = x; //
+ // No keytimes or paced animation
+ if ( iCalcMode == KAnimCalcModeDiscrete )
+ {
+ // From SMIL 2.1 Animation Modules
+ // Normative: Normative: A from-to animation with a from value vf
+ // and a to value vt is equivalent to the same animation with a
+ // values list with 2 values, vf and vt.
+
+ if ( x < KTimeMax / 2 )
+ {
+ aAnimTime = 0;
+ }
+ else
+ {
+ aAnimTime = KTimeMax;
+ }
+ }
+ }
+ else if ( iCalcMode == KAnimCalcModePaced )
+ {
+ aAnimTime = x;
+ TInt32 i = 0;
+ while ( i < kcount && ( *iKeyTime )[i].iY < aAnimTime )
+ i++;
+ if ( i > 0 )
+ i--;
+ aValueIndex = i;
+ // to avoid crashing for the array index aValueIndex + 1
+ TBool IndexWasDecremented = EFalse;
+ if(aValueIndex + 1 == kcount)
+ {
+ aValueIndex--;
+ IndexWasDecremented = ETrue;
+ }
+ TInt32 dy = ( TInt32 )
+ ( ( *iKeyTime )[aValueIndex + 1].iY -
+ ( *iKeyTime )[aValueIndex].iY );
+ if ( dy != 0 )
+ aSubAnimTime = MULT255( aAnimTime - ( *iKeyTime )[aValueIndex].iY ) / dy;
+ else
+ aSubAnimTime = 0;
+
+ if(IndexWasDecremented)
+ {
+ aValueIndex++;
+ }
+ }
+ else
+ {
+ // find corresponding keytime index
+ TInt32 i = 0;
+ while ( i < kcount && ( *iKeyTime )[i].iX < x )
+ i++;
+ if ( i > 0 )
+ i--;
+
+
+ ///// EXPLICITLY INCREMENT THE aValueIndex TO THE LAST OF THE LIST.
+
+ if(x == 255)
+ {
+ aValueIndex = kcount-1;
+ }
+ else
+ {
+ aValueIndex = i;
+ }
+
+
+ ////////////// END OF ADDITION ///////////////
+
+ if ( iCalcMode == KAnimCalcModeDiscrete )
+ {
+ if ( x == KTimeMax )
+ aValueIndex = iKeyTime->Count() - 1;
+ aAnimTime = ( *iKeyTime )[aValueIndex].iY;
+ aSubAnimTime = 0;
+ }
+ else
+ {
+ if ( iCalcMode == KAnimCalcModeLinear )
+ {
+ // calcMode:Linear
+
+
+ if(( *iKeyTime )[i].iX == ( *iKeyTime )[i+1].iX)
+ {
+ while((i<(kcount-1)) && ( *iKeyTime )[i + 1].iX == ( *iKeyTime )[i].iX )
+ {
+ // this will increment the index so that
+ // the interpolation would be done between the last
+ // values.
+ i++;
+ // count should be less than the total number of elements.
+ }
+
+
+ }
+
+ TInt32 alpha = MULT255( ( TInt32 )
+ ( x - ( *iKeyTime )[i].iX ) ) /
+ ( TInt32 )
+ ( ( *iKeyTime )[i + 1].iX -
+ ( *iKeyTime )[i].iX ) ;
+
+ if(x == 255)
+ {
+ aAnimTime = 255; // THIS SPECIFIES THAT THE DUR IS COMPLETE.
+ }
+ else
+ {
+
+ aAnimTime = CSvgAnimationBase::BlendInt( alpha,
+ ( *iKeyTime )[i].iY,
+ ( *iKeyTime )[i + 1].iY );
+ }
+ aSubAnimTime = alpha;
+
+ }
+ else
+ {
+ // calcMode:Spline
+ TBool IndexWasDecremented = EFalse;
+ if(aValueIndex + 1 == kcount)
+ {
+ aValueIndex--;
+ IndexWasDecremented = ETrue;
+ }
+ aAnimTime = ( *iAnimTime )[x];
+ TInt32 ydiff = ( TInt32 )
+ ( ( *iKeyTime )[aValueIndex + 1].iY -
+ ( *iKeyTime )[aValueIndex].iY );
+ if ( ydiff != 0 )
+ {
+ aSubAnimTime = MULT255( aAnimTime -
+ ( *iKeyTime )[aValueIndex].iY ) / ydiff;
+ }
+ else
+ {
+ aSubAnimTime = 0;
+ }
+ // oops increment again if it was decremented.
+ if(IndexWasDecremented)
+ {
+ aValueIndex++;
+ }
+
+
+
+ }
+
+ if ( aAnimTime > KTimeMax )
+ {
+ aAnimTime = KTimeMax;
+ }
+ else
+ {
+ if ( aAnimTime < 0 )
+ {
+ aAnimTime = 0;
+ }
+ }
+
+ }
+ }
+ }
+
+// *******************************************************
+// Create keytimes
+// default is equally deived time
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+void CSvgAnimTimeController::CreateKeyTime( TInt32 aKeyTimeCount )
+ {
+ // Create keyTime array if not available
+ TInt lDivider = aKeyTimeCount;
+ if ( iCalcMode != KAnimCalcModeDiscrete )
+ {
+ lDivider--;
+ }
+
+ if ( iKeyTime->Count() == 0 && aKeyTimeCount > 0 && lDivider != 0 ) // check to avoid division by zero.
+ {
+ for ( TInt32 i = 0; i < aKeyTimeCount; i++ )
+ {
+ AddKeyTime( TFloatFixPt( i ) / TFloatFixPt( lDivider ) );
+ }
+ }
+ }
+
+void CSvgAnimTimeController::CreateKeyTimeForEnumeration( TInt32 aKeyTimeCount )
+ {
+ // Create keyTime array if not available
+ // ignore the calc mode specification.
+
+ TInt lDivider = aKeyTimeCount - 1;
+ if ( iKeyTime->Count() == 0 && aKeyTimeCount > 0 && lDivider != 0 ) // check to avoid division by zero.
+ {
+ for ( TInt32 i = 0; i < aKeyTimeCount; i++ )
+ {
+ AddKeyTime( TFloatFixPt( i ) / TFloatFixPt( lDivider ) );
+ }
+ }
+ }
+
+// Preparing animation time
+// this should be called just before animation start
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimTimeController::PrepareTimeL( const RArray<TFloatFixPt>* aValues )
+ {
+ TInt32 i;
+ // set y for each keytime
+ TInt32 count = iKeyTime->Count();
+
+ // THIS IS MODIFIED FOR THE BUG FIX.
+ if ( count <= 1)
+ {
+ return;
+ }
+
+ if ( iCalcMode == KAnimCalcModePaced )
+ {
+ if ( aValues == NULL )
+ {
+ return;
+ }
+
+ TInt32 valCount = aValues->Count();
+ if ( valCount != count )
+ {
+ return; // No animation if values and keytimes has different number of items
+ }
+
+ // 'Paced' animation needs unique animation time from
+ // value difference
+ RArray<TFloatFixPt>* yary = new ( ELeave ) RArray<TFloatFixPt>( 1 ); // SSB was 10
+ CleanupStack::PushL( yary );
+
+ #ifdef SVG_FLOAT_BUILD
+ yary->AppendL( TFloatFixPt( 0.0f ) );
+ TFloatFixPt sum( 0.0f );
+ #else
+ yary->AppendL( TFloatFixPt( 0, ETrue ) );
+ TFloatFixPt sum( 0, ETrue );
+ #endif
+
+ for ( i = 1; i < valCount; i++ )
+ {
+ TFloatFixPt value = ( *aValues )[i] - ( *aValues )[i - 1];
+ if ( value < TFloatFixPt( 0 ) )
+ {
+ value = TFloatFixPt(0) - value;
+ }
+ yary->AppendL( value );
+ sum += ( *yary )[i];
+ }
+ TFloatFixPt tmax( ( TInt32 ) KTimeMax );
+ ( *iKeyTime )[0].iY = 0;
+
+
+ for ( i = 1; i < valCount; i++ )
+ {
+ if( (TReal32)sum != 0) // check to avoid division by zero.
+ {
+ ( *yary )[i] = ( ( *yary )[i] / sum ) * tmax; // need to make sure value does not exceed 0x7fff
+ }
+ else
+ {
+ ( *yary )[i] = (TFloatFixPt) (0);
+ }
+
+ ( *iKeyTime )[i].iY = ( TUint16 )
+ ( ( *iKeyTime )[i - 1].iY +
+ ( TUint16 ) ( TInt32 ) ( *yary )[i] );
+ }
+ ( *iKeyTime )[count - 1].iY = KTimeMax;
+
+ yary->Close();
+ CleanupStack::PopAndDestroy( 1 ); // yary
+ }
+ else
+ {
+ for ( i = 0; i < count; i++ )
+ {
+ ( *iKeyTime )[i].iY = ( TUint16 ) ( i * KTimeMax / ( count -1 ) );
+ }
+ }
+ // interpolate animation time (keySplines)
+ for ( i = 1; i < KTimeMax; i++ )
+ {
+ if ( ( *iAnimTime )[i] == 0 )
+ ( *iAnimTime )[i] = ( *iAnimTime )[i - 1];
+ }
+ }
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimTimeController::AddKeyTime( TFloatFixPt aTimerTime )
+ {
+ TKeyTime newKeytime;
+ newKeytime.iX = ( TUint16 )
+ ( ( TInt32 ) ( aTimerTime * TFloatFixPt( KTimeMax ) ) );
+ newKeytime.iY = 0;
+ iKeyTime->Append( newKeytime );
+ }
+
+//
+// This needs 'L' postfix or TRAP
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimTimeController::AddKeySplineL( TFloatFixPt aX1,
+ TFloatFixPt aY1,
+ TFloatFixPt aX2,
+ TFloatFixPt aY2 )
+ {
+ // keySplines must be keyTime-1
+ if ( iSplineIndex >= iKeyTime->Count() - 1 )
+ {
+ return;
+ }
+
+ // Keytime must be set before adding keyspline
+ CGfxGeneralPath* path = CGfxGeneralPath::NewLC();
+
+ TFloatFixPt x0, y0, x3, y3;
+ x0 = ( TInt32 ) ( *iKeyTime )[iSplineIndex].iX;
+ y0 = ( TInt32 ) ( *iKeyTime )[iSplineIndex].iY;
+ x3 = ( TInt32 )
+ ( ( *iKeyTime )[iSplineIndex + 1].iX -
+ ( *iKeyTime )[iSplineIndex].iX );
+ y3 = ( TInt32 )
+ ( ( *iKeyTime )[iSplineIndex + 1].iY -
+ ( *iKeyTime )[iSplineIndex].iY );
+ aX1 *= x3;
+ aY1 *= y3;
+ aX2 *= x3;
+ aY2 *= y3;
+
+ path->MoveToL( x0, y0, ETrue );
+ path->CubicToL( aX1, aY1, aX2, aY2, x3, y3, EFalse );
+ TGfxAffineTransform ident;
+
+ CGfxFlatteningPathIterator* itr = CGfxFlatteningPathIterator::NewL( path,
+ &ident,
+ 3 );
+
+ CleanupStack::PushL( itr );
+ TFloatFixPt tmpcoords[6];
+ while ( !itr->IsDone() )
+ {
+ itr->CurrentSegment( tmpcoords );
+ TInt32 x = tmpcoords[0];
+ if ( 0 <= x && x <= 255 )
+ {
+ ( *iAnimTime )[x] = ( TUint8 ) ( TInt32 ) tmpcoords[1];
+ }
+ itr->NextL();
+ }
+
+ iSplineIndex++;
+ CleanupStack::PopAndDestroy( 2 ); // path, itr
+ }
+
+
+
+// ---------------------------------------------------------------------------
+// Functions used by Decoder
+// ---------------------------------------------------------------------------
+
+TInt CSvgAnimTimeController::BeginTimesCount()
+ {
+ return iBeginTimeList->Count();
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimTimeController::SetBeginTimeList(RArray<TInt32>*& aList)
+ {
+ if (iBeginTimeList)
+ {
+ iBeginTimeList->Reset();
+ delete iBeginTimeList;
+ iBeginTimeList= NULL;
+ }
+
+ iBeginTimeList= aList;
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimTimeController::SetKeyTimeArray(RArray<TKeyTime>*& aArray)
+ {
+ if (iKeyTime)
+ {
+ iKeyTime->Close();
+ delete iKeyTime;
+ iKeyTime= NULL;
+ }
+
+ iKeyTime= aArray;
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimTimeController:: SetAnimTimeArray(RArray<TUint32>*& aArray)
+ {
+ if (iAnimTime)
+ {
+ iAnimTime->Close();
+ delete iAnimTime;
+ iAnimTime= NULL;
+ }
+
+ iAnimTime= aArray;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimTimeController:: CalculateAnimTimes()
+ {
+ if(iRepeatDurationTime <= iDurationTime )
+ {
+ iNewActiveDurationTime = iDurationTime;
+ iDurationTime = iRepeatDurationTime;
+
+ }
+ if( iBeginTime == KTimeIndefinite || iRepeatDurationTime == KTimeIndefinite )
+ {
+ iEndTime = KTimeIndefinite;
+ }
+
+ }
+
+void CSvgAnimTimeController:: SetOriginalValues_DOMReuse()
+ {
+ iOrgEndTime = iEndTime;
+ iModifiedEndTime= iEndTime;
+ iOrgDurationTime = iDurationTime;
+ }
+TUint32 CSvgAnimTimeController::GetOriginalEndTime()
+{
+return iOrgEndTime;
+}
+void CSvgAnimTimeController:: ReInitialize()
+ {
+ iEndTime = iOrgEndTime;
+ iDurationTime = iOrgDurationTime;
+ }
+void CSvgAnimTimeController::AddToInitialList(TInt aBeginTime)
+ {
+ if ( aBeginTime < 0 )
+ {
+ aBeginTime = 0;
+ }
+ iInitialBeginTimeList->Append( aBeginTime );
+ iInitialBeginTimeList->SortSigned();
+
+ }
+void CSvgAnimTimeController:: ReInitializeForSeek()
+ {
+/* if (iOrgEndTime == KTimeIndefinite)
+ {
+ if( iEndTime == KTimeIndefinite)
+ {
+ iEndTime= iModifiedEndTime;
+ }
+ }
+ else
+ {
+ iEndTime = iOrgEndTime;
+ }
+*/
+ iEndTime = iModifiedEndTime;
+ iDurationTime = iOrgDurationTime;
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgAnimTimeController::SetIsSplineCalcMode
+// Sets the calc mode to spline mode
+// ---------------------------------------------------------------------------
+void CSvgAnimTimeController::SetIsSplineCalcMode(
+ const TBool aIsSplineCalcMode ) // Boolean indicating calcMode
+ {
+ iIsSplineCalcMode = aIsSplineCalcMode;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSvgAnimTimeController::IsSplineCalcMode
+// Returns ETrue if the calc mode is in spline mode
+// ---------------------------------------------------------------------------
+TBool CSvgAnimTimeController::IsSplineCalcMode() const
+ {
+ return iIsSplineCalcMode;
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgAnimTimeController::SetSplineValueL
+// Sets the spline parameter string for later processing when calc mode is set
+// ---------------------------------------------------------------------------
+void CSvgAnimTimeController::SetSplineValueL( const TDesC& aSplineValue )
+ {
+ iSplines = aSplineValue.AllocL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgAnimTimeController::SplineValue
+// Returns the string corresponding to the Spline parameters.
+// ---------------------------------------------------------------------------
+TPtrC CSvgAnimTimeController::SplineValue() const
+ {
+ if ( iSplines )
+ {
+ return iSplines->Des();
+ }
+ else
+ {
+ TPtrC lRetVal;
+ lRetVal.Set( KEmptyString );
+ return lRetVal;
+ }
+ }
+
+void CSvgAnimTimeController::GetAnimTimeForEnumeration( TInt32 aTimerTime,
+ TInt32& aAnimTime,
+ TInt32& aValueIndex,
+ TBool aKeyTimesPresent
+ )
+ {
+
+ // This function is specifically for enumerations. i.e. "strings"
+ // remember that these attributes {"strings"} can not be interpolated
+ // linearly so the calc mode for these should be
+ // discrete irrespective of what is specified in the .svg file.
+
+
+ // THE following code supports only "discrete" calc mode.
+
+ if( iDurationTime == KTimeIndefinite || iDurationTime == 0)
+ {
+ aValueIndex = 0;
+ aAnimTime=0;
+ return;
+ }
+ TInt32 x;
+
+ if( iNewActiveDurationTime > 0 )//"repeatDur" <= "Dur"
+ {
+ x = MULT255( aTimerTime - iBeginTime ) / iNewActiveDurationTime;
+ }
+ else
+ {
+
+ x = MULT255( aTimerTime - iBeginTime ) / iDurationTime;
+
+ }
+
+ if ( x > KTimeMax )
+ {
+ x = KTimeMax;
+ }
+ else
+ {
+ if ( x < 0 )
+ {
+ x = 0;
+ }
+ }
+
+ TInt32 kcount = iKeyTime->Count();
+
+ if ( kcount == 0 )
+ {
+ aValueIndex = 0;
+ aAnimTime = x; //
+ // No keytimes or paced animation
+ if ( x < KTimeMax / 2 )
+ {
+ aAnimTime = 0;
+ }
+ else
+ {
+ aAnimTime = KTimeMax;
+ }
+
+ }
+ else
+ {
+ // find corresponding keytime index
+ TInt32 i = 0;
+ // earlier the last one was getting missed. this is specifically for
+ // "string" data types.
+ while ( i < kcount && ( *iKeyTime )[i].iX <= x )
+ {
+ i++;
+ }
+ if ( i > 0 )
+ {
+ i--;
+ }
+
+ /// PROPAGATE THE CHANGES TO THIS PLACE ALSO.
+ if(x == 255)
+ {
+ aValueIndex = kcount-1;
+ }
+ else
+ {
+ aValueIndex = i;
+ }
+ ////// END OF ADDITION.
+
+ if(i == (kcount-1))
+ {
+ i--;
+ }
+ // do not go down if "keyTimes" is specified in the file.
+
+ if(aKeyTimesPresent)
+ {
+ return;
+ }
+
+ ///come to this place if keyTimes is not present.
+ TInt32 alpha = MULT255( ( TInt32 )
+ ( x - ( *iKeyTime )[i].iX ) ) /
+ ( TInt32 )
+ ( ( *iKeyTime )[i + 1].iX -
+ ( *iKeyTime )[i].iX ) ;
+
+
+
+ // gives you AnimTime between 0-255 , this is used when KeyTimes is not
+ // explicitly specified in the .svg file.
+ aAnimTime = CSvgAnimationBase::BlendInt( alpha,
+ ( *iKeyTime )[i].iY,
+ ( *iKeyTime )[i + 1].iY );
+
+
+ if(aAnimTime > KTimeMax)
+ aAnimTime = KTimeMax;
+ if(aAnimTime < 0)
+ aAnimTime = 0;
+
+ }
+ }
+
+//////////////////////////////////////
+void CSvgAnimTimeController::CopyL(CSvgAnimTimeController* newElement)
+{
+ if(newElement)
+ {
+ newElement->iCalcMode = iCalcMode;
+ newElement->iBeginTime = iBeginTime;
+ newElement->iDurationTime = iDurationTime;
+ newElement->iOrgDurationTime = iOrgDurationTime;
+ newElement->iEndTime = iEndTime;
+ newElement->iOrgEndTime = iOrgEndTime;
+ newElement->iRepeatDurationTime = iRepeatDurationTime;
+ newElement->iNewActiveDurationTime = iNewActiveDurationTime;
+ newElement->iSplineIndex = iSplineIndex;
+ newElement->iModifiedEndTime = iModifiedEndTime;
+ newElement->iIsSplineCalcMode = EFalse;
+ newElement->iSplines = NULL; // There is no parsing later
+ TInt Count= iKeyTime->Count();
+ newElement->iKeyTime->Reset();
+ for(TInt i=0; i<Count; i++)
+ {
+ newElement->iKeyTime->AppendL(this->iKeyTime->operator[](i));
+ }
+ TInt Count2= iAnimTime->Count();
+ newElement->iAnimTime->Reset();
+ for(TInt i2=0; i2<Count2; i2++)
+ {
+ newElement->iAnimTime->AppendL(this->iAnimTime->operator[](i2));
+ }
+ TInt Count3= iBeginTimeList->Count();
+ newElement->iBeginTimeList->Reset();
+ for(TInt i3=0; i3<Count3; i3++)
+ {
+ newElement->iBeginTimeList->AppendL(this->iBeginTimeList->operator[](i3));
+ }
+ }
+
+}
+void CSvgAnimTimeController:: SetModifiedEndTime(TUint32 aTime)
+ {
+ if(aTime >= iBeginTime)
+ iModifiedEndTime = aTime;
+ else
+ iModifiedEndTime = iBeginTime;
+
+ }
+
+void CSvgAnimTimeController:: Reset()
+ {
+ // iEndTime = iModifiedEndTime;
+
+ if(iOrgEndTime == KTimeIndefinite)
+ {
+ iEndTime = iModifiedEndTime;
+ }
+ else
+ {
+ iEndTime= iOrgEndTime;
+ }
+ iDurationTime = iOrgDurationTime ;
+
+
+ }
+void CSvgAnimTimeController:: SetEndTimesIndefinite()
+ {
+ iModifiedEndTime = KTimeIndefinite;
+ iEndTime = KTimeIndefinite;
+ }
+void CSvgAnimTimeController::GetNextEndTime(TInt32 aBeginTime)
+ {
+ // this is similar to adobe.
+ TInt lCount = iEndTimeList->Count();
+ for(TInt i=0; i<lCount; i++)
+ {
+ if(iEndTimeList->operator[](i) >= aBeginTime)
+ {
+ iEndTime = iEndTimeList->operator[](i);
+ return;
+ }
+ }
+ iEndTime = KTimeIndefinite;
+ }
+void CSvgAnimTimeController::SetNextBeginTime(TInt32 aCurTime)
+ {
+ // Initially begintime is indefinite
+ // checking beginlist
+ if( aCurTime == KTimeIndefinite && iBeginTimeList->Count() > 0)
+ {
+ iBeginTime = iBeginTimeList->operator[](0);
+ }
+ // pick the begin time that is greater than the time passed
+ else
+ {
+ TInt lCount = iBeginTimeList->Count();
+ for(TInt i=0; i<lCount; i++)
+ {
+ if(iBeginTimeList->operator[](i) >= aCurTime)
+ {
+ iBeginTime = iBeginTimeList->operator[](i);
+ return;
+ }
+ }
+
+ iBeginTime = KTimeIndefinite;
+ }
+ }
+
+void CSvgAnimTimeController::SaveEndTime()
+ {
+ iInitialEndTime = iEndTime;
+ iInitialEndTimeList->Reset();
+ for(TInt i=0; i<iEndTimeList->Count(); i++)
+ {
+ iInitialEndTimeList->Append(iEndTimeList->operator[](i));
+ }
+ }
+void CSvgAnimTimeController::SaveBeginTime()
+ {
+ iInitialBeginTime = iBeginTime;
+ iInitialBeginTimeList->Reset();
+ for(TInt i =0; i<iBeginTimeList->Count(); i++)
+ {
+ iInitialBeginTimeList->Append(iBeginTimeList->operator[](i));
+ }
+ }
+void CSvgAnimTimeController::ResetEndTime()
+ {
+
+ iEndTime = iInitialEndTime;
+ iModifiedEndTime = iInitialEndTime;
+
+ iEndTimeList->Reset();
+
+ for(TInt i=0; i<iInitialEndTimeList->Count();i++)
+ {
+ iEndTimeList->Append(iInitialEndTimeList->operator[](i));
+ }
+ }
+void CSvgAnimTimeController::ResetBeginTime()
+ {
+ iBeginTime = iInitialBeginTime;
+ iBeginTimeList->Reset();
+ for(TInt i=0; i<iInitialBeginTimeList->Count();i++)
+ {
+ iBeginTimeList->Append(iInitialBeginTimeList->operator[](i));
+ }
+ }
+TInt32 CSvgAnimTimeController::LastEndTime()
+ {
+ if(iEndTimeList)
+ {
+ if(iEndTimeList->Count())
+ {
+ return iEndTimeList->operator[](iEndTimeList->Count() - 1);
+ }
+ else
+ {
+ return KTimeIndefinite;
+ }
+ }
+ else
+ {
+ return KTimeIndefinite;
+ }
+ }
+TInt32 CSvgAnimTimeController::LastBeginTime()
+ {
+ if(iBeginTimeList)
+ {
+ if(iBeginTimeList->Count())
+ {
+ return iBeginTimeList->operator[](iBeginTimeList->Count() - 1);
+ }
+ else
+ {
+ return KTimeIndefinite;
+ }
+ }
+ else
+ {
+ return KTimeIndefinite;
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGAnimTimingParser.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,466 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include <e32svr.h>
+
+#include "SVGAnimTimingParser.h"
+#include "SVGStringTokenizer.h"
+#include "SVGAnimationBase.h"
+
+#include "SVGTokenizer.h"
+_LIT( KTextRepeat, "repeat" );
+
+// ---------------------------------------------------------------------------
+// Two phase construction
+// ---------------------------------------------------------------------------
+CSvgAnimTimingParser* CSvgAnimTimingParser::NewL( const TDesC& aTimingDes, CSvgElementImpl* aElement )
+ {
+ CSvgAnimTimingParser* self = NewLC( aTimingDes, aElement );
+ CleanupStack::Pop();
+ return self;
+ }
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgAnimTimingParser* CSvgAnimTimingParser::NewLC( const TDesC& aTimingDes, CSvgElementImpl* aElement )
+ {
+ CSvgAnimTimingParser* self = new ( ELeave ) CSvgAnimTimingParser();
+ CleanupStack::PushL( self );
+ self->ConstructL( aTimingDes, aElement );
+ return self;
+ }
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgAnimTimingParser::CSvgAnimTimingParser() : iTimingDes( NULL, 0 )
+ {
+
+ }
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimTimingParser::ConstructL( const TDesC& aTimingDes, CSvgElementImpl* aElement )
+ {
+ // Copy Timing descriptor and trim all spaces
+ iBuf = HBufC::NewL( aTimingDes.Length() );
+ *iBuf = aTimingDes; // copy data
+ iTimingDes.Set( iBuf->Des() );
+ iTimingDes.TrimAll();
+ iElement = aElement;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgAnimTimingParser::~CSvgAnimTimingParser()
+ {
+ delete iBuf;
+ iBuf = NULL;
+ }
+
+
+//***************************************************************
+// 'begin' and 'end' attribute parser
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimTimingParser::Parse( TDes& aIdValue,
+ TSvgEvent& aEvent,
+ TInt32& aClockValue,
+ TReal32& aRepeatValue,
+ TBool aBeginAttribute )
+ {
+ // Init value
+ aEvent = ESvgEventNone;
+ aClockValue = 0;
+ aRepeatValue = 0;
+
+ TLex lex( iTimingDes );
+
+ lex.SkipSpace();
+
+ // Check if Offset-value only
+ if ( lex.Peek() == '+' || lex.Peek() == '-' || lex.Peek().IsDigit() || lex.Peek() == '.' )
+ {
+ lex.SkipSpace();
+ ParseClockValue( lex, aClockValue );
+ aEvent = ESvgEventNone;
+ return;
+ }
+
+ // Parse first token
+ lex.Mark();
+ SkipAlphaNumeric( lex );
+ TPtrC firstToken = lex.MarkedToken();
+ // Checks if the first part of the begin attribute is an event
+ TSvgEvent event = DesToEventId( firstToken );
+
+ if ( event == ESvgEventNone )
+ {
+ if ( firstToken == _L( "accessKey" ) )
+ {
+ // accessKey(x)
+ aEvent = ESvgEventKey;
+ //Skip any spaces between "Access Key" and opening Brace "("
+ lex.SkipSpace();
+ //Get automatically moves the pointer to the next character
+ TChar openBraces = lex.Get();
+ //If the next character is opening brace then continue
+ if(openBraces == '(')
+ {
+ TChar curValue = 0;
+ TInt inc=0;
+
+ //inc checks how many chars are there between opening and closing braces
+ // it is needed to ensure only one char is there between "(" and ")"
+ do
+ {
+ inc++;
+ //If there are more than one char between "(" and ")" exit
+ if(inc >1)
+ break;
+ //Move to the next char
+ curValue = lex.Peek();
+ lex.Inc();
+ }while(lex.Peek() != ')');
+
+ //assign cur value to access key if no of chars between "(" and ")" is 1
+ if(inc == 1)
+ {
+ iAccessKeyValue = curValue;
+ }
+
+ if ( lex.Peek() == ')' )
+ {
+ lex.Inc();
+ }
+ // if some offset value is given with accesskey then parse it.
+ ParseClockValue( lex, aClockValue );
+
+ }
+ }
+ else if ( firstToken == KTextRepeat )
+ {
+ // repeat(x) without Id-value
+ // Not yet supported
+ aEvent = ESvgEventRepeatEvent;
+ }
+ else if ( firstToken == _L( "wallclock" ) )
+ {
+ // wallclock(....)
+ // Not yet supported
+ aEvent = ESvgEventWallClock;
+ }
+ else //
+ {
+ // The first token was 'id'. Parse next token as event
+ if ( lex.Peek() != '.')
+ {
+ // This is not a valid begin value
+ aEvent = ESvgEventNone;
+ aIdValue = _L("");
+ aClockValue= KTimeIndefinite; // same as KTimeIndefinite
+ return;
+ }
+ lex.Inc(); // skip '.': no space allowed between id, '.', and event
+ lex.Mark();
+ aIdValue = firstToken; // copy token string
+
+ SkipAlphaNumeric( lex );
+ TPtrC secondToken = lex.MarkedToken();
+
+ // What if the event is not clearly mentioned
+ aEvent = DesToEventId( secondToken );
+ if(aEvent != ESvgEventNone)
+ {
+ if ( secondToken == KTextRepeat )
+ {
+ // repeat(x) with Id-value
+
+ ((CSvgAnimationBase*)iElement)->StoreRepeatId(firstToken, aBeginAttribute);
+
+ aEvent = ESvgEventRepeatEvent;
+ // TChar tmpchar = lex.Peek();
+ if ( lex.Peek() == '(' )
+ {
+ lex.Inc();
+ if (lex.Val(aRepeatValue, '.' )!= KErrNone)
+ {
+ if(lex.Val(aRepeatValue) != KErrNone )
+ aRepeatValue=1;
+ }
+ lex.Inc();
+ }
+
+ }
+ ParseClockValue( lex, aClockValue );
+ }
+ else
+ {
+ // this is not a valid begin value;
+ aEvent = ESvgEventNone;
+ aIdValue = _L("");
+ aClockValue= KTimeIndefinite; // same as KTimeIndefinite
+ return;
+ }
+
+ }
+ }
+ else
+ {
+ // Event without id
+ aEvent = event;
+// TPtrC tempToken = lex.MarkedToken();
+ ParseClockValue( lex, aClockValue );
+// aClockValue = 0;
+ }
+ }
+
+//***************************************************************
+// Private methods
+
+// ---------------------------------------------------------------------------
+// Parse clock value
+// ---------------------------------------------------------------------------
+void CSvgAnimTimingParser::ParseClockValue( TLex& aLex, TInt32& aClockValue )
+ {
+ TReal32 value = 0;
+
+ aLex.SkipSpaceAndMark();
+
+ TBool wasAddition = ETrue;
+
+ if (aLex.Peek() == '+')
+ {
+ aLex.Inc();
+ aLex.Mark();
+ aLex.SkipSpaceAndMark();
+ }
+ else if (aLex.Peek() == '-')
+ {
+ wasAddition = EFalse;
+ aLex.Inc();
+ aLex.Mark();
+ aLex.SkipSpaceAndMark();
+ }
+
+ TTokenizer tokenizer( aLex.Remainder() );
+
+ // blank, setting to zero
+ if ( tokenizer.IsAtEnd() )
+ {
+ aClockValue = 0;
+ }
+ else if ( tokenizer.SkipDecimal() )
+ {
+ // Decimal number , extract it
+ TPtrC decimalString = tokenizer.SkippedString();
+ TLex lex( decimalString );
+ // Specify the decimal seperator, instead of using
+ // locale specific seperator.
+ lex.Val( value, '.' );
+
+ tokenizer.SkipWhiteSpace();
+ // Get the units
+ TPtrC remainder = tokenizer.Remainder();
+ // millseconds
+ if ( remainder == _L( "ms" ) )
+ {
+ aClockValue = value;
+
+ if (!wasAddition)
+ aClockValue = 0 - aClockValue;
+ }
+ // seconds: implied or 's'
+ else if ( remainder.Length() == 0 || remainder == _L( "s" ) )
+ {
+ aClockValue = value * 1000;
+
+ if (!wasAddition)
+ aClockValue = 0 - aClockValue;
+ }
+ // anything else is invalid
+ else
+ {
+ aClockValue = KTimeIndefinite;
+ }
+ }
+ // invalid
+ else
+ {
+ aClockValue = KTimeIndefinite;
+ }
+ }
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimTimingParser::SkipUntilNumEnd( TLex& aLex )
+ {
+ TChar tmpchar = aLex.Peek();
+ while ( tmpchar.IsDigit() || tmpchar == '.' )
+ {
+ tmpchar = aLex.Get();
+ }
+
+ if ( !aLex.Eos() && (aLex.Offset() > 0) )
+ {
+ aLex.UnGet();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimTimingParser::SkipAlphaNumeric( TLex& aLex )
+ {
+ TChar tmpchar = aLex.Peek();
+ while ( tmpchar.IsAlphaDigit() || tmpchar == '_' || tmpchar == '-' )
+ {
+ tmpchar = aLex.Get();
+ }
+ if ( !aLex.Eos() && (aLex.Offset() > 0) )
+ {
+ aLex.UnGet();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TSvgEvent CSvgAnimTimingParser::DesToEventId( const TDesC& aEventDes )
+ {
+ // 'begin' matches with 'begineEvent' and 'end' matches with 'endEvent'
+
+ if ( aEventDes == _L("begin") )
+ {
+ return ESvgEventBeginEvent;
+ }
+ else if ( aEventDes == _L("end") )
+ {
+ return ESvgEventEndEvent;
+ }
+ else if ( aEventDes == _L("repeat") )
+ {
+ return ESvgEventRepeatEvent;
+ }
+ else if ( aEventDes == _L("focusin") )
+ {
+ return ESvgEventFocusin;
+ }
+ else if ( aEventDes == _L("focusout") )
+ {
+ return ESvgEventFocusout;
+ }
+ else if ( aEventDes == _L("activate") )
+ {
+ return ESvgEventActivate;
+ }
+ else if ( aEventDes == _L("click") )
+ {
+ return ESvgEventClick;
+ }
+ else if ( aEventDes == _L("mousedown") )
+ {
+ return ESvgEventMousedown;
+ }
+ else if ( aEventDes == _L("mouseup") )
+ {
+ return ESvgEventMouseup;
+ }
+ else if ( aEventDes == _L("mouseover") )
+ {
+ return ESvgEventMouseover;
+ }
+ else if ( aEventDes == _L("mousemove") )
+ {
+ return ESvgEventMousemove;
+ }
+ else if ( aEventDes == _L("mouseout") )
+ {
+ return ESvgEventMouseout;
+ }
+ else if ( aEventDes == _L("DOMSubtreeModified") )
+ {
+ return ESvgEventDOMSubtreeModified;
+ }
+ else if ( aEventDes == _L("DOMNodeInserted") )
+ {
+ return ESvgEventDOMNodeInserted;
+ }
+ else if ( aEventDes == _L("DOMNodeRemoved") )
+ {
+ return ESvgEventDOMNodeRemoved;
+ }
+ else if ( aEventDes == _L("DOMNodeRemovedFromDocument") )
+ {
+ return ESvgEventDOMNodeRemovedFromDocument;
+ }
+ else if ( aEventDes == _L("DOMNodeInsertedIntoDocument") )
+ {
+ return ESvgEventDOMNodeInsertedIntoDocument;
+ }
+ else if ( aEventDes == _L("DOMAttrModified") )
+ {
+ return ESvgEventDOMAttrModified;
+ }
+ else if ( aEventDes == _L("DOMCharacterDataModified") )
+ {
+ return ESvgEventDOMCharacterDataModified;
+ }
+ else if ( aEventDes == _L("SVGLoad") )
+ {
+ return ESvgEventSVGLoad;
+ }
+ else if ( aEventDes == _L("SVGUnload") )
+ {
+ return ESvgEventSVGUnload;
+ }
+ else if ( aEventDes == _L("SVGAbort") )
+ {
+ return ESvgEventSVGAbort;
+ }
+ else if ( aEventDes == _L("SVGError") )
+ {
+ return ESvgEventSVGError;
+ }
+ else if ( aEventDes == _L("SVGResize") )
+ {
+ return ESvgEventSVGResize;
+ }
+ else if ( aEventDes == _L("SVGScroll") )
+ {
+ return ESvgEventSVGScroll;
+ }
+ else if ( aEventDes == _L("SVGZoom") )
+ {
+ return ESvgEventSVGZoom;
+ }
+
+ else
+ {
+ return ESvgEventNone;
+ }
+
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGAnimateElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,921 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include "SVGAnimateElementImpl.h"
+
+#include "SVGElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+
+
+
+
+// ---------------------------------------------------------------------------
+// Two phase construction
+// ---------------------------------------------------------------------------
+CSvgAnimateElementImpl* CSvgAnimateElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgAnimateElementImpl* self = new ( ELeave )
+ CSvgAnimateElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgAnimateElementImpl* CSvgAnimateElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgAnimateElementImpl* self = new ( ELeave )
+ CSvgAnimateElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+// *******************************************************
+// Protected
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateElementImpl::ConstructL( const TUint8 aElemID )
+ {
+ CSvgAnimationBase::ConstructL( aElemID );
+
+ iReqAttrFlag=KSVG_ANIMATE_ELEMFLAG;
+ iIsInheritedAttribute = EFalse;
+ }
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgAnimateElementImpl::~CSvgAnimateElementImpl()
+ {
+ }
+
+// *******************************************************
+// Protected
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgAnimateElementImpl::CSvgAnimateElementImpl( CSvgDocumentImpl* aDoc ) : CSvgAnimationBase( aDoc )
+ {
+ }
+
+// *******************************************************
+// From SVG DOM
+
+
+// *******************************************************
+// From MSvgEventReceiver
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateElementImpl::ResetReferenceElementL()
+ {
+ if(iTargetElement != NULL )
+ {
+ if( ((iTargetElement->iAnimateAttrSet == NULL) || (iTargetElement->iAnimateAttrSet->Find(iAttrId) == KErrNotFound) ) )
+ {
+ if ( iInitDone && iAnimStatus != KAnimNotActive)
+ {
+ iCheckFirstAnim= ETrue;
+ SetToOriginalL();
+ if( !(iTargetElement->iAnimateAttrSet) )
+ {
+ iTargetElement->iAnimateAttrSet = new (ELeave) RArray<TUint32>(1);
+ }
+ iTargetElement->iAnimateAttrSet->AppendL((TUint32)(iAttrId));
+ }
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// From MSvgEventReceiver
+// ---------------------------------------------------------------------------
+//
+TBool CSvgAnimateElementImpl::ReceiveEventL( MSvgEvent* aEvent )
+ {
+ return CSvgAnimationBase::ReceiveEventProcL( aEvent, this );
+ }
+
+
+// ---------------------------------------------------------------------------
+// From CSvgAnimationBase
+// ---------------------------------------------------------------------------
+//
+TBool CSvgAnimateElementImpl::AnimProcL( MSvgTimerEvent* aEvent )
+
+ {
+
+ if(iAnimStatus == KAnimActive && !iHadBegun)
+ {
+ SetFromValuesL();
+ iHadBegun = ETrue;
+
+ }
+
+
+ if((iAnimStatus != KAnimActive) || iDoFreeze)
+ {
+ if(iFill== KAnimFillFreeze && !iDoFreeze && iAnimStatus == KAnimFinished)
+ {
+
+ }
+ else
+ {
+ CSvgAnimationBase::CheckForEndTimesAndFreezeL(this);
+ return EFalse;
+ }
+ }
+
+ // Calc alpha from time [0-255]
+ TInt32 alpha;
+ TInt32 valix, subanimtime;
+
+ switch ( iDataType )
+ {
+ // x, y, width, height,
+ // rx, ry, cx, cy, radius
+ // x1, y1, x2, y2
+ case KSvgTypeOpacity:
+ case KSvgTypeLength:
+ {
+ iAnimTime->GetAnimTime( (aEvent->Time()-iNegativeBeginTime) , alpha, valix, subanimtime );
+ TFloatFixPt v1 = iFromFloat;
+ TFloatFixPt v2 = iToFloat;
+ TFloatFixPt lCurValue;
+ if(iHaveBy && iCurrentRepeatCount > 0 && iAccumulate == KAccumSum )
+ {
+ v1= KFloatFixZero;
+ v2 = iToFloat - iFromFloat;
+ }
+ if ( iValuesFloat->Count() > 0 )
+ {
+
+ // check for the range of valix
+ if(valix >= iValuesFloat->Count() )
+ {
+ valix = iValuesFloat->Count() - 1;
+ }
+
+ v1 = ( *iValuesFloat )[valix];
+ if ( valix + 1 >= iValuesFloat->Count() )
+ {
+ v2 = ( *iValuesFloat )[valix];
+ }
+ else
+ {
+ v2 = ( *iValuesFloat )[valix + 1];
+ }
+ alpha = subanimtime;
+ }
+ lCurValue = BlendFloat( alpha, v1, v2 );
+ if( iAccumulate == KAccumSum && !iNoFrom )
+ {
+ TFloatFixPt lRepeatCount((TInt) iCurrentRepeatCount) ;
+ if(iValuesFloat->Count() > 0)
+ {
+ lCurValue += ((*iValuesFloat) [iValuesFloat->Count() -1]) * lRepeatCount ;
+ }
+ else
+ {
+ TFloatFixPt lRepeatCount((TInt) iCurrentRepeatCount) ;
+ lCurValue += lRepeatCount * (v2);
+ if(iHaveBy && iCurrentRepeatCount > 0)
+ {
+ lCurValue += iFromFloat;
+ }
+ }
+ }
+ if ( ( iFill == KAnimFillFreeze ) )
+ {
+ iEndFloat = lCurValue;
+ }
+ if ( ( iAdditive == KAdditiveSum ) && !iNoFrom ) //.
+ {
+ TFloatFixPt lOrig;
+ iTargetElement->GetAttributeFloat( iAttrId, lOrig );
+ lCurValue += lOrig;
+ }
+ iTargetElement->SetAttributeFloatL( iAttrId, lCurValue );
+
+ }
+ break;
+ case KSvgTypeList:
+ case KSvgTypePath:
+ {
+ iAnimTime->GetAnimTime( (aEvent->Time()-iNegativeBeginTime), alpha, valix, subanimtime );
+ CGfxGeneralPath*v1 = iFromPath;
+ CGfxGeneralPath*v2 = iToPath;
+
+ if ( iValuesPath->Count() > 0 )
+ {
+
+ // check for the range of valix
+ if(valix >= iValuesPath->Count() )
+ {
+ valix = iValuesPath->Count() - 1;
+ }
+
+ v1 = iValuesPath->operator[]( valix );
+ if ( valix + 1 >= iValuesPath->Count() )
+ {
+ v2 = iValuesPath->operator[]( valix );
+ }
+ else
+ {
+ v2 = iValuesPath->operator[]( valix + 1 );
+ }
+ alpha = subanimtime;
+ }
+
+ CGfxGeneralPath*lCurPath = CGfxGeneralPath::NewLC();
+
+ BlendPathL( alpha, v1, v2, lCurPath );
+
+ if ( iAdditive == KAdditiveSum )
+ {
+ AddPathsL( lCurPath, iOrgPath );
+ }
+ else
+ {
+ // User current blended value
+ }
+ if ( ( iFill == KAnimFillFreeze ) )
+ {
+ CopyPathsL( iEndPath, lCurPath );
+ }
+
+ iTargetElement->SetAttributePathL( iAttrId, lCurPath );
+
+ CleanupStack::PopAndDestroy( 1 ); // lCurPath
+
+ }
+ break;
+ case KSvgTypeTransform:
+ break;
+
+ case KSvgTypeColor:
+ {
+ iAnimTime->GetAnimTime((aEvent->Time()-iNegativeBeginTime), alpha, valix, subanimtime );
+ TInt32 v1 = iFromInt;
+ TInt32 v2 = iToInt;
+ TInt32 lCurValue;
+ if(iHaveBy && iCurrentRepeatCount > 0 && iAccumulate == KAccumSum )
+ {
+ v1= 0;
+ v2 = SubtractColor(iToInt,iFromInt);
+ }
+
+ if ( iValuesInt->Count() > 0 )
+ {
+
+ // check for the range of valix
+ if(valix >= iValuesInt->Count() )
+ {
+ valix = iValuesInt->Count() - 1;
+ }
+
+ v1 = ( *iValuesInt )[valix];
+ if ( valix + 1 >= iValuesInt->Count() )
+ {
+ v2 = ( *iValuesInt )[valix];
+ }
+ else
+ {
+ v2 = ( *iValuesInt )[valix + 1];
+ }
+ alpha = subanimtime;
+ }
+
+ if ( iNoFrom ) //. This is to emulate Adobe.
+ {
+ if ( alpha > ( KTimeMax >> 1 ) )
+ {
+ alpha = KTimeMax;
+ }
+ else
+ {
+ alpha = 0;
+ }
+ }
+
+ lCurValue = BlendColor( alpha, v1, v2 );
+ if( iAccumulate == KAccumSum && !iNoFrom )
+ {
+
+
+ if(iValuesInt->Count() > 0)
+ {
+ TInt32 ColorToAdd = 0;
+ ColorToAdd = ((*iValuesInt) [iValuesInt->Count() -1]);
+ for( TInt i=0 ; i< iCurrentRepeatCount ; i++)
+ {
+ lCurValue = AddColor( lCurValue, ColorToAdd );
+ }
+
+ }
+ else
+ {
+ for (TInt i=0; i<iCurrentRepeatCount;i++)
+ {
+ lCurValue = AddColor( lCurValue, v2 ) ;
+ }
+
+ if(iHaveBy && iCurrentRepeatCount > 0)
+ {
+
+ lCurValue = AddColor( lCurValue, iFromInt );
+ }
+
+ }
+ }
+
+ // Fix for accum_addit_7.svg
+ if ( ( iFill == KAnimFillFreeze ) )
+ {
+ iEndInt = lCurValue;
+ iEndInt = lCurValue;
+ }
+ if ( ( iAdditive == KAdditiveSum ) && !iNoFrom ) //.
+ {
+ TInt32 lOrig;
+ iTargetElement->GetAttributeIntL( iAttrId, lOrig );
+
+
+
+ lCurValue = AddColor( lCurValue, lOrig );
+ }
+
+ iTargetElement->SetAttributeIntL( iAttrId, lCurValue );
+
+ }
+ break;
+ case KSvgTypeTextAnchor:
+ case KSvgTypeVisibility:
+ case KSvgTypeGradientUnits:
+ case KSvgTypeSpreadMethod:
+ case KSvgTypeDisplay:
+ {
+ iAnimTime->GetAnimTimeForEnumeration( (aEvent->Time()-iNegativeBeginTime), alpha, valix, iKeyTimesPresent);
+ TInt32 v1 = iFromInt;
+ TInt32 v2 = iToInt;
+ TInt32 lCurValue;
+ if ( iValuesInt->Count() > 0 )
+ {
+
+ // check for the range of valix
+ if(valix >= iValuesInt->Count() )
+ {
+ valix = iValuesInt->Count() - 1;
+ }
+
+ if(iKeyTimesPresent)
+ {
+ if ( valix < iValuesInt->Count() )
+ {
+ lCurValue = (*iValuesInt)[valix];
+ }
+ else
+ {
+ lCurValue = (*iValuesInt)[valix-1];
+ }
+ }
+ else
+ {
+ TInt index = ( alpha * iValuesInt->Count() / 255 ) ;
+ if(index == iValuesInt->Count()) index--;
+ if ( index >= 0 )
+ {
+ lCurValue = (*iValuesInt)[index];
+ }
+ else
+ {
+ lCurValue = (*iValuesInt)[0];
+ }
+ }
+
+ }
+
+ else
+ {
+ if(alpha>=128) // average of 256 to determine which value should predominate
+ {
+ lCurValue = v2;
+ }
+ else
+ {
+ lCurValue = v1;
+ }
+ }
+ if ( ( iFill == KAnimFillFreeze ) )
+ {
+ iEndInt = lCurValue;
+ }
+
+ iTargetElement->SetAttributeIntL( iAttrId, lCurValue );
+
+ }
+ break;
+
+ case KSvgTypeViewBox:
+ {
+ DoViewBoxAnimProcL(aEvent);
+ break;
+ }
+ }
+ CSvgAnimationBase::CheckForEndTimesAndFreezeL(this);
+ return ETrue;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateElementImpl::BlendPathL( TInt32 aAlpha,
+ CGfxGeneralPath* aFromPath,
+ CGfxGeneralPath* aToPath,
+ CGfxGeneralPath*& aBlendPath )
+ {
+ if ( aFromPath && aToPath )
+ {
+ aBlendPath->SetPointTypeArrayL( aFromPath->PointTypeArray() );
+
+ RArray<TFloatFixPt>* lCurPoints = new ( ELeave ) RArray<TFloatFixPt>( 20 );
+ CleanupStack::PushL( lCurPoints );
+ lCurPoints->AppendL(NULL);
+ lCurPoints->Remove(0);
+
+ RArray<TFloatFixPt>* fromPoints = aFromPath->PointCoordsArrayAll();
+ RArray<TFloatFixPt>* toPoints = aToPath->PointCoordsArrayAll();
+
+ TInt lFromcount = fromPoints->Count();
+ TInt lTocount = toPoints->Count();
+ TInt i = 0;
+ TFloatFixPt lCurPoint;
+
+ while (i < lFromcount && i < lTocount )
+ {
+ lCurPoint = BlendFloat( aAlpha,
+ fromPoints->operator[]( i ),
+ toPoints->operator[]( i ) );
+ lCurPoints->AppendL( lCurPoint );
+ i++;
+ }
+
+ aBlendPath->SetPointCoordsArrayL( lCurPoints );
+
+ lCurPoints->Close();
+ CleanupStack::PopAndDestroy( 1 ); // lCurPoints
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateElementImpl::AddPathsL( CGfxGeneralPath*& aPathResult,
+ CGfxGeneralPath* aPath1 )
+ {
+ RArray<TFloatFixPt>* lCurPoints = new ( ELeave ) RArray<TFloatFixPt>( 20 );
+ CleanupStack::PushL( lCurPoints );
+ lCurPoints->AppendL(NULL);
+ lCurPoints->Remove(0);
+
+ RArray<TFloatFixPt>* points1 = aPath1->PointCoordsArrayAll();
+ RArray<TFloatFixPt>* result = aPathResult->PointCoordsArrayAll();
+ TInt pcount = points1->Count();
+ TInt rcount = result->Count();
+ TInt i = 0;
+ TFloatFixPt lCurPoint;
+
+ while ( i < pcount && i < rcount )
+ {
+ lCurPoint = points1->operator[]( i ) + result->operator[]( i );
+ lCurPoints->AppendL( lCurPoint );
+ i++;
+ }
+
+ aPathResult->SetPointCoordsArrayL( lCurPoints );
+
+ lCurPoints->Close();
+ CleanupStack::PopAndDestroy( 1 ); // lCurPoints
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateElementImpl::CopyPathsL( CGfxGeneralPath*& aPathResult,
+ CGfxGeneralPath* aPath1 )
+ {
+ RArray<TFloatFixPt>* lCurPoints = new ( ELeave ) RArray<TFloatFixPt>( 20 );
+ CleanupStack::PushL( lCurPoints );
+
+ lCurPoints->AppendL(NULL);
+ lCurPoints->Remove(0);
+ RArray<TFloatFixPt>* points1 = aPath1->PointCoordsArrayAll();
+
+ TInt count = points1->Count();
+ TInt i = 0;
+ TFloatFixPt lCurPoint;
+
+ while ( i < count )
+ {
+ lCurPoint = points1->operator[]( i );
+ lCurPoints->AppendL( lCurPoint );
+ i++;
+ }
+
+ aPathResult->SetPointCoordsArrayL( lCurPoints );
+
+ lCurPoints->Close();
+ CleanupStack::PopAndDestroy( 1 ); // lCurPoints
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateElementImpl::ResetAnimationL()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgAnimateElementImpl::SetAttributeIntL( const TInt aNameId, const TInt32 aValue)
+{
+ return CSvgAnimationBase::SetAttributeIntL(aNameId,aValue);
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgAnimateElementImpl::GetAttributeIntL( const TInt aNameId, TInt32& aValue )
+{
+ return CSvgAnimationBase::GetAttributeIntL(aNameId,aValue);
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgAnimateElementImpl::SetAttributeFloatL(const TInt aNameId, TFloatFixPt aValue )
+{
+ return CSvgAnimationBase::SetAttributeFloatL(aNameId,aValue);
+}
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgAnimateElementImpl::GetAttributeFloat(const TInt aNameId, TFloatFixPt& aValue )
+{
+ return CSvgAnimationBase::GetAttributeFloat(aNameId,aValue);
+}
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+void CSvgAnimateElementImpl::ReInitializeAnimation()
+ {
+
+ if ( iAttrId == 0xffff )
+ return;
+
+ CSvgAnimationBase::ReInitializeAnimation();
+
+ if(iCheckFirstAnim)
+ {
+ if(iIsInheritedAttribute)
+ {
+ iTargetElement->PointToParent(iAttrId);
+ }
+ else
+ {
+ TRAPD(error, SetToOriginalL());
+
+ if (error != KErrNone)
+ {
+ // error processing not processed
+ return;
+ }
+ }
+ }
+
+
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateElementImpl::SetOriginalValues_DOMReuse()
+ {
+ // calling base class function.
+ CSvgAnimationBase::SetOriginalValues_DOMReuse();
+
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CGfxGeneralPath* CSvgAnimateElementImpl::GetPathAttribute(TInt aAttributeId)
+ {
+ return CSvgAnimationBase::GetPathAttribute(aAttributeId);
+
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateElementImpl::SetPathAttribute(TInt aAttributeId, CGfxGeneralPath* aPathHandle)
+ {
+
+ CSvgAnimationBase::SetPathAttribute(aAttributeId, aPathHandle);
+
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateElementImpl::Reset(MSvgEvent* aEvent)
+ {
+
+ iIsUserSeek = ETrue;
+
+ // first call the animation base function.
+ TSvgTimerEvent* timerEvent = ( TSvgTimerEvent* ) aEvent;
+
+
+ if((TInt32)timerEvent->Time() < iAbsoluteBeginTime)
+ {
+ // let it come to initial position.
+ ((CSvgDocumentImpl*)iOwnerDocument)->iInitialDrawFlag = ETrue;
+ ReInitializeAnimation();
+ return;
+ }
+ TRAPD(error,CSvgAnimationBase::ResetL( aEvent, this));
+
+ if (error != KErrNone)
+ {
+ // error processing not processed
+ return;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+/////////////////////////////////////////////
+MXmlElement* CSvgAnimateElementImpl::CloneL(MXmlElement*
+aParentElement)
+ {
+ CSvgAnimateElementImpl* newElement = CSvgAnimateElementImpl::NewL( this->ElemID(),
+ ((CSvgDocumentImpl*)iOwnerDocument) );
+ CleanupStack::PushL( newElement );
+ newElement->iParentNode = aParentElement;
+ // copy the data
+ // end copying data from this class.
+ // this will get cloned setting the parent element to aParentElement;
+
+ newElement->iOwnerDocument = this->iOwnerDocument;
+
+ // set the target element this needs to be modified.
+ newElement->iTargetElement = (CSvgElementImpl*)aParentElement;
+ this->CopyL(newElement);
+ CleanupStack::Pop();
+ return newElement;
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateElementImpl::CopyL(CSvgAnimateElementImpl* aDestElement )
+ {
+ if(aDestElement)
+ {
+ // copy from superclass
+ this->CSvgAnimationBase::CopyL(aDestElement);
+ // copy reference to idoc (CSvgDocumentImpl)
+ aDestElement->iOwnerDocument = this->iOwnerDocument;
+ }
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateElementImpl::DeactivateAnimation()
+ {
+ CSvgAnimationBase::DeactivateAnimation(this);
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+// for calculation of interpolated values for viewBox animation.
+void CSvgAnimateElementImpl::DoViewBoxAnimProcL(MSvgTimerEvent* aEvent)
+ {
+
+ TInt32 alpha;
+ TInt32 valix;
+ TInt32 subanimtime;
+ TReal32 vBoxX=0;
+ TReal32 vBoxY=0;
+ TReal32 vBoxW=0;
+ TReal32 vBoxH=0;
+
+ iAnimTime->GetAnimTime( (aEvent->Time()-iNegativeBeginTime), alpha, valix, subanimtime );
+ TGfxRectangle2D v1 = iFromViewBox;
+ TGfxRectangle2D v2 = iToViewBox;
+ TGfxRectangle2D lCurValue;
+ if(iHaveBy && iCurrentRepeatCount > 0 && iAccumulate == KAccumSum )
+ {
+ v1= TGfxRectangle2D( vBoxX, vBoxY, vBoxW, vBoxH );
+ vBoxX = iToViewBox.iX - iFromViewBox.iX;
+ vBoxY = iToViewBox.iY - iFromViewBox.iY;
+ vBoxW = iToViewBox.iWidth - iFromViewBox.iWidth;
+ vBoxH = iToViewBox.iHeight - iFromViewBox.iHeight;
+ v2 = TGfxRectangle2D( vBoxX, vBoxY, vBoxW, vBoxH );
+ }
+
+ if ( iValuesViewBox->Count() > 0 )
+ {
+
+ // check for the range of valix
+ if(valix >= iValuesViewBox->Count() )
+ {
+ valix = iValuesViewBox->Count() - 1;
+ }
+
+ v1 = ( *iValuesViewBox )[valix];
+ if ( valix + 1 >= iValuesViewBox->Count() )
+ {
+ v2 = ( *iValuesViewBox )[valix];
+ }
+ else
+ {
+ v2 = ( *iValuesViewBox )[valix + 1];
+ }
+ alpha = subanimtime;
+ }
+
+ // to get the interpolation of each values of the viewBox
+ vBoxX = BlendFloat( alpha, v1.iX, v2.iX );
+ vBoxY = BlendFloat( alpha, v1.iY, v2.iY );
+ vBoxW = BlendFloat( alpha, v1.iWidth, v2.iWidth );
+ vBoxH = BlendFloat( alpha, v1.iHeight, v2.iHeight );
+
+ lCurValue = TGfxRectangle2D( vBoxX, vBoxY, vBoxW, vBoxH );
+
+ if( iAccumulate == KAccumSum && !iNoFrom)
+ {
+ TFloatFixPt lRepeatCount((TInt) iCurrentRepeatCount) ;
+ if(iValuesViewBox->Count() > 0)
+ {
+ TGfxRectangle2D lVal= ((*iValuesViewBox) [iValuesViewBox->Count() -1]);
+
+ lCurValue.iX += lVal.iX * lRepeatCount;
+ lCurValue.iY += lVal.iY * lRepeatCount;
+ lCurValue.iWidth += lVal.iWidth * lRepeatCount;
+ lCurValue.iHeight += lVal.iHeight * lRepeatCount;
+ }
+ else
+ {
+ lCurValue.iX += v2.iX * lRepeatCount;
+ lCurValue.iY += v2.iY * lRepeatCount;
+ lCurValue.iWidth += v2.iWidth * lRepeatCount;
+ lCurValue.iHeight += v2.iHeight * lRepeatCount;
+ if(iHaveBy && iCurrentRepeatCount > 0)
+ {
+ lCurValue.iX += iFromViewBox.iX ;
+ lCurValue.iY += iFromViewBox.iY ;
+ lCurValue.iWidth += iFromViewBox.iWidth ;
+ lCurValue.iHeight += iFromViewBox.iHeight ;
+ }
+ }
+ }
+
+ if ( ( iFill == KAnimFillFreeze ) )
+ {
+ iEndViewBox = lCurValue;
+ }
+ if ( ( iAdditive == KAdditiveSum ) && !iNoFrom ) //.
+ {
+ TGfxRectangle2D lOrig;
+ if(iTargetElement->ElemID() == KSvgSvgElement)
+ {
+ ((CSvgSvgElementImpl*)iTargetElement)->GetViewBox( lOrig );
+ }
+
+ lCurValue.iX += lOrig.iX ;
+ lCurValue.iY += lOrig.iY ;
+ lCurValue.iWidth += lOrig.iWidth ;
+ lCurValue.iHeight += lOrig.iHeight ;
+ }
+
+ // set the value to the target element.
+ if(iTargetElement->ElemID() == KSvgSvgElement)
+ {
+ ((CSvgSvgElementImpl*)iTargetElement)->SetViewBoxL( lCurValue );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+ TBool CSvgAnimateElementImpl::DoAnimProcL(MSvgEvent* aEvent)
+ {
+ return this->AnimProcL((MSvgTimerEvent*)aEvent);
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateElementImpl::InitAnimationL()
+ {
+
+ if(!iTargetElement)
+ {
+ // if target element is not found then remove it.
+ ((CSvgDocumentImpl*)iOwnerDocument)->RemoveFromEventReceiverList(this);
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->UpdatePresentation(1);
+ return;
+ }
+
+ if (!iHaveValues)
+ {
+ if (!iHaveTo && !iHaveBy)
+ {
+ ((CSvgDocumentImpl*)iOwnerDocument)->RemoveFromEventReceiverList(this );
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->UpdatePresentation(1);
+ }
+ }
+
+ iIsInheritedAttribute = iTargetElement->IsInherited(iAttrId);
+ CSvgAnimationBase::InitAnimationL();
+ SetFillValueL();
+
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateElementImpl::SetToOriginalL()
+ {
+
+ // this is to make sure the inherited style attributes are made point back to the parent.
+ if(iIsInheritedAttribute && iAnimStatus == KAnimFinished)
+ {
+ // only if the animation has finished
+ iTargetElement->PointToParent(iAttrId);
+ }
+ else
+ {
+ CSvgAnimationBase::SetToOriginalL();
+ }
+ }
+
+void CSvgAnimateElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<animate attributeType=\"hmmm\" attributeName=\"hmm\" from=\"%d\" to=\"%d\" dur=\"hmm\" repeatCount=\"hmm\"/>",
+ /*iDataType,*/ (int)iFromFloat, (int)iToFloat/*, iRepeatCount*/);
+ #endif
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGAnimateMotionElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,1308 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include <e32math.h>
+
+#include "SVGAnimateMotionElementImpl.h"
+
+#include "SVGElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+
+#include "GfxGeneralPath.h"
+#include "GfxFlatteningPathIterator.h"
+#include "SVGPathDataParser.h"
+#include "SVGPointLexer.h"
+#include "SVGStringTokenizer.h"
+
+_LIT( AUTO, "auto" );
+_LIT( AUTOREVERSE, "auto-reverse" );
+_LIT( SEMICOLON, ";" );
+
+// *******************************************************
+// Constructor/deconstructor
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgAnimateMotionElementImpl* CSvgAnimateMotionElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgAnimateMotionElementImpl* self = new ( ELeave )
+ CSvgAnimateMotionElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgAnimateMotionElementImpl* CSvgAnimateMotionElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgAnimateMotionElementImpl* self = new ( ELeave )
+ CSvgAnimateMotionElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateMotionElementImpl::ConstructL( const TUint8 aElemID )
+ {
+ CSvgAnimationBase::ConstructL( aElemID );
+
+ iMotionPath = CGfxGeneralPath::NewL();
+ iAnimTime->SetCalMode( KAnimCalcModePaced ); // animateMotion has differenr default
+ iReqAttrFlag=KSVG_AMINATEMO_ELEMFLAG;
+ }
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgAnimateMotionElementImpl::~CSvgAnimateMotionElementImpl()
+ {
+ if ( iMotionPath )
+ {
+ delete iMotionPath;
+ iMotionPath = NULL;
+ }
+ if ( iPathIterator )
+ {
+ delete iPathIterator;
+ iPathIterator = NULL;
+ }
+ }
+
+// *******************************************************
+// Private
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgAnimateMotionElementImpl::CSvgAnimateMotionElementImpl( CSvgDocumentImpl* aDoc ) : CSvgAnimationBase( aDoc ),
+ iCurrentSeg( 0,
+ 0,
+ 0,
+ 0 ),
+ //iIsValues( EFalse ),
+ iPrevRotate(0)
+
+ {
+ iAttrId = KAtrTransform;
+ }
+
+// *******************************************************
+// From SVG DOM
+
+
+// *******************************************************
+// SVG Implementation
+
+
+// *******************************************************
+// From MSvgEventReceiver
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateMotionElementImpl::ResetReferenceElementL()
+ {
+ if(iTargetElement != NULL )
+ {
+ if( ((iTargetElement->iAnimateAttrSet == NULL) ||
+ (iTargetElement->iAnimateAttrSet->Find(iAttrId) == KErrNotFound) ) )
+ {
+ if ( iInitDone )
+ {
+ iCheckFirstAnim= ETrue;
+ SetToOriginalL();
+ if( !(iTargetElement->iAnimateAttrSet) )
+ {
+ iTargetElement->iAnimateAttrSet = new (ELeave) RArray<TUint32>(1);
+ }
+ iTargetElement->iAnimateAttrSet->AppendL((TUint32)iAttrId);
+ }
+ }
+ }
+ }
+// *******************************************************
+// From MXmlElement
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgAnimateMotionElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+ _LIT( KTmpAttrName, "attributeName" );
+ _LIT( KTmpPath, "path" );
+ _LIT( KTmpRotate, "rotate" );
+ _LIT( KTmpFrom, "from" );
+ _LIT( KTmpTo, "to" );
+ _LIT( KTmpValues, "values" );
+ _LIT( KTmpBy, "by" );
+
+
+ if ( aName == KTmpAttrName )
+ {
+ // Ignore 'attributeName' attribute
+ }
+ else if ( aName == KTmpPath )
+ {
+ iMotionPath->Reset();
+ TSvgPathDataParser::ParsePathData( aValue, iMotionPath );
+
+ CGfxPathIterator* itr;
+ TFloatFixPt tmpcoords[6];
+ iMotionPath->GetPathIteratorL( &iIdentTransform, itr );
+ CleanupStack::PushL( itr );
+
+ while ( !itr->IsDone() )
+ {
+ switch ( itr->CurrentSegment( tmpcoords ) )
+ {
+ case EGfxSegMoveTo:
+ iToFloatX = tmpcoords[0];
+ iToFloatY = tmpcoords[1];
+ break;
+ case EGfxSegLineTo:
+ iToFloatX = tmpcoords[0];
+ iToFloatY = tmpcoords[1];
+ break;
+ case EGfxSegQuadTo:
+ iToFloatX = tmpcoords[2];
+ iToFloatY = tmpcoords[3];
+ break;
+ case EGfxSegCubicTo:
+ iToFloatX = tmpcoords[4];
+ iToFloatY = tmpcoords[5];
+ break;
+ case EGfxSegClose:
+ iToFloatX = tmpcoords[0]; //.
+ iToFloatY = tmpcoords[1];
+ }
+
+ itr->NextL();
+ }
+ iPathSeen = ETrue;
+ CleanupStack::PopAndDestroy();
+ if(iReqAttrFlag == KAtrSVGAmo && (iMotionPath->PointTypeArray())->Count() != 0 )
+ {
+ iReqAttrFlag = 0;
+ }
+ }
+ else if ( aName == KTmpRotate )
+ {
+ if ( aValue == AUTO )
+ {
+ iAnimMotionRotate = KAnimMotionRotateAuto;
+ }
+ else if ( aValue == AUTOREVERSE )
+ {
+ iAnimMotionRotate = KAnimMotionRotateAutoReverse;
+ }
+ else
+ {
+ TLex lString ( aValue );
+ if (lString.Val( iAnimMotionRotate )!= KErrNone)
+ {
+ iAnimMotionRotate= 0;
+ }
+ if ( iAnimMotionRotate < 0 )
+ {
+ // Note: A problem may occur if the value is less than -3600
+ iAnimMotionRotate += 3600;
+ }
+ iAnimMotionRotate %= 360;
+ }
+ }
+ else if ( aName == KTmpFrom )
+ {
+ if ( ! iHaveValues )
+ {
+ iNoFrom = EFalse;
+ iMotionPath->Reset();
+ TSvgPointLexer svgplex ( aValue );
+ TChar com;
+ TFloatFixPt x, y;
+
+ svgplex.GetNextPoint( com, x, y );
+ svgplex.Cleanup();
+
+ iOrgFromFloatX = iFromFloatX = x;
+ iOrgFromFloatY = iFromFloatY = y;
+ iMotionPath->MoveToL( x, y, ETrue ); // 'from' -> MoveTo
+ }
+
+ if(iReqAttrFlag == KAtrSVGAmo)
+ {
+ iReqAttrFlag = KAtrToBy;
+ }
+ else
+ {
+ iReqAttrFlag = 0;
+ }
+ }
+ else if ( aName == KTmpBy )
+ {
+ if ( !iHaveTo )
+ {
+ iHaveBy = ETrue;
+ if(iReqAttrFlag == KAtrSVGAmo || iReqAttrFlag == KAtrToBy)
+ {
+ iReqAttrFlag = 0;
+ }
+ if ( !iHaveValues )
+ {
+ TSvgPointLexer svgplex ( aValue );
+ TChar com;
+ TFloatFixPt x, y;
+
+ svgplex.GetNextPoint( com, x, y );
+ svgplex.Cleanup();
+
+ if ( iNoFrom )
+ {
+ iToFloatX = x;
+ iToFloatY = y;
+ iNoFrom = EFalse;
+ // this is taken from animate transforms.
+ iAdditive = KAdditiveSum;
+ iAdditiveOrg = KAdditiveSum;
+ }
+ else
+ {
+ iToFloatX = iFromFloatX + x;
+ iToFloatY = iFromFloatY + y;
+ }
+
+ CGfxPathIterator* itr;
+ iMotionPath->GetPathIteratorL( &iIdentTransform, itr );
+ CleanupStack::PushL( itr );
+
+ if ( itr->IsDone() )
+ {
+ TFloatFixPt lZero;
+ // If the animation path is empty, fill with default value.
+ iMotionPath->MoveToL( lZero, lZero, ETrue );
+ }
+ CleanupStack::PopAndDestroy( 1 ); // itr
+ iMotionPath->LineToL( x, y, ETrue ); // 'by' -> LineTo
+ }
+ }
+
+ if(iReqAttrFlag == KAtrSVGAmo && (iMotionPath->PointTypeArray())->Count() != 0 )
+ {
+ iReqAttrFlag = 0;
+ }
+ }
+ else if ( aName == KTmpTo )
+ {
+ if ( !iHaveValues )
+ {
+
+ // this is taken from animate transforms.
+ if ( iNoFrom )
+ {
+ iAdditive = KAdditiveSum;
+ iAdditiveOrg = KAdditiveSum;
+ }
+ TSvgPointLexer svgplex ( aValue );
+ TChar com;
+ TFloatFixPt x, y;
+ iHaveTo = ETrue;
+ svgplex.GetNextPoint( com, x, y );
+ svgplex.Cleanup();
+
+ iToFloatX = x;
+ iToFloatY = y;
+ CGfxPathIterator* itr;
+ iMotionPath->GetPathIteratorL( &iIdentTransform, itr );
+ CleanupStack::PushL( itr );
+ if ( itr->IsDone() )
+ {
+ TFloatFixPt lZero;
+ // If the animation path is empty, fill with default value.
+ // should this default be zero or object position
+ iMotionPath->MoveToL( lZero, lZero, ETrue );
+ }
+ CleanupStack::PopAndDestroy( 1 ); // itr
+ iMotionPath->LineToL( x, y, ETrue ); // 'to' -> LineTo
+ }
+
+ if(iReqAttrFlag == KAtrSVGAmo || iReqAttrFlag == KAtrToBy)
+ {
+ iReqAttrFlag = 0;
+ }
+ }
+ else if ( aName == KTmpValues )
+ {
+ // Process only if Path values have not been seen
+ if ( !iPathSeen )
+ {
+ TStringTokenizer tkn ( aValue, SEMICOLON );
+ TBool first = ETrue;
+ iHaveValues = ETrue;
+ iNoFrom = EFalse; //.
+ iMotionPath->Reset();
+ while ( tkn.HasMoreTokens() ) // 'values' is a set of coordinates
+ {
+ TSvgPointLexer svgplex ( tkn.NextToken() );
+ TChar com;
+ TFloatFixPt x, y;
+ svgplex.GetNextPoint( com, x, y );
+ svgplex.Cleanup();
+
+ if ( first )
+ {
+ iMotionPath->MoveToL( x, y, ETrue );
+ iOrgFromFloatX = iFromFloatX = x; //.
+ iOrgFromFloatY = iFromFloatY = y;
+ first = EFalse;
+ }
+ else
+ {
+ iMotionPath->LineToL( x, y, ETrue );
+ }
+ iToFloatX = x; //.
+ iToFloatY = y;
+ }
+
+ if(iReqAttrFlag == KAtrSVGAmo || iReqAttrFlag == KAtrToBy)
+ {
+ iReqAttrFlag = 0;
+ }
+ }
+ }
+ else
+ {
+ return CSvgAnimationBase::SetAttributeL( aName, aValue );
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// From MSvgEventReceiver
+// ---------------------------------------------------------------------------
+TBool CSvgAnimateMotionElementImpl::ReceiveEventL( MSvgEvent* aEvent )
+ {
+ return CSvgAnimationBase::ReceiveEventProcL( aEvent, this );
+ }
+
+// ---------------------------------------------------------------------------
+// From CSvgAnimationBase
+// ---------------------------------------------------------------------------
+//
+TBool CSvgAnimateMotionElementImpl::AnimProcL( MSvgTimerEvent* aEvent )
+
+ {
+
+
+ if((iAnimStatus != KAnimActive) || iDoFreeze)
+ {
+ if(iFill== KAnimFillFreeze && !iDoFreeze && iAnimStatus == KAnimFinished)
+ {
+ // calculate the freeze value.
+ }
+ else
+ {
+ CSvgAnimationBase::CheckForEndTimesAndFreezeL(this);
+ return EFalse;
+ }
+ }
+ if ( ( iPathIterator == NULL ) || ( iPathIterator->IsDone() ) )
+ {
+ return EFalse; // Already end of path. Nothing to do any more.
+ }
+
+ TFloatFixPt nextPos, diff;
+ TFloatFixPt zero ( 0 );
+
+ // Get next position in [0..255] range
+ TInt32 animatetime; // Not used...
+ TInt32 valix, subanimtime;
+ iAnimTime->GetAnimTime( (aEvent->Time()-iNegativeBeginTime), animatetime, valix, subanimtime );
+
+ // Get next position in actual length
+ TFloatFixPt v2;
+ if ( valix >= iValuesFloat->Count() - 1 )
+ {
+ valix= iValuesFloat->Count() - 1;
+ v2 = ( *iValuesFloat )[valix];
+ }
+ else
+ {
+ v2 = ( *iValuesFloat )[valix + 1];
+ }
+ nextPos = CSvgAnimationBase::BlendFloat( subanimtime,
+ ( *iValuesFloat )[valix],
+ v2 );
+
+ diff = nextPos - iCurrentPos;
+ TGfxSegType SegType;
+
+ while ( iSubPos + diff > iSubLength && !iPathIterator->IsDone() )
+ {
+ if ( iSubLength < zero )
+ {
+ iSubLength = zero;
+ }
+ TFloatFixPt tmpcoords[6];
+ diff -= iSubLength - iSubPos;
+ iPathIterator->NextL();
+ SegType = iPathIterator->CurrentSegment( tmpcoords );
+ iCurrentSeg.iX1 = iCurrentSeg.iX2;
+ iCurrentSeg.iY1 = iCurrentSeg.iY2;
+ iCurrentSeg.iX2 = tmpcoords[0];
+ iCurrentSeg.iY2 = tmpcoords[1];
+
+ if ( SegType == EGfxSegMoveTo )
+ {
+ iSubLength = zero;
+ }
+ else
+ {
+ iSubLength = iCurrentSeg.Length();
+ }
+
+ iSubPos = zero;
+ }
+ iSubPos += diff;
+
+ // Calcualate or set rotation
+ TReal32 rot = 0.0f;
+ if ( iAnimMotionRotate < 0 )
+ {
+ TFloatFixPt dx = iCurrentSeg.iX1 - iCurrentSeg.iX2;
+ if ( dx == zero )
+ {
+
+ if( iAnimMotionRotate == KAnimMotionRotateAuto )
+ {
+ if(iPrevRotate == 0 || iPrevRotate >= 3.1415926f)
+ rot = 3.1415926f + 1.5707963f;
+ else
+ rot = 1.5707963f; // pi/2
+ }
+ else // AutoReverse
+ {
+ if(iPrevRotate >= 0 )
+ rot = 1.5707963f;
+ else
+ rot = -1.5707963f;
+
+ }
+ }
+ else
+ {
+ TReal atan;
+ Math::ATan( atan, ( TReal32 )( iCurrentSeg.iY1 - iCurrentSeg.iY2 ), ( TReal32 )dx );
+ rot = ( TReal32 ) atan;
+ if ( iAnimMotionRotate == KAnimMotionRotateAuto )
+ {
+ rot += 3.1415926f;
+ }
+
+ }
+ iPrevRotate = rot;
+ }
+ else
+ {
+ rot = iAnimMotionRotate * 3.1415926f / 180.0f;
+ }
+
+ // Create transform
+ MSvgTransformList* trList;
+ TInt32 matrixIndex;
+ iTargetElement->GetTransform( trList );
+ iTargetElement->GetAttributeIntL( KAtrAnimMotionMatrixIndex, matrixIndex );
+ // new position
+ TInt32 subalpha;
+ if ( iSubLength == zero )
+ {
+ subalpha = 0;
+ }
+ else
+ {
+ subalpha = ( TInt32 ) ( iSubPos / iSubLength * TFloatFixPt( 255 ) ); // need to make sure value does not exceed 0x7fff
+ }
+ if ( subalpha > 0xff )
+ {
+ subalpha = 0xff;
+ }
+ if ( subalpha < 0 )
+ {
+ subalpha = 0;
+ }
+
+ TFloatFixPt trnsx, trnsy;
+ trnsx = CSvgAnimationBase::BlendFloat( subalpha,
+ iCurrentSeg.iX1,
+ iCurrentSeg.iX2 );
+ trnsy = CSvgAnimationBase::BlendFloat( subalpha,
+ iCurrentSeg.iY1,
+ iCurrentSeg.iY2 );
+
+ TGfxAffineTransform deltaTr = TGfxAffineTransform::GetTranslateInstance( trnsx,
+ trnsy );
+ if ( rot != 0.0f )
+ {
+ deltaTr.Rotate( rot );
+ }
+
+ // Set transform
+
+ if ( iAccumulate == KAccumSum ) //.
+ {
+ TGfxAffineTransform accumulateDeltaTr = TGfxAffineTransform::GetTranslateInstance( iFromFloatX - iOrgFromFloatX, iFromFloatY - iOrgFromFloatY);
+ deltaTr.Concatenate( accumulateDeltaTr );
+ }
+
+ if ( iAdditive == KAdditiveSum ) //.
+ {
+ TGfxAffineTransform curMatrix = trList->GetItem( matrixIndex );
+ curMatrix.Concatenate( deltaTr );
+ trList->ReplaceItem( curMatrix, matrixIndex );
+ }
+ else
+ {
+ trList->ReplaceItem( deltaTr, matrixIndex );
+
+ }
+ if(iFill== KAnimFillFreeze)
+ {
+ iEndMatrix = deltaTr;
+ }
+ // update current position
+ iCurrentPos = nextPos;
+
+ CSvgAnimationBase::CheckForEndTimesAndFreezeL(this);
+ return ETrue;
+ }
+
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateMotionElementImpl::ResetAnimationL()
+ {
+ TFloatFixPt tmpcoords[6];
+
+ // Path iterator
+ if ( iPathIterator )
+ {
+ delete iPathIterator;
+ iPathIterator = NULL;
+ }
+
+ iPathIterator = CGfxFlatteningPathIterator::NewL( iMotionPath,
+ &iIdentTransform,
+ 3 );
+
+
+ // path length
+ iPathIterator->CurrentSegment( tmpcoords );
+ iCurrentSeg.iX1 = tmpcoords[0];
+ iCurrentSeg.iY1 = tmpcoords[1];
+ iCurrentSeg.iX2 = tmpcoords[0];
+ iCurrentSeg.iY2 = tmpcoords[1];
+
+ iSubLength = -1;
+ iCurrentPos = 0;
+ iSubPos = 0;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateMotionElementImpl::InitAnimationL()
+ {
+ if(!iTargetElement)
+ {
+ // if target element is not found then remove it.
+ ((CSvgDocumentImpl*)iOwnerDocument)->RemoveFromEventReceiverList(this);
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->UpdatePresentation(1);
+ return;
+ }
+
+ TFloatFixPt len;
+ TFloatFixPt lx, ly;
+ TFloatFixPt dx, dy, int0x7f( KMAXFLOATFIX );
+ // Create values of distance from start point on motion path
+ TFloatFixPt tmpcoords[6];
+ {
+ CGfxGeneralPath* path = CGfxGeneralPath::NewLC();
+ CGfxPathIterator* itr;
+ iMotionPath->GetPathIteratorL( &iIdentTransform, itr );
+
+ CleanupStack::PushL( itr );
+ TFloatFixPt length;
+ iValuesFloat->Reset();
+ while ( !itr->IsDone() )
+ {
+ switch ( itr->CurrentSegment( tmpcoords ) )
+ {
+ case EGfxSegMoveTo:
+ path->MoveToL( tmpcoords[0], tmpcoords[1], ETrue );
+ lx = tmpcoords[0];
+ ly = tmpcoords[1];
+ len = TSvgPathDataParser::PathLengthL( path );
+ break;
+ case EGfxSegLineTo:
+ path->LineToL( tmpcoords[0], tmpcoords[1], ETrue );
+ dx = lx - tmpcoords[0];
+ dy = ly - tmpcoords[1];
+ if ( dx > int0x7f || dy > int0x7f )
+ {
+ // calculate as integer
+ TInt32 tmplen, tx, ty;
+ tx = ( TInt32 ) dx;
+ ty = ( TInt32 ) dy;
+ #ifdef SVG_FLOAT_BUILD
+ tmplen = TFloatFixPt::Sqrt(tx * tx + ty * ty);
+ #else
+ tmplen = TFloatFixPt::FixedSqrtGeneral( tx * tx + ty * ty, 0 );
+ #endif
+ len += TFloatFixPt( tmplen );
+ }
+ else
+ {
+ // calculate as TFixPt
+
+ len += TFloatFixPt::Sqrt( dx * dx + dy * dy );
+ }
+ lx = tmpcoords[0];
+ ly = tmpcoords[1];
+
+ break;
+ case EGfxSegQuadTo:
+ path->QuadToL( tmpcoords[0],
+ tmpcoords[1],
+ tmpcoords[2],
+ tmpcoords[3],
+ ETrue );
+ len = TSvgPathDataParser::PathLengthL( path );
+ break;
+ case EGfxSegCubicTo:
+ path->CubicToL( tmpcoords[0],
+ tmpcoords[1],
+ tmpcoords[2],
+ tmpcoords[3],
+ tmpcoords[4],
+ tmpcoords[5],
+ ETrue );
+ len = TSvgPathDataParser::PathLengthL( path );
+ break;
+ case EGfxSegClose:
+ path->LineToL( tmpcoords[0], tmpcoords[1], ETrue );
+ len = TSvgPathDataParser::PathLengthL( path );
+ break;
+ }
+
+ length = len;
+ //length = TSvgPathDataParser::PathLengthL( path );
+ iValuesFloat->AppendL( length );
+ itr->NextL();
+ }
+ CleanupStack::PopAndDestroy( 2 ); // path, itr
+ }
+
+ CSvgAnimationBase::InitAnimationL();
+ if(!iKeyTimesPresent)
+ iAnimTime->CreateKeyTime( iMotionPath->PointTypeArray()->Count() );
+ iAnimTime->PrepareTimeL( iValuesFloat );
+ SetFillValueL();
+ this->ResetAnimationL();
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateMotionElementImpl::SetFillValueL()
+ {
+ iPrevRotate = 0;
+ MSvgTransformList* trList = NULL;
+ if ( iTargetElement )
+ {
+ ((CSvgElementImpl*)iTargetElement)->GetTransform( trList );
+ TInt32 matrixIndex = -1;
+ iTargetElement->GetAttributeIntL( KAtrAnimMotionMatrixIndex, matrixIndex );
+ ((CSvgElementImpl*)iTargetElement)->GetTransform( trList );
+ if ( trList && matrixIndex != -1 )
+ {
+ iFillMatrix = trList->GetItem(matrixIndex);
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateMotionElementImpl::SetToOriginalL()
+ {
+ MSvgTransformList* trList;
+ TInt32 matrixIndex;
+ if (iTargetElement == NULL)
+ {
+ return;
+ }
+ iTargetElement->GetAttributeIntL( KAtrAnimMotionMatrixIndex, matrixIndex );
+ ( ( CSvgElementImpl * ) iTargetElement )->GetTransform( trList );
+
+
+ trList->ReplaceItem( iFillMatrix, matrixIndex );
+
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateMotionElementImpl::SetToInitialValueL()
+ {
+ MSvgTransformList* trList;
+ TInt32 matrixIndex;
+ iTargetElement->GetAttributeIntL( KAtrAnimMotionMatrixIndex, matrixIndex );
+ ( ( CSvgElementImpl * ) iTargetElement )->GetTransform( trList );
+
+ if( iAdditive == KAdditiveSum)
+ {
+ TGfxAffineTransform curMatrix = trList->GetItem( matrixIndex );
+ curMatrix.Concatenate(iFillMatrix);
+ trList->ReplaceItem( curMatrix, matrixIndex );
+ }
+ else
+ {
+ trList->ReplaceItem( iFillMatrix, matrixIndex );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateMotionElementImpl::SetToEndValueL()
+ {
+ MSvgTransformList* trList;
+ TInt32 matrixIndex;
+ iTargetElement->GetAttributeIntL( KAtrAnimMotionMatrixIndex, matrixIndex );
+ ( ( CSvgElementImpl * ) iTargetElement )->GetTransform( trList );
+
+ if( iAdditive == KAdditiveSum)
+ {
+ TGfxAffineTransform curMatrix = trList->GetItem( matrixIndex );
+ curMatrix.Concatenate(iEndMatrix);
+ trList->ReplaceItem( curMatrix, matrixIndex );
+ }
+ else
+ {
+ trList->ReplaceItem( iEndMatrix, matrixIndex );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateMotionElementImpl::SetAccumulateValues()
+ {
+ TFloatFixPt lDelta;
+ if(iHaveBy)
+ {
+
+ lDelta = iToFloatX - iFromFloatX;
+ iToFloatX = iToFloatX + lDelta;
+ iFromFloatX = iFromFloatX + lDelta;
+
+ lDelta = iToFloatY - iFromFloatY;
+ iToFloatY = iToFloatY + lDelta;
+ iFromFloatY = iFromFloatY + lDelta;
+
+ }
+ else
+ {
+ lDelta = iToFloatX - iFromFloatX;
+ iFromFloatX = iToFloatX + iOrgFromFloatX;
+ iToFloatX = iFromFloatX + lDelta;
+
+ lDelta = iToFloatY - iFromFloatY;
+ iFromFloatY = iToFloatY + iOrgFromFloatY;
+ iToFloatY = iFromFloatY + lDelta;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// From MXmlElementOpt
+// ---------------------------------------------------------------------------
+TInt CSvgAnimateMotionElementImpl::GetAttributePath( const TInt /* aNameId */,
+ CGfxGeneralPath*& /* aValue */ )
+ {
+ return KErrNoAttribute;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgAnimateMotionElementImpl::SetAttributePathL( const TInt aNameId,
+ CGfxGeneralPath* aValue )
+ {
+ if ( aNameId == KAtrData )
+ {
+ iMotionPath->Reset();
+ CGfxPathIterator* lIter = NULL;
+ aValue->GetPathIteratorL( &iIdentTransform, lIter );
+ CleanupStack::PushL( lIter );
+ iMotionPath->AppendL( lIter );
+ CleanupStack::PopAndDestroy( 1 ); //lIter
+ }
+
+ return KErrNone;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Functions used by Decoder
+// ---------------------------------------------------------------------------
+TInt CSvgAnimateMotionElementImpl::SetAttributePathRef( const TInt aNameId,
+ CGfxGeneralPath*& aValue )
+ {
+ iIsMotionPath= EFalse;
+ if ( aNameId == KAtrAnimateMotion )
+ {
+ if(iMotionPath)
+ {
+ delete iMotionPath;
+ iMotionPath= NULL;
+ }
+ iMotionPath= aValue;
+
+ if((iMotionPath->PointTypeArray())->Count() != 0 )
+ {
+ CGfxPathIterator* itr = NULL;
+ TFloatFixPt tmpcoords[6];
+ TRAPD( error,iMotionPath->GetPathIteratorL( &iIdentTransform, itr ) );
+ if (error!= KErrNone)
+ {
+ return error;
+ }
+
+
+
+ while ( !itr->IsDone() )
+ {
+ switch ( itr->CurrentSegment( tmpcoords ) )
+ {
+ case EGfxSegMoveTo:
+ iToFloatX = tmpcoords[0];
+ iToFloatY = tmpcoords[1];
+ break;
+ case EGfxSegLineTo:
+ iToFloatX = tmpcoords[0];
+ iToFloatY = tmpcoords[1];
+ break;
+ case EGfxSegQuadTo:
+ iToFloatX = tmpcoords[2];
+ iToFloatY = tmpcoords[3];
+ break;
+ case EGfxSegCubicTo:
+ iToFloatX = tmpcoords[4];
+ iToFloatY = tmpcoords[5];
+ break;
+ case EGfxSegClose:
+ iToFloatX = tmpcoords[0];
+ iToFloatY = tmpcoords[1];
+ }
+
+ TRAPD( error, itr->NextL() );
+ if ( error != KErrNone )
+ {
+ delete itr;
+ return KErrNone;
+ }
+ }
+
+ delete itr;
+ itr= NULL;
+
+
+ RArray<TFloatFixPt>* lArrayFix;
+ lArrayFix= iMotionPath->PointCoordsArrayAll();
+ if (lArrayFix)
+ {
+ iOrgFromFloatX = iFromFloatX = lArrayFix->operator[](0);
+ iOrgFromFloatY = iFromFloatY = lArrayFix->operator[](1);
+ }
+
+ }
+ }
+
+ else
+ {
+ return KErrNoAttribute;
+ }
+
+ return KErrNone;
+ }
+// ---------------------------------------------------------------------------
+// Functions used by Decoder
+// ---------------------------------------------------------------------------
+void CSvgAnimateMotionElementImpl::SetAnimRotate(TInt16 aRotate)
+ {
+ iAnimMotionRotate= aRotate;
+ }
+// ---------------------------------------------------------------------------
+// Functions used by Decoder
+// ---------------------------------------------------------------------------
+TInt CSvgAnimateMotionElementImpl::SetAttributeIntL( const TInt aNameId, const TInt32 aValue)
+{
+ if(aNameId == KAtrRotate)
+ {
+ iAnimMotionRotate = (TInt16)aValue;
+ return KErrNone;
+ }
+ return CSvgAnimationBase::SetAttributeIntL(aNameId,aValue);
+}
+// ---------------------------------------------------------------------------
+// Functions used by Decoder
+// ---------------------------------------------------------------------------
+TInt CSvgAnimateMotionElementImpl::GetAttributeIntL( const TInt aNameId, TInt32& aValue )
+{
+ if(aNameId == KAtrRotate)
+ {
+ aValue = (TInt)(iAnimMotionRotate);
+ return KErrNone;
+ }
+ return CSvgAnimationBase::GetAttributeIntL(aNameId,aValue);
+}
+// ---------------------------------------------------------------------------
+// Functions used by Decoder
+// ---------------------------------------------------------------------------
+TInt CSvgAnimateMotionElementImpl::SetAttributeFloatL(const TInt aNameId, TFloatFixPt aValue )
+{
+ return CSvgAnimationBase::SetAttributeFloatL(aNameId,aValue);
+}
+// ---------------------------------------------------------------------------
+// Functions used by Decoder
+// ---------------------------------------------------------------------------
+TInt CSvgAnimateMotionElementImpl::GetAttributeFloat(const TInt aNameId, TFloatFixPt& aValue )
+{
+ return CSvgAnimationBase::GetAttributeFloat(aNameId,aValue);
+}
+// ---------------------------------------------------------------------------
+// Functions used by Decoder
+// ---------------------------------------------------------------------------
+void CSvgAnimateMotionElementImpl::ReInitializeAnimation()
+ {
+
+ if ( iAttrId == 0xffff )
+ return;
+
+ if( iCurrentRepeatCount > 0 && iAccumulate == KAccumSum )
+ {
+ iFromFloatX= iOrgFromFloatX;
+ iFromFloatY= iOrgFromFloatY;
+ iToFloatX= iOrgToFloatX;
+ iToFloatY= iOrgToFloatY;
+ }
+
+ CSvgAnimationBase::ReInitializeAnimation();
+
+ iCurrentSeg.iX1 = (TFloatFixPt) 0;
+ iCurrentSeg.iX2 = (TFloatFixPt) 0;
+ iCurrentSeg.iY1 = (TFloatFixPt) 0;
+ iCurrentSeg.iY2 = (TFloatFixPt) 0;
+ MSvgTransformList* trList;
+ TInt32 matrixIndex = 0;
+
+ if (iTargetElement)
+ {
+ TRAPD(error ,iTargetElement->GetAttributeIntL( KAtrAnimMotionMatrixIndex, matrixIndex ));
+ if ( error != KErrNone )
+ {
+ // ignore trap error
+ }
+ ( ( CSvgElementImpl * ) iTargetElement )->GetTransform( trList );
+ if( trList && (trList->NumberOfItems() > matrixIndex) )
+ {
+ trList->ReplaceItem( TGfxAffineTransform(), matrixIndex );
+
+ trList->SetAdditive( iAdditive, matrixIndex );
+ }
+ }
+ iFillMatrix= TGfxAffineTransform();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateMotionElementImpl::SetOriginalValues_DOMReuse()
+ {
+ iOrgToFloatX= iToFloatX;
+ iOrgToFloatY= iToFloatY;
+ // calling base class function.
+ CSvgAnimationBase::SetOriginalValues_DOMReuse();
+ }
+// ---------------------------------------------------------------------------
+// Functions used by Decoder
+// ---------------------------------------------------------------------------
+CGfxGeneralPath* CSvgAnimateMotionElementImpl::GetPathAttribute(TInt aAttributeId)
+ {
+ if(aAttributeId == KAtrPath)
+ {
+ return iMotionPath;
+ }
+ else
+ {
+ return CSvgAnimationBase::GetPathAttribute(aAttributeId);
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateMotionElementImpl::SetPathAttribute(TInt aAttributeId, CGfxGeneralPath* aPathHandle)
+{
+
+ if(aAttributeId == KAtrPath)
+ {
+ if(iMotionPath == aPathHandle)
+ {
+ return;
+ }
+ delete iMotionPath;
+ iMotionPath = aPathHandle;
+
+ CGfxPathIterator* itr = NULL;
+ TFloatFixPt tmpcoords[6];
+ TRAPD(error ,iMotionPath->GetPathIteratorL( &iIdentTransform, itr ));
+ if ( error != KErrNone )
+ {
+ // ignore trap error
+ }
+
+ if(itr)
+ {
+ while ( !itr->IsDone() )
+ {
+ switch ( itr->CurrentSegment( tmpcoords ) )
+ {
+ case EGfxSegMoveTo:
+ iToFloatX = tmpcoords[0];
+ iToFloatY = tmpcoords[1];
+ break;
+ case EGfxSegLineTo:
+ iToFloatX = tmpcoords[0];
+ iToFloatY = tmpcoords[1];
+ break;
+ case EGfxSegQuadTo:
+ iToFloatX = tmpcoords[2];
+ iToFloatY = tmpcoords[3];
+ break;
+ case EGfxSegCubicTo:
+ iToFloatX = tmpcoords[4];
+ iToFloatY = tmpcoords[5];
+ break;
+ case EGfxSegClose:
+ iToFloatX = tmpcoords[0]; //.
+ iToFloatY = tmpcoords[1];
+ }
+ TRAPD( error, itr->NextL() );
+ if ( error != KErrNone )
+ {
+ delete itr;
+ return;
+ }
+ }
+
+ delete itr;
+ }
+
+ RArray<TFloatFixPt>* lArrayFix;
+ lArrayFix= iMotionPath->PointCoordsArrayAll();
+ if (lArrayFix)
+ {
+ iOrgFromFloatX = iFromFloatX = lArrayFix->operator[](0);
+ iOrgFromFloatY = iFromFloatY = lArrayFix->operator[](1);
+ }
+
+ }
+ else
+ {
+ CSvgAnimationBase::SetPathAttribute(aAttributeId, aPathHandle);
+ }
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateMotionElementImpl::Reset(MSvgEvent* aEvent)
+{
+ iIsUserSeek = ETrue;
+ // first call the animation base function.
+ TSvgTimerEvent* timerEvent = ( TSvgTimerEvent* ) aEvent;
+ if((TInt32)timerEvent->Time() < iAbsoluteBeginTime)
+ {
+ // let it come to initial position.
+ ((CSvgDocumentImpl*)iOwnerDocument)->iInitialDrawFlag = ETrue;
+ ReInitializeAnimation();
+ return;
+ }
+ TRAPD(error,CSvgAnimationBase::ResetL( aEvent, this));
+
+ if (error != KErrNone)
+ {
+ // error processing not processed
+ return;
+ }
+}
+
+
+/////////////////////////////////////////////
+MXmlElement* CSvgAnimateMotionElementImpl::CloneL(MXmlElement*
+aParentElement)
+ {
+ CSvgAnimateMotionElementImpl* newElement = CSvgAnimateMotionElementImpl::NewL( this->ElemID(),
+ ((CSvgDocumentImpl*)iOwnerDocument) );
+ CleanupStack::PushL( newElement );
+ newElement->iParentNode = aParentElement;
+ // copy the data
+ // end copying data from this class.
+ // this will get cloned setting the parent element to aParentElement;
+ newElement->iOwnerDocument = this->iOwnerDocument;
+ // set the target element this needs to be modified.
+ newElement->iTargetElement = (CSvgElementImpl*)aParentElement;
+ this->CopyL(newElement);
+ CleanupStack::Pop();
+ return newElement;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateMotionElementImpl::CopyL(CSvgAnimateMotionElementImpl* aDestElement )
+ {
+ if(aDestElement)
+ {
+
+
+ // copy stuff from superclass
+ this->CSvgAnimationBase::CopyL(aDestElement);
+
+ // copy the reference to idoc (CSvgDocumentImpl)
+ aDestElement->iOwnerDocument = this->iOwnerDocument;
+
+ /*Need to check Test whether Copying is proper*/
+
+ aDestElement->iFillMatrix = this->iFillMatrix;
+ if(this->iMotionPath)
+ {
+ /*Motion Path and iPathIterator assignment needs to be checked.*/
+ aDestElement->iMotionPath->Reset();
+ aDestElement->iMotionPath->SetPointCoordsArrayL(this->iMotionPath->PointCoordsArrayAll());
+ aDestElement->iMotionPath->SetPointTypeArrayL(this->iMotionPath->PointTypeArray());
+ }
+ aDestElement->iIdentTransform = this->iIdentTransform;
+ aDestElement->iSubLength = this->iSubLength;
+ aDestElement->iCurrentPos = this->iCurrentPos;
+ aDestElement->iSubPos = this->iSubPos;
+ aDestElement->iCurrentSeg = this->iCurrentSeg;
+ aDestElement->iAnimMotionRotate = this->iAnimMotionRotate;
+ aDestElement->iEndMatrix = this->iEndMatrix;
+ //aDestElement->iIsValues = this->iIsValues;
+ aDestElement->iToFloatX = this->iToFloatX;
+ aDestElement->iToFloatY = this->iToFloatY;
+ aDestElement->iFromFloatX = this->iFromFloatX;
+ aDestElement->iFromFloatY = this->iFromFloatY;
+ aDestElement->iOrgFromFloatX = this->iOrgFromFloatX;
+ aDestElement->iOrgFromFloatY = this->iOrgFromFloatY;
+ // for DOM Reuse
+ aDestElement->iOrgToFloatX = this->iOrgToFloatX;
+ aDestElement->iOrgToFloatY = this->iOrgToFloatY;
+ aDestElement->iIsMotionPath = this->iIsMotionPath;
+
+ if(this->iPathIterator)
+ {
+ aDestElement->ResetAnimationL();
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateMotionElementImpl::DeactivateAnimation()
+{
+CSvgAnimationBase::DeactivateAnimation(this);
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgAnimateMotionElementImpl::DoAnimProcL(MSvgEvent* aEvent)
+{
+return this->AnimProcL((MSvgTimerEvent*)aEvent);
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateMotionElementImpl::SetAccumulateValuesForSetMediaTime()
+{
+if(iAccumulate == KAccumSum )
+ {
+ iFromFloatX= iOrgFromFloatX;
+ iFromFloatY= iOrgFromFloatY;
+ iToFloatX= iOrgToFloatX;
+ iToFloatY= iOrgToFloatY;
+
+ TInt i=0;
+ while(i < iCurrentRepeatCount )
+ {
+ SetAccumulateValues();
+ i++;
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateMotionElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<animateMotion calcMode=\"hmm\" xlink:href=\"hmm\" path=\"hmm\" keyPoints=\"hmm\" rotate=\"%d\"/>",
+ /*Href(),*/ (int)iAnimMotionRotate);
+ #endif
+ }
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGAnimateTransformElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,1175 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+
+#include "SVGAnimateTransformElementImpl.h"
+
+#include "SVGElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+
+#include "SVGPointLexer.h"
+#include "SVGStringTokenizer.h"
+
+#include "GfxAffineTransform.h"
+
+_LIT( SEMICOLON, ";" );
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgAnimateTransformElementImpl* CSvgAnimateTransformElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgAnimateTransformElementImpl*self = new ( ELeave )
+ CSvgAnimateTransformElementImpl( aDoc );
+
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgAnimateTransformElementImpl* CSvgAnimateTransformElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgAnimateTransformElementImpl*self = new ( ELeave )
+ CSvgAnimateTransformElementImpl( aDoc );
+
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateTransformElementImpl::ConstructL( const TUint8 aElemID)
+ {
+ CSvgAnimationBase::ConstructL( aElemID );
+
+ // Initial length of values is 2 (from and to)
+ iTransformValues = new ( ELeave ) RArray<TMatrixData>( 2 );
+ TMatrixData mtrx;
+ iTransformValues->AppendL( mtrx );
+ iTransformValues->AppendL( mtrx );
+
+ iOrgTransformValues = new ( ELeave ) RArray<TMatrixData>( 2 );
+
+ iOrgTransformValues->AppendL( mtrx );
+ iOrgTransformValues->AppendL( mtrx );
+
+
+ iAccumMatrixData.iData[0] = 0;
+ iAccumMatrixData.iData[1] = 0;
+ iAccumMatrixData.iData[2] = 0;
+
+ iReqAttrFlag=KSVG_ANIMATETRANSFORM_ELEMFLAG;
+
+
+
+ }
+
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgAnimateTransformElementImpl::~CSvgAnimateTransformElementImpl()
+ {
+ if ( iTransformValues )
+ {
+ iTransformValues->Close();
+ delete iTransformValues;
+ iTransformValues = NULL;
+ }
+ if ( iOrgTransformValues )
+ {
+ iOrgTransformValues->Close();
+ delete iOrgTransformValues;
+ iOrgTransformValues = NULL;
+
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Private
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgAnimateTransformElementImpl::CSvgAnimateTransformElementImpl( CSvgDocumentImpl* aDoc ) : CSvgAnimationBase( aDoc ),
+
+ iMatrixDataSize( 2 ),
+ iMultipleRendering (EFalse)
+ {
+ iDataType = KSvgTypeTranslate;
+ }
+
+// ---------------------------------------------------------------------------
+// From MSvgEventReceiver
+// ---------------------------------------------------------------------------
+void CSvgAnimateTransformElementImpl::ResetReferenceElementL()
+ {
+ if(iTargetElement != NULL )
+ {
+ if( ((iTargetElement->iAnimateAttrSet == NULL) || (iTargetElement->iAnimateAttrSet->Find(iAttrId) == KErrNotFound) ) )
+ {
+ if ( iInitDone )
+ {
+ iCheckFirstAnim= ETrue;
+ SetToOriginalL();
+ if( !(iTargetElement->iAnimateAttrSet) )
+ {
+ iTargetElement->iAnimateAttrSet = new (ELeave) RArray<TUint32>(1);
+ }
+ iTargetElement->iAnimateAttrSet->AppendL((TUint32)iAttrId);
+ }
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// From MXmlElement
+// ---------------------------------------------------------------------------
+TInt CSvgAnimateTransformElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+ _LIT( KTmpAttrName, "attributeName" );
+ _LIT( KTmpTransform, "transform" );
+ _LIT( KTmpFrom, "from" );
+ _LIT( KTmpTo, "to" );
+ _LIT( KTmpBy, "by" );
+ _LIT( KTmpType, "type" );
+ _LIT( KTmpScale, "scale" );
+ _LIT( KTmpRotate, "rotate" );
+ _LIT( KTmpSkewX, "skewX" );
+ _LIT( KTmpSkewY, "skewY" );
+ _LIT( KTmpValues, "values" );
+ _LIT( KTmpGradientTransform, "gradientTransform");
+
+ if ( !iTargetSet )
+ {
+ iTargetElement = ( CSvgElementImpl * ) ParentNode();// default is parent element
+ iTargetSet = ETrue;
+ }
+ TUint16 lElementId = 0;
+ if (iTargetElement)
+ lElementId = iTargetElement->ElemID();
+ if ( aName == KTmpAttrName )
+ {
+
+ if(iReqAttrFlag == KAtrSVGTrf)
+ {
+ iReqAttrFlag = KAtrType;
+ }
+ else
+ {
+ iReqAttrFlag = 0;
+ }
+ if( aValue == KTmpTransform &&
+ !(lElementId == KSvgRadialGradientElement || lElementId
+ == KSvgLinearGradientElement)
+ )
+ {
+ iAttrId = KAtrAnimateTransformAttrId;
+ return KErrNone;
+ }
+ else if (aValue == KTmpGradientTransform &&
+ (lElementId == KSvgRadialGradientElement || lElementId
+ == KSvgLinearGradientElement))
+ {
+ iAttrId = KAtrAnimateTransformAttrId;
+ return KErrNone;
+ }
+ else if(aValue == KTmpGradientTransform) // Specifically for Xlink:href case
+ {
+ iAttrId = KAtrGradientTransform;
+ return KErrNone;
+ }
+ else
+ {
+ // value must be not be 'transform'
+ iAttrId = 0xffff;
+ return KErrNone;
+ }
+ }
+ else if ( aName == KTmpType )
+ {
+
+ if(iReqAttrFlag == KAtrSVGTrf)
+ {
+ iReqAttrFlag = KAtrAttributeName;
+ }
+ else
+ {
+ iReqAttrFlag = 0;
+ }
+
+ // Use iDataType to keep transformation type
+ if ( aValue == KTmpScale )
+ {
+ iDataType = KSvgTypeScale;
+ iMatrixDataSize = 2;
+ }
+ else if ( aValue == KTmpRotate )
+ {
+ iDataType = KSvgTypeRotate;
+ iMatrixDataSize = 3;
+ }
+ else if ( aValue == KTmpSkewX )
+ {
+ iDataType = KSvgTypeSkewX;
+ iMatrixDataSize = 1;
+ }
+ else if ( aValue == KTmpSkewY )
+ {
+ iDataType = KSvgTypeSkewY;
+ iMatrixDataSize = 1;
+ }
+ else
+ {
+ iDataType = KSvgTypeTranslate; // default transformation
+ iMatrixDataSize = 2;
+ }
+ return KErrNone;
+ }
+ else if ( aName == KTmpFrom )
+ {
+ iNoFrom = EFalse;
+ // Processing for semi-colon separated data is needed
+ DesToMatrixData( aValue, ( *iTransformValues )[0] );
+ return KErrNone;
+ }
+ else if ( aName == KTmpTo )
+ {
+ iHaveTo = ETrue;
+
+ if ( iNoFrom )
+ {
+ iAdditive = KAdditiveSum;
+ iAdditiveOrg = KAdditiveSum;
+ }
+
+ // Processing for semi-colon separated data is needed
+ DesToMatrixData( aValue, ( *iTransformValues )[1] );
+ iAccumMatrixData.iData[0] = (*iTransformValues)[1].iData[0];
+ iAccumMatrixData.iData[1] = (*iTransformValues)[1].iData[1];
+ iAccumMatrixData.iData[2] = (*iTransformValues)[1].iData[2];
+ return KErrNone;
+ }
+ else if ( aName == KTmpBy )
+ {
+ if ( !iHaveTo )
+ {
+ TInt32 i;
+ DesToMatrixData( aValue, ( *iTransformValues )[1] );
+ iHaveBy = ETrue;
+
+ if(iNoFrom)
+ {
+ iAdditive = KAdditiveSum;
+ iAdditiveOrg = KAdditiveSum;
+ }
+ for ( i = 0; i < 3; i++ )
+ {
+ ( *iTransformValues )[1].iData[i] = ( *iTransformValues )[1].iData[i] +
+ ( *iTransformValues )[0].iData[i];
+ }
+
+ }
+ return KErrNone;
+ }
+ else if ( aName == KTmpValues )
+ {
+ TStringTokenizer tkn ( aValue, SEMICOLON );
+ iTransformValues->Reset();
+
+ iHaveValues = ETrue;
+
+ iNoFrom = EFalse;
+
+ while ( tkn.HasMoreTokens() )
+ {
+ TMatrixData mtrx;
+ DesToMatrixData( tkn.NextToken(), mtrx );
+ iTransformValues->AppendL( mtrx );
+ }
+ TInt lTransformValuesCount = iTransformValues->Count();
+ if(lTransformValuesCount > 0)
+ {
+ iAccumMatrixData.iData[0] = (*iTransformValues)[lTransformValuesCount - 1].iData[0];
+ iAccumMatrixData.iData[1] = (*iTransformValues)[lTransformValuesCount - 1].iData[1];
+ iAccumMatrixData.iData[2] = (*iTransformValues)[lTransformValuesCount - 1].iData[2];
+ }
+
+ return KErrNone;
+ }
+
+ return CSvgAnimationBase::SetAttributeL( aName, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// From MSvgEventReceiver
+// ---------------------------------------------------------------------------
+TBool CSvgAnimateTransformElementImpl::ReceiveEventL( MSvgEvent* aEvent )
+ {
+ return CSvgAnimationBase::ReceiveEventProcL( aEvent, this );
+ }
+
+// ---------------------------------------------------------------------------
+// From CSvgAnimationBase
+// ---------------------------------------------------------------------------
+
+TBool CSvgAnimateTransformElementImpl::AnimProcL( MSvgTimerEvent* aEvent )
+
+ {
+
+
+ if((iAnimStatus != KAnimActive) || iDoFreeze)
+ {
+ if(iFill== KAnimFillFreeze && !iDoFreeze && iAnimStatus == KAnimFinished)
+ {
+
+ }
+ else
+ {
+ CSvgAnimationBase::CheckForEndTimesAndFreezeL(this );
+ return EFalse;
+ }
+ }
+ // No animation if 'from' or 'to' is not available
+ if ( iTransformValues->Count() < 2 )
+ {
+ return EFalse;
+ }
+
+ // Calc alpha from time [0-255]
+ TInt32 alpha;
+ TInt32 valix1, valix2, subanimtime;
+ TMatrixData mdata;
+
+ iAnimTime->GetAnimTime((aEvent->Time()-iNegativeBeginTime), alpha, valix1, subanimtime );
+
+ // check for the range of valix
+ if ( valix1 >= iTransformValues->Count() )
+ {
+ valix1 = iTransformValues->Count() - 1;
+ }
+
+
+ if ( iNoFrom && !iHaveBy ) //. This is to emulate Adobe.
+ {
+ if ( alpha > ( KTimeMax >> 1 ) )
+ {
+ subanimtime = KTimeMax;
+ }
+ else
+ {
+ subanimtime = 0;
+ return ETrue;
+ }
+ }
+
+ if ( valix1 >= iTransformValues->Count() - 1 )
+ {
+ valix2 = valix1;
+ }
+
+ else
+ {
+ valix2 = valix1 + 1;
+ }
+
+ mdata.iData[0] = BlendFloat( subanimtime,
+ ( *iTransformValues )[valix1].iData[0],
+ ( *iTransformValues )[valix2].iData[0] );
+ mdata.iData[1] = BlendFloat( subanimtime,
+ ( *iTransformValues )[valix1].iData[1],
+ ( *iTransformValues )[valix2].iData[1] );
+ mdata.iData[2] = BlendFloat( subanimtime,
+ ( *iTransformValues )[valix1].iData[2],
+ ( *iTransformValues )[valix2].iData[2] );
+ // Additive
+ /*
+ * !!!! Additive="replace" is not supported
+ * !!!! Additional implementation needed in MSvgTransformList
+ */
+
+ // Set value
+ TGfxAffineTransform deltaTr;
+ switch ( iDataType )
+ {
+ case KSvgTypeTranslate:
+ deltaTr = TGfxAffineTransform::GetTranslateInstance( mdata.iData[0],
+ mdata.iData[1] );
+ break;
+ case KSvgTypeScale:
+ deltaTr = TGfxAffineTransform::GetScaleInstance( mdata.iData[0],
+ mdata.iData[1] );
+ break;
+ case KSvgTypeRotate:
+ deltaTr = TGfxAffineTransform::GetRotateInstance( ( TReal32 )
+ mdata.iData[0] * 3.1415926f /
+ 180.0f,
+ mdata.iData[1],
+ mdata.iData[2] );
+ break;
+ case KSvgTypeSkewX:
+ deltaTr = TGfxAffineTransform::GetShearInstance( ( TReal32 )
+ mdata.iData[0]* 3.1415926f /
+ 180.0f,
+ 0.0f );
+ break;
+ case KSvgTypeSkewY:
+ deltaTr = TGfxAffineTransform::GetShearInstance( 0.0f,
+ ( TReal32 )
+ mdata.iData[0]* 3.1415926f /
+ 180.0f );
+ break;
+ }
+ MSvgTransformList* trList;
+ ( ( CSvgElementImpl * ) iTargetElement )->GetTransform( trList );
+ TInt32 matrixIndex;
+ ( ( CSvgElementImpl * ) iTargetElement )->GetAttributeIntL( KAtrAnimTransformMatrixIndex, matrixIndex );
+ if ( iAdditive == KAdditiveSum ) //.
+ {
+ if(iNoFrom && subanimtime == KTimeMax && !iHaveBy)
+ {
+ iTargetElement->SetOverwriteTransforms( ETrue );
+ }
+ /*else
+ {
+ //if additive = sum and there is a from or a by then dont overwrite the transform
+ iTargetElement->iOverwriteTransforms = EFalse;
+ }*/
+ if(iHaveTo && iNoFrom)
+ {
+ iTargetElement->SetOverwriteTransforms(ETrue);
+ trList->ReplaceItem(deltaTr, matrixIndex);
+ }
+ else
+ {
+ TGfxAffineTransform curMatrix = trList->GetItem( matrixIndex );
+ curMatrix.Concatenate( deltaTr );
+ trList->ReplaceItem( curMatrix, matrixIndex );
+ }
+
+ }
+ else
+ {
+ iTargetElement->SetOverwriteTransforms( ETrue );
+ trList->ReplaceItem( deltaTr, matrixIndex );
+
+ }
+ if(iFill == KAnimFillFreeze)
+ {
+ iEndMatrix = deltaTr;
+ }
+ CSvgAnimationBase::CheckForEndTimesAndFreezeL(this );
+ return ETrue;
+ }
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateTransformElementImpl::SetFillValueL()
+ {
+ MSvgTransformList* trList;
+ ( ( CSvgElementImpl * ) iTargetElement )->GetTransform( trList );
+ TInt32 matrixIndex;
+ iTargetElement->GetAttributeIntL( KAtrAnimTransformMatrixIndex, matrixIndex );
+ iFillMatrix = trList->GetItem(matrixIndex);
+ }
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateTransformElementImpl::SetToOriginalL()
+ {
+ MSvgTransformList* trList;
+ TInt32 matrixIndex;
+ iTargetElement->GetAttributeIntL( KAtrAnimTransformMatrixIndex, matrixIndex );
+ ( ( CSvgElementImpl * ) iTargetElement )->GetTransform( trList );
+
+ trList->ReplaceItem( iFillMatrix /*TGfxAffineTransform()*/,
+ matrixIndex );
+ iTargetElement->SetOverwriteTransforms( EFalse );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateTransformElementImpl::SetToInitialValueL()
+ {
+ MSvgTransformList* trList;
+ ( ( CSvgElementImpl * ) iTargetElement )->GetTransform( trList );
+ TInt32 matrixIndex;
+ iTargetElement->GetAttributeIntL( KAtrAnimTransformMatrixIndex, matrixIndex );
+
+ if( iAdditive == KAdditiveSum)
+ {
+
+ TGfxAffineTransform curMatrix = trList->GetItem( matrixIndex );
+ curMatrix.Concatenate(iFillMatrix);
+ trList->ReplaceItem( curMatrix, matrixIndex );
+ }
+ else
+ {
+ // iTargetElement->iOverwriteTransforms = ETrue;
+ trList->ReplaceItem( iFillMatrix, matrixIndex );
+ }
+
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateTransformElementImpl::SetToEndValueL()
+ {
+ MSvgTransformList* trList;
+ ( ( CSvgElementImpl * ) iTargetElement )->GetTransform( trList );
+ TInt32 matrixIndex;
+ iTargetElement->GetAttributeIntL( KAtrAnimTransformMatrixIndex, matrixIndex );
+
+ if( iAdditive == KAdditiveSum)
+ {
+ if(iNoFrom && !iHaveBy)
+ {
+ iTargetElement->SetOverwriteTransforms( ETrue );
+ }
+ if(iHaveTo && iNoFrom)
+ {
+ iTargetElement->SetOverwriteTransforms(ETrue);
+ trList->ReplaceItem(iEndMatrix, matrixIndex);
+ }
+ else
+ {
+ TGfxAffineTransform curMatrix = trList->GetItem( matrixIndex );
+ curMatrix.Concatenate(iEndMatrix);
+ trList->ReplaceItem( curMatrix, matrixIndex );
+ }
+ }
+ else
+ {
+ iTargetElement->SetOverwriteTransforms( ETrue );
+ trList->ReplaceItem( iEndMatrix, matrixIndex );
+ }
+
+ }
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateTransformElementImpl::InitAnimationL()
+ {
+
+ if(!iTargetElement)
+ {
+ // if target element is not found then remove it.
+ ((CSvgDocumentImpl*)iOwnerDocument)->RemoveFromEventReceiverList(this);
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->UpdatePresentation(1);
+ return;
+ }
+
+ if (!iHaveValues)
+ {
+ if (!iHaveTo && !iHaveBy)
+ {
+ ((CSvgDocumentImpl*)iOwnerDocument)->RemoveFromEventReceiverList(this );
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->UpdatePresentation(1);
+ }
+ }
+
+
+ CSvgAnimationBase::InitAnimationL();
+
+ if(iMultipleRendering)
+ {
+ return;
+ }
+
+ // Set keytime
+ iValuesFloat->Reset();
+ TInt count = iTransformValues->Count();
+ for ( TInt i = 0; i < count; i++ )
+ {
+ iValuesFloat->AppendL( TFloatFixPt( i ) ); // create dummy scalar array
+ }
+ if(!iKeyTimesPresent)
+ iAnimTime->CreateKeyTime( iValuesFloat->Count() );
+ iAnimTime->PrepareTimeL( iValuesFloat );
+ SetFillValueL();
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateTransformElementImpl::SetAccumulateValues()
+ {
+
+ if ( !iNoFrom)
+ {
+
+ if ( iHaveBy )
+ {
+ TMatrixData delta;
+
+ //0
+ delta.iData[0] = ( *iTransformValues )[1].iData[0] -
+ ( *iTransformValues )[0].iData[0];
+
+ ( *iTransformValues )[0].iData[0] = ( *iTransformValues )[1].iData[0];
+
+ ( *iTransformValues )[1].iData[0] += delta.iData[0];
+
+ //1
+ delta.iData[1] = ( *iTransformValues )[1].iData[1] -
+ ( *iTransformValues )[0].iData[1];
+
+ ( *iTransformValues )[0].iData[1] = ( *iTransformValues )[1].iData[1];
+
+ ( *iTransformValues )[1].iData[1] += delta.iData[1];
+
+ //2
+ delta.iData[2] = ( *iTransformValues )[1].iData[2] -
+ ( *iTransformValues )[0].iData[2];
+
+ ( *iTransformValues )[0].iData[2] = ( *iTransformValues )[1].iData[2];
+
+ ( *iTransformValues )[1].iData[2] += delta.iData[2];
+
+ }
+ else
+ {
+ TInt lTransformValuesCount = (*iTransformValues).Count();
+ for(int i=0;i<lTransformValuesCount;i++)
+ {
+ (*iTransformValues)[i].iData[0] += iAccumMatrixData.iData[0];
+ (*iTransformValues)[i].iData[1] += iAccumMatrixData.iData[1];
+ (*iTransformValues)[i].iData[2] += iAccumMatrixData.iData[2];
+ }
+ }
+ }
+ else
+ {
+ if ( iHaveBy )
+ {
+ TMatrixData delta;
+
+ //0
+ delta.iData[0] = ( *iTransformValues )[1].iData[0] -
+ ( *iTransformValues )[0].iData[0];
+
+ ( *iTransformValues )[0].iData[0] = ( *iTransformValues )[1].iData[0];
+
+ ( *iTransformValues )[1].iData[0] += delta.iData[0];
+
+ //1
+ delta.iData[1] = ( *iTransformValues )[1].iData[1] -
+ ( *iTransformValues )[0].iData[1];
+
+ ( *iTransformValues )[0].iData[1] = ( *iTransformValues )[1].iData[1];
+
+ ( *iTransformValues )[1].iData[1] += delta.iData[1];
+
+ //2
+ delta.iData[2] = ( *iTransformValues )[1].iData[2] -
+ ( *iTransformValues )[0].iData[2];
+
+ ( *iTransformValues )[0].iData[2] = ( *iTransformValues )[1].iData[2];
+
+ ( *iTransformValues )[1].iData[2] += delta.iData[2];
+
+ }
+
+ }
+
+ }
+
+
+// *******************************************************
+// AnimateTransformElementImpl specific methods
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateTransformElementImpl::DesToMatrixData( const TDesC& aDes,
+ TMatrixData& aMatrixData )
+ {
+ TSvgPointLexer svgplex ( aDes );
+ TInt i = 0;
+
+ while ( !svgplex.IsDone() && i < 3 )
+ {
+ TChar com;
+ TFloatFixPt data;
+ TInt32 rslt = svgplex.GetNext( com, data );
+ if ( rslt != KErrNone )
+ break;
+ aMatrixData.iData[i] = data;
+ i++;
+ }
+ svgplex.Cleanup();
+
+ // Support shortened data expression
+ if ( i < iMatrixDataSize )
+ {
+ TFloatFixPt zero ( 0 );
+ switch ( iDataType )
+ {
+ case KSvgTypeTranslate:
+ aMatrixData.iData[1] = zero;
+ break;
+ case KSvgTypeScale:
+ aMatrixData.iData[1] = aMatrixData.iData[0];
+ break;
+ case KSvgTypeRotate:
+
+ if ( (i + 1) < iMatrixDataSize )
+ {
+ aMatrixData.iData[1] = zero;
+ }
+
+ aMatrixData.iData[2] = zero;
+ break;
+ }
+ }
+ if( i > iMatrixDataSize)
+ {
+ // reset back everything. this is invalid value.
+ TFloatFixPt zero ( 0 );
+ aMatrixData.iData[0] = zero;
+ aMatrixData.iData[1] = zero;
+ aMatrixData.iData[2] = zero;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateTransformElementImpl::ResetAnimationL()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// Functions used by Decoder
+// ---------------------------------------------------------------------------
+
+void CSvgAnimateTransformElementImpl::SetMatrixDataSize(TUint8 aValue)
+ {
+ iMatrixDataSize= aValue;
+ }
+// ---------------------------------------------------------------------------
+// Functions used by Decoder
+// ---------------------------------------------------------------------------
+TBool CSvgAnimateTransformElementImpl::SetMatrixData( TInt aIndex, TMatrixData& aMatrix)
+ {
+ if ( iTransformValues && aIndex < iTransformValues->Count() )
+ {
+ for (TInt i=0; i<3; i++)
+ {
+ (iTransformValues->operator[](aIndex)).iData[i]= aMatrix.iData[i];
+ }
+ return ETrue;
+ }
+ else
+ {
+ return EFalse;
+ }
+ }
+// ---------------------------------------------------------------------------
+// Functions used by Decoder
+// ---------------------------------------------------------------------------
+void CSvgAnimateTransformElementImpl::SetTransformValues(RArray<TMatrixData>*& aValues)
+ {
+ if (iTransformValues)
+ {
+ iTransformValues->Close();
+ delete iTransformValues;
+ iTransformValues= NULL;
+ }
+ iTransformValues= aValues;
+ }
+// ---------------------------------------------------------------------------
+// Functions used by Decoder
+// ---------------------------------------------------------------------------
+TInt CSvgAnimateTransformElementImpl::SetAttributeIntL( const TInt aNameId,const TInt32 aValue )
+ {
+ if(aNameId == KAtrType)
+ {
+ if ( aValue == KSvgTypeScale )
+ {
+ iDataType = KSvgTypeScale;
+ iMatrixDataSize = 2;
+ }
+ else if ( aValue == KSvgTypeRotate )
+ {
+ iDataType = KSvgTypeRotate;
+ iMatrixDataSize = 3;
+ }
+ else if ( aValue == KSvgTypeSkewX )
+ {
+ iDataType = KSvgTypeSkewX;
+ iMatrixDataSize = 1;
+ }
+ else if ( aValue == KSvgTypeSkewY )
+ {
+ iDataType = KSvgTypeSkewY;
+ iMatrixDataSize = 1;
+ }
+ else
+ {
+ iDataType = KSvgTypeTranslate; // default transformation
+ iMatrixDataSize = 2;
+ }
+ return KErrNone;
+ }
+ return CSvgAnimationBase::SetAttributeIntL(aNameId,aValue);
+ }
+// ---------------------------------------------------------------------------
+// Functions used by Decoder
+// ---------------------------------------------------------------------------
+TInt CSvgAnimateTransformElementImpl::GetAttributeIntL( const TInt aNameId, TInt32& aValue )
+ {
+ if(aNameId == KAtrType)
+ {
+ aValue = iDataType;
+ return KErrNone;
+ }
+ return CSvgAnimationBase::GetAttributeIntL(aNameId,aValue);
+ }
+// ---------------------------------------------------------------------------
+// Functions used by Decoder
+// ---------------------------------------------------------------------------
+TInt CSvgAnimateTransformElementImpl::GetAttributeFloat(const TInt aNameId,TFloatFixPt& aValue )
+{
+ return CSvgAnimationBase::GetAttributeFloat(aNameId,aValue);
+}
+// ---------------------------------------------------------------------------
+// Functions used by Decoder
+// ---------------------------------------------------------------------------
+TInt CSvgAnimateTransformElementImpl::SetAttributeFloatL(const TInt aNameId,TFloatFixPt aValue )
+{
+ return CSvgAnimationBase::SetAttributeFloatL(aNameId,aValue);
+}
+// ---------------------------------------------------------------------------
+// Functions used by Decoder
+// ---------------------------------------------------------------------------
+// this function is for binary discrepancies
+void CSvgAnimateTransformElementImpl::SetAccumMatrix()
+{
+ if(iHaveTo)
+ {
+ iAccumMatrixData.iData[0] = (*iTransformValues)[1].iData[0];
+ iAccumMatrixData.iData[1] = (*iTransformValues)[1].iData[1];
+ iAccumMatrixData.iData[2] = (*iTransformValues)[1].iData[2];
+ }
+ else
+ {
+ if(!iNoFrom)
+ {
+ TInt lTransformValuesCount = iTransformValues->Count();
+ if(lTransformValuesCount > 0)
+ {
+ iAccumMatrixData.iData[0] = (*iTransformValues)[lTransformValuesCount - 1].iData[0];
+ iAccumMatrixData.iData[1] = (*iTransformValues)[lTransformValuesCount - 1].iData[1];
+ iAccumMatrixData.iData[2] = (*iTransformValues)[lTransformValuesCount - 1].iData[2];
+ }
+ }
+ }
+}
+// ---------------------------------------------------------------------------
+// Functions used by Decoder
+// ---------------------------------------------------------------------------
+void CSvgAnimateTransformElementImpl::ReInitializeAnimation()
+ {
+
+ if ( iAttrId == 0xffff )
+ return;
+
+ // Do not set Multiple Rendering flag if animation is not
+ // initialised. This allows the Key Times array in the anim
+ // time controller to be set correctly so that the
+ // interpolation happens correctly.
+ if ( iInitDone )
+ {
+ iMultipleRendering= ETrue;
+ }
+
+ if( iCurrentRepeatCount > 0 && iAccumulate == KAccumSum )
+ {
+ SetTransValues_DOMReuse();
+ }
+
+
+ CSvgAnimationBase::ReInitializeAnimation();
+
+ if(iTargetElement)
+ {
+ TInt32 matrixIndex = -1;
+ MSvgTransformList* trList;
+ ( ( CSvgElementImpl * ) iTargetElement )->GetTransform( trList );
+
+ TGfxAffineTransform affineTransform;
+ TRAPD(error,iTargetElement->GetAttributeIntL( KAtrAnimTransformMatrixIndex, matrixIndex ));
+ if(error == KErrNone)
+ {
+ ( ( CSvgElementImpl * ) iTargetElement )->GetTransform( trList );
+ if( trList && (trList->NumberOfItems() > matrixIndex) )
+ {
+ trList->ReplaceItem(affineTransform,matrixIndex);
+ }
+ }
+
+ }
+
+ iFillMatrix= TGfxAffineTransform();
+
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateTransformElementImpl::SetTransValues_DOMReuse()
+ {
+ if(iOrgTransformValues && iTransformValues)
+ {
+ iTransformValues->Reset();
+
+ TInt orgTransformValCnt = iOrgTransformValues->Count();
+ for(TInt i=0; i<orgTransformValCnt; i++)
+ {
+ TMatrixData lMatrix;
+ lMatrix.iData[0] = (*iOrgTransformValues)[i].iData[0];
+ lMatrix.iData[1] = (*iOrgTransformValues)[i].iData[1];
+ lMatrix.iData[2] = (*iOrgTransformValues)[i].iData[2];
+
+ iTransformValues->Append((TMatrixData) lMatrix);
+ }
+ }
+ }
+// ---------------------------------------------------------------------------
+// Functions used by Decoder
+// ---------------------------------------------------------------------------
+void CSvgAnimateTransformElementImpl::SetOriginalValues_DOMReuse()
+ {
+
+ if( iAccumulate == KAccumSum )
+ {
+ if(iTransformValues && iOrgTransformValues)
+ {
+ iOrgTransformValues->Reset();
+
+ TInt transformValCnt = iTransformValues->Count();
+ for(TInt i=0; i<transformValCnt; i++)
+ {
+ TMatrixData lMatrix;
+ lMatrix.iData[0] = (*iTransformValues)[i].iData[0];
+ lMatrix.iData[1] = (*iTransformValues)[i].iData[1];
+ lMatrix.iData[2] = (*iTransformValues)[i].iData[2];
+
+ iOrgTransformValues->Append((TMatrixData) lMatrix);
+ }
+ }
+ }
+
+ // calling base class function.
+ CSvgAnimationBase::SetOriginalValues_DOMReuse();
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CGfxGeneralPath* CSvgAnimateTransformElementImpl::GetPathAttribute(TInt aAttributeId)
+ {
+ return CSvgAnimationBase::GetPathAttribute(aAttributeId);
+
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateTransformElementImpl::SetPathAttribute(TInt aAttributeId, CGfxGeneralPath* aPathHandle)
+{
+
+ CSvgAnimationBase::SetPathAttribute(aAttributeId, aPathHandle);
+
+}
+// ---------------------------------------------------------------------------
+// Set the values in the dom .
+// ---------------------------------------------------------------------------
+void CSvgAnimateTransformElementImpl::Reset(MSvgEvent* aEvent)
+{
+
+ iIsUserSeek = ETrue;
+ // first call the animation base function.
+ TSvgTimerEvent* timerEvent = ( TSvgTimerEvent* ) aEvent;
+
+ if((TInt32)timerEvent->Time() < iAbsoluteBeginTime)
+ {
+ // let it come to initial position.
+ ((CSvgDocumentImpl*)iOwnerDocument)->iInitialDrawFlag = ETrue;
+ ReInitializeAnimation();
+ return;
+ }
+
+ TRAPD(error,CSvgAnimationBase::ResetL( aEvent, this));
+
+ if (error != KErrNone)
+ {
+ // error processing not processed
+ return;
+ }
+
+
+}
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+/////////////////////////////////////////////
+MXmlElement* CSvgAnimateTransformElementImpl::CloneL(MXmlElement*
+aParentElement)
+ {
+
+ CSvgAnimateTransformElementImpl* newElement = CSvgAnimateTransformElementImpl::NewL( this->ElemID(),((CSvgDocumentImpl*)iOwnerDocument) );
+ CleanupStack::PushL( newElement );
+ newElement->iParentNode = aParentElement;
+ // copy the data
+ // end copying data from this class.
+ // this will get cloned setting the parent element to aParentElement;
+
+ newElement->iOwnerDocument = this->iOwnerDocument;
+
+ // set the target element this needs to be modified.
+ newElement->iTargetElement = (CSvgElementImpl*)aParentElement;
+ this->CopyL(newElement);
+ CleanupStack::Pop();
+ return newElement;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateTransformElementImpl::CopyL(CSvgAnimateTransformElementImpl* aDestElement )
+ {
+ // copy stuff from superclass
+ if(aDestElement)
+ {
+
+
+ this->CSvgAnimationBase::CopyL(aDestElement);
+ // copy the reference to idoc (CSvgDocumentImpl)
+ aDestElement->iOwnerDocument = this->iOwnerDocument;
+
+ aDestElement->iMultipleRendering = this->iMultipleRendering;
+ aDestElement->iMatrixDataSize = this->iMatrixDataSize;
+ aDestElement->iFillMatrix = this->iFillMatrix;
+ aDestElement->iEndMatrix = this->iEndMatrix;
+ TMatrixData lTemp;
+
+ TInt count = this->iTransformValues->Count() ;
+ aDestElement->iTransformValues->Reset();
+ for(TInt i=0; i<count; i++)
+ {
+ aDestElement->iTransformValues->AppendL(lTemp);
+ aDestElement->iTransformValues->operator[](i).iData[0] =
+this->iTransformValues->operator[](i).iData[0];
+ aDestElement->iTransformValues->operator[](i).iData[1] =
+this->iTransformValues->operator[](i).iData[1];
+ aDestElement->iTransformValues->operator[](i).iData[2] =
+this->iTransformValues->operator[](i).iData[2];
+ }
+ TInt count2 = this->iOrgTransformValues->Count();
+ aDestElement->iOrgTransformValues->Reset();
+ for(TInt i=0; i<count2; i++)
+ {
+ aDestElement->iOrgTransformValues->AppendL(lTemp);
+ aDestElement->iOrgTransformValues->operator[](i).iData[0] =
+this->iOrgTransformValues->operator[](i).iData[0];
+ aDestElement->iOrgTransformValues->operator[](i).iData[1] =
+this->iOrgTransformValues->operator[](i).iData[1];
+ aDestElement->iOrgTransformValues->operator[](i).iData[2] =
+this->iOrgTransformValues->operator[](i).iData[2];
+ }
+ aDestElement->iAccumMatrixData.iData[0] = this->iAccumMatrixData.iData[0];
+ aDestElement->iAccumMatrixData.iData[1] = this->iAccumMatrixData.iData[1];
+ aDestElement->iAccumMatrixData.iData[2] = this->iAccumMatrixData.iData[2];
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateTransformElementImpl::DeactivateAnimation()
+{
+CSvgAnimationBase::DeactivateAnimation(this);
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgAnimateTransformElementImpl::DoAnimProcL(MSvgEvent* aEvent)
+{
+return this->AnimProcL((MSvgTimerEvent*)aEvent);
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimateTransformElementImpl::SetAccumulateValuesForSetMediaTime()
+{
+if(iAccumulate == KAccumSum )
+ {
+
+ SetTransValues_DOMReuse();
+
+ SetAccumMatrix();
+ TInt i=0;
+ while(i < iCurrentRepeatCount )
+ {
+ // take care of the accum = sum.
+ SetAccumulateValues();
+ i++;
+ }
+ }
+}
+
+void CSvgAnimateTransformElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<animateTransform attributeName=\"hmm\" attributeType=\"hmm\" type=\"%d\" from=\"%d\" to=\"%d\" dur=\"hmm\" additive=\"hmm\" />",
+ /*iDataType,*/ (int)iFromFloat, (int)iToFloat /*,iAccumulate*/);
+ #endif
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGAnimationBase.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,5371 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include "SVGAnimationBase.h"
+#include "SVGElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGStringTokenizer.h"
+#include "SVGPointLexer.h"
+#include "SVGPathDataParser.h"
+#include "SVGAnimTimingParser.h"
+#include "SVGPaintCssValueImpl.h"
+#include "SVGIntCssValueImpl.h"
+
+//CONSTANTS
+_LIT(KSEMICOLON, ";");
+
+// ---------------------------------------------------------------------------
+// No NewL or NewLC because this is abstract class
+// ---------------------------------------------------------------------------
+void CSvgAnimationBase::ConstructL( const TUint8 aElemID )
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+
+ iAnimTime = CSvgAnimTimeController::NewL();
+ iValuesFloat = new ( ELeave ) RArray<TFloatFixPt>( 1 );
+ iValuesInt = new ( ELeave ) RArray<TInt32>( 1 );
+ iValuesPath = new ( ELeave ) RPointerArray<CGfxGeneralPath>( 1 );
+ // viewBox
+ iValuesViewBox = new ( ELeave ) RArray<TGfxRectangle2D>( 1 );
+ iEventList = new ( ELeave )CArrayFixFlat<TEventListItem>( 1 );
+ iEndTimeList = new ( ELeave )CArrayFixFlat<TEventListItem>( 1 );
+ /*Added to Support forward referencing*/
+ iSvgUriReferenceImpl = CSvgUriReferenceImpl::NewL();
+ ((CSvgDocumentImpl*)iOwnerDocument)->AddToEventReceiverListL(
+ this, KSvgEventMaskTimer );
+ }
+
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+CSvgAnimationBase::CSvgAnimationBase( CSvgDocumentImpl* aDoc ) :
+ iAnimStatus( KAnimNotActive ),
+ iTargetElement( NULL ),
+ iEndOffset( 0 ),
+ iRepeatCount( 1 ),
+ iRepeatEndValue ( 0 ) ,
+ iAbsoluteBeginTime ( 0 ),
+ iBeginTimeIndex( 0 ) ,
+ // iEndAccessKeyCode( 0 ),
+ iCurrentRepeatCount( 0 ),
+ iAttrId( 0xffff ),
+ iInitDone( EFalse ),
+ iTargetSet( EFalse ),
+ iNoFrom( ETrue ),
+ iHaveTo( EFalse ),
+ iHaveBy( EFalse ),
+ iHaveValues (EFalse),
+ iFill( KAnimFillRemove ),
+ iHadBegun( EFalse ),
+ iAnimRestart( KRestartAlways ),
+ iAccumulate( KAccumNone ),
+ iAdditive( KAdditivePass ),
+ iAdditiveOrg( KAdditiveReplace ),
+ iOverrideTime ( EFalse ),
+ iRepeatCountSet ( EFalse ),
+ iKeyTimesPresent(EFalse),
+ // iEndReferenceElemeId(NULL),
+ iIsUserSeek(EFalse),
+ iEndTimeIndex(0)
+
+
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgAnimationBase::~CSvgAnimationBase()
+ {
+ if ( iAnimTime )
+ {
+ delete iAnimTime;
+ iAnimTime = NULL;
+ }
+
+
+ if (iRepeatId)
+ {
+ delete iRepeatId;
+ iRepeatId = NULL;
+ }
+
+ if ( iValuesInt )
+ {
+ iValuesInt->Close();
+ delete iValuesInt;
+ iValuesInt = NULL;
+ }
+
+ if ( iValuesViewBox )
+ {
+ iValuesViewBox->Close();
+ delete iValuesViewBox;
+ iValuesViewBox = NULL;
+ }
+
+ if ( iValuesFloat )
+ {
+ iValuesFloat->Close();
+ delete iValuesFloat;
+ iValuesFloat = NULL;
+ }
+
+ if ( iOrgPath )
+ {
+ delete iOrgPath;
+ iOrgPath = NULL;
+ }
+
+ if ( iEndPath )
+ {
+ delete iEndPath;
+ iEndPath = NULL;
+ }
+
+ if ( iOrgFromPath )
+ {
+ delete iOrgFromPath;
+ iOrgFromPath = NULL;
+ }
+
+ if ( iFromPath )
+ {
+ delete iFromPath;
+ iFromPath = NULL;
+ }
+
+ if ( iToPath )
+ {
+ delete iToPath;
+ iToPath = NULL;
+ }
+
+ if ( iValuesPath )
+ {
+ iValuesPath->ResetAndDestroy();
+ iValuesPath->Close();
+ delete iValuesPath;
+ iValuesPath = NULL;
+ }
+
+ if ( iSvgUriReferenceImpl )
+ {
+ delete iSvgUriReferenceImpl;
+ iSvgUriReferenceImpl = NULL;
+ }
+
+
+ if ( iEventList )
+ {
+ TInt lCount = iEventList->Count();
+ for(TInt i= 0; i< lCount; i++)
+ {
+ if(iEventList->operator[](i).iReferenceElemeId)
+ {
+ delete iEventList->operator[](i).iReferenceElemeId;
+ iEventList->operator[](i).iReferenceElemeId = NULL;
+ }
+ }
+ delete iEventList;
+ iEventList = NULL;
+ }
+
+ if ( iEndTimeList )
+ {
+ TInt lCount2 = iEndTimeList->Count();
+ for(TInt i= 0; i< lCount2; i++)
+ {
+ if(iEndTimeList->operator[](i).iReferenceElemeId)
+ {
+ delete iEndTimeList->operator[](i).iReferenceElemeId;
+ iEndTimeList->operator[](i).iReferenceElemeId = NULL;
+ }
+ }
+
+ delete iEndTimeList;
+ iEndTimeList = NULL;
+ }
+
+ //remove this from the animation list
+ CSvgDocumentImpl* lOwnerDocument = (CSvgDocumentImpl*)iOwnerDocument;
+ if (lOwnerDocument)
+ {
+ TInt index = lOwnerDocument->iSvgAnimations.Find(this);
+
+ if (index != KErrNotFound)
+ {
+ lOwnerDocument->iSvgAnimations.Remove( index );
+ }
+ }
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TUint32 CSvgAnimationBase::SimpleDuration()
+ {
+ TUint32 lEndTime= KTimeIndefinite;
+ TUint32 lDur= KTimeIndefinite;
+
+ if(iAbsoluteBeginTime == (TInt32)KTimeIndefinite)
+ {
+ return KTimeIndefinite;
+ }
+ if ( iAnimTime->DurationTime() == 0 )
+ {
+ // If the animation's dur is specified as 0, then the Simple duration
+ // of this animation is 0. This is done so that the animation should not happen
+ return 0;
+ }
+
+ lEndTime = iAnimTime->EndTime();
+ if ( lEndTime <= iAnimTime->BeginTime() )
+ {
+ lEndTime= KTimeIndefinite;
+ }
+
+ if ( iRepeatCount == KRepeatCountMax )
+ {
+ if ( iAnimTime->RepeatDurationTime() == KTimeIndefinite )
+ {
+ lDur= KTimeIndefinite; // Neither are specified
+ }
+ else // RepeatDur was specified.
+ {
+ lDur= iAbsoluteBeginTime + iAnimTime->RepeatDurationTime();
+ }
+ }
+
+ else if( (iAnimTime->DurationTime() == KTimeIndefinite || iAnimTime->DurationTime() == KIndefiniteAnimationDuration)
+ && ( this->ElemID() != KSvgSetElement ) )
+ {
+ lDur= KTimeIndefinite;
+ return lDur;
+ }
+ else // RepeatCount was specified.
+ {
+ if ( iAnimTime->RepeatDurationTime() == KTimeIndefinite )
+ {
+ lDur= (TUint32) (iAbsoluteBeginTime + iAnimTime->DurationTime() * iRepeatCount);
+ }
+ else // Both are specified. Return the minimum time.
+ {
+ if ( iAnimTime->RepeatDurationTime() < ( iAnimTime->DurationTime() * iRepeatCount ) )
+ {
+ lDur= iAbsoluteBeginTime + iAnimTime->RepeatDurationTime();
+ }
+ else
+ {
+ lDur= (TUint32) (iAbsoluteBeginTime + iAnimTime->DurationTime() * iRepeatCount);
+ }
+ }
+ }
+
+ // should return the Minimum of end time and calculated duration
+ if(lDur <= lEndTime)
+ return lDur;
+ else
+ return lEndTime;
+
+
+ }
+TUint32 CSvgAnimationBase::CompleteDuration()
+ {
+ TUint32 lDur= KTimeIndefinite;
+
+ TUint32 lEndTime = iAnimTime->LastEndTime();
+ TUint32 lBeginTime = iAnimTime->LastBeginTime();
+
+ if(lBeginTime == (TInt32)KTimeIndefinite)
+ {
+ return KTimeIndefinite;
+ }
+ if ( iAnimTime->DurationTime() == 0 )
+ {
+ // If the animation's dur is specified as 0, then the Simple duration
+ // of this animation is 0. This is done so that the animation should not happen
+ return 0;
+ }
+
+
+ if ( lEndTime <= lBeginTime)
+ {
+ // When animation's end time is <= its begin time, it means that the
+ // animation should be treated as an indefinite animation and animation
+ // never becomes active
+ lEndTime = KTimeIndefinite;
+
+ }
+
+ if ( iRepeatCount == KRepeatCountMax )
+ {
+ if ( iAnimTime->RepeatDurationTime() == KTimeIndefinite )
+ {
+ lDur= KTimeIndefinite; // Neither are specified
+ }
+ else // RepeatDur was specified.
+ {
+ lDur= lBeginTime + iAnimTime->RepeatDurationTime();
+ }
+ }
+
+ else if( (iAnimTime->DurationTime() == KTimeIndefinite || iAnimTime->DurationTime() == KIndefiniteAnimationDuration)
+ && ( this->ElemID() != KSvgSetElement ) )
+ {
+ lDur= KTimeIndefinite;
+ return lDur;
+ }
+ else // RepeatCount was specified.
+ {
+ if ( iAnimTime->RepeatDurationTime() == KTimeIndefinite )
+ {
+ lDur= (TUint32) (lBeginTime + iAnimTime->DurationTime() * iRepeatCount);
+ }
+ else // Both are specified. Return the minimum time.
+ {
+ if ( iAnimTime->RepeatDurationTime() < ( iAnimTime->DurationTime() * iRepeatCount ) )
+ {
+ lDur= lBeginTime + iAnimTime->RepeatDurationTime();
+ }
+ else
+ {
+ lDur= (TUint32) (lBeginTime + iAnimTime->DurationTime() * iRepeatCount);
+ }
+ }
+ }
+
+ // should return the Minimum of end time and calculated duration
+ if(lDur <= lEndTime)
+ return lDur;
+ else
+ return lEndTime;
+
+
+ }
+
+
+// From SVG DOM / MElementTimeControl
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgAnimationBase::BeginElementL()
+ {
+
+ SetBeginByEventL( this, ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->CurrentTIme() );
+
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgAnimationBase::BeginElementAtL( TFloatFixPt aOffset )
+ {
+ TInt32 offset = aOffset.RawData() / KBeginElementOffsetRatio /* *1000/65536 */;
+ SetBeginByEventL( this, ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->CurrentTIme() + offset );
+
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgAnimationBase::EndElement()
+ {
+ SetEndByEvent( this, ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->CurrentTIme() );
+
+
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgAnimationBase::EndElementAt( TFloatFixPt aOffset )
+ {
+ TInt32 offset = aOffset.RawData() / 66 /* *1000/65536 */;
+
+ SetEndByEvent( this, ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->CurrentTIme() + offset );
+
+
+ return EFalse;
+ }
+
+
+// *******************************************************
+// SVG Implementation
+
+
+// *******************************************************
+// From MXmlElement
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgAnimationBase::SetAttributeL( const TDesC& aName, const TDesC& aValue )
+ {
+
+ // Before anything else set the target to parent
+ if ( !iTargetSet )
+ {
+ iTargetElement = ( CSvgElementImpl * ) ParentNode();// default is parent element
+ if (iTargetElement)
+ {
+ iTargetSet = ETrue;
+ }
+ }
+
+ _LIT( KTmpAttrName, "attributeName" );
+ _LIT( KTmpXlinkHref, "xlink:href" );
+ _LIT( KTmpBegin, "begin" );
+ _LIT( KTmpDur, "dur" );
+ _LIT( KTmpRepeatDur, "repeatDur" );
+ _LIT( KTmpEnd, "end" );
+ _LIT( KTmpFrom, "from" );
+ _LIT( KTmpTo, "to" );
+ _LIT( KTmpBy, "by" );
+ _LIT( KTmpFill, "fill" );
+ _LIT( KTmpRestart, "restart" );
+ _LIT( KTmpRepeatCount, "repeatCount" );
+ _LIT( KTmpAccumulate, "accumulate" );
+ _LIT( KTmpAdditive, "additive" );
+
+ _LIT( KTmpValues, "values" );
+ _LIT( KTmpCalcMode, "calcMode" );
+ _LIT( KTmpKeyTimes, "keyTimes" );
+ _LIT( KTmpKeySplines, "keySplines" );
+
+ _LIT( KTmpIndefinite, "indefinite" );
+
+
+ if ( SetIdandXmlbaseL( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+
+
+ if ( aName == KTmpXlinkHref )
+ {
+ // STEP 1 - Get the reference element
+ // If the first char is '#' then remove it
+ // This is possible if coming from cXML parser and not CVG Decoder
+ TInt pos = aValue.Locate( '#' );
+ if ( pos != KErrNotFound && pos == 0 )
+ {
+ HBufC* tBufC = HBufC::NewLC( aValue.Length() );
+ TPtr tPtr = tBufC->Des();
+ tPtr.Copy( aValue );
+ tPtr.Delete( pos, 1 );
+ CSvgElementImpl *lElement = ( CSvgElementImpl * )
+ ((CSvgDocumentImpl*)iOwnerDocument)->GetElementById( tPtr );
+ if(this->SetXlinkAttributeL( aName, tPtr ))
+ {
+ if(lElement)
+ {
+ SetTarget(lElement);
+ }
+ else
+ {
+ CleanupStack::PopAndDestroy( 1 );
+ return KErrAnimateReferenceElementNotFound;
+ }
+ }
+ CleanupStack::PopAndDestroy( 1 );
+ }
+
+ if ( !iTargetElement )
+ {
+ iAttrId = 0xffff;
+ return KErrNoAttribute;
+ }
+ else if(( iTargetElement->ElemID() == KSvgRadialGradientElement
+ || iTargetElement->ElemID() == KSvgLinearGradientElement)
+ && (iAttrId == KAtrGradientTransform))
+ {
+ iAttrId = KAtrTransform;
+ }
+ GetAttrValueL();
+ return KErrNone;
+ }
+
+ if ( aName == KTmpAttrName )
+ {
+ iReqAttrFlag = 0;
+
+ iAnimStatus = KAnimNotActive;
+
+ if (iTargetElement)
+ {
+ iTargetElement->iHasAnimationBase = (TInt)this;
+ iTargetElement->SetIsAnimating( EFalse );
+ SetIsAnimating( EFalse );
+ }
+
+ if ( !IsElementAttrs( aValue ) && !IsPresentationAttrs( aValue ) )
+ {
+ iAttrId = 0xffff; // Not supported attribute.
+ }
+ else
+ {
+ if(!iTargetElement)
+ {
+ iAttrId = 0xffff;
+ return KErrNoAttribute;
+ }
+ GetAttrValueL();
+ }
+ }
+ else if ( aName == KTmpBegin )
+ {
+ iIsBeginSet= ETrue;
+ if ( aValue == KTmpIndefinite )
+ {
+ iAnimTime->SetBeginTime( KTimeIndefinite );
+ iAbsoluteBeginTime = KTimeIndefinite;
+ }
+
+ else
+ {
+ TStringTokenizer tkn ( aValue, KSEMICOLON );
+ while ( tkn.HasMoreTokens() )
+ {
+ TPtrC lToken = tkn.NextToken();
+ CSvgAnimTimingParser* atParser = CSvgAnimTimingParser::NewLC( lToken, this );
+ TInt32 clockValue;
+ HBufC* lBeginSyncElementId = HBufC::NewL(lToken.Length());
+ TSvgEvent lBeginReferenceEvent;
+ TReal32 lRepeatBeginValue;
+ TPtr ptr = lBeginSyncElementId->Des();
+ atParser->Parse( ptr,
+ lBeginReferenceEvent,
+ clockValue,
+ lRepeatBeginValue,
+ ETrue);
+
+ TEventListItem tmp;
+ if ( lBeginSyncElementId->Length() <= 0 )
+ {
+ tmp.iTargetElement = iTargetElement;
+ tmp.iReferenceElemeId= NULL;
+ }
+ else
+ {
+ // get element by id and append its pointer.
+
+ // there can be an issue if the id is not found. in case of forward reference.
+ // for this we will store the id if it is not found at this time.
+ tmp.iTargetElement = ( CSvgElementImpl * )
+ ((CSvgDocumentImpl*)iOwnerDocument)->GetElementById( *lBeginSyncElementId );
+
+ if( tmp.iTargetElement == NULL)
+ {
+ // this indicates that this is a forward reference in case of begin.
+
+ tmp.iReferenceElemeId = lBeginSyncElementId->AllocL();
+ }
+ else
+ {
+ // otherwise the element is found and we
+ // do not need to keep iBeginReferenceElemeId so
+ // make it NULL;
+ tmp.iReferenceElemeId = NULL;
+ }
+ }
+ if ( clockValue < 0 ) // Himanshu:to check the negative begin value
+ {
+ iNegativeBeginTime = clockValue;
+
+ // adjusting the duration time if already set before
+ TInt32 aNewDurationTime = iAnimTime->GetDurationTime();
+ if ( aNewDurationTime != KTimeIndefinite )
+ {
+ aNewDurationTime += clockValue;
+ iAnimTime->SetDurationTime(aNewDurationTime);
+ }
+ // adjusting the end time if already set before
+ TInt32 aNewEndTime = iAnimTime->GetEndTime();
+ if ( aNewEndTime > 0 && aNewEndTime < KTimeIndefinite )
+ {
+ aNewEndTime += clockValue;
+ iAnimTime->SetEndTime(aNewEndTime);
+ }
+
+ clockValue = 0; // set clockValue to 0 if negative begin
+ }
+
+ tmp.iEvent = lBeginReferenceEvent;
+ tmp.iTime = clockValue;
+
+ switch ( lBeginReferenceEvent )
+ {
+ case ESvgEventKey:
+ {
+ iAnimTime->SetBeginTime( KTimeIndefinite );
+ iAbsoluteBeginTime = KTimeIndefinite;
+ tmp.iAccessKeyCode = atParser->AccekeyValue();
+ tmp.iOffset = clockValue;
+ tmp.iTargetElement = NULL;
+ ((CSvgDocumentImpl*)iOwnerDocument)->AddToEventReceiverListL( this,
+ KSvgEventMaskExternalUI );
+ }
+ break;
+ case ESvgEventWallClock:
+ {
+ // not supported yet
+ }
+ break;
+
+ case ESvgEventNone:
+ {
+ // Simple Offset-value
+ iAnimTime->AddBeginTime( clockValue );
+ iAbsoluteBeginTime = clockValue;
+ tmp.iTargetElement = NULL;
+ }
+ break;
+
+ case ESvgEventRepeatEvent:
+ {
+ iAnimTime->SetBeginTime( KTimeIndefinite );
+ iAbsoluteBeginTime = KTimeIndefinite;
+
+ tmp.iOffset = clockValue;
+ tmp.iRepeatValue = lRepeatBeginValue;
+ }
+ break;
+ default:
+ {
+ iAnimTime->SetBeginTime( KTimeIndefinite );
+ iAbsoluteBeginTime = KTimeIndefinite;
+ tmp.iTime = KTimeIndefinite;
+ tmp.iOffset = clockValue;
+
+ ((CSvgDocumentImpl*)iOwnerDocument)->AddToEventReceiverListL( this,
+ KSvgEventMaskInternal );
+ }
+ break;
+ }
+ delete lBeginSyncElementId;
+ iEventList->AppendL(tmp);
+ CleanupStack::PopAndDestroy( 1 ); // atParser
+ }
+ iAnimTime->SaveBeginTime();
+ }
+
+ if ( ( ((CSvgDocumentImpl*)iOwnerDocument)->Engine() && iAnimTime && ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->CurrentTIme() >= iAnimTime->BeginTime() )
+ || ( iAnimTime && ((CSvgDocumentImpl*)iOwnerDocument)->iTimeForJSR226 >= iAnimTime->BeginTime() ) )
+ {
+ iTargetElement->SetIsAnimating( ETrue );
+ SetIsAnimating( ETrue );
+ }
+
+ }
+ else if ( aName == KTmpDur )
+ {
+ if ( aValue == KTmpIndefinite )
+ {
+ iAnimTime->SetDurationTime( KTimeIndefinite );
+ }
+ else
+ {
+ CSvgAnimTimingParser* atParser = CSvgAnimTimingParser::NewLC( aValue, this );
+ TInt32 clockValue;
+ TLex lex ( aValue );
+ atParser->ParseClockValue( lex, clockValue );
+ CleanupStack::PopAndDestroy( 1 ); // atParser
+
+ if (clockValue >= 0)
+ {
+ if ( iNegativeBeginTime < 0 ) //Himanshu: adjusting the duration if negative begin time is given
+ {
+ clockValue += iNegativeBeginTime;
+ }
+ iAnimTime->SetDurationTime( clockValue );
+ }
+ else
+ {
+ iAnimTime->SetDurationTime( KTimeIndefinite );
+
+ if ( !iAnimTime->BeginTime() )
+ {
+ iAnimTime->SetBeginTime( KTimeIndefinite );
+ }
+ }
+ }
+ }
+ else if ( aName == KTmpRepeatDur )
+ {
+ if ( aValue == KTmpIndefinite )
+ {
+ iAnimTime->SetRepeatDurationTime( KTimeIndefinite );
+ // Set Repeat Count to max if not set
+ if ( ! iRepeatCountSet )
+ {
+ iRepeatCount = KRepeatCountMax;
+ }
+ }
+ else
+ {
+ CSvgAnimTimingParser* atParser = CSvgAnimTimingParser::NewLC( aValue, this );
+ TInt32 clockValue;
+ TLex lex ( aValue );
+ atParser->ParseClockValue( lex, clockValue );
+ CleanupStack::PopAndDestroy( 1 ); // atParser
+ // Set the repeat duration time only if the clock value
+ // is valid
+ if( clockValue != KTimeIndefinite )
+ {
+ iAnimTime->SetRepeatDurationTime( clockValue );
+
+ // Set Repeat Count to max if not set
+ if ( ! iRepeatCountSet )
+ {
+ iRepeatCount = KRepeatCountMax;
+ }
+ }
+ }
+ }
+ else if ( aName == KTmpEnd )
+ {
+ if ( aValue == KTmpIndefinite )
+ {
+ iAnimTime->SetEndTime( KTimeIndefinite );
+ }
+ else
+ {
+ TStringTokenizer tkn ( aValue, KSEMICOLON );
+ while ( tkn.HasMoreTokens() )
+ {
+ TPtrC lToken = tkn.NextToken();
+ CSvgAnimTimingParser* atParser = CSvgAnimTimingParser::NewLC( lToken, this );
+ TInt32 clockValue;
+
+
+ TBuf<28> lEndSyncElementId;
+
+ TSvgEvent lEndReferenceEvent;
+ TReal32 lRepeatEndValue;
+ atParser->Parse( lEndSyncElementId,
+ lEndReferenceEvent,
+ clockValue,
+ lRepeatEndValue,
+ EFalse);
+ TEventListItem tmp;
+
+ if ( iNegativeBeginTime < 0 ) //Himanshu: adjusting the end time if negative begin is given
+ {
+ clockValue += iNegativeBeginTime;
+ }
+ if ( lEndSyncElementId.Length() <= 0 )
+ {
+ tmp.iTargetElement = iTargetElement;
+ tmp.iReferenceElemeId= NULL;
+ }
+ else
+ {
+ // get element by id and append its pointer.
+
+ // there can be an issue if the id is not found. in case of forward reference.
+ // for this we will store the id if it is not found at this time.
+ tmp.iTargetElement = ( CSvgElementImpl * )
+ ((CSvgDocumentImpl*)iOwnerDocument)->GetElementById( lEndSyncElementId );
+
+ if( tmp.iTargetElement == NULL)
+ {
+ // this indicates that this is a forward reference in case of begin.
+
+ tmp.iReferenceElemeId = lEndSyncElementId.AllocL();
+ }
+ else
+ {
+ // otherwise the element is found and we
+ // do not need to keep iReferenceElemeId so
+ // make it NULL;
+ tmp.iReferenceElemeId = NULL;
+ }
+ }
+ tmp.iEvent = lEndReferenceEvent;
+ tmp.iTime = clockValue;
+ tmp.iRepeatValue = lRepeatEndValue;
+
+
+ switch ( lEndReferenceEvent )
+ {
+ case ESvgEventKey:
+ //iAnimTime->SetEndTime( KTimeIndefinite ); // same as indefinite
+ tmp.iAccessKeyCode = atParser->AccekeyValue();
+ tmp.iOffset = clockValue;
+ tmp.iTargetElement = NULL;
+
+ /*iEndAccessKeyCode = atParser->AccekeyValue(); */
+
+ ((CSvgDocumentImpl*)iOwnerDocument)->AddToEventReceiverListL( this,
+ KSvgEventMaskExternalUI );
+ break;
+
+ case ESvgEventWallClock:
+ // not supported yet
+ break;
+
+ case ESvgEventNone:
+ // Simple Offset-value
+ iAnimTime->AddEndTime( clockValue );
+ tmp.iTargetElement = NULL;
+ break;
+
+ default:
+ // <id>.<event> +/- <offeset>
+ //iAnimTime->SetEndTime( KTimeIndefinite ); // same as indifinite
+ /* iEndOffset = clockValue;*/
+
+ tmp.iTime = KTimeIndefinite;
+ tmp.iOffset = clockValue;
+
+ ((CSvgDocumentImpl*)iOwnerDocument)->AddToEventReceiverListL( this,
+ KSvgEventMaskInternal );
+ }
+ iEndTimeList->AppendL(tmp);
+ CleanupStack::PopAndDestroy( 1 ); // atParser
+ }
+ iAnimTime->SaveEndTime();
+ }
+
+ if ( ( ((CSvgDocumentImpl*)iOwnerDocument)->Engine() && iAnimTime && ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->CurrentTIme() > iAnimTime->EndTime() )
+ || ( iAnimTime && ((CSvgDocumentImpl*)iOwnerDocument)->iTimeForJSR226 > iAnimTime->EndTime() ) )
+ {
+ iTargetElement->SetIsAnimating( EFalse );
+ SetIsAnimating( EFalse );
+ }
+ }
+ else if ( aName == KTmpFrom )
+ {
+ iNoFrom = EFalse;
+ // parser needed
+ switch ( iDataType )
+ {
+ case KSvgTypeOpacity:
+ {
+
+ TBool lPercentage = EFalse;
+ if (aValue.Locate('%') != KErrNotFound)
+ {
+ lPercentage = ETrue;
+ }
+
+ TLex lString ( aValue );
+ TReal32 lVal;
+ if (lString.Val( lVal, '.' ) != KErrNone)
+ {
+ lVal=1;
+ }
+
+ if (lPercentage)
+ {
+ lVal = lVal / TReal32(100);
+ }
+
+ if(lVal>1)
+ {
+ lVal=1;
+ }
+ if(lVal<0)
+ {
+ lVal=0;
+ }
+ iOrgFromFloat = iFromFloat = lVal;
+ }
+ break;
+ case KSvgTypeGradientUnits:
+ {
+ if(aValue == _L("objectBoundingBox"))
+ {
+ iOrgFromInt = iFromInt = 1;
+ }
+ else if(aValue == _L("userSpaceOnUse"))
+ {
+ iOrgFromInt = iFromInt = 0;
+ }
+ }
+ break;
+ case KSvgTypeLength:
+ {
+ TLex string ( aValue );
+ TReal32 val;
+ if( string.Val( val, '.' ) != KErrNone)
+ {
+ val = 0;
+ }
+ iOrgFromFloat = iFromFloat = val;
+ }
+ break;
+ case KSvgTypeList:
+ case KSvgTypePath:
+ {
+ if ( iOrgFromPath )
+ {
+ delete iOrgFromPath;
+ iOrgFromPath = NULL;
+ }
+ iOrgFromPath = CGfxGeneralPath::NewL();
+
+ // Destroy iFromPath first, because it was built before during init
+ if ( iFromPath )
+ {
+ delete iFromPath;
+ iFromPath = NULL;
+ }
+ iFromPath = CGfxGeneralPath::NewL();
+
+ if ( iAttrId == KAtrPoints ) //.
+ {
+ TSvgPathDataParser::ParsePointDataL( aValue, iOrgFromPath );
+ TSvgPathDataParser::ParsePointDataL( aValue, iFromPath );
+ }
+ else
+ {
+ TSvgPathDataParser::ParsePathData( aValue, iOrgFromPath );
+ TSvgPathDataParser::ParsePathData( aValue, iFromPath );
+ }
+ }
+ break;
+ case KSvgTypeSpreadMethod:
+ {
+ TInt pos = ((CSvgDocumentImpl*)iOwnerDocument)->SchemaData()->FindSpreadMethod(aValue);
+ if(pos != KErrNotFound)
+ {
+ iOrgFromInt = iFromInt = pos;
+ }
+ else
+ {
+ iOrgFromInt = iFromInt = 0;// default pad
+ }
+ }
+ break;
+ case KSvgTypeColor:
+ {
+ TLex lex ( aValue );
+ TInt32 colorValue;
+ if ( lex.Val( colorValue ) != KErrNone )
+ {
+ // means we have a URL color definition
+ iFromPaint = ((CSvgDocumentImpl*)iOwnerDocument)->iMemoryManager->GetCssPaintObjectL(aValue, ((CSvgElementImpl*)((CSvgDocumentImpl*)iOwnerDocument)->RootElement()));
+
+ if (iFromPaint)
+ {
+ MGfxPaint* lVal = iFromPaint->Value();
+ if (lVal)
+ {
+ iOrgFromInt = iFromInt = lVal->GetColor();
+ }
+ }
+ break;
+ }
+ }
+ // fall through for other color values.
+ case KSvgTypeInteger:
+ {
+ TLex lString ( aValue );
+ TInt32 lVal;
+ if (lString.Val( lVal ) != KErrNone)
+ {
+ lVal=0;
+ }
+ iOrgFromInt = iFromInt = lVal;
+ }
+ break;
+ case KSvgTypeDisplay:
+ {
+ if ( aValue == _L( "inline" ) )
+ {
+ iOrgFromInt = iFromInt = 0;
+ }
+ else if ( aValue == _L( "none" ) )
+ {
+ iOrgFromInt = iFromInt = 16;
+ }
+ else
+ {
+ //assume inherit on everything else
+ iOrgFromInt = iFromInt = (TInt32) KEnumInherit;
+ }
+ }
+ break;
+
+ case KSvgTypeTextAnchor:
+ {
+ TInt pos;
+ pos = ((CSvgDocumentImpl*)iOwnerDocument)->SchemaData()->FindTextAnchorEnum(aValue);
+ if(pos!= -1)
+ {
+ iOrgFromInt = iFromInt = pos ;
+ }
+ }
+ break;
+
+ case KSvgTypeVisibility:
+ {
+ if ( aValue == _L( "visible" ) )
+ {
+ iOrgFromInt = iFromInt = 0;
+ }
+ else if ( aValue == _L( "hidden" ) )
+ {
+ iOrgFromInt = iFromInt = 1;
+ }
+ }
+ break;
+
+ // viewBox
+ case KSvgTypeViewBox:
+ {
+ ParseViewBoxValue(aValue, iOrgFromViewBox);
+ iFromViewBox = iOrgFromViewBox;
+ }
+ break;
+ }
+ }
+ else if ( aName == KTmpTo )
+ {
+ iHaveTo = ETrue;
+ // parser needed
+ switch ( iDataType )
+ {
+ case KSvgTypeOpacity:
+ {
+ TBool lPercentage = EFalse;
+ if (aValue.Locate('%') != KErrNotFound)
+ {
+ lPercentage = ETrue;
+ }
+
+ TLex lString ( aValue );
+ TReal32 lVal;
+ if (lString.Val( lVal, '.' ) != KErrNone)
+ {
+ lVal=1;
+ }
+
+ if (lPercentage)
+ {
+ lVal = lVal / TReal32(100);
+ }
+
+ if(lVal>1)
+ {
+ lVal=1;
+ }
+ if(lVal<0)
+ {
+ lVal=0;
+ }
+ iToFloat = lVal;
+ break;
+ }
+ case KSvgTypeGradientUnits:
+ {
+ if(aValue == _L("objectBoundingBox"))
+ {
+ iToInt= 1;
+ }
+ else if(aValue == _L("userSpaceOnUse"))
+ {
+ iToInt = 0;
+ }
+ }
+ break;
+
+ case KSvgTypeTextAnchor:
+ {
+ TInt pos;
+ pos = ((CSvgDocumentImpl*)iOwnerDocument)->SchemaData()->FindTextAnchorEnum(aValue);
+ if(pos!= -1)
+ {
+ iToInt = pos ;
+ }
+ }
+ break;
+
+ case KSvgTypeLength:
+ {
+ TLex string ( aValue );
+ TReal32 val;
+ if( string.Val( val, '.' ) != KErrNone )
+ {
+ val = 0;
+ }
+ iToFloat = val;
+ }
+ break;
+ case KSvgTypeList:
+ case KSvgTypePath:
+ {
+ CGfxPathIterator* itr1;
+ CGfxPathIterator* itr2;
+ TGfxAffineTransform idenTransform;
+
+ if ( iToPath )
+ {
+ delete iToPath;
+ iToPath = NULL;
+ }
+ iToPath = CGfxGeneralPath::NewL();
+
+ // Build a new path
+
+ if ( iAttrId == KAtrPoints )
+ {
+ TSvgPathDataParser::ParsePointDataL( aValue, iToPath );
+ }
+ else
+ {
+ TSvgPathDataParser::ParsePathData( aValue, iToPath );
+ }
+
+ iToPath->GetPathIteratorL( &idenTransform, itr1 );
+ CleanupStack::PushL( itr1 );
+
+ if ( iNoFrom )
+ {
+ iOrgPath->GetPathIteratorL( &idenTransform, itr2 );
+ }
+ else
+ {
+ iFromPath->GetPathIteratorL( &idenTransform, itr2 );
+ }
+ CleanupStack::PushL( itr2 );
+
+
+ TFloatFixPt tmpcoords1[6];
+ TFloatFixPt tmpcoords2[6];
+ while ( !itr1->IsDone() && !itr2->IsDone() )
+ {
+ TGfxSegType type1 = itr1->CurrentSegment( tmpcoords1 );
+ TGfxSegType type2 = itr2->CurrentSegment( tmpcoords2 );
+ if ( type1 != type2 )
+ {
+ // MISMATCH
+ // SHOULD END ANIMATION
+ break;
+ }
+
+ itr1->NextL();
+ itr2->NextL();
+ }
+ }
+ CleanupStack::PopAndDestroy( 2 ); // destroy itr1 & itr2
+ break;
+ case KSvgTypeSpreadMethod:
+ {
+ TInt pos = ((CSvgDocumentImpl*)iOwnerDocument)->SchemaData()->FindSpreadMethod(aValue);
+ if(pos != KErrNotFound)
+ {
+ iToInt = pos;
+ }
+ else
+ {
+ iToInt= 0;// default pad
+ }
+ }
+ break;
+
+ case KSvgTypeColor:
+ {
+ TLex lex ( aValue );
+ TInt32 colorValue;
+ if ( lex.Val( colorValue ) != KErrNone )
+ {
+ // means we have a URL color definition
+ iToPaint = ((CSvgDocumentImpl*)iOwnerDocument)->iMemoryManager->GetCssPaintObjectL(aValue, ((CSvgElementImpl*)((CSvgDocumentImpl*)iOwnerDocument)->RootElement()));
+
+ if (iToPaint)
+ {
+ MGfxPaint* lVal = iToPaint->Value();
+ if (lVal)
+ {
+ iToInt = lVal->GetColor();
+ }
+ }
+ break;
+ }
+ }
+ // fall through for rgb values
+ case KSvgTypeInteger:
+ {
+ TLex lString ( aValue );
+ TInt32 lVal;
+ if (lString.Val( lVal ) != KErrNone)
+ {
+ lVal=0;
+ }
+ iToInt = lVal;
+ }
+ break;
+ case KSvgTypeDisplay:
+ {
+ if ( aValue == _L( "inline" ) )
+ {
+ iToInt = 0;
+ }
+ else if ( aValue == _L( "none" ) )
+ {
+ iToInt = 16;
+ }
+ else
+ {
+ //assume inherit on everything else
+ iToInt = (TInt32) KEnumInherit;
+ }
+ }
+ break;
+ case KSvgTypeVisibility:
+ {
+ if ( aValue == _L( "visible" ) )
+ {
+ iToInt = 0;
+ }
+ else if ( aValue == _L( "hidden" ) )
+ {
+ iToInt = 1;
+ }
+ }
+ break;
+
+ // viewBox
+ case KSvgTypeViewBox:
+ {
+ ParseViewBoxValue(aValue, iToViewBox);
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ else if ( aName == KTmpBy )
+ {
+ iHaveBy = ETrue;
+
+ if(!iHaveTo)
+ {
+ switch ( iDataType )
+ {
+ case KSvgTypeOpacity:
+ {
+
+ TBool lPercentage = EFalse;
+ if (aValue.Locate('%') != KErrNotFound)
+ {
+ lPercentage = ETrue;
+ }
+
+ TLex lString ( aValue );
+ TReal32 lVal;
+ if (lString.Val( lVal, '.' ) != KErrNone)
+ {
+ lVal=1;
+ }
+
+ if (lPercentage)
+ {
+ lVal = lVal / TReal32(100);
+ }
+
+ if(lVal>1)
+ {
+ lVal=1;
+ }
+ if(lVal<0)
+ {
+ lVal=0;
+ }
+ if ( iNoFrom )
+ {
+ iAdditive = KAdditiveSum;
+ iAdditiveOrg = KAdditiveSum;
+ iToFloat = iFromFloat + TFloatFixPt( lVal );
+ iNoFrom = EFalse;
+ iOrgFromFloat = iFromFloat = (TReal32)0;
+ }
+ else
+ {
+ iToFloat = iFromFloat + TFloatFixPt( lVal );
+ }
+ break;
+ }
+ case KSvgTypeLength:
+ {
+ TLex string ( aValue );
+ TReal32 val;
+
+ if( string.Val( val, '.' ) != KErrNone )
+ {
+ val = 0;
+ }
+
+ if ( iNoFrom )
+ {
+ iAdditive = KAdditiveSum;
+ iAdditiveOrg = KAdditiveSum;
+ iToFloat = iFromFloat + TFloatFixPt( val );
+ iNoFrom = EFalse;
+ iOrgFromFloat = iFromFloat = (TReal32)0;
+ }
+ else
+ {
+ iToFloat = iFromFloat + TFloatFixPt( val );
+ }
+ }
+ break;
+ case KSvgTypeList:
+ case KSvgTypePath:
+ {
+ if ( iToPath )
+ {
+ delete iToPath;
+ iToPath = NULL;
+ }
+ iToPath = CGfxGeneralPath::NewL();
+
+ if ( iAttrId == KAtrPoints ) //.
+ {
+ TSvgPathDataParser::ParsePointDataL( aValue, iToPath );
+ }
+ else
+ {
+ TSvgPathDataParser::ParsePathData( aValue, iToPath );
+ }
+ CGfxGeneralPath*lCurPath = CGfxGeneralPath::NewLC();
+ RArray<TFloatFixPt>* fromPoints;
+ RArray<TFloatFixPt>* toPoints = iToPath->PointCoordsArrayAll();
+
+ if ( iNoFrom )
+ {
+ fromPoints = iOrgPath->PointCoordsArrayAll();
+ lCurPath->SetPointTypeArrayL( iOrgPath->PointTypeArray() );
+ }
+ else
+ {
+ fromPoints = iFromPath->PointCoordsArrayAll();
+ lCurPath->SetPointTypeArrayL( iFromPath->PointTypeArray() );
+ }
+ TInt i = 0;
+ TInt fromCount = fromPoints->Count();
+ TInt toCount = toPoints->Count();
+
+ while ( i < fromCount && i < toCount)
+ {
+ toPoints->operator[]( i ) = fromPoints->operator[]( i ) +
+ toPoints->operator[]( i );
+ i++;
+ }
+ CleanupStack::PopAndDestroy( 1 ); // lCurPath
+ return ETrue;
+ }
+ case KSvgTypeColor:
+ {
+ TLex lString ( aValue );
+ TInt32 lVal;
+ if (lString.Val( lVal ) != KErrNone)
+ {
+ lVal=0;
+ }
+
+ if ( iNoFrom )
+ {
+ iToInt = lVal;
+ iToInt = AddColor( iPropInt, lVal);
+ iOrgFromInt = iFromInt = (TInt32) 0;
+ }
+ else
+ {
+ iToInt = AddColor( iFromInt, lVal);
+ }
+ }
+ break;
+ case KSvgTypeSpreadMethod:
+ {
+ TInt pos = ((CSvgDocumentImpl*)iOwnerDocument)->SchemaData()->FindSpreadMethod(aValue);
+ if(pos != KErrNotFound)
+ {
+ iToInt = pos;
+ }
+ else
+ {
+ iToInt= 0;// default pad
+ }
+
+ if ( iNoFrom )
+ {
+ iAdditive = KAdditiveSum;
+ iAdditiveOrg = KAdditiveSum;
+ iNoFrom = EFalse;
+ iOrgFromInt = iFromInt = (TInt32) 0;
+ }
+ // by here has no meaning just take the absolute value
+ }
+ break;
+ case KSvgTypeGradientUnits:
+ {
+ if(aValue == _L("objectBoundingBox"))
+ {
+ iToInt= 1;
+ }
+ else if(aValue == _L("userSpaceOnUse"))
+ {
+ iToInt = 0;
+ }
+ if ( iNoFrom )
+ {
+ iAdditive = KAdditiveSum;
+ iAdditiveOrg = KAdditiveSum;
+ iNoFrom = EFalse;
+ iOrgFromInt = iFromInt = (TInt32) 0;
+ }
+ // by here has no meaning just take the absolute value
+ }
+ break;
+ case KSvgTypeInteger:
+ {
+ TLex lString ( aValue );
+ TInt32 lVal;
+ if (lString.Val( lVal ) != KErrNone)
+ {
+ lVal=0;
+ }
+
+ if ( iNoFrom )
+ {
+ iAdditive = KAdditiveSum;
+ iAdditiveOrg = KAdditiveSum;
+ iToInt = lVal;
+ iNoFrom = EFalse;
+ iOrgFromInt = iFromInt = (TInt32) 0;
+ }
+ else
+ {
+ iToInt = iFromInt + lVal;
+ }
+ }
+ break;
+ case KSvgTypeVisibility:
+ {
+ if ( aValue == _L( "visible" ) )
+ {
+ iToInt = 0;
+ }
+ else if ( aValue == _L( "hidden" ) )
+ {
+ iToInt = 1;
+ }
+ }
+ break;
+ case KSvgTypeTextAnchor:
+ {
+ TInt pos;
+ pos = ((CSvgDocumentImpl*)iOwnerDocument)->SchemaData()->FindTextAnchorEnum(aValue);
+ if(pos!= -1)
+ {
+ iToInt = pos ;
+ }
+ }
+ break;
+ case KSvgTypeDisplay:
+ {
+ if ( aValue == _L( "inline" ) )
+ {
+ iToInt = 0;
+ }
+ else if ( aValue == _L( "none" ) )
+ {
+ iToInt = 16;
+ }
+ else
+ {
+ //assume inherit on everything else
+ iToInt = (TInt32) KEnumInherit;
+ }
+
+ }
+ break;
+
+ // viewBox
+ case KSvgTypeViewBox:
+ {
+
+ TGfxRectangle2D lVal;
+ ParseViewBoxValue(aValue, lVal);
+
+ TReal32 lX=0;
+ TReal32 lY=0;
+ TReal32 lW=0;
+ TReal32 lH=0;
+ lX = lVal.iX + iFromViewBox.iX;
+ lY = lVal.iY + iFromViewBox.iY;
+ lW = lVal.iWidth + iFromViewBox.iWidth;
+ lH = lVal.iHeight + iFromViewBox.iHeight;
+
+ TGfxRectangle2D result = TGfxRectangle2D( lX, lY, lW, lH );
+
+ if ( iNoFrom )
+ {
+ iAdditive = KAdditiveSum;
+ iAdditiveOrg = KAdditiveSum;
+ iToViewBox = result;
+ iNoFrom = EFalse;
+ iOrgFromViewBox = iFromViewBox = TGfxRectangle2D( 0, 0, 0, 0 );
+ }
+ else
+ {
+ iToViewBox = result;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ // repeatCount : numeric value | "indefinite"
+ // Specifies the number of iterations of the animation function. It can have the following attribute
+ // values:
+ // * numeric value
+ // This is a (base 10) "floating point" numeric value that specifies the number of iterations.
+ // It can include partial iterations expressed as fraction values. A fractional value describes a
+ // portion of the simple duration. Values must be greater than 0.
+ // * "indefinite"
+ // The animation is defined to repeat indefinitely (i.e. until the document ends).
+ else if ( aName == KTmpRepeatCount )
+ {
+ iRepeatCountSet = ETrue;
+ if ( aValue == KTmpIndefinite )
+ {
+ iRepeatCount = KRepeatCountMax;
+ }
+ else
+ {
+ TLex lexer ( aValue );
+ TReal32 val = 1.0f;
+ // Check for invalid number string or negative value
+ // Also check for value value followed by other characters, i.e ("6-4" or "3abd"
+ // Starting and ending whitespaces are chopped by lexer.
+ if ( lexer.Val( val, '.' ) != KErrNone || val <= 0 || lexer.Remainder().Length() > 0 )
+ {
+ val = 1.0f;
+ }
+ iRepeatCount = val;
+ }
+ }
+ else if ( aName == KTmpFill )
+ {
+ if ( aValue == _L( "freeze" ) )
+ {
+ iFill = KAnimFillFreeze;
+ }
+ }
+ else if ( aName == KTmpRestart )
+ {
+ if ( aValue == _L( "whenNotActive" ) )
+ {
+ iAnimRestart = KRestartWhenNotActive; //KAnimFillFreeze;
+ }
+ else if ( aValue == _L( "never" ) )
+ {
+ iAnimRestart = KRestartNever;
+ }
+ // Default is 'always'
+
+ }
+ else if ( aName == KTmpValues )
+ {
+ iHaveValues = ETrue;
+ iNoFrom = EFalse;
+
+ switch ( iDataType )
+ {
+
+ case KSvgTypeOpacity:
+ case KSvgTypeLength:
+ iValuesFloat->Reset();
+ break;
+
+ case KSvgTypeList:
+ case KSvgTypePath:
+ iValuesFloat->Reset();
+ iValuesPath->Reset(); // could be ResetAndDestroy()
+ break;
+ case KSvgTypeTextAnchor:
+ case KSvgTypeGradientUnits:
+ case KSvgTypeColor:
+ case KSvgTypeInteger:
+ case KSvgTypeVisibility:
+ case KSvgTypeDisplay:
+ iValuesFloat->Reset();
+ iValuesInt->Reset();
+ break;
+
+ case KSvgTypeViewBox:
+ iValuesFloat->Reset();
+ iValuesViewBox->Reset();
+ break;
+
+ default:
+ break;
+ }
+
+ TStringTokenizer tkn ( aValue, KSEMICOLON );
+ while ( tkn.HasMoreTokens() )
+ {
+ switch ( iDataType )
+ {
+ case KSvgTypeOpacity:
+ {
+ TFloatFixPt KZero;
+ TFloatFixPt KOne( KFloatFixOne );
+ TFloatFixPt opacity;
+
+ TPtrC lToken = tkn.NextToken();
+
+ if ( TFloatFixPt::ConvertString( lToken, opacity ) != KErrNone )
+ {
+ opacity = KOne;
+ }
+ else
+ {
+
+ if ( lToken.Locate('%') != KErrNotFound )
+ {
+ opacity = opacity / TFloatFixPt(100);
+ }
+
+ if ( opacity < KZero )
+ opacity = KZero;
+ else if ( opacity > KOne )
+ opacity = KOne;
+ }
+ User::LeaveIfError( iValuesFloat->Append( opacity ) );
+ }
+ break;
+
+ case KSvgTypeLength:
+ User::LeaveIfError(iValuesFloat->Append( TFloatFixPt::ConvertString( tkn.NextToken() ) ));
+ break;
+
+ case KSvgTypeList:
+ case KSvgTypePath:
+ {
+ CGfxGeneralPath*tPath = CGfxGeneralPath::NewL();
+ CleanupStack::PushL(tPath);
+ if ( iAttrId == KAtrPoints ) //.
+ {
+ TSvgPathDataParser::ParsePointDataL( tkn.NextToken(), tPath );
+ }
+ else
+ {
+ TSvgPathDataParser::ParsePathData( tkn.NextToken(),
+ tPath );
+ }
+ User::LeaveIfError(iValuesPath->Append( tPath ));
+ CleanupStack::Pop();
+ }
+
+ break;
+ case KSvgTypeColor:
+ {
+ TSvgColor tColor ( KGfxColorNull );
+ TUint32 tempVal;
+
+
+
+
+ TBool col = tColor.GetStringL( tkn.NextToken(), tempVal );
+
+ if(!col)
+ {
+
+ tempVal = 0x000000; // set the default to black,
+ }
+ User::LeaveIfError(iValuesInt->Append( tempVal ));
+ }
+ break;
+
+ case KSvgTypeSpreadMethod:
+ {
+ TInt pos = ((CSvgDocumentImpl*)iOwnerDocument)->SchemaData()->FindSpreadMethod(tkn.NextToken() );
+ if(pos != KErrNotFound)
+ {
+ User::LeaveIfError(iValuesInt->Append( pos ));
+ }
+ else
+ {
+ User::LeaveIfError(iValuesInt->Append( 0));// default pad
+ }
+ }
+ break;
+
+ case KSvgTypeInteger:
+ User::LeaveIfError(iValuesInt->Append( TFloatFixPt::ConvertString( tkn.NextToken() ) ));
+ break;
+
+ case KSvgTypeVisibility:
+ {
+ TPtrC tmptk = tkn.NextToken();
+
+ if (tmptk.Find(_L( "visible" )) != KErrNotFound)
+ {
+ User::LeaveIfError(iValuesInt->Append( 0 ));
+ }
+ else if (tmptk.Find(_L( "hidden" )) != KErrNotFound)
+ {
+ User::LeaveIfError(iValuesInt->Append( 1 ));
+ }
+ else if ( tmptk.Find(_L("inherit")) != KErrNotFound )
+ {
+ User::LeaveIfError(iValuesInt->Append(KInherit));
+ }
+
+
+ }
+ break;
+ case KSvgTypeGradientUnits:
+ {
+ TPtrC tmptk = tkn.NextToken();
+ if (tmptk.Find(_L( "objectBoundingBox" )) != KErrNotFound)
+ {
+ User::LeaveIfError(iValuesInt->Append( 1));
+ }
+ else if (tmptk.Find(_L( "userSpaceOnUse" )) != KErrNotFound)
+ {
+ User::LeaveIfError(iValuesInt->Append( 0));
+ }
+
+ }
+ break;
+ case KSvgTypeDisplay:
+ {
+ TPtrC tmptk = tkn.NextToken();
+
+ if (tmptk.Find(_L( "inline" )) != KErrNotFound)
+ {
+ //found inline
+ User::LeaveIfError(iValuesInt->Append( 0 ));
+ }
+ else if (tmptk.Find(_L( "none" )) != KErrNotFound)
+ {
+ User::LeaveIfError(iValuesInt->Append( 16 ));
+ }
+ else
+ {
+ //assume inherit on everything else
+ User::LeaveIfError(iValuesInt->Append( (TInt32) KEnumInherit ));
+ //iValuesInt->Append( 0 );
+ }
+
+ }
+ break;
+
+ case KSvgTypeTextAnchor:
+ {
+
+ TInt pos;
+
+ pos = ((CSvgDocumentImpl*)iOwnerDocument)->SchemaData()->FindTextAnchorEnum(tkn.NextToken());
+
+ if(pos!= -1)
+ {
+ User::LeaveIfError(iValuesInt->Append( pos ));
+ }
+ }
+ break;
+
+ // viewBox attribute
+ case KSvgTypeViewBox:
+ {
+ TGfxRectangle2D lVal;
+ ParseViewBoxValue( tkn.NextToken(), lVal);
+ User::LeaveIfError(iValuesViewBox->Append( lVal ));
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ else if ( aName == KTmpCalcMode )
+ {
+ if ( aValue == _L( "discrete" ) )
+ {
+ iAnimTime->SetCalMode( KAnimCalcModeDiscrete );
+ }
+ else if ( aValue == _L( "paced" ) )
+ {
+ iAnimTime->SetCalMode( KAnimCalcModePaced );
+ }
+ else if ( aValue == _L( "spline" ) )
+ {
+ iAnimTime->SetCalMode( KAnimCalcModeSpline );
+ // Indicate to the anim timing controller that
+ // the Spline mode is set
+ iAnimTime->SetIsSplineCalcMode( ETrue );
+ TPtrC lSplineValue( iAnimTime->SplineValue() );
+ if ( lSplineValue.Length() > 0 )
+ {
+ TStringTokenizer tkn2 (lSplineValue, KSEMICOLON);
+ iAnimTime->PrepareTimeL( NULL );
+
+ while ( tkn2.HasMoreTokens() )
+ {
+ TSvgPointLexer svgplex ( tkn2.NextToken() );
+ TChar com; // ingnor this
+ TFloatFixPt x1, y1, x2, y2;
+ svgplex.GetNextPoint( com, x1, y1 );
+ svgplex.GetNextPoint( com, x2, y2 );
+ svgplex.Cleanup();
+
+ TFloatFixPt tmpZero = TFloatFixPt(0);
+ TFloatFixPt tmpOne = TFloatFixPt(1);
+
+#ifdef SVG_FLOAT_BUILD
+ if ( ( x1 < ( tmpZero ) ) || ( x1 > ( tmpOne ) ) )
+ {
+ x1 = tmpZero;
+ }
+
+ if ( ( y1 < ( tmpZero ) ) || ( y1 > ( tmpOne ) ) )
+ {
+ y1 = tmpZero;
+ }
+
+ if ( ( x2 < ( tmpZero ) ) || ( x2 > ( tmpOne ) ) )
+ {
+ x2 = tmpOne;
+ }
+
+ if ( ( y2 < ( tmpZero ) ) || ( y2 > ( tmpOne ) ) )
+ {
+ y2 = tmpOne;
+ }
+#else
+ if ( ( x1.operator < ( tmpZero ) ) || ( x1.operator > ( tmpOne ) ) )
+ {
+ x1 = tmpZero;
+ }
+
+ if ( ( y1.operator < ( tmpZero ) ) || ( y1.operator > ( tmpOne ) ) )
+ {
+ y1 = tmpZero;
+ }
+
+ if ( ( x2.operator < ( tmpZero ) ) || ( x2.operator > ( tmpOne ) ) )
+ {
+ x2 = tmpOne;
+ }
+
+ if ( ( y2.operator < ( tmpZero ) ) || ( y2.operator > ( tmpOne ) ) )
+ {
+ y2 = tmpOne;
+ }
+#endif
+ iAnimTime->AddKeySplineL( x1, y1, x2, y2 );
+ }
+ }
+ }
+ else
+ {
+ iAnimTime->SetCalMode( KAnimCalcModeLinear );
+ }
+ }
+ else if ( aName == KTmpKeyTimes )
+ {
+ // if paced spec says we ignore keyTimes
+ if(iAnimTime->CalMode() != KAnimCalcModePaced)
+ {
+ iKeyTimesPresent = ETrue;
+ iAnimTime->ResetKeyTime();
+ TStringTokenizer tkn ( aValue, KSEMICOLON );
+ TInt32 first = 1;
+
+ TFloatFixPt current_time;
+
+ while ( tkn.HasMoreTokens() )
+ {
+ current_time = TFloatFixPt::ConvertString( tkn.NextToken() );
+
+ if( (first && current_time != (TFloatFixPt) 0.0f) ||
+ current_time < (TFloatFixPt) 0.0f ||
+ current_time > (TFloatFixPt) 1.0f)
+ { // put on this keyframe animation
+ // Spec says freeze on errors, but it
+ // also says ignore keytimes on error
+
+ iAnimTime->ResetKeyTime();
+ iKeyTimesPresent = EFalse;
+
+ break;
+ }
+
+ first = 0;
+ iAnimTime->AddKeyTime( current_time );
+ }
+
+ // last keytime value should be 1 for calcmode= linear or spline
+ if( (current_time != (TFloatFixPt)1.0f) &&
+ (iAnimTime->CalMode() != KAnimCalcModeDiscrete) )
+ {
+ iAnimTime->ResetKeyTime();
+ }
+ }
+ }
+ else if ( aName == KTmpKeySplines )
+ {
+ // Count number of splines
+ TInt32 splines = 0;
+ TStringTokenizer tkn1 ( aValue, KSEMICOLON );
+ while ( tkn1.HasMoreTokens() )
+ {
+ tkn1.NextToken();
+ splines++;
+ }
+ if(!iKeyTimesPresent)
+ iAnimTime->CreateKeyTime( splines + 1 );
+ if( iAnimTime->IsSplineCalcMode() )
+ {
+ iAnimTime->PrepareTimeL( NULL );
+ TStringTokenizer tkn2 ( aValue, KSEMICOLON );
+
+ while ( tkn2.HasMoreTokens() )
+ {
+ TSvgPointLexer svgplex ( tkn2.NextToken() );
+ TChar com; // ingnor this
+ TFloatFixPt x1, y1, x2, y2;
+ svgplex.GetNextPoint( com, x1, y1 );
+ svgplex.GetNextPoint( com, x2, y2 );
+ svgplex.Cleanup();
+
+ TFloatFixPt tmpZero = TFloatFixPt(0);
+ TFloatFixPt tmpOne = TFloatFixPt(1);
+
+#ifdef SVG_FLOAT_BUILD
+ if ( ( x1 < ( tmpZero ) ) || ( x1 > ( tmpOne ) ) )
+ {
+ x1 = tmpZero;
+ }
+
+ if ( ( y1 < ( tmpZero ) ) || ( y1 > ( tmpOne ) ) )
+ {
+ y1 = tmpZero;
+ }
+
+ if ( ( x2 < ( tmpZero ) ) || ( x2 > ( tmpOne ) ) )
+ {
+ x2 = tmpOne;
+ }
+
+ if ( ( y2 < ( tmpZero ) ) || ( y2 > ( tmpOne ) ) )
+ {
+ y2 = tmpOne;
+ }
+#else
+ if ( ( x1.operator < ( tmpZero ) ) || ( x1.operator > ( tmpOne ) ) )
+ {
+ x1 = tmpZero;
+ }
+
+ if ( ( y1.operator < ( tmpZero ) ) || ( y1.operator > ( tmpOne ) ) )
+ {
+ y1 = tmpZero;
+ }
+
+ if ( ( x2.operator < ( tmpZero ) ) || ( x2.operator > ( tmpOne ) ) )
+ {
+ x2 = tmpOne;
+ }
+
+ if ( ( y2.operator < ( tmpZero ) ) || ( y2.operator > ( tmpOne ) ) )
+ {
+ y2 = tmpOne;
+ }
+#endif
+ iAnimTime->AddKeySplineL( x1, y1, x2, y2 );
+ }
+ }
+ else
+ {
+ iAnimTime->SetSplineValueL( aValue );
+ }
+ }
+ else if ( aName == KTmpAccumulate )
+ {
+ if ( aValue == _L( "sum" ) )
+ {
+ iAccumulate = KAccumSum;
+ }
+ }
+ else if ( aName == KTmpAdditive )
+ {
+ if ( aValue == _L( "sum" ) )
+ {
+ iAdditive = KAdditiveSum;
+ iAdditiveOrg = KAdditiveSum;
+ }
+ }
+ else
+ {
+ if ( this->SetTestAttributeL( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+ }
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// From CSvgElementImpl
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgAnimationBase::CloneL(MXmlElement*)
+ {
+ return NULL;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Animation specific common methods
+// ---------------------------------------------------------------------------
+TBool CSvgAnimationBase::ReceiveEventProcL( MSvgEvent* aEvent,
+ CSvgAnimationBase* aAnimElement )
+ {
+ if ( CSvgElementImpl::IsSVGEnginePaused() )
+ {
+ return EFalse;
+ }
+ TBool lGetTimerEvent = EFalse;
+ TInt32 lEngineTime =0;
+
+ TInt32 lCurTime = ((CSvgDocumentImpl *)(iOwnerDocument))->CurrentTime();
+ // Check if target attribute is valid
+ if ( iAttrId == 0xffff )
+ {
+ ((CSvgDocumentImpl*)iOwnerDocument)->RemoveFromEventReceiverList(this );
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->UpdatePresentation(1);
+ return EFalse;
+ }
+
+ if ( !iInitDone )
+ {
+ iInitDone = ETrue;
+ aAnimElement->InitAnimationL();
+ if ( aAnimElement->iTargetElement == NULL )
+ {
+ return EFalse;
+ }
+ ((CSvgDocumentImpl*)iOwnerDocument)->AddEventBeginTime( aAnimElement, iAbsoluteBeginTime, aAnimElement->iTargetElement );
+ }
+ else if ( aAnimElement->iTargetElement == NULL )
+ {
+ return EFalse;
+ }
+
+ // select event type
+ switch ( aEvent->EventType() )
+ {
+ case ESvgEngineEventTimerPrep :
+ return EFalse;
+
+
+ case ESvgEngineInternalEvent:
+ {
+ MSvgInternalEvent* event = ( MSvgInternalEvent* ) aEvent;
+ CSvgElementImpl* leventElement = (CSvgElementImpl*) ( event->ObjectAddress() );
+
+ CSvgAnimationBase* ltargetElement = (CSvgAnimationBase*)event->ObjectAddress();
+ TInt i;
+ TInt lCount = iEventList->Count();
+
+ if (event->SvgEvent() == ESvgEventRepeatEvent )
+ {
+ CSvgElementImpl* lElement = event->ObjectAddress();
+
+ if (lElement)
+ {
+ // NotifyAnimationsRepeatingOnThisOneL( lElement->Id(), ltargetElement);
+ }
+
+ }
+
+ for (i = 0; i < lCount; i++ )
+ {
+ if ( (iEventList->operator[](i)).iEvent != ESvgEventNone &&
+ (iEventList->operator[](i)).iEvent == event->SvgEvent() )
+ {
+ if ( leventElement == (iEventList->operator[](i)).iTargetElement )
+ {
+ switch(event->SvgEvent())
+ {
+ case ESvgEventRepeatEvent:
+ // Check whether the target element has repeated as many times
+ // as is defined for the begin of this element.
+ if ( ltargetElement->iCurrentRepeatCount == (TInt32) (iEventList->operator[](i)).iRepeatValue )
+ {
+ TReal32 lFractionalTime = (iEventList->operator[](i)).iRepeatValue - ((TInt32) (iEventList->operator[](i)).iRepeatValue);
+
+ SetBeginByEventL( aAnimElement,
+ (TInt32) (lCurTime +
+ (iEventList->operator[](i)).iOffset +
+ ltargetElement->Duration()*lFractionalTime), ETrue);
+
+ // Get THhe Engine's Current Media Time.
+ lEngineTime = ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->CurrentTIme();
+
+ // calculate the start time.
+ TInt32 lStartTimeForThis = (TInt32) (lCurTime +
+ (iEventList->operator[](i)).iOffset +
+ ltargetElement->Duration()*lFractionalTime) ;
+
+ //compare BOTH.
+ if(lStartTimeForThis <= lEngineTime )
+ {
+ // indicates that this element should get the last timer
+ // event.
+ lGetTimerEvent = ETrue;
+ }
+
+ }
+ break;
+
+ default :
+ {
+
+ SetBeginByEventL( aAnimElement, lCurTime + (iEventList->operator[](i)).iOffset , ETrue);
+ // calculate the start time.
+ TInt32 lStartTimeForThis = (lCurTime + (iEventList->operator[](i)).iOffset ) ;
+
+ // see the Engine's Current media time.
+ lEngineTime = ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->CurrentTIme();
+
+ // Compare BOTH.
+ /* if(lStartTimeForThis <= lEngineTime )
+ {
+ // indicates that this element should get the last timer
+ // event.
+ lGetTimerEvent = ETrue;
+ }*/
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ TInt lCount2 = iEndTimeList->Count();
+ for (i = 0; i < lCount2; i++ )
+ {
+
+ if ( (iEndTimeList->operator[](i)).iEvent != ESvgEventNone &&
+ (iEndTimeList->operator[](i)).iEvent == event->SvgEvent() )
+ {
+ if ( leventElement == (iEndTimeList->operator[](i)).iTargetElement )
+ {
+ switch(event->SvgEvent())
+ {
+ case ESvgEventRepeatEvent:
+ if ( ltargetElement->iCurrentRepeatCount == (TInt32) (iEndTimeList->operator[](i)).iRepeatValue )
+ {
+ TReal32 lFractionalTime = (iEndTimeList->operator[](i)).iRepeatValue - ((TInt32) (iEndTimeList->operator[](i)).iRepeatValue);
+
+ SetEndByEvent( aAnimElement,
+ (TInt32) (lCurTime +
+ (iEndTimeList->operator[](i)).iOffset +
+ ltargetElement->Duration()*lFractionalTime) );
+
+ }
+ break;
+
+ default :
+ {
+ SetEndByEvent( aAnimElement, lCurTime + (iEndTimeList->operator[](i)).iOffset );
+ }
+ break;
+ }
+ }
+ }
+
+ }
+
+ }
+ if(lGetTimerEvent)
+ {
+ // NO return this means that the Element should get the Last timer event.
+ break;
+ }
+ else
+ {
+ // this should not get the last timer event.
+ return EFalse;
+ }
+
+
+ case ESvgEngineEventKeyPress:
+ {
+ MSvgUiKeyEvent* event = ( MSvgUiKeyEvent* ) aEvent;
+ TInt i;
+
+ TInt lCount = iEventList->Count();
+ for (i = 0; i < lCount; i++ )
+ {
+
+ if ( (iEventList->operator[](i)).iEvent == ESvgEventKey &&
+ (iEventList->operator[](i)).iAccessKeyCode == event->KeyCode() )
+ {
+ SetBeginByEventL( aAnimElement, lCurTime + (iEventList->operator[](i)).iOffset, ETrue );
+ }
+ }
+ TInt lEndTimesCount = iEndTimeList->Count();
+ for (i = 0; i < lEndTimesCount; i++ )
+ {
+ if ( (iEndTimeList->operator[](i)).iEvent == ESvgEventKey &&
+ (iEndTimeList->operator[](i)).iAccessKeyCode == event->KeyCode() )
+ {
+ SetEndByEvent( aAnimElement, lCurTime + (iEndTimeList->operator[](i)).iOffset );
+ }
+ }
+
+ }
+ return EFalse;
+
+
+ case ESvgEngineEventTimer:
+ break;
+
+ default:
+ // mouse event is ignored here
+ return EFalse;
+ }
+
+
+ // Only timer event come thorugh after here
+ TSvgTimerEvent* timerEvent = ( TSvgTimerEvent* ) aEvent;
+ TSvgTimerEvent lLastEventTime(lEngineTime);
+
+ // this is treated as
+ if(lGetTimerEvent)
+ {
+ // send the last timer event.
+ timerEvent = &lLastEventTime;
+ }
+
+ // if( (!iOverrideTime) )
+ {
+ // This condition would not be satisfied for animations having one begin time
+ // E.g begin='5s' moves on to check if iAnimStatus is NotActive
+ if ( (iBeginTimeIndex+1 < iAnimTime->BeginTimesCount() ) && ( timerEvent->Time() >= iAnimTime->GetBeginTime( iBeginTimeIndex + 1 )))
+ {
+
+ if ( iAnimRestart == KRestartWhenNotActive && iAnimStatus == KAnimActive )
+ {
+ return ETrue; // Not start when active and restart="whenNotActive"
+ }
+ if ( iAnimRestart == KRestartNever && iHadBegun )
+ {
+ return ETrue; // Not start when anim had begun and if restart="never"
+ }
+ iBeginTimeIndex++;
+ iAnimTime->SetBeginTime( iAnimTime->GetBeginTime( iBeginTimeIndex ));
+ // added for setting proper end time
+ iAbsoluteBeginTime= iAnimTime->GetBeginTime( iBeginTimeIndex );
+ iAnimStatus = KAnimNotActive;
+
+ if (iTargetElement)
+ {
+ iTargetElement->iHasAnimationBase = (TInt)this;
+ iTargetElement->SetIsAnimating( EFalse );
+ SetIsAnimating( EFalse );
+ }
+ iAnimTime->GetNextEndTime(iAnimTime->BeginTime());
+
+ TUint32 lSimpleDur= SimpleDuration();
+ if(lSimpleDur != KTimeIndefinite)
+ {
+ iAnimTime->SetEndTime( lSimpleDur );
+ }
+
+ // in case of multiple begin times we need to sort the list again.
+ ((CSvgDocumentImpl*)iOwnerDocument)->iInitSortList=ETrue;
+ }
+ }
+
+ if ( iAnimStatus == KAnimNotActive )
+ {
+ // Animation element becomes active only if current time exceeds
+ // the anim's begin time and its duration is not indefinite
+ if ( timerEvent->Time() >= iAnimTime->BeginTime() )
+ {
+ // iHasEnded = EFalse;
+ // start animation
+ iAnimStatus = KAnimActive;
+ iDoFreeze = EFalse;
+ if (iTargetElement)
+ {
+ iTargetElement->iHasAnimationBase = (TInt)this;
+ iTargetElement->SetIsAnimating( ETrue );
+ SetIsAnimating( ETrue );
+ }
+ if ((this->ElemID() == KSvgAnimateElement) ||
+ (this->ElemID() == KSvgAudioElement) ||
+ (this->ElemID() == KSvgMediaAnimationElement ))
+ {
+ // this will be used to calculate the from values again
+ iHadBegun = EFalse;
+ }
+ else
+ {
+ iHadBegun = ETrue;
+ }
+ iAdditive = iAdditiveOrg;
+ iCurrentRepeatCount= 0;
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->NotifyAnimationStarted();
+
+ //Triggers internal begin event so that animations dependent on this would get the events
+ TSvgInternalEvent event ( ESvgEventBeginEvent, this,iAnimTime->BeginTime() );
+
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->ProcessEventL(
+ ( CSvgDocumentImpl* ) OwnerDocument(), &event );
+
+ }
+ else
+ {
+ iAdditive = KAdditivePass;
+ }
+ }
+
+ if ( iAnimStatus == KAnimActive )
+ {
+ // if end time less than the simple duration
+
+ // DurationTime() shall return the duration set in svg
+ // E.g begin="0s" dur="10s" repeatCount='3' returns DurationTime() 10000,
+ // repeating of the animation would be handled while checking done
+ // before setting iAnimStatus to KAnimFinished. (see if ( iAnimStatus == KAnimEnd ))
+ if ( iAnimTime->DurationTime() != KTimeIndefinite
+ && timerEvent->Time() >= iAnimTime->BeginTime() + iAnimTime->DurationTime() )
+ {
+ // end animation
+ iAnimStatus = KAnimEnd;
+ if (iTargetElement)
+ {
+ iTargetElement->iHasAnimationBase = (TInt)this;
+ iTargetElement->SetIsAnimating( EFalse );
+ SetIsAnimating( EFalse );
+
+ }
+ }
+ // any endtime got from simpleDuration, EndTime values in svg content, event based endtimes
+ // E.g begin="0s" dur="10s" repeatCount='3' returns EndTime() 30000,
+ if ( timerEvent->Time() >= iAnimTime->EndTime() )
+ {
+ // end animation
+ iAnimStatus = KAnimEnd;
+ if (iTargetElement)
+ {
+ iTargetElement->iHasAnimationBase = (TInt)this;
+ iTargetElement->SetIsAnimating( EFalse );
+ SetIsAnimating( EFalse );
+ }
+ }
+
+ }
+
+ if ( iAnimStatus == KAnimEnd )
+ {
+
+ //Check if animation is finished
+ // Check 1. repeatcount reached
+ // 2. Repeatduration valid and reached
+ // 3. Endtime reached
+ if (( ( iCurrentRepeatCount >= iRepeatCount )||
+
+ ( ( iAnimTime->RepeatDurationTime() != KTimeIndefinite )&&
+ ( iRepeatCount == KRepeatCountMax )&&
+ ( timerEvent->Time() >= iAbsoluteBeginTime + iAnimTime->RepeatDurationTime() ) ) )
+
+ || timerEvent->Time() >= iAnimTime->EndTime()
+ )
+ {
+ iEndTimeIndex++;
+ TInt32 LEndTIme = lCurTime;
+
+ iAnimTime->SetEndTime(KTimeIndefinite);
+ iAnimStatus = KAnimFinished;
+
+ if (iTargetElement)
+ {
+ iTargetElement->iHasAnimationBase = (TInt)this;
+ iTargetElement->SetIsAnimating( EFalse );
+ SetIsAnimating( EFalse );
+ }
+
+ iOverrideTime = EFalse;
+
+ // if its begin depends on its end than it might create a problem.
+ if(!iIsEndEventSent || IsSelfDependentForBegin())
+ {
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->NotifyAnimationEnded();
+ TSvgInternalEvent event ( ESvgEventEndEvent, this,LEndTIme );
+ TSvgInternalEvent event1 ( ESvgEventRepeatEvent, this,LEndTIme );
+ //repeatCount Event is also generated
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->ProcessEventL(
+ ( CSvgDocumentImpl* ) OwnerDocument(), &event1 );
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->ProcessEventL(
+ ( CSvgDocumentImpl* ) OwnerDocument(), &event );
+ // Update presentation should be called only if the animation gets finished
+ // Check for the multiple begin values to make sure that the animation ended completely.
+ if ( (iBeginTimeIndex+1 >= iAnimTime->BeginTimesCount() ) || ( iAnimTime->GetBeginTime( iBeginTimeIndex + 1 ) <= timerEvent->Time()))
+ {
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->UpdatePresentation(1);
+ }
+ return ETrue; // so that draw happens if begin depends on its own end event
+ }
+ else
+ {
+ iIsEndEventSent = EFalse;
+ }
+
+ }
+
+ else
+ {
+ // E.g begin="0s" dur="10s" repeatCount='3'
+ //in such case if curtime < 30s and iAnimStatus is End then animation would repeat
+ iCurrentRepeatCount++;
+ if ( iAccumulate == KAccumSum )
+ {
+ aAnimElement->SetAccumulateValues();
+ }
+ aAnimElement->ResetAnimationL();
+ iAnimTime->ResetBeginTime( iAnimTime->BeginTime() +
+ iAnimTime->DurationTime() );
+ iAnimStatus = KAnimActive;
+
+ if (iTargetElement)
+ {
+ iTargetElement->iHasAnimationBase = (TInt)this;
+ iTargetElement->SetIsAnimating( ETrue );
+ SetIsAnimating( ETrue );
+ }
+
+ iOverrideTime = EFalse;
+ // Generates repeatEvent
+ //Triggers internal repeat event so that animations dependent on this would get the events
+
+ TInt32 lRepeatTime = iAbsoluteBeginTime + iCurrentRepeatCount*iAnimTime->DurationTime();
+
+ TSvgInternalEvent event ( ESvgEventRepeatEvent, this,lRepeatTime );
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->ProcessEventL(
+ ( CSvgDocumentImpl* ) OwnerDocument(), &event );
+ }
+ }
+
+ // do not redraw.
+ if(iAnimStatus == KAnimNotActive || (iAnimStatus == KAnimFinished && iDoFreeze))
+ {
+ // this will avoid going in to the draw again.
+ return EFalse;
+ }
+ return ETrue;
+
+ }
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimationBase::SetFillValueL()
+ {
+ switch ( iDataType )
+ {
+ case KSvgTypeOpacity:
+ case KSvgTypeLength:
+ iTargetElement->GetAttributeFloat( iAttrId, iPropFloat );
+ if ( ( iFill == KAnimFillFreeze ) && iNoFrom )
+ {
+ iFromFloat = iPropFloat;
+ }
+ break;
+
+ case KSvgTypeList:
+ case KSvgTypePath:
+ break;
+
+ case KSvgTypeColor:
+ if ( iAttributeFlag && !iCurrentRepeatCount )
+ {
+ iTargetElement->GetAttributeIntL( iAttrId, iPropInt );
+
+ }
+ break;
+ case KSvgTypeTextAnchor:
+ case KSvgTypeGradientUnits:
+ case KSvgTypeSpreadMethod:
+ case KSvgTypeInteger:
+ case KSvgTypeDisplay:
+ case KSvgTypeVisibility:
+ if ( iAttributeFlag )
+ {
+ iTargetElement->GetAttributeIntL( iAttrId, iPropInt );
+ }
+ break;
+
+ // viewBox
+ case KSvgTypeViewBox:
+ {
+ if(iTargetElement->ElemID() == KSvgSvgElement)
+ {
+ ((CSvgSvgElementImpl*)iTargetElement)->GetViewBox( iOrgViewBox );
+ if ( ( iFill == KAnimFillFreeze ) && iNoFrom )
+ {
+ iFromViewBox = iOrgViewBox;
+ }
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimationBase::SetToOriginalL()
+ {
+ switch ( iDataType )
+ {
+ case KSvgTypeOpacity:
+ case KSvgTypeLength:
+ iTargetElement->SetAttributeFloatL( iAttrId, iPropFloat );
+ break;
+ case KSvgTypeList:
+ case KSvgTypePath:
+ iTargetElement->SetAttributePathL( iAttrId, iOrgPath );
+ break;
+ case KSvgTypeTextAnchor:
+ case KSvgTypeGradientUnits:
+ case KSvgTypeSpreadMethod:
+ case KSvgTypeColor:
+ case KSvgTypeInteger:
+ case KSvgTypeDisplay:
+ case KSvgTypeVisibility:
+ if ( iAttributeFlag )
+ {
+ iTargetElement->SetAttributeIntL( iAttrId, iPropInt );
+ }
+ break;
+
+ //viewBox
+ case KSvgTypeViewBox:
+ {
+ if(iTargetElement->ElemID() == KSvgSvgElement)
+ {
+ ((CSvgSvgElementImpl*)iTargetElement)->SetViewBoxL( iOrgViewBox );
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimationBase::SetToInitialValueL()
+ {
+ switch ( iDataType )
+ {
+ case KSvgTypeOpacity:
+ case KSvgTypeLength:
+ iTargetElement->SetAttributeFloatL( iAttrId, iPropFloat );
+ break;
+ case KSvgTypeList:
+ case KSvgTypePath:
+ iTargetElement->SetAttributePathL( iAttrId, iOrgPath );
+ break;
+ case KSvgTypeColor:
+ if ( iAttributeFlag )
+ {
+ iTargetElement->SetAttributeIntL( iAttrId, iPropInt );
+ }
+ else
+ {
+ if( iAttrId == KCSS_ATTR_VISIBILITY ||
+ iAttrId == KCSS_ATTR_FILL ||
+ iAttrId == KCSS_ATTR_STROKE )
+ {
+ iTargetElement->RemoveAttribute(iAttrId);
+ }
+
+ }
+ break;
+ case KSvgTypeTextAnchor:
+ case KSvgTypeGradientUnits:
+ case KSvgTypeSpreadMethod:
+ case KSvgTypeInteger:
+ case KSvgTypeDisplay:
+ case KSvgTypeVisibility:
+ if ( iAttributeFlag )
+ {
+ iTargetElement->SetAttributeIntL( iAttrId, iPropInt );
+ }
+ else
+ {
+ if( iAttrId == KCSS_ATTR_VISIBILITY ||
+ iAttrId == KCSS_ATTR_FILL ||
+ iAttrId == KCSS_ATTR_STROKE )
+ {
+ iTargetElement->RemoveAttribute(iAttrId);
+ }
+
+ }
+ break;
+
+ //viewBox
+ case KSvgTypeViewBox:
+ {
+ if(iTargetElement->ElemID() == KSvgSvgElement)
+ {
+ ((CSvgSvgElementImpl*)iTargetElement)->SetViewBoxL( iOrgViewBox );
+ }
+ }
+ break;
+
+ default:
+ ;
+ }
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimationBase::SetToEndValueL()
+ {
+ switch ( iDataType )
+ {
+ case KSvgTypeOpacity:
+ case KSvgTypeLength:
+ if( iAdditive == KAdditiveSum && !iNoFrom && (this->ElemID() == KSvgAnimateElement ))
+ {
+ TFloatFixPt lCurValue;
+ iTargetElement->GetAttributeFloat( iAttrId, lCurValue );
+ iTargetElement->SetAttributeFloatL(iAttrId, lCurValue + iEndFloat );
+ }
+ else
+ {
+ iTargetElement->SetAttributeFloatL( iAttrId, iEndFloat );
+ }
+ break;
+ case KSvgTypeList:
+ case KSvgTypePath:
+ {
+ iTargetElement->SetAttributePathL( iAttrId, iEndPath );
+ }
+ break;
+ case KSvgTypeTextAnchor:
+ case KSvgTypeGradientUnits:
+ case KSvgTypeSpreadMethod:
+ case KSvgTypeInteger:
+ case KSvgTypeDisplay:
+ case KSvgTypeVisibility:
+ {
+ if ( iAttributeFlag )
+ {
+ iTargetElement->SetAttributeIntL( iAttrId, iEndInt );
+ }
+ }
+ break;
+
+ case KSvgTypeColor:
+ {
+ // fix for accum_addit_7
+ if( iAttributeFlag )
+ {
+ if( iAdditive == KAdditiveSum && !iNoFrom )
+ {
+
+ TInt32 lCurValue;
+ iTargetElement->GetAttributeIntL( iAttrId, lCurValue );
+
+
+ lCurValue = AddColor( iEndInt, lCurValue );
+ iTargetElement->SetAttributeIntL( iAttrId, lCurValue );
+ }
+
+ else
+ {
+ iTargetElement->SetAttributeIntL( iAttrId, iEndInt );
+ }
+ }
+ }
+ break;
+
+ //viewBox
+ case KSvgTypeViewBox:
+ {
+ if( iAdditive == KAdditiveSum && !iNoFrom && (this->ElemID() == KSvgAnimateElement ))
+ {
+ TGfxRectangle2D lCurValue;
+ if(iTargetElement->ElemID() == KSvgSvgElement)
+ {
+ ((CSvgSvgElementImpl*)iTargetElement)->GetViewBox( lCurValue );
+ }
+
+ lCurValue.iX += iEndViewBox.iX ;
+ lCurValue.iY += iEndViewBox.iY ;
+ lCurValue.iWidth += iEndViewBox.iWidth ;
+ lCurValue.iHeight += iEndViewBox.iHeight ;
+
+
+ // set the vlue to the target element.
+ if(iTargetElement->ElemID() == KSvgSvgElement)
+ {
+ ((CSvgSvgElementImpl*)iTargetElement)->SetViewBoxL( lCurValue );
+ }
+ }
+
+ else
+ {
+ if(iTargetElement->ElemID() == KSvgSvgElement)
+ {
+ ((CSvgSvgElementImpl*)iTargetElement)->SetViewBoxL( iEndViewBox );
+ }
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+
+
+// ---------------------------------------------------------------------------
+// Initialization before start of animation
+// ---------------------------------------------------------------------------
+void CSvgAnimationBase::InitAnimationL()
+ {
+ // 1. Create keytimes if no keytime but values available
+ // 2. Set animation time according to calcMode
+ //
+ // Also, add target element to event receiver list for mouse event
+ //Set the First Begin Time
+
+
+
+ if( iAnimTime->BeginTimesCount() > 0 )
+ {
+ iAnimTime->SetBeginTime( iAnimTime->GetBeginTime(0));
+ iAbsoluteBeginTime = iAnimTime->GetBeginTime(0);
+ }
+
+
+ if( iAnimTime->RepeatDurationTime() != KTimeIndefinite )
+ {
+ iAnimTime->CalculateAnimTimes();
+ }
+
+
+
+
+ iOverrideTime = ETrue;
+
+ switch ( iDataType )
+ {
+ case KSvgTypeOpacity:
+ case KSvgTypeLength:
+ if ( iNoFrom )
+ {
+ iOrgFromFloat = iFromFloat = iPropFloat;
+ }
+ iAnimTime->CreateKeyTime( iValuesFloat->Count() );
+ iAnimTime->PrepareTimeL( iValuesFloat );
+ break;
+ case KSvgTypeList:
+ case KSvgTypePath:
+ {
+
+ if ( iOrgFromPath )
+ {
+ delete iOrgFromPath;
+ iOrgFromPath = NULL;
+ }
+ iOrgFromPath = CGfxGeneralPath::NewL();
+
+ CGfxGeneralPath* parentPath = NULL;
+ iTargetElement->GetAttributePath( iAttrId, parentPath );
+ CGfxPathIterator* itr;
+ TGfxAffineTransform affineTransform;
+
+ if (parentPath != NULL)
+ {
+ parentPath->GetPathIteratorL( &affineTransform, itr );
+ CleanupStack::PushL( itr );
+
+ iOrgFromPath->AppendL( itr );
+ CleanupStack::PopAndDestroy( 1 ); // destroy itr
+ }
+ // Set keytime
+
+ iValuesFloat->Reset();
+ TInt lCount = iValuesPath->Count();
+ for ( TInt i = 0; i < lCount ; i++ )
+ {
+ User::LeaveIfError(iValuesFloat->Append( TFloatFixPt( i ) )); // create dummy scalar array
+ }
+ iAnimTime->CreateKeyTime( iValuesFloat->Count() );
+ iAnimTime->PrepareTimeL( iValuesFloat );
+ }
+ break;
+
+ case KSvgTypeColor:
+ {
+ // Set keytime
+ iValuesFloat->Reset();
+ // Compute the colour distance in iValuesFloat
+ FindColorDistanceL();
+ iAnimTime->CreateKeyTime( iValuesFloat->Count() );
+ iAnimTime->PrepareTimeL( iValuesFloat );
+ }
+ break;
+ case KSvgTypeTextAnchor:
+ case KSvgTypeGradientUnits:
+ case KSvgTypeSpreadMethod:
+ case KSvgTypeVisibility:
+ case KSvgTypeDisplay:
+ case KSvgTypeInteger:
+ iAnimTime->CreateKeyTimeForEnumeration( iValuesInt->Count() );
+ iAnimTime->PrepareTimeL( ( RArray<TFloatFixPt>* ) iValuesInt );
+ break;
+
+ // viewBox
+ case KSvgTypeViewBox:
+ {
+ if ( iNoFrom )
+ {
+ iOrgFromViewBox = iFromViewBox = iOrgViewBox;
+ }
+ // Set keytime
+ iValuesFloat->Reset();
+ TInt lCount = iValuesViewBox->Count();
+ for ( TInt i = 0; i < lCount ; i++ )
+ User::LeaveIfError(iValuesFloat->Append( TFloatFixPt( i ) )); // create dummy scalar array
+ iAnimTime->CreateKeyTime( iValuesFloat->Count() );
+ iAnimTime->PrepareTimeL( iValuesFloat );
+ }
+ break;
+
+ default:
+ // Text
+ break;
+ }
+
+ TUint32 lSimpleDuration = SimpleDuration();
+ if( lSimpleDuration != KTimeIndefinite)
+ {
+ iAnimTime->SetEndTime(lSimpleDuration);
+ iAnimTime->SetModifiedEndTime(lSimpleDuration);
+ }
+
+ if(this->ElemID() == KSvgAnimateColorElement)
+
+ {
+
+ // this Is to check that the animateColor is not applied to anything
+ // other than color.
+
+ switch(iDataType )
+ {
+ case KSvgTypeColor:
+ break;
+ default :
+ ((CSvgDocumentImpl*)iOwnerDocument)->RemoveFromEventReceiverList(this );
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->UpdatePresentation(1);
+ break;
+ }
+
+ }
+
+ // Add to event receiver list
+ // Also need to look end event...
+ CSvgElementImpl* targetElement = NULL;
+
+
+ // this is for forward reference.
+ // first find the count this can be more than one
+ // for multiple BeginTimes.
+ TInt lCount = iEventList->Count();
+ for (TInt i=0; i< lCount; i++)
+ {
+
+ if ( (iEventList->operator[](i)).iTargetElement != NULL )
+ {
+ ((CSvgDocumentImpl*)iOwnerDocument)->AddToEventReceiverListL(
+ (iEventList->operator[](i)).iTargetElement,
+ (iEventList->operator[](i)).iEvent,
+ KSvgEventMaskExternalUI );
+ }
+
+ // check that this is not NULL;
+ // NULL means Begin time is absolute.
+ if(iEventList->operator[](i).iReferenceElemeId != NULL)
+ {
+
+ // find the element.
+ targetElement = ( CSvgElementImpl * )
+ ((CSvgDocumentImpl*)iOwnerDocument)->GetElementById(
+ iEventList->operator[](i).iReferenceElemeId->Des());
+ if(targetElement != NULL)
+ {
+
+ // Add to Event receiver list.
+ ((CSvgDocumentImpl*)iOwnerDocument)->AddToEventReceiverListL(
+ targetElement ,(iEventList->operator[](i)).iEvent, KSvgEventMaskExternalUI );
+
+ // update the pointer to the target element.
+ iEventList->operator[](i).iTargetElement = targetElement;
+ iTargetElement->iHasAnimationBase = (TInt)this;
+ }
+
+ delete iEventList->operator[](i).iReferenceElemeId;
+ iEventList->operator[](i).iReferenceElemeId = NULL;
+
+ }
+
+ }
+
+ // add the end sync element so that it receives mouse events
+
+ if( iEndTimeList->Count() > 0 )
+ {
+
+ // this is for forward reference.
+ // first find the count this can be more than one
+ // for multiple BeginTimes.
+ TInt lCount2 = iEndTimeList->Count();
+ for (TInt i=0; i< lCount2; i++)
+ {
+
+ if ( (iEndTimeList->operator[](i)).iTargetElement != NULL )
+ {
+ ((CSvgDocumentImpl*)iOwnerDocument)->AddToEventReceiverListL(
+ (iEndTimeList->operator[](i)).iTargetElement,
+ (iEndTimeList->operator[](i)).iEvent,
+ KSvgEventMaskExternalUI );
+ }
+
+ // check that this is not NULL;
+ // NULL means Begin time is absolute.
+ if(iEndTimeList->operator[](i).iReferenceElemeId != NULL)
+ {
+
+ // find the element.
+ targetElement = ( CSvgElementImpl * )
+ ((CSvgDocumentImpl*)iOwnerDocument)->GetElementById(
+ iEndTimeList->operator[](i).iReferenceElemeId->Des());
+ if(targetElement != NULL)
+ {
+
+ // Add to Event receiver list.
+ ((CSvgDocumentImpl*)iOwnerDocument)->AddToEventReceiverListL(
+ targetElement ,
+ (iEndTimeList->operator[](0)).iEvent,
+ KSvgEventMaskExternalUI );
+
+ // update the pointer to the target element.
+ iEndTimeList->operator[](i).iTargetElement = targetElement;
+ iTargetElement->iHasAnimationBase = (TInt)this;
+ }
+
+ delete iEndTimeList->operator[](i).iReferenceElemeId;
+ iEndTimeList->operator[](i).iReferenceElemeId = NULL;
+
+ }
+
+ }
+
+ }
+
+ }
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimationBase::SetAccumulateValues()
+ {
+ /* switch ( iDataType )
+ {
+ case KSvgTypeOpacity:
+ case KSvgTypeLength:
+ case KSvgTypeList:
+ case KSvgTypePath:
+ break;
+
+ case KSvgTypeColor:
+ break;
+
+ case KSvgTypeInteger:
+ break;
+
+ default:
+ // Descriptor
+ ;
+ }*/
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgAnimationBase::IsElementAttrs( const TDesC& aAttrName )
+ {
+ TInt pos = ((CSvgDocumentImpl*)iOwnerDocument)->SchemaData()->GetSVGTAttributeId(aAttrName);
+
+ if ( pos == KErrNotFound)
+ {
+ // Did not find the attribute name
+ return EFalse;
+ }
+ else
+ {
+ iAttrId= (TUint16) pos;
+ if(iAttrId <= KSvgCoordAttrEndIndex || iAttrId == KAtrFy || iAttrId == KAtrFx )
+ {
+ iDataType = KSvgTypeLength;
+ }
+ else
+ {
+ switch(iAttrId)
+ {
+ case KAtrGradientUnits:
+ iDataType = KSvgTypeGradientUnits;
+ break;
+ case KAtrSpreadMethods:
+ iDataType = KSvgTypeSpreadMethod;
+ break;
+
+ case KAtrStopColor:
+ iDataType= KSvgTypeColor;
+ break;
+
+ case KAtrPoints:
+ case KAtrD:
+ iDataType = KSvgTypePath;
+ break;
+
+ case KAtrOffset: // Always need to be between 0 - 1 , thus treating same as opacity.
+ case KAtrStopOpacity:
+ iDataType= KSvgTypeOpacity;
+ break;
+
+ case KAtrViewBox:
+ iDataType= KSvgTypeViewBox;
+ break;
+
+ default:
+ return EFalse;
+ }
+ }
+ }
+
+ return ETrue;
+ }
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgAnimationBase::IsPresentationAttrs( const TDesC& aAttrName )
+ {
+ TInt ret;
+ ret = ((CSvgDocumentImpl*)iOwnerDocument)->SchemaData()->GetPresentationAttributeId( aAttrName);
+ if ( ret == KErrNotFound )
+ {
+ // Did not find the attribute name
+ return EFalse;
+ }
+ else
+ {
+ switch ( ret )
+ {
+ case KCSS_ATTR_FILL:
+ // fill
+ iAttrId = KCSS_ATTR_FILL;
+ iDataType = KSvgTypeColor;
+ break;
+ case KCSS_ATTR_STROKE:
+ // stroke
+ iAttrId = KCSS_ATTR_STROKE;
+ iDataType = KSvgTypeColor;
+ break;
+ case KCSS_ATTR_STROKEWIDTH:
+ // stroke-width
+ iAttrId = KCSS_ATTR_STROKEWIDTH;
+ iDataType = KSvgTypeLength;
+ break;
+ case KCSS_ATTR_STROKE_DASHOFFSET:
+ iAttrId = KCSS_ATTR_STROKE_DASHOFFSET;
+ iDataType = KSvgTypeLength;
+ break;
+ case KCSS_ATTR_VISIBILITY:
+ // visibility
+ iAttrId = KCSS_ATTR_VISIBILITY;
+ iDataType = KSvgTypeVisibility;
+ break;
+ case KCSS_ATTR_COLOR:
+ // color
+ iAttrId = KCSS_ATTR_COLOR;
+ iDataType = KSvgTypeColor;
+ break;
+ case KCSS_ATTR_FONTSIZE:
+ // font-size
+ iAttrId = KCSS_ATTR_FONTSIZE;
+ iDataType = KSvgTypeLength;
+ break;
+ case KCSS_ATTR_DISPLAY:
+ // display
+ iAttrId = KCSS_ATTR_DISPLAY;
+ iDataType = KSvgTypeDisplay;
+ break;
+ case KCSS_ATTR_TEXTANCHOR:
+ iAttrId = KCSS_ATTR_TEXTANCHOR;
+ iDataType = KSvgTypeTextAnchor;
+ break;
+ case KCSS_ATTR_FILL_OPACITY:
+ iAttrId = KCSS_ATTR_FILL_OPACITY;
+ iDataType = KSvgTypeOpacity;
+ break;
+ case KCSS_ATTR_STROKE_OPACITY:
+ iAttrId = KCSS_ATTR_STROKE_OPACITY;
+ iDataType = KSvgTypeOpacity;
+ break;
+ case KCSS_ATTR_GROUP_OPACITY:
+ iAttrId = KCSS_ATTR_GROUP_OPACITY;
+ iDataType = KSvgTypeOpacity;
+ break;
+ default:
+ break;
+ }
+
+ }
+
+ return ETrue;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimationBase::GetAttrValueL()
+ {
+ iAttributeFlag = 1;
+ switch ( iDataType )
+ {
+ case KSvgTypeLength:
+ case KSvgTypeNumber:
+ iTargetElement->GetAttributeFloat( iAttrId, iPropFloat );
+ iTargetElement->GetAttributeFloat( iAttrId, iOrgFloat );
+ break;
+ case KSvgTypeOpacity:
+ iTargetElement->GetAttributeFloat( iAttrId, iPropFloat );
+ iTargetElement->GetAttributeFloat( iAttrId, iOrgFloat );
+ break;
+ case KSvgTypeList:
+ case KSvgTypePath:
+ {
+ // copy parent -> iOrgPath
+ CGfxGeneralPath*parentPath = NULL;
+
+ if ( iOrgPath )
+ {
+ delete iOrgPath;
+ iOrgPath = NULL;
+ }
+
+ if ( iEndPath )
+ {
+ delete iEndPath;
+ iEndPath = NULL;
+ }
+
+ iOrgPath = CGfxGeneralPath::NewL();
+ iEndPath = CGfxGeneralPath::NewL();
+
+ iTargetElement->GetAttributePath( iAttrId, parentPath );
+
+ if(parentPath != NULL)
+ {
+ CGfxPathIterator* itr;
+ TGfxAffineTransform affineTransform;
+ parentPath->GetPathIteratorL( &affineTransform, itr );
+ CleanupStack::PushL( itr );
+ iOrgPath->AppendL( itr );
+ CleanupStack::PopAndDestroy( 1 ); // destroy itr
+
+ iTargetElement->GetAttributePath( iAttrId, parentPath );
+ CGfxPathIterator* itr1;
+ TGfxAffineTransform affineTransform1;
+ parentPath->GetPathIteratorL( &affineTransform1, itr1 );
+ CleanupStack::PushL( itr1 );
+ iEndPath->AppendL( itr1 );
+ CleanupStack::PopAndDestroy( 1 ); // destroy itr
+ }
+ }
+ break;
+ case KSvgTypeColor:
+ {
+ TInt32 col;
+
+ if ( iTargetElement->GetAttributeIntL( iAttrId, col ) ==
+ KErrNoAttribute )
+ {
+ iPropInt = 0;
+ iAttributeFlag = 0;
+ }
+ else
+ {
+ // convert the color to openVG color
+ iPropInt = col;
+ iAttributeFlag = 1;
+ }
+ iTargetElement->GetAttributeIntL( iAttrId, iOrgInt );
+ }
+ break;
+ case KSvgTypeTextAnchor:
+ case KSvgTypeGradientUnits:
+ case KSvgTypeSpreadMethod:
+ case KSvgTypeInteger:
+ iTargetElement->GetAttributeIntL( iAttrId, iPropInt );
+ iTargetElement->GetAttributeIntL( iAttrId, iOrgInt );
+ break;
+ case KSvgTypeVisibility:
+ iTargetElement->GetAttributeIntL( iAttrId, iOrgInt );
+ if ( iTargetElement->GetAttributeIntL( iAttrId, iPropInt ) == KErrNoAttribute )
+ {
+ iPropInt = 0;
+ iAttributeFlag = 0;
+ }
+ else
+ {
+ iAttributeFlag = 1;
+ }
+ break;
+ case KSvgTypeDisplay:
+ iTargetElement->GetAttributeIntL( iAttrId, iPropInt );
+ iTargetElement->GetAttributeIntL( iAttrId, iOrgInt );
+ break;
+
+
+ // viewBox
+ case KSvgTypeViewBox:
+ {
+ if(iTargetElement->ElemID() == KSvgSvgElement)
+ {
+ ((CSvgSvgElementImpl*)iTargetElement)->GetViewBox( iOrgViewBox );
+ }
+ }
+ break;
+
+ default:
+ iTargetElement->GetAttributeIntL( iAttrId, iOrgInt );
+ iTargetElement->GetAttributeIntL( iAttrId, iPropInt );
+ break;
+ }
+ }
+
+
+void CSvgAnimationBase::ResetAttrValueL()
+ {
+
+ if (!iTargetElement)
+ {
+ return;
+ }
+
+ switch ( iDataType )
+ {
+ case KSvgTypeLength:
+ case KSvgTypeNumber:
+ iTargetElement->SetAttributeFloatL( iAttrId, iOrgFloat );
+ break;
+ case KSvgTypeOpacity:
+ iTargetElement->SetAttributeFloatL( iAttrId, iOrgFloat );
+ break;
+ case KSvgTypeColor:
+ iTargetElement->SetAttributeIntL( iAttrId, iOrgInt );
+ break;
+ case KSvgTypeTextAnchor:
+ case KSvgTypeGradientUnits:
+ case KSvgTypeSpreadMethod:
+ case KSvgTypeInteger:
+ iTargetElement->SetAttributeIntL( iAttrId, iOrgInt );
+ break;
+ case KSvgTypeVisibility:
+ iTargetElement->SetAttributeIntL( iAttrId, iOrgInt );
+ break;
+ case KSvgTypeDisplay:
+ iTargetElement->SetAttributeIntL( iAttrId, iOrgInt );
+ break;
+ default:
+ iTargetElement->SetAttributeIntL( iAttrId, iOrgInt );
+ break;
+ }
+ }
+
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimationBase::SetTarget( CSvgElementImpl* aTarget )
+ {
+ if (aTarget)
+ {
+ iTargetSet = ETrue;
+ // Before anything else set the target to parent
+ iTargetElement = aTarget;
+ iTargetElement->iHasAnimationBase = (TInt)this;
+ }
+ }
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimationBase::SetBeginByEventL( CSvgAnimationBase* aAnimElement,
+ TInt32 aBeginTime, TBool aAddTime )
+ {
+ if ( iAnimRestart == KRestartWhenNotActive && iAnimStatus == KAnimActive )
+ {
+ return; // Not start when active and restart="whenNotActive"
+ }
+ if ( iAnimRestart == KRestartNever && iHadBegun )
+ {
+ return; // Not start when anim had begun and if restart="never"
+ }
+
+
+ aAnimElement->ResetAnimationL();
+
+ if ( aAddTime )
+ {
+ iAnimTime->AddBeginTime( aBeginTime );
+ }
+ else
+ {
+ iAnimTime->ResetBeginTime( aBeginTime );
+ }
+
+ iAnimStatus = KAnimNotActive;
+
+ if (iTargetElement)
+ {
+ iTargetElement->iHasAnimationBase = (TInt)this;
+ iTargetElement->SetIsAnimating( EFalse );
+ SetIsAnimating( EFalse );
+ }
+ iOverrideTime = ETrue;
+ TInt32 lCurTime = ((CSvgDocumentImpl*)(iOwnerDocument))->CurrentTime();
+ iAnimTime->SetNextBeginTime(lCurTime);
+ iAbsoluteBeginTime = iAnimTime->BeginTime();
+
+ if(iAnimTime->GetOriginalEndTime() == KTimeIndefinite)
+ {
+ iAnimTime->SetEndTime(KTimeIndefinite);
+ }
+
+ TUint32 lSimpleDuration = SimpleDuration();
+ if( lSimpleDuration != KTimeIndefinite)
+ {
+ iAnimTime->SetEndTime(lSimpleDuration);
+ }
+
+ ((CSvgDocumentImpl*)iOwnerDocument)->AddEventBeginTime( aAnimElement, iAbsoluteBeginTime, aAnimElement->iTargetElement );
+ ((CSvgDocumentImpl*)iOwnerDocument)->iInitSortList=ETrue;
+
+
+ }
+
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAnimationBase::SetEndByEvent( CSvgAnimationBase* /* aAnimElement */,
+ TInt32 aEndTime )
+ {
+ iAnimTime->AddEndTime( aEndTime );
+
+ iAnimTime->GetNextEndTime(iAnimTime->BeginTime());
+ TUint32 lSimpleDur= SimpleDuration();
+ if(lSimpleDur != KTimeIndefinite)
+ {
+ iAnimTime->SetEndTime( lSimpleDur );
+ }
+
+ iIsEndEventSent = EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+// Blending methods aAlpha must be [0 - 255]
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgAnimationBase::BlendFloat( TInt32 aAlpha, TFloatFixPt aV1, TFloatFixPt aV2 )
+ {
+ #ifdef SVG_FLOAT_BUILD
+ TFloatFixPt percent = ((float)aAlpha)/255.0f;
+ TFloatFixPt percentValue = ( aV2 - aV1 ) * percent;
+ return aV1 + percentValue;
+ #else
+ TUint32 v1 = aV1.RawData() >> 8;
+ TUint32 v2 = aV2.RawData() >> 8;
+ return TFloatFixPt( BlendInt( aAlpha, v1, v2 ) << 8, ETrue );
+#endif
+ }
+
+// ---------------------------------------------------------------------------
+// Blending methods aAlpha must be [0 - 255]
+// ---------------------------------------------------------------------------
+TInt32 CSvgAnimationBase::BlendInt( TInt32 aAlpha, TInt32 aV1, TInt32 aV2 )
+ {
+ return ( (aV2 - aV1) * (((TReal32)aAlpha)/((TReal32)255)) ) + aV1 ;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TUint32 CSvgAnimationBase::BlendColor( TInt32 aAlpha, // Interpolation factor
+ // between [0-255]
+ TUint32 aV1, // Initial Colour value in RGB format
+ TUint32 aV2 ) // Final Colour value
+ {
+ TUint32 r, g, b;
+ TInt32 c1, c2;
+
+ // aAlpha is a value between 0-255 which indicates current interpolated
+ // value of the animation.
+ // Since colour value is divided by 256 (for optimisation - bit shift
+ // by 8 bits) alpha is set to 256 when it is 255.
+ if( 255 == aAlpha )
+ {
+ aAlpha = 256;
+ }
+
+ // Compute Red component
+ c1 = aV2 & KRmask;
+ c2 = aV1 & KRmask;
+ r = ( ( ( c1 - c2 ) * aAlpha + c2 * 256 ) >> 8 ) & KRmask;
+
+ // Compute Green Component
+ c1 = aV2 & KGmask;
+ c2 = aV1 & KGmask;
+ g = ( ( ( c1 - c2 ) * aAlpha + c2 * 256 ) >> 8 ) & KGmask;
+
+ // Compute Blue component
+ c1 = aV2 & KBmask;
+ c2 = aV1 & KBmask;
+ b = ( ( ( c1 - c2 ) * aAlpha + c2 * 256 ) >> 8 ) & KBmask;
+
+ // Combine r,g,b and return
+ return r | g | b;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TUint32 CSvgAnimationBase::AddColor( TUint32 aV1, TUint32 aV2 )
+ {
+ TInt32 r, g, b;
+ TInt32 r1, r2, g1, g2, b1, b2;
+ TUint sign1, sign2;
+
+ // WARNING, spare high order bits store sign of 8 bit components
+ // on input values only the use is limited in scope to
+ // SetAccumulateValues method
+ // return value is unsigned & clamped
+ // MSB better be blank for normal use
+
+ sign1 = (TInt32)( aV1 & 0xff000000) >> 24;
+ sign2 = (TInt32)( aV2 & 0xff000000) >> 24;
+ r1 = (aV1 & 0x00ff0000) >> 16;
+ r2 = (aV2 & 0x00ff0000) >> 16;
+ g1 = (aV1 & 0x0000ff00) >> 8;
+ g2 = (aV2 & 0x0000ff00) >> 8;
+ b1 = (aV1 & 0x000000ff);
+ b2 = (aV2 & 0x000000ff);
+
+ if(sign1 & 0x04)
+ {
+ r1 *= -1;
+ }
+ if(sign1 & 0x02)
+ {
+ g1 *= -1;
+ }
+ if(sign1 & 0x01)
+ {
+ b1 *= -1;
+ }
+ if(sign2 & 0x04)
+ {
+ r2 *= -1;
+ }
+ if(sign2 & 0x02)
+ {
+ g2 *= -1;
+ }
+ if(sign2 & 0x01)
+ {
+ b2 *= -1;
+ }
+
+ r = ( ( r1 + r2 ) );
+ g = ( ( g1 + g2 ) );
+ b = ( ( b1 + b2 ) );
+
+ // clamp for overflow & underflow
+ if ( r > 255 )
+ {
+ r = 255;
+ }
+ if ( g > 255 )
+ {
+ g = 255;
+ }
+ if ( b > 255 )
+ {
+ b = 255;
+ }
+
+ if ( r < 0 )
+ {
+ r = 0;
+ }
+ if ( g < 0 )
+ {
+ g = 0;
+ }
+
+ if ( b < 0 )
+ {
+ b = 0;
+ }
+ return ( ( ( r & 0xFF ) << 16 ) | ( ( g & 0xFF ) << 8 ) | ( b & 0xFF ) );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TUint32 CSvgAnimationBase::SubtractColor( TUint32 aV1, TUint32 aV2 )
+ {
+ TInt32 r, g, b;
+ TInt32 r1, r2, g1, g2, b1, b2;
+ TUint sign = 0x0;
+
+ // WARNING, spare high order bits store sign of 8 bit components
+ // the use is limited in scope to SetAccumulateValues method
+ // the commented code would handle signed input but this isn't
+ // used by calling code
+ // output components are not clamped
+ r1 = (aV1 & 0x00ff0000) >> 16;
+ r2 = (aV2 & 0x00ff0000) >> 16;
+ g1 = (aV1 & 0x0000ff00) >> 8;
+ g2 = (aV2 & 0x0000ff00) >> 8;
+ b1 = (aV1 & 0x000000ff);
+ b2 = (aV2 & 0x000000ff);
+
+ r = ( ( r1 - r2 ) );
+ g = ( ( g1 - g2 ) );
+ b = ( ( b1 - b2 ) );
+
+ if ( r < 0 )
+ {
+ sign = 0x04;
+ r *= -1;
+ }
+
+ if ( g < 0 )
+ {
+ sign |= 0x02;
+ g *= -1;
+ }
+
+ if ( b < 0 )
+ {
+ sign |= 0x01;
+ b *= -1;
+ }
+ return ( ( ( r & 0xFF ) << 16 ) | ( ( g & 0xFF ) << 8 ) | ( b & 0xFF ) );
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt32 CSvgAnimationBase::GetNumberOfEvents(const TDesC& aValue)
+ {
+ TInt32 result=1;
+ TStringTokenizer tkn ( aValue, KSEMICOLON );
+ while( tkn.HasMoreTokens() )
+ {
+ tkn.NextToken( );
+ result++;
+ }
+ return result;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+TInt32 CSvgAnimationBase::Duration()
+ {
+ return (TInt32)iAnimTime->DurationTime();
+ }
+
+
+void CSvgAnimationBase::SaveBeginTimeToList(TInt aTimeInMilliseconds)
+ {
+ iAnimTime->AddToInitialList(aTimeInMilliseconds);
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+void CSvgAnimationBase::ReInitializeAnimation()
+ {
+
+
+ iHadBegun= EFalse;
+ iBeginTimeIndex = 0 ;
+ iCurrentRepeatCount= 0;
+ iInitDone = EFalse;
+ iOverrideTime = EFalse;
+ iAnimStatus = KAnimNotActive;
+
+ if (iTargetElement)
+ {
+ iTargetElement->iHasAnimationBase = (TInt)this;
+ iTargetElement->SetIsAnimating( EFalse );
+ SetIsAnimating( EFalse );
+ }
+
+ //JSR226 Change in question
+// if (iOwnerDocument && ((CSvgDocumentImpl*)iOwnerDocument)->Engine() && iTargetElement )
+// {
+ //hope these are parrallel vectors
+ //for (TInt i=0; i < iAnimTime->BeginTimesCount(); i++)
+ //{
+// if ( (iAnimTime->BeginTime() <= ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->CurrentTIme() )
+// && ( iAnimTime->EndTime() >= ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->CurrentTIme() ) )
+// {
+// iTargetElement->iAnimating = ETrue;
+// iAnimating = ETrue;
+// }
+ //}
+// }
+ //--end of change in question
+//
+ if(iAdditiveOrg == KAdditiveReplace)
+ {
+ iAdditive= KAdditivePass;
+ }
+
+
+ if (iAnimTime)
+ {
+ if (iIsUserSeek)
+ iAnimTime->ReInitializeForSeek();
+ else
+ iAnimTime->ReInitialize();
+
+ if( iAnimTime->BeginTimesCount()== 0 )
+ {
+ if(iIsBeginSet ) // begin on events
+ {
+ if(!iIsUserSeek)// for DOM Reusage only
+ {
+ iAnimTime->SetBeginTime(KTimeIndefinite);
+ iAbsoluteBeginTime = KTimeIndefinite ;
+ }
+ else
+ {
+ // if begin depends on event and repeat is there,
+ //then iAbsoluteBeginTime != iBeginTime.
+ if((TUint32)iAbsoluteBeginTime != iAnimTime->BeginTime() )
+ iAnimTime->SetBeginTime(iAbsoluteBeginTime);
+ }
+
+ }
+ else
+ {
+ iAnimTime->SetBeginTime(0);
+ iAbsoluteBeginTime = 0 ;
+ }
+ }
+
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Functions used by Decoder
+// ---------------------------------------------------------------------------
+
+
+void CSvgAnimationBase::SetAttributeId(const TUint16 aAtrId)
+ {
+ iAttrId= aAtrId;
+ }
+
+void CSvgAnimationBase::SetAttributeType(const TUint8 aAtrType)
+ {
+ iDataType= (TUint16) aAtrType;
+ }
+
+void CSvgAnimationBase::SetBeginTimeList(RArray<TInt32>*& aList)
+ {
+ if (iAnimTime)
+ {
+ iAnimTime->SetBeginTimeList(aList);
+ }
+ }
+
+void CSvgAnimationBase::SetBeginTime(TInt32 aTime)
+ {
+ if (iAnimTime)
+ {
+ iAnimTime->SetBeginTime(aTime);
+ }
+ }
+
+void CSvgAnimationBase::SetAbsoluteBeginTime(TInt32 aTime)
+ {
+ iAbsoluteBeginTime= aTime;
+ iIsBeginSet = ETrue;
+ }
+
+void CSvgAnimationBase::SetEventList(CArrayFixFlat<TEventListItem>*& aEventList)
+ {
+ if (iEventList)
+ {
+ iEventList->Reset();
+ delete iEventList;
+ iEventList= NULL;
+ }
+ iEventList= aEventList;
+ }
+
+void CSvgAnimationBase::SetEndTimeList(CArrayFixFlat<TEventListItem>*& aTimeList)
+ {
+ if (iEndTimeList)
+ {
+ iEndTimeList->Reset();
+ delete iEndTimeList;
+ iEndTimeList= NULL;
+ }
+ iEndTimeList= aTimeList;
+ }
+
+void CSvgAnimationBase::SetDurationTime(TInt32 aTime)
+ {
+ if (iAnimTime)
+ {
+ iAnimTime->SetDurationTime(aTime);
+ }
+ }
+
+void CSvgAnimationBase::SetFromFlag()
+ {
+ iNoFrom= EFalse;
+ }
+
+void CSvgAnimationBase::SetFromInt(TInt32 aValue)
+ {
+ iFromInt= aValue;
+ iOrgFromInt= aValue;
+ }
+
+void CSvgAnimationBase::SetFromFloat(TFloatFixPt aValue)
+ {
+ iFromFloat= aValue;
+ iOrgFromFloat= aValue;
+ }
+
+void CSvgAnimationBase::SetFromViewBox(TGfxRectangle2D aValue)
+ {
+ iFromViewBox= aValue;
+ iOrgFromViewBox= aValue;
+ }
+
+void CSvgAnimationBase::SetFromPathL(CGfxGeneralPath*& aPath)
+ {
+ if (iFromPath)
+ {
+ delete iFromPath;
+ iFromPath= NULL;
+ }
+ iFromPath= aPath;
+
+ if ( iOrgFromPath )
+ {
+ delete iOrgFromPath;
+ iOrgFromPath = NULL;
+ }
+
+ iOrgFromPath = CGfxGeneralPath::NewL();
+ iOrgFromPath->SetPointTypeArrayL(aPath->PointTypeArray());
+ iOrgFromPath->SetPointCoordsArrayL(aPath->PointCoordsArrayAll());
+ }
+
+void CSvgAnimationBase::SetToFlag()
+ {
+ iHaveTo= ETrue;
+ }
+
+void CSvgAnimationBase:: SetToInt(TInt32 aValue)
+ {
+ iToInt= aValue;
+ }
+
+void CSvgAnimationBase:: SetToFloat(TFloatFixPt aValue)
+ {
+ iToFloat= aValue;
+ }
+
+void CSvgAnimationBase::SetToPath(CGfxGeneralPath*& aPath)
+ {
+ iToPath= aPath;
+ }
+
+void CSvgAnimationBase::SetToViewBox(TGfxRectangle2D aValue)
+ {
+ iToViewBox= aValue;
+ }
+
+CSvgElementImpl*& CSvgAnimationBase::GetTargetElem()
+ {
+ return iTargetElement;
+ }
+
+void CSvgAnimationBase::SetAnimFreeze()
+ {
+ iFill= KAnimFillFreeze;
+ }
+
+void CSvgAnimationBase::SetValuesFlag()
+ {
+ iHaveValues = ETrue;
+ }
+
+void CSvgAnimationBase::SetIntValuesArray( RArray<TInt32>*& aArray)
+ {
+ if (iValuesInt)
+ {
+ iValuesInt->Close();
+ delete iValuesInt;
+ }
+ iValuesInt= aArray;
+ }
+
+void CSvgAnimationBase::SetFloatValuesArray( RArray<TFloatFixPt>*& aArray)
+ {
+ if (iValuesFloat)
+ {
+ iValuesFloat->Close();
+ delete iValuesFloat;
+ }
+
+ iValuesFloat= aArray;
+ }
+
+void CSvgAnimationBase::SetViewBoxValuesArray( RArray<TGfxRectangle2D>*& aArray)
+ {
+ if (iValuesViewBox)
+ {
+ iValuesViewBox->Close();
+ delete iValuesViewBox;
+ }
+
+ iValuesViewBox= aArray;
+ }
+
+void CSvgAnimationBase::SetPathValuesArray( RPointerArray<CGfxGeneralPath>*& aArray)
+ {
+ if (iValuesPath)
+ {
+ iValuesPath->Close();
+ delete iValuesPath;
+ }
+
+ iValuesPath= aArray;
+ }
+
+void CSvgAnimationBase::ResetFloatValuesArray()
+ {
+ if (iValuesFloat)
+ {
+ iValuesFloat->Reset();
+ }
+ }
+
+void CSvgAnimationBase::SetRepeatCount(TReal32 aCount)
+ {
+ // fix for repeatCount
+ if(aCount <= 0)
+ {
+ iRepeatCount = 1;
+ }
+ else
+ {
+ iRepeatCount= aCount;
+ }
+ iRepeatCountSet = ETrue;
+
+ }
+
+void CSvgAnimationBase::SetRepeatDuration(TUint32 aDur)
+ {
+ if(!iRepeatCountSet)
+ {
+ iRepeatCount = KRepeatCountMax;
+ }
+
+ if (iAnimTime)
+ {
+ iAnimTime->SetRepeatDurationTime(aDur);
+ }
+ }
+
+
+void CSvgAnimationBase::SetEndTime(TInt32 aTime)
+ {
+ if(iAnimTime)
+ {
+ iAnimTime->SetEndTime(aTime);
+ }
+ }
+
+void CSvgAnimationBase::SetRestartMode(TRestartMode aMode)
+ {
+ iAnimRestart= aMode;
+ }
+
+void CSvgAnimationBase::SetAccumulate(TAccumulate aValue)
+ {
+ iAccumulate= aValue;
+ }
+
+void CSvgAnimationBase::SetAdditive(TAdditive aValue)
+ {
+ iAdditive= aValue;
+ iAdditiveOrg= aValue;
+ }
+
+void CSvgAnimationBase::SetCalcMode(TAnimCalcMode aMode)
+ {
+ if (iAnimTime)
+ {
+ iAnimTime->SetCalMode(aMode);
+ }
+ }
+
+void CSvgAnimationBase::SetKeyTimeArray(RArray<CSvgAnimTimeController::TKeyTime>*& aArray)
+ {
+ if (iAnimTime)
+ {
+ iAnimTime->SetKeyTimeArray(aArray);
+ }
+ }
+
+void CSvgAnimationBase::SetAnimTimeArray(RArray<TUint32>*& aArray)
+ {
+ if (iAnimTime)
+ {
+ iAnimTime->SetAnimTimeArray(aArray);
+ }
+ }
+
+void CSvgAnimationBase::SetByFlag()
+ {
+ iHaveBy= ETrue;
+ }
+
+TBool CSvgAnimationBase:: GetFromFlag()
+ {
+ return iNoFrom;
+ }
+
+TUint16 CSvgAnimationBase::GetAttributeId()
+ {
+ return iAttrId;
+ }
+
+void CSvgAnimationBase::SetKeyTimeFlag()
+ {
+ iKeyTimesPresent= ETrue;
+ }
+
+TInt CSvgAnimationBase::GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue )
+ {
+ switch(aNameId)
+ {
+ case KAtrAttributeName:
+ {
+ aValue = (TFloatFixPt)(TInt)(iAttrId);
+ break;
+ }
+ case KAtrBegin:
+ {
+ aValue = (TInt32)iAnimTime->GetBeginTime( iBeginTimeIndex );
+ break;
+ }
+ case KAtrDur:
+ {
+ aValue = (TFloatFixPt)(TInt) (iAnimTime->DurationTime());
+ break;
+ }
+ case KAtrRepeatCount:
+ {
+ aValue = (TInt)iRepeatCount;
+ break;
+ }
+ case KAtrRepeatDur:
+ {
+ aValue = (TInt32) iAnimTime->RepeatDurationTime();
+ break;
+ }
+ case KAtrEnd:
+ {
+ aValue = (TInt32)iAnimTime->EndTime();
+ break;
+ }
+ case KAtrFrom:
+ {
+ if(! iNoFrom)
+ {
+ switch(iDataType)
+ { // Length float.
+ case KSvgTypeOpacity:
+ case KSvgTypeLength:
+ {
+ aValue = iFromFloat;
+ break;
+ }
+ default: break;
+ }
+ }
+ }
+ break;
+ case KAtrTo:
+ {
+ if(iHaveTo)
+ {
+ switch(iDataType)
+ { // Length float.
+ case KSvgTypeOpacity:
+ case KSvgTypeLength:
+ {
+ aValue = iToFloat;
+ break;
+ }
+ default: break;
+
+ }
+ }
+ }
+ break;
+ case KAtrBy:
+ {
+ if(iHaveBy)
+ {
+ switch(iDataType)
+ { // Length float.
+ case KSvgTypeOpacity:
+ case KSvgTypeLength:
+ {
+ aValue = iToFloat - iFromFloat;
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ }
+ break;
+ default:
+ //this is for the JSR because it wants the original value returned instead of the animated
+ //version that element would return if it gets down to the default of this case statement
+ if (aNameId == iAttrId)
+ {
+ aValue = iOrgFloat;
+ return KErrNone;
+ }
+ else
+ {
+ return CSvgElementImpl::GetAttributeFloat( aNameId,aValue );
+ }
+ }
+ return KErrNone;
+ }
+
+TInt CSvgAnimationBase::SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue )
+{
+ switch(aNameId)
+ {
+ case KAtrAttributeName:
+ {
+ iAttrId = (TUint16)(TInt32)aValue;
+ break;
+ }
+ case KAtrBegin:
+ {
+ iAnimTime->SetBeginTime( aValue );
+ break;
+ }
+ case KAtrDur:
+ {
+ iAnimTime->SetDurationTime( aValue );
+ break;
+ }
+
+ case KAtrRepeatCount:
+ {
+ if((TInt32)aValue <= 0)
+ {
+ iRepeatCount = 1;
+ }
+ else
+ {
+ iRepeatCount= (TUint16) (TInt32)aValue;
+ }
+ iRepeatCountSet = ETrue;
+ break;
+ }
+
+ case KAtrRepeatDur:
+
+ {
+ iAnimTime->SetRepeatDurationTime( (TInt32)aValue );
+ break;
+ }
+ case KAtrEnd:
+ {
+ iAnimTime->SetEndTime( aValue );
+ break;
+ }
+ case KAtrFrom:
+ {
+
+ switch(iDataType)
+ { // Length float.
+ case KSvgTypeOpacity:
+ case KSvgTypeLength:
+ {
+ iFromFloat = aValue;
+ break;
+ }
+ default:
+ break;
+ }
+
+ }
+ break;
+ case KAtrTo:
+ {
+
+ switch(iDataType)
+ { // Length float.
+ case KSvgTypeOpacity:
+ case KSvgTypeLength:
+ {
+ iToFloat= aValue ;
+ break;
+ }
+ default:
+ break;
+ // color and integer values.
+
+ }
+
+ }
+ break;
+ case KAtrBy:
+ {
+ switch(iDataType)
+ { // Length float.
+ case KSvgTypeOpacity:
+ case KSvgTypeLength:
+ {
+ iToFloat = iFromFloat + aValue;
+ break;
+ }
+ default:
+ break;
+ }
+
+ }
+ break;
+ default:
+ {
+ //JSR226 change in question. This is so you can set the original value from the JSR226 side.
+ if (aNameId == iAttrId)
+ {
+ iOrgFloat = aValue;
+ }
+
+ return CSvgElementImpl::SetAttributeFloatL( aNameId,aValue );
+ }
+ }
+ return KErrNone;
+
+ }
+
+TInt CSvgAnimationBase::SetAttributeIntL( const TInt aNameId,
+ const TInt32 aValue )
+ {
+ switch(aNameId)
+ {
+ case KAtrFrom:
+ {
+ switch(iDataType)
+ {
+ case KSvgTypeTextAnchor:
+ case KSvgTypeColor:
+ case KSvgTypeVisibility:
+ case KSvgTypeGradientUnits:
+ case KSvgTypeSpreadMethod:
+ case KSvgTypeDisplay:
+ iFromInt = aValue;
+ iNoFrom = EFalse;
+ break;
+
+ default:return KErrNotFound;
+ }
+ }
+ break;
+ case KAtrTo:
+ {
+ switch(iDataType)
+ {
+ // only these are supported as Int
+ case KSvgTypeTextAnchor:
+ case KSvgTypeColor:
+ case KSvgTypeVisibility:
+ case KSvgTypeGradientUnits:
+ case KSvgTypeSpreadMethod:
+ case KSvgTypeDisplay:
+ iToInt = aValue;
+ iHaveTo = ETrue;
+ break;
+ default:return KErrNotFound;
+ }
+ }
+ break;
+ case KAtrBy:
+ {
+ // By is not supported.
+ if(iDataType == KSvgTypeColor)
+ {
+ iToInt = (TInt32 ) AddColor( iFromInt, (TInt32)aValue);
+ break;
+ }
+ }
+ break;
+ case KAtrAdditive:
+ {
+ iAdditive = (TUint8)aValue;
+ iAdditiveOrg = (TUint8)aValue;
+ break;
+ }
+
+ case KAtrAccumulate:
+ {
+ iAccumulate = (TUint8)aValue;
+ break;
+ }
+
+ case KAtrCalcMode:
+ {
+ iAnimTime->SetCalMode( (TUint8)aValue );
+ break;
+ }
+
+ case KAtrRestart:
+ {
+ iAnimRestart = (TUint8) aValue;
+ break;
+ }
+
+ // this is confusing but in case of animation
+ // elements the style attributes really do not matter.
+ case KCSS_ATTR_FILL:
+ {
+ iFill = (TUint8) aValue;
+ break;
+ }
+
+ default:
+ return CSvgElementImpl::SetAttributeIntL( aNameId, aValue );
+ }
+ return KErrNone;
+}
+
+TInt CSvgAnimationBase::GetAttributeIntL( const TInt aNameId,
+ TInt32& aValue )
+{
+switch(aNameId)
+ {
+ case KAtrFrom:
+ {
+ if(!iNoFrom)
+ {
+ switch(iDataType)
+ {
+ case KSvgTypeTextAnchor:
+ case KSvgTypeColor:
+ case KSvgTypeVisibility:
+ case KSvgTypeGradientUnits:
+ case KSvgTypeSpreadMethod:
+ case KSvgTypeDisplay:
+ aValue = iFromInt;
+ break;
+
+ default:return KErrNotFound;
+ }
+ }
+ }
+ break;
+ case KAtrTo:
+ {
+ if(iHaveTo)
+ {
+ switch(iDataType)
+ {
+ case KSvgTypeTextAnchor:
+ case KSvgTypeColor:
+ case KSvgTypeVisibility:
+ case KSvgTypeGradientUnits:
+ case KSvgTypeSpreadMethod:
+ case KSvgTypeDisplay:
+ aValue = iToInt;
+ break;
+ default:return KErrNotFound;
+ }
+ }
+ }
+ break;
+ case KAtrBy:
+ {
+ // By is not supported.
+ if(iDataType == KSvgTypeColor)
+ {
+ aValue = (TInt32 ) SubtractColor( iToInt, iFromInt );
+ }
+ }
+ break;
+ case KAtrAdditive:
+ {
+ aValue = iAdditive ;
+ break;
+ }
+
+ case KAtrAccumulate:
+ {
+ aValue = iAccumulate ;
+ break;
+ }
+ case KAtrCalcMode:
+ {
+ aValue = iAnimTime->CalMode();
+ break;
+ }
+ case KAtrRestart:
+ {
+ aValue = iAnimRestart ;
+ break;
+ }
+ case KCSS_ATTR_FILL:
+ {
+ aValue = iFill ;
+ break;
+ }
+ default:
+ return CSvgElementImpl::GetAttributeIntL( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+void CSvgAnimationBase::ResetL(MSvgEvent* aEvent, CSvgAnimationBase* aAnimElement)
+ {
+
+ TSvgTimerEvent* timerEvent = ( TSvgTimerEvent* ) aEvent;
+ TInt32 lCurrentTime = timerEvent->Time();
+ iAnimTime->Reset();
+ TInt32 lBeginTime = iAbsoluteBeginTime;
+
+ //If Stop was called Dynamic endtime list(iEndTimeList) was reset to iInitialEndTimesList
+ // This needs recalculation of iEndTime inside animTimeController
+ TInt32 lSimpleDur = SimpleDuration();
+ if( lSimpleDur != KTimeIndefinite)
+ {
+ iAnimTime->SetEndTime(lSimpleDur);
+ }
+
+ TInt32 lDuration = iAnimTime->DurationTime();
+
+ // reset back to the original values.
+ aAnimElement->ResetReferenceElementL();
+
+ // Set the Additive;
+ iAdditive = iAdditiveOrg;
+
+ if(lCurrentTime >= lBeginTime && lCurrentTime < lSimpleDur)
+ {
+ // set the new status.
+ iAnimStatus = KAnimActive;
+ iHadBegun = ETrue;
+
+ // calculate the CurrentRepeatCount.
+ if(lDuration> 0)
+ {
+ iCurrentRepeatCount = (TUint16)((lCurrentTime - lBeginTime ) / lDuration);
+
+ // check it if it is bigger than the allowed repeatCount.
+ if(iCurrentRepeatCount > iRepeatCount)
+ {
+ // truncate the repeatCount
+ iCurrentRepeatCount = (TUint16)iRepeatCount;
+ }
+ }
+ else
+ {
+ // No duration means repeatCount is ignored.
+ iCurrentRepeatCount = 0;
+ }
+
+ if(aAnimElement->ElemID()== KSvgAnimateTransformElement ||aAnimElement->ElemID()== KSvgAnimateMotionElement )
+ {
+ if(aAnimElement->ElemID() == KSvgAnimateMotionElement)
+ {
+ aAnimElement->ResetAnimationL();
+ }
+ aAnimElement->SetAccumulateValuesForSetMediaTime();
+ }
+ // set the begin time.
+ iAnimTime->SetBeginTime(lBeginTime + (iCurrentRepeatCount*lDuration));
+
+ // Send the begin event.
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->NotifyAnimationStarted();
+ TSvgInternalEvent Beginevent ( ESvgEventBeginEvent, this, lBeginTime );
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->ProcessEventL(
+ ( CSvgDocumentImpl* ) OwnerDocument(), &Beginevent );
+
+
+ // Send Repeat Events.
+ if(iAnimTime->DurationTime() != KTimeIndefinite)
+ {
+ TUint16 lTotalRepeatEvents = (TUint16)iCurrentRepeatCount;
+ for(TUint16 i= 0; i < lTotalRepeatEvents; i++)
+ {
+ TUint32 lDur = (TUint32)iAnimTime->DurationTime();
+ TInt lCount = (TUint16)(i+1);
+ TInt32 lRepeatTime = lBeginTime + (TInt32)(lDur*lCount);
+ TSvgInternalEvent Repeatevent ( ESvgEventRepeatEvent, this, lRepeatTime );
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->ProcessEventL(
+ ( CSvgDocumentImpl* ) OwnerDocument(), &Repeatevent );
+ }
+ }
+ }
+ else if(lCurrentTime >= lSimpleDur)
+ {
+ // made active to calculate the freeze value.
+ iAnimStatus = KAnimActive;
+ iHadBegun = ETrue;
+ TBool lAcuumulate = EFalse;
+ if(lDuration> 0)
+ {
+ iCurrentRepeatCount = (TUint16)((lCurrentTime - lBeginTime ) / lDuration);
+
+ // check below is for the correct repeatCount setting this is
+ // necessary for accumulate values calculation.
+ if(iCurrentRepeatCount >= iRepeatCount || iRepeatCount == KRepeatCountMax)
+ {
+ // this means that the repeatCount was not specified so it is not supposed to send the
+ // repeatEvents.
+ if(iRepeatCount == 1)
+ {
+ iCurrentRepeatCount = 0;
+ }
+ else
+ {
+ if(iRepeatCountSet)
+ {
+ // repeatCount was specified.
+ if(iRepeatCount != KRepeatCountMax)
+ {
+ // repeatCount is not "indefinite"
+ iCurrentRepeatCount = (TUint16) iRepeatCount;
+ }
+ }
+ else
+ {
+ // what if repeatDuration was specified.
+ if(KTimeIndefinite != iAnimTime->RepeatDurationTime())
+ {
+ // repeatDuration is not "indefinite"
+ iCurrentRepeatCount = (iAnimTime->RepeatDurationTime()) / lDuration;
+ }
+ }
+ lAcuumulate = ETrue;
+ }
+ }
+ }
+ else
+ {
+ iCurrentRepeatCount = 0;
+ }
+ //take the last begin time so that accumulation happens correctly.
+ // if "end" needs to be checked
+ TInt32 lEnd = iAnimTime->GetOriginalEndTime();
+ TInt count =0;
+ TBool lChangeRepeatCount = EFalse;
+ if(KTimeIndefinite != lEnd)
+ {
+ for(; count <= iCurrentRepeatCount; count++)
+ {
+ // check is the repaetCount is more than the valid range.
+ // depending on the end time.
+ if((lBeginTime+(count*lDuration)) < lEnd)
+ {
+
+ }
+ else
+ {
+ // original end time must be grater than the begin time to be valid.
+ if(lEnd > lBeginTime)
+ {
+ // repeatCount needs to be changed.
+ lChangeRepeatCount = ETrue;
+ }
+ break;
+
+ }
+ }
+ }
+ if(lChangeRepeatCount)
+ {
+ if(count >0)
+ {
+ iCurrentRepeatCount = count - 1;
+ }
+ else
+ {
+ iCurrentRepeatCount = 0;
+ }
+ }
+ iAnimTime->SetBeginTime(lBeginTime + (iCurrentRepeatCount)*lDuration);
+
+ // Decrement the repeatCount; this is because the accumulate will give
+ //additional one repeatCouont for seeking beyond the end time.
+ TReal32 RealRepeatCount = iCurrentRepeatCount;
+ if(iCurrentRepeatCount > 0 && ( RealRepeatCount == iRepeatCount || iRepeatCount == KRepeatCountMax))
+ {
+ iCurrentRepeatCount--;
+ }
+
+ // check for animateTransforms and animateMotion for iAccumulate
+ // which means that these need to accumulate separately.
+ if(aAnimElement->ElemID()== KSvgAnimateTransformElement ||aAnimElement->ElemID()== KSvgAnimateMotionElement )
+ {
+ if(iAccumulate == KAccumSum && lAcuumulate)
+ {
+ // if it is animateMotion reset the current path indicaters.
+ if(aAnimElement->ElemID() == KSvgAnimateMotionElement)
+ {
+ aAnimElement->ResetAnimationL();
+ }
+ // accumulate.
+ aAnimElement->SetAccumulateValuesForSetMediaTime();
+ }
+ }
+
+ // send the begin
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->NotifyAnimationStarted();
+ TSvgInternalEvent Beginevent ( ESvgEventBeginEvent, this, lBeginTime );
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->ProcessEventL(
+ ( CSvgDocumentImpl* ) OwnerDocument(), &Beginevent );
+ // send the begin, repeat, and end Events.
+ if(iAnimTime->DurationTime() != KTimeIndefinite)
+ {
+ TUint16 lTotalRepeatEvents = (TUint16)iCurrentRepeatCount;
+ for(TUint16 i= 0; i < lTotalRepeatEvents; i++)
+ {
+ TUint32 lDur = (TUint32)iAnimTime->DurationTime();
+ TInt lCount = (TUint16)(i+1);
+ TInt32 lRepeatTime = lBeginTime + (TInt32)(lDur*lCount);
+ TSvgInternalEvent Repeatevent ( ESvgEventRepeatEvent, this, lRepeatTime );
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->ProcessEventL(
+ ( CSvgDocumentImpl* ) OwnerDocument(), &Repeatevent );
+ }
+ }
+
+ // send end events.
+ if(lSimpleDur != (TInt32)KTimeIndefinite)
+ {
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->NotifyAnimationEnded();
+ TSvgInternalEvent Endevent ( ESvgEventEndEvent, this, lSimpleDur );
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->ProcessEventL(
+ ( CSvgDocumentImpl* ) OwnerDocument(), &Endevent );
+ TSvgTimerEvent lEndTime1(lSimpleDur);
+ iIsEndEventSent = ETrue;
+ // calculate the freeze values.
+ if(iFill == KAnimFillFreeze)
+ {
+ // if it has to freeze than calculate the final values.
+ aAnimElement->AnimProcL(&lEndTime1);
+
+ // this is to avoid it going in the AnimProcL again. Which will change
+ // the freeze values.
+ // THIS MUST BE DONE ONLY WHEN THE repeatCount is fractional.
+ TReal32 lFractReapeatDur = 0;
+ if(KTimeIndefinite != iAnimTime->RepeatDurationTime())
+ {
+ // this is to check whether this matches a fractional repeatCount.
+ lFractReapeatDur = iAnimTime->RepeatDurationTime();
+ lFractReapeatDur = (lFractReapeatDur - (lDuration*(iCurrentRepeatCount+1))) ;
+ }
+ if((iRepeatCount - TInt(iRepeatCount)>0 || lFractReapeatDur > 0 )
+ || ((iAnimTime->BeginTime() + iAnimTime->DurationTime()) > lSimpleDur &&
+ iAnimTime->BeginTime()!= lSimpleDur))
+ {
+ // do not go to AnimProcL only once.
+ iDoFreeze = ETrue;
+ }
+ }
+ else
+ {
+ // this should be ok . But how do we get the initial value.
+ aAnimElement->SetToInitialValueL();
+ // do not go to animProcL;
+ iDoFreeze = ETrue;
+ }
+ }
+ }
+ }
+
+void CSvgAnimationBase::SetOriginalValues_DOMReuse()
+ {
+
+ if(iAnimTime)
+ {
+ iAnimTime->SetOriginalValues_DOMReuse();
+ }
+ }
+CGfxGeneralPath* CSvgAnimationBase::GetPathAttribute(TInt aAttributeId)
+{
+if(iDataType == KSvgTypePath)
+ {
+ switch(aAttributeId)
+ {
+ case KAtrTo: return iToPath;
+ case KAtrFrom: return iOrgFromPath;
+ default :
+ return NULL;
+ }
+ }
+return NULL;
+}
+void CSvgAnimationBase::SetPathAttribute(TInt aAttributeId, CGfxGeneralPath* aPathHandle)
+{
+ if(iDataType == KSvgTypePath)
+ {
+ switch(aAttributeId)
+ {
+ case KAtrTo:
+ {
+ if(iToPath == aPathHandle)
+ {
+ return;
+ }
+ delete iToPath;
+ iToPath = aPathHandle;
+ }
+ break;
+ case KAtrFrom:
+ {
+
+ if(iOrgFromPath == aPathHandle)
+ {
+ return;
+ }
+
+ delete iOrgFromPath;
+ iOrgFromPath = aPathHandle;
+
+ // clone it .
+ delete iFromPath;
+ iFromPath = NULL;
+
+ /************************************/
+ TRAPD(error ,iFromPath = CGfxGeneralPath::NewL());
+ if(error == KErrNone)
+ {
+ RArray<TUint32>* lTypes = aPathHandle->PointTypeArray();
+ RArray<TFloatFixPt>* lCoords = aPathHandle->PointCoordsArrayAll();
+ TRAP_IGNORE( iFromPath->SetPointTypeArrayL(lTypes) );
+ TRAP_IGNORE( iFromPath->SetPointCoordsArrayL(lCoords) );
+ }
+ /************************************/
+
+ }
+ break;
+ default :
+ break;
+ }
+ }
+
+}
+
+
+TUint8 CSvgAnimationBase::GetAnimStatus()
+{
+ return iAnimStatus;
+}
+
+// added for forward referencing
+TInt CSvgAnimationBase::SetRefElemById(const TDesC& aName)
+ {
+ //If iTargetElement is Set to Null means that some junk Href was given
+ iTargetElement = ( CSvgElementImpl*)((CSvgDocumentImpl*)iOwnerDocument)->GetElementById( aName );
+
+ if(iTargetElement==NULL)
+ {
+ return KErrNotFound;
+ }
+ else
+ {
+ iTargetElement->iHasAnimationBase = (TInt)this;
+ TRAPD(lError,GetAttrValueL());
+ if ( lError != KErrNone )
+ {
+ // ignore trap error
+ }
+ return KErrNone;
+ }
+ }
+
+void CSvgAnimationBase::CopyL(CSvgAnimationBase* newElement)
+ {
+ if(newElement)
+ {
+
+ // copy this pointer.
+ this->iAnimTime->CopyL(newElement->iAnimTime);
+
+ if(iEndPath)
+ {
+ newElement->iEndPath = CGfxGeneralPath::NewL();
+
+ RArray<TUint32>* lTypes = this->iEndPath->PointTypeArray();
+ RArray<TFloatFixPt>* lCoords = this->iEndPath->PointCoordsArrayAll();
+ newElement->iEndPath->SetPointTypeArrayL(lTypes);
+ newElement->iEndPath->SetPointCoordsArrayL(lCoords);
+ }
+ if(iOrgPath)
+ {
+ newElement->iOrgPath = CGfxGeneralPath::NewL();
+
+ RArray<TUint32>* lTypes = this->iOrgPath->PointTypeArray();
+ RArray<TFloatFixPt>* lCoords = this->iOrgPath->PointCoordsArrayAll();
+ newElement->iOrgPath->SetPointTypeArrayL(lTypes);
+ newElement->iOrgPath->SetPointCoordsArrayL(lCoords);
+ }
+ if(iFromPath)
+ {
+ newElement->iFromPath = CGfxGeneralPath::NewL();
+
+ RArray<TUint32>* lTypes = this->iFromPath->PointTypeArray();
+ RArray<TFloatFixPt>* lCoords = this->iFromPath->PointCoordsArrayAll();
+ newElement->iFromPath->SetPointTypeArrayL(lTypes);
+ newElement->iFromPath->SetPointCoordsArrayL(lCoords);
+ }
+ if(iToPath)
+ {
+ newElement->iToPath = CGfxGeneralPath::NewL();
+
+ RArray<TUint32>* lTypes = this->iToPath->PointTypeArray();
+ RArray<TFloatFixPt>* lCoords = this->iToPath->PointCoordsArrayAll();
+ newElement->iToPath->SetPointTypeArrayL(lTypes);
+ newElement->iToPath->SetPointCoordsArrayL(lCoords);
+ }
+ if(iOrgFromPath)
+ {
+ newElement->iOrgFromPath = CGfxGeneralPath::NewL();
+
+ RArray<TUint32>* lTypes = this->iOrgFromPath->PointTypeArray();
+ RArray<TFloatFixPt>* lCoords = this->iOrgFromPath->PointCoordsArrayAll();
+ newElement->iOrgFromPath->SetPointTypeArrayL(lTypes);
+ newElement->iOrgFromPath->SetPointCoordsArrayL(lCoords);
+ }
+ if(iValuesFloat)
+ {
+
+ TInt lCount = iValuesFloat->Count();
+ newElement->iValuesFloat->Reset();
+ for(TInt i=0; i<lCount; i++)
+ {
+ newElement->iValuesFloat->AppendL(iValuesFloat->operator[](i));
+ }
+ }
+ if(iValuesInt)
+ {
+ TInt lCount = iValuesInt->Count();
+ newElement->iValuesInt->Reset();
+ for(TInt i=0; i<lCount; i++)
+ {
+ User::LeaveIfError(newElement->iValuesInt->Append(iValuesInt->operator[](i)));
+ }
+ }
+
+ //iValuesPath
+ if(iValuesPath)
+ {
+ TInt lCount = iValuesPath->Count();
+ newElement->iValuesPath->Reset();
+ for(TInt i=0; i<lCount; i++)
+ {
+ CGfxGeneralPath* lOrgPath = (this->iValuesPath)->operator[](i);
+ RArray<TUint32>* lTypes = lOrgPath->PointTypeArray();
+ RArray<TFloatFixPt>* lCoords = lOrgPath->PointCoordsArrayAll();
+
+ CGfxGeneralPath* lClonePath = CGfxGeneralPath::NewL();
+ CleanupStack::PushL(lClonePath);
+ lClonePath->SetPointTypeArrayL(lTypes);
+ lClonePath->SetPointCoordsArrayL(lCoords);
+ newElement->iValuesPath->AppendL((CGfxGeneralPath*)lClonePath);
+ CleanupStack::Pop(lClonePath);
+ }
+ }
+
+ //iValuesViewBox
+ if(iValuesViewBox)
+ {
+ TInt lCount = iValuesViewBox->Count();
+ newElement->iValuesViewBox->Reset();
+ for(TInt i=0; i<lCount; i++)
+ {
+ User::LeaveIfError(newElement->iValuesViewBox->Append(iValuesViewBox->operator[](i)));
+ }
+ }
+
+ newElement->iEndOffset = iEndOffset;
+ newElement->iRepeatCount = iRepeatCount;
+ newElement->iRepeatEndValue = iRepeatEndValue;
+ newElement->iAbsoluteBeginTime = iAbsoluteBeginTime;
+ newElement->iAttributeFlag = iAttributeFlag;
+ newElement->iEndInt = iEndInt;
+ newElement->iPropInt = iPropInt;
+ newElement->iOrgInt = iOrgInt;
+ newElement->iFromInt = iFromInt;
+ newElement->iToInt = iToInt;
+ newElement->iOrgFromInt = iOrgFromInt;
+ newElement->iIsBeginSet = iIsBeginSet;
+ newElement->iPropFloat = iPropFloat;
+ newElement->iOrgFloat = iOrgFloat;
+ newElement->iFromFloat = iFromFloat;
+ newElement->iToFloat = iToFloat;
+ newElement->iOrgFromFloat = iOrgFromFloat;
+ newElement->iEndFloat = iEndFloat;
+ newElement->iBeginTimeIndex = iBeginTimeIndex;
+ //newElement->iEndAccessKeyCode = iEndAccessKeyCode;
+ newElement->iCurrentRepeatCount = iCurrentRepeatCount;
+ newElement->iAttrId = iAttrId;
+ newElement->iDataType = iDataType;
+ newElement->iInitDone = iInitDone;
+ newElement->iTargetSet = iTargetSet;
+ newElement->iNoFrom = iNoFrom;
+ newElement->iHaveTo = iHaveTo;
+ newElement->iHaveBy = iHaveBy;
+ newElement->iHaveValues = iHaveValues;
+ newElement->iAnimStatus = iAnimStatus;
+
+ //viewBox
+ newElement->iOrgViewBox = iOrgViewBox;
+ newElement->iFromViewBox = iFromViewBox;
+ newElement->iToViewBox = iToViewBox;
+ newElement->iOrgFromViewBox = iOrgFromViewBox;
+ newElement->iEndViewBox = iEndViewBox;
+
+// newElement->iEndReferenceEvent = iEndReferenceEvent;
+ //////////////////////////////
+ newElement->iAnimStatus = iAnimStatus;
+ newElement->iFill = iFill;
+ newElement->iHadBegun = iHadBegun;
+ newElement->iAnimRestart = iAnimRestart;
+ newElement->iAccumulate = iAccumulate;
+ newElement->iAdditive = iAdditive;
+ newElement->iAdditiveOrg = iAdditiveOrg;
+ newElement->iOverrideTime = iOverrideTime;
+ newElement->iRepeatCountSet = iRepeatCountSet;
+ newElement->iDoFreeze = iDoFreeze;
+ newElement->iKeyTimesPresent = iKeyTimesPresent;
+ newElement->iCheckFirstAnim = iCheckFirstAnim;
+
+ newElement->iIsUserSeek = EFalse;
+
+
+
+
+ if(iEventList)
+ {
+ TInt lCount = iEventList->Count();
+
+
+ newElement->iEventList->Reset();
+ for(TInt i=0;i<lCount;i++ )
+ {
+ newElement->iEventList->AppendL(iEventList->operator[](i));
+ (newElement->iEventList->operator[](i)).iReferenceElemeId = NULL;
+ if(iEventList->operator[](i).iReferenceElemeId)
+ {
+ (newElement->iEventList->operator[](i)).iReferenceElemeId = (iEventList->operator[](i).iReferenceElemeId)->AllocL();
+ }
+ else
+ {
+ (newElement->iEventList->operator[](i)).iReferenceElemeId = NULL;
+ }
+ }
+ }
+
+
+ if(iEndTimeList)
+ {
+ TInt lCount = iEndTimeList->Count();
+ newElement->iEndTimeList->Reset();
+ for(TInt i=0;i<lCount;i++ )
+ {
+ newElement->iEndTimeList->AppendL(iEndTimeList->operator[](i));
+ (newElement->iEndTimeList->operator[](i)).iReferenceElemeId = NULL;
+ if(iEndTimeList->operator[](i).iReferenceElemeId)
+ {
+ (newElement->iEndTimeList->operator[](i)).iReferenceElemeId = (iEndTimeList->operator[](i).iReferenceElemeId)->AllocL();
+ }
+ else
+ {
+ (newElement->iEndTimeList->operator[](i)).iReferenceElemeId = NULL;
+ }
+ }
+ }
+ }
+
+ }
+// Call stack on Stop and Play
+// CSvgEngineInterfaceImpl::Replay
+// CSvgEngineImpl::SetMediaTime
+// CSvgEngineImpl::SeekEngine
+// CSvgTimeContainer::UserSeek
+// CSvgDocumentImpl::Reset
+// CSvgEventHandler::Reset
+// CSvgEventHandler::DeactivateAnimations
+// CSvgAnimateElementImpl::DeactivateAnimation
+void CSvgAnimationBase::DeactivateAnimation(CSvgAnimationBase* aElement)
+{
+ if(!aElement)return;
+
+ iDoFreeze = EFalse;
+
+ // this should work for multiple begins.
+ if(iEventList->Count()> 0)
+ {
+ if(iEventList->operator[](0).iEvent != ESvgEventNone || iEventList->Count() > 1)
+ {
+ // if it is not absolute.
+ // reset this to initials.
+ iAbsoluteBeginTime = KTimeIndefinite;
+ iHadBegun= EFalse;
+ iBeginTimeIndex = 0 ;
+ iCurrentRepeatCount= 0;
+ iInitDone = EFalse;
+ iOverrideTime = EFalse;
+ iAnimStatus = KAnimNotActive;
+ iAnimTime->SetBeginTime(KTimeIndefinite);
+
+ // reset the time related stuffs.
+ iAnimTime->ReInitialize();
+
+ // this is necessary.
+ if(iAdditiveOrg == KAdditiveReplace)
+ {
+ iAdditive= KAdditivePass;
+ }
+ // this is a virtual function.
+ aElement->ReInitializeAnimation();
+ }
+ }
+
+ // Set the end times to indefinite.
+ if(iEndTimeList->Count()> 0 )
+ {
+ if(iEndTimeList->operator[](0).iEvent != ESvgEventNone )
+ {
+ iAnimTime->SetEndTimesIndefinite();
+ }
+ }
+}
+
+TBool CSvgAnimationBase::ParseViewBoxValue(const TDesC& aValue, TGfxRectangle2D& aRect)
+ {
+
+ TLex input( aValue );
+ TReal32 vBoxX=0;
+ TReal32 vBoxY=0;
+ TReal32 vBoxW=0;
+ TReal32 vBoxH=0;
+
+ input.SkipSpace();
+ if (input.Val( vBoxX, '.' ) != KErrNone)
+ vBoxX= 0;
+
+ if( input.Peek() == ',' )
+ input.Inc();
+ input.SkipSpace();
+ if( input.Peek() == ',' )
+ input.Inc();
+
+ if (input.Val( vBoxY, '.' ) != KErrNone)
+ vBoxY= 0;
+
+
+ if( input.Peek() == ',' )
+ input.Inc();
+ input.SkipSpace();
+ if( input.Peek() == ',' )
+ input.Inc();
+
+ if (input.Val( vBoxW, '.' ) != KErrNone)
+ vBoxW= 0;
+
+ if( input.Peek() == ',' )
+ input.Inc();
+ input.SkipSpace();
+ if( input.Peek() == ',' )
+ input.Inc();
+
+ if (input.Val( vBoxH, '.' ) != KErrNone)
+ vBoxH= 0;
+
+ aRect= TGfxRectangle2D( vBoxX, vBoxY, vBoxW, vBoxH );
+ return ETrue;
+ }
+void CSvgAnimationBase::CheckForEndTimesAndFreezeL(CSvgAnimationBase* aElement)
+{
+ if(iAnimStatus == KAnimFinished) // KAnimFinished
+ {
+ if(!iDoFreeze)
+ {
+ iDoFreeze = ETrue;
+ return;
+ }
+ if ( iFill == KAnimFillFreeze )
+ {
+ aElement->SetToEndValueL();
+ }
+
+ }
+}
+
+// function for decoder
+void CSvgAnimationBase::AddEndTime( TInt32 aEndTime )
+ {
+ if(iAnimTime)
+ iAnimTime->AddEndTime(aEndTime);
+ }
+
+void CSvgAnimationBase::SetAccumulateValuesForSetMediaTime()
+{
+}
+
+TBool CSvgAnimationBase::IsSelfDependentForBegin()
+{
+
+ /*********************************************************************
+
+ This is used only after setmediaTime is done on the svg DOCUMENT.
+ This function is to tell whether the elements begin depends on its end.
+
+ *********************************************************************/
+
+ if(iEventList->Count()> 0)
+ {
+ TInt lCount = iEventList->Count();
+ for(TInt i=0; i< lCount; i++)
+ {
+ if(iEventList->operator[](i).iTargetElement == this &&
+ iEventList->operator[](i).iEvent == ESvgEventEndEvent)
+ {
+ return ETrue;
+ }
+ }
+ }
+
+ return EFalse;
+}
+ void CSvgAnimationBase::SetFromValuesL()
+{
+ /*
+ * this is to make sure that the iOrg values do not get modified once set.
+ */
+ switch ( iDataType )
+ {
+ case KSvgTypeOpacity:
+ case KSvgTypeLength:
+ {
+ // This is to handle all cases, was only fill="freeze" cases.
+ if (iNoFrom)
+ {
+ TFloatFixPt lTempValue;
+ iTargetElement->GetAttributeFloat( iAttrId, lTempValue );
+ iFromFloat = lTempValue;
+ }
+ }
+ break;
+
+ case KSvgTypeList:
+ case KSvgTypePath:
+
+ {
+
+ if (iNoFrom )
+ {
+ if ( iFromPath )
+ {
+ delete iFromPath;
+ iFromPath = NULL;
+ }
+ CGfxGeneralPath*parentPath;
+ iFromPath = CGfxGeneralPath::NewL();
+ iTargetElement->GetAttributePath( iAttrId, parentPath );
+ CGfxPathIterator* itr;
+ TGfxAffineTransform affineTransform;
+ parentPath->GetPathIteratorL( &affineTransform, itr );
+ CleanupStack::PushL( itr );
+ iFromPath->AppendL( itr );
+ CleanupStack::PopAndDestroy( 1 ); // destroy itr
+ }
+
+ }
+ break;
+ /*
+ * The above algorithm can be applicable to color as well.
+ * Results are not same as adobe.
+ */
+ case KSvgTypeColor:
+
+ break;
+
+ // following are all strings data types.
+ case KSvgTypeTextAnchor:
+ case KSvgTypeGradientUnits:
+ case KSvgTypeSpreadMethod:
+ case KSvgTypeInteger:
+ case KSvgTypeDisplay:
+ case KSvgTypeVisibility:
+ if (iAttributeFlag)
+ if ( iNoFrom )
+ {
+ iTargetElement->GetAttributeIntL( iAttrId, iFromInt);
+ }
+ break;
+
+ // viewBox
+ case KSvgTypeViewBox:
+ {
+ if(iTargetElement->ElemID() == KSvgSvgElement)
+ {
+ if (iNoFrom)
+ {
+ TGfxRectangle2D lTempVierwBox;
+ ((CSvgSvgElementImpl*)iTargetElement)->GetViewBox( lTempVierwBox );
+ iFromViewBox = lTempVierwBox;
+ }
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+TInt32 CSvgAnimationBase::GetAbsoluteBeginTime()
+ {
+ return iAbsoluteBeginTime;
+ }
+
+TInt32 CSvgAnimationBase::GetEndTime()
+ {
+ return iAnimTime->EndTime();
+ }
+
+
+void CSvgAnimationBase::CheckBeginTime()
+ {
+
+ if (iAnimTime->BeginTimesCount() == 0 && iAnimTime->BeginTime() == 0)
+ {
+ iAnimTime->AddBeginTime(0);
+ iAnimTime->AddToInitialList(0);
+ }
+ }
+
+void CSvgAnimationBase::StoreRepeatId( const TDesC& aValue, TBool aRepeatWasInBeginAtt )
+{
+ if (iRepeatId)
+ {
+ delete iRepeatId;
+ iRepeatId = NULL;
+ }
+
+ iRepeatInBegin = aRepeatWasInBeginAtt;
+ TRAPD( error, iRepeatId = aValue.AllocL() );
+ if ( error != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgAnimationBase::StoreRepeatId: iRepeatId = aValue.AllocL() leaves");
+ #endif
+ }
+}
+
+void CSvgAnimationBase::NotifyAnimationsRepeatingOnThisOneL( const TDesC* aId )
+{
+ // Get THhe Engine's Current Media Time.
+ CSvgDocumentImpl* lDocument = ((CSvgDocumentImpl*)iOwnerDocument);
+
+ if ( !aId || aId->Length() == 0 )
+ return;
+
+ TInt32 lEngineTime = ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->CurrentTIme();
+
+ TInt lAnimationCount = lDocument->iSvgAnimations.Count();
+ for (TInt i=0; i < lAnimationCount; i++)
+ {
+ CSvgAnimationBase* lAnimatingElement = lDocument->iSvgAnimations[i];
+ if ( lAnimatingElement->iRepeatId && (lAnimatingElement->iRepeatId->CompareF(*aId) == 0 ) )
+ {
+ if (lAnimatingElement->iRepeatInBegin)
+ {
+ lAnimatingElement->SetBeginByEventL( lAnimatingElement,lEngineTime, ETrue );
+ }
+ else
+ {
+ //it must have been in an end attribute
+ lAnimatingElement->SetEndByEvent(lAnimatingElement, lEngineTime );
+ }
+
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// void CSvgAnimationBase::FindColorDistanceL()
+// This function computes the distance between colours for the purpose
+// of animateColor element. Colours are treated as a 3D point
+// with r, g, b acting as axes. It modifies the iValuesFloat array and each
+// index contains the cummulative length(from start colour) of the segment
+// with same index
+// ---------------------------------------------------------------------------
+void CSvgAnimationBase::FindColorDistanceL()
+ {
+ TInt lcount = iValuesInt->Count();
+
+ //Fix for MLIO-743FRR:check whether "values" attribute is present
+ if ( lcount > 0 )
+ {
+ iValuesFloat->AppendL( 0 );
+ }
+
+ TFloatFixPt len = 0;
+
+ for(TInt i = 1; i < lcount; i++)
+ {
+ TInt c1 = (*iValuesInt)[i-1];
+ TInt c2 = (*iValuesInt)[i];
+ TInt r1 = c1 & 0x00FF0000;
+ r1 = r1 >> 16;
+ TInt g1 = c1 & 0x0000FF00;
+ g1 = g1 >> 8;
+ TInt b1 = c1 & 0x000000FF;
+
+ TInt r2 = c2 & 0x00FF0000;
+ r2 = r2 >> 16;
+ TInt g2 = c2 & 0x0000FF00;
+ g2 = g2 >> 8;
+ TInt b2 = c2 & 0x000000FF;
+
+ TInt dr = r1 - r2;
+ TInt dg = g1 - g2;
+ TInt db = b1 - b2;
+
+ TFloatFixPt length = TFloatFixPt::Sqrt( dr * dr + dg * dg + db * db );
+ //TFloatFixPt length = Math::Sqrt( dr * dr + dg * dg + db * db );
+ len += length;
+ iValuesFloat->AppendL( len );
+ }
+ }
+
+TBool CSvgAnimationBase::IsFillFreeze()
+ {
+ if ( iFill == KAnimFillFreeze )
+ return ETrue;
+ else
+ return EFalse;
+ }
+void CSvgAnimationBase::ResetTimes()
+ {
+ iAnimTime->ResetBeginTime();
+ iAnimTime->ResetEndTime();
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGAnimationElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,745 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+// INCLUDE FILES
+#include "SVGAnimationElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+#include "SVGAnimationBase.h"
+#include "SVGEvent.h"
+#include "SVGEventHandler.h"
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// Setter functions
+
+// -----------------------------------------------------------------------------
+// SetRecursionVariable: Set aIsRecursion to indicate that the element has been
+// cloned or not.
+//
+// Returns: TFloatFixPt
+// -----------------------------------------------------------------------------
+//
+void CSvgAnimationElementImpl::SetRecursionVariable(TBool aIsRecursion)
+ {
+ iUseInRecursion = aIsRecursion;
+ }
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// Getter functions
+
+// -----------------------------------------------------------------------------
+// X: returns iX
+//
+// Returns: TFloatFixPt
+// -----------------------------------------------------------------------------
+//
+TFloatFixPt CSvgAnimationElementImpl::X()
+ {
+ return iX;
+ }
+
+
+// -----------------------------------------------------------------------------
+// Y: returns iY
+//
+// Returns: TFloatFixPt
+// -----------------------------------------------------------------------------
+//
+TFloatFixPt CSvgAnimationElementImpl::Y()
+ {
+ return iY;
+ }
+
+
+// -----------------------------------------------------------------------------
+// Width: returns iWidth
+//
+// Returns: TFloatFixPt
+// -----------------------------------------------------------------------------
+//
+TFloatFixPt CSvgAnimationElementImpl::Width()
+ {
+ return iWidth;
+ }
+
+
+// -----------------------------------------------------------------------------
+// Height: return iHeight
+//
+// Returns: TFloatFixPt
+// -----------------------------------------------------------------------------
+//
+TFloatFixPt CSvgAnimationElementImpl::Height()
+ {
+ return iHeight;
+ }
+
+
+// -----------------------------------------------------------------------------
+// PreservRatio: Returns the PreserveAspecRatio's setting. Mainly used by encoder.
+//
+// Returns: Descriptor of PreserveAspecRatio value
+// -----------------------------------------------------------------------------
+//
+const TDesC& CSvgAnimationElementImpl::PreservRatio()
+ {
+ return (TDesC&) *iPreservRatio;
+ }
+
+
+// -----------------------------------------------------------------------------
+// SetAttributeL: Called by Contenthandler or decoder to set attributes
+//
+// Returns: TInt error code
+// -----------------------------------------------------------------------------
+//
+TInt CSvgAnimationElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+ _LIT( KXlink, "xlink:href" );
+ _LIT( KPreserveAspectRatio, "preserveAspectRatio" );
+
+ if ( aName == KXlink )
+ {
+ // STEP 1 - Get the reference element
+ // If the first char is '#' then remove it
+ // This is possible if coming from cXML parser and not CVG Decoder
+ TInt pos = aValue.Locate( '#' );
+ if ( pos != KErrNotFound && pos == 0 )
+ {
+ HBufC* tBufC = HBufC::NewLC( aValue.Length() );
+ TPtr tPtr = tBufC->Des();
+ tPtr.Copy( aValue );
+ tPtr.Delete( pos, 1 );
+
+ if ( this->SetXlinkAttributeL( aName, tPtr ) )
+ {
+ iReferencedElement = ( CSvgElementImpl * )
+ ((CSvgDocumentImpl*)iOwnerDocument)->GetElementById( tPtr );
+
+ if(iReferencedElement == NULL)
+ {
+ // failure in finding the referenced element
+ CleanupStack::PopAndDestroy( 1 ); // tBufC
+ return KErrReferencedElementNotFound;
+ }
+ }
+
+ CleanupStack::PopAndDestroy( 1 ); // tBufC
+ }
+ }
+ else if ( aName == KPreserveAspectRatio )
+ {
+ iPreservRatio = aValue.AllocL();
+ }
+ else
+ {
+ CSvgAnimationBase::SetAttributeL(aName, aValue);
+ }
+
+ return KErrNone;
+ }
+
+
+// -----------------------------------------------------------------------------
+// SetAttributeFloatL: Called by Contenthandler or decoder to set attributes
+//
+// Returns: TInt error code
+// -----------------------------------------------------------------------------
+//
+TInt CSvgAnimationElementImpl::SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrX:
+ iX = aValue;
+ break;
+
+ case KAtrY:
+ iY = aValue;
+ break;
+
+ case KAtrWidth:
+ iWidth = aValue;
+ break;
+
+ case KAtrHeight:
+ iHeight = aValue;
+ break;
+
+ default:
+ return CSvgElementImpl::SetAttributeFloatL( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+
+// -----------------------------------------------------------------------------
+// GetAttributeFloat: returns value of the floating attribute
+//
+// Returns: TInt error code
+// -----------------------------------------------------------------------------
+//
+TInt CSvgAnimationElementImpl::GetAttributeFloat( const TInt aNameId, TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrX:
+ aValue = iX ;
+ break;
+
+ case KAtrY:
+ aValue = iY ;
+ break;
+
+ case KAtrWidth:
+ aValue = iWidth ;
+ break;
+
+ case KAtrHeight:
+ aValue = iHeight ;
+ break;
+
+ default:
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// GetUriRefId: Get the id of reference target id
+//
+// Returns: TDesC& id
+// -----------------------------------------------------------------------------
+//
+//const TDesC& CSvgAnimationElementImpl::GetUriRefId()
+// {
+// return (TDesC&) (iReferencedElement->Id());
+// }
+
+
+// -----------------------------------------------------------------------------
+// IsUriRefSet: Return true or not if uri is set
+//
+// Returns: TBool
+// -----------------------------------------------------------------------------
+//
+TBool CSvgAnimationElementImpl::IsUriRefSet()
+ {
+ if(iReferencedElement)
+ {
+ return ETrue;
+ }
+ else
+ {
+ return EFalse;
+ }
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// ReceiveEventL: The implemented function will be called whenever subscribed
+// events are received.
+//
+// From MSvgEventReceiver
+//
+// Return: TBool ETrue if redraw is needed
+// EFalse if redraw is not needed
+// -----------------------------------------------------------------------------
+//
+TBool CSvgAnimationElementImpl::ReceiveEventL( MSvgEvent* aEvent )
+ {
+ // Processing events after begin time
+ if( CSvgElementImpl::IsSVGEnginePaused())
+ {
+ return EFalse;
+ }
+ CSvgEngineImpl* engine = ((CSvgDocumentImpl*)iOwnerDocument)->Engine();
+ if (engine == NULL)
+ {
+ return EFalse;
+ }
+
+ TInt32 lEngineCurrentTime = engine->CurrentTIme();
+
+ if ( lEngineCurrentTime < iAbsoluteBeginTime)
+ {
+ // not begin yet.
+ return ETrue;
+ }
+ else
+ {
+ // rewrite engine time to simulate different timer
+ if ( aEvent->EventType() == ESvgEngineEventTimer )
+ {
+ ((MSvgTimerEvent*)aEvent)->SetTime( (TInt32)(lEngineCurrentTime
+ - iAbsoluteBeginTime ));
+ }
+ }
+
+ // Basically forward received events to all its children as if they receive
+ // event from DocumentImpl.
+ if ( iAnimationEventHandler->ProcessEventL( aEvent ))
+ {
+ if (iInitSortList)
+ {
+ iAnimationEventHandler->SortEventList();
+ iInitSortList = EFalse;
+ }
+ iAnimationEventHandler->DoAnimProcL(aEvent);
+ engine->RedrawL();
+ }
+ else
+ {
+ // this is to keep the dom in its final state.
+ if(aEvent->EventType() == ESvgEngineEventTimer)
+ {
+ iAnimationEventHandler->DoAnimProcL(aEvent);
+ }
+ }
+
+ // Process key event separately.
+ if (aEvent->EventType() == ESvgEngineEventKeyPress)
+ {
+ }
+
+ // return true to be redrawn
+ return ETrue;
+ }
+
+
+// -----------------------------------------------------------------------------
+// RecursionVariable: Getter function that could be called by Contenthandler or
+// decoder to determine if the element has been cloned.
+// elements
+//
+// Return: TBool ETrue if the element is cloned already
+// -----------------------------------------------------------------------------
+//
+TBool CSvgAnimationElementImpl::RecursionVariable()
+ {
+ return iUseInRecursion;
+ }
+
+
+// -----------------------------------------------------------------------------
+// SetRefElemById: Called by Contenthandler or decoder to set referenced
+// elements
+//
+// Return: none
+// -----------------------------------------------------------------------------
+//
+TInt CSvgAnimationElementImpl::SetRefElemById(const TDesC& aName)
+ {
+ iReferencedElement = ( CSvgElementImpl * )
+ ((CSvgDocumentImpl*)iOwnerDocument)->GetElementById( aName );
+ if( iReferencedElement == NULL )
+ {
+ return KErrNotFound;
+ }
+ else
+ {
+ return KErrNone;
+ }
+
+ }
+
+
+// -----------------------------------------------------------------------------
+// SetReferenceElementL: Called by Contenthandler or decoder to clone referenced
+// element which has been determined in SetRefElemById(...).
+//
+// Return: none
+// -----------------------------------------------------------------------------
+//
+void CSvgAnimationElementImpl::SetReferenceElementL()
+ {
+ _LIT( KPreserveAspectRatio, "preserveAspectRatio" );
+
+ if(!RecursionVariable())
+ {
+ if( iReferencedElement != NULL )
+ {
+ // Setting iUseInRecursion to True so that the Call to CloneL
+ // is not called to this instance of use in this recursion
+ SetRecursionVariable(ETrue);
+
+ CSvgElementImpl* theElement = (CSvgElementImpl *)iReferencedElement->CloneL((MXmlElement*)this);
+ CleanupStack::PushL(theElement);
+ this->CXmlElementImpl::AppendChildL(theElement);
+ CleanupStack::Pop();
+ if(!RecursionVariable())
+ {
+ // The Recursion variable is set to false only when the Cloning
+ // goes into loop.
+ // Using this information and then Setting the Recursion variable
+ // back to True to use the information to set error code in
+ // StartElementL in Content Handler
+ //
+ SetRecursionVariable(ETrue);
+ }
+ else // Normal CloneL loop exit
+ {
+ // Setting iUseInRecursion back to False
+ SetRecursionVariable(EFalse);
+ }
+
+ CSvgDocumentImpl* doc = ( CSvgDocumentImpl* ) OwnerDocument();
+ CSvgSvgElementImpl* lSvgRoot = (CSvgSvgElementImpl*) doc->RootElement();
+ if (iPreservRatio != NULL)
+ {
+ lSvgRoot->SetAttributeL( KPreserveAspectRatio, iPreservRatio->Des() );
+ }
+ lSvgRoot->SetWidth( iX );
+ lSvgRoot->SetHeight( iY );
+
+ }
+ }
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// ResetEventListener: Reset event listeners for it's children
+//
+// Returns: none
+// -----------------------------------------------------------------------------
+//
+void CSvgAnimationElementImpl::ResetEventListener()
+ {
+ FindAllAnimationElements( (CSvgElementImpl* )this, iMyAnimationElementList );
+
+ // Remove event listening for every animation elements that are child of
+ // this Animation element. This is to implement a separated time container
+ //
+ // Instead, register event linstening to the event handler of this element.
+ //
+ TInt myAnimationEleListCnt = iMyAnimationElementList->Count();
+ for (int i=0; i<myAnimationEleListCnt; i++)
+ {
+ CSvgElementImpl* lCurElem =
+ (CSvgElementImpl*)iMyAnimationElementList->operator[](i);
+ // Removing...
+ ((CSvgDocumentImpl*)iOwnerDocument)->RemoveFromEventReceiverList(lCurElem);
+
+ // Adding...
+ TUint8 eventMask = iAnimationEventHandler->EventMask(lCurElem);
+ TRAPD(err, iAnimationEventHandler->AddToEventReceiverListL( lCurElem, eventMask ));
+ if (err != KErrNone)
+ {
+ #ifdef _DEBUG
+ _LIT(msg, "CSvgAnimationElementImpl::ResetEventListener():Can't add myself to event receiverList");
+ RDebug::Print(msg);
+ #endif //_DEBUG
+ }
+ }
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// RemoveEventListener: Remove event listeners for it's children
+//
+// Returns: none
+// -----------------------------------------------------------------------------
+//
+void CSvgAnimationElementImpl::RemoveEventListener()
+ {
+ FindAllAnimationElements( (CSvgElementImpl* )this, iMyAnimationElementList );
+
+ // Remove event listening for every animation elements that are child of
+ // this Animation element. This is to implement a separated time container
+ //
+ // Instead, register event linstening to the event handler of this element.
+ //
+ for (int i=0; i<iMyAnimationElementList->Count(); i++)
+ {
+ CSvgElementImpl* lCurElem =
+ (CSvgElementImpl*)iMyAnimationElementList->operator[](i);
+ // Removing...
+ iAnimationEventHandler->RemoveFromEventReceiverList( lCurElem );
+ }
+ }
+
+
+
+
+// -----------------------------------------------------------------------------
+// CSvgAnimationElementImpl: Find all animation elements and save it to aList
+//
+// Returns: none
+// -----------------------------------------------------------------------------
+//
+void CSvgAnimationElementImpl::FindAllAnimationElements(
+ CSvgElementImpl* aElement,
+ RPointerArray<CSvgElementImpl>* aList )
+ {
+ CSvgElementImpl* child = (CSvgElementImpl*)aElement->FirstChild();
+ while ( child != NULL )
+ {
+ if ( IsAnimationElement(child) )
+ {
+ aList->Append( child );
+ }
+ FindAllAnimationElements( child, aList );
+ child = (CSvgElementImpl*)child->NextSibling();
+ }
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// IsAnimationElement: A utility function that check if the element
+// is an animation element.
+//
+// Returns: TBool ETrue if the element is a animation element.
+// EFalse if the element is not an animation element.
+// -----------------------------------------------------------------------------
+//
+TBool CSvgAnimationElementImpl::IsAnimationElement(CSvgElementImpl* aElement)
+ {
+
+ TInt id = aElement->ElemID();
+
+ return (( id == KSvgAnimateElement ) ||
+ ( id == KSvgAnimateMotionElement ) ||
+ ( id == KSvgAnimateTransformElement ) ||
+ ( id == KSvgSetElement ) ||
+ ( id == KSvgAnimateColorElement ));
+ }
+
+
+// -----------------------------------------------------------------------------
+// ResetAnimationL: Actions to reset the animation
+//
+// Returns: none
+// -----------------------------------------------------------------------------
+//
+void CSvgAnimationElementImpl::ResetAnimationL()
+ {
+ }
+
+
+// -----------------------------------------------------------------------------
+// AnimProcL: Actions to reset the animation
+//
+// Returns: none
+// -----------------------------------------------------------------------------
+//
+TBool CSvgAnimationElementImpl::AnimProcL( MSvgTimerEvent* aEvent )
+ {
+ if (aEvent->EventType() == ESvgEngineEventKeyPress)
+ {
+ }
+
+ return EFalse;
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// CloneL: Perform a deep clone of this object
+//
+// Returns: MXmlElement pointer to the newly created element.
+// -----------------------------------------------------------------------------
+//
+MXmlElement* CSvgAnimationElementImpl::CloneL(MXmlElement* aParentElement)
+ {
+
+ if(RecursionVariable())
+ {
+ SetRecursionVariable(EFalse);
+ return NULL;
+ }
+
+ CSvgAnimationElementImpl* newElement = CSvgAnimationElementImpl::NewL( this->ElemID(),
+ ((CSvgDocumentImpl*)iOwnerDocument) );
+ CleanupStack::PushL(newElement);
+ newElement->iParentNode = aParentElement;
+
+ // copy everything over
+ this->CopyL(newElement);
+ CleanupStack::Pop();
+
+ return newElement;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CopyL: Perform a deep copy of this object
+//
+// Returns: none
+// -----------------------------------------------------------------------------
+//
+void CSvgAnimationElementImpl::CopyL( CSvgAnimationElementImpl* aDestElement )
+ {
+ if(aDestElement)
+ {
+ aDestElement->iX = this->iX;
+ aDestElement->iY = this->iY;
+ aDestElement->iHeight = this->iHeight;
+ aDestElement->iWidth = this->iWidth;
+ aDestElement->iReferencedElement = this->iReferencedElement;
+
+ aDestElement->SetRecursionVariable(this->RecursionVariable());
+ aDestElement->iOwnerDocument = this->iOwnerDocument;
+ // copy stuff from superclass
+ this->CSvgElementImpl::CopyL(aDestElement);
+ }
+ }
+
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSvgAnimationElementImpl* CSvgAnimationElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc)
+ {
+ CSvgAnimationElementImpl* self = new (ELeave)CSvgAnimationElementImpl(aDoc);
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSvgAnimationElementImpl* CSvgAnimationElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc)
+ {
+ CSvgAnimationElementImpl* self = new (ELeave) CSvgAnimationElementImpl(aDoc);
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+
+// -----------------------------------------------------------------------------
+// C++ default constructor
+// -----------------------------------------------------------------------------
+//
+CSvgAnimationElementImpl::CSvgAnimationElementImpl( CSvgDocumentImpl* aDoc )
+ : CSvgAnimationBase( aDoc )
+ {
+ iInitSortList = ETrue; //True indicates that the soring has not been done.
+ }
+
+
+// -----------------------------------------------------------------------------
+// Symbian default constructor that can leave.
+// -----------------------------------------------------------------------------
+//
+void CSvgAnimationElementImpl::ConstructL( const TUint8 aElemID )
+ {
+ CSvgAnimationBase::ConstructL( aElemID );
+
+ iSvgStyleProperties = new(ELeave) RPointerArray<CCssValue>(KCSS_MAX_ATTR);
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+ iSvgStyleProperties->Remove( 0 );
+
+ iMyAnimationElementList = new (ELeave)RPointerArray<CSvgElementImpl> (1);
+ iMyAnimationElementList->Reset();
+
+ iSvgTransformable = CSvgTransformableImpl::NewL();
+
+ #ifdef SVG_FLOAT_BUILD
+ iX = ( 0 );
+ iY = ( 0 );
+ #else
+ iX.operator = ( 0 );
+ iY.operator = ( 0 );
+ #endif
+
+ iUseInRecursion = EFalse;
+
+ iAnimationEventHandler = CSvgEventHandler::NewL();
+
+// ((CSvgDocumentImpl*)
+// iOwnerDocument)->AddToEventReceiverListL(this, KSvgEventMaskTimer |
+// KSvgEventMaskInternal | KSvgEventMaskExternalUI);
+ }
+
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSvgAnimationElementImpl::~CSvgAnimationElementImpl()
+ {
+
+ // unregister event listening for all childs.
+ RemoveEventListener();
+
+ if( iAnimationEventHandler )
+ {
+ delete iAnimationEventHandler;
+ iAnimationEventHandler = NULL ;
+ }
+
+
+ if ( iSvgStyleProperties )
+ {
+ iSvgStyleProperties->Close();
+ delete iSvgStyleProperties;
+ iSvgStyleProperties = NULL;
+ }
+
+ if ( iMyAnimationElementList )
+ {
+ iMyAnimationElementList->Reset();
+ iMyAnimationElementList->Close();
+ delete iMyAnimationElementList;
+ }
+
+ if ( iPreservRatio )
+ {
+ delete iPreservRatio;
+ }
+
+ }
+
+void CSvgAnimationElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<animation x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xlink:href=\"hmm\" preserveAspectRatio=\"hmm\" />",
+ (int)iX, (int)iY, (int)iWidth, (int)iHeight/*, Href(), PreservRatio()*/);
+ #endif
+ }
+}
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGAudioElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,791 @@
+/*
+* Copyright (c) 2005 - 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include <AudioPreference.h> // For priority/pref values
+
+#include "SVGAudioElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGEngineImpl.h"
+#include "SVGSchemaData.h"
+#include "SVGTimeContainer.h"
+
+_LIT(KAudioAMR, "audio/amr");
+_LIT(KAudioAWB, "audio/amr-wb");
+_LIT(KAudioMP3, "audio/mpeg");
+_LIT(KAudioMP4, "audio/mp4");
+_LIT(KAudio3GP, "audio/3gp");
+_LIT(KAudio3G2, "audio/3g2");
+_LIT(KAudioAAC, "audio/aac");
+_LIT(KAudioMID, "audio/midi");
+_LIT(KAudioMID2, "audio/sp-midi");
+_LIT(KAudioRMF, "audio/rmf");
+_LIT(KAudioRMF2, "audio/x-rmf");
+_LIT(KAudioRMF3, "audio/x-beatnik-rmf");
+_LIT(KAudioMXMF, "audio/mobile-xmf");
+_LIT(KAudioWMA, "audio/x-ms-wma");
+_LIT(KAttrAudioType, "type" );
+_LIT(KXlinkHref, "xlink:href" );
+_LIT(KDur,"dur");
+_LIT(KMedia,"media");
+_LIT(KAudioLevelStr, "audio-level");
+_LIT(KVolumeStr, "volume");
+
+// audio-level property by default is 100%
+const TInt KAudioLevelDefaultPercent = 100;
+const TInt KMillisecondsPerMicrosecond = 1000;
+// ---------------------------------------------------------------------------
+// Create new element of audioelementimpl
+// ---------------------------------------------------------------------------
+CSvgAudioElementImpl* CSvgAudioElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgAudioElementImpl* self = new ( ELeave )
+ CSvgAudioElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID, aDoc );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Create new element of audioelementimpl
+// ---------------------------------------------------------------------------
+CSvgAudioElementImpl* CSvgAudioElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgAudioElementImpl* self = new ( ELeave )
+ CSvgAudioElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID,aDoc );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Create new element of audioelementimpl
+// ---------------------------------------------------------------------------
+void CSvgAudioElementImpl::ConstructL( const TUint8 aElemID,
+ CSvgDocumentImpl* /* aDoc */ )
+ {
+ iPercentLevelVolume = KAudioLevelDefaultPercent;
+ CSvgMediaElementBase::ConstructL( aElemID );
+ iStoredPos = 0;
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor for Audioelement
+// ---------------------------------------------------------------------------
+CSvgAudioElementImpl::~CSvgAudioElementImpl()
+ {
+ if ( iAudioPlayer )
+ {
+ iAudioPlayer->Stop();
+ delete iAudioPlayer;
+ iAudioPlayer = NULL;
+ }
+ if( iUri)
+ {
+ delete iUri;
+ iUri= NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Sets attributes of audio element
+// ---------------------------------------------------------------------------
+TInt CSvgAudioElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+ if (!iTargetSet)
+ {
+ iTargetElement = ( CSvgElementImpl * ) ParentNode();// default is parent element
+ if (iTargetElement)
+ {
+ iTargetSet = ETrue;
+ }
+ }
+
+ if(aName == KDur && aValue != KMedia)
+ {
+ iDurMedia = EFalse;
+
+ }
+
+ if( aName == KXlinkHref)
+ {
+ this->SetXlinkAttributeL(aName,aValue);
+ iUri = aValue.AllocL();
+ }
+ if ( aName == KAttrAudioType )
+ {
+ HBufC16* tempValue = aValue.Alloc();
+ TPtr16 lowercaseValue = tempValue->Des();
+ lowercaseValue.LowerCase();
+
+ if ( !( (lowercaseValue == KAudioAMR) ||
+ (lowercaseValue == KAudioAWB) ||
+ (lowercaseValue == KAudioMP3) ||
+ (lowercaseValue == KAudioMP4) ||
+ (lowercaseValue == KAudio3GP) ||
+ (lowercaseValue == KAudio3G2) ||
+ (lowercaseValue == KAudioAAC) ||
+ (lowercaseValue == KAudioMID) ||
+ (lowercaseValue == KAudioMID2) ||
+ (lowercaseValue == KAudioRMF) ||
+ (lowercaseValue == KAudioRMF2) ||
+ (lowercaseValue == KAudioRMF3) ||
+ (lowercaseValue == KAudioMXMF) ||
+ (lowercaseValue == KAudioWMA) ))
+ {
+ iAudioStatus = EPlayerProhibit;
+ }
+ delete tempValue;
+ }
+ else if (( aName == KAudioLevelStr) || ( aName == KVolumeStr ))
+ {
+ TLex value ( aValue );
+ TReal32 volume;
+ if( value.Val( volume, '.' ) == KErrNone)
+ {
+ iVolume = volume < 0 ? 0 : volume;
+ iVolume = volume > 1 ? 1 : volume;
+ }
+ return KErrNone;
+ }
+ return CSvgMediaElementBase::SetAttributeL( aName, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// Sets attributes of audio element
+// ---------------------------------------------------------------------------
+
+TInt CSvgAudioElementImpl::SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue )
+ {
+ return CSvgElementImpl::SetAttributeDesL( aNameId, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+// Sets attributes of audio element
+// ---------------------------------------------------------------------------
+TInt CSvgAudioElementImpl::SetAttributeFloatL( const TInt aNameId,
+ TFloatFixPt aValue )
+ {
+ return CSvgMediaElementBase::SetAttributeFloatL(aNameId,aValue);
+ }
+
+
+// ---------------------------------------------------------------------------
+// Gets attributes of audio element
+// ---------------------------------------------------------------------------
+TInt CSvgAudioElementImpl::GetAttributeFloat(const TInt aNameId,
+ TFloatFixPt& aValue )
+ {
+ return CSvgMediaElementBase::GetAttributeFloat(aNameId,aValue);
+ }
+
+
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+// Deep Copy of the parent
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgAudioElementImpl::CloneL(MXmlElement* aParentElement)
+ {
+ CSvgAudioElementImpl* newElement = CSvgAudioElementImpl::NewL(
+ this->ElemID(), ((CSvgDocumentImpl*)iOwnerDocument) );
+
+ CleanupStack::PushL(newElement);
+ newElement->iParentNode = aParentElement;
+ // copy everything over
+ this->CopyL(newElement);
+ CleanupStack::Pop();
+ return newElement;
+ }
+
+
+// ---------------------------------------------------------------------------
+// From MSvgEventReceiver
+// ---------------------------------------------------------------------------
+TBool CSvgAudioElementImpl::ReceiveEventL( MSvgEvent* aEvent )
+ {
+ return CSvgMediaElementBase::ReceiveEventProcL( aEvent, this );
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgAudioElementImpl::InitAnimationL
+// From CSvgMediaElementBase
+// ---------------------------------------------------------------------------
+void CSvgAudioElementImpl::InitAnimationL()
+ {
+ CSvgMediaElementBase::InitAnimationL();
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgAudioElementImpl::ResetAnimationL
+// From CSvgMediaElementBase
+// ---------------------------------------------------------------------------
+void CSvgAudioElementImpl::ResetAnimationL()
+ {
+ if (( iAnimStatus == KAnimActive ) ||
+ ( iAnimStatus == KAnimFinished) ||
+ ( iAnimStatus == KAnimEnd))
+ {
+
+ if (( iAudioStatus == EPlayerStatePlaying ) ||
+ ( iAudioStatus == EPlayerStateComplete ))
+ {
+ // Save the audio start offset
+ iAudioStartOffset =
+ ( ( CSvgDocumentImpl* )iOwnerDocument)->CurrentTime();
+ iStoredPos = 0;
+ // if previously audio is still playing, and asked to play again...
+ iAudioPlayer->Stop();
+ //For Negative Begin
+ if ( iNegativeBeginTime < 0)
+ {
+ const TInt64 aInterval = iNegativeBeginTime * -KMillisecondsPerMicrosecond;
+ TTimeIntervalMicroSeconds aTime(aInterval);
+ iAudioPlayer->SetPosition(aTime);
+ iStoredPos = aTime;
+ }
+ //For Negative Begin
+
+ iAudioPlayer->Play();
+ iAudioStatus = EPlayerStatePlaying;
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgAudioElementImpl::Reset
+// From CSvgMediaElementBase
+// ---------------------------------------------------------------------------
+void CSvgAudioElementImpl::Reset( MSvgEvent* aEvent )
+ {
+
+ iIsUserSeek = ETrue;
+ iStoredPos = 0;
+ // call the animation base function.
+ TSvgTimerEvent* timerEvent = ( TSvgTimerEvent* ) aEvent;
+ if((TInt32)timerEvent->Time() < iAbsoluteBeginTime)
+ {
+ // let it come to initial position.
+ //((CSvgDocumentImpl*)iOwnerDocument)->iInitialDrawFlag = ETrue;
+ ReInitializeAnimation();
+ return;
+ }
+ TRAPD(error,CSvgAnimationBase::ResetL( aEvent, this));
+ if (error != KErrNone)
+ {
+ // error processing not processed
+ return;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Call AnimaProcL
+// ---------------------------------------------------------------------------
+TBool CSvgAudioElementImpl::DoAnimProcL(MSvgEvent* aEvent)
+ {
+ return this->AnimProcL((MSvgTimerEvent*)aEvent);
+ }
+
+
+// ---------------------------------------------------------------------------
+// From MsvgAnimationBase
+// ---------------------------------------------------------------------------
+TBool CSvgAudioElementImpl::AnimProcL( MSvgTimerEvent* /*aEvent*/ )
+ {
+#ifdef _DEBUG
+ RDebug::Print(_L("%d %d"), iAnimStatus, IsAnimating());
+#endif
+ if ( iAudioStatus == EPlayerProhibit )
+ return EFalse;
+
+ if ( /*iAnimTime->DurationTime() == KTimeIndefinite ||*/ iAnimTime->DurationTime() == 0 )
+ {
+ return EFalse;
+ }
+
+ if ( !iAudioPlayer )
+ {
+ iAudioPlayer = CMdaAudioPlayerUtility::NewL(*this);
+ RDebug::Print(_L("SvgtAudioElem: Player created"));
+ }
+
+ if ( iAudioStatus != EPlayerStateIdle && !iAudioPlayer )
+ {
+ // Error case, when player is initialised but
+ // iAudioPlayer pointer is NULL.
+ return EFalse;
+ }
+
+ if( iAnimStatus != KAnimActive )
+ {
+ if ( iAudioStatus == EPlayerStatePlaying )
+ {
+ iStoredPos = 0;
+ iAudioPlayer->Stop();
+ iAudioStatus = EPlayerStateStop;
+ return EFalse;
+ }
+ }
+ else //iAnimStatus == KAnimActive
+ {
+ if ( !iHadBegun )
+ {
+ iHadBegun = ETrue;
+ // Save the time the audio element starts
+ iAudioStartOffset =
+ ( ( CSvgDocumentImpl* )iOwnerDocument)->CurrentTime();
+
+ // this is a restart from begin list.
+ if ((iAudioStatus != EPlayerStateIdle) &&
+ (iAudioStatus != EPlayerStatePlayInit))
+ {
+ iStoredPos = 0;
+ iAudioPlayer->Stop();
+ iAudioPlayer->Play();
+ iAudioStatus = EPlayerStatePlaying;
+ }
+ return ETrue;
+ }
+
+ if ( iAudioStatus == EPlayerStateIdle ) // stopped
+ {
+ // Indicate to the time container that audio element
+ // is not ready
+ ( ( CSvgDocumentImpl* )
+ iOwnerDocument )->TimeContainer()->TimedEntityNotReady(
+ this );
+ // Save the audio start offset
+ iAudioStartOffset =
+ ( ( CSvgDocumentImpl* )iOwnerDocument)->CurrentTime();
+ TPtrC href = Href();
+ #ifdef _DEBUG
+ RDebug::Print(_L("CSvgAudioElementImpl::NewFilePlayerL is to be called"));
+ RDebug::RawPrint(href);
+ #endif
+
+ //Check and load file here
+ RFs session;
+ CSvgErrorImpl* SvgError = CSvgErrorImpl::NewL();
+ CSvgDocumentImpl::OpenSession( session, *SvgError );
+
+ RFile fileHandle;
+
+ CSvgDocumentImpl* document = (CSvgDocumentImpl*)OwnerDocument();
+ CSvgEngineImpl* engine = document->Engine();
+ MSvgRequestObserver* lRequestObserver = NULL;
+ TInt lFetchStatus = KErrNone;
+ if(engine!= NULL)
+ {
+ lRequestObserver = engine->iRequestObserver;
+ }
+ else
+ {
+ return EFalse;
+ }
+
+ if(lRequestObserver != NULL)
+ {
+ lFetchStatus = lRequestObserver->FetchImage( *iUri, session, fileHandle );
+ }
+ else
+ {
+ return EFalse;
+ }
+
+ if(lFetchStatus == KErrNone)
+ {
+ iAudioPlayer->OpenFileL(fileHandle);
+
+ }
+ else
+ {
+ return EFalse;
+ }
+ if(SvgError)
+ {
+ delete SvgError;
+ }
+ session.Close();
+ iAudioStatus = EPlayerStatePlayInit;
+ #ifdef _DEBUG
+ RDebug::Print(_L("SvgtAudioElem: File opened"));
+ #endif
+ return ETrue;
+ }
+ if( iAudioStatus == EPlayerStateStop && iTcCommandState != ESvgTEPausedState)
+ {
+
+ iAudioStartOffset =
+ ( ( CSvgDocumentImpl* )iOwnerDocument)->CurrentTime();
+ // if previously audio is still playing, and asked to play again...
+ iAudioPlayer->Play();
+ iAudioStatus = EPlayerStatePlaying;
+ }
+ }
+ return ETrue;
+ }
+
+
+
+// ---------------------------------------------------------------------------
+// Set the volume of the Audio Player to the specified level
+// ---------------------------------------------------------------------------
+void CSvgAudioElementImpl::SetVolume(TInt aPercentage)
+ {
+ if(
+ iAudioPlayer &&
+ (iAudioStatus != EPlayerStateIdle && iAudioStatus != EPlayerStatePlayInit && iAudioStatus != EPlayerProhibit)
+ )
+ {
+ TInt lVolLevel = 0;
+ // Check if within limits
+ if ( aPercentage > 0 && aPercentage <= 100 )
+ {
+#ifdef __WINSCW__
+ const TReal32 KMaxAudioVolumeLevels = 65535;
+#else
+ const TReal32 KMaxAudioVolumeLevels = iAudioPlayer->MaxVolume();
+#endif
+ // Calculating the volume based on system volume & element volume
+ TReal32 lRealLevel = ((TReal32)aPercentage/100.0) * KMaxAudioVolumeLevels * iVolume;
+ lVolLevel = lRealLevel;
+ }
+ iAudioPlayer->SetVolume(lVolLevel);
+ }
+ iPercentLevelVolume = aPercentage;
+ }
+
+// ---------------------------------------------------------------------------
+// From CMdaAudioPlayerUtility
+// Callback from Audio Player indicating the audio has finished initalisation
+// ---------------------------------------------------------------------------
+void CSvgAudioElementImpl::MapcInitComplete(TInt aError,
+ const TTimeIntervalMicroSeconds& aDuration)
+ {
+ if ( aError == KErrNone )
+ {
+ if(iDurMedia)
+ {
+ TTimeIntervalMicroSeconds durInMicroS;
+ durInMicroS = aDuration;
+
+
+ TInt32 durInMilliS;
+ durInMilliS = durInMicroS.Int64() / KMillisecondsPerMicrosecond;
+
+ iAnimTime->SetDurationTime(durInMilliS);
+ //In ReInitialize function of AnimTimeController
+ // the duration is reinitialized from Org Duration
+ iAnimTime->SetOrgDurationTime(durInMilliS);
+ }
+#ifdef _DEBUG
+ RDebug::Print(_L("CSvgAudioElementImpl::MapcInitComplete :-> Open audio file OK!"));
+#endif
+ iMediaDuration = aDuration;
+
+ TInt lVolLevel = 0;
+
+ // Check if within limits
+ if ( iPercentLevelVolume > 0 && iPercentLevelVolume <= 100 )
+ {
+#ifdef __WINSCW__
+ const TReal32 KMaxAudioVolumeLevels = 65535;
+#else
+ const TReal32 KMaxAudioVolumeLevels = iAudioPlayer->MaxVolume();
+#endif
+ // Calculating the volume based on system volume & element volume
+ TReal32 lRealLevel = ((TReal32)iPercentLevelVolume/100.0) * KMaxAudioVolumeLevels * iVolume;
+ lVolLevel = lRealLevel;
+ }
+ iAudioPlayer->SetVolume(lVolLevel);
+ // If the pause command was issued do not play, the resume should set
+ // it playing
+ if(iTcCommandState == ESvgTEPlayingState)
+ {
+#ifdef _DEBUG
+ RDebug::Print(_L("To play"));
+#endif
+ iAudioPlayer->Play();
+ iAudioStatus = EPlayerStatePlaying;
+ }
+ else if(iTcCommandState == ESvgTEStoppedState)
+ {
+ iAudioStatus = EPlayerStateStop;
+ }
+ else
+ {
+ iAudioStatus = EPlayerStatePaused;
+ }
+ }
+ else
+ {
+ #ifdef _DEBUG
+ RDebug::Print(_L("CSvgAudioElementImpl::MapcPlayComplete :-> Error code [%d]"), aError);
+ #endif
+ }
+ if ( iNegativeBeginTime < 0 )
+ {
+ const TInt64 aInterval = iNegativeBeginTime * -1000;
+ TTimeIntervalMicroSeconds aTime(aInterval);
+ iAudioPlayer->SetPosition(aTime);
+ iStoredPos = aTime;
+ }
+ // Indicate to time container that audio element is ready
+ ( ( CSvgDocumentImpl* )iOwnerDocument )->TimeContainer()->TimedEntityReady(
+ this );
+
+ }
+
+// ---------------------------------------------------------------------------
+// From CMdaAudioPlayerUtility
+// Callback from Audio Player indicating the audio has finished playing
+// ---------------------------------------------------------------------------
+void CSvgAudioElementImpl::MapcPlayComplete(TInt aError)
+ {
+ // normal play exit
+ iAudioStatus = EPlayerStateComplete;
+
+ if ( aError != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Print(_L("CSvgAudioElementImpl::MapcPlayComplete :-> Error code [%d]"), aError);
+ #endif
+ }
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSvgAudioElementImpl::CanGenerateTick
+// From CSvgMediaElementBase
+// -----------------------------------------------------------------------------
+TBool CSvgAudioElementImpl::CanGenerateTick()
+ {
+ // If media is playing then audio element can generate tick
+ if ( iAudioPlayer &&
+ ( iAudioStatus == EPlayerStatePlaying ||
+ iAudioStatus == EPlayerStatePlayInit ) )
+ {
+ return ETrue;
+ }
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgAudioElementImpl::GetEntityCurrentTime
+// From CSvgMediaElementBase
+// -----------------------------------------------------------------------------
+//
+void CSvgAudioElementImpl::GetEntityCurrentTime( TUint32&
+ aEntityCurTime ) // Current Entity Time in msecs.
+ {
+ if ( iAudioPlayer && iAudioStatus != EPlayerStateIdle )
+ {
+ // Convert to milliseconds and account for negative begin time
+ // and the audio start offset and send back
+ if(iAudioStatus == EPlayerStateComplete)
+ {
+ TTimeIntervalMicroSeconds lDuration = iAudioPlayer->Duration();
+ aEntityCurTime = iAudioStartOffset + lDuration.Int64() / KMillisecondsPerMicrosecond;
+ }
+ else
+ {
+ TTimeIntervalMicroSeconds lPos;
+ iAudioPlayer->GetPosition( lPos );
+
+ // at EOF lPos returns zero, no point of time should
+ // iStorePos be greater than lPos
+ if(iStoredPos > lPos)
+ {
+ lPos = iStoredPos;
+ }
+ else
+ {
+ iStoredPos = lPos;
+ }
+ #ifdef _DEBUG
+ RDebug::Printf("====================================");
+ RDebug::Printf("Audio gets current position \n");
+ RDebug::Printf("lpos %d", lPos.Int64());
+ RDebug::Printf("====================================");
+ #endif
+ aEntityCurTime = iAudioStartOffset + lPos.Int64() / KMillisecondsPerMicrosecond;
+ }
+ if(iAudioStatus == EPlayerStatePlaying)
+ {
+ aEntityCurTime += iNegativeBeginTime;
+ }
+ }
+ else
+ {
+ aEntityCurTime = iAudioStartOffset;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgAudioElementImpl::ResyncTimedEntity
+// From CSvgMediaElementBase
+// -----------------------------------------------------------------------------
+void CSvgAudioElementImpl::ResyncTimedEntity(
+ TUint32 aSyncTime ) // Time for resync in msecs.
+ {
+ if ( iAudioPlayer && iAudioStatus == EPlayerStatePlaying )
+ {
+ // Convert sync to microsecs before setting position
+ TTimeIntervalMicroSeconds lSeekPos( aSyncTime * KMillisecondsPerMicrosecond );
+ iAudioPlayer->SetPosition( lSeekPos );
+ iStoredPos = lSeekPos;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgAudioElementImpl::PauseTimedEntity
+// From CSvgMediaElementBase
+// -----------------------------------------------------------------------------
+void CSvgAudioElementImpl::PauseTimedEntity()
+ {
+
+ iTcCommandState = ESvgTEPausedState;
+ if ( iAudioPlayer && iAudioStatus == EPlayerStatePlaying )
+ {
+ iAudioPlayer->Pause();
+ iAudioStatus = EPlayerStatePaused;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgAudioElementImpl::ResumeTimedEntity
+// From CSvgMediaElementBase
+// -----------------------------------------------------------------------------
+void CSvgAudioElementImpl::ResumeTimedEntity()
+ {
+ iTcCommandState = ESvgTEPlayingState;
+ // Resume of the player is done only when it is Pause State
+ // When resume is done on Stopped/Completed, it might start playing it
+ // even though animation is not active or it is not supposed to repeat.
+ if ( iAudioStatus == EPlayerStatePaused )
+ {
+ iAudioPlayer->Play();
+ iAudioStatus = EPlayerStatePlaying;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgAudioElementImpl::StopTimedEntity
+// From CSvgMediaElementBase
+// -----------------------------------------------------------------------------
+void CSvgAudioElementImpl::StopTimedEntity()
+ {
+ iTcCommandState = ESvgTEStoppedState;
+ if ( iAudioPlayer && iAudioStatus != EPlayerStateIdle )
+ {
+ iStoredPos = 0;
+ iAudioPlayer->Stop();
+ iAudioStatus = EPlayerStateStop;
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+//From MSvgTimedEntityInterface
+// ---------------------------------------------------------------------------
+TSvgObjectType CSvgAudioElementImpl::ObjectType()
+ {
+ return ESvgAudioElement;
+ }
+
+
+
+// ---------------------------------------------------------------------------
+// returns the child time container of the element
+// used in timecontainer
+// ---------------------------------------------------------------------------
+CSvgTimeContainer* CSvgAudioElementImpl::GetChildTimeContainer()
+ {
+ return NULL;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Constructor for CSvgAudioElementImpl
+// ---------------------------------------------------------------------------
+CSvgAudioElementImpl::CSvgAudioElementImpl( CSvgDocumentImpl* aDoc )
+ : CSvgMediaElementBase( aDoc ),
+ iAudioStatus(EPlayerStateIdle),
+ iVolume(1),
+ iTcCommandState(ESvgTEPlayingState),
+ iDurMedia(ETrue)
+ {
+ iAttrId = KAtrAudioId;
+ iAudioPlayer = NULL;
+ }
+
+
+// ---------------------------------------------------------------------------
+// perform a deep copy of this object
+// ---------------------------------------------------------------------------
+void CSvgAudioElementImpl::CopyL( CSvgAudioElementImpl* aDestElement )
+ {
+ if(aDestElement)
+ {
+ // copy stuff from superclass
+ this->CSvgElementImpl::CopyL(aDestElement);
+
+ // copy the reference to idoc (CSvgDocumentImpl)
+ aDestElement->iOwnerDocument = this->iOwnerDocument;
+ aDestElement->iAudioPlayer = this->iAudioPlayer;
+ aDestElement->iAudioStatus = this->iAudioStatus;
+ aDestElement->iVolume = this->iVolume;
+ aDestElement->iPercentLevelVolume = this->iPercentLevelVolume;
+ aDestElement->iMediaDuration = this->iMediaDuration;
+ aDestElement->iTcCommandState = this->iTcCommandState;
+ aDestElement->iAudioStartOffset = this->iAudioStartOffset;
+ aDestElement->iDurMedia = this->iDurMedia;
+ }
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAudioElementImpl::DeactivateAnimation()
+ {
+ CSvgAnimationBase::DeactivateAnimation(this);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgAudioElementImpl::Print( TBool aIsEncodeOn )
+ {
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<audio>");
+ #endif
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// End of file
+// ---------------------------------------------------------------------------
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGCircleElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,373 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "SVGCircleElementImpl.h"
+#include "SVGElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+
+#include "GfxAffineTransform.h"
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgCircleElementImpl* CSvgCircleElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgCircleElementImpl* self = new ( ELeave )
+ CSvgCircleElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgCircleElementImpl* CSvgCircleElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgCircleElementImpl* self = new ( ELeave )
+ CSvgCircleElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgCircleElementImpl::ConstructL( const TUint8 aElemID )
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+
+ iSvgStyleProperties = new(ELeave) RPointerArray<CCssValue>(KCSS_MAX_ATTR);
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+ iSvgStyleProperties->Remove( 0 );
+
+ iSvgTransformable = CSvgTransformableImpl::NewL();
+
+ iReqAttrFlag=KSVG_CIRCLE_ELEMFLAG;
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgCircleElementImpl::~CSvgCircleElementImpl()
+ {
+
+ if ( iSvgStyleProperties )
+ {
+ iSvgStyleProperties->Close();
+ delete iSvgStyleProperties;
+ iSvgStyleProperties = NULL;
+ }
+ }
+
+// *******************************************************
+// From SVG DOM
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgCircleElementImpl::Cx()
+ {
+ #ifdef SVG_FLOAT_BUILD
+ return iCircle.iX + (iCircle.iWidth * TFloatFixPt( 0.5f ) );
+ #else
+ return iCircle.iX + (iCircle.iWidth >> 1);
+ #endif
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+TFloatFixPt CSvgCircleElementImpl::Cy()
+ {
+ #ifdef SVG_FLOAT_BUILD
+ return iCircle.iY + (iCircle.iHeight * .5f);
+ #else
+ return iCircle.iY + (iCircle.iHeight >> 1);
+ #endif
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+TFloatFixPt CSvgCircleElementImpl::R()
+ {
+ #ifdef SVG_FLOAT_BUILD
+ return iCircle.iWidth * .5f;
+ #else
+ return iCircle.iWidth >> 1;
+ #endif
+ }
+
+// *******************************************************
+// SVG Implementation
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+void CSvgCircleElementImpl::SetCx( TFloatFixPt aCx )
+ {
+ #ifdef SVG_FLOAT_BUILD
+ iCircle.iX = aCx - (iCircle.iWidth * .5f);
+ #else
+ iCircle.iX = aCx - (iCircle.iWidth >> 1);
+ #endif
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+void CSvgCircleElementImpl::SetCy( TFloatFixPt aCy )
+ {
+ #ifdef SVG_FLOAT_BUILD
+ iCircle.iY = aCy - (iCircle.iHeight * .5f);
+ #else
+ iCircle.iY = aCy - (iCircle.iHeight >> 1);
+ #endif
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+void CSvgCircleElementImpl::SetR( TFloatFixPt aR )
+ {
+ #ifdef SVG_FLOAT_BUILD
+ if (aR < TFloatFixPt(0))
+ {
+ aR = 0;
+ }
+ iCircle.iX += (iCircle.iWidth * TFloatFixPt(.5f)) - aR;
+ iCircle.iWidth = aR * TFloatFixPt(2.0f);
+ // Both x and width will be changed.
+ iCircle.iY += (iCircle.iHeight * TFloatFixPt(.5f)) - aR;
+ iCircle.iHeight = aR * TFloatFixPt(2.0f);
+ #else
+ if (aR < TFloatFixPt(0, ETrue))
+ {
+ aR = TFloatFixPt(0, ETrue);
+ }
+ iCircle.iX += (iCircle.iWidth >> 1) - aR;
+ iCircle.iWidth = aR << 1;
+ // Both x and width will be changed.
+ iCircle.iY += (iCircle.iHeight >> 1) - aR;
+ iCircle.iHeight = aR << 1;
+ #endif
+
+ }
+
+// *******************************************************
+// From MXmlElement
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgCircleElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+ return KErrNone;
+ }
+
+
+// From MXmlElementOpt
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgCircleElementImpl::GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrCx:
+ case KAtrRefX:
+ aValue = Cx();
+ break;
+ case KAtrCy:
+ case KAtrRefY:
+ aValue = Cy();
+ break;
+ case KAtrRadius:
+ aValue = R();
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgCircleElementImpl::SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrCx:
+ SetCx( aValue );
+ break;
+ case KAtrCy:
+ SetCy( aValue );
+ break;
+ case KAtrRadius:
+ SetR( aValue );
+ iReqAttrFlag = 0;
+ if ( WasTurnedOff() )
+ {
+ _LIT(KInline , "inline");
+ // turn it on. this means all the required attributes Are present and
+ // hence we can render it.
+ CSvgElementImpl::SetPropertyL(KCSS_ATTR_DISPLAY, KInline);
+ SetTurnOff( EFalse );
+ }
+ break;
+ default:
+ return CSvgElementImpl::SetAttributeFloatL( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+// *******************************************************
+// From CSvgElementImpl
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgCircleElementImpl::DrawL( CGfx2dGc* aGc, CSvgElementImpl* aElement )
+ {
+ TFloatFixPt lValue;
+ this->GetAttributeFloat(KAtrRadius,lValue);
+ if (lValue.iValue <= 0)
+ {
+ return ETrue;
+ }
+ this->DrawShapeL( aGc, iCircle, aElement );
+ return ETrue;
+ }
+
+// *******************************************************
+// Private
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+CSvgCircleElementImpl::CSvgCircleElementImpl( CSvgDocumentImpl* aDoc ) : iCircle( 0,
+ 0,
+ 0,
+ 0 )
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgCircleElementImpl::GetBBox( TGfxRectangle2D& aBbox )
+ {
+ iCircle.GetBounds( GetCTM(), aBbox );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgCircleElementImpl::GetUnscaledBBox( TGfxRectangle2D& aBbox )
+ {
+ TGfxAffineTransform identityTx;
+ iCircle.GetBounds( identityTx, aBbox );
+ }
+
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgCircleElementImpl::CloneL(MXmlElement* aParentElement)
+ {
+
+ CSvgCircleElementImpl* newElement = CSvgCircleElementImpl::NewL( this->ElemID(),
+ ((CSvgDocumentImpl*)iOwnerDocument) );
+
+
+ CleanupStack::PushL(newElement);
+ newElement->iParentNode = aParentElement;
+
+ // copy everything over
+ this->CopyL(newElement);
+ CleanupStack::Pop();
+
+ return newElement;
+ }
+
+// perform a deep copy of this object
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgCircleElementImpl::CopyL( CSvgCircleElementImpl* aDestElement )
+ {
+ if(aDestElement)
+ {
+ // copy iCircle items special to circle
+ aDestElement->iCircle.iX = this->iCircle.iX;
+ aDestElement->iCircle.iY = this->iCircle.iY;
+ aDestElement->iCircle.iWidth = this->iCircle.iWidth;
+ aDestElement->iCircle.iHeight = this->iCircle.iHeight;
+
+ // copy the reference to idoc (CSvgDocumentImpl)
+
+ aDestElement->iOwnerDocument = this->iOwnerDocument;
+
+ // copy stuff from superclass
+ this->CSvgElementImpl::CopyL(aDestElement);
+ }
+
+ }
+
+void CSvgCircleElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<circle x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\">", (int)iCircle.iX, (int)iCircle.iY, (int)iCircle.iWidth, (int)iCircle.iHeight);
+ #endif
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGClrCssValueImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include "SVGClrCssValueImpl.h"
+#include "SVGElementImpl.h"
+
+
+// *******************************************************
+// Constructor/deconstructor
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CClrCssValueImpl::~CClrCssValueImpl()
+ {
+ if(iValue)
+ {
+ delete iValue;
+ iValue = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+TSvgColor* CClrCssValueImpl::Value()
+ {
+ return iValue;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CClrCssValueImpl::SetValueL( const TDesC& aValue )
+ {
+
+ if(iValue)
+ {
+ delete iValue;
+ iValue=NULL;
+ }
+
+ _LIT( KNone, "none" );
+ _LIT( KCurrentColor, "currentColor" );
+
+ TUint32 tempVal;
+ if ( aValue == KNone )
+ {
+ tempVal = KGfxColorNull;
+ }
+ else if ( aValue == KCurrentColor )
+ {
+ tempVal = KSvgCurrentColor;
+ }
+ else
+ {
+ TSvgColor tColor(KGfxColorNull);
+ if( tColor.GetStringL( aValue,tempVal) != EFalse )
+ {
+ }
+ else
+ {
+ tempVal = 0;
+ }
+
+ }
+
+ iValue = new (ELeave) TSvgColor(tempVal);
+ return KErrNone;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CClrCssValueImpl::SetValueL( const TInt& aValue )
+ {
+ if(iValue)
+ {
+ delete iValue;
+ iValue=NULL;
+ }
+
+ iValue = new (ELeave)TSvgColor (aValue);
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+void CClrCssValueImpl::SetL(CClrCssValueImpl* aValueToMimic)
+{
+ CloneRGBValueL(aValueToMimic->iValue->GetColor());
+}
+
+// *******************************************************
+// Private
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CClrCssValueImpl::CClrCssValueImpl( ):iValue(NULL)
+ {
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CClrCssValueImpl::CloneRGBValueL(const TInt& aValue)
+ {
+ if ( iValue )
+ {
+ delete ( TSvgColor * ) iValue;
+ iValue = NULL;
+ }
+
+ iValue = new ( ELeave ) TSvgColor( (TUint32)aValue );
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CClrCssValueImpl::IsEqual( CCssValue* aValue )
+{
+ if (((CClrCssValueImpl*)aValue)->iValue == iValue)
+ {
+ return ETrue;
+ }
+
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CClrCssValueImpl::Print()
+{
+#ifdef _DEBUG
+ if (iValue)
+ RDebug::Printf("%x", iValue->GetColor());
+#endif
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGColor.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,1006 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include "SVGColor.h"
+#include "SVGSchemaData.h"
+#include "SVGDocumentImpl.h"
+
+
+//CONSTANTS
+_LIT(KCOLOR_WHITE, "white");
+_LIT(KCOLOR_ANTIQUEWHITE, "antiquewhite");
+_LIT(KCOLOR_BLACK, "black");
+_LIT(KCOLOR_SKYBLUE, "skyblue");
+_LIT(KCOLOR_BLUE, "blue");
+_LIT(KCOLOR_PURPLE, "purple");
+_LIT(KCOLOR_RED, "red");
+_LIT(KCOLOR_WHITESMOKE, "whitesmoke");
+_LIT(KCOLOR_SNOW, "snow");
+_LIT(KCOLOR_YELLOW, "yellow");
+_LIT(KCOLOR_GRAY, "gray");
+_LIT(KCOLOR_GREEN, "green");
+_LIT(KCOLOR_DARKRED, "darkred");
+_LIT(KCOLOR_ORANGE, "orange");
+_LIT(KCOLOR_BROWN, "brown");
+_LIT(KCOLOR_MAGENTA, "magenta");
+_LIT(KCOLOR_MAROON, "maroon");
+_LIT(KCOLOR_PINK, "pink");
+_LIT(KCOLOR_ROYALBLUE, "royalblue");
+_LIT(KCOLOR_ALICEBLUE, "aliceblue");
+_LIT(KCOLOR_AQUA, "aqua");
+_LIT(KCOLOR_LIGHTGREEN, "lightgreen");
+_LIT(KCOLOR_LIGHTGRAY, "lightgray");
+_LIT(KCOLOR_LIGHTGREY, "lightgrey");
+_LIT(KCOLOR_LIGHTPINK, "lightpink");
+_LIT(KCOLOR_AQUAMARINE, "aquamarine");
+_LIT(KCOLOR_AZURE, "azure");
+_LIT(KCOLOR_BEIGE, "beige");
+_LIT(KCOLOR_CYAN, "cyan");
+_LIT(KCOLOR_DARKBLUE, "darkblue");
+_LIT(KCOLOR_DARKCYAN, "darkcyan");
+_LIT(KCOLOR_DARKGOLDENROD, "darkgoldenrod");
+_LIT(KCOLOR_DARKGRAY, "darkgray");
+_LIT(KCOLOR_DARKGREY, "darkgrey");
+_LIT(KCOLOR_DARKGREEN, "darkgreen");
+_LIT(KCOLOR_DARKKHAKI, "darkkhaki");
+_LIT(KCOLOR_DARKMAGENTA, "darkmagenta");
+_LIT(KCOLOR_DARKOLIVEGREEN, "darkolivegreen");
+_LIT(KCOLOR_DARKORANGE, "darkorange");
+_LIT(KCOLOR_DARKORCHID, "darkorchid");
+_LIT(KCOLOR_INDIGO, "indigo");
+_LIT(KCOLOR_IVORY, "ivory");
+_LIT(KCOLOR_KHAKI, "khaki");
+_LIT(KCOLOR_LAVENDER, "lavender");
+_LIT(KCOLOR_BISQUE, "bisque");
+_LIT(KCOLOR_BLANCHEDALMOND, "blanchedalmond");
+_LIT(KCOLOR_BLUEVIOLET, "blueviolet");
+_LIT(KCOLOR_BURLYWOOD, "burlywood");
+_LIT(KCOLOR_CADETBLUE, "cadetblue");
+_LIT(KCOLOR_CHARTREUSE, "chartreuse");
+_LIT(KCOLOR_CHOCOLATE, "chocolate");
+_LIT(KCOLOR_CORAL, "coral");
+_LIT(KCOLOR_CORNFLOWERBLUE, "cornflowerblue");
+_LIT(KCOLOR_CORNSILK, "cornsilk");
+_LIT(KCOLOR_CRIMSON, "crimson");
+_LIT(KCOLOR_DARKSALMON, "darksalmon");
+_LIT(KCOLOR_DARKSEAGREEN, "darkseagreen");
+_LIT(KCOLOR_DARKSLATEBLUE, "darkslateblue");
+_LIT(KCOLOR_DARKSLATEGRAY, "darkslategray");
+_LIT(KCOLOR_DARKTURQUOISE, "darkturquoise");
+_LIT(KCOLOR_DARKVIOLET, "darkviolet");
+_LIT(KCOLOR_DEEPPINK, "deeppink");
+_LIT(KCOLOR_DEEPSKYBLUE, "deepskyblue");
+_LIT(KCOLOR_DIMGRAY, "dimgray");
+_LIT(KCOLOR_DODGERBLUE, "dodgerblue");
+_LIT(KCOLOR_FIREBRICK, "firebrick");
+_LIT(KCOLOR_FLORALWHITE, "floralwhite");
+_LIT(KCOLOR_FORESTGREEN, "forestgreen");
+_LIT(KCOLOR_FUCHSIA, "fuchsia");
+_LIT(KCOLOR_GAINSBORO, "gainsboro");
+_LIT(KCOLOR_GHOSTWHITE, "ghostwhite");
+_LIT(KCOLOR_GOLD, "gold");
+_LIT(KCOLOR_GOLDENROD, "goldenrod");
+_LIT(KCOLOR_GREENYELLOW, "greenyellow");
+_LIT(KCOLOR_HONEYDEW, "honeydew");
+_LIT(KCOLOR_HOTPINK, "hotpink");
+_LIT(KCOLOR_INDIANRED, "indianred");
+_LIT(KCOLOR_LAVENDERBLUSH, "lavenderblush");
+_LIT(KCOLOR_LAWNGREEN, "lawngreen");
+_LIT(KCOLOR_LEMONCHIFFON, "lemonchiffon");
+_LIT(KCOLOR_LIGHTBLUE, "lightblue");
+_LIT(KCOLOR_LIGHTCORAL, "lightcoral");
+_LIT(KCOLOR_LIGHTCYAN, "lightcyan");
+_LIT(KCOLOR_LIGHTGOLDENRODYELLOW, "lightgoldenrodyellow");
+_LIT(KCOLOR_LIGHTSALMON, "lightsalmon");
+_LIT(KCOLOR_LIGHTSEAGREEN, "lightseagreen");
+_LIT(KCOLOR_LIGHTSKYBLUE, "lightskyblue");
+_LIT(KCOLOR_LIGHTSLATEGRAY, "lightslategray");
+_LIT(KCOLOR_LIGHTSTEELBLUE, "lightsteelblue");
+_LIT(KCOLOR_LIGHTYELLOW, "lightyellow");
+_LIT(KCOLOR_LIME, "lime");
+_LIT(KCOLOR_LIMEGREEN, "limegreen");
+_LIT(KCOLOR_LINEN, "linen");
+_LIT(KCOLOR_MEDIUMAQUAMARINE, "mediumaquamarine");
+_LIT(KCOLOR_MEDIUMBLUE, "mediumblue");
+_LIT(KCOLOR_MEDIUMORCHID, "mediumorchid");
+_LIT(KCOLOR_MEDIUMPURPLE, "mediumpurple");
+_LIT(KCOLOR_MEDIUMSEAGREEN, "mediumseagreen");
+_LIT(KCOLOR_MEDIUMSLATEBLUE, "mediumslateblue");
+_LIT(KCOLOR_MEDIUMSPRINGGREEN, "mediumspringgreen");
+_LIT(KCOLOR_MEDIUMTURQUOISE, "mediumturquoise");
+_LIT(KCOLOR_MEDIUMVIOLETRED, "mediumvioletred");
+_LIT(KCOLOR_MIDNIGHTBLUE, "midnightblue");
+_LIT(KCOLOR_MINTCREAM, "mintcream");
+_LIT(KCOLOR_MISTYROSE, "mistyrose");
+_LIT(KCOLOR_MOCCASIN, "moccasin");
+_LIT(KCOLOR_NAVAJOWHITE, "navajowhite");
+_LIT(KCOLOR_NAVY, "navy");
+_LIT(KCOLOR_OLDLACE, "oldlace");
+_LIT(KCOLOR_OLIVE, "olive");
+_LIT(KCOLOR_OLIVEDRAB, "olivedrab");
+_LIT(KCOLOR_ORANGERED, "orangered");
+_LIT(KCOLOR_ORCHID, "orchid");
+_LIT(KCOLOR_PALEGOLDENROD, "palegoldenrod");
+_LIT(KCOLOR_PALEGREEN, "palegreen");
+_LIT(KCOLOR_PALETURQUOISE, "paleturquoise");
+_LIT(KCOLOR_PALEVIOLETRED, "palevioletred");
+_LIT(KCOLOR_PAPAYAWHIP, "papayawhip");
+_LIT(KCOLOR_PEACHPUFF, "peachpuff");
+_LIT(KCOLOR_PERU, "peru");
+_LIT(KCOLOR_PLUM, "plum");
+_LIT(KCOLOR_POWDERBLUE, "powderblue");
+_LIT(KCOLOR_ROSYBROWN, "rosybrown");
+_LIT(KCOLOR_SADDLEBROWN, "saddlebrown");
+_LIT(KCOLOR_SALMON, "salmon");
+_LIT(KCOLOR_SANDYBROWN, "sandybrown");
+_LIT(KCOLOR_SEAGREEN, "seagreen");
+_LIT(KCOLOR_SEASHELL, "seashell");
+_LIT(KCOLOR_SIENNA, "sienna");
+_LIT(KCOLOR_SILVER, "silver");
+_LIT(KCOLOR_SLATEBLUE, "slateblue");
+_LIT(KCOLOR_SLATEGRAY, "slategray");
+_LIT(KCOLOR_SPRINGGREEN, "springgreen");
+_LIT(KCOLOR_STEELBLUE, "steelblue");
+_LIT(KCOLOR_TAN, "tan");
+_LIT(KCOLOR_TEAL, "teal");
+_LIT(KCOLOR_THISTLE, "thistle");
+_LIT(KCOLOR_TOMATO, "tomato");
+_LIT(KCOLOR_TURQUOISE, "turquoise");
+_LIT(KCOLOR_VIOLET, "violet");
+_LIT(KCOLOR_WHEAT, "wheat");
+_LIT(KCOLOR_YELLOWGREEN, "yellowgreen");
+_LIT(KCOLOR_NONE, "none");
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TSvgColor::TSvgColor( TUint32 aValue ) : TGfxColor( aValue )
+ {
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TSvgColor::TSvgColor( TInt aRed, TInt aGreen, TInt aBlue ) : TGfxColor( aRed,
+ aGreen,
+ aBlue )
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+TBool TSvgColor::GetStringL( const TDesC& aColorValue, TUint32 &aColor)
+
+ {
+
+ TUint32 color = 0; // default value
+
+ const TUint16* lPtr = aColorValue.Ptr();
+ TInt offset = KErrNotFound;
+
+ _LIT16( Krgb, "rgb" );
+
+ // If color is given as a '#...' value
+ if ( lPtr[0] == '#' )
+ {
+ TPtrC tPtrC = aColorValue.Right( aColorValue.Length() - 1 );
+
+ if ( tPtrC.Length() > 6 )
+ {
+ aColor = color;
+ return EFalse;
+ }
+
+ for ( TInt i = 0; i < tPtrC.Length(); i++ )
+ {
+ if ( !TChar( tPtrC[i] ).IsHexDigit() )
+ {
+ aColor = color;
+ return EFalse;
+ }
+ }
+
+ if ( tPtrC.Length() == 3 ) // as in "#f00"
+ {
+ TBuf<6> lCol( tPtrC );
+
+ // Make it #rrggbb
+ lCol.Insert( 0, TPtrC( &lCol[0], 1 ) );
+ lCol.Insert( 2, TPtrC( &lCol[2], 1 ) );
+ lCol.Insert( 4, TPtrC( &lCol[4], 1 ) );
+
+
+ TLex tLex( lCol );
+ if(tLex.Val( color, EHex ) != KErrNone)
+ {
+ return EFalse;
+ }
+ }
+ else
+ {
+ TLex tLex( tPtrC );
+ if(tLex.Val( color, EHex ) != KErrNone)
+ {
+ return EFalse;
+ }
+ }
+ }
+ // If color is given as a RGB
+ else if ( ( offset = aColorValue.FindF( Krgb ) ) != KErrNotFound )
+ {
+ if ( offset > 0 || aColorValue.Length() > 36 )
+ {
+ return ETrue;
+ }
+
+ TBuf<36> tBuf; // Usually not more than 24 chars long
+ const TUint16* cPtr = aColorValue.Ptr();
+ TInt colorValueLength = aColorValue.Length();
+ for ( TInt idx = 0; idx < colorValueLength; idx++ )
+ {
+ if ( cPtr[idx] != ' ' )// remove spaces
+ {
+ tBuf.Append( cPtr[idx] );
+ }
+ }
+
+ color = ProcessRGBL( tBuf );
+ }
+ // If color is given as a text string (eg. "red")
+ else
+ {
+ color= MapColorToInt( aColorValue );
+ if(color==KGfxColorNull)
+ {
+ return EFalse;
+ }
+ }
+
+
+ aColor = color;
+
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TUint32 TSvgColor::MapColorToInt( const TDesC& aColorName )
+ {
+
+ TLex convert(aColorName);
+ convert.SkipSpace();
+
+ if ( !convert.Remainder().CompareF( KCOLOR_WHITE ))
+ {
+ return 0xFFFFFF;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_BLACK ))
+ {
+ return 0x000000;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_BLUE ))
+ {
+ return 0x0000FF;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_SKYBLUE ))
+ {
+ return 0x87CEEB;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_RED ))
+ {
+ return 0xFF0000;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_YELLOW ))
+ {
+ return 0xFFFF00;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_GRAY ))
+ {
+ return 0x808080;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_GREEN ))
+ {
+ return 0x008000;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_ALICEBLUE ))
+ {
+ return 0xF0F8FF;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_ANTIQUEWHITE ))
+ {
+ return 0xFAEBD7;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_AQUA ))
+ {
+ return 0x00FFFF;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_AQUAMARINE ))
+ {
+ return 0x7FFFD4;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_AZURE ))
+ {
+ return 0xF0FFFF;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_ORANGE ))
+ {
+ return 0xFFA500;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_BEIGE ))
+ {
+ return 0xF5F5DC;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_MAGENTA ))
+ {
+ return 0xFF00FF;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_MAROON ))
+ {
+ return 0x800000;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DARKGRAY ))
+ {
+ return 0xA9A9A9;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DARKGREY ))
+ {
+ return 0xA9A9A9;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DARKGREEN ))
+ {
+ return 0x006400;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DARKKHAKI ))
+ {
+ return 0xBDB76B;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DARKMAGENTA ))
+ {
+ return 0x8B008B;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_CYAN ))
+ {
+ return 0x00FFFF;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DARKBLUE ))
+ {
+ return 0x00008B;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DARKCYAN ))
+ {
+ return 0x008B8B;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_BISQUE ))
+ {
+ return 0xFFE4C4;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_BLANCHEDALMOND ))
+ {
+ return 0xFFEBCD;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_BLUEVIOLET ))
+ {
+ return 0x8A2BE2;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_BROWN ))
+ {
+ return 0xA52A2A;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_BURLYWOOD ))
+ {
+ return 0xDEB887;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_CADETBLUE ))
+ {
+ return 0x5F9EA0;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_CHARTREUSE ))
+ {
+ return 0x7FFF00;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_CHOCOLATE ))
+ {
+ return 0xD2691E;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_CORAL ))
+ {
+ return 0xFF7F50;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_CORNFLOWERBLUE ))
+ {
+ return 0x6495ED;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_CORNSILK ))
+ {
+ return 0xFFF8DC;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_CRIMSON ))
+ {
+ return 0xDC143C;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DARKGOLDENROD ))
+ {
+ return 0xB8860B;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DARKOLIVEGREEN ))
+ {
+ return 0x556B2F;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DARKORANGE ))
+ {
+ return 0xFF8C00;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DARKORCHID ))
+ {
+ return 0x9932CC;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DARKRED ))
+ {
+ return 0x8B0000;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DARKSALMON ))
+ {
+ return 0xE9967A;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DARKSEAGREEN ))
+ {
+ return 0x8FBC8F;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DARKSLATEBLUE ))
+ {
+ return 0x483D8B;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DARKSLATEGRAY ))
+ {
+ return 0x2F4F4F;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DARKTURQUOISE ))
+ {
+ return 0x00CED1;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DARKVIOLET ))
+ {
+ return 0x9400D3;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DEEPPINK ))
+ {
+ return 0xFF1493;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DEEPSKYBLUE ))
+ {
+ return 0x00BFFF;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DIMGRAY ))
+ {
+ return 0x696969;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_DODGERBLUE ))
+ {
+ return 0x1E90FF;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_FIREBRICK ))
+ {
+ return 0xB22222;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_FLORALWHITE ))
+ {
+ return 0xFFFAF0;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_FORESTGREEN ))
+ {
+ return 0x228B22;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_FUCHSIA ))
+ {
+ return 0xFF00FF;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_GAINSBORO ))
+ {
+ return 0xDCDCDC;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_GHOSTWHITE ))
+ {
+ return 0xF8F8FF;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_GOLD ))
+ {
+ return 0xFFD700;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_GOLDENROD ))
+ {
+ return 0xDAA520;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_GREENYELLOW ))
+ {
+ return 0xADFF2F;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_HONEYDEW ))
+ {
+ return 0xF0FFF0;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_HOTPINK ))
+ {
+ return 0xFF69B4;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_INDIANRED ))
+ {
+ return 0xCD5C5C;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_INDIGO ))
+ {
+ return 0x4B0082;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_IVORY ))
+ {
+ return 0xFFFFF0;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_KHAKI ))
+ {
+ return 0xF0E68C;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_LAVENDER ))
+ {
+ return 0xE6E6FA;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_LAVENDERBLUSH ))
+ {
+ return 0xFFF0F5;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_LAWNGREEN ))
+ {
+ return 0x7CFC00;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_LEMONCHIFFON ))
+ {
+ return 0xFFFACD;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_LIGHTBLUE ))
+ {
+ return 0xADD8E6;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_LIGHTCORAL ))
+ {
+ return 0xF08080;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_LIGHTCYAN ))
+ {
+ return 0xE0FFFF;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_LIGHTGOLDENRODYELLOW ))
+ {
+ return 0xFAFAD2;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_LIGHTGREEN ))
+ {
+ return 0x90EE90;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_LIGHTGRAY ))
+ {
+ return 0xD3D3D3;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_LIGHTGREY ))
+ {
+ return 0xD3D3D3;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_LIGHTPINK ))
+ {
+ return 0xFFB6C1;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_LIGHTSALMON ))
+ {
+ return 0xFFA07A;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_LIGHTSEAGREEN ))
+ {
+ return 0x20B2AA;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_LIGHTSKYBLUE ))
+ {
+ return 0x87CEFA;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_LIGHTSLATEGRAY ))
+ {
+ return 0x778899;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_LIGHTSTEELBLUE ))
+ {
+ return 0xB0C4DE;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_LIGHTYELLOW ))
+ {
+ return 0xFFFFE0;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_LIME ))
+ {
+ return 0x00FF00;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_LIMEGREEN ))
+ {
+ return 0x32CD32;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_LINEN ))
+ {
+ return 0xFAF0E6;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_MEDIUMAQUAMARINE ))
+ {
+ return 0x66CDAA;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_MEDIUMBLUE ))
+ {
+ return 0x0000CD;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_MEDIUMORCHID ))
+ {
+ return 0xBA55D3;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_MEDIUMPURPLE ))
+ {
+ return 0x9370DB;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_MEDIUMSEAGREEN ))
+ {
+ return 0x3CB371;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_MEDIUMSLATEBLUE ))
+ {
+ return 0x7B68EE;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_MEDIUMSPRINGGREEN ))
+ {
+ return 0x00FA9A;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_MEDIUMTURQUOISE ))
+ {
+ return 0x48D1CC;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_MEDIUMVIOLETRED ))
+ {
+ return 0xC71585;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_MIDNIGHTBLUE ))
+ {
+ return 0x191970;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_MINTCREAM ))
+ {
+ return 0xF5FFFA;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_MISTYROSE ))
+ {
+ return 0xFFE4E1;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_MOCCASIN ))
+ {
+ return 0xFFE4B5;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_NAVAJOWHITE ))
+ {
+ return 0xFFDEAD;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_NAVY ))
+ {
+ return 0x000080;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_OLDLACE ))
+ {
+ return 0xFDF5E6;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_OLIVE ))
+ {
+ return 0x808000;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_OLIVEDRAB ))
+ {
+ return 0x6B8E23;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_ORANGERED ))
+ {
+ return 0xFF4500;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_ORCHID ))
+ {
+ return 0xDA70D6;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_PALEGOLDENROD ))
+ {
+ return 0xEEE8AA;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_PALEGREEN ))
+ {
+ return 0x98FB98;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_PALETURQUOISE ))
+ {
+ return 0xAFEEEE;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_PALEVIOLETRED ))
+ {
+ return 0xDB7093;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_PAPAYAWHIP ))
+ {
+ return 0xFFEFD5;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_PEACHPUFF ))
+ {
+ return 0xFFDAB9;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_PERU ))
+ {
+ return 0xCD853F;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_PINK ))
+ {
+ return 0xFFC0CB;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_PLUM ))
+ {
+ return 0xDDA0DD;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_POWDERBLUE ))
+ {
+ return 0xB0E0E6;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_PURPLE ))
+ {
+ return 0x800080;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_ROSYBROWN ))
+ {
+ return 0xBC8F8F;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_ROYALBLUE ))
+ {
+ return 0x4169E1;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_SADDLEBROWN ))
+ {
+ return 0x8B4513;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_SALMON ))
+ {
+ return 0xFA8072;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_SANDYBROWN ))
+ {
+ return 0xF4A460;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_SEAGREEN ))
+ {
+ return 0x2E8B57;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_SEASHELL ))
+ {
+ return 0xFFF5EE;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_SIENNA ))
+ {
+ return 0xA0522D;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_SILVER ))
+ {
+ return 0xC0C0C0;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_SLATEBLUE ))
+ {
+ return 0x6A5ACD;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_SLATEGRAY ))
+ {
+ return 0x708090;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_SNOW ))
+ {
+ return 0xFFFAFA;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_SPRINGGREEN ))
+ {
+ return 0x00FF7F;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_STEELBLUE ))
+ {
+ return 0x4682B4;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_TAN ))
+ {
+ return 0xD2B48C;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_TEAL ))
+ {
+ return 0x008080;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_THISTLE ))
+ {
+ return 0xD8BFD8;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_TOMATO ))
+ {
+ return 0xFF6347;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_TURQUOISE ))
+ {
+ return 0x40E0D0;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_VIOLET ))
+ {
+ return 0xEE82EE;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_WHEAT ))
+ {
+ return 0xF5DEB3;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_WHITESMOKE ))
+ {
+ return 0xF5F5F5;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_YELLOWGREEN ))
+ {
+ return 0x9ACD32;
+ }
+ else if ( !convert.Remainder().CompareF( KCOLOR_NONE ) )
+ {
+ return 0x1ffffff ;
+ }
+ return KGfxColorNull;
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TUint32 TSvgColor::ProcessRGBL( const TDesC& aColorValue )
+ {
+ //this function is used to process the rgb(255,255,255)
+ //style color attribute
+
+ TUint32 color = 0x1ffffff; // KGfxColorNull
+ TInt red = 0;
+ TInt green = 0;
+ TInt blue = 0;
+
+ // To be completed
+ TInt pos1 = aColorValue.Locate( ',' );
+ TInt pos2 = aColorValue.LocateReverse( ',' );
+ if (pos1 < 0 )
+ {
+ pos1 = 0;
+ }
+ if (pos2 < 0 )
+ {
+ pos2 = 0;
+ }
+
+ if ( pos1 == pos2 ) // there is only one comma
+ {
+ return color;
+ }
+
+ TPtrC tStr = aColorValue.Right( aColorValue.Length() - 4 ); // Remove "Rgb(" leave "R,G,B)"
+ TPtrC tRed = tStr.Left( pos1 ); // Get Red
+ TPtrC tStr2 = aColorValue.Left( pos2 );
+ TInt pos3 = tStr2.Locate( ',' );
+ if (pos3 < 0 )
+ {
+ pos3 = 0;
+ }
+ TPtrC tGreen = tStr2.Right( tStr2.Length() - pos3 - 1 ); // Get Green
+ TPtrC tStr3 = aColorValue.Right( aColorValue.Length() - pos2 - 1 );
+ TInt pos4 = tStr3.Locate(')');
+ if (pos4 < 0 )
+ {
+ pos4 = 0;
+ }
+
+ TPtrC tBlue = tStr3.Left( pos4 ); // Get Blue
+
+ if ( !ProcessRGBPercentageL( tRed, red ) )
+ {
+ TLex rLex( tRed );
+ if (rLex.Val( red ) != KErrNone)
+ {
+ red = 0;
+ }
+ }
+
+ if ( !ProcessRGBPercentageL( tGreen, green ) )
+ {
+ TLex gLex( tGreen );
+ if (gLex.Val( green ) != KErrNone)
+ {
+ green = 0;
+ }
+ }
+
+ if ( !ProcessRGBPercentageL( tBlue, blue ) )
+ {
+ TLex bLex( tBlue );
+ if (bLex.Val( blue ) != KErrNone)
+ {
+ blue = 0;
+ }
+ }
+
+ if (blue > 255)
+ {
+ blue = 255;
+ }
+
+ if (green > 255)
+ {
+ green = 255;
+ }
+
+ if (red > 255)
+ {
+ red = 255;
+ }
+
+ //clipping to zero in case of -ve values.ESMA-7QFHZC
+ if (blue < 0)
+ {
+ blue = 0;
+ }
+ if (green < 0)
+ {
+ green = 0;
+ }
+ if (red < 0)
+ {
+ red = 0;
+ }
+ return (red<<16)|(green<<8)|(blue);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool TSvgColor::ProcessRGBPercentageL( const TDesC& aColorValue, TInt& color )
+ {
+ TInt pos;
+
+ pos = aColorValue.Locate( '%' );
+
+ if ( pos == KErrNotFound )
+ {
+ return EFalse;
+ }
+
+ HBufC* tBufC = HBufC::NewLC( aColorValue.Length() );
+ TPtr tPtr = tBufC->Des();
+ tPtr.Copy( aColorValue );
+
+ tPtr.Delete( pos, 1 ); // Remove '%'
+
+ TInt pcn = 0;
+ TLex lex( tPtr );
+
+ if (lex.Val( pcn ) != KErrNone)
+ {
+ pcn = 0;
+ }
+ //ESMA-7QGBUN
+ color = ( int ) ( (255 * pcn)/100 ); // (2.55 * pcn)
+
+ CleanupStack::PopAndDestroy( 1 ); //tBufC
+
+ return ETrue;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGDOMImplementationImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include "SVGDOMImplementationImpl.h"
+#include "SVGDocumentImpl.h"
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+MXmlDocument* CSvgDOMImplementationImpl::CreateDocumentL( const TDesC& /* aNamespaceUri */,
+ const TDesC& /* aQualifiedName*/ /*,
+ CXmlDocumentType* aDocType*/ )
+ {
+ return ( MXmlDocument * ) CSvgDocumentImpl::NewL(iSvgBitmapFontProvider);
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgDOMImplementationImpl* CSvgDOMImplementationImpl::NewL(CSvgBitmapFontProvider *aSvgBitmapFontProvider)
+ {
+ CSvgDOMImplementationImpl* self = new ( ELeave )
+ CSvgDOMImplementationImpl(aSvgBitmapFontProvider);
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgDOMImplementationImpl* CSvgDOMImplementationImpl::NewLC(CSvgBitmapFontProvider *aSvgBitmapFontProvider)
+ {
+ CSvgDOMImplementationImpl* self = new ( ELeave )
+ CSvgDOMImplementationImpl(aSvgBitmapFontProvider);
+ CleanupStack::PushL( self );
+ self->ConstructL();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgDOMImplementationImpl::ConstructL()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgDOMImplementationImpl::CSvgDOMImplementationImpl(CSvgBitmapFontProvider *aSvgBitmapFontProvider): iSvgBitmapFontProvider(aSvgBitmapFontProvider)
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgDOMImplementationImpl::~CSvgDOMImplementationImpl()
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGDefsElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,204 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "SVGDefsElementImpl.h"
+#include "SVGElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+
+#include "GfxAffineTransform.h"
+
+// *******************************************************
+// Constructor/deconstructor
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgDefsElementImpl* CSvgDefsElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgDefsElementImpl*self = new ( ELeave ) CSvgDefsElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgDefsElementImpl* CSvgDefsElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgDefsElementImpl*self = new ( ELeave ) CSvgDefsElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgDefsElementImpl::~CSvgDefsElementImpl()
+ {
+ }
+
+// *******************************************************
+// From MXmlElement
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgDefsElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+
+ if ( this->SetLangSpaceAttributeL( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+
+
+
+ if ( this->SetTransform( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+
+ if ( this->SetTestAttributeL( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+
+ if ( SetIdandXmlbaseL( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+
+ return KErrNone;
+ }
+
+
+// From MXmlElementOpt
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgDefsElementImpl::GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrRefX:
+ {
+ TFloatFixPt xmin( KMAXFLOATFIX ), x; // 0x7fff is the maximum integer in TFixPt
+ CSvgElementImpl* lNewElement = ( CSvgElementImpl* ) FirstChild();
+ while ( lNewElement != NULL )
+ {
+ lNewElement->GetAttributeFloat( KAtrRefX, x );
+ if ( x < xmin )
+ xmin = x;
+ lNewElement = ( CSvgElementImpl * )
+ lNewElement->NextSibling();
+ }
+ aValue = xmin;
+ }
+ break;
+ case KAtrRefY:
+ {
+ TFloatFixPt ymin( KMAXFLOATFIX ), y; // 0x7fff is the maximum integer in TFixPt
+ CSvgElementImpl*lNewElement = ( CSvgElementImpl* ) FirstChild();
+ while ( lNewElement != NULL )
+ {
+ lNewElement->GetAttributeFloat( KAtrRefY, y );
+ if ( y < ymin )
+ ymin = y;
+ lNewElement = ( CSvgElementImpl * )
+ lNewElement->NextSibling();
+ }
+ aValue = ymin;
+ }
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+// *******************************************************
+// From CSvgElementImpl
+
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgDefsElementImpl::CloneL(MXmlElement*)
+ {
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgDefsElementImpl::DrawL( CGfx2dGc* /* aGc */,
+ CSvgElementImpl* /* aElement */ )
+ {
+ return EFalse;
+ }
+
+
+// *******************************************************
+// Private
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgDefsElementImpl::ConstructL( const TUint8 aElemID )
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgDefsElementImpl::CSvgDefsElementImpl( CSvgDocumentImpl* aDoc )
+ {
+ SetOwnerDocument( aDoc );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgDefsElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<defs>");
+ //something in def here
+ RDebug::Printf("</defs>");
+ #endif
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGDescElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,292 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "SVGDescElementImpl.h"
+#include "SVGElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+
+#include "GfxAffineTransform.h"
+
+// *******************************************************
+// Constructor/deconstructor
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgDescElementImpl* CSvgDescElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgDescElementImpl*self = new ( ELeave ) CSvgDescElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgDescElementImpl* CSvgDescElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgDescElementImpl*self = new ( ELeave ) CSvgDescElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgDescElementImpl::~CSvgDescElementImpl()
+ {
+
+ if ( iText )
+ {
+ delete iText;
+ iText = NULL;
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgDescElementImpl::GetAttributeDes( const TInt aNameId, TPtrC16& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrCdata:
+ aValue.Set(*iText);
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeDes( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgDescElementImpl::SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrCdata:
+ SetTextL( aValue );
+ break;
+
+ default:
+ return CSvgElementImpl::SetAttributeDesL( aNameId, aValue );
+ }
+
+ return KErrNone;
+ }
+
+// *******************************************************
+// From MXmlElement
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgDescElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+
+ if ( this->SetLangSpaceAttributeL( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+
+
+
+ if ( this->SetTransform( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+
+ if ( this->SetTestAttributeL( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+
+ if ( SetIdandXmlbaseL( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+
+ return KErrNone;
+ }
+
+// ==========================================================================
+// xml:space is an inheritable attribute which can have one of two values:
+//
+// default (the initial/default value for xml:space) - When xml:space="default":
+// - Remove all newline characters.
+// - Convert all tab characters into space characters.
+// - Strip off all leading and trailing space characters.
+// - All contiguous space characters will be consolidated.
+//
+// preserve - When xml:space="preserve" :
+// - Convert all newline and tab characters into space characters.
+// ==========================================================================
+void CSvgDescElementImpl::SetTextL( const TDesC& aText )
+ {
+ _LIT( KPreserve, "preserve" );
+
+ if ( iText )
+ {
+ delete iText;
+ iText = NULL;
+ }
+
+ iText = aText.AllocL();
+ TPtr textDes = iText->Des();
+
+ // default
+ if ( XMLSpace() != KPreserve )
+ {
+ for (TInt i = textDes.Length() - 1; i >= 0; i--)
+ {
+ if (textDes[i] == '\n' || textDes[i] == '\r')
+ {
+ textDes.Delete(i,1);
+ }
+ }
+ textDes.TrimRight();
+ textDes.TrimLeft();
+ }
+ // preserve
+ else
+ {
+ TInt textDesLength = textDes.Length();
+ for ( TInt i = 0; i < textDesLength; i++ )
+ {
+ // ms-dos carriage return contains two characters: 13, 10
+ if ( i + 1 < textDesLength && (TInt)textDes[i] == 13 && (TInt)textDes[i+1] == 10 )
+ {
+ textDes[i] = ' ';
+ textDes.Delete( i+1, 1 );
+ }
+ else if ( TChar(textDes[i]).IsSpace() )
+ {
+ textDes[i] = ' ';
+ }
+ }
+ }
+ }
+
+// *******************************************************
+// From CSvgElementImpl
+
+// perform a deep clone of this object
+// ==========================================================================
+// Need method description
+// ==========================================================================
+MXmlElement* CSvgDescElementImpl::CloneL(MXmlElement* aParentElement)
+ {
+ CSvgDescElementImpl* newElement = CSvgDescElementImpl::NewL( this->ElemID(), ((CSvgDocumentImpl*)iOwnerDocument) );
+
+ CleanupStack::PushL(newElement);
+ newElement->iParentNode = aParentElement;
+ // copy everything over
+ this->CopyL(newElement);
+ CleanupStack::Pop();
+ return newElement;
+
+ }
+
+// ==========================================================================
+// perform a deep copy of this object
+// ==========================================================================
+void CSvgDescElementImpl::CopyL( CSvgDescElementImpl* aDestElement )
+ {
+ if(aDestElement)
+ {
+
+ // copy stuff from superclass
+ this->CSvgElementImpl::CopyL(aDestElement);
+
+ if(this->iText)
+ {
+ delete aDestElement->iText;
+ aDestElement->iText= NULL;
+ aDestElement->iText= (this->iText)->AllocL();
+ }
+
+ // copy the reference to idoc (CSvgDocumentImpl)
+ aDestElement->iOwnerDocument = this->iOwnerDocument;
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TBool CSvgDescElementImpl::DrawL( CGfx2dGc* /* aGc */,
+ CSvgElementImpl* /* aElement */ )
+ {
+ return EFalse;
+ }
+
+
+// *******************************************************
+// Private
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDescElementImpl::ConstructL( const TUint8 aElemID )
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+
+ iText = HBufC::NewL( 2 );
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgDescElementImpl::CSvgDescElementImpl( CSvgDocumentImpl* aDoc )
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDescElementImpl::Print( TBool aIsEncodeOn )
+ {
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<desc>");
+ //need to add code here to output iText
+ RDebug::Printf("</desc>");
+ #endif
+ }
+ }
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGDiscardElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,858 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+// INCLUDE FILES
+#include "SVGDiscardElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+#include "SVGAnimTimingParser.h"
+#include "SVGEngineImpl.h"
+#include "SVGAnimationBase.h"
+#include "SVGRectElementImpl.h"
+#include "SVGEvent.h"
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// RemoveTargetElement: A utility function that renmoves target element.
+// Remove target element and all its child from its parent level.
+// Allocated Style properties of the target elements have to be deleted here.
+// -----------------------------------------------------------------------------
+//
+void CSvgDiscardElementImpl::RemoveTargetElement()
+ {
+
+ if (iTargetElement!= NULL)
+ {
+ CSvgElementImpl* lParent = (CSvgElementImpl*)iTargetElement->ParentNode();
+ if ( lParent != NULL )
+ {
+ lParent->RemoveChild(iTargetElement);
+ }
+ else if ( iTargetElement->ElemID() == KSvgSvgElement )
+ {
+ // remove all children
+ CSvgElementImpl* child = (CSvgElementImpl*)iTargetElement->FirstChild();
+ CSvgElementImpl* sib = (CSvgElementImpl*) NULL;
+ while ( (child != NULL ) || sib != (CSvgElementImpl*) NULL )
+ {
+ sib = (CSvgElementImpl*)child->NextSibling();
+ // remove myself later
+ if (child != this)
+ {
+ iTargetElement->RemoveChild(child);
+ delete child;
+ }
+ child = sib;
+ }
+ }
+
+ // make sure that the target element is not root
+ if ( iTargetElement->ElemID() != KSvgSvgElement )
+ {
+ delete iTargetElement;
+ iTargetElement = NULL;
+ }
+ iRemoveMyself = ETrue;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// FindTargetElementL: A utility function that finds target element
+// and adjust the begin time.
+//
+// Returns: TBool ETrue if target is set.
+// EFalse if target is not found.
+// -----------------------------------------------------------------------------
+//
+TBool CSvgDiscardElementImpl::FindTargetElementL()
+ {
+ if (iTargetElement)
+ return ETrue;
+
+ // Target could be set from one of the following ways:
+ // 1) Defined as SyncBased value. ==> get element
+ // 2) xlink-href defined. ==> get element
+ // 3) Invalid element id ==> Ignore
+ // 4) No specified xlink-href nor other element id. ==> Use parent
+
+ if ( iHrefValueDefined )
+ {
+ // Case 2 & 3
+ TPtrC lPtr = iTargetId->Des();
+ iTargetElement = ( CSvgElementImpl * )
+ ((CSvgDocumentImpl*)iOwnerDocument)->GetElementById(lPtr);
+ if (iTargetElement == NULL)
+ {
+ // Case 3
+ // Ignore and remove myself later.
+ iRemoveMyself = ETrue;
+ return EFalse;
+ }
+ }
+ else // Case 4
+ {
+ // Set parent to target only when the parent is an animation element
+ iTargetElement = ( CSvgElementImpl * ) ParentNode();
+ }
+
+ // Target element should be determined by now.
+
+
+ // Check to see if the target element is animatable.
+ // If not, remove myself.
+ // Calculate begin time.
+
+ if ( iSyncValueDefined )
+ {
+ // Get reference target element
+ iRefTargetElement = ( CSvgElementImpl * )
+ ((CSvgDocumentImpl*)iOwnerDocument)->GetElementById(iBeginSyncElementId);
+
+ // Only Syncbased begin time
+ if (!iEventValueDefined)
+ {
+ // If specified element doesn't exist or the element is not animated,
+ // remove myself.
+ if ((iRefTargetElement == NULL) /*|| !IsAnimationElement(iRefTargetElement)*/)
+ {
+ // No referenced element or not animatable element (no begin/end attr)
+ // ==> Ignore and remove myself later.
+ iRemoveMyself = ETrue;
+ return EFalse;
+ }
+
+ // re-calculate begin time. e.g. id1.start+5s
+ if (iBeginReferenceEvent == ESvgEventBeginEvent)
+ {
+ iAbsoluteBeginTime +=
+ ((CSvgAnimationBase*)iRefTargetElement)->GetAbsoluteBeginTime();
+ }
+ else if (iBeginReferenceEvent == ESvgEventEndEvent)
+ {
+ iAbsoluteBeginTime +=
+ ((CSvgAnimationBase*)iRefTargetElement)->GetEndTime();
+ }
+ }
+ else // iEventValueDefined is TRUE
+ {
+ // Listen external events
+ ((CSvgDocumentImpl*)
+ iOwnerDocument)->AddToEventReceiverListL(iRefTargetElement,
+ KSvgEventMaskExternalUI);
+ }
+ }
+ else if (iEventValueDefined)
+ {
+ // Listen external events
+ ((CSvgDocumentImpl*)
+ iOwnerDocument)->AddToEventReceiverListL(iTargetElement,
+ KSvgEventMaskExternalUI);
+ }
+
+ return ETrue; // Set Target element
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// HasAnimationElements: A utility function that check if the element
+// contains animation element(s).
+//
+// Returns: TBool ETrue if the element contains animation element(s)
+// EFalse if the element doesn't animated.
+// -----------------------------------------------------------------------------
+//
+/*
+TBool CSvgDiscardElementImpl::HasAnimationElements(CSvgElementImpl* aElement)
+ {
+ TBool lFound = EFalse;
+
+ // Return immediately if the target element is already an animation element.
+ if (IsAnimationElement(aElement))
+ return ETrue;
+
+ // Look through childs
+ CSvgElementImpl* child = (CSvgElementImpl*)aElement->FirstChild();
+ while ( child != NULL )
+ {
+ if ( IsAnimationElement(child) )
+ {
+ lFound = ETrue;
+ break;
+ }
+ child = (CSvgElementImpl*)child->NextSibling();
+ }
+ if (lFound)
+ return ETrue;
+
+ return EFalse;
+ }
+*/
+
+
+// -----------------------------------------------------------------------------
+// IsAnimationElement: A utility function that check if the element
+// is an animation element.
+//
+// Returns: TBool ETrue if the element is a animation element.
+// EFalse if the element is not an animation element.
+// -----------------------------------------------------------------------------
+//
+
+/*
+TBool CSvgDiscardElementImpl::IsAnimationElement(CSvgElementImpl* aElement)
+ {
+
+ TInt id = aElement->ElemID();
+
+ return (( id == KSvgAnimateElement ) ||
+ ( id == KSvgAnimateMotionElement ) ||
+ ( id == KSvgAnimateTransformElement ) ||
+ ( id == KSvgSetElement ) ||
+ ( id == KSvgAnimateColorElement ));
+ }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// SetAttributeL: The implemented function will be called from CSvgContentHandler.
+//
+// From CSvgElementImpl
+//
+// There will be two attributes been set: begin and xlink:href.
+// If xlink:href is not specified, the target element will be parent element
+// If begin time is not specifid, the target element will be remove immdeiately.
+//
+// Returns: ETrue always in this case.
+// -----------------------------------------------------------------------------
+//
+TInt CSvgDiscardElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+ _LIT( KTmpXlinkHref, "xlink:href" );
+ _LIT( KTmpBegin, "begin" );
+
+ // If not xlink:href, it must be attribute "begin"
+ if ( aName == KTmpXlinkHref )
+ {
+ // STEP 1 - Get the reference element
+ // If the first char is '#' then remove it
+ // This is possible if coming from cXML parser and not the Decoder
+ iHrefValueDefined = ETrue;
+ TInt pos = aValue.Locate( '#' );
+ if ( pos == 0 )
+ {
+ if (iTargetId)
+ {
+ delete iTargetId;
+ iTargetId = NULL;
+ }
+ iTargetId = aValue.AllocL();
+ TPtr tPtr = iTargetId->Des();
+ tPtr.Delete(pos, 1);
+ }
+ }
+ else if ( aName == KTmpBegin )
+ {
+ CSvgAnimTimingParser* atParser = CSvgAnimTimingParser::NewLC( aValue, this );
+ TInt32 clockValue;
+ TReal32 lRepeatBeginValue;
+ atParser->Parse( iBeginSyncElementId,
+ iBeginReferenceEvent,
+ clockValue,
+ lRepeatBeginValue,
+ ETrue);
+
+ iAbsoluteBeginTime = clockValue;
+
+ if ( iBeginSyncElementId.Size() != 0 )
+ {
+ iSyncValueDefined = ETrue;
+ }
+
+ if ( iBeginReferenceEvent != ESvgEventNone )
+ {
+ iEventValueDefined = ETrue;
+ iRefBeginTime = clockValue;
+ iAbsoluteBeginTime = KTimeIndefinite;
+ if (iBeginReferenceEvent == ESvgEventKey)
+ {
+ iKeyValue = atParser->AccekeyValue();
+ }
+ }
+
+
+ CleanupStack::PopAndDestroy( 1 ); // atParser
+ }
+
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+
+ return KErrNone;
+ }
+
+
+
+
+// -----------------------------------------------------------------------------
+// ReceiveEventL: The implemented function will be called whenever subscribed
+// events are received.
+//
+// From MSvgEventReceiver
+//
+// Return: TBool ETrue if redraw is needed
+// EFalse if redraw is not needed
+// -----------------------------------------------------------------------------
+//
+TBool CSvgDiscardElementImpl::ReceiveEventL( MSvgEvent* aEvent )
+ {
+
+ if (iRemoveMyself)
+ {
+ // Two reasons to remove myself.
+ // 1) when discard element is not sepcified inside of the target
+ // element so the object is not removed automatically along with
+ // target element.
+ // 2) Invalid begin time
+ iTargetElement = ( CSvgElementImpl * ) ParentNode();
+ iTargetElement->RemoveChild(this);
+ delete this;
+ return EFalse;
+ }
+
+ // Looking for target as soon as first event received. Also adject time
+ // according to timeing attribute.
+ if (!FindTargetElementL())
+ {
+ // Target not found, exit and remove myself next time
+ return EFalse;
+ }
+
+ // Target element should be identified by now.
+
+ CSvgEngineImpl* engine = ((CSvgDocumentImpl*)iOwnerDocument)->Engine();
+ if (engine == NULL)
+ {
+ return EFalse;
+ }
+
+ TInt32 lEngineCurrentTime = engine->CurrentTIme();
+
+ // User input event
+ if (aEvent->EventType() == ESvgEngineEventKeyPress)
+ {
+ MSvgUiKeyEvent* evt = ( MSvgUiKeyEvent* ) aEvent;
+ if (evt->KeyCode() == iKeyValue)
+ {
+ // Remove target immediately
+ RemoveTargetElement();
+ engine->RedrawL();
+ return ETrue;
+ }
+ return EFalse;
+ }
+ // Timer event
+ if (aEvent->EventMask() == KSvgEventMaskTimer)
+ {
+
+ if (lEngineCurrentTime >= iAbsoluteBeginTime)
+ {
+ // Time to remove target
+ RemoveTargetElement();
+ }
+ }
+ // Internal event
+ else if ((aEvent->EventMask() == KSvgEventMaskInternal )
+ && (!iRefBeginTimeSet))
+ {
+ MSvgInternalEvent* evt = ( MSvgInternalEvent* ) aEvent;
+ TSvgEvent s_evt = evt->SvgEvent();
+ if (s_evt == iBeginReferenceEvent)
+ {
+
+ // Event other than AccessKey
+ // Check to see if there is a clock associated with the event.
+ if (s_evt == iBeginReferenceEvent)
+ {
+ // This is some form of event+(-)clock so delay removing
+ // Note that once the reference time is set, the absolutetime
+ // can't be changed with other events.
+ if (iRefTargetElement != NULL)
+ {
+ // This is a syncbased event
+ if (evt->ObjectAddress() == iRefTargetElement)
+ {
+ iAbsoluteBeginTime = lEngineCurrentTime + iRefBeginTime;
+ iRefBeginTimeSet = ETrue;
+ return EFalse;
+ }
+ }
+ else
+ {
+ // Not syncbased event
+ if (evt->ObjectAddress() == iTargetElement)
+ {
+ iAbsoluteBeginTime = lEngineCurrentTime + iRefBeginTime;
+ iRefBeginTimeSet = ETrue;
+ return EFalse;
+ }
+ }
+ } // if (s_evt == iBeginReferenceEvent)...
+ else
+ {
+ // No clock assoicated with the event.
+ if (iRefTargetElement != NULL)
+ {
+ // This is a syncbased event
+ if (evt->ObjectAddress() == iRefTargetElement)
+ {
+ // Remove target immediately
+ RemoveTargetElement();
+ }
+ }
+ // Not syncbased event
+ else if (evt->ObjectAddress() == iTargetElement)
+ {
+ // Remove target immediately
+ RemoveTargetElement();
+ }
+ }
+ } // if (s_evt == iBeginReferenceEvent)...
+ } //if ((aEvent->EventMask() == KSvgEventMaskInte...
+ else
+ {
+ // Not interested event
+ return EFalse;
+ }
+
+ // return true to be redrawn
+ return ETrue;
+ }
+
+
+// Setter functions
+
+// -----------------------------------------------------------------------------
+// SetTargetId: Set iTargetId to the object. Mainly used by decoder.
+//
+// Returns: void
+// -----------------------------------------------------------------------------
+//
+void CSvgDiscardElementImpl::SetTargetId(const TDesC& aTargetId)
+ {
+ delete iTargetId;
+ iTargetId = NULL;
+ TRAPD(err, iTargetId = aTargetId.AllocL());
+ if (err != KErrNone)
+ {
+ // Only display error message. If this failed, iTargetId can safely to be null.
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgDiscardElementImpl::SetTargetId Error: memory allocation failed.");
+ #endif
+ }
+ }
+
+
+// -----------------------------------------------------------------------------
+// SetSyncValueDefined: Set iSyncValueDefined to the object. Mainly used by decoder.
+//
+// Returns: void
+// -----------------------------------------------------------------------------
+//
+void CSvgDiscardElementImpl::SetSyncValueDefined(TBool aSyncValueDefined)
+ {
+ iSyncValueDefined = aSyncValueDefined;
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// SetEventValueDefined: Set iEventValueDefined to the object. Mainly used by decoder.
+//
+// Returns: void
+// -----------------------------------------------------------------------------
+//
+void CSvgDiscardElementImpl::SetEventValueDefined(TBool aEventValueDefined)
+ {
+ iEventValueDefined = aEventValueDefined;
+ }
+
+
+// -----------------------------------------------------------------------------
+// SetHrefValueDefined: Set iHrefValueDefined to the object. Mainly used by decoder.
+//
+// Returns: void
+// -----------------------------------------------------------------------------
+//
+void CSvgDiscardElementImpl::SetHrefValueDefined(TBool aHrefValueDefined)
+ {
+ iHrefValueDefined = aHrefValueDefined;
+ }
+
+
+// -----------------------------------------------------------------------------
+// SetBeginSyncElementId: Set aBeginSyncElementId to the object. Mainly used by decoder.
+//
+// Returns: void
+// -----------------------------------------------------------------------------
+//
+void CSvgDiscardElementImpl::SetBeginSyncElementId(const TDesC& aBeginSyncElementId)
+ {
+ iBeginSyncElementId.SetLength(0);
+ iBeginSyncElementId.Append(aBeginSyncElementId);
+ }
+
+
+// -----------------------------------------------------------------------------
+// SetAbsoluteBeginTime: Set iAbsoluteBeginTime to the object. Mainly used by decoder.
+//
+// Returns: void
+// -----------------------------------------------------------------------------
+//
+void CSvgDiscardElementImpl::SetAbsoluteBeginTime(TInt aAbsoluteBeginTime)
+ {
+ if (aAbsoluteBeginTime == -1)
+ {
+ iAbsoluteBeginTime = KTimeIndefinite;
+ }
+ else
+ {
+ iAbsoluteBeginTime = aAbsoluteBeginTime;
+ }
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// SetRefBeginTime: Set aRefBeginTime to the object. Mainly used by decoder.
+//
+// Returns: void
+// -----------------------------------------------------------------------------
+//
+void CSvgDiscardElementImpl::SetRefBeginTime(TInt aRefBeginTime)
+ {
+ iRefBeginTime = aRefBeginTime;
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// SetKeyValue: Set aKeyValue to the object. Mainly used by decoder.
+//
+// Returns: void
+// -----------------------------------------------------------------------------
+//
+void CSvgDiscardElementImpl::SetKeyValue(TInt aKeyValue)
+ {
+ iKeyValue = aKeyValue;
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// TargetId: Returns iBeginReferenceEvent that is specified in begin attribute.
+// Mainly used by encoder.
+//
+// Returns: void
+// -----------------------------------------------------------------------------
+//
+void CSvgDiscardElementImpl::SetBeginReferenceEvent(TSvgEvent aBeginReferenceEvent)
+ {
+ iBeginReferenceEvent = aBeginReferenceEvent;
+ }
+
+
+// Getter functions
+
+// -----------------------------------------------------------------------------
+// TargetId: Returns the target element's id. Mainly used by encoder.
+//
+// Returns: Descriptor of target element's id
+// -----------------------------------------------------------------------------
+//
+const TDesC& CSvgDiscardElementImpl::TargetId()
+ {
+ return (TDesC&) *iTargetId;
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// BeginSyncElementId: Returns element's id that is specified in begin attribute.
+// Mainly used by encoder.
+//
+// Returns: Descriptor of the element's id
+// -----------------------------------------------------------------------------
+//
+const TDesC& CSvgDiscardElementImpl::BeginSyncElementId()
+ {
+ return iBeginSyncElementId;
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// AbsoluteBeginTime: Returns the absolute begin time that is identified in
+// SetAttribute. The begin time may be changed when using with SyncBase or
+// EventBased attribute.
+//
+// Mainly used by encoder.
+//
+// Returns: TInt AbsoluteBeginTime
+// -----------------------------------------------------------------------------
+//
+TInt CSvgDiscardElementImpl::AbsoluteBeginTime()
+ {
+ if (iAbsoluteBeginTime == KTimeIndefinite)
+ {
+ // write -1 in case both encorder and decoder understand.
+ return -1;
+ }
+ else
+ {
+ return iAbsoluteBeginTime;
+ }
+ }
+
+
+// -----------------------------------------------------------------------------
+// IsSyncValueDefined: Returns the flag iSyncValueDefined that was set in
+// SetAttribute.
+//
+// Mainly used by encoder.
+//
+// Returns: TBool iSyncValueDefined
+// -----------------------------------------------------------------------------
+//
+TBool CSvgDiscardElementImpl::IsSyncValueDefined()
+ {
+ return iSyncValueDefined;
+ }
+
+
+// -----------------------------------------------------------------------------
+// IsEventValueDefined: Returns the flag iEventValueDefined that was set in
+// SetAttribute.
+//
+// Mainly used by encoder.
+//
+// Returns: TBool iEventValueDefined
+// -----------------------------------------------------------------------------
+//
+TBool CSvgDiscardElementImpl::IsEventValueDefined()
+ {
+ return iEventValueDefined;
+ }
+
+
+// -----------------------------------------------------------------------------
+// IsHrefValueDefined: Returns the flag iHrefValueDefined that was set in
+// SetAttribute.
+//
+// Mainly used by encoder.
+//
+// Returns: TBool iHrefValueDefined
+// -----------------------------------------------------------------------------
+//
+TBool CSvgDiscardElementImpl::IsHrefValueDefined()
+ {
+ return iHrefValueDefined;
+ }
+
+
+// -----------------------------------------------------------------------------
+// RefBeginTime: Returns the reference begin time that was set in
+// SetAttribute.
+//
+// Mainly used by encoder.
+//
+// Returns: TInt iRefBeginTime
+// -----------------------------------------------------------------------------
+//
+TInt CSvgDiscardElementImpl::RefBeginTime()
+ {
+ return iRefBeginTime;
+ }
+
+
+// -----------------------------------------------------------------------------
+// KeyValue: Returns the key value (scan code) that was set in
+// SetAttribute.
+//
+// Mainly used by encoder.
+//
+// Returns: TInt iKeyValue
+// -----------------------------------------------------------------------------
+//
+TInt CSvgDiscardElementImpl::KeyValue()
+ {
+ return iKeyValue;
+ }
+
+
+// -----------------------------------------------------------------------------
+// KeyValue: Returns the iBeginReferenceEvent that was set in
+// SetAttribute.
+//
+// Mainly used by encoder.
+//
+// Returns: TSvgEvent iBeginReferenceEvent
+// -----------------------------------------------------------------------------
+//
+TSvgEvent CSvgDiscardElementImpl::BeginReferenceEvent()
+ {
+ return iBeginReferenceEvent;
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// CloneL: Perform a deep clone of this object
+//
+// Returns: MXmlElement pointer to the newly created element.
+// -----------------------------------------------------------------------------
+//
+MXmlElement* CSvgDiscardElementImpl::CloneL(MXmlElement* aParentElement)
+ {
+ CSvgDiscardElementImpl* newElement = CSvgDiscardElementImpl::NewL( this->ElemID(),
+ ((CSvgDocumentImpl*)iOwnerDocument) );
+ CleanupStack::PushL(newElement);
+ newElement->iParentNode = aParentElement;
+
+ // copy everything over
+ this->CopyL(newElement);
+ CleanupStack::Pop();
+
+ return newElement;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CopyL: Perform a deep copy of this object
+//
+// Returns: none
+// -----------------------------------------------------------------------------
+//
+void CSvgDiscardElementImpl::CopyL( CSvgDiscardElementImpl* aDestElement )
+ {
+ if(aDestElement)
+ {
+ aDestElement->iOwnerDocument = this->iOwnerDocument;
+ // copy stuff from superclass
+ this->CSvgElementImpl::CopyL(aDestElement);
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSvgDiscardElementImpl* CSvgDiscardElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc)
+ {
+ CSvgDiscardElementImpl* self = new (ELeave)CSvgDiscardElementImpl(aDoc);
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSvgDiscardElementImpl* CSvgDiscardElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc)
+ {
+ CSvgDiscardElementImpl* self = new (ELeave) CSvgDiscardElementImpl(aDoc);
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// C++ default constructor
+// -----------------------------------------------------------------------------
+//
+CSvgDiscardElementImpl::CSvgDiscardElementImpl( CSvgDocumentImpl* aDoc )
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+
+// -----------------------------------------------------------------------------
+// Symbian default constructor that can leave.
+// -----------------------------------------------------------------------------
+//
+void CSvgDiscardElementImpl::ConstructL( const TUint8 aElemID )
+ {
+ CXmlElementImpl::InitializeL( aElemID );
+
+ iTargetElement = NULL;
+ iTargetId = HBufC::NewL(0);
+ iAbsoluteBeginTime = 0;
+ iRemoveMyself = EFalse;
+ iHrefValueDefined = EFalse;
+ iBeginReferenceEvent = (TSvgEvent)NULL;
+ iSyncValueDefined = EFalse;
+ iEventValueDefined = EFalse;
+ iRefBeginTime = 0;
+ iRefTargetElement = NULL;
+ iRefBeginTimeSet = EFalse;
+ iKeyValue = 0;
+ iBeginSyncElementId.SetLength(0);
+
+ ((CSvgDocumentImpl*)
+ iOwnerDocument)->AddToEventReceiverListL(this, KSvgEventMaskTimer |
+ KSvgEventMaskInternal | KSvgEventMaskExternalUI);
+ }
+
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSvgDiscardElementImpl::~CSvgDiscardElementImpl()
+ {
+ delete iTargetId;
+ }
+
+// -----------------------------------------------------------------------------
+// Print
+// -----------------------------------------------------------------------------
+//
+void CSvgDiscardElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<discard xlink:href =\"hmm\" begin=\"%d\" />", /*Href(),*/ (int)iAbsoluteBeginTime);
+ #endif
+ }
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGDocumentImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,2647 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include <utf.h>
+#include <s32mem.h>
+
+#include "SVGContentHandler.h"
+#include "Svgdecoder.h"
+
+#include "SVGDocumentImpl.h"
+#include "SVGEngineImpl.h"
+#include "SVGSvgElementImpl.h"
+#include "SVGLineElementImpl.h"
+#include "SVGRectElementImpl.h"
+#include "SVGCircleElementImpl.h"
+#include "SVGEllipseElementImpl.h"
+#include "SVGPolylineElementImpl.h"
+#include "SVGGElementImpl.h"
+#include "SVGPathElementImpl.h"
+#include "SVGMpathElementImpl.h"
+#include "SVGSchemaData.h"
+#include "SVGTextElementImpl.h"
+#include "SVGImageElementImpl.h"
+#include "SVGUseElementImpl.h"
+#include "SVGAElementImpl.h"
+#include "SVGStyleElementImpl.h"
+#include "SVGForeignObjectElementImpl.h"
+#include "SVGSetElementImpl.h"
+#include "SVGAnimateTransformElementImpl.h"
+#include "SVGAnimateElementImpl.h"
+#include "SVGAnimateMotionElementImpl.h"
+#include "SVGAnimationElementImpl.h"
+#include "SVGMetadataElementImpl.h"
+#include "SVGDescElementImpl.h"
+#include "SVGDefsElementImpl.h"
+#include "SVGTitleElementImpl.h"
+#include "SVGFontElementImpl.h"
+#include "SVGFontFaceElementImpl.h"
+#include "SVGGlyphElementImpl.h"
+#include "SVGMissingGlyphElementImpl.h"
+#include "SvgHkernelementimpl.h"
+
+#include "SVGLinearGradientElementImpl.h"
+#include "SVGRadialGradientElementImpl.h"
+#include "SvgStopElementImpl.h"
+#include "SVGDiscardElementImpl.h"
+#include "SVGScriptElementImpl.h"
+
+#include "SVGAudioElementImpl.h"
+
+//#ifdef RD_SVGT_MEDIAANIMATION_SUPPORT
+#include "SVGMediaAnimationElementImpl.h"
+//#endif
+#include "SVGTextAreaElementImpl.h"
+#include "SVGSolidColorElementImpl.h"
+
+#include "SVGFloatCssValueImpl.h"
+
+#include "SVGEventHandler.h"
+#include "SVGErrorImpl.h"
+#include "SVGFontHashMap.h"
+#include "SVGTimeContainer.h"
+#include <ezgzip.h>
+
+#include <caf/caf.h>
+#include <bautils.h>
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgDocumentImpl* CSvgDocumentImpl::NewL( CSvgBitmapFontProvider* aSvgBitmapFontProvider, const TBool aHasParent,
+ const TSvgSyncBehaviour aSyncBehavDefault,
+ const TInt32 aSyncTolDefault )
+ {
+ CSvgDocumentImpl* self = new ( ELeave ) CSvgDocumentImpl(aSvgBitmapFontProvider,
+ aHasParent, aSyncBehavDefault, aSyncTolDefault );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgDocumentImpl* CSvgDocumentImpl::NewLC( CSvgBitmapFontProvider* aSvgBitmapFontProvider, const TBool aHasParent,
+ const TSvgSyncBehaviour aSyncBehavDefault,
+ const TInt32 aSyncTolDefault )
+ {
+ CSvgDocumentImpl* self = new ( ELeave ) CSvgDocumentImpl(aSvgBitmapFontProvider,
+ aHasParent, aSyncBehavDefault, aSyncTolDefault );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::ConstructL()
+ {
+ iSchemaData = CSvgSchemaData::NewL();
+
+
+ iEventHandler = CSvgEventHandler::NewL();
+
+ // create CSvgErrorImpl object
+// iSvgError = CSvgErrorImpl::NewL();
+ iIsInteractive = EFalse;
+ iHasGroupOpacity = EFalse;
+
+
+// iImageHashMap = CSvgImageHashMap::NewL();
+ iFontHashMap = CSvgFontHashMap::NewL();
+
+ iMemoryManager = CSvgMemoryManager::NewL();
+
+ iTimeForJSR226 = 0;
+ // Create the time container used for Runtime Sync
+ iTimeContainer = CSvgTimeContainer::NewL( this, iHasParent );
+
+ // Add to the time container
+ iTimeContainer->AddTimedEntityL( this );
+
+ //set media state to ready as default for document
+ iTimeContainer->TimedEntityReady( this );
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgDocumentImpl::CSvgDocumentImpl( CSvgBitmapFontProvider* aSvgBitmapFontProvider, const TBool aHasParent,
+ const TSvgSyncBehaviour aSyncBehavDefault,
+ const TInt32 aSyncTolDefault ) :
+ iInitSortList( ETrue ),
+ iReqExReqFtrSysLTested( EFalse ),
+ iFinishedParsing( EFalse ),
+ iFontHashMap( NULL ),
+ iEngine(NULL),
+ iMultipleRendering( EFalse ),
+ iHasGradientElement( EFalse ),
+ iIsThumbNailMode( EFalse ),
+ iIsDRMProtected( EFalse ),
+ iHasParent( aHasParent ),
+ iSyncBehaviorDefault(
+ aSyncBehavDefault ),
+ iSyncToleranceDefault(
+ aSyncTolDefault),
+ iSvgBitmapFontProvider(aSvgBitmapFontProvider)
+
+
+
+ {
+ SetDRMMode( ETrue );
+ SetDRMRights( ETrue );
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgDocumentImpl::~CSvgDocumentImpl()
+ {
+ if ( iTimeContainer )
+ {
+ // Stop timer and reset time
+ iTimeContainer->UserStop();
+ iTimeContainer->UserResetTime();
+ }
+
+ if (iPerfText)
+ {
+ delete iPerfText;
+ iPerfText = NULL;
+ }
+
+ if( iSchemaData )
+ {
+ delete iSchemaData;
+ iSchemaData = NULL;
+ }
+
+ if( iEventHandler )
+ {
+ delete iEventHandler;
+ iEventHandler = NULL ;
+ }
+
+// if( iSvgError )
+// {
+// delete iSvgError;
+// iSvgError = NULL;
+// }
+
+ if( iRootElement )
+ {
+ delete iRootElement;
+ iRootElement = NULL;
+ }
+
+/* if ( iImageHashMap )
+ {
+ //probably should check to verify that the image ptrs
+ //in this have had their images deleted somehow to be safe
+ delete iImageHashMap;
+ iImageHashMap = NULL;
+ } */
+
+ if ( iFontHashMap )
+ {
+ delete iFontHashMap;
+ iFontHashMap = NULL;
+ }
+ iSvgMouseListeners.Close();
+
+ iSvgAnimations.Close();
+
+ if ( iXmlHandler )
+ {
+ delete iXmlHandler;
+ }
+
+ if ( iError )
+ {
+ delete iError;
+ }
+
+ if ( iMemoryManager )
+ {
+ delete iMemoryManager;
+ }
+
+ delete iTimeContainer;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::SetEngine( CSvgEngineImpl* aEngine )
+ {
+ iEngine = aEngine;
+ // Propogate this to all child documentsas well
+ // Only animation elements currently possess a new document
+ // Locate all the active animation elements
+ RPointerArray<CSvgElementImpl> lAnimationEleList;
+
+ FindAllElements(
+ (CSvgElementImpl* )RootElement(),
+ KSvgMediaAnimationElement, lAnimationEleList );
+ // Set the engine on the child documents associated with the animation elements as well
+ TInt lAnimationEleCnt = lAnimationEleList.Count();
+ for ( TInt lCurAnimationEle = 0; lCurAnimationEle < lAnimationEleCnt; lCurAnimationEle++ )
+ {
+ CSvgMediaAnimationElementImpl* lAnimationElement =
+ (CSvgMediaAnimationElementImpl* )lAnimationEleList[ lCurAnimationEle ];
+ CSvgDocumentImpl* lChildDoc = lAnimationElement->GetChildDocument();
+ if ( lChildDoc )
+ {
+ lChildDoc->SetEngine( aEngine );
+ }
+ }
+ lAnimationEleList.Close();
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgEngineImpl* CSvgDocumentImpl::Engine()
+ {
+ return iEngine;
+ }
+
+//***********************************************************************
+// From MXmlDocument
+//
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+MXmlElement* CSvgDocumentImpl::CreateElementL( const TDesC& aTagName )
+ {
+
+ TInt position = iSchemaData->GetSVGElementId(aTagName);
+
+ if ( position == KErrNotFound )
+ {
+ return NULL;
+ }
+
+ return CreateElementL( position );
+
+ }
+
+ // ==========================================================================
+// Need method description
+// ==========================================================================
+MXmlElement* CSvgDocumentImpl::CreateElementL(const TUint8 aTagName )
+ {
+
+ TInt position = (TInt) aTagName;
+
+ //##4 this uses the rearrangement of elements, all these elements are same as g element
+ // same constructor
+ //
+ // =====> creating fake G elements to take the place of others...
+ //
+ //need to remove G elements as place holders that is a bad idea
+
+ if( position >= KSvgAltglyphElement && position <= KSvgViewElement )
+ {
+ return ( MXmlElement * ) CSvgGElementImpl::NewL( (TUint8) position, this );
+ }
+
+ switch ( position )
+ {
+
+ case KSvgPathElement:
+ // path
+ return ( MXmlElement * ) CSvgPathElementImpl::NewL( (TUint8) position, this );
+
+ case KSvgStopElement:
+ // stop
+ return ( MXmlElement * ) CSvgStopElementImpl::NewL((TUint8) position,this);
+
+ case KSvgLinearGradientElement:
+ // linearGradient
+ return ( MXmlElement * ) CSvgLinearGradientElementImpl::NewL((TUint8) position,this);
+
+ case KSvgRectElement:
+ // rect
+ return ( MXmlElement * ) CSvgRectElementImpl::NewL( (TUint8) position, this );
+
+ case KSvgPolygonElement:
+ // polygon
+ return ( MXmlElement * ) CSvgPolylineElementImpl::NewL( (TUint8) position, this );
+
+ case KSvgSvgElement:
+ // svg
+ return ( MXmlElement * ) CSvgSvgElementImpl::NewL( (TUint8) position, this );
+
+ case KSvgRadialGradientElement:
+ // radialGradient
+ return ( MXmlElement * ) CSvgRadialGradientElementImpl::NewL((TUint8) position,this);
+
+ case KSvgCircleElement:
+ // circle
+ return ( MXmlElement * ) CSvgCircleElementImpl::NewL( (TUint8) position, this );
+
+ case KSvgLineElement:
+ // line
+ return ( MXmlElement * ) CSvgLineElementImpl::NewL( (TUint8) position,this );
+
+ case KSvgPolylineElement:
+ // polyline
+ return ( MXmlElement * ) CSvgPolylineElementImpl::NewL( (TUint8) position, this );
+
+ case KSvgEllipseElement:
+ // ellipse
+ return ( MXmlElement * ) CSvgEllipseElementImpl::NewL( (TUint8) position, this );
+
+ case KSvgDefsElement:
+ // defs
+ return ( MXmlElement * ) CSvgDefsElementImpl::NewL((TUint8) position, this);
+
+ case KSvgForeignObjectElement:
+ // foreignObject
+ return ( MXmlElement * ) CSvgForeignObjectElementImpl::NewL((TUint8) position, this);
+
+ case KSvgStyleElement:
+ // style
+ return ( MXmlElement * ) CSvgStyleElementImpl::NewL( (TUint8) position, this );
+
+ case KSvgUseElement:
+ // use
+ return ( MXmlElement * ) CSvgUseElementImpl::NewL( (TUint8) position, this );
+
+ case KSvgImageElement:
+ // image
+ return ( MXmlElement * ) CSvgImageElementImpl::NewL( (TUint8) position, this );
+
+ case KSvgAnimateColorElement:
+ // animateColor
+ case KSvgAnimateElement:
+ {
+ // animate
+ CSvgAnimateElementImpl* lAnimateElement = CSvgAnimateElementImpl::NewL( (TUint8) position, this );
+ iSvgAnimations.Append(lAnimateElement);
+ return ( MXmlElement * ) lAnimateElement;
+ }
+
+ case KSvgSetElement:
+ // set
+ return ( MXmlElement * ) CSvgSetElementImpl::NewL( (TUint8) position, this );
+
+ case KSvgMpathElement:
+ // mPath
+ return ( MXmlElement * ) CSvgMpathElementImpl::NewL( (TUint8) position, this );
+
+ case KSvgDiscardElement:
+ // discard
+ return ( MXmlElement * ) CSvgDiscardElementImpl::NewL( (TUint8) position, this );
+
+ /* case KSvgAnimationElement:
+ {
+ // animation
+ CSvgAnimationElementImpl* lAnimationElementImpl = CSvgAnimationElementImpl::NewL( (TUint8) position, this );
+ iSvgAnimations.Append( lAnimationElementImpl );
+ return ( MXmlElement * ) lAnimationElementImpl;
+ }
+*/
+ case KSvgScriptElement:
+ {
+ // script
+ return ( MXmlElement * ) CSvgScriptElementImpl::NewL((TUint8) position,this);
+ }
+
+ case KSvgSolidColorElement:
+ // solidColor
+ return ( MXmlElement * ) CSvgSolidColorElementImpl::NewL((TUint8) position,this);
+
+ case KSvgMetadataElement:
+ // metaData
+ return ( MXmlElement * ) CSvgMetadataElementImpl::NewL((TUint8) position, this);
+
+ case KSvgDescElement:
+ // desc
+ return ( MXmlElement * ) CSvgDescElementImpl::NewL((TUint8) position, this);
+
+ case KSvgTitleElement:
+ // title
+ return ( MXmlElement * ) CSvgTitleElementImpl::NewL((TUint8) position, this);
+
+ case KSvgTextElement:
+ // text
+ //add in the boolean thing here....
+ return ( MXmlElement * ) CSvgTextElementImpl::NewL( (TUint8) position, this );
+
+ case KSvgTextAreaElement:
+ {
+ // textArea
+ return ( MXmlElement * ) CSvgTextAreaElementImpl::NewL((TUint8) position,this);
+ }
+
+ case KSvgAnimateMotionElement:
+ {
+ // animateMotion
+ CSvgAnimateMotionElementImpl* lAnimateMotionElement = CSvgAnimateMotionElementImpl::NewL( (TUint8) position, this );
+ iSvgAnimations.Append(lAnimateMotionElement);
+ return ( MXmlElement * ) lAnimateMotionElement;
+ }
+
+ case KSvgAnimateTransformElement:
+ {
+ // animateTransform
+ CSvgAnimateTransformElementImpl* lAnimateTransformElement = CSvgAnimateTransformElementImpl::NewL( (TUint8) position, this );
+ iSvgAnimations.Append(lAnimateTransformElement);
+ return ( MXmlElement * ) lAnimateTransformElement;
+ }
+
+ case KSvgGlyphElement:
+ // glyph
+#ifdef SVG_FONTS_INCLUDE
+ return ( MXmlElement * ) CSvgGlyphElementImpl::NewL( (TUint8) position, this );
+#else
+ return ( MXmlElement * ) CSvgGElementImpl::NewL( _L( "g" ),(TUint8) position, this );
+#endif
+ case KSvgFontElement:
+ // font
+#ifdef SVG_FONTS_INCLUDE
+ return ( MXmlElement * ) CSvgFontElementImpl::NewL( (TUint8) position, this );
+#else
+ return ( MXmlElement * ) CSvgGElementImpl::NewL( _L( "g" ),(TUint8) position, this );
+#endif
+
+ case KSvgAElement:
+ // a
+ return ( MXmlElement * ) CSvgAElementImpl::NewL( (TUint8) position, this );
+
+ case KSvgFontfaceElement:
+ // font-face
+#ifdef SVG_FONTS_INCLUDE
+ return ( MXmlElement * ) CSvgFontFaceElementImpl::NewL( (TUint8) position, this );
+#else
+ return ( MXmlElement * ) CSvgGElementImpl::NewL( _L( "g" )(TUint8) position, this );
+#endif
+
+ case KSvgMissingglyphElement:
+ // missing-glyph
+#ifdef SVG_FONTS_INCLUDE
+ return ( MXmlElement * ) CSvgMissingGlyphElementImpl::NewL( (TUint8) position, this );
+#else
+ return ( MXmlElement * ) CSvgGElementImpl::NewL( _L( "g" )(TUint8) position, this );
+#endif
+
+ case KSvgHkernElement:
+ // hkern
+#ifdef SVG_FONTS_INCLUDE
+ return ( MXmlElement * ) CSvgHkernElementImpl::NewL( (TUint8) position, this );
+#else
+ return ( MXmlElement * ) CSvgGElementImpl::NewL( _L( "g" )(TUint8) position, this );
+#endif
+
+ case KSvgAudioElement:
+ {
+ CSvgAudioElementImpl* lAudioElement = CSvgAudioElementImpl::NewL( (TUint8) position, this );
+ iSvgAnimations.Append(lAudioElement);
+ return ( MXmlElement * ) lAudioElement;
+ }
+//#ifdef RD_SVGT_MEDIAANIMATION_SUPPORT
+ case KSvgMediaAnimationElement:
+ {
+ CSvgMediaAnimationElementImpl* lMediaAnimationElement = CSvgMediaAnimationElementImpl::NewL( (TUint8) position, this );
+ iSvgAnimations.Append(lMediaAnimationElement);
+ return ( MXmlElement * ) lMediaAnimationElement;
+ }
+//#endif
+
+ } // for switch
+
+ return NULL;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgDocumentImpl::CreateAttribute( const TDesC& /* aName */ )
+ {
+ return KErrNone;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+MXmlElement* CSvgDocumentImpl::GetElementById( const TDesC& aElementId )
+ {
+ if(iRootElement)
+ {
+ const TDesC* myId = iRootElement->Id();
+
+ if (myId)
+ {
+ if (myId->Length() > 0)
+ {
+ if ( *myId == aElementId )
+ {
+ return iRootElement;
+ }
+ }
+ }
+
+ MXmlElement* element = SearchElementById( iRootElement, aElementId );
+
+ return element;
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgDocumentImpl::GetNumberOfIds(MXmlElement* aElement)
+{
+ TInt count = 0;
+
+ CSvgElementImpl* child = ( CSvgElementImpl* ) aElement->FirstChild();
+ while ( child != NULL )
+ {
+ const TDesC* lPtr = child->Id();
+
+ if (lPtr)
+ {
+ count++;
+ }
+ // search children
+ TInt inside_count = GetNumberOfIds( child );
+ if ( inside_count > 0 )
+ {
+ count = count + inside_count;
+ }
+ // search siblings
+
+ child = ( CSvgElementImpl * ) child->NextSibling();
+ }
+
+ return count;
+}
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TDesC* CSvgDocumentImpl::GetId(TInt index)
+{
+ TDesC* id = NULL;
+ RPointerArray<TDesC> ids;
+
+ FindAllIds( (CSvgElementImpl*)RootElement(), ids );
+
+ if (index < ids.Count())
+ {
+ id = ids[index];
+ }
+
+ ids.Close();
+
+ return id;
+}
+
+// ==========================================================================
+// // Return all elements of the given type
+// ==========================================================================
+void CSvgDocumentImpl::FindAllIds( CSvgElementImpl* aStartElement, RPointerArray<TDesC>& aList )
+{
+ if ( aStartElement == NULL )
+ return;
+
+ CSvgElementImpl* child = (CSvgElementImpl*)aStartElement->FirstChild();
+ while ( child != NULL )
+ {
+ // add to list if child is found
+ const TDesC* myId = child->Id();
+
+ if ( myId )
+ aList.Append( myId );
+
+ // find in grandchildren
+ FindAllIds( child, aList );
+ child = (CSvgElementImpl*)child->NextSibling();
+ }
+}
+
+
+//***********************************************************************
+// From MSvgDocument
+//
+
+
+
+//
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TDesC& CSvgDocumentImpl::GetUrl()
+ {
+ return iUri;
+ }
+
+// ==========================================================================
+// // Returns the value of the current focus index.
+// ==========================================================================
+
+TInt32 CSvgDocumentImpl::GetCurFocusIndex()
+{
+ return iCurObjIdx;
+}
+
+
+// ==========================================================================
+// // Increment the focus index by one value
+// ==========================================================================
+
+TInt32 CSvgDocumentImpl::IncCurFocusIndex()
+{
+ return ++iCurObjIdx;
+}
+
+// ==========================================================================
+// // Decrement the focus index by one value
+// ==========================================================================
+TInt32 CSvgDocumentImpl::DecCurFocusIndex()
+{
+ return --iCurObjIdx;
+}
+
+// ==========================================================================
+// // Sets the focus index to the given value
+// ==========================================================================
+void CSvgDocumentImpl::SetCurFocusIndex(TInt32 aVal)
+{
+ iCurObjIdx = aVal;
+}
+
+// ==========================================================================
+// // Returns the current focus object
+// ==========================================================================
+CSvgElementImpl* CSvgDocumentImpl::GetCurFocusObject()
+{
+ return iCurrentFocusObject;
+}
+
+// ==========================================================================
+// // Sets the current focus element to the element specified
+// ==========================================================================
+void CSvgDocumentImpl::SetCurFocusObject(CSvgElementImpl* aElement)
+{
+ iCurrentFocusObject = aElement;
+}
+
+//
+// ==========================================================================
+// Need method description
+// ==========================================================================
+EXPORT_C MXmlElement* CSvgDocumentImpl::RootElement()
+ {
+ return iRootElement;
+ }
+
+//***********************************************************************
+//
+//
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+MXmlElement* CSvgDocumentImpl::SearchElementById( MXmlElement* aElement,
+ const TDesC& aElementId )
+ {
+ CSvgElementImpl* child = ( CSvgElementImpl* ) aElement->FirstChild();
+ while ( child != NULL )
+ {
+ const TDesC* lPtr = child->Id();
+
+ if (lPtr)
+ {
+ if ( *lPtr == aElementId )
+ {
+ return child;
+ }
+ }
+ // search children
+ MXmlElement* childrenMatch = SearchElementById( child, aElementId );
+ if ( childrenMatch != NULL )
+ {
+ return childrenMatch;
+ }
+ // search siblings
+
+ child = ( CSvgElementImpl * ) child->NextSibling();
+
+ }
+ return NULL;
+ }
+
+
+
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+MXmlElement* CSvgDocumentImpl::AppendChildL( MXmlElement* aNewChild )
+ {
+
+ if ( aNewChild && ((CXmlElementImpl*)aNewChild)->ElemID() == KSvgSvgElement )
+
+ {
+ // Set new node as the root element, if it is
+ if ( iRootElement )
+ {
+ return NULL;
+ }
+ iRootElement = (CSvgElementImpl *) aNewChild;
+
+ // Set the new node's next sibling
+ aNewChild->SetNextSibling( NULL );
+ }
+ else
+ {
+ return NULL;
+ }
+
+ return aNewChild;
+ }
+
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgSchemaData* CSvgDocumentImpl::SchemaData()
+ {
+ return iSchemaData;
+ }
+
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::SetUri( const TDesC& aUri )
+ {
+ iUri.Zero();
+ iUri.Copy(aUri);
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::GetUri( TDes& aUri )
+ {
+ aUri.Zero();
+ aUri.Copy(iUri);
+ }
+
+// ==========================================================================
+// Register an element for receiving events using the event mask
+// ==========================================================================
+void CSvgDocumentImpl::AddToEventReceiverListL( MSvgEventReceiver* aElement,
+ TUint8 aEventMask)
+ {
+ if (iEventHandler != NULL)
+ iEventHandler->AddToEventReceiverListL( aElement, aEventMask );
+ }
+
+// ==========================================================================
+// Register an element for receiving events and events using the event mask
+// ==========================================================================
+void CSvgDocumentImpl::AddToEventReceiverListL( MSvgEventReceiver* aElement,
+ TSvgEvent aEvent,
+ TUint8 aEventMask)
+ {
+ if (iEventHandler != NULL)
+ iEventHandler->AddToEventReceiverListL( aElement,aEvent,aEventMask );
+ }
+
+// ==========================================================================
+// Unregister an element for receiving events using the event mask
+// ==========================================================================
+void CSvgDocumentImpl::RemoveFromEventReceiverList( MSvgEventReceiver* aElement )
+ {
+ if (iEventHandler != NULL)
+ iEventHandler->RemoveFromEventReceiverList( aElement );
+ }
+
+// ==========================================================================
+// Provide event handler the event timing information for the
+// completion of event.
+// ==========================================================================
+void CSvgDocumentImpl::AddEventBeginTime(MSvgEventReceiver* aElement, TUint32 aTime, MSvgEventReceiver* aTargetElement )
+ {
+ if (iEventHandler != NULL)
+ iEventHandler->AddEventBeginTime( aElement, aTime, aTargetElement );
+ }
+
+// ==========================================================================
+// Sort the events in a time scale according to their absolute start
+// and finish times
+// ==========================================================================
+void CSvgDocumentImpl::SortEventList()
+ {
+ if (iEventHandler != NULL)
+ iEventHandler->SortEventList();
+ }
+
+//
+// ==========================================================================
+// Returns an element that is registered for the given event mask and
+// is the first one starting from the given index (either up or down the
+// list based on the aNext parameter)
+// ==========================================================================
+CSvgElementImpl* CSvgDocumentImpl::GetEventReceiverElement(TInt32 aIndex, TBool aNext, TUint8 aEventMask, TInt32& aNewIndex)
+ {
+ if (iEventHandler != NULL)
+ {
+ return (CSvgElementImpl*)iEventHandler->GetEventReceiver(aIndex, aNext, aEventMask, aNewIndex);
+ }
+ else
+ return NULL;
+
+ }
+
+// ==========================================================================
+// Is Animation file
+// ==========================================================================
+TBool CSvgDocumentImpl::IsAnimationFile()
+ {
+ if( (iEventHandler != NULL) && iEventHandler->Count() )
+ return ETrue;
+ else
+ return EFalse;
+ }
+
+// ==========================================================================
+// IsValidSubEventMask
+// ==========================================================================
+TBool CSvgDocumentImpl::IsValidSubEventMask(TUint16 aSubEventMask)
+ {
+ if(iEventHandler)
+ {
+ return(iEventHandler->IsValidSubEventMask(aSubEventMask));
+ }
+ else
+ {
+ return EFalse;
+ }
+ }
+// ==========================================================================
+// Set DRM Mode
+// ==========================================================================
+
+void CSvgDocumentImpl::SetDRMMode(TBool aEnable)
+ {
+ iDrmEnable = aEnable;
+ }
+// ==========================================================================
+// Set DRM Mode
+// ==========================================================================
+void CSvgDocumentImpl::Reset(MSvgEvent *aEvent)
+ {
+ if ( iAnimationResetNeeded && iEventHandler != NULL )
+ {
+ iEventHandler->Reset( aEvent );
+ iAnimationResetNeeded = EFalse;
+ }
+ }
+// ==========================================================================
+// Set DRM Mode
+// ==========================================================================
+TBool CSvgDocumentImpl::SvgElementPresent(CSvgElementImpl* aElement)
+{
+ if(iRootElement == NULL) return EFalse;
+ if ( ( ( CSvgElementImpl * ) iRootElement ) == aElement )
+ {
+ return ETrue;
+ }
+
+ return SearchByPointer(iRootElement, aElement);
+
+}
+// ==========================================================================
+// Set DRM Mode
+// ==========================================================================
+TBool CSvgDocumentImpl::SearchByPointer(CSvgElementImpl* aParent, CSvgElementImpl* aElement)
+{
+ CSvgElementImpl* child = ( CSvgElementImpl* ) aParent->FirstChild();
+ while ( child != NULL )
+ {
+
+ if ( child == aElement )
+ {
+ return ETrue;
+ }
+ // search children
+ TBool result = SearchByPointer( child, aElement );
+ if (result)
+ {
+ return ETrue;
+ }
+ // search siblings
+ child = ( CSvgElementImpl * ) child->NextSibling();
+ }
+ return EFalse;
+}
+// ==========================================================================
+// Set DRM Mode
+// ==========================================================================
+void CSvgDocumentImpl::SetFocusElement(CXmlElementImpl* aElement )
+{
+ iCurrentFocusObject = (CSvgElementImpl*)aElement;
+}
+// ==========================================================================
+// Set DRM Mode
+// ==========================================================================
+CXmlElementImpl* CSvgDocumentImpl::GetFocusElement()
+{
+ return (CXmlElementImpl*) iCurrentFocusObject;
+}
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::ReInitialize()
+ {
+ if(iMultipleRendering)
+ {
+ if (iEventHandler != NULL)
+ iEventHandler->ReInitialize();
+ }
+ else
+ {
+ iMultipleRendering= ETrue;
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::Load( const TDesC& aFileName, CSvgErrorImpl& aError )
+{
+ aError.SetErrorCode( ESvgNoError );
+
+ RFs session;
+ OpenSession( session, aError );
+ if ( aError.HasError() )
+ return;
+
+ RFile fileHandle;
+ TInt openError = fileHandle.Open( session, aFileName, EFileRead );
+ if ( openError != KErrNone )
+ {
+ PrepareError( aError, ESvgUnknown, openError,
+ _L( "Fail to open file for reading: " ), aFileName );
+ session.Close();
+ return;
+ }
+ else
+ {
+ Load( fileHandle, aError );
+ session.Close();
+ }
+}
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::Load( const TDesC8& aByteData, CSvgErrorImpl& aError, TBool aRemoveFalseSwitchElements )
+{
+ aError.SetErrorCode( ESvgNoError );
+
+ //-------------------------------------------------------------------
+ // Byte array is gzipped and/or drm:
+ // Write buffer to file:
+ // a) GZip only has filename function to unzip
+ // b) Drm only has file-handle to decrypt
+ //-------------------------------------------------------------------
+ if ( IsGzipContent( aByteData ) ||
+ ( iDrmEnable && IsDRMContent( aByteData ) ) )
+ {
+ RFs session;
+ OpenSession( session, aError );
+ if ( aError.HasError() )
+ return;
+
+ // Write byte-array to temp file
+ TFileName zippedTempFilename;
+ if ( WriteToTempFile( session, aByteData, zippedTempFilename, aError ) != KErrNone )
+ {
+ session.Close();
+ return;
+ }
+ Load( zippedTempFilename, aError );
+ session.Delete( zippedTempFilename );
+ session.Close();
+ }
+ //-------------------------------------------------------------------
+ // byte-array is neither gzipped nor DRM encrypted
+ //-------------------------------------------------------------------
+ else
+ {
+ iIsDRMProtected = EFalse;
+ iEventHandler->Reset();
+ TRAPD(error,ProcessSvgContentL( aByteData, aError, aRemoveFalseSwitchElements ));
+ if ( error != KErrNone )
+ {
+ PrepareError( aError, ESvgNoMemory, error,
+ _L( "Out of Memory: " ),
+ _L( "Instantiating Parser" ) );
+ }
+
+ iInitialDrawFlag = ETrue;
+ iFinishedParsing = ETrue;
+
+ }
+}
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::Load( RFile& aFileHandle, CSvgErrorImpl& aError )
+{
+ aError.SetErrorCode( ESvgNoError );
+
+ RFs session;
+ OpenSession( session, aError );
+ if ( !aError.HasError() )
+ {
+ Load( session, aFileHandle, aError );
+ session.Close();
+ }
+}
+// -----------------------------------------------------------------------------
+// CSvgDocumentImpl::ParentTimeContainerTick
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+//
+void CSvgDocumentImpl::ParentTimeContainerTick(
+ TSvgTick aTick ) // Current tick information
+ {
+ TBool lDoRedraw = ETrue;
+ if ( iHasParent )
+ {
+ // Do not redraw in child document to avoid
+ // double redraws.
+ lDoRedraw = EFalse;
+ }
+ // Create timer event and propogate to engine
+ TSvgTimerEvent lTimerEvent( aTick.iParentTcTick );
+ // Send to engine to process the timer event
+ TRAPD( lProcEvtErr, Engine()->ProcessEventL(
+ this, &lTimerEvent, lDoRedraw ) );
+ if ( lProcEvtErr != KErrNone )
+ {
+ // Error Processing
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgDocumentImpl::GetEntitySyncBehavior
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+//
+TSvgSyncBehaviour CSvgDocumentImpl::GetEntitySyncBehavior()
+ {
+ // Document is locked with the parent tc timeline
+ return ESvgSyncLocked;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSvgDocumentImpl::GetEntityCurrentTime
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+//
+void CSvgDocumentImpl::GetEntityCurrentTime( TUint32&
+ /* aEntityCurTime */) // Current Entity Time in msecs.
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgDocumentImpl::GetCnfSyncMasterStatus
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+//
+void CSvgDocumentImpl::GetCnfSyncMasterStatus(
+ TBool& aIsSyncMaster ) // Indicates whether the element is configured as
+ // Sync Master.
+ {
+ // Document can never be a sync master
+ aIsSyncMaster = EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgDocumentImpl::GetCurSyncMasterStatus
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+void CSvgDocumentImpl::GetCurSyncMasterStatus(
+ TBool& aIsSyncMaster ) // Indicates whether the element is currrently
+ // Sync Master.
+ {
+ // Document can never be a sync master
+ aIsSyncMaster = EFalse;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSvgDocumentImpl::SetCurSyncMasterStatus
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+void CSvgDocumentImpl::SetCurSyncMasterStatus(
+ TBool /*aSyncMasterStatus */) // Indicates whether the element is
+ // currrently Sync Master.
+ {
+ // Document sync master status is always false as it can never be
+ // a sync master
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgDocumentImpl::CanGenerateTick
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+TBool CSvgDocumentImpl::CanGenerateTick()
+ {
+ // Document cannot generate tick, as it is not a inherently timed element
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgDocumentImpl::CanUseParentTick
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+TBool CSvgDocumentImpl::CanUseParentTick()
+ {
+ // Return True as document can always use parent tick to
+ // advance itself
+ return ( ETrue );
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgDocumentImpl::ResyncTimedEntity
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+void CSvgDocumentImpl::ResyncTimedEntity(
+ TUint32 /*aSynctime*/ ) // Time for resync in msecs.
+ {
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// CSvgDocumentImpl::PauseTimedEntity
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+void CSvgDocumentImpl::PauseTimedEntity()
+ {
+
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgDocumentImpl::ResumeTimedEntity
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+void CSvgDocumentImpl::ResumeTimedEntity()
+ {
+
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgDocumentImpl::StopTimedEntity
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+void CSvgDocumentImpl::StopTimedEntity()
+ {
+ iEventHandler->ResetTimes();
+ }
+
+
+//From MSvgTimedEntityInterface
+TSvgObjectType CSvgDocumentImpl::ObjectType()
+{
+ return ESvgDocumentElement;
+}
+
+
+//returns the child time container of the element
+//used in timecontainer
+CSvgTimeContainer* CSvgDocumentImpl::GetChildTimeContainer()
+{
+ return NULL;
+}
+
+
+//if node has a child
+// visit the child call postorder on that
+//add current node
+//if there are siblings
+// visit all siblings
+void CSvgDocumentImpl::ParsePostOrderMediaElements( CSvgElementImpl* aRoot,
+ RPointerArray<CSvgElementImpl>& aPostOrderList)
+ {
+ if ( !aRoot )
+ {
+ return;
+ }
+
+ CSvgElementImpl* lNodePtr = ( CSvgElementImpl* )aRoot->FirstChild();
+ while ( lNodePtr != NULL )
+ {
+ ParsePostOrderMediaElements( lNodePtr, aPostOrderList );
+ lNodePtr = (CSvgElementImpl* )(lNodePtr->NextSibling() );
+ }
+
+ // Add only media elements, currently animation and audio
+ if ( aRoot->ElemID() == KSvgMediaAnimationElement ||
+ aRoot->ElemID() == KSvgAudioElement )
+ {
+ aPostOrderList.Append( aRoot );
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::Load( RFs& aSession, RFile& aFileHandle, CSvgErrorImpl& aError )
+{
+ iEventHandler->Reset();
+
+ RFile ungzippedFile;
+ RFile* fileHandle = &aFileHandle;
+ TFileName tempFilename;
+ TBool needToDeleteTempFile = EFalse;
+ iIsDRMProtected = EFalse;
+
+ //************************************************
+ // Check for gzip format: write to temp file
+ //************************************************
+ // Ignore Gzip content due to platform security: uncompressed file must be created
+ if ( IsGzipContent( aFileHandle ) )
+ {
+ //************************************************
+ // Ungzipped content may be DRM or txt-svg or binary-svg
+ //************************************************
+ needToDeleteTempFile = ETrue;
+ if ( !ProcessGZipContent( aSession, aFileHandle, tempFilename, aError ) )
+ return;
+
+ // Open ungzipped file
+ TInt openError = ungzippedFile.Open( aSession, tempFilename, EFileRead );
+ if ( openError != KErrNone )
+ {
+ // couldn't open temp file for writing
+ PrepareError( aError, ESvgUnknown, openError,
+ _L( "Loading GZipped SVG File failed: " ),
+ _L( "Error Opening Temp File for Reading." ) );
+
+ // Delete uncompress temp file if needed
+ if ( needToDeleteTempFile )
+ aSession.Delete( tempFilename );
+ return;
+ }
+ fileHandle = &ungzippedFile;
+ }
+
+ HBufC8* svgByteArray = NULL;
+ //************************************************
+ // Decrypt DRM
+ //************************************************
+ if ( iDrmEnable && IsDRMContent( *fileHandle ) )
+ {
+ TRAPD( drmError, svgByteArray = ProcessDRMContentL( *fileHandle, aError ) );
+ if ( drmError != KErrNone )
+ {
+ PrepareError( aError, ESvgNoMemory, drmError,
+ _L( "Out of Memory: " ),
+ _L( "Instantiating DRM Decoder" ) );
+ return;
+ }
+ // drm failed, error should already be set
+ else if ( svgByteArray == NULL )
+ {
+ return;
+ }
+
+ if ( needToDeleteTempFile && ( drmError || svgByteArray == NULL ) )
+ {
+ aSession.Delete( tempFilename );
+ }
+ iIsDRMProtected = ETrue;
+ }
+ // Read Non encrypted data
+ else
+ {
+ //************************************************
+ // Read plain file: txt-svg or binary-svg
+ //************************************************
+ TInt fileLength = 0;
+ fileHandle->Size( fileLength );
+ TRAPD( error, svgByteArray = HBufC8::NewL( fileLength ) );
+ if ( error != NULL )
+ {
+ PrepareError( aError, ESvgNoMemory, error,
+ _L( "Out of Memory" ),
+ _L( "Allocating byte-array for data" ) );
+ if ( needToDeleteTempFile )
+ {
+ aSession.Delete( tempFilename );
+ }
+ return;
+ }
+ TInt pos = 0;
+ fileHandle->Seek( ESeekStart, pos );
+ TPtr8 des = svgByteArray->Des();
+ TInt readError = fileHandle->Read( des );
+ if ( readError != KErrNone )
+ {
+ PrepareError( aError, ESvgUnknown, readError,
+ _L( "Reading SVG File Failed." ), _L( "" ) );
+ delete svgByteArray;
+ if ( needToDeleteTempFile )
+ {
+ aSession.Delete( tempFilename );
+ }
+ return;
+ }
+ }
+
+ //************************************************
+ // Parser binary or plain svg content
+ //************************************************
+ TRAPD( svgError, ProcessSvgContentL( *svgByteArray, aError ) );
+ if ( svgError != KErrNone || ( aError.HasError() && !aError.IsWarning() ) )
+ {
+ delete svgByteArray;
+ if ( !aError.HasError() )
+ {
+ PrepareError( aError, ESvgNoMemory, svgError,
+ _L( "Out of Memory: " ),
+ _L( "Instantiating SVG ContentHandler/Decoder" ) );
+ }
+ if ( needToDeleteTempFile )
+ aSession.Delete( tempFilename );
+ return;
+ }
+
+ iInitialDrawFlag = ETrue;
+ iFinishedParsing = ETrue;
+
+ delete svgByteArray;
+
+
+ // Delete uncompress temp file if needed
+ if ( needToDeleteTempFile )
+ {
+ // Close only when file handle is for temp file
+ fileHandle->Close();
+ aSession.Delete( tempFilename );
+ }
+
+ // Prepare engine to draw document
+ LoadingCompleted();
+}
+
+// ==========================================================================
+// Need method description
+// Leaves only when allocating memory fails
+// Reports other errors
+// ==========================================================================
+void CSvgDocumentImpl::ProcessSvgContentL( const TDesC8& aByteArray, CSvgErrorImpl& aError, TBool aRemoveFalseSwitchElements )
+{
+ //************************************************
+ // Determine binary or xml svg file
+ //************************************************
+ if ( IsBinarySvg( aByteArray ) )
+ {
+ TInt error = KErrNone;
+ CSvgDecoder* decoder = CSvgDecoder::NewL( aByteArray );
+
+ TRAP( error, iRootElement = decoder->StartDecodingL( this, aError ) );
+ if ( error != KErrNone || iRootElement == NULL && !aError.HasError() )
+ {
+ if ( error != KErrNone )
+ {
+ PrepareError( aError, ESvgbFileNotValid, error,
+ _L( "Invalid binary file." ), _L( "" ) );
+ }
+ }
+ delete decoder;
+ }
+ else
+ {
+ iXmlHandler = CSvgContentHandler::NewL( aRemoveFalseSwitchElements );
+ iRootElement = iXmlHandler->ParseByteData( this, aByteArray, aError );
+ delete iXmlHandler;
+ iXmlHandler = NULL;
+ }
+}
+
+// ==========================================================================
+// JSR226 only!!
+// Allows filling of document from JSR side with 16 bit string instead of 8
+//
+// ==========================================================================
+void CSvgDocumentImpl::Load16BitString( const TDesC16& aSvgString, CSvgErrorImpl& aError, TBool aRemoveFalseSwitchElements )
+{
+ aError.SetErrorCode( ESvgNoError );
+
+ iIsDRMProtected = EFalse;
+
+ if (iEventHandler)
+ iEventHandler->Reset();
+ TRAPD(error,Process16BitSvgContentL( aSvgString, aError, aRemoveFalseSwitchElements ));
+ if ( error != KErrNone )
+ {
+ PrepareError( aError, ESvgNoMemory, error,
+ _L( "Out of Memory: " ),
+ _L( "Instantiating Parser" ) );
+ }
+
+ iInitialDrawFlag = ETrue;
+ iFinishedParsing = ETrue;
+}
+
+void CSvgDocumentImpl::Process16BitSvgContentL( const TDesC16& aSvgString, CSvgErrorImpl& aError, TBool aRemoveFalseSwitchElements )
+{
+ iXmlHandler = CSvgContentHandler::NewL( aRemoveFalseSwitchElements );
+ iRootElement = iXmlHandler->Parse16BitData( this, aSvgString, aError );
+ delete iXmlHandler;
+ iXmlHandler = NULL;
+}
+// END OF JSR226 ONLY
+// ==========================================================================
+
+// ==========================================================================
+void CSvgDocumentImpl::CancelParsing()
+ {
+ // Check if there is animation element in the parent svg
+ RPointerArray<CSvgElementImpl> lAnimationEleList;
+ FindAllElements((CSvgElementImpl* )RootElement(),
+ KSvgMediaAnimationElement, lAnimationEleList );
+ TInt lAnimationEleCnt = lAnimationEleList.Count();
+ for ( TInt lCurAnimationEle = 0;
+ lCurAnimationEle < lAnimationEleCnt; lCurAnimationEle++ )
+ {
+ CSvgMediaAnimationElementImpl* lAnimationElement =
+ (CSvgMediaAnimationElementImpl* )lAnimationEleList[ lCurAnimationEle ];
+ CSvgDocumentImpl* lChildDoc = lAnimationElement->GetChildDocument();
+ if ( lChildDoc )
+ {
+ lChildDoc->CancelParsing(); // Cancel parsing on child svg
+ }
+ }
+ lAnimationEleList.Close();
+ if ( iXmlHandler )
+ {
+ iXmlHandler->CancelParsing();
+ }
+ }
+
+// ==========================================================================
+TBool CSvgDocumentImpl::IsParsing()
+ {
+ // xml handler is set to NULL after parsing
+ return iXmlHandler != NULL;
+ }
+
+//***************************************************************************
+// The function isGroupOpacity checks to see if there is a valid opacity
+// attribute.
+//***************************************************************************
+
+TBool CSvgDocumentImpl::isGroupOpacity( CSvgElementImpl* aElement )
+{
+ TBool lReturnValue = EFalse;
+ CCssValue* lCssValue = NULL;
+
+ aElement->FindProperty( KCSS_ATTR_GROUP_OPACITY, lCssValue, aElement );
+ if ( lCssValue )
+ {
+ if ( ((CFloatCssValueImpl*)lCssValue)->Value() != KFloatFixOne )
+ {
+ // valid opacity value
+ lReturnValue = ETrue;
+ }
+ }
+
+ return lReturnValue;
+}
+
+
+// ==========================================================================
+// Pre-condition: content is DRM
+// The content of a DRM may be svg-text or svg-bin
+// Leaves only for memory allocation failure
+// ==========================================================================
+HBufC8* CSvgDocumentImpl::ProcessDRMContentL( RFile& aFileHandle, CSvgErrorImpl& aError )
+{
+ // Open File Content and Data
+ ContentAccess::CContent* content = ContentAccess::CContent::NewLC(
+ aFileHandle );
+ // Note: very important to use EView and NOT EPlay
+ ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EView );
+
+ // Read Length of Content
+ TInt length = 0;
+ TRAPD( sizeError, data->DataSizeL( length ) );
+ // Cannot get length of data
+ if ( sizeError != KErrNone )
+ {
+ ProcessDRMError( sizeError, aError );
+ CleanupStack::PopAndDestroy( 2 );
+ return NULL;
+ }
+
+ // Allocate Memory for Content: no leavable command after this
+ // so, pushing onto cleanup stack not needed
+ HBufC8* buffer = HBufC8::NewL( length );
+
+ TPtr8 des = buffer->Des();
+ TInt readError = data->Read( des );
+
+ // Check for read error
+ if ( readError != KErrNone )
+ {
+ ProcessDRMError( readError, aError );
+ CleanupStack::PopAndDestroy( 2 );
+ delete buffer;
+ return NULL;
+ }
+ // Only consume rights when not in thumb nail mode
+ else if ( !iIsThumbNailMode )
+ {
+ // Do not consume drm rights if iDrmRightsConsumptionEnabled is EFalse
+ if(iDrmRightsConsumptionEnabled)
+ {
+ TInt intentError = data->ExecuteIntent( ContentAccess::EView );
+ if ( intentError != KErrNone )
+ {
+ ProcessDRMError( readError, aError );
+ aError.SetIsWarning( ETrue );
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy( 2 );
+ return buffer;
+}
+
+// ==========================================================================
+// Un-gzip to a temp file and return the name of temp file
+// ==========================================================================
+TBool CSvgDocumentImpl::ProcessGZipContent( RFs& aSession,
+ RFile& aGZipFileHandle,
+ TFileName& aUnzippedFileName ,
+ CSvgErrorImpl& aError )
+{
+ // Write data to temp file: gzip does not have function to read RFile
+ TFileName gzipFilename;
+ if ( WriteToTempFile( aSession, aGZipFileHandle, gzipFilename, aError ) != KErrNone )
+ return EFalse;
+
+ TBool result = ProcessGZipContent( aSession, gzipFilename, aUnzippedFileName, aError );
+
+ // Delete temp gzipped file
+ aSession.Delete( gzipFilename );
+
+ return result;
+}
+
+// ==========================================================================
+// Uncompress to a temporary file
+// ==========================================================================
+TBool CSvgDocumentImpl::ProcessGZipContent( RFs& aSession,
+ TFileName& aZippedFileName,
+ TFileName& aUnzippedFileName ,
+ CSvgErrorImpl& aError )
+{
+ // Create ungzipped temp file
+ TFileName path;
+ GetProcessPrivatePath( aSession, path );
+ RFile gzipOutputFile;
+ TInt replaceError = gzipOutputFile.Temp( aSession, path, aUnzippedFileName, EFileWrite );
+ if ( replaceError != KErrNone )
+ {
+ // couldn't open temp file for writing
+ PrepareError( aError, ESvgUnknown, replaceError,
+ _L( "Failed to create file or unGZip: " ), aUnzippedFileName );
+ return EFalse;
+ }
+
+ // okay so far, uncompressing
+ CEZGZipToFile* uncompressor = NULL;
+ TRAPD( uncompressorError,
+ uncompressor = CEZGZipToFile::NewL( aSession, aZippedFileName, gzipOutputFile ) )
+ if ( uncompressorError != KErrNone )
+ {
+ PrepareError( aError, ESvgUnknown, uncompressorError,
+ _L( "Out of memory: " ),
+ _L( "Instantiating GZip decompressor" ) );
+ gzipOutputFile.Close();
+ aSession.Delete( aUnzippedFileName );
+
+ return EFalse;
+ }
+
+ // Decompress file
+ TBool done = EFalse;
+ while ( !done )
+ {
+ TRAPD( inflateError, done = !uncompressor->InflateL() );
+ if ( inflateError != KErrNone )
+ {
+ PrepareError( aError, ESvgUnknown, inflateError,
+ _L( "Uncompressing GZip file failed." ), _L( "" ) );
+ delete uncompressor;
+ gzipOutputFile.Close();
+ aSession.Delete( aUnzippedFileName );
+
+ return EFalse;
+ }
+ }
+
+ gzipOutputFile.Close();
+ delete uncompressor;
+
+ return ETrue;
+}
+
+// ==========================================================================
+// Error codes taken from caf/content.h
+// ==========================================================================
+void CSvgDocumentImpl::ProcessDRMError( TInt errorCode, CSvgErrorImpl& aError )
+{
+ if ( errorCode == KErrNone )
+ return;
+
+ if ( errorCode == KErrNotFound )
+ {
+ aError.SetDescription( _L( "Content Not Found" ) );
+ }
+ else if ( errorCode == KErrCAPendingRights )
+ {
+ aError.SetDescription( _L( "Rights Have Not Arrived" ) );
+ }
+ else if ( errorCode == KErrCANoPermission )
+ {
+ aError.SetDescription( _L( "No Permission to Play Content" ) );
+ }
+ else if ( errorCode == KErrCANoRights )
+ {
+ aError.SetDescription( _L( "No Rights Exists for Content" ) );
+ }
+ else if ( errorCode == KErrCANotSupported )
+ {
+ aError.SetDescription( _L( "Unable to Open Content" ) );
+ }
+ else if ( errorCode == KErrPermissionDenied )
+ {
+ aError.SetDescription( _L( "No Permission to Open Content" ) );
+ }
+ else if ( errorCode == KErrAccessDenied )
+ {
+ aError.SetDescription( _L( "Content Already in Use or No DRM Capability" ) );
+ }
+ else if ( errorCode == KErrCASizeNotDetermined )
+ {
+ aError.SetDescription( _L( "Cannot Determine Size of Content" ) );
+ }
+ else
+ {
+ aError.SetDescription( _L( "Unknown DRM Error" ) );
+ }
+ aError.SetIsWarning( EFalse );
+ aError.SetErrorCode( ESvgDRMFailure );
+ aError.SetSystemErrorCode( errorCode );
+}
+
+// ==========================================================================
+// Returns true if the first two bytes of the given file could be a gzip file.
+// This function is modified from the function in EZGZipFile class.
+// ==========================================================================
+TBool CSvgDocumentImpl::IsGzipContent( RFile& aFileHandle )
+{
+ TUint8 ids[2];
+ TPtr8 des( ids, 0, sizeof( TUint8 ) * 2 );
+
+ if ( aFileHandle.Read( des ) != KErrNone )
+ return EFalse;
+
+ // reset to start of file
+ TInt zero = 0;
+ aFileHandle.Seek( ESeekStart, zero );
+ return ( ids[0] == 31 && ids[1] == 139 );
+// return ( ids[0] == EZGZipFile::ID1 && ids[1] == EZGZipFile::ID2 );
+}
+
+// ==========================================================================
+// Returns whether the byte-array header matches a GZIP signature
+// ==========================================================================
+TBool CSvgDocumentImpl::IsGzipContent( const TDesC8& aByteArray )
+{
+ return aByteArray.Length() >= 2 &&
+ aByteArray[0] == 31 && aByteArray[1] == 139;
+// aByteArray[0] == EZGZipFile::ID1 && aByteArray[1] == EZGZipFile::ID2;
+}
+
+// ==========================================================================
+// Returns whether the byte-array header matches a SVG binary signature
+// ==========================================================================
+TBool CSvgDocumentImpl::IsBinarySvg( const TDesC8& aByteArray )
+{
+ //const TUint32 KBinaryFile = 66737868;
+ //const TUint32 KBinaryFile2 = 66737869;
+
+ if ((aByteArray.Length() >= 4 &&
+ aByteArray[0] == 0xCC && aByteArray[1] == 0x56 &&
+ aByteArray[2] == 0xFA && aByteArray[3] == 0x03) ||
+ (aByteArray.Length() >= 4 &&
+ aByteArray[0] == 0xCD && aByteArray[1] == 0x56 &&
+ aByteArray[2] == 0xFA && aByteArray[3] == 0x03) ||
+ (aByteArray.Length() >= 4 &&
+ aByteArray[0] == 0xCE && aByteArray[1] == 0x56 &&
+ aByteArray[2] == 0xFA && aByteArray[3] == 0x03) ||
+ (aByteArray.Length() >= 4 &&
+ aByteArray[0] == 0xCF && aByteArray[1] == 0x56 &&
+ aByteArray[2] == 0xFA && aByteArray[3] == 0x03) )
+ {
+ return ETrue;
+ }
+ else
+ {
+ return EFalse;
+ }
+}
+
+// ==========================================================================
+// Returns whether the file header matches a DRM signature
+// ==========================================================================
+TBool CSvgDocumentImpl::IsDRMContent( RFile& aFileHandle )
+{
+ TUint8 ids[2];
+ TPtr8 des( ids, 0, sizeof( TUint8 ) * 2 );
+
+ if ( aFileHandle.Read( des ) != KErrNone )
+ return EFalse;
+
+ // reset to start of file
+ TInt zero = 0;
+ aFileHandle.Seek( ESeekStart, zero );
+ return ( ids[0] == 0x01 && ids[1] == 0x0D );
+}
+
+// ==========================================================================
+// Returns whether the file header matches a DRM signature
+// ==========================================================================
+TBool CSvgDocumentImpl::IsDRMContent( const TDesC8& aByteArray )
+{
+ return ( aByteArray.Length() > 1 && aByteArray[0] == 0x01 && aByteArray[1] == 0x0D );
+}
+
+// ==========================================================================
+// Generate the "c:/private/<sid>" directory name
+// ==========================================================================
+TInt CSvgDocumentImpl::GetProcessPrivatePath( RFs& aSession, TFileName& aPath )
+{
+ aSession.PrivatePath( aPath );
+ aPath.Insert( 0, _L( "c:" ) );
+ return KErrNone;
+}
+
+// ==========================================================================
+// Create "c:/private/<sid>" directory if it does not already exist
+// ==========================================================================
+TInt CSvgDocumentImpl::CreateProcessPrivateDirectory( RFs& aSession, TFileName& aPath )
+{
+ GetProcessPrivatePath( aSession, aPath );
+ return ( !BaflUtils::FolderExists( aSession, aPath ) ) ? aSession.MkDir( aPath ) : KErrNone;
+}
+
+// ==========================================================================
+// Open a file session, error is indicated in aError
+// ==========================================================================
+void CSvgDocumentImpl::OpenSession( RFs& aSession, CSvgErrorImpl& aError )
+{
+ TInt error = aSession.Connect();
+ if ( error != KErrNone )
+ {
+ // couldn't open temp file for writing
+ PrepareError( aError, ESvgUnknown, error,
+ _L( "Connecting File Session Failed." ), _L( "" ) );
+ }
+}
+
+// ==========================================================================
+// Session must be opened successfully
+// File name of temp file is store in aFilename
+// ==========================================================================
+TInt CSvgDocumentImpl::WriteToTempFile( RFs& aSession, const TDesC8& aByteArray,
+ TFileName& aFilename, CSvgErrorImpl& aError )
+{
+ // Create temporary file for byte-array
+ TFileName path;
+ CreateProcessPrivateDirectory( aSession, path );
+ RFile writeFile;
+ TInt tempError = writeFile.Temp( aSession, path, aFilename, EFileWrite );
+ if ( tempError != KErrNone )
+ {
+ PrepareError( aError, ESvgUnknown, tempError,
+ _L( "Failed open temp file to write data." ), aFilename );
+ return tempError;
+ }
+
+ // Write byte-array to file
+ TInt writeError = writeFile.Write( aByteArray );
+ if ( writeError != KErrNone )
+ {
+ PrepareError( aError, ESvgUnknown, writeError,
+ _L( "Failed to write data to temp file." ), aFilename );
+ writeFile.Close();
+ aSession.Delete( aFilename );
+ return writeError;
+ }
+ writeFile.Flush();
+ writeFile.Close();
+
+ return KErrNone;
+}
+
+// ==========================================================================
+// Session must be opened successfully
+// File name of temp file is store in aFilename
+// ==========================================================================
+TInt CSvgDocumentImpl::WriteToTempFile( RFs& aSession, RFile& aFileHandle,
+ TFileName& aFilename, CSvgErrorImpl& aError )
+{
+ // Create temporary file for byte-array
+ TFileName path;
+ CreateProcessPrivateDirectory( aSession, path );
+ RFile writeFile;
+ TInt tempError = writeFile.Temp( aSession, path, aFilename, EFileWrite );
+ if ( tempError != KErrNone )
+ {
+ PrepareError( aError, ESvgUnknown, tempError,
+ _L( "Failed open temp file to write data." ), path );
+ return tempError;
+ }
+
+ // Write data to temp file
+ TInt size;
+ TInt sizeError = aFileHandle.Size( size );
+ if ( sizeError != KErrNone )
+ {
+ PrepareError( aError, ESvgUnknown, sizeError,
+ _L( "Failed to get data length of file." ), aFilename );
+ aSession.Delete( aFilename );
+ return sizeError;
+ }
+
+ TBuf8<1024> buffer;
+ TInt bytesCopied = 0;
+ while ( bytesCopied < size )
+ {
+ buffer.Zero();
+ TInt bytesToCopy = ( size - bytesCopied < 1024 ) ? size - bytesCopied : 1024;
+ // read data
+ TInt readError = aFileHandle.Read( buffer, bytesToCopy );
+ if ( readError != KErrNone )
+ {
+ PrepareError( aError, ESvgUnknown, readError,
+ _L( "Failed to read data to copy to temp file: " ), aFilename );
+ writeFile.Close();
+ aSession.Delete( aFilename );
+ return readError;
+ }
+ // write data
+ TInt writeError = writeFile.Write( buffer, bytesToCopy );
+ if ( writeError != KErrNone )
+ {
+ PrepareError( aError, ESvgUnknown, writeError,
+ _L( "Failed to write to temp file: " ), aFilename );
+ writeFile.Close();
+ aSession.Delete( aFilename );
+ return writeError;
+ }
+ bytesCopied += bytesToCopy;
+ }
+
+ writeFile.Flush();
+ writeFile.Close();
+
+ return KErrNone;
+}
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::PrepareError( CSvgErrorImpl& aError,
+ TSvgErrorCode aSvgErrorCode,
+ TInt aSystemErrorCode,
+ const TDesC& aMsg1,
+ const TDesC& aMsg2 )
+{
+ aError.SetDescription( aMsg1, aMsg2 );
+ aError.SetErrorCode( aSvgErrorCode );
+ aError.SetSystemErrorCode( aSystemErrorCode );
+ aError.SetIsWarning( EFalse );
+}
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::LoadingCompleted()
+{
+ if ( iEngine != NULL && iEngine->GraphicsContext() != NULL )
+ {
+ iEngine->GraphicsContext()->SetDoDithering( iHasGradientElement );
+ }
+}
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::SetThumbNailMode( TBool aThumbNailMode )
+{
+ iIsThumbNailMode = aThumbNailMode;
+}
+
+//==========================================================================
+// CSvgDocumentImpl::SetDRMRights( TBool aEnable )
+//==========================================================================
+void CSvgDocumentImpl::SetDRMRights( TBool aEnable)
+{
+ iDrmRightsConsumptionEnabled = aEnable;
+}
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TBool CSvgDocumentImpl::IsThumbNailOnly()
+{
+ return iIsThumbNailMode && iIsDRMProtected;
+}
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::SetWasPrepared( TBool aBool )
+{
+ iWasPrepared = aBool;
+
+}
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TBool CSvgDocumentImpl::WasPrepared()
+{
+ return iWasPrepared;
+}
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::SetLoadingListeners( const RPointerArray<MSvgLoadingListener>* aList )
+ {
+ iLoadingListeners = aList;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+const RPointerArray<MSvgLoadingListener>* CSvgDocumentImpl::GetLoadingListeners()
+ {
+ return iLoadingListeners;
+ }
+
+/*---------------------------MouseListener---------------------------*/
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::AddInternalMouseListener( const MSvgMouseListener* aListener )
+ {
+ TInt index = iSvgMouseListeners.Find( aListener );
+ if ( aListener != NULL && index == KErrNotFound )
+ {
+ iSvgMouseListeners.Append( aListener );
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::RemoveInternalMouseListener( const MSvgMouseListener* aListener )
+ {
+ TInt index = iSvgMouseListeners.Find( aListener );
+ if ( index != KErrNotFound )
+ {
+ iSvgMouseListeners.Remove( index );
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgDocumentImpl::MouseInternalListenerCount()
+ {
+ return iSvgMouseListeners.Count();
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::NotifyInternalMousePressed( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY )
+ {
+
+ for ( TInt i = 0; i < iSvgMouseListeners.Count(); i++ )
+ {
+ iSvgMouseListeners[i]->MousePressed( aElements, aX, aY );
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::NotifyInternalMouseReleased( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY )
+ {
+
+ for ( TInt i = 0; i < iSvgMouseListeners.Count(); i++ )
+ {
+ iSvgMouseListeners[i]->MouseReleased( aElements, aX, aY );
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::NotifyInternalMouseEntered( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY )
+ {
+
+ for ( TInt i = 0; i < iSvgMouseListeners.Count(); i++ )
+ {
+ iSvgMouseListeners[i]->MouseEntered( aElements, aX, aY );
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::NotifyInternalMouseExited( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY )
+ {
+
+ for ( TInt i = 0; i < iSvgMouseListeners.Count(); i++ )
+ {
+ iSvgMouseListeners[i]->MouseExited( aElements, aX, aY );
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::NotifyInternalMouseMoved( RPointerArray<CSvgElementImpl>& aElements,
+ TInt aX, TInt aY )
+ {
+
+ for ( TInt i = 0; i < iSvgMouseListeners.Count(); i++ )
+ {
+ iSvgMouseListeners[i]->MouseMoved( aElements, aX, aY );
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::NotifyDocumentStart()
+ {
+ if ( iLoadingListeners != NULL )
+ {
+ TInt loadingListenersCnt = iLoadingListeners->Count();
+ for ( TInt i = 0; i < loadingListenersCnt; i++ )
+ {
+ (*iLoadingListeners)[i]->DocumentStart();
+ }
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::NotifyDocumentEnd()
+ {
+ if ( iLoadingListeners != NULL )
+ {
+ TInt loadingListenersCnt = iLoadingListeners->Count();
+ for ( TInt i = 0; i < loadingListenersCnt; i++ )
+ {
+ (*iLoadingListeners)[i]->DocumentEnd();
+ }
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::NotifyElementStart( const TDesC& aTagName,
+ MSvgAttributeList& aAttributeList,
+ TBool aIsSvgChild )
+ {
+ // Do not send back attribute list if content was decrypted
+ // from DRM protected content.
+ if ( iLoadingListeners != NULL && !iIsDRMProtected )
+ {
+ TInt loadingListenersCnt = iLoadingListeners->Count();
+ for ( TInt i = 0; i < loadingListenersCnt; i++ )
+ {
+ if ( aIsSvgChild || (*iLoadingListeners)[i]->ReportAllElements() )
+ {
+ (*iLoadingListeners)[i]->ElementStart( aTagName, aAttributeList );
+ }
+ }
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::NotifyElementEnd( const TDesC& aTagName, TBool aIsSvgChild )
+ {
+ if ( iLoadingListeners != NULL )
+ {
+ TInt loadingListenersCnt = iLoadingListeners->Count();
+ for ( TInt i = 0; i < loadingListenersCnt; i++ )
+ {
+ if ( aIsSvgChild || (*iLoadingListeners)[i]->ReportAllElements() )
+ {
+ (*iLoadingListeners)[i]->ElementEnd( aTagName );
+ }
+ }
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::NotifyUnsupportedElement( const TDesC& aTagName,
+ MSvgAttributeList& aAttributeList )
+ {
+ if ( iLoadingListeners != NULL )
+ {
+ TInt loadingListenersCnt = iLoadingListeners->Count();
+ for ( TInt i = 0; i < loadingListenersCnt; i++ )
+ {
+ (*iLoadingListeners)[i]->UnsupportedElement( aTagName, aAttributeList );
+ }
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::NotifyExternalDataRequested( const TDesC& aUri )
+ {
+ if ( iLoadingListeners != NULL )
+ {
+ TInt loadingListenersCnt = iLoadingListeners->Count();
+ for ( TInt i = 0; i < loadingListenersCnt; i++ )
+ {
+ (*iLoadingListeners)[i]->ExternalDataRequested( aUri );
+ }
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::NotifyExternalDataReceived( const TDesC& aUri )
+ {
+ if ( iLoadingListeners != NULL )
+ {
+ TInt loadingListenersCnt = iLoadingListeners->Count();
+ for ( TInt i = 0; i < loadingListenersCnt; i++ )
+ {
+ (*iLoadingListeners)[i]->ExternalDataReceived( aUri );
+ }
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgDocumentImpl::NotifyExternalDataRequestFailed( const TDesC& aUri )
+ {
+ if ( iLoadingListeners != NULL )
+ {
+ TInt loadingListenersCnt = iLoadingListeners->Count();
+ for ( TInt i = 0; i < loadingListenersCnt; i++ )
+ {
+ (*iLoadingListeners)[i]->ExternalDataRequestFailed( aUri );
+ }
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TUint32 CSvgDocumentImpl::IsIndefiniteAnimation()
+ {
+ if ( !iCheckedAnimationDuration )
+ {
+ AnimationDuration();
+ }
+ // special value for indefinite animation
+ return ( iAnimationDuration == KIndefiniteAnimationDuration );
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TUint32 CSvgDocumentImpl::AnimationDuration()
+ {
+ if ( iCheckedAnimationDuration )
+ {
+ return IsIndefiniteAnimation() ? 0xFFFFFFFF : iAnimationDuration;
+ }
+ else if ( iRootElement == NULL )
+ {
+ return 0;
+ }
+
+ if ( iIsInteractive )
+ {
+ // If there is interactivity in the content, set the animation
+ // duration to indefinite so that the timer continues to run.
+ iAnimationDuration = KIndefiniteAnimationDuration;
+ }
+ else
+ {
+ iAnimationDuration = SubtreeDuration( iRootElement );
+ }
+
+ iCheckedAnimationDuration = ETrue;
+ return IsIndefiniteAnimation() ? 0xFFFFFFFF : iAnimationDuration;
+ }
+
+// ==========================================================================
+// Return the longest animation in subtree
+// ==========================================================================
+TUint32 CSvgDocumentImpl::SubtreeDuration( CSvgElementImpl* aRootElement )
+ {
+ TUint dur = 0;
+
+ if ( aRootElement->IsAnimatedElement() )
+ {
+ dur = ( ( CSvgAnimationBase * ) aRootElement )->CompleteDuration();
+ }
+
+ else if ( aRootElement->ElemID() == KSvgDiscardElement )
+ {
+ dur = ((CSvgDiscardElementImpl*)aRootElement)->AbsoluteBeginTime();
+ }
+
+ // check child duration
+ TUint childDur;
+ CSvgElementImpl* child = (CSvgElementImpl*)aRootElement->FirstChild();
+ while ( child != NULL )
+ {
+ childDur = SubtreeDuration( child );
+ if ( childDur > dur )
+ {
+ dur = childDur;
+ }
+ child = (CSvgElementImpl*)child->NextSibling();
+ }
+ return dur;
+ }
+
+// ==========================================================================
+// notified from outside (AppendChild/RemoveChild)
+// ==========================================================================
+void CSvgDocumentImpl::ElementAppendedOrRemoved()
+ {
+ // Clear flag to retrieve animation duration on AnimationDuration() call
+ iCheckedAnimationDuration = EFalse;
+ }
+
+// ==========================================================================
+// Return all elements of the given type
+// or all of the elements if the type = -1
+// ==========================================================================
+void CSvgDocumentImpl::FindAllElements( CSvgElementImpl* aStartElement, TInt aElementId,
+ RPointerArray<CSvgElementImpl>& aList,
+ TSvgSearchFlags aFlags )
+ {
+ if ( aStartElement == NULL )
+ return;
+
+ CSvgElementImpl* child = (CSvgElementImpl*)aStartElement->FirstChild();
+ while ( child != NULL )
+ {
+ // add to list if child is found
+ if ( child->ElemID() == aElementId || aElementId == -1 )
+ aList.Append( child );
+
+ // find in grandchildren
+ if ( aFlags & ESvgSearchExcludeUseSubtree )
+ {
+ // If Exclude Use Subtree, ignore the subtree under use element
+ if ( child->ElemID() != KSvgUseElement )
+ {
+ FindAllElements( child, aElementId, aList, aFlags );
+ }
+ }
+ else
+ {
+ FindAllElements( child, aElementId, aList, aFlags );
+ }
+ child = (CSvgElementImpl*)child->NextSibling();
+ }
+ }
+
+// ==========================================================================
+// ImageLoadingObserver interface method
+// ==========================================================================
+void CSvgDocumentImpl::ImageLoadingCompleted( TInt aError )
+ {
+ iImageElementCnt--;
+
+ if ( iLoadingListeners != NULL && iImageElementCnt == 0)
+ {
+ TInt loadingListenersCnt = iLoadingListeners->Count();
+ for ( TInt i = 0; i < loadingListenersCnt; i++ )
+ {
+ (*iLoadingListeners)[i]->ImagesLoaded(aError);
+ }
+ }
+
+
+ }
+
+// ==========================================================================
+// Loops through the tree and prints out all of the elements
+// (almost regenerating the DOM tree)
+//
+// ==========================================================================
+void CSvgDocumentImpl::PrintAllElements( CSvgElementImpl* aStartElement )
+{
+ if ( aStartElement == NULL )
+ return;
+
+ aStartElement->Print( EFalse );
+ //===> comment the styles out to generate true SVG content
+ // aStartElement->PrintStyleProperties();
+
+ CSvgElementImpl* child = (CSvgElementImpl*)aStartElement->FirstChild();
+ PrintAllElements( child );
+
+ child = (CSvgElementImpl*)aStartElement->NextSibling();
+ PrintAllElements( child );
+}
+
+TBool CSvgDocumentImpl::HasError()
+ {
+ return iError && iError->HasError();
+ }
+
+MSvgError* CSvgDocumentImpl::GetError()
+ {
+ return iError;
+ }
+
+void CSvgDocumentImpl::SetIsWarning( TBool aIsWarning )
+{
+ if (iError)
+ {
+ iError->SetIsWarning( aIsWarning );
+ }
+}
+void CSvgDocumentImpl::SetError( TInt aErrorType, const TDesC& aMsg1, const TDesC& aMsg2 )
+ {
+ if ( !iError )
+ {
+ TRAPD( error, iError = CSvgErrorImpl::NewL() );
+ if ( error != KErrNone )
+ {
+ return;
+ }
+ PrepareError( *iError, ESvgUnknown, aErrorType, aMsg1, aMsg2 );
+ iError->SetIsWarning( ETrue );
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// Accessor funciton for SyncBehaviorDefault value
+// ---------------------------------------------------------------------------
+TSvgSyncBehaviour CSvgDocumentImpl::SyncBehaviorDefault()
+ {
+ return iSyncBehaviorDefault;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor funciton for SyncBehaviorDefault value
+// ---------------------------------------------------------------------------
+TUint32 CSvgDocumentImpl::SyncToleranceDefault()
+ {
+ return iSyncToleranceDefault;
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgDocumentImpl::SetCurrentTime
+// Set Function for the document's current time
+// ---------------------------------------------------------------------------
+void CSvgDocumentImpl::SetCurrentTime( TInt32 aCurTime )
+ {
+ if ( iTimeContainer )
+ {
+ iTimeContainer->SetCurrentTime( aCurTime );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgDocumentImpl::CurrentTime
+// Accessor for the Document's current time
+// ---------------------------------------------------------------------------
+TInt32 CSvgDocumentImpl::CurrentTime()
+ {
+ if ( iTimeContainer )
+ {
+ return iTimeContainer->CurrentTime();
+ }
+ return KErrGeneral;
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgDocumentImpl::SetSyncBehavior
+// Set the Synchronised behaviour for the time container
+// ---------------------------------------------------------------------------
+void CSvgDocumentImpl::SetTCSyncBehavior( const TSvgSyncBehaviour aValue )
+ {
+ if ( iTimeContainer )
+ {
+ iTimeContainer->SetSyncBehavior( aValue );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgDocumentImpl::SetSyncTolerance
+// Set the Synchronised Tolerance for the time container
+// ---------------------------------------------------------------------------
+void CSvgDocumentImpl::SetTCSyncTolerance( const TUint32 aValue )
+ {
+ if ( iTimeContainer )
+ {
+ iTimeContainer->SetSyncTolerance( aValue );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgDocumentImpl::SetSyncMaster
+// Set the time container as Synchronised Master
+// ---------------------------------------------------------------------------
+void CSvgDocumentImpl::SetTCSyncMaster( const TBool aValue )
+ {
+ if ( iTimeContainer )
+ {
+ iTimeContainer->SetSyncMaster( aValue );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgDocumentImpl::TimeContainer
+// Accessor for time container
+// -----------------------------------------------------------------------------
+//
+CSvgTimeContainer* CSvgDocumentImpl::TimeContainer()
+ {
+ return iTimeContainer;
+ }
+
+void CSvgDocumentImpl::DocumentTransform(TGfxAffineTransform& aTr)
+ {
+ iTransformMatrix = aTr;
+ }
+
+TGfxAffineTransform CSvgDocumentImpl::GetDocumentTransform()
+ {
+ return iTransformMatrix;
+ }
+
+
+CSvgBitmapFontProvider * CSvgDocumentImpl::GetBitmapFontProvider()
+{
+ return iSvgBitmapFontProvider ;
+}
+
+// -----------------------------------------------------------------------------
+// CSvgDocumentImpl::SvgHasAnimationElement
+// Checks if Document has Animation Element
+// -----------------------------------------------------------------------------
+
+TBool CSvgDocumentImpl::SvgHasAnimationElement()
+ {
+ RPointerArray<CSvgElementImpl> lAnimationEleList;
+ FindAllElements((CSvgElementImpl* )RootElement(),
+ KSvgMediaAnimationElement, lAnimationEleList );
+ TInt lAnimationEleCnt = lAnimationEleList.Count();
+ lAnimationEleList.Close();
+ if ( lAnimationEleCnt > 0 )
+ {
+ return ETrue;
+ }
+
+ return EFalse;
+
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgDocumentImpl::IsDocumentContentInteractive
+// Checks if Document content is InterActive
+// -----------------------------------------------------------------------------
+
+TBool CSvgDocumentImpl::IsDocumentContentInteractive()
+ {
+ RPointerArray<CSvgElementImpl> elements;
+ FindAllElements( (CSvgElementImpl* )RootElement(),
+ KSvgAElement, elements );
+ if ( elements.Count() != 0 )
+ {
+ elements.Close();
+ return ETrue;
+ }
+ elements.Close();
+
+ if ( iIsInteractive )
+ return ETrue;
+
+ // Check if animation element is there
+ RPointerArray<CSvgElementImpl> lAnimationEleList;
+ FindAllElements((CSvgElementImpl* )RootElement(),
+ KSvgMediaAnimationElement, lAnimationEleList );
+
+ // If no animation element is present then return EFalse
+ TInt lAnimationEleCnt = lAnimationEleList.Count();
+ if ( lAnimationEleCnt == 0 )
+ {
+ lAnimationEleList.Close();
+ return EFalse;
+ }
+
+ // Check all animation element and if any child svg has ..
+ // interactive content then return ETrue
+ for ( TInt lCurAnimationEle = 0;
+ lCurAnimationEle < lAnimationEleCnt; lCurAnimationEle++ )
+ {
+ CSvgMediaAnimationElementImpl* lAnimationElement =
+ (CSvgMediaAnimationElementImpl* )lAnimationEleList[ lCurAnimationEle ];
+ CSvgDocumentImpl* lChildDoc = lAnimationElement->GetChildDocument();
+ // if child svg has interavitve content then return
+ if(lChildDoc && lChildDoc->iIsInteractive)
+ {
+ lAnimationEleList.Close();
+ return ETrue;
+ }
+ }
+
+ lAnimationEleList.Close();
+ return EFalse;
+
+ }
+
+
+void CSvgDocumentImpl::SetImageElementsCount(TInt aCnt)
+ {
+ iImageElementCnt = aCnt;
+ }
+
+TInt CSvgDocumentImpl::GetImageElementsCount()
+ {
+ return iImageElementCnt;
+ }
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,3478 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include "SVGElementImpl.h"
+#include "SVGXmlElementImpl.h"
+
+#include "GfxAffineTransform.h"
+
+#include "SVGClrCssValueImpl.h"
+#include "SVGPaintCssValueImpl.h"
+#include "SVGIntCssValueImpl.h"
+#include "SVGFloatCssValueImpl.h"
+#include "SVGStrCssValueImpl.h"
+#include "SVGVectorCssValueImpl.h"
+
+#include "SVGSchemaData.h"
+#include "SVGAnimationBase.h"
+#include "SVGLineElementImpl.h"
+#include "SVGRectElementImpl.h"
+#include "SVGCircleElementImpl.h"
+#include "SVGMpathElementImpl.h"
+
+#include "SVGFontFaceElementImpl.h"
+
+#include "SVGDocumentImpl.h"
+#include "SVGStringTokenizer.h"
+
+#include "SVGEngineImpl.h"
+#include "SVGUseElementImpl.h"
+#include "SVGAnimationElementImpl.h"
+#include "SVGTokenizer.h"
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgElementImpl::~CSvgElementImpl()
+ {
+ if ( iId )
+ {
+ delete iId;
+ iId = NULL;
+ }
+
+ //need to remove from event list if it was an animation
+
+ CSvgDocumentImpl* thisDocument = ( CSvgDocumentImpl* ) OwnerDocument();
+
+ if (thisDocument != NULL)
+ {
+ thisDocument->RemoveFromEventReceiverList(this);
+ }
+
+ if ( iSvgTests )
+ {
+ delete iSvgTests;
+ iSvgTests = NULL;
+ }
+
+ if( iSvgLangSpace )
+ {
+ delete iSvgLangSpace;
+ iSvgLangSpace = NULL;
+ }
+
+ if ( iSvgTransformable )
+ {
+ delete iSvgTransformable;
+ iSvgTransformable = NULL;
+ }
+ ResetReferenceAttrSet();
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgElementImpl::StyleInParent(CSvgElementImpl* aElement, TInt aAttrIndex)
+ {
+ if(aElement != NULL)
+ {
+ CSvgElementImpl* lParentElement = (CSvgElementImpl*)aElement->ParentNode ();
+ while(lParentElement && (lParentElement->iSvgStyleProperties != NULL))
+ {
+ if(!lParentElement)
+ return EFalse;
+ if (aElement->iSvgStyleProperties->operator[](aAttrIndex) ==
+ lParentElement->iSvgStyleProperties->operator[](aAttrIndex))
+ {
+ return ETrue;
+ }
+ lParentElement = (CSvgElementImpl*)lParentElement->ParentNode ();
+ }
+ }
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgElementImpl::CSvgElementImpl() : iAnimateTransformMatrixIndex(-1),
+ iSvgStyleProperties(NULL),
+ iAnimateMotionMatrixIndex( -1 )
+
+ {
+ SetAllAttributesAdded( ETrue );
+ }
+
+void CSvgElementImpl::InitializeL( TUint8 aElemID)
+ {
+ CXmlElementImpl::InitializeL( aElemID );
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgElementImpl::IsDrawable()
+ {
+ return ETrue;
+ }
+
+//*****************************************************
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgElementImpl::DrawShapeL( CGfx2dGc* aGc,
+ MGfxShape& aShape,
+ CSvgElementImpl* /*aElement */)
+ {
+ if ( !AreAllAttributesAdded() )
+ {
+ return;
+ }
+
+ // Paint is a special case.
+ // Paint must be reset locally
+
+ SetGCL( aGc/*, aElement */);
+
+ if( iSvgTransformable )
+ {
+ aGc->SetTransform( GetCTM() );
+ }
+
+ aGc->DrawL( &aShape );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgElementImpl::DrawShapeL( CGfx2dGc* aGc, CSvgElementImpl* /*aElement*/ )
+ {
+
+ SetGCL( aGc/*, aElement */);
+
+ if(iSvgTransformable )
+ {
+ aGc->SetTransform( GetCTM() );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgElementImpl::DrawL( CGfx2dGc* /* aGc */,
+ CSvgElementImpl* /* aElement */ )
+ {
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TDesC* CSvgElementImpl::Id()
+ {
+ return iId;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgElementImpl::SetIdandXmlbaseL( const TDesC& aPropertyName,
+ const TDesC& aValue )
+ {
+ _LIT( KId, "id" );
+ if ( aPropertyName == KId)
+ {
+ delete iId;
+ iId = NULL;
+ iId = aValue.AllocL();
+ }
+ else
+ {
+ return EFalse;
+ }
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// This method might leave with KErrNoMemory.
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgElementImpl::AppendChildL( MXmlElement* aNewChild, TBool aIsJSR226Element )
+ {
+
+ CXmlElementImpl::AppendChildL( aNewChild );
+
+ if ( aNewChild && (((CSvgElementImpl *)aNewChild)->ElemID() != KSvgSvgElement) )
+ {
+ TInt err = KErrNone;
+
+ if (!aIsJSR226Element)
+ {
+ err = ((CSvgElementImpl *)aNewChild)->InitSvgStyleProperties();
+ }
+ else
+ {
+ // Error return needs to be checked
+ ((CSvgElementImpl*)aNewChild)->InitAllSvgStyleProperties((CSvgElementImpl*)aNewChild);
+ }
+ if (err != KErrNone)
+ #ifdef _Debug
+ RDebug::Print(_L("CSvgElementImpl::AppendChildL[%x]: memory when append child"), this);
+ #endif //_Debug
+ User::Leave(err);
+ }
+
+
+ return aNewChild;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+TInt CSvgElementImpl::SetAttributeL( const TDesC& aName ,
+ const TDesC& aValue )
+ {
+
+
+ if ( SetTransform( aName, aValue ) ||
+ SetIdandXmlbaseL( aName, aValue ) ||
+ SetLangSpaceAttributeL( aName, aValue ) ||
+ SetTestAttributeL( aName, aValue )
+ )
+ {
+ return KErrNone;
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgElementImpl::RemoveAttribute( const TInt aAttrId )
+ {
+ if( iSvgStyleProperties && aAttrId < iSvgStyleProperties->Count() )
+ {
+ CCssValue *lCurrentCssPointer = iSvgStyleProperties->operator[](aAttrId);
+ CCssValue *lParentCssPointer = NULL ;
+
+ CSvgElementImpl* lParentElement = (CSvgElementImpl*)iParentNode;
+ while(lParentElement && (lParentElement->iSvgStyleProperties == NULL))
+ {
+ lParentElement = (CSvgElementImpl*)lParentElement->ParentNode ();
+ }
+
+ if ( lParentElement )
+ {
+ FindProperty( (TInt8)aAttrId, lParentCssPointer, ( CSvgElementImpl * )lParentElement );
+ }
+
+ iSvgStyleProperties->operator[](aAttrId) = lParentCssPointer;
+ PropagateToChildren( lCurrentCssPointer,lParentCssPointer, aAttrId );
+ }
+ return KErrNone;
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+void CSvgElementImpl::SetPresentationAttribute( const TInt8 aPropertyId,
+ CCssValue*& aCssValue )
+
+ {
+ if( iSvgStyleProperties && aPropertyId < iSvgStyleProperties->Count() )
+ {
+ iSvgStyleProperties->operator[](aPropertyId) = aCssValue;
+ }
+
+ }
+
+// ---------------------------------------------------------------------------
+// This method sets a property value that takes a float
+// The switch statement can be expanded to add more attributes
+// ---------------------------------------------------------------------------
+TBool CSvgElementImpl::SetPropertyFloatL( const TInt& aAttrId,
+ TReal32 aValue)
+ {
+ CSvgDocumentImpl* doc = ( CSvgDocumentImpl* ) OwnerDocument();
+
+ if (!doc)
+ {
+ return EFalse;
+ }
+
+ TInt position = aAttrId;
+
+
+ CSvgElementImpl* lParentElement = (CSvgElementImpl*)iParentNode;
+ while(lParentElement && (lParentElement->iSvgStyleProperties == NULL))
+ {
+ lParentElement = (CSvgElementImpl*)lParentElement->ParentNode ();
+ }
+
+ switch ( position )
+ {
+ case KCSS_ATTR_STROKE_OPACITY:
+ case KCSS_ATTR_FILL_OPACITY:
+ case KCSS_ATTR_GROUP_OPACITY:
+ {
+ TFloatFixPt KZero;
+ TFloatFixPt KOne( KFloatFixOne );
+ TFloatFixPt opacityValue = aValue;
+ if (opacityValue < KZero)
+ {
+ opacityValue = KZero;
+ }
+ else if (opacityValue > KOne)
+ {
+ opacityValue = KOne;
+ }
+ CFloatCssValueImpl* tParentValue = NULL;
+ CFloatCssValueImpl* tValue = (CFloatCssValueImpl *)(iSvgStyleProperties->operator[](position));
+
+ if( this != doc->RootElement() && lParentElement )
+ {
+ tParentValue = (CFloatCssValueImpl *)
+ (lParentElement->iSvgStyleProperties->operator[](position));
+ }
+ if (tParentValue == tValue || tValue == NULL)
+ {
+ tValue = doc->iMemoryManager->GetCssFloatObjectL( opacityValue );
+
+ iSvgStyleProperties->operator[](position) = tValue;
+ }
+ else
+ {
+ tValue->SetValueL( opacityValue );
+ }
+ }
+ break;
+ default:
+ return EFalse;
+
+ }
+
+ return ETrue;
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+TBool CSvgElementImpl::SetPropertyL( const TInt& aAttrId,
+ const TDesC& aValue)
+ {
+ _LIT( KInherit, "inherit" );
+
+ CSvgDocumentImpl* doc = ( CSvgDocumentImpl* ) OwnerDocument();
+
+ if (!doc)
+ {
+ return EFalse;
+ }
+
+ CSvgSchemaData* lSchemaData = doc->SchemaData();
+
+ TInt position = aAttrId;
+
+
+ if( (aValue == KInherit) || (iSvgStyleProperties == NULL))
+ {
+ return ETrue;
+ }
+
+ CSvgElementImpl* lParentElement = (CSvgElementImpl*)iParentNode;
+ while(lParentElement && (lParentElement->iSvgStyleProperties == NULL))
+ {
+ lParentElement = (CSvgElementImpl*)lParentElement->ParentNode ();
+ }
+
+
+ switch ( position )
+ {
+
+ case KCSS_ATTR_FILL:
+ //fill
+ {
+ CPaintCssValueImpl* tParentValue = NULL;
+ CPaintCssValueImpl* tValue = (CPaintCssValueImpl *)(iSvgStyleProperties->operator[](position));
+ if( this != doc->RootElement() && lParentElement)
+ {
+ tParentValue = (CPaintCssValueImpl *)
+ (lParentElement->iSvgStyleProperties->operator[](position));
+ }
+ if (tParentValue == tValue || tValue == NULL)
+ {
+ tValue = doc->iMemoryManager->GetCssPaintObjectL(aValue, this);
+
+
+ if ( tValue->IsDefaultSet() )
+ {
+ // if default color is set, check see if parent has one
+ if ( lParentElement )
+ {
+ tParentValue = (CPaintCssValueImpl *)
+ (lParentElement->iSvgStyleProperties->operator[](position));
+ }
+
+ if ( tParentValue != NULL )
+ {
+ iSvgStyleProperties->operator[](position) = tParentValue;
+ break;
+ }
+
+ }
+ else
+ {
+ iSvgStyleProperties->operator[](position) = tValue;
+ }
+ }
+ else
+ {
+ tValue->SetValueL( aValue );
+ }
+
+ break;
+
+ }
+ case KCSS_ATTR_STROKE_OPACITY:
+ case KCSS_ATTR_FILL_OPACITY:
+ case KCSS_ATTR_GROUP_OPACITY:
+ {
+ TFloatFixPt KZero;
+ TFloatFixPt KOne( KFloatFixOne );
+ TFloatFixPt opacityValue;
+ if ( TFloatFixPt::ConvertString( aValue, opacityValue ) == KErrNone )
+ {
+ if (aValue.Locate('%') != KErrNotFound)
+ {
+ //if a percentage
+ opacityValue = opacityValue / TFloatFixPt(100);
+ }
+ }
+ else
+ {
+ opacityValue = KOne;
+ }
+
+ if (opacityValue < KZero)
+ opacityValue = KZero;
+ else if (opacityValue > KOne)
+ opacityValue = KOne;
+
+ CFloatCssValueImpl* tParentValue = NULL;
+ CFloatCssValueImpl* tValue = (CFloatCssValueImpl *)(iSvgStyleProperties->operator[](position));
+
+ if( this != doc->RootElement() && lParentElement )
+ {
+ tParentValue = (CFloatCssValueImpl *)
+ (lParentElement->iSvgStyleProperties->operator[](position));
+ }
+ if (tParentValue == tValue || tValue == NULL)
+ {
+ tValue = doc->iMemoryManager->GetCssFloatObjectL(opacityValue);
+
+ iSvgStyleProperties->operator[](position) = tValue;
+ }
+ else
+ {
+ tValue->SetValueL( opacityValue );
+ }
+ }
+ break;
+
+ case KCSS_ATTR_STROKE:
+ case KCSS_ATTR_COLOR:
+ {
+
+ CClrCssValueImpl* tParentValue = NULL;
+ CClrCssValueImpl* tValue = (CClrCssValueImpl *)(iSvgStyleProperties->operator[](position));
+ if( this != doc->RootElement() && lParentElement )
+ {
+ tParentValue = (CClrCssValueImpl *)
+ (lParentElement->iSvgStyleProperties->operator[](position));
+ }
+ if (tParentValue == tValue || tValue == NULL)
+ {
+ tValue = doc->iMemoryManager->GetCssClrObjectL( aValue );
+
+ iSvgStyleProperties->operator[](position) = tValue;
+ }
+ else
+ {
+ tValue->SetValueL( aValue );
+ }
+
+ break;
+
+ }
+ case KCSS_ATTR_VISIBILITY:
+ // visibility
+ {
+ TPtrC lVal;
+ if ( aValue == _L( "visible" ) )
+ {
+ lVal.Set( _L( "0" ) );
+ }
+ else if ( aValue == _L( "hidden" ) )
+ {
+ lVal.Set( _L( "1" ) );
+ }
+ else if ( aValue == _L( "collapse" ) )
+ {
+ lVal.Set( _L( "3" ) );
+ }
+
+ CIntCssValueImpl* tParentValue = NULL;
+ CIntCssValueImpl* tValue = (CIntCssValueImpl *)(iSvgStyleProperties->operator[](position));
+ if( this != doc->RootElement() && lParentElement )
+ {
+ tParentValue = (CIntCssValueImpl *)
+ (lParentElement->iSvgStyleProperties->operator[](position));
+ }
+ if (tParentValue == tValue || tValue == NULL)
+ {
+ tValue = doc->iMemoryManager->GetCssIntObjectL( lVal );
+
+ iSvgStyleProperties->operator[](position) = tValue;
+ }
+ else
+ {
+ tValue->SetValueL( lVal );
+ }
+ }
+ break;
+
+ case KCSS_ATTR_DISPLAY:
+ // display
+ {
+
+ TPtrC lVal;
+ if ( aValue == _L( "inline" ) )
+ {
+ lVal.Set( _L( "0" ) );
+ }
+ else if ( aValue == _L( "none" ) )
+ {
+ lVal.Set( _L( "16" ) );
+ }
+
+ CIntCssValueImpl* tParentValue = NULL;
+ CIntCssValueImpl* tValue = (CIntCssValueImpl *)(iSvgStyleProperties->operator[](position));
+ if( this != doc->RootElement() && lParentElement)
+ {
+ tParentValue = (CIntCssValueImpl *)
+ (lParentElement->iSvgStyleProperties->operator[](position));
+ }
+ if (tParentValue == tValue || tValue == NULL)
+ {
+ tValue = doc->iMemoryManager->GetCssIntObjectL( lVal );
+
+ iSvgStyleProperties->operator[](position) = tValue;
+ }
+ else
+ {
+ tValue->SetValueL( lVal );
+ }
+
+ break;
+ }
+ case KCSS_ATTR_FONTSTYLE:
+ // font-style
+ {
+ TInt i;
+
+ i = lSchemaData->FindFontStyle(aValue);
+
+ TBufC<12> buf;
+ TPtr lVal ( buf.Des() );
+ _LIT( KFixptFormat, "%d" );
+ lVal.Format( KFixptFormat, i );
+
+ CIntCssValueImpl* tParentValue = NULL;
+ CIntCssValueImpl* tValue = (CIntCssValueImpl *)(iSvgStyleProperties->operator[](position));
+ if( this != doc->RootElement() && lParentElement )
+ {
+ tParentValue = (CIntCssValueImpl *)
+ (lParentElement->iSvgStyleProperties->operator[](position));
+ }
+ if (tParentValue == tValue || tValue == NULL)
+ {
+ tValue = doc->iMemoryManager->GetCssIntObjectL( lVal );
+
+ iSvgStyleProperties->operator[](position) = tValue;
+ }
+ else
+ {
+ tValue->SetValueL( lVal );
+ }
+ }
+ break;
+ case KCSS_ATTR_FONTWEIGHT:
+ // font-weight
+ {
+
+ TInt i;
+ i = lSchemaData->FindFontWeightEnum(aValue);
+ TBufC<12> buf;
+ TPtr lVal ( buf.Des() );
+ _LIT( KFixptFormat, "%d" );
+ lVal.Format( KFixptFormat, i );
+
+ CIntCssValueImpl* tParentValue = NULL;
+ CIntCssValueImpl* tValue = (CIntCssValueImpl *)(iSvgStyleProperties->operator[](position));
+ if( this != doc->RootElement() && lParentElement)
+ {
+ tParentValue = (CIntCssValueImpl *)
+ (lParentElement->iSvgStyleProperties->operator[](position));
+ }
+ if (tParentValue == tValue || tValue == NULL)
+ {
+
+ tValue = doc->iMemoryManager->GetCssIntObjectL( lVal );
+
+ iSvgStyleProperties->operator[](position) = tValue;
+ }
+ else
+ {
+ tValue->SetValueL( lVal );
+ }
+ }
+ break;
+
+ case KCSS_ATTR_FONTFAMILY:
+ if( ElemID() == KSvgFontfaceElement )
+ {
+ ((CSvgFontFaceElementImpl *)this)->SetFontFamilyL(aValue);
+ }
+
+ case KCSS_ATTR_STROKE_LINECAP:
+ case KCSS_ATTR_STROKE_LINEJOIN:
+ case KCSS_ATTR_FILLRULE:
+ {
+ CStrCssValueImpl* tParentValue = NULL;
+ CStrCssValueImpl* tValue = (CStrCssValueImpl *)(iSvgStyleProperties->operator[](position));
+ if( this != doc->RootElement() && lParentElement )
+ {
+ tParentValue = (CStrCssValueImpl *)
+ (lParentElement->iSvgStyleProperties->operator[](position));
+ }
+ if (tParentValue == tValue || tValue == NULL)
+ {
+ tValue = doc->iMemoryManager->GetCssStrObjectL( aValue );
+ iSvgStyleProperties->operator[](position) = tValue;
+ }
+ else
+ {
+ tValue->SetValueL( aValue );
+ }
+ }
+ break;
+ case KCSS_ATTR_STROKE_DASHARRAY:
+ {
+
+ CVectorCssValueImpl* tParentValue = NULL;
+ CVectorCssValueImpl* tValue = (CVectorCssValueImpl *)(iSvgStyleProperties->operator[](position));
+ if( this != doc->RootElement() && lParentElement)
+ {
+ tParentValue = (CVectorCssValueImpl *)
+ (lParentElement->iSvgStyleProperties->operator[](position));
+ }
+ if (tParentValue == tValue || tValue == NULL)
+ {
+ tValue = doc->iMemoryManager->GetCssVectorObjectL( aValue );
+ iSvgStyleProperties->operator[](position) = tValue;
+ }
+ else
+ {
+ tValue->SetValueL( aValue );
+ }
+
+ if(tValue)
+ {
+ CArrayFix<TFloatFixPt>* lDashArray = tValue->Value();
+ TFloatFixPt lSum( 0 );
+ TUint numElem = lDashArray->Count();
+ // Iterate through the array to check whether the sum of elements
+ // of the dash array is non-zero.
+ for (TUint arrCount = 0; arrCount < numElem; arrCount++)
+ {
+ lSum = lSum + lDashArray->At(arrCount);
+ }
+ // If the sum is zero then, the behaviour should be similar to "none" i.e. no dashing applied.
+ if ( lSum == TFloatFixPt( 0 ) )
+ {
+ iSvgStyleProperties->operator[](position)= NULL;
+
+
+ // Not deleting the tValue as this would be freed in the
+ // destructor of CSvgMemoryManager
+ }
+ }
+
+ }
+ break;
+ case KCSS_ATTR_STROKEWIDTH:
+ {
+ // stroke-width can not be negative
+ TReal32 strokeWidth;
+ TPtrC remainder;
+ TBool validValue = TTokenizer::ParseDecimal( aValue, strokeWidth, remainder );
+
+ // Check for valid number characters and no characters following
+ // and must be non-negative
+ if ( !validValue || strokeWidth < 0.0f )
+ {
+ strokeWidth = 1.0f;
+ }
+ /*
+ "1pt" equals "1.25px" (and therefore 1.25 user units)
+ "1pc" equals "15px" (and therefore 15 user units)
+ "1mm" would be "3.543307px" (3.543307 user units)
+ "1cm" equals "35.43307px" (and therefore 35.43307 user units)
+ "1in" equals "90px" (and therefore 90 user units)
+ */
+ else if ( remainder.Length() > 0 )
+ {
+ if ( remainder == _L("px") )
+ {
+ // do nothing
+ }
+ if ( remainder == _L("pt") )
+ {
+ strokeWidth *= 1.25f;
+ }
+ else if ( remainder == _L("pc") )
+ {
+ strokeWidth *= 15.0f;
+ }
+ else if ( remainder == _L("mm") )
+ {
+ strokeWidth *= 3.543307f;
+ }
+ else if ( remainder == _L("cm") )
+ {
+ strokeWidth *= 35.43307f;
+ }
+ else if ( remainder == _L("in") )
+ {
+ strokeWidth *= 90.0f;
+ }
+ else
+ {
+ strokeWidth = 1.0f;
+ }
+ }
+
+ CFloatCssValueImpl* tParentValue = NULL;
+ CFloatCssValueImpl* tValue = (CFloatCssValueImpl *)(iSvgStyleProperties->operator[](position));
+ if( this != doc->RootElement() && lParentElement)
+ {
+ tParentValue = (CFloatCssValueImpl *)
+ (lParentElement->iSvgStyleProperties->operator[](position));
+ }
+ if (tParentValue == tValue || tValue == NULL)
+ {
+ tValue = doc->iMemoryManager->GetCssFloatObjectL( strokeWidth );
+ iSvgStyleProperties->operator[](position) = tValue;
+ }
+ else
+ {
+ tValue->SetValueL( strokeWidth );
+ }
+ }
+ break;
+
+ case KCSS_ATTR_FONTSIZE:
+ case KCSS_ATTR_STROKE_DASHOFFSET:
+ case KCSS_ATTR_STROKE_MITERLIMIT:
+ {
+ CFloatCssValueImpl* tParentValue = NULL;
+ CFloatCssValueImpl* tValue = (CFloatCssValueImpl *)(iSvgStyleProperties->operator[](position));
+ if( this != doc->RootElement() && lParentElement )
+ {
+ tParentValue = (CFloatCssValueImpl *)
+ (lParentElement->iSvgStyleProperties->operator[](position));
+ }
+ if (tParentValue == tValue || tValue == NULL)
+ {
+ tValue = doc->iMemoryManager->GetCssFloatObjectL(aValue);
+
+ iSvgStyleProperties->operator[](position) = tValue;
+ }
+ else
+ {
+ tValue->SetValueL( aValue );
+ }
+ }
+ break;
+ case KCSS_ATTR_TEXTANCHOR:
+ //text-anchor
+ {
+
+ TInt i;
+
+ i = lSchemaData->FindTextAnchorEnum(aValue);
+
+ TBufC<12> buf;
+ TPtr lVal ( buf.Des() );
+ _LIT( KFixptFormat, "%d" );
+ lVal.Format( KFixptFormat, i );
+
+ CIntCssValueImpl* tParentValue = NULL;
+ CIntCssValueImpl* tValue = (CIntCssValueImpl *)(iSvgStyleProperties->operator[](position));
+ if( this != doc->RootElement() && lParentElement )
+ {
+ tParentValue = (CIntCssValueImpl *)
+ (lParentElement->iSvgStyleProperties->operator[](position));
+ }
+ if (tParentValue == tValue || tValue == NULL)
+ {
+ tValue = doc->iMemoryManager->GetCssIntObjectL( lVal );
+
+ iSvgStyleProperties->operator[](position) = tValue;
+ }
+ else
+ {
+ tValue->SetValueL( lVal );
+ }
+ }
+ break;
+ case KCSS_ATTR_TEXTDECORATION:
+ //text-decoration
+ {
+
+ TInt i;
+ i = lSchemaData->FindTextDecorationEnum(aValue);
+ TBufC<12> buf;
+ TPtr lVal ( buf.Des() );
+ _LIT( KFixptFormat, "%d" );
+ lVal.Format( KFixptFormat, i );
+
+ CIntCssValueImpl* tParentValue = NULL;
+ CIntCssValueImpl* tValue = (CIntCssValueImpl *)(iSvgStyleProperties->operator[](position));
+ if( this != doc->RootElement() && lParentElement)
+ {
+ tParentValue = (CIntCssValueImpl *)
+ (lParentElement->iSvgStyleProperties->operator[](position));
+ }
+ if (tParentValue == tValue || tValue == NULL)
+ {
+ tValue = doc->iMemoryManager->GetCssIntObjectL(lVal);
+
+ iSvgStyleProperties->operator[](position) = tValue;
+ }
+ else
+ {
+ tValue->SetValueL( lVal );
+ }
+ }
+ break;
+
+ default:
+ return EFalse;
+
+ }
+
+ return ETrue;
+
+ }
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgElementImpl::SetTransform( const TDesC& aAttributeName,
+ const TDesC& aValue )
+ {
+
+ if( iSvgTransformable == NULL )
+ {
+ return EFalse;
+ }
+
+ // If this attribute is not transform attribute, return immediately.
+ _LIT( KTransform, "transform" );
+ if ( aAttributeName != KTransform )
+ return EFalse;
+
+ TLex input ( aValue );
+ TReal32 M00, M10, M01, M11, M02, M12;
+ TGfxAffineTransform tempTransform;
+ MSvgTransformList* trList;
+
+ iSvgTransformable->GetTransform( trList );
+ TGfxAffineTransform originalTransform = trList->GetItem( 0 );
+
+ _LIT( KMatrixP, "matrix(" );
+ _LIT( KTranslateP, "translate(" );
+ _LIT( KScaleP, "scale(" );
+ _LIT( KRotateP, "rotate(" );
+ _LIT( KSkewxP, "skewX(" );
+ _LIT( KSkewyP, "skewY(" );
+
+ while ( !( input.Eos() ) )
+ {
+ input.Mark();
+ input.SkipCharacters();
+ TPtrC token = input.MarkedToken(); // then extract token
+
+ if ( token == KMatrixP )
+ {
+ input.SkipSpace(); if ( input.Val( M00, '.' ) != KErrNone ) return EFalse;
+ input.SkipSpace(); if ( input.Val( M10, '.' ) != KErrNone ) return EFalse;
+ input.SkipSpace(); if ( input.Val( M01, '.' ) != KErrNone ) return EFalse;
+ input.SkipSpace(); if ( input.Val( M11, '.' ) != KErrNone ) return EFalse;
+ input.SkipSpace(); if ( input.Val( M02, '.' ) != KErrNone ) return EFalse;
+ input.SkipSpace(); if ( input.Val( M12, '.' ) != KErrNone ) return EFalse;
+
+ //check to make sure the user isn't setting in scale of 0 because that can never be undone
+ //they probably just mean that they don't want to scale
+ /* if (M00 == 0)
+ {
+ M00 = 1;
+ }
+ if (M11 == 0)
+ {
+ M11 = 1;
+ }*/
+
+ tempTransform.SetTransform( M00, M10, M01, M11, M02, M12 );
+ originalTransform.Concatenate( tempTransform );
+ trList->ReplaceItem( originalTransform, 0 );
+ }
+ else if ( token == KTranslateP )
+ {
+ // parse tx
+ input.SkipSpace();
+ if ( input.Val( M00, '.' ) != KErrNone ) return EFalse;
+
+ // parse ty
+ input.SkipSpace();
+ if ( input.Val( M10, '.' ) != KErrNone ) M10 = 0.0;
+
+ // set translate
+ TFloatFixPt fixM00 ( M00 );
+ TFloatFixPt fixM10 ( M10 );
+ originalTransform.Translate( fixM00, fixM10 );
+ trList->ReplaceItem( originalTransform, 0 );
+ }
+ else if ( token == KScaleP )
+ {
+ input.SkipSpace();
+ if(input.Peek().IsDigit() || (input.Peek() == '-') || (input.Peek() == '.'))
+ {
+ if ( input.Val( M00, TChar('.') ) != KErrNone )
+ return EFalse;
+ }
+ else
+ {
+ M00 = 1.0;
+ }
+ input.SkipSpace();
+ // If only one value is given then both scale values are set to that value
+ if ( input.Eos() || input.Peek() == ')' )
+ {
+ M11 = M00;
+ }
+ else
+ {
+ if(input.Peek().IsDigit() || (input.Peek() == '-') || (input.Peek() == '.'))
+ {
+ if ( input.Val( M11, TChar('.')) != KErrNone )
+ return EFalse;
+ }
+ else
+ {
+ M11 = 1.0;
+ }
+ }
+ originalTransform.Scale( M00, M11 );
+ trList->ReplaceItem( originalTransform, 0 );
+ }
+ else if ( token == KRotateP )
+ {
+ // parse r
+ input.SkipSpace();
+ if ( input.Val( M00, '.' ) != KErrNone ) return EFalse;
+ // parse cx
+ input.SkipSpace();
+ if ( input.Val( M01, '.' ) == KErrNone )
+ {
+ // parse cy
+ input.SkipSpace();
+ if ( input.Val( M10, '.' ) != KErrNone ) return EFalse;
+ M00 = M00 * KGradiansPerDegree; // Convert to Radians
+ originalTransform.Rotate( M00, TFloatFixPt(M01), TFloatFixPt(M10) );
+ trList->ReplaceItem( originalTransform, 0 );
+ }
+ else
+ {
+ M00 = M00 * KGradiansPerDegree; // Convert to Radians
+ originalTransform.Rotate( M00 );
+ trList->ReplaceItem( originalTransform, 0 );
+ }
+ }
+ else if ( token == KSkewxP )
+ {
+ input.SkipSpace(); if ( input.Val( M00, '.' ) != KErrNone ) return EFalse;
+ M00 = M00 * KGradiansPerDegree; // Convert to Radians
+ originalTransform.Shear( M00, 0.0f );
+ trList->ReplaceItem( originalTransform, 0 );
+ }
+ else if ( token == KSkewyP )
+ {
+ input.SkipSpace(); if ( input.Val( M00, '.' ) != KErrNone ) return EFalse;
+ M00 = M00 * KGradiansPerDegree; // Convert to Radians
+ originalTransform.Shear( 0.0f, M00 );
+ trList->ReplaceItem( originalTransform, 0 );
+ }
+
+ // Skip close paranthesis
+ input.SkipSpace();
+ input.Mark();
+ input.MarkedToken(); // then extract token
+ }
+ return ETrue;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TSvgColor* CSvgElementImpl::CurrentColor()
+ {
+
+
+ if( iSvgStyleProperties )
+ {
+ CCssValue* lColorValue = NULL;
+ lColorValue = iSvgStyleProperties->operator[](KCSS_ATTR_COLOR);
+
+ if ( lColorValue &&
+ ( ( CClrCssValueImpl * ) lColorValue )->Value() &&
+ ( ( TSvgColor*)(( CClrCssValueImpl * ) lColorValue )->Value())->GetColor() != KSvgCurrentColor
+ )
+ {
+ // current color found and useful, return it
+ return ( TSvgColor*)(( CClrCssValueImpl * ) lColorValue )->Value();
+ }
+ else
+ {
+ // current color found, but it is "currentColor"
+ // find the real color from searching parents
+
+ if ( iParentNode )
+ {
+ return ( ( CSvgElementImpl * ) iParentNode )->CurrentColor();
+ }
+ }
+ }
+ else
+ {
+ if ( iParentNode )
+ {
+ return ( ( CSvgElementImpl * ) iParentNode )->CurrentColor();
+ }
+ }
+ return NULL;
+ }
+
+void CSvgElementImpl::InitAllSvgStyleProperties(CSvgElementImpl* aElement)
+{
+ if (aElement && aElement->ParentNode())
+ {
+ aElement->InitSvgJSRStyleProperties((CSvgElementImpl*)aElement->ParentNode());
+ }
+
+ if (aElement && aElement->iSvgStyleProperties && aElement->iSvgStyleProperties->Count() == KCSS_MAX_ATTR)
+ {
+ CSvgElementImpl* lChildElement = (CSvgElementImpl*)aElement->FirstChild();
+
+ if ( lChildElement )
+ {
+ InitAllSvgStyleProperties( lChildElement );
+ }
+
+ CSvgElementImpl* lSiblingElement = (CSvgElementImpl*)aElement->NextSibling();
+
+ if ( lSiblingElement )
+ {
+ InitAllSvgStyleProperties( lSiblingElement );
+ }
+ }
+}
+
+void CSvgElementImpl::InitSvgJSRStyleProperties(CSvgElementImpl* aParentElement)
+{
+ if ( iSvgStyleProperties && iSvgStyleProperties->Count() == KCSS_MAX_ATTR )
+ {
+ //JSR226 ELEMENT CREATION WILL COME TO THIS
+ // any non NULL values in the iSvgStyleProperties array should be kept and
+ // the NULL ones should be replaced by the parent values
+
+ if( aParentElement && aParentElement->iSvgStyleProperties)
+ {
+ TInt count = aParentElement->iSvgStyleProperties->Count();
+ for ( TInt i = 0; i < count; i++ )
+ {
+ CCssValue* lCssValue = aParentElement->iSvgStyleProperties->operator[]( i );
+ CCssValue* thisCssValue = this->iSvgStyleProperties->operator[]( i );
+
+ if( lCssValue && !thisCssValue )
+ {
+ // the parent had a property but we just had NULL, so lets inherit the parent property
+ (*iSvgStyleProperties)[i] = lCssValue;
+ }
+ else
+ {
+ //this element must have a new value of its own in it so leave it alone
+ }
+ }
+ }
+ }
+}
+
+TInt CSvgElementImpl::InitSvgStyleProperties( )
+ {
+ // all styles from all elements for the normal engine
+ // flow will be setup in this function
+
+ TInt err(KErrNone);
+
+ if( iSvgStyleProperties && iSvgStyleProperties->Count() == 0 )
+ {
+ //NORMAL ENGINE ELEMENT CREATION...
+ CSvgElementImpl* lParentElement = (CSvgElementImpl*)iParentNode;
+ while(lParentElement && ((lParentElement->iSvgStyleProperties == NULL) || (lParentElement->iSvgStyleProperties->Count() == 0)) )
+ {
+ lParentElement = (CSvgElementImpl*)lParentElement->ParentNode ();
+ }
+
+ if( lParentElement )
+ {
+ TInt count = lParentElement->iSvgStyleProperties->Count();
+ for ( TInt i = 0; i < count; i++ )
+ {
+ CCssValue* lCssValue = lParentElement->iSvgStyleProperties->operator[]( i );
+ err = iSvgStyleProperties->Insert(lCssValue,i);
+ if (err)
+ return err;
+ }
+ }
+ }
+
+ return err;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+void CSvgElementImpl::FindProperty( const TInt8 aPropertyId,
+ CCssValue*& aCssValue,
+ CSvgElementImpl* aElement )
+
+ {
+ if (aElement != NULL)
+ aElement->FindProperty(aPropertyId, aCssValue);
+ else
+ FindProperty(aPropertyId, aCssValue);
+ }
+
+void CSvgElementImpl::FindProperty( const TInt8 aPropertyId,
+ CCssValue*& aCssValue)
+
+ {
+ if( iSvgStyleProperties && iSvgStyleProperties->Count() > aPropertyId)
+ {
+ aCssValue = iSvgStyleProperties->operator[](aPropertyId);
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgElementImpl::SetTransform( MSvgTransformList*& aTransformList )
+ {
+ if( !iSvgTransformable )
+ {
+ // iSvgTransformable should not be NULL (created by subclass)
+ TRAP_IGNORE( iSvgTransformable = CSvgTransformableImpl::NewL() );
+ }
+
+ if( iSvgTransformable )
+ {
+ iSvgTransformable->SetTransform( aTransformList );
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgElementImpl::GetTransform( MSvgTransformList*& aTransformList )
+ {
+ if( !iSvgTransformable )
+ {
+ // iSvgTransformable should not be NULL (created by subclass)
+ TRAP_IGNORE( iSvgTransformable = CSvgTransformableImpl::NewL() );
+ }
+
+ if( iSvgTransformable )
+ {
+ iSvgTransformable->GetTransform( aTransformList );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TGfxAffineTransform& CSvgElementImpl::GetCTM()
+ {
+ if( !iSvgTransformable )
+ {
+ // iSvgTransformable should not be NULL (created by subclass)
+ TRAP_IGNORE( iSvgTransformable = CSvgTransformableImpl::NewL() );
+ }
+ return( iSvgTransformable->GetCTM() );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgElementImpl::SetCTM( TGfxAffineTransform& aTr )
+ {
+ if( !iSvgTransformable )
+ {
+ // iSvgTransformable should not be NULL (created by subclass)
+ TRAP_IGNORE( iSvgTransformable = CSvgTransformableImpl::NewL() );
+ }
+
+ if( iSvgTransformable )
+ {
+ iSvgTransformable->SetCTM( aTr );
+ }
+ else
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgElementImpl::SetCTM element %d wasnt transformable CTM not set", this->ElemID());
+ #endif
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgElementImpl::SetGCL( CGfx2dGc* aGc)
+ {
+
+
+ TSvgColor* lStroke = NULL;
+ MGfxPaint* lFill = NULL;
+ TGfxStroke lStrokeC;
+ TFloatFixPt lStrokeWidth = 1;
+ TPtrC lFillRule; // Should be a defined constant for nonzero
+ TPtrC lSLinecap; // Should be a defined constant for linecap
+ TPtrC lSLinejoin; // Should be a defined constant for linejoin
+ TInt lFontStyle = -1; // Should be a defined constant for fontstyle
+ TFloatFixPt lFontSize = 10; // Should be a defined constant for fontstyle
+ TInt lFontWeight = -1; // Should be a defined constant for fontweight
+ TInt lTextanchor = -1;
+ TInt lTextDecoration = -1;
+ TFloatFixPt lDashOffset = 0;
+ TFloatFixPt lSMiterlimit; // Should be a defined constant for strokemiterlimit
+ CArrayFix<TFloatFixPt>* lDasharray = NULL;
+
+ CCssValue* lCssValue = NULL;
+
+ // Get fill color
+
+ FindProperty( KCSS_ATTR_FILL, lCssValue);
+ if ( lCssValue )
+ {
+ // Currently only TSvgColor is represented by PaintCssValue
+ // It will be extended to handle CGfxTexturePaint and CGfxGradientPaint
+ lFill = ( ( CPaintCssValueImpl * ) lCssValue )->Value();
+ // Set fill color
+ if(lFill)
+ {
+ if (lFill->GetColor() == KSvgCurrentColor )
+ {
+
+ lFill = CurrentColor();
+ if (lFill && lFill->GetColor() != KGfxColorNull )
+ {
+ aGc->SetPaint( lFill );
+
+ }
+ else
+ {
+ aGc->SetPaint( NULL );
+ }
+ }
+ else if (lFill->GetColor() != KGfxColorNull )
+ {
+ aGc->SetPaint( lFill );
+ }
+ else
+ {
+ aGc->SetPaint( NULL );
+ }
+ }
+ else
+ {
+ aGc->SetPaint( NULL );
+ }
+ }
+ else
+ {
+ TSvgColor black ( 0 );
+ aGc->SetPaint( &black );
+ }
+
+ // this is just regular opacity which needs to be an entire elements opacity
+ // Opacity set using stroke and fill opacity
+ CCssValue* lOpacityCssValue = NULL;
+ FindProperty( KCSS_ATTR_GROUP_OPACITY, lOpacityCssValue);
+ if ( lOpacityCssValue && ( ((CFloatCssValueImpl*)lOpacityCssValue)->Value() < TFloatFixPt(1) ) )
+ {
+ aGc->SetStrokeOpacity( ( ( CFloatCssValueImpl * ) lOpacityCssValue )->Value() );
+ aGc->SetFillOpacity( ( ( CFloatCssValueImpl * ) lOpacityCssValue )->Value() );
+ }
+
+ lCssValue = NULL;
+ FindProperty( KCSS_ATTR_STROKE_OPACITY, lCssValue);
+ if ( lCssValue )
+ {
+ TFloatFixPt lValue = ( ( CFloatCssValueImpl * ) lCssValue )->Value();
+ aGc->SetStrokeOpacity( lValue );
+ }
+ else
+ {
+ aGc->SetStrokeOpacity(1);
+ }
+
+ lCssValue = NULL;
+ FindProperty( KCSS_ATTR_FILL_OPACITY, lCssValue);
+ if ( lCssValue )
+ {
+ TFloatFixPt lValue = ( ( CFloatCssValueImpl * ) lCssValue )->Value();
+ aGc->SetFillOpacity( lValue );
+ }
+ else
+ {
+ aGc->SetFillOpacity(1);
+ }
+
+ // Get stroke color
+ lCssValue = NULL;
+ FindProperty( KCSS_ATTR_STROKE, lCssValue);
+
+ if ( lCssValue )
+ {
+ lStroke = ( ( CClrCssValueImpl * ) lCssValue )->Value();
+ // Set stroke color
+ if ( lStroke && lStroke->GetColor () == KSvgCurrentColor )
+ {
+ lStroke = CurrentColor();
+ if(lStroke)
+ {
+ aGc->SetForegroundColor( *lStroke );
+ }
+ }
+ else if ( lStroke )
+ {
+ aGc->SetForegroundColor( *lStroke );
+ }
+ }
+
+ // Get stroke-width
+ lCssValue = NULL;
+ FindProperty( KCSS_ATTR_STROKEWIDTH, lCssValue);
+
+ if ( lCssValue )
+ {
+ lStrokeWidth = ( ( CFloatCssValueImpl * ) lCssValue )->Value();
+ if (lStrokeWidth <= TFloatFixPt(0))
+ {
+ lStrokeC.SetStrokeWidth( TFloatFixPt(0) );
+ }
+ else
+ {
+ // Set stroke-width
+ lStrokeC.SetStrokeWidth( lStrokeWidth );
+ }
+ }
+
+ // Get and set fill-rule
+ lCssValue = NULL;
+ FindProperty( KCSS_ATTR_FILLRULE, lCssValue);
+
+ if ( lCssValue )
+ {
+ lFillRule.Set( ( ( CStrCssValueImpl * ) lCssValue )->Value() );
+ if ( lFillRule == _L("evenodd" ) )// evenodd
+ {
+ aGc->SetWindingRule( EGfxWindEvenOdd );
+ }
+ else if ( lFillRule == _L("nonzero") )
+ {
+ aGc->SetWindingRule( EGfxWindNonZero );
+ }
+ }
+
+ // Get and set stroke-linecap
+ lCssValue = NULL;
+ FindProperty( KCSS_ATTR_STROKE_LINECAP, lCssValue);
+
+ if ( lCssValue )
+ {
+ lSLinecap.Set( ( ( CStrCssValueImpl * ) lCssValue )->Value() );
+
+ if (lSLinecap == _L("butt"))
+ {
+ lStrokeC.SetCapType( EGfxCapButt );
+ }
+ else if (lSLinecap == _L("round"))
+ {
+ lStrokeC.SetCapType( EGfxCapRound );
+ }
+ else if (lSLinecap == _L("square"))
+ {
+ lStrokeC.SetCapType( EGfxCapSquare );
+ }
+ }
+
+ lCssValue = NULL;
+ FindProperty( KCSS_ATTR_STROKE_LINEJOIN, lCssValue);
+
+ if ( lCssValue )
+ {
+ lSLinejoin.Set( ( ( CStrCssValueImpl * ) lCssValue )->Value() );
+
+ if (lSLinejoin == _L("miter"))
+ {
+ lStrokeC.SetJoinType( EGfxJoinMiter );
+ }
+ else if (lSLinejoin == _L("round"))
+ {
+ lStrokeC.SetJoinType( EGfxJoinRound );
+ }
+ else if (lSLinejoin == _L("bevel"))
+ {
+ lStrokeC.SetJoinType( EGfxJoinBevel );
+ }
+ }
+
+
+ lCssValue = NULL;
+
+ FindProperty( KCSS_ATTR_STROKE_DASHOFFSET, lCssValue);
+ if ( lCssValue )
+ {
+ lDashOffset = ( ( CFloatCssValueImpl * ) lCssValue )->Value();
+ // Set dashoffset into GC
+ aGc->SetDashOffset( lDashOffset );
+ }
+
+ // Get and set stroke-dasharray
+ lCssValue = NULL;
+ FindProperty( KCSS_ATTR_STROKE_DASHARRAY, lCssValue);
+ if ( lCssValue )
+ {
+ ( ( CVectorCssValueImpl * ) lCssValue )->Value( lDasharray );
+ // Set stroke-dasharray into GC
+ aGc->SetDashArrayL( lDasharray );
+ }
+
+ // get and set stroke-miterlimit
+ lCssValue = NULL;
+ FindProperty( KCSS_ATTR_STROKE_MITERLIMIT, lCssValue);
+
+ if ( lCssValue )
+ {
+ lSMiterlimit = ( ( CFloatCssValueImpl * ) lCssValue )->Value();
+
+ lStrokeC.SetMiterLimit(lSMiterlimit);
+ }
+
+ if( iElemID == KSvgTextAreaElement || iElemID == KSvgTextElement)
+ {
+ lCssValue = NULL;
+ FindProperty( KCSS_ATTR_FONTSIZE, lCssValue);
+
+ if ( lCssValue )
+ {
+ lFontSize = ( ( CFloatCssValueImpl * ) lCssValue )->Value();
+
+ #ifdef SVG_FLOAT_BUILD
+ if(lFontSize <= TFloatFixPt ( 0 ) )
+ {
+ lFontSize = TFloatFixPt ( 10 );
+ }
+ #else
+ if(lFontSize <= TFloatFixPt ( 0,ETrue ) )
+ lFontSize = TFloatFixPt ( 10 );
+ #endif
+ aGc->SetFontSize( lFontSize );
+ }
+
+ lCssValue = NULL;
+ FindProperty( KCSS_ATTR_FONTSTYLE, lCssValue);
+
+ if ( lCssValue )
+ {
+ lFontStyle = ( ( CIntCssValueImpl * ) lCssValue )->Value();
+ aGc->SetFontStyle( lFontStyle );
+ }
+
+ // Get and set font-weight
+ lCssValue = NULL;
+ FindProperty( KCSS_ATTR_FONTWEIGHT, lCssValue);
+
+ if ( lCssValue )
+ {
+ lFontWeight = ( ( CIntCssValueImpl * ) lCssValue )->Value();
+ aGc->SetFontWeight( lFontWeight );
+ }
+
+ // Get and set text-anchor
+ lCssValue = NULL;
+ FindProperty( KCSS_ATTR_TEXTANCHOR, lCssValue);
+
+ if ( lCssValue )
+ {
+ lTextanchor = ( ( CIntCssValueImpl * ) lCssValue )->Value();
+ aGc->SetTextanchor( lTextanchor );
+ }
+
+ // Get and set text-decoration
+ lCssValue = NULL;
+ FindProperty( KCSS_ATTR_TEXTDECORATION, lCssValue);
+
+ if ( lCssValue )
+ {
+ lTextDecoration = ( ( CIntCssValueImpl * ) lCssValue )->Value();
+ aGc->SetTextDecoration( lTextDecoration );
+ }
+ }
+ // Sset the stroke into the graphics library now that we are done
+ aGc->SetStroke( lStrokeC );
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgElementImpl::UpdateCTM( )
+{
+ CSvgDocumentImpl* lDocument = (CSvgDocumentImpl*)(this->OwnerDocument());
+
+ if ( !lDocument )
+ {
+ return;
+ }
+
+ TInt lElementId = this->ElemID();
+ if( this->IsTransformable() )
+ {
+ MSvgTransformList* trList;
+
+ // Current delta transformation due to animation, etc.
+ TGfxAffineTransform localUserSpace;
+ // Element's CTM
+ TGfxAffineTransform lCurrentTM;
+
+
+ // we do not need this for the radial and linear Gradient Element.
+ //
+ if ( this != lDocument->RootElement()
+ && !(lElementId == KSvgLinearGradientElement
+ || lElementId == KSvgRadialGradientElement ))
+
+ {
+ CSvgElementImpl* lParentEl = ( CSvgElementImpl* )this->ParentNode();
+ while (lParentEl && !(lParentEl->IsTransformable()) )
+ {
+ lParentEl = ( CSvgElementImpl* )lParentEl->ParentNode();
+ }
+ if( lParentEl )
+ {
+ lCurrentTM = lParentEl->GetCTM();
+ }
+ }
+
+ this->GetTransform( trList );
+ localUserSpace = trList->Consolidate( IsOverwriteTransforms() );
+ lCurrentTM.Concatenate( localUserSpace );
+
+ if(lElementId == KSvgUseElement)
+ {
+ lCurrentTM.Translate(((CSvgUseElementImpl *)this)->X(),((CSvgUseElementImpl *)this)->Y() );
+ }
+ /* else if(lElementId == KSvgAnimationElement)
+ {
+ lCurrentTM.Translate(((CSvgAnimationElementImpl *)this)->X(),((CSvgAnimationElementImpl *)this)->Y() );
+ }*/
+ else if ( lElementId == KSvgSvgElement )
+ {
+ // Viewbox
+ CSvgSvgElementImpl* tmpSvgEl = ( CSvgSvgElementImpl* )
+ this;
+ TGfxRectangle2D tmpRect ( tmpSvgEl->X(),
+ tmpSvgEl->Y(),
+ tmpSvgEl->Width(),
+ tmpSvgEl->Height() );
+
+ // Add stop for bogus viewports being set if the SVG element hasn't been set
+ // from the Java side.
+ if (tmpRect.iWidth >= TFloatFixPt(0) && tmpRect.iHeight >= TFloatFixPt(0))
+ {
+ tmpSvgEl->SetWindowViewportTrans( tmpRect, lCurrentTM );
+ }
+
+ }
+
+ this->SetCTM( lCurrentTM );
+ }
+
+ CSvgElementImpl*lNewElement = ( CSvgElementImpl* )
+ this->FirstChild();
+ while ( lNewElement != NULL )
+ {
+ lNewElement->UpdateCTM();
+ lNewElement = ( CSvgElementImpl * ) lNewElement->NextSibling();
+ }
+}
+
+
+
+
+
+// *******************************************************
+
+// ---------------------------------------------------------------------------
+// From MSvgTests
+// ---------------------------------------------------------------------------
+void CSvgElementImpl::GetRequiredFeatures( const CDesCArrayFlat*& aRequiredFeatures )
+ {
+ if( iSvgTests )
+ {
+ iSvgTests->GetRequiredFeatures( aRequiredFeatures );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgElementImpl::GetRequiredExtensions( const CDesCArrayFlat*& aRequiredExtensions )
+ {
+ if( iSvgTests )
+ {
+ iSvgTests->GetRequiredExtensions( aRequiredExtensions );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// returns false if system language was empty string
+// ---------------------------------------------------------------------------
+TBool CSvgElementImpl::GetSystemLanguage( const CDesCArrayFlat*& aSystemLanguage )
+ {
+ if( iSvgTests )
+ {
+ return (iSvgTests->GetSystemLanguage( aSystemLanguage ));
+ }
+
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgElementImpl::HasExtension( const TDesC& aExtension )
+ {
+ if( iSvgTests )
+ {
+ return iSvgTests->HasExtension( aExtension );
+ }
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgElementImpl::HasAnyTests( )
+ {
+ if( iSvgTests )
+ {
+ return iSvgTests->HasAnyTests( );
+ }
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgElementImpl::HasFeature( const TDesC& aFeature )
+ {
+ if( iSvgTests )
+ {
+ return iSvgTests->HasFeature( aFeature );
+ }
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgElementImpl::SetTestAttributeL( const TDesC& aPropertyName,
+ const TDesC& aValue )
+ {
+
+ _LIT( KRequiredFeatures, "requiredFeatures" );
+ _LIT( KRequiredExtensions, "requiredExtensions" );
+ _LIT( KSystemLanguage, "systemLanguage" );
+
+ if (aPropertyName == KRequiredFeatures || aPropertyName == KRequiredExtensions || aPropertyName == KSystemLanguage)
+ {
+ if (!iSvgTests)
+ {
+ iSvgTests = CSvgTestsImpl::NewL();
+ }
+
+ return iSvgTests->SetTestAttributeL( aPropertyName, aValue );
+ }
+
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgElementImpl::CreateSvgTestL(const TUint16 aAttrName)
+{
+ if (aAttrName == KAtrRequiredFeatures || aAttrName == KAtrRequiredExtensions || aAttrName == KAtrSystemLanguage)
+ {
+ if (!iSvgTests)
+ {
+ iSvgTests = CSvgTestsImpl::NewL();
+ }
+ }
+}
+// *******************************************************
+// ---------------------------------------------------------------------------
+// From MSvgLangSpace.h
+// ---------------------------------------------------------------------------
+const TDesC& CSvgElementImpl::XMLLang()
+ {
+ if( iSvgLangSpace )
+ {
+ return iSvgLangSpace->XMLLang();
+ }
+ else
+ {
+ return KNullDesC;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgElementImpl::SetXMLLangL( const TDesC& aXMLLang )
+ {
+ if( iSvgLangSpace )
+ {
+ iSvgLangSpace->SetXMLLangL( aXMLLang );
+ }
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TDesC& CSvgElementImpl::XMLSpace()
+ {
+ if( iSvgLangSpace )
+ {
+ return iSvgLangSpace->XMLSpace();
+ }
+ else
+ {
+ return KNullDesC;
+ }
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgElementImpl::SetXMLSpaceL( const TDesC& aXMLSpace )
+ {
+ if( iSvgLangSpace )
+ {
+ iSvgLangSpace->SetXMLSpaceL( aXMLSpace );
+ }
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgElementImpl::SetLangSpaceAttributeL( const TDesC& aPropertyName,
+ const TDesC& aValue )
+{
+ _LIT( KXMLLang, "xml:lang" );
+ _LIT( KXMLSpace, "xml:space" );
+
+ if (aPropertyName == KXMLLang || aPropertyName == KXMLSpace)
+ {
+ if (!iSvgLangSpace)
+ {
+ iSvgLangSpace = CSvgLangSpaceImpl::NewL();
+ }
+
+ return iSvgLangSpace->SetLangSpaceAttributeL( aPropertyName, aValue );
+ }
+ else
+ {
+ return EFalse;
+ }
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgElementImpl::SetXlinkAttributeL( const TDesC& aPropertyName,
+ const TDesC& aValue )
+ {
+ if( iSvgUriReferenceImpl )
+ {
+ return iSvgUriReferenceImpl->SetXlinkAttributeL( aPropertyName, aValue );
+ }
+ else
+ {
+ return EFalse;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TDesC& CSvgElementImpl::Href()
+ {
+ if( iSvgUriReferenceImpl )
+ {
+ return iSvgUriReferenceImpl->Href();
+ }
+ return KNullDesC;
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TDesC* CSvgElementImpl::HrefPointer()
+ {
+ if( iSvgUriReferenceImpl )
+ {
+ return iSvgUriReferenceImpl->HrefPointer();
+ }
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+const TDesC& CSvgElementImpl::XlinkShow()
+ {
+ if(iSvgUriReferenceImpl )
+ {
+ return iSvgUriReferenceImpl->XlinkShow();
+ }
+ return KNullDesC;
+ }
+
+
+// *******************************************************
+// From MSvgEventReceiver
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgElementImpl::ReceiveEventL( MSvgEvent* aEvent, const TUint16 aSubEventMask )
+ {
+ CSvgEngineImpl* engine = ( ( CSvgDocumentImpl* ) OwnerDocument() )->Engine();
+
+ // Accepts Internal event and mouse events
+ switch ( aEvent->EventType() )
+ {
+ case ESvgEngineInternalEvent:
+ break;
+ case ESvgEngineEventMouseDown:
+ case ESvgEngineEventMouseUp:
+ case ESvgEngineEventMouseMove:
+ {
+ // Check if pointer is inside of the element
+ MSvgUiMouseEvent* mevent = ( MSvgUiMouseEvent* ) aEvent;
+ //TGfxRectangle2D p(mevent->X(), mevent->Y(), 0,0);
+ TGfxPoint2D p ( mevent->X(), mevent->Y() );
+ TGfxRectangle2D bbox;
+ TInt32 lVisible;
+ TInt32 lDisplay;
+ this->GetAttributeIntL(KCSS_ATTR_VISIBILITY,lVisible);
+ this->GetAttributeIntL(KCSS_ATTR_DISPLAY,lDisplay);
+ GetBBox( bbox );
+ if ( bbox.Contains( p ) && lDisplay != 16 && lVisible == 0 )
+ {
+ // Invoke internal event
+ switch ( aEvent->EventType() )
+ {
+ case ESvgEngineEventMouseDown:
+ {
+ TSvgInternalEvent evt ( ESvgEventMousedown,
+ ( CSvgElementImpl* )
+ this );
+ engine->ProcessEventL(
+ ( CSvgDocumentImpl* )OwnerDocument(), &evt );
+ SetMouseDown( ETrue );
+ }
+ break;
+ case ESvgEngineEventMouseUp:
+ {
+ TSvgInternalEvent evt ( ESvgEventMouseup,
+ ( CSvgElementImpl* )
+ this );
+ engine->ProcessEventL(
+ ( CSvgDocumentImpl* )OwnerDocument(), &evt );
+
+ if ( IsMouseDown() )
+ {
+ // Check the aSubEventMask to know which event
+ // has occured
+ if(CanGenerateInternalEvent(aSubEventMask,ESvgEventActivate))
+ {
+
+ TSvgInternalEvent evt1 (
+ ESvgEventActivate,
+ ( CSvgElementImpl* )this );
+
+ engine->ProcessEventL(
+ ( CSvgDocumentImpl* ) OwnerDocument(),
+ &evt1 );
+ }
+ if ( CanGenerateInternalEvent(aSubEventMask,ESvgEventClick))
+ {
+
+ TSvgInternalEvent evt (
+ ESvgEventClick,
+ ( CSvgElementImpl* )this );
+
+ engine->ProcessEventL(
+ ( CSvgDocumentImpl* ) OwnerDocument(),
+ &evt );
+
+ }
+ }
+ SetMouseDown( EFalse );
+ }
+ break;
+ case ESvgEngineEventMouseMove:
+ {
+
+ engine->NotifyElementActivatedLinkEntered(this);
+
+ if ( CanGenerateInternalEvent(aSubEventMask,ESvgEventMousemove) )
+ {
+
+ TSvgInternalEvent evt1(
+ ESvgEventMousemove,
+ ( CSvgElementImpl* )this );
+ engine->ProcessEventL(
+ ( CSvgDocumentImpl* ) OwnerDocument(),
+ &evt1 );
+ }
+
+ if ( !IsMouseIn() )
+ {
+
+ engine->NotifyInteractiveElementEntered(this);
+
+ // Check the aSubEventMask to know which event
+ // has occured
+ if ( CanGenerateInternalEvent(aSubEventMask,ESvgEventMouseover) )
+ {
+
+ TSvgInternalEvent evt (
+ ESvgEventMouseover,
+ ( CSvgElementImpl* )this );
+ engine->ProcessEventL(
+ ( CSvgDocumentImpl* ) OwnerDocument(),
+ &evt );
+ }
+
+ if ( CanGenerateInternalEvent(aSubEventMask,ESvgEventFocusin) )
+ {
+
+ TSvgInternalEvent evt2 (
+ ESvgEventFocusin,
+ ( CSvgElementImpl* )this );
+
+ engine->ProcessEventL(
+ ( CSvgDocumentImpl* ) OwnerDocument(),
+ &evt2 );
+
+ }
+ }
+ SetMouseIn( ETrue );
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ engine->NotifyElementActivatedLinkExited(this);
+
+
+ // if state was 'mouse down'then reset the state
+ SetMouseDown( EFalse );
+
+ // if state was 'mouse in' and event is ESvgEngineEventMouseMove,
+ // invoke mouseout event
+
+ //MouseMove: in case of scrolling over a element focusOut events must
+ // be generated
+
+ //MouseDown: In touch cases, if you tap on a element and then tap outside
+ // then a focusout event must be generated
+ if ( IsMouseIn() &&
+ (aEvent->EventType() == ESvgEngineEventMouseMove || aEvent->EventType() == ESvgEngineEventMouseDown )
+ )
+ {
+
+ // Check the aSubEventMask to know whether any valid bit
+ // is set
+ if(engine->Document()->IsValidSubEventMask(aSubEventMask))
+ {
+ engine->NotifyInteractiveElementExited(this);
+ }
+ if ( CanGenerateInternalEvent(
+ aSubEventMask,ESvgEventMouseout ) )
+ {
+ TSvgInternalEvent mouseOutEvent (
+ ESvgEventMouseout, this );
+ engine->ProcessEventL(
+ ( CSvgDocumentImpl* ) OwnerDocument(),
+ &mouseOutEvent );
+ }
+ if ( CanGenerateInternalEvent(
+ aSubEventMask,ESvgEventFocusout))
+ {
+ TSvgInternalEvent focusOutEvent (
+ ESvgEventFocusout, this );
+ engine->ProcessEventL(
+ ( CSvgDocumentImpl* ) OwnerDocument(),
+ &focusOutEvent );
+ }
+ }
+ SetMouseIn( EFalse );
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ return EFalse;
+ }
+
+ // *******************************************************
+// From MSvgEventReceiver
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgElementImpl::ReceiveEventL( MSvgEvent* /*aEvent*/ )
+ {
+ // Dummy implementation
+ return EFalse;
+ }
+
+
+
+
+// *******************************************************
+// From MXmlElementOpt
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgElementImpl::GetAttributeIntL( const TInt aNameId, TInt32& aValue )
+ {
+
+
+ CCssValue* lCssValue = NULL;
+
+
+ if( aNameId == KAtrAnimMotionMatrixIndex )
+ {
+ aValue = AnimateMotionMatrixIndexL();
+ }
+ else if(aNameId== KAtrAnimTransformMatrixIndex)
+ {
+ aValue = AnimateTransformMatrixIndexL();
+ }
+ else
+ {
+ if( (aNameId >= KCSS_MAX_ATTR || aNameId < 0))
+ {
+ return KErrInvalidAttribute;
+ }
+
+ if (iSvgStyleProperties == NULL )
+ {
+ //if the style properties havent been set then just get a default one to be safe
+ GetDefaultAttributeL(aNameId, lCssValue);
+ }
+ else
+ {
+ lCssValue = iSvgStyleProperties->operator[](aNameId);
+ }
+
+ if( lCssValue )
+ {
+ aValue = (( CIntCssValueImpl* )lCssValue)->Value();
+
+ if( aNameId == KCSS_ATTR_FILL )
+ {
+
+ MGfxPaint* lPaintValue = (MGfxPaint *)((( CPaintCssValueImpl* )lCssValue)->Value());
+ /*
+ if(lPaintValue && lPaintValue->GetColor()== KSvgCurrentColor)
+ {
+ lPaintValue = CurrentColor();
+ aValue = lPaintValue->GetColor();
+ }
+ else*/ if(lPaintValue)
+ {
+ aValue = lPaintValue->GetColor();
+ }
+ else
+ {
+ return KErrNoAttribute;
+ }
+ }
+ else if(aNameId == KCSS_ATTR_STROKE || aNameId == KCSS_ATTR_COLOR)
+ {
+ TSvgColor *lColorValue = (( CClrCssValueImpl* )lCssValue)->Value();
+ if(lColorValue)
+ {
+ aValue = lColorValue->GetColor();
+ }
+ else
+ {
+ return KErrNoAttribute;
+ }
+ }
+ return KErrNone;
+ }
+ else
+ {
+ return KErrNoAttribute;
+ }
+ }
+ return KErrNone;
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgElementImpl::SetAttributeIntL( const TInt aNameId,
+ const TInt32 aValue )
+ {
+
+
+ CSvgDocumentImpl* doc = ( CSvgDocumentImpl* ) OwnerDocument();
+
+ if (!doc)
+ {
+ return KErrNoAttribute;
+ }
+
+ if( aNameId >= KCSS_MAX_ATTR || (iSvgStyleProperties == NULL))
+ {
+ return KErrNoAttribute;
+ }
+
+ CSvgElementImpl* lParentElement = (CSvgElementImpl*)ParentNode ();
+ while(lParentElement && (lParentElement->iSvgStyleProperties == NULL))
+ {
+ lParentElement = (CSvgElementImpl*)lParentElement->ParentNode ();
+ }
+ switch(aNameId)
+ {
+ case KCSS_ATTR_FILL:
+ {
+ CPaintCssValueImpl* tValue = (CPaintCssValueImpl *)(iSvgStyleProperties->operator[](aNameId));
+ CPaintCssValueImpl* tParentValue = NULL ;
+ if( this != doc->RootElement() && lParentElement )
+ {
+ tParentValue = (CPaintCssValueImpl *)(lParentElement->iSvgStyleProperties->operator[](aNameId));
+ }
+
+ if( tParentValue == tValue || tValue == NULL) //Not Yet set
+ {
+ tValue = doc->iMemoryManager->GetCssPaintObjectL();
+
+ CCssValue* oldValue = iSvgStyleProperties->operator[](aNameId);
+ PropagateToChildren( oldValue, tValue, aNameId );
+ iSvgStyleProperties->operator[](aNameId) = tValue;
+ }
+ tValue->SetValueL( aValue );
+
+ break;
+ }
+ case KCSS_ATTR_STROKE:
+ case KCSS_ATTR_COLOR:
+ {
+
+ CClrCssValueImpl* tValue = (CClrCssValueImpl *)(iSvgStyleProperties->operator[](aNameId));
+ CClrCssValueImpl* tParentValue = NULL ;
+ if( this != doc->RootElement() && lParentElement)
+ {
+ tParentValue = (CClrCssValueImpl *)(lParentElement->iSvgStyleProperties->operator[](aNameId));
+ }
+
+ if( tParentValue == tValue || tValue == NULL) //Not Yet set
+ {
+ tValue = doc->iMemoryManager->GetCssClrObjectL();
+
+ CCssValue* oldValue = iSvgStyleProperties->operator[](aNameId);
+ PropagateToChildren( oldValue, tValue, aNameId );
+ iSvgStyleProperties->operator[](aNameId) = tValue;
+ }
+ tValue->SetValueL( aValue );
+
+ break;
+ }
+ default:
+ {
+ CIntCssValueImpl* tValue = (CIntCssValueImpl *)(iSvgStyleProperties->operator[](aNameId));
+ if( tValue != NULL && tValue->Value() == aValue )
+ {
+ return KErrNone;
+ }
+ CIntCssValueImpl* tParentValue = NULL ;
+ if( this != doc->RootElement() && lParentElement )
+ {
+ tParentValue = (CIntCssValueImpl *)(lParentElement->iSvgStyleProperties->operator[](aNameId));
+ }
+
+ if( tParentValue == tValue || tValue == NULL) //Not Yet set
+ {
+ tValue = doc->iMemoryManager->GetCssIntObjectL();
+
+ CCssValue* oldValue = iSvgStyleProperties->operator[](aNameId);
+ PropagateToChildren( oldValue, tValue, aNameId );
+ iSvgStyleProperties->operator[](aNameId) = tValue;
+
+ }
+ if( lParentElement && aValue == KInherit )
+ {
+ //tParentValue = (CIntCssValueImpl *)(lParentElement->iSvgStyleProperties->operator[](aNameId));
+ //(*iSvgStyleProperties)[aNameId]= tParentValue;
+ if(tParentValue)
+ tValue->SetValueL(tParentValue->Value());
+ }
+ else
+ {
+ tValue->SetValueL( aValue );
+ }
+
+ break;
+
+ }
+ }
+ return KErrNoAttribute;
+
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgElementImpl::GetAttributeFloat( const TInt aNameId, TFloatFixPt& aValue )
+ {
+
+ CCssValue* lCssValue = NULL;
+ if((aNameId < KCSS_MAX_ATTR) && iSvgStyleProperties )
+ {
+ lCssValue = iSvgStyleProperties->operator[](aNameId);
+ if( lCssValue )
+ {
+ aValue = (( CFloatCssValueImpl * )lCssValue)->Value();
+ return KErrNone;
+ }
+ else
+ {
+ TRAPD(err, GetDefaultAttributeL(aNameId, lCssValue));
+ if (err)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgElementImpl::GetAttributeFloat: Error trapped=%d", err);
+ #endif
+ return KErrNoAttribute;
+ }
+ aValue = (( CFloatCssValueImpl * )lCssValue)->Value();
+ return KErrNone;
+ }
+ }
+ return KErrNoAttribute;
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgElementImpl::SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue )
+ {
+ CSvgDocumentImpl* doc = ( CSvgDocumentImpl* ) OwnerDocument();
+
+ if (!doc)
+ {
+ return KErrNoAttribute;
+ }
+
+ if(aNameId < KCSS_MAX_ATTR && iSvgStyleProperties)
+ {
+ CSvgElementImpl* lParentElement = (CSvgElementImpl*)ParentNode ();
+ while(lParentElement && (lParentElement->iSvgStyleProperties == NULL))
+ {
+ lParentElement = (CSvgElementImpl*)lParentElement->ParentNode ();
+ }
+
+
+ CFloatCssValueImpl* tValue = (CFloatCssValueImpl *)(iSvgStyleProperties->operator[](aNameId));
+ CFloatCssValueImpl* tParentValue = NULL ;
+ if( this != doc->RootElement() && lParentElement)
+ {
+ tParentValue = (CFloatCssValueImpl *)(lParentElement->iSvgStyleProperties->operator[](aNameId));
+
+ }
+
+ if( tParentValue == tValue || tValue == NULL) //Not Yet set
+ {
+ tValue = doc->iMemoryManager->GetCssFloatObjectL();
+
+
+ CCssValue* oldValue = iSvgStyleProperties->operator[](aNameId);
+ PropagateToChildren( oldValue, tValue, aNameId );
+
+ iSvgStyleProperties->operator[](aNameId) = tValue;
+ }
+ return tValue->SetValueL( aValue );
+
+ }
+ return KErrNoAttribute;
+
+ }
+
+
+void CSvgElementImpl::GetSvgStylePropertiesArray( RPointerArray<CCssValue>*& aSvgStyleProperties)
+ {
+ aSvgStyleProperties = iSvgStyleProperties;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgElementImpl::GetAttributePath( const TInt /* aNameId */,
+ CGfxGeneralPath*& /* aValue */ )
+ {
+ return KErrNoAttribute;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgElementImpl::SetAttributePathL( const TInt /*aNameId */,
+ CGfxGeneralPath* /* aValue */ )
+ {
+ return KErrNoAttribute;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgElementImpl::SetAttributePathRef( const TInt /*aNameId */,
+ CGfxGeneralPath*& /* aValue */ )
+ {
+ return KErrNoAttribute;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgElementImpl::GetAttributeDes( const TInt aNameId, TPtrC16& aValue )
+ {
+ CCssValue* lCssValue = NULL;
+
+ if(aNameId < KCSS_MAX_ATTR && iSvgStyleProperties)
+ {
+ lCssValue = iSvgStyleProperties->operator[](aNameId);
+ if( lCssValue )
+ {
+ aValue.Set( (( CStrCssValueImpl * )lCssValue)->Value() );
+ return KErrNone;
+
+ }
+ else
+ {
+ TBool defaultAttr = EFalse;
+ TRAPD(err, defaultAttr = GetDefaultAttributeL(aNameId, lCssValue));
+ if (err)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgElementImpl::GetAttributeDes: Error trapped=%d", err);
+ #endif
+ return KErrNoAttribute;
+ }
+
+ if (defaultAttr && lCssValue)
+ {
+ aValue.Set( (( CStrCssValueImpl * )lCssValue)->Value() );
+ return KErrNone;
+ }
+ return KErrNoAttribute;
+ }
+ }
+ // This is added for JSR API's and this is helpful for testing of the JSR API's
+ if(aNameId == KAtrId)
+ {
+ if( Id() )
+ {
+ aValue.Set( *Id() );
+ return KErrNone;
+ }
+ }
+ return KErrNoAttribute;
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgElementImpl::SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue )
+ {
+ CSvgDocumentImpl* doc = ( CSvgDocumentImpl* ) OwnerDocument();
+
+ if (!doc)
+ {
+ return KErrNoAttribute;
+ }
+
+ if(aNameId < KCSS_MAX_ATTR && iSvgStyleProperties)
+ {
+
+ CSvgElementImpl* lParentElement = (CSvgElementImpl*)ParentNode ();
+ while(lParentElement && (lParentElement->iSvgStyleProperties == NULL))
+ {
+ lParentElement = (CSvgElementImpl*)lParentElement->ParentNode ();
+ }
+
+ CStrCssValueImpl* tValue = (CStrCssValueImpl *)(iSvgStyleProperties->operator[](aNameId));
+ CStrCssValueImpl* tParentValue = NULL ;
+ if( this != doc->RootElement() && lParentElement)
+ {
+ tParentValue = (CStrCssValueImpl *)(lParentElement->iSvgStyleProperties->operator[](aNameId));
+ }
+
+ if( tParentValue == tValue || tValue == NULL) //Not Yet set
+ {
+ tValue = doc->iMemoryManager->GetCssStrObjectL(KNullDesC);
+
+
+ CCssValue* oldValue = iSvgStyleProperties->operator[](aNameId);
+ PropagateToChildren( oldValue, tValue, aNameId );
+
+ iSvgStyleProperties->operator[](aNameId) = tValue;
+
+ }
+ return tValue->SetValueL( aValue );
+
+ }
+ // the following code is added to modify the Id. This might be needed for the JSR API's
+ if(aNameId == KAtrId)
+ {
+ delete iId;
+ iId = NULL;
+ iId = aValue.AllocL();
+ return KErrNone;
+ }
+ return KErrNoAttribute;
+
+
+ }
+
+// ---------------------------------------------------------------------------
+// Internal public method (public but not exported)
+// ---------------------------------------------------------------------------
+TInt32 CSvgElementImpl::AnimateMotionMatrixIndexL()
+ {
+ if ( iAnimateMotionMatrixIndex < 0 && iSvgTransformable )
+ {
+ TGfxAffineTransform ident;
+ MSvgTransformList* trList;
+ this->GetTransform( trList );
+ trList->AppendItemL( ident, ETrue, ETrue ); // Set identity transform
+ iAnimateMotionMatrixIndex = ( TInt16 ) ( trList->NumberOfItems() - 1 );// Keep index in list for this anim element
+ }
+
+ return iAnimateMotionMatrixIndex;
+ }
+TInt32 CSvgElementImpl::AnimateTransformMatrixIndexL()
+ {
+ if ( iAnimateTransformMatrixIndex < 0 && iSvgTransformable )
+ {
+ TGfxAffineTransform ident;
+ MSvgTransformList* trList;
+ this->GetTransform( trList );
+ trList->AppendItemL( ident, ETrue, 2); // Set identity transform
+ iAnimateTransformMatrixIndex = trList->NumberOfItems() - 1;// Keep index in list for this anim element */
+ }
+
+ return iAnimateTransformMatrixIndex;
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgElementImpl::GetBBox( TGfxRectangle2D& /*aBbox*/ )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgElementImpl::GetUnscaledBBox( TGfxRectangle2D& /*aBbox*/ )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgElementImpl::ResetReferenceElementL()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgElementImpl::CloneL(MXmlElement*)
+ {
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// copy the contents of this object to the passed object
+// this method assumes that the passed object has already been
+// created using the proper NewL method.
+// ---------------------------------------------------------------------------
+void CSvgElementImpl::CopyL( CSvgElementImpl* aDestElement )
+ {
+
+ if(aDestElement)
+ {
+
+ if( iSvgStyleProperties )
+ {
+ aDestElement->iSvgStyleProperties->Reset();
+
+ CloneSvgStylePropertiesL(aDestElement,(CSvgElementImpl *)(aDestElement->ParentNode()));
+ }
+
+
+ // copy iSvgTransformable (CSvgTransformableImpl)
+ if( iSvgTransformable )
+ {
+ if ( aDestElement->iSvgTransformable != NULL )
+ {
+ delete aDestElement->iSvgTransformable;
+ aDestElement->iSvgTransformable = NULL;
+ }
+ aDestElement->iSvgTransformable = this->iSvgTransformable->CloneL();
+ }
+
+ // copy iSvgTests (CSvgTestImpl)
+ if( iSvgTests )
+ {
+ if ( aDestElement->iSvgTests != NULL )
+ {
+ delete aDestElement->iSvgTests;
+ aDestElement->iSvgTests = NULL;
+ }
+ aDestElement->iSvgTests = this->iSvgTests->CloneL();
+ }
+
+ // copy iSvgUriReferenceImpl (CSvgUriReferenceImpl)
+ if( iSvgUriReferenceImpl )
+ {
+ if ( aDestElement->iSvgUriReferenceImpl != NULL )
+ {
+ delete aDestElement->iSvgUriReferenceImpl;
+ aDestElement->iSvgUriReferenceImpl = NULL;
+ }
+ aDestElement->iSvgUriReferenceImpl = this->iSvgUriReferenceImpl->CloneL();
+ }
+
+ // copy iSvgLangSpace (CSvgLangSpaceImpl)
+ if( iSvgLangSpace )
+ {
+ if ( aDestElement->iSvgLangSpace != NULL )
+ {
+ delete aDestElement->iSvgLangSpace;
+ aDestElement->iSvgLangSpace = NULL;
+ }
+ aDestElement->iSvgLangSpace = this->iSvgLangSpace->CloneL();
+ }
+
+ // copy Id (iId)
+ if( iId )
+ {
+ aDestElement->SetAttributeDesL( KAtrId, *iId );
+ }
+
+ // copy stuff from superclass
+ this->CXmlElementImpl::CopyL(aDestElement);
+ }
+
+ }
+
+void CSvgElementImpl::PropagateToChildren( CCssValue *oldValue, CCssValue *newValue, const TInt aNameId )
+ {
+ CSvgElementImpl *lChild = (CSvgElementImpl *)FirstChild();
+
+ while(lChild)
+ {
+ if( lChild->iSvgStyleProperties )
+ {
+ if( lChild->iSvgStyleProperties->operator[](aNameId) == oldValue)
+ {
+ lChild->iSvgStyleProperties->operator[](aNameId) = newValue;
+ if( lChild->FirstChild() )
+ {
+ lChild = (CSvgElementImpl *)lChild->FirstChild();
+ continue;
+ }
+
+ }
+ }
+ else
+ {
+ if( lChild->FirstChild() )
+ {
+ lChild = (CSvgElementImpl *)lChild->FirstChild();
+ continue;
+ }
+ }
+
+
+ if( lChild->NextSibling() )
+ {
+ lChild = (CSvgElementImpl *)lChild->NextSibling();
+ }
+ else
+ {
+ lChild = (CSvgElementImpl *)lChild->ParentNode();
+ while( lChild != this && lChild->NextSibling() == NULL )
+ {
+ lChild = (CSvgElementImpl *)lChild->ParentNode();
+ }
+ if( lChild == this )
+ {
+ lChild = NULL ;
+ }
+ else
+ {
+ lChild = (CSvgElementImpl *)(lChild->NextSibling());
+ }
+ }
+ }
+ }
+
+void CSvgElementImpl::CloneSvgStylePropertiesL( CSvgElementImpl* aNewChild, CSvgElementImpl* aParentElement)
+ {
+
+ CSvgDocumentImpl* doc = (CSvgDocumentImpl*)OwnerDocument();
+
+ if (!doc)
+ {
+ return;
+ }
+
+ if( iSvgStyleProperties )
+ {
+ TInt count = iSvgStyleProperties->Count();
+ CSvgElementImpl* lTmpParent = (CSvgElementImpl*)ParentNode ();
+ while(lTmpParent && (lTmpParent->iSvgStyleProperties == NULL))
+ {
+ lTmpParent = (CSvgElementImpl*)lTmpParent->ParentNode ();
+ }
+
+ RPointerArray<CCssValue>*lSvgStyleProperties = NULL;
+
+ ( ( CSvgElementImpl * ) aNewChild )->GetSvgStylePropertiesArray( lSvgStyleProperties );
+
+ CSvgElementImpl* lTmpCloneParent = aParentElement;
+ while(lTmpCloneParent && (lTmpCloneParent->iSvgStyleProperties == NULL))
+ {
+ lTmpCloneParent = (CSvgElementImpl*)lTmpCloneParent->ParentNode ();
+ }
+
+ for ( TInt i = 0; i < count; i++ )
+ {
+ if( lTmpParent && (lTmpParent->iSvgStyleProperties->operator[]( i ) == iSvgStyleProperties->operator[]( i )) )
+ {
+ CCssValue* lCssValue = NULL;
+ if( lTmpCloneParent )
+ {
+ lCssValue = lTmpCloneParent->iSvgStyleProperties->operator[]( i );
+ }
+ lSvgStyleProperties->InsertL(lCssValue,i);
+ }
+ else
+ {
+
+ CCssValue* lCssValue = (iSvgStyleProperties->operator[]( i ));
+
+ //CLONING VALUES THROUGH MEMORY MANAGER
+
+ CCssValue* lCssValueCloned = doc->iMemoryManager->CloneCssValueL(lCssValue);
+
+ lSvgStyleProperties->InsertL(lCssValueCloned,i);
+ }
+ }
+ }
+ }
+
+void CSvgElementImpl::ResetReferenceAttrSet()
+ {
+ if( iAnimateAttrSet )
+ {
+ iAnimateAttrSet->Close();
+ delete iAnimateAttrSet;
+ iAnimateAttrSet = NULL ;
+ }
+ }
+
+
+// functions for encoding
+
+void CSvgElementImpl::SetTransformList(TGfxAffineTransform& aTr)
+ {
+ if( iSvgTransformable )
+ {
+ iSvgTransformable->SetTransformList(aTr);
+ }
+ }
+
+
+void CSvgElementImpl::SetRequiredFeatures( CDesCArrayFlat*& aRequiredFeatures )
+ {
+ if( iSvgTests )
+ {
+ iSvgTests->SetRequiredFeatures (aRequiredFeatures);
+ }
+ }
+
+void CSvgElementImpl::SetRequiredExtensions( CDesCArrayFlat*& aRequiredExtensions )
+ {
+ if( iSvgTests )
+ {
+ iSvgTests->SetRequiredExtensions (aRequiredExtensions);
+ }
+ }
+
+void CSvgElementImpl::SetSystemLanguage( CDesCArrayFlat*& aSystemLanguage )
+ {
+ if( iSvgTests )
+ {
+ iSvgTests->SetSystemLanguage (aSystemLanguage);
+ }
+ }
+
+TBool CSvgElementImpl::IsTransformable()
+ {
+ if( iSvgTransformable )
+ return ETrue;
+ else
+ return EFalse;
+ }
+TInt CSvgElementImpl::SetUriRefDesL( const TUint16 aNameId,
+ const TDesC& aValue )
+ {
+ if( iSvgUriReferenceImpl )
+ {
+ return iSvgUriReferenceImpl->SetUriRefDesL(aNameId, aValue);
+ }
+ return (TInt) EFalse;
+ }
+void CSvgElementImpl::Reset(MSvgEvent* /*aEvent*/)
+ {
+
+ }
+
+void CSvgElementImpl::ReInitializeAnimation()
+{
+
+}
+
+CGfxGeneralPath* CSvgElementImpl::GetPathAttribute(TInt /*aAttributeId*/)
+{
+ return NULL;
+}
+void CSvgElementImpl::SetPathAttribute(TInt /*aSvgAttrId*/, CGfxGeneralPath* /*aPathHandle*/)
+{
+
+}
+
+//this element has an animation associated with it
+TBool CSvgElementImpl::HasAnimation()
+{
+ if (iHasAnimationBase)
+ {
+ return ETrue;
+ }
+
+ return EFalse;
+}
+
+void CSvgElementImpl::SetIsAnimating( TBool aBool )
+{
+ if ( aBool )
+ {
+ iBooleanFlags = iBooleanFlags | KAnimatingBit;
+ }
+ else
+ {
+ iBooleanFlags = iBooleanFlags & ~KAnimatingBit;
+ }
+}
+
+TBool CSvgElementImpl::IsAnimating()
+{
+ return iBooleanFlags & KAnimatingBit;
+}
+
+void CSvgElementImpl::SetTurnOff( TBool aBool )
+{
+ if ( aBool )
+ {
+ iBooleanFlags = iBooleanFlags | KWasTurnedOffBit;
+ }
+ else
+ {
+ iBooleanFlags = iBooleanFlags & ~KWasTurnedOffBit;
+ }
+}
+
+TBool CSvgElementImpl::WasTurnedOff()
+{
+ return iBooleanFlags & KWasTurnedOffBit;
+}
+
+void CSvgElementImpl::SetOverwriteTransforms( TBool aBool )
+{
+ if ( aBool )
+ {
+ iBooleanFlags = iBooleanFlags | KOverwriteTransformsBit;
+ }
+ else
+ {
+ iBooleanFlags = iBooleanFlags & ~KOverwriteTransformsBit;
+ }
+}
+
+TBool CSvgElementImpl::IsOverwriteTransforms()
+{
+ return iBooleanFlags & KOverwriteTransformsBit;
+}
+
+void CSvgElementImpl::SetAllAttributesAdded( TBool aBool )
+{
+ if ( aBool )
+ {
+ iBooleanFlags = iBooleanFlags | KAllAttributesAddedBit;
+ }
+ else
+ {
+ iBooleanFlags = iBooleanFlags & ~KAllAttributesAddedBit;
+ }
+}
+
+TBool CSvgElementImpl::AreAllAttributesAdded()
+{
+ return iBooleanFlags & KAllAttributesAddedBit;
+}
+
+void CSvgElementImpl::SetMouseDown( TBool aBool )
+{
+ if ( aBool )
+ {
+ iBooleanFlags = iBooleanFlags | KMouseDownBit;
+ }
+ else
+ {
+ iBooleanFlags = iBooleanFlags & ~KMouseDownBit;
+ }
+}
+
+TBool CSvgElementImpl::IsMouseDown()
+{
+ return iBooleanFlags & KMouseDownBit;
+}
+
+void CSvgElementImpl::SetMouseIn( TBool aBool )
+{
+ if ( aBool )
+ {
+ iBooleanFlags = iBooleanFlags | KMouseInBit;
+ }
+ else
+ {
+ iBooleanFlags = iBooleanFlags & ~KMouseInBit;
+ }
+}
+
+TBool CSvgElementImpl::IsMouseIn()
+{
+ return iBooleanFlags & KMouseInBit;
+}
+
+void CSvgElementImpl::DeactivateAnimation()
+{
+}
+
+TBool CSvgElementImpl::DoAnimProcL(MSvgEvent* /*aEvent*/)
+{
+return ETrue;
+}
+void CSvgElementImpl ::PointToParent(const TInt aAttrId)
+{
+ //this method doesnt look too good to me.
+ //especially since the OldPointer that is getting passed
+ //to PropagateToChildren is NULL
+
+ if(aAttrId < KCSS_MAX_ATTR && iSvgStyleProperties)
+ {
+ CSvgElementImpl* lTmpParent = (CSvgElementImpl*)ParentNode ();
+ if(lTmpParent)
+ {
+ if(iSvgStyleProperties->operator[]( aAttrId ) != lTmpParent->iSvgStyleProperties->operator[](aAttrId ))
+ {
+
+ //store the old value.
+ CCssValue *OldPointer = iSvgStyleProperties->operator[]( aAttrId );
+
+ //this deletion is no longer needed as the memory manager is in charge of this now
+
+ // set the pointer
+ iSvgStyleProperties->operator[]( aAttrId ) = lTmpParent->iSvgStyleProperties->operator[](aAttrId );
+
+ // update the child pointers to the previous values.
+ PropagateToChildren(OldPointer, lTmpParent->iSvgStyleProperties->operator[](aAttrId ), aAttrId );
+ }
+ }
+ }
+}
+TBool CSvgElementImpl::IsInherited(const TInt aAttrId)
+{
+if(aAttrId < KCSS_MAX_ATTR && iSvgStyleProperties)
+ {
+ CSvgElementImpl* lTmpParent = (CSvgElementImpl*)ParentNode ();
+ if(lTmpParent && lTmpParent->iSvgStyleProperties)
+ {
+ return (iSvgStyleProperties->operator[]( aAttrId ) == lTmpParent->iSvgStyleProperties->operator[](aAttrId ));
+ }
+ }
+return EFalse;
+}
+
+//probably dont need this anymore
+void CSvgElementImpl::InitSvgStylePropertiesWithNullL()
+{
+ for( int i=0; i < KCSS_MAX_ATTR; i++ )
+ {
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+ }
+}
+
+TBool CSvgElementImpl::IsVisible()
+{
+ if ( !AreAllAttributesAdded() )
+ {
+ return EFalse;
+ }
+
+ TInt32 visbilityValue = -1;
+ TInt lReturnValue = KErrGeneral;
+ TRAPD(err, lReturnValue = this->GetAttributeIntL( KCSS_ATTR_VISIBILITY, visbilityValue ));
+ if (err)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgElementImpl::IsVisible() GetAttributeIntL error");
+ #endif
+ }
+
+ return ( ( lReturnValue == KErrNone) && (visbilityValue == 0) );
+}
+
+void CSvgElementImpl::PrintStyleProperties( )
+{
+ //prints all of the style properties out that this element has ahold of
+
+ #ifdef _DEBUG
+ if (!iSvgStyleProperties)
+ {
+ RDebug::Printf("CSvgElementImpl::PrintStyleProperties[%x]: NO STYLES FOUND", this);
+ return;
+ }
+
+ RDebug::Printf("----STYLES---");
+ for (TInt i=0; i<iSvgStyleProperties->Count(); i++)
+ {
+ switch (i)
+ {
+ case 0:
+ RDebug::Printf("fill=\"");
+ break;
+ case 22:
+ RDebug::Printf("fill-opacity=\"");
+ break;
+ case 23:
+ RDebug::Printf("stroke-opacity=\"");
+ break;
+ case 1:
+ RDebug::Printf("stroke=\"");
+ break;
+ case 2:
+ RDebug::Printf("stroke-width=\"");
+ break;
+ case 3:
+ RDebug::Printf("visibility=\"");
+ break;
+ case 4:
+ RDebug::Printf("font-family=\"");
+ break;
+ case 5:
+ RDebug::Printf("font-size=\"");
+ break;
+ case 6:
+ RDebug::Printf("font-style=\"");
+ break;
+ case 7:
+ RDebug::Printf("font-weight=\"");
+ break;
+ case 8:
+ RDebug::Printf("stroke-dasharray=\"");
+ break;
+ case 9:
+ RDebug::Printf("display=\"");
+ break;
+ case 10:
+ RDebug::Printf("fill-rule=\"");
+ break;
+ case 11:
+ RDebug::Printf("stroke-linecap=\"");
+ break;
+ case 12:
+ RDebug::Printf("stroke-linejoin=\"");
+ break;
+ case 13:
+ RDebug::Printf("stroke-dashoffset=\"");
+ break;
+ case 14:
+ RDebug::Printf("stroke-miterlimit=\"");
+ break;
+ case 15:
+ RDebug::Printf("color=\"");
+ break;
+ case 16:
+ RDebug::Printf("text-anchor=\"");
+ break;
+ case 17:
+ RDebug::Printf("text-decoration=\"");
+ break;
+ case 18:
+ RDebug::Printf("color-interpolation=\"");
+ break;
+ case 19:
+ RDebug::Printf("color-rendering=\"");
+ break;
+ case 20:
+ RDebug::Printf("letter-spacing=\"");
+ break;
+ case 21:
+ RDebug::Printf("word-spacing=\"");
+ break;
+ case 24: //THIS SHOULD BE = KSS_MAX_ATTR
+ RDebug::Printf("group-opacity=\"");
+ break;
+ default:
+ RDebug::Printf("UNKNOWN STYLE FOUND!!");
+ break;
+ }
+
+ if ( iSvgStyleProperties->operator[]( i ) )
+ {
+ iSvgStyleProperties->operator[]( i )->Print();
+ RDebug::Printf("\"");
+ }
+ else
+ {
+ //that style was empty
+ RDebug::Printf("EMPTY!!\"", i);
+ }
+ }
+ RDebug::Printf("---END OF STYLES---");
+
+ #endif
+
+}
+
+TBool CSvgElementImpl::GetDefaultAttributeL( const TInt aNameId, CCssValue*& aValue )
+{
+ CSvgDocumentImpl* lDocument = (CSvgDocumentImpl*)OwnerDocument();
+
+ if (!lDocument)
+ {
+ return EFalse;
+ }
+
+ CSvgElementImpl* lRootElement = (CSvgElementImpl*)(lDocument->RootElement());
+
+ if (lRootElement)
+ {
+ RPointerArray<CCssValue>*lSvgStyleProperties = NULL;
+
+ lRootElement->GetSvgStylePropertiesArray(lSvgStyleProperties);
+
+ if (lSvgStyleProperties && lSvgStyleProperties->operator[](aNameId) != NULL )
+ {
+ aValue = (CCssValue*)lSvgStyleProperties->operator[](aNameId);
+ return ETrue;
+ }
+ }
+
+ switch( aNameId )
+ {
+ // Initilaise Svg Element with default values
+ case KCSS_ATTR_FILL:
+ {
+ CPaintCssValueImpl* lPaintObject = lDocument->iMemoryManager->GetCssPaintObjectL(_L("black"),(CSvgElementImpl *)this);
+
+ iSvgStyleProperties->InsertL(lPaintObject, KCSS_ATTR_FILL );
+ }
+ case KCSS_ATTR_FILL_OPACITY:
+ {
+ CFloatCssValueImpl* lFloatObject5 = lDocument->iMemoryManager->GetCssFloatObjectL(_L("1"));
+
+ iSvgStyleProperties->InsertL(lFloatObject5,KCSS_ATTR_FILL_OPACITY);
+ }
+ break;
+
+ case KCSS_ATTR_STROKE_OPACITY:
+ {
+ CFloatCssValueImpl* lFloatObject6 = lDocument->iMemoryManager->GetCssFloatObjectL(_L("1"));
+
+ iSvgStyleProperties->InsertL(lFloatObject6,KCSS_ATTR_STROKE_OPACITY);
+ }
+ break;
+
+ case KCSS_ATTR_STROKE:
+ {
+ CClrCssValueImpl* lClrObject = lDocument->iMemoryManager->GetCssClrObjectL(_L("none"));
+
+ iSvgStyleProperties->InsertL(lClrObject, KCSS_ATTR_STROKE);
+ }
+ break;
+
+ case KCSS_ATTR_STROKEWIDTH:
+ {
+ CFloatCssValueImpl* lFloatObject = lDocument->iMemoryManager->GetCssFloatObjectL(_L("1"));
+
+ iSvgStyleProperties->InsertL(lFloatObject, KCSS_ATTR_STROKEWIDTH);
+ }
+ break;
+
+ case KCSS_ATTR_VISIBILITY:
+ {
+ CIntCssValueImpl* lIntObject = lDocument->iMemoryManager->GetCssIntObjectL(_L("0"));
+
+ iSvgStyleProperties->InsertL(lIntObject,KCSS_ATTR_VISIBILITY);
+ }
+ break;
+
+ case KCSS_ATTR_FONTFAMILY:
+ {
+ iSvgStyleProperties->InsertL(NULL,KCSS_ATTR_FONTFAMILY);
+ }
+ break;
+
+ case KCSS_ATTR_FONTSIZE:
+ {
+ CFloatCssValueImpl* lFloatObject2 = lDocument->iMemoryManager->GetCssFloatObjectL(_L("10"));
+
+ iSvgStyleProperties->InsertL(lFloatObject2 ,KCSS_ATTR_FONTSIZE);
+ }
+ break;
+
+ case KCSS_ATTR_FONTSTYLE:
+ {
+ CIntCssValueImpl* lIntObject2 = lDocument->iMemoryManager->GetCssIntObjectL(_L("0"));
+
+ iSvgStyleProperties->InsertL(lIntObject2,KCSS_ATTR_FONTSTYLE);
+ }
+ break;
+
+ case KCSS_ATTR_FONTWEIGHT:
+ {
+ CIntCssValueImpl* lIntObject3 = lDocument->iMemoryManager->GetCssIntObjectL(_L("0"));
+
+ iSvgStyleProperties->InsertL(lIntObject3,KCSS_ATTR_FONTWEIGHT);
+ }
+ break;
+
+ case KCSS_ATTR_STROKE_DASHARRAY:
+ {
+ iSvgStyleProperties->InsertL(NULL,KCSS_ATTR_STROKE_DASHARRAY);
+ }
+ break;
+
+ case KCSS_ATTR_DISPLAY:
+ {
+ //set default to inline
+ CIntCssValueImpl* lIntObject4 = lDocument->iMemoryManager->GetCssIntObjectL(_L("0"));
+
+ iSvgStyleProperties->InsertL(lIntObject4,KCSS_ATTR_DISPLAY);
+ }
+ break;
+
+ case KCSS_ATTR_FILLRULE:
+ {
+ CStrCssValueImpl* lStrObject1 = lDocument->iMemoryManager->GetCssStrObjectL(_L("nonzero"));
+
+ iSvgStyleProperties->InsertL(lStrObject1,KCSS_ATTR_FILLRULE);
+ }
+ break;
+
+ case KCSS_ATTR_STROKE_LINECAP:
+ {
+ CStrCssValueImpl* lStrObject2 = lDocument->iMemoryManager->GetCssStrObjectL(_L("butt"));
+
+ iSvgStyleProperties->InsertL(lStrObject2,KCSS_ATTR_STROKE_LINECAP);
+ }
+ break;
+
+ case KCSS_ATTR_STROKE_LINEJOIN:
+ {
+ CStrCssValueImpl* lStrObject3 = lDocument->iMemoryManager->GetCssStrObjectL(_L("miter"));
+
+ iSvgStyleProperties->InsertL(lStrObject3,KCSS_ATTR_STROKE_LINEJOIN);
+ }
+ break;
+
+ case KCSS_ATTR_STROKE_DASHOFFSET:
+ {
+ CFloatCssValueImpl* lFloatObject3 = lDocument->iMemoryManager->GetCssFloatObjectL(_L("0"));
+
+ iSvgStyleProperties->InsertL(lFloatObject3,KCSS_ATTR_STROKE_DASHOFFSET);
+ }
+ break;
+
+ case KCSS_ATTR_STROKE_MITERLIMIT:
+ {
+ CFloatCssValueImpl* lFloatObject4 = lDocument->iMemoryManager->GetCssFloatObjectL(_L("4"));
+
+ iSvgStyleProperties->InsertL(lFloatObject4,KCSS_ATTR_STROKE_MITERLIMIT);
+ }
+ break;
+
+ case KCSS_ATTR_COLOR:
+ {
+ CClrCssValueImpl* lClrObject4 = lDocument->iMemoryManager->GetCssClrObjectL(_L("black"));
+
+ iSvgStyleProperties->InsertL(lClrObject4,KCSS_ATTR_COLOR);
+ }
+ break;
+
+ case KCSS_ATTR_TEXTANCHOR:
+ {
+ CIntCssValueImpl* lIntObject5 = lDocument->iMemoryManager->GetCssIntObjectL(_L("0"));
+
+ iSvgStyleProperties->InsertL(lIntObject5,KCSS_ATTR_TEXTANCHOR);
+ }
+ break;
+
+ case KCSS_ATTR_TEXTDECORATION:
+ {
+ CIntCssValueImpl* lIntObject6 = lDocument->iMemoryManager->GetCssIntObjectL(_L("-1"));
+
+ iSvgStyleProperties->InsertL(lIntObject6,KCSS_ATTR_TEXTDECORATION);
+ }
+ break;
+
+ case KCSS_ATTR_COLORINTERPOLATION:
+ {
+ iSvgStyleProperties->InsertL(NULL,KCSS_ATTR_COLORINTERPOLATION);
+ }
+ break;
+
+ case KCSS_ATTR_COLORRENDERING:
+ {
+ iSvgStyleProperties->InsertL(NULL,KCSS_ATTR_COLORRENDERING);
+ }
+ break;
+
+ case KCSS_ATTR_LETTERSPACING:
+ {
+ iSvgStyleProperties->InsertL(NULL,KCSS_ATTR_LETTERSPACING);
+ }
+ break;
+
+ case KCSS_ATTR_WORDSPACING:
+ {
+ iSvgStyleProperties->InsertL(NULL,KCSS_ATTR_WORDSPACING);
+ }
+ break;
+
+ case KCSS_ATTR_GROUP_OPACITY:
+ {
+ CFloatCssValueImpl* lFloatObject7 = lDocument->iMemoryManager->GetCssFloatObjectL(_L("1"));
+
+ iSvgStyleProperties->InsertL(lFloatObject7,KCSS_ATTR_GROUP_OPACITY);
+ }
+ break;
+
+ default:
+ {
+ //don't know the element
+ return EFalse;
+ }
+ }
+
+ aValue = (CCssValue*)iSvgStyleProperties->operator[](aNameId);
+ return ETrue;
+}
+
+TFloatFixPt CSvgElementImpl::GetCurrentScale( )
+{
+ const TGfxAffineTransform& ctm = GetCTM();
+ //GET THE SCALE FACTOR FROM THE CURRENT ELEMENT
+ TGfxPoint2D ep( 1, 0 ), org( 2, 0 );
+ ctm.Transform( &ep, & ep, 1 );
+ ctm.Transform( &org, & org, 1 );
+ ep.iX -= org.iX;
+ ep.iY -= org.iY;
+
+ TFloatFixPt scale = TFloatFixPt::Sqrt( ep.iX * ep.iX + ep.iY * ep.iY );
+ // adjust for rounding error when rotated (and not scaled)
+ if ( scale < TFloatFixPt(1.0f) && scale > TFloatFixPt(0.998f) )
+ {
+ scale = TFloatFixPt(1.0f);
+ }
+
+ return scale;
+}
+
+
+//ALL animated element types must be listed here
+TBool CSvgElementImpl::IsAnimatedElement( )
+{
+ return ( iElemID == KSvgAnimateElement ||
+ iElemID == KSvgAnimateColorElement ||
+ iElemID == KSvgAnimateMotionElement ||
+ iElemID == KSvgAnimateTransformElement ||
+ iElemID == KSvgSetElement ||
+ //iElemID == KSvgDiscardElement || //discard has a begin but doesn't inherit from animationbase?
+ iElemID == KSvgAudioElement ||
+ iElemID == KSvgMediaAnimationElement );
+}
+
+TBool CSvgElementImpl::CanGenerateInternalEvent(TUint16 aSubEventmask, TSvgEvent aEvent)
+ {
+ TUint16 tmp=aSubEventmask;
+ switch(aEvent)
+ {
+ case ESvgEventActivate:
+ tmp= tmp & ESvgInteractiveEventActivate;
+ break;
+ case ESvgEventClick:
+ tmp = tmp & ESvgInteractiveEventClick;
+ break;
+ case ESvgEventMouseover:
+ tmp = tmp & ESvgInteractiveEventMouseover;
+ break;
+ case ESvgEventMousemove:
+ tmp = tmp & ESvgInteractiveEventMousemove;
+ break;
+ case ESvgEventFocusin:
+ tmp = tmp & ESvgInteractiveEventFocusin;
+ break;
+ case ESvgEventMouseout:
+ tmp = tmp & ESvgInteractiveEventMouseout;
+ break;
+ case ESvgEventFocusout:
+ tmp = tmp & ESvgInteractiveEventFocusout;
+ break;
+ default:
+ tmp=0;
+ }
+ if(tmp)
+ {
+ return ETrue;
+ }
+ else
+ {
+ return EFalse;
+ }
+ }
+TBool CSvgElementImpl::IsSVGEnginePaused()
+{
+ CSvgEngineImpl* lEngine = ( ( CSvgDocumentImpl* ) OwnerDocument() )->Engine();
+ return ( lEngine->IsSVGEnginePaused() );
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGEllipseElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,403 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "SVGEllipseElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+
+#include "GfxAffineTransform.h"
+_LIT(KInline , "inline");
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgEllipseElementImpl* CSvgEllipseElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgEllipseElementImpl* self = new ( ELeave )
+ CSvgEllipseElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgEllipseElementImpl* CSvgEllipseElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgEllipseElementImpl* self = new ( ELeave )
+ CSvgEllipseElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgEllipseElementImpl::ConstructL( const TUint8 aElemID )
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+ iSvgStyleProperties = new(ELeave) RPointerArray<CCssValue>(KCSS_MAX_ATTR);
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+ iSvgStyleProperties->Remove( 0 );
+
+
+
+ iSvgTransformable = CSvgTransformableImpl::NewL();
+ //iSvgTests = CSvgTestsImpl::NewL();
+
+ iReqAttrFlag=KSVG_ELLIPSE_ELEMFLAG;
+
+ }
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgEllipseElementImpl::~CSvgEllipseElementImpl()
+ {
+
+ if( iSvgStyleProperties )
+ {
+ iSvgStyleProperties->Close();
+ delete iSvgStyleProperties;
+ iSvgStyleProperties = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+TFloatFixPt CSvgEllipseElementImpl::Rx()
+ {
+ #ifdef SVG_FLOAT_BUILD
+ return iEllipse.iWidth * .5f;
+ #else
+ return iEllipse.iWidth >> 1;
+ #endif
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgEllipseElementImpl::Ry()
+ {
+ #ifdef SVG_FLOAT_BUILD
+ return iEllipse.iHeight * .5f;
+ #else
+ return iEllipse.iHeight >> 1;
+ #endif
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgEllipseElementImpl::Cx()
+ {
+ #ifdef SVG_FLOAT_BUILD
+ return iEllipse.iX + (iEllipse.iWidth * .5f);
+ #else
+ return iEllipse.iX + (iEllipse.iWidth >> 1);
+ #endif
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgEllipseElementImpl::Cy()
+ {
+ #ifdef SVG_FLOAT_BUILD
+ return iEllipse.iY + (iEllipse.iHeight * .5f);
+ #else
+
+ return iEllipse.iY + (iEllipse.iHeight >> 1);
+ #endif
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgEllipseElementImpl::SetRx( TFloatFixPt aRx )
+ {
+ #ifdef SVG_FLOAT_BUILD
+ // Both x and width will be changed.
+ iEllipse.iX += (iEllipse.iWidth * .5f) - aRx;
+ iEllipse.iWidth = aRx * TFloatFixPt(2);
+ #else
+ // Both x and width will be changed.
+ iEllipse.iX += (iEllipse.iWidth >> 1) - aRx;
+ iEllipse.iWidth = aRx << 1;
+ #endif
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgEllipseElementImpl::SetRy( TFloatFixPt aRy )
+ {
+ #ifdef SVG_FLOAT_BUILD
+ // Both x and width will be changed.
+ iEllipse.iY += (iEllipse.iHeight * .5f) - aRy;
+ iEllipse.iHeight = aRy * TFloatFixPt(2);
+ #else
+ // Both x and width will be changed.
+ iEllipse.iY += (iEllipse.iHeight >> 1) - aRy;
+ iEllipse.iHeight = aRy << 1;
+ #endif
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgEllipseElementImpl::SetCx( TFloatFixPt aCx )
+ {
+ #ifdef SVG_FLOAT_BUILD
+ iEllipse.iX = aCx - (iEllipse.iWidth * .5f);
+ #else
+ iEllipse.iX = aCx - (iEllipse.iWidth >> 1);
+ #endif
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgEllipseElementImpl::SetCy( TFloatFixPt aCy )
+ {
+ #ifdef SVG_FLOAT_BUILD
+ iEllipse.iY = aCy - (iEllipse.iHeight * .5f);
+ #else
+
+ iEllipse.iY = aCy - (iEllipse.iHeight >> 1);
+ #endif
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgEllipseElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgEllipseElementImpl::GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrCx:
+ case KAtrRefX:
+ aValue = Cx();
+ break;
+ case KAtrCy:
+ case KAtrRefY:
+ aValue = Cy();
+ break;
+ case KAtrRx:
+ aValue = Rx();
+ break;
+ case KAtrRy:
+ aValue = Ry();
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgEllipseElementImpl::SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrCx:
+ SetCx( aValue );
+ break;
+ case KAtrCy:
+ SetCy( aValue );
+ break;
+
+ case KAtrRx:
+ if(iReqAttrFlag == KAtrSVGElp)
+ {
+ iReqAttrFlag = KAtrRy;
+ }
+ else
+ {
+ iReqAttrFlag = 0;
+ if ( WasTurnedOff() )
+ {
+ // turn it on. this means all the required attributes Are present and
+ // hence we can render it.
+ CSvgElementImpl::SetPropertyL(KCSS_ATTR_DISPLAY, KInline);
+ SetTurnOff( EFalse );
+ }
+ }
+
+ SetRx( aValue );
+
+
+ break;
+ case KAtrRy:
+ if(iReqAttrFlag == KAtrSVGElp)
+ {
+ iReqAttrFlag = KAtrRx;
+ }
+ else
+ {
+ iReqAttrFlag = 0;
+ if ( WasTurnedOff() )
+ {
+ // turn it on. this means all the required attributes Are present and
+ // hence we can render it.
+ CSvgElementImpl::SetPropertyL(KCSS_ATTR_DISPLAY, KInline);
+ SetTurnOff( EFalse );
+ }
+ }
+
+ SetRy( aValue );
+ break;
+ default:
+ return CSvgElementImpl::SetAttributeFloatL( aNameId, aValue );
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgEllipseElementImpl::DrawL( CGfx2dGc* aGc, CSvgElementImpl* aElement )
+ {
+ // If either of width or height is zero no need to draw the ellipse.
+ if(iEllipse.iWidth.iValue && iEllipse.iHeight.iValue)
+ {
+ DrawShapeL( aGc, iEllipse, aElement );
+ }
+ return ETrue;
+ }
+
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+CSvgEllipseElementImpl::CSvgEllipseElementImpl( CSvgDocumentImpl* aDoc ) : iEllipse( 0,
+ 0,
+ 0,
+ 0 )
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgEllipseElementImpl::GetBBox( TGfxRectangle2D& aBbox )
+ {
+ iEllipse.GetBounds( GetCTM(), aBbox );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgEllipseElementImpl::GetUnscaledBBox( TGfxRectangle2D& aBbox )
+ {
+ TGfxAffineTransform identityTx;
+ iEllipse.GetBounds( identityTx, aBbox );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgEllipseElementImpl::CloneL(MXmlElement* aParentElement)
+ {
+ // create new ellipse
+
+ CSvgEllipseElementImpl* newElement = CSvgEllipseElementImpl::NewL( this->ElemID(), ((CSvgDocumentImpl*)iOwnerDocument) );
+
+ CleanupStack::PushL(newElement);
+ newElement->iParentNode = aParentElement;
+
+ // copy everything over
+ CopyL(newElement);
+ CleanupStack::Pop();
+ return newElement;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+void CSvgEllipseElementImpl::CopyL( CSvgEllipseElementImpl* aDestElement )
+ {
+ if(aDestElement)
+ {
+
+ // copy stuff from superclass
+ CSvgElementImpl::CopyL(aDestElement);
+
+ // copy iEllipse items special to circle
+ aDestElement->iEllipse.iX = iEllipse.iX;
+ aDestElement->iEllipse.iY = iEllipse.iY;
+ aDestElement->iEllipse.iHeight = iEllipse.iHeight;
+ aDestElement->iEllipse.iWidth = iEllipse.iWidth;
+
+ // copy the reference to idoc (CSvgDocumentImpl)
+ aDestElement->iOwnerDocument = iOwnerDocument;
+ }
+ }
+
+void CSvgEllipseElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<ellipse x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\">", (int)iEllipse.iX, (int)iEllipse.iY, (int)iEllipse.iWidth, (int)iEllipse.iHeight);
+ #endif
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGEventAttributes.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include "SVGEventAttributes.h"
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+CSvgEventAttributes::CSvgEventAttributes() : iOnClick( NULL ),
+ iOnLoad( NULL ),
+ iOnMouseMove( NULL )
+ {
+ }
+
+CSvgEventAttributes::~CSvgEventAttributes()
+ {
+ delete iOnClick;
+ delete iOnLoad;
+ delete iOnMouseMove;
+ }
+
+void CSvgEventAttributes::SetOnClickL( const TDesC& aString )
+ {
+ if ( iOnClick != NULL )
+ {
+ delete iOnClick;
+ iOnClick = NULL;
+ }
+ iOnClick = aString.AllocL();
+ }
+
+const HBufC* CSvgEventAttributes::OnClick()
+ {
+ return iOnClick;
+ }
+
+void CSvgEventAttributes::SetOnLoadL( const TDesC& aString )
+ {
+ if ( iOnLoad != NULL )
+ {
+ delete iOnLoad;
+ iOnLoad = NULL;
+ }
+ iOnLoad = aString.AllocL();
+ }
+
+const HBufC* CSvgEventAttributes::OnLoad()
+ {
+ return iOnLoad;
+ }
+
+void CSvgEventAttributes::SetOnMouseMoveL( const TDesC& aString )
+ {
+ if ( iOnMouseMove != NULL )
+ {
+ delete iOnMouseMove;
+ iOnMouseMove = NULL;
+ }
+ iOnMouseMove = aString.AllocL();
+ }
+
+const HBufC* CSvgEventAttributes::OnMouseMove()
+ {
+ return iOnMouseMove;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGFitToViewBoxImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,889 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+
+#include <e32base.h>
+
+#include "SVGFitToViewBoxImpl.h"
+#include "SVGSvgElementImpl.h"
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgFitToViewBoxImpl* CSvgFitToViewBoxImpl::NewL()
+ {
+ CSvgFitToViewBoxImpl* self = new ( ELeave ) CSvgFitToViewBoxImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgFitToViewBoxImpl* CSvgFitToViewBoxImpl::NewLC()
+ {
+ CSvgFitToViewBoxImpl* self = new ( ELeave ) CSvgFitToViewBoxImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgFitToViewBoxImpl::~CSvgFitToViewBoxImpl()
+ {
+ if ( iAspectRatio )
+ {
+ delete iAspectRatio;
+ iAspectRatio = NULL;
+ }
+
+ }
+
+// *******************************************************
+// From SVG DOM
+
+/// Returns (parameter 1):
+/// preserveAspectio attribute value: if defined for this element
+/// NULL: if not defined
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgFitToViewBoxImpl::GetPreserveAspectRatio( MSvgPreserveAspectRatio*& aAspectRatio )
+ {
+ aAspectRatio = iAspectRatio;
+ }
+
+/// Returns:
+/// TRUE: If Viewbox defined
+/// FALSE: If Viewbox is not defined
+/// aViewBox: Element's viewbox (if defined).
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgFitToViewBoxImpl::GetViewBox( TGfxRectangle2D& aViewBox )
+ {
+ aViewBox = iViewBox;
+ return iViewBoxDefined;
+ }
+
+// *******************************************************
+// SVG Implementation
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgFitToViewBoxImpl::SetPreserveAspectRatioL( TSvgPreserveAspectAlignType aAlign,
+ TSvgMeetOrSliceType aMeetSlice )
+ {
+ iAspectRatio->SetAlign( aAlign );
+ iAspectRatio->SetMeetOrSlice( aMeetSlice );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgFitToViewBoxImpl::SetViewBoxL( TGfxRectangle2D aViewBox )
+ {
+ iViewBox = aViewBox;
+ iViewBoxDefined = ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgFitToViewBoxImpl::ViewBoxDefined()
+ {
+ return iViewBoxDefined;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgFitToViewBoxImpl::SetViewBoxL( const TDesC& aAttributeName,
+ const TDesC& aValue )
+ {
+ // If this attribute is not viewBox attribute, return immediately.
+ _LIT( KViewBox, "viewBox" );
+ _LIT( KPreserveAspectRatio, "preserveAspectRatio" );
+ _LIT( KNone, "none" );
+ _LIT( KXMidYMid, "xMidYMid" );
+ _LIT( KXMidYMin, "xMidYMin" );
+ _LIT( KXMidYMax, "xMidYMax" );
+ _LIT( KXMinYMin, "xMinYMin" );
+ _LIT( KXMinYMid, "xMinYMid" );
+ _LIT( KXMinYMax, "xMinYMax" );
+ _LIT( KXMaxYMin, "xMaxYMin" );
+ _LIT( KXMaxYMid, "xMaxYMid" );
+ _LIT( KXMaxYMax, "xMaxYMax" );
+
+ _LIT( KMeet, "meet" );
+ _LIT( KSlice, "slice" );
+
+ TLex input( aValue );
+
+ if ( aAttributeName == KViewBox )
+ {
+ TReal32 vBoxX=0;
+ TReal32 vBoxY=0;
+ TReal32 vBoxW=0;
+ TReal32 vBoxH=0;
+
+ input.SkipSpace();
+ if (input.Val( vBoxX, '.' ) != KErrNone)
+ return ETrue;
+
+ if( input.Peek() == ',' )
+ input.Inc();
+ input.SkipSpace();
+ if( input.Peek() == ',' )
+ input.Inc();
+
+ if (input.Val( vBoxY, '.' ) != KErrNone)
+ return ETrue;
+
+
+ if( input.Peek() == ',' )
+ input.Inc();
+ input.SkipSpace();
+ if( input.Peek() == ',' )
+ input.Inc();
+
+ if (input.Val( vBoxW, '.' ) != KErrNone)
+ return ETrue;
+
+ if( input.Peek() == ',' )
+ input.Inc();
+ input.SkipSpace();
+ if( input.Peek() == ',' )
+ input.Inc();
+
+ if (input.Val( vBoxH, '.' ) != KErrNone)
+ return ETrue;
+ //Error Checking
+ if (vBoxW < 0)
+ vBoxW = 0;
+ if (vBoxH < 0)
+ vBoxH = 0;
+
+
+
+
+ TGfxRectangle2D tr = TGfxRectangle2D( vBoxX, vBoxY, vBoxW, vBoxH );
+ this->SetViewBoxL( tr );
+ return ETrue;
+ }
+ else if ( aAttributeName == KPreserveAspectRatio )
+ {
+
+ input.Mark();
+ input.SkipCharacters();
+ TChar test = input.Peek();
+ TPtrC token = input.MarkedToken(); // then extract token
+
+ if ( token == KNone )
+ {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_None,
+ ESvgMeetOrSlice_Unknown );
+ }
+ else if ( token == KXMidYMid )
+ {
+
+ //check meet and slice parsing
+ //AJD need to seperate SetPreserveAspectRatio calls too...
+ TPtrC token = input.NextToken();
+
+ if ( token == KMeet )
+ {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XmidYmid,
+ ESvgMeetOrSlice_Meet );
+ }
+ else if ( token == KSlice )
+ {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XmidYmid,
+ ESvgMeetOrSlice_Slice );
+ }
+ else {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XmidYmid,
+ ESvgMeetOrSlice_Meet );
+ }
+ }
+ else if ( token == KXMidYMin )
+ {
+ TPtrC token = input.NextToken(); // then extract token
+
+ if ( token == KMeet )
+ {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XmidYmin,
+ ESvgMeetOrSlice_Meet );
+ }
+ else if ( token == KSlice )
+ {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XmidYmin,
+ ESvgMeetOrSlice_Slice );
+ }
+ else {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XmidYmin,
+ ESvgMeetOrSlice_Meet );
+ }
+ }
+ else if ( token == KXMidYMax )
+ {
+ TPtrC token = input.NextToken(); // then extract token
+
+ if ( token == KMeet )
+ {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XmidYmax,
+ ESvgMeetOrSlice_Meet );
+ }
+ else if ( token == KSlice )
+ {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XmidYmax,
+ ESvgMeetOrSlice_Slice );
+ }
+ else {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XmidYmax,
+ ESvgMeetOrSlice_Meet );
+ }
+ }
+ else if ( token == KXMinYMin )
+ {
+ TPtrC token = input.NextToken(); // then extract token
+ if ( token == KMeet )
+ {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XminYmin,
+ ESvgMeetOrSlice_Meet );
+ }
+ else if ( token == KSlice )
+ {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XminYmin,
+ ESvgMeetOrSlice_Slice );
+ }
+ else {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XminYmin,
+ ESvgMeetOrSlice_Meet );
+ }
+ }
+ else if ( token == KXMinYMid )
+ {
+ TPtrC token = input.NextToken(); // then extract token
+ if ( token == KMeet )
+ {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XminYmid,
+ ESvgMeetOrSlice_Meet );
+ }
+ else if ( token == KSlice )
+ {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XminYmid,
+ ESvgMeetOrSlice_Slice );
+ }
+ else {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XminYmid,
+ ESvgMeetOrSlice_Meet );
+ }
+ }
+ else if ( token == KXMinYMax )
+ {
+ TPtrC token = input.NextToken(); // then extract token
+ if ( token == KMeet )
+ {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XminYmax,
+ ESvgMeetOrSlice_Meet );
+ }
+ else if ( token == KSlice )
+ {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XminYmax,
+ ESvgMeetOrSlice_Slice );
+ }
+ else {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XminYmax,
+ ESvgMeetOrSlice_Meet );
+ }
+ }
+ else if ( token == KXMaxYMin )
+ {
+ TPtrC token = input.NextToken(); // then extract token
+ if ( token == KMeet )
+ {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XmaxYmin,
+ ESvgMeetOrSlice_Meet );
+ }
+ else if ( token == KSlice )
+ {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XmaxYmin,
+ ESvgMeetOrSlice_Slice );
+ }
+ else {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XmaxYmin,
+ ESvgMeetOrSlice_Meet );
+ }
+ }
+ else if ( token == KXMaxYMid )
+ {
+ TPtrC token = input.NextToken(); // then extract token
+ if ( token == KMeet )
+ {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XmaxYmid,
+ ESvgMeetOrSlice_Meet );
+ }
+ else if ( token == KSlice )
+ {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XmaxYmid,
+ ESvgMeetOrSlice_Slice );
+ }
+ else {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XmaxYmid,
+ ESvgMeetOrSlice_Meet );
+ }
+ }
+ else if ( token == KXMaxYMax )
+ {
+ TPtrC token = input.NextToken(); // then extract token
+ if ( token == KMeet )
+ {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XmaxYmax,
+ ESvgMeetOrSlice_Meet );
+ }
+ else if ( token == KSlice )
+ {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XmaxYmax,
+ ESvgMeetOrSlice_Slice );
+ }
+ else {
+ this->SetPreserveAspectRatioL( ESvgPreserveAspectRatio_XmaxYmax,
+ ESvgMeetOrSlice_Meet );
+ }
+ }
+
+ return ETrue;
+ }
+ else
+ return EFalse;
+ }
+
+
+
+/// Sets window-viewport transformation
+/// Foley, Van Dam, 2nd ed, p 212
+/// Currenly, only SVG element can have viewport.
+/// aXYWH: x, y, width, height attributes of the element.
+/// aTr: transformations up to element.
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgFitToViewBoxImpl::SetWindowViewportTrans( TGfxRectangle2D aXYWH,
+ TGfxAffineTransform& aTr,
+ TSize aSize )
+ {
+ TGfxAffineTransform tr;
+ TGfxAffineTransform tr2;
+
+ //VIEWPORT NUMBERS
+ TFloatFixPt lViewPortX = aXYWH.MinX();
+ TFloatFixPt lViewPortY = aXYWH.MinY();
+ TFloatFixPt lViewPortWidth = aXYWH.MaxX() - lViewPortX;
+ TFloatFixPt lViewPortHeight = aXYWH.MaxY() - lViewPortY;
+
+ tr.SetTransform( 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f );
+
+ /* 1. Translate to origin */
+ tr.Translate( lViewPortX, lViewPortY );
+
+ /* 2. Scale */
+
+ TFloatFixPt lViewBoxXmin;
+ TFloatFixPt lViewBoxYmin;
+ TFloatFixPt lViewBoxWidth;
+ TFloatFixPt lViewBoxHeight;
+
+ if ( iViewBoxDefined ) //
+ {
+ lViewBoxXmin = iViewBox.MinX();
+ lViewBoxYmin = iViewBox.MinY();
+ lViewBoxWidth = iViewBox.MaxX() - lViewBoxXmin;
+ lViewBoxHeight = iViewBox.MaxY() - lViewBoxYmin;
+ }
+ else
+ {
+ //this will default viewBox to <svg> element width and height
+ lViewBoxXmin = 0;
+ lViewBoxYmin = 0;
+ lViewBoxWidth = aSize.iWidth;
+ lViewBoxHeight = aSize.iHeight;
+ }
+
+ #ifdef SVG_FLOAT_BUILD
+ if ( lViewBoxWidth == TFloatFixPt(0.0f) || lViewBoxHeight == TFloatFixPt(0.0f) )
+ #else
+ if ( lViewBoxWidth == TFloatFixPt( 0 , ETrue ) || lViewBoxHeight == TFloatFixPt( 0,ETrue ) )
+ #endif
+ return;
+
+ TFloatFixPt sx = TFloatFixPt(1.0f);
+ TFloatFixPt sy = TFloatFixPt(1.0f);
+
+ sx = lViewPortWidth / lViewBoxWidth;
+ sy = lViewPortHeight / lViewBoxHeight;
+
+ #ifdef SVG_FLOAT_BUILD
+ if ( sx == TFloatFixPt(0.0f) || sy == TFloatFixPt(0.0f) )
+ #else
+ if ( sx == TFloatFixPt( 0 , ETrue ) || sy == TFloatFixPt( 0,ETrue ) )
+ #endif
+ return;
+
+ TSvgPreserveAspectAlignType align = iAspectRatio->GetAlign();
+ TSvgMeetOrSliceType meetSlice = iAspectRatio->GetMeetOrSlice();
+
+ TFloatFixPt xtrans = TFloatFixPt( -1.0f ) * lViewBoxXmin;
+ TFloatFixPt ytrans = TFloatFixPt( -1.0f ) * lViewBoxYmin;
+
+ switch ( align )
+ {
+ case ESvgPreserveAspectRatio_None:
+ /* Non uniform scaling */
+ //none - Do not force uniform scaling.
+ //Scale the graphic content of the given element
+ //non-uniformly if necessary such that the element's
+ //bounding box exactly matches the viewport rectangle.
+
+ //(Note: if <align> is none, then the optional <meetOrSlice> value is ignored.)
+ break;
+
+ case ESvgPreserveAspectRatio_XminYmin:
+ //Align the <min-x> of the element's viewBox with the smallest X value of the viewport.
+ //Align the <min-y> of the element's viewBox with the smallest Y value of the viewport.
+
+ if (meetSlice == ESvgMeetOrSlice_Meet)
+ {
+ if ( sx > sy )
+ {
+ sx = sy;
+ //no change for xtrans...default above
+ }
+ else // ( sx < sy )
+ {
+ sy = sx;
+ //no change for ytrans...default above
+ }
+ }
+ else if (meetSlice == ESvgMeetOrSlice_Slice)
+ {
+ if (sx > sy)
+ {
+ sy = sx;
+ }
+ else // ( sx < sy )
+ {
+ sx = sy;
+ }
+ }
+ break;
+
+ case ESvgPreserveAspectRatio_XmidYmin:
+ //Align the midpoint X value of the element's viewBox with the midpoint X value of the viewport.
+ //Align the <min-y> of the element's viewBox with the smallest Y value of the viewport.
+ //Align the <min-x> of the element's viewBox with the smallest X value of the viewport.
+ //Align the <min-y> of the element's viewBox with the smallest Y value of the viewport.
+
+ if (meetSlice == ESvgMeetOrSlice_Meet)
+ {
+ if ( sx > sy )
+ {
+ sx = sy;
+ #ifdef SVG_FLOAT_BUILD
+ xtrans = ( ( TFloatFixPt )
+ ( lViewPortWidth - ( ( TFloatFixPt ) ( lViewBoxWidth / lViewBoxHeight ) * lViewPortHeight ) ) * TFloatFixPt(.5f) ) / sx - lViewBoxXmin;
+ #else
+ xtrans = ( ( TFloatFixPt )
+ ( lViewPortWidth - ( ( TFloatFixPt ) ( lViewBoxWidth / lViewBoxHeight ) * lViewPortHeight ) ) >> 1 ) / sx - lViewBoxXmin;
+ #endif
+ }
+ else // ( sx < sy )
+ {
+ sy = sx;
+ //no change for ytrans...default above
+ }
+ }
+ else if (meetSlice == ESvgMeetOrSlice_Slice)
+ {
+ if ( sx > sy )
+ {
+ sy = sx;
+ }
+ else //( sx < sy )
+ {
+ sx = sy;
+ xtrans = lViewPortWidth - sx*lViewBoxWidth;
+ xtrans = xtrans/sx;
+ xtrans = xtrans/TFloatFixPt(2) - lViewBoxXmin;
+ }
+ }
+ break;
+
+ case ESvgPreserveAspectRatio_XmaxYmin:
+ //Align the <min-x>+<width> of the element's viewBox with the maximum X value of the viewport.
+ //Align the <min-y> of the element's viewBox with the smallest Y value of the viewport.
+ if (meetSlice == ESvgMeetOrSlice_Meet)
+ {
+ if ( sx > sy )
+ {
+ sx = sy;
+
+ xtrans = ( ( TFloatFixPt )
+ ( lViewPortWidth - ( ( TFloatFixPt ) ( lViewBoxWidth / lViewBoxHeight ) * lViewPortHeight ) ) ) / sx - lViewBoxXmin;
+ }
+ else // ( sx < sy )
+ {
+ sy = sx;
+ //no change for ytrans...default above
+ }
+ }
+ else if (meetSlice == ESvgMeetOrSlice_Slice)
+ {
+ if ( sx > sy )
+ {
+ sy = sx;
+ //no change for ytrans...default above
+ }
+ else // ( sx < sy )
+ {
+ sx = sy;
+ xtrans = lViewPortWidth - sx*lViewBoxWidth;
+ xtrans = xtrans/sx - lViewBoxXmin;
+ }
+ }
+ break;
+
+ case ESvgPreserveAspectRatio_XminYmid:
+ //Align the <min-x> of the element's viewBox with the smallest X value of the viewport.
+ //Align the midpoint Y value of the element's viewBox with the midpoint Y value of the viewport.
+ if (meetSlice == ESvgMeetOrSlice_Meet)
+ {
+ if ( sx > sy )
+ {
+ sx = sy;
+ //no change for xtrans...default above
+ }
+ else // ( sx < sy )
+ {
+ sy = sx;
+ #ifdef SVG_FLOAT_BUILD
+ ytrans = ( ( TFloatFixPt )
+ ( lViewPortHeight - ( ( TFloatFixPt ) ( lViewBoxHeight / lViewBoxWidth ) * lViewPortWidth ) ) * TFloatFixPt(.5f) ) /sy - lViewBoxYmin;
+ #else
+ ytrans = ( ( TFloatFixPt )
+ ( lViewPortHeight - ( ( TFloatFixPt ) ( lViewBoxHeight / lViewBoxWidth ) * lViewPortWidth ) ) >> 1 ) /sy - lViewBoxYmin;
+ #endif
+ }
+ }
+ else if (meetSlice == ESvgMeetOrSlice_Slice)
+ {
+ if ( sx > sy )
+ {
+ sy = sx;
+ ytrans = lViewPortHeight - sx*lViewBoxHeight;
+ ytrans = ytrans/sx;
+ ytrans = ytrans/TFloatFixPt(2) - lViewBoxYmin;
+ }
+ else // ( sx < sy )
+ {
+ sx = sy;
+ }
+ }
+ break;
+
+ case ESvgPreserveAspectRatio_XmidYmid:
+ //(default) case
+ //Align the midpoint X value of the element's viewBox with the midpoint X value of the viewport.
+ //Align the midpoint Y value of the element's viewBox with the midpoint Y value of the viewport.
+ if (meetSlice == ESvgMeetOrSlice_Meet)
+ {
+ if ( sx > sy )
+ {
+ sx = sy;
+ #ifdef SVG_FLOAT_BUILD
+ xtrans = ( ( TFloatFixPt )
+ ( lViewPortWidth - ( ( TFloatFixPt ) ( lViewBoxWidth / lViewBoxHeight ) * lViewPortHeight ) ) * TFloatFixPt(.5f) ) / sx - lViewBoxXmin;
+ #else
+ xtrans = ( ( TFloatFixPt )
+ ( lViewPortWidth - ( ( TFloatFixPt ) ( lViewBoxWidth / lViewBoxHeight ) * lViewPortHeight ) ) >> 1 ) / sx - lViewBoxXmin;
+ #endif
+ }
+ else if ( sx < sy )
+ {
+ sy = sx;
+ #ifdef SVG_FLOAT_BUILD
+
+ ytrans = ( ( TFloatFixPt )
+ ( lViewPortHeight - ( ( TFloatFixPt ) ( lViewBoxHeight / lViewBoxWidth ) * lViewPortWidth ) ) * TFloatFixPt(.5f) ) /sy - lViewBoxYmin;
+ #else
+ ytrans = ( ( TFloatFixPt )
+ ( lViewPortHeight - ( ( TFloatFixPt ) ( lViewBoxHeight / lViewBoxWidth ) * lViewPortWidth ) ) >> 1 ) /sy - lViewBoxYmin;
+ #endif
+ }
+ }
+ else if (meetSlice == ESvgMeetOrSlice_Slice)
+ {
+ if ( sx > sy )
+ {
+ sy = sx;
+ ytrans = lViewPortHeight - sx*lViewBoxHeight;
+ ytrans = ytrans/sx;
+ ytrans = ytrans/TFloatFixPt(2) - lViewBoxYmin;
+ }
+ else // ( sx < sy )
+ {
+ sx = sy;
+ xtrans = lViewPortWidth - sx*lViewBoxWidth;
+ xtrans = xtrans/sx;
+ xtrans = xtrans/TFloatFixPt(2) - lViewBoxXmin;
+ }
+ }
+ break;
+
+ case ESvgPreserveAspectRatio_XmaxYmid:
+ //Align the <min-x>+<width> of the element's viewBox with the maximum X value of the viewport.
+ //Align the midpoint Y value of the element's viewBox with the midpoint Y value of the viewport.
+ if (meetSlice == ESvgMeetOrSlice_Meet)
+ {
+ if ( sx > sy )
+ {
+ sx = sy;
+ xtrans = ( ( TFloatFixPt )
+ ( lViewPortWidth - ( ( TFloatFixPt ) ( lViewBoxWidth / lViewBoxHeight ) * lViewPortHeight ) ) ) / sx - lViewBoxXmin;
+ }
+ else //( sx < sy )
+ {
+ sy = sx;
+ #ifdef SVG_FLOAT_BUILD
+
+ ytrans = ( ( TFloatFixPt )
+ ( lViewPortHeight - ( ( TFloatFixPt ) ( lViewBoxHeight / lViewBoxWidth ) * lViewPortWidth ) ) * TFloatFixPt(.5f) ) /sy - lViewBoxYmin;
+ #else
+ ytrans = ( ( TFloatFixPt )
+ ( lViewPortHeight - ( ( TFloatFixPt ) ( lViewBoxHeight / lViewBoxWidth ) * lViewPortWidth ) ) >> 1 ) /sy - lViewBoxYmin;
+ #endif
+ }
+ }
+ else if (meetSlice == ESvgMeetOrSlice_Slice)
+ {
+ if ( sx > sy )
+ {
+ sy = sx;
+ ytrans = lViewPortHeight - sx*lViewBoxHeight;
+ ytrans = ytrans/sx;
+ ytrans = ytrans/TFloatFixPt(2) - lViewBoxYmin;
+ }
+ else //( sx < sy )
+ {
+ sx = sy;
+ xtrans = lViewPortWidth - sx*lViewBoxWidth;
+ xtrans = xtrans/sx - lViewBoxXmin;
+ }
+ }
+ break;
+
+ case ESvgPreserveAspectRatio_XminYmax:
+ //Align the <min-x> of the element's viewBox with the smallest X value of the viewport.
+ //Align the <min-y>+<height> of the element's viewBox with the maximum Y value of the viewport.
+ if (meetSlice == ESvgMeetOrSlice_Meet)
+ {
+ if ( sx > sy )
+ {
+ sx = sy;
+ //no change for xtrans...default above
+ }
+ else //( sx < sy )
+ {
+ sy = sx;
+
+ ytrans = ( ( TFloatFixPt )
+ ( lViewPortHeight - ( ( TFloatFixPt ) ( lViewBoxHeight / lViewBoxWidth ) * lViewPortWidth ) ) ) /sy - lViewBoxYmin;
+ }
+ }
+ else if (meetSlice == ESvgMeetOrSlice_Slice)
+ {
+ if ( sx > sy )
+ {
+ sy = sx;
+ ytrans = lViewPortHeight - sx*lViewBoxHeight;
+ ytrans = ytrans/sx - lViewBoxYmin;
+ }
+ else //( sx < sy )
+ {
+ sx = sy;
+ }
+ }
+ break;
+
+ case ESvgPreserveAspectRatio_XmidYmax:
+ //Align the midpoint X value of the element's viewBox with the midpoint X value of the viewport.
+ //Align the <min-y>+<height> of the element's viewBox with the maximum Y value of the viewport.
+ if (meetSlice == ESvgMeetOrSlice_Meet)
+ {
+ if ( sx > sy )
+ {
+ sx = sy;
+ #ifdef SVG_FLOAT_BUILD
+
+ xtrans = ( ( TFloatFixPt )
+ ( lViewPortWidth - ( ( TFloatFixPt ) ( lViewBoxWidth / lViewBoxHeight ) * lViewPortHeight ) ) * TFloatFixPt(.5f) ) / sx - lViewBoxXmin;
+ #else
+ xtrans = ( ( TFloatFixPt )
+ ( lViewPortWidth - ( ( TFloatFixPt ) ( lViewBoxWidth / lViewBoxHeight ) * lViewPortHeight ) ) >> 1 ) / sx - lViewBoxXmin;
+
+ #endif
+ }
+ else //( sx < sy )
+ {
+ sy = sx;
+
+ ytrans = ( ( TFloatFixPt )
+ ( lViewPortHeight - ( ( TFloatFixPt ) ( lViewBoxHeight / lViewBoxWidth ) * lViewPortWidth ) ) ) /sy - lViewBoxYmin;
+ }
+ }
+ else if (meetSlice == ESvgMeetOrSlice_Slice)
+ {
+ if ( sx > sy )
+ {
+ sy = sx;
+ ytrans = lViewPortHeight - sx*lViewBoxHeight;
+ ytrans = ytrans/sx - lViewBoxYmin;
+ }
+ else //( sx < sy )
+ {
+ sx = sy;
+ xtrans = lViewPortWidth - sx*lViewBoxWidth;
+ xtrans = xtrans/sx;
+ xtrans = xtrans/TFloatFixPt(2) - lViewBoxXmin;
+ }
+ }
+ break;
+
+ case ESvgPreserveAspectRatio_XmaxYmax:
+ //Align the <min-x>+<width> of the element's viewBox with the maximum X value of the viewport.
+ //Align the <min-y>+<height> of the element's viewBox with the maximum Y value of the viewport.
+ if (meetSlice == ESvgMeetOrSlice_Meet)
+ {
+ if ( sx > sy )
+ {
+ sx = sy;
+
+ xtrans = ( ( TFloatFixPt )
+ ( lViewPortWidth - ( ( TFloatFixPt ) ( lViewBoxWidth / lViewBoxHeight ) * lViewPortHeight ) ) ) / sx - lViewBoxXmin;
+ }
+ else //( sx < sy )
+ {
+ sy = sx;
+
+ ytrans = ( ( TFloatFixPt )
+ ( lViewPortHeight - ( ( TFloatFixPt ) ( lViewBoxHeight / lViewBoxWidth ) * lViewPortWidth ) ) ) /sy - lViewBoxYmin;
+ }
+ }
+ else if (meetSlice == ESvgMeetOrSlice_Slice)
+ {
+ if ( sx > sy )
+ {
+ sy = sx;
+ ytrans = lViewPortHeight - sx*lViewBoxHeight;
+ ytrans = ytrans/sx - lViewBoxYmin;
+ }
+ else //( sx < sy )
+ {
+ sx = sy;
+ xtrans = lViewPortWidth - sx*lViewBoxWidth;
+ xtrans = xtrans/sx - lViewBoxXmin;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ tr2.SetTransform( sx, 0.0f, 0.0f, sy, 0.0f, 0.0f );
+ tr.Concatenate( tr2 );
+
+ /* 3. Translate to viewport origin */
+ tr.Translate( xtrans, ytrans );
+
+ //this aTr should be the CTM for the root element
+ //and should change when the viewBox is set because that could cause scaling
+ aTr.Concatenate( tr );
+ }
+
+// *******************************************************
+// Private
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgFitToViewBoxImpl::ConstructL()
+ {
+
+ //defaults to xMidYMid and Meet
+ iAspectRatio = CSvgPreserveAspectRatioImpl::NewL();
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgFitToViewBoxImpl::CSvgFitToViewBoxImpl() : iViewBox( 0, 0, 0, 0 ),
+ iViewBoxDefined( EFalse )
+
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgFitToViewBoxImpl* CSvgFitToViewBoxImpl::CloneL()
+ {
+ CSvgFitToViewBoxImpl* retValue = CSvgFitToViewBoxImpl::NewL();
+
+ CleanupStack::PushL(retValue);
+
+ // *** copy iAspectRatio
+ if ( this->iAspectRatio != NULL )
+ {
+ if ( retValue->iAspectRatio != NULL )
+ {
+ delete retValue->iAspectRatio;
+ retValue->iAspectRatio = NULL;
+ }
+ retValue->iAspectRatio = this->iAspectRatio->CloneL();
+ }
+
+ // *** copy other simple instance variables
+ retValue->iViewBox = this->iViewBox;
+ retValue->iViewBoxDefined = this->iViewBoxDefined;
+
+ CleanupStack::Pop(retValue);
+
+ return retValue;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGFloatCssValueImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#ifdef _DEBUG
+#if !defined(__E32DEBUG_H__)
+#include <e32debug.h>
+#endif
+#endif
+#include "SVGFloatCssValueImpl.h"
+
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CFloatCssValueImpl::CFloatCssValueImpl()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CFloatCssValueImpl::CFloatCssValueImpl( float aValue )
+{
+ iValue = aValue;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CFloatCssValueImpl::~CFloatCssValueImpl()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CFloatCssValueImpl::Value()
+ {
+ return iValue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CFloatCssValueImpl::SetValueL( const TDesC& aValue )
+ {
+
+ TReal32 tReal;
+ TLex tLex( aValue );
+ if ( tLex.Val( tReal, '.' ) == KErrNone )
+ {
+ iValue = ( TFloatFixPt ) tReal;
+ }
+ return KErrNone;
+ }
+
+TInt CFloatCssValueImpl::SetValueL( const TFloatFixPt& aValue )
+ {
+ iValue = aValue;
+ return KErrNone;
+ }
+
+
+// *******************************************************
+// Private
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CFloatCssValueImpl::IsEqual( CCssValue* aValue )
+{
+ if (((CFloatCssValueImpl*)aValue)->iValue == iValue)
+ {
+ return ETrue;
+ }
+
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CFloatCssValueImpl::Print()
+{
+ #ifdef _DEBUG
+ RDebug::Printf("%d", (int)iValue);
+ #endif
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGFontElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,235 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "SVGFontElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+
+#include "GfxAffineTransform.h"
+
+#ifdef SVG_FONTS_INCLUDE
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgFontElementImpl* CSvgFontElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgFontElementImpl*self = new ( ELeave ) CSvgFontElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL(aElemID);
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgFontElementImpl* CSvgFontElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgFontElementImpl*self = new ( ELeave ) CSvgFontElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL(aElemID);
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgFontElementImpl::ConstructL( const TUint8 aElemID )
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+
+
+ #ifdef SVG_FLOAT_BUILD
+ iHorzAdvX = TFloatFixPt(0);
+ iHorzOrgX = TFloatFixPt(0);
+ iHorzOrgY = TFloatFixPt(0);
+ #else
+ iHorzAdvX = TFloatFixPt( 0 ,ETrue);
+ iHorzOrgX = TFloatFixPt( 0 ,ETrue);
+ iHorzOrgY = TFloatFixPt( 0 ,ETrue);
+ #endif
+
+ iSvgStyleProperties = new(ELeave) RPointerArray<CCssValue>(KCSS_MAX_ATTR);
+
+ // This is required to allocate buffer up to granularity so that the
+ // following Insert calls cannot leave.
+
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+ iSvgStyleProperties->Remove( 0 );
+
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgFontElementImpl::CSvgFontElementImpl( CSvgDocumentImpl* aDoc )
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgFontElementImpl::~CSvgFontElementImpl()
+ {
+ if(iSvgStyleProperties)
+ {
+ iSvgStyleProperties->Close();
+ delete iSvgStyleProperties;
+ iSvgStyleProperties = NULL;
+ }
+ }
+
+// *******************************************************
+// From SVG DOM
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgFontElementImpl::GetHorzOrgX()
+ {
+ return iHorzOrgX;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgFontElementImpl::GetHorzOrgY()
+ {
+ return iHorzOrgY;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgFontElementImpl::GetHorzAdvX()
+ {
+ return iHorzAdvX;
+ }
+
+// *******************************************************
+// From MXmlElement
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgFontElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+
+ return KErrNone;
+ }
+
+
+// From MXmlElementOpt
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgFontElementImpl::SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue )
+
+{
+
+ switch ( aNameId )
+ {
+ case KAtrHorizAdvX:
+ iHorzAdvX = aValue;
+ break;
+ case KAtrHorizOriginX:
+ iHorzOrgX = aValue;
+ break;
+ case KAtrHorizOriginY:
+ iHorzOrgY = aValue;
+ break;
+ default:
+ return CSvgElementImpl::SetAttributeFloatL( aNameId, aValue );
+ }
+ return KErrNone;
+
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgFontElementImpl::GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrHorizOriginX:
+ aValue = GetHorzOrgX();
+ break;
+ case KAtrHorizAdvX:
+ aValue = GetHorzAdvX();
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+
+ return KErrNone;
+ }
+
+// *******************************************************
+// From CSvgElementImpl
+
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgFontElementImpl::CloneL(MXmlElement*)
+ {
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgFontElementImpl::DrawL( CGfx2dGc* /* aGc */,
+ CSvgElementImpl* /* aElement */ )
+ {
+ return EFalse;
+ }
+
+void CSvgFontElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<font horiz-origin-x=\"%d\" horiz-origin-y=\"%d\" horiz-adv-x=\"%d\">", (int)iHorzOrgX, (int)iHorzOrgY, (int)iHorzAdvX);
+ #endif
+
+ /*vert-origin-x
+ vert-origin-y
+ vert-adv-y*/
+ }
+}
+
+#endif //ifdef SVG_FONTS_INCLUDE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGFontFaceElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,443 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "SVGFontFaceElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+#include "SVGEngineImpl.h"
+
+#include "GfxAffineTransform.h"
+#include "SVGFontHashMap.h"
+
+#ifdef SVG_FONTS_INCLUDE
+
+_LIT( SPACE, " " );
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgFontFaceElementImpl* CSvgFontFaceElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgFontFaceElementImpl*self = new ( ELeave )
+ CSvgFontFaceElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID);
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgFontFaceElementImpl* CSvgFontFaceElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgFontFaceElementImpl*self = new ( ELeave )
+ CSvgFontFaceElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID);
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgFontFaceElementImpl::ConstructL( const TUint8 aElemID)
+ {
+ CSvgElementImpl::InitializeL( aElemID);
+ iFontFamily = HBufC::NewL( 2 );
+ *iFontFamily = SPACE;
+
+ iUnicodeRange = HBufC::NewL( 2 );
+ *iUnicodeRange = SPACE;
+
+ #ifdef SVG_FLOAT_BUILD
+ iUnitsPerEm = TFloatFixPt( 0 );
+ iAlphabetic = TFloatFixPt( 0 );
+
+ iAscent = TFloatFixPt( 0 );
+ iDescent = TFloatFixPt( 0 );
+
+ iUnderlinePosition = TFloatFixPt( 0 );
+ iUnderlineThickness = TFloatFixPt( 0 );
+ iOverlinePosition = TFloatFixPt( 0 );
+ iOverlineThickness = TFloatFixPt( 0 );
+ iStrikethroughPosition = TFloatFixPt( 0 );
+ iStrikethroughThickness = TFloatFixPt( 0 );
+ #else
+ iUnitsPerEm = TFloatFixPt( 0 ,ETrue );
+ iAlphabetic = TFloatFixPt( 0 ,ETrue);
+
+ iAscent = TFloatFixPt( 0 ,ETrue );
+ iDescent = TFloatFixPt( 0 ,ETrue );
+
+ iUnderlinePosition = TFloatFixPt( 0 ,ETrue );
+ iUnderlineThickness = TFloatFixPt( 0 ,ETrue );
+ iOverlinePosition = TFloatFixPt( 0 ,ETrue );
+ iOverlineThickness = TFloatFixPt( 0 ,ETrue );
+ iStrikethroughPosition = TFloatFixPt( 0 ,ETrue );
+ iStrikethroughThickness = TFloatFixPt( 0 ,ETrue );
+ #endif
+
+ iSvgStyleProperties = new(ELeave) RPointerArray<CCssValue>(KCSS_MAX_ATTR);
+
+ // This is required to allocate buffer up to granularity so that the
+ // following Insert calls cannot leave.
+
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+ iSvgStyleProperties->Remove( 0 );
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgFontFaceElementImpl::~CSvgFontFaceElementImpl()
+ {
+ //AJD this whole thing needs to be replaced with some sort of external resource registry area....
+ //for images, fonts, other svg files
+ if ( ((CSvgDocumentImpl*)iOwnerDocument)->Engine() && ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->iFontHashMap)
+ {
+ TRAPD(err, ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->iFontHashMap->RemoveReferenceFromFontL(iFontFamily->Des()));
+ if (err)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgFontFaceElementImpl::~CSvgFontFaceElementImpl: Error trapped=%d", err);
+ #endif
+ }
+ }
+
+ if ( (CSvgDocumentImpl*)iOwnerDocument && ((CSvgDocumentImpl*)iOwnerDocument)->iFontHashMap)
+ {
+ TRAPD(err, ((CSvgDocumentImpl*)iOwnerDocument)->iFontHashMap->RemoveReferenceFromFontL(iFontFamily->Des()));
+ if (err)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgFontFaceElementImpl::~CSvgFontFaceElementImpl: Error trapped=%d", err);
+ #endif
+ }
+ }
+
+ if ( iFontFamily )
+ {
+ delete iFontFamily;
+ iFontFamily = NULL;
+ }
+
+ if ( iUnicodeRange )
+ {
+ delete iUnicodeRange;
+ iUnicodeRange = NULL;
+ }
+
+ if ( iSvgStyleProperties )
+ {
+ iSvgStyleProperties->Close();
+ delete iSvgStyleProperties;
+ iSvgStyleProperties = NULL;
+ }
+ }
+
+// *******************************************************
+// From SVG DOM
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TDesC* CSvgFontFaceElementImpl::GetFontFamily( )
+ {
+ return iFontFamily;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgFontFaceElementImpl::GetAscent()
+ {
+ return iAscent;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgFontFaceElementImpl::GetDescent()
+ {
+ return iDescent;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgFontFaceElementImpl::GetUnitsPerEm()
+ {
+ return iUnitsPerEm;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgFontFaceElementImpl::GetAlphabetic()
+ {
+ return iAlphabetic;
+ }
+
+// *******************************************************
+// SVG Implementation
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgFontFaceElementImpl::SetFontFamilyL( const TDesC& aFontFamily )
+ {
+ if ( iFontFamily )
+ {
+ delete iFontFamily;
+ iFontFamily = NULL;
+ }
+ iFontFamily = aFontFamily.AllocL();
+
+ if(iOwnerDocument)
+ {
+ //FOR JSR226 we have to store at document level
+ //since it doesnt have an engine at parsing time
+ ((CSvgDocumentImpl*)iOwnerDocument)->iFontHashMap->AddFontL((CSvgFontElementImpl*) ParentNode(), *iFontFamily);
+
+ //Get the parent element(FontElement) and store it in the FontMap Table.
+ CSvgEngineImpl* lEngine = ((CSvgDocumentImpl*)iOwnerDocument)->Engine();
+ if (lEngine)
+ {
+ lEngine->iFontHashMap->AddFontL((CSvgFontElementImpl*)ParentNode(), *iFontFamily);
+ }
+
+ }
+ }
+// --------------------------------------------------------------------------
+// CSvgFontFaceElementImpl::RemoveFontFamily
+// Remove the font-family from the hash map
+// --------------------------------------------------------------------------
+void CSvgFontFaceElementImpl::RemoveFontFamily(const TDesC& aFontFamily)
+ {
+
+ if(iOwnerDocument)
+ {
+
+ ((CSvgDocumentImpl*)iOwnerDocument)->iFontHashMap->RemoveReferenceFromFontL(aFontFamily);
+
+ CSvgEngineImpl* lEngine = ((CSvgDocumentImpl*)iOwnerDocument)->Engine();
+ if (lEngine)
+ {
+ lEngine->iFontHashMap->RemoveReferenceFromFontL(aFontFamily);
+ }
+
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgFontFaceElementImpl::SetUnicodeRangeL( const TDesC& aUnicodeRange )
+ {
+ if ( iUnicodeRange )
+ {
+ delete iUnicodeRange;
+ iUnicodeRange = NULL;
+ }
+ iUnicodeRange = aUnicodeRange.AllocL();
+ }
+
+
+
+// *******************************************************
+// From MXmlElement
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgFontFaceElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+ _LIT( KUnicodeRange, "unicode-range" );
+ if ( aName == KUnicodeRange )
+ {
+ SetUnicodeRangeL( aValue );
+ }
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgFontFaceElementImpl::SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrAscent: iAscent = aValue;
+ break;
+ case KAtrDescent: iDescent = aValue;
+ break;
+ case KAtrAlphabetic: iAlphabetic = aValue;
+ break;
+ case KAtrUnderlinePosition: iUnderlinePosition = aValue;
+ break;
+ case KAtrUnderlineThickness: iUnderlineThickness = aValue;
+ break;
+ case KAtrOverlinePosition: iOverlinePosition = aValue;
+ break;
+ case KAtrOverlineThickness: iOverlineThickness = aValue;
+ break;
+ case KAtrStrikethroughPosition: iStrikethroughPosition = aValue;
+ break;
+ case KAtrStrikethroughThickness: iStrikethroughThickness = aValue;
+ break;
+ case KAtrUnitsPerEm: iUnitsPerEm = aValue;
+ break;
+ default:
+ return CSvgElementImpl::SetAttributeFloatL( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+
+// From MXmlElementOpt
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgFontFaceElementImpl::GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrUnitsPerEm:
+ aValue = GetUnitsPerEm();
+ break;
+ case KAtrAscent:
+ aValue = GetAscent();
+ break;
+ case KAtrDescent:
+ aValue = GetDescent();
+ break;
+ case KAtrAlphabetic:
+ aValue = GetAlphabetic();
+ break;
+ case KAtrUnderlinePosition:
+ aValue = iUnderlinePosition;
+ break;
+ case KAtrUnderlineThickness:
+ aValue = iUnderlineThickness;
+ break;
+ case KAtrOverlinePosition:
+ aValue = iOverlinePosition;
+ break;
+ case KAtrOverlineThickness:
+ aValue = iOverlineThickness;
+ break;
+ case KAtrStrikethroughPosition:
+ aValue = iStrikethroughPosition;
+ break;
+ case KAtrStrikethroughThickness:
+ aValue = iStrikethroughThickness;
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgFontFaceElementImpl::GetAttributeDes( const TInt aNameId,
+ TPtrC16& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrUnicodeRange:
+ {
+ if ( ( iUnicodeRange->Length() > 2 ) )
+ {
+ aValue.Set( *iUnicodeRange );
+ break;
+ }
+ else
+ return KErrNoAttribute;
+ }
+ default:
+ return CSvgElementImpl::GetAttributeDes( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+// *******************************************************
+// From CSvgElementImpl
+
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgFontFaceElementImpl::CloneL(MXmlElement*)
+ {
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgFontFaceElementImpl::DrawL( CGfx2dGc* /* aGc */,
+ CSvgElementImpl* /* aElement */ )
+ {
+ return EFalse;
+ }
+
+
+// *******************************************************
+// Private
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+CSvgFontFaceElementImpl::CSvgFontFaceElementImpl( CSvgDocumentImpl* aDoc )
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+void CSvgFontFaceElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<font-face font-family=\"hmm\" alphabetic=\"%d\" underline-position=\"%d\" underline-thickness=\"%d\" overline-position=\"%d\" overline-thickness=\"%d\" strikethrough-position=\"%d\" strikethrough-thickness=\"%d\" unicode-range=\"hmm\" units-per-em=\"%d\" ascent=\"%d\" descent=\"%d\"\\>",
+ /*iFontFamily,*/ (int)iAlphabetic, (int)iUnderlinePosition, (int)iUnderlineThickness, (int)iOverlinePosition, (int)iOverlineThickness, (int)iStrikethroughPosition, (int)iStrikethroughThickness, /*iUnicodeRange->Des(),*/ (int)iUnitsPerEm, (int)iAscent, (int)iDescent);
+ #endif
+ }
+}
+
+#endif //ifdef SVG_FONTS_INCLUDE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGFontHashMap.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,445 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include "SVGFontHashMap.h"
+#include "SVGDocumentImpl.h"
+
+//SVG Font storage
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgFontHashMap* CSvgFontHashMap::NewL()
+ {
+ CSvgFontHashMap* self = new ( ELeave ) CSvgFontHashMap;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgFontHashMap* CSvgFontHashMap::NewLC()
+ {
+ CSvgFontHashMap* self = new ( ELeave ) CSvgFontHashMap;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgFontHashMap::ConstructL()
+ {
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgFontHashMap::CSvgFontHashMap()
+
+ {
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgFontHashMap::~CSvgFontHashMap()
+ {
+ iSvgFontMapItems.ResetAndDestroy();
+ iSvgFontMapItems.Close();
+
+ iFontDocumentPointers.ResetAndDestroy();
+ iFontDocumentPointers.Close();
+ }
+
+// ==========================================================================
+// CSvgFontHashMap::AddFontL( CSvgFontElementImpl* aFontPtr,
+// const TDesC& aFontFamilyName )
+// return ETrue if Font added
+// return EFalse if Font was already in map
+// ==========================================================================
+TBool CSvgFontHashMap::AddFontL( CSvgFontElementImpl* aFontPtr,
+ const TDesC& aFontFamilyName )
+{
+ CSvgFontMapItem* lFontMapItem = GetFontMapItem( aFontFamilyName );
+
+ if (lFontMapItem)
+ {
+ //already a reference to this font in the font map
+ AddReferenceToFontL( aFontFamilyName);
+ return EFalse;
+ }
+ else
+ {
+ //didnt find that font in the font map...add it
+ CSvgFontMapItem* lNewSvgFontMapItem = CSvgFontMapItem::NewL( );
+
+ lNewSvgFontMapItem->SetFontPtr( aFontPtr );
+ lNewSvgFontMapItem->CopyFontFamilyName( aFontFamilyName );
+ lNewSvgFontMapItem->IncrementReferenceCount();
+
+ iSvgFontMapItems.Append(lNewSvgFontMapItem);
+
+ return ETrue;
+ }
+}
+
+// --------------------------------------------------------------------------
+// void CSvgFontHashMap::AddReferenceToFontL( CFbsBitmap* aFont,
+// return ETrue if reference successfully added
+// return EFalse if already in map so just incremented reference
+// ---------------------------------------------------------------------------
+TBool CSvgFontHashMap::AddReferenceToFontL( const TDesC& aFontFamilyName )
+ {
+ CSvgFontMapItem* lFontMapItem = GetFontMapItem( aFontFamilyName );
+
+ if (lFontMapItem)
+ {
+ //already a reference to this Font in the Font map
+ lFontMapItem->IncrementReferenceCount();
+ return ETrue;
+ }
+ else
+ {
+ return EFalse;
+ }
+
+ }
+
+// --------------------------------------------------------------------------
+// TBool CSvgFontHashMap::HasFontName( const TDesC& aFontName
+// ---------------------------------------------------------------------------
+TBool CSvgFontHashMap::HasFontFamilyName( const TDesC& aFontFamilyName )
+ {
+ TBool lHaveFont = EFalse;
+
+ TInt svgFontMapItemsCnt = iSvgFontMapItems.Count();
+ for (TInt i=0; i < svgFontMapItemsCnt; i++)
+ {
+ if ( aFontFamilyName == ((CSvgFontMapItem*)iSvgFontMapItems[i])->GetFontFamilyName() )
+ {
+ lHaveFont = ETrue;
+ }
+ }
+
+ return lHaveFont;
+
+ }
+
+// --------------------------------------------------------------------------
+// CSvgFontMapItem* CSvgFontHashMap::GetFontMapItem( const TDesC& aFontName
+// ---------------------------------------------------------------------------
+CSvgFontMapItem* CSvgFontHashMap::GetFontMapItem( const TDesC& aFontFamilyName )
+{
+ TInt svgFontMapItemsCnt = iSvgFontMapItems.Count();
+ for ( TInt i = 0; i < svgFontMapItemsCnt; i++ )
+ {
+ CSvgFontMapItem* lFontMap = (CSvgFontMapItem*)iSvgFontMapItems[i];
+
+ TInt result = aFontFamilyName.Compare( lFontMap->GetFontFamilyName() );
+
+ if ( result == 0 )
+ {
+ return lFontMap;
+ }
+ }
+
+ return NULL;
+}
+
+// --------------------------------------------------------------------------
+// TBool CSvgDocumentImpl::RemoveReferenceFromFontL( const TDesC& aFontName )
+// returns True if there aren't any left
+// returns False if there are references to that Font left
+// ---------------------------------------------------------------------------
+TBool CSvgFontHashMap::RemoveReferenceFromFontL( const TDesC& aFontFamilyName )
+ {
+
+ CSvgFontMapItem* lFontMapItem = GetFontMapItem( aFontFamilyName );
+
+ if (lFontMapItem != NULL)
+ {
+ //we have this lFontMapElement
+ TInt aReferenceCount = lFontMapItem->DecrementReferenceCount();
+
+ if (aReferenceCount <= 0)
+ {
+ //no more references to this Font remove it from the map
+ iSvgFontMapItems.Remove(iSvgFontMapItems.Find(lFontMapItem));
+ delete lFontMapItem;
+ return ETrue;
+ }
+ }
+
+ return EFalse;
+ }
+
+// --------------------------------------------------------------------------
+// START OF EXTERNAL SVG FONT DOCUMENT METHODS
+// --------------------------------------------------------------------------
+// TBool CSvgFontHashMap::AddFontDocument(CSvgDocumentImpl* newFontDocument, const TDesC& aFontFamily)
+// ---------------------------------------------------------------------------
+TBool CSvgFontHashMap::AddFontDocument(CSvgDocumentImpl* aFontDocument, const TDesC& aFontFamily)
+{
+ if (aFontDocument == NULL)
+ {
+ //no document passed in
+ return EFalse;
+ }
+
+ CSvgElementImpl* myFontElement = (CSvgElementImpl*)GetFontPtr(aFontFamily);
+
+ if (myFontElement == NULL)
+ {
+ //no font in of this name in map so we can't add its document handle
+ return EFalse;
+ }
+
+ if ( !HasFontDocument(aFontDocument) )
+ {
+ //then add it to the list of font documents
+ iFontDocumentPointers.Append(aFontDocument);
+
+ //and add it to the current document's font map
+ TInt errorcode = KErrNone;
+ TRAP(errorcode, AddFontL((CSvgFontElementImpl*)myFontElement, aFontFamily));
+
+ return ETrue;
+ }
+
+ return EFalse;
+}
+
+// --------------------------------------------------------------------------
+// void CSvgFontHashMap::DeleteFontDocument(const TDesC& aFontFamily)
+// ---------------------------------------------------------------------------
+void CSvgFontHashMap::DeleteFontDocument(const TDesC& aFontFamily)
+{
+ CSvgElementImpl* myFontElement = NULL;
+
+ TInt fontDocPointersCnt = iFontDocumentPointers.Count();
+ for (TInt i=0; i < fontDocPointersCnt; i++)
+ {
+ CSvgDocumentImpl* myDoc = (CSvgDocumentImpl*)iFontDocumentPointers[i];
+
+ myFontElement = (CSvgElementImpl*)GetFontPtr(aFontFamily);
+
+ if (myFontElement != NULL)
+ {
+ iFontDocumentPointers.Remove(i);
+ TInt error = KErrNone;
+ TRAP(error,RemoveReferenceFromFontL(aFontFamily));
+ if (myDoc)
+ {
+ delete myDoc;
+ myDoc = NULL;
+ }
+ }
+ }
+}
+
+// --------------------------------------------------------------------------
+// TBool CSvgFontHashMap::HasFontDocument(CSvgDocumentImpl* myDoc)
+// ---------------------------------------------------------------------------
+TBool CSvgFontHashMap::HasFontDocument(CSvgDocumentImpl* myDoc)
+{
+ //check to see if we have this document pointer already
+ TBool hasFontPointer = EFalse;
+
+ TInt fontDocPointersCnt = iFontDocumentPointers.Count();
+ for (TInt i=0; i < fontDocPointersCnt; i++)
+ {
+ if ((CSvgDocumentImpl*)iFontDocumentPointers[i] == myDoc)
+ {
+ hasFontPointer = ETrue;
+ }
+ }
+
+ return hasFontPointer;
+}
+
+// --------------------------------------------------------------------------
+//END OF EXTERNAL SVG FONT DOCUMENT
+// --------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------
+// void CSvgFontHashMap::PrintFontHashMap( )
+// ---------------------------------------------------------------------------
+void CSvgFontHashMap::PrintFontHashMap()
+{
+ RDebug::Printf("----Font Hash Map----\n");
+ TInt svgFontMapItemsCnt = iSvgFontMapItems.Count();
+ for (TInt i=0; i< svgFontMapItemsCnt; i++)
+ {
+ CSvgFontMapItem* lFontMapItem = iSvgFontMapItems[i];
+
+ if(lFontMapItem)
+ {
+ lFontMapItem->Print();
+ }
+ }
+}
+
+// --------------------------------------------------------------------------
+// CFbsBitmap* CSvgDocumentImpl::GetFontPtr( const TDesC& aFontName )
+// ---------------------------------------------------------------------------
+CSvgFontElementImpl* CSvgFontHashMap::GetFontPtr( const TDesC& aFontFamilyName )
+ {
+
+ CSvgFontMapItem* lFontMapItem = GetFontMapItem( aFontFamilyName );
+
+ if (lFontMapItem)
+ {
+ return (lFontMapItem->GetFontPtr());
+ }
+
+ return NULL;
+
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgFontMapItem* CSvgFontMapItem::NewL()
+ {
+ CSvgFontMapItem* self = new ( ELeave ) CSvgFontMapItem;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgFontMapItem* CSvgFontMapItem::NewLC()
+ {
+ CSvgFontMapItem* self = new ( ELeave ) CSvgFontMapItem;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgFontMapItem::ConstructL()
+ {
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgFontMapItem::CSvgFontMapItem()
+ {
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgFontMapItem::~CSvgFontMapItem()
+ {
+ if (iFontFamilyName)
+ {
+ delete iFontFamilyName;
+ iFontFamilyName = NULL;
+ }
+ /*if (iFontPtr)
+ {
+ delete iFontPtr;
+ }
+ if (iFontDocumentPtr)
+ {
+ delete iFontDocumentPtr;
+ }*/
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgFontElementImpl* CSvgFontMapItem::GetFontPtr()
+ {
+ return iFontPtr;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TDesC& CSvgFontMapItem::GetFontFamilyName()
+ {
+ return ( const TDesC & ) *iFontFamilyName;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgFontMapItem::SetFontPtr( CSvgFontElementImpl* aFontPtr )
+ {
+ iFontPtr = aFontPtr;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgFontMapItem::CopyFontFamilyName( const TDesC& aFontFamilyName )
+ {
+ if (iFontFamilyName)
+ {
+ delete iFontFamilyName;
+ iFontFamilyName = NULL;
+ }
+
+ iFontFamilyName = aFontFamilyName.Alloc();
+ }
+
+//-----------------------------------------------------------------------
+//
+//-----------------------------------------------------------------------
+TInt CSvgFontMapItem::IncrementReferenceCount( )
+ {
+ iFontReferenceCount++;
+ return iFontReferenceCount;
+ }
+
+//-----------------------------------------------------------------------
+//
+//-----------------------------------------------------------------------
+TInt CSvgFontMapItem::DecrementReferenceCount()
+ {
+ iFontReferenceCount--;
+ return iFontReferenceCount;
+ }
+
+//-----------------------------------------------------------------------
+//
+//-----------------------------------------------------------------------
+void CSvgFontMapItem::Print()
+{
+ RDebug::RawPrint(iFontFamilyName->Des());
+ RDebug::Printf("ref_count = %d fontptr = %d fontdocptr = %d \n", iFontReferenceCount, iFontPtr, iFontDocumentPtr);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGForeignObjectElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,340 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "SVGForeignObjectElementImpl.h"
+#include "SVGElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+
+#include "GfxAffineTransform.h"
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgForeignObjectElementImpl* CSvgForeignObjectElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgForeignObjectElementImpl* self = new ( ELeave )
+ CSvgForeignObjectElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgForeignObjectElementImpl* CSvgForeignObjectElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgForeignObjectElementImpl* self = new ( ELeave )
+ CSvgForeignObjectElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgForeignObjectElementImpl::CSvgForeignObjectElementImpl( CSvgDocumentImpl* aDoc )
+ {
+ SetOwnerDocument(aDoc);
+ iReqAttrFlag = KAtrSVGRec;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgForeignObjectElementImpl::~CSvgForeignObjectElementImpl()
+ {
+ iReqAttrFlag = KAtrSVGRec;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgForeignObjectElementImpl::X()
+{
+ return iX;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgForeignObjectElementImpl::Y()
+{
+ return iY;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgForeignObjectElementImpl::Width()
+{
+ return iWidth;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgForeignObjectElementImpl::Height()
+{
+ return iHeight;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgForeignObjectElementImpl::SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue )
+{
+ switch ( aNameId )
+ {
+ case KAtrX:
+ iX = aValue;
+ break;
+ case KAtrY:
+ iY = aValue;
+ break;
+
+ case KAtrWidth:
+ iWidth = aValue;
+ if(iReqAttrFlag == KAtrSVGRec)
+ {
+ iReqAttrFlag = KAtrHeight;
+ }
+ else
+ {
+ iReqAttrFlag = 0;
+ }
+ break;
+ case KAtrHeight:
+ iHeight = aValue;
+ if(iReqAttrFlag == KAtrSVGRec)
+ {
+ iReqAttrFlag = KAtrWidth;
+ }
+ else
+ {
+ iReqAttrFlag = 0;
+ }
+ break;
+ default:
+ return CSvgElementImpl::SetAttributeFloatL( aNameId, aValue );
+ }
+ return KErrNone;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgForeignObjectElementImpl::SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue )
+{
+ switch ( aNameId )
+ {
+ case KAtrCdata:
+ SetCdataL( aValue );
+ break;
+
+ default:
+ return CSvgElementImpl::SetAttributeDesL( aNameId, aValue );
+ }
+ return KErrNone;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgForeignObjectElementImpl::SetCdataL( const TDesC& aCdata )
+{
+ if ( iCdata )
+ {
+ delete iCdata;
+ iCdata = NULL;
+ }
+
+ iCdata = aCdata.AllocL();
+
+}
+
+// *******************************************************
+// From MXmlElement
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgForeignObjectElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+
+ if ( this->SetLangSpaceAttributeL( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+ if ( this->SetTransform( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+
+ if ( this->SetTestAttributeL( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+
+ if ( SetIdandXmlbaseL( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+
+ return KErrNone;
+ }
+
+// *******************************************************
+// From CSvgElementImpl
+
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgForeignObjectElementImpl::CloneL(MXmlElement*)
+ {
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgForeignObjectElementImpl::DrawL( CGfx2dGc* /* aGc */,
+ CSvgElementImpl* /* aElement */ )
+ {
+ return EFalse;
+ }
+
+
+// *******************************************************
+// Private
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgForeignObjectElementImpl::ConstructL( const TUint8 aElemID )
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+ }
+
+/*** FROM MSvgMouseListener ***/
+// ---------------------------------------------------------------------------
+// mouse entered
+// ---------------------------------------------------------------------------
+TBool CSvgForeignObjectElementImpl::MouseEntered( RPointerArray<CSvgElementImpl>& /*aElements*/,
+ TInt /*aX*/, TInt /*aY*/ )
+{
+ /*CSvgEngineImpl* aEngine = ( ( CSvgDocumentImpl* ) OwnerDocument() )->Engine();
+
+ for (TInt i = 0; i < aElements.Count(); i++ )
+ {
+ if ( aElements[i] == this )
+ {
+ aEngine->NotifyHyperlinkEntered(this);
+ return ETrue;
+ }
+ }*/
+
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+// Notified when the mouse pointer exits a visible svg element.
+// ---------------------------------------------------------------------------
+TBool CSvgForeignObjectElementImpl::MouseExited( RPointerArray<CSvgElementImpl>& /*aElements*/,
+ TInt /*aX*/, TInt /*aY*/ )
+{
+ /*CSvgEngineImpl* aEngine = ( ( CSvgDocumentImpl* ) OwnerDocument() )->Engine();
+
+ for (TInt i = 0; i < aElements.Count(); i++ )
+ {
+ if ( aElements[i] == this )
+ {
+ aEngine->NotifyHyperlinkExited(this);
+ return ETrue;
+ }
+ }*/
+
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+// Notified when the mouse pointer is pressed down on visible svg element.
+// ---------------------------------------------------------------------------
+TBool CSvgForeignObjectElementImpl::MouseMoved( RPointerArray<CSvgElementImpl>& /*aElements*/,
+ TInt /*aX*/, TInt /*aY*/ )
+{
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+// Notified when the mouse pointer is pressed down on visible svg element.
+// ---------------------------------------------------------------------------
+TBool CSvgForeignObjectElementImpl::MousePressed( RPointerArray<CSvgElementImpl>& /*aElements*/,
+ TInt /*aX*/, TInt /*aY*/ )
+{
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+// Notified when the mouse pointer is released on on visible svg element.
+// ---------------------------------------------------------------------------
+TBool CSvgForeignObjectElementImpl::MouseReleased( RPointerArray<CSvgElementImpl>& /*aElements*/,
+ TInt /*aX*/, TInt /*aY*/ )
+{
+ /*CSvgEngineImpl* aEngine = ( ( CSvgDocumentImpl* ) OwnerDocument() )->Engine();
+
+ for (TInt i = 0; i < aElements.Count(); i++ )
+ {
+ if ( aElements[i] == this )
+ {
+ aEngine->NotifyHyperlinkActivated(this);
+ return ETrue;
+ }
+ }*/
+
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgForeignObjectElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<foreignObject x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\">", (int)X(), (int)Y(), (int)Width(), (int)Height());
+ RDebug::Printf("</foreignObject>");
+ #endif
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGGElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,476 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "SVGGElementImpl.h"
+#include "SVGElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+
+#include "GfxAffineTransform.h"
+
+#include "SVGUseElementImpl.h"
+_LIT(DISPLAY, "display");
+_LIT(NONE, "none");
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgGElementImpl* CSvgGElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgGElementImpl* self = new ( ELeave ) CSvgGElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgGElementImpl* CSvgGElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgGElementImpl* self = new ( ELeave ) CSvgGElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgGElementImpl::~CSvgGElementImpl()
+ {
+ if ( iSvgStyleProperties )
+ {
+ iSvgStyleProperties->Close();
+ delete iSvgStyleProperties;
+ iSvgStyleProperties = NULL;
+ }
+
+ }
+
+
+// Private
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+void CSvgGElementImpl::ConstructL( const TUint8 aElemID )
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+
+ iSvgStyleProperties = new(ELeave) RPointerArray<CCssValue>(KCSS_MAX_ATTR);
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+iSvgStyleProperties->Remove( 0 );
+
+ iSvgTransformable = CSvgTransformableImpl::NewL();
+
+ if (this->ElemID() >= KSvgAllGElemsSubStartIndex &&
+ this->ElemID() <= KSvgAllGElemsEndIndex )
+ {
+ // Set display to "none"
+ // Otherwise it will be rendered
+ SetAttributeL(DISPLAY, NONE);
+ }
+ }
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+CSvgGElementImpl::CSvgGElementImpl( CSvgDocumentImpl* aDoc )
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+
+// *******************************************************
+// From MXmlElement
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgGElementImpl::SetAttributeL( const TDesC& aName, const TDesC& aValue )
+ {
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+ return KErrNone;
+ }
+
+
+// From MXmlElementOpt
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgGElementImpl::GetAttributeFloat( const TInt aNameId, TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrRefX:
+ {
+ TFloatFixPt xmin( KMAXFLOATFIX ), x; // 0x7fff is the maximum integer in TFixPt
+ CSvgElementImpl*lNewElement = ( CSvgElementImpl* ) FirstChild();
+ while ( lNewElement != NULL )
+ {
+ lNewElement->GetAttributeFloat( KAtrRefX, x );
+ if ( x < xmin )
+ xmin = x;
+ lNewElement = ( CSvgElementImpl * )
+ lNewElement->NextSibling();
+ }
+ aValue = xmin;
+ }
+ break;
+ case KAtrRefY:
+ {
+ TFloatFixPt ymin( KMAXFLOATFIX ), y; // 0x7fff is the maximum integer in TFixPt
+ CSvgElementImpl*lNewElement = ( CSvgElementImpl* ) FirstChild();
+ while ( lNewElement != NULL )
+ {
+ lNewElement->GetAttributeFloat( KAtrRefY, y );
+ if ( y < ymin )
+ ymin = y;
+ lNewElement = ( CSvgElementImpl * )
+ lNewElement->NextSibling();
+ }
+ aValue = ymin;
+ }
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+// *******************************************************
+// From CSvgElementImpl
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgGElementImpl::DrawL( CGfx2dGc* /* aGc */,
+ CSvgElementImpl* /* aElement */ )
+ {
+
+ if ( this->ElemID() >= KSvgAllGElemsStartIndex &&
+ this->ElemID() <= KSvgAllGElemsEndIndex
+ )
+
+
+ {
+ return EFalse;
+ }
+ else
+ {
+ return ETrue;
+ }
+
+ }
+
+
+// *******************************************************
+// Utilities
+// Get group bounding box
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgGElementImpl::GetGroupBounding( TGfxRectangle2D& aBbox,
+ CSvgElementImpl* aStartElement )
+ {
+ TFloatFixPt xMin( KMAXFLOATFIX ), yMin( KMAXFLOATFIX ), xMax( KMINFLOATFIX ), yMax( KMINFLOATFIX );
+
+ GetGroupBoundingInternal( xMin, yMin, xMax, yMax, aStartElement );
+ aBbox.iX = xMin;
+ aBbox.iY = yMin;
+ aBbox.iWidth = xMax - xMin;
+ aBbox.iHeight = yMax - yMin;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgGElementImpl::GetGroupBoundingInternal( TFloatFixPt& aXmin,
+ TFloatFixPt& aYmin,
+ TFloatFixPt& aXmax,
+ TFloatFixPt& aYmax,
+ CSvgElementImpl* aStartElement )
+ {
+ TInt position= aStartElement->ElemID();
+ if( position > KSvgNoBoundBoxElemsEndIndex )
+
+ {
+ TFloatFixPt zero ( 0 );
+ TGfxRectangle2D bbox;
+ TInt32 displayValue;
+ aStartElement->GetBBox( bbox );
+
+ TRAP_IGNORE( aStartElement->GetAttributeIntL( KCSS_ATTR_DISPLAY, displayValue ) );
+
+ // Ignore area-less elements and dispay="none" elements
+ if ( (bbox.iWidth > zero || bbox.iHeight > zero) && displayValue != KDisplayEnumNone)
+ {
+ if ( bbox.iX < aXmin )
+ aXmin = bbox.iX;
+ if ( bbox.iY < aYmin )
+ aYmin = bbox.iY;
+ if ( bbox.iX + bbox.iWidth > aXmax )
+ aXmax = bbox.iX + bbox.iWidth;
+ if ( bbox.iY + bbox.iHeight > aYmax )
+ aYmax = bbox.iY + bbox.iHeight;
+ }
+ }
+
+ CSvgElementImpl*element = ( CSvgElementImpl* )
+ aStartElement->FirstChild();
+ while ( element != NULL )
+ {
+ GetGroupBoundingInternal( aXmin, aYmin, aXmax, aYmax, element );
+ element = ( CSvgElementImpl * ) element->NextSibling();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgGElementImpl::GetGroupBoundingUnscaled( TGfxRectangle2D& aBbox,
+ CSvgElementImpl* aStartElement )
+ {
+ TFloatFixPt xMin( KMAXFLOATFIX ), yMin( KMAXFLOATFIX ), xMax( KMINFLOATFIX ), yMax( KMINFLOATFIX );
+
+ GetGroupBoundingInternalUnscaled( xMin, yMin, xMax, yMax, aStartElement );
+ aBbox.iX = xMin;
+ aBbox.iY = yMin;
+ aBbox.iWidth = xMax - xMin;
+ aBbox.iHeight = yMax - yMin;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgGElementImpl::GetGroupBoundingInternalUnscaled( TFloatFixPt& aXmin,
+ TFloatFixPt& aYmin,
+ TFloatFixPt& aXmax,
+ TFloatFixPt& aYmax,
+ CSvgElementImpl* aStartElement )
+{
+ TInt position= aStartElement->ElemID();
+ if( position > KSvgNoBoundBoxElemsEndIndex )
+
+ {
+ TFloatFixPt zero ( 0 );
+ TGfxRectangle2D bbox;
+ TInt32 displayValue;
+
+ //solving the case where a <g><rect transform="translate(10,10)"></g>
+ //the rect elements transform must be reflected on the G
+ //but we dont want the scaled bbox of the rect with the entire CTM scaling
+
+ if( aStartElement->IsTransformable() )
+ {
+ MSvgTransformList* trList;
+
+ TGfxAffineTransform lElementTransform;
+
+ aStartElement->GetTransform( trList );
+ lElementTransform = trList->Consolidate( aStartElement->IsOverwriteTransforms() );
+
+ TGfxAffineTransform lTempCTM = aStartElement->GetCTM();
+
+ //use only the transform on the child element and not the entire CTM
+ aStartElement->SetCTM( lElementTransform );
+ if (KSvgUseElement == (( CSvgElementImpl* )aStartElement)->ElemID())
+ {
+ ((CSvgUseElementImpl*)aStartElement)->GetBoundingBox( bbox);
+ }
+ else
+ aStartElement->GetBBox( bbox );
+
+ //set the original entire CTM back on to the element
+ aStartElement->SetCTM(lTempCTM);
+
+ }
+
+ TRAP_IGNORE( aStartElement->GetAttributeIntL( KCSS_ATTR_DISPLAY, displayValue ) );
+
+ //TBool iDisplayNoneFlag = aStartElement->IsInherited(KCSS_ATTR_DISPLAY);
+ // if the display attribute is inherited, consider it for bounding box calculation
+ if ( (bbox.iWidth > zero || bbox.iHeight > zero) && ( displayValue != KDisplayEnumNone ) ) // Ignore area-less elements
+ {
+ if ( bbox.iX < aXmin )
+ aXmin = bbox.iX;
+ if ( bbox.iY < aYmin )
+ aYmin = bbox.iY;
+ if ( bbox.iX + bbox.iWidth > aXmax )
+ aXmax = bbox.iX + bbox.iWidth;
+ if ( bbox.iY + bbox.iHeight > aYmax )
+ aYmax = bbox.iY + bbox.iHeight;
+ }
+ }
+ if (KSvgUseElement == (( CSvgElementImpl* )aStartElement)->ElemID())
+ return;
+
+ CSvgElementImpl*element = ( CSvgElementImpl* )
+ aStartElement->FirstChild();
+ TFloatFixPt tempXMin ;
+ TFloatFixPt tempYMin ;
+ TFloatFixPt tempXMax ;
+ TFloatFixPt tempYMax ;
+
+ while ( element != NULL )
+ {
+
+ //Apply group level transformation if the group is not the original element.
+ if( KSvgGElement == element->ElemID() )
+ {
+ TFloatFixPt xMin( KMAXFLOATFIX ), yMin( KMAXFLOATFIX ), xMax( KMINFLOATFIX ), yMax( KMINFLOATFIX );
+
+ tempXMin = KMAXFLOATFIX ;
+ tempYMin = KMAXFLOATFIX ;
+ tempXMax = KMINFLOATFIX ;
+ tempYMax = KMINFLOATFIX ;
+
+ GetGroupBoundingInternalUnscaled( tempXMin, tempYMin, tempXMax, tempYMax, element );
+ if((tempXMax > tempXMin)&&(tempYMax > tempYMin))
+ {
+ TGfxRectangle2D rect(tempXMin, tempYMin, tempXMax - tempXMin, tempYMax - tempYMin);
+
+ MSvgTransformList* trList;
+
+ TGfxAffineTransform lElementTransform;
+
+ element->GetTransform( trList );
+ lElementTransform = trList->Consolidate( element->IsOverwriteTransforms() );
+
+ rect.GetBounds(lElementTransform, rect);
+
+ tempXMin = rect.iX ;
+ tempYMin = rect.iY ;
+ tempXMax = rect.iX + rect.iWidth ;
+ tempYMax = rect.iY + rect.iHeight ;
+
+ if( tempXMin < aXmin )
+ aXmin = tempXMin ;
+ if( tempYMin < aYmin )
+ aYmin = tempYMin ;
+ if( tempXMax > aXmax )
+ aXmax = tempXMax ;
+ if( tempYMax > aYmax )
+ aYmax = tempYMax ;
+ }
+ }
+ else
+ {
+ GetGroupBoundingInternalUnscaled( aXmin, aYmin, aXmax, aYmax, element );
+ }
+
+ element = ( CSvgElementImpl * ) element->NextSibling();
+ }
+
+}
+
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgGElementImpl::CloneL(MXmlElement* aParentElement)
+ {
+ // create new g element
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+ CSvgGElementImpl* newElement = CSvgGElementImpl::NewL( this->ElemID(), ((CSvgDocumentImpl*)iOwnerDocument) );
+
+
+ CleanupStack::PushL(newElement);
+ newElement->iParentNode = aParentElement;
+
+ // copy everything over
+ this->CopyL(newElement);
+ CleanupStack::Pop();
+ return newElement;
+ }
+
+// perform a deep copy of this object
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgGElementImpl::CopyL( CSvgGElementImpl* aDestElement )
+ {
+ if(aDestElement)
+ {
+ // copy stuff from superclass
+ this->CSvgElementImpl::CopyL(aDestElement);
+ // copy the reference to idoc (CSvgDocumentImpl)
+ aDestElement->iOwnerDocument = this->iOwnerDocument;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgGElementImpl::GetBBox( TGfxRectangle2D& aBbox )
+ {
+
+ // if there are not any children then the bbox should be NULL
+ if (!HasChildNodes())
+ {
+ return;
+ }
+
+ CSvgGElementImpl::GetGroupBounding( aBbox, this );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgGElementImpl::GetUnscaledBBox( TGfxRectangle2D& aBbox )
+ {
+
+ // if there are not any children then the bbox should be NULL
+ if (!HasChildNodes())
+ {
+ return;
+ }
+
+ CSvgGElementImpl::GetGroupBoundingUnscaled( aBbox, this );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgGElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<g>");
+ #endif
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGGlyphElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,483 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "SVGGlyphElementImpl.h"
+#include "SVGElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+#include "SVGPathDataParser.h"
+#include "SVGPathElementImpl.h"
+
+#include "GfxAffineTransform.h"
+
+#ifdef SVG_FONTS_INCLUDE
+
+_LIT( SPACE, " " );
+_LIT( D, "d" );
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgGlyphElementImpl* CSvgGlyphElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgGlyphElementImpl* self = new ( ELeave )
+ CSvgGlyphElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID);
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgGlyphElementImpl* CSvgGlyphElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgGlyphElementImpl* self = new ( ELeave )
+ CSvgGlyphElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID);
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgGlyphElementImpl::ConstructL( const TUint8 aElemID )
+ {
+
+ CSvgElementImpl::InitializeL( aElemID);
+
+ iOwnedPath = EFalse;
+ iUnicode = HBufC::NewL( 2 );
+ *iUnicode = SPACE;
+ iGlyphName = HBufC::NewL( 0 );
+ iLangCode = HBufC::NewL( 0 );
+ iShape = CGfxGeneralPath::NewL();
+ #ifdef SVG_FLOAT_BUILD
+ iHorzAdvX = TFloatFixPt( 0 );
+ #else
+ iHorzAdvX = TFloatFixPt( 0 , ETrue);
+ #endif
+
+ iSvgStyleProperties = new(ELeave) RPointerArray<CCssValue>(KCSS_MAX_ATTR);
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+iSvgStyleProperties->Remove( 0 );
+
+
+ }
+
+
+
+
+
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+
+CSvgGlyphElementImpl::CSvgGlyphElementImpl( CSvgDocumentImpl* aDoc )
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgGlyphElementImpl::~CSvgGlyphElementImpl()
+ {
+ if ( iUnicode )
+ {
+ delete iUnicode;
+ iUnicode = NULL;
+ }
+
+ if ( iGlyphName )
+ {
+ delete iGlyphName;
+ iGlyphName = NULL;
+ }
+
+ if ( iLangCode )
+ {
+ delete iLangCode;
+ iLangCode = NULL;
+ }
+
+ if ( iShape )
+ {
+ CSvgElementImpl* aChild = (CSvgElementImpl*)FirstChild();
+ if (!(aChild && aChild->ElemID() == KSvgPathElement))
+ {
+ delete iShape;
+ iShape = NULL;
+ }
+ else if ( iOwnedPath )
+ {
+ delete iShape;
+ }
+ iShape = NULL;
+ }
+
+ if ( iSvgStyleProperties )
+ {
+ iSvgStyleProperties->Close();
+ delete iSvgStyleProperties;
+ iSvgStyleProperties = NULL;
+ }
+
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgGlyphElementImpl::GetBBox( TGfxRectangle2D& aBbox )
+ {
+ iShape->GetBounds( GetCTM(), aBbox );
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgGlyphElementImpl::GetUnscaledBBox( TGfxRectangle2D& aBbox )
+ {
+ TGfxAffineTransform identityTx;
+ iShape->GetBounds( identityTx, aBbox );
+ }
+
+// *******************************************************
+// From SVG DOM
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgGlyphElementImpl::GetUnicode( TDes& aUnicode )
+ {
+ aUnicode = iUnicode->Des();
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TFloatFixPt CSvgGlyphElementImpl::GetHorzAdvX()
+ {
+ return iHorzAdvX;
+ }
+
+
+// *******************************************************
+// SVG Implementation
+
+
+
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgGlyphElementImpl::SetPath( const TDesC& aPath )
+ {
+ TSvgPathDataParser::ParsePathData( aPath, iShape );
+ }
+
+
+// *******************************************************
+// From MXmlElementOpt
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgGlyphElementImpl::GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrRefX:
+ aValue = iShape->PointCoordsArray()[0];
+ break;
+ case KAtrRefY:
+ aValue = iShape->PointCoordsArray()[1];
+ break;
+ case KAtrHorizAdvX:
+ aValue = GetHorzAdvX();
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgGlyphElementImpl::GetAttributePath( const TInt aNameId,
+ CGfxGeneralPath*& aValue )
+ {
+ if ( aNameId == KAtrData )
+ {
+ aValue = iShape;
+ }
+ else
+ {
+ aValue = NULL;
+ return KErrNoAttribute;
+ }
+
+ return KErrNone;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgGlyphElementImpl::SetAttributePathL( const TInt aNameId,
+ CGfxGeneralPath* /* aValue */ )
+ {
+ if ( aNameId == KAtrData )
+ {
+ }
+ else
+ {
+ return KErrNoAttribute;
+ }
+
+ return KErrNone;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgGlyphElementImpl::SetAttributePathRef( const TInt aNameId,
+ CGfxGeneralPath*& aValue )
+ {
+ if ( aNameId == KAtrData )
+ {
+ if(iShape)
+ {
+ delete iShape;
+ iShape= NULL;
+ }
+ iShape= aValue;
+
+ }
+ else
+ {
+ return KErrNoAttribute;
+ }
+
+ return KErrNone;
+ }
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgGlyphElementImpl::GetAttributeDes( const TInt aNameId, TPtrC16& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrUnicode:
+ if ( iUnicode->Length() > 0 )
+ {
+ aValue.Set( *iUnicode );
+ break;
+ }
+ else
+ return KErrNoAttribute;
+
+ case KAtrGlyphName:
+ if ( iGlyphName->Length() > 0 )
+ {
+ aValue.Set( *iGlyphName );
+ break;
+ }
+ else
+ return KErrNoAttribute;
+
+ case KAtrLang:
+ if ( iLangCode->Length() > 0 )
+ {
+ aValue.Set( *iLangCode );
+ break;
+ }
+ else
+ return KErrNoAttribute;
+
+ default:
+ return CSvgElementImpl::GetAttributeDes( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+// *******************************************************
+// From MXmlElement
+
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgGlyphElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+ if( aName == D )
+ {
+ SetPath (aValue);
+ iOwnedPath = ETrue;
+ }
+ return KErrNone;
+ }
+
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgGlyphElementImpl::SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue )
+ {
+ if( aNameId == KAtrHorizAdvX )
+ {
+ iHorzAdvX = aValue;
+ }
+ else return CSvgElementImpl::SetAttributeFloatL( aNameId, aValue );
+ return KErrNone;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgGlyphElementImpl::SetAttributeDesL( const TInt aNameId, const TDesC& aValue )
+{
+ switch (aNameId)
+ {
+ case KAtrUnicode:
+ delete iUnicode;
+ iUnicode = NULL;
+ iUnicode = aValue.AllocL();
+ //iUnicode->Des().ZeroTerminate();
+ break;
+ case KAtrGlyphName:
+ delete iGlyphName;
+ iGlyphName = NULL;
+ iGlyphName = aValue.AllocL();
+ break;
+ case KAtrLang:
+ delete iLangCode;
+ iLangCode = NULL;
+ iLangCode = aValue.AllocL();
+ break;
+
+ default: return CSvgElementImpl::SetAttributeDesL( aNameId, aValue );
+
+ }
+ return KErrNone;
+}
+
+
+// *******************************************************
+// From CSvgElementImpl
+
+// perform a deep clone of this object
+// ==========================================================================
+// Need method description
+// ==========================================================================
+MXmlElement* CSvgGlyphElementImpl::CloneL(MXmlElement*)
+ {
+ return NULL;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TBool CSvgGlyphElementImpl::DrawL( CGfx2dGc* /* aGc */,
+ CSvgElementImpl* /* aElement */ )
+ {
+ return EFalse;
+ }
+
+
+// *******************************************************
+// Private
+
+CGfxGeneralPath* CSvgGlyphElementImpl::GetPathAttribute(TInt aAttributeId)
+ {
+ if(aAttributeId == KAtrD)
+ {
+ return iShape;
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+void CSvgGlyphElementImpl::SetPathAttribute(TInt aAttributeId, CGfxGeneralPath* aPathHandle)
+{
+ if(aAttributeId == KAtrD)
+ {
+ if(iShape == aPathHandle)
+ {
+ return;
+ }
+ delete iShape;
+ iShape = aPathHandle;
+ }
+}
+
+void CSvgGlyphElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ if (iGlyphName)
+ {
+ RDebug::Printf("<glyph name=\"%s\" unicode=\"%d\" lang=\"%d\" horiz-adv-x=\"%d\" >",
+ iGlyphName, (int)iUnicode, (int)iLangCode, (int)iHorzAdvX);
+
+ if (iShape)
+ {
+ RArray<TUint32>* lTypes = iShape->PointTypeArray();
+ RArray<TFloatFixPt>* lCoords = iShape->PointCoordsArrayAll();
+
+ if (lTypes->Count() != lCoords->Count())
+ {
+ RDebug::Printf("Invalid path points and types didnt match", this);
+ return;
+ }
+
+ RDebug::Printf("<path d=\"", this);
+
+ TInt lTypesCnt = lTypes->Count();
+ for (TInt i=0; i < lTypesCnt; i++)
+ {
+ RDebug::Printf("%c ", lTypes->operator[]( i ));
+ RDebug::Printf("%d ", (int)(lCoords->operator[]( i )));
+ }
+
+ RDebug::Printf(" z\">", this);
+ }
+
+ RDebug::Printf("</glyph>", this);
+ }
+ #endif
+ }
+}
+#endif //ifdef SVG_FONTS_INCLUDE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGGradientElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,247 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include "SVGGradientElementImpl.h"
+#include "SVGDocumentImpl.h"
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgGradientElementImpl::CSvgGradientElementImpl( CSvgDocumentImpl* aDoc )
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgGradientElementImpl::ConstructL(const TUint8 aElemID)
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+
+ iSvgStyleProperties = new(ELeave) RPointerArray<CCssValue>(KCSS_MAX_ATTR);
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+ iSvgStyleProperties->Remove( 0 );
+ iSvgUriReferenceImpl = CSvgUriReferenceImpl::NewL();
+
+ iSvgTransformable = CSvgTransformableImpl::NewL();
+ iSvgStopElementArray = new( ELeave ) RPointerArray<CSvgStopElementImpl> ( 1 );
+
+ iStopElementData = new(ELeave) RArray<TSvgStopData> (1);
+ iStopElementData->Reset();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgGradientElementImpl::~CSvgGradientElementImpl()
+ {
+ if(iSvgStopElementArray)
+ {
+ iSvgStopElementArray->Close();
+ delete iSvgStopElementArray;
+ iSvgStopElementArray = NULL;
+ }
+
+ if ( iSvgStyleProperties )
+ {
+ iSvgStyleProperties->Close();
+ delete iSvgStyleProperties;
+ iSvgStyleProperties = NULL;
+ }
+
+ if ( iSvgUriReferenceImpl )
+ {
+ delete iSvgUriReferenceImpl;
+ iSvgUriReferenceImpl = NULL;
+ }
+
+ if(iStopElementData)
+ {
+ iStopElementData->Close();
+ delete iStopElementData;
+ iStopElementData = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgGradientElementImpl::SetAttributeL( const TDesC& aName,const TDesC& aValue )
+ {
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+
+ if(aName==_L("gradientUnits")||aName==_L("patternUnits"))
+ {
+ if(aValue==_L("userSpaceOnUse"))
+ iGradientPaint->iGradientUnits = KuserSpaceOnUse;
+ else if(aValue==_L("objectBoundingBox"))
+ iGradientPaint->iGradientUnits = KobjectBoundingBox;
+ }
+ else if(aName==_L("spreadMethod"))
+ {
+ if(aValue==_L("pad"))
+ iGradientPaint->iSpreadMethod = KspreadMethodPad;
+ else if(aValue==_L("reflect"))
+ iGradientPaint->iSpreadMethod = KspreadMethodReflect;
+ else if(aValue==_L("repeat"))
+ iGradientPaint->iSpreadMethod = KspreadMethodRepeat;
+ }
+ return KErrNone;
+ }
+
+TInt CSvgGradientElementImpl::SetAttributeIntL( const TInt aNameId,
+ const TInt32 aValue )
+{
+ if(aNameId == KAtrSpreadMethods)
+ {
+
+ iGradientPaint->iSpreadMethod = (TUint16) aValue;
+ }
+
+ else if(aNameId == KAtrGradientUnits)
+ {
+ iGradientPaint->iGradientUnits = (TUint16) aValue;
+ }
+
+ else
+ CSvgElementImpl::SetAttributeIntL (aNameId,aValue);
+ return 0;
+}
+TInt CSvgGradientElementImpl::GetAttributeIntL( const TInt aNameId, TInt32& aValue )
+{
+ if(aNameId == KAtrSpreadMethods)
+ {
+ aValue = iGradientPaint->iSpreadMethod ;
+ }
+
+ else if(aNameId == KAtrGradientUnits)
+ {
+ aValue = iGradientPaint->iGradientUnits ;
+ }
+
+ else
+ CSvgElementImpl::GetAttributeIntL (aNameId,aValue);
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// Adjusts the offset values of all the previously added elements such that
+// each gradient offset value is greater than the previous gradient stop's
+// offset value.
+// ---------------------------------------------------------------------------
+void CSvgGradientElementImpl::UpdateOffsetValues(CSvgStopElementImpl *aStopEl)
+{
+ TInt count = iSvgStopElementArray->Count();
+
+ if (count == 1)
+ {
+ return;
+ }
+
+ TFloatFixPt aNewOffset = aStopEl->iOffset;
+
+ //Since the Stop Element is already added, The loop runs for "count - 1" times.
+ for (TInt i=0; i < count - 1; i++)
+ {
+ TFloatFixPt OldOffset = iSvgStopElementArray->operator[](i)->iOffset;
+
+ if ( OldOffset >= aNewOffset )
+ {
+ //set this latter value up so it has at least as high a value as the
+ //previous stop offsets
+ aStopEl->iOffset = OldOffset;
+
+ if (aStopEl->iOffset == TFloatFixPt(0))
+ {
+ aStopEl->iOffset += TFloatFixPt(.001f);
+ }
+ else
+ {
+ //two stop offsets have the same value now so make the one before ever so slightly less
+ //the latter one will control the "overlap point"
+ OldOffset -= TFloatFixPt(.001f);
+ }
+
+ iSvgStopElementArray->operator[](i)->iOffset = OldOffset;
+ }
+ }
+
+}
+
+// ---------------------------------------------------------------------------
+// The function not only adds the element in Stop element array but also
+// adjusts the offset values of all the previously added elements such that
+// each gradient offset value is greater than the previous gradient stop's
+// offset value.
+// ---------------------------------------------------------------------------
+void CSvgGradientElementImpl::AddStopElementInArray(CSvgStopElementImpl *aStopEl)
+ {
+
+ TBool lFound = EFalse;
+
+ TInt err = iSvgStopElementArray->Find(aStopEl);
+
+ if( err != KErrNotFound )
+ {
+ lFound = ETrue;
+ }
+
+ if(!lFound)
+ {
+ iSvgStopElementArray->Append(aStopEl);
+ UpdateOffsetValues(aStopEl);
+ }
+
+ }
+
+void CSvgGradientElementImpl::SetGradientTransMatrix(SVGReal aMatrix[2][3])
+ {
+ TGfxAffineTransform tempTransform;
+ MSvgTransformList* trList;
+ GetTransform( trList );
+ TGfxAffineTransform originalTransform = trList->GetItem( 0 );
+ tempTransform.iM00.iValue = aMatrix[0][0];
+ tempTransform.iM01.iValue = aMatrix[0][1];
+ tempTransform.iM02.iValue = aMatrix[0][2];
+ tempTransform.iM10.iValue = aMatrix[1][0];
+ tempTransform.iM11.iValue = aMatrix[1][1];
+ tempTransform.iM12.iValue = aMatrix[1][2];
+
+ TUint32 lTransType = KTransformIdentity;
+
+ TFloatFixPt KZero;
+ TFloatFixPt KOne( KFloatFixOne );
+ if ( tempTransform.iM02 != KZero || tempTransform.iM12 != KZero )
+ lTransType |= KTransformTranslate;
+
+ if ( tempTransform.iM00 != KZero || tempTransform.iM11 != KZero )
+ lTransType |= KTransformScale;
+
+ if ( tempTransform.iM01 != KZero || tempTransform.iM10 != KZero )
+ lTransType |= KTransformShear;
+
+ if ( (int)lTransType == KTransformScale &&
+ tempTransform.iM00 == KOne && tempTransform.iM11 == KOne )
+ lTransType = KTransformIdentity;
+
+ tempTransform.iTransType = lTransType;
+
+ originalTransform.Concatenate( tempTransform );
+ trList->ReplaceItem( originalTransform, 0 );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGImageElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,1543 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include "SVGImageElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGEngineImpl.h"
+#include "SVGSchemaData.h"
+
+#include "GfxAffineTransform.h"
+
+#include <imcvcodc.h>
+
+#include <caf/caf.h>
+
+const TInt KErrNoAttributeSet = -1;
+#define KSVGWAITFORIMAGEDOWNLOAD 1
+
+#define PERIODIC_DELAY 300000
+#define PERIODIC_INTERVAL 1000000
+
+_LIT( KSvg, ".svg" );
+_LIT( KSvgb, ".svgb" );
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgImageElementImpl* CSvgImageElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgImageElementImpl* self = new ( ELeave )
+ CSvgImageElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID, aDoc );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgImageElementImpl* CSvgImageElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgImageElementImpl* self = new ( ELeave )
+ CSvgImageElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID,aDoc );
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::ConstructL( const TUint8 aElemID,
+ CSvgDocumentImpl* /* aDoc */ )
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+
+
+ iUsedImage = EFalse;
+// iBitmap = new ( ELeave ) CFbsBitmap();
+ iReqAttrFlag=KSVG_IMAGE_ELEMFLAG;
+
+ iSvgStyleProperties = new(ELeave) RPointerArray<CCssValue>(KCSS_MAX_ATTR);
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+ iSvgStyleProperties->Remove( 0 );
+ iSvgTransformable = CSvgTransformableImpl::NewL();
+ iSvgUriReferenceImpl = CSvgUriReferenceImpl::NewL();
+
+ iBitmapLoadCalled = EFalse;
+
+ iImgRect.iHeight = TFloatFixPt(-1);
+ iImgRect.iWidth = TFloatFixPt(-1);
+
+ iIsBase64 = EFalse;
+ }
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgImageElementImpl::~CSvgImageElementImpl()
+ {
+ // Reset the notifiers first.
+ NotifyResetReference();
+
+ // Check whether there this element refers to an image element.
+ // This would be the case when use is used to refer to a parent
+ // image element.
+ if ( iRefElement )
+ {
+ iRefElement->RemoveImageElementListener( this );
+ iRefElement = NULL;
+ }
+
+ if ( iImageLoader )
+ {
+ delete iImageLoader;
+ iImageLoader = NULL;
+ }
+
+ if ( !iUsedImage )
+ {
+ delete iBitmap;
+ delete iMask;
+ }
+ if ( !iUsedImage && iPar )
+ {
+ if ( iPar )
+ {
+ delete iPar;
+ iPar = NULL;
+ }
+ }
+
+ if ( iImageData )
+ {
+ delete iImageData;
+ iImageData = NULL;
+ }
+
+ if ( iSvgUriReferenceImpl )
+ {
+ delete iSvgUriReferenceImpl;
+ iSvgUriReferenceImpl = NULL;
+ }
+
+
+ if ( iSvgStyleProperties )
+ {
+ iSvgStyleProperties->Close();
+ delete iSvgStyleProperties;
+ iSvgStyleProperties = NULL;
+ }
+
+ iImageElementListeners.Close();
+
+ if ( iSessionConnected )
+ {
+ iSession.Close();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::GetBBox( TGfxRectangle2D& aBbox )
+ {
+ iImgRect.GetBounds( GetCTM(), aBbox );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::GetUnscaledBBox( TGfxRectangle2D& aBbox )
+ {
+ TGfxAffineTransform identityTx;
+ iImgRect.GetBounds( identityTx, aBbox );
+ }
+
+// *******************************************************
+// From SVG DOM
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgImageElementImpl::X()
+ {
+ return iImgRect.iX;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgImageElementImpl::Y()
+ {
+ return iImgRect.iY;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgImageElementImpl::Width()
+ {
+ if (iImgRect.iWidth == TFloatFixPt(-1))
+ {
+ return TFloatFixPt(0);
+ }
+
+ return iImgRect.iWidth;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgImageElementImpl::Height()
+ {
+ if (iImgRect.iHeight == TFloatFixPt(-1) )
+ {
+ return TFloatFixPt(0);
+ }
+
+ return iImgRect.iHeight;
+ }
+
+// *******************************************************
+// SVG Implementation
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::SetWidth( TFloatFixPt aWidth )
+ {
+ iRenderImage = !(aWidth <= TFloatFixPt(0));
+
+ iImgRect.iWidth = aWidth;
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::SetHeight( TFloatFixPt aHeight )
+ {
+ iRenderImage = !(aHeight <= TFloatFixPt(0));
+
+ iImgRect.iHeight = aHeight;
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::SetParL( const TDesC& aName )
+ {
+ iPar = aName.AllocL();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TDesC& CSvgImageElementImpl::Par()
+ {
+ if ( iPar )
+ return *iPar;
+ else
+ return KNullDesC;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::SetUriL( const TDesC& aUri )
+ {
+ // Indicate that the Uri is set. This is used to decide whether
+ // to indicate an error if xlink:href attribute was not specified
+ // on the image element.
+ iIsUriSet = ETrue;
+ _LIT( KXlinkHref, "xlink:href" );
+ SetXlinkAttributeL(KXlinkHref, aUri);
+ CheckRequiredAttributes();
+
+ if ( Href().Length() == 0)
+ {
+ //empty URI string...do nothing
+ //JSR 226 tests start out with empty string
+ return;
+ }
+
+ //We have to be careful in this method searching the entire string
+ //because we can get the entire
+ //base64 encoded image coming through this call
+
+ // Verify xlink for JavaInterface
+ CSvgDocumentImpl* document = (CSvgDocumentImpl*)OwnerDocument();
+ //if ( document && aUri.Length() > 0)
+ if ( document )
+ {
+ // Check for local URI (#uri)
+ //if ( aUri.Locate( '#' ) != KErrNotFound || aUri.Length() == 0)
+ if ( Href().Left(1) == _L("#") )
+ {
+ document->SetError( KErrNotFound, _L( "Usage of local URI in <image>: " ), aUri );
+ }
+ else
+ {
+ _LIT( KHttp, "http://" );
+ _LIT( KData, "data:");
+
+ if ( ( Href().Length() >= 7 ) && ( Href().Left( 7 ) == KHttp ) )
+ {
+ //using an http address for the image
+ return;
+ }
+ else if ( ( Href().Length() >= 5 ) && ( Href().Left( 5 ) == KData ) )
+ {
+ //this is a base 64 image
+ iIsBase64 = ETrue;
+ return;
+ }
+ else
+ {
+ _LIT( KJpgFile, ".jpg");
+ _LIT( KPngFile, ".png");
+ _LIT( KSvgFile, ".svg");
+
+ // Check for relative URI
+ if ( aUri.Locate( '/' ) == KErrNotFound)
+ {
+ //plain image used...but is this relative?!?
+ //does JSR 226 need an error thrown on this?
+ //i.e. image.jpg
+ if (aUri.Right(4) == KJpgFile)
+ {
+ //this is a plain image.jpg
+ return;
+ }
+ else if (aUri.Right(4) == KPngFile)
+ {
+ //this is a plain image.png file
+ return;
+ }
+ else if (aUri.Right(4) == KSvgFile)
+ {
+ //this is a filename.svg file
+ document->SetError(KErrNotFound, _L("Usage of SVG file in xlink-href:"), aUri);
+ }
+ return;
+ }
+ /*if ( aUri.Find( KFile ) != 1 || !TChar( aUri[0] ).IsAlpha() )
+ {
+ document->SetError( KErrNotFound, _L( "Usage of relative URI in <image>: " ), aUri );
+ }
+ else
+ {
+ //this is an absolute image
+ //i.e. c:/folder/image.jpg
+ }*/
+ }
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::LoadUriL()
+ {
+ if ( Href().Length() == 0 )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgImageElementImpl::LoadUriL()--iUri is NULL or empty.");
+ #endif
+ return;
+ }
+ iBitmapLoadCalled = ETrue;
+ iSessionConnected = EFalse;
+
+ // Cannot continue without SvgEngine instance or
+ // MSvgRequestObserver is not set
+
+ CSvgDocumentImpl* document = (CSvgDocumentImpl*)OwnerDocument();
+ if ( document == NULL )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgImageElementImpl::LoadUriL--document handle null");
+ #endif
+ return;
+ }
+
+ // Request
+ if ( ( Href().Length() >= 4 && Href().Right( 4 ) == KSvg ) ||
+ ( Href().Length() >= 5 && Href().Right( 5 ) == KSvgb ) )
+ {
+ iIsSvgFile = ETrue;
+ }
+
+ // Don't call LoadUriL if LoadingListener exists and LoadingListener::WillAssignImageData returns ETrue
+ if ( document )
+ {
+ const RPointerArray<MSvgLoadingListener>* listeners = document->GetLoadingListeners();
+ if ( listeners && listeners->Count() > 0 )
+ {
+ if ( (*listeners)[0]->WillAssignImageData() )
+ {
+ (*listeners)[0]->ImageDataReference( Href() );
+ return;
+ }
+ }
+ }
+
+ // Embedded image
+ if ( ( Href().Length() >= 5 ) && ( Href().Left( 5 ) == _L( "data:" ) ) )
+ {
+ ProcessEncodedImageL( Href() );
+ return;
+ }
+
+ iBitmapOrgReady = EFalse;
+ iBitmapReady = EFalse;
+
+ CSvgEngineImpl* engine = document->Engine();
+ if ( engine == NULL || engine->iRequestObserver == NULL )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgImageElementImpl::LoadUriL--engine handle null");
+ #endif
+ return;
+ }
+
+ // Connect session
+ RFile fileHandle;
+ if ( iSession.Connect() != KErrNone )
+ {
+ return;
+ }
+ iSessionConnected = ETrue;
+ TInt status = engine->iRequestObserver->FetchImage( Href(), iSession, fileHandle );
+ if ( status == KErrNone )
+ {
+ // prevent division by zero (DrawL) when image fails to load
+ CFbsBitmap* aBitmap = new ( ELeave ) CFbsBitmap();
+ CleanupStack::PushL( aBitmap );
+ TInt lCreateErr = aBitmap->Create( TSize( 1, 1 ), EColor64K );
+ if ( lCreateErr != KErrNone )
+ {
+ // Error in creation, destroy the bitmap and return
+ CleanupStack::PopAndDestroy( aBitmap );
+ return;
+ }
+ // Ownership is about to be tranferred to Image Element
+ CleanupStack::Pop( aBitmap );
+ TInt lDecodeErr = StartImageDecoding( fileHandle, aBitmap, ETrue );
+ if ( lDecodeErr != KErrNone )
+ {
+ // No error Processing
+ }
+ }
+ else
+ {
+ iSession.Close();
+ iSessionConnected = EFalse;
+ }
+ }
+
+void CSvgImageElementImpl::PrepareImageFromSvgFile(const TDesC8& aImageData)
+ {
+ CSvgDocumentImpl* document = (CSvgDocumentImpl*)OwnerDocument();
+ if ( !document )
+ {
+ return;
+ }
+
+ CSvgEngineImpl* engine = document->Engine();
+ if ( !engine )
+ {
+ return;
+ }
+ TSize bitmapSize( (TInt32)Width(), (TInt32)Height() );
+ if ( !iBitmap )
+ {
+ iBitmap = new CFbsBitmap();
+ }
+ if(!iMask)
+ {
+ iMask = new CFbsBitmap();
+ }
+ if(iMask)
+ {
+ iMask->Create( bitmapSize, EGray256);
+ }
+ // Can't use ELeave because this function can't leave
+ // Using ELeave but didn't handle (no trap or propagate to parents) causes more confusing.
+ // Check for NULL is good enough.
+ // Ignore CodeScanner error (Code Review Guide)
+ if (iBitmap)
+ {
+ iBitmap->Create( bitmapSize, EColor16MU );
+
+ TBool preserveRatio = !( iPar != NULL && *iPar == _L( "none" ) );
+ // RenderFileToBuffer if uri is a svg file
+ TInt err = engine->RenderFileToBuffer( aImageData, iBitmap,iMask, preserveRatio );
+ ImageLoadingCompleted(err);
+ }
+ iSession.Close();
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+void CSvgImageElementImpl::ProcessEncodedImageL( const TDesC& aXlinkHrefValue )
+ {
+ // find positions for ';' and ',' to determine encoding, mimetype
+ TInt startIndex = aXlinkHrefValue.Locate( ';' );
+ TInt endIndex = aXlinkHrefValue.Locate( ',' );
+
+ // mimetype is after 'data:' : xlink:href="data:image/png;base64,
+ // ignore mimetype extraction, decode will detect mimetype from decoded data.
+
+ if ( startIndex != KErrNotFound && endIndex != KErrNotFound &&
+ startIndex < endIndex )
+ {
+ // extract encoding type
+ TPtrC encoding( aXlinkHrefValue.Left( endIndex ).Right( endIndex - startIndex - 1 ) );
+ // handle Base64 encoding
+ _LIT( KEncodingBase64, "base64" );
+ if ( encoding == KEncodingBase64 )
+ {
+ // find index of first character after white-space
+ TInt index = endIndex + 1;
+ while ( index < aXlinkHrefValue.Length() && TChar( aXlinkHrefValue[index] ).IsSpace() )
+ index++;
+
+ // must be 8-bit
+ TInt length = aXlinkHrefValue.Length() - index;
+ HBufC8* encoded = HBufC8::NewLC( length );
+ encoded->Des().Copy( aXlinkHrefValue.Right( length ) );
+
+ // Assign to member variable to destroy after image is process.
+ iImageData = HBufC8::NewL( length );
+ TPtr8 decodedDes = iImageData->Des();
+
+ // decode
+ TImCodecB64 encodingBase64;
+ TInt decodeError = encodingBase64.Decode( *encoded, decodedDes );
+ CleanupStack::PopAndDestroy( encoded );
+
+ if ( decodeError == KErrNone )
+ {
+ // prevent division by zero (DrawL) when image fails to load
+ CFbsBitmap* lBitmap = new ( ELeave ) CFbsBitmap();
+ CleanupStack::PushL( lBitmap );
+ TInt lCreateErr = lBitmap->Create( TSize( 1, 1 ), EColor64K );
+ if ( lCreateErr != KErrNone )
+ {
+ // Error creating bitmap, delete bitmap and return
+ CleanupStack::PopAndDestroy( lBitmap );
+ return;
+ }
+ // Ownership of aBitmap is about to be transferred to image
+ // element
+ CleanupStack::Pop( lBitmap );
+ // If bitmap was already present, release it
+ if ( iBitmap )
+ {
+ delete iBitmap;
+ iBitmap = NULL;
+ }
+ iBitmap = lBitmap;
+ TInt lImgDecErr = StartImageDecoding( *iImageData,
+ ETrue ); // ETrue means Synchronous Loading
+ if ( lImgDecErr != KErrNone )
+ {
+ // No Error Processing
+ }
+ }
+ }
+ }
+ }
+
+// *******************************************************
+// From MXmlElement
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgImageElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+ _LIT( KTmpUri, "xlink:href" );
+ _LIT( KTmpPreserveAspectRatio, "preserveAspectRatio" );
+
+ if ( this->SetXlinkAttributeL( aName, aValue ) )
+ {
+ if ( aName == KTmpUri )
+ {
+ SetUriL( aValue );
+ CheckRequiredAttributes();
+ }
+ return KErrNone;
+ }
+
+
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+
+ if ( aName == KTmpPreserveAspectRatio )
+ {
+ SetParL( aValue );
+ }
+
+ return KErrNoAttributeSet;
+ }
+
+
+
+// From MXmlElementOpt
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgImageElementImpl::GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrX:
+ case KAtrRefX:
+ aValue = X();
+ break;
+ case KAtrY:
+ case KAtrRefY:
+ aValue = Y();
+ break;
+ case KAtrHeight:
+ aValue = Height();
+ break;
+ case KAtrWidth:
+ aValue = Width();
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgImageElementImpl::SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrX:
+ iImgRect.iX = aValue;
+ break;
+ case KAtrY:
+ iImgRect.iY = aValue;
+ break;
+
+ case KAtrHeight:
+ SetHeight( aValue );
+ CheckRequiredAttributes();
+ break;
+
+ case KAtrWidth:
+ SetWidth( aValue );
+ CheckRequiredAttributes();
+ break;
+
+ default:
+ return CSvgElementImpl::SetAttributeFloatL( aNameId, aValue );
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgImageElementImpl::SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrXlinkhref:
+ SetUriL( aValue );
+ CheckRequiredAttributes();
+ break;
+ default:
+ return CSvgElementImpl::SetAttributeDesL( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+void CSvgImageElementImpl::ImageLoadingCompleted( TInt aError )
+ {
+ iBitmapReady = aError != KErrCancel;
+ if ( aError == KErrNone )
+ {
+
+ PrepareImageWithMask();
+ iBitmapOrgReady = ETrue;
+ // Notify clones that the bitmap is ready.
+
+
+ NotifyImageDecoded();
+
+ // The redraw needs to be done once the image element is decoded,
+ // so that the image is rendered in place in the content.
+ // If the decoding is done asynchronously, the client does not know
+ // when the decoding was completed hence it cannot perform a redraw()
+ // In such a scenario, the image element itself triggers a redraw.
+
+ if(iImageLoader && !(iImageLoader->IsSynchronousLoading()))
+ {
+ CSvgDocumentImpl* document = (CSvgDocumentImpl*)OwnerDocument();
+ if(document)
+ {
+ CSvgEngineImpl* engine =document->Engine();
+ if(engine)
+ {
+ engine->ImageLoadingCompleted(aError);
+ }
+ }
+ }
+ } // if ( aError == KErrNone )
+ CSvgDocumentImpl* document = (CSvgDocumentImpl*)OwnerDocument();
+ if(document)
+ {
+ document->ImageLoadingCompleted(aError);
+ }
+
+
+
+
+ if ( iSessionConnected )
+ {
+ iSession.Close();
+ iSessionConnected = EFalse;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// void CSvgImageElementImpl::PrepareImageWithMask()
+// Combines mask information into main bitmap for use with OpenVG
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::PrepareImageWithMask()
+ {
+ if ( iBitmap && iMask )
+ {
+ TSize size = iMask->SizeInPixels();
+ // If size of bitmap and mask do not match, cannot process mask
+ if ( size != iBitmap->SizeInPixels() )
+ {
+ return;
+ }
+ iBitmap->LockHeap();
+ iMask->LockHeap();
+
+ TUint32* bitmapData = (TUint32*)iBitmap->DataAddress();
+ TUint8* maskData = (TUint8*)iMask->DataAddress();
+
+ TInt lBmpSLLen = CFbsBitmap::ScanLineLength( size.iWidth,
+ iBitmap->DisplayMode() );
+
+ TInt lMaskSLLen = CFbsBitmap::ScanLineLength( size.iWidth,
+ iMask->DisplayMode() );
+
+ TInt count = size.iWidth * size.iHeight;
+ TUint32* lBitmapCurPtr = bitmapData;
+ TUint8* lMaskCurPtr = maskData;
+
+ for ( TInt lIndex = 1; lIndex < count; lIndex++ )
+ {
+ // Converting from ARGB to RGBA8888
+ *lBitmapCurPtr = ( *lBitmapCurPtr & 0x00FFFFFF ) << 8 | *lMaskCurPtr;
+ // Check if one row is complete
+ if ( lIndex % size.iWidth == 0 )
+ {
+ // One row of pixels is complete. Now reposition the
+ // lBitmapCurPtr, lMaskCurPtr to point to beginning of new row.
+ // Current row is given by (index/widthMask)
+ //
+ // In order to get offset to first pixel, we need to
+ // perform following
+ // BasePtr + Current row * (row width in bytes)
+ lBitmapCurPtr =(TUint32*)((TUint8*)bitmapData + ( ( lIndex / size.iWidth )
+ * lBmpSLLen ));
+ lMaskCurPtr = maskData + ( ( lIndex / size.iWidth )
+ * lMaskSLLen );
+ }
+ else
+ {
+ // Still within the row, keep incrementing
+ lBitmapCurPtr++;
+ lMaskCurPtr++;
+ }
+ }
+ iMask->UnlockHeap();
+ iBitmap->UnlockHeap();
+ }
+ }
+
+// *******************************************************
+// From CSvgElementImpl
+
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgImageElementImpl::CloneL(MXmlElement* aParentElement)
+ {
+ CSvgImageElementImpl* newElement = CSvgImageElementImpl::NewL( this->ElemID(), ((CSvgDocumentImpl*)iOwnerDocument) );
+
+ CleanupStack::PushL(newElement);
+ newElement->iParentNode = aParentElement;
+ // copy everything over
+ this->CopyL(newElement);
+ CleanupStack::Pop();
+ // Add the cloned element to image decode notification list.
+ // This is done to ensure that the image is decoded only once.
+ AddImageElementListener( newElement );
+ newElement->SetReferenceElement( this );
+ return newElement;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgImageElementImpl::DrawL( CGfx2dGc* aGc, CSvgElementImpl* aElement )
+ {
+ // Set Gc
+ this->DrawShapeL( aGc, aElement );
+
+ if ( iBitmap == NULL )
+ return ETrue;
+ TSize imageSize = iBitmap->SizeInPixels(); //.
+ if ( imageSize.iWidth == 0 || imageSize.iHeight == 0 )
+ return ETrue;
+
+ const TGfxAffineTransform& currentTM = GetCTM();
+
+ aGc->SetTransform( currentTM );
+
+ if ( iBitmapReady && iRenderImage && iBitmap )
+ {
+ aGc->DrawImage( iBitmap, iImgRect, iMask != NULL );
+ }
+ else if ( iBitmapOrgReady && iRenderImage )
+ {
+ aGc->SetForegroundColor( TGfxColor( 0xaaaaaa ) );
+ aGc->SetPaint( NULL );
+ aGc->DrawL( &iImgRect );
+ }
+ return ETrue;
+ }
+
+// *******************************************************
+// Private
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgImageElementImpl::CSvgImageElementImpl( CSvgDocumentImpl* aDoc ) :
+ iRenderImage ( ETrue ),
+ iIsUriSet( EFalse ),
+ iImageDecodingDone(EFalse),
+ iBitmapReady( EFalse )
+ {
+ SetOwnerDocument(aDoc);
+ iBitmap = NULL;
+ iMask = NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// perform a deep copy of this object
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::CopyL( CSvgImageElementImpl* aDestElement )
+ {
+ if(aDestElement)
+ {
+ // copy stuff from superclass
+ this->CSvgElementImpl::CopyL(aDestElement);
+
+ // copy items special to CSvgImageElementImpl
+ aDestElement->iUsedImage = ETrue; // this is not original image
+ delete aDestElement->iBitmap; // delete old
+ aDestElement->iBitmap = this->iBitmap; // borrow new
+ aDestElement->iImgRect = this->iImgRect;
+ aDestElement->iPar = this->iPar;
+ aDestElement->iBitmapOrgReady = ETrue;
+ aDestElement->iBitmapReady = ETrue;
+ aDestElement->iRenderImage = ETrue;
+ aDestElement->iIsBase64 = this->iIsBase64;
+
+ // copy the reference to idoc (CSvgDocumentImpl)
+ aDestElement->iOwnerDocument = this->iOwnerDocument;
+ }
+
+
+ }
+
+/********************* Helping Class **************************/
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+CSvgImageElementImpl::CSvgImageLoaderUtil* CSvgImageElementImpl::CSvgImageLoaderUtil::NewL(
+ MSVGImageLoadingObserver* aObserver,
+ RFile& aFileHandle,
+ TBool aSyncLoading )
+ {
+ CSvgImageLoaderUtil* self = new ( ELeave ) CSvgImageLoaderUtil( );
+ CleanupStack::PushL( self );
+ self->ConstructL( aObserver, aFileHandle, aSyncLoading );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+CSvgImageElementImpl::CSvgImageLoaderUtil* CSvgImageElementImpl::CSvgImageLoaderUtil::NewL(
+ MSVGImageLoadingObserver* aObserver,
+ const TDesC8& aEncodedData,
+ TBool aSyncLoading )
+ {
+ CSvgImageLoaderUtil* self = new ( ELeave ) CSvgImageLoaderUtil( );
+ CleanupStack::PushL( self );
+ self->ConstructL( aObserver, aEncodedData, aSyncLoading );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+CSvgImageElementImpl::CSvgImageLoaderUtil::~CSvgImageLoaderUtil()
+ {
+ Cancel();
+ if(iImageDecoder)
+ {
+ delete iImageDecoder;
+ iImageDecoder = NULL;
+ }
+ if ( iActiveSchedulerWait )
+ {
+ delete iActiveSchedulerWait;
+ }
+ if(iImageByteData)
+ {
+ delete iImageByteData;
+ iImageByteData=NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Set the display mode (color mode), the default value is EColor64K.
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::CSvgImageLoaderUtil::SetDisplayMode( TDisplayMode aDisplayMode )
+ {
+ iDisplayMode = aDisplayMode;
+ }
+
+// ---------------------------------------------------------------------------
+// Returns the FrameInfo of Image
+// ---------------------------------------------------------------------------
+TFrameInfo CSvgImageElementImpl::CSvgImageLoaderUtil::GetFrameInfo()
+ {
+ return iImageDecoder->FrameInfo();
+ }
+
+
+// ---------------------------------------------------------------------------
+// Request asynchronously for the image, sized to the image size.
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::CSvgImageLoaderUtil::RequestForImageL( CFbsBitmap& aBitmap,
+ CFbsBitmap& aMask,
+ TBool aHasAlpha,
+ TFrameInfo aFrameInfo )
+ {
+ if ( iImageDecoder != NULL )
+ {
+ if ( aHasAlpha )
+ {
+ User::LeaveIfError( aMask.Create( aFrameInfo.iOverallSizeInPixels, EGray256 ) );
+ User::LeaveIfError( aBitmap.Create( aFrameInfo.iOverallSizeInPixels, EColor16MU ) );
+ iImageDecoder->Convert( &iStatus, aBitmap, aMask, 0 );
+ }
+ else
+ {
+ User::LeaveIfError( aBitmap.Create( aFrameInfo.iOverallSizeInPixels, EColor64K ) );
+ iImageDecoder->Convert( &iStatus, aBitmap, 0 );
+ }
+
+ SetActive();
+ if ( iActiveSchedulerWait )
+ {
+ iActiveSchedulerWait->Start();
+ }
+ }
+ else
+ {
+ iObserver->ImageLoadingCompleted( KErrNotFound );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Override method from CActive, called upon successful completion of request
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::CSvgImageLoaderUtil::RunL()
+ {
+ if ( iActiveSchedulerWait )
+ {
+ iActiveSchedulerWait->AsyncStop();
+ }
+ if ( iObserver )
+ {
+ iObserver->ImageLoadingCompleted( iStatus.Int() );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Override method from CActive, called upon a cancel of request
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::CSvgImageLoaderUtil::DoCancel()
+ {
+ if ( iImageDecoder != NULL )
+ {
+ iImageDecoder->Cancel();
+ }
+
+ // must delete decoder immediate or exception occurs in destructor.
+ delete iImageDecoder;
+ iImageDecoder = NULL;
+ iObserver->ImageLoadingCompleted( KErrCancel );
+ }
+
+// ---------------------------------------------------------------------------
+// Override method from CActive, called upon an error from request
+// ---------------------------------------------------------------------------
+TInt CSvgImageElementImpl::CSvgImageLoaderUtil::RunError( TInt aError )
+ {
+ // must delete decoder immediate or exception occurs in destructor.
+ delete iImageDecoder;
+ iImageDecoder = NULL;
+ iObserver->ImageLoadingCompleted( aError );
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+CSvgImageElementImpl::CSvgImageLoaderUtil::CSvgImageLoaderUtil() : CActive( EPriorityNormal )
+ {
+ SetDisplayMode( EColor64K );
+ CActiveScheduler::Add( this );
+ }
+
+// ---------------------------------------------------------------------------
+// Second phase Construction
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::CSvgImageLoaderUtil::ConstructL(
+ MSVGImageLoadingObserver* aObserver,
+ RFile& aFileHandle,
+ TBool aSyncLoading )
+ {
+ iObserver = aObserver;
+ iIsSyncLoading=aSyncLoading;
+
+ // Reset to start of file
+ TInt zero = 0;
+ aFileHandle.Seek( ESeekStart, zero );
+
+ TInt fileSize = 0;
+ TInt sizeError = aFileHandle.Size( fileSize );
+ if ( sizeError != KErrNone )
+ {
+
+ return;
+ }
+
+
+ iImageByteData = HBufC8::New ( fileSize );
+
+ if (!iImageByteData)
+ {
+
+ return;
+ }
+
+ TPtr8 binaryBufferPtr = iImageByteData->Des();
+
+ // Read the image data into a buffer.
+ TInt readError = aFileHandle.Read(binaryBufferPtr, fileSize);
+ if ( readError != KErrNone )
+ {
+ delete iImageByteData;
+ iImageByteData = NULL;
+ return;
+ }
+ // Unused parameter
+ RFs session;
+ iImageDecoder = CImageDecoder::DataNewL( session, *iImageByteData, CImageDecoder::TOptions( CImageDecoder::EAllowGeneratedMask |
+ CImageDecoder::EOptionAlwaysThread ));
+ iImageDecoder->SetDecoderThreadPriority( EPriorityNormal );
+
+ if ( aSyncLoading )
+ {
+ iActiveSchedulerWait = new (ELeave) CActiveSchedulerWait();
+ }
+ }
+
+void CSvgImageElementImpl::CSvgImageLoaderUtil::ConstructL( MSVGImageLoadingObserver* aObserver,
+ const TDesC8& aEncodedData,
+ TBool aSyncLoading )
+ {
+ iObserver = aObserver;
+ iIsSyncLoading=aSyncLoading;
+ // Unused parameter
+ RFs session;
+ iImageDecoder = CImageDecoder::DataNewL( session, aEncodedData, CImageDecoder::TOptions( CImageDecoder::EAllowGeneratedMask |
+ CImageDecoder::EOptionAlwaysThread ));
+ iImageDecoder->SetDecoderThreadPriority( EPriorityNormal );
+ if ( aSyncLoading )
+ {
+ iActiveSchedulerWait = new (ELeave) CActiveSchedulerWait();
+ }
+ }
+
+TInt CSvgImageElementImpl::GetAttributeDes( const TInt aNameId,
+ TPtrC16& aValue )
+{
+ if(aNameId == KAtrPreserveAspectRatio)
+ {
+ aValue.Set( Par() );
+ return KErrNone;
+ }
+ // added for updation of Get/Set
+ if( aNameId == KAtrXlinkhref )
+ {
+ aValue.Set( Href() );
+ return KErrNone;
+ }
+ return CSvgElementImpl::GetAttributeDes( aNameId, aValue );
+
+}
+
+// MSvgImageDecodingRequester method
+TInt CSvgImageElementImpl::StartImageDecoding( const TDesC8& aImageData,
+ TBool aSyncLoading )
+ {
+ if ( iBitmap != NULL )
+ {
+
+ if( iIsSvgFile )
+ {
+ // SVG files are decoded by engine and do not follow the ImageDecoder Path
+ PrepareImageFromSvgFile(aImageData);
+ return KErrNone;
+ }
+ if( iImageDecodingDone )
+ {
+ CSvgDocumentImpl* document = (CSvgDocumentImpl*)OwnerDocument();
+ if(document)
+ {
+ TInt incCnt = document->GetImageElementsCount() + 1;
+ document->SetImageElementsCount(incCnt);
+ }
+
+ }
+ else
+ {
+ iImageDecodingDone = ETrue;
+ }
+ // Check if the iImageLoader already exists for the ImageElement
+ TInt err = KErrNone;
+
+ if( iImageLoader == NULL )
+ {
+ TRAP(err, iImageLoader = CSvgImageLoaderUtil::NewL( this,
+ aImageData,
+ aSyncLoading )); // EFalse means Asynchronous decoding
+ }
+ else
+ {
+ // Cancel the currently active request if the request is pending.
+ if( iImageLoader)
+ {
+ delete iImageLoader;
+ iImageLoader = NULL;
+ }
+
+ TRAP(err, iImageLoader = CSvgImageLoaderUtil::NewL( this,
+ aImageData,
+ aSyncLoading )); // EFalse means Asynchronous decoding
+ }
+
+ if ( err != KErrNone || !iImageLoader )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgImageElementImpl::StartImageDecoding failed");
+ #endif
+ ImageLoadingCompleted(err);
+ return err;
+ }
+
+ TFrameInfo lFrameInfo( iImageLoader->GetFrameInfo() );
+ TBool lHasAlpha = (lFrameInfo.iFlags & TFrameInfo::ETransparencyPossible) != 0;
+
+ if( lHasAlpha )
+ {
+ if( iMask )
+ {
+ delete iMask;
+ iMask = NULL;
+ }
+
+ iMask = new (ELeave) CFbsBitmap();
+ }
+
+ TRAPD(err2, iImageLoader->RequestForImageL( *iBitmap, *iMask, lHasAlpha, lFrameInfo ));
+ if ( err2 != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgImageElementImpl::StartImageDecoding RequestForImageL() failed");
+ #endif
+ ImageLoadingCompleted(err2);
+ return err2;
+ }
+ }
+ return KErrNone;
+ }
+
+
+TInt CSvgImageElementImpl::StartImageDecoding( RFile& aImageFile,
+ CFbsBitmap* aBitmap,
+ TBool aSyncLoading )
+ {
+ if ( iBitmap )
+ {
+ // Destroy the existing bitmap
+ delete iBitmap;
+ }
+ // Take ownership of the bitmap
+ iBitmap = aBitmap;
+
+ if ( iBitmap != NULL )
+ {
+ if( iIsSvgFile )
+ {
+
+ TInt length;
+ aImageFile.Size(length);
+
+ HBufC8 *aImageData = HBufC8::NewL( length );
+ TPtr8 des = aImageData->Des();
+
+ TInt readError = aImageFile.Read( des );
+ if ( readError != KErrNone )
+ {
+ delete aImageData;
+ return KErrGeneral;
+ }
+ else
+ {
+ // SVG files are decoded by engine and do not follow the ImageDecoder Path
+ PrepareImageFromSvgFile(des);
+ return KErrNone;
+ }
+ }
+ if( iImageDecodingDone )
+ {
+ CSvgDocumentImpl* document = (CSvgDocumentImpl*)OwnerDocument();
+ if(document)
+ {
+ TInt incCnt = document->GetImageElementsCount() + 1;
+ document->SetImageElementsCount(incCnt);
+ }
+
+ }
+ else
+ {
+ iImageDecodingDone = ETrue;
+ }
+
+ TInt err = KErrNone;
+ // Check if the iImageLoader already exists for the ImageElement
+ if( iImageLoader == NULL )
+ {
+ TRAP( err, iImageLoader = CSvgImageLoaderUtil::NewL( this,
+ aImageFile,
+ aSyncLoading )); // EFalse means Asynchronous decoding
+ }
+ else
+ {
+ // Cancel the currently active request if the request is pending.
+ if( iImageLoader)
+ {
+ delete iImageLoader;
+ iImageLoader = NULL;
+ }
+
+ TRAP(err, iImageLoader = CSvgImageLoaderUtil::NewL( this,
+ aImageFile,
+ aSyncLoading )); // EFalse means Asynchronous decoding
+ }
+
+ if ( err != KErrNone || !iImageLoader )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgImageElementImpl::StartImageDecoding failed");
+ #endif
+ ImageLoadingCompleted(err);
+ return err;
+ }
+ // Get the Frame info and based on it create the iMask if required.
+ TFrameInfo lFrameInfo( iImageLoader->GetFrameInfo() );
+ TBool lHasAlpha = (lFrameInfo.iFlags & TFrameInfo::ETransparencyPossible) != 0;
+
+ if( lHasAlpha )
+ {
+ if( iMask )
+ {
+ delete iMask;
+ iMask = NULL;
+ }
+
+ iMask = new (ELeave) CFbsBitmap();
+ }
+
+
+ TRAPD(err2, iImageLoader->RequestForImageL( *iBitmap, *iMask, lHasAlpha, lFrameInfo ));
+
+ if ( err2 != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgImageElementImpl::StartImageDecoding RequestForImageL() failed");
+ #endif
+ ImageLoadingCompleted(err);
+ return err2;
+ }
+ }
+ return KErrNone;
+ }
+// ---------------------------------------------------------------------------
+// CSvgImageElementImpl::SetReferenceElement
+// Informs the image element that it is referring to a particular image
+// element.
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::SetReferenceElement( CSvgImageElementImpl*
+ aImageElement )
+ {
+ iRefElement = aImageElement;
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgImageElementImpl::GetReferenceElement
+// Get Function for reference element
+// ---------------------------------------------------------------------------
+CSvgImageElementImpl* CSvgImageElementImpl::ReferenceElement()
+ {
+ return iRefElement;
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgImageElementImpl::AddImageElementListener
+// Adds an image element listener - used in the case of cloning of image
+// element.
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::AddImageElementListener(
+ MSvgImageElementListener* aListener )
+ {
+ if ( iImageElementListeners.Find( aListener ) != KErrNotFound )
+ {
+ return;
+ }
+ if ( iImageElementListeners.Append( aListener ) != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("iImageElementListeners.Append failed");
+ #endif
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgImageElementImpl::RemoveImageElementListener
+// Removes an image element listener - used in the case of cloning of image
+// element.
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::RemoveImageElementListener(
+ MSvgImageElementListener* aListener )
+ {
+ TInt index = iImageElementListeners.Find( aListener );
+ if ( index == KErrNotFound )
+ {
+ return;
+ }
+ iImageElementListeners.Remove( index );
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgImageElementImpl::BitmapDecoded
+// This is the callback implementation for updating the decoded image
+// and mask from referenced image element.
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::BitmapDecoded( CFbsBitmap* aBitmap,
+ CFbsBitmap* aMask )
+ {
+ // Save the pointers to the decoded bitmap in this element,
+ // this can be used in subsequent draw.
+ // Note: Both the bitmap and mask are not owned by this element.
+ // It is owned by the reference element.
+ iBitmap = aBitmap;
+ iMask = aMask;
+
+ iBitmapReady = iBitmap != NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgImageElementImpl::ResetReference
+// This is the callback implementation for resetting reference element
+// pointer
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::ResetReference()
+ {
+ // Stop referring to the reference element.
+ iRefElement = NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgImageElementImpl::NotifyImageDecoded
+// Notify listeners that image has been decoded.
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::NotifyImageDecoded()
+ {
+ TInt imageEleListenersCnt = iImageElementListeners.Count();
+ for ( TInt i = 0; i < imageEleListenersCnt; i++ )
+ {
+ iImageElementListeners[i]->BitmapDecoded( iBitmap, iMask );
+ }
+}
+
+// ---------------------------------------------------------------------------
+// CSvgImageElementImpl::ResetReference
+// Notify listeners to reset their reference element pointers
+// ---------------------------------------------------------------------------
+void CSvgImageElementImpl::NotifyResetReference()
+ {
+ TInt imageEleListenersCnt = iImageElementListeners.Count();
+ for ( TInt i = 0; i < imageEleListenersCnt; i++ )
+ {
+ iImageElementListeners[i]->ResetReference();
+ }
+}
+
+void CSvgImageElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<image x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xlink:href=\"hmm\" \\>", (int)X(), (int)Y(), (int)Width(), (int)Height()/*, Href()*/);
+ #endif
+ }
+}
+
+CFbsBitmap* CSvgImageElementImpl::GetBitmap()
+ {
+ return iBitmap;
+ }
+
+void CSvgImageElementImpl::SetBitmap( CFbsBitmap* aBitmap )
+ {
+ if ( iBitmap )
+ {
+ delete iBitmap;
+ iBitmap = NULL;
+ }
+ iBitmap = aBitmap;
+ }
+
+void CSvgImageElementImpl::AssignImageData( HBufC8* aData )
+ {
+ if(iImageData)
+ {
+ delete iImageData;
+ iImageData = NULL;
+ }
+ iImageData = aData;
+ }
+
+TInt CSvgImageElementImpl::CheckRequiredAttributes()
+{
+ if ( !( iImgRect.iHeight >= TFloatFixPt(0) ) )
+ {
+ //need a height
+ iReqAttrFlag = KAtrHeight;
+ return iReqAttrFlag;
+ }
+
+ if ( !( iImgRect.iWidth >= TFloatFixPt(0)) )
+ {
+ iReqAttrFlag = KAtrWidth;
+ return iReqAttrFlag;
+ }
+
+
+ if ( !iIsUriSet )
+ {
+ iReqAttrFlag = KAtrXlinkhref;
+ return iReqAttrFlag;
+ }
+
+ iReqAttrFlag = 0;
+
+ // check if the diplay property is turned off programatically
+ if( WasTurnedOff() )
+ {
+ _LIT(KInline, "inline");
+ // turn it on. this means all the required attributes Are present and
+ // hence we can render it.
+ CSvgElementImpl::SetPropertyL(KCSS_ATTR_DISPLAY, KInline);
+ SetTurnOff( EFalse );
+ }
+
+ return 0;
+}
+// ---------------------------------------------------------------------------
+// CSvgImageElementImpl::IsSynchronousLoading
+// Returns whether the image decoding was synchronous or not
+// ---------------------------------------------------------------------------
+TBool CSvgImageElementImpl::CSvgImageLoaderUtil::IsSynchronousLoading()
+ {
+ return iIsSyncLoading;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGImageHashMap.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,319 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include "SVGImageHashMap.h"
+
+// DECODED IMAGE STORAGE FOR IMAGE ELEMENTS TO SHARE
+// SO IMAGES WITH THE SAME XLINK-HREF don't have to decode twice
+// SVG FONT STORAGE FOR JSR 226 ONLY
+// BECAUSE WE DONT HAVE AN ENGINE AT PARSE TIME
+// FOR SVG FONTS
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgImageHashMap* CSvgImageHashMap::NewL()
+ {
+ CSvgImageHashMap* self = new ( ELeave ) CSvgImageHashMap;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgImageHashMap* CSvgImageHashMap::NewLC()
+ {
+ CSvgImageHashMap* self = new ( ELeave ) CSvgImageHashMap;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgImageHashMap::ConstructL()
+ {
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgImageHashMap::CSvgImageHashMap()
+
+ {
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgImageHashMap::~CSvgImageHashMap()
+ {
+ iSvgImageMapItems.ResetAndDestroy();
+ iSvgImageMapItems.Close();
+ }
+
+// ==========================================================================
+// CSvgImageHashMap::AddImageL( CFbsBitmap* aImagePtr,
+// const TDesC& aImageName )
+// return ETrue if image added
+// return EFalse if image was already in map
+// ==========================================================================
+TBool CSvgImageHashMap::AddImageL( CFbsBitmap* aImagePtr,
+ const TDesC& aImageName )
+{
+ CSvgImageMapItem* lImageMapItem = GetImageMapItem( aImageName );
+
+ if (lImageMapItem)
+ {
+ //already a reference to this image in the image map
+ lImageMapItem->IncrementReferenceCount();
+ return EFalse;
+ }
+ else
+ {
+ //didnt find that image in the image map...add it
+ CSvgImageMapItem* lNewSvgImageMapItem = CSvgImageMapItem::NewL( );
+
+ lNewSvgImageMapItem->SetImagePtr( aImagePtr );
+ lNewSvgImageMapItem->CopyImageNameL( aImageName );
+ lNewSvgImageMapItem->IncrementReferenceCount();
+
+ iSvgImageMapItems.Append(lNewSvgImageMapItem);
+
+ return ETrue;
+ }
+}
+
+// --------------------------------------------------------------------------
+// TBool CSvgImageHashMap::HasImageName( const TDesC& aImageName
+// ---------------------------------------------------------------------------
+TBool CSvgImageHashMap::HasImageName( const TDesC& aImageName )
+ {
+ TBool lHaveImage = EFalse;
+
+ TInt svgImageMapItemsCnt = iSvgImageMapItems.Count();
+ for (TInt i=0; i < svgImageMapItemsCnt; i++)
+ {
+ if ( aImageName == ((CSvgImageMapItem*)iSvgImageMapItems[i])->GetImageName() )
+ {
+ lHaveImage = ETrue;
+ }
+ }
+
+ return lHaveImage;
+
+ }
+
+// --------------------------------------------------------------------------
+// CSvgImageMapItem* CSvgImageHashMap::GetImageMapItem( const TDesC& aImageName
+// ---------------------------------------------------------------------------
+CSvgImageMapItem* CSvgImageHashMap::GetImageMapItem( const TDesC& aImageName )
+{
+ TInt svgImageMapItemsCnt = iSvgImageMapItems.Count();
+ for ( TInt i = 0; i < svgImageMapItemsCnt; i++ )
+ {
+ CSvgImageMapItem* lImageMap = (CSvgImageMapItem*)iSvgImageMapItems[i];
+
+ TInt result = aImageName.Compare( lImageMap->GetImageName() );
+
+ if ( result == 0 )
+ {
+ return lImageMap;
+ }
+ }
+
+ return NULL;
+}
+
+// --------------------------------------------------------------------------
+// TBool CSvgDocumentImpl::RemoveReferenceFromImageL( const TDesC& aImageName )
+// returns True if there aren't any left
+// returns False if there are references to that image left
+// ---------------------------------------------------------------------------
+TBool CSvgImageHashMap::RemoveReferenceFromImageL( const TDesC& aImageName )
+ {
+
+ CSvgImageMapItem* lImageMapItem = GetImageMapItem( aImageName );
+
+ if (lImageMapItem != NULL)
+ {
+ //we have this lImageMapElement
+ TInt aReferenceCount = lImageMapItem->DecrementReferenceCount();
+
+ if (aReferenceCount <= 0)
+ {
+ //no more references to this image remove it from the map
+ iSvgImageMapItems.Remove(iSvgImageMapItems.Find(lImageMapItem));
+ delete lImageMapItem;
+ return ETrue;
+ }
+ }
+
+ return EFalse;
+ }
+
+// --------------------------------------------------------------------------
+// CFbsBitmap* CSvgDocumentImpl::GetImagePtr( const TDesC& aImageName )
+// ---------------------------------------------------------------------------
+CFbsBitmap* CSvgImageHashMap::GetImagePtr( const TDesC& aImageName )
+ {
+
+ CSvgImageMapItem* lImageMapItem = GetImageMapItem( aImageName );
+
+ if (lImageMapItem)
+ {
+ return (lImageMapItem->GetImagePtr());
+ }
+
+ return NULL;
+
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgImageMapItem* CSvgImageMapItem::NewL()
+ {
+ CSvgImageMapItem* self = new ( ELeave ) CSvgImageMapItem;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgImageMapItem* CSvgImageMapItem::NewLC()
+ {
+ CSvgImageMapItem* self = new ( ELeave ) CSvgImageMapItem;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgImageMapItem::ConstructL()
+ {
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgImageMapItem::CSvgImageMapItem(): iImageDecodingStatus(EFalse)
+
+ {
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgImageMapItem::~CSvgImageMapItem()
+ {
+ if (iImageName->Length())
+ {
+ //delete the xlink-href (base64 image data
+ delete iImageName;
+ iImageName = NULL;
+ }
+ /*if (iImagePtr)
+ {
+ //delete the bitmap
+ delete iImagePtr;
+ }*/
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CFbsBitmap* CSvgImageMapItem::GetImagePtr()
+ {
+ return iImagePtr;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TDesC& CSvgImageMapItem::GetImageName()
+ {
+ return ( const TDesC & ) *iImageName;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgImageMapItem::SetImagePtr( CFbsBitmap* aImagePtr )
+ {
+ iImagePtr = aImagePtr;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgImageMapItem::CopyImageNameL( const TDesC& aImageName )
+ {
+ iImageName = aImageName.AllocL();
+ }
+
+//----------------------------------------------------------------------
+//
+//-----------------------------------------------------------------------
+void CSvgImageMapItem::SetImageDecodingStatus( TBool aThisImageIsDecoding )
+ {
+ iImageDecodingStatus = aThisImageIsDecoding;
+ }
+
+//----------------------------------------------------------------------
+//
+//----------------------------------------------------------------------
+TBool CSvgImageMapItem::GetImageDecodingStatus( )
+ {
+ return iImageDecodingStatus;
+ }
+
+//-----------------------------------------------------------------------
+//
+//-----------------------------------------------------------------------
+TInt CSvgImageMapItem::IncrementReferenceCount( )
+ {
+ iImageReferenceCount++;
+ return iImageReferenceCount;
+ }
+
+//-----------------------------------------------------------------------
+//
+//-----------------------------------------------------------------------
+TInt CSvgImageMapItem::DecrementReferenceCount()
+ {
+ iImageReferenceCount--;
+ return iImageReferenceCount;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGImplMain.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,17 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGIntCssValueImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32DEBUG_H__)
+#include <e32debug.h>
+#endif
+
+#include "SVGIntCssValueImpl.h"
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CIntCssValueImpl::~CIntCssValueImpl()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CIntCssValueImpl::SetValueL( const TDesC& aValue )
+ {
+
+ TInt32 tInt;
+ TLex tLex( aValue );
+ if ( tLex.Val( tInt ) == KErrNone )
+ {
+ iValue = tInt;
+ }
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CIntCssValueImpl::SetValueL( const TInt& aValue )
+ {
+ iValue = aValue;
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CIntCssValueImpl::Value()
+ {
+ return iValue;
+ }
+
+// *******************************************************
+// Private
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CIntCssValueImpl::CIntCssValueImpl( )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CIntCssValueImpl::IsEqual( CCssValue* aValue )
+{
+ if (((CIntCssValueImpl*)aValue)->iValue == iValue)
+ {
+ return ETrue;
+ }
+
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CIntCssValueImpl::Print( )
+{
+#ifdef _DEBUG
+ RDebug::Printf("%d", iValue);
+#endif
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGLangSpaceImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,158 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include "SVGLangSpaceImpl.h"
+
+
+// ---------------------------------------------------------------------------
+// Implements the SVGLangSpace DOM interface.
+// ---------------------------------------------------------------------------
+CSvgLangSpaceImpl* CSvgLangSpaceImpl::NewL()
+ {
+ CSvgLangSpaceImpl* self = new ( ELeave ) CSvgLangSpaceImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgLangSpaceImpl* CSvgLangSpaceImpl::NewLC()
+ {
+ CSvgLangSpaceImpl* self = new ( ELeave ) CSvgLangSpaceImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgLangSpaceImpl::~CSvgLangSpaceImpl()
+ {
+ if ( iXMLLang )
+ {
+ delete iXMLLang;
+ iXMLLang = NULL;
+ }
+
+ if ( iXMLSpace)
+ {
+ delete iXMLSpace;
+ iXMLSpace = NULL;
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgLangSpaceImpl::ConstructL()
+ {
+ iXMLLang = HBufC::NewL( 0 );
+ iXMLSpace = HBufC::NewL( 0 );
+ }
+
+
+// From MSvgLangSpace
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TDesC& CSvgLangSpaceImpl::XMLLang()
+ {
+ return ( const TDesC & ) *iXMLLang;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgLangSpaceImpl::SetXMLLangL( const TDesC& aXMLLang )
+ {
+ if ( iXMLLang )
+ {
+ delete iXMLLang;
+ iXMLLang = NULL;
+ }
+ iXMLLang = aXMLLang.AllocL();
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TDesC& CSvgLangSpaceImpl::XMLSpace()
+ {
+ return ( const TDesC & ) *iXMLSpace;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgLangSpaceImpl::SetXMLSpaceL( const TDesC& aXMLSpace )
+ {
+ if ( iXMLSpace )
+ {
+ delete iXMLSpace;
+ iXMLSpace = NULL;
+ }
+ iXMLSpace = aXMLSpace.AllocL();
+ return KErrNone;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgLangSpaceImpl::SetLangSpaceAttributeL( const TDesC& aPropertyName,
+ const TDesC& aValue )
+ {
+ _LIT( KXMLLang, "xml:lang" );
+ _LIT( KXMLSpace, "xml:space" );
+
+ if ( aPropertyName == KXMLLang )
+ {
+ return SetXMLLangL( aValue );
+ }
+ else if ( aPropertyName == KXMLSpace )
+ {
+ return SetXMLSpaceL( aValue );
+ }
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgLangSpaceImpl* CSvgLangSpaceImpl::CloneL()
+ {
+ CSvgLangSpaceImpl* retValue = CSvgLangSpaceImpl::NewL();
+
+ CleanupStack::PushL(retValue);
+ // *** copy iXMLLang
+ retValue->SetXMLLangL(this->XMLLang());
+
+ // *** copy iXMLSpace
+ retValue->SetXMLSpaceL(this->XMLSpace());
+ CleanupStack::Pop();
+ return retValue;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGLineElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,254 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "SVGLineElementImpl.h"
+#include "SVGElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+
+#include "GfxAffineTransform.h"
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgLineElementImpl* CSvgLineElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgLineElementImpl*self = new ( ELeave ) CSvgLineElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgLineElementImpl* CSvgLineElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgLineElementImpl*self = new ( ELeave ) CSvgLineElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgLineElementImpl::ConstructL( const TUint8 aElemID )
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+
+ iSvgStyleProperties = new(ELeave) RPointerArray<CCssValue>(KCSS_MAX_ATTR);
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+ iSvgStyleProperties->Remove( 0 );
+ iSvgTransformable = CSvgTransformableImpl::NewL();
+ }
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgLineElementImpl::CSvgLineElementImpl( CSvgDocumentImpl* aDoc ) : iLine( 0,
+ 0,
+ 0,
+ 0 )
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgLineElementImpl::~CSvgLineElementImpl()
+ {
+ if ( iSvgStyleProperties )
+ {
+ iSvgStyleProperties->Close();
+ delete iSvgStyleProperties;
+ iSvgStyleProperties = NULL;
+ }
+ }
+
+
+
+// *******************************************************
+// From MXmlElement
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgLineElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+ return KErrNone;
+ }
+
+
+// From MXmlElementOpt
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgLineElementImpl::GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrX1:
+ aValue = iLine.iX1;
+ break;
+ case KAtrY1:
+ aValue = iLine.iY1;
+ break;
+ case KAtrX2:
+ aValue = iLine.iX2;
+ break;
+ case KAtrY2:
+ aValue = iLine.iY2;
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgLineElementImpl::SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrX1:
+ iLine.iX1 = aValue;
+ // SetX1(aValue);
+ break;
+ case KAtrY1:
+ iLine.iY1 = aValue;
+ // SetY1(aValue);
+ break;
+ case KAtrX2 :
+ iLine.iX2 = aValue;
+ //SetX1(aValue);
+ break;
+ case KAtrY2 :
+ iLine.iY2 = aValue;
+ //SetY2(aValue);
+ break;
+ default:
+ return CSvgElementImpl::SetAttributeFloatL( aNameId, aValue );
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgLineElementImpl::DrawL( CGfx2dGc* aGc, CSvgElementImpl* aElement )
+ {
+
+ //line isnt a line at all two identical points
+ if (iLine.iX1 == iLine.iX2 && iLine.iY1 == iLine.iY2)
+ return ETrue;
+
+ this->DrawShapeL( aGc, iLine, aElement );
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgLineElementImpl::GetBBox( TGfxRectangle2D& aBbox )
+ {
+ iLine.GetBounds( GetCTM(), aBbox );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgLineElementImpl::GetUnscaledBBox( TGfxRectangle2D& aBbox )
+ {
+ TGfxAffineTransform identityTx;
+ iLine.GetBounds( identityTx, aBbox );
+ }
+
+// ---------------------------------------------------------------------------
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+
+MXmlElement* CSvgLineElementImpl::CloneL(MXmlElement* aParentElement)
+ {
+ // create new circle
+ CSvgLineElementImpl* newElement = CSvgLineElementImpl::NewL( this->ElemID(), ((CSvgDocumentImpl*)iOwnerDocument));
+
+ CleanupStack::PushL(newElement);
+
+ newElement->iParentNode = aParentElement;
+
+ // copy everything over
+ this->CopyL(newElement);
+ CleanupStack::Pop();
+ return newElement;
+ }
+
+// perform a deep copy of this object
+void CSvgLineElementImpl::CopyL( CSvgLineElementImpl* aDestElement )
+ {
+ if(aDestElement)
+ {
+ // copy stuff from superclass
+ this->CSvgElementImpl::CopyL(aDestElement);
+
+ // copy iLine items special to circle
+ aDestElement->iLine.iX1 = this->iLine.iX1;
+ aDestElement->iLine.iX2 = this->iLine.iX2;
+ aDestElement->iLine.iY1 = this->iLine.iY1;
+ aDestElement->iLine.iY2 = this->iLine.iY2;
+
+ // copy the reference to idoc (CSvgDocumentImpl)
+ aDestElement->iOwnerDocument = this->iOwnerDocument;
+ }
+
+
+
+ }
+
+void CSvgLineElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<line x1=\"%d\" x2=\"%d\" y1=\"%d\" y2=\"%d\">", (int)iLine.iX1, (int)iLine.iX2, (int)iLine.iY1, (int)iLine.iY2);
+ #endif
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGLinearGradientElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,271 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include "SVGLinearGradientElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+#include "SvgStopElementImpl.h"
+#include "SVGIntCssValueImpl.h"
+
+#include "GfxAffineTransform.h"
+
+_LIT(X1,"x1");
+_LIT(X2,"x2");
+_LIT(Y1,"y1");
+_LIT(Y2,"y2");
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgLinearGradientElementImpl* CSvgLinearGradientElementImpl::NewL(const TUint8 aElemID, CSvgDocumentImpl* aDoc )
+ {
+ CSvgLinearGradientElementImpl *self = new (ELeave) CSvgLinearGradientElementImpl(aDoc);
+ CleanupStack::PushL(self);
+ self->ConstructL(aElemID);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgLinearGradientElementImpl::ConstructL(const TUint8 aElemID)
+ {
+ CSvgGradientElementImpl::ConstructL(aElemID);
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgLinearGradientElementImpl::CSvgLinearGradientElementImpl( CSvgDocumentImpl* aDoc ):
+ CSvgGradientElementImpl(aDoc)
+ {
+ iGradientPaint = &iGfxLinearPaint;
+ }
+
+// ---------------------------------------------------------------------------
+//Dt:17-Feb-2009 modified the function to support the % values for X1,Y1,X2,Y2
+//TSW ISSUE ID: ANAE-7NZ8B8
+// ---------------------------------------------------------------------------
+TInt CSvgLinearGradientElementImpl::SetAttributeL(const TDesC &aName, const TDesC &aValue)
+ {
+ TFloatFixPt KZero( KFloatFixZero );
+ TFloatFixPt KOne( KFloatFixOne );
+ TFloatFixPt val;
+ if ( aName == X1 || aName == X2 || aName == Y1 || aName == Y2 )
+ {
+
+ if ( IsValidValue(aValue) )
+ {
+ val = TFloatFixPt::ConvertString(aValue);
+ if ( aValue.Locate('%') != KErrNotFound )
+ {
+ val = val / TFloatFixPt(100);
+ }
+ }
+ else
+ {
+ if( aName == X2 )
+ {
+ val = KOne;
+ }
+ else
+ {
+ val = KZero;
+ }
+ }
+ if( aName==X1 )
+ {
+ iGfxLinearPaint.iX1 = val;
+ }
+ else if( aName==Y1 )
+ {
+ iGfxLinearPaint.iY1 = val;
+ }
+ else if( aName==X2 )
+ {
+ iGfxLinearPaint.iX2 = val;
+ }
+ else
+ {
+ iGfxLinearPaint.iY2 = val;
+ }
+
+ }
+ else
+ {
+ CSvgGradientElementImpl::SetAttributeL( aName, aValue );
+ }
+ return 0;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+MGfxPaint *CSvgLinearGradientElementImpl::PaintAttribute()
+ {
+ TInt i=0;
+ TFloatFixPt lOffset;
+ TUint32 lStopColor;
+ TFloatFixPt lStopOpacity;
+ if( iStopElementData )
+ {
+ iStopElementData->Reset();
+ }
+
+ TInt svgStopEleArrayCnt = iSvgStopElementArray->Count();
+ for(i=0;i<svgStopEleArrayCnt ;i++)
+ {
+ CSvgStopElementImpl* temp = (*iSvgStopElementArray)[i];
+
+ // Check if the element has valid offset value. If the offset had invalid value
+ // it will be made zero but this function will return FALSE.
+ if( temp->IsValidElement() )
+ {
+ temp->GetOffset(lOffset);
+ temp->GetStopColor(lStopColor);
+ temp->GetStopOpacity (lStopOpacity);
+ TSvgStopData la ;
+ la.iOffset = lOffset;
+ la.iStopColor = lStopColor;
+ la.iStopOpacity = lStopOpacity;
+ TInt error = iStopElementData->Append(la);
+ if(error != KErrNone)
+ {
+ // not enough memory
+ break;
+ }
+ }
+
+ }
+ iGfxLinearPaint.iStopData = iStopElementData;
+ const TGfxAffineTransform& tempTransform = GetCTM();
+ iGradientPaint->iGradientTransform.matrix[0][0] = tempTransform.iM00.iValue;
+ iGradientPaint->iGradientTransform.matrix[0][1] = tempTransform.iM01.iValue;
+ iGradientPaint->iGradientTransform.matrix[0][2] = tempTransform.iM02.iValue;
+ iGradientPaint->iGradientTransform.matrix[1][0] = tempTransform.iM10.iValue;
+ iGradientPaint->iGradientTransform.matrix[1][1] = tempTransform.iM11.iValue;
+ iGradientPaint->iGradientTransform.matrix[1][2] = tempTransform.iM12.iValue;
+ return &iGfxLinearPaint;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgLinearGradientElementImpl::GetAttributeFloat( const TInt aNameId, TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrX1:
+ aValue = iGfxLinearPaint.iX1 ;
+ break;
+ case KAtrY1:
+ aValue = iGfxLinearPaint.iY1 ;
+ break;
+ case KAtrX2 :
+ aValue = iGfxLinearPaint.iX2 ;
+ break;
+ case KAtrY2 :
+ aValue = iGfxLinearPaint.iY2 ;
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+ return 0;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgLinearGradientElementImpl::SetAttributeFloatL( const TInt aNameId, const TFloatFixPt aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrX1:
+ iGfxLinearPaint.iX1 = aValue;
+ break;
+ case KAtrY1:
+ iGfxLinearPaint.iY1 = aValue;
+ break;
+ case KAtrX2 :
+ iGfxLinearPaint.iX2 = aValue;
+ break;
+ case KAtrY2 :
+ iGfxLinearPaint.iY2 = aValue;
+ break;
+ default:
+ return CSvgElementImpl::SetAttributeFloatL( aNameId, aValue );
+ }
+ return 0;
+ }
+TInt CSvgLinearGradientElementImpl::SetAttributeIntL( const TInt aNameId,
+ const TInt32 aValue )
+{
+ CSvgGradientElementImpl::SetAttributeIntL( aNameId,
+ aValue );
+ return 0;
+
+}
+TInt CSvgLinearGradientElementImpl::GetAttributeIntL( const TInt aNameId, TInt32& aValue )
+{
+ CSvgGradientElementImpl::GetAttributeIntL(aNameId, aValue );
+ return 0;
+}
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgLinearGradientElementImpl::~CSvgLinearGradientElementImpl()
+ {
+
+ }
+
+void CSvgLinearGradientElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<linearGradient xlink:href=\"hmm\" spreadMethod=\"hmm\" gradientUnits=\"hmm\" gradientTransform=\"hmm\" x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\"/>",
+ /*Href(),*/ (int)iGfxLinearPaint.iX1, (int)iGfxLinearPaint.iY1, (int)iGfxLinearPaint.iX2, (int)iGfxLinearPaint.iY2);
+ #endif
+ }
+}
+TBool CSvgLinearGradientElementImpl::IsValidValue(const TDesC& aValue)
+{
+ TBool lValidValue = ETrue;
+ // aValue can only contain these characters "-+.%0123456789", If it contains any thing
+ // other than this it should be treated as 0.
+
+ _LIT(KValidChars,"-+.%0123456789");
+ TBufC<14> lValidChars(KValidChars);
+
+ TInt llength = aValue.Length();
+
+ for( int charpos = 0 ; charpos < llength; charpos++ )
+ {
+ if( lValidChars.Locate(aValue[charpos]) == KErrNotFound )
+ {
+
+ lValidValue = EFalse;
+ break;
+ }
+ }
+
+ return lValidValue;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGLockedRealTimeEntity.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,279 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "SVGLockedRealTimeEntity.h"
+
+CSvgLockedRealTimeEntity* CSvgLockedRealTimeEntity::NewL(CSvgDocumentImpl* aDoc)
+ {
+ CSvgLockedRealTimeEntity* self = new (ELeave) CSvgLockedRealTimeEntity(aDoc);
+ CleanupStack::PushL(self);
+ self->ConstructL(aDoc);
+ CleanupStack::Pop(self);
+ return self;
+ }
+//==========================================================================
+void CSvgLockedRealTimeEntity::ConstructL(CSvgDocumentImpl* aDoc)
+ {
+ iOwnerDocument = aDoc;
+ }
+//==========================================================================
+CSvgLockedRealTimeEntity::CSvgLockedRealTimeEntity(CSvgDocumentImpl* aDoc): CSvgMediaElementBase( aDoc ),
+ iIsPaused(EFalse),
+ iSyncMasterCurrent(EFalse)
+ {
+ //SyncBehaviour is locked
+ //MediaState is ready always
+
+ }
+//==========================================================================
+CSvgLockedRealTimeEntity::~CSvgLockedRealTimeEntity()
+ {
+
+ }
+
+//==========================================================================
+//from svgelementimpl
+void CSvgLockedRealTimeEntity::Print(TInt /*aValue*/)
+ {
+
+ }
+
+//==========================================================================
+/**
+* The parent time container provides the timing clock to
+* the timed entity (audio, video, animation, document)
+* using this routine.
+* @since S60 3.2
+* @param aTick Current tick information
+* @return none.
+*/
+void CSvgLockedRealTimeEntity::ParentTimeContainerTick( TSvgTick /*aTick*/ )
+{
+
+}
+
+//==========================================================================
+/**
+* Returns the sync behavior of the entity.
+* @since S60 3.2
+* @param none.
+* @return TSvgSyncBehaviour Element's Sync Behaviour.
+*/
+TSvgSyncBehaviour CSvgLockedRealTimeEntity::GetEntitySyncBehavior()
+{
+ return ESvgSyncLocked;
+}
+
+//==========================================================================
+/**
+* When the timed entity acts as timing master in the time container,
+* the time container gets the timed entity clock using this method
+* and feeds to rest of timed entities.
+* @since S60 3.2
+* @param aEntityCurTime Current Entity Time in msecs.
+* @return none.
+*/
+void CSvgLockedRealTimeEntity::GetEntityCurrentTime( TUint32& aEntityCurTime )
+ {
+ //Keep returning the same time if the entity is paused
+ if(iIsPaused)
+ {
+ aEntityCurTime = iStoredTick.iParentTcTick;
+ }
+ //add the relative time difference in realtimetick to parenttick
+ else
+ {
+ TSvgTick curTick = iOwnerDocument->TimeContainer()->GetCurTick();
+ TInt32 delta = curTick.iRealTimeTick - iStoredTick.iRealTimeTick;
+
+ if(delta < 0)
+ delta = 0;
+
+ aEntityCurTime = iStoredTick.iParentTcTick + delta;
+
+ }
+ }
+//==========================================================================
+/**
+* Returns the configured sync master value(as per DOM tree) as specified
+* in the SVG content.
+* @since S60 3.2
+* @param aIsSyncMaster Indicates whether the element is configured as
+* Sync Master.
+* Locked Real Time Entity can never be configured as syncmaster hence
+* This implementation is NULL
+* @return none.
+*/
+void CSvgLockedRealTimeEntity::GetCnfSyncMasterStatus( TBool& /*aIsSyncMaster*/ )
+{
+
+}
+
+//==========================================================================
+/**
+* Check if timed entity is going to act as timing master in the
+* time container. This behavior could change dynamically.
+* @since S60 3.2
+* @param aIsSyncMaster Indicates whether the element is currrently Sync Master.
+* @return none.
+*/
+void CSvgLockedRealTimeEntity::GetCurSyncMasterStatus( TBool& isSyncMaster )
+{
+ isSyncMaster = iSyncMasterCurrent;
+}
+
+//==========================================================================
+/** If some other element is resolved as syncMaster in the time container group,
+* this element can not act as sync master.
+* @since S60 3.2
+* @param aSyncMasterStatus Indicates whether the element is currrently
+* Sync Master.
+* @return none.
+*/
+void CSvgLockedRealTimeEntity::SetCurSyncMasterStatus( TBool aSyncMasterStatus )
+{
+ //iSyncMasterCurrent stores current Mastership status of LRT
+ // only if LRT is getting set as syncmaster then only we store the current tick
+ if(aSyncMasterStatus && !iSyncMasterCurrent)
+ {
+ iStoredTick = iOwnerDocument->TimeContainer()->GetCurTick();
+ #ifdef _DEBUG
+ RDebug::Printf("LRT gets set as Syncmaster \n");
+ #endif
+ }
+ if(iSyncMasterCurrent != aSyncMasterStatus)
+ {
+ iSyncMasterCurrent = aSyncMasterStatus;
+ }
+ #ifdef _DEBUG
+ RDebug::Printf("====================================");
+ RDebug::Printf("IStoredTick.iRealTimeTick %d", iStoredTick.iRealTimeTick);
+ RDebug::Printf("iStoredTick.iParentTcTick %d", iStoredTick.iParentTcTick);
+ RDebug::Printf("====================================");
+ #endif
+}
+
+
+//==========================================================================
+/**
+* Check if timed entity can provide timing ticks to rest of time
+* container elements. This behavior could change dynamically.
+* For example, if audio clip is over, the audio element can't generate
+* ticks for others.
+* @since S60 3.2
+* @param none.
+* @return TBool True if can generate timing tick.
+*/
+// LRT can always generate tick, it acts as a pseudo realtime
+TBool CSvgLockedRealTimeEntity::CanGenerateTick()
+ {
+ return ETrue;
+ }
+//==========================================================================
+/**
+* Check if timed entity can use its parent's tick. Usually only the
+* parent document should return true for this function.
+* All other elements return false
+* @since S60 3.2
+* @param none.
+* @return TBool True if can use parent's timing tick.
+*/
+//only used in animation purposes
+TBool CSvgLockedRealTimeEntity::CanUseParentTick()
+{
+ return EFalse;
+}
+
+//==========================================================================
+/**
+* If the timed entity needs to be in sync with the time container and
+* it has slipped beyond the sync tolerance limit, the method is called to
+* bring the element in sync with the time container.
+* @since S60 3.2
+* @param aSynctime Time for resync in msecs.
+* @return none.
+*/
+
+void CSvgLockedRealTimeEntity::ResyncTimedEntity( TUint32 /*aSynctime*/ )
+{
+
+}
+
+//==========================================================================
+/**
+* This would be used for pausing the locked timed entity while other locked
+* timed entities get loaded.
+* @since S60 3.2
+* @param none.
+* @return none.
+*/
+void CSvgLockedRealTimeEntity::PauseTimedEntity()
+ {
+ iStoredTick = iOwnerDocument->TimeContainer()->GetCurTick();
+ iIsPaused = ETrue;
+ }
+//==========================================================================
+/**
+* This would be used for resuming the locked timed entity once all locked
+* timed entities get loaded.
+* @since S60 3.2
+* @param none.
+* @return none.
+*/
+void CSvgLockedRealTimeEntity::ResumeTimedEntity()
+ {
+ iStoredTick = iOwnerDocument->TimeContainer()->GetCurTick();
+ iIsPaused = EFalse;
+ }
+//==========================================================================
+/**
+* This would be used for stopping the timed entity.
+* @since S60 3.2
+* @param none.
+* @return none.
+*/
+void CSvgLockedRealTimeEntity::StopTimedEntity()
+ {
+ iStoredTick.iParentTcTick = 0;
+ iStoredTick.iRealTimeTick = 0;
+ }
+
+//==========================================================================
+/* Return the type of class
+@Return Type Enumeration of object type
+@Parameters none
+*/
+TSvgObjectType CSvgLockedRealTimeEntity::ObjectType()
+ {
+ return ESvgLockedRealTimeEntity;
+ }
+
+//==========================================================================
+//for animation element
+CSvgTimeContainer* CSvgLockedRealTimeEntity::GetChildTimeContainer()
+ {
+ return NULL;
+ }
+TBool CSvgLockedRealTimeEntity::AnimProcL( MSvgTimerEvent* /*aEvent*/ )
+ {
+ return ETrue;
+ }
+void CSvgLockedRealTimeEntity::ResetAnimationL()
+ {
+
+ }
+
+/*******************************End of file*********************************/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGMediaAnimationElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,1880 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include "Gfx2dGcOpenVG.h"
+#include "GfxRoundRectangle2D.h"
+#include "SVGMediaAnimationElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGEngineImpl.h"
+#include "SVGSchemaData.h"
+#include "SVGEventHandler.h"
+
+_LIT( KXlink, "xlink:href" );
+_LIT( KFocusable, "focusable" );
+_LIT(KInitialVisibility, "initialVisibility");
+_LIT( KSvgFile, ".svg");
+_LIT( KSvgbFile, ".svgb");
+_LIT( KSvgzFile, ".svgz");
+_LIT(msg, "Fail to open file for reading: ");
+_LIT( KErrorMsg, "Failed to Load Svg Content: Read File Size Error." );
+_LIT( KMemoryErrorMsg, "Failed to Load Svg Content: Out of memory");
+_LIT( KReadErrorMsg, "Failed to Load Svg Content: Read File Data Error");
+_LIT(KEngineFailed, "Failed to Create Svg Document: Out of Memory");
+_LIT( KTmpDur, "dur" );
+_LIT( KTmpDurMedia, "media" );
+
+CSvgMediaAnimationElementImpl* CSvgMediaAnimationElementImpl::NewL(const TUint8
+ aElemID,CSvgDocumentImpl* aDoc )
+ {
+ CSvgMediaAnimationElementImpl* self = CSvgMediaAnimationElementImpl::NewLC
+ (aElemID,aDoc);
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgMediaAnimationElementImpl* CSvgMediaAnimationElementImpl::NewLC(const TUint8
+ aElemID, CSvgDocumentImpl* aDoc )
+ {
+ CSvgMediaAnimationElementImpl* self = new ( ELeave ) CSvgMediaAnimationElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID,aDoc );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaAnimationElementImpl::SetSyncBehavior
+// Set the Synchronised behaviour for the animation element
+// -----------------------------------------------------------------------------
+//
+void CSvgMediaAnimationElementImpl::SetSyncBehavior( const TDesC& aValue )
+ {
+ CSvgMediaElementBase::SetSyncBehavior( aValue );
+ // If document is created then set the sync value to the time container
+ if ( iNewDocument )
+ {
+ iNewDocument->SetTCSyncBehavior( iSyncBehavior );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaAnimationElementImpl::SetSyncTolerance
+// Set the Synchronised Tolerance for the animation element
+// -----------------------------------------------------------------------------
+//
+void CSvgMediaAnimationElementImpl::SetSyncTolerance( const TDesC& aValue )
+ {
+ CSvgMediaElementBase::SetSyncTolerance( aValue );
+
+ // If document is created then set the sync value to the time container
+ if ( iNewDocument )
+ {
+ iNewDocument->SetTCSyncTolerance( iSyncTolerance );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaAnimationElementImpl::SetSyncMaster
+// Set the animation element as Synchronised Master
+// -----------------------------------------------------------------------------
+//
+void CSvgMediaAnimationElementImpl::SetSyncMaster( const TDesC& aValue )
+ {
+ CSvgMediaElementBase::SetSyncMaster( aValue );
+
+ // If document is created then set the sync value to the time container
+ if ( iNewDocument )
+ {
+ iNewDocument->SetTCSyncMaster( iSyncMasterConfig );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgMediaAnimationElementImpl::ConstructL( const TUint8 aElemID,
+ CSvgDocumentImpl* /* aDoc */ )
+ {
+ CSvgMediaElementBase::ConstructL( aElemID );
+ iViewBoxImpl = CSvgFitToViewBoxImpl::NewL();
+ iIsFocusable = ETrue;
+ iDurMediaTime = ETrue;
+ iSvgError = CSvgErrorImpl::NewL();
+ if(!iSvgTransformable)
+ iSvgTransformable = CSvgTransformableImpl::NewL();
+ iChildSvgName = HBufC::NewL( 100 );
+ #ifdef SVG_FLOAT_BUILD
+ iX = ( 0 );
+ iY = ( 0 );
+ #else
+ iX.operator = ( 0 );
+ iY.operator = ( 0 );
+ #endif
+
+ #ifdef SVG_FLOAT_BUILD
+
+ iScale = ( 0 );
+ #else
+ iScale.operator = ( 0 );
+ #endif
+ iIsOriginalRootTrSet = EFalse;
+ if (OwnerDocument())
+ {
+ ((CSvgDocumentImpl*)OwnerDocument())->AddInternalMouseListener( this );
+ ((CSvgDocumentImpl*)iOwnerDocument)->AddToEventReceiverListL(
+ this, KSvgEventMaskExternalUI );
+ }
+
+ }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+
+CSvgMediaAnimationElementImpl::CSvgMediaAnimationElementImpl
+ ( CSvgDocumentImpl* aDoc ):CSvgMediaElementBase
+ ( aDoc ),iAnimationStatus(EPlayerStateIdle),iInitialVisibility(EAnimationNotVisible)
+
+
+ {
+ iAttrId = KAtrMediaAnimationId;
+ }
+
+// ---------------------------------------------------------------------------
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgMediaAnimationElementImpl::CloneL(MXmlElement* aParentElement)
+ {
+ CSvgMediaAnimationElementImpl* newElement = CSvgMediaAnimationElementImpl::
+ NewL( this->ElemID(), ((CSvgDocumentImpl*)iOwnerDocument) );
+
+ CleanupStack::PushL(newElement);
+ newElement->iParentNode = aParentElement;
+ // copy everything over
+ this->CopyL(newElement);
+ CleanupStack::Pop();
+ return newElement;
+ }
+
+// ==========================================================================
+// perform a deep copy of this object
+// ==========================================================================
+void CSvgMediaAnimationElementImpl::CopyL( CSvgMediaAnimationElementImpl* aDestElement )
+ {
+ if(aDestElement)
+ {
+ // copy stuff from superclass
+ this->CSvgElementImpl::CopyL(aDestElement);
+ this->CSvgMediaElementBase::CopyL(aDestElement);
+ aDestElement->iWidth = iWidth;
+ aDestElement->iHeight = iHeight;
+ aDestElement->iInitialVisibility = iInitialVisibility;
+ aDestElement->iDurMediaTime = iDurMediaTime;
+ aDestElement->iX = iX;
+ aDestElement->iY = iY;
+ aDestElement->iScale = iScale;
+ aDestElement->iOriginalRootTr = iOriginalRootTr;
+ aDestElement->iIsOriginalRootTrSet = iIsOriginalRootTrSet;
+ aDestElement->iAnimationStatus = iAnimationStatus;
+ aDestElement->iTargetElement = ( CSvgElementImpl * ) ParentNode();
+ aDestElement->iTargetSet = ETrue;
+ TInt handle = 0;
+ TInt engine = 0;
+ TPtr tPtr = this->iChildSvgName->Des();
+ aDestElement->PrepareDomChildSvg(tPtr,handle,engine);
+
+ }
+
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+CSvgMediaAnimationElementImpl::~CSvgMediaAnimationElementImpl()
+ {
+
+ delete iViewBoxImpl;
+ delete iSvgError;
+ delete iNewDocument;
+ iSvgMouseEnteredElements.Close();
+ delete iChildSvgName;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgMediaAnimationElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+ //added for the bug if no begin is given
+ if ( !iTargetSet )
+ {
+ // default is parent element
+ iTargetElement = ( CSvgElementImpl * ) ParentNode();
+ iTargetSet = ETrue;
+ }
+
+ // Encapsulates both viewBox and preserveAspectRatio attributes.
+ if ( iViewBoxImpl->SetViewBoxL( aName, aValue ) )
+ {
+ if ( iNewDocument && iNewDocument->RootElement() )
+ {
+ MSvgPreserveAspectRatio* lAspectRatio;
+ iViewBoxImpl->GetPreserveAspectRatio(lAspectRatio);
+
+ if ( lAspectRatio )
+ {
+ ((CSvgSvgElementImpl *)
+ (iNewDocument->RootElement()))->SetPreserveAspectRatioL
+ (lAspectRatio->GetAlign(), lAspectRatio->GetMeetOrSlice());
+ }
+ }
+
+ return KErrNone;
+ }
+
+ if ( aName == KXlink )
+ {
+ if ( aValue.Length() != 0 )
+ {
+ iChildSvgName = iChildSvgName->ReAlloc(aValue.Length());
+ TPtr tPtr = iChildSvgName->Des();
+ tPtr.Copy( aValue );
+ TInt length = tPtr.Length();
+ TPtrC tPtrCSvg = tPtr.Right(4);
+ TPtrC tPtrCSvgX = tPtr.Right(5);
+
+ if ( tPtrCSvg.Find(KSvgFile) == KErrNotFound &&
+ tPtrCSvgX.Find(KSvgbFile) == KErrNotFound
+ && tPtrCSvgX.Find(KSvgzFile) == KErrNotFound )
+ {
+ return KErrGeneral;
+ }
+ else
+ {
+ TInt handle = 0;
+ TInt engine = 0;
+ TPtrC fileName;
+ PrepareDomChildSvg(tPtr,handle,engine);
+
+ // Check if error occured
+ if ( !iSvgError->HasError() )
+ {
+ // If document is valid then set parameters of child svg
+ // element from animation element
+
+ if ( iNewDocument && iNewDocument->RootElement() )
+ {
+ ((CSvgSvgElementImpl *)
+ (iNewDocument->RootElement()))->iWidthInPercentage = EFalse;
+ ((CSvgSvgElementImpl *)
+ (iNewDocument->RootElement()))->iHeightInPercentage = EFalse;
+ ((CSvgSvgElementImpl *)
+ (iNewDocument->RootElement()))->SetWidth((TFloatFixPt)iWidth);
+ ((CSvgSvgElementImpl *)
+ (iNewDocument->RootElement()))->SetHeight((TFloatFixPt)iHeight);
+
+ // Set the Sync Values from animation element to time container
+ // Sync Behaviour
+ iNewDocument->SetTCSyncBehavior( iSyncBehavior );
+ // Sync Tolerance
+ iNewDocument->SetTCSyncTolerance( iSyncTolerance );
+ // Sync Mastership
+ iNewDocument->SetTCSyncMaster( iSyncMasterConfig );
+
+ MSvgPreserveAspectRatio* lAspectRatio;
+ iViewBoxImpl->GetPreserveAspectRatio(lAspectRatio);
+
+ if ( lAspectRatio )
+ {
+ ((CSvgSvgElementImpl *)
+ (iNewDocument->RootElement()))->
+ SetPreserveAspectRatioL(lAspectRatio->GetAlign(),
+ lAspectRatio->GetMeetOrSlice());
+ }
+
+ }
+ }
+ else
+ {
+ return KErrGeneral;
+ }
+ }
+ }
+ }
+
+ else if ( aName == KFocusable )
+ {
+ if ( aValue == _L("true") )
+ iIsFocusable = ETrue;
+ if ( aValue == _L("false") )
+ iIsFocusable = EFalse;
+ }
+ else if ( aName == KInitialVisibility )
+ {
+ if ( aValue == _L("always") )
+ {
+ iInitialVisibility = EAnimationVisible;
+ }
+ }
+ else if ( aName == KTmpDur && aValue != KTmpDurMedia )
+ {
+ iDurMediaTime = EFalse;
+ return CSvgMediaElementBase::SetAttributeL(aName, aValue);
+ }
+ else
+ {
+ return CSvgMediaElementBase::SetAttributeL(aName, aValue);
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgMediaAnimationElementImpl::SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue )
+ {
+ return CSvgMediaElementBase::SetAttributeDesL( aNameId, aValue );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgMediaAnimationElementImpl::GetAttributeFloat(const TInt aNameId,
+ TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrX:
+ aValue = iX ;
+ break;
+
+ case KAtrY:
+ aValue = iY ;
+ break;
+
+ case KAtrWidth:
+ aValue = iWidth ;
+ break;
+
+ case KAtrHeight:
+ aValue = iHeight ;
+ break;
+ default:
+ return CSvgMediaElementBase::GetAttributeFloat( aNameId, aValue );
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgMediaAnimationElementImpl::SetAttributeFloatL( const TInt aNameId,
+ TFloatFixPt aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrX:
+ iX = aValue;
+ SetInitialCTM();
+ break;
+
+ case KAtrY:
+ iY = aValue;
+ SetInitialCTM();
+ break;
+
+ case KAtrWidth:
+ iWidth = aValue;
+ break;
+
+ case KAtrHeight:
+ iHeight= aValue;
+ break;
+
+ default:
+ return CSvgMediaElementBase::SetAttributeFloatL( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// From MSvgEventReceiver
+// ---------------------------------------------------------------------------
+
+TBool CSvgMediaAnimationElementImpl::ReceiveEventL( MSvgEvent* aEvent )
+ {
+ if( CSvgElementImpl::IsSVGEnginePaused())
+ {
+ return EFalse;
+ }
+
+ if ( !iNewDocument )
+ {
+ return EFalse;
+ }
+ // Process animation element's events first
+ TBool lSelfRedrawReqd = CSvgMediaElementBase::ReceiveEventProcL( aEvent,
+ this );
+
+ CSvgElementImpl::ReceiveEventL(aEvent);
+ // Only External UI events are sent to the child document
+ if ( ( aEvent->EventMask() & KSvgEventMaskExternalUI ) )
+ {
+ TInt lEvtTime = 0;
+ // Save the time as the ProcessEvent modifies the time of the event
+ // to the document's current time for keypress events
+ if ( aEvent->EventType() == ESvgEngineEventKeyPress )
+ {
+ lEvtTime = ( ( MSvgUiKeyEvent * ) aEvent )->Time();
+ }
+
+ // Send the events to the child document
+ ( ( ( CSvgDocumentImpl* )
+ iOwnerDocument )->Engine() )->ProcessEventL( iNewDocument,
+ aEvent, EFalse );
+
+ // Restore the time, so that when the event is propogated to
+ // further elements in the DOM tree, the time is in sync with
+ // respect to current document time.
+ if ( aEvent->EventType() == ESvgEngineEventKeyPress )
+ {
+ ( ( MSvgUiKeyEvent * ) aEvent )->SetTime( lEvtTime );
+ }
+
+ }
+ return lSelfRedrawReqd;
+
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+void CSvgMediaAnimationElementImpl::ResetAnimationL()
+ {
+ // Check if document is valid
+ if ( !iNewDocument || !iNewDocument->RootElement() )
+ {
+ return;
+ }
+
+ if (( iAnimStatus == KAnimActive ) ||
+ ( iAnimStatus == KAnimFinished) ||
+ ( iAnimStatus == KAnimEnd))
+ {
+ if (( iAnimationStatus == EPlayerStatePlaying ) ||
+ ( iAnimationStatus == EPlayerStateStop ))
+ {
+ // if previously audio is still playing, and asked to play again...
+ iNewDocument->SetCurrentTime( 0 );
+
+ iNewDocument->iAnimationResetNeeded = ETrue;
+
+ if(this->iNewDocument && this->iNewDocument->iEventHandler)
+ {
+ this->iNewDocument->iEventHandler->SetCurrentTime(0);
+ }
+
+ TSvgTimerEvent timeEvent(0);
+
+
+ iNewDocument->Reset( &timeEvent );
+ // Save the animation start tick so that
+ // child document's tick can be correctly offset
+ iBeginTick = ( ( CSvgDocumentImpl* )
+ iOwnerDocument )->TimeContainer()->GetCurTick();
+ iAnimationStatus = EPlayerStatePlaying;
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgMediaAnimationElementImpl::Reset( MSvgEvent* aEvent )
+ {
+
+ iIsUserSeek = ETrue;
+
+ // call the animation base function.
+ TSvgTimerEvent* timerEvent = ( TSvgTimerEvent* ) aEvent;
+
+
+ if ( (TInt32)timerEvent->Time() < iAbsoluteBeginTime )
+ {
+ // let it come to initial position.
+ ((CSvgDocumentImpl*)iOwnerDocument)->iInitialDrawFlag = ETrue;
+ ReInitializeAnimation();
+ // Seek to the initial position means that
+ // animation should also be drawn in initial position
+ if ( iNewDocument && iNewDocument->RootElement() )
+ {
+ iNewDocument->SetCurrentTime( 0 );
+ iNewDocument->iAnimationResetNeeded = ETrue;
+
+ if ( this->iNewDocument && this->iNewDocument->iEventHandler )
+ {
+ this->iNewDocument->iEventHandler->SetCurrentTime(0);
+ }
+
+ TSvgTimerEvent timeEvent(0);
+ iNewDocument->Reset( &timeEvent );
+ }
+ return;
+ }
+ TRAPD(error,CSvgMediaElementBase::ResetL( aEvent, this));
+
+ if ( error != KErrNone )
+ {
+ // error processing not processed
+ return;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+TBool CSvgMediaAnimationElementImpl::DoAnimProcL(MSvgEvent* aEvent)
+ {
+ if ( !iNewDocument )
+ {
+ return EFalse;
+ }
+ return this->AnimProcL((MSvgTimerEvent*)aEvent);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+TBool CSvgMediaAnimationElementImpl::IsViewable()
+ {
+ if ( iInitialVisibility == EAnimationVisible )
+ {
+ return ETrue;
+ }
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgMediaAnimationElementImpl::Print( TBool /*aIsEncodeOn */)
+ {
+ // No implementation.
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgMediaAnimationElementImpl::DrawL( CGfx2dGc* aGc,
+ CSvgElementImpl* /* aElement */)
+ {
+ // Check if document is valid
+ if ( !iNewDocument || !iNewDocument->RootElement() || (TInt)iWidth==0 ||
+ (TInt)iHeight==0 )
+ {
+ return EFalse;
+ }
+
+ // if iInitialVisibility status is EAnimationInitialised then draw won't happen
+ if ( iInitialVisibility == EAnimationNotVisible ||
+ iInitialVisibility == EAnimationVisible )
+ {
+
+ // visibility is set to initialised state to get font before actual draw
+ if ( iInitialVisibility == EAnimationNotVisible )
+ {
+ iInitialVisibility = EAnimationInitialised;
+ }
+
+ TReal32 opacity = 1;
+ TGfxRoundRectangle2D Rectangle;
+ TGfxAffineTransform aTr = GetCTM();
+ ((CSvgSvgElementImpl *)(iNewDocument->RootElement()))->SetTransformList
+ (iOriginalRootTr);
+ ((CSvgElementImpl*)iNewDocument->RootElement())->UpdateCTM();
+
+ iNewDocument->iIsRendering = ETrue;
+ ((CGfx2dGcOpenVG*)aGc)->BindToMediaImageL(iScale * iWidth,iScale * iHeight);
+ (iNewDocument->Engine())->DrawElementsL((CSvgElementImpl*)
+ (iNewDocument->RootElement()));
+ iNewDocument->iIsRendering = EFalse;
+ TGfxAffineTransform tMatrix;
+ tMatrix = aTr;
+
+ #ifdef SVG_FLOAT_BUILD
+ tMatrix.Scale( ( TFloatFixPt( 1 ) / ( iScale ) ),
+ ( TFloatFixPt( 1 ) / ( iScale ) ) );
+ #else
+ tMatrix.Scale( ( TFloatFixPt( 0x10000,ETrue ) / ( iScale ) ),
+ ( TFloatFixPt( 0x10000,ETrue ) / ( iScale ) ) );
+ #endif
+
+ // draw happens only if iInitialVisibility status is EAnimationVisible
+ // i.e. animation element has started its animation
+
+ ((CGfx2dGcOpenVG*)aGc)->UnbindFromMediaImageL(tMatrix,opacity,150,150,iInitialVisibility);
+
+ tMatrix.Concatenate(iOriginalRootTr);
+ ((CSvgSvgElementImpl *)(iNewDocument->RootElement()))->SetTransformList
+ (tMatrix);
+ ((CSvgElementImpl*)iNewDocument->RootElement())->UpdateCTM();
+ return ETrue;
+ }
+
+ return EFalse;
+ }
+
+//---------------------------------------------------------------------------
+//
+//---------------------------------------------------------------------------
+void CSvgMediaAnimationElementImpl::SetInitialCTM()
+ {
+
+ TGfxAffineTransform aTr(1,0,0,1,iX,iY);
+ SetTransformList(aTr);
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgMediaAnimationElementImpl::GetChildDocument()
+// Accessor function for obtaining the child SVG document
+// ---------------------------------------------------------------------------
+CSvgDocumentImpl* CSvgMediaAnimationElementImpl::GetChildDocument()
+ {
+ if ( iNewDocument )
+ return iNewDocument;
+ else
+ return NULL;
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaAnimationElementImpl::SetPreserveAspectRatioL
+// From CSvgElementImpl
+// -----------------------------------------------------------------------------
+//
+void CSvgMediaAnimationElementImpl::SetPreserveAspectRatioL(
+ TSvgPreserveAspectAlignType aAlign,
+ TSvgMeetOrSliceType aMeetSlice )
+ {
+ iViewBoxImpl->SetPreserveAspectRatioL( aAlign, aMeetSlice);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgMediaAnimationElementImpl::SetWidth(TReal32 aValue)
+ {
+ iWidth = aValue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgMediaAnimationElementImpl::SetHeight(TReal32 aValue)
+ {
+ iHeight = aValue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+MSvgError* CSvgMediaAnimationElementImpl::PrepareDomChildSvg
+ (const TDesC& aFileName,TInt& aHandle, TInt aEngine)
+ {
+ // Create session to open file
+ RFs session;
+ CSvgDocumentImpl::OpenSession( session, *iSvgError );
+ if ( iSvgError->HasError() )
+ {
+ return iSvgError;
+ }
+
+ // Open file handle
+ RFile fileHandle;
+ TInt openError = 0;
+
+ if ( ((CSvgDocumentImpl*)iOwnerDocument)->Engine() == NULL )
+ {
+ return iSvgError;
+ }
+ if ( (((CSvgDocumentImpl*)iOwnerDocument)->Engine())->iRequestObserver == NULL)
+ {
+ return iSvgError;
+ }
+
+ openError = (((CSvgDocumentImpl*)iOwnerDocument)->Engine())->iRequestObserver
+ ->FetchImage( aFileName, session,fileHandle );
+
+ if ( openError != KErrNone )
+ {
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, openError,
+ msg, aFileName );
+ fileHandle.Close();
+ session.Close();
+ return iSvgError;
+ }
+ else
+ {
+ PrepareDomChildSvg( fileHandle, aHandle, aEngine );
+ }
+
+ // If iDurMediaTime is ETrue then it means dur has been set as sometime
+ // else dur was not there and defauly media duration is set.
+ // iDurMediaTime is set to ETrue by default.
+ if ( iDurMediaTime )
+ {
+ TUint32 dur = iNewDocument->AnimationDuration();
+ if ( dur == 0xFFFFFFFF )
+ {
+ fileHandle.Close();
+ session.Close();
+ return iSvgError;
+ }
+ dur /= 1000;
+ TBuf<10> number;
+ number.Num(dur);
+ CSvgMediaElementBase::SetAttributeL(KTmpDur, number);
+ }
+
+
+
+ fileHandle.Close();
+ session.Close();
+ return iSvgError;
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+ MSvgError* CSvgMediaAnimationElementImpl::PrepareDomChildSvg
+ ( RFile& aFileHandle, TInt& aHandle, TInt aEngine)
+ {
+ // reset to start of file
+ TInt zero = 0;
+ aFileHandle.Seek( ESeekStart, zero );
+
+ TInt fileSize = 0;
+ TInt sizeError = aFileHandle.Size( fileSize );
+ if ( sizeError != KErrNone )
+ {
+
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgUnknown, sizeError,
+ KErrorMsg, KNullDesC );
+ return iSvgError;
+ }
+
+ HBufC8* byteArray = NULL;
+ TRAPD( error, byteArray = HBufC8::NewL( fileSize ) );
+ if ( error != KErrNone )
+ {
+
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgNoMemory, error,
+ KMemoryErrorMsg, KNullDesC );
+ return iSvgError;
+ }
+
+ TPtr8 des = byteArray->Des();
+ TInt readError = aFileHandle.Read( des );
+ if ( readError != KErrNone )
+ {
+
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgNoMemory, error,
+ KReadErrorMsg, KNullDesC );
+ delete byteArray;
+ return iSvgError;
+ }
+
+ PrepareDomChildSvg( *byteArray, aHandle, aEngine );
+ delete byteArray;
+ return iSvgError;
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+MSvgError* CSvgMediaAnimationElementImpl::PrepareDomChildSvg(const TDesC8& aByteData,
+ TInt& aHandle, TInt /* aEngine */)
+ {
+ aHandle = 0;
+
+ // Clear Error
+ iSvgError->SetErrorCode( ESvgNoError );
+
+
+ // CSvgDocumentImpl* newDocument = NULL;
+ CSvgSvgElementImpl* lRoot = (CSvgSvgElementImpl* )((CSvgDocumentImpl* )
+ iOwnerDocument)->RootElement();
+
+ // Get the default sync behaviour from SVG element
+ TSvgSyncBehaviour lRootSB = lRoot->SyncBehaviorDefault();
+
+ // Get the default tolerance from SVG element
+ TInt32 lRootST = lRoot->SyncToleranceDefault();
+
+ // Indicate ETrue while creating document to indicate that
+ // document has a parent
+ CSvgBitmapFontProvider *tempBitmapFontProvider =
+ ((CSvgDocumentImpl*)iOwnerDocument)->GetBitmapFontProvider();
+
+ TRAPD( error, iNewDocument = CSvgDocumentImpl::NewL( tempBitmapFontProvider,
+ ETrue, lRootSB, lRootST ) );
+
+ // Check for error
+ if ( error != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Print(KEngineFailed);
+ #endif //_DEBUG
+ CSvgDocumentImpl::PrepareError( *iSvgError, ESvgNoMemory, error,
+ KEngineFailed, KNullDesC );
+ return iSvgError;
+ }
+
+ // Set appropriate flags to documents
+ iNewDocument->SetWasPrepared( !iIsLoadingRequest );
+ iNewDocument->SetDRMMode( iDrmEnabled );
+ iNewDocument->SetThumbNailMode( iIsThumbNailMode );
+
+
+ iNewDocument->SetEngine(((CSvgDocumentImpl*)iOwnerDocument)->Engine());
+ iNewDocument->SetLoadingListeners(((CSvgDocumentImpl*)iOwnerDocument)
+ ->GetLoadingListeners());
+
+ // Parse document
+ iNewDocument->Load( aByteData, *iSvgError );
+
+ #ifdef _DEBUG
+ if ( iNewDocument->GetError() && iNewDocument->GetError()->HasError() )
+ {
+ RDebug::Printf("Load warning: ");
+ RDebug::RawPrint( iNewDocument->GetError()->Description() );
+ }
+ #endif
+
+ iFileIsLoaded = !iSvgError->HasError() || iSvgError->IsWarning();
+
+ // Parsing error or out of memory
+ if ( !iFileIsLoaded )
+ {
+ return iSvgError;
+ }
+
+ aHandle = (TInt)iNewDocument;
+
+ // Add the animation element as an observer on the child time
+ // container
+ iNewDocument->TimeContainer()->SetTcObserver( this );
+
+ return iSvgError;
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaAnimationElementImpl::ParentTimeContainerTick
+// From CSvgMediaElementBase
+// -----------------------------------------------------------------------------
+//
+void CSvgMediaAnimationElementImpl::ParentTimeContainerTick(
+ TSvgTick /* aTick */) // Current tick information
+ {
+ //empty implementation
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSvgMediaAnimationElementImpl::GetEntityCurrentTime
+// From CSvgMediaElementBase
+// -----------------------------------------------------------------------------
+//
+void CSvgMediaAnimationElementImpl::GetEntityCurrentTime( TUint32&
+ aEntityCurTime ) // Current Entity Time in msecs.
+ {
+ if ( iNewDocument )
+ {
+ // Access time container from child document
+ CSvgTimeContainer* lChildTC = iNewDocument->TimeContainer();
+
+ if ( lChildTC )
+ {
+ lChildTC->GetEntityCurrentTime( aEntityCurTime );
+ // Adjust the time from the timed entity to compensate
+ // the BeginTick's parent time container tick
+ aEntityCurTime += iBeginTick.iParentTcTick;
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaAnimationElementImpl::SetCurSyncMasterStatus
+// From CSvgMediaElementBase
+// -----------------------------------------------------------------------------
+void CSvgMediaAnimationElementImpl::SetCurSyncMasterStatus(
+ TBool aSyncMasterStatus ) // Indicates whether the element is currrently
+ // Sync Master.
+ {
+ // Set the current sync master status
+ CSvgMediaElementBase::SetCurSyncMasterStatus( aSyncMasterStatus );
+ if ( iNewDocument )
+ {
+ // Access time container from child document
+ CSvgTimeContainer* lChildTC = iNewDocument->TimeContainer();
+
+ if ( lChildTC )
+ {
+ lChildTC->SetCurSyncMasterStatus( aSyncMasterStatus );
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaAnimationElementImpl::CanGenerateTick
+// From CSvgMediaElementBase
+// -----------------------------------------------------------------------------
+TBool CSvgMediaAnimationElementImpl::CanGenerateTick()
+ {
+ if ( iNewDocument )
+ {
+ // Access time container from child document
+ CSvgTimeContainer* lChildTC = iNewDocument->TimeContainer();
+
+ if ( lChildTC )
+ {
+ return ( lChildTC->CanGenerateTick() );
+ }
+ }
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaAnimationElementImpl::ResyncTimedEntity
+// From CSvgMediaElementBase
+// -----------------------------------------------------------------------------
+void CSvgMediaAnimationElementImpl::ResyncTimedEntity(
+ TUint32 /* aSynctime */ ) // Time for resync in msecs.
+ {
+ // Empty Implementation
+ }
+// -----------------------------------------------------------------------------
+// CSvgMediaAnimationElementImpl::PauseTimedEntity
+// From CSvgMediaElementBase
+// -----------------------------------------------------------------------------
+void CSvgMediaAnimationElementImpl::PauseTimedEntity()
+ {
+ iIsSyncPauseIssued = ETrue;
+ if ( iNewDocument && iAnimationStatus == EPlayerStatePlaying )
+ {
+ iAnimationStatus = EPlayerStatePaused;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaAnimationElementImpl::ResumeTimedEntity
+// From CSvgMediaElementBase
+// -----------------------------------------------------------------------------
+void CSvgMediaAnimationElementImpl::ResumeTimedEntity()
+ {
+ iIsSyncPauseIssued = EFalse;
+ if ( iNewDocument && iAnimationStatus == EPlayerStatePaused )
+ {
+ // The child time container recieves the event from the parent time
+ // container directly.
+ iAnimationStatus = EPlayerStatePlaying;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaAnimationElementImpl::StopTimedEntity
+// From CSvgMediaElementBase
+// -----------------------------------------------------------------------------
+void CSvgMediaAnimationElementImpl::StopTimedEntity()
+ {
+ if ( iNewDocument )
+ {
+ iAnimationStatus = EPlayerStateStop;
+ }
+ }
+
+
+//From MSvgTimedEntityInterface
+TSvgObjectType CSvgMediaAnimationElementImpl::ObjectType()
+ {
+ return ESvgMediaAnimationElement;
+ }
+
+
+//returns the child time container of the element
+//used in timecontainer
+CSvgTimeContainer* CSvgMediaAnimationElementImpl::GetChildTimeContainer()
+ {
+ //Check for valid document and get time container from documentimpl
+ if ( iNewDocument )
+ {
+ return iNewDocument->TimeContainer();
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+// -----------------------------------------------------------------------------
+// CSvgMediaAnimationElementImpl::TimeContainerReady
+// From MSvgTimeContainerObserver
+// -----------------------------------------------------------------------------
+void CSvgMediaAnimationElementImpl::TimeContainerReady()
+ {
+ // Access time container from owner document
+ CSvgTimeContainer* lOwnerTC = ((CSvgDocumentImpl* )
+ iOwnerDocument)->TimeContainer();
+
+ if ( lOwnerTC )
+ {
+ lOwnerTC->TimedEntityReady( this );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaAnimationElementImpl::TimeContainerNotReady
+// From MSvgTimeContainerObserver
+// -----------------------------------------------------------------------------
+void CSvgMediaAnimationElementImpl::TimeContainerNotReady()
+ {
+ // Access time container from owner document
+ CSvgTimeContainer* lOwnerTC = ((CSvgDocumentImpl* )
+ iOwnerDocument)->TimeContainer();
+
+ if ( lOwnerTC )
+ {
+ lOwnerTC->TimedEntityNotReady( this );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+TBool CSvgMediaAnimationElementImpl::AnimProcL( MSvgTimerEvent* /* aEvent */ )
+ {
+#ifdef _DEBUG
+ RDebug::Print(_L("%d %d"), iAnimStatus, IsAnimating());
+#endif
+ // Check if document is valid
+ if ( !iNewDocument || !iNewDocument->RootElement() )
+ {
+ return EFalse;
+ }
+ if ( iAnimationStatus == EPlayerProhibit )
+ return EFalse;
+ if ( iAnimTime->DurationTime() == KTimeIndefinite || iAnimTime->DurationTime() == 0 )
+ {
+ return EFalse;
+ }
+
+ if ( iAnimStatus != KAnimActive )
+ {
+ if ( iAnimationStatus == EPlayerStatePlaying )
+ {
+ //stop child svg animation based on freeze/remove value.
+ if( iFill == KAnimFillRemove )
+ {
+ iNewDocument->SetCurrentTime( 0 );
+
+ iNewDocument->iAnimationResetNeeded = ETrue;
+
+ if (iNewDocument && iNewDocument->iEventHandler )
+ {
+ iNewDocument->iEventHandler->SetCurrentTime(0);
+ }
+
+ TSvgTimerEvent timeEvent(0);
+
+
+ iNewDocument->Reset( &timeEvent );
+ }
+
+ iAnimationStatus = EPlayerStateStop;
+ return EFalse;
+ }
+ }
+ else //iAnimStatus == KAnimActive
+ {
+ if ( !iHadBegun )
+ {
+ iHadBegun = ETrue;
+ // animation element can be drawn now
+ iInitialVisibility = EAnimationVisible;
+ // this is a restart from begin list.
+ if ( (iAnimationStatus != EPlayerStateIdle) )
+// (iAnimationStatus != EPlayerStatePlayInit))
+ {
+
+ //child svg animataion should begin from 0 again, seek it to zero.
+
+ // Remember the current time as beginning of the animation.
+
+ iNewDocument->SetCurrentTime(0);
+
+ iNewDocument->iAnimationResetNeeded = ETrue;
+
+ if ( this->iNewDocument && this->iNewDocument->iEventHandler )
+ {
+ this->iNewDocument->iEventHandler->SetCurrentTime(0);
+ }
+
+ TSvgTimerEvent timeEvent(0);
+
+
+ iNewDocument->Reset( &timeEvent );
+
+ // Save the animation start tick so that
+ // child document's tick can be correctly offset
+ iBeginTick = ( ( CSvgDocumentImpl* )
+ iOwnerDocument )->TimeContainer()->GetCurTick();
+ iAnimationStatus = EPlayerStatePlaying;
+
+ }
+ return ETrue;
+ }
+
+
+ if ( iAnimationStatus == EPlayerStateIdle ) // stopped
+ {
+ //child svg animataion should begin from 0 i.e for the first time
+ // Remember the current time as beginning of the animation.
+ iNewDocument->SetCurrentTime( 0 );
+
+ iNewDocument->iAnimationResetNeeded = ETrue;
+
+ if ( this->iNewDocument && this->iNewDocument->iEventHandler )
+ {
+ this->iNewDocument->iEventHandler->SetCurrentTime(0);
+ }
+
+ TSvgTimerEvent timeEvent(0);
+
+
+ iNewDocument->Reset( &timeEvent );
+
+ // Save the animation start tick so that
+ // child document's tick can be correctly offset
+ iBeginTick = ( ( CSvgDocumentImpl* )
+ iOwnerDocument )->TimeContainer()->GetCurTick();
+ iAnimationStatus = EPlayerStatePlaying;
+ return ETrue;
+ }
+
+ if ( iAnimationStatus == EPlayerStatePlaying )
+ {
+
+ // child svg active and in running state so pass the tick
+ // to the child svg's time container
+ // Subtract the reference begin tick from the current tick
+ // before giving the tick.
+ TSvgTick lChildTick = ( ( CSvgDocumentImpl* )
+ iOwnerDocument )->TimeContainer()->GetCurTick();
+
+ lChildTick.iParentTcTick -= iBeginTick.iParentTcTick;
+ lChildTick.iRealTimeTick -= iBeginTick.iRealTimeTick;
+ lChildTick.iParentTcTick -= iNegativeBeginTime;
+ lChildTick.iRealTimeTick -= iNegativeBeginTime;
+ iNewDocument->TimeContainer()->ParentTimeContainerTick
+ ( lChildTick );
+ }
+ if ( iAnimationStatus == EPlayerStateStop )
+ {
+
+ iNewDocument->SetCurrentTime( 0 );
+ iNewDocument->iAnimationResetNeeded = ETrue;
+
+ if ( this->iNewDocument && this->iNewDocument->iEventHandler )
+ {
+ this->iNewDocument->iEventHandler->SetCurrentTime(0);
+ }
+
+ TSvgTimerEvent timeEvent(0);
+
+
+ iNewDocument->Reset( &timeEvent );
+
+ // Save the animation start tick so that
+ // child document's tick can be correctly offset
+ iBeginTick = ( ( CSvgDocumentImpl* )
+ iOwnerDocument )->TimeContainer()->GetCurTick();
+ iAnimationStatus = EPlayerStatePlaying;
+ return ETrue;
+ }
+ }
+
+
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+void CSvgMediaAnimationElementImpl::InitAnimationL()
+ {
+ if ( !iNewDocument )
+ {
+ return;
+ }
+ CSvgMediaElementBase::InitAnimationL();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgMediaAnimationElementImpl::GetPreserveAspectRatio(
+ MSvgPreserveAspectRatio*& aAspectRatio )
+ {
+ iViewBoxImpl->GetPreserveAspectRatio( aAspectRatio );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgMediaAnimationElementImpl::X()
+ {
+ return iX;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgMediaAnimationElementImpl::Y()
+ {
+ return iY;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgMediaAnimationElementImpl::Width()
+ {
+ return iWidth;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgMediaAnimationElementImpl::Height()
+ {
+ return iHeight;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+ void CSvgMediaAnimationElementImpl::GetBBox( TGfxRectangle2D& aBbox )
+ {
+ TGfxRoundRectangle2D aRectangle;
+
+ aRectangle.iX = 0;
+ aRectangle.iY = 0;
+ aRectangle.iHeight = iHeight;
+ aRectangle.iWidth = iWidth;
+ if ( !(TInt32)iHeight || !(TInt32)iWidth || iInitialVisibility != EAnimationVisible )
+ {
+ aRectangle.iHeight = aRectangle.iWidth = 0;
+ }
+ aRectangle.GetBounds( GetCTM(), aBbox );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgMediaAnimationElementImpl::GetFourPointBBox
+ (TSvgFourPointRect& aFourPointBbox)
+{
+ const TGfxAffineTransform& ctm = GetCTM();
+ TGfxRoundRectangle2D aRectangle;
+ aRectangle.iX = 0;
+ aRectangle.iY = 0;
+ aRectangle.iHeight = iHeight;
+ aRectangle.iWidth = iWidth;
+
+ if ( !(TInt32)iHeight || !(TInt32)iWidth )
+ {
+ aRectangle.iHeight = aRectangle.iWidth = 0;
+ }
+ TSvgFourPointRect lFourPointBox(aRectangle.iX, aRectangle.iY, aRectangle.iWidth, aRectangle.iHeight);
+
+ TGfxPoint2D lPoint1, lPoint2, lPoint3, lPoint4;
+
+ lFourPointBox.GetPoints(lPoint1, lPoint2, lPoint3, lPoint4);
+
+ ctm.Transform(&lPoint1, &lPoint1, 1);
+ ctm.Transform(&lPoint2, &lPoint2, 1);
+ ctm.Transform(&lPoint3, &lPoint3, 1);
+ ctm.Transform(&lPoint4, &lPoint4, 1);
+
+ aFourPointBbox.SetRectPoints(lPoint1, lPoint2, lPoint3, lPoint4);
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgMediaAnimationElementImpl::GetUnscaledBBox( TGfxRectangle2D& aBbox )
+ {
+ TGfxAffineTransform identityTx;
+ TGfxRoundRectangle2D aRectangle;
+ aRectangle.iX = iX;
+ aRectangle.iY = iY;
+ aRectangle.iHeight = iHeight;
+ aRectangle.iWidth = iWidth;
+ aRectangle.GetBounds( identityTx, aBbox );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgMediaAnimationElementImpl::MouseEntered(
+ RPointerArray<CSvgElementImpl>& /* aElements */,
+ TInt aX, TInt aY )
+
+ {
+ if ( !iNewDocument )
+ {
+ return EFalse;
+ }
+
+ TInt listenerCount = (((CSvgDocumentImpl*)iOwnerDocument)->Engine())->
+ MouseListenerCount();
+
+ if ( iNewDocument )
+ {
+ listenerCount += iNewDocument->MouseInternalListenerCount();
+ }
+ if ( listenerCount == 0 )
+ {
+ return EFalse;
+ }
+ // Get list of elements containing pointer (bounding-box)
+ RPointerArray<CSvgElementImpl> viewableElements;
+ RPointerArray<CSvgElementImpl> enteringElements;
+ RPointerArray<CSvgElementImpl> stillInsideElements;
+ (((CSvgDocumentImpl*)iOwnerDocument)->Engine())->GetViewableElementsAtPoint
+ (iNewDocument, viewableElements, aX, aY );
+
+ // check for mouse entering of elements
+ TInt viewableEleCnt = viewableElements.Count();
+ for ( TInt i = 0; i < viewableEleCnt; i++ )
+ {
+ // If an element is in the view-list but NOT in the entered-list
+ // then, it's copied to the entered-list
+ // otherwise, ignore (still inside)
+ if ( iSvgMouseEnteredElements.Find( viewableElements[i] )
+ == KErrNotFound )
+ {
+ enteringElements.Append( viewableElements[i] );
+ }
+ else
+ {
+ stillInsideElements.Append( viewableElements[i] );
+ }
+ }
+
+ // check for mouse exiting of elements
+ RPointerArray<CSvgElementImpl> exitingElements;
+ TInt svgMouseEnteredEleCnt = iSvgMouseEnteredElements.Count();
+ for ( TInt i = 0; i < svgMouseEnteredEleCnt; i++ )
+ {
+ // If an element is in the entered-list but not the view-list
+ // then, it's copied to the exiting list
+ // otherwise, ignore (
+ if ( viewableElements.Find( iSvgMouseEnteredElements[i] )
+ == KErrNotFound )
+ {
+ exitingElements.Append( iSvgMouseEnteredElements[i] );
+ }
+ }
+
+ // Remove exiting elements from entered list
+ TInt exitingEleCnt = exitingElements.Count();
+ for ( TInt i = 0; i < exitingEleCnt; i++ )
+ {
+ TInt index = iSvgMouseEnteredElements.Find( exitingElements[i] );
+ if ( index != KErrNotFound )
+ {
+ iSvgMouseEnteredElements.Remove( index );
+ }
+ }
+
+ // Add entering elements to entered-list
+ TInt enteringEleCnt = enteringElements.Count();
+ for ( TInt i = 0; i < enteringEleCnt; i++ )
+ {
+ iSvgMouseEnteredElements.Append( enteringElements[i] );
+ }
+
+ // Notify exiting
+ if ( exitingElements.Count() > 0 )
+ {
+ (((CSvgDocumentImpl*)iOwnerDocument)->Engine())->NotifyMouseExited
+ ( exitingElements, aX, aY );
+ if ( iNewDocument )
+ {
+ iNewDocument->NotifyInternalMouseExited( exitingElements, aX, aY );
+ }
+ }
+
+ // Notify entering
+ if ( enteringElements.Count() > 0 )
+ {
+ (((CSvgDocumentImpl*)iOwnerDocument)->Engine())->NotifyMouseEntered
+ ( enteringElements, aX, aY );
+ if ( iNewDocument )
+ {
+ iNewDocument->NotifyInternalMouseEntered( enteringElements, aX, aY );
+ }
+ }
+
+ // Notify moved
+ if ( stillInsideElements.Count() > 0 )
+ {
+ (((CSvgDocumentImpl*)iOwnerDocument)->Engine())->NotifyMouseMoved
+ ( stillInsideElements, aX, aY );
+ if ( iNewDocument )
+ {
+ iNewDocument->NotifyInternalMouseMoved( stillInsideElements, aX, aY );
+ }
+ }
+
+ exitingElements.Close();
+ enteringElements.Close();
+ stillInsideElements.Close();
+ viewableElements.Close();
+
+
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgMediaAnimationElementImpl::MouseExited(
+ RPointerArray<CSvgElementImpl>& /* aElements */,
+ TInt aX, TInt aY )
+ {
+ if ( !iNewDocument )
+ {
+ return EFalse;
+ }
+
+ TInt listenerCount = (((CSvgDocumentImpl*)iOwnerDocument)->Engine())->
+ MouseListenerCount();
+
+ if ( iNewDocument )
+ {
+ listenerCount += iNewDocument->MouseInternalListenerCount();
+ }
+ if ( listenerCount == 0 )
+ {
+ return EFalse;
+ }
+ // Get list of elements containing pointer (bounding-box)
+ RPointerArray<CSvgElementImpl> viewableElements;
+ RPointerArray<CSvgElementImpl> enteringElements;
+ RPointerArray<CSvgElementImpl> stillInsideElements;
+ (((CSvgDocumentImpl*)iOwnerDocument)->Engine())->GetViewableElementsAtPoint
+ (iNewDocument, viewableElements, aX, aY );
+
+ // check for mouse entering of elements
+ TInt viewableEleCnt = viewableElements.Count();
+ for ( TInt i = 0; i < viewableEleCnt; i++ )
+ {
+ // If an element is in the view-list but NOT in the entered-list
+ // then, it's copied to the entered-list
+ // otherwise, ignore (still inside)
+ if ( iSvgMouseEnteredElements.Find( viewableElements[i] )
+ == KErrNotFound )
+ {
+ enteringElements.Append( viewableElements[i] );
+ }
+ else
+ {
+ stillInsideElements.Append( viewableElements[i] );
+ }
+ }
+
+ // check for mouse exiting of elements
+ RPointerArray<CSvgElementImpl> exitingElements;
+ TInt svgMouseEnteredEleCnt = iSvgMouseEnteredElements.Count();
+ for ( TInt i = 0; i < svgMouseEnteredEleCnt; i++ )
+ {
+ // If an element is in the entered-list but not the view-list
+ // then, it's copied to the exiting list
+ // otherwise, ignore (
+ if ( viewableElements.Find( iSvgMouseEnteredElements[i] )
+ == KErrNotFound )
+ {
+ exitingElements.Append( iSvgMouseEnteredElements[i] );
+ }
+ }
+
+ // Remove exiting elements from entered list
+ TInt exitingEleCnt = exitingElements.Count();
+ for ( TInt i = 0; i < exitingEleCnt; i++ )
+ {
+ TInt index = iSvgMouseEnteredElements.Find( exitingElements[i] );
+ if ( index != KErrNotFound )
+ {
+ iSvgMouseEnteredElements.Remove( index );
+ }
+ }
+
+ // Add entering elements to entered-list
+ TInt enteringEleCnt = enteringElements.Count();
+ for ( TInt i = 0; i < enteringEleCnt; i++ )
+ {
+ iSvgMouseEnteredElements.Append( enteringElements[i] );
+ }
+
+ // Notify exiting
+ if ( exitingElements.Count() > 0 )
+ {
+ (((CSvgDocumentImpl*)iOwnerDocument)->Engine())->NotifyMouseExited
+ ( exitingElements, aX, aY );
+ if ( iNewDocument )
+ {
+ iNewDocument->NotifyInternalMouseExited( exitingElements, aX, aY );
+ }
+ }
+
+ // Notify entering
+ if ( enteringElements.Count() > 0 )
+ {
+ (((CSvgDocumentImpl*)iOwnerDocument)->Engine())->NotifyMouseEntered
+ ( enteringElements, aX, aY );
+ if ( iNewDocument )
+ {
+ iNewDocument->NotifyInternalMouseEntered( enteringElements, aX, aY );
+ }
+ }
+
+ // Notify moved
+ if ( stillInsideElements.Count() > 0 )
+ {
+ (((CSvgDocumentImpl*)iOwnerDocument)->Engine())->NotifyMouseMoved
+ ( stillInsideElements, aX, aY );
+ if ( iNewDocument )
+ {
+ iNewDocument->NotifyInternalMouseMoved( stillInsideElements, aX, aY );
+ }
+ }
+
+ exitingElements.Close();
+ enteringElements.Close();
+ stillInsideElements.Close();
+ viewableElements.Close();
+
+
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgMediaAnimationElementImpl::MouseMoved(
+ RPointerArray<CSvgElementImpl>& /*aElements */,
+ TInt aX, TInt aY )
+ {
+ if( !iNewDocument )
+ {
+ return EFalse;
+ }
+
+ // Process for Mouse enter/exit
+ TInt listenerCount = (((CSvgDocumentImpl*)iOwnerDocument)->Engine())
+ ->MouseListenerCount();
+
+ if ( iNewDocument )
+ {
+ listenerCount += iNewDocument->MouseInternalListenerCount();
+ }
+ if ( listenerCount == 0 )
+ {
+ return EFalse;
+ }
+ // Get list of elements containing pointer (bounding-box)
+ RPointerArray<CSvgElementImpl> viewableElements;
+ RPointerArray<CSvgElementImpl> enteringElements;
+ RPointerArray<CSvgElementImpl> stillInsideElements;
+ (((CSvgDocumentImpl*)iOwnerDocument)->Engine())->GetViewableElementsAtPoint
+ (iNewDocument, viewableElements, aX, aY );
+
+ // check for mouse entering of elements
+ TInt viewableEleCnt = viewableElements.Count();
+ for ( TInt i = 0; i < viewableEleCnt; i++ )
+ {
+ // If an element is in the view-list but NOT in the entered-list
+ // then, it's copied to the entered-list
+ // otherwise, ignore (still inside)
+ if ( iSvgMouseEnteredElements.Find( viewableElements[i] )
+ == KErrNotFound )
+ {
+ enteringElements.Append( viewableElements[i] );
+ }
+ else
+ {
+ stillInsideElements.Append( viewableElements[i] );
+ }
+ }
+
+ // check for mouse exiting of elements
+ RPointerArray<CSvgElementImpl> exitingElements;
+ TInt svgMouseEnteredEleCnt = iSvgMouseEnteredElements.Count();
+ for ( TInt i = 0; i < svgMouseEnteredEleCnt; i++ )
+ {
+ // If an element is in the entered-list but not the view-list
+ // then, it's copied to the exiting list
+ // otherwise, ignore (
+ if ( viewableElements.Find( iSvgMouseEnteredElements[i] )
+ == KErrNotFound )
+ {
+ exitingElements.Append( iSvgMouseEnteredElements[i] );
+ }
+ }
+
+ // Remove exiting elements from entered list
+ TInt exitingEleCnt = exitingElements.Count();
+ for ( TInt i = 0; i < exitingEleCnt; i++ )
+ {
+ TInt index = iSvgMouseEnteredElements.Find( exitingElements[i] );
+ if ( index != KErrNotFound )
+ {
+ iSvgMouseEnteredElements.Remove( index );
+ }
+ }
+
+ // Add entering elements to entered-list
+ TInt enteringEleCnt = enteringElements.Count();
+ for ( TInt i = 0; i < enteringEleCnt; i++ )
+ {
+ iSvgMouseEnteredElements.Append( enteringElements[i] );
+ }
+
+ // Notify exiting
+ if ( exitingElements.Count() > 0 )
+ {
+ (((CSvgDocumentImpl*)iOwnerDocument)->Engine())->NotifyMouseExited
+ ( exitingElements, aX, aY );
+ if ( iNewDocument )
+ {
+ iNewDocument->NotifyInternalMouseExited( exitingElements, aX, aY );
+ }
+ }
+
+ // Notify entering
+ if ( enteringElements.Count() > 0 )
+ {
+ (((CSvgDocumentImpl*)iOwnerDocument)->Engine())->NotifyMouseEntered
+ ( enteringElements, aX, aY );
+ if ( iNewDocument )
+ {
+ iNewDocument->NotifyInternalMouseEntered( enteringElements, aX, aY );
+ }
+ }
+
+ // Notify moved
+ if ( stillInsideElements.Count() > 0 )
+ {
+ (((CSvgDocumentImpl*)iOwnerDocument)->Engine())->NotifyMouseMoved
+ ( stillInsideElements, aX, aY );
+ if ( iNewDocument )
+ {
+ iNewDocument->NotifyInternalMouseMoved( stillInsideElements, aX, aY );
+ }
+ }
+
+ exitingElements.Close();
+ enteringElements.Close();
+ stillInsideElements.Close();
+ viewableElements.Close();
+
+
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgMediaAnimationElementImpl::MousePressed(
+ RPointerArray<CSvgElementImpl>& /* aElements */,
+ TInt aX, TInt aY )
+ {
+
+ if( !iNewDocument )
+ {
+ return EFalse;
+ }
+
+
+ TInt listenerCount = (((CSvgDocumentImpl*)iOwnerDocument)->Engine())
+ ->MouseListenerCount();
+
+
+ if (iNewDocument)
+ {
+ listenerCount += iNewDocument->MouseInternalListenerCount();
+ }
+ if ( listenerCount == 0 )
+ {
+ // return 0;
+ return EFalse;
+ }
+ RPointerArray<CSvgElementImpl> viewableElements;
+ // TInt topClickedElement = 0;
+
+ (((CSvgDocumentImpl*)iOwnerDocument)->Engine())->GetViewableElementsAtPoint
+ (iNewDocument,viewableElements, aX, aY );
+ if ( viewableElements.Count() > 0 )
+ {
+ (((CSvgDocumentImpl*)iOwnerDocument)->Engine())->NotifyMousePressed
+ ( viewableElements, aX, aY );
+ if ( iNewDocument)
+ {
+ iNewDocument->NotifyInternalMousePressed( viewableElements, aX, aY );
+ }
+ }
+ viewableElements.Close();
+
+ //return topClickedElement;
+
+
+ return ETrue;
+ }
+
+TBool CSvgMediaAnimationElementImpl::MouseReleased(
+ RPointerArray<CSvgElementImpl>& /* aElements */,
+ TInt aX, TInt aY )
+ {
+ // Process for MouseRelease
+ if ( !iNewDocument )
+ {
+ return EFalse;
+ }
+
+ TInt listenerCount = (((CSvgDocumentImpl*)iOwnerDocument)->Engine())->
+ MouseListenerCount();
+
+ if ( iNewDocument )
+ {
+ listenerCount += iNewDocument->MouseInternalListenerCount();
+ }
+ if ( listenerCount == 0 )
+ {
+ return ETrue;
+ }
+ RPointerArray<CSvgElementImpl> viewableElements;
+ (((CSvgDocumentImpl*)iOwnerDocument)->Engine())->GetViewableElementsAtPoint
+ (iNewDocument, viewableElements, aX, aY );
+ if ( viewableElements.Count() > 0 )
+ {
+ (((CSvgDocumentImpl*)iOwnerDocument)->Engine())->NotifyMouseReleased
+ ( viewableElements, aX, aY );
+ if ( iNewDocument )
+ {
+ iNewDocument->NotifyInternalMouseReleased( viewableElements, aX, aY );
+ }
+ }
+ viewableElements.Close();
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgMediaAnimationElementImpl::UpdateCTM()
+ {
+ if ( !iNewDocument )
+ {
+ return;
+ }
+
+ CSvgElementImpl::UpdateCTM();
+ TGfxAffineTransform aTr = GetCTM();
+
+ TGfxPoint2D ep( 1, 0 ), org( 2, 0 );
+ aTr.Transform( &ep, & ep, 1 );
+ aTr.Transform( &org, & org, 1 );
+ ep.iX -= org.iX;
+ ep.iY -= org.iY;
+ iScale = TFloatFixPt::Sqrt( ep.iX * ep.iX + ep.iY * ep.iY );
+
+ TGfxAffineTransform tMatrix;
+ tMatrix = aTr;
+
+ #ifdef SVG_FLOAT_BUILD
+ tMatrix.Scale( ( TFloatFixPt( 1 ) / ( iScale ) ), ( TFloatFixPt( 1 ) / ( iScale ) ) );
+ #else
+ tMatrix.Scale( ( TFloatFixPt( 0x10000,ETrue ) / ( iScale ) ), ( TFloatFixPt( 0x10000,ETrue ) / ( iScale ) ) );
+ #endif
+
+ if ( !iIsOriginalRootTrSet )
+ {
+ MSvgTransformList* aTransformList;
+ ((CSvgSvgElementImpl *)(iNewDocument->RootElement()))->GetTransform
+ (aTransformList);
+ iOriginalRootTr = aTransformList->GetItem(0);
+ iIsOriginalRootTrSet = ETrue;
+ }
+
+ iNewDocument->DocumentTransform(tMatrix);
+ tMatrix.Concatenate(iOriginalRootTr);
+
+ ((CSvgSvgElementImpl *)(iNewDocument->RootElement()))->SetTransformList
+ (tMatrix);
+
+ TFloatFixPt newWidth = iScale * iWidth;
+ TFloatFixPt newHeight = iScale * iHeight;
+
+
+ ((CSvgSvgElementImpl *)(iNewDocument->RootElement()))->SetWidth(newWidth);
+ ((CSvgSvgElementImpl *)(iNewDocument->RootElement()))->SetHeight(newHeight);
+
+ ((CSvgElementImpl*)iNewDocument->RootElement())->UpdateCTM();
+
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgMediaAnimationElementImpl::DeactivateAnimation()
+ {
+ CSvgMediaElementBase::DeactivateAnimation(this);
+ }
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGMediaElementBase.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,503 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Provides the base class implementation for the media elements.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "SVGMediaElementBase.h"
+#include "SVGAnimTimingParser.h"
+#include "SVGTimeContainer.h"
+
+_LIT( KTmpCanSlip, "canSlip" );
+_LIT( KTmpLocked, "locked" );
+_LIT( KTmpIndependent, "independent" );
+_LIT( KTmpDefault, "default" );
+_LIT( KTmpSyncBehavior, "syncBehavior" );
+_LIT( KTmpSyncTolerance, "syncTolerance" );
+_LIT( KTmpSyncMaster, "syncMaster" );
+// EXTERNAL DATA STRUCTURES
+//extern ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::CSvgMediaElementBase
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSvgMediaElementBase::CSvgMediaElementBase( CSvgDocumentImpl* aDoc ):
+ CSvgAnimationBase( aDoc ),
+ iSyncMasterConfig( EFalse ),
+ iSyncMasterCurrent( EFalse ),
+ iSyncOffset( 0 )
+ {
+ // Obtain the default sync behaviour/tolerance from the root element
+ CSvgSvgElementImpl* lSvgEle = (CSvgSvgElementImpl* )aDoc->RootElement();
+ if ( lSvgEle )
+ {
+ iSyncBehavior = lSvgEle->SyncBehaviorDefault();
+ iSyncTolerance = lSvgEle->SyncToleranceDefault();
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSvgMediaElementBase::ConstructL( const TUint8 aElemID )
+ {
+ CSvgAnimationBase::ConstructL( aElemID );
+ // Add this element to the time container to recieve runtime sync events
+ ((CSvgDocumentImpl* )iOwnerDocument)->TimeContainer()->AddTimedEntityL( this );
+ }
+
+// Destructor
+CSvgMediaElementBase::~CSvgMediaElementBase()
+ {
+ // Remove this element from the time container
+ ((CSvgDocumentImpl* )iOwnerDocument)->TimeContainer()->DelTimedEntity( this );
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::SetSyncBehavior
+// Set the Synchronised behaviour for the media element
+// -----------------------------------------------------------------------------
+//
+void CSvgMediaElementBase::SetSyncBehavior( const TDesC& aValue )
+ {
+
+ if ( !aValue.CompareF( KTmpCanSlip ) )
+ {
+ iSyncBehavior = ESvgSyncCanSlip;
+ }
+ else if ( !aValue.CompareF( KTmpLocked ) )
+ {
+ iSyncBehavior = ESvgSyncLocked;
+ }
+ else if ( !aValue.CompareF( KTmpIndependent ) )
+ {
+ iSyncBehavior = ESvgSyncIndependent;
+ }
+ else if ( !aValue.CompareF( KTmpDefault ) )
+ {
+ // Obtain the sync behaviour from the root of time container
+ CSvgDocumentImpl* lSvgDoc = (( CSvgDocumentImpl* )
+ iOwnerDocument);
+ CSvgSvgElementImpl* lSvgEle = (CSvgSvgElementImpl* )lSvgDoc->RootElement();
+ if ( lSvgEle )
+ {
+ iSyncBehavior = lSvgEle->SyncBehaviorDefault();
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::SetSyncTolerance
+// Set the Synchronised Tolerance for the media element
+// -----------------------------------------------------------------------------
+//
+void CSvgMediaElementBase::SetSyncTolerance( const TDesC& aValue )
+ {
+ if ( aValue.CompareF( KTmpDefault ) )
+ {
+ CSvgAnimTimingParser* lATParserPtr = NULL;
+ // Treat as clock value
+ TRAPD( lCreateATPErr,
+ {
+ lATParserPtr = CSvgAnimTimingParser::NewL( aValue, this );
+ } );
+
+ if ( lCreateATPErr != KErrNone )
+ {
+ // Error Processing
+ return;
+ }
+
+ TInt32 lClockValue;
+ TLex lLex( aValue );
+ lATParserPtr->ParseClockValue( lLex, lClockValue );
+ delete lATParserPtr;
+ iSyncTolerance = lClockValue;
+ }
+ else
+ {
+ // Get clock value from parent
+ CSvgDocumentImpl* lSvgDoc = (( CSvgDocumentImpl* )
+ iOwnerDocument);
+ CSvgSvgElementImpl* lSvgEle = (CSvgSvgElementImpl* )lSvgDoc->RootElement();
+ if ( lSvgEle )
+ {
+ iSyncTolerance = lSvgEle->SyncToleranceDefault();
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::SetSyncMaster
+// Set the media element as Synchronised Master
+// -----------------------------------------------------------------------------
+//
+void CSvgMediaElementBase::SetSyncMaster( const TDesC& aValue )
+ {
+ if ( !aValue.CompareF(_L("true")) )
+ {
+ iSyncMasterConfig = ETrue;
+ }
+ else
+ {
+ iSyncMasterConfig = EFalse;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::SetSyncBehavior
+// Set the Synchronised behaviour for the media element
+// -----------------------------------------------------------------------------
+//
+void CSvgMediaElementBase::SetSyncBehavior(
+ const TSvgSyncBehaviour aValue )
+ {
+ if ( aValue == ESvgSyncDefault )
+ {
+ // Obtain the sync behaviour from the root of time container
+ CSvgDocumentImpl* lSvgDoc = (( CSvgDocumentImpl* )
+ iOwnerDocument);
+ CSvgSvgElementImpl* lSvgEle = (CSvgSvgElementImpl* )lSvgDoc->RootElement();
+ if ( lSvgEle )
+ {
+ iSyncBehavior = lSvgEle->SyncBehaviorDefault();
+ }
+ }
+ else
+ {
+ iSyncBehavior = aValue;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::SetSyncTolerance
+// Set the Synchronised Tolerance for the media element
+// -----------------------------------------------------------------------------
+//
+void CSvgMediaElementBase::SetSyncTolerance( const TInt32 aValue ,
+ const TBool aUseDefault )
+ {
+ if ( aUseDefault )
+ {
+ // Get clock value from parent
+ CSvgDocumentImpl* lSvgDoc = (( CSvgDocumentImpl* )
+ iOwnerDocument);
+ CSvgSvgElementImpl* lSvgEle = (CSvgSvgElementImpl* )lSvgDoc->RootElement();
+ if ( lSvgEle )
+ {
+ iSyncTolerance = lSvgEle->SyncToleranceDefault();
+ }
+ }
+ else
+ {
+ iSyncTolerance = aValue;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::SetSyncMaster
+// Set the media element as Synchronised Master
+// -----------------------------------------------------------------------------
+//
+void CSvgMediaElementBase::SetSyncMaster( const TBool aValue )
+ {
+ iSyncMasterConfig = aValue;
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::SyncBehavior
+// Accessor for the Synchronised behaviour for the media element
+// -----------------------------------------------------------------------------
+//
+TSvgSyncBehaviour CSvgMediaElementBase::SyncBehavior()
+ {
+ return iSyncBehavior;
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::SyncTolerance
+// Accessor for the Synchronised Tolerance for the media element
+// -----------------------------------------------------------------------------
+//
+TInt32 CSvgMediaElementBase::SyncTolerance()
+ {
+ return iSyncTolerance;
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::SyncMaster
+// Accessor for the Synchronised Mastership for the media element
+// -----------------------------------------------------------------------------
+//
+TBool CSvgMediaElementBase::SyncMaster()
+ {
+ return iSyncMasterConfig;
+ }
+
+// -----------------------------------------------------------------------------
+// SetAttributeL: Called by Contenthandler or decoder to set attributes
+// From CSvgAnimationBase
+// -----------------------------------------------------------------------------
+//
+TInt CSvgMediaElementBase::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+
+ if ( !aName.CompareF( KTmpSyncBehavior ) )
+ {
+ SetSyncBehavior( aValue );
+ }
+ else if ( !aName.CompareF( KTmpSyncTolerance ) )
+ {
+ SetSyncTolerance( aValue );
+ }
+ else if ( !aName.CompareF( KTmpSyncMaster ) )
+ {
+ SetSyncMaster( aValue );
+ }
+ else
+ {
+ return CSvgAnimationBase::SetAttributeL( aName, aValue );
+ }
+
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::ParentTimeContainerTick
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+//
+void CSvgMediaElementBase::ParentTimeContainerTick(
+ TSvgTick aTick ) // Current tick information
+ {
+ // Check if the element is currently acting as syncMaster for the locked
+ // group it is part of.
+ // Note element having syncMaster property set doesn't make it master. It
+ // needs to be resolved.
+ TBool lIsCurSyncMaster = EFalse;
+
+ GetCurSyncMasterStatus( lIsCurSyncMaster );
+
+ if ( lIsCurSyncMaster || iSyncBehavior != ESvgSyncLocked )
+ {
+ // Could be locked, or not locked. In both cases, use media
+ // element clock.
+ if ( CanGenerateTick() )
+ {
+ //No action.
+ }
+ else
+ {
+ // Use the Real Time Tick.
+ // Create a timer event with real time tick
+ // Send this event to engine
+ }
+ }
+
+ if( !lIsCurSyncMaster && iSyncBehavior == ESvgSyncLocked)
+ {
+ // The element needs to be in sync with Parent.
+ if ( CanUseParentTick() )
+ {
+ // Run the media element with parent's tick.
+ // Create a timer event with parent's tick
+ // Send this event to engine
+ // Only required at Document Level.
+ }
+ else
+ {
+ // Calculate SyncOffset value
+ // Get the current tick on the element
+ TUint32 lEntityTime;
+ GetEntityCurrentTime( lEntityTime );
+ // Calculate the drift
+ TInt32 iSyncOffset = aTick.iParentTcTick - lEntityTime;
+
+ // Media element running with its own clock, need
+ // to resynchronize if the element is out of sync
+ // wrt to parent clock.
+ if ( Abs( iSyncOffset ) > iSyncTolerance )
+ {
+ // Resynchronize the Media Element wrt to
+ // Parent Clock.
+ ResyncTimedEntity( aTick.iParentTcTick );
+ }
+ }
+ }
+
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::GetEntitySyncBehavior
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+//
+TSvgSyncBehaviour CSvgMediaElementBase::GetEntitySyncBehavior()
+ {
+ return iSyncBehavior;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::GetEntityCurrentTime
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+//
+void CSvgMediaElementBase::GetEntityCurrentTime( TUint32&
+ /* aEntityCurTime*/ ) // Current Entity Time in msecs.
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::GetCnfSyncMasterStatus
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+//
+void CSvgMediaElementBase::GetCnfSyncMasterStatus(
+ TBool& aIsSyncMaster ) // Indicates whether the element is configured as
+ // Sync Master.
+ {
+ aIsSyncMaster = iSyncMasterConfig;
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::GetCurSyncMasterStatus
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+void CSvgMediaElementBase::GetCurSyncMasterStatus(
+ TBool& aIsSyncMaster ) // Indicates whether the element is currrently
+ // Sync Master.
+ {
+ aIsSyncMaster = iSyncMasterCurrent;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::SetCurSyncMasterStatus
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+void CSvgMediaElementBase::SetCurSyncMasterStatus(
+ TBool aSyncMasterStatus ) // Indicates whether the element is currrently
+ // Sync Master.
+ {
+ iSyncMasterCurrent = aSyncMasterStatus;
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::CanGenerateTick
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+TBool CSvgMediaElementBase::CanGenerateTick()
+ {
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::CanUseParentTick
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+TBool CSvgMediaElementBase::CanUseParentTick()
+ {
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::ResyncTimedEntity
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+void CSvgMediaElementBase::ResyncTimedEntity(
+ TUint32 /* aSynctime */ ) // Time for resync in msecs.
+ {
+
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::PauseTimedEntity
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+void CSvgMediaElementBase::PauseTimedEntity()
+ {
+
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::ResumeTimedEntity
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+void CSvgMediaElementBase::ResumeTimedEntity()
+ {
+
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgMediaElementBase::StopTimedEntity
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+void CSvgMediaElementBase::StopTimedEntity()
+ {
+
+ }
+
+
+//From MSvgTimedEntityInterface
+TSvgObjectType CSvgMediaElementBase::ObjectType()
+{
+ return ESvgInvalidReference ;
+}
+
+
+//returns the child time container of the element
+//used in timecontainer
+CSvgTimeContainer* CSvgMediaElementBase::GetChildTimeContainer()
+{
+ return NULL;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGMemoryManager.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,608 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include "SVGMemoryManager.h"
+#include "SVGPaintCssValueImpl.h"
+#include "SVGFloatCssValueImpl.h"
+#include "SVGIntCssValueImpl.h"
+#include "SVGStrCssValueImpl.h"
+#include "SVGVectorCssValueImpl.h"
+#include "SVGClrCssValueImpl.h"
+#include "SVGDocumentImpl.h"
+
+class CSvgElementImpl;
+
+const TUint CSvgMemoryManager::KCssPaintBlockSize = 20;
+const TUint CSvgMemoryManager::KCssFloatBlockSize = 20;
+const TUint CSvgMemoryManager::KCssIntBlockSize = 20;
+const TUint CSvgMemoryManager::KCssClrBlockSize = 20;
+const TUint CSvgMemoryManager::KCssStrBlockSize = 20;
+const TUint CSvgMemoryManager::KCssVectorBlockSize = 4;
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgMemoryManager* CSvgMemoryManager::NewL()
+ {
+ CSvgMemoryManager* self = new ( ELeave ) CSvgMemoryManager;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgMemoryManager* CSvgMemoryManager::NewLC()
+ {
+ CSvgMemoryManager* self = new ( ELeave ) CSvgMemoryManager;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgMemoryManager::ConstructL()
+ {
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgMemoryManager::CSvgMemoryManager() :
+ iCPaintCssValueImplArrays( 2 ),
+ iCFloatCssValueImplArrays( 2 ),
+ iCClrCssValueImplArrays( 2 ),
+ iCIntCssValueImplArrays( 2 ),
+ iCStrCssValueImplArrays( 2 ),
+ iCVectorCssValueImplArrays( 1 )
+ {
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgMemoryManager::~CSvgMemoryManager()
+ {
+ //delete all of the paint blocks
+ TInt cPaintCSSValueImplArraysCnt = iCPaintCssValueImplArrays.Count();
+ for (TInt i=0; i < cPaintCSSValueImplArraysCnt; i++)
+ {
+ delete [] iCPaintCssValueImplArrays[i];
+ }
+ iCPaintCssValueImplArrays.Close();
+
+
+ //delete all of the float blocks
+ TInt cFloatValueImplArraysCnt = iCFloatCssValueImplArrays.Count();
+ for (TInt i=0; i < cFloatValueImplArraysCnt; i++)
+ {
+ delete [] iCFloatCssValueImplArrays[i];
+ }
+ iCFloatCssValueImplArrays.Close();
+
+ //delete all of the clr blocks
+ TInt cClrCssValueImplArraysCnt = iCClrCssValueImplArrays.Count();
+ for (TInt i=0; i < cClrCssValueImplArraysCnt; i++)
+ {
+ delete [] iCClrCssValueImplArrays[i];
+ }
+ iCClrCssValueImplArrays.Close();
+
+
+ //delete all of the int blocks
+ TInt cIntCssValueImplArraysCnt = iCIntCssValueImplArrays.Count();
+ for (TInt i=0; i < cIntCssValueImplArraysCnt; i++)
+ {
+ delete [] iCIntCssValueImplArrays[i];
+ }
+ iCIntCssValueImplArrays.Close();
+
+ //delete all of the str blocks
+ TInt cStrCssValueImplArraysCnt = iCStrCssValueImplArrays.Count();
+ for (TInt i=0; i < cStrCssValueImplArraysCnt; i++)
+ {
+ delete [] iCStrCssValueImplArrays[i];
+ }
+ iCStrCssValueImplArrays.Close();
+
+ //delete all of the vector blocks
+ TInt cVectorCssValueImplArraysCnt = iCVectorCssValueImplArrays.Count();
+ for (TInt i=0; i < cVectorCssValueImplArraysCnt; i++)
+ {
+ delete [] iCVectorCssValueImplArrays[i];
+ }
+ iCVectorCssValueImplArrays.Close();
+
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CCssValue* CSvgMemoryManager::CloneCssValueL(CCssValue* aCssValue )
+{
+ CCssValue* lCssValueCloned = NULL;
+
+ //see if the value is in a paint block
+ TInt cPaintCssValueImplArraysCnt = iCPaintCssValueImplArrays.Count();
+ for (TInt i=0; i < cPaintCssValueImplArraysCnt; i++)
+ {
+ CPaintCssValueImpl* aPaintBlock = iCPaintCssValueImplArrays[i];
+ if ((TInt)aCssValue >= (TInt)&aPaintBlock[0] && (TInt)aCssValue <= (TInt)&aPaintBlock[KCssPaintBlockSize])
+ {
+ //aValue is a Paint clone it as such
+ if ( ((CPaintCssValueImpl*)aCssValue)->iUrlId )
+ {
+ lCssValueCloned = GetCssPaintObjectL(((CPaintCssValueImpl*)aCssValue)->iUrlId->Des(),
+ ((CPaintCssValueImpl*)aCssValue)->iSvgElementImpl);
+ }
+ else
+ {
+ lCssValueCloned = GetCssPaintObjectL( ((CPaintCssValueImpl*)aCssValue)->iSvgElementImpl );
+ }
+
+ MGfxPaint* value = ((CPaintCssValueImpl*)aCssValue)->Value();
+
+ if (value)
+ {
+ ((CPaintCssValueImpl*)lCssValueCloned)->CloneRGBValueL( value->GetColor() );
+ }
+
+ return lCssValueCloned;
+ }
+ }
+
+ //see if the value is in a float block
+ TInt cFloatCssValueImplArraysCnt = iCFloatCssValueImplArrays.Count();
+ for (TInt i=0; i < cFloatCssValueImplArraysCnt; i++)
+ {
+ CFloatCssValueImpl* aFloatBlock = iCFloatCssValueImplArrays[i];
+ if ((TInt)aCssValue >= (TInt)&aFloatBlock[0] && (TInt)aCssValue <= (TInt)&aFloatBlock[KCssFloatBlockSize])
+ {
+ //aValue is a Float clone it as such
+ lCssValueCloned = GetCssFloatObjectL(((CFloatCssValueImpl*)aCssValue)->Value());
+ return lCssValueCloned;
+ }
+ }
+
+ //see if the value is in a str block
+ TInt cClrCssValueImplArraysCnt = iCClrCssValueImplArrays.Count();
+ for (TInt i=0; i < cClrCssValueImplArraysCnt; i++)
+ {
+ CClrCssValueImpl* aClrBlock = iCClrCssValueImplArrays[i];
+ if ((TInt)aCssValue >= (TInt)&aClrBlock[0] && (TInt)aCssValue <= (TInt)&aClrBlock[KCssClrBlockSize])
+ {
+ //aValue is a Clr clone it as such
+ lCssValueCloned = GetCssClrObjectL();
+ ((CClrCssValueImpl*)lCssValueCloned)->SetL((CClrCssValueImpl*)aCssValue);
+
+ return lCssValueCloned;
+ }
+ }
+
+ //see if the value is in an int block
+ TInt cIntCssValueImplArraysCnt = iCIntCssValueImplArrays.Count();
+ for (TInt i=0; i < cIntCssValueImplArraysCnt; i++)
+ {
+ CIntCssValueImpl* aIntBlock = iCIntCssValueImplArrays[i];
+ if ((TInt)aCssValue >= (TInt)&aIntBlock[0] && (TInt)aCssValue <= (TInt)&aIntBlock[KCssIntBlockSize])
+ {
+ //aValue is an Int clone it as such
+ lCssValueCloned = GetCssIntObjectL(((CIntCssValueImpl*)aCssValue)->Value());
+ return lCssValueCloned;
+ }
+ }
+
+ //see if the value is in a str block
+ TInt cStrCssValueImplArraysCnt = iCStrCssValueImplArrays.Count();
+ for (TInt i=0; i < cStrCssValueImplArraysCnt; i++)
+ {
+ CStrCssValueImpl* aStrBlock = iCStrCssValueImplArrays[i];
+ if ((TInt)aCssValue >= (TInt)&aStrBlock[0] && (TInt)aCssValue <= (TInt)&aStrBlock[KCssStrBlockSize])
+ {
+ //aValue is a string clone it as such
+ //makes a copy of the string
+ lCssValueCloned = GetCssStrObjectL(((CStrCssValueImpl*)aCssValue)->Value());
+ return lCssValueCloned;
+ }
+ }
+
+ //see if the value is in a vector block
+ TInt cVectorCssValueImplArraysCnt = iCVectorCssValueImplArrays.Count();
+ for (TInt i=0; i < cVectorCssValueImplArraysCnt; i++)
+ {
+ CVectorCssValueImpl* aVectorBlock = iCVectorCssValueImplArrays[i];
+ if ((TInt)aCssValue >= (TInt)&aVectorBlock[0] && (TInt)aCssValue <= (TInt)&aVectorBlock[KCssVectorBlockSize])
+ {
+ //aValue is a vector clone it as such
+ //makes a copy of the vector
+ lCssValueCloned = GetCssVectorObjectL(((CVectorCssValueImpl*)aCssValue)->Value());
+ return lCssValueCloned;
+ }
+ }
+
+ return NULL;
+}
+
+// ==========================================================================
+// BEGIN CIntCssValue Memory Management
+// ==========================================================================
+// ==========================================================================
+// CSvgMemoryManager::AllocateCssIntBlockL
+// ==========================================================================
+void CSvgMemoryManager::AllocateCssIntBlockL( )
+{
+ //setup the new current block
+ iCurrentIntObjectIndex = 0;
+
+ iCIntCssValueImplArray = new ( ELeave ) CIntCssValueImpl[KCssIntBlockSize];
+
+ //put the new block into the larger tracking array.
+ iCIntCssValueImplArrays.AppendL(iCIntCssValueImplArray);
+
+}
+
+// ==========================================================================
+// CSvgMemoryManager::GetCssIntObject
+// MAIN allocation block
+// ==========================================================================
+CIntCssValueImpl* CSvgMemoryManager::GetCssIntObjectL( TInt aInitValue )
+{
+ if ( !iCIntCssValueImplArray || iCurrentIntObjectIndex >= KCssIntBlockSize )
+ {
+ //we have used all of the objects in the current array
+ //and need to allocate another one
+ AllocateCssIntBlockL();
+ }
+ CIntCssValueImpl* lIntObject = &iCIntCssValueImplArray[iCurrentIntObjectIndex++];
+ lIntObject->SetValueL(aInitValue);
+ return ( lIntObject );
+}
+
+// ==========================================================================
+// CSvgMemoryManager::GetCssIntObject
+// ==========================================================================
+CIntCssValueImpl* CSvgMemoryManager::GetCssIntObjectL( CIntCssValueImpl* aIntValue )
+{
+ return GetCssIntObjectL( aIntValue->Value() );
+}
+
+// ==========================================================================
+// CSvgMemoryManager::GetCssIntObject
+// ==========================================================================
+CIntCssValueImpl* CSvgMemoryManager::GetCssIntObjectL( const TDesC& aValueString )
+{
+ CIntCssValueImpl* intObject = GetCssIntObjectL();
+
+ intObject->SetValueL(aValueString);
+
+ return intObject;
+
+}
+// ==========================================================================
+// END OF CIntCssValue Memory Management
+// ==========================================================================
+
+// ==========================================================================
+// BEGIN CPaintCssValueImpl Memory Management
+// ==========================================================================
+// ==========================================================================
+// CSvgMemoryManager::AllocateCssPaintBlockL
+// ==========================================================================
+void CSvgMemoryManager::AllocateCssPaintBlockL()
+{
+ //setup the new current block
+ iCurrentPaintObjectIndex = 0;
+
+ iCPaintCssValueImplArray = new ( ELeave ) CPaintCssValueImpl[KCssPaintBlockSize];
+
+ //may not need this as long as we always pass in initial values for paint
+ //Mem::FillZ( iCPaintCssValueImplArray, sizeof(CPaintCssValueImpl)*KCssPaintBlockSize);
+
+ //put the new block into the larger tracking array.
+ iCPaintCssValueImplArrays.AppendL(iCPaintCssValueImplArray);
+
+}
+
+// ==========================================================================
+// CSvgMemoryManager::GetCssPaintObject
+// ==========================================================================
+CPaintCssValueImpl* CSvgMemoryManager::GetCssPaintObjectL( CSvgElementImpl* aElementImpl )
+ {
+ if ( !iCPaintCssValueImplArray || iCurrentPaintObjectIndex >= KCssPaintBlockSize )
+ {
+ //we have used all of the objects in the current array
+ //and need to allocate another one
+ AllocateCssPaintBlockL();
+ }
+
+ CPaintCssValueImpl* lPaintObject = &iCPaintCssValueImplArray[iCurrentPaintObjectIndex++];
+ lPaintObject->SetElement(aElementImpl);
+ return ( lPaintObject );
+ }
+
+// ==========================================================================
+// CSvgMemoryManager::GetCssPaintObject
+// ==========================================================================
+CPaintCssValueImpl* CSvgMemoryManager::GetCssPaintObjectL( const TDesC& aValue, CSvgElementImpl* aElementImpl)
+{
+ CPaintCssValueImpl* lPaintObject = GetCssPaintObjectL(aElementImpl);
+
+ CSvgElementImpl* lReferencedElement = NULL;
+ // iUrlFlag is true means this paint is gradient.
+
+ CSvgDocumentImpl *lDoc = (CSvgDocumentImpl *)aElementImpl->OwnerDocument();
+
+ if (lDoc)
+ {
+ lReferencedElement = ( CSvgElementImpl*)lDoc->GetElementById( aValue );
+ }
+
+ if(lReferencedElement)
+ {
+ lPaintObject->SetUrlflag();
+ lPaintObject->SetUrlIdL(aValue);
+ lPaintObject->iValue = lPaintObject->Value();
+ }
+ else
+ {
+ lPaintObject->SetValueL(aValue);
+ }
+ return lPaintObject;
+}
+// ==========================================================================
+// END OF CPaintCssValueImpl Memory Management
+// ==========================================================================
+
+// ==========================================================================
+// BEGIN CFloatCssValueImpl Memory Management
+// ==========================================================================
+// ==========================================================================
+// CSvgMemoryManager::AllocateCssFloatBlockL
+// ==========================================================================
+void CSvgMemoryManager::AllocateCssFloatBlockL( )
+{
+ //setup the new current block
+ iCurrentFloatObjectIndex = 0;
+
+ iCFloatCssValueImplArray = new ( ELeave ) CFloatCssValueImpl[KCssFloatBlockSize];
+
+ //put the new block into the larger tracking array.
+ iCFloatCssValueImplArrays.AppendL(iCFloatCssValueImplArray);
+
+}
+
+// ==========================================================================
+// CSvgMemoryManager::GetCssFloatObject
+// MAIN allocation block
+// ==========================================================================
+CFloatCssValueImpl* CSvgMemoryManager::GetCssFloatObjectL( float aFloat )
+ {
+ if ( !iCFloatCssValueImplArray || iCurrentFloatObjectIndex >= KCssFloatBlockSize )
+ {
+ //we have used all of the objects in the current array
+ //and need to allocate another one
+ AllocateCssFloatBlockL();
+ }
+
+ CFloatCssValueImpl* lFloatObject = &iCFloatCssValueImplArray[iCurrentFloatObjectIndex++];
+ lFloatObject->SetValueL( aFloat );
+ return ( lFloatObject );
+ }
+
+// ==========================================================================
+// CSvgMemoryManager::GetCssIntObject
+// ==========================================================================
+CFloatCssValueImpl* CSvgMemoryManager::GetCssFloatObjectL( CFloatCssValueImpl* aFloatValue )
+{
+ return GetCssFloatObjectL( aFloatValue->Value() );
+}
+
+// ==========================================================================
+// CSvgMemoryManager::GetCssFloatObject
+// ==========================================================================
+CFloatCssValueImpl* CSvgMemoryManager::GetCssFloatObjectL( const TDesC& aValueString )
+{
+ CFloatCssValueImpl* floatObject = GetCssFloatObjectL();
+
+ floatObject->SetValueL(aValueString);
+
+ return floatObject;
+
+}
+// ==========================================================================
+// END OF CFloatCssValueImpl Memory Management
+// ==========================================================================
+
+// ==========================================================================
+// BEGIN CClrCssValueImpl Memory Management
+// ==========================================================================
+// ==========================================================================
+// CSvgMemoryManager::AllocateCssClrBlockL
+// ==========================================================================
+void CSvgMemoryManager::AllocateCssClrBlockL( )
+{
+ //setup the new current block
+ iCurrentClrObjectIndex = 0;
+
+ iCClrCssValueImplArray = new ( ELeave ) CClrCssValueImpl[KCssClrBlockSize];
+
+ //put the new block into the larger tracking array.
+ iCClrCssValueImplArrays.AppendL(iCClrCssValueImplArray);
+
+}
+
+// ==========================================================================
+// CSvgMemoryManager::GetCssClrObject
+// MAIN allocation block
+// ==========================================================================
+CClrCssValueImpl* CSvgMemoryManager::GetCssClrObjectL( )
+ {
+ if ( !iCClrCssValueImplArray || iCurrentClrObjectIndex >= KCssClrBlockSize )
+ {
+ //we have used all of the objects in the current array
+ //and need to allocate another one
+ AllocateCssClrBlockL();
+ }
+
+ CClrCssValueImpl* lClrObject = &iCClrCssValueImplArray[iCurrentClrObjectIndex++];
+ return ( lClrObject );
+ }
+
+// ==========================================================================
+// CSvgMemoryManager::GetCssClrObject
+// ==========================================================================
+CClrCssValueImpl* CSvgMemoryManager::GetCssClrObjectL( const TDesC& aValueString )
+{
+ CClrCssValueImpl* clrObject = GetCssClrObjectL();
+
+ clrObject->SetValueL(aValueString);
+
+ return clrObject;
+
+}
+// ==========================================================================
+// END OF CClrCssValueImpl Memory Management
+// ==========================================================================
+
+// ==========================================================================
+// BEGIN CStrCssValueImpl Memory Management
+// ==========================================================================
+// ==========================================================================
+// CSvgMemoryManager::AllocateCssStrBlockL
+// ==========================================================================
+void CSvgMemoryManager::AllocateCssStrBlockL( )
+{
+ //setup the new current block
+ iCurrentStrObjectIndex = 0;
+
+ iCStrCssValueImplArray = new ( ELeave ) CStrCssValueImpl[KCssStrBlockSize];
+
+ //may not need this as long as we always pass in initial values for string
+ Mem::FillZ( iCStrCssValueImplArray, sizeof(CStrCssValueImpl)*KCssStrBlockSize);
+
+ //put the new block into the larger tracking array.
+ iCStrCssValueImplArrays.AppendL(iCStrCssValueImplArray);
+
+}
+
+// ==========================================================================
+// CSvgMemoryManager::GetCssStrObject
+// MAIN allocation block
+// ==========================================================================
+CStrCssValueImpl* CSvgMemoryManager::GetCssStrObjectL( const TDesC& aValue )
+ {
+ if ( !iCStrCssValueImplArray || iCurrentStrObjectIndex >= KCssStrBlockSize )
+ {
+ //we have used all of the objects in the current array
+ //and need to allocate another one
+ AllocateCssStrBlockL();
+ }
+
+ CStrCssValueImpl* lStrObject = &iCStrCssValueImplArray[iCurrentStrObjectIndex++];
+ lStrObject->SetValueL(aValue);
+ return ( lStrObject );
+ }
+// ==========================================================================
+// END OF CStrCssValueImpl Memory Management
+// ==========================================================================
+
+// ==========================================================================
+// BEGIN CVectorCssValueImpl Memory Management
+// ==========================================================================
+// ==========================================================================
+// CSvgMemoryManager::AllocateCssVectorBlockL
+// ==========================================================================
+void CSvgMemoryManager::AllocateCssVectorBlockL( )
+{
+ //setup the new current block
+ iCurrentVectorObjectIndex = 0;
+
+ iCVectorCssValueImplArray = new ( ELeave ) CVectorCssValueImpl[KCssVectorBlockSize];
+
+ Mem::FillZ( iCVectorCssValueImplArray, sizeof(CVectorCssValueImpl)*KCssVectorBlockSize);
+
+ //put the new block into the larger tracking array.
+ iCVectorCssValueImplArrays.AppendL(iCVectorCssValueImplArray);
+
+}
+
+// ==========================================================================
+// CSvgMemoryManager::GetCssVectorObject
+// MAIN allocation block
+// ==========================================================================
+CVectorCssValueImpl* CSvgMemoryManager::GetCssVectorObjectL( const TDesC& aValue )
+ {
+ if ( !iCVectorCssValueImplArray || iCurrentVectorObjectIndex >= KCssVectorBlockSize )
+ {
+ //we have used all of the objects in the current array
+ //and need to allocate another one
+ AllocateCssVectorBlockL();
+ }
+
+ CVectorCssValueImpl* lVectorObject = &iCVectorCssValueImplArray[iCurrentVectorObjectIndex++];
+ lVectorObject->SetValueL(aValue);
+ return ( lVectorObject );
+ }
+
+// ==========================================================================
+// CSvgMemoryManager::GetCssVectorObject
+// MAIN allocation block
+// ==========================================================================
+CVectorCssValueImpl* CSvgMemoryManager::GetCssVectorObjectL( CArrayFix<TFloatFixPt>* aValue )
+ {
+ if ( !iCVectorCssValueImplArray || iCurrentVectorObjectIndex >= KCssVectorBlockSize )
+ {
+ //we have used all of the objects in the current array
+ //and need to allocate another one
+ AllocateCssVectorBlockL();
+ }
+
+ CVectorCssValueImpl* lVectorObject = &iCVectorCssValueImplArray[iCurrentVectorObjectIndex++];
+ lVectorObject->CloneValueL(aValue);
+ return ( lVectorObject );
+ }
+
+// ==========================================================================
+// END OF CVectorCssValueImpl Memory Management
+// ==========================================================================
+
+void CSvgMemoryManager::Print()
+{
+ #ifdef _DEBUG
+ RDebug::Printf("CSvgMemoryManager:: iCPaintCssValueImplArrays objects: %d",
+ (iCPaintCssValueImplArrays.Count() - 1) * KCssPaintBlockSize + iCurrentPaintObjectIndex);
+ RDebug::Printf("CSvgMemoryManager:: iCFloatCssValueImplArrays objects: %d",
+ (iCFloatCssValueImplArrays.Count() - 1) * KCssFloatBlockSize + iCurrentFloatObjectIndex);
+ RDebug::Printf("CSvgMemoryManager:: iCClrCssValueImplArrays objects: %d",
+ (iCClrCssValueImplArrays.Count() - 1) * KCssClrBlockSize + iCurrentClrObjectIndex);
+ RDebug::Printf("CSvgMemoryManager:: iCIntCssValueImplArrays objects: %d",
+ (iCIntCssValueImplArrays.Count() - 1) * KCssIntBlockSize + iCurrentIntObjectIndex);
+ RDebug::Printf("CSvgMemoryManager:: iCStrCssValueImplArrays objects: %d",
+ (iCStrCssValueImplArrays.Count() - 1) * KCssStrBlockSize + iCurrentStrObjectIndex);
+ RDebug::Printf("CSvgMemoryManager:: iCVectorCssValueImplArrays objects: %d",
+ (iCVectorCssValueImplArrays.Count() - 1) * KCssVectorBlockSize + iCurrentVectorObjectIndex);
+ #endif
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGMetadataElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,282 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "SVGMetadataElementImpl.h"
+#include "SVGElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+
+#include "GfxAffineTransform.h"
+
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgMetadataElementImpl* CSvgMetadataElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgMetadataElementImpl*self = new ( ELeave )
+ CSvgMetadataElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgMetadataElementImpl* CSvgMetadataElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgMetadataElementImpl*self = new ( ELeave )
+ CSvgMetadataElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgMetadataElementImpl::~CSvgMetadataElementImpl()
+ {
+
+ if ( iText )
+ {
+ delete iText;
+ iText = NULL;
+ }
+
+ }
+
+// *******************************************************
+// From MXmlElement
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgMetadataElementImpl::GetAttributeDes( const TInt aNameId, TPtrC16& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrCdata:
+ aValue.Set(*iText);
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeDes( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgMetadataElementImpl::SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrCdata:
+ SetTextL( aValue );
+ break;
+
+ default:
+ return CSvgElementImpl::SetAttributeDesL( aNameId, aValue );
+ }
+
+ return KErrNone;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgMetadataElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+
+ if ( this->SetLangSpaceAttributeL( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+
+ if ( this->SetTestAttributeL( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+
+ if ( SetIdandXmlbaseL( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+
+ return KErrNone;
+ }
+
+// ==========================================================================
+// xml:space is an inheritable attribute which can have one of two values:
+//
+// default (the initial/default value for xml:space) - When xml:space="default":
+// - Remove all newline characters.
+// - Convert all tab characters into space characters.
+// - Strip off all leading and trailing space characters.
+// - All contiguous space characters will be consolidated.
+//
+// preserve - When xml:space="preserve" :
+// - Convert all newline and tab characters into space characters.
+// ==========================================================================
+void CSvgMetadataElementImpl::SetTextL( const TDesC& aText )
+ {
+ _LIT( KPreserve, "preserve" );
+
+ if ( iText )
+ {
+ delete iText;
+ iText = NULL;
+ }
+
+ iText = aText.AllocL();
+ TPtr textDes = iText->Des();
+
+ // default
+ if ( XMLSpace() != KPreserve )
+ {
+ for (TInt i = textDes.Length() - 1; i >= 0; i--)
+ {
+ if (textDes[i] == '\n' || textDes[i] == '\r')
+ {
+ textDes.Delete(i,1);
+ }
+ }
+ textDes.TrimRight();
+ textDes.TrimLeft();
+ }
+ // preserve
+ else
+ {
+ TInt textDesLength = textDes.Length();
+ for ( TInt i = 0; i < textDesLength; i++ )
+ {
+ // ms-dos carriage return contains two characters: 13, 10
+ if ( i + 1 < textDes.Length() && (TInt)textDes[i] == 13 && (TInt)textDes[i+1] == 10 )
+ {
+ textDes[i] = ' ';
+ textDes.Delete( i+1, 1 );
+ }
+ else if ( TChar(textDes[i]).IsSpace() )
+ {
+ textDes[i] = ' ';
+ }
+ }
+ }
+ }
+
+// *******************************************************
+// From CSvgElementImpl
+
+// perform a deep clone of this object
+// ==========================================================================
+// Need method description
+// ==========================================================================
+MXmlElement* CSvgMetadataElementImpl::CloneL(MXmlElement* aParentElement)
+ {
+ CSvgMetadataElementImpl* newElement = CSvgMetadataElementImpl::NewL( this->ElemID(), ((CSvgDocumentImpl*)iOwnerDocument) );
+
+ CleanupStack::PushL(newElement);
+ newElement->iParentNode = aParentElement;
+ // copy everything over
+ this->CopyL(newElement);
+ CleanupStack::Pop();
+ return newElement;
+
+ }
+
+// ==========================================================================
+// perform a deep copy of this object
+// ==========================================================================
+void CSvgMetadataElementImpl::CopyL( CSvgMetadataElementImpl* aDestElement )
+ {
+ if(aDestElement)
+ {
+
+ // copy stuff from superclass
+ this->CSvgElementImpl::CopyL(aDestElement);
+
+ if(this->iText)
+ {
+ delete aDestElement->iText;
+ aDestElement->iText= NULL;
+ aDestElement->iText= (this->iText)->AllocL();
+ }
+
+ // copy the reference to idoc (CSvgDocumentImpl)
+ aDestElement->iOwnerDocument = this->iOwnerDocument;
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TBool CSvgMetadataElementImpl::DrawL( CGfx2dGc* /* aGc */,
+ CSvgElementImpl* /* aElement */ )
+ {
+ return EFalse;
+ }
+
+
+// *******************************************************
+// Private
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgMetadataElementImpl::ConstructL( const TUint8 aElemID )
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+
+ iText = HBufC::NewL( 2 );
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgMetadataElementImpl::CSvgMetadataElementImpl( CSvgDocumentImpl* aDoc )
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgMetadataElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<metadata>");
+ //need to add code here to output tdesc with metadata
+ RDebug::Printf("</metadata>");
+ #endif
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGMissingGlyphElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,339 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "SVGMissingGlyphElementImpl.h"
+#include "SVGElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+#include "SVGPathDataParser.h"
+
+#include "GfxAffineTransform.h"
+
+#ifdef SVG_FONTS_INCLUDE
+
+_LIT( D, "d" );
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgMissingGlyphElementImpl* CSvgMissingGlyphElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgMissingGlyphElementImpl*self = new ( ELeave )
+ CSvgMissingGlyphElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID);
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgMissingGlyphElementImpl* CSvgMissingGlyphElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgMissingGlyphElementImpl*self = new ( ELeave )
+ CSvgMissingGlyphElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID);
+
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgMissingGlyphElementImpl::ConstructL( const TUint8 aElemID )
+ {
+ CSvgElementImpl::InitializeL( aElemID);
+
+ iShape = CGfxGeneralPath::NewL();
+ #ifdef SVG_FLOAT_BUILD
+ iHorzAdvX = TFloatFixPt( 0 );
+ #else
+ iHorzAdvX = TFloatFixPt( 0, ETrue );
+ #endif
+
+ iSvgStyleProperties = new(ELeave) RPointerArray<CCssValue>(KCSS_MAX_ATTR);
+ // This is required to allocate buffer up to granularity so that the
+ // following Insert calls cannot leave.
+
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+ iSvgStyleProperties->Remove( 0 );
+
+ }
+
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgMissingGlyphElementImpl::~CSvgMissingGlyphElementImpl()
+ {
+ if(iShape)
+ {
+ delete iShape;
+ iShape = NULL;
+ }
+ if(iSvgStyleProperties)
+ {
+ iSvgStyleProperties->Close();
+ delete iSvgStyleProperties;
+ iSvgStyleProperties = NULL;
+ }
+ }
+
+// *******************************************************
+// From SVG DOM
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgMissingGlyphElementImpl::GetHorzAdvX()
+ {
+ return iHorzAdvX;
+ }
+
+// *******************************************************
+// SVG Implementation
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgMissingGlyphElementImpl::SetPath( const TDesC& aPath )
+ {
+ TSvgPathDataParser::ParsePathData( aPath, iShape );
+ }
+
+
+// *******************************************************
+// From MXmlElement
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgMissingGlyphElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+
+ if (aName == D )
+ {
+ SetPath( aValue );
+ }
+ return KErrNone;
+ }
+
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgMissingGlyphElementImpl::GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrRefX:
+ aValue = iShape->PointCoordsArray()[0];
+ break;
+ case KAtrRefY:
+ aValue = iShape->PointCoordsArray()[1];
+ break;
+ case KAtrHorizAdvX:
+ aValue = GetHorzAdvX();
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgMissingGlyphElementImpl::GetAttributePath( const TInt aNameId,
+ CGfxGeneralPath*& aValue )
+ {
+ if ( aNameId == KAtrData )
+ {
+ aValue = iShape;
+ }
+ else
+ {
+ aValue = NULL;
+ return KErrNoAttribute;
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgMissingGlyphElementImpl::SetAttributePathL( const TInt aNameId,
+ CGfxGeneralPath* /* aValue */ )
+ {
+ if ( aNameId != KAtrData )
+ return KErrNoAttribute;
+
+
+ return KErrNone;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgMissingGlyphElementImpl::SetAttributePathRef( const TInt aNameId,
+ CGfxGeneralPath*& aValue )
+ {
+ if ( aNameId == KAtrData )
+ {
+
+ if(iShape)
+ {
+ delete iShape;
+ iShape= NULL;
+ }
+ iShape= aValue;
+ }
+ else
+ {
+ return KErrNoAttribute;
+ }
+
+ return KErrNone;
+ }
+
+
+// *******************************************************
+// From CSvgElementImpl
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+MXmlElement* CSvgMissingGlyphElementImpl::CloneL(MXmlElement*)
+ {
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgMissingGlyphElementImpl::DrawL( CGfx2dGc* /* aGc */,
+ CSvgElementImpl* /* aElement */ )
+ {
+ return EFalse;
+ }
+
+
+// *******************************************************
+// Private
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+CSvgMissingGlyphElementImpl::CSvgMissingGlyphElementImpl( CSvgDocumentImpl* aDoc )
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+ TInt CSvgMissingGlyphElementImpl::SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue )
+ {
+ if( aNameId == KAtrHorizAdvX )
+ {
+ iHorzAdvX = aValue;
+ }
+ else
+ {
+ return CSvgElementImpl::SetAttributeFloatL( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+CGfxGeneralPath* CSvgMissingGlyphElementImpl::GetPathAttribute(TInt aAttributeId)
+ {
+ if(aAttributeId == KAtrD)
+ {
+ return iShape;
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+void CSvgMissingGlyphElementImpl::SetPathAttribute(TInt aAttributeId, CGfxGeneralPath* aPathHandle)
+{
+ // i think it will be better if it is deleted here.
+ if(aAttributeId == KAtrD)
+ {
+ if(iShape == aPathHandle)
+ {
+ return;
+ }
+ delete iShape;
+ iShape = aPathHandle;
+ }
+}
+
+void CSvgMissingGlyphElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<missing-glyph horiz-adv-x=\"%d\" >", (int)iHorzAdvX);
+
+ if (iShape)
+ {
+ RArray<TUint32>* lTypes = iShape->PointTypeArray();
+ RArray<TFloatFixPt>* lCoords = iShape->PointCoordsArrayAll();
+
+ if (lTypes->Count() != lCoords->Count())
+ {
+ RDebug::Printf("Invalid path points and types didnt match", this);
+ return;
+ }
+
+ RDebug::Printf("<path d=\"", this);
+
+ TInt lTypesCnt = lTypes->Count();
+ for (TInt i=0; i < lTypesCnt; i++)
+ {
+ RDebug::Printf("%c ", lTypes->operator[]( i ));
+ RDebug::Printf("%d ", (int)(lCoords->operator[]( i )));
+ }
+
+ RDebug::Printf(" z\">", this);
+ }
+
+ RDebug::Printf("</missing-glyph>", this);
+ #endif
+ }
+}
+#endif //ifdef SVG_FONTS_INCLUDE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGMpathElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,310 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include "SVGMpathElementImpl.h"
+#include "GfxGeneralPath.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+
+_LIT( XLINKHREF, "xlink:href" );
+
+// ---------------------------------------------------------------------------
+// Two phase construction
+// ---------------------------------------------------------------------------
+
+
+CSvgMpathElementImpl* CSvgMpathElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgMpathElementImpl* self = new ( ELeave )
+ CSvgMpathElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgMpathElementImpl* CSvgMpathElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgMpathElementImpl* self = new ( ELeave )
+ CSvgMpathElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgMpathElementImpl::~CSvgMpathElementImpl()
+ {
+ if ( iSvgUriReferenceImpl )
+ {
+ delete iSvgUriReferenceImpl;
+ iSvgUriReferenceImpl = NULL;
+ }
+ if ( iParsedHref )
+ {
+ delete iParsedHref;
+ iParsedHref = NULL;
+ }
+
+ }
+
+// *******************************************************
+// From MXmlElement
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgMpathElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+ if ( this->SetXlinkAttributeL( aName, aValue ) )
+ {
+ // Get the path from the xlink
+ TBuf<10> lTmpXlink( XLINKHREF );
+ if ( aName == lTmpXlink )
+ {
+ if( iReqAttrFlag == KAtrXlinkhref)
+ {
+ iReqAttrFlag =0;
+ }
+ CSvgElementImpl*targetEl = NULL;
+ TInt pos = KErrNotFound;
+ // If the first char is '#' then remove it
+ // This is possible if coming from cXML parser and not CVG Decoder
+
+ pos = aValue.Locate( '#' );
+ if ( pos != KErrNotFound && pos == 0 )
+ {
+ iParsedHref = HBufC::NewL( aValue.Length() );
+ TPtr tPtr = iParsedHref->Des();
+ tPtr.Copy( aValue );
+ tPtr.Delete( pos, 1 );
+ targetEl = ( CSvgElementImpl * ) ((CSvgDocumentImpl*)iOwnerDocument)->GetElementById( tPtr );
+ }
+ else
+ {
+ return pos;
+ }
+
+ if (targetEl)
+ {
+ targetEl->GetAttributePath( KAtrData, iShape );
+ }
+ else
+ {
+ iNeedTarget = ETrue;
+ }
+
+ if ( iShape )
+ {
+ CSvgElementImpl*parentEl = ( CSvgElementImpl* )
+ ParentNode();
+ if ( parentEl )
+ {
+ parentEl->SetAttributePathL( KAtrData, iShape );
+ }
+ }
+ }
+
+ return KErrNone;
+ }
+
+
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+
+ return KErrNone;
+ }
+
+// From MXmlElementOpt
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgMpathElementImpl::GetAttributePath( const TInt aNameId,
+ CGfxGeneralPath*& aValue )
+ {
+ if ( aNameId == KAtrData )
+ {
+ aValue = iShape;
+ }
+ else
+ {
+ aValue = NULL;
+ return KErrNoAttribute;
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgMpathElementImpl::SetAttributePathL( const TInt aNameId,
+ CGfxGeneralPath* /* aValue */ )
+ {
+ if ( aNameId == KAtrData )
+ {
+ }
+ else
+ {
+ return KErrNoAttribute;
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgMpathElementImpl::DrawL( CGfx2dGc* /*aGc*/, CSvgElementImpl* /*aElement*/ )
+ {
+
+ return EFalse;
+
+ /*
+ if (iNeedTarget)
+ {
+ CSvgElementImpl* targetEl = NULL;
+
+ iNeedTarget = EFalse;
+
+ if ( iParsedHref && iParsedHref->Length() > 0)
+ {
+ TPtr tPtr = iParsedHref->Des();
+ targetEl = ( CSvgElementImpl * ) ((CSvgDocumentImpl*)iOwnerDocument)->GetElementById( tPtr );
+
+ if (targetEl)
+ {
+ targetEl->GetAttributePath( KAtrData, iShape );
+ }
+ else
+ {
+ iNeedTarget = ETrue;
+ }
+ }
+ }
+
+ this->DrawShapeL( aGc, *iShape, aElement );
+ return EFalse;
+ */
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+void CSvgMpathElementImpl::ConstructL( const TUint8 aElemID )
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+ iReqAttrFlag = KAtrXlinkhref;
+
+ iSvgUriReferenceImpl = CSvgUriReferenceImpl::NewL();
+ iParsedHref = NULL;
+ iNeedTarget = EFalse;
+ }
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+CSvgMpathElementImpl::CSvgMpathElementImpl( CSvgDocumentImpl* aDoc )
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+
+// ---------------------------------------------------------------------------
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgMpathElementImpl::CloneL(MXmlElement* aParentElement)
+ {
+ // create new polyline
+ CSvgMpathElementImpl* newElement = CSvgMpathElementImpl::NewL( this->ElemID(), ((CSvgDocumentImpl*)iOwnerDocument) );
+ CleanupStack::PushL(newElement);
+ newElement->iParentNode = aParentElement;
+ // copy everything over
+ this->CopyL(newElement);
+ CleanupStack::Pop();
+ return newElement;
+ }
+
+
+// ---------------------------------------------------------------------------
+// perform a deep copy of this object
+// ---------------------------------------------------------------------------
+void CSvgMpathElementImpl::CopyL( CSvgMpathElementImpl* aDestElement )
+ {
+ if(aDestElement)
+ {
+ // copy stuff from superclass
+ this->CSvgElementImpl::CopyL(aDestElement);
+ // copy iShape
+ aDestElement->iShape->SetPointTypeArrayL( iShape->PointTypeArray() );
+ aDestElement->iShape->SetPointCoordsArrayL( iShape->PointCoordsArrayAll() );
+ // copy the reference to idoc (CSvgDocumentImpl)
+ aDestElement->iOwnerDocument = this->iOwnerDocument;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// perform a deep copy of this object
+// ---------------------------------------------------------------------------
+void CSvgMpathElementImpl::SetAttributePathByIdL(const TDesC& aId)
+ {
+ CSvgElementImpl*targetEl = NULL;
+ targetEl = ( CSvgElementImpl * ) ((CSvgDocumentImpl*)iOwnerDocument)->GetElementById( aId );
+ targetEl->GetAttributePath( KAtrData, iShape );
+
+ if ( iShape )
+ {
+ CSvgElementImpl*parentEl = ( CSvgElementImpl* )
+ ParentNode();
+ if ( parentEl )
+ {
+ parentEl->SetAttributePathL( KAtrData, iShape );
+ }
+ }
+ }
+
+void CSvgMpathElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<mpath xlink:href=\"hmm\">"/*, Href()*/);
+ #endif
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGPaintCssValueImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,357 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include "SVGPaintCssValueImpl.h"
+#include "SVGFloatCssValueImpl.h"
+
+#include "SVGElementImpl.h"
+#include "SVGColor.h"
+#include "GfxPaint.h"
+
+#include "SVGDocumentImpl.h"
+#include "SVGGradientElementImpl.h"
+#include "SVGSolidColorElementImpl.h"
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CPaintCssValueImpl::~CPaintCssValueImpl()
+ {
+
+ if( iUrlId )
+ {
+ delete iUrlId;
+ iUrlId = NULL ;
+ }
+
+ if ( iValue && iIsValueOwned )
+
+ {
+ delete ( TSvgColor * ) iValue;
+ }
+ iValue = NULL;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+MGfxPaint* CPaintCssValueImpl::Value()
+ {
+ CSvgElementImpl* lReferencedElement = NULL;
+ if ( iUrlFlag && iSvgElementImpl )
+ {
+ // iUrlFlag is true means this paint is gradient.
+ CSvgDocumentImpl *lDoc = (CSvgDocumentImpl *)iSvgElementImpl->OwnerDocument();
+
+ if (lDoc)
+ {
+ if(iUrlId)
+ {
+ lReferencedElement = ( CSvgElementImpl*)lDoc->GetElementById( *iUrlId );
+ if(lReferencedElement)
+ TInt elementId = lReferencedElement->ElemID();
+ if ( lReferencedElement && ((lReferencedElement->ElemID() == KSvgLinearGradientElement) ||
+ (lReferencedElement->ElemID() == KSvgRadialGradientElement)) )
+ {
+ //Get Attributes from Gradient Element
+ iValue = ((CSvgGradientElementImpl *)lReferencedElement)->PaintAttribute();
+ iIsValueOwned = EFalse;
+ }
+ else if (lReferencedElement && lReferencedElement->ElemID() == KSvgSolidColorElement )
+ {
+ // Get Attributes from solidColor element
+ GetColorFromSolidColorElement(lReferencedElement);
+ // delete the reference because we now have a clone.
+ TRAPD(err, SetValueL(iValue->GetColor()));
+ delete iUrlId;
+ iUrlId = NULL;
+ if (err)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CPaintCssValueImpl::Value() error trapped=%d", err);
+ #endif
+ }
+ iUrlFlag = EFalse;
+ }
+ else // id = color value... for some reason like <rect id="red" fill="red"
+ {
+ TRAPD(err, SetValueL(iUrlId->Des()));
+ if (err)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("CPaintCssValueImpl::Value() error trapped=%d", err);
+ #endif
+ }
+ }
+ }
+ }
+ }
+
+ return iValue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CPaintCssValueImpl::SetValueL( const TDesC& aValue )
+ {
+ if ( iValue )
+ {
+ delete ( TSvgColor * ) iValue;
+ iValue = NULL;
+ iIsValueOwned = EFalse;
+ }
+
+ _LIT( KNone, "none" );
+
+ _LIT( KCurrentColor, "currentColor" );
+ _LIT(KUrl,"url");
+
+
+ TUint32 tempVal = 0x000000;//default is 'black'
+ if ( aValue == KNone )
+ {
+ tempVal = KGfxColorNull;
+ }
+ else if ( aValue == KCurrentColor )
+ {
+ tempVal = KSvgCurrentColor;
+ }
+ else if (aValue.Left(3) == KUrl)
+ {
+ // URL = gradient at the moment...
+ iUrlFlag=ETrue;
+
+ HBufC* lReferenceId = (aValue.Right(aValue.Length()-5)).AllocL();
+
+
+ if( iUrlId )
+ {
+ delete iUrlId;
+ iUrlId = NULL;
+ }
+
+ iUrlId = (lReferenceId->Left(lReferenceId->Length()-1)).AllocL();
+
+ delete lReferenceId;
+ lReferenceId = NULL;
+
+ // Return it from here otherwise a memory Leak will occur
+ return KErrNone;
+
+ }
+ else
+ {
+
+
+ TSvgColor tColor(KGfxColorNull);
+ if( tColor.GetStringL( aValue,tempVal) != EFalse )
+ {
+ }
+ else
+ {
+ tempVal = 0;
+ iDefaultSet = ETrue;
+ }
+ }
+ iValue = new ( ELeave ) TSvgColor( tempVal );
+ iIsValueOwned = ETrue;
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CPaintCssValueImpl::SetValueL( const TInt& aValue )
+ {
+ if ( iValue && !iUrlFlag)
+ {
+ delete ( TSvgColor * ) iValue;
+ iValue = NULL;
+ }
+ iUrlFlag = EFalse;
+ iValue = new ( ELeave ) TSvgColor( aValue );
+ iIsValueOwned = ETrue;
+ return KErrNone;
+ }
+// ---------------------------------------------------------------------------
+// This method gets the color value from the referenced solidColor element
+// ---------------------------------------------------------------------------
+void CPaintCssValueImpl::GetColorFromSolidColorElement(CSvgElementImpl* aReferencedElement)
+ {
+ CCssValue* lCssValue = NULL;
+ aReferencedElement->FindProperty( KCSS_ATTR_FILL, lCssValue, aReferencedElement );
+ if (lCssValue != NULL)
+ {
+ iValue = ((CPaintCssValueImpl*)lCssValue)->Value();
+ ((CSvgSolidColorElementImpl*)aReferencedElement)->ApplyOpacitytoElement( iSvgElementImpl );
+ }
+ }
+
+/*// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CPaintCssValueImpl::SetL( CPaintCssValueImpl* aValue )
+{
+ iSvgElementImpl = aValue->iSvgElementImpl;
+ iValueType = aValue->iValueType;
+
+ if (aValue->iValue && !aValue->iUrlFlag)
+ {
+ CloneRGBValueL( ((TSvgColor*)(aValue->iValue))->Value());
+ }
+ else if (aValue->iValue)
+ {
+ iValue = aValue->iValue;
+ }
+
+ iDefaultSet = aValue->iDefaultSet;
+ iUrlFlag = aValue->iUrlFlag;
+
+ if( aValue->iUrlFlag )
+ {
+ SetUrlIdL(aValue->iUrlId->Des());
+ }
+}
+*/
+
+// *******************************************************
+// Private
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CPaintCssValueImpl::CPaintCssValueImpl() :iUrlId(NULL), iValue( NULL ),
+ iUrlFlag(EFalse),
+ iDefaultSet (EFalse),
+ iIsValueOwned( EFalse )
+ {
+ }
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CPaintCssValueImpl::SetUrlflag()
+ {
+ iUrlFlag= ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CPaintCssValueImpl::GetUrlflag()
+{
+ return iUrlFlag;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CPaintCssValueImpl::SetUrlIdL(const TDesC& aValue)
+ {
+ if( iUrlId )
+ {
+ delete iUrlId;
+ iUrlId = NULL;
+ }
+ iUrlId = aValue.AllocL();
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CPaintCssValueImpl::CloneRGBValueL(const TInt& aValue)
+ {
+ if (!iUrlFlag)
+ {
+ if(iValue)
+ {
+ delete ( TSvgColor * ) iValue;
+ }
+ iValue = new ( ELeave ) TSvgColor( (TUint32)aValue );
+ iIsValueOwned = ETrue;
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+HBufC* CPaintCssValueImpl::GetUrlId()
+ {
+ return iUrlId;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CPaintCssValueImpl::IsEqual( CCssValue* aValue )
+{
+ if (((CPaintCssValueImpl*)aValue)->iValue == iValue)
+ {
+ return ETrue;
+ }
+
+ return EFalse;
+}
+
+
+// ---------------------------------------------------------------------------
+// IsDefaultSet check if default color is set
+// ---------------------------------------------------------------------------
+TBool CPaintCssValueImpl::IsDefaultSet()
+ {
+ return iDefaultSet;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CPaintCssValueImpl::SetElement(CSvgElementImpl* aElement)
+{
+ iSvgElementImpl = aElement;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgElementImpl* CPaintCssValueImpl::GetElement()
+{
+ return iSvgElementImpl;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CPaintCssValueImpl::Print()
+{
+#ifdef _DEBUG
+ if (iValue)
+ {
+ RDebug::Printf("%d", (( TSvgColor* )iValue)->GetColor() );
+ }
+#endif
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGPathDataParser.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,409 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include "SVGPathDataParser.h"
+#include "SVGPointLexer.h"
+
+#include "GfxFloatFixPt.h"
+#include "GfxAffineTransform.h"
+#include "GfxFlatteningPathIterator.h"
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void TSvgPathDataParser::ParsePathData( const TDesC& aData,
+ CGfxGeneralPath* aPath )
+ {
+
+ TRAPD( error, ParsePathDataL( aData, aPath ) );
+ if ( error != KErrNone )
+ {
+ // error processing
+ return;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void TSvgPathDataParser::ParsePathDataL( const TDesC& aData,
+ CGfxGeneralPath* aPath )
+ {
+ TUint8 lPrevCom = '\0';
+ TFloatFixPt xy[6];
+ TInt32 rslt = ETrue;
+ TUint8 com;
+ TUint8 lPrevCom2 = '\0';
+
+ TSvgPointLexer svgplex( aData );
+
+ TFloatFixPt KZero;
+ TFloatFixPt KMinVal = 0.01f;
+ TFloatFixPt KOne( KFloatFixOne );
+
+ while ( svgplex.GetCommand ( com ) )
+ {
+
+ // Reset for command procesing
+ if( com == '\0' )
+ {
+ if( lPrevCom == 'z' ||lPrevCom == 'Z' )
+ {
+ aPath->Reset();
+ break ;
+ }
+ // As per 1.2 spec 8.3.2 The "moveto" commands
+ // If a 'moveto' is followed by multiple pairs of coordinates without explicit commands,
+ // the subsequent pairs shall be treated as implicit 'lineto' commands.
+
+ else if( lPrevCom == 'm')
+ {
+ com = 'l';
+ }
+ else if( lPrevCom == 'M' )
+ {
+ com = 'L';
+ }
+ else
+ {
+ com = lPrevCom;
+ }
+ }
+ else
+ {
+ lPrevCom = com;
+ }
+
+ switch ( com )
+ {
+ case 'M':
+ rslt = svgplex.GetNextWithNumOfPoints( xy ,TInt (2) );
+ if (rslt && lPrevCom2 == 'M')
+ {
+ //AJD do we want to remove this
+ // i.e. d="M 20 20 M 10 10 L 15 15
+ // has a bounding box of 5,5,10,10 or 10,10,10,10
+ //aPath->RemoveLastPathCommand();
+ }
+ if(rslt)
+ {
+ aPath->MoveToL( xy[0], xy[1], ETrue );
+ }
+ break;
+ case 'm':
+ rslt = svgplex.GetNextWithNumOfPoints( xy ,TInt (2) );
+ // added to change values from 0.0 to 0.01f if both the co-oridnates
+ // are having value 0.0.
+ // fix for bug "CGSR-78X9V2"
+ if(xy[0] == KZero && xy[1] == KZero)
+ {
+ xy[0] = KMinVal;
+ xy[1] = KMinVal;
+ }
+ if(rslt)
+ {
+ aPath->MoveToL( xy[0], xy[1], EFalse );
+ }
+
+ break;
+ case 'L':
+ rslt = svgplex.GetNextWithNumOfPoints( xy ,TInt (2) );
+ if(rslt)
+ {
+ aPath->LineToL( xy[0], xy[1], ETrue );
+ }
+ break;
+ case 'H':
+ rslt = svgplex.GetNextWithNumOfPoints( xy ,TInt (1) );
+ if(rslt)
+ {
+ aPath->HorizonToL( xy[0], ETrue );
+ }
+ break;
+ case 'V':
+ rslt = svgplex.GetNextWithNumOfPoints( xy ,TInt (1) );
+ if(rslt)
+ {
+ aPath->VertToL( xy[0], ETrue );
+ }
+ break;
+ case 'l':
+ rslt = svgplex.GetNextWithNumOfPoints( xy ,TInt (2) );
+ // added to change values from 0.0 to 0.01f if both the co-oridnates
+ // are having value 0.0.
+ // fix for bug "CGSR-78X9V2"
+ if(xy[0] == KZero && xy[1] == KZero)
+ {
+ xy[0] = KMinVal;
+ xy[1] = KMinVal;
+ }
+ if(rslt)
+ {
+ aPath->LineToL( xy[0], xy[1], EFalse );
+ }
+ break;
+ case 'h':
+ rslt = svgplex.GetNextWithNumOfPoints( xy ,TInt (1) );
+ // added to change values from 0.0 to 0.01f if both the co-oridnates
+ // are having value 0.0.
+ // fix for bug "CGSR-78X9V2"
+ if(xy[0] == KZero && xy[1] == KZero)
+ {
+ xy[0] = KMinVal;
+ xy[1] = KMinVal;
+ }
+ if(rslt)
+ {
+ aPath->HorizonToL( xy[0], EFalse );
+ }
+
+ break;
+ case 'v':
+ rslt = svgplex.GetNextWithNumOfPoints( xy ,TInt (1) );
+ // added to change values from 0.0 to 0.01f if both the co-oridnates
+ // are having value 0.0.
+ // fix for bug "CGSR-78X9V2"
+ if(xy[0] == KZero && xy[1] == KZero)
+ {
+ xy[0] = KMinVal;
+ xy[1] = KMinVal;
+ }
+ if(rslt)
+ {
+ aPath->VertToL( xy[0], EFalse );
+ }
+
+ break;
+ case 'C':
+ rslt = svgplex.GetNextWithNumOfPoints( xy ,TInt (6) );
+ if( rslt )
+ {
+ aPath->CubicToL( xy[0],
+ xy[1],
+ xy[2],
+ xy[3],
+ xy[4],
+ xy[5],
+ ETrue );
+ }
+ break;
+ case 'c':
+ rslt = svgplex.GetNextWithNumOfPoints( xy ,TInt (6) );
+ if(rslt)
+ {
+ aPath->CubicToL( xy[0],
+ xy[1],
+ xy[2],
+ xy[3],
+ xy[4],
+ xy[5],
+ EFalse );
+ }
+ break;
+ case 'S':
+ rslt = svgplex.GetNextWithNumOfPoints( xy ,TInt (4) );
+ if(rslt)
+ {
+ aPath->ShortCubicToL( xy[0],
+ xy[1],
+ xy[2],
+ xy[3],
+ ETrue );
+ }
+ break;
+ case 's':
+ rslt = svgplex.GetNextWithNumOfPoints( xy ,TInt (4) );
+ if(rslt)
+ {
+ aPath->ShortCubicToL( xy[0],
+ xy[1],
+ xy[2],
+ xy[3],
+ EFalse );
+ }
+ break;
+ case 'Q':
+ rslt = svgplex.GetNextWithNumOfPoints( xy ,TInt (4) );
+ if( rslt )
+ {
+ aPath->QuadToL( xy[0],
+ xy[1],
+ xy[2],
+ xy[3],
+ ETrue );
+ }
+ break;
+ case 'T':
+ rslt = svgplex.GetNextWithNumOfPoints( xy ,TInt (2) );
+ if(rslt)
+ {
+
+ // If there is no previous command or if
+ // the previous command was not a Q, q, T or t, the control point shall be current point.
+ if ( lPrevCom2 !='Q' && lPrevCom2 != 'q' && lPrevCom2 != 'T'
+ && lPrevCom2 != 't' )
+ {
+ aPath->QuadToLWithNoControlPoint( xy[0], xy[1] );
+ }
+ else
+ {
+ aPath->ShortQuadToL( xy[0], xy[1], ETrue );
+ }
+ }
+ break;
+ case 'q':
+ rslt = svgplex.GetNextWithNumOfPoints( xy ,TInt (4) );
+ if(rslt)
+ {
+ aPath->QuadToL( xy[0],
+ xy[1],
+ xy[2],
+ xy[3],
+ EFalse );
+ }
+ break;
+ case 't':
+ rslt = svgplex.GetNextWithNumOfPoints( xy ,TInt (2) );
+ if(xy[0] != KZero || xy[1] != KZero)
+ {
+ if(rslt)
+ {
+ aPath->ShortQuadToL( xy[0], xy[1], EFalse );
+ }
+ }
+ break;
+ case 'Z':
+ case 'z':
+ aPath->ClosePathL();
+ break;
+
+ default:
+ rslt=0;
+ break;
+
+ }// switch(lPrevCom)
+
+ if( !rslt )
+ {
+ // This is a failing path case reset.
+ aPath->Reset();
+ break ;
+ }
+
+ lPrevCom2 = com;
+ }
+ svgplex.Cleanup();
+ }
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void TSvgPathDataParser::ParsePointDataL( const TDesC& aData,
+ CGfxGeneralPath* aPath )
+ {
+ TSvgPointLexer svgplex( aData );
+ TBool first = ETrue;
+ while ( !svgplex.IsDone() )
+ {
+ TChar com;
+ TFloatFixPt x, y;
+ TInt32 rslt = svgplex.GetNextPoint( com, x, y );
+
+ if ( rslt != KErrNone )
+ {
+ aPath->Reset();
+ break;
+ }
+ if ( first )
+ {
+ aPath->MoveToL( x, y, ETrue );
+ first = EFalse;
+ }
+ else
+ {
+ aPath->LineToL( x, y, ETrue );
+ }
+ }
+ svgplex.Cleanup();
+ }
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt TSvgPathDataParser::PathLengthL( CGfxGeneralPath* aPath )
+ {
+ CGfxFlatteningPathIterator* pitr;
+ TGfxAffineTransform ident;
+ pitr = CGfxFlatteningPathIterator::NewL( aPath, & ident, 3 );
+
+
+ CleanupStack::PushL( pitr );
+
+ TFloatFixPt len;
+ TFloatFixPt lx, ly;
+ TFloatFixPt dx, dy, int0x7f( KMAXFLOATFIX );
+ TFloatFixPt tmpcoords[6];
+ while ( !pitr->IsDone() )
+ {
+ switch ( pitr->CurrentSegment( tmpcoords ) )
+ {
+ case EGfxSegMoveTo:
+ lx = tmpcoords[0];
+ ly = tmpcoords[1];
+ break;
+ case EGfxSegLineTo:
+ dx = lx - tmpcoords[0];
+ dy = ly - tmpcoords[1];
+ if ( dx > int0x7f || dy > int0x7f )
+ {
+ // calculate as integer
+ TInt32 tmplen, tx, ty;
+ tx = ( TInt32 ) dx;
+ ty = ( TInt32 ) dy;
+ #ifdef SVG_FLOAT_BUILD
+ tmplen = TFloatFixPt::Sqrt(tx * tx + ty * ty);
+ #else
+ tmplen = TFloatFixPt::FixedSqrtGeneral( tx * tx + ty * ty, 0 );
+ #endif
+ len += TFloatFixPt( tmplen );
+ }
+ else
+ {
+ // calculate as TFixPt
+
+ len += TFloatFixPt::Sqrt( dx * dx + dy * dy );
+ }
+ lx = tmpcoords[0];
+ ly = tmpcoords[1];
+ break;
+ case EGfxSegClose:
+ ;// Not support multiple path length
+ break;
+ default:
+ break;
+ }
+ pitr->NextL();
+ }
+
+ CleanupStack::PopAndDestroy( 1 );
+
+ return len;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGPathElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,362 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include "SVGPathElementImpl.h"
+#include "GfxGeneralPath.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+#include "SVGPathDataParser.h"
+
+_LIT( D, "d" );
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+CSvgPathElementImpl* CSvgPathElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgPathElementImpl*self = new ( ELeave ) CSvgPathElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgPathElementImpl::~CSvgPathElementImpl()
+ {
+ if(iShape)
+ {
+ delete iShape;
+ iShape = NULL;
+ }
+ if(iSvgStyleProperties)
+ {
+ iSvgStyleProperties->Close();
+ delete iSvgStyleProperties;
+ iSvgStyleProperties = NULL;
+ }
+ }
+
+// *******************************************************
+// From MXmlElement
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgPathElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+
+
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+
+ if ( aName == D )
+ {
+ iReqAttrFlag = 0;
+ TSvgPathDataParser::ParsePathData( aValue, iShape );
+
+ // verify path starts with move command
+ RArray<TUint32>* typeArray = iShape->PointTypeArray();
+ if ( !typeArray || ( typeArray->Count() > 0 && (*typeArray)[0] != EGfxSegMoveTo ) )
+ {
+ if ( iOwnerDocument )
+ {
+ _LIT( msg1, "Missing 'move to segment' in <path>" );
+ _LIT(msg2, "");
+ ((CSvgDocumentImpl*)iOwnerDocument)->SetError( KErrNotFound, msg1, msg2 );
+ }
+ }
+ }
+
+ if (( ((CSvgElementImpl*)iParentNode) != NULL && ((CSvgElementImpl*)iParentNode)->ElemID() == KSvgGlyphElement ) && ( aName == D) )
+ {
+ ((CSvgElementImpl*)iParentNode)->SetAttributeL(aName,aValue);
+ }
+
+ return KErrNone;
+ }
+
+// From MXmlElementOpt
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgPathElementImpl::GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrRefX:
+ aValue = iShape->PointCoordsArray()[0];
+ break;
+ case KAtrRefY:
+ aValue = iShape->PointCoordsArray()[1];
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgPathElementImpl::GetAttributePath( const TInt aNameId,
+ CGfxGeneralPath*& aValue )
+ {
+ if ( aNameId == KAtrData )
+ {
+ aValue = iShape;
+ }
+ else
+ {
+ aValue = NULL;
+ return KErrNoAttribute;
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgPathElementImpl::SetAttributePathL( const TInt aNameId,
+ CGfxGeneralPath* aValue )
+ {
+ if ( aNameId == KAtrData )
+ {
+ // copy aValue into iShape not just reassign pointers - that will cause memory leak
+ // copy when CGfxGeneralPath implements a copy method
+ iShape->SetPointTypeArrayL( aValue->PointTypeArray() );
+ iShape->SetPointCoordsArrayL( aValue->PointCoordsArrayAll() );
+ if( WasTurnedOff() )
+ {
+ // turn it on. this means all the required attributes Are present and
+ // hence we can render it.
+ _LIT(KInline , "inline");
+ CSvgElementImpl::SetPropertyL(KCSS_ATTR_DISPLAY, KInline);
+ SetTurnOff( EFalse );
+ }
+
+ }
+ else
+ {
+ return KErrNoAttribute;
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgPathElementImpl::SetAttributePathRef( const TInt aNameId,
+ CGfxGeneralPath*& aValue )
+ {
+ if ( aNameId == KAtrData )
+ {
+
+ if(iShape)
+ {
+ delete iShape;
+ iShape= NULL;
+ }
+ iShape= aValue;
+
+ if (( ((CSvgElementImpl*)iParentNode) != NULL && ((CSvgElementImpl*)iParentNode)->ElemID() == KSvgGlyphElement ) && ( aNameId == KAtrD) )
+ {
+ ((CSvgElementImpl*)iParentNode)->SetPathAttribute(aNameId,aValue);
+ }
+
+ }
+ else
+ {
+ return KErrNoAttribute;
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgPathElementImpl::DrawL( CGfx2dGc* aGc, CSvgElementImpl* aElement )
+ {
+ this->DrawShapeL( aGc, *iShape, aElement );
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgPathElementImpl::ConstructL( const TUint8 aElemID )
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+
+ iSvgStyleProperties = new(ELeave) RPointerArray<CCssValue>(KCSS_MAX_ATTR);
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+ iSvgStyleProperties->Remove( 0 );
+ iSvgTransformable = CSvgTransformableImpl::NewL();
+
+ iShape = CGfxGeneralPath::NewL();
+ iReqAttrFlag=KSVG_PATH_ELEMFLAG;
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgPathElementImpl::CSvgPathElementImpl( CSvgDocumentImpl* aDoc )
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgPathElementImpl::GetBBox( TGfxRectangle2D& aBbox )
+ {
+
+ if (!iShape || iShape->PointTypeArray()->Count() == 0)
+ {
+ // The D attribute has not been set yet
+ return;
+ }
+
+ iShape->GetBounds( GetCTM(), aBbox );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgPathElementImpl::GetUnscaledBBox( TGfxRectangle2D& aBbox )
+ {
+ if (!iShape || iShape->PointTypeArray()->Count() == 0)
+ {
+ // The D attribute has not been set yet
+ return;
+ }
+
+ TGfxAffineTransform identityTx;
+ iShape->GetBounds( identityTx, aBbox );
+ }
+
+// ---------------------------------------------------------------------------
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgPathElementImpl::CloneL(MXmlElement* aParentElement)
+ {
+ // create new polyline
+ CSvgPathElementImpl* newElement = CSvgPathElementImpl::NewL( this->ElemID(), ((CSvgDocumentImpl*)iOwnerDocument) );
+
+ CleanupStack::PushL(newElement);
+ newElement->iParentNode = aParentElement;
+ // copy everything over
+ this->CopyL(newElement);
+ CleanupStack::Pop();
+ return newElement;
+ }
+
+// ---------------------------------------------------------------------------
+// perform a deep copy of this object
+// ---------------------------------------------------------------------------
+void CSvgPathElementImpl::CopyL( CSvgPathElementImpl* aDestElement )
+ {
+ if(aDestElement)
+ {
+ // copy stuff from superclass
+ this->CSvgElementImpl::CopyL(aDestElement);
+
+ // copy iShape
+ RArray<TUint32>* lTypes = this->iShape->PointTypeArray();
+ RArray<TFloatFixPt>* lCoords = this->iShape->PointCoordsArrayAll();
+ aDestElement->iShape->SetPointTypeArrayL(lTypes);
+ aDestElement->iShape->SetPointCoordsArrayL(lCoords);
+
+ // copy the reference to idoc (CSvgDocumentImpl)
+ aDestElement->iOwnerDocument = this->iOwnerDocument;
+ }
+
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CGfxGeneralPath* CSvgPathElementImpl::GetPathAttribute(TInt aAttributeId)
+{
+ if(aAttributeId == KAtrD)
+ {
+ return iShape;
+ }
+ return NULL;
+}
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgPathElementImpl::SetPathAttribute(TInt aAttributeId, CGfxGeneralPath* aPathHandle)
+{
+ if(aAttributeId == KAtrD)
+ {
+ if(iShape != aPathHandle)
+ {
+ delete iShape;
+ iShape = aPathHandle;
+ }
+ }
+}
+
+void CSvgPathElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RArray<TUint32>* lTypes = this->iShape->PointTypeArray();
+ RArray<TFloatFixPt>* lCoords = this->iShape->PointCoordsArrayAll();
+
+ if (lTypes->Count() != lCoords->Count())
+ {
+ RDebug::Printf("Invalid path points and types didnt match", this);
+ return;
+ }
+
+ RDebug::Printf("<path d=\"", this);
+
+ TInt lTypesCnt = lTypes->Count();
+ for (TInt i=0; i < lTypesCnt; i++)
+ {
+ RDebug::Printf("%c ", lTypes->operator[]( i ));
+ RDebug::Printf("%d ", (int)(lCoords->operator[]( i )));
+ }
+
+ RDebug::Printf(" z\">", this);
+
+ #endif
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGPointLexer.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,435 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include "SVGPointLexer.h"
+
+#include "stdlib.h"
+#include "string.h"
+
+// Below define is used as a mask for getting LSB of 16bit number
+// for endian-agnostic progressing.
+#define KLSBMASK ( 0xFF )
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TSvgPointLexer::TSvgPointLexer( const TDesC& aDes ) :
+ iLex( aDes ), iNegativeNumber( EFalse )
+{
+ iDataCopy = NULL;
+ iDataCopy = aDes.Alloc();
+ if ( iDataCopy )
+ {
+ iData = (TUint16 *)iDataCopy->Ptr();
+ iDataEnd = iData + iDataCopy->Length();
+ }
+}
+
+void TSvgPointLexer::Cleanup()
+{
+ if ( iDataCopy )
+ {
+ delete iDataCopy;
+ iDataCopy = NULL;
+ }
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt32 TSvgPointLexer::GetNext( TChar& aCommand, TFloatFixPt& aVal )
+ {
+ TReal32 realnum = 0.0;
+
+ // Parse a command and minus symbol
+ iNegativeNumber = EFalse;
+ aCommand = SkipUntilNum();
+ if ( iLex.Eos() && aCommand != 'z' )
+ {
+ return -1;
+ }
+ else if ( aCommand == 'z' )
+ {
+ // if 'z' was found return immediately
+ // never parse for numbers
+ return KErrNone;
+ }
+
+ // Parse a number with fraction
+ iLex.Mark();
+ if ( SkipToNumEnd() )
+ {
+ TInt result = TLex( iLex.MarkedToken() ).Val( realnum, '.' ) ;
+ if (result != KErrNone)
+ {
+ realnum= 0.0;
+ return result;
+ }
+ }
+ else
+ {
+ realnum = 0.0;
+ }
+ if ( iNegativeNumber )
+ realnum = -realnum;
+ aVal = ( TFloatFixPt ) realnum;
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+TBool TSvgPointLexer::GetNextWithNumOfPoints( TFloatFixPt *aVal, TInt NoOfPoints)
+ {
+ TReal32 realnum = 0.0;
+ TUint8 tmpchar;
+ TInt i=0;
+
+ for( i=0;i < NoOfPoints;i++ )
+ {
+ // Since iData is a TUint16 pointer, and we need to
+ // operate with 8bit ASCII, mask LSB to obtain the same
+ tmpchar = *iData & KLSBMASK;
+ // Traverse the string while character encountered is
+ // ' ', LineFeed('\0xa'), ',', Carriage Return ('\0xd')
+ while( !(tmpchar^32) || !(tmpchar^10) || !(tmpchar^44) || !(tmpchar^13) )
+ {
+ iData++;
+ if ( iData < iDataEnd )
+ {
+ tmpchar = *iData & KLSBMASK;
+ }
+ else
+ {
+ // Exceeding buffer limits, return error
+ return EFalse;
+ }
+ }
+
+ // Check if character encountered is '-'
+ if( !(tmpchar^45) )
+ {
+ iData++;
+
+ if ( iData < iDataEnd )
+ {
+ if(SkipToNumEndWithoutLex(realnum) )
+ {
+ realnum = -realnum;
+ }
+ else
+ {
+ return EFalse;
+ }
+ }
+ else // if ( iData < iDataEnd )
+ {
+ // Exceeding buffer limits, return error
+ return EFalse;
+ }
+ }
+ else // Not a '-' char
+ {
+ if( !(tmpchar^43) ) // to increment the data if '+' is given
+ {
+ iData++;
+ }
+
+ if( !SkipToNumEndWithoutLex(realnum) )
+ {
+ return EFalse;
+ }
+ }
+ // Save the converted number into float array
+ // provided by caller.
+ aVal[i] = ( TFloatFixPt )(realnum);
+ }
+
+ return ETrue;
+ }
+
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt32 TSvgPointLexer::GetNextPoint( TChar& aCommand, TFloatFixPt& aX, TFloatFixPt& aY )
+ {
+ TReal32 realnum = 0.0;
+
+ // Parse X value
+ iNegativeNumber = EFalse;
+ aCommand = SkipUntilNum();
+ if ( iLex.Eos() )
+ {
+ return -1;
+ }
+ iLex.Mark();
+ if ( SkipToNumEnd() )
+ {
+ TInt result = TLex( iLex.MarkedToken() ).Val( realnum, '.' ) ;
+ if (result != KErrNone)
+ {
+ realnum= 0.0;
+ return result;
+ }
+ }
+ else
+ {
+ realnum = 0.0;
+ }
+ if ( iNegativeNumber )
+ realnum = -realnum;
+ aX = realnum;
+
+ // Parse Y value
+ iNegativeNumber = EFalse;
+ iLex.Mark();
+ SkipUntilNum();
+ if ( iLex.Eos() )
+ {
+ return -1;
+ }
+ iLex.Mark();
+ if ( SkipToNumEnd() )
+ {
+ TInt result = TLex( iLex.MarkedToken() ).Val( realnum, '.') ;
+ if (result != KErrNone)
+ {
+ realnum= 0.0;
+ return result;
+ }
+ }
+ else
+ {
+ realnum = 0.0; // exponential description
+ }
+ if ( iNegativeNumber )
+ realnum = -realnum;
+ aY = realnum;
+
+ return KErrNone;
+ }
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool TSvgPointLexer::SkipToNumEnd()
+ {
+ TChar tmpchar = iLex.Peek();
+ TBool tmpbool = ETrue;
+ TBool acceptMinus = EFalse;
+
+ while ( tmpchar.IsDigit() ||
+ !(tmpchar^46) ||
+ ( !(tmpchar^45) && acceptMinus ) )
+ {
+ iLex.Inc();
+ tmpchar = iLex.Peek();
+ acceptMinus = EFalse;
+
+ if ( !(tmpchar^101) || !(tmpchar^69) )
+ {
+ // exponential value
+ iLex.Inc();
+ tmpchar = iLex.Peek();
+ tmpbool = EFalse;
+ acceptMinus = ETrue;
+ }
+ }
+ return tmpbool;
+ }
+
+//
+// ---------------------------------------------------------------------------
+// TBool TSvgPointLexer::SkipToNumEndWithoutLex(TReal32 &aNum)
+// This function parses the number at the current position into aNum
+// ---------------------------------------------------------------------------
+TBool TSvgPointLexer::SkipToNumEndWithoutLex(TReal32 &aNum)
+ {
+ TBool numberFound = EFalse;
+ TReal32 lNumber=0;
+ // Since iData is a TUint16 pointer, and we need to
+ // operate with 8bit ASCII, mask LSB to obtain the same
+ TUint8 tmpchar = *iData & KLSBMASK;
+ TInt fractionPart=0;
+
+ // Scan through the string while the character is
+ // between '0' and '9'
+ // or is '.'
+ // and there are more characters in the string
+ while ( (((tmpchar > 47) && (tmpchar < 58) )||
+ !(tmpchar^46)) && iData < iDataEnd )
+ {
+ // If a '.' is not found
+ if(tmpchar^46)
+ {
+ // This means that the char is between '0' and '9'
+ numberFound = ETrue;
+ // Append it to lNumber
+ lNumber = 10*lNumber + (tmpchar -'0');
+
+ if(fractionPart)
+ {
+ fractionPart++;
+ }
+ }
+ else // '.' is found
+ {
+ fractionPart++;
+ }
+
+ iData++;
+ if ( iData < iDataEnd )
+ {
+ tmpchar = *iData & KLSBMASK;
+
+ // Check if characted is 'e' or 'E'
+ // for eg. -3.486e-007
+ // This is for floating point representation and is
+ // not supported currently. Such numbers are treated
+ // as 0.0.
+ // The number is skipped.
+ if ( (!(tmpchar^101) || !(tmpchar^69)) )
+ {
+ iData++;
+ if ( iData < iDataEnd )
+ {
+ tmpchar = *iData & KLSBMASK;
+
+ // Check if character is '-', if so
+ // skip it
+ if( !(tmpchar^45) )
+ {
+ iData++;
+ if ( iData < iDataEnd )
+ {
+ tmpchar = *iData & KLSBMASK;
+ }
+ }
+ // Skip the numbers and decimal point after 'e'
+ while ( ( ( ( tmpchar > 47 ) && ( tmpchar < 58 ) ) ||
+ !( tmpchar^46 ) ) && ( iData < iDataEnd ) )
+ {
+ iData++;
+ if ( iData < iDataEnd )
+ {
+ tmpchar = *iData & KLSBMASK;
+ }
+ }
+ }
+ aNum = 0.0;
+ return numberFound;
+ } // if (exponential number)
+ } // if iData < iDataEnd
+ } // end while
+ // Account for decimal point by performing following calculation
+ // lNumber = lNumber / ( 10^ ( fractionPart - 1 ) )
+ if(numberFound)
+ {
+ TInt l=0;
+ TInt k=1;
+ while(l<(fractionPart-1))
+ {
+ k=(k*10);
+ l++;
+ }
+ lNumber = (lNumber/k);
+ aNum = lNumber;
+ }
+
+ return numberFound;
+ }
+
+
+
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TChar TSvgPointLexer::SkipUntilNum()
+ {
+ TChar ret = '\0';
+ iLex.SkipSpace();
+ TChar tmpchar = iLex.Peek();
+ // skip until finding a digit or '.'
+
+ while ( !( tmpchar.IsDigit() || tmpchar == '.' ) && !iLex.Eos() )
+ {
+ if ( tmpchar == '-' )
+ {
+ iNegativeNumber = ETrue;
+ }
+ else if ( tmpchar == 'Z' || tmpchar == 'z' )
+ {
+ // if 'Z' or 'z' was found, return imediately.
+ iLex.Inc();
+ return 'z';
+ }
+ else if ( tmpchar != ' ' && tmpchar != ',' && tmpchar != '\n' )
+ // a better way may be for only selected characters to be recognized and not ignored.
+ {
+ ret = tmpchar;
+ }
+ iLex.Inc();
+ tmpchar = iLex.Peek();
+ }
+
+ return ret;
+ }
+
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool TSvgPointLexer::GetCommand(TUint8 &a)
+{
+ a = '\0';
+ TUint8 tmpchar;
+ while (iData < iDataEnd )
+ {
+ tmpchar = *iData & KLSBMASK;
+ // If character is a not between '0' and '9' and not '.' and '-'
+ if (!((tmpchar > 47) && (tmpchar < 58)) && (tmpchar^46) && (tmpchar^45) )
+ {
+ // Check if character is an alphabet
+ if((tmpchar >=65 && tmpchar <= 90) || (tmpchar >=97 && tmpchar <= 122) )
+ {
+ a = tmpchar;
+ iData++;
+ return ETrue;
+ }
+ else
+ {
+ iData++;
+ }
+ }
+ else
+ {
+ return ETrue;
+ }
+
+ }
+ return EFalse;
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGPolylineElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,333 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "SVGPolylineElementImpl.h"
+#include "SVGElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+#include "SVGPathDataParser.h"
+
+#include "GfxAffineTransform.h"
+
+_LIT(POINTS, "points");
+_LIT(INLINE, "inline");
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgPolylineElementImpl* CSvgPolylineElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgPolylineElementImpl*self = new ( ELeave )
+ CSvgPolylineElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgPolylineElementImpl* CSvgPolylineElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgPolylineElementImpl*self = new ( ELeave )
+ CSvgPolylineElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgPolylineElementImpl::ConstructL( const TUint8 aElemID )
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+
+ iSvgStyleProperties = new(ELeave) RPointerArray<CCssValue>(KCSS_MAX_ATTR);
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+ iSvgStyleProperties->Remove( 0 );
+ iSvgTransformable = CSvgTransformableImpl::NewL();
+
+ iShape = CGfxGeneralPath::NewL();
+ iReqAttrFlag=KSVG_POLYLINE_ELEMFLAG;
+
+ }
+
+
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgPolylineElementImpl::~CSvgPolylineElementImpl()
+ {
+ if ( iShape )
+ {
+ delete iShape;
+ iShape = NULL;
+ }
+ if ( iSvgStyleProperties )
+ {
+ iSvgStyleProperties->Close();
+ delete iSvgStyleProperties;
+ iSvgStyleProperties = NULL;
+ }
+ }
+
+// *******************************************************
+// From MXmlElement
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgPolylineElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+
+
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+
+ if( aName == POINTS )
+ {
+
+ iReqAttrFlag = 0;
+ TSvgPathDataParser::ParsePointDataL( aValue,
+ iShape );
+ // Polyline does not close a path.
+ if(this->ElemID() == KSvgPolygonElement )
+ {
+ iShape->ClosePathL();
+ }
+ }
+
+ return KErrNone;
+ }
+
+// From MXmlElementOpt
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgPolylineElementImpl::GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrRefX:
+ aValue = iShape->PointCoordsArray()[0];
+ break;
+ case KAtrRefY:
+ aValue = iShape->PointCoordsArray()[1];
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgPolylineElementImpl::GetAttributePath( const TInt aNameId,
+ CGfxGeneralPath*& aValue )
+ {
+ if ( aNameId == KAtrPoints )
+ {
+ aValue = iShape;
+ }
+ else
+ {
+ aValue = NULL;
+ return KErrNoAttribute;
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgPolylineElementImpl::SetAttributePathL( const TInt aNameId,
+ CGfxGeneralPath* aValue )
+ {
+ if ( aNameId == KAtrPoints ) //.
+ {
+ // We need to copy aValue into iShape
+ // We should not just reassign pointers - that will cause memory leak
+ // We will do the copy when CGfxGeneralPath implements a copy method
+ iShape->SetPointTypeArrayL( aValue->PointTypeArray() );
+ iShape->SetPointCoordsArrayL( aValue->PointCoordsArrayAll() );
+ if( WasTurnedOff() )
+ {
+ // turn it on. this means all the required attributes Are present and
+ // hence we can render it.
+ CSvgElementImpl::SetPropertyL(KCSS_ATTR_DISPLAY, INLINE);
+ SetTurnOff( EFalse );
+ }
+ }
+ else
+ {
+ return KErrNoAttribute;
+ }
+ if(this->ElemID() == KSvgPolygonElement )
+ {
+ iShape->ClosePathL();
+ }
+ return KErrNone;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgPolylineElementImpl::SetAttributePathRef( const TInt aNameId,
+ CGfxGeneralPath*& aValue )
+ {
+ if ( aNameId == KAtrPoints )
+ {
+
+ if(iShape)
+ {
+ delete iShape;
+ iShape= NULL;
+ }
+ iShape= aValue;
+
+ }
+ else
+ {
+ return KErrNoAttribute;
+ }
+
+ return KErrNone;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgPolylineElementImpl::DrawL( CGfx2dGc* aGc, CSvgElementImpl* aElement )
+ {
+ this->DrawShapeL( aGc, *iShape, aElement );
+
+ return ETrue;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgPolylineElementImpl::CSvgPolylineElementImpl( CSvgDocumentImpl* aDoc )
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgPolylineElementImpl::GetBBox( TGfxRectangle2D& aBbox )
+ {
+ iShape->GetBounds( GetCTM(), aBbox );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgPolylineElementImpl::GetUnscaledBBox( TGfxRectangle2D& aBbox )
+ {
+ TGfxAffineTransform identityTx;
+ iShape->GetBounds( identityTx, aBbox );
+ }
+
+// ---------------------------------------------------------------------------
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgPolylineElementImpl::CloneL(MXmlElement* aParentElement)
+ {
+ // create new polyline
+ CSvgPolylineElementImpl* newElement = CSvgPolylineElementImpl::NewL( this->ElemID(), ((CSvgDocumentImpl*)iOwnerDocument) );
+
+ CleanupStack::PushL(newElement);
+ newElement->iParentNode = aParentElement;
+ // copy everything over
+ CopyL(newElement);
+ CleanupStack::Pop();
+ return newElement;
+ }
+
+// ---------------------------------------------------------------------------
+// perform a deep copy of this object
+// ---------------------------------------------------------------------------
+void CSvgPolylineElementImpl::CopyL( CSvgPolylineElementImpl* aDestElement )
+ {
+ if(aDestElement)
+ {
+ // copy stuff from superclass
+ CSvgElementImpl::CopyL(aDestElement);
+
+ // copy iShape
+ RArray<TUint32>* lTypes = iShape->PointTypeArray();
+ RArray<TFloatFixPt>* lCoords = iShape->PointCoordsArrayAll();
+ aDestElement->iShape->SetPointTypeArrayL(lTypes);
+ aDestElement->iShape->SetPointCoordsArrayL(lCoords);
+
+ // copy the reference to idoc (CSvgDocumentImpl)
+ aDestElement->iOwnerDocument = iOwnerDocument;
+ }
+
+ }
+
+void CSvgPolylineElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RArray<TUint32>* lTypes = this->iShape->PointTypeArray();
+ RArray<TFloatFixPt>* lCoords = this->iShape->PointCoordsArrayAll();
+
+ if (lTypes->Count() != lCoords->Count())
+ {
+ RDebug::Printf("Invalid polyline points and types didnt match", this);
+ return;
+ }
+
+ RDebug::Printf("<polyline points=\"", this);
+
+ TInt lTypesCnt = lTypes->Count();
+ for (TInt i=0; i < lTypesCnt; i++)
+ {
+ RDebug::Printf("%c ", lTypes->operator[]( i ));
+ RDebug::Printf("%d ", (int)(lCoords->operator[]( i )));
+ }
+
+ RDebug::Printf(" z\">", this);
+
+ #endif
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGPreserveAspectRatioImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include <e32base.h>
+
+#include "SVGPreserveAspectRatioImpl.h"
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgPreserveAspectRatioImpl* CSvgPreserveAspectRatioImpl::NewL()
+ {
+ CSvgPreserveAspectRatioImpl* self = new ( ELeave )
+ CSvgPreserveAspectRatioImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgPreserveAspectRatioImpl* CSvgPreserveAspectRatioImpl::NewLC()
+ {
+ CSvgPreserveAspectRatioImpl* self = new ( ELeave )
+ CSvgPreserveAspectRatioImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgPreserveAspectRatioImpl::~CSvgPreserveAspectRatioImpl()
+ {
+ }
+
+// *******************************************************
+// From SVG DOM
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TSvgPreserveAspectAlignType CSvgPreserveAspectRatioImpl::GetAlign()
+ {
+ return iAlign;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TSvgMeetOrSliceType CSvgPreserveAspectRatioImpl::GetMeetOrSlice()
+ {
+ return iMeetOrSlice;
+ }
+
+// *******************************************************
+// SVG Implementation
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgPreserveAspectRatioImpl::SetAlign( TSvgPreserveAspectAlignType aType )
+ {
+ iAlign = aType;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgPreserveAspectRatioImpl::SetMeetOrSlice( TSvgMeetOrSliceType aType )
+ {
+ iMeetOrSlice = aType;
+ }
+
+// *******************************************************
+// Private
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgPreserveAspectRatioImpl::ConstructL()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgPreserveAspectRatioImpl::CSvgPreserveAspectRatioImpl() : iMeetOrSlice( ESvgMeetOrSlice_Meet ),
+ iAlign( ESvgPreserveAspectRatio_XmidYmid )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgPreserveAspectRatioImpl* CSvgPreserveAspectRatioImpl::CloneL()
+ {
+ CSvgPreserveAspectRatioImpl* retValue = CSvgPreserveAspectRatioImpl::NewL();
+ retValue->iMeetOrSlice = iMeetOrSlice;
+ retValue->iAlign = iAlign;
+ return retValue;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGRadialGradientElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,215 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include "SVGRadialGradientElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+#include "SvgStopElementImpl.h"
+#include "SVGIntCssValueImpl.h"
+
+#include "GfxAffineTransform.h"
+
+_LIT(FX, "fx");
+_LIT(FY, "fy");
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgRadialGradientElementImpl* CSvgRadialGradientElementImpl::NewL(const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgRadialGradientElementImpl *self = new (ELeave) CSvgRadialGradientElementImpl(aDoc);
+ CleanupStack::PushL(self);
+ self->ConstructL(aElemID);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgRadialGradientElementImpl::ConstructL(const TUint8 aElemID)
+ {
+ CSvgGradientElementImpl::ConstructL( aElemID );
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgRadialGradientElementImpl::CSvgRadialGradientElementImpl( CSvgDocumentImpl* aDoc ):
+ CSvgGradientElementImpl(aDoc)
+ {
+ iGradientPaint = &iGfxRadialPaint;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgRadialGradientElementImpl::SetAttributeL(const TDesC &aName, const TDesC &aValue)
+ {
+ CSvgGradientElementImpl::SetAttributeL( aName, aValue );
+
+ if(aName == FX)
+ {
+ iGfxRadialPaint.iFx=TFloatFixPt::ConvertString(aValue);
+
+ return KErrNone;
+ }
+ else if(aName == FY)
+ {
+ iGfxRadialPaint.iFy=TFloatFixPt::ConvertString(aValue);
+
+ return KErrNone;
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+MGfxPaint *CSvgRadialGradientElementImpl::PaintAttribute()
+ {
+ TInt i=0;
+
+ TFloatFixPt lOffset;
+ TUint32 lStopColor;
+ TFloatFixPt lStopOpacity;
+
+ if( iStopElementData )
+ {
+ iStopElementData->Reset();
+ }
+
+ TInt svgStopEleArrayCnt = iSvgStopElementArray->Count();
+ for(i=0;i<svgStopEleArrayCnt;i++)
+ {
+ CSvgStopElementImpl* temp = (*iSvgStopElementArray)[i];
+
+ // Check if the element has valid offset value. If the offset had invalid value
+ // it will be made zero but this function will return FALSE.
+ if( temp->IsValidElement() )
+ {
+ temp->GetOffset(lOffset);
+ temp->GetStopColor(lStopColor);
+ temp->GetStopOpacity (lStopOpacity);
+ TSvgStopData la ;
+ la.iOffset = lOffset;
+ la.iStopColor = lStopColor;
+ la.iStopOpacity = lStopOpacity;
+ TInt error = iStopElementData->Append(la);
+ if(error != KErrNone)
+ {
+ break;
+ }
+ }
+ }
+ iGfxRadialPaint.iStopData = iStopElementData;
+
+ const TGfxAffineTransform& tempTransform = GetCTM();
+ iGradientPaint->iGradientTransform.matrix[0][0] = tempTransform.iM00.iValue;
+ iGradientPaint->iGradientTransform.matrix[0][1] = tempTransform.iM01.iValue;
+ iGradientPaint->iGradientTransform.matrix[0][2] = tempTransform.iM02.iValue;
+ iGradientPaint->iGradientTransform.matrix[1][0] = tempTransform.iM10.iValue;
+ iGradientPaint->iGradientTransform.matrix[1][1] = tempTransform.iM11.iValue;
+ iGradientPaint->iGradientTransform.matrix[1][2] = tempTransform.iM12.iValue;
+
+
+ return &iGfxRadialPaint;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgRadialGradientElementImpl::GetAttributeFloat( const TInt aNameId, TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrCx:
+ aValue = iGfxRadialPaint.iCx ;
+ break;
+ case KAtrCy:
+ aValue = iGfxRadialPaint.iCy ;
+ break;
+ case KAtrR :
+ aValue = iGfxRadialPaint.iR ;
+ break;
+ case KAtrFx:
+ aValue = iGfxRadialPaint.iFx;
+ break;
+ case KAtrFy:
+ aValue = iGfxRadialPaint.iFy;
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+
+ return 0;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgRadialGradientElementImpl::SetAttributeFloatL( const TInt aNameId, const TFloatFixPt aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrCx:
+ iGfxRadialPaint.iCx = aValue;
+ break;
+ case KAtrCy:
+ iGfxRadialPaint.iCy = aValue;
+ break;
+ case KAtrR :
+ iGfxRadialPaint.iR = aValue;
+ break;
+ case KAtrFx:
+ iGfxRadialPaint.iFx= aValue;
+ break;
+ case KAtrFy:
+ iGfxRadialPaint.iFy = aValue;
+ break;
+
+ default:
+ return CSvgElementImpl::SetAttributeFloatL( aNameId, aValue );
+ }
+ return 0;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgRadialGradientElementImpl::~CSvgRadialGradientElementImpl()
+ {
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgRadialGradientElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<radialGradient gradientUnits=\"hmm\" gradientTransform=\"hmm\" cx=\"%d\" cy=\"%d\" r=\"%d\" fx=\"%d\" fy=\"%d\" spreadMethod=\"hmm\" xlink:href=\"hmm\"/>",
+ (int)iGfxRadialPaint.iCx, (int)iGfxRadialPaint.iCy, (int)iGfxRadialPaint.iR, (int)iGfxRadialPaint.iFx, (int)iGfxRadialPaint.iFy/*, Href()*/);
+ #endif
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGRectElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,391 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "SVGRectElementImpl.h"
+#include "SVGElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+#include "SVGFourPointRect.h"
+
+#include "GfxAffineTransform.h"
+
+
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgRectElementImpl* CSvgRectElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgRectElementImpl*self = new ( ELeave ) CSvgRectElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID);
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgRectElementImpl* CSvgRectElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgRectElementImpl*self = new ( ELeave ) CSvgRectElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+
+
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgRectElementImpl::~CSvgRectElementImpl()
+ {
+
+ if ( iSvgStyleProperties )
+ {
+ iSvgStyleProperties->Close();
+ delete iSvgStyleProperties;
+ iSvgStyleProperties = NULL;
+ }
+ }
+
+// *******************************************************
+// From SVG DOM
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TFloatFixPt CSvgRectElementImpl::X()
+ {
+ return iRectangle.iX;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TFloatFixPt CSvgRectElementImpl::Y()
+ {
+ return iRectangle.iY;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TFloatFixPt CSvgRectElementImpl::Width()
+ {
+ return iRectangle.iWidth;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TFloatFixPt CSvgRectElementImpl::Height()
+ {
+ return iRectangle.iHeight;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TFloatFixPt CSvgRectElementImpl::Rx()
+ {
+ return iRectangle.iArcWidth;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TFloatFixPt CSvgRectElementImpl::Ry()
+ {
+ return iRectangle.iArcHeight;
+ }
+
+// ==========================================================================
+// For JSR support
+// ==========================================================================
+void CSvgRectElementImpl::SetRectValues(TFloatFixPt aX, TFloatFixPt aY, TFloatFixPt aWidth, TFloatFixPt aHeight)
+ {
+ iRectangle.iX = aX;
+ iRectangle.iY = aY;
+ iRectangle.iHeight = aHeight;
+ iRectangle.iWidth = aWidth;
+ }
+
+
+// From MXmlElementOpt
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgRectElementImpl::GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrX:
+ case KAtrRefX:
+ aValue = X();
+ break;
+ case KAtrY:
+ case KAtrRefY:
+ aValue = Y();
+ break;
+ case KAtrWidth:
+ aValue = Width();
+ break;
+ case KAtrHeight:
+ aValue = Height();
+ break;
+ // added as a part of get and Set api update
+ case KAtrRx:
+ aValue = iRectangle.iArcWidth;
+ break;
+ case KAtrRy:
+ aValue = iRectangle.iArcHeight;
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgRectElementImpl::SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrX:
+ iRectangle.iX = aValue;
+ break;
+ case KAtrY:
+
+ iRectangle.iY = aValue;
+ break;
+
+ case KAtrRx:
+ iRectangle.iArcWidth = aValue;
+ break;
+ case KAtrRy:
+ iRectangle.iArcHeight = aValue;
+ break;
+
+
+ case KAtrWidth:
+ if(iReqAttrFlag == KAtrSVGRec)
+ {
+ iReqAttrFlag = KAtrHeight;
+ }
+ else
+ {
+ iReqAttrFlag = 0;
+
+ if( WasTurnedOff() )
+ {
+ _LIT(KInline , "inline");
+ // turn it on. this means all the required attributes Are present and
+ // hence we can render it.
+ CSvgElementImpl::SetPropertyL(KCSS_ATTR_DISPLAY, KInline);
+ SetTurnOff( EFalse );
+ }
+ }
+ iRectangle.iWidth = aValue;
+ break;
+
+ case KAtrHeight:
+ if(iReqAttrFlag == KAtrSVGRec)
+ {
+ iReqAttrFlag = KAtrWidth;
+ }
+ else
+ {
+ iReqAttrFlag = 0;
+ if( WasTurnedOff() )
+ {
+ _LIT(KInline , "inline");
+ // turn it on. this means all the required attributes Are present and
+ // hence we can render it.
+ CSvgElementImpl::SetPropertyL(KCSS_ATTR_DISPLAY, KInline);
+ SetTurnOff( EFalse );
+ }
+ }
+ iRectangle.iHeight = aValue;
+ break;
+ default:
+ return CSvgElementImpl::SetAttributeFloatL( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+
+// *******************************************************
+// From MXmlElement
+
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgRectElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+ return KErrNone;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TBool CSvgRectElementImpl::DrawL( CGfx2dGc* aGc, CSvgElementImpl* aElement )
+ {
+ if (iRectangle.iWidth.iValue <= 0 || iRectangle.iHeight.iValue <= 0 )
+ {
+ return ETrue;
+ }
+ DrawShapeL( aGc, iRectangle, aElement );
+ return ETrue;
+ }
+
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgRectElementImpl::ConstructL( const TUint8 aElemID )
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+
+ iSvgStyleProperties = new(ELeave) RPointerArray<CCssValue>(KCSS_MAX_ATTR );
+
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+ iSvgStyleProperties->Remove( 0 );
+
+ iSvgTransformable = CSvgTransformableImpl::NewL();
+
+ iReqAttrFlag=KSVG_RECT_ELEMFLAG;
+
+ }
+
+
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+
+CSvgRectElementImpl::CSvgRectElementImpl( CSvgDocumentImpl* aDoc ) : iRectangle()
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgRectElementImpl::GetFourPointBBox(TSvgFourPointRect& aFourPointBbox)
+{
+ const TGfxAffineTransform& ctm = GetCTM();
+
+ TSvgFourPointRect lFourPointBox(iRectangle.iX, iRectangle.iY, iRectangle.iWidth, iRectangle.iHeight);
+
+ TGfxPoint2D lPoint1, lPoint2, lPoint3, lPoint4;
+
+ lFourPointBox.GetPoints(lPoint1, lPoint2, lPoint3, lPoint4);
+
+ ctm.Transform(&lPoint1, &lPoint1, 1);
+ ctm.Transform(&lPoint2, &lPoint2, 1);
+ ctm.Transform(&lPoint3, &lPoint3, 1);
+ ctm.Transform(&lPoint4, &lPoint4, 1);
+
+ aFourPointBbox.SetRectPoints(lPoint1, lPoint2, lPoint3, lPoint4);
+}
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgRectElementImpl::GetBBox( TGfxRectangle2D& aBbox )
+ {
+ iRectangle.GetBounds( GetCTM(), aBbox );
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgRectElementImpl::GetUnscaledBBox( TGfxRectangle2D& aBbox )
+ {
+ TGfxAffineTransform identityTx;
+ iRectangle.GetBounds( identityTx, aBbox );
+ }
+
+// ==========================================================================
+// perform a deep clone of this object
+// ==========================================================================
+MXmlElement* CSvgRectElementImpl::CloneL(MXmlElement* aParentElement)
+ {
+ // create new rectangle
+ CSvgRectElementImpl* newElement = CSvgRectElementImpl::NewL( this->ElemID(), ((CSvgDocumentImpl*)iOwnerDocument) );
+
+ CleanupStack::PushL(newElement);
+ newElement->iParentNode = aParentElement;
+ // copy everything over
+ this->CopyL(newElement);
+ CleanupStack::Pop();
+ return newElement;
+ }
+
+// ==========================================================================
+// perform a deep copy of this object
+// ==========================================================================
+void CSvgRectElementImpl::CopyL( CSvgRectElementImpl* aDestElement )
+ {
+ if(aDestElement)
+ {
+ // copy stuff from superclass
+ this->CSvgElementImpl::CopyL(aDestElement);
+
+ // copy iRectangle items special to circle
+ aDestElement->iRectangle.iX = this->iRectangle.iX;
+ aDestElement->iRectangle.iY = this->iRectangle.iY;
+ aDestElement->iRectangle.iHeight = this->iRectangle.iHeight;
+ aDestElement->iRectangle.iWidth = this->iRectangle.iWidth;
+ aDestElement->iRectangle.iArcHeight = this->iRectangle.iArcHeight;
+ aDestElement->iRectangle.iArcWidth = this->iRectangle.iArcWidth;
+
+ // copy the reference to idoc (CSvgDocumentImpl)
+ aDestElement->iOwnerDocument = this->iOwnerDocument;
+ }
+
+ }
+
+void CSvgRectElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<rect x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" rx=\"%d\" ry=\"%d\">", (int)iRectangle.iX, (int)iRectangle.iY, (int)iRectangle.iWidth, (int)iRectangle.iHeight, (int)iRectangle.iArcWidth, (int)iRectangle.iArcHeight);
+ #endif
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGRelToAbsPath.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include <f32file.h>
+
+#include "SVGRelToAbsPath.h"
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt TSvgRelToAbsPath::GetFullPath( TParse& aParse,
+ const TText8* upath,
+ RFs& aSession,
+ TDes* aFileName )
+ {
+ TInt r;
+ TBuf<4> drive;
+ TFileName nextBit;
+ TText8 c =* upath;
+
+ if ( c && upath[1] == KDriveDelimiter )
+ {
+ // drive name specified
+ drive.Copy( TPtrC8( upath, 2 ) );
+ drive.UpperCase();
+ upath += 2;
+ drive.Append( TChar( KPathDelimiter ) );
+ }
+ else
+ {
+ // no leading drive specifier
+ drive.Zero();
+ if ( c == KPathDelimiter || c == '/' )
+ {
+ upath += 1;
+ drive.Append( TChar( KPathDelimiter ) );
+ }
+ }
+
+ r = aSession.Parse( drive, aParse );
+
+ // upath now looks like a relative pathname, to be added onto
+ // aParse a directory at a time.
+
+ c = *upath;
+ while ( c && ( r == KErrNone ) )
+ {
+ const TText8* ustart = upath;
+ do
+ c = *upath++;
+ while ( c && c != KPathDelimiter && c != '/' );
+
+ TInt len = ( upath - ustart ) - 1; // excludes delimiter
+ if ( len == 0 )
+ continue;
+ if ( ustart[0] == '.' )
+ {
+ if ( len == 1 )
+ continue; // directory . ignored
+ if ( len == 2 && ustart[1] == '.' )
+ {
+ // directory ..
+ aParse.PopDir();
+ continue;
+ }
+ }
+ if ( len >= KMaxFileName )
+ return KErrBadName;
+ if ( c == '\0' && aFileName != NULL )
+ {
+ // it's the trailing filename
+ aFileName->Copy( TPtrC8( ustart, len ) );
+ break;
+ }
+ else
+ {
+ // it's a component of the accumulating path
+ nextBit.Copy( TPtrC8( ustart, len ) );
+ r = aParse.AddDir( nextBit );
+ }
+ }
+ return( r );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt TSvgRelToAbsPath::GetFullFile( TFileName& aName,
+ const TText8* upath,
+ RFs& aSession )
+ {
+ TParse path;
+ TInt err = GetFullPath( path, upath, aSession, & aName );
+ if ( !err )
+ {
+ err = path.SetNoWild( path.DriveAndPath(), NULL, & aName );
+ if ( !err )
+ aName = path.FullName();
+ }
+ return err;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGSchemaData.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,1662 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+
+#include "SVGSchemaData.h"
+
+//ELEMENT LITERALS
+_LIT(KPATH, "path");
+_LIT(KSTOP, "stop");
+_LIT(KLINEARGRADIENT, "linearGradient");
+_LIT(KG, "g");
+_LIT(KRECT, "rect");
+_LIT(KPOLYGON, "polygon");
+_LIT(KSVG, "svg");
+_LIT(KRADIALGRADIENT, "radialGradient");
+_LIT(KCIRCLE, "circle");
+_LIT(KLINE, "line");
+_LIT(KPOLYLINE, "polyline");
+_LIT(KELLIPSE, "ellipse");
+_LIT(KDEFS, "defs");
+_LIT(KFOREIGNOBJECT, "foreignObject");
+_LIT(KALTGLYPH, "altGlyph");
+_LIT(KALTGLYPHDEF, "altGlyphDef");
+_LIT(KDESC, "desc");
+_LIT(KSCRIPT, "script");
+_LIT(KSWITCH, "switch");
+_LIT(KMETADATA, "metadata");
+_LIT(KTITLE, "title");
+_LIT(KFONTFACENAME, "font-face-name");
+_LIT(KFONTFACESRC, "font-face-src");
+_LIT(KFONTFACEURI, "font-face-uri");
+_LIT(KGLYPHREF, "glyphRef");
+_LIT(KVKERN, "vkern");
+_LIT(KVIEW, "view");
+_LIT(KHKERN, "hkern");
+_LIT(KA, "a");
+_LIT(KFONT, "font");
+_LIT(KFONTFACE, "font-face");
+_LIT(KGLYPH, "glyph");
+_LIT(KIMAGE, "image");
+_LIT(KMISSINGGLYPH, "missing-glyph");
+_LIT(KSTYLE, "style");
+_LIT(KTEXT, "text");
+_LIT(KUSE, "use");
+_LIT(KANIMATE, "animate");
+_LIT(KANIMATECOLOR, "animateColor");
+_LIT(KANIMATEMOTION, "animateMotion");
+_LIT(KANIMATETRANSFORM, "animateTransform");
+_LIT(KSET, "set");
+_LIT(KMPATH, "mpath");
+_LIT(KTEXTAREA, "textArea");
+_LIT(KDISCARD, "discard");
+_LIT(KSOLIDCOLOR, "solidColor");
+_LIT(KANIMATION, "animation");
+_LIT(KAUDIO, "audio");
+_LIT(KNOTFOUND, "NOT FOUND");
+
+//ATTRIBUTE LITERALS
+_LIT(KFILL, "fill");
+_LIT(KSOLIDCOLORATT, "solid-color");
+_LIT(KSTROKE, "stroke");
+_LIT(KFILLOPACITY, "fill-opacity");
+_LIT(KSOLIDOPACITY, "solid-opacity");
+_LIT(KSTROKEOPACITY, "stroke-opacity");
+_LIT(KOPACITY, "opacity");
+_LIT(KSTROKEWIDTH, "stroke-width");
+_LIT(KVISIBILITY, "visibility");
+_LIT(KFONTFAMILY, "font-family");
+_LIT(KFONTSIZE, "font-size");
+_LIT(KFONTSTYLE, "font-style");
+_LIT(KFONTWEIGHT, "font-weight");
+_LIT(KSTROKEDASHARRAY, "stroke-dasharray");
+_LIT(KDISPLAY, "display");
+_LIT(KFILLRULE, "fill-rule");
+_LIT(KSTROKELINECAP, "stroke-linecap");
+_LIT(KSTROKELINEJOIN, "stroke-linejoin");
+_LIT(KSTROKEDASHOFFSET, "stroke-dashoffset");
+_LIT(KSTROKEMITERLIMIT, "stroke-miterlimit");
+_LIT(KCOLOR, "color");
+_LIT(KTEXTANCHOR, "text-anchor");
+_LIT(KTEXTDECORATION, "text-decoration");
+_LIT(KLETTERSPACING, "letter-spacing");
+_LIT(KWORDSPACING, "word-spacing");
+_LIT(KCOLORINTERPOLATION, "color-interpolation");
+_LIT(KCOLORRENDERING, "color-rendering");
+_LIT(KVOLUME, "volume");
+_LIT(KAUDIOLEVEL, "audio-level");
+
+_LIT(KPAD, "pad");
+_LIT(KREFLECT, "reflect");
+_LIT(KREPEAT, "repeat");
+
+
+_LIT(KNORMAL, "normal");
+_LIT(KITALIC, "italic");
+_LIT(KOBLIQUE, "oblique");
+_LIT(KINHERIT, "inherit");
+
+_LIT(KBOLD, "bold");
+_LIT(KBOLDER, "bolder");
+_LIT(KLIGHTER, "lighter");
+_LIT(K100, "100");
+_LIT(K200, "200");
+_LIT(K300, "300");
+_LIT(K400, "400");
+_LIT(K500, "500");
+_LIT(K600, "600");
+_LIT(K700, "700");
+_LIT(K800, "800");
+_LIT(K900, "900");
+
+_LIT(KSTART, "start");
+_LIT(KMIDDLE, "middle");
+_LIT(KEND, "end");
+_LIT(KNONE, "none");
+_LIT(KUNDERLINE, "underline");
+_LIT(KOVERLINE, "overline");
+_LIT(KLINETHROUGH, "line-through");
+
+_LIT(KD, "d");
+_LIT(KOFFSET, "offset");
+_LIT(KGRADIENTUNITS, "gradientUnits");
+_LIT(KX1, "x1");
+_LIT(KY1, "y1");
+_LIT(KX2, "x2");
+_LIT(KY2, "y2");
+_LIT(KWIDTH, "width");
+_LIT(KHEIGHT, "height");
+_LIT(KGRADIENTTRANSFORM, "gradientTransform");
+_LIT(KX, "x");
+_LIT(KY, "y");
+_LIT(KPOINTS, "points");
+_LIT(KVIEWBOX, "viewBox");
+_LIT(KRX, "rx");
+_LIT(KRY, "ry");
+_LIT(KCX, "cx");
+_LIT(KCY, "cy");
+_LIT(KR, "r");
+_LIT(KFX, "fx");
+_LIT(KFY, "fy");
+_LIT(KPATHLENGTH, "pathLength");
+_LIT(KSPREADMETHOD, "spreadMethod");
+_LIT(KSTOPCOLOR, "stop-color");
+_LIT(KSTOPOPACITY, "stop-opacity");
+_LIT(KTEXTLENGTH, "textLength");
+_LIT(KHORIZADVX, "horiz-adv-x");
+_LIT(KHORIZORIGINX, "horiz-origin-x");
+_LIT(KHORIZORIGINY, "horiz-origin-y");
+_LIT(KASCENT, "ascent");
+_LIT(KDESCENT, "descent");
+_LIT(KALPHABETIC, "alphabetic");
+_LIT(KUNDERLINEPOSITION, "underline-position");
+_LIT(KUNDERLINETHICKNESS, "underline-thickness");
+_LIT(KOVERLINEPOSITION, "overline-position");
+_LIT(KOVERLINETHICKNESS, "overline-thickness");
+_LIT(KSTRIKETHROUGHPOSITION, "strikethrough-position");
+_LIT(KSTRIKETHROUGHTHICKNESS, "strikethrough-thickness");
+_LIT(KUNITSPEREM, "units-per-em");
+_LIT(KK, "k");
+_LIT(KG1, "g1");
+_LIT(KG2, "g2");
+_LIT(KU1, "u1");
+_LIT(KU2, "u2");
+_LIT(KROTATE, "rotate");
+_LIT(KCDATA, "cdata");
+_LIT(KUNICODE, "unicode");
+_LIT(KGLYPHNAME, "glyph-name");
+_LIT(KLANG, "lang");
+_LIT(KVERSION, "version");
+_LIT(KATTRIBUTENAME, "attributeName");
+_LIT(KTYPE, "type");
+_LIT(KTRANSFORM, "transform");
+_LIT(KFROM, "from");
+_LIT(KTO, "to");
+_LIT(KBY, "by");
+_LIT(KVALUES, "values");
+_LIT(KTARGET, "target");
+_LIT(KKEYSPLINES, "keySplines");
+_LIT(KKEYTIMES, "keyTimes");
+// Runtime Sync Attributes
+_LIT( KSYNCBEHAVIORDEFAULT, "syncBehaviorDefault" );
+_LIT( KSYNCTOLERANCEDEFAULT,"syncToleranceDefault" );
+_LIT( KSYNCBEHAVIOR, "syncBehavior" );
+_LIT( KSYNCTOLERANCE, "syncTolerance" );
+_LIT( KSYNCMASTER, "syncMaster" );
+_LIT( KINITIALVISIBILITY, "initialVisibility" );
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgSchemaData::ConstructL()
+ {
+
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgSchemaData* CSvgSchemaData::NewL()
+ {
+ CSvgSchemaData* self = new ( ELeave ) CSvgSchemaData();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgSchemaData* CSvgSchemaData::NewLC()
+ {
+ CSvgSchemaData* self = new ( ELeave ) CSvgSchemaData();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgSchemaData::~CSvgSchemaData()
+ {
+
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgSchemaData::CSvgSchemaData()
+ {
+ }
+
+
+/********************* Methods to generate SchemaData Literals ******************/
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgSchemaData::GetSVGElementId(const TDesC& aElement)
+{
+ if (aElement == KPATH )
+ {
+ return KSvgPathElement;
+ }
+ if (aElement == KSTOP )
+ {
+ return KSvgStopElement;
+ }
+ if (aElement == KLINEARGRADIENT )
+ {
+ return KSvgLinearGradientElement;
+ }
+ if (aElement == KG)
+ {
+ return KSvgGElement;
+ }
+ if (aElement == KRECT )
+ {
+ return KSvgRectElement;
+ }
+ if (aElement == KPOLYGON )
+ {
+ return KSvgPolygonElement;
+ }
+ if (aElement == KSVG)
+ {
+ return KSvgSvgElement;
+ }
+ if (aElement == KRADIALGRADIENT )
+ {
+ return KSvgRadialGradientElement;
+ }
+ if (aElement == KCIRCLE )
+ {
+ return KSvgCircleElement;
+ }
+ if (aElement == KLINE )
+ {
+ return KSvgLineElement;
+ }
+ if (aElement == KPOLYLINE )
+ {
+ return KSvgPolylineElement;
+ }
+ if (aElement == KELLIPSE )
+ {
+ return KSvgEllipseElement;
+ }
+ if (aElement == KDEFS)
+ {
+ return KSvgDefsElement;
+ }
+ if (aElement == KFOREIGNOBJECT)
+ {
+ return KSvgForeignObjectElement;
+ }
+ if (aElement == KALTGLYPH)
+ {
+ return KSvgAltglyphElement;
+ }
+ if (aElement == KALTGLYPHDEF )
+ {
+ return KSvgAltglyphdefElement;
+ }
+ if (aElement == KDESC )
+ {
+ return KSvgDescElement;
+ }
+ if (aElement == KSCRIPT )
+ {
+ return KSvgScriptElement ;
+ }
+ if (aElement == KSWITCH )
+ {
+ return KSvgSwitchElement;
+ }
+ if (aElement == KMETADATA)
+ {
+ return KSvgMetadataElement;
+ }
+ if (aElement == KTITLE)
+ {
+ return KSvgTitleElement;
+ }
+ if (aElement == KFONTFACENAME)
+ {
+ return KSvgFontfacenameElement;
+ }
+ if (aElement == KFONTFACESRC)
+ {
+ return KSvgFontfacesrcElement;
+ }
+ if (aElement == KFONTFACEURI)
+ {
+ return KSvgFontfaceuriElement;
+ }
+ if (aElement == KGLYPHREF)
+ {
+ return KSvgGlyphrefElement;
+ }
+ if (aElement == KVKERN)
+ {
+ return KSvgVkernElement;
+ }
+ if (aElement == KVIEW )
+ {
+ return KSvgViewElement;
+ }
+ if (aElement == KHKERN )
+ {
+ return KSvgHkernElement;
+ }
+ if (aElement == KA )
+ {
+ return KSvgAElement;
+ }
+ if (aElement == KFONT )
+ {
+ return KSvgFontElement;
+ }
+ if (aElement == KFONTFACE )
+ {
+ return KSvgFontfaceElement;
+ }
+ if (aElement == KGLYPH )
+ {
+ return KSvgGlyphElement;
+ }
+ if (aElement == KIMAGE )
+ {
+ return KSvgImageElement;
+ }
+ if (aElement == KMISSINGGLYPH )
+ {
+ return KSvgMissingglyphElement;
+ }
+ if (aElement == KSTYLE )
+ {
+ return KSvgStyleElement;
+ }
+ if (aElement == KTEXT )
+ {
+ return KSvgTextElement;
+ }
+ if (aElement == KUSE )
+ {
+ return KSvgUseElement;
+ }
+ if (aElement == KANIMATE )
+ {
+ return KSvgAnimateElement;
+ }
+ if (aElement == KANIMATECOLOR )
+ {
+ return KSvgAnimateColorElement;
+ }
+ if (aElement == KANIMATEMOTION )
+ {
+ return KSvgAnimateMotionElement;
+ }
+ if (aElement == KANIMATETRANSFORM )
+ {
+ return KSvgAnimateTransformElement;
+ }
+ if (aElement == KSET )
+ {
+ return KSvgSetElement;
+ }
+ if (aElement == KMPATH )
+ {
+ return KSvgMpathElement;
+ }
+ if (aElement == KTEXTAREA )
+ {
+ return KSvgTextAreaElement;
+ }
+ if (aElement == KDISCARD )
+ {
+ return KSvgDiscardElement;
+ }
+ if (aElement == KSOLIDCOLOR )
+ {
+ return KSvgSolidColorElement;
+ }
+ /* if (aElement == KANIMATION )
+ {
+ return KSvgAnimationElement;
+ }
+ */
+ if (aElement == KAUDIO )
+ {
+ return KSvgAudioElement;
+ }
+//#ifdef RD_SVGT_MEDIAANIMATION_SUPPORT
+ if (aElement == KANIMATION )
+ {
+ return KSvgMediaAnimationElement;
+ }
+//#endif
+ else
+ {
+ return KErrNotFound;
+ }
+
+}
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgSchemaData::GetPresentationAttributeId(const TDesC& aElement)
+{
+ if ( (aElement == KFILL ) || (aElement == KSOLIDCOLORATT ) )
+ {
+ return KCSS_ATTR_FILL;
+ }
+ if (aElement == KSTROKE )
+ {
+ return KCSS_ATTR_STROKE;
+ }
+ if ( (aElement == KFILLOPACITY) || (aElement == KSOLIDOPACITY) )
+ {
+ return KCSS_ATTR_FILL_OPACITY;
+ }
+ if (aElement == KSTROKEOPACITY )
+ {
+ return KCSS_ATTR_STROKE_OPACITY;
+ }
+ if (aElement == KOPACITY )
+ {
+ return KCSS_ATTR_GROUP_OPACITY;
+ }
+ if (aElement == KSTROKEWIDTH )
+ {
+ return KCSS_ATTR_STROKEWIDTH;
+ }
+ if (aElement == KVISIBILITY )
+ {
+ return KCSS_ATTR_VISIBILITY;
+ }
+ if (aElement == KFONTFAMILY )
+ {
+ return KCSS_ATTR_FONTFAMILY;
+ }
+ if (aElement == KFONTSIZE )
+ {
+ return KCSS_ATTR_FONTSIZE;
+ }
+ if (aElement == KFONTSTYLE )
+ {
+ return KCSS_ATTR_FONTSTYLE;
+ }
+ if (aElement == KFONTWEIGHT )
+ {
+ return KCSS_ATTR_FONTWEIGHT;
+ }
+ if (aElement == KSTROKEDASHARRAY )
+ {
+ return KCSS_ATTR_STROKE_DASHARRAY;
+ }
+ if (aElement == KDISPLAY )
+ {
+ return KCSS_ATTR_DISPLAY;
+ }
+ if (aElement == KFILLRULE )
+ {
+ return KCSS_ATTR_FILLRULE;
+ }
+ if (aElement == KSTROKELINECAP )
+ {
+ return KCSS_ATTR_STROKE_LINECAP;
+ }
+ if (aElement == KSTROKELINEJOIN )
+ {
+ return KCSS_ATTR_STROKE_LINEJOIN;
+ }
+ if (aElement == KSTROKEDASHOFFSET )
+ {
+ return KCSS_ATTR_STROKE_DASHOFFSET;
+ }
+ if (aElement == KSTROKEMITERLIMIT )
+ {
+ return KCSS_ATTR_STROKE_MITERLIMIT;
+ }
+ if (aElement == KCOLOR )
+ {
+ return KCSS_ATTR_COLOR;
+ }
+ if (aElement == KTEXTANCHOR )
+ {
+ return KCSS_ATTR_TEXTANCHOR;
+ }
+ if (aElement == KTEXTDECORATION )
+ {
+ return KCSS_ATTR_TEXTDECORATION;
+ }
+ if (aElement == KLETTERSPACING )
+ {
+ return KCSS_ATTR_LETTERSPACING;
+ }
+ if (aElement == KWORDSPACING )
+ {
+ return KCSS_ATTR_WORDSPACING;
+ }
+ if (aElement == KCOLORINTERPOLATION )
+ {
+ return KCSS_ATTR_COLORINTERPOLATION;
+ }
+ if (aElement == KCOLORRENDERING )
+ {
+ return KCSS_ATTR_COLORRENDERING;
+ }
+ else
+ {
+ return KErrNotFound;
+ }
+
+}
+
+TInt CSvgSchemaData::FindSpreadMethod(const TDesC& aElement)
+{
+ if(aElement == KPAD )
+ {
+ return 0;
+ }
+ if(aElement == KREFLECT )
+ {
+ return 1;
+ }
+ if(aElement == KREPEAT )
+ {
+ return 2;
+ }
+ else
+ {
+ return KErrNotFound;
+ }
+}
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgSchemaData::FindFontStyle(const TDesC& aElement)
+{
+ if(aElement == KNORMAL )
+ {
+ return 0;
+ }
+ if(aElement == KITALIC )
+ {
+ return 1;
+ }
+ if(aElement == KOBLIQUE )
+ {
+ return 2;
+ }
+ if(aElement == KINHERIT )
+ {
+ return 3;
+ }
+ else
+ {
+ return KErrNotFound;
+ }
+}
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgSchemaData::FindFontWeightEnum(const TDesC& aElement)
+{
+ if(aElement == KNORMAL )
+ {
+ return 0;
+ }
+ if (aElement == KBOLD )
+ {
+ return 1;
+ }
+ if (aElement == KBOLDER )
+ {
+ return 2;
+ }
+ if (aElement == KLIGHTER )
+ {
+ return 3;
+ }
+ if (aElement == K100 )
+ {
+ return 4;
+ }
+ if (aElement == K200 )
+ {
+ return 5;
+ }
+ if (aElement == K300 )
+ {
+ return 6;
+ }
+ if (aElement == K400 )
+ {
+ return 7;
+ }
+ if (aElement == K500 )
+ {
+ return 8;
+ }
+ if (aElement == K600 )
+ {
+ return 9;
+ }
+ if (aElement == K700 )
+ {
+ return 10;
+ }
+ if (aElement == K800 )
+ {
+ return 11;
+ }
+ if (aElement == K900 )
+ {
+ return 12;
+ }
+ if (aElement == KINHERIT )
+ {
+ return 13;
+ }
+ else
+ {
+ return KErrNotFound;
+ }
+}
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgSchemaData::FindTextAnchorEnum(const TDesC& aElement)
+{
+ if(aElement == KSTART )
+ {
+ return 0;
+ }
+ if (aElement == KMIDDLE )
+ {
+ return 1;
+ }
+ if (aElement == KEND )
+ {
+ return 2;
+ }
+ else
+ {
+ return -1;
+ }
+
+}
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgSchemaData::FindTextDecorationEnum(const TDesC& aElement)
+{
+ if (aElement == KNONE )
+ {
+ return 0;
+ }
+ if (aElement == KUNDERLINE )
+ {
+ return 1;
+ }
+ if (aElement == KOVERLINE )
+ {
+ return 2;
+ }
+ if (aElement == KLINETHROUGH )
+ {
+ return 3;
+ }
+
+ //Inherit & Blink is not supported currently
+ else
+ {
+ return -1;
+ }
+
+}
+
+TUint16 CSvgSchemaData::GetSVGTAttributeId(const TDesC& aAttrName)
+{
+ if( aAttrName == KD )
+ {
+ return KAtrD;
+ }
+ if(aAttrName == KOFFSET )
+ {
+ return KAtrOffset;
+ }
+ if( aAttrName == KSTYLE )
+ {
+ return KAtrStyle;
+ }
+ if(aAttrName == KGRADIENTUNITS )
+ {
+ return KAtrGradientUnits;
+ }
+ if( aAttrName == KX1 )
+ {
+ return KAtrX1;
+ }
+ if( aAttrName == KY1 )
+ {
+ return KAtrY1;
+ }
+ if( aAttrName == KX2 )
+ {
+ return KAtrX2;
+ }
+ if( aAttrName == KY2 )
+ {
+ return KAtrY2;
+ }
+ if( aAttrName == KWIDTH )
+ {
+ return KAtrWidth;
+ }
+ if( aAttrName == KHEIGHT )
+ {
+ return KAtrHeight;
+ }
+ if( aAttrName == KGRADIENTTRANSFORM )
+ {
+ return KAtrGradientTransform;
+ }
+ if( aAttrName == KX )
+ {
+ return KAtrX;
+ }
+ if( aAttrName == KY )
+ {
+ return KAtrY;
+ }
+ if( aAttrName == KPOINTS )
+ {
+ return KAtrPoints;
+ }
+ if (aAttrName == KVIEWBOX )
+ {
+ return KAtrViewBox;
+ }
+ if( aAttrName == KRX )
+ {
+ return KAtrRx;
+ }
+ if( aAttrName == KRY )
+ {
+ return KAtrRy;
+ }
+ if( aAttrName == KCX )
+ {
+ return KAtrCx;
+ }
+ if( aAttrName == KCY )
+ {
+ return KAtrCy;
+ }
+ if( aAttrName == KR )
+ {
+ return KAtrR;
+ }
+ if(aAttrName == KFX )
+ {
+ return KAtrFx;
+ }
+ if(aAttrName == KFY )
+ {
+ return KAtrFy;
+ }
+ if( aAttrName == KPATHLENGTH )
+ {
+ return KAtrPathLength;
+ }
+ if( aAttrName == KSTROKEWIDTH )
+ {
+ return KAtrStrokeWidth;
+ }
+ if(aAttrName == KSPREADMETHOD )
+ {
+ return KAtrSpreadMethods;
+ }
+ if(aAttrName == KSTOPCOLOR )
+ {
+ return KAtrStopColor;
+ }
+ if(aAttrName == KSTOPOPACITY )
+ {
+ return KAtrStopOpacity;
+ }
+ if( aAttrName == KTEXTLENGTH )
+ {
+ return KAtrTextLength;
+ }
+ if( aAttrName == KHORIZADVX )
+ {
+ return KAtrHorizAdvX;
+ }
+ if( aAttrName == KHORIZORIGINX )
+ {
+ return KAtrHorizOriginX;
+ }
+ if( aAttrName == KHORIZORIGINY )
+ {
+ return KAtrHorizOriginY;
+ }
+ if( aAttrName == KASCENT )
+ {
+ return KAtrAscent;
+ }
+ if( aAttrName == KDESCENT )
+ {
+ return KAtrDescent;
+ }
+ if( aAttrName == KALPHABETIC )
+ {
+ return KAtrAlphabetic;
+ }
+ if( aAttrName == KUNDERLINEPOSITION )
+ {
+ return KAtrUnderlinePosition;
+ }
+ if( aAttrName == KUNDERLINETHICKNESS )
+ {
+ return KAtrUnderlineThickness;
+ }
+ if( aAttrName == KOVERLINEPOSITION )
+ {
+ return KAtrOverlinePosition;
+ }
+ if( aAttrName == KOVERLINETHICKNESS )
+ {
+ return KAtrOverlineThickness;
+ }
+ if( aAttrName == KSTRIKETHROUGHPOSITION )
+ {
+ return KAtrStrikethroughPosition;
+ }
+ if( aAttrName == KSTRIKETHROUGHTHICKNESS )
+ {
+ return KAtrStrikethroughThickness;
+ }
+ if( aAttrName == KUNITSPEREM )
+ {
+ return KAtrUnitsPerEm;
+ }
+ if( aAttrName == KWORDSPACING )
+ {
+ return KAtrWordSpacing;
+ }
+ if( aAttrName == KLETTERSPACING )
+ {
+ return KAtrLetterSpacing;
+ }
+ if( aAttrName == KK )
+ {
+ return KAtrK;
+ }
+ if( aAttrName == KG1 )
+ {
+ return KAtrG1;
+ }
+ if( aAttrName == KG2 )
+ {
+ return KAtrG2;
+ }
+ if( aAttrName == KU1 )
+ {
+ return KAtrU1;
+ }
+ if( aAttrName == KU2 )
+ {
+ return KAtrU2;
+ }
+ if( aAttrName == KTEXTDECORATION )
+ {
+ return KAtrTextDecoration;
+ }
+ if( aAttrName == KROTATE )
+ {
+ return KAtrRotate;
+ }
+ if( aAttrName == KCDATA )
+ {
+ return KAtrCdata;
+ }
+ if( aAttrName == KUNICODE )
+ {
+ return KAtrUnicode;
+ }
+ if( aAttrName == KGLYPHNAME )
+ {
+ return KAtrGlyphName;
+ }
+ if( aAttrName == KLANG )
+ {
+ return KAtrLang;
+ }
+ if( aAttrName == KVERSION )
+ {
+ return KAtrVersion;
+ }
+ if( aAttrName == KATTRIBUTENAME )
+ {
+ return KAtrAttributeName;
+ }
+ if( aAttrName == KTYPE )
+ {
+ return KAtrType;
+ }
+ if( aAttrName == KTRANSFORM )
+ {
+ return KAtrTransform;
+ }
+ if( aAttrName == KFROM )
+ {
+ return KAtrFrom;
+ }
+ if( aAttrName == KTO )
+ {
+ return KAtrTo;
+ }
+ if( aAttrName == KBY )
+ {
+ return KAtrBy;
+ }
+ if (aAttrName == KVALUES )
+ {
+ return KAtrValues;
+ }
+ if (aAttrName == KKEYSPLINES)
+ {
+ return KAtrKeySplines;
+ }
+ if (aAttrName == KKEYTIMES)
+ {
+ return KAtrKeyTimes;
+ }
+ if (aAttrName == KTARGET )
+ {
+ return KAtrTarget;
+ }
+ if (aAttrName == KSOLIDOPACITY )
+ {
+ return KAtrSolidOpacity;
+ }
+ if ( aAttrName == KSYNCBEHAVIORDEFAULT )
+ {
+ return KAtrSyncBehaviorDefault;
+ }
+ if ( aAttrName == KSYNCTOLERANCEDEFAULT )
+ {
+ return KAtrSyncToleranceDefault;
+ }
+ if ( aAttrName == KSYNCBEHAVIOR )
+ {
+ return KAtrSyncBehavior;
+ }
+ if ( aAttrName == KSYNCTOLERANCE )
+ {
+ return KAtrSyncTolerance;
+ }
+ if ( aAttrName == KSYNCMASTER )
+ {
+ return KAtrSyncMaster;
+ }
+ if ( aAttrName == KINITIALVISIBILITY )
+ {
+ return KAtrInitialVisibility;
+ }
+ if ( aAttrName == KVOLUME )
+ {
+ return KAtrVolume;
+ }
+ if ( aAttrName == KAUDIOLEVEL )
+ {
+ return KAtrAudioLevel;
+ }
+ else
+ {
+ return (TUint16)KErrNotFound;
+ }
+}
+
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+void CSvgSchemaData::GetSVGElementName(const TUint8 aElement, TDes& aElemName)
+{
+ if (aElement == KSvgPathElement )
+ {
+ aElemName.Copy( KPATH );
+ return ;
+
+ }
+ if (aElement == KSvgStopElement )
+ {
+ aElemName.Copy( KSTOP );
+ return ;
+
+ }
+ if (aElement == KSvgLinearGradientElement )
+ {
+ aElemName.Copy( KLINEARGRADIENT );
+ return ;
+
+ }
+ if (aElement == KSvgGElement)
+ {
+ aElemName.Copy( KG );
+ return ;
+
+ }
+ if (aElement == KSvgRectElement )
+ {
+ aElemName.Copy( KRECT );
+ return ;
+
+ }
+ if (aElement == KSvgPolygonElement)
+ {
+ aElemName.Copy( KPOLYGON );
+ return ;
+
+ }
+ if (aElement == KSvgSvgElement)
+ {
+ aElemName.Copy( KSVG );
+ return ;
+ }
+ if (aElement == KSvgRadialGradientElement )
+ {
+ aElemName.Copy( KRADIALGRADIENT );
+ return ;
+
+ }
+ if (aElement == KSvgCircleElement )
+ {
+ aElemName.Copy( KCIRCLE );
+ return ;
+
+ }
+ if (aElement == KSvgLineElement )
+ {
+ aElemName.Copy( KLINE );
+ return ;
+
+ }
+ if (aElement == KSvgPolylineElement )
+ {
+ aElemName.Copy( KPOLYLINE );
+ return ;
+
+ }
+ if (aElement == KSvgEllipseElement )
+ {
+ aElemName.Copy( KELLIPSE );
+ return ;
+
+ }
+ if (aElement == KSvgDefsElement)
+ {
+ aElemName.Copy( KDEFS );
+ return ;
+
+ }
+ if (aElement == KSvgForeignObjectElement)
+ {
+ aElemName.Copy( KFOREIGNOBJECT );
+ return ;
+
+ }
+ if (aElement == KSvgScriptElement)
+ {
+ aElemName.Copy( KSCRIPT );
+ return ;
+
+ }
+ if (aElement == KSvgSwitchElement )
+ {
+ aElemName.Copy( KSWITCH );
+ return ;
+
+ }
+ if (aElement == KSvgDescElement)
+ {
+ aElemName.Copy( KDESC );
+ return ;
+
+ }
+ if (aElement == KSvgAltglyphElement)
+ {
+ aElemName.Copy( KALTGLYPH );
+ return ;
+
+ }
+ if (aElement == KSvgAltglyphdefElement)
+ {
+ aElemName.Copy( KALTGLYPHDEF );
+ return ;
+
+ }
+ if (aElement == KSvgMetadataElement)
+ {
+ aElemName.Copy( KMETADATA );
+ return ;
+
+ }
+ if (aElement == KSvgTitleElement)
+ {
+ aElemName.Copy( KTITLE );
+ return ;
+
+ }
+ if (aElement == KSvgFontfacenameElement)
+ {
+ aElemName.Copy( KFONTFACENAME );
+ return ;
+
+ }
+ if (aElement == KSvgFontfacesrcElement)
+ {
+ aElemName.Copy( KFONTFACESRC );
+ return ;
+ }
+ if (aElement == KSvgFontfaceuriElement)
+ {
+ aElemName.Copy( KFONTFACEURI );
+ return ;
+
+ }
+ if (aElement == KSvgGlyphrefElement)
+ {
+ aElemName.Copy( KGLYPHREF );
+ return ;
+
+ }
+ if (aElement == KSvgVkernElement)
+ {
+ aElemName.Copy( KVKERN );
+ return ;
+
+ }
+ if (aElement == KSvgViewElement)
+ {
+ aElemName.Copy( KVIEW );
+ return ;
+
+ }
+ if (aElement == KSvgHkernElement )
+ {
+ aElemName.Copy( KHKERN );
+ return ;
+
+ }
+ if (aElement == KSvgAElement )
+ {
+ aElemName.Copy( KA );
+ return ;
+
+ }
+ if (aElement == KSvgFontElement)
+ {
+ aElemName.Copy( KFONT );
+ return ;
+
+ }
+ if (aElement == KSvgFontfaceElement)
+ {
+ aElemName.Copy( KFONTFACE );
+ return ;
+
+ }
+ if (aElement == KSvgGlyphElement)
+ {
+ aElemName.Copy( KGLYPH );
+ return ;
+
+ }
+ if (aElement == KSvgImageElement )
+ {
+ aElemName.Copy( KIMAGE );
+ return ;
+
+ }
+ if (aElement == KSvgMissingglyphElement )
+ {
+ aElemName.Copy( KMISSINGGLYPH );
+ return ;
+
+ }
+ if (aElement == KSvgStyleElement)
+ {
+ aElemName.Copy( KSTYLE );
+ return ;
+
+ }
+ if (aElement == KSvgTextElement)
+ {
+ aElemName.Copy( KTEXT );
+ return ;
+
+ }
+ if (aElement == KSvgUseElement)
+ {
+ aElemName.Copy( KUSE );
+ return ;
+
+ }
+ if (aElement == KSvgAnimateElement )
+ {
+ aElemName.Copy( KANIMATE );
+ return ;
+
+ }
+ if (aElement == KSvgAnimateColorElement )
+ {
+ aElemName.Copy( KANIMATECOLOR );
+ return ;
+
+ }
+ if (aElement == KSvgAnimateMotionElement )
+ {
+ aElemName.Copy( KANIMATEMOTION );
+ return ;
+
+ }
+ if (aElement == KSvgAnimateTransformElement )
+ {
+ aElemName.Copy( KANIMATETRANSFORM );
+ return ;
+
+ }
+ if (aElement == KSvgSetElement )
+ {
+ aElemName.Copy( KSET );
+ return ;
+
+ }
+ if (aElement == KSvgMpathElement )
+ {
+ aElemName.Copy( KMPATH );
+ return ;
+
+ }
+ if (aElement == KSvgTextAreaElement )
+ {
+ aElemName.Copy( KTEXTAREA );
+ return ;
+
+ }
+ if (aElement == KSvgDiscardElement )
+ {
+ aElemName.Copy( KDISCARD );
+ return ;
+ }
+/* if (aElement == KSvgAnimationElement )
+ {
+ aElemName.Copy( KANIMATION );
+ return ;
+ }*/
+ if (aElement == KSvgSolidColorElement )
+ {
+ aElemName.Copy( KSOLIDCOLOR );
+ return ;
+ }
+ if (aElement == KSvgAudioElement )
+ {
+ aElemName.Copy( KAUDIO );
+ return ;
+ }
+ else
+ {
+ aElemName.Copy( KNOTFOUND );
+ return ;
+
+ }
+}
+
+TAttributeType CSvgSchemaData::GetAttributeType(const TDesC& aAttrName)
+ {
+ if(aAttrName == KFILL )
+ {
+ return EString;
+ }
+ if( aAttrName == KD )
+ {
+ return EString;
+ }
+ if(aAttrName == KOFFSET )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KSTYLE )
+ {
+ return EUndefinedType;
+ }
+ if(aAttrName == KGRADIENTUNITS )
+ {
+ return EUndefinedType;
+ }
+ if( aAttrName == KX1 )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KY1 )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KX2 )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KY2 )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KWIDTH )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KHEIGHT )
+ {
+ return EFloat;
+ }
+ if(aAttrName == KFILLOPACITY )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KGRADIENTTRANSFORM )
+ {
+ return EString;
+ }
+ if( aAttrName == KX )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KY )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KPOINTS )
+ {
+ return EString;
+ }
+ if (aAttrName == KVIEWBOX )
+ {
+ return EString;
+ }
+ if( aAttrName == KRX )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KRY )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KCX )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KCY )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KR )
+ {
+ return EFloat;
+ }
+ if(aAttrName == KFX )
+ {
+ return EFloat;
+ }
+ if(aAttrName == KFY )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KPATHLENGTH )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KSTROKEWIDTH )
+ {
+ return EFloat;
+ }
+ if(aAttrName == KSTROKE )
+ {
+ return EInteger;
+ }
+ if(aAttrName == KSPREADMETHOD )
+ {
+ return EUndefinedType;
+ }
+ if(aAttrName == KSTOPCOLOR )
+ {
+ return EUndefinedType;
+ }
+ if(aAttrName == KSTOPOPACITY )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KTEXTLENGTH )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KHORIZADVX )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KHORIZORIGINX )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KHORIZORIGINY )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KASCENT )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KDESCENT )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KALPHABETIC )
+ {
+ return EUndefinedType;
+ }
+ if( aAttrName == KUNDERLINEPOSITION )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KUNDERLINETHICKNESS )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KOVERLINEPOSITION )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KOVERLINETHICKNESS )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KSTRIKETHROUGHPOSITION )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KSTRIKETHROUGHTHICKNESS )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KUNITSPEREM )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KWORDSPACING )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KLETTERSPACING )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KK )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KG1 )
+ {
+ return EString;
+ }
+ if( aAttrName == KG2 )
+ {
+ return EString;
+ }
+ if( aAttrName == KU1 )
+ {
+ return EString;
+ }
+ if( aAttrName == KU2 )
+ {
+ return EString;
+ }
+ if( aAttrName == KTEXTDECORATION )
+ {
+ return EUndefinedType;
+ }
+ if( aAttrName == KROTATE )
+ {
+ return EUndefinedType;
+ }
+ if( aAttrName == KCDATA )
+ {
+ return EString;
+ }
+ if( aAttrName == KUNICODE )
+ {
+ return EString;
+ }
+ if( aAttrName == KGLYPHNAME )
+ {
+ return EString;
+ }
+ if( aAttrName == KLANG )
+ {
+ return EString;
+ }
+ if( aAttrName == KVERSION )
+ {
+ return EString;
+ }
+ if( aAttrName == KATTRIBUTENAME )
+ {
+ return EString;
+ }
+ if( aAttrName == KTYPE )
+ {
+ return EUndefinedType;
+ }
+ if( aAttrName == KTRANSFORM )
+ {
+ return EString;
+ }
+ if( aAttrName == KFROM )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KTO )
+ {
+ return EFloat;
+ }
+ if( aAttrName == KBY )
+ {
+ return EUndefinedType;
+ }
+ if (aAttrName == KVALUES )
+ {
+ return EString;
+ }
+ if (aAttrName == KSTROKEDASHARRAY )
+ {
+ return EString;
+ }
+ if (aAttrName == KSTROKEDASHOFFSET )
+ {
+ return EFloat;
+ }
+ if (aAttrName == KTARGET )
+ {
+ return EString;
+ }
+ if(aAttrName == KSOLIDOPACITY )
+ {
+ return EFloat;
+ }
+ if ( aAttrName == KSYNCBEHAVIORDEFAULT )
+ {
+ return EString;
+ }
+ if ( aAttrName == KSYNCTOLERANCEDEFAULT )
+ {
+ return EString;
+ }
+ if ( aAttrName == KSYNCBEHAVIOR )
+ {
+ return EString;
+ }
+ if ( aAttrName == KSYNCTOLERANCE )
+ {
+ return EString;
+ }
+ if ( aAttrName == KSYNCMASTER )
+ {
+ return EInteger;
+ }
+ if ( aAttrName == KINITIALVISIBILITY )
+ {
+ return EString;
+ }
+ else
+ {
+ return EUndefinedType;
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGScriptElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,137 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include "SVGScriptElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGEngineImpl.h"
+
+// ---------------------------------------------------------------------------
+// Two phase construction
+// ---------------------------------------------------------------------------
+CSvgScriptElementImpl* CSvgScriptElementImpl::NewL( TUint8 aElementId, CSvgDocumentImpl* aDocument )
+ {
+ CSvgScriptElementImpl* self = new ( ELeave ) CSvgScriptElementImpl( aDocument );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElementId );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgScriptElementImpl::~CSvgScriptElementImpl()
+ {
+ delete iScript;
+ delete iXLink;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const HBufC8* CSvgScriptElementImpl::GetScript()
+ {
+ return iScript;
+ }
+
+// ---------------------------------------------------------------------------
+// Script has "type" and "xlink:href" attributes
+// ---------------------------------------------------------------------------
+TInt CSvgScriptElementImpl::SetAttributeL( const TDesC& aName, const TDesC& aValue )
+{
+ _LIT( KXlink, "xlink:href" );
+ _LIT( KType, "type" );
+ if ( aName == KXlink )
+ {
+ delete iXLink;
+ iXLink = NULL;
+ iXLink = aValue.Alloc();
+ FetchExternalScriptL();
+ }
+ else if ( aName == KType )
+ {
+ // ignore
+ }
+
+ return KErrNone;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgScriptElementImpl::SetScriptL( const TDesC& aScriptString )
+ {
+ // Already have script from xlink:href
+ if ( iXLink != NULL && iScript != NULL )
+ {
+ return;
+ }
+
+ delete iScript;
+ iScript = NULL;
+ iScript = HBufC8::NewL( aScriptString.Length() );
+ iScript->Des().Copy( aScriptString );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgScriptElementImpl::CSvgScriptElementImpl( CSvgDocumentImpl* aDocument )
+ {
+ iScript = NULL;
+ iDocument = aDocument;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgScriptElementImpl::ConstructL( TUint8 aElementId )
+ {
+ CSvgElementImpl::InitializeL( aElementId );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgScriptElementImpl::FetchExternalScriptL()
+ {
+
+ // Presently SVGT Engine is not supporting expernal script.
+ // This requires script engine which has capability to change DOM.
+ /*
+ if ( iXLink != NULL && iDocument != NULL && iDocument->Engine() != NULL )
+ {
+ iScript = iDocument->Engine()->FetchExternalDataL( *iXLink );
+ }
+ */
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgScriptElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<script xlink:href=\"hmm\">"/*, iXLink*/);
+ RDebug::Printf("hmm"/*, iScript*/);
+ RDebug::Printf("</script",this);
+ #endif
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGSetElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,351 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "SVGSetElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgSetElementImpl* CSvgSetElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgSetElementImpl* self = new ( ELeave ) CSvgSetElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgSetElementImpl* CSvgSetElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgSetElementImpl* self = new ( ELeave ) CSvgSetElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgSetElementImpl::ConstructL( const TUint8 aElemID)
+ {
+ CSvgAnimationBase::ConstructL( aElemID );
+ iReqAttrFlag=KSVG_ANIMATE_ELEMFLAG;
+ iIsInheritedAttribute = EFalse;
+ }
+
+
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgSetElementImpl::~CSvgSetElementImpl()
+ {
+ }
+
+// *******************************************************
+// Private
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgSetElementImpl::CSvgSetElementImpl( CSvgDocumentImpl* aDoc ) : CSvgAnimationBase( aDoc )
+
+ {
+ }
+
+// *******************************************************
+// From MSvgEventReceiver
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgSetElementImpl::ResetReferenceElementL()
+ {
+ if(iTargetElement != NULL )
+ {
+ if( ((iTargetElement->iAnimateAttrSet == NULL) || (iTargetElement->iAnimateAttrSet->Find(iAttrId) == KErrNotFound) ) )
+ {
+ if (iInitDone && iAnimStatus != KAnimNotActive)
+ {
+ iCheckFirstAnim= ETrue;
+ SetToOriginalL();
+ if( !(iTargetElement->iAnimateAttrSet) )
+ {
+ iTargetElement->iAnimateAttrSet = new (ELeave) RArray<TUint32>(1);
+ }
+ iTargetElement->iAnimateAttrSet->Append((TUint32)(iAttrId));
+ }
+ }
+ }
+ }
+
+// *******************************************************
+// From MSvgEventReceiver
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgSetElementImpl::ReceiveEventL( MSvgEvent* aEvent )
+ {
+ return CSvgAnimationBase::ReceiveEventProcL( aEvent, this );
+ }
+
+// From CSvgAnimationBase
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgSetElementImpl::AnimProcL( MSvgTimerEvent* /* aEvent */)
+
+ {
+
+ if((iAnimStatus != KAnimActive) || iDoFreeze)
+ {
+ if(iFill== KAnimFillFreeze && !iDoFreeze && iAnimStatus == KAnimFinished)
+ {
+ }
+ else
+ {
+ CSvgAnimationBase::CheckForEndTimesAndFreezeL(this );
+ return EFalse;
+ }
+ }
+ // Set value
+ switch ( iDataType )
+ {
+ case KSvgTypeOpacity:
+ case KSvgTypeLength:
+ iEndFloat = iToFloat;
+ iTargetElement->SetAttributeFloatL( iAttrId, iToFloat );
+ break;
+ case KSvgTypeList:
+ case KSvgTypePath:
+ case KSvgTypeTransform:
+ break;
+ case KSvgTypeColor:
+ iEndInt = iToInt;
+ iTargetElement->SetAttributeIntL( iAttrId, iToInt );
+ break;
+ case KSvgTypeTextAnchor:
+ case KSvgTypeInteger:
+ iEndInt = iToInt;
+ iTargetElement->SetAttributeIntL( iAttrId, iToInt );
+ case KSvgTypeVisibility:
+ iEndInt = iToInt;
+ iTargetElement->SetAttributeIntL( iAttrId, iToInt );
+ case KSvgTypeDisplay:
+ iEndInt = iToInt;
+ iTargetElement->SetAttributeIntL( iAttrId, iToInt );
+ break;
+
+ //viewBox
+ case KSvgTypeViewBox:
+ {
+ if(iTargetElement->ElemID() == KSvgSvgElement)
+ {
+ iEndViewBox= iToViewBox;
+ ((CSvgSvgElementImpl*)iTargetElement)->SetViewBoxL( iToViewBox );
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ CSvgAnimationBase::CheckForEndTimesAndFreezeL(this );
+ return ETrue; //.
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgSetElementImpl::ResetAnimationL()
+ {
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgSetElementImpl::SetAttributeIntL( const TInt aNameId, const TInt32 aValue)
+{
+ return CSvgAnimationBase::SetAttributeIntL(aNameId,aValue);
+}
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgSetElementImpl::GetAttributeIntL( const TInt aNameId, TInt32& aValue )
+{
+ return CSvgAnimationBase::GetAttributeIntL(aNameId,aValue);
+}
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgSetElementImpl::SetAttributeFloatL(const TInt aNameId, TFloatFixPt aValue )
+{
+ return CSvgAnimationBase::SetAttributeFloatL(aNameId,aValue);
+}
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgSetElementImpl::GetAttributeFloat(const TInt aNameId, TFloatFixPt& aValue )
+{
+ return CSvgAnimationBase::GetAttributeFloat(aNameId,aValue);
+}
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgSetElementImpl::ReInitializeAnimation()
+ {
+
+/* if( iCurrentRepeatCount > 1 && iAccumulate == KAccumSum )
+ {*/
+
+ if ( iAttrId == 0xffff )
+ return;
+
+ CSvgAnimationBase::ReInitializeAnimation();
+
+ if(iCheckFirstAnim)
+ {
+ if(iIsInheritedAttribute)
+ {
+ iTargetElement->PointToParent(iAttrId);
+ }
+ else
+ {
+ TRAPD(error, SetToOriginalL());
+ if (error != KErrNone)
+ {
+ //non error condition needs to be handled
+ }
+ }
+
+ }
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CGfxGeneralPath* CSvgSetElementImpl::GetPathAttribute(TInt aAttributeId)
+ {
+ return CSvgAnimationBase::GetPathAttribute(aAttributeId);
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgSetElementImpl::SetPathAttribute(TInt aAttributeId, CGfxGeneralPath* aPathHandle)
+ {
+ CSvgAnimationBase::SetPathAttribute( aAttributeId, aPathHandle);
+ }
+
+
+
+
+void CSvgSetElementImpl::Reset(MSvgEvent* aEvent)
+ {
+ iIsUserSeek = ETrue;
+ // first call the animation base function.
+ TSvgTimerEvent* timerEvent = ( TSvgTimerEvent* ) aEvent;
+
+ if((TInt32)timerEvent->Time() < iAbsoluteBeginTime)
+ {
+ // let it come to initial position.
+ ((CSvgDocumentImpl*)iOwnerDocument)->iInitialDrawFlag = ETrue;
+ ReInitializeAnimation();
+ return;
+ }
+
+ TRAPD(error,CSvgAnimationBase::ResetL( aEvent, this));
+
+ if (error != KErrNone)
+ {
+ // Error Processing
+ }
+
+ }
+void CSvgSetElementImpl::DeactivateAnimation()
+ {
+CSvgAnimationBase::DeactivateAnimation(this);
+ }
+TBool CSvgSetElementImpl::DoAnimProcL(MSvgEvent* aEvent)
+ {
+return this->AnimProcL((MSvgTimerEvent*)aEvent);
+ }
+void CSvgSetElementImpl::InitAnimationL()
+ {
+ if(!iTargetElement)
+ {
+ // if target element is not found then remove it.
+ ((CSvgDocumentImpl*)iOwnerDocument)->RemoveFromEventReceiverList(this);
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->UpdatePresentation(1);
+ return;
+ }
+
+ if (!iHaveValues)
+ {
+ if (!iHaveTo && !iHaveBy)
+ {
+ ((CSvgDocumentImpl*)iOwnerDocument)->RemoveFromEventReceiverList(this );
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->UpdatePresentation(1);
+ }
+ }
+
+ iIsInheritedAttribute = iTargetElement->IsInherited(iAttrId);
+
+ // this is to make sure that this is taken only once.
+
+ CSvgAnimationBase::InitAnimationL();
+ SetFillValueL();
+ }
+
+void CSvgSetElementImpl::SetToOriginalL()
+ {
+ // this is to make sure the inherited style attributes are made point back to the parent.
+ if(iIsInheritedAttribute && iAnimStatus == KAnimFinished)
+ {
+ // only if the animation has finished
+ iTargetElement->PointToParent(iAttrId);
+ }
+ else
+ {
+ // set this to original values.
+ CSvgAnimationBase::SetToOriginalL();
+ }
+ }
+
+void CSvgSetElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<set to=\"hmm\"\\>",this);
+ #endif
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGSolidColorElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,258 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+// INCLUDE FILES
+#include "SVGSolidColorElementImpl.h"
+#include "SVGFloatCssValueImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+
+_LIT(SOLIDOPACITY, "solid-opacity");
+_LIT(INHERIT, "inherit");
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+CSvgSolidColorElementImpl* CSvgSolidColorElementImpl::NewL(const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgSolidColorElementImpl *self = new (ELeave) CSvgSolidColorElementImpl(aDoc);
+ CleanupStack::PushL(self);
+ self->ConstructL(aElemID);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+CSvgSolidColorElementImpl* CSvgSolidColorElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgSolidColorElementImpl* self = new ( ELeave )
+ CSvgSolidColorElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Symbian default constructor that can leave.
+// ---------------------------------------------------------------------------
+void CSvgSolidColorElementImpl::ConstructL(const TUint8 aElemID)
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+
+ iSvgStyleProperties = new(ELeave) RPointerArray<CCssValue>(KCSS_MAX_ATTR);
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+ iSvgStyleProperties->Remove( 0 );
+
+ iSvgUriReferenceImpl = CSvgUriReferenceImpl::NewL();
+ iSvgTransformable = CSvgTransformableImpl::NewL();
+
+ }
+// ---------------------------------------------------------------------------
+// C++ default constructor
+// ---------------------------------------------------------------------------
+
+CSvgSolidColorElementImpl::CSvgSolidColorElementImpl( CSvgDocumentImpl* aDoc )
+ {
+ SetOwnerDocument(aDoc);
+
+ iSolidOpacity = TFloatFixPt(1);
+
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+CSvgSolidColorElementImpl::~CSvgSolidColorElementImpl()
+ {
+
+ if ( iSvgStyleProperties )
+ {
+ iSvgStyleProperties->Close();
+ delete iSvgStyleProperties;
+ iSvgStyleProperties = NULL;
+ }
+
+ if ( iSvgUriReferenceImpl )
+ {
+ delete iSvgUriReferenceImpl;
+ iSvgUriReferenceImpl = NULL;
+ }
+
+ }
+
+// ============================ MEMBER FUNCTIONS ========================================
+
+// -----------------------------------------------------------------------------
+// SetAttributeL: The implemented function will be called from CSvgContentHandler.
+// SetAttributeFloatL: The implemented function will be called from CSvgContentHandler.
+//
+// From CSvgElementImpl
+//
+// There will be two attributes been set: solid-color and solid-opacity.
+// These attributes are redundant and are same as fill and fill-opacity
+//
+// Returns: ETrue always in this case.
+// -----------------------------------------------------------------------------
+//
+TInt CSvgSolidColorElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+ TFloatFixPt KZero;
+ TFloatFixPt KOne( KFloatFixOne );
+
+ if(aName == SOLIDOPACITY)
+ {
+ if(aValue == INHERIT)
+ {
+ // inherit does not make any sense since the stop-opacity is
+ //specific to stop element only and a stop element can not have another stop element as
+ //its child.
+ iSolidOpacity = KOne;
+ }
+ else
+ {
+ #ifdef SVG_FLOAT_BUILD
+ iSolidOpacity = TFloatFixPt::ConvertString( aValue );
+ if (!(iSolidOpacity > TFloatFixPt(0) && iSolidOpacity < TFloatFixPt(1)) )
+
+ #else
+ if ( TFloatFixPt::ConvertString (aValue, iSolidOpacity ) != KErrNone )
+ #endif
+ {
+ iSolidOpacity = KOne;
+ }
+ else
+ {
+ if (aValue.Locate('%') != KErrNotFound)
+ {
+ //if stop opacity was listed as a percentage
+ iSolidOpacity = iSolidOpacity / TFloatFixPt(100);
+ }
+
+ if ( iSolidOpacity < KZero )
+ iSolidOpacity = KZero;
+ else if ( iSolidOpacity > KOne )
+ iSolidOpacity = KOne;
+ }
+ }
+
+ //CFloatCssValueImpl* lFloatObject = (CFloatCssValueImpl*)iSvgStyleProperties[KCSS_ATTR_FILL_OPACITY];
+ CFloatCssValueImpl* lFloatObject;
+ this->FindProperty( KCSS_ATTR_FILL_OPACITY, (CCssValue*&)lFloatObject, this );
+ lFloatObject->SetValueL(iSolidOpacity);
+
+
+
+ }
+
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgSolidColorElementImpl::GetAttributeFloat(const TInt aNameId, TFloatFixPt& aValue)
+{
+ switch(aNameId)
+ {
+ case KAtrSolidOpacity:
+ aValue = iSolidOpacity;
+ break;
+ default:
+ CSvgElementImpl::GetAttributeFloat(aNameId,aValue);
+ break;
+ }
+
+ return 0;
+
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgSolidColorElementImpl::SetAttributeFloatL(const TInt aNameId,const TFloatFixPt aValue)
+{
+ switch(aNameId)
+ {
+ case KAtrSolidOpacity:
+ {
+ iSolidOpacity = aValue;
+
+ //set the solid opacity into the fill-opacity here
+// CFloatCssValueImpl* lFloatObject = (CFloatCssValueImpl*)iSvgStyleProperties[KCSS_ATTR_FILL_OPACITY];
+// lFloatObject->SetValueL(iSolidOpacity);
+ CFloatCssValueImpl* lFloatObject;
+ this->FindProperty( KCSS_ATTR_FILL_OPACITY, (CCssValue*&)lFloatObject, this );
+ lFloatObject->SetValueL(iSolidOpacity);
+
+ }
+ break;
+
+ default:
+ return CSvgElementImpl::SetAttributeFloatL(aNameId,aValue);
+ }
+
+ return 0;
+}
+
+
+// ---------------------------------------------------------------------------=======
+// ApplyOpacitytoElement: Applies solid-opacity to appropriate element
+// ---------------------------------------------------------------------------=======
+void CSvgSolidColorElementImpl::ApplyOpacitytoElement(CSvgElementImpl* aElement)
+ {
+ CCssValue* lCssValue = NULL;
+ // get soild-opacity attribute from SolidColor element
+ // solid-opacity is same as fill-opacity attribute
+ this->FindProperty( KCSS_ATTR_FILL_OPACITY, lCssValue, this );
+ if (lCssValue != NULL)
+ {
+ TBool lResult = ETrue;
+ // apply solid-opacity to the element
+ TRAPD( err, lResult = aElement->SetPropertyFloatL( KCSS_ATTR_FILL_OPACITY,
+ ((CFloatCssValueImpl*)lCssValue)->Value()) );
+ if ( err || !lResult )
+ {
+ #ifdef _DEBUG
+ _LIT( KErrMsg, "CPaintCssValueImpl::Value() Error in SetValueL" );
+ RDebug::Print(KErrMsg);
+ #endif //_DEBUG*/
+ }
+
+ }//
+
+ }
+
+void CSvgSolidColorElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<solidColor/>", this);
+ #endif
+ }
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGStopElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,332 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include "SvgStopElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGGradientElementImpl.h"
+#include "SVGIntCssValueImpl.h"
+
+_LIT(OFFSET, "offset");
+_LIT(STOPOPACITY, "stop-opacity");
+_LIT(INHERIT, "inherit");
+_LIT(STOPCOLOR, "stop-color");
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgStopElementImpl* CSvgStopElementImpl::NewL(const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgStopElementImpl *self = new (ELeave) CSvgStopElementImpl(aDoc);
+ CleanupStack::PushL(self);
+ self->ConstructL(aElemID);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgStopElementImpl::ConstructL(const TUint8 aElemID)
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+ iSvgStyleProperties = new(ELeave) RPointerArray<CCssValue>(KCSS_MAX_ATTR);
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+ iSvgStyleProperties->Remove( 0 );
+
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgStopElementImpl::CSvgStopElementImpl( CSvgDocumentImpl* aDoc ):
+ iOffset(-1),// This implies that offset value is yet to be initialized.
+ iStopOpacity(1),
+ iStopColor(0),
+
+ iValidOffsetValue(ETrue)
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgStopElementImpl::GetAttributeFloat(const TInt aNameId, TFloatFixPt& aValue)
+{
+ switch(aNameId)
+ {
+ case KAtrOffset:
+ aValue= iOffset;
+ break;
+ case KAtrStopOpacity:
+ aValue = iStopOpacity;
+ break;
+ default:
+ CSvgElementImpl::GetAttributeFloat(aNameId,aValue);
+ break;
+ }
+
+ return 0;
+
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgStopElementImpl::SetAttributeFloatL(const TInt aNameId,const TFloatFixPt aValue)
+{
+ switch(aNameId)
+ {
+ case KAtrOffset:
+ iOffset= aValue;
+
+ // Adjust the value of offset
+ if(((((CSvgElementImpl*)ParentNode())->ElemID()) == KSvgRadialGradientElement) ||
+ ((((CSvgElementImpl*)ParentNode())->ElemID()) == KSvgLinearGradientElement))
+ {
+ CSvgGradientElementImpl *parent = ((CSvgGradientElementImpl *)ParentNode());
+
+ if(parent)
+ {
+ parent->UpdateOffsetValues((CSvgStopElementImpl*)this);
+ }
+ }
+
+ break;
+ case KAtrStopOpacity:
+ iStopOpacity= aValue;
+ break;
+
+ default:
+ CSvgElementImpl::SetAttributeFloatL(aNameId,aValue);
+ break;
+ }
+
+ return 0;
+
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgStopElementImpl::GetAttributeIntL( const TInt aNameId, TInt32& aValue )
+{
+ switch(aNameId)
+ {
+ case KAtrStopColor:
+ aValue = iStopColor;
+ break;
+ default:
+ CSvgElementImpl::GetAttributeIntL( aNameId, aValue );
+ break;
+ }
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgStopElementImpl::SetAttributeIntL( const TInt aNameId,
+ const TInt32 aValue )
+{
+ switch(aNameId)
+ {
+ case KAtrStopColor:
+ {
+ iStopColor = (TUint32)aValue;
+ }
+ break;
+ default:
+ CSvgElementImpl::SetAttributeIntL( aNameId,
+ aValue );
+ break;
+ }
+ return 0;
+}
+
+TBool CSvgStopElementImpl::IsValidValue(const TDesC& aValue)
+{
+ TBool lValidValue = ETrue;
+ // aValue can only contain these characters "-+.%0123456789", If it contains any thing
+ // other than this it should be treated as 0.
+
+ _LIT(KValidChars,"-+.%0123456789");
+ TBufC<14> lValidChars(KValidChars);
+
+ TInt llength = aValue.Length();
+
+ for( int charpos = 0 ; charpos < llength; charpos++ )
+ {
+ if( lValidChars.Locate(aValue[charpos]) == KErrNotFound )
+ {
+
+ lValidValue = EFalse;
+ break;
+ }
+ }
+
+ return lValidValue;
+}
+
+TBool CSvgStopElementImpl::IsValidElement() const
+{
+ return iValidOffsetValue;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgStopElementImpl::SetAttributeL(const TDesC &aName, const TDesC &aValue)
+ {
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+ TFloatFixPt KZero(KFloatFixZero);
+ TFloatFixPt KOne( KFloatFixOne );
+
+ if(aName == OFFSET)
+ {
+ iValidOffsetValue = IsValidValue(aValue);
+
+ if( iValidOffsetValue )
+ {
+ iOffset=TFloatFixPt::ConvertString(aValue);
+
+ if (aValue.Locate('%') != KErrNotFound)
+ {
+ iOffset = iOffset / TFloatFixPt(100);
+ }
+
+ // Finally if the iOffset value is lesser than 0, it should be made to 0.
+ if( iOffset < KZero )
+ {
+ iOffset = KZero ;
+ }
+ else if( iOffset > KOne )
+ {
+ iOffset = KOne ;
+ }
+ }
+ else
+ {
+ // aValue contains invalid characters hence "0" is assigned to it.
+ // Any stop element with wrong offset value should not be considered while
+ // rendereing and the effect should be as if no stop-offset is declared.
+ iOffset = KZero;
+ }
+
+ }
+ else if(aName == STOPOPACITY)
+ {
+
+ if(aValue == INHERIT)
+ {
+ // inherit does not make any sense since the stop-opacity is
+ //specific to stop element only and a stop element can not have another stop element as
+ //its child.
+ iStopOpacity = KOne;
+ }
+ else
+ {
+ if( IsValidValue(aValue) )
+ {
+ #ifdef SVG_FLOAT_BUILD
+ iStopOpacity = TFloatFixPt::ConvertString (aValue);
+
+ if (!(iStopOpacity >= TFloatFixPt(0) && iStopOpacity <= TFloatFixPt(1)))
+ #else
+ if ( TFloatFixPt::ConvertString (aValue, iStopOpacity ) != KErrNone )
+ #endif
+ {
+ iStopOpacity = KOne;
+ }
+ else
+ {
+ if (aValue.Locate('%') != KErrNotFound)
+ {
+ //if stop opacity was listed as a percentage
+ iStopOpacity = iStopOpacity / TFloatFixPt(100);
+ }
+
+ if ( iStopOpacity < KZero )
+ iStopOpacity = KZero;
+ else if ( iStopOpacity > KOne )
+ iStopOpacity = KOne;
+ }
+ }
+ else
+ {
+ iStopOpacity = KOne;
+ }
+ }
+ }
+ else if (aName == STOPCOLOR)
+ {
+ TUint32 tempVal;
+
+ TSvgColor tColor(KGfxColorNull);
+ if( tColor.GetStringL( aValue,tempVal) )
+ {
+
+ }
+ else
+ {
+ tempVal = 0;
+ }
+ iStopColor=tempVal;
+ }
+
+ return 0;
+
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgStopElementImpl::~CSvgStopElementImpl()
+ {
+ if ( iSvgStyleProperties )
+ {
+ iSvgStyleProperties->Close();
+ delete iSvgStyleProperties;
+ iSvgStyleProperties = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgStopElementImpl::SetStopColorL(TUint32 &aVal)
+ {
+ iStopColor= aVal;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgStopElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<stop stop-color=\"hmmm\" stop-opacity=\"%d\" offset=\"%d\" />",
+ /*iStopColor,*/ (int)iStopOpacity, (int)iOffset );
+ #endif
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGStrCssValueImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#ifdef _DEBUG
+#if !defined(__E32DEBUG_H__)
+#include <e32debug.h>
+#endif
+#endif
+#include "SVGStrCssValueImpl.h"
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CStrCssValueImpl::~CStrCssValueImpl()
+ {
+ if ( iCssText )
+ {
+ delete iCssText;
+ iCssText = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CStrCssValueImpl::SetValueL( const TDesC& aValue )
+ {
+ if ( iCssText )
+ {
+ delete iCssText;
+ iCssText = NULL;
+ }
+
+ iCssText = aValue.AllocL();
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TDesC& CStrCssValueImpl::Value()
+ {
+ return *iCssText;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+void CStrCssValueImpl::SetL(CStrCssValueImpl* aValue)
+ {
+
+ SetValueL(aValue->Value());
+
+ }
+
+// *******************************************************
+// Private
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+CStrCssValueImpl::CStrCssValueImpl( )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CStrCssValueImpl::IsEqual( CCssValue* aValue )
+{
+ if (((CStrCssValueImpl*)aValue)->iCssText == iCssText)
+ {
+ return ETrue;
+ }
+
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CStrCssValueImpl::Print()
+{
+ #ifdef _DEBUG
+ if (iCssText && iCssText->Length() > 0)
+ {
+ HBufC8* buf = NULL;
+ buf = HBufC8::New( Value().Length() + 1);
+ buf->Des().Copy( Value() );
+ buf->Des().ZeroTerminate();
+ RDebug::Printf("%s", buf->Ptr());
+ delete buf;
+ }
+ else
+ {
+ RDebug::Printf("NULL");
+ }
+ #endif
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGStringTokenizer.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include "SVGStringTokenizer.h"
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TStringTokenizer::TStringTokenizer( const TDesC& aSrc, const TDesC& aDelim ) : iSrc( aSrc ),
+ iDelim( aDelim )
+ {
+ SkipDeliminator( iDelim );
+ }
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TPtrC TStringTokenizer::NextToken()
+ {
+ return NextToken( iDelim );
+ }
+
+//
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TPtrC TStringTokenizer::NextToken( const TDesC& aDelim )
+ {
+ iSrc.Mark();
+ TChar tmpchar = iSrc.Peek();
+ while ( !isDeliminator( tmpchar, aDelim ) && !iSrc.Eos() )
+ {
+ iSrc.Inc();
+ tmpchar = iSrc.Peek();
+ }
+ TPtrC token = iSrc.MarkedToken();
+ SkipDeliminator( aDelim );
+ return token;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool TStringTokenizer::HasMoreTokens()
+ {
+ return !iSrc.Eos();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool TStringTokenizer::isDeliminator( TChar aChar, const TDesC& aDelim )
+ {
+ TUint16 ch = ( TUint16 ) ( TUint ) aChar;
+
+ TInt32 delimLength = aDelim.Length();
+ for ( TInt32 i = 0; i < delimLength; i++ )
+ {
+ if ( ch == aDelim[i] )
+ return ETrue;
+ }
+
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void TStringTokenizer::SkipDeliminator( const TDesC& aDelim )
+ {
+ TChar tmpchar = iSrc.Peek();
+ while ( isDeliminator( tmpchar, aDelim ) && !iSrc.Eos() )
+ {
+ iSrc.Inc();
+ tmpchar = iSrc.Peek();
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGStyleElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,331 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "SVGStyleElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+
+#include "GfxAffineTransform.h"
+
+// *******************************************************
+// Constructor/deconstructor
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgStyleElementImpl* CSvgStyleElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgStyleElementImpl* self = new ( ELeave )
+ CSvgStyleElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgStyleElementImpl* CSvgStyleElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgStyleElementImpl* self = new ( ELeave )
+ CSvgStyleElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgStyleElementImpl::~CSvgStyleElementImpl()
+ {
+ if ( iStyle )
+ {
+ delete iStyle;
+ iStyle = NULL;
+ }
+
+ if ( iType )
+ {
+ delete iType;
+ iType = NULL;
+ }
+
+ if ( iMedia )
+ {
+ delete iMedia;
+ iMedia = NULL;
+ }
+
+ if ( iTitle)
+ {
+ delete iTitle;
+ iTitle = NULL;
+ }
+ }
+
+// *******************************************************
+// SVG Implementation
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgStyleElementImpl::SetTypeL( const TDesC& aValue )
+ {
+ if ( iType )
+ {
+ delete iType;
+ iType = NULL;
+ }
+ iType = aValue.AllocL();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgStyleElementImpl::SetMediaL( const TDesC& aValue )
+ {
+ if ( iMedia )
+ {
+ delete iMedia;
+ iMedia = NULL;
+ }
+ iMedia = aValue.AllocL();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgStyleElementImpl::SetTitleL( const TDesC& aValue )
+ {
+ if ( iTitle )
+ {
+ delete iTitle;
+ iTitle = NULL;
+ }
+ iTitle = aValue.AllocL();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgStyleElementImpl::SetStyleL( const TDesC& aValue )
+ {
+ if ( iStyle )
+ {
+ delete iStyle;
+ iStyle = NULL;
+ }
+ iStyle = aValue.AllocL();
+ }
+
+
+// *******************************************************
+// From MXmlElement
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgStyleElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+ if ( SetIdandXmlbaseL( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+
+ if ( this->SetLangSpaceAttributeL( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+
+ // Set type
+ _LIT( KType, "type" );
+ _LIT( KMedia, "media" );
+ _LIT( KTitle, "title" );
+
+ if ( aName == KType )
+ {
+ SetTypeL( aValue );
+ }
+ // Set media
+ else if ( aName == KMedia )
+ {
+ SetMediaL( aValue );
+ }
+ // Set title
+ else if ( aName == KTitle )
+ {
+ SetTitleL( aValue );
+ }
+ else if ( aName == KTitle )
+ {
+ SetStyleL( aValue );
+ }
+
+ return KErrNone;
+ }
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgStyleElementImpl::SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue )
+ {
+
+ switch (aNameId)
+ {
+ case KAtrType:
+ delete iType;
+ iType = NULL;
+ iType = aValue.AllocL();
+ break;
+ case KAtrMedia:
+ delete iMedia;
+ iMedia = NULL;
+ iMedia = aValue.AllocL();
+ break;
+ case KAtrTitle:
+ delete iTitle;
+ iTitle = NULL;
+ iTitle = aValue.AllocL();
+ break;
+
+ default:
+ return CSvgElementImpl::SetAttributeDesL( aNameId, aValue );
+
+ }
+ return KErrNone;
+ }
+
+// From MXmlElementOpt
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgStyleElementImpl::GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrRefX:
+ {
+ TFloatFixPt xmin( KMAXFLOATFIX ), x; // 0x7fff is the maximum integer in TFixPt
+ CSvgElementImpl*lNewElement = ( CSvgElementImpl* ) FirstChild();
+ while ( lNewElement != NULL )
+ {
+ lNewElement->GetAttributeFloat( KAtrRefX, x );
+ if ( x < xmin )
+ xmin = x;
+ lNewElement = ( CSvgElementImpl * )
+ lNewElement->NextSibling();
+ }
+ aValue = xmin;
+ }
+ break;
+ case KAtrRefY:
+ {
+ TFloatFixPt ymin( KMAXFLOATFIX ), y; // 0x7fff is the maximum integer in TFixPt
+ CSvgElementImpl*lNewElement = ( CSvgElementImpl* ) FirstChild();
+ while ( lNewElement != NULL )
+ {
+ lNewElement->GetAttributeFloat( KAtrRefY, y );
+ if ( y < ymin )
+ ymin = y;
+ lNewElement = ( CSvgElementImpl * )
+ lNewElement->NextSibling();
+ }
+ aValue = ymin;
+ }
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+// *******************************************************
+// From CSvgElementImpl
+
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgStyleElementImpl::CloneL(MXmlElement*)
+ {
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgStyleElementImpl::DrawL( CGfx2dGc* /* aGc */,
+ CSvgElementImpl* /* aElement */ )
+ {
+ return EFalse;
+ }
+
+
+// *******************************************************
+// Private
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgStyleElementImpl::ConstructL( const TUint8 aElemID )
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+}
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+CSvgStyleElementImpl::CSvgStyleElementImpl( CSvgDocumentImpl* aDoc )
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgStyleElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<style type=\"hmm\" media=\"hmm\" title=\"hmm\">"/*, iType, iMedia, iTitle*/);
+ #endif
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGTestsImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,473 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include "SVGTestsImpl.h"
+
+
+// ---------------------------------------------------------------------------
+// Two phase construction:
+// - Implements the SVGTests DOM interface.
+// - Partially implemented, only those required
+// for passing SVG Test Suite.
+// ---------------------------------------------------------------------------
+CSvgTestsImpl* CSvgTestsImpl::NewL()
+ {
+ CSvgTestsImpl* self = new ( ELeave ) CSvgTestsImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgTestsImpl* CSvgTestsImpl::NewLC()
+ {
+ CSvgTestsImpl* self = new ( ELeave ) CSvgTestsImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgTestsImpl::~CSvgTestsImpl()
+ {
+ if ( iRequiredFeatures )
+ {
+ delete iRequiredFeatures;
+ iRequiredFeatures = NULL;
+ }
+ if ( iRequiredExtensions )
+ {
+ delete iRequiredExtensions;
+ iRequiredExtensions = NULL;
+ }
+ if ( iSystemLanguage )
+ {
+ delete iSystemLanguage;
+ iSystemLanguage = NULL;
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTestsImpl::ConstructL()
+ {
+ iRequiredFeatures = new ( ELeave ) CDesCArrayFlat( 1 );
+ iRequiredFeatures->Reset();
+ iRequiredExtensions = new ( ELeave ) CDesCArrayFlat( 1 );
+ iRequiredExtensions->Reset();
+ iSystemLanguage = new ( ELeave ) CDesCArrayFlat( 1 );
+ iSystemLanguage->Reset();
+
+ iSystemLanguageEmpty = EFalse;
+ }
+
+
+// From MSvgTests
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTestsImpl::GetRequiredFeatures( const CDesCArrayFlat*& aRequiredFeatures )
+ {
+ aRequiredFeatures = iRequiredFeatures;
+ }
+
+// ---------------------------------------------------------------------------
+// function for decoding
+// ---------------------------------------------------------------------------
+void CSvgTestsImpl::SetRequiredFeatures( CDesCArrayFlat*& aRequiredFeatures )
+ {
+ if(iRequiredFeatures)
+ {
+ iRequiredFeatures->Reset();
+ delete iRequiredFeatures;
+ iRequiredFeatures= NULL;
+ }
+ iRequiredFeatures= aRequiredFeatures;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTestsImpl::GetRequiredExtensions( const CDesCArrayFlat*& aRequiredExtensions )
+ {
+ aRequiredExtensions = iRequiredExtensions;
+ }
+
+// ---------------------------------------------------------------------------
+// function for decoding
+// ---------------------------------------------------------------------------
+void CSvgTestsImpl::SetRequiredExtensions( CDesCArrayFlat*& aRequiredExtensions )
+ {
+ if(iRequiredExtensions)
+ {
+ iRequiredExtensions->Reset();
+ delete iRequiredExtensions;
+ iRequiredExtensions= NULL;
+ }
+ iRequiredExtensions= aRequiredExtensions;
+ }
+
+// ---------------------------------------------------------------------------
+// returns false if there was an empty string system language true otherwise
+// ---------------------------------------------------------------------------
+TBool CSvgTestsImpl::GetSystemLanguage( const CDesCArrayFlat*& aSystemLanguage )
+ {
+ aSystemLanguage = iSystemLanguage;
+
+ if (iSystemLanguageEmpty)
+ {
+ return EFalse;
+ }
+
+ return ETrue;
+
+ }
+
+// ---------------------------------------------------------------------------
+// function for decoding
+// ---------------------------------------------------------------------------
+void CSvgTestsImpl::SetSystemLanguage( CDesCArrayFlat*& aSystemLanguage )
+ {
+ if(iSystemLanguage)
+ {
+ iSystemLanguage->Reset();
+ delete iSystemLanguage;
+ iSystemLanguage= NULL;
+ }
+ iSystemLanguage= aSystemLanguage;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgTestsImpl::HasExtension( const TDesC& /* aExtension */ )
+ {
+ return EFalse;
+ }
+
+// For use in requiredFeatures
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgTestsImpl::HasFeature( const TDesC& aFeature )
+ {
+ // SVG Tiny Feature List
+ _LIT( KTiny, "http://www.w3.org/TR/SVGMobile/Tiny/feature#" );
+ _LIT( KBase, "base" );
+ _LIT( KInteractivity, "interactivity" );
+ _LIT( KAll, "all" );
+
+ // SVG 1.1 Feature List
+ _LIT( KSVG11, "http://www.w3.org/TR/SVG11/feature#" );
+ _LIT( KCoreAttr, "CoreAttribute" );
+ _LIT( KBasicStr, "BasicStructure" );
+ _LIT( KStyle, "Style" );
+ _LIT( KPaintAttr, "PaintAttribute" );
+ _LIT( KGraphicsAttr, "BasicGraphicsAttribute" );
+ _LIT( KHyperlink, "Hyperlinking" );
+ _LIT( KXlinkAttr, "XlinkAttribute" );
+ _LIT( KCond, "ConditionalProcessing" );
+ _LIT( KShape, "Shape" );
+ _LIT( KImage, "Image" );
+ _LIT( KBasicTest, "BasicText" );
+ _LIT( KBasicFont, "BasicFont" );
+ _LIT( KDocAttr,"DocumentEventsAttribute" );
+ _LIT( KGraphEvt,"GraphicalEventsAttribute" );
+ _LIT( KAnimEvt,"AnimationEventsAttribute" );
+ _LIT( KScript, "Scripting" );
+ _LIT( KView, "View" );
+ _LIT( KAnim, "SVG-animation" );
+ _LIT( KExt, "Extensibility" );
+
+ _LIT( KSVG12, "http://www.w3.org/TR/SVG12/feature#" );
+ _LIT( KAudio, "Audio");
+
+ // SVG 1.2 Feature List
+ // SVG Feature List
+ _LIT( KStatic, "org.w3c.svg.static" );
+ _LIT( KDynamic, "org.w3c.svg.dynamic" );
+
+ TPtrC tinybase( KTiny );
+ if( (aFeature.Length()-tinybase.Length()) > 1 )
+ {
+ TPtrC rightTiny= aFeature.Right(aFeature.Length()-tinybase.Length() );
+ if ( rightTiny.Match(KBase) != KErrNotFound)
+ return ETrue;
+ if ( rightTiny.Match(KInteractivity) != KErrNotFound)
+ return ETrue;
+ if ( rightTiny.Match(KAll) != KErrNotFound )
+ return ETrue;
+ }
+
+ TPtrC svg11base( KSVG11 );
+ if( (aFeature.Length()-svg11base.Length()) > 1 )
+ {
+ TPtrC rightSvg11= aFeature.Right(aFeature.Length()-svg11base.Length() );
+ if ( rightSvg11.Match(KAnim) != KErrNotFound )
+ return ETrue;
+ if ( rightSvg11.Match(KCoreAttr) != KErrNotFound )
+ return ETrue;
+ if ( rightSvg11.Match(KBasicStr) != KErrNotFound )
+ return ETrue;
+ if ( rightSvg11.Match(KStyle) != KErrNotFound )
+ return ETrue;
+ if ( rightSvg11.Match(KPaintAttr) != KErrNotFound )
+ return ETrue;
+ if ( rightSvg11.Match(KGraphicsAttr) != KErrNotFound )
+ return ETrue;
+ if ( rightSvg11.Match(KHyperlink) != KErrNotFound )
+ return ETrue;
+ if ( rightSvg11.Match(KXlinkAttr) != KErrNotFound )
+ return ETrue;
+ if (rightSvg11.Match(KCond) != KErrNotFound )
+ return ETrue;
+ if ( rightSvg11.Match(KShape) != KErrNotFound )
+ return ETrue;
+ if ( rightSvg11.Match(KImage) != KErrNotFound )
+ return ETrue;
+ if ( rightSvg11.Match(KBasicTest) != KErrNotFound )
+ return ETrue;
+ if (rightSvg11.Match(KBasicFont) != KErrNotFound )
+ return ETrue;
+ if ( rightSvg11.Match(KDocAttr) != KErrNotFound )
+ return ETrue;
+ if ( rightSvg11.Match(KGraphEvt) != KErrNotFound )
+ return ETrue;
+ if ( rightSvg11.Match(KAnimEvt) != KErrNotFound )
+ return ETrue;
+ if ( rightSvg11.Match(KScript)!= KErrNotFound )
+ return EFalse; // Scripting is not supported.
+ if ( rightSvg11.Match(KView) != KErrNotFound )
+ return ETrue;
+ if ( rightSvg11.Match(KAnim) != KErrNotFound )
+ return ETrue;
+ if ( rightSvg11.Match(KExt) != KErrNotFound )
+ return ETrue;
+ }
+
+ TPtrC svg12base( KSVG12 );
+ if( (aFeature.Length()-svg12base.Length()) > 1 )
+ {
+ TPtrC rightSvg12= aFeature.Right(aFeature.Length()-svg12base.Length() );
+ if ( rightSvg12.Match(KAudio) != KErrNotFound )
+ {
+ return ETrue;
+ }
+ }
+
+ if ( aFeature == KStatic )
+ return ETrue;
+ if ( aFeature == KDynamic )
+ return EFalse;
+ else
+ return FALSE;
+ }
+
+TBool CSvgTestsImpl::HasAnyTests()
+{
+ const CDesCArrayFlat* tempTestArray = NULL;
+
+ GetRequiredFeatures(tempTestArray);
+ if (tempTestArray && tempTestArray->Count() > 0)
+ {
+ return ETrue;
+ }
+
+ GetSystemLanguage(tempTestArray);
+ if (tempTestArray && tempTestArray->Count() > 0)
+ {
+ return ETrue;
+ }
+
+ GetRequiredExtensions(tempTestArray);
+ if (tempTestArray && tempTestArray->Count() > 0)
+ {
+ return ETrue;
+ }
+
+ if (iSystemLanguageEmpty)
+ {
+ return ETrue;
+ }
+
+ return EFalse;
+}
+
+// Implementation
+
+TBool CSvgTestsImpl::SetRequiredFeatureAttribute( const TDesC& aValue )
+{
+ TLex input( aValue );
+
+ while ( !( input.Eos() ) )
+ {
+ input.SkipSpace();
+ input.Mark();
+ input.SkipCharacters();
+ TPtrC token = input.MarkedToken(); // then extract token
+ TRAPD(error,iRequiredFeatures->AppendL( token ));
+
+ if (error != KErrNone)
+ {
+ //Error Processing
+ return EFalse;
+ }
+ }
+
+ return ETrue;
+}
+
+TBool CSvgTestsImpl::SetRequiredExtensionAttribute( const TDesC& aValue )
+{
+ TLex input( aValue );
+
+ if ( aValue.Length() == 0 )
+ {
+ TRAPD(error1,iRequiredExtensions->AppendL( aValue ));
+
+ if (error1 != KErrNone)
+ {
+ //Error Processing
+ return EFalse;
+ }
+ }
+ else
+ {
+ while ( !( input.Eos() ) )
+ {
+ input.SkipSpace();
+ input.Mark();
+ input.SkipCharacters();
+ TPtrC token = input.MarkedToken(); // then extract token
+ TRAPD(error,iRequiredExtensions->AppendL( token ));
+
+ if (error != KErrNone)
+ {
+ //Error Processing
+ return EFalse;
+ }
+ }
+ }
+ return ETrue;
+}
+
+TBool CSvgTestsImpl::SetSystemLanguageAttribute( const TDesC& aValue )
+{
+ TLex input( aValue );
+
+ iSystemLanguageEmpty = EFalse;
+
+ if ( input.Eos() )
+ {
+ iSystemLanguageEmpty = ETrue;
+ }
+ else
+ {
+ while ( !( input.Eos() ) )
+ {
+ input.SkipSpace();
+ input.Mark();
+ input.SkipCharacters();
+ TPtrC token = input.MarkedToken(); // then extract token
+ TRAPD(error,iSystemLanguage->AppendL( token ));
+
+ if (error != KErrNone)
+ {
+ //Error Processing
+ return EFalse;
+ }
+ }
+ }
+
+ return ETrue;
+
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgTestsImpl::SetTestAttributeL( const TDesC& aPropertyName,
+ const TDesC& aValue )
+{
+
+ _LIT( KRequiredFeatures, "requiredFeatures" );
+ _LIT( KRequiredExtensions, "requiredExtensions" );
+ _LIT( KSystemLanguage, "systemLanguage" );
+
+ if (aPropertyName == KRequiredFeatures)
+ {
+ return SetRequiredFeatureAttribute(aValue);
+ }
+ else if (aPropertyName == KRequiredExtensions)
+ {
+ return SetRequiredExtensionAttribute(aValue);
+ }
+ else if (aPropertyName == KSystemLanguage)
+ {
+ return SetSystemLanguageAttribute(aValue);
+ }
+ else
+ {
+ return EFalse;
+ }
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgTestsImpl* CSvgTestsImpl::CloneL()
+ {
+ CSvgTestsImpl* retValue = CSvgTestsImpl::NewL();
+
+ CleanupStack::PushL(retValue);
+ // no need to call Reset() on any of these arrays because
+ // that already happened in the call to NewL above
+ int i;
+
+ // *** copy required features
+ TInt requiredFeaturesCnt = this->iRequiredFeatures->Count();
+ for (i=0; i< requiredFeaturesCnt; i++)
+ {
+ retValue->iRequiredFeatures->AppendL(this->iRequiredFeatures->operator[](i));
+ }
+
+ // *** copy required extensions
+ TInt requiredExtensionsCnt = this->iRequiredExtensions->Count();
+ for (i=0; i< requiredExtensionsCnt; i++)
+ {
+ retValue->iRequiredExtensions->AppendL(this->iRequiredExtensions->operator[](i));
+ }
+
+ // *** copy system language
+ TInt systemLanguageCnt = this->iSystemLanguage->Count();
+ for (i=0; i< systemLanguageCnt; i++)
+ {
+ retValue->iSystemLanguage->AppendL(this->iSystemLanguage->operator[](i));
+ }
+ CleanupStack::Pop();
+ return retValue;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGTextAreaElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,1031 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include <AknBidiTextUtils.h>
+
+#include "SVGTextAreaElementImpl.h"
+#include "SVGRectElementImpl.h"
+#include "SVGTextElementImpl.h"
+#include "SVGElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+#include "SVGEngineImpl.h"
+#include "GfxAffineTransform.h"
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgTextAreaElementImpl* CSvgTextAreaElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+{
+ CSvgTextAreaElementImpl*self = new ( ELeave ) CSvgTextAreaElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID);
+ CleanupStack::Pop();
+
+ return self;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgTextAreaElementImpl* CSvgTextAreaElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+{
+ CSvgTextAreaElementImpl*self = new ( ELeave ) CSvgTextAreaElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgTextAreaElementImpl::~CSvgTextAreaElementImpl()
+{
+ if ( iSvgStyleProperties )
+ {
+ iSvgStyleProperties->Close();
+ delete iSvgStyleProperties;
+ iSvgStyleProperties = NULL;
+ }
+
+ if ( iInnerRectangle )
+ {
+ this->RemoveChild(iInnerRectangle);
+ delete iInnerRectangle;
+ iInnerRectangle = NULL;
+ }
+
+ if ( iBorderRectangle )
+ {
+ this->RemoveChild(iBorderRectangle);
+ delete iBorderRectangle;
+ iBorderRectangle = NULL;
+ }
+
+ if (iTextElementsArray)
+ {
+ iTextElementsArray->Reset();
+ iTextElementsArray->Close();
+ delete iTextElementsArray;
+ iTextElementsArray = NULL;
+ }
+ if (iAllText)
+ {
+ delete iAllText;
+ iAllText = NULL;
+ }
+
+ ((CSvgDocumentImpl*)OwnerDocument())->RemoveInternalMouseListener( this );
+
+}
+
+// *******************************************************
+// From SVG DOM
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgTextAreaElementImpl::X()
+{
+ if (!iInitialized)
+ {
+ return 0;
+ }
+
+ return iBorderRectangle->X();
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgTextAreaElementImpl::Y()
+{
+ if (!iInitialized)
+ {
+ return 0;
+ }
+
+ return iBorderRectangle->Y();
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgTextAreaElementImpl::Width()
+{
+ if (!iInitialized)
+ {
+ return 0;
+ }
+
+ return iBorderRectangle->Width();
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgTextAreaElementImpl::Height()
+{
+ if (!iInitialized)
+ {
+ return 0;
+ }
+
+ return iBorderRectangle->Height();
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgTextAreaElementImpl::Rx()
+{
+ if (!iInitialized)
+ {
+ return 0;
+ }
+
+ return iBorderRectangle->Rx();
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgTextAreaElementImpl::Ry()
+{
+ if (!iInitialized)
+ {
+ return 0;
+ }
+
+ return iBorderRectangle->Ry();
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgTextAreaElementImpl::IsEditable()
+{
+ return iEditable;
+}
+
+
+// ---------------------------------------------------------------------------
+// For JSR support
+// ---------------------------------------------------------------------------
+void CSvgTextAreaElementImpl::SetTextAreaDimensions(TFloatFixPt aX, TFloatFixPt aY, TFloatFixPt aWidth, TFloatFixPt aHeight)
+{
+ if (!iInitialized)
+ {
+ TRAPD(err, InitializeL());
+ if (err)
+ {
+ #ifdef _DEBUG
+ _LIT( KErrMsg, "CSvgTextAreaElementImpl::SetTextAreaDimensions Error in InitializeL()" );
+ RDebug::Print(KErrMsg);
+ #endif //_DEBUG
+ }
+ }
+
+ TRAPD(err, iBorderRectangle->SetAttributeFloatL(KAtrX, aX));
+ if (err)
+ {
+ #ifdef _DEBUG
+ _LIT( KErrMsg, "CSvgTextAreaElementImpl::SetTextAreaDimensions Error in SetAttributeFloatL" );
+ RDebug::Print(KErrMsg);
+ #endif //_DEBUG
+ }
+
+ TRAP(err, iBorderRectangle->SetAttributeFloatL(KAtrY, aY));
+ if (err)
+ {
+ #ifdef _DEBUG
+ _LIT( KErrMsg, "CSvgTextAreaElementImpl::SetTextAreaDimensions Error in SetAttributeFloatL" );
+ RDebug::Print(KErrMsg);
+ #endif //_DEBUG
+ }
+
+ TRAP(err, iBorderRectangle->SetAttributeFloatL(KAtrWidth, aWidth));
+ if (err)
+ {
+ #ifdef _DEBUG
+ _LIT( KErrMsg, "CSvgTextAreaElementImpl::SetTextAreaDimensions Error in SetAttributeFloatL" );
+ RDebug::Print(KErrMsg);
+ #endif //_DEBUG
+ }
+
+ TRAP(err, iBorderRectangle->SetAttributeFloatL(KAtrHeight, aHeight));
+ if (err)
+ {
+ #ifdef _DEBUG
+ _LIT( KErrMsg, "CSvgTextAreaElementImpl::SetTextAreaDimensions Error in SetAttributeFloatL" );
+ RDebug::Print(KErrMsg);
+ #endif //_DEBUG
+ }
+}
+
+// From MXmlElementOpt
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgTextAreaElementImpl::GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue )
+{
+ if (!iInitialized)
+ {
+ TRAPD(err, InitializeL());
+ if (err)
+ {
+ #ifdef _DEBUG
+ _LIT( KErrMsg, "CSvgTextAreaElementImpl::GetAttributeFloat Error in InitializeL()" );
+ RDebug::Print(KErrMsg);
+ #endif //_DEBUG
+ }
+ }
+
+ switch ( aNameId )
+ {
+ case KAtrX:
+ case KAtrRefX:
+ aValue = X();
+ break;
+ case KAtrY:
+ case KAtrRefY:
+ aValue = Y();
+ break;
+ case KAtrWidth:
+ aValue = Width();
+ break;
+ case KAtrHeight:
+ aValue = Height();
+ break;
+ // added as a part of get and Set api updation
+ case KAtrRx:
+ aValue = Rx();
+ break;
+ case KAtrRy:
+ aValue = Ry();
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+ return KErrNone;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgTextAreaElementImpl::SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue )
+{
+ if (!iInitialized)
+ {
+ InitializeL();
+ }
+
+ switch ( aNameId )
+ {
+ case KAtrX:
+ iBorderRectangle->SetAttributeFloatL(aNameId, aValue);
+ iInnerRectangle->SetAttributeFloatL(aNameId, aValue+TFloatFixPt(2));
+ break;
+ case KAtrY:
+ iBorderRectangle->SetAttributeFloatL(aNameId, aValue);
+ iInnerRectangle->SetAttributeFloatL(aNameId, aValue+TFloatFixPt(2));
+ break;
+ case KAtrRx:
+ iBorderRectangle->SetAttributeFloatL(aNameId, aValue);
+ //iInnerRectangle->SetAttributeFloatL(aNameId, aValue+TFloatFixPt(2));
+ break;
+ case KAtrRy:
+ iBorderRectangle->SetAttributeFloatL(aNameId, aValue);
+ //iInnerRectangle->SetAttributeFloatL(aNameId, aValue+TFloatFixPt(2));
+ break;
+ case KAtrWidth:
+ if(iReqAttrFlag == KAtrSVGRec)
+ {
+ iReqAttrFlag = KAtrHeight;
+ }
+ else
+ {
+ iReqAttrFlag = 0;
+ }
+
+ iBorderRectangle->SetAttributeFloatL(aNameId, aValue);
+ iInnerRectangle->SetAttributeFloatL(aNameId, aValue-TFloatFixPt(4));
+ break;
+
+ case KAtrHeight:
+ if(iReqAttrFlag == KAtrSVGRec)
+ {
+ iReqAttrFlag = KAtrWidth;
+ }
+ else
+ {
+ iReqAttrFlag = 0;
+ }
+ iBorderRectangle->SetAttributeFloatL(aNameId, aValue);
+ iInnerRectangle->SetAttributeFloatL(aNameId, aValue-TFloatFixPt(4));
+ break;
+ default:
+ return CSvgElementImpl::SetAttributeFloatL( aNameId, aValue );
+ }
+ return KErrNone;
+}
+
+
+// *******************************************************
+// From MXmlElement
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgTextAreaElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+{
+ if (!iInitialized)
+ {
+ InitializeL();
+ }
+
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+ return KErrNone;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgTextAreaElementImpl::GetAttributeDes( const TInt aNameId, TPtrC16& aValue )
+ {
+ if (!iInitialized)
+ {
+ return KErrNone;
+ }
+
+ switch ( aNameId )
+ {
+ case KAtrCdata:
+ aValue.Set(*iAllText);
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeDes( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgTextAreaElementImpl::SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrCdata:
+ SetTextL( aValue );
+ break;
+
+ default:
+ return CSvgElementImpl::SetAttributeDesL( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTextAreaElementImpl::SetEditable( const TDesC& aValue )
+{
+ if (aValue.FindF(_L("simple")) == KErrNotFound && aValue.FindF(_L("true")) == KErrNotFound)
+ {
+ iEditable = EFalse;
+ }
+ else
+ {
+ iEditable = ETrue;
+ }
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTextAreaElementImpl::LocalizedArrangeTextL( CGfx2dGc* /* aGc */ )
+ {
+ if (!iInitialized)
+ {
+ return;
+ }
+
+ //every time we call arrange text we will clear the previous text elements
+ //very expensive but easiest way to do this
+ if (iTextElementsArray)
+ {
+ TInt textEleArrayCnt = iTextElementsArray->Count();
+ for (TInt i=0; i < textEleArrayCnt; i++)
+ {
+ this->RemoveChild( iTextElementsArray->operator[](i) );
+ delete iTextElementsArray->operator[](i);
+ }
+
+ iTextElementsArray->Reset();
+ }
+ // If there is some text in the text area, we need to do the following operations
+ // a. calculate number of lines that can fit in the inner rectangle of textArea
+ // i. For this we need to get the dimension of Inner Rectangle
+ // ii. Then get the font corresponding to the current scale. This is obtained
+ // by creating a dummy text element and updating its CTM.
+ //
+ if (iAllText && iAllText->Length() > 0)
+ {
+ TFloatFixPt lInnerRectWidthF, lInnerRectHeightF;
+ iInnerRectangle->GetAttributeFloat( KAtrWidth, lInnerRectWidthF );
+ iInnerRectangle->GetAttributeFloat( KAtrHeight, lInnerRectHeightF );
+
+ // Create a dummy text element to obtain the font
+ CSvgTextElementImpl* lTextElement =
+ (CSvgTextElementImpl*)iOwnerDocument->CreateElementL(KSvgTextElement);
+ CleanupStack::PushL(lTextElement);
+ lTextElement->SetAttributeDesL(KAtrCdata,iAllText->Des());
+
+ this->AppendChildL(lTextElement);
+ CleanupStack::Pop(lTextElement);
+ lTextElement->UpdateCTM();
+ // Update the text element's font corresponding to the CTM.
+ lTextElement->UpdateCurrentScaledFont();
+
+ TFloatFixPt lScale = GetCurrentScale();
+
+ //Taken the widest charactor to check against the dimensions of the text area.
+ //There is no point in going futher, If the area of text area elelment
+ //is not big enough to fit the single char,
+ TChar ch('W');
+ if ( lScale == TFloatFixPt( 0 ) ||
+ ((TReal32)( lInnerRectWidthF * lScale)) < lTextElement->Font()->CharWidthInPixels( ch ) ||
+ ((TReal32)( lInnerRectHeightF * lScale)) < lTextElement->Font()->FontMaxHeight())
+ {
+ // Scale = 0 , means no drawing will take place.
+ // Cleanup the text element
+ this->RemoveChild(lTextElement);
+ delete lTextElement;
+ lTextElement = NULL;
+ return;
+ }
+
+ // Store the current font's ascent and descent
+ TInt lTextAscent = lTextElement->Font()->FontMaxAscent();
+ TInt lTextDescent = lTextElement->Font()->FontMaxDescent();
+
+ TReal32 lTextHeight = lTextAscent + lTextDescent;
+
+ if (lTextHeight == 0)
+ {
+ //no text height so we need to not draw the text
+ this->RemoveChild(lTextElement);
+ delete lTextElement;
+ lTextElement = NULL;
+ return;
+ }
+
+ // Calculate gap between two consecutive lines of text
+ // CFont provides FontLineGap() which is Font Height + Line Gap
+
+ TInt lLineGap = lTextElement->Font()->FontLineGap();
+ // Number of lines of text
+ TInt lNumOflines = (TReal32)( lInnerRectHeightF * lScale)/( lLineGap ) ;
+
+ if( lNumOflines < 1)
+ {
+ //text is taller than the rectangle
+ this->RemoveChild(lTextElement);
+ delete lTextElement;
+ lTextElement = NULL;
+ return;
+ }
+ // Create a list of line widths and line texts to use with ConvertToVisualAndWrapToArrayL
+ CArrayFixFlat<TInt>* lLineWidthArray = new ( ELeave ) CArrayFixFlat<TInt>( lNumOflines );
+ CleanupStack::PushL(lLineWidthArray);
+
+ //one px offset is taken on Left & right ends w.r. to inner rect width.
+ lLineWidthArray->AppendL((TInt)( lInnerRectWidthF * lScale ) - 2,lNumOflines);
+
+ CArrayFixFlat< TPtrC >* lWrappedArray = new ( ELeave ) CArrayFixFlat<TPtrC>( lLineWidthArray->Count() );
+
+ CleanupStack::PushL(lWrappedArray);
+
+ //ConvertToVisualAndWrapToArrayL requires KAknBidiExtraSpacePerLine.
+ //Refer the help of AknBidiTextUtils::ConvertToVisualAndWrapToArrayL
+ HBufC *lBuf = HBufC::NewLC(iAllText->Length() + (lNumOflines) * KAknBidiExtraSpacePerLine);
+
+ TPtr buf = lBuf->Des();
+ buf.Copy(iAllText->Des());
+ // Below API fills the lWrappedArray with the lines of text. If no space
+ // is available in textArea, then trailing ellipsis(...) will be displayed.
+ AknBidiTextUtils::ConvertToVisualAndWrapToArrayL(buf, *lLineWidthArray,
+ *lTextElement->iBitmapFont, *lWrappedArray, ETrue);
+
+ // Dummy text element is no longer required.
+ this->RemoveChild(lTextElement);
+ delete lTextElement;
+ lTextElement = NULL;
+
+ // Calculating the y offset for first line of text.
+ // Text is positioned wrt font baseline, hence the position =
+ // Inner Rectangle 's Y Coordinate + Unscaled Font Ascent
+ // The scaling will be taken care of by UpdateCTM on the text elements.
+ TInt lTextCurrentY = TReal32(iInnerRectangle->Y()) + (lTextAscent / (TReal32)lScale );
+ TInt lWrappedArrayCnt = lWrappedArray->Count();
+
+ // lWrappedArrayCnt is guaranteed to be less than lNumOfLines.
+ // This loop creates Text elements as many as elements in lWrapppedArray.
+ // These elements are appended as child to the text area.
+ for( TInt i=0; i < lWrappedArrayCnt ; i++)
+ {
+ lTextElement = (CSvgTextElementImpl*)iOwnerDocument->CreateElementL(KSvgTextElement);
+ CleanupStack::PushL( lTextElement );
+ iTextElementsArray->Append(lTextElement);
+
+ TPtrC lineText = lWrappedArray->At(i);
+ lTextElement->SetAttributeDesL(KAtrCdata,lineText);
+
+ //Text positioned from the inner rectangle's X- coordinate + 1 pixel gap
+ lTextElement->SetAttributeFloatL(KAtrX, TFloatFixPt(iInnerRectangle->X() + TFloatFixPt(1)));
+
+ //need to set the next text element up to go down the height here too...
+ lTextElement->SetAttributeFloatL(KAtrY, TFloatFixPt(lTextCurrentY));
+
+ lTextElement->SetAttributeFloatL(KAtrWidth, TFloatFixPt(iInnerRectangle->Width() - TFloatFixPt(2)));
+ lTextElement->SetAttributeFloatL(KAtrHeight, lTextHeight);
+
+ this->AppendChildL(lTextElement);
+
+ lTextElement->UpdateCTM();
+ lTextElement->UpdateCurrentScaledFont();
+
+ //The subsequent position calculated as lTextHeight( Ascent + descent ) / unscaled line gap
+ lTextCurrentY += (TInt)(( lLineGap )/(TReal32)lScale);
+
+ CleanupStack::Pop( lTextElement );
+ }
+
+ //delete lBuf;
+ CleanupStack::PopAndDestroy(lBuf);
+ CleanupStack::Pop(lWrappedArray);
+ delete lWrappedArray;
+ CleanupStack::Pop(lLineWidthArray);
+ delete lLineWidthArray;
+
+ }
+}
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgTextAreaElementImpl::GetLength()
+ {
+ return iAllText->Length();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTextAreaElementImpl::GetText( TDes& allText )
+ {
+ if ( iAllText )
+ {
+ if ( allText.MaxLength() < iAllText->Length() )
+ {
+ allText = iAllText->Left( allText.MaxLength() );
+ }
+ else
+ {
+ allText = *iAllText;
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTextAreaElementImpl::SetTextL( const TDesC& aText )
+ {
+
+ _LIT( KPreserve, "preserve" );
+ _LIT( KDefault, "default");
+ if ( iAllText )
+ {
+ delete iAllText;
+ iAllText = NULL;
+ }
+
+ iAllText = aText.AllocL();
+ TPtr textDes = iAllText->Des();
+ TBool def = ETrue;
+
+ // Get the xml:space value.
+ TBuf<20> lXmlspace;
+
+ if(XMLSpace() == KPreserve)
+ {
+ lXmlspace=KPreserve;
+ def=EFalse;
+ }
+ else if(XMLSpace() == KDefault)
+ {
+ lXmlspace=KDefault;
+ }
+ // xml:space is inherited if not specified
+ if ( lXmlspace!= KPreserve && lXmlspace != KDefault)
+ {
+ // Traverse to the nearest parent element which has the xml:space
+ // If no xml:space then render using xml:space="default"
+ CSvgElementImpl *lRoot=(CSvgElementImpl *)this->ParentNode();
+ while(lRoot)
+ {
+ if ((lRoot->XMLSpace() == KPreserve))
+ {
+ def = EFalse;
+ break;
+ }
+ else if(lRoot->XMLSpace()==KDefault)
+ {
+ break;
+ }
+ lRoot=(CSvgElementImpl *)lRoot->ParentNode();
+ }
+ }
+
+ _LIT(KSpace, " ");
+ // default
+ if ( def && lXmlspace != KPreserve )
+ {
+
+ // Remove leading, trailing and contiguous spaces
+ textDes.TrimAll();
+
+ for (TInt i = textDes.Length() - 1; i >= 0; i--)
+ {
+
+ // Remove new line character
+ if (textDes[i] == '\n')
+ {
+ textDes.Delete(i,1);
+ }
+
+ // Tab to be replaced with space.
+ if(textDes[i] == '\t')
+ {
+ textDes.Replace(i,1,KSpace);
+ }
+ }
+ }
+ // preserve
+ else
+ {
+
+ for ( TInt i = 0; i < textDes.Length(); i++ )
+ {
+ // ms-dos carriage return contains two characters: 13, 10
+ const TInt KCarriageReturn1 = 13;
+ const TInt KCarriageReturn2 = 10;
+
+ if ( i + 1 < textDes.Length() &&
+ (TInt)textDes[i] == KCarriageReturn1 &&
+ (TInt)textDes[i+1] == KCarriageReturn2 )
+ {
+ textDes[i] = ' ';
+ textDes.Delete( i+1, 1 );
+ }
+
+ // New line and tab should be replaced by space character.
+ if (textDes[i] == '\n' ||textDes[i] == '\t')
+ {
+ textDes.Replace(i,1, KSpace);
+ }
+ }
+ }
+
+ iNeedTextRearrange = ETrue;
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTextAreaElementImpl::InitializeL()
+{
+ if (!iBorderRectangle && !iInnerRectangle)
+ {
+ iBorderRectangle = CSvgRectElementImpl::NewL(KSvgRectElement, (CSvgDocumentImpl*)iOwnerDocument);
+ this->AppendChildL(iBorderRectangle);
+ iInnerRectangle = CSvgRectElementImpl::NewL(KSvgRectElement, (CSvgDocumentImpl*)iOwnerDocument);
+ this->AppendChildL(iInnerRectangle);
+
+ iInnerRectangle->SetAttributeFloatL(KAtrRx, 2);
+ iInnerRectangle->SetAttributeFloatL(KAtrRy, 2);
+ iInnerRectangle->SetPropertyL(KCSS_ATTR_FILL, _L("none"));
+ iInnerRectangle->SetPropertyL(KCSS_ATTR_STROKEWIDTH, _L(".02"));
+ iInnerRectangle->SetPropertyL(KCSS_ATTR_STROKE, _L("black"));
+
+ iBorderRectangle->SetAttributeFloatL(KAtrRx, 2);
+ iBorderRectangle->SetAttributeFloatL(KAtrRy, 2);
+ iBorderRectangle->SetPropertyL(KCSS_ATTR_FILL, _L("none"));
+ iBorderRectangle->SetPropertyL(KCSS_ATTR_STROKEWIDTH, _L(".1"));
+ iBorderRectangle->SetPropertyL(KCSS_ATTR_STROKE, _L("black"));
+
+ iInitialized = ETrue;
+ }
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgTextAreaElementImpl::DrawL( CGfx2dGc* aGc, CSvgElementImpl* aElement )
+{
+ if (iBorderRectangle->Width() <= TFloatFixPt(0) || iBorderRectangle->Height() <= TFloatFixPt(0))
+ {
+ return ETrue;
+ }
+
+ TFloatFixPt scale = GetCurrentScale();
+ TFloatFixPt width = iInnerRectangle->Width() * scale;
+ TFloatFixPt height = iInnerRectangle->Height() * scale;
+
+ if ( width != iLastBBox.iWidth || height != iLastBBox.iHeight )
+ {
+ iNeedTextRearrange = ETrue;
+ iLastBBox.iWidth = width;
+ iLastBBox.iHeight = height;
+ }
+
+ DrawTextElements( aGc, aElement );
+
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgTextAreaElementImpl::DrawTextElements( CGfx2dGc* aGc, CSvgElementImpl* /*aElement*/ )
+{
+ //draw text elements...readjust their positions according the width and height of the inner rectangle...
+ if (iNeedTextRearrange)
+ {
+ //TRAPD(err, ArrangeTextL(aGc));
+ TRAPD(err, LocalizedArrangeTextL(aGc));
+ if (err)
+ {
+ #ifdef _DEBUG
+ _LIT( KErrMsg, "CSvgTextAreaElementImpl::DrawTextElements Error in ArrangeTextL()" );
+ RDebug::Print(KErrMsg);
+ #endif //_DEBUG
+ }
+
+ iNeedTextRearrange = EFalse;
+ }
+
+ //draw text until it reaches the inner border then start a new text element on the next line down
+ /*if (iTextElementsArray)
+ {
+ for (int i=0; i < iTextElementsArray->Count(); i++)
+ {
+ //draw text elements here...
+ TRAPD(err, iTextElementsArray->operator[](i)->DrawL(aGc, aElement));
+ if (err)
+ {
+ #ifdef _DEBUG
+ _LIT( KErrMsg, "CSvgTextAreaElementImpl::DrawTextElements Error in DrawL()" );
+ RDebug::Print(KErrMsg);
+ #endif //_DEBUG
+ }
+
+ }
+ }*/
+
+ return ETrue;
+}
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTextAreaElementImpl::ConstructL( const TUint8 aElemID )
+{
+ CSvgElementImpl::InitializeL( aElemID );
+
+ iSvgStyleProperties = new(ELeave) RPointerArray<CCssValue>(KCSS_MAX_ATTR );
+
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+ iSvgStyleProperties->Remove( 0 );
+
+ iTextElementsArray = new (ELeave)RPointerArray<CSvgTextElementImpl> (1);
+ iTextElementsArray->Reset();
+
+ iSvgTransformable = CSvgTransformableImpl::NewL();
+
+ iReqAttrFlag=KSVG_RECT_ELEMFLAG;
+
+ iBorderRectangle = NULL;
+ iInnerRectangle = NULL;
+
+ iNeedTextRearrange = ETrue;
+ iInitialized = EFalse;
+
+ iAllText = HBufC::NewL( 2 );
+
+ iEditable = EFalse;
+
+ // Add this as internal event receiver
+ //((CSvgDocumentImpl*)iOwnerDocument)->AddToEventReceiverListL( this, KSvgEventMaskExternalUI);
+
+ ((CSvgDocumentImpl*)OwnerDocument())->AddInternalMouseListener( this );
+
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+CSvgTextAreaElementImpl::CSvgTextAreaElementImpl( CSvgDocumentImpl* aDoc )
+{
+ SetOwnerDocument(aDoc);
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTextAreaElementImpl::GetBBox( TGfxRectangle2D& aBbox )
+{
+ if (!iInitialized)
+ {
+ TGfxRectangle2D myRect(0,0,0,0);
+ aBbox = myRect;
+ return;
+ }
+
+ iBorderRectangle->GetBBox( aBbox );
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTextAreaElementImpl::GetUnscaledBBox( TGfxRectangle2D& aBbox )
+{
+ if (!iInitialized)
+ {
+ TGfxRectangle2D myRect(0,0,0,0);
+ aBbox = myRect;
+ return;
+ }
+
+ iBorderRectangle->GetUnscaledBBox(aBbox);
+}
+
+// ---------------------------------------------------------------------------
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgTextAreaElementImpl::CloneL(MXmlElement* aParentElement)
+{
+ // create new text area
+ CSvgTextAreaElementImpl* newElement = CSvgTextAreaElementImpl::NewL( this->ElemID(), ((CSvgDocumentImpl*)iOwnerDocument) );
+
+ newElement->iParentNode = aParentElement;
+ // copy everything over
+ this->CopyL(newElement);
+
+ return newElement;
+}
+
+// ---------------------------------------------------------------------------
+// perform a deep copy of this object
+// ---------------------------------------------------------------------------
+void CSvgTextAreaElementImpl::CopyL( CSvgTextAreaElementImpl* aDestElement )
+{
+ // copy stuff from superclass
+ this->CSvgElementImpl::CopyL(aDestElement);
+
+ // copy iRectangle items special to circle
+ aDestElement->iBorderRectangle = (CSvgRectElementImpl*)iBorderRectangle->CloneL((MXmlElement*)iBorderRectangle);
+ aDestElement->iInnerRectangle = (CSvgRectElementImpl*)iInnerRectangle->CloneL((MXmlElement*)iInnerRectangle);
+
+ if (iTextElementsArray)
+ {
+ TInt textEleArrayCnt = iTextElementsArray->Count();
+ for (int i=0; i < textEleArrayCnt; i++)
+ {
+ aDestElement->iTextElementsArray->Append((CSvgTextElementImpl*)iTextElementsArray->operator[](i)->CloneL((MXmlElement*)iTextElementsArray->operator[](i)));
+ }
+ }
+
+ // copy the reference to idoc (CSvgDocumentImpl)
+ aDestElement->iOwnerDocument = this->iOwnerDocument;
+}
+
+/*** FROM MSvgMouseListener ***/
+// ---------------------------------------------------------------------------
+// mouse entered
+// ---------------------------------------------------------------------------
+TBool CSvgTextAreaElementImpl::MouseEntered( RPointerArray<CSvgElementImpl>& aElements,
+ TInt /*aX*/, TInt /*aY*/ )
+{
+ CSvgEngineImpl* engine = ( ( CSvgDocumentImpl* ) OwnerDocument() )->Engine();
+
+ TInt eleCnt = aElements.Count();
+ for (TInt i = 0; i < eleCnt; i++ )
+ {
+ if ( aElements[i] == this )
+ {
+ engine->NotifyTextAreaEntered(this);
+ return ETrue;
+ }
+ }
+
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+// Notified when the mouse pointer exits a visible svg element.
+// ---------------------------------------------------------------------------
+TBool CSvgTextAreaElementImpl::MouseExited( RPointerArray<CSvgElementImpl>& aElements,
+ TInt /*aX*/, TInt /*aY*/ )
+{
+ CSvgEngineImpl* lEngine = ( ( CSvgDocumentImpl* ) OwnerDocument() )->Engine();
+
+ TInt eleCnt = aElements.Count();
+ for (TInt i = 0; i < eleCnt; i++ )
+ {
+ if ( aElements[i] == this )
+ {
+ lEngine->NotifyTextAreaExited(this);
+ return ETrue;
+ }
+ }
+
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+// Notified when the mouse pointer is pressed down on visible svg element.
+// ---------------------------------------------------------------------------
+TBool CSvgTextAreaElementImpl::MouseMoved( RPointerArray<CSvgElementImpl>& /*aElements*/,
+ TInt /*aX*/, TInt /*aY*/ )
+{
+ return EFalse;
+}
+// ---------------------------------------------------------------------------
+// Notified when the mouse pointer is pressed down on visible svg element.
+// ---------------------------------------------------------------------------
+TBool CSvgTextAreaElementImpl::MousePressed( RPointerArray<CSvgElementImpl>& /*aElements*/,
+ TInt /*aX*/, TInt /*aY*/ )
+{
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+// Notified when the mouse pointer is released on on visible svg element.
+// ---------------------------------------------------------------------------
+TBool CSvgTextAreaElementImpl::MouseReleased( RPointerArray<CSvgElementImpl>& aElements,
+ TInt /*aX*/, TInt /*aY*/ )
+{
+ CSvgEngineImpl* lEngine = ( ( CSvgDocumentImpl* ) OwnerDocument() )->Engine();
+
+ TInt eleCnt = aElements.Count();
+ for (TInt i = 0; i < eleCnt; i++ )
+ {
+ if ( aElements[i] == this )
+ {
+ lEngine->NotifyTextAreaActivated(this);
+ return ETrue;
+ }
+ }
+
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+// void CSvgTextAreaElementImpl::Print()
+// ---------------------------------------------------------------------------
+void CSvgTextAreaElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<textarea x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" editable=\"%d\" >hmm</textarea>", (int)X(), (int)Y(), (int)Width(), (int)Height(), (int)iEditable/*, iAllText*/);
+ #endif
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGTextElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,3395 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "SVGTextElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGEngineImpl.h"
+#include "SVGSchemaData.h"
+#include "SVGFloatCssValueImpl.h"
+#include "SVGStrCssValueImpl.h"
+#include "SVGIntCssValueImpl.h"
+#include "SVGPaintCssValueImpl.h"
+
+#include "GfxLine2D.h"
+#include "GfxStroke.h"
+#include "GfxColor.h"
+
+#include "GfxAffineTransform.h"
+
+
+#include "SVGStringTokenizer.h"
+#include "GfxGeneralPath.h"
+
+#include "SVGGlyphElementImpl.h"
+//#include "SvgDefaultFont.h"
+#include "SVGErrorImpl.h"
+#include "SVGFourPointRect.h"
+
+#include "hal.h"
+#include "hal_data.h"
+
+#define KDefaultFontSize 10
+#define KOne 1
+#define KDefaultUnitsPerEm 1000
+
+_LIT( KGlyphNameNone, "GlyphNameNone");
+_LIT( KDefaultFont, "serif" ); // Similar changes should be applied to Gfx2dGcOpenVg.cpp file
+
+// ---------------------------------------------------------------------------
+// Two phase construction
+// ---------------------------------------------------------------------------
+
+CSvgTextElementImpl* CSvgTextElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+
+ {
+ CSvgTextElementImpl*self = new ( ELeave ) CSvgTextElementImpl( aDoc );
+ CleanupStack::PushL( self );
+
+
+ self->ConstructL( aElemID );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+
+CSvgTextElementImpl* CSvgTextElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgTextElementImpl*self = new ( ELeave ) CSvgTextElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgTextElementImpl::CSvgTextElementImpl( CSvgDocumentImpl* aDoc ): iOffset(0)
+ {
+ SetOwnerDocument(aDoc);
+
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+void CSvgTextElementImpl::ConstructL( const TUint8 aElemID )
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+
+
+ iArrayX = new ( ELeave ) CArrayFixFlat<TFloatFixPt>( 1 );
+ iArrayY = new ( ELeave ) CArrayFixFlat<TFloatFixPt>( 1 );
+
+ #ifdef SVG_FLOAT_BUILD
+ iArrayX->AppendL( TFloatFixPt(0) );
+ iArrayY->AppendL( TFloatFixPt(0) );
+
+ iPoint.iX = TFloatFixPt( 0 );
+ iPoint.iY = TFloatFixPt( 0 );
+ #else
+ iArrayX->AppendL( TFloatFixPt( 0 , ETrue) );
+ iArrayY->AppendL( TFloatFixPt( 0 , ETrue) );
+
+
+ iPoint.iX = TFloatFixPt( 0 ,ETrue);
+ iPoint.iY = TFloatFixPt( 0 ,ETrue);
+ #endif
+
+ iText = HBufC::NewL( 2 );
+ // *iText = _L( " " );
+
+ iG1 = HBufC::NewL( 0 );
+ iG2 = HBufC::NewL( 0 );
+
+ iU1 = HBufC::NewL( 0 );
+ iU2 = HBufC::NewL( 0 );
+
+ iSvgStyleProperties = new(ELeave) RPointerArray<CCssValue>(KCSS_MAX_ATTR);
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+ iSvgStyleProperties->Remove( 0 );
+
+ iTriedLoadingSVGFonts = EFalse;
+ iNeedToCacheGlyphs = EFalse;
+
+ iSvgTransformable = CSvgTransformableImpl::NewL();
+
+ //set in the default font...just in case
+ SetFontFamilyL(KDefaultFont ); //_L("DefaultFont"));
+
+ iEditable = EFalse;
+
+ if (OwnerDocument())
+ {
+ ((CSvgDocumentImpl*)OwnerDocument())->AddInternalMouseListener( this );
+ }
+
+ //gets the default font that the graphics context holds at the start
+ //should be whatever the client side specified as the initial fontspec
+ //GetCurrentFontScaled(iBitmapFont, iBitmapFontSpec);
+
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgTextElementImpl::~CSvgTextElementImpl()
+ {
+
+ iGlyphElements.Close();
+
+ if ( iFamilies )
+ {
+ iFamilies->Reset();
+ delete iFamilies;
+ iFamilies = NULL;
+ }
+ if ( iArrayX )
+ {
+ iArrayX->Reset();
+ delete iArrayX;
+ iArrayX = NULL;
+ }
+ if ( iArrayY )
+ {
+ iArrayY->Reset();
+ delete iArrayY;
+ iArrayY = NULL;
+ }
+ if ( iArrayRotate )
+ {
+ iArrayRotate->Reset();
+ delete iArrayRotate;
+ iArrayRotate = NULL;
+ }
+
+ if ( iText )
+ {
+ delete iText;
+ iText = NULL;
+ }
+
+ if ( iG1 )
+ {
+ delete iG1;
+ iG1 = NULL;
+ }
+
+ if ( iG2 )
+ {
+ delete iG2;
+ iG2 = NULL;
+ }
+
+ if ( iU1)
+ {
+ delete iU1;
+ iU1 = NULL;
+ }
+
+ if ( iU2 )
+ {
+ delete iU2;
+ iU2 = NULL;
+ }
+
+ ((CSvgDocumentImpl*)OwnerDocument())->RemoveInternalMouseListener( this );
+ // The Font is owned by TextElement
+ // now as each text element may have its own specific font
+ // and keeping one copy at Gc level will not work.
+ // Gc is just refering to the Font from Textelement, so
+ // need to free it here. Note the iWsSceenDevice initialisation
+ // was done in draw as it needs to happens in main thread in case
+ // of progressive rendering.
+ //
+ if (iBitmapFont)
+ {
+ CSvgBitmapFontProvider *tempBitmapFontProvider = ((CSvgDocumentImpl*)iOwnerDocument)->GetBitmapFontProvider();
+ tempBitmapFontProvider->ReleaseFont(iBitmapFont);
+ iBitmapFont = NULL;
+
+ }
+
+ if ( iSvgStyleProperties )
+ {
+ iSvgStyleProperties->Close();
+ delete iSvgStyleProperties;
+ iSvgStyleProperties = NULL;
+ }
+
+ }
+
+
+// *******************************************************
+// From SVG DOM
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt32 CSvgTextElementImpl::NumberOfChars()
+ {
+ return iText->Length();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTextElementImpl::GetX( CArrayFix<TFloatFixPt>* aX )
+ {
+ if (aX->Count() > 0)
+ {
+ aX->At( 0 ) = iPoint.iX;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTextElementImpl::GetY( CArrayFix<TFloatFixPt>* aY )
+ {
+ if (aY->Count() > 0 )
+ {
+ aY->At( 0 ) = iPoint.iY;
+ }
+ }
+
+// *******************************************************
+// SVG Implementation
+
+TBool CSvgTextElementImpl::IsNumberAttributeValid( const TDesC& aValue )
+
+ {
+ TBool lValidAttr = EFalse;
+
+ if ( aValue.Length() > 0 )
+ {
+
+ TLex lInput ( aValue );
+
+ TChar tmpchar;
+ while ( lInput.Peek() != 0 )
+ {
+ tmpchar = lInput.Get();
+ if( !(tmpchar.IsDigit()) && !(tmpchar == '.') && !(tmpchar == '-') && !(tmpchar == ' ') )
+ {
+ lValidAttr = EFalse;
+ break;
+ }
+ lValidAttr = ETrue;
+ }
+
+ }
+
+ return lValidAttr;
+}
+
+// ---------------------------------------------------------------------------
+// xml:space is an inheritable attribute which can have one of two values:
+//
+// default (the initial/default value for xml:space) - When xml:space="default":
+// - Remove all newline characters.
+// - Convert all tab characters into space characters.
+// - Strip off all leading and trailing space characters.
+// - All contiguous space characters will be consolidated.
+//
+// preserve - When xml:space="preserve" :
+// - Convert all newline and tab characters into space characters.
+// ---------------------------------------------------------------------------
+void CSvgTextElementImpl::SetTextL( const TDesC& aText )
+ {
+ _LIT( KPreserve, "preserve" );
+ _LIT( KDefault, "default");
+ if ( iText )
+ {
+ delete iText;
+ iText = NULL;
+ }
+
+ iText = aText.AllocL();
+ TPtr textDes = iText->Des();
+ TBool def = ETrue;
+
+ // Get the xml:space value.
+ TBuf<20> lXmlspace;
+
+ if(XMLSpace() == KPreserve)
+ {
+ lXmlspace=KPreserve;
+ def=EFalse;
+ }
+ else if(XMLSpace() == KDefault)
+ {
+ lXmlspace=KDefault;
+ }
+ // xml:space is inherited if not specified
+ if ( lXmlspace!= KPreserve && lXmlspace != KDefault)
+ {
+ // Traverse to the nearest parent element which has the xml:space
+ // If no xml:space then render using xml:space="default"
+ CSvgElementImpl *lRoot=(CSvgElementImpl *)this->ParentNode();
+ while(lRoot)
+ {
+ if ((lRoot->XMLSpace() == KPreserve))
+ {
+ def = EFalse;
+ break;
+ }
+ else if(lRoot->XMLSpace()==KDefault)
+ {
+ break;
+ }
+ lRoot=(CSvgElementImpl *)lRoot->ParentNode();
+ }
+
+ }
+
+ _LIT(KSpace, " ");
+ // default
+ if ( def && lXmlspace != KPreserve )
+ {
+
+ // Remove leading, trailing and contiguous spaces
+ textDes.TrimAll();
+
+ for (TInt i = textDes.Length() - 1; i >= 0; i--)
+ {
+
+ // Remove new line character
+ if (textDes[i] == '\n' ||
+ textDes[i] == '\r')
+ {
+ textDes.Delete(i,1);
+ }
+
+ // Tab to be replaced with space.
+ if(textDes[i] == '\t')
+ {
+ textDes.Replace(i,1,KSpace);
+ }
+ }
+ }
+ // preserve
+ else
+ {
+
+ for ( TInt i = 0; i < textDes.Length(); i++ )
+ {
+ // ms-dos carriage return contains two characters: 13, 10
+ const TInt KCarriageReturn1 = 13;
+ const TInt KCarriageReturn2 = 10;
+
+ if ( i + 1 < textDes.Length() &&
+ (TInt)textDes[i] == KCarriageReturn1 &&
+ (TInt)textDes[i+1] == KCarriageReturn2 )
+ {
+ textDes[i] = ' ';
+ textDes.Delete( i+1, 1 );
+ }
+
+ // New line and tab should be replaced by space character.
+ if (textDes[i] == '\n' ||textDes[i] == '\t')
+ {
+ textDes.Replace(i,1, KSpace);
+ }
+ }
+ }
+
+ iUseDefaultSVGFont = IsMostBasicLatin();
+ iNeedToCacheGlyphs = ETrue;
+ }
+
+void CSvgTextElementImpl::CacheGlyphsForText()
+{
+ if (!iNeedToCacheGlyphs || iText == NULL || iText->Length() == 0 || iSVGFont == NULL)
+ {
+ return;
+ }
+ // Reset the cache first
+ iGlyphElements.Reset();
+ //initialize the glyph elements cache array...this seems expensive any other way to do this
+ TInt textLength = iText->Length();
+ for (TInt j = 0; j < textLength; j++)
+ {
+ //it might actually be better to put a ptr to missing glyph in here instead of null
+ iGlyphElements.Append(NULL);
+ }
+
+ //we have an svg font...
+ if ( iSVGFont->HasChildNodes() )
+ {
+ /*******************************/
+ /* Text Caching functionality, */
+ /*******************************/
+
+ CSvgElementImpl* lFirstChild = ( CSvgElementImpl * ) iSVGFont->FirstChild();
+
+ while ( lFirstChild != NULL )
+ {
+ /***********************/
+ /*CACHING HKERN ELEMENT*/
+ /***********************/
+ if( lFirstChild->ElemID() == KSvgHkernElement)
+ {
+ //1 per font
+ iHkernElement = lFirstChild;
+ }
+
+ /******************************/
+ /*CACHING MISSINGGLYPH ELEMENT*/
+ /******************************/
+
+ if ( lFirstChild->ElemID() == KSvgMissingglyphElement)
+ {
+ //1 per font
+ iMissingGlyphElement = lFirstChild;
+ }
+
+ /***********************/
+ /* FONTFACE ELEMENT */
+ /***********************/
+
+ if ( lFirstChild->ElemID() == KSvgFontfaceElement )
+ {
+ //1 per font
+ iFontFaceElement = lFirstChild;
+ }
+
+ /***********************/
+ /* CACHE GLYPH ELEMENT */
+ /***********************/
+
+ if ( lFirstChild->ElemID() == KSvgGlyphElement)
+ {
+ TPtrC16 lUnicode;
+ lFirstChild->GetAttributeDes( KAtrUnicode, lUnicode );
+
+ TPtr textDes = iText->Des();
+
+ TPtrC lLangCode;
+ TInt langCodeFound = 0;
+
+ TInt checkErrorLangCode = lFirstChild->GetAttributeDes( KAtrLang, lLangCode);
+
+ if (checkErrorLangCode != KErrNoAttribute)
+ {
+ TPtrC lXmlLangAttr(this->XMLLang());
+ langCodeFound = lLangCode.CompareF( lXmlLangAttr );
+ }
+
+ TInt textLength = iText->Length();
+ for (TInt i=0; i < textLength; i++)
+ {
+ //this probably isnt right i think one of these is a string that needs to be an int
+ if ( textDes[i] == lUnicode[0] && langCodeFound == 0)
+ {
+ //then this text string uses this glyph and we need to cache it in each spot it is used
+ iGlyphElements[i] = lFirstChild;
+ }
+ }
+ }
+
+ lFirstChild = ( CSvgElementImpl* ) lFirstChild->NextSibling();
+ }
+ }
+
+ iNeedToCacheGlyphs = EFalse;
+}
+
+TBool CSvgTextElementImpl::IsMostBasicLatin()
+{
+ //check to see if all basic latin characters
+ if (iText == NULL || iText->Length() == 0)
+ {
+ return EFalse;
+ }
+
+ TPtr textDes = iText->Des();
+
+ TInt lOutOfLatinCount = 0;
+
+ TInt textDesLength = textDes.Length();
+ for (TInt i=0; i< textDesLength; i++)
+ {
+ if (!((TInt)textDes[i] <= 0x007F))
+ {
+ lOutOfLatinCount++;
+ break;
+ }
+ }
+
+ //make sure that at least half arent outside of basic latin characters
+ if (lOutOfLatinCount > (textDes.Length() / 2) )
+ {
+ return EFalse;
+ }
+
+ return ETrue;
+}
+
+TDesC& CSvgTextElementImpl::GetText()
+{
+ return *iText;
+}
+
+void CSvgTextElementImpl::SetFont(CFont* aBitmapFont, CSvgElementImpl* aSVGFont)
+{
+ if (aBitmapFont != NULL)
+ {
+ iBitmapFont = aBitmapFont;
+ }
+ if (aSVGFont != NULL)
+ {
+ iSVGFont = aSVGFont;
+ }
+}
+
+TBool CSvgTextElementImpl::HasFont()
+{
+ if (iBitmapFont || iSVGFont)
+ {
+ return ETrue;
+ }
+ else
+ {
+ return EFalse;
+ }
+}
+
+
+void CSvgTextElementImpl::FreeFontData()
+{
+
+ if (iBitmapFont)
+ {
+ CSvgBitmapFontProvider *tempBitmapFontProvider = ((CSvgDocumentImpl*)iOwnerDocument)->GetBitmapFontProvider();
+ tempBitmapFontProvider->ReleaseFont(iBitmapFont);
+ iBitmapFont = NULL;
+
+ }
+
+}
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTextElementImpl::SetFontFamilyL( const TDesC& aValue )
+ {
+ //May not need to be called every frame, the CSS value is stored on the element level
+
+ TInt pos;
+ if ( iFamilies )
+ {
+ iFamilies->Reset();
+ delete iFamilies;
+ iFamilies = NULL;
+ }
+ iFamilies = new ( ELeave ) CDesCArrayFlat( 1 );
+ TStringTokenizer tkn ( aValue, _L( "," ) );
+
+ _LIT( KQuote, "'" );
+ while ( tkn.HasMoreTokens() )
+ {
+ TPtrC lToken = tkn.NextToken();
+ pos = lToken.Find( KQuote );
+ TLex lStr( lToken );
+
+ const TChar KQuoteChar( '\'' );
+ if ( pos == KErrNotFound )
+ {
+ lStr.SkipSpaceAndMark(); //Skip whitespaces at beginning of font-family value
+ while (lStr.Get()) //get the remaining string from Mark
+ {
+ }
+ lStr.UnGet(); //"back" up one character
+
+ const TChar KWhiteSpaceChar( ' ' );
+
+ while (lStr.Peek() == KWhiteSpaceChar) //for multi white spaces at the end
+ {
+ lStr.UnGet();
+ }
+ //Token length = iNext pos - iMark pos
+ lStr.Inc(); //Increment iNext position by 1 to "include" iNext
+
+ }
+ else
+ {
+ pos++;
+ lStr.SkipAndMark( pos );
+ lStr.Inc( pos );
+ while ( lStr.Get() != KQuoteChar )
+ {
+ }
+ lStr.UnGet();
+ }
+ TPtrC lFontFamily = lStr.MarkedToken();
+ iFamilies->AppendL( lFontFamily );
+ }
+
+ //default font added to end here...
+ iFamilies->AppendL( KDefaultFont ); // _L("DefaultFont"));
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTextElementImpl::SetRotateL( const TDesC& aValue )
+ {
+ iArrayRotate = new ( ELeave ) CArrayFixFlat<TReal32>( 1 );
+ TStringTokenizer tkn ( aValue, _L( ", " ) );
+
+ TInt lCount = 0;
+
+ while ( tkn.HasMoreTokens() )
+ {
+ TPtrC lToken = tkn.NextToken();
+ TLex lString ( lToken );
+ TReal32 val;
+ if (lString.Val( val, '.' ) == KErrNone)
+ {
+ iArrayRotate->AppendL( val );
+ lCount++;
+ }
+ }
+
+ if( lCount == 0)
+ {
+ if ( iArrayRotate )
+ {
+ iArrayRotate->Reset();
+ delete iArrayRotate;
+ iArrayRotate = NULL;
+ }
+ }
+
+ }
+
+// ---------------------------------------------------------------------------
+//AA: Generic function to parse the "x" or "y" coordinate values
+// ---------------------------------------------------------------------------
+void CSvgTextElementImpl::SetArrayL( const TDesC& aValue , const TBool aIsX)
+ {
+
+ CArrayFixFlat<TFloatFixPt>* lArray;
+ TFloatFixPt lPt;
+ // the flag is used to determine which coodinate needs to be processed
+ if(aIsX)
+ {
+ lArray=iArrayX;
+ lPt=iPoint.iX;
+
+ }
+ else
+ {
+ lArray=iArrayY;
+ lPt=iPoint.iY;
+ }
+
+ if ( lArray )
+ {
+ lArray->Reset();
+ delete lArray;
+ lArray = NULL;
+ }
+
+ lArray = new ( ELeave ) CArrayFixFlat<TFloatFixPt>( 1 );
+CleanupStack::PushL(lArray);
+
+ if( (aValue.Length() > 0 ) && ( IsNumberAttributeValid(aValue) ) )
+ {
+ TStringTokenizer tkn ( aValue, _L( ", " ) );
+
+ TInt lFirstXY = 0;
+
+ TInt lCount = 0;
+
+ while ( tkn.HasMoreTokens() )
+ {
+ TPtrC lToken = tkn.NextToken();
+ TLex lString ( lToken );
+ TReal32 val;
+ if (lString.Val( val, '.' ) == KErrNone)
+ {
+ if( val < -32765 )
+ val = -32765;
+ if( val > 32765 )
+ val = 32765;
+
+ if ( lFirstXY == 0 )
+ {
+ lPt = val;
+ lFirstXY = 1;
+ }
+
+ lArray->AppendL( ( TFloatFixPt ) val );
+ lCount++;
+ }
+ }
+
+ if( lCount == 0)
+ {
+ lPt = TFloatFixPt( 0 );
+ lArray->AppendL( ( TFloatFixPt ) 0 );
+ }
+ }
+ else
+ {
+ lPt = TFloatFixPt( 0 );
+ lArray->AppendL( ( TFloatFixPt ) 0 );
+
+ }
+CleanupStack::Pop(lArray);
+
+ if(aIsX)
+ {
+ iPoint.iX = lPt;
+ iArrayX = lArray;
+ }
+ else
+ {
+ iPoint.iY = lPt;
+ iArrayY = lArray;
+ }
+ // In case of fewer x and more y and
+ // fewer y and more x, we need to append the last value of the
+ // coordinate to the corresponding array to be used for all the
+ // remaining characters.
+ if ( iArrayY && iArrayX )
+ {
+
+ TInt xCount=iArrayX->Count();
+ TInt yCount=iArrayY->Count();
+ TInt charCount=iText->Length();
+
+ // Either x or y should be having valid values.
+ if(xCount>0 || yCount>0)
+ {
+ // Text has more characters than the x or y values.
+ if(charCount>xCount||charCount>yCount)
+
+ {
+ // More y than x and More characters than x append last
+ // value of the x coordinate.
+ if((yCount>=xCount) && (charCount>xCount))
+ {
+ iArrayX->AppendL(iArrayX->At(xCount-1), (charCount-xCount));
+ }
+ // More x than y and More characters than y append last
+ // value of the y coordinate.
+ if((yCount<=xCount) && (charCount>yCount))
+ {
+ iArrayY->AppendL(iArrayY->At(yCount-1), (charCount-yCount));
+ }
+ }
+
+ }
+ }
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTextElementImpl::SetX( CArrayFix<TFloatFixPt>* aX )
+ {
+ if (aX->Count() > 0)
+ {
+ iPoint.iX = aX->At( 0 );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTextElementImpl::SetY( CArrayFix<TFloatFixPt>* aY )
+ {
+ if (aY->Count() > 0)
+ {
+ iPoint.iY = aY->At( 0 );
+ }
+ }
+
+// *******************************************************
+// From MXmlElement
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgTextElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+ return KErrNone;
+ }
+
+
+// *******************************************************
+// From MXmlElementOpt
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgTextElementImpl::GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrX:
+ case KAtrRefX:
+ aValue = iPoint.iX;
+ break;
+ case KAtrY:
+ case KAtrRefY:
+ aValue = iPoint.iY;
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgTextElementImpl::SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrX:
+ {
+ iPoint.iX = aValue;
+ if(!iArrayX)
+ {
+ iArrayX= new ( ELeave ) CArrayFixFlat<TFloatFixPt>( 1 );
+ }
+
+ iArrayX->Reset();
+ iArrayX->AppendL((TFloatFixPt)aValue);
+ }
+ break;
+ case KAtrY:
+ {
+ iPoint.iY = aValue;
+ if(!iArrayY)
+ {
+ iArrayY= new ( ELeave ) CArrayFixFlat<TFloatFixPt>( 1 );
+ }
+
+ iArrayY->Reset();
+ iArrayY->AppendL((TFloatFixPt)aValue);
+ }
+ break;
+
+
+ default:
+ return CSvgElementImpl::SetAttributeFloatL( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgTextElementImpl::GetAttributeDes( const TInt aNameId, TPtrC16& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrCdata:
+ aValue.Set(*iText);
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeDes( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgTextElementImpl::SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrCdata:
+ SetTextL( aValue );
+ break;
+
+ case KAtrX:
+ SetArrayL(aValue, ETrue);
+ break;
+
+ case KAtrY:
+ SetArrayL(aValue, EFalse);
+ break;
+
+ case KAtrRotate:
+ SetRotateL( aValue );
+ break;
+
+ default:
+ return CSvgElementImpl::SetAttributeDesL( aNameId, aValue );
+ }
+
+ // check first character is number or '.'
+ if ( aNameId == KAtrX || aNameId == KAtrY )
+ {
+ if ( aValue.Length() == 0 ||
+ ( !TChar( aValue[0] ).IsDigit() && aValue[0] != '.' && aValue[0] != '-') )
+ {
+ if ( iOwnerDocument )
+ {
+ _LIT( KMsg, "Invalid value-string for number attribute: " );
+ ((CSvgDocumentImpl*)iOwnerDocument)->SetError( KErrNotFound, KMsg, aValue );
+ }
+ }
+ }
+ return KErrNone;
+ }
+
+
+// ---------------------------------------------------------------------------
+// This is a Local Function.
+// Checks to see if the given character is within the SVG Font's Unicode Range.*
+// Only the following formats are allowed for "unicode-range" attribute
+// Single numbers: U+20A7 | U+215? | U+00?? | U+E??
+// Pair of numbers: U+AC00-D7FF | U+F9000-FAFF
+// ---------------------------------------------------------------------------
+TBool CSvgTextElementImpl::IsWithinUnicodeRange( const TDesC& aUnicodeRange,
+ const TDesC& aCharacter )
+ {
+ _LIT( KQQ, "??" );
+ _LIT( KQ, "?" );
+ _LIT( KF, "F" );
+ _LIT( KFF, "FF" );
+ _LIT( KLitZero, "0" );
+ _LIT( KZZero, "00" );
+ _LIT( KHyph, "-" );
+ _LIT( KUni, "U+" );
+
+ TUint32 lStartRange = 0;
+ TUint32 lEndRange = 65536;
+
+ TUint32 lCharacter = ( TUint32 ) aCharacter.operator[]( 0 );
+
+ TBuf<11> lUnicodeRange;
+
+ if(aUnicodeRange.Length() <= 11)
+ lUnicodeRange = aUnicodeRange; //Max.Length "U+00AB-00AF"
+ else
+ return EFalse; //Length is greater than 11.
+
+ TInt pos;
+
+
+ //Removing "U+"
+ pos = lUnicodeRange.Find( KUni );
+ if ( pos != KErrNotFound )
+ lUnicodeRange.Delete( pos, 2 );
+ else
+ return EFalse; // Not a valid unicode range, i.e. not "U+" element
+
+ //Finding "-", if yes, then pair found.
+ pos = lUnicodeRange.Find( KHyph );
+ if ( pos != KErrNotFound )//found
+ {
+ TPtrC lStartString = lUnicodeRange.Left( pos );
+ TLex lStart ( lStartString );
+ if (lStart.Val( lStartRange, EHex ) != KErrNone)
+ lStartRange=0;
+
+ TPtrC lEndString = lUnicodeRange.Right( lUnicodeRange.Length() -
+ pos -
+ 1 );
+ TLex lEnd ( lEndString );
+ if (lEnd.Val( lEndRange, EHex ) != KErrNone)
+ lEndRange= 65536;
+ }
+ else //single number
+ {
+ pos = lUnicodeRange.Find( KQQ );
+ if ( pos != KErrNotFound )
+ {
+ lUnicodeRange.Replace( pos, 2, KZZero );
+ TPtrC lStartString = lUnicodeRange.Left( pos + 2 );
+ TLex lStart ( lStartString );
+ if (lStart.Val( lStartRange, EHex ) != KErrNone)
+ lStartRange=0;
+
+ lUnicodeRange.Replace( pos, 2, KFF );
+ TPtrC lEndString = lUnicodeRange.Left( pos + 2 );
+ TLex lEnd ( lEndString );
+ if (lEnd.Val( lEndRange, EHex ) != KErrNone)
+ lEndRange= 65536;
+ }
+
+ else if ( (pos = lUnicodeRange.Find( KQ ) ) != KErrNotFound )
+ {
+ lUnicodeRange.Replace( pos, 1, KLitZero );
+ TPtrC lStartString = lUnicodeRange.Left( pos + 1 );
+ TLex lStart ( lStartString );
+ if (lStart.Val( lStartRange, EHex ) != KErrNone)
+ lStartRange=0;
+
+ lUnicodeRange.Replace( pos, 1, KF );
+ TPtrC lEndString = lUnicodeRange.Left( pos + 1 );
+ TLex lEnd ( lEndString );
+ if (lEnd.Val( lEndRange, EHex ) != KErrNone)
+ lEndRange= 65536;
+ }
+ else
+ {
+ TLex lEnd ( lUnicodeRange );
+ if (lEnd.Val( lEndRange, EHex ) != KErrNone)
+ lEndRange= 65536;
+ lStartRange = lEndRange;
+ }
+ }
+
+ if ( ( lCharacter >= lStartRange ) && ( lCharacter <= lEndRange ) )
+ return ETrue;
+ else
+ return EFalse;
+ }
+
+//Method to set kerning pairs u1 and u2.
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTextElementImpl::SetUKernPairsL( const TDesC& aU1, const TDesC& aU2 )
+ {
+ if(iU1)
+ {
+ delete iU1;
+ iU1 = NULL;
+ }
+ iU1 = aU1.AllocL();
+ if(iU2)
+ {
+ delete iU2;
+ iU2 = NULL;
+ }
+ iU2 = aU2.AllocL();
+
+ }
+
+
+//Method to set kerning pairs g1 and g2.
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTextElementImpl::SetGKernPairsL( const TDesC& aG1, const TDesC& aG2 )
+ {
+
+ if(iG1)
+ {
+ delete iG1;
+ iG1 = NULL;
+ }
+ iG1 = aG1.AllocL();
+
+ if(iG2)
+ {
+ delete iG2;
+ iG2 = NULL;
+ }
+ iG2 = aG2.AllocL();
+
+ }
+
+
+// ---------------------------------------------------------------------------
+// This method checks to see whether kerning is required.
+// ---------------------------------------------------------------------------
+TBool CSvgTextElementImpl::IsKerningRequired( const TDesC& aPrevGlyphName,
+ const TDesC& aCurrGlyphName,
+ const TDesC& aPrevUnicode,
+ const TDesC& aCurrUnicode )
+ {
+ _LIT( KGlyphNameNone, "GlyphNameNone");
+ TBool lFoundG1(EFalse);
+ TBool lFoundG2(EFalse);
+ TBool lFoundU1(EFalse);
+ TBool lFoundU2(EFalse);
+
+ //Finding G1
+ if( aPrevGlyphName != KGlyphNameNone)
+ {
+ TStringTokenizer tkn1 ( iG1->Des(), _L( "," ) );
+ while ( tkn1.HasMoreTokens() )
+ {
+ TPtrC lToken = tkn1.NextToken();
+ if( (lToken.Compare(aPrevGlyphName)) == 0 )
+ {
+ lFoundG1 = ETrue;
+ break;
+ }
+ }
+ }
+ //Finding G2
+ if( aCurrGlyphName != KGlyphNameNone)
+ {
+ TStringTokenizer tkn2 ( iG2->Des(), _L( "," ) );
+ while ( tkn2.HasMoreTokens() )
+ {
+ TPtrC lToken = tkn2.NextToken();
+ if( (lToken.Compare(aCurrGlyphName)) == 0 )
+ {
+ lFoundG2 = ETrue;
+ break;
+ }
+ }
+ }
+ //Finding U1
+ TStringTokenizer tkn3 ( iU1->Des(), _L( "," ) );
+ while ( tkn3.HasMoreTokens() )
+ {
+
+ TPtrC lToken = tkn3.NextToken();
+
+ if( lToken.Length() == 1) //Unicode character
+ {
+ if( (lToken.Compare(aPrevUnicode.Right(1))) == 0 )
+ {
+ lFoundU1 = ETrue;
+ break;
+ }
+
+ }
+ else // Unicode Range
+ {
+ if(IsWithinUnicodeRange( lToken, aPrevUnicode ))
+ lFoundU1 = ETrue;
+ break;
+ }
+
+ }
+
+ //Finding U2
+ TStringTokenizer tkn4 ( iU2->Des(), _L( "," ) );
+ while ( tkn4.HasMoreTokens() )
+ {
+
+ TPtrC lToken = tkn4.NextToken();
+
+ if( lToken.Length() == 1) //Unicode character
+ {
+ if( (lToken.Compare(aCurrUnicode.Left(1))) == 0 )
+ {
+ lFoundU2 = ETrue;
+ break;
+ }
+
+ }
+ else // Unicode Range
+ {
+ if(IsWithinUnicodeRange( lToken, aCurrUnicode ))
+ {
+ lFoundU2 = ETrue;
+ break;
+ }
+ }
+
+ }
+
+ if ( (lFoundG1 || lFoundU1) && (lFoundG2 || lFoundU2) )
+ return ETrue;
+ else
+ return EFalse;
+ }
+
+
+// *******************************************************
+// From CSvgElementImpl
+
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgTextElementImpl::CloneL(MXmlElement* aParentElement)
+ {
+
+ CSvgTextElementImpl* newElement = CSvgTextElementImpl::NewL( this->ElemID(), ((CSvgDocumentImpl*)iOwnerDocument) );
+
+ CleanupStack::PushL(newElement);
+ newElement->iParentNode = aParentElement;
+ // copy everything over
+ this->CopyL(newElement);
+ CleanupStack::Pop();
+ return newElement;
+ }
+
+// ---------------------------------------------------------------------------
+// perform a deep copy of this object
+// ---------------------------------------------------------------------------
+void CSvgTextElementImpl::CopyL( CSvgTextElementImpl* aDestElement )
+ {
+ if(aDestElement)
+ {
+
+ // copy stuff from superclass
+ this->CSvgElementImpl::CopyL(aDestElement);
+
+ if(this->iText)
+ {
+ delete aDestElement->iText;
+ aDestElement->iText= NULL;
+ aDestElement->iText= (this->iText)->AllocL();
+ }
+ aDestElement->iPoint.iX= this->iPoint.iX;
+ aDestElement->iPoint.iY= this->iPoint.iY;
+
+ aDestElement->iLetterSpacing= this->iLetterSpacing;
+ aDestElement->iWordSpacing= this->iWordSpacing;
+ aDestElement->iRotate= this->iRotate;
+
+ //iFamilies
+ if(this->iFamilies)
+ {
+ TInt lCount= (this->iFamilies)->Count();
+ if(lCount)
+ {
+ if(aDestElement->iFamilies)
+ {
+ aDestElement->iFamilies->Reset();
+ delete aDestElement->iFamilies;
+ aDestElement->iFamilies = NULL;
+ }
+ aDestElement->iFamilies = new ( ELeave ) CDesCArrayFlat( 1 );
+ for(TInt i=0; i<lCount; i++)
+ {
+ TPtrC lPtr= (this->iFamilies)->operator[](i);
+ aDestElement->iFamilies->AppendL(lPtr);
+ }
+ }
+ }
+
+ //iArraX
+ if(this->iArrayX)
+ {
+ TInt lCount= (this->iArrayX)->Count();
+ if(lCount)
+ {
+ if(aDestElement->iArrayX)
+ {
+ aDestElement->iArrayX->Reset();
+ delete aDestElement->iArrayX;
+ aDestElement->iArrayX = NULL;
+ }
+ aDestElement->iArrayX = new ( ELeave ) CArrayFixFlat<TFloatFixPt>( 1 );
+ for(TInt i=0; i<lCount; i++)
+ {
+ TFloatFixPt lFix= (this->iArrayX)->operator[](i);
+ aDestElement->iArrayX->AppendL(lFix);
+ }
+ }
+ }
+
+ //iArrayY
+ if(this->iArrayY)
+ {
+ TInt lCount= (this->iArrayY)->Count();
+ if(lCount)
+ {
+ if(aDestElement->iArrayY)
+ {
+ aDestElement->iArrayY->Reset();
+ delete aDestElement->iArrayY;
+ aDestElement->iArrayY = NULL;
+ }
+ aDestElement->iArrayY = new ( ELeave ) CArrayFixFlat<TFloatFixPt>( 1 );
+ for(TInt i=0; i<lCount; i++)
+ {
+ TFloatFixPt lFix= (this->iArrayY)->operator[](i);
+ aDestElement->iArrayY->AppendL(lFix);
+ }
+ }
+ }
+
+ // iArrayRotate
+ if(this->iArrayRotate)
+ {
+ TInt lCount= (this->iArrayRotate)->Count();
+ if(lCount)
+ {
+ if(aDestElement->iArrayRotate)
+ {
+ aDestElement->iArrayRotate->Reset();
+ delete aDestElement->iArrayRotate;
+ aDestElement->iArrayRotate = NULL;
+ }
+ aDestElement->iArrayRotate = new ( ELeave ) CArrayFixFlat<TReal32>( 1 );
+ for(TInt i=0; i<lCount; i++)
+ {
+ TReal32 lFix= (this->iArrayRotate)->operator[](i);
+ aDestElement->iArrayRotate->AppendL(lFix);
+ }
+ }
+ }
+
+///////////////////Cloning the glyph elements///////////////////////
+ TInt lCount= (this->iGlyphElements).Count();
+ if(lCount)
+ {
+ for(TInt i=0; i<lCount; i++)
+ {
+ CSvgElementImpl* element = (this->iGlyphElements).operator[](i);
+ aDestElement->iGlyphElements.AppendL(element);
+ }
+ }
+
+
+ aDestElement->iNeedToCacheGlyphs = this->iNeedToCacheGlyphs;
+
+//////////////////////////////////////////////////////////////////////
+ aDestElement->iTextAnchor= this->iTextAnchor;
+ aDestElement->iTextDecoration= this->iTextDecoration;
+
+ if(this->iG1)
+ {
+ delete aDestElement->iG1;
+ aDestElement->iG1= NULL;
+ aDestElement->iG1= (this->iG1)->AllocL();
+ }
+
+ if(this->iG2)
+ {
+ delete aDestElement->iG2;
+ aDestElement->iG2= NULL;
+ aDestElement->iG2= (this->iG2)->AllocL();
+ }
+
+ if(this->iU1)
+ {
+ delete aDestElement->iU1;
+ aDestElement->iU1= NULL;
+ aDestElement->iU1= (this->iU1)->AllocL();
+ }
+
+ if(this->iU2)
+ {
+ delete aDestElement->iU2;
+ aDestElement->iU2= NULL;
+ aDestElement->iU2= (this->iU2)->AllocL();
+ }
+
+ //Note that copying iBitmapFont from one text element to
+ //another, there is danger of double free. Let new element
+ //get its own Font pointer. Anyway it just updates the
+ //access count on the server side if two fonts are same.
+ //aDestElement->iBitmapFont= this->iBitmapFont;
+ aDestElement->iBitmapFont= NULL;
+
+
+ // copy the reference to idoc (CSvgDocumentImpl)
+ aDestElement->iOwnerDocument = this->iOwnerDocument;
+ }
+
+ }
+
+// ---------------------------------------------------------------------------
+// This Method is used to draw the TEXT described within the <text> element.
+// There are 2 types of Fonts used to render the text. First, the family-name
+// is checked to see if there exists a SVG FONT defined within the SVG File.
+// If there is one, then text is rendered using this font, else the text is
+// rendered using the Bitmap system fonts using the Drawstring() in Gfx2D.
+// ---------------------------------------------------------------------------
+TBool CSvgTextElementImpl::DrawL( CGfx2dGc* aGc, CSvgElementImpl* aElement )
+{
+ if (iText->Length() == 0)
+ {
+ return EFalse;
+ }
+
+ // Reset and set GC
+ this->DrawShapeL( aGc, aElement );
+ //if ( !aGc->RenderingHints()->Visibility() )
+ // return EFalse; // Do nothing if visibility is False.
+
+
+ TInt8 lTextDecoration = (TInt8)
+ (((CIntCssValueImpl *)(iSvgStyleProperties->operator[](KCSS_ATTR_TEXTDECORATION)))->Value());
+
+ TInt8 lTextAnchor =(TInt8)(
+ ((CIntCssValueImpl *)(iSvgStyleProperties->operator[](KCSS_ATTR_TEXTANCHOR)))->Value());
+
+/**********************************************************/
+/* ROM Configuration Flag whether to include SVG FONTS */
+/**********************************************************/
+
+ //get the scaling factor currently in the graphics library.
+
+ TFloatFixPt KZero;
+
+ //CSvgElementImpl* lFirstChild = NULL;
+ CGfxGeneralPath* lShape = NULL;
+ CGfxGeneralPath* lShapeMG = NULL;
+ TFloatFixPt origX ( iPoint.iX );
+ TFloatFixPt currentPosOrigX( iPoint.iX );
+ /*iSVGBbox.iX = iPoint.iX;
+ iSVGBbox.iY = iPoint.iY;
+ iSVGBbox.iWidth = 0;*/
+ TFloatFixPt currentPosOrigY( iPoint.iY );
+ TFloatFixPt lUnitsPerEm( 1000 );
+ TFloatFixPt lAlphabetic( 0 );
+ TFloatFixPt lFontHorzOrgX( 0 );
+ TFloatFixPt lFontHorzAdvX( 0 );
+ TFloatFixPt lMissingGlyphHorzAdvX( 0 );
+ TFloatFixPt lFontSize( 10 );
+ TPtrC lFontFamily;
+ TPtrC16 lUnicode;
+ TPtrC16 lPrevUnicode;
+ TPtrC16 lUnicodeRange; //Max.Length "U+00AB-00AF"
+ TPtrC16 lLangCode; //ex: en-US or en-GB or ja-JP or zh-CN or en....
+ TPtrC16 lG1;
+ TPtrC16 lG2;
+ TPtrC16 lU1;
+ TPtrC16 lU2;
+ TPtrC16 lPrevGlyphName;
+ TPtrC16 lCurrGlyphName;
+ TFloatFixPt lK; //kerning purpose....
+
+ TFloatFixPt lAscent( KZero );
+ TFloatFixPt lDescent( KZero );
+ TFloatFixPt lUnderlinePosition( KZero );
+ TFloatFixPt lUnderlineThickness( KZero );
+ TFloatFixPt lOverlinePosition( KZero );
+ TFloatFixPt lOverlineThickness( KZero );
+ TFloatFixPt lStrikethroughPosition( KZero );
+ TFloatFixPt lStrikethroughThickness( KZero );
+ TFloatFixPt lTotalTextAdvance ( KZero );
+
+ //Getting font-size property
+
+ CCssValue* lCssValue = NULL;
+ this->FindProperty( KCSS_ATTR_FONTSIZE, lCssValue, aElement );
+ if ( lCssValue )
+ {
+ lFontSize = (( CFloatCssValueImpl * ) lCssValue )->Value();
+ if(lFontSize <= KZero )
+ lFontSize = TFloatFixPt ( 10 );
+ }
+
+ //Getting font-family property
+ this->FindProperty( KCSS_ATTR_FONTFAMILY, lCssValue, aElement );
+ if ( lCssValue && ((( CStrCssValueImpl * ) lCssValue )->Value()).Length() != 0)
+ {
+ lFontFamily.Set( ( ( CStrCssValueImpl * ) lCssValue )->Value() );
+ SetFontFamilyL( lFontFamily );
+ }
+
+
+ //attempt to load svg font files of same font family name
+ //this boolean will be a problem if we want to be able to swap
+ //font-family names on the fly and use svg fonts.
+ if (!iTriedLoadingSVGFonts)
+ {
+ LoadExternalSVGFontL(lFontFamily);
+ iTriedLoadingSVGFonts = ETrue;
+ }
+
+ //Retrieving Font Element Pointer from the Font Table
+ //if font in svg document
+ iSVGFont = NULL;
+ if ( iFamilies != NULL )
+ {
+ TInt familiesCnt = iFamilies->Count();
+ for (int i=0; i< familiesCnt; i++)
+ {
+ iSVGFont = ( CSvgElementImpl * )
+ ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->iFontHashMap->GetFontPtr(iFamilies->operator[]( i ));
+
+ if (iSVGFont == NULL)
+ {
+ iSVGFont = ( CSvgElementImpl * )
+ ((CSvgDocumentImpl*)iOwnerDocument)->iFontHashMap->GetFontPtr( iFamilies->operator[]( i ) );
+ }
+
+ if (iSVGFont != NULL)
+ {
+ //found a font with that family name...continue
+ break;
+ }
+ }
+ }
+
+/**********************************************************/
+/* Checking for pre-defined SVG Fonts through the */
+/* retrieved pointer from the Font Table. */
+/* IF the Font is found (ptr!=NULL), SVG Fonts are used */
+/* ELSE Bitmap Font is used through DrawString() method */
+/**********************************************************/
+
+ if ( iSVGFont != NULL && iSVGFont->HasChildNodes())
+ {
+ TGfxAffineTransform currentTM;
+ //we found an svg font and are using it...
+
+ iSVGFont->GetAttributeFloat( KAtrHorizOriginX, lFontHorzOrgX );
+ iSVGFont->GetAttributeFloat( KAtrHorizAdvX, lFontHorzAdvX );
+ lMissingGlyphHorzAdvX = lFontHorzAdvX; //Default Value
+ TInt checkErrShapeMG = -1;//To keep a value other than KErrNone. Should this be replaced
+
+ if (iNeedToCacheGlyphs)
+ {
+ CacheGlyphsForText();
+ }
+
+ TFloatFixPt lUnitsPerEmInverse;
+ TFloatFixPt minusOne( -1 );
+
+ /***********************/
+ /* HKERN ELEMENT */
+ /***********************/
+ if (iHkernElement != NULL)
+ {
+ iHkernElement->GetAttributeFloat( KAtrK, lK );
+
+ TInt checkErrorG1 = iHkernElement->GetAttributeDes( KAtrG1, lG1);
+ TInt checkErrorG2 = iHkernElement->GetAttributeDes( KAtrG2, lG2);
+ TInt checkErrorU1 = iHkernElement->GetAttributeDes( KAtrU1, lU1);
+ TInt checkErrorU2 = iHkernElement->GetAttributeDes( KAtrU2, lU2);
+
+ if( (checkErrorG1 != KErrNoAttribute) && (checkErrorG2 != KErrNoAttribute) )
+ {
+ SetGKernPairsL( lG1, lG2);
+ }
+
+ if( (checkErrorU1 != KErrNoAttribute) && (checkErrorU2 != KErrNoAttribute) )
+ {
+ SetUKernPairsL( lU1, lU2);
+ }
+ }
+
+ /********************************/
+ /* Text Rendering functionality */
+ /*******************************/
+
+ /***********************/
+ /* MISSINGGLYPH ELEMENT*/
+ /***********************/
+ if (iMissingGlyphElement != NULL)
+ {
+ iMissingGlyphElement->GetAttributeFloat( KAtrHorizAdvX,
+ lMissingGlyphHorzAdvX );
+
+ if ( lMissingGlyphHorzAdvX == TFloatFixPt( 0 ) )
+ {
+ lMissingGlyphHorzAdvX = lFontHorzAdvX;
+ }
+
+ checkErrShapeMG = iMissingGlyphElement->GetAttributePath( KAtrData,
+ lShapeMG );
+ }
+
+ /***********************/
+ /* FONTFACE ELEMENT */
+ /***********************/
+
+ if (iFontFaceElement != NULL)
+ {
+ iFontFaceElement->GetAttributeFloat( KAtrUnitsPerEm,
+ lUnitsPerEm );
+
+ #ifdef SVG_FLOAT_BUILD
+ if ( lUnitsPerEm <= TFloatFixPt( 0 ) )
+ {
+ lUnitsPerEm = TFloatFixPt( 1000 );
+ }
+ #else
+ if ( lUnitsPerEm <= TFloatFixPt( 0,ETrue ) )
+ {
+ lUnitsPerEm = TFloatFixPt( 1000 );
+ }
+ #endif
+ lUnitsPerEmInverse = TFloatFixPt( 1 ) / lUnitsPerEm;
+
+ iFontFaceElement->GetAttributeFloat( KAtrAscent,
+ lAscent );
+
+ iFontFaceElement->GetAttributeFloat( KAtrDescent,
+ lDescent );
+
+ iFontFaceElement->GetAttributeFloat( KAtrUnderlinePosition,
+ lUnderlinePosition );
+
+ iFontFaceElement->GetAttributeFloat( KAtrUnderlineThickness,
+ lUnderlineThickness );
+
+ iFontFaceElement->GetAttributeFloat( KAtrOverlinePosition,
+ lOverlinePosition );
+
+ iFontFaceElement->GetAttributeFloat( KAtrOverlineThickness,
+ lOverlineThickness );
+
+ iFontFaceElement->GetAttributeFloat( KAtrStrikethroughPosition,
+ lStrikethroughPosition );
+
+ iFontFaceElement->GetAttributeFloat( KAtrStrikethroughThickness,
+ lStrikethroughThickness );
+
+ iFontFaceElement->GetAttributeFloat( KAtrAlphabetic,
+ lAlphabetic );
+ }
+
+ //Checking valid UnicodeRange of FontFace Element this is trying to limit the number that we have to search through
+ //but why do we need this in here
+
+ /*TInt checkErrorUnicodeRange = iFontFaceElement->GetAttributeDes( KAtrUnicodeRange,
+ lUnicodeRange );
+ if ( checkErrorUnicodeRange != KErrNoAttribute )
+ {
+ //Function call to unicode-range bounds.
+ if(!IsWithinUnicodeRange( lUnicodeRange,
+ outputChar ))
+ {
+ currentPosOrigX += ( lFontHorzAdvX * lUnitsPerEmInverse ) * lFontSize;
+ lIsWithinUnicodeRange = EFalse;
+ break;
+ }
+ }*/
+
+ //Text Anchor related.
+ //lTotalTextAdvance = lFontHorzAdvX * (TFloatFixPt)iText->Length() * lUnitsPerEmInverse * lFontSize;
+ // Calculate the exact total text advance instead of taking default per glyph
+ // advance which will approximate the value.
+ TFloatFixPt lGlyphHorzAdvX;
+ TInt langCodeFound( 0 );
+ // Calculate the total text advance in the following cases:
+ // a. Text Anchor is middle
+ // b. Text Anchor is end
+ // c. Text Decoration is needed( Underline/Overline/Strikethrough )
+ if( lTextAnchor == 1 || lTextAnchor == 2 || lTextDecoration != -1 )
+ {
+ lTotalTextAdvance= GetTotalTextAdvance(lK,lUnitsPerEmInverse,lFontSize,lMissingGlyphHorzAdvX,lFontHorzAdvX);
+ }
+
+ if( lTextAnchor == 1 )//Middle
+ {
+ currentPosOrigX -= (lTotalTextAdvance * TFloatFixPt(.5f));
+ origX -= (lTotalTextAdvance * TFloatFixPt(.5f));
+ }
+
+ if( lTextAnchor == 2 )//End
+ {
+ currentPosOrigX -= lTotalTextAdvance;
+ origX -= lTotalTextAdvance;
+ }
+ //else default:start
+
+ if( lAlphabetic != KZero )
+ {
+ //Should be rationally negative, but Adobe traverses positive.
+ currentPosOrigY += ( lAlphabetic * lUnitsPerEmInverse ) * lFontSize;
+ }
+
+ if( lFontHorzOrgX != KZero )
+ {
+ //Should be rationally positive, but Adobe traverses negative.
+ currentPosOrigX -= ( lFontHorzOrgX * lUnitsPerEmInverse ) * lFontSize;
+ origX -= ( lFontHorzOrgX * lUnitsPerEmInverse ) * lFontSize;
+ }
+
+ /***********************/
+ /* GLYPH ELEMENT */
+ /***********************/
+ //Assume that xml:lang matches lang code of glyph element.
+ //TInt lUnicodeLength( 0 );
+
+ //The x coordinate is needed to draw the text decorations.
+ if(iArrayX)
+ {
+ origX=iArrayX->At(0);
+ }
+ TInt glyphEleCnt = iGlyphElements.Count();
+ for (TInt i=0; i < glyphEleCnt; i++)
+ {
+ CSvgElementImpl* lGlyphElement = (CSvgElementImpl*)iGlyphElements[i];
+
+ if (lGlyphElement != NULL)
+ {
+ //have a valid glyph
+ TInt checkErrorUnicode = lGlyphElement->GetAttributeDes( KAtrUnicode,
+ lUnicode );
+ //check the glyph name
+ TInt checkErrorGlyphName = lGlyphElement->GetAttributeDes( KAtrGlyphName,
+ lCurrGlyphName );
+ if( checkErrorGlyphName == KErrNoAttribute )
+ {
+ lCurrGlyphName.Set( KGlyphNameNone );
+ }
+
+ //check its language
+ TInt checkErrorLangCode = lGlyphElement->GetAttributeDes( KAtrLang,
+ lLangCode );
+ TPtrC lXmlLangAttr(this->XMLLang());
+
+ if( checkErrorLangCode != KErrNoAttribute ) //if Lang code present
+ {
+ langCodeFound = lLangCode.CompareF( lXmlLangAttr );//compare xml:lang with Lang code.
+ }
+
+ //if Lang code is matching && unicode attr. present, we are good.
+ if ( (checkErrorUnicode != KErrNoAttribute) && (langCodeFound == 0) )
+ {
+ //Checking and Introducing kerning(adjusting spacing).
+ if( lPrevGlyphName.Length() > 0 )
+ {
+ if( IsKerningRequired( lPrevGlyphName, lCurrGlyphName, lPrevUnicode, lUnicode ))
+ {
+ currentPosOrigX -= ( lK * lUnitsPerEmInverse ) * lFontSize;
+ }
+ }
+
+ lGlyphElement->GetAttributeFloat( KAtrHorizAdvX,
+ lGlyphHorzAdvX );
+
+ #ifdef SVG_FLOAT_BUILD
+ if ( lGlyphHorzAdvX == TFloatFixPt( 0 ) )
+ #else
+ if ( lGlyphHorzAdvX == TFloatFixPt( 0,ETrue ) )
+ #endif
+ {
+ lGlyphHorzAdvX = /*(TFloatFixPt)lUnicodeLength **/ lFontHorzAdvX;
+ }
+
+ TInt checkErrorShape = lGlyphElement->GetAttributePath( KAtrData,
+ lShape );
+ /***********************/
+ /* Drawing the Glyph */
+ /***********************/
+ if ( checkErrorShape == KErrNone )
+ {
+ this->DrawShapeL( aGc, aElement );
+
+ // Fix for UMAA-753ARS
+ // Scale the strokewidth before applying
+ // the scaling for glyph
+ ScaleStrokeWidth(aGc);
+
+ // For multiple x, y get the current position
+ // from the array.
+ if((iArrayX != NULL ) && ( i< iArrayX->Count() ))
+ {
+ currentPosOrigX = iArrayX->At(i);
+ }
+ if((iArrayY!=NULL) && (i<iArrayY->Count() ) )
+ {
+ currentPosOrigY = iArrayY->At(i);
+ }
+
+ currentTM = this->GetCTM();
+
+ currentTM.Translate( currentPosOrigX,
+ currentPosOrigY );
+ currentTM.Scale( lUnitsPerEmInverse,
+ minusOne * lUnitsPerEmInverse );
+ currentTM.Scale( lFontSize, lFontSize );
+ aGc->SetTransform( currentTM );
+
+ aGc->DrawL( lShape );
+
+ lPrevUnicode.Set(lUnicode);
+ lPrevGlyphName.Set(lCurrGlyphName);
+
+ currentPosOrigX += ( lGlyphHorzAdvX * lUnitsPerEmInverse ) * lFontSize;
+
+ }
+ }
+
+ }
+ else
+ {
+ //need to use missing glyph for this one...
+ //iGlyphElements.Insert(iMissingGlyphElement, i);
+
+ /***********************/
+ /* Drawing MissingGlyph*/
+ /***********************/
+
+ if ( checkErrShapeMG == KErrNone )
+ {
+ this->DrawShapeL( aGc, aElement );
+
+ // Fix for UMAA-753ARS
+ // Scale the strokewidth before applying
+ // the scaling for glyph
+ ScaleStrokeWidth(aGc);
+
+ // For multiple x, y get the current position
+ // from the array.
+ if((iArrayX != NULL ) && ( i< iArrayX->Count() ))
+ {
+ currentPosOrigX = iArrayX->At(i);
+ }
+ if((iArrayY!=NULL) && (i<iArrayY->Count() ) )
+ {
+ currentPosOrigY = iArrayY->At(i);
+ }
+ currentTM = this->GetCTM();
+
+ currentTM.Translate( currentPosOrigX, currentPosOrigY );
+ currentTM.Scale( lUnitsPerEmInverse,
+ minusOne * lUnitsPerEmInverse );
+ currentTM.Scale( lFontSize, lFontSize );
+ aGc->SetTransform( currentTM );
+
+ aGc->DrawL( lShapeMG );
+ }
+
+ currentPosOrigX += ( lMissingGlyphHorzAdvX * lUnitsPerEmInverse ) * lFontSize;
+
+ }
+ }//end-for
+ TGfxRectangle2D lBbox;
+ if(iGlyphElements[glyphEleCnt-1] && lShape)
+ {
+ // Get the bbox for the last glyph element.
+ lShape->GetBounds(currentTM,lBbox);
+ }
+ else if ( lShapeMG )
+ {
+ // Get the bbox for the last missing-glyph element.
+ lShapeMG->GetBounds(currentTM,lBbox);
+ }
+ currentPosOrigX=lBbox.iX+lBbox.iWidth;
+/**********************************************************/
+/* Text Decoration Implementation for SVG Fonts */
+/* The following attributes are supported in this section */
+/* "underline-position" */
+/* "underline-thickness" */
+/* "overline-position" */
+/* "overline-thickness" */
+/* "strikethrough-position" */
+/* "strikethrough-thickness" */
+/**********************************************************/
+
+ if( lTextDecoration != -1 )
+ {
+ TFloatFixPt lLineStartX( origX );//Text Anchored position(see under fontfaceFound section).
+ TFloatFixPt lLineStartY( currentPosOrigY );
+ TFloatFixPt lLineEndX( origX + lTotalTextAdvance );
+ TFloatFixPt lLineEndY( currentPosOrigY );
+ TFloatFixPt lStrokeThickness ( 1 );//default thickness > 0; pensize is set to 1 in Gfx2D.
+
+ if( lTextDecoration == 1 )
+ {
+ if( lUnderlinePosition != KZero )
+ {
+ //negative(minus sign) due to inverted font coordinate system
+ lLineStartY = lLineEndY = currentPosOrigY - (lUnderlinePosition * lUnitsPerEmInverse) * lFontSize;
+ }
+ else if( lUnderlinePosition == KZero && lDescent != KZero )
+ {
+ lLineStartY = lLineEndY = currentPosOrigY - ((lDescent/TFloatFixPt(2)) * lUnitsPerEmInverse) * lFontSize;
+ }
+ else
+ {
+ //default. No information provided( descent or underline position)
+ }
+ if( lUnderlineThickness != KZero )
+ {
+ lStrokeThickness = lUnderlineThickness * lUnitsPerEmInverse * lFontSize ;
+ }
+ }
+
+ if( lTextDecoration == 2 )
+ {
+ if( lOverlinePosition != KZero )
+ {
+ //negative(minus sign) due to inverted font coordinate system
+ lLineStartY = lLineEndY = currentPosOrigY - (lOverlinePosition * lUnitsPerEmInverse) * lFontSize;
+ }
+ else if( lOverlinePosition == KZero && lAscent != KZero )
+ {
+ lLineStartY = lLineEndY = currentPosOrigY - (lAscent * lUnitsPerEmInverse) * lFontSize;
+ }
+ else
+ {
+ //default. No information provided( ascent or overline position)
+ }
+ if( lOverlineThickness != KZero )
+ {
+ lStrokeThickness = lOverlineThickness * lUnitsPerEmInverse * lFontSize ;
+ }
+ }
+
+
+ if( lTextDecoration == 3 )
+ {
+ if( lStrikethroughPosition != KZero )
+ {
+ //negative(minus sign) due to inverted font coordinate system
+ lLineStartY = lLineEndY = currentPosOrigY - (lStrikethroughPosition * lUnitsPerEmInverse) * lFontSize;
+ }
+ else if( lStrikethroughPosition == KZero && lAscent != KZero )
+ {
+ lLineStartY = lLineEndY = currentPosOrigY - ((lAscent/TFloatFixPt(3)) * lUnitsPerEmInverse) * lFontSize;
+ }
+ else
+ {
+ //default. No information provided( ascent or strikethrough position)
+ }
+ if( lStrikethroughThickness != KZero )
+ {
+ lStrokeThickness = lStrikethroughThickness * lUnitsPerEmInverse * lFontSize ;
+ }
+ }
+
+ TGfxLine2D lLine( lLineStartX ,lLineStartY, lLineEndX, lLineEndY );
+
+ this->DrawShapeL( aGc, aElement );
+
+ // Setting Stokewidth for SVG Fonts. Check if there exists a value or default value (1) is set.
+ if( ( lOverlineThickness != KZero ) || ( lUnderlineThickness != KZero ) || ( lStrikethroughThickness != KZero ) )
+ {
+ TGfxStroke lStroke = aGc->Stroke();
+ lStroke.SetStrokeWidth( lStrokeThickness); // relation to font co-ordinate system.
+ aGc->SetStroke( lStroke );
+ }
+
+
+ TGfxColor lForegroundColor(aGc->ForegroundColor());
+ if ( lForegroundColor.GetColor() == KGfxColorNull )
+ {
+ if ( (aGc->Paint()) != NULL )
+ aGc->SetForegroundColor(TGfxColor( (aGc->Paint())->GetColor() ));
+ }
+
+ aGc->DrawL( &lLine );
+ }//end of text decoration functionality
+ }
+ else
+ {
+
+/**********************************************************/
+/* If SVG Font is not available then Bitmap Fonts are used*/
+/* to render the text by calling the DrawString() function*/
+/* of Gfx2D */
+/**********************************************************/
+ UpdateCurrentScaledFont();
+
+ aGc->DrawStringL( iText->Des(),
+ iPoint.iX,
+ iPoint.iY,
+ lTextAnchor,
+ lTextDecoration,
+ iFamilies,
+ iWordSpacing,
+ iLetterSpacing,
+ iArrayRotate,
+ iArrayX,
+ iArrayY,
+ iBoundingBox,
+ iBitmapFont,
+ iBitmapFontSpec );
+
+ // Storing of the font is done in above routine
+ // only, hence removing below lines.
+ // store font info for bitmap font
+ //if ( iBitmapFont == NULL )
+ //iBitmapFont = GetCurrentFontScaled();
+
+ }
+ // Fix for ScreenSaver Bug
+ CSvgDocumentImpl* doc = (CSvgDocumentImpl*)OwnerDocument();
+ if ( doc && doc->Engine() )
+ {
+ iGfx2dGc = doc->Engine()->GraphicsContext();
+ }
+ return EFalse;
+}
+
+// -----------------------------------------------------------------------------
+// void CSvgTextElementImpl::ScaleStrokeWidth(CGfx2dGc* aGc)
+// Scale the stroke width in order to nullify the effect of scaling appiled on
+// the glyph
+// -----------------------------------------------------------------------------
+void CSvgTextElementImpl::ScaleStrokeWidth(CGfx2dGc* aGc)
+ {
+
+ TFloatFixPt lStrokeWidth;
+ CCssValue* lCssValue = NULL;
+ this->FindProperty( KCSS_ATTR_STROKEWIDTH, lCssValue);
+ if ( lCssValue )
+ {
+ lStrokeWidth = ( ( CFloatCssValueImpl * ) lCssValue )->Value();
+ if (lStrokeWidth <= TFloatFixPt(0))
+ {
+ aGc->SetStrokeWidth( TFloatFixPt(0) );
+ }
+ else
+ {
+ // Get the font-size
+ TFloatFixPt lFontSize( 10 );
+ this->FindProperty( KCSS_ATTR_FONTSIZE, lCssValue, NULL );
+ if ( lCssValue )
+ {
+ lFontSize = (( CFloatCssValueImpl * ) lCssValue )->Value();
+ if(lFontSize <= TFloatFixPt(0) )
+ {
+ lFontSize = TFloatFixPt ( 10 );
+ }
+ }
+ TFloatFixPt lUnitsPerEm( 1000 );
+
+ // Get units-per-em
+ if (iFontFaceElement != NULL)
+ {
+ iFontFaceElement->GetAttributeFloat( KAtrUnitsPerEm,
+ lUnitsPerEm );
+
+ #ifdef SVG_FLOAT_BUILD
+ if ( lUnitsPerEm <= TFloatFixPt( 0 ) )
+ {
+ lUnitsPerEm = TFloatFixPt( 1000 );
+ }
+ #else
+ if ( lUnitsPerEm <= TFloatFixPt( 0,ETrue ) )
+ {
+ lUnitsPerEm = TFloatFixPt( 1000 );
+ }
+ #endif
+
+ }
+
+ lStrokeWidth=(lStrokeWidth*lUnitsPerEm)/lFontSize;
+ aGc->SetStrokeWidth(lStrokeWidth);
+ }
+ }
+
+ }
+
+// *******************************************************
+// From MSvgLocatable/MSvgTransformable
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTextElementImpl::GetBBox( TGfxRectangle2D& aBbox )
+ {
+ if (iSVGFont)
+ {
+ //get the bounding boxes of
+ //all of the glyphs in the child and add them together.
+ GetBBoxForSVGText(aBbox);
+ }
+ else if (iBitmapFont)
+ {
+ GetBBoxForSystemText(aBbox);
+ }
+ else
+ {
+ //this is an error case if it gets to here
+ // When GetBBox is called just after PrepareDom, the font
+ // spec is not initialied yet. It happens only in DrawL.
+ // To take care of this issue, and give a correct bounding box,
+ // Bitmap font is assumed. Note: This would not work if
+ // SVG font is selected. This needs to be fixed more generically.
+
+ UpdateCurrentScaledFont();
+ if (iBitmapFont)
+ {
+ GetBBoxForSystemText(aBbox);
+ }
+ else
+ {
+ aBbox.iY = iPoint.iY;
+ aBbox.iX = iPoint.iX;
+ aBbox.iWidth = 0;
+ aBbox.iHeight = 0;
+ }
+
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTextElementImpl::GetFourPointBBox( TSvgFourPointRect& aFourPointBBox )
+ {
+ if (iSVGFont)
+ {
+ //get the bounding boxes of
+ //all of the glyphs in the child and add them together.
+ GetBBoxForSVGText(aFourPointBBox,this->GetCTM());
+ }
+ else if (iBitmapFont)
+ {
+ GetBBoxForSystemText(aFourPointBBox);
+ }
+ else
+ {
+ //this is an error case if it gets to here
+ }
+ }
+
+void CSvgTextElementImpl::GetBBoxForSVGText( TGfxRectangle2D& aBbox )
+{
+ //bbox for svg fonts
+ TSvgFourPointRect lFourPtRect;
+ GetBBoxForSVGText(lFourPtRect,this->GetCTM());
+
+ lFourPtRect.GetTRect(aBbox);
+}
+
+void CSvgTextElementImpl::GetBBoxForSVGText( TSvgFourPointRect& aFourPointBbox, const TGfxAffineTransform& aTransform)
+{
+ //bbox for svg fonts
+ TGfxRectangle2D lBbox;
+
+ TFloatFixPt lascent = Ascent();
+ TFloatFixPt ldescent = Descent();
+
+ // Fix for ANAE-739CPX
+ // When ascent and descent are not specified, get the
+ // the translated and scaled bounding-box for each glyph
+ // and then find the total bounding box.
+ TFloatFixPt KZero;
+ if(lascent<=KZero||ldescent<=KZero)
+ {
+ TGfxRectangle2D lBbox1; /* Final bounding box for the text */
+ TFloatFixPt lFontSize;
+ CCssValue* lCssValue = NULL;
+
+ // Get the font-size
+ this->FindProperty( KCSS_ATTR_FONTSIZE, lCssValue, NULL );
+ if ( lCssValue )
+ {
+ lFontSize = (( CFloatCssValueImpl * ) lCssValue )->Value();
+ if(lFontSize <= KZero )
+ {
+ lFontSize = TFloatFixPt ( KDefaultFontSize );
+ }
+ }
+
+ TFloatFixPt lUnitsPerEm( KDefaultUnitsPerEm );
+ TFloatFixPt lUnitsPerEmInverse(KZero);
+
+ // Get units-per-em
+ if (iFontFaceElement != NULL)
+ {
+ iFontFaceElement->GetAttributeFloat( KAtrUnitsPerEm,
+ lUnitsPerEm );
+
+
+ if ( lUnitsPerEm <= KZero )
+ {
+ lUnitsPerEm = TFloatFixPt( KDefaultUnitsPerEm );
+ }
+
+ lUnitsPerEmInverse = TFloatFixPt( KOne ) / lUnitsPerEm;
+ }
+
+ TFloatFixPt lGlyphHorzAdvX(KZero);
+ TFloatFixPt lFontHorzAdvX(KZero);
+ TFloatFixPt lMissingGlyphHorzAdvX(KZero);
+ TFloatFixPt lK(KZero);
+
+ if(iSVGFont)
+ {
+ // Get horiz-adv-x
+ iSVGFont->GetAttributeFloat( KAtrHorizAdvX, lFontHorzAdvX );
+ }
+
+
+ if (iMissingGlyphElement != NULL)
+ {
+ iMissingGlyphElement->GetAttributeFloat( KAtrHorizAdvX,
+ lMissingGlyphHorzAdvX );
+
+
+ if ( lMissingGlyphHorzAdvX == KZero )
+ {
+ lMissingGlyphHorzAdvX = lFontHorzAdvX;
+ }
+ }
+
+ // Get "k" for hkern
+ if(iHkernElement)
+ {
+ iHkernElement->GetAttributeFloat( KAtrK, lK );
+ }
+ TFloatFixPt currentPosOrigX(iPoint.iX);
+
+ // Find the total width of the BBox
+ TFloatFixPt lTotalTextAdvance =GetTotalTextAdvance(lK,lUnitsPerEmInverse,lFontSize,lMissingGlyphHorzAdvX,lFontHorzAdvX);
+
+ //Get the text-anchor
+ TInt8 lTextAnchor =(TInt8)(
+ ((CIntCssValueImpl *)(iSvgStyleProperties->operator[](
+ KCSS_ATTR_TEXTANCHOR)))->Value());
+
+ if( lTextAnchor == 1 )//Middle
+ {
+ currentPosOrigX -= (lTotalTextAdvance * TFloatFixPt(.5f));
+ }
+
+ if( lTextAnchor == 2 )//End
+ {
+ currentPosOrigX -= lTotalTextAdvance;
+ }
+
+ TFloatFixPt minusOne( -1 );
+
+ // (xMin1, yMin1) is the Top-left-corner and
+ // (xMax1, yMax1) is the bottom-right-corner
+ // of the final bounding box for the text
+ TFloatFixPt xMin1(KMAXFLOATFIX), yMin1(KMAXFLOATFIX), xMax1(KMINFLOATFIX), yMax1(KMINFLOATFIX);
+ TGfxRectangle2D lBbox;
+ const TDesC& ltext=*iText;
+ TInt ltextLength = ltext.Length();
+ TInt glyphEleCnt = iGlyphElements.Count();
+
+ for (TInt i= 0; i < ltextLength && i < glyphEleCnt; i++)
+ {
+ CSvgElementImpl* lGlyphElement = (CSvgElementImpl*)iGlyphElements[i];
+
+ CGfxGeneralPath* lShape = NULL;
+ if(lGlyphElement||iMissingGlyphElement)
+ {
+ // Tranformation Matrix for positioning and scaling the BBox
+ TGfxAffineTransform myCurrentTM = aTransform;
+
+ myCurrentTM.Translate( currentPosOrigX, iPoint.iY);
+
+ myCurrentTM.Scale( lUnitsPerEmInverse,
+ minusOne * lUnitsPerEmInverse );
+ myCurrentTM.Scale( lFontSize, lFontSize );
+
+ if(lGlyphElement)
+ {
+ TInt checkErrorShape = lGlyphElement->GetAttributePath(
+ KAtrData,lShape );
+
+ lGlyphElement->GetAttributeFloat( KAtrHorizAdvX,
+ lGlyphHorzAdvX );
+
+
+ if ( lGlyphHorzAdvX == KZero )
+ {
+ lGlyphHorzAdvX = /*(TFloatFixPt)lUnicodeLength **/ lFontHorzAdvX;
+ }
+ currentPosOrigX += ( lGlyphHorzAdvX * lUnitsPerEmInverse ) * lFontSize;
+ }
+ else
+ {
+ TInt checkErrorShape = iMissingGlyphElement->
+ GetAttributePath(KAtrData,lShape );
+
+ currentPosOrigX += ( lMissingGlyphHorzAdvX * lUnitsPerEmInverse ) * lFontSize;
+ }
+ // Get the tranformed BBox for each glyph
+ lShape->GetBounds(myCurrentTM, lBbox);
+
+ // Find the (xMin1,yMin1) and (xMax1, yMax1) for the total
+ // bounding box of text
+ if(lBbox.iX<xMin1) xMin1=lBbox.iX;
+ if(lBbox.iY<yMin1) yMin1=lBbox.iY;
+ if((lBbox.iY+lBbox.iHeight)>yMax1) yMax1=lBbox.iY+lBbox.iHeight;
+ if((lBbox.iX+lBbox.iWidth)>xMax1) xMax1=lBbox.iX+lBbox.iWidth;
+ }
+
+ }
+ lBbox1.iX=xMin1;
+ lBbox1.iY=yMin1;
+ lBbox1.iWidth=xMax1-xMin1;
+ lBbox1.iHeight=yMax1-yMin1;
+
+ aFourPointBbox.SetRectPoints(lBbox1);
+ return;
+ }
+ // End of fix for ANAE-739CPX
+
+ lBbox.iHeight = lascent + ldescent;
+ lBbox.iWidth = TextAdvance(*iText);
+
+ TReal32 lascentReal = (TReal32)lascent;
+ TReal32 ldescentReal = (TReal32)ldescent;
+ TReal32 liHeightReal = (TReal32)lBbox.iHeight;
+ TReal32 liWidthReal = (TReal32)lBbox.iWidth;
+
+ //////////////////// rotate without scaling again //////////////////////
+ lBbox.iX = iPoint.iX;
+ lBbox.iY = iPoint.iY - lascent;
+
+ //at this point the bbox not scaled,translated but not rotated
+
+ //should we create 1/scale factor or create with scale factor then get inverse
+ /*TGfxAffineTransform aScaleMat;
+ TReal32 inverseScale = 1.0/(TReal)iScale;
+ aScaleMat = TGfxAffineTransform::GetScaleInstance(inverseScale, inverseScale);
+ */
+
+ const TGfxAffineTransform& ctm = aTransform;
+
+ TGfxPoint2D transformedPoint(lBbox.iX, lBbox.iY);
+ ctm.Transform(&transformedPoint, &transformedPoint, 1);
+
+ TGfxPoint2D lTopLeftCorner(lBbox.iX, lBbox.iY);
+ TGfxPoint2D lTopRightCorner(lBbox.iX + lBbox.iWidth, lBbox.iY);
+ TGfxPoint2D lBottomLeftCorner(lBbox.iX, lBbox.iY + lBbox.iHeight);
+ TGfxPoint2D lBottomRightCorner(lBbox.iX + lBbox.iWidth, lBbox.iY + lBbox.iHeight);
+
+ TGfxPoint2D lTransTopLeftCorner;
+ TGfxPoint2D lTransBottomLeftCorner;
+ TGfxPoint2D lTransTopRightCorner;
+ TGfxPoint2D lTransBottomRightCorner;
+
+ ctm.Transform(&lTopLeftCorner, &lTransTopLeftCorner,1);
+ ctm.Transform(&lTopRightCorner, &lTransTopRightCorner,1);
+ ctm.Transform(&lBottomLeftCorner, &lTransBottomLeftCorner,1);
+ ctm.Transform(&lBottomRightCorner, &lTransBottomRightCorner,1);
+
+ TFloatFixPt lXTranslation = transformedPoint.iX - lTransTopLeftCorner.iX;
+ TFloatFixPt lYTranslation = (transformedPoint.iY - lTransTopLeftCorner.iY ); //- ascent;
+
+ // X position is affected by anchor
+ switch( TextAnchor() )
+ {
+ case EStartAnchor:
+ //do nothing
+ break;
+ case EMiddleAnchor:
+ lXTranslation = lXTranslation - ( lBbox.iWidth / TFloatFixPt( 2 ) );
+ break;
+ case EEndAnchor:
+ lXTranslation = lXTranslation - lBbox.iWidth;
+ break;
+ default:
+ //do nothing
+ break;
+ }
+
+ lTransTopLeftCorner.iX = lTransTopLeftCorner.iX + lXTranslation;
+ lTransTopLeftCorner.iY = lTransTopLeftCorner.iY + lYTranslation;
+
+ lTransTopRightCorner.iX = lTransTopRightCorner.iX + lXTranslation;
+ lTransTopRightCorner.iY = lTransTopRightCorner.iY + lYTranslation;
+
+ lTransBottomLeftCorner.iX = lTransBottomLeftCorner.iX + lXTranslation;
+ lTransBottomLeftCorner.iY = lTransBottomLeftCorner.iY + lYTranslation;
+
+ lTransBottomRightCorner.iX = lTransBottomRightCorner.iX + lXTranslation;
+ lTransBottomRightCorner.iY = lTransBottomRightCorner.iY + lYTranslation;
+
+ //at this point I have the exact path coordinates of the bbox
+ aFourPointBbox.SetRectPoints(lTransTopLeftCorner, lTransTopRightCorner, lTransBottomLeftCorner, lTransBottomRightCorner);
+
+ //aFourPointBbox.SetRectPoints(aTopLeftCorner, aTopRightCorner, aBottomLeftCorner, aBottomRightCorner);
+
+}
+
+void CSvgTextElementImpl::GetBBoxForSystemText( TGfxRectangle2D& aBbox )
+{
+ //bbox for bitmap fonts
+ TSvgFourPointRect lFourPtRect;
+ GetBBoxForSystemText(lFourPtRect);
+
+ lFourPtRect.GetTRect(aBbox);
+
+}
+
+void CSvgTextElementImpl::GetBBoxForSystemText( TSvgFourPointRect& aFourPointBbox )
+{
+ //bbox for bitmap fonts
+ TGfxRectangle2D lBbox;
+
+ iScale = GetCurrentScale();
+
+ if (iBoundingBox.iWidth == 0 && iBoundingBox.iHeight == 0)
+ {
+ iBoundingBox.iWidth = iBitmapFont->TextWidthInPixels(iText->Des());
+ iBoundingBox.iHeight = iBitmapFont->FontMaxHeight();
+ }
+
+ //scaled already for bitmap text...
+ lBbox.iWidth = iBoundingBox.iWidth;
+ lBbox.iHeight = iBoundingBox.iHeight;
+ TFloatFixPt lascent = Ascent();
+ TFloatFixPt ldescent = TFloatFixPt(iBoundingBox.iHeight) - Ascent();
+ TReal32 linverseScale = 1.0/(TReal)iScale;
+
+ TGfxAffineTransform lInitTranslationMat = TGfxAffineTransform::GetTranslateInstance(iPoint.iX,iPoint.iY);
+ TGfxAffineTransform lTotalMat = GetCTM();
+ lTotalMat.Concatenate(lInitTranslationMat);
+ TGfxAffineTransform lInverseScaleMat = TGfxAffineTransform::GetScaleInstance(linverseScale, linverseScale);
+ lTotalMat.Concatenate(lInverseScaleMat);
+ TGfxAffineTransform lDescentCorrectionMat =TGfxAffineTransform::GetTranslateInstance(0,ldescent);
+ lTotalMat.Concatenate(lDescentCorrectionMat);
+
+ TGfxPoint2D lTopLeftCorner(0, TFloatFixPt(0) - lBbox.iHeight );
+ TGfxPoint2D lTopRightCorner(lBbox.iWidth , TFloatFixPt(0) - lBbox.iHeight );
+ TGfxPoint2D lBottomLeftCorner(0, 0);
+ TGfxPoint2D lBottomRightCorner(lBbox.iWidth, 0 );
+
+
+ TGfxPoint2D lTransTopLeftCorner;
+ TGfxPoint2D lTransBottomLeftCorner;
+ TGfxPoint2D lTransTopRightCorner;
+ TGfxPoint2D lTransBottomRightCorner;
+
+ //applying current rotation transform without the scale.
+ lTotalMat.Transform(&lTopLeftCorner, &lTransTopLeftCorner,1);
+ lTotalMat.Transform(&lTopRightCorner, &lTransTopRightCorner,1);
+ lTotalMat.Transform(&lBottomLeftCorner, &lTransBottomLeftCorner,1);
+ lTotalMat.Transform(&lBottomRightCorner, &lTransBottomRightCorner,1);
+
+ TFloatFixPt lXTranslation = 0;
+ //TFixPt lXTranslation = transformedPoint.iX - iPoint.iX;
+
+ TFloatFixPt lYTranslation = 0;
+ //TFixPt lYTranslation = transformedPoint.iY - iPoint.iY;
+
+ // X position is affected by anchor
+ switch( TextAnchor() )
+ {
+ case EStartAnchor:
+ //do nothing
+ break;
+ case EMiddleAnchor:
+ lXTranslation = lXTranslation - ( lBbox.iWidth / TFloatFixPt( 2 ) );
+ break;
+ case EEndAnchor:
+ lXTranslation = lXTranslation - lBbox.iWidth;
+ break;
+ default:
+ //do nothing
+ break;
+ }
+
+ lTransTopLeftCorner.iX += lXTranslation;
+ lTransTopLeftCorner.iY += lYTranslation;
+
+ lTransTopRightCorner.iX += lXTranslation;
+ lTransTopRightCorner.iY += lYTranslation;
+
+ lTransBottomLeftCorner.iX += lXTranslation;
+ lTransBottomLeftCorner.iY += lYTranslation;
+
+ lTransBottomRightCorner.iX += lXTranslation;
+ lTransBottomRightCorner.iY += lYTranslation;
+
+ //at this point I have the exact path coordinates of the bbox
+ aFourPointBbox.SetRectPoints(lTransTopLeftCorner, lTransTopRightCorner, lTransBottomLeftCorner, lTransBottomRightCorner);
+}
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTextElementImpl::GetUnscaledBBox( TGfxRectangle2D& aBbox )
+ {
+ if((iText->Des()).Length()==0)
+ {
+ aBbox.iHeight=0;
+ aBbox.iWidth=0;
+ aBbox.iX=0;
+ aBbox.iY=0;
+ return;
+
+ }
+ // If both bitmap font and SVG font are not present then
+ // attempt to fetch SVG font. If that fails then
+ // try obtaining the bitmap font
+ if ( iSVGFont )
+ {
+ TSvgFourPointRect lFourPtRect;
+ TGfxAffineTransform TM ;
+ GetBBoxForSVGText(lFourPtRect,TM);
+
+ lFourPtRect.GetTRect(aBbox);
+ return;
+ }
+
+ else
+
+ {
+
+ TRAPD( ErrCode , CreateSVGFontL());
+ if( ErrCode != KErrNotFound)
+ {
+ //first en cache the glymph and then
+ //calculate total text advance
+ TSvgFourPointRect lFourPtRect;
+ TGfxAffineTransform TM ;
+ GetBBoxForSVGText(lFourPtRect,TM);
+ lFourPtRect.GetTRect(aBbox);
+ return;
+ }
+
+
+ else
+ {
+ UpdateCurrentScaledFont();
+ iBoundingBox.iWidth = iBitmapFont->TextWidthInPixels(iText->Des());
+ iBoundingBox.iHeight = iBitmapFont->FontMaxHeight();
+
+ //unscaled for bitmap text...
+ aBbox.iWidth = iBoundingBox.iWidth;
+ TFloatFixPt ascent = Ascent();
+ //aBbox.iHeight = ascent + Descent();
+
+ aBbox.iHeight = iBoundingBox.iHeight;
+
+ aBbox.iY = iPoint.iY - ascent;
+
+ // X position is affected by anchor
+ switch( TextAnchor() )
+ {
+ case EStartAnchor:
+ aBbox.iX = iPoint.iX;
+ break;
+ case EMiddleAnchor:
+ aBbox.iX = iPoint.iX - ( aBbox.iWidth / TFloatFixPt( 2 ) );
+ break;
+ case EEndAnchor:
+ aBbox.iX = iPoint.iX - aBbox.iWidth;
+ break;
+ default:
+ aBbox.iX = iPoint.iX;
+ break;
+ }
+
+ }
+
+ }
+
+
+ }
+
+
+
+
+void CSvgTextElementImpl::SetRotateArray(CArrayFixFlat<TReal32>*& aRotate)
+ {
+ if ( iArrayRotate )
+ {
+ iArrayRotate->Reset();
+ delete iArrayRotate;
+ iArrayRotate= NULL;
+ }
+
+ iArrayRotate= aRotate;
+/* TInt lCount= aRotate->Count();
+ iArrayRotate = new ( ELeave ) CArrayFixFlat<TReal32>( lCount );
+
+ for (TInt i=0; i<lCount; i++)
+ {
+ iArrayRotate->AppendL((TReal32)aRotate->operator[](i));
+ }
+ */
+ }
+
+void CSvgTextElementImpl::SetXYArray(TUint16 aAtrId, CArrayFixFlat<TFloatFixPt>*& aX )
+ {
+ if (aAtrId== KAtrX)
+ {
+ if ( iArrayX )
+ {
+ iArrayX->Reset();
+ delete iArrayX;
+ iArrayX = NULL;
+ }
+ iArrayX= aX;
+ SetX(aX);
+ }
+ else
+ {
+ if ( iArrayY )
+ {
+ iArrayY->Reset();
+ delete iArrayY;
+ iArrayY = NULL;
+ }
+ iArrayY= aX;
+ SetY(aX);
+ }
+ }
+
+TFloatFixPt CSvgTextElementImpl::FontSize()
+{
+ CCssValue* cssValue = NULL;
+ FindProperty( KCSS_ATTR_FONTSIZE, cssValue, this );
+ if ( cssValue )
+ {
+ TFloatFixPt fontsize = ((CFloatCssValueImpl*)cssValue)->Value();
+ if ( fontsize <= TFloatFixPt( 0 ) )
+ fontsize = TFloatFixPt( 10 );
+ return fontsize;
+ }
+ else
+ {
+ return 10;
+ }
+}
+
+TFloatFixPt CSvgTextElementImpl::TextAdvance( const TDesC& aText, TInt aIndex )
+{
+ if ( iBitmapFont )
+ {
+ TInt advance = 0;
+ UpdateCurrentScaledFont();
+ if ( iBitmapFont)
+ {
+ advance = ((CFbsFont*)iBitmapFont)->TextWidthInPixels(aText);
+
+ return TFloatFixPt(advance);
+ }
+
+ return 0;
+ }
+ else if ( iSVGFont )
+ {
+ //if an svg font...
+ TReal32 fontHorzAdvX = 0.0;
+ TFloatFixPt advanceX = TFloatFixPt( 0 );
+
+ TInt textLength = aText.Length();
+ TInt glyphEleCnt = iGlyphElements.Count();
+ for (TInt i= aIndex; i < (aIndex+textLength) && (i< glyphEleCnt); i++)
+ {
+ //assuming that glyph element cache is a parallel vector here
+ CSvgElementImpl* lGlyphElement = (CSvgElementImpl*)iGlyphElements[i];
+
+ if (lGlyphElement != NULL)
+ {
+ lGlyphElement->GetAttributeFloat( KAtrHorizAdvX, advanceX );
+ fontHorzAdvX += (TReal32)advanceX;
+ }
+ }
+
+ TFloatFixPt lUnitsPerEm = TFloatFixPt(1000);
+
+ if (iFontFaceElement)
+ {
+ iFontFaceElement->GetAttributeFloat( KAtrUnitsPerEm, lUnitsPerEm);
+
+ if (lUnitsPerEm == TFloatFixPt(0))
+ {
+ lUnitsPerEm = TFloatFixPt(1000);
+ }
+ }
+
+ // Must use TReal to prevent overflow
+ TReal32 retValue = fontHorzAdvX * (TReal32)FontSize() / (TReal32)lUnitsPerEm;
+ return (TFloatFixPt)retValue;
+ }
+ else
+ {
+ //case where we dont have a bitmap font or an svg font
+ return 0;
+ }
+}
+
+
+
+TFloatFixPt CSvgTextElementImpl::Ascent()
+{
+
+ //check for the bbox issue
+ if ( iSVGFont )
+ {
+ //if an svg font the ascent is this...
+
+ TFloatFixPt lAscent, lUnitsPerEm;
+ TReal32 totalAscent = 0.0;
+
+ if (iFontFaceElement)
+ {
+ iFontFaceElement->GetAttributeFloat( KAtrAscent,
+ lAscent );
+
+ iFontFaceElement->GetAttributeFloat( KAtrUnitsPerEm, lUnitsPerEm);
+
+ if(lUnitsPerEm==TFloatFixPt(0))
+ {
+ lUnitsPerEm=TFloatFixPt(1000);
+ }
+ totalAscent = (TReal32)lAscent * (TReal32)FontSize() / (TReal32)lUnitsPerEm;
+
+ return (TFloatFixPt)totalAscent;
+ }
+
+ //default value for ascent
+ return 0;
+ }
+ else if ( iBitmapFont )
+ {
+ // if ( iBitmapFont )
+
+ UpdateCurrentScaledFont();
+ //if a bitmap font the ascent is this....
+ TInt ascent = 10;
+
+ if (iBitmapFont)
+ {
+ //Tweak factor is needed as font not behaving correctly for
+ // all languages.
+ ascent = iBitmapFont->FontMaxAscent() + 1;
+ }
+ else
+ {
+ }
+
+ return ( ascent >= 0 ) ? ascent : -ascent;
+ }
+
+ else
+ {
+ //case where we dont have a bitmap font or svg font
+ return 0;
+ }
+ }
+
+const CFont* CSvgTextElementImpl::Font() const
+ {
+ return iBitmapFont;
+ }
+
+TFloatFixPt CSvgTextElementImpl::Descent()
+{
+
+ //check for the bbox issue
+ if ( iSVGFont )
+ {
+ //for svg fonts...
+ //if an svg font the descent is this...
+
+ TFloatFixPt lDescent, lUnitsPerEm;
+ TReal32 totalDescent = 0.0;
+
+ if (iFontFaceElement)
+ {
+ iFontFaceElement->GetAttributeFloat( KAtrDescent,
+ lDescent );
+
+ iFontFaceElement->GetAttributeFloat( KAtrUnitsPerEm, lUnitsPerEm);
+
+ if(lUnitsPerEm==TFloatFixPt(0))
+ {
+ lUnitsPerEm=TFloatFixPt(1000);
+ }
+
+ totalDescent = (TReal32)lDescent * (TReal32)FontSize() / (TReal32)lUnitsPerEm;
+
+ return ( totalDescent >= 0 ) ? (TFloatFixPt)totalDescent : (TFloatFixPt)-totalDescent;
+ }
+
+ return 0;
+ }
+ else if ( iBitmapFont )
+ {
+ UpdateCurrentScaledFont();
+ //for bitmap fonts...
+ TInt descent = 10;
+
+ if (iBitmapFont)
+ {
+ descent = iBitmapFont->DescentInPixels();
+ }
+ else
+ {
+ }
+
+ return ( descent >= 0 ) ? descent : -descent;
+
+ }
+ else
+ {
+ //case where we dont have a bitmap font or svg font
+ return 0;
+ }
+}
+
+TTextAnchor CSvgTextElementImpl::TextAnchor()
+{
+
+ TInt anchor = ((CIntCssValueImpl*)((*iSvgStyleProperties)[KCSS_ATTR_TEXTANCHOR]))->Value();
+ return ( anchor == -1 ) ? EStartAnchor : (TTextAnchor)anchor;
+}
+
+TBool CSvgTextElementImpl::LoadExternalSVGFontL(const TDesC& aFontFamily)
+{
+ CSvgEngineImpl* lEngine = ((CSvgDocumentImpl*)iOwnerDocument)->Engine();
+ CSvgDocumentImpl* lNewFontDoc = NULL;
+
+ if (lEngine == NULL)
+ {
+ return EFalse;
+ }
+
+ if ( lEngine->iFontHashMap->HasFontFamilyName(aFontFamily) )
+ {
+ //already have that font
+ return EFalse;
+ }
+ else
+ {
+ CSvgBitmapFontProvider *tempBitmapFontProvider = ((CSvgDocumentImpl*)iOwnerDocument)->GetBitmapFontProvider();
+ lNewFontDoc = CSvgDocumentImpl::NewL( tempBitmapFontProvider );
+ lNewFontDoc->SetEngine(lEngine);
+ }
+
+ if (aFontFamily.Length() > 0)
+ {
+ TBuf<256> myFontUrl;
+ myFontUrl.Copy(aFontFamily.Left(24));
+ myFontUrl.Append(_L(".svg"));
+
+ if (FetchSvgFontL(myFontUrl, lNewFontDoc))
+ {
+ if ( lEngine->iFontHashMap->AddFontDocument(lNewFontDoc, aFontFamily) )
+ {
+ return ETrue;
+ }
+ }
+ }
+
+ //If basic latin use SVG DEFAULT FONT
+ if ( iUseDefaultSVGFont && !lEngine->iFontHashMap->HasFontFamilyName(aFontFamily))
+ {
+ if (FetchSvgFontL(_L("defaultsvgfont.svg"), lNewFontDoc))
+ {
+ TBool aReturn = lEngine->iFontHashMap->AddFontDocument(lNewFontDoc, KDefaultFont );
+
+ //this will overwrite whatever font family the element had set...
+ //remove this to let fonts fall through to bitmap their specified bitmap fonts
+ //SetFontFamilyL(_L("NokiaSansWide"));
+ if(!aReturn)
+ {
+ if(lNewFontDoc)
+ {
+ delete lNewFontDoc;
+ lNewFontDoc = NULL;
+ }
+
+ }
+ return ETrue;
+ }
+ /*else if (LoadDefaultSvgFont(iNewFontDoc))
+ {
+ if (iEngine->AddFontDocument(iNewFontDoc, aFontFamily))
+ {
+ return ETrue;
+ }
+ }*/
+ }
+
+ delete lNewFontDoc;
+ lNewFontDoc = NULL;
+ return EFalse;
+}
+
+TBool CSvgTextElementImpl::IsEditable()
+{
+ return iEditable;
+}
+
+TBool CSvgTextElementImpl::FetchSvgFontL(const TDesC& aUri, CSvgDocumentImpl* newFontDocument)
+{
+ CSvgErrorImpl* lmyError = CSvgErrorImpl::NewL();
+
+ //do a fetchimage style fetch of the SVG font file here...
+ // Connect session
+ RFs lSession;
+ RFile fileHandle;
+ if ( lSession.Connect() == KErrNone )
+ {
+ CSvgEngineImpl* lEngine = ((CSvgDocumentImpl*)iOwnerDocument)->Engine();
+
+ if (lEngine->FetchFont( aUri, lSession, fileHandle))
+ {
+ TBuf<512> aName;
+
+ fileHandle.Name(aName);
+
+ if ( aName.CompareF(aUri) == 0)
+ {
+ //need to attach this to the real document and just once for all text elements
+ newFontDocument->Load( fileHandle, *lmyError );
+ }
+ else
+ {
+ lSession.Close();
+ delete lmyError;
+ return EFalse;
+ }
+
+ if (lmyError->ErrorCode() == ESvgNoError)
+ {
+ lSession.Close();
+ delete lmyError;
+ return ETrue;
+ }
+ }
+ else
+ {
+ lSession.Close();
+ }
+ }
+
+ delete lmyError;
+ return EFalse;
+}
+
+
+/*TBool CSvgTextElementImpl::LoadDefaultSvgFont(CSvgDocumentImpl* newFontDocument)
+{
+ CSvgErrorImpl* myError = CSvgErrorImpl::NewL();
+ CSvgEngineImpl* iEngine = ((CSvgDocumentImpl*)iOwnerDocument)->Engine();
+
+ TPtrC8 svgfontdata( (TUint8*)strSVGFont, User::StringLength((TUint8*)strSVGFont) );
+ iEngine->newFontDocument->Load( svgfontdata, *myError );
+
+ if (myError->ErrorCode() != ESvgNoError)
+ {
+ delete myError;
+ return EFalse;
+ }
+
+ delete myError;
+ return ETrue;
+}*/
+
+/*** FROM MSvgMouseListener ***/
+// ---------------------------------------------------------------------------
+// mouse entered
+// ---------------------------------------------------------------------------
+TBool CSvgTextElementImpl::MouseEntered( RPointerArray<CSvgElementImpl>& aElements,
+ TInt /*aX*/, TInt /*aY*/ )
+{
+ CSvgEngineImpl* lEngine = ( ( CSvgDocumentImpl* ) OwnerDocument() )->Engine();
+
+ TInt eleCnt = aElements.Count();
+ for (TInt i = 0; i < eleCnt; i++ )
+ {
+ if ( aElements[i] == this )
+ {
+ lEngine->NotifyTextEntered(this);
+ return ETrue;
+ }
+ }
+
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+// Notified when the mouse pointer exits a visible svg element.
+// ---------------------------------------------------------------------------
+TBool CSvgTextElementImpl::MouseExited( RPointerArray<CSvgElementImpl>& aElements,
+ TInt /*aX*/, TInt /*aY*/ )
+{
+ CSvgEngineImpl* lEngine = ( ( CSvgDocumentImpl* ) OwnerDocument() )->Engine();
+
+ TInt eleCnt = aElements.Count();
+ for (TInt i = 0; i < eleCnt; i++ )
+ {
+ if ( aElements[i] == this )
+ {
+ lEngine->NotifyTextExited(this);
+ return ETrue;
+ }
+ }
+
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+// Notified when the mouse pointer is moved inside a visible svg element.
+// ---------------------------------------------------------------------------
+TBool CSvgTextElementImpl::MouseMoved( RPointerArray<CSvgElementImpl>& /*aElements*/,
+ TInt /*aX*/, TInt /*aY*/ )
+{
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+// Notified when the mouse pointer is pressed down on visible svg element.
+// ---------------------------------------------------------------------------
+TBool CSvgTextElementImpl::MousePressed( RPointerArray<CSvgElementImpl>& /*aElements*/,
+ TInt /*aX*/, TInt /*aY*/ )
+{
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+// Notified when the mouse pointer is released on on visible svg element.
+// ---------------------------------------------------------------------------
+TBool CSvgTextElementImpl::MouseReleased( RPointerArray<CSvgElementImpl>& aElements,
+ TInt /*aX*/, TInt /*aY*/ )
+{
+ CSvgEngineImpl* lEngine = ( ( CSvgDocumentImpl* ) OwnerDocument() )->Engine();
+
+ TInt eleCnt = aElements.Count();
+ for (TInt i = 0; i < eleCnt; i++ )
+ {
+ if ( aElements[i] == this )
+ {
+ lEngine->NotifyTextActivated(this);
+ return ETrue;
+ }
+ }
+
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTextElementImpl::SetEditable( const TDesC& aValue )
+{
+ if (aValue.FindF(_L("simple")) == KErrNotFound && aValue.FindF(_L("true")) == KErrNotFound)
+ {
+ iEditable = EFalse;
+ }
+ else
+ {
+ iEditable = ETrue;
+ }
+}
+
+void CSvgTextElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<text x=\"%d\" y=\"%d\" editable=\"%d\" >hmm</text>", (int)iPoint.iX, (int)iPoint.iY, (int)IsEditable()/*, iText*/);
+ #endif
+ }
+}
+
+void CSvgTextElementImpl::UpdateCurrentScaledFont()
+ {
+
+ // Get latest scaling factor
+ TFloatFixPt scale = GetCurrentScale();
+
+ TFloatFixPt fontsize = (TFloatFixPt)FontSize();
+
+ TFloatFixPt fontHeight = scale * fontsize;
+ // RDebug::Printf("Requesting fontHeight: %d\n", (TInt)fontHeight);
+
+ GetScaledFont( fontHeight, (*iFamilies)[0], iBitmapFont, iBitmapFontSpec );
+ // RDebug::Printf("Ascent : %d\n", (TInt)iBitmapFont->AscentInPixels());
+ // RDebug::Printf("Descent: %d\n", (TInt)iBitmapFont->DescentInPixels());
+ }
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::GetSystemFontScaled(TFloatFixPt aHeight,
+// const TDesC& aTypefaceName,// CFont*& aFont,
+// TFontSpec& aFontSpec )
+// ---------------------------------------------------------------------------
+ void CSvgTextElementImpl::GetScaledFont( TFloatFixPt aHeight,
+ const TDesC& aTypefaceName,
+ CFont*& aFont,
+ TFontSpec& aFontSpec )
+ {
+ if (aHeight >= TFloatFixPt(300))
+ {
+ aHeight = TFloatFixPt(300);
+ }
+
+ // Calculate twip size
+ TInt twipsSize;
+ if( aHeight > TFloatFixPt(0) )
+ {
+ TInt xpixels,ypixels,xtwips,ytwips;
+ HAL::Get(HALData::EDisplayXPixels, xpixels);
+ HAL::Get(HALData::EDisplayYPixels, ypixels);
+ HAL::Get(HALData::EDisplayXTwips, xtwips);
+ HAL::Get(HALData::EDisplayYTwips, ytwips);
+
+ if ( xpixels == 0 )
+ {
+ return;
+ }
+
+ TFloatFixPt ratio = TFloatFixPt(xtwips)/(TFloatFixPt)xpixels;
+ twipsSize = (TInt) (ratio * aHeight);//((float)ytwips/ypixel) is same
+ }
+ else
+ {
+ return;
+ }
+
+ TFontStrokeWeight strokeWeight = EStrokeWeightNormal;
+ TFontPosture fontPosture = EPostureUpright ;
+
+ // Get font-weight
+ TInt32 fontweight = 1;
+ CCssValue* weightValue = NULL;
+ FindProperty( KCSS_ATTR_FONTWEIGHT, weightValue, this );
+
+ if ( weightValue )
+ {
+ fontweight = ((CIntCssValueImpl*)weightValue)->Value();
+ }
+
+ if ( ( fontweight == 1 ) ||
+ ( fontweight == 2 ) ||
+ ( fontweight == 9 ) ||
+ ( fontweight == 10 ) ||
+ ( fontweight == 11 ) ||
+ ( fontweight == 12 ) ) // Bold
+ {
+ strokeWeight = EStrokeWeightBold;
+ }
+ else
+ {
+ strokeWeight = EStrokeWeightNormal;
+ }
+
+ // Get font-style
+ TInt32 style = 1;
+ CCssValue* styleValue = NULL;
+ FindProperty( KCSS_ATTR_FONTSTYLE, styleValue, this );
+
+ if ( styleValue )
+ {
+ style = ((CIntCssValueImpl*)styleValue)->Value();
+ }
+
+ if ( style == 1 )
+ {
+ //Italic
+ fontPosture = EPostureItalic;
+ }
+ else
+ {
+ fontPosture = EPostureUpright;
+ }
+
+
+ TFontStyle fontStyle( fontPosture, strokeWeight, EPrintPosNormal );
+
+ // Get Latest required Font Spec.
+ TFontSpec tempFontSpec(aFontSpec);
+ tempFontSpec.iTypeface.iName = aTypefaceName.Left(24);
+ tempFontSpec.iHeight = twipsSize;
+ tempFontSpec.iFontStyle = fontStyle;
+
+ CSvgBitmapFontProvider *tempBitmapFontProvider = ((CSvgDocumentImpl*)iOwnerDocument)->GetBitmapFontProvider();
+ if( aFont )
+ {
+ if(!(tempFontSpec == aFontSpec))
+ {
+ aFontSpec = tempFontSpec;
+ tempBitmapFontProvider->ReleaseFont(aFont);
+ tempBitmapFontProvider->GetNearestFontToDesignHeightInTwips(aFont, aFontSpec);
+ }
+ }
+ else
+ {
+ aFontSpec = tempFontSpec;
+ tempBitmapFontProvider->GetNearestFontToDesignHeightInTwips(aFont, aFontSpec);
+ }
+
+ }
+// ---------------------------------------------------------------------------
+ // Calculate the exact total text advance instead of taking default per glyph
+ // advance which will approximate the value.
+// ---------------------------------------------------------------------------
+ TFloatFixPt CSvgTextElementImpl::GetTotalTextAdvance(const TFloatFixPt& alK,const TFloatFixPt& alUnitsPerEmInverse,const TFloatFixPt& alFontSize,const TFloatFixPt& alMissingGlyphHorzAdvX,const TFloatFixPt& alFontHorzAdvX)
+ {
+ //Text Anchor related.
+ //lFontHorzAdvX = 400;
+ //lTotalTextAdvance = lFontHorzAdvX * (TFloatFixPt)iText->Length() * lUnitsPerEmInverse * lFontSize;
+
+
+ TFloatFixPt lGlyphHorzAdvX;
+ TInt langCodeFound( 0 );
+ TInt8 lTextAnchor =(TInt8)(((CIntCssValueImpl *)(iSvgStyleProperties->operator[](KCSS_ATTR_TEXTANCHOR)))->Value());
+ TPtrC16 lPrevGlyphName;
+ TPtrC16 lCurrGlyphName;
+ TFloatFixPt lK = alK; //kerning purpose....
+ TFloatFixPt KZero;
+ TFloatFixPt lTotalTextAdvance ( KZero );
+ TPtrC16 lUnicode;
+ TPtrC16 lLangCode; //ex: en-US or en-GB or ja-JP or zh-CN or en....
+ TPtrC16 lPrevUnicode;
+ TPtrC16 lUnicodeRange; //Max.Length "U+00AB-00AF"
+ TFloatFixPt lUnitsPerEmInverse = alUnitsPerEmInverse;
+ TFloatFixPt lFontSize = alFontSize;
+ TFloatFixPt lFontHorzOrgX( 0 );
+ TFloatFixPt lFontHorzAdvX = alFontHorzAdvX;
+ TFloatFixPt lMissingGlyphHorzAdvX = alMissingGlyphHorzAdvX;
+
+
+ TInt glyphEleCnt = iGlyphElements.Count();
+ for (TInt i=0; i < glyphEleCnt; i++)
+ {
+ CSvgElementImpl* lGlyphElement = (CSvgElementImpl*)iGlyphElements[i];
+
+ if (lGlyphElement != NULL)
+ {
+ //have a valid glyph
+ TInt checkErrorUnicode = lGlyphElement->GetAttributeDes( KAtrUnicode,
+ lUnicode );
+ //check the glyph name
+ TInt checkErrorGlyphName = lGlyphElement->GetAttributeDes( KAtrGlyphName,
+ lCurrGlyphName );
+ if( checkErrorGlyphName == KErrNoAttribute )
+ {
+ lCurrGlyphName.Set( KGlyphNameNone );
+ }
+
+ //check its language
+ TInt checkErrorLangCode = lGlyphElement->GetAttributeDes( KAtrLang,
+ lLangCode );
+ TPtrC lXmlLangAttr(this->XMLLang());
+
+ if( checkErrorLangCode != KErrNoAttribute ) //if Lang code present
+ {
+ langCodeFound = lLangCode.CompareF( lXmlLangAttr );//compare xml:lang with Lang code.
+ }
+
+ //if Lang code is matching && unicode attr. present, we are good.
+ if ( (checkErrorUnicode != KErrNoAttribute) && (langCodeFound == 0) )
+ {
+ //Checking and Introducing kerning(adjusting spacing).
+ if( lPrevGlyphName.Length() > 0 )
+ {
+ if( IsKerningRequired( lPrevGlyphName, lCurrGlyphName, lPrevUnicode, lUnicode ))
+ {
+ lTotalTextAdvance -= ( lK * lUnitsPerEmInverse ) * lFontSize;
+ }
+ }
+
+ lGlyphElement->GetAttributeFloat( KAtrHorizAdvX,
+ lGlyphHorzAdvX );
+
+ #ifdef SVG_FLOAT_BUILD
+ if ( lGlyphHorzAdvX == TFloatFixPt( 0 ) )
+ #else
+ if ( lGlyphHorzAdvX == TFloatFixPt( 0,ETrue ) )
+ #endif
+ {
+ lGlyphHorzAdvX = /*(TFloatFixPt)lUnicodeLength **/ lFontHorzAdvX;
+ }
+
+
+ lTotalTextAdvance += ( lGlyphHorzAdvX * lUnitsPerEmInverse ) * lFontSize;
+
+
+ }
+
+
+ }
+ else
+ {
+ //need to use missing glyph for this one...
+
+ lTotalTextAdvance += ( lMissingGlyphHorzAdvX * lUnitsPerEmInverse ) * lFontSize;
+
+ }
+ }//end-for
+
+
+ return lTotalTextAdvance ;
+
+ }// End Function
+void CSvgTextElementImpl::CreateSVGFontL()
+{
+ CCssValue* lCssValue = NULL;
+
+ TPtrC lFontFamily;
+ //Getting font-family property
+ this->FindProperty( KCSS_ATTR_FONTFAMILY, lCssValue,this );
+ if ( lCssValue && ((( CStrCssValueImpl * ) lCssValue )->Value()).Length() != 0)
+ {
+ lFontFamily.Set( ( ( CStrCssValueImpl * ) lCssValue )->Value() );
+ SetFontFamilyL( lFontFamily );
+ }
+
+ //attempt to load svg font files of same font family name
+ //this boolean will be a problem if we want to be able to swap
+ //font-family names on the fly and use svg fonts.
+ if (!iTriedLoadingSVGFonts)
+ {
+ LoadExternalSVGFontL(lFontFamily);
+ iTriedLoadingSVGFonts = ETrue;
+ }
+
+ //Retrieving Font Element Pointer from the Font Table
+ //if font in svg document
+ iSVGFont = NULL;
+ if ( iFamilies != NULL )
+ {
+ TInt familiesCnt = iFamilies->Count();
+ for (int i=0; i< familiesCnt; i++)
+ {
+ // In JSR-226 case, the engine may not have been created yet.
+ if ( ((CSvgDocumentImpl*)iOwnerDocument)->Engine() )
+ {
+ iSVGFont = ( CSvgElementImpl * )((CSvgDocumentImpl*)iOwnerDocument)->Engine()->iFontHashMap->GetFontPtr(iFamilies->operator[]( i ));
+ }
+
+ if (iSVGFont == NULL)
+ {
+ iSVGFont = ( CSvgElementImpl * )((CSvgDocumentImpl*)iOwnerDocument)->iFontHashMap->GetFontPtr(iFamilies->operator[]( i ) );
+ }
+
+ if (iSVGFont != NULL)
+ {
+ //found a font with that family name...continue
+ break;
+ }
+ }
+ }
+
+/**********************************************************/
+/* Checking for pre-defined SVG Fonts through the */
+/* retrieved pointer from the Font Table. */
+/* IF the Font is found (ptr!=NULL), SVG Fonts are used */
+/* ELSE Bitmap Font is used through DrawString() method */
+/**********************************************************/
+
+ if(!iSVGFont)
+ {
+ User::Leave(KErrNotFound);
+ }
+
+ if ( iSVGFont != NULL && iSVGFont->HasChildNodes())
+ {
+ //we found an svg font and are using it...
+ // iSVGFont->GetAttributeFloat( KAtrHorizOriginX, lFontHorzOrgX );
+ // iSVGFont->GetAttributeFloat( KAtrHorizAdvX, lFontHorzAdvX );
+ // lMissingGlyphHorzAdvX = lFontHorzAdvX; //Default Value
+ // TInt checkErrShapeMG = -1;//To keep a value other than KErrNone. Should this be replaced
+ CacheGlyphsForText();
+ }
+
+
+
+
+
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGTimeContainer.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,1490 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Provides implementation of a time container
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "SVGTimeContainer.h"
+#include "SVGTimer.h"
+#include "SVGEvent.h"
+#include "SVGDocumentImpl.h"
+
+#include "SVGLockedRealTimeEntity.h"
+
+// EXTERNAL DATA STRUCTURES
+//extern ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::CSvgTimeContainer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSvgTimeContainer::CSvgTimeContainer( CSvgDocumentImpl* aOwnerDoc,
+ const TBool aHasParent,
+ const TSvgSyncBehaviour aSyncBehavior,
+ const TBool aIsSyncMaster,
+ const TUint32 aSyncTolerance ) :
+ iTcSyncBehavior( aSyncBehavior ),
+ iTcSyncTolerance( aSyncTolerance ),
+ iTcSyncMasterConfig( aIsSyncMaster ),
+ iIsParentTcPresent( aHasParent ),
+ iOwnerDoc( aOwnerDoc ),
+ iMediaState( ESvgMediaReady ),
+ iUserState(ESvgUserRunning),
+ iIsSyncPaused(EFalse)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSvgTimeContainer::ConstructL()
+ {
+ //Add locked real time entity(LRTE) here
+ iLrte = CSvgLockedRealTimeEntity::NewL(iOwnerDoc);
+ // Populate the entity list item corresponding to LRTE
+ iLrteListItem.iTimedEntity = iLrte;
+ iLrteListItem.iMediaState = ESvgMediaIdle;
+ iLrteListItem.iUserState =ESvgUserRunning ;
+ iLrteListItem.iIsSyncPaused = EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSvgTimeContainer* CSvgTimeContainer::NewL( CSvgDocumentImpl* aOwnerDoc,
+ const TBool aHasParent,
+ const TSvgSyncBehaviour aSyncBehavior,
+ const TBool aIsSyncMaster,
+ const TUint32 aSyncTolerance )
+ {
+ CSvgTimeContainer* self = new( ELeave ) CSvgTimeContainer( aOwnerDoc,
+ aHasParent, aSyncBehavior, aIsSyncMaster, aSyncTolerance );
+
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+
+// Destructor
+CSvgTimeContainer::~CSvgTimeContainer()
+ {
+ // Reset the observer
+ iObserver = NULL;
+ // Delete the locked realtime timed entity
+ delete iLrte;
+ // Cleanup the list of timed entities
+ CleanupTimedEntities();
+
+ // Delete the timer if present
+ if ( iTimer )
+ {
+ delete iTimer;
+ iTimer = NULL;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::GetSyncMasterForTimeContainer
+// Resolves the sync master within the time container and returns the same.
+// -----------------------------------------------------------------------------
+//
+MSvgTimedEntityInterface* CSvgTimeContainer::GetSyncMasterForTimeContainer()
+ {
+ // First check the number of elements in the time container
+ TInt lTimedEntityListCnt = iTcTimedEntities.Count();
+
+ // if there is only one element in the list(which is the document),
+ // return NULL to avoid list traversal
+ if ( lTimedEntityListCnt <= 1 )
+ {
+ return NULL;
+ }
+
+ TInt lFirstAudioIndex = iTcTimedEntities.Count(); // Store invalid value
+ MSvgTimedEntityInterface* lCurSyncMaster = NULL;
+
+ // Within the locked group of timed entities within the time
+ // container, need to find out which element is acting as master.
+
+ // For All Timed Entities
+ // Get the first eligible sync master
+ for ( TInt lItemIndex = lTimedEntityListCnt - 1; lItemIndex >= 0 ; lItemIndex-- )
+ {
+ //get each element
+ MSvgTimedEntityInterface* lCurTimedEntity =
+ (iTcTimedEntities[ lItemIndex ]).iTimedEntity ;
+
+ // In case an audio element is found
+ // check whether is is locked and can generate tick
+ // If so, it is an eligible sync master
+ if( lFirstAudioIndex == lTimedEntityListCnt &&
+ lCurTimedEntity->ObjectType() == ESvgAudioElement &&
+ lCurTimedEntity->GetEntitySyncBehavior() == ESvgSyncLocked &&
+ lCurTimedEntity->CanGenerateTick() )
+ {
+ // Remember this so it can be used later if
+ // no eligible syncmaster found
+ lFirstAudioIndex = lItemIndex;
+ }
+
+ TBool lIsSyncMaster = EFalse;
+ lCurTimedEntity->GetCnfSyncMasterStatus( lIsSyncMaster );
+ // An element is an eligible sync master if:
+ // a. It is locked wrt the TC
+ // b. It is configured as a sync master
+ // c. It can generate tick i.e. it is active and has implicit duration.
+ if ( lCurTimedEntity->GetEntitySyncBehavior() == ESvgSyncLocked
+ && lIsSyncMaster
+ && lCurTimedEntity->CanGenerateTick() )
+ {
+ lCurSyncMaster = lCurTimedEntity;
+ break;
+ }
+ }
+
+
+ if ( !lCurSyncMaster )
+ {
+ if( lFirstAudioIndex != lTimedEntityListCnt )
+ {
+ // Did not find a sync master, and audio element available
+ lCurSyncMaster = iTcTimedEntities[ lFirstAudioIndex ].iTimedEntity;
+ }
+ //Locked real time entityas syncmaster
+ else
+ {
+ lCurSyncMaster = iLrteListItem.iTimedEntity;
+ }
+
+ }
+
+ if ( lCurSyncMaster )
+ {
+ // Sync Master found
+ // Store the syncMaster in iTcSyncMaster.
+ iTcSyncMaster = lCurSyncMaster;
+
+ // Set the state in the sync master that it is the chosen one.
+ iTcSyncMaster->SetCurSyncMasterStatus( ETrue );
+
+ // For All Timed Entities other than syncMaster in TC group
+ // SetCurSyncMasterStatus = False;
+ for ( TInt lItemIndex = lTimedEntityListCnt - 1; lItemIndex >= 0 ; lItemIndex-- )
+ {
+ MSvgTimedEntityInterface* lCurTimedEntity =
+ (iTcTimedEntities[ lItemIndex ]).iTimedEntity ;
+ if ( lCurTimedEntity != iTcSyncMaster )
+ {
+ lCurTimedEntity->SetCurSyncMasterStatus( EFalse );
+ }
+ }
+
+ if(iLrteListItem.iTimedEntity != lCurSyncMaster)
+ {
+ iLrteListItem.iTimedEntity->SetCurSyncMasterStatus(EFalse);
+ }
+ }
+
+
+ return iTcSyncMaster;
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::AddTimedEntityL
+// Add a timed entity to the time container.
+// -----------------------------------------------------------------------------
+//
+void CSvgTimeContainer::AddTimedEntityL(
+ MSvgTimedEntityInterface* aTimedEntity )
+ {
+ if ( !aTimedEntity )
+ {
+ User::Leave( KErrArgument );
+ }
+
+ // check to see if entity is already in list and simply return
+ TInt lTimedEntityListCnt = iTcTimedEntities.Count();
+ for ( TInt lItemIndex = lTimedEntityListCnt - 1; lItemIndex >= 0 ; lItemIndex-- )
+ {
+ if ( (iTcTimedEntities[ lItemIndex ]).iTimedEntity == aTimedEntity )
+ {
+ return;
+ }
+ }
+
+ TSvgTimedEntityListItem lListItem;
+ lListItem.iTimedEntity = aTimedEntity;
+
+ //Media State initially Idle
+ lListItem.iMediaState = ESvgMediaIdle;
+
+ //User state initially is running
+ lListItem.iUserState =ESvgUserRunning ;
+
+ // Sync State is Playing
+ lListItem.iIsSyncPaused = EFalse;
+
+ // Append to Timed Entity List
+ iTcTimedEntities.AppendL( lListItem );
+
+ // Obtain the post order list of media elements
+ RPointerArray<CSvgElementImpl> lMediaEleList;
+ lMediaEleList.Reset();
+
+ CSvgElementImpl *handle = (CSvgElementImpl *)(iOwnerDoc->RootElement());
+ iOwnerDoc->ParsePostOrderMediaElements( handle, lMediaEleList );
+
+ // Rearrange as per Post order
+ RearrangeTimedEntityList( lMediaEleList );
+
+ // Done with the list
+ lMediaEleList.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::DelTimedEntity
+// Removes the timed entity from the time container.
+// -----------------------------------------------------------------------------
+//
+void CSvgTimeContainer::DelTimedEntity(
+ MSvgTimedEntityInterface* aTimedEntity )
+ {
+ // check whether the entity exists and then remove it from the list
+ TInt lTimedEntityListCnt = iTcTimedEntities.Count();
+
+ for ( TInt lItemIndex = lTimedEntityListCnt - 1; lItemIndex >= 0 ; lItemIndex-- )
+ {
+ if ( (iTcTimedEntities[ lItemIndex ]).iTimedEntity == aTimedEntity )
+ {
+ iTcTimedEntities.Remove( lItemIndex );
+ break;
+ }
+ }
+
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::CleanupTimedEntities
+// Removes all the timed entities from the time container.
+// -----------------------------------------------------------------------------
+//
+void CSvgTimeContainer::CleanupTimedEntities( )
+ {
+ // Delete the entries in the timed entity list; does not delete the
+ // timed entities.
+ iTcTimedEntities.Reset();
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgTimeContainer::SetCurrentTime
+// Set Function for the TC's current time
+// ---------------------------------------------------------------------------
+void CSvgTimeContainer::SetCurrentTime( TInt32 aCurTime )
+ {
+ iCurrentTime = aCurTime;
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgTimeContainer::CurrentTime
+// Accessor for the TC's current time
+// ---------------------------------------------------------------------------
+TInt32 CSvgTimeContainer::CurrentTime()
+ {
+ return iCurrentTime;
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgTimeContainer::SetSyncBehavior
+// Set the Synchronised behaviour for the time container
+// ---------------------------------------------------------------------------
+void CSvgTimeContainer::SetSyncBehavior( const TSvgSyncBehaviour aValue )
+ {
+ iTcSyncBehavior = aValue;
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgTimeContainer::SetSyncTolerance
+// Set the Synchronised Tolerance for the time container
+// ---------------------------------------------------------------------------
+void CSvgTimeContainer::SetSyncTolerance( const TUint32 aValue )
+ {
+ iTcSyncTolerance = aValue;
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgTimeContainer::SetSyncMaster
+// Set the time container as Synchronised Master
+// ---------------------------------------------------------------------------
+void CSvgTimeContainer::SetSyncMaster( const TBool aValue )
+ {
+ iTcSyncMasterConfig = aValue;
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgTimeContainer::GetCurTick
+// Accessor function to get the current tick
+// ---------------------------------------------------------------------------
+TSvgTick CSvgTimeContainer::GetCurTick()
+ {
+ return iCurrentTick;
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgTimeContainer::Document
+// Accessor function to get the owner doc of the TC
+// ---------------------------------------------------------------------------
+CSvgDocumentImpl* CSvgTimeContainer::Document()
+ {
+ return iOwnerDoc;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSvgTimeContainer::TimedEntityNotReady
+// Informing the time container that timed entity is not ready
+ /*
+ If this element is locked
+ {
+ PauseLockedElements
+ {
+ (Whether ready/not ready)
+ For all locked elements:
+ SyncPauseElement.
+ }
+ If TC Observer present
+ Give Not Ready Event
+ }
+
+ */
+ // ---------------------------------------------------------------------------
+void CSvgTimeContainer::TimedEntityNotReady(
+ MSvgTimedEntityInterface* aTimedEntity )
+ {
+
+
+ TInt lTimedEntityListCnt = iTcTimedEntities.Count();
+ for ( TInt lItemIndex = lTimedEntityListCnt - 1; lItemIndex >= 0 ; lItemIndex-- )
+ {
+ //get current element
+ if ( (iTcTimedEntities[ lItemIndex ]).iTimedEntity == aTimedEntity )
+ {
+ //set current element as not ready
+ (iTcTimedEntities[ lItemIndex ]).iMediaState = ESvgMediaNotReady;
+
+ //if current element is locked
+ if((iTcTimedEntities[ lItemIndex ]).iTimedEntity->GetEntitySyncBehavior() == ESvgSyncLocked )
+ {
+ //Indicate the timecontainer is not ready
+ SetMediaState(ESvgMediaNotReady);
+
+ PauseLockedEntities();
+
+ // Inform the observer that the time container is not ready
+ if ( iObserver )
+ {
+ iObserver->TimeContainerNotReady();
+ }
+ }
+ //Once we have got the right timed entity on which not ready was called
+ //exit the loop
+ break;
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::SyncpauseElement
+//Pauses running syncronised elements
+ /*
+ Pauses a single element
+
+ If ( syncStatus is not paused AND ( userStatus is not paused or not stopped ) )
+ Pause Element
+ Set syncStatus = Paused // iIsSyncPaused
+
+
+ If Element type = Animation
+ {
+ Get Child TC Pointer.
+ If Valid,
+ Call Child Tc->SyncPause
+ }
+
+
+ */
+ // -----------------------------------------------------------------------------
+//
+
+
+void CSvgTimeContainer::SyncPauseElement(TSvgTimedEntityListItem* aTimedEntityItem)
+ {
+ if (
+ (!aTimedEntityItem->iIsSyncPaused)
+ && (aTimedEntityItem->iUserState == ESvgUserRunning)
+ )
+ {
+ aTimedEntityItem->iTimedEntity->PauseTimedEntity();
+ }
+ aTimedEntityItem->iIsSyncPaused = ETrue;
+
+ if(aTimedEntityItem->iTimedEntity->ObjectType() == ESvgMediaAnimationElement)
+ {
+ CSvgTimeContainer* lAnimTimeContainer = aTimedEntityItem->iTimedEntity->GetChildTimeContainer();
+ if(lAnimTimeContainer)
+ {
+ lAnimTimeContainer->SyncPause();
+ }
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// CSvgTimeContainer::TimedEntityReady
+// Informing the time container that timed entity is ready
+ /*
+ If this element is locked
+ {
+ If all locked elements ready
+ {
+ ResumeLockedElements
+ {
+ For all locked elements:
+ SyncResumeElement.
+
+ }
+ If TC Observer present
+ Give ready of TC
+ }
+ }
+ */
+// ---------------------------------------------------------------------------
+void CSvgTimeContainer::TimedEntityReady(
+ MSvgTimedEntityInterface* aTimedEntity )
+ {
+
+ TBool lIsOkToResume = ETrue;
+
+ TInt lTimedEntityListCnt = iTcTimedEntities.Count();
+ for ( TInt lItemIndex = lTimedEntityListCnt - 1; lItemIndex >= 0 ; lItemIndex-- )
+ {
+ //get current element from entities list
+ if ( (iTcTimedEntities[ lItemIndex ]).iTimedEntity == aTimedEntity )
+ {
+ //set current element as not ready
+ (iTcTimedEntities[ lItemIndex ]).iMediaState = ESvgMediaReady;
+
+ //if current element is locked
+ if((iTcTimedEntities[ lItemIndex ]).iTimedEntity->GetEntitySyncBehavior() == ESvgSyncLocked )
+ {
+ //for all timed entities
+ for ( lItemIndex = lTimedEntityListCnt - 1; lItemIndex >= 0 ; lItemIndex-- )
+ {
+ // check if any timed entities are locked and not ready
+ // Idle elements cannot be checked as they are not active
+ if(
+ ( (iTcTimedEntities[ lItemIndex ]).iTimedEntity->GetEntitySyncBehavior() == ESvgSyncLocked )
+ && ((iTcTimedEntities[lItemIndex].iMediaState == ESvgMediaNotReady))
+ )
+ {
+ //Indicate cant resume now as some locked entities are not ready
+ lIsOkToResume = EFalse;
+ //exit loop
+ break;
+ }
+ }
+ }
+ //Once we have got the right timed entity on which ready was called
+ //exit the loop
+ break;
+ }
+ }
+
+ if ( lIsOkToResume )
+ {
+ //Indicate the timecontainer is ready as all elements are ready
+ SetMediaState(ESvgMediaReady);
+
+ ResumeLockedEntities();
+
+ // Inform the observer that the time container is ready
+ if ( iObserver )
+ {
+ iObserver->TimeContainerReady();
+ }
+ }
+ }
+
+//-------------------------------------------------------------------------------
+//void CSvgTimeContainer::SyncResumeElement
+ /*
+ Resumes a single element
+
+ if ( syncStatus is not running AND (userStatus is running))
+ AND (TC.syncStatus is running) AND (TC.userStatus is running))
+ {
+
+ Resume Element
+ }
+ Set syncStatus = running
+ If Element type = Animation
+ {
+ Get Child TC Pointer.
+ If Valid,
+ Call Child Tc->SyncResume
+ }
+
+ */
+//-------------------------------------------------------------------------------
+void CSvgTimeContainer::SyncResumeElement(TSvgTimedEntityListItem* aTimedEntity)
+ {
+ if(
+ (aTimedEntity->iIsSyncPaused)
+ && (aTimedEntity->iUserState == ESvgUserRunning)
+ && (!iIsSyncPaused)
+ && (iUserState == ESvgUserRunning )
+ )
+ {
+ aTimedEntity->iTimedEntity->ResumeTimedEntity();
+ }
+ aTimedEntity->iIsSyncPaused = EFalse;
+
+ if(aTimedEntity->iTimedEntity->ObjectType() == ESvgMediaAnimationElement)
+ {
+ CSvgTimeContainer* AnimTimeContainer = aTimedEntity->iTimedEntity->GetChildTimeContainer();
+ if(AnimTimeContainer)
+ {
+ AnimTimeContainer->SyncResume();
+ }
+ }
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::PauseLockedEntities
+// Pauses the time container's locked entities
+// -----------------------------------------------------------------------------
+//
+void CSvgTimeContainer::PauseLockedEntities()
+ {
+ /*
+ (Whether ready/not ready)
+ For all locked elements:
+ SyncPauseElement.
+ */
+ TInt lTimedEntityListCnt = iTcTimedEntities.Count();
+ for ( TInt lItemIndex = lTimedEntityListCnt - 1; lItemIndex >= 0 ; lItemIndex-- )
+ {
+ if((iTcTimedEntities[ lItemIndex ]).iTimedEntity->GetEntitySyncBehavior() == ESvgSyncLocked )
+ {
+ SyncPauseElement(&iTcTimedEntities[ lItemIndex ]);
+ }
+ }
+ SyncPauseElement(&iLrteListItem);
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::ResumeLockedEntities
+// Resumes the time container's locked entities
+// -----------------------------------------------------------------------------
+//
+void CSvgTimeContainer::ResumeLockedEntities()
+ {
+ /*
+ For all locked elements:
+ SyncResumeElement.
+ */
+ TInt lTimedEntityListCnt = iTcTimedEntities.Count();
+ for ( TInt lItemIndex = lTimedEntityListCnt - 1; lItemIndex >= 0 ; lItemIndex-- )
+ {
+ if((iTcTimedEntities[ lItemIndex ]).iTimedEntity->GetEntitySyncBehavior() == ESvgSyncLocked )
+ {
+ SyncResumeElement(&iTcTimedEntities[ lItemIndex ]);
+ }
+ }
+ SyncResumeElement(&iLrteListItem) ;
+
+
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::SetTcObserver
+// Set the observer for the time container
+// -----------------------------------------------------------------------------
+//
+void CSvgTimeContainer::SetTcObserver( MSvgTimeContainerObserver* aTCObserver )
+ {
+ iObserver = aTCObserver;
+ // Inform the observer that the time container is ready
+ if ( iObserver )
+ {
+ if ( iMediaState == ESvgMediaReady)
+ {
+ iObserver->TimeContainerReady();
+ }
+ else
+ {
+ iObserver->TimeContainerNotReady();
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::UserStop
+// Called to handle user/client generated stop event
+/*
+ UserStop()
+ {
+
+ Set the TC.UserState too
+ This.UserState = Paused.
+
+
+ For all timed entities
+ {
+ UserStopElement()
+ {
+ StopElement()
+ Set userStatus = Stopped
+ If Element type = Animation
+ {
+ Get Child TC Pointer.
+ If Valid,
+ Call Child Tc->UserStop
+ }
+
+ }
+ }
+ }
+ */
+// -----------------------------------------------------------------------------
+//
+void CSvgTimeContainer::UserStop()
+ {
+ SetUserState(ESvgUserStopped);
+ // Cancel the timer
+ if ( iTimer )
+ {
+ iTimer->SVGStop();
+ }
+ TInt lTimedEntityListCnt = iTcTimedEntities.Count();
+ for ( TInt lItemIndex = lTimedEntityListCnt - 1; lItemIndex >= 0 ; lItemIndex-- )
+ {
+ UserStopElement(&iTcTimedEntities[lItemIndex]);
+ }
+ UserStopElement(&iLrteListItem);
+
+ }
+
+
+void CSvgTimeContainer::UserStopElement(TSvgTimedEntityListItem* aTimedEntity)
+{
+ aTimedEntity->iTimedEntity->StopTimedEntity();
+
+ aTimedEntity->iIsSyncPaused = EFalse;
+
+ SetUserState(ESvgUserStopped);
+
+ if(aTimedEntity->iTimedEntity->ObjectType() == ESvgMediaAnimationElement)
+ {
+ CSvgTimeContainer* AnimTimeContainer = aTimedEntity->iTimedEntity->GetChildTimeContainer();
+ if(AnimTimeContainer)
+ {
+ AnimTimeContainer->UserStop();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::UserResume
+// Called to handle user/client generated resume event
+// -----------------------------------------------------------------------------
+//
+void CSvgTimeContainer::UserResume( TInt32 aTime )
+ {
+
+ SetUserState(ESvgUserRunning);
+ if ( iTimer )
+ {
+ iTimer->SVGResume( aTime );
+ }
+
+
+
+ /*
+ UserResume()
+ {
+ For all timed entities
+ {
+ UserResumeElement()
+ }
+ }
+ */
+
+ TInt lTimedEntityListCnt = iTcTimedEntities.Count();
+ for ( TInt lItemIndex = lTimedEntityListCnt - 1; lItemIndex >= 0 ; lItemIndex-- )
+ {
+ UserResumeElement(&iTcTimedEntities[ lItemIndex ]);
+ }
+
+
+ UserResumeElement(&iLrteListItem);
+
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::UserResumeElement
+/*
+UserResumeElement()
+ {
+ If(Element is locked)
+ {
+ If ( syncStatus is running AND TC.syncStatus is running)
+ Resume Element
+ }
+ Else
+ {
+ ResumeElement()
+ }
+
+ Set userStatus = running
+ If Element type = Animation
+ {
+ Get Child TC Pointer.
+ If Valid,
+ Call Child Tc->UserResume
+ }
+
+ }
+*/
+// -----------------------------------------------------------------------------
+//
+
+void CSvgTimeContainer::UserResumeElement(TSvgTimedEntityListItem* aTimedEntity)
+ {
+ aTimedEntity->iUserState = ESvgUserRunning ;
+
+ if(//Element is locked
+ (aTimedEntity->iTimedEntity->GetEntitySyncBehavior() == ESvgSyncLocked)
+ &&((aTimedEntity->iIsSyncPaused) || (iIsSyncPaused))
+ //element or timecontainer is syncpaused
+ )
+ {
+ //Do not resume
+ }
+ else
+ {
+ aTimedEntity->iTimedEntity->ResumeTimedEntity();
+ }
+
+
+ if(aTimedEntity->iTimedEntity->ObjectType() == ESvgMediaAnimationElement)
+ {
+ CSvgTimeContainer* AnimTimeContainer = aTimedEntity->iTimedEntity->GetChildTimeContainer();
+ if(AnimTimeContainer)
+ {
+ AnimTimeContainer->UserResume();
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::UserPlay
+// Called to handle user/client generated play event
+// -----------------------------------------------------------------------------
+//
+void CSvgTimeContainer::UserPlay()
+ {
+
+
+ if ( !iTimer )
+ {
+ // Check whether this time container has a parent
+ // then we do not have to create the timer
+ if ( !iIsParentTcPresent )
+ {
+ // Obtain the post order list of media elements
+ RPointerArray<CSvgElementImpl> lMediaEleList;
+ lMediaEleList.Reset();
+
+ CSvgElementImpl *handle = (CSvgElementImpl *)(iOwnerDoc->RootElement());
+
+ //Parse postorderr only if there are media elements
+ if(iTcTimedEntities.Count() > 1 )
+ {
+ iOwnerDoc->ParsePostOrderMediaElements( handle, lMediaEleList );
+ }
+
+
+ // Rearrange as per Post order
+ RearrangeTimedEntityList( lMediaEleList );
+
+ // Done with the list
+ lMediaEleList.Close();
+
+ TRAPD( lTimerCreateErr, iTimer = CSvgTimer::NewL( this ) );
+
+ if ( lTimerCreateErr != KErrNone )
+ {
+ // Error Processing
+ return;
+ }
+
+ iTimer->SetStartTime();
+
+ // the current home time needs to be updated.
+ if ( iOwnerDoc && iCurrentTime != 0 )
+ {
+ iCurrentTime = 0;
+ iCurrentTick.iParentTcTick = 0;
+ iCurrentTick.iRealTimeTick = 0;
+ TSvgTimerEvent timeEvent( iCurrentTime );
+ iOwnerDoc->Reset( &timeEvent );
+ }
+
+ if ( !iTimer->IsActive() )
+ {
+ iTimer->After( 1000 );
+ }
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::UserPause
+
+ /*
+
+ Set the TC.UserState too
+ This.UserState = Paused.
+
+ UserPause()
+ {
+ For all timed entities
+ {
+ UserPauseElement() iIsSyncPaused is syncStatus
+
+ }
+ }
+ */
+// -----------------------------------------------------------------------------
+//
+void CSvgTimeContainer::UserPause()
+{
+ SetUserState(ESvgUserPaused);
+ if ( iTimer )
+ {
+ iTimer->SVGStop();
+ }
+
+ TInt lTimedEntityListCnt = iTcTimedEntities.Count();
+ for ( TInt lItemIndex = lTimedEntityListCnt - 1; lItemIndex >= 0 ; lItemIndex-- )
+ {
+ UserPauseElement(&iTcTimedEntities[ lItemIndex ]);
+ }
+
+ UserPauseElement(&iLrteListItem);
+
+}
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::UserPauseElement
+// Called to handle user/client generated pause event
+//
+/*
+ UserPauseElement() iIsSyncPaused is syncStatus
+ {
+ If ( syncStatus is not Paused AND userStatus is not paused or stopped )
+ Pause Element
+ Set userStatus = Paused
+
+ If Element type = Animation
+ {
+ Get Child TC Pointer.
+ If Valid,
+ Call Child Tc->UserPause
+ }
+
+ }
+*/
+
+//-----------------------------------------------------------------------------
+//
+
+ void CSvgTimeContainer::UserPauseElement(TSvgTimedEntityListItem* aTimedEntity)
+{
+ if(
+ !(aTimedEntity->iIsSyncPaused )
+ && (aTimedEntity->iUserState == ESvgUserRunning)
+ )
+ {
+ aTimedEntity->iTimedEntity->PauseTimedEntity();
+
+ }
+ aTimedEntity->iUserState = ESvgUserPaused;
+
+ if(aTimedEntity->iTimedEntity->ObjectType() == ESvgMediaAnimationElement)
+ {
+ CSvgTimeContainer* AnimTimeContainer = aTimedEntity->iTimedEntity->GetChildTimeContainer();
+ if(AnimTimeContainer)
+ {
+ AnimTimeContainer->UserPause();
+ }
+ }
+
+}
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::UserSeek
+// Called to handle user/client generated seek event
+// -----------------------------------------------------------------------------
+//
+void CSvgTimeContainer::UserSeek(
+ TInt aTime ) // Time in msecs to seek
+ {
+ if ( iTimer )
+ {
+ //if ( iOwnerDoc && iCurrentTime != aTime )
+ if ( iOwnerDoc)
+ {
+ iCurrentTime = aTime;
+ iCurrentTick.iParentTcTick = aTime;
+ iCurrentTick.iRealTimeTick = aTime;
+ TSvgTimerEvent timeEvent( iCurrentTime );
+ iOwnerDoc->Reset( &timeEvent );
+ }
+
+ iTimer->SetSeekTime( aTime );
+ }
+ // Need to send user resume events to timed entities
+ SetUserState(ESvgUserRunning);
+ TInt lTimedEntityListCnt = iTcTimedEntities.Count();
+ for ( TInt lItemIndex = lTimedEntityListCnt - 1; lItemIndex >= 0 ; lItemIndex-- )
+ {
+ UserResumeElement( &iTcTimedEntities[ lItemIndex ] );
+ }
+
+ UserResumeElement(&iLrteListItem);
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgTimeContainer::UserResetTime
+// Resets the time variables
+// ---------------------------------------------------------------------------
+void CSvgTimeContainer::UserResetTime()
+ {
+ if ( iTimer )
+ {
+ iTimer->ResetTime();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CSvgTimeContainer::UserChangeFrameDuration
+// Changes the frame duration in the timer
+// ---------------------------------------------------------------------------
+void CSvgTimeContainer::UserChangeFrameDuration( TUint32 aTimerDuration )
+ {
+ if ( iTimer )
+ {
+ iTimer->ChangeFrameDuration( aTimerDuration );
+ }
+ }
+// ---------------------------------------------------------------------------
+// CSvgTimeContainer::UserFps
+// Returns number of frames per sec(debug api)
+// ---------------------------------------------------------------------------
+TUint CSvgTimeContainer::UserFps()
+ {
+ if ( iTimer )
+ {
+ return iTimer->Fps();
+ }
+ return 0;
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::ParentTimeContainerTick
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+//
+void CSvgTimeContainer::ParentTimeContainerTick(
+ TSvgTick aTick ) // Current tick information
+ {
+ // Update the member variable keeping track of current tick
+ iCurrentTick.iRealTimeTick = aTick.iRealTimeTick;
+
+ // If the TC is locked wrt to its parent and parent is present
+ if ( ( iTcSyncBehavior == ESvgSyncLocked ) && iIsParentTcPresent )
+ {
+ iCurrentTick.iParentTcTick = aTick.iParentTcTick;
+ // Propogate the tick to all timed elements in the container
+ PropogateTickToContainerElements( iCurrentTick );
+ }
+ else
+ {
+ // Container not locked with respect to parent.
+ // Get Sync Master Entity in the group and use its clock as timing
+ // reference for the Time container.
+ MSvgTimedEntityInterface* lSyncMaster = GetSyncMasterForTimeContainer();
+
+ if ( !lSyncMaster )
+ {
+ // No Sync Master
+ iCurrentTick.iParentTcTick = aTick.iRealTimeTick;
+ // Propogate the tick to all timed elements in the container
+ PropogateTickToContainerElements( iCurrentTick );
+ }
+ else
+ {
+ // Sync Master Present, check whether it can generate tick
+ if ( lSyncMaster->CanGenerateTick() )
+ {
+ TUint32 lMasterCurTime = 0;
+ lSyncMaster->GetEntityCurrentTime( lMasterCurTime );
+ iCurrentTick.iParentTcTick = lMasterCurTime;
+ // Propogate the tick to all timed elements in the container
+ PropogateTickToContainerElements( iCurrentTick );
+ }
+ else
+ {
+ // Sync Master present but cannot generate tick, so use
+ // real time tick
+ iCurrentTick.iParentTcTick = aTick.iRealTimeTick;
+ // Propogate the tick to all timed elements in the container
+ PropogateTickToContainerElements( iCurrentTick );
+ }
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::GetEntitySyncBehavior
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+//
+TSvgSyncBehaviour CSvgTimeContainer::GetEntitySyncBehavior()
+ {
+ return iTcSyncBehavior;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::GetEntityCurrentTime
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+//
+void CSvgTimeContainer::GetEntityCurrentTime( TUint32&
+ aEntityCurTime ) // Current Entity Time in msecs.
+ {
+ // IF GetCurSyncMasterStatus == FALSE, Error. // Shouldn't be happening.
+ TBool lCurSyncMasterStatus = EFalse;
+ GetCurSyncMasterStatus( lCurSyncMasterStatus );
+
+ if ( lCurSyncMasterStatus )
+ {
+ // Resolve the sync Master for the container. (Should have happened?)
+ MSvgTimedEntityInterface* lSyncMaster = GetSyncMasterForTimeContainer();
+ // IF no syncMaster, Error (Shouldn't be happening.)
+ if ( !lSyncMaster )
+ {
+ return;
+ }
+ lSyncMaster->GetEntityCurrentTime( aEntityCurTime );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::GetCnfSyncMasterStatus
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+//
+void CSvgTimeContainer::GetCnfSyncMasterStatus(
+ TBool& aIsSyncMaster ) // Indicates whether the element is configured as
+ // Sync Master.
+ {
+ iTcSyncMasterConfig = aIsSyncMaster;
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::GetCurSyncMasterStatus
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+void CSvgTimeContainer::GetCurSyncMasterStatus(
+ TBool& aIsSyncMaster ) // Indicates whether the element is currrently
+ // Sync Master.
+ {
+ aIsSyncMaster = iTcSyncMasterCurrent;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::SetCurSyncMasterStatus
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+void CSvgTimeContainer::SetCurSyncMasterStatus(
+ TBool aSyncMasterStatus ) // Indicates whether the element is currrently
+ // Sync Master.
+ {
+ iTcSyncMasterCurrent = aSyncMasterStatus;
+ // Update the state of current sync master if there is one
+ if ( iTcSyncMaster )
+ {
+ iTcSyncMaster->SetCurSyncMasterStatus( aSyncMasterStatus );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::CanGenerateTick
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+TBool CSvgTimeContainer::CanGenerateTick()
+ {
+ MSvgTimedEntityInterface* lSyncMaster = GetSyncMasterForTimeContainer();
+ if(lSyncMaster == iLrteListItem.iTimedEntity)
+ {
+ return EFalse;
+ }
+ return ( lSyncMaster ? ETrue:EFalse );
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::CanUseParentTick
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+TBool CSvgTimeContainer::CanUseParentTick()
+ {
+ // This function returns true if it does not have a parent time container
+ // Hence the root time container creates the timer and hence can use
+ // parent tick
+ return ( !iIsParentTcPresent );
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::ResyncTimedEntity
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+void CSvgTimeContainer::ResyncTimedEntity(
+ TUint32 /*aSynctime */) // Time for resync in msecs.
+ {
+ // TODO: Resync Logic
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::PauseTimedEntity
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+void CSvgTimeContainer::PauseTimedEntity()
+ {
+
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::ResumeTimedEntity
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+void CSvgTimeContainer::ResumeTimedEntity()
+ {
+
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::StopTimedEntity
+// From MSvgTimedEntityInterface
+// -----------------------------------------------------------------------------
+void CSvgTimeContainer::StopTimedEntity()
+ {
+
+ }
+
+
+//From MSvgTimedEntityInterface
+TSvgObjectType CSvgTimeContainer::ObjectType()
+{
+ return ESvgInvalidReference;
+}
+
+//returns the child time container of the element
+//used in timecontainer
+CSvgTimeContainer* CSvgTimeContainer::GetChildTimeContainer()
+{
+ return NULL;
+}
+
+//-------------------------------------------------------------------------------
+/*
+TC::SyncPause()
+{
+ tc.SyncStatus = Paused;
+
+ For All Locked Elements
+ {
+ Pause Element;
+ Note: No element level state change, as element level syncStatus reflects only
+ syncStatus evaluated in TC group level. ,e.g. syncStatus could be running in this
+ case
+ If element = animation
+ {
+ Get Child TC pointer
+ If Child TC
+ childTc->SyncPause;
+ }
+
+ }
+}
+
+
+*/
+//-------------------------------------------------------------------------------
+void CSvgTimeContainer::SyncPause()
+ {
+ //iIsSyncPaused = ETrue;
+ SetSyncState(ETrue);
+
+ TInt lTimedEntityListCnt = iTcTimedEntities.Count();
+ for ( TInt lItemIndex = lTimedEntityListCnt - 1; lItemIndex >= 0 ; lItemIndex-- )
+ {
+ if((iTcTimedEntities[ lItemIndex ]).iTimedEntity->GetEntitySyncBehavior() == ESvgSyncLocked )
+ {
+ iTcTimedEntities[lItemIndex].iTimedEntity->PauseTimedEntity();
+ }
+
+ if(iTcTimedEntities[lItemIndex].iTimedEntity->ObjectType() == ESvgMediaAnimationElement)
+ {
+ CSvgTimeContainer* AnimTimeContainer = iTcTimedEntities[lItemIndex].iTimedEntity->GetChildTimeContainer();
+ if(AnimTimeContainer)
+ {
+ AnimTimeContainer->SyncPause();
+ }
+ }
+ }
+ iLrteListItem.iTimedEntity->PauseTimedEntity() ;
+
+ }
+
+//----------------------------------------------------------------------------------
+//
+/*
+TC::SyncResume()
+{
+ tc.SyncStatus = Running;
+ For all locked elements
+ {
+ If (syncStatus == running AND userStatus == running AND TC.userStatus == running)
+ {
+ Resume Element
+ }
+
+ If element = animation
+ {
+ Get Child TC pointer
+ If Child TC
+ childTc->SyncResume;
+ }
+ }
+}
+
+
+*/
+//----------------------------------------------------------------------------------
+void CSvgTimeContainer::SyncResume()
+ {
+ SetSyncState(EFalse);
+ TInt lTimedEntityListCnt = iTcTimedEntities.Count();
+ for ( TInt lItemIndex = lTimedEntityListCnt - 1; lItemIndex >= 0 ; lItemIndex-- )
+ {
+ if((iTcTimedEntities[ lItemIndex ]).iTimedEntity->GetEntitySyncBehavior() == ESvgSyncLocked )
+ {
+ if(
+ !(iTcTimedEntities[lItemIndex].iIsSyncPaused)
+ &&(iTcTimedEntities[lItemIndex].iUserState == ESvgUserRunning)
+ &&(iUserState == ESvgUserRunning)
+ )
+ {
+ iTcTimedEntities[lItemIndex].iTimedEntity->ResumeTimedEntity();
+ }
+
+ }
+
+ if(iTcTimedEntities[lItemIndex].iTimedEntity->ObjectType() == ESvgMediaAnimationElement)
+ {
+ CSvgTimeContainer* AnimTimeContainer = iTcTimedEntities[lItemIndex].iTimedEntity->GetChildTimeContainer();
+ if(AnimTimeContainer)
+ {
+ AnimTimeContainer->SyncResume();
+ }
+ }
+ }
+
+ iLrteListItem.iTimedEntity->ResumeTimedEntity();
+
+}
+//---------------------------------------------------------------
+//Sets the time container User state
+//void CSvgTimeContainer::SetUserState(TSvgEntityUserState state)
+//---------------------------------------------------------------
+void CSvgTimeContainer::SetUserState(TSvgEntityUserState state)
+{
+ iUserState = state;
+ /* #ifdef _DEBUG
+ RDebug::Print(_L("CSvgTimeContainer User State changed to %d"),state);
+ RDebug::Print(_L("\n0.ESvgUserRunning 1.ESvgUserPaused 2.ESvgUserStopped\n\n"));
+ #endif
+ */
+}
+
+
+//---------------------------------------------------------------
+//Sets the time container Media state
+//void CSvgTimeContainer::SetMediaState(TSvgEntityMediaState state)
+//---------------------------------------------------------------
+void CSvgTimeContainer::SetMediaState(TSvgEntityMediaState state)
+{
+ iMediaState = state;
+ /*
+ #ifdef _DEBUG
+ RDebug::Print(_L("CSvgTimeContainer Media State changed to %d"),state);
+ RDebug::Print(_L("\n0.ESvgMediaIdle 1.ESvgMediaNotReady 2.ESvgMediaReady\n\n"));
+ #endif
+ */
+}
+
+//---------------------------------------------------------------
+//Sets the time container sync state state
+//void CSvgTimeContainer::SetSyncState(TBool state)
+//---------------------------------------------------------------
+void CSvgTimeContainer::SetSyncState(TBool state)
+{
+ iIsSyncPaused = state;
+/* #ifdef _DEBUG
+ RDebug::Print(_L("CSvgTimeContainer iIsyncPaused changed to %d"),state);
+ RDebug::Print(_L("\n0 False 1 True\n\n"));
+ #endif
+ */
+}
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::PropogateTickToContainerElements
+// Propogate tick to all elements in time container
+// -----------------------------------------------------------------------------
+void CSvgTimeContainer::PropogateTickToContainerElements( TSvgTick& aTick )
+ {
+ // Propogate the tick to all container elements
+ TInt lTimedEntityListCnt = iTcTimedEntities.Count();
+ for ( TInt lItemIndex = lTimedEntityListCnt - 1; lItemIndex >= 0 ; lItemIndex-- )
+ {
+ (iTcTimedEntities[ lItemIndex ]).iTimedEntity->ParentTimeContainerTick( aTick );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::RearrangeTimedEntityList
+// Rearrange the timed entities as per post order
+// -----------------------------------------------------------------------------
+void CSvgTimeContainer::RearrangeTimedEntityList( RPointerArray<CSvgElementImpl>&
+ aPostOrderList )
+ {
+ TUint lCurElement = 0;
+ TUint lCurTimedEntity = 0;
+ for ( ;lCurElement < aPostOrderList.Count(); lCurElement++, lCurTimedEntity++ )
+ {
+ CSvgMediaElementBase* lCurMediaEle = ( CSvgMediaElementBase* )
+ aPostOrderList[ lCurElement ];
+
+ // Start looking in the timed entity list from lCurTimedEntity
+ TUint lListIndex = lCurTimedEntity;
+
+ // Find the element in the current timed entity list
+ /*for ( ; ( ( iTcTimedEntities[ lListIndex ].iTimedEntity !=
+ ( MSvgTimedEntityInterface* ) lCurMediaEle ) &&
+ ( lListIndex < iTcTimedEntities.Count() ) );
+ lListIndex++ )
+ {
+ }
+ */
+ do
+ {
+ if( iTcTimedEntities[ lListIndex ].iTimedEntity == ( MSvgTimedEntityInterface* ) lCurMediaEle )
+ break;
+ lListIndex++;
+ }while(lListIndex < iTcTimedEntities.Count() ) ;
+
+
+ if ( lListIndex != iTcTimedEntities.Count() )
+ {
+ if ( lListIndex != lCurTimedEntity )
+ {
+ // Not in same position, need to swap
+ TSvgTimedEntityListItem lTempItem = iTcTimedEntities[ lCurTimedEntity ];
+ iTcTimedEntities[ lCurTimedEntity ] = iTcTimedEntities[ lListIndex ];
+ iTcTimedEntities[ lListIndex ] = lTempItem;
+ }
+ }
+ else
+ {
+ // Can occur in case of Delete Timed Entity -> ignore
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgTimeContainer::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGTitleElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,285 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "SVGTitleElementImpl.h"
+#include "SVGElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+
+#include "GfxAffineTransform.h"
+
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgTitleElementImpl* CSvgTitleElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgTitleElementImpl* self = new ( ELeave )
+ CSvgTitleElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgTitleElementImpl* CSvgTitleElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgTitleElementImpl* self = new ( ELeave )
+ CSvgTitleElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgTitleElementImpl::~CSvgTitleElementImpl()
+ {
+ if ( iText )
+ {
+ delete iText;
+ iText = NULL;
+ }
+ }
+
+// *******************************************************
+// From MXmlElement
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgTitleElementImpl::GetAttributeDes( const TInt aNameId, TPtrC16& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrCdata:
+ aValue.Set( iText->Ptr() );
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeDes( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgTitleElementImpl::SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrCdata:
+ SetTextL( aValue );
+ break;
+
+ default:
+ return CSvgElementImpl::SetAttributeDesL( aNameId, aValue );
+ }
+
+ return KErrNone;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TInt CSvgTitleElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+
+ if ( this->SetLangSpaceAttributeL( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+
+ /* if(this->SetClassName(aName, aValue))
+ {
+ return KErrNone;
+ }
+ */
+
+
+ if ( this->SetTestAttributeL( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+
+ if ( SetIdandXmlbaseL( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+
+ return KErrNone;
+ }
+
+// ==========================================================================
+// xml:space is an inheritable attribute which can have one of two values:
+//
+// default (the initial/default value for xml:space) - When xml:space="default":
+// - Remove all newline characters.
+// - Convert all tab characters into space characters.
+// - Strip off all leading and trailing space characters.
+// - All contiguous space characters will be consolidated.
+//
+// preserve - When xml:space="preserve" :
+// - Convert all newline and tab characters into space characters.
+// ==========================================================================
+void CSvgTitleElementImpl::SetTextL( const TDesC& aText )
+ {
+ _LIT( KPreserve, "preserve" );
+
+ if ( iText )
+ {
+ delete iText;
+ iText = NULL;
+ }
+
+ iText = aText.AllocL();
+ TPtr textDes = iText->Des();
+
+ // default
+ if ( XMLSpace() != KPreserve )
+ {
+ for (TInt i = textDes.Length() - 1; i >= 0; i--)
+ {
+ if (textDes[i] == '\n' || textDes[i] == '\r')
+ {
+ textDes.Delete(i,1);
+ }
+ }
+ textDes.TrimRight();
+ textDes.TrimLeft();
+ }
+ // preserve
+ else
+ {
+ TInt textDesLength = textDes.Length();
+ for ( TInt i = 0; i < textDesLength; i++ )
+ {
+ // ms-dos carriage return contains two characters: 13, 10
+ if ( i + 1 < textDes.Length() && (TInt)textDes[i] == 13 && (TInt)textDes[i+1] == 10 )
+ {
+ textDes[i] = ' ';
+ textDes.Delete( i+1, 1 );
+ }
+ else if ( TChar(textDes[i]).IsSpace() )
+ {
+ textDes[i] = ' ';
+ }
+ }
+ }
+ }
+
+// *******************************************************
+// From CSvgElementImpl
+
+// perform a deep clone of this object
+// ==========================================================================
+// Need method description
+// ==========================================================================
+MXmlElement* CSvgTitleElementImpl::CloneL(MXmlElement* aParentElement)
+ {
+ CSvgTitleElementImpl* newElement = CSvgTitleElementImpl::NewL( this->ElemID(), ((CSvgDocumentImpl*)iOwnerDocument) );
+
+ CleanupStack::PushL(newElement);
+ newElement->iParentNode = aParentElement;
+ // copy everything over
+ this->CopyL(newElement);
+ CleanupStack::Pop();
+ return newElement;
+
+ }
+
+// ==========================================================================
+// perform a deep copy of this object
+// ==========================================================================
+void CSvgTitleElementImpl::CopyL( CSvgTitleElementImpl* aDestElement )
+ {
+ if(aDestElement)
+ {
+
+ // copy stuff from superclass
+ this->CSvgElementImpl::CopyL(aDestElement);
+
+ if(this->iText)
+ {
+ delete aDestElement->iText;
+ aDestElement->iText= NULL;
+ aDestElement->iText= (this->iText)->AllocL();
+ }
+
+ // copy the reference to idoc (CSvgDocumentImpl)
+ aDestElement->iOwnerDocument = this->iOwnerDocument;
+ }
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+TBool CSvgTitleElementImpl::DrawL( CGfx2dGc* /* aGc */,
+ CSvgElementImpl* /* aElement */ )
+ {
+ return EFalse;
+ }
+
+
+// *******************************************************
+// Private
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgTitleElementImpl::ConstructL( const TUint8 aElemID )
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+
+ iText = HBufC::NewL( 2 );
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgTitleElementImpl::CSvgTitleElementImpl( CSvgDocumentImpl* aDoc )
+ {
+ SetOwnerDocument( aDoc );
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgTitleElementImpl::Print( TBool aIsEncodeOn )
+ {
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<title>");
+ #endif
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGTokenizer.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,315 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include "SVGTokenizer.h"
+
+TTokenizer::TTokenizer( const TPtrC& aString )
+{
+ iString.Set( Trim( aString ) );
+ iCurrentIndex = 0;
+ iPreviousIndex = 0;
+}
+
+TBool TTokenizer::IsAtEnd()
+{
+ return iCurrentIndex >= EndIndex();
+}
+
+TInt TTokenizer::EndIndex()
+{
+ return iString.Length();
+}
+
+TUint16 TTokenizer::NextChar()
+{
+ if ( IsAtEnd() )
+ return '\0';
+ else
+ return iString[iCurrentIndex];
+}
+
+void TTokenizer::Advance( TInt aCount )
+{
+ iCurrentIndex += aCount;
+ if ( iCurrentIndex > EndIndex() )
+ iCurrentIndex = EndIndex();
+ else if ( iCurrentIndex < 0 )
+ iCurrentIndex = 0;
+
+ iPreviousIndex = iCurrentIndex;
+}
+
+TBool TTokenizer::SkipInteger()
+{
+ if ( iCurrentIndex >= EndIndex() )
+ return EFalse;
+
+ if ( NextChar() == '-' || NextChar() == '+' )
+ {
+ TInt index = iCurrentIndex;
+ iCurrentIndex++;
+ if ( SkipInteger() )
+ {
+ iPreviousIndex = index;
+ return ETrue;
+ }
+ else
+ {
+ iCurrentIndex = index;
+ iPreviousIndex = iCurrentIndex;
+ return EFalse;
+ }
+ }
+
+ iPreviousIndex = iCurrentIndex;
+ TInt index = iCurrentIndex;
+
+ while ( index < EndIndex() && IsDigit( iString[index] ) )
+ {
+ index++;
+ }
+ if ( IsAtEnd() )
+ return EFalse;
+
+ iCurrentIndex = index;
+ return ETrue;
+}
+
+TBool TTokenizer::SkipDecimal()
+{
+ if ( iCurrentIndex >= EndIndex() )
+ return EFalse;
+
+ if ( NextChar() == '-' || NextChar() == '+' )
+ {
+ TInt index = iCurrentIndex;
+ iCurrentIndex++;
+ if ( NextChar() != '-' && NextChar() != '+' && SkipDecimal() )
+ {
+ iPreviousIndex = index;
+ return ETrue;
+ }
+ else
+ {
+ iCurrentIndex = index;
+ iPreviousIndex = iCurrentIndex;
+ return EFalse;
+ }
+ }
+
+ if ( NextChar() == '.' )
+ {
+ TInt index = iCurrentIndex;
+ Advance( 1 ); // skip '.'
+ if ( !IsDigit( NextChar() ) )
+ {
+ // Only found '.' and no digits following
+ Advance( -1 );
+ return EFalse;
+ }
+ else
+ {
+ // '.xxx'
+ SkipInteger();
+ iPreviousIndex = index;
+ return ETrue;
+ }
+ }
+ else if ( IsDigit( NextChar() ) )
+ {
+ SkipInteger();
+ if ( NextChar() != '.' )
+ {
+ // 'xxx'
+ return ETrue;
+ }
+ else
+ {
+ TInt index = iPreviousIndex;//iCurrentIndex;
+ Advance( 1 ); // skip '.'
+
+ SkipInteger();
+ iPreviousIndex = index;
+ return ETrue;
+ }
+
+ }
+ return EFalse;
+}
+
+TBool TTokenizer::SkipHex()
+{
+ if ( iCurrentIndex >= EndIndex() )
+ return EFalse;
+
+ iPreviousIndex = iCurrentIndex;
+ TInt index = iCurrentIndex;
+
+ while ( index < EndIndex() && IsHexDigit( iString[index] ) )
+ {
+ index++;
+ }
+ if ( IsAtEnd() )
+ return EFalse;
+
+ iCurrentIndex = index;
+ return ETrue;
+}
+
+TBool TTokenizer::SkipWhiteSpace()
+{
+ if ( iCurrentIndex >= EndIndex() )
+ return EFalse;
+
+ iPreviousIndex = iCurrentIndex;
+ TInt index = iCurrentIndex;
+
+ while ( index < EndIndex() && IsWhiteSpace( iString[index] ) )
+ {
+ index++;
+ }
+ if ( IsAtEnd() )
+ return EFalse;
+
+ iCurrentIndex = index;
+ return ETrue;
+}
+
+TBool TTokenizer::SkipUntil( TUint16 aChar )
+{
+ if ( IsAtEnd() )
+ return EFalse;
+
+ iPreviousIndex = iCurrentIndex;
+
+ TPtrC remaining( &iString.Ptr()[iCurrentIndex], iString.Length() - iCurrentIndex );
+ TInt index = IndexOf( remaining, aChar );
+ if ( index == -1 )
+ return EFalse;
+
+ iCurrentIndex += index;
+ return ETrue;
+}
+
+TBool TTokenizer::SkipUntilEnd( )
+{
+ if ( IsAtEnd() )
+ return EFalse;
+
+ iPreviousIndex = iCurrentIndex;
+
+ TPtrC remaining( &iString.Ptr()[iCurrentIndex], iString.Length() - iCurrentIndex );
+ TInt index = remaining.Length();
+
+ iCurrentIndex += index;
+ return ETrue;
+}
+
+TBool TTokenizer::StartsWith( const TDesC& aString )
+{
+ if ( IsAtEnd() || aString.Length() > iString.Length() - iCurrentIndex )
+ return EFalse;
+
+ TPtrC remaining( &iString.Ptr()[iCurrentIndex], aString.Length() );
+ return remaining == aString;
+}
+
+TPtrC TTokenizer::SkippedString()
+{
+ return TPtrC( &iString.Ptr()[iPreviousIndex], iCurrentIndex - iPreviousIndex );
+}
+
+TPtrC TTokenizer::Remainder()
+{
+ if ( iString.Length() == 0 )
+ return TPtrC( NULL, 0 );
+ else
+ return TPtrC( &iString.Ptr()[iCurrentIndex], iString.Length() - iCurrentIndex );
+}
+//------------------------------------------------------
+// Helping Functions
+//------------------------------------------------------
+TBool TTokenizer::IsWhiteSpace( TUint16 aChar )
+{
+ return ( aChar == ' ' ) || ( aChar == '\t' ) || ( aChar == '\n' );
+}
+
+TBool TTokenizer::IsDigit( TUint16 aChar )
+{
+ return ( aChar >= '0' && aChar <= '9' );
+}
+
+TBool TTokenizer::IsHexDigit( TUint16 aChar )
+{
+ return ( aChar >= '0' && aChar <= '9' ) ||
+ ( aChar >= 'a' && aChar <= 'f' ) ||
+ ( aChar >= 'A' && aChar <= 'F' );
+}
+
+TInt TTokenizer::IndexOf( const TDesC& aString, TUint16 aChar )
+{
+ TInt length = aString.Length();
+ for ( TInt i = 0; i < length; i++ )
+ {
+ if ( aString[i] == aChar )
+ return i;
+ }
+ return -1;
+}
+
+TPtrC TTokenizer::Trim( const TDesC& aString )
+{
+ TInt startIndex = 0;
+ for ( ; startIndex < aString.Length() && IsWhiteSpace( aString[startIndex] ); startIndex++ )
+ {
+ }
+
+ TInt endIndex = aString.Length();
+ for ( ; endIndex > 0 && IsWhiteSpace( aString[endIndex-1] ); endIndex-- )
+ {
+ }
+
+ return TPtrC( &aString.Ptr()[startIndex], endIndex - startIndex );
+}
+
+TBool TTokenizer::ParseDecimal( const TDesC& aString, TReal32& aValue, TPtrC& aRemainder )
+ {
+ TTokenizer tokenizer( aString );
+ tokenizer.SkipWhiteSpace();
+
+ // blank, setting to zero
+ if ( tokenizer.IsAtEnd() )
+ {
+ return EFalse;
+ }
+
+ if ( tokenizer.SkipDecimal() )
+ {
+ // Decimal number, extract it
+ TPtrC decimalString = tokenizer.SkippedString();
+ TLex lex( decimalString );
+ // Specify the decimal seperator, instead of using
+ // locale specific seperator.
+ lex.Val( aValue, '.' );
+
+ tokenizer.SkipWhiteSpace();
+ aRemainder.Set( tokenizer.Remainder() );
+ return ETrue;
+ }
+ return EFalse;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGTransformListImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,332 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include "GfxAffineTransform.h"
+#include "SVGTransformListImpl.h"
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgTransformListImpl* CSvgTransformListImpl::NewL()
+ {
+ CSvgTransformListImpl* self = new ( ELeave ) CSvgTransformListImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgTransformListImpl* CSvgTransformListImpl::NewLC()
+ {
+ CSvgTransformListImpl* self = new ( ELeave ) CSvgTransformListImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgTransformListImpl::~CSvgTransformListImpl()
+ {
+ iTransformations.Close();
+ iTransformAdditive.Close();
+ iTransformTypes.Close();
+ }
+
+// *******************************************************
+// From SVG DOM
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgTransformListImpl::AppendItemL( TGfxAffineTransform& aTransform )
+ {
+ iTransformations.AppendL( aTransform );
+ iTransformAdditive.AppendL( 2 ); // do nothing if not set Default: additive
+ iTransformTypes.AppendL( 0 ); // Default: not animMotion
+ iAvoidConsolidation = EFalse;
+ return ETrue;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgTransformListImpl::AppendItemL( TGfxAffineTransform& aTransform,
+ TInt32 aAdditive,
+ TInt32 aSrcAnimMotion )
+ {
+ iTransformations.AppendL( aTransform );
+ iTransformAdditive.AppendL( aAdditive );
+ iTransformTypes.AppendL( aSrcAnimMotion );
+ iAvoidConsolidation = EFalse;
+ return ETrue;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTransformListImpl::Clear()
+ {
+ iTransformations.Reset();
+ iAvoidConsolidation = EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TGfxAffineTransform CSvgTransformListImpl::Consolidate(TBool aOverwriteTrans)
+ {
+ if(!iAvoidConsolidation)
+ {
+ TInt numTransforms = iTransformations.Count();
+ TInt i;
+ TGfxAffineTransform tr,tr2,tr3;
+ TGfxAffineTransform tmpAnimMotion;
+ TInt32 tmpAdditive;
+ TInt32 tmpAnimType;
+
+ for ( i = 0; i < numTransforms; i++ )
+ {
+ tmpAdditive = iTransformAdditive[i];
+ tmpAnimType = iTransformTypes[i];
+ if ( tmpAnimType == 0 )
+ {
+ tr.Concatenate( iTransformations[i]);
+ }
+ }
+
+ // first find the animate Motion
+
+ for ( i = numTransforms-1 ; i > -1 ; i-- )
+ {
+ tmpAdditive = iTransformAdditive[i];
+ tmpAnimType = iTransformTypes[i];
+ if ( tmpAnimType == 1 && tmpAdditive == 0 )
+ {
+ {
+ // overwrite the previous animTrans transforms,
+ // but not the previous animMotion transforms
+ //tr = iTransformations[i];
+ tr2.Concatenate( iTransformations[i] );
+ //i--;
+ break;
+ }
+ }
+ }
+ i++;
+ for ( ;i < numTransforms; i++ )
+ {
+ if ( 1 == iTransformTypes[i] )
+ {
+ /*tmpAnimMotion = iTransformations[i];*/
+ tr.Concatenate(tmpAnimMotion);
+ tr2.Concatenate( iTransformations[i] );
+ }
+ }
+
+
+
+ for ( i = 0; i < numTransforms; i++ )
+ {
+ tmpAdditive = iTransformAdditive[i];
+ tmpAnimType = iTransformTypes[i];
+
+ if ( tmpAnimType == 2 )
+ {
+ // if matrix is additive, continue calculation
+ if ( !aOverwriteTrans)
+ {
+ tr3.Concatenate( iTransformations[i] );
+ }
+ else
+ {
+ // overwrite the previous animTrans transforms,
+ // but not the previous animMotion transforms
+ //tr = tmpAnimMotion;
+ tr = tmpAnimMotion;
+ tr3 = iTransformations[i];
+ }
+ }
+
+ }
+
+
+ tr.Concatenate(tr2);
+ tr.Concatenate(tr3);
+ /*Saving Conslidated Matrix for Later use*/
+ iConsolidatedMatrix.iM00 = tr.iM00;
+ iConsolidatedMatrix.iM01 = tr.iM01;
+ iConsolidatedMatrix.iM02 = tr.iM02;
+ iConsolidatedMatrix.iM10 = tr.iM10;
+ iConsolidatedMatrix.iM11 = tr.iM11;
+ iConsolidatedMatrix.iM12 = tr.iM12;
+ iConsolidatedMatrix.iTransType = tr.iTransType;
+
+ iAvoidConsolidation = ETrue;
+ }
+ return iConsolidatedMatrix;
+
+ }
+
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TGfxAffineTransform CSvgTransformListImpl::GetItem( TInt aIndex )
+ {
+ if(aIndex < iTransformations.Count())
+ {
+ return iTransformations[aIndex];
+ }
+ else
+ {
+ // what does this means.
+ TGfxAffineTransform a;
+ return a;
+
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgTransformListImpl::NumberOfItems()
+ {
+ return iTransformations.Count();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TGfxAffineTransform CSvgTransformListImpl::InitializeL( TGfxAffineTransform& aNewItem )
+ {
+ iTransformations.Reset();
+ iTransformations.AppendL( aNewItem );
+ iAvoidConsolidation = EFalse;
+ return aNewItem;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TGfxAffineTransform CSvgTransformListImpl::ReplaceItem( TGfxAffineTransform newItem,
+ int aIndex )
+ {
+ if(aIndex < iTransformations.Count())
+ {
+ iTransformations[ aIndex ] = newItem;
+ }
+ iAvoidConsolidation = EFalse;
+ return newItem;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTransformListImpl::SetAdditive( TInt32 additive, TInt32 index )
+ {
+ iTransformAdditive[ index ] = additive;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgTransformListImpl* CSvgTransformListImpl::CloneL()
+ {
+ CSvgTransformListImpl* retValue = CSvgTransformListImpl::NewL();
+
+ CleanupStack::PushL(retValue);
+ TInt i;
+ // copy iTransformations
+ retValue->iTransformations.Reset();
+ TInt transformationCnt = this->iTransformations.Count();
+ for (i=0; i<transformationCnt; i++)
+ retValue->iTransformations.AppendL(this->iTransformations[i]);
+ {
+ }
+
+ // copy iTransformAdditive
+ retValue->iTransformAdditive.Reset();
+ TInt transformAdditiveCnt = this->iTransformAdditive.Count();
+ for (i=0; i<transformAdditiveCnt; i++)
+ {
+ retValue->iTransformAdditive.AppendL(this->iTransformAdditive[i]);
+ }
+
+ // copy iTransformTypes
+ retValue->iTransformTypes.Reset();
+ TInt transformTypesCnt = this->iTransformTypes.Count();
+ for (i=0; i<transformTypesCnt; i++)
+ {
+ retValue->iTransformTypes.AppendL(this->iTransformTypes[i]);
+ }
+ CleanupStack::Pop();
+ return retValue;
+ }
+
+// *******************************************************
+// Private
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTransformListImpl::ConstructL()
+ {
+ TGfxAffineTransform tr;
+ iTransformations.AppendL( tr );
+
+ iTransformAdditive.AppendL( 2 ); // pass
+
+ iTransformTypes.AppendL( 0 );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgTransformListImpl::CSvgTransformListImpl() : iTransformations( 1 ),
+ iTransformAdditive( 1 ),
+ iTransformTypes( 1 )
+
+ {
+ }
+
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgTransformListImpl::SetAvoidConsolidation(TBool aAvoidConsolidation)
+ {
+ iAvoidConsolidation = aAvoidConsolidation;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGTransformableImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,146 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include "SVGTransformableImpl.h"
+
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgTransformableImpl* CSvgTransformableImpl::NewL()
+ {
+ CSvgTransformableImpl* self = new ( ELeave ) CSvgTransformableImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgTransformableImpl* CSvgTransformableImpl::NewLC()
+ {
+ CSvgTransformableImpl* self = new ( ELeave ) CSvgTransformableImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+
+ return self;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgTransformableImpl::~CSvgTransformableImpl()
+ {
+ if ( iTransform )
+ {
+ delete iTransform;
+ iTransform = NULL;
+ }
+ }
+
+// From MSvgTransformable
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgTransformableImpl::GetTransform( MSvgTransformList*& aTransformList )
+ {
+ aTransformList = ( MSvgTransformList * ) iTransform;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgTransformableImpl::SetTransform( MSvgTransformList*& aTransformList )
+ {
+ iTransform = ( CSvgTransformListImpl * ) aTransformList;
+ iTransform->SetAvoidConsolidation(EFalse);
+ }
+
+// From MSvgLocatable
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+const TGfxAffineTransform& CSvgTransformableImpl::GetCTM()
+ {
+ return iCTM;
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgTransformableImpl::SetCTM( TGfxAffineTransform& aTr )
+ {
+ iCTM = aTr;
+ }
+
+// Private
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+void CSvgTransformableImpl::ConstructL()
+ {
+ iTransform = CSvgTransformListImpl::NewL();
+ }
+
+// ==========================================================================
+// Need method description
+// ==========================================================================
+CSvgTransformableImpl::CSvgTransformableImpl()
+ {
+ }
+
+// ==========================================================================
+// perform a deep clone of this object
+// ==========================================================================
+CSvgTransformableImpl* CSvgTransformableImpl::CloneL()
+ {
+ CSvgTransformableImpl* newObject = CSvgTransformableImpl::NewL();
+ CleanupStack::PushL(newObject);
+
+ // copy iTransform
+ if (newObject->iTransform != NULL)
+ {
+ delete newObject->iTransform;
+ newObject->iTransform= NULL;
+ }
+ newObject->iTransform = this->iTransform->CloneL();
+
+ // copy iCTM
+ newObject->iCTM = this->iCTM;
+ CleanupStack::Pop();
+
+ return newObject;
+ }
+
+
+void CSvgTransformableImpl::SetTransformList(TGfxAffineTransform& aTr)
+ {
+ iTransform->ReplaceItem(aTr, 0);
+ iTransform->SetAvoidConsolidation(EFalse);
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGUriReferenceImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,429 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#include "SVGUriReferenceImpl.h"
+#include "SVGSchemaData.h"
+
+_LIT( KXlinkActuate, "xlink:actuate" );
+_LIT( KXlinkArcrole, "xlink:arcrole" );
+_LIT( KXlinkRole, "xlink:role" );
+_LIT( KXlinkShow, "xlink:show" );
+_LIT( KXlinkTitle, "xlink:title" );
+_LIT( KXlinkType, "xlink:type" );
+_LIT( KXlinkHref, "xlink:href" );
+
+
+// ---------------------------------------------------------------------------
+// Two phase constructiion:
+// - Implements the SVGXlink
+// - There is no DOM interface defined.
+// ---------------------------------------------------------------------------
+CSvgUriReferenceImpl* CSvgUriReferenceImpl::NewL()
+ {
+ CSvgUriReferenceImpl* self = new ( ELeave ) CSvgUriReferenceImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgUriReferenceImpl* CSvgUriReferenceImpl::NewLC()
+ {
+ CSvgUriReferenceImpl* self = new ( ELeave ) CSvgUriReferenceImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgUriReferenceImpl::~CSvgUriReferenceImpl()
+ {
+ if ( iXlinkActuate )
+ {
+ delete iXlinkActuate;
+ iXlinkActuate = NULL;
+ }
+
+ if ( iXlinkArcrole )
+ {
+ delete iXlinkArcrole;
+ iXlinkArcrole = NULL;
+ }
+
+ if ( iXlinkRole )
+ {
+ delete iXlinkRole;
+ iXlinkRole = NULL;
+ }
+
+ if ( iXlinkShow )
+ {
+ delete iXlinkShow;
+ iXlinkShow = NULL;
+ }
+
+ if ( iXlinkTitle )
+ {
+ delete iXlinkTitle;
+ iXlinkTitle = NULL;
+ }
+
+ if ( iXlinkType)
+ {
+ delete iXlinkType;
+ iXlinkType = NULL;
+ }
+
+ if ( iXlinkHref )
+ {
+ delete iXlinkHref;
+ iXlinkHref = NULL;
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgUriReferenceImpl::ConstructL()
+ {
+ iXlinkActuate = HBufC::NewL( 0 );
+ iXlinkArcrole = HBufC::NewL( 0 );
+ iXlinkRole = HBufC::NewL( 0 );
+ iXlinkShow = HBufC::NewL( 0 );
+ iXlinkTitle = HBufC::NewL( 0 );
+ iXlinkType = HBufC::NewL( 0 );
+ iXlinkHref = HBufC::NewL( 0 );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TDesC& CSvgUriReferenceImpl::XlinkActuate()
+ {
+ return *iXlinkActuate;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TDesC& CSvgUriReferenceImpl::XlinkArcrole()
+ {
+ return *iXlinkArcrole;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TDesC& CSvgUriReferenceImpl::XlinkRole()
+ {
+ return *iXlinkRole;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TDesC& CSvgUriReferenceImpl::XlinkShow()
+ {
+ return *iXlinkShow;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TDesC& CSvgUriReferenceImpl::XlinkTitle()
+ {
+ return *iXlinkTitle;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TDesC& CSvgUriReferenceImpl::XlinkType()
+ {
+ return *iXlinkType;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TDesC& CSvgUriReferenceImpl::XlinkHref()
+ {
+ return *iXlinkHref;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TDesC& CSvgUriReferenceImpl::Href()
+ {
+ return *iXlinkHref;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TDesC* CSvgUriReferenceImpl::HrefPointer()
+ {
+ return iXlinkHref;
+ }
+
+// Implementation
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgUriReferenceImpl::SetXlinkAttributeL( const TDesC& aPropertyName,
+ const TDesC& aValue )
+ {
+ if ( aPropertyName == KXlinkActuate )
+ {
+ if(iXlinkActuate)
+ {
+
+ delete iXlinkActuate;
+ iXlinkActuate = NULL;
+
+ }
+ iXlinkActuate = aValue.AllocL();
+ }
+ else if ( aPropertyName == KXlinkArcrole )
+ {
+ if(iXlinkArcrole)
+ {
+ delete iXlinkArcrole;
+ iXlinkArcrole = NULL;
+
+ }
+ iXlinkArcrole = aValue.AllocL();
+ }
+ else if ( aPropertyName == KXlinkRole )
+ {
+ if(iXlinkRole)
+ {
+ delete iXlinkRole;
+ iXlinkRole = NULL;
+
+ }
+ iXlinkRole = aValue.AllocL();
+ }
+ else if ( aPropertyName == KXlinkShow )
+ {
+ if(iXlinkShow)
+ {
+ delete iXlinkShow;
+ iXlinkShow = NULL;
+
+ }
+ iXlinkShow = aValue.AllocL();
+ }
+ else if ( aPropertyName == KXlinkTitle )
+ {
+ if(iXlinkTitle)
+ {
+ delete iXlinkTitle;
+ iXlinkTitle = NULL;
+
+ }
+ iXlinkTitle = aValue.AllocL();
+ }
+ else if ( aPropertyName == KXlinkType )
+ {
+ if(iXlinkType)
+ {
+ delete iXlinkType;
+ iXlinkType = NULL;
+
+ }
+ iXlinkType = aValue.AllocL();
+ }
+ else if ( aPropertyName == KXlinkHref )
+ {
+ if(iXlinkType)
+ {
+ delete iXlinkHref;
+ iXlinkHref = NULL;
+
+ }
+ iXlinkHref = aValue.AllocL();
+ }
+ else
+ {
+ return EFalse;
+ }
+
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgUriReferenceImpl* CSvgUriReferenceImpl::CloneL()
+ {
+ CSvgUriReferenceImpl* retValue = CSvgUriReferenceImpl::NewL();
+ CleanupStack::PushL(retValue);
+ // copy iXlinkActuate
+ if(retValue->iXlinkActuate)
+ {
+ delete retValue->iXlinkActuate;
+ retValue->iXlinkActuate = NULL;
+
+ }
+ retValue->iXlinkActuate = this->iXlinkActuate->AllocL();
+
+ // copy iXlinkArcrole
+ if(retValue->iXlinkArcrole)
+ {
+ delete retValue->iXlinkArcrole;
+ retValue->iXlinkArcrole = NULL;
+ }
+ retValue->iXlinkArcrole = this->iXlinkArcrole->AllocL();
+
+ // copy iXlinkRole
+ if(retValue->iXlinkRole)
+ {
+ delete retValue->iXlinkRole;
+ retValue->iXlinkRole = NULL;
+
+ }
+ retValue->iXlinkRole = this->iXlinkRole->AllocL();
+
+
+ // copy iXlinkShow
+ if(retValue->iXlinkShow)
+ {
+ delete retValue->iXlinkShow;
+ retValue->iXlinkShow = NULL;
+
+ }
+ retValue->iXlinkShow = this->iXlinkShow->AllocL();
+
+ // copy iXlinkTitle
+ if(retValue->iXlinkTitle)
+ {
+ delete retValue->iXlinkTitle;
+ retValue->iXlinkTitle = NULL;
+
+ }
+ retValue->iXlinkTitle = this->iXlinkTitle->AllocL();
+
+ // copy iXlinkType
+ if(retValue->iXlinkType)
+ {
+ delete retValue->iXlinkType;
+ retValue->iXlinkType = NULL;
+
+ }
+ retValue->iXlinkType = this->iXlinkType->AllocL();
+
+ // copy iXlinkHref
+ if(retValue->iXlinkHref)
+ {
+ delete retValue->iXlinkHref;
+ retValue->iXlinkHref = NULL;
+
+ }
+ retValue->iXlinkHref = this->iXlinkHref->AllocL();
+
+ CleanupStack::Pop();
+ return retValue;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgUriReferenceImpl::SetUriRefDesL( const TUint16 aPropertyName,
+ const TDesC& aValue )
+ {
+ if ( aPropertyName == KAtrXlinkactuate )
+ {
+ if(iXlinkActuate)
+ {
+ delete iXlinkActuate;
+ iXlinkActuate = NULL;
+ }
+ iXlinkActuate = aValue.AllocL();
+ }
+ else if ( aPropertyName == KAtrXlinkarcrole )
+ {
+ if(iXlinkArcrole)
+ {
+ delete iXlinkArcrole;
+ iXlinkArcrole = NULL;
+ }
+ iXlinkArcrole = aValue.AllocL();
+ }
+ else if ( aPropertyName == KAtrXlinkrole )
+ {
+ if(iXlinkRole)
+ {
+ delete iXlinkRole;
+ iXlinkRole = NULL;
+ }
+ iXlinkRole = aValue.AllocL();
+ }
+ else if ( aPropertyName == KAtrXlinkshow )
+ {
+ if(iXlinkShow)
+ {delete iXlinkShow;
+ iXlinkShow = NULL;
+ }
+ iXlinkShow = aValue.AllocL();
+ }
+ else if ( aPropertyName == KAtrXlinktitle )
+ {
+ if(iXlinkTitle)
+ {
+ delete iXlinkTitle;
+ iXlinkTitle = NULL;
+ }
+ iXlinkTitle = aValue.AllocL();
+ }
+ else if ( aPropertyName == KAtrXlinktype )
+ {
+ if(iXlinkType)
+ {
+ delete iXlinkType;
+ iXlinkType = NULL;
+ }
+ iXlinkType = aValue.AllocL();
+ }
+ else if ( aPropertyName == KAtrXlinkhref )
+ {
+ if(iXlinkHref)
+ {
+ delete iXlinkHref;
+ iXlinkHref = NULL;
+ }
+ iXlinkHref = aValue.AllocL();
+ }
+ else
+ {
+ return KErrNotFound;
+ }
+ return KErrNone;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGUseElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,673 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include "SVGUseElementImpl.h"
+#include "SVGElementImpl.h"
+#include "SVGDocumentImpl.h"
+
+#include "GfxAffineTransform.h"
+
+#include "SVGImageElementImpl.h"
+
+_LIT( XLINKHREF, "xlink:href" );
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+CSvgUseElementImpl* CSvgUseElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgUseElementImpl* self = new ( ELeave ) CSvgUseElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+CSvgUseElementImpl* CSvgUseElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+
+ {
+ CSvgUseElementImpl* self = new ( ELeave ) CSvgUseElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgUseElementImpl::ConstructL( const TUint8 aElemID)
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+
+ iSvgStyleProperties = new(ELeave) RPointerArray<CCssValue>(KCSS_MAX_ATTR);
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+ iSvgStyleProperties->Remove( 0 );
+ iSvgTransformable = CSvgTransformableImpl::NewL();
+ iSvgUriReferenceImpl = CSvgUriReferenceImpl::NewL();
+
+ #ifdef SVG_FLOAT_BUILD
+ iX = 0 ;
+ iY = 0 ;
+ #else
+ iX.operator = ( 0 );
+ iY.operator = ( 0 );
+ #endif
+ //iXSet = EFalse;
+ //iYSet = EFalse;
+
+ iReqAttrFlag = KAtrXlinkhref;
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgUseElementImpl::~CSvgUseElementImpl()
+ {
+
+ if ( iSvgUriReferenceImpl )
+ {
+ delete iSvgUriReferenceImpl;
+ iSvgUriReferenceImpl = NULL;
+ }
+
+ if ( iSvgStyleProperties )
+ {
+ iSvgStyleProperties->Close();
+ delete iSvgStyleProperties;
+ iSvgStyleProperties = NULL;
+ }
+ if ( iUseHRef )
+ {
+ delete iUseHRef;
+ iUseHRef = NULL;
+ }
+ }
+
+// *******************************************************
+// From SVG DOM
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgUseElementImpl::X()
+ {
+ return iX;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgUseElementImpl::Y()
+ {
+ return iY;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgUseElementImpl::Width()
+ {
+ return iWidth;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgUseElementImpl::Height()
+ {
+ return iHeight;
+ }
+
+// *******************************************************
+// SVG Implementation
+
+
+// *******************************************************
+// From MXmlElement
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgUseElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+ // Get the path from the xlink
+ _LIT( KXLink, "xlink:href" );
+ if ( aName == KXLink )
+ {
+ iReqAttrFlag = 0;
+
+ // STEP 1 - Get the reference element
+ // If the first char is '#' then remove it
+ // This is possible if coming from cXML parser and not CVG Decoder
+
+ TInt pos1 = aValue.Locate('/');
+
+ if ( pos1 != KErrNotFound)
+ {
+ if (iOwnerDocument)
+ {
+ _LIT( KMsg, "Non-local valid URI in <use> element" );
+ ((CSvgDocumentImpl*)iOwnerDocument)->SetError( KErrNotFound, KMsg, aValue );
+ ((CSvgDocumentImpl*)iOwnerDocument)->SetIsWarning( ETrue );
+ }
+ }
+
+ TInt pos = aValue.Locate( '#' );
+ if ( pos != KErrNotFound && pos == 0 )
+ {
+ TPtrC ptr( &aValue[1], aValue.Length() - 1);
+
+ // Maintain one more class level member for JSR
+ // This member will contain the value starting with '#'
+ if ( iUseHRef )
+ {
+ delete iUseHRef;
+ iUseHRef = NULL;
+ }
+
+ iUseHRef = aValue.AllocL();
+
+ if ( this->SetXlinkAttributeL( aName, ptr ) )
+ {
+ ireferenceEl = NULL;
+ if ( iOwnerDocument )
+ {
+ ireferenceEl = (CSvgElementImpl*)((CSvgDocumentImpl*)iOwnerDocument)->GetElementById( ptr );
+
+ if ( ireferenceEl && ireferenceEl->ElemID() == KSvgUseElement)
+ {
+ ((CSvgUseElementImpl*)ireferenceEl)->iUseElementThatUsesThisUse = this;
+
+ if ( ((CSvgUseElementImpl*)ireferenceEl)->iUseElementThatUsesThisUse == iUseElementThatUsesThisUse )
+ {
+ //then there are use elements in recursion
+ // Set error in document
+ _LIT( KMsg, "URI in <use> causes recursion loop with another <use>: " );
+ ((CSvgDocumentImpl*)iOwnerDocument)->SetError( KErrNotFound, KMsg, aValue );
+ ((CSvgDocumentImpl*)iOwnerDocument)->SetIsWarning( EFalse );
+
+ //get rid of the loop by removing this one
+ ireferenceEl = NULL;
+ }
+ }
+
+
+ }
+ if(ireferenceEl == NULL)
+ {
+ // Set error in document
+ if ( iOwnerDocument && ((CSvgDocumentImpl*)iOwnerDocument)->iFinishedParsing )
+ {
+ _LIT( KMsg, "Invalid URI in <use> element: " );
+ ((CSvgDocumentImpl*)iOwnerDocument)->SetError( KErrNotFound, KMsg, aValue );
+ }
+ return KErrReferencedElementNotFound; // failure in finding the referenced element
+ }
+ }
+ }
+ else if ( pos > 0 && iOwnerDocument && ((CSvgDocumentImpl*)iOwnerDocument)->iFinishedParsing )
+ {
+ // Set error in document
+ _LIT( KMsg, "Non-local valid URI in <use> element: " );
+ ((CSvgDocumentImpl*)iOwnerDocument)->SetError( KErrNotFound, KMsg, aValue );
+ }
+ else if( pos == KErrNotFound )
+ {
+
+ // Maintain one more class level member for JSR
+ // This member will contain the value starting with '#'
+ if ( iUseHRef )
+ {
+ delete iUseHRef;
+ iUseHRef = NULL;
+ }
+
+ iUseHRef = aValue.AllocL();
+ TPtrC ptr( &aValue[0], aValue.Length());
+ this->SetXlinkAttributeL( aName, ptr);
+ }
+ }
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgUseElementImpl::SetAttributeDesL( const TInt aNameId,
+ const TDesC& aValue )
+{
+ switch ( aNameId )
+ {
+ case KAtrXlinkhref:
+ {
+ iReqAttrFlag = 0;
+
+ // STEP 1 - Get the reference element
+ // If the first char is '#' then remove it
+ // This is possible if coming from cXML parser and not CVG Decoder
+ TInt pos1 = aValue.Locate('/');
+
+ if ( pos1 != KErrNotFound)
+ {
+ if (iOwnerDocument)
+ {
+ _LIT( KMsg, "Non-local valid URI in <use> element" );
+ ((CSvgDocumentImpl*)iOwnerDocument)->SetError( KErrNotFound, KMsg, aValue );
+ ((CSvgDocumentImpl*)iOwnerDocument)->SetIsWarning( ETrue );
+ }
+ }
+
+
+ TInt pos = aValue.Locate( '#' );
+ if ( pos != KErrNotFound && pos == 0 )
+ {
+
+ TPtrC ptr( &aValue[1], aValue.Length() - 1);
+ // Maintain one more class level member for JSR
+ // This member will contain the value starting with '#'
+ if ( iUseHRef )
+ {
+ delete iUseHRef;
+ iUseHRef = NULL;
+ }
+ iUseHRef = aValue.AllocL();
+
+ if ( this->SetXlinkAttributeL( XLINKHREF, ptr ) )
+ {
+ ireferenceEl = NULL;
+ if ( iOwnerDocument )
+ {
+ ireferenceEl = (CSvgElementImpl*)((CSvgDocumentImpl*)iOwnerDocument)->GetElementById( ptr );
+
+ if (ireferenceEl && ireferenceEl->ElemID() == KSvgUseElement)
+ {
+ ((CSvgUseElementImpl*)ireferenceEl)->iUseElementThatUsesThisUse = this;
+
+ if ( ((CSvgUseElementImpl*)ireferenceEl)->iUseElementThatUsesThisUse == iUseElementThatUsesThisUse )
+ {
+ //then there are use elements in recursion
+ _LIT( KMsg, "URI in <use> causes recursion loop with another <use>: " );
+ ((CSvgDocumentImpl*)iOwnerDocument)->SetError( KErrNotFound, KMsg, aValue );
+ ((CSvgDocumentImpl*)iOwnerDocument)->SetIsWarning( EFalse );
+
+ //get rid of the loop by removing this one
+ ireferenceEl = NULL;
+ }
+ }
+
+ }
+ if(ireferenceEl == NULL)
+ {
+ // Set error in document
+ if ( iOwnerDocument && ((CSvgDocumentImpl*)iOwnerDocument)->iFinishedParsing)
+ {
+ _LIT( KMsg, "Invalid URI in <use> element: " );
+ ((CSvgDocumentImpl*)iOwnerDocument)->SetError( KErrNotFound, KMsg, aValue );
+ }
+ return KErrReferencedElementNotFound; // failure in finding the referenced element
+ }
+ }
+ }
+ else if ( pos > 0 && iOwnerDocument && ((CSvgDocumentImpl*)iOwnerDocument)->iFinishedParsing )
+ {
+ // Set error in document
+ _LIT( KMsg, "Non-local valid URI in <use> element: " );
+ ((CSvgDocumentImpl*)iOwnerDocument)->SetError( KErrNotFound, KMsg, aValue );
+ }
+ else if( pos == KErrNotFound )
+ {
+ // Maintain one more class level member for JSR
+ // This member will contain the value starting with '#'
+ if ( iUseHRef )
+ {
+ delete iUseHRef;
+ iUseHRef = NULL;
+ }
+
+ iUseHRef = aValue.AllocL();
+
+ TPtrC ptr( &aValue[0], aValue.Length());
+ this->SetXlinkAttributeL( XLINKHREF, ptr);
+ }
+ return KErrNone;
+ }
+
+ default:
+ {
+ return CSvgElementImpl::SetAttributeDesL( aNameId, aValue );
+ }
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgUseElementImpl::GetAttributeDes( const TInt aNameId, TPtrC16& aValue )
+ {
+
+ if ( aNameId == KAtrXlinkhref )
+ {
+ // iUseHRef contains value starting with '#'
+ if ( iUseHRef )
+ {
+ aValue.Set( *iUseHRef );
+ return KErrNone;
+ }
+
+ if ( iSvgUriReferenceImpl )
+ {
+ aValue.Set( iSvgUriReferenceImpl->Href());
+ return KErrNone;
+ }
+
+ }
+
+ return CSvgElementImpl::GetAttributeDes( aNameId, aValue );
+
+ }
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgUseElementImpl::SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrX:
+ iX = aValue;
+ //iXSet = ETrue;
+ break;
+ case KAtrY:
+
+ iY = aValue;
+ //iYSet = ETrue;
+ break;
+ case KAtrWidth:
+ iWidth = aValue;
+ break;
+
+ case KAtrHeight:
+ iHeight = aValue;
+ break;
+ default:
+ return CSvgElementImpl::SetAttributeFloatL( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgUseElementImpl::GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrX:
+ aValue = iX ;
+ break;
+ case KAtrY:
+
+ aValue = iY ;
+ break;
+ case KAtrWidth:
+ aValue = iWidth ;
+ break;
+
+ case KAtrHeight:
+ aValue = iHeight ;
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+
+// *******************************************************
+// From MXmlElementOpt
+
+// *******************************************************
+// From CSvgElementImpl
+
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgUseElementImpl::CloneL(MXmlElement* aParentElement)
+ {
+
+ CSvgUseElementImpl* newElement = CSvgUseElementImpl::NewL( this->ElemID(),
+ ((CSvgDocumentImpl*)iOwnerDocument) );
+ CleanupStack::PushL(newElement);
+
+ newElement->iParentNode = aParentElement;
+ // copy everything over
+ this->CopyL(newElement);
+CleanupStack::Pop();
+ return newElement;
+ }
+
+//---------------------------------------------------------------------------
+// perform a deep copy of this object
+//
+//---------------------------------------------------------------------------
+void CSvgUseElementImpl::CopyL( CSvgUseElementImpl* aDestElement )
+ {
+ if(aDestElement)
+ {
+ // copy stuff from superclass
+ this->CSvgElementImpl::CopyL(aDestElement);
+
+ // copy iRectangle items special to circle
+ aDestElement->iX = this->iX;
+ aDestElement->iY = this->iY;
+ aDestElement->iHeight = this->iHeight;
+ aDestElement->iWidth = this->iWidth;
+
+ aDestElement->ireferenceEl = this->ireferenceEl;
+ aDestElement->iUseElementThatUsesThisUse = this->iUseElementThatUsesThisUse;
+
+ // copy the reference to idoc (CSvgDocumentImpl)
+ aDestElement->iOwnerDocument = this->iOwnerDocument;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgUseElementImpl::DrawL( CGfx2dGc* /* aGc */,
+ CSvgElementImpl* /* aElement */ )
+ {
+ return ETrue;
+ }
+
+// *******************************************************
+// Private
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgUseElementImpl::CSvgUseElementImpl( CSvgDocumentImpl* aDoc )
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+/*
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgUseElementImpl::DeepClone( MXmlElement* aReferenceEl )
+ {
+ CSvgElementImpl*aNewElement = ( CSvgElementImpl* )
+ aReferenceEl->FirstChild();
+ while ( aNewElement )
+ {
+ DeepClone( aNewElement );
+ aNewElement = ( CSvgElementImpl * ) aNewElement->NextSibling();
+ }
+ }
+*/
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgUseElementImpl::SetReferenceElementL()
+ {
+ if( ireferenceEl != NULL )
+ {
+ CSvgElementImpl* theElement = (CSvgElementImpl *)ireferenceEl->CloneL((MXmlElement*)this);
+ CleanupStack::PushL(theElement);
+ this->CXmlElementImpl::AppendChildL(theElement);
+ CleanupStack::Pop();
+
+ //if reference element is a use element check for recursion loop
+ if (ireferenceEl->ElemID() == KSvgUseElement)
+ {
+ ((CSvgUseElementImpl*)ireferenceEl)->iUseElementThatUsesThisUse = this;
+
+ if ( ireferenceEl == iUseElementThatUsesThisUse )
+ {
+ //then there are use elements in recursion
+ _LIT( KMsg, "URI in <use> causes recursion loop with another <use>: " );
+ ((CSvgDocumentImpl*)iOwnerDocument)->SetError( KErrNotFound, KMsg, Href() );
+ ((CSvgDocumentImpl*)iOwnerDocument)->SetIsWarning( EFalse );
+
+ //get rid of the loop by removing this one
+ ireferenceEl = NULL;
+ }
+ }
+ }
+ }
+
+
+CSvgElementImpl* CSvgUseElementImpl::GetReferenceElementL()
+{
+ return ireferenceEl;
+}
+
+TInt CSvgUseElementImpl::SetRefElemById(const TDesC& aName)
+ {
+ ireferenceEl = ( CSvgElementImpl * )
+ ((CSvgDocumentImpl*)iOwnerDocument)->GetElementById( aName );
+ iReqAttrFlag = 0;
+
+ return ( ireferenceEl == NULL ) ? KErrNotFound : KErrNone;
+ }
+
+void CSvgUseElementImpl::GetUnscaledBBox( TGfxRectangle2D& aBbox )
+{
+ TGfxRectangle2D lReferenceBbox;
+ if (ireferenceEl != NULL)
+ {
+ ((CSvgElementImpl*)ireferenceEl)->GetUnscaledBBox(lReferenceBbox);
+ }
+
+ // width and height
+ aBbox.iX = lReferenceBbox.iX + X();
+ aBbox.iY = lReferenceBbox.iY + Y();
+ aBbox.iWidth = lReferenceBbox.iWidth;
+ aBbox.iHeight = lReferenceBbox.iHeight;
+}
+
+TBool CSvgUseElementImpl::IsViewable( )
+{
+ if (ireferenceEl)
+ {
+ return ireferenceEl->IsViewable();
+ }
+
+ return EFalse;
+}
+
+void CSvgUseElementImpl::GetBBox( TGfxRectangle2D& aBbox )
+{
+ TGfxRectangle2D lReferenceBbox;
+ if (ireferenceEl)
+ {
+ ((CSvgElementImpl*)ireferenceEl)->GetBBox(lReferenceBbox);
+ }
+
+ // width and height
+ aBbox.iX = lReferenceBbox.iX + X();
+ aBbox.iY = lReferenceBbox.iY + Y();
+ aBbox.iWidth = lReferenceBbox.iWidth;
+ aBbox.iHeight = lReferenceBbox.iHeight;
+
+}
+
+void CSvgUseElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<use x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xlink:href=\"hmm\">", (int)iX, (int)iY, (int)iWidth, (int)iHeight/*, Href()*/);
+ #endif
+ }
+}
+// new function
+void CSvgUseElementImpl::GetBoundingBox( TGfxRectangle2D& aBbox )
+{
+ TGfxRectangle2D lReferenceBbox;
+ if (ireferenceEl != NULL)
+ {
+ TGfxAffineTransform lTempCTM = ((CSvgElementImpl*)ireferenceEl)->GetCTM();
+ TGfxAffineTransform lElementCTM = ((CSvgElementImpl*)this)->GetCTM();
+ MSvgTransformList* trList;
+ TGfxAffineTransform lElementTransform;
+ ((CSvgElementImpl*)ireferenceEl)->GetTransform( trList);
+ lElementTransform = trList->Consolidate( ((CSvgElementImpl*)ireferenceEl)->IsOverwriteTransforms() );
+ lElementTransform.Concatenate(lElementCTM);
+
+ ((CSvgElementImpl*)ireferenceEl)->SetCTM(lElementTransform);
+ //((CSvgElementImpl*)ireferenceEl)->GetBBox(lReferenceBbox);
+ ((CSvgElementImpl*)ireferenceEl)->GetUnscaledBBox(lReferenceBbox);
+ lReferenceBbox.GetBounds(lElementTransform, lReferenceBbox);
+
+ ((CSvgElementImpl*)ireferenceEl)->SetCTM(lTempCTM);
+ }
+ // width and height
+ aBbox.iX = lReferenceBbox.iX + X();
+ aBbox.iY = lReferenceBbox.iY + Y();
+ aBbox.iWidth = lReferenceBbox.iWidth;
+ aBbox.iHeight = lReferenceBbox.iHeight;
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SVGVectorCssValueImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,171 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#ifdef _DEBUG
+#if !defined(__E32DEBUG_H__)
+#include <e32debug.h>
+#endif
+#endif
+
+#include "SVGVectorCssValueImpl.h"
+#include "SVGPointLexer.h"
+
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CVectorCssValueImpl::~CVectorCssValueImpl()
+ {
+ if ( iValue )
+ {
+ iValue->Reset();
+ delete iValue;
+ iValue = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CVectorCssValueImpl::Value( CArrayFix<TFloatFixPt>*& aArray )
+ {
+ aArray = iValue;
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CArrayFix<TFloatFixPt>* CVectorCssValueImpl::Value( )
+ {
+ return iValue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CVectorCssValueImpl::SetValueL( const TDesC& aValue )
+ {
+
+ if ( iValue )
+ {
+ iValue->Reset();
+ delete iValue;
+ iValue = NULL;
+ }
+ iValue = new ( ELeave ) CArrayFixFlat<TFloatFixPt>( 1 );
+
+
+ TSvgPointLexer svgplex( aValue );
+
+ while ( !svgplex.IsDone() )
+ {
+ TChar com = ',';
+ TFloatFixPt dashf;
+ TInt32 rslt = svgplex.GetNext( com, dashf );
+ if ( rslt != KErrNone )
+ {
+ break;
+ }
+ iValue->AppendL( dashf );
+ }
+ svgplex.Cleanup();
+
+ return KErrNone;
+ }
+
+
+// *******************************************************
+// Private
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CVectorCssValueImpl::CVectorCssValueImpl():iValue( NULL )
+ {
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CVectorCssValueImpl::CVectorCssValueImpl(CArrayFix<TFloatFixPt>* aValue ):iValue( aValue )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// function for encoding
+// ---------------------------------------------------------------------------
+void CVectorCssValueImpl::SetValueL( CArrayFix<TFloatFixPt>*& aValue )
+ {
+ if ( iValue )
+ {
+ iValue->Reset();
+ delete iValue;
+ iValue = NULL;
+ }
+
+ iValue= aValue;
+ }
+
+// ---------------------------------------------------------------------------
+// function for encoding
+// ---------------------------------------------------------------------------
+void CVectorCssValueImpl::CloneValueL( CArrayFix<TFloatFixPt>*& aValue )
+ {
+ if ( iValue )
+ {
+ iValue->Reset();
+ delete iValue;
+ iValue = NULL;
+ }
+
+ iValue = new ( ELeave ) CArrayFixFlat<TFloatFixPt>( 1 );
+
+ TInt valCnt = aValue->Count();
+ for (TInt i=0; i < valCnt; i++)
+ {
+ iValue->AppendL( aValue->At(i) );
+ }
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CVectorCssValueImpl::IsEqual( CCssValue* aValue )
+{
+ if (((CVectorCssValueImpl*)aValue)->iValue == iValue)
+ {
+ return ETrue;
+ }
+
+ return EFalse;
+}
+
+void CVectorCssValueImpl::Print()
+{
+ #ifdef _DEBUG
+
+ TInt valCnt = iValue->Count();
+ for (TInt i=0; i < valCnt; i++)
+ {
+ RDebug::Printf("%d, ", (int)(iValue->At(i)));
+ }
+ #endif
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/SvgHkernelementimpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,311 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+#include "SvgHkernelementimpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGSchemaData.h"
+
+#include "GfxAffineTransform.h"
+
+
+#ifdef SVG_FONTS_INCLUDE
+
+// ---------------------------------------------------------------------------
+// Two phase construction
+// ---------------------------------------------------------------------------
+CSvgHkernElementImpl* CSvgHkernElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgHkernElementImpl*self = new ( ELeave ) CSvgHkernElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID);
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgHkernElementImpl* CSvgHkernElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgHkernElementImpl*self = new ( ELeave ) CSvgHkernElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID );
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgHkernElementImpl::ConstructL( const TUint8 aElemID)
+ {
+ CSvgElementImpl::InitializeL( aElemID );
+
+ #ifdef SVG_FLOAT_BUILD
+ iK = TFloatFixPt(0.0f);
+ #else
+ iK = TFloatFixPt( 0 ,ETrue);
+ #endif
+
+ iG1 = HBufC::NewL( 0 );
+ iG2 = HBufC::NewL( 0 );
+ iU1 = HBufC::NewL( 0 );
+ iU2 = HBufC::NewL( 0 );
+
+ iReqAttrFlag=KSVG_HKERN_ELEMFLAG;
+
+ }
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgHkernElementImpl::~CSvgHkernElementImpl()
+ {
+ if ( iG1 )
+ {
+ delete iG1;
+ iG1 = NULL;
+ }
+
+ if ( iG2 )
+ {
+ delete iG2;
+ iG2 = NULL;
+ }
+
+ if ( iU1 )
+ {
+ delete iU1;
+ iU1 = NULL;
+ }
+
+ if (iU2)
+ {
+ delete iU2;
+ iU2 = NULL;
+ }
+ }
+
+// ===================================
+// From SVG DOM
+// ===================================
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgHkernElementImpl::GetK()
+ {
+ return iK;
+ }
+
+
+// ===================================
+// From MXmlElement
+// ===================================
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgHkernElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+
+
+
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+
+ return KErrNone;
+ }
+
+
+TInt CSvgHkernElementImpl::SetAttributeDesL( const TInt aNameId, const TDesC& aValue )
+{
+ switch (aNameId)
+ {
+ case KAtrG1:
+ delete iG1;
+ iG1 = NULL;
+ iG1 = aValue.AllocL();
+ break;
+ case KAtrG2:
+ delete iG2;
+ iG2 = NULL;
+ iG2 = aValue.AllocL();
+ break;
+ case KAtrU1:
+ delete iU1;
+ iU1 = NULL;
+ iU1 = aValue.AllocL();
+ break;
+ case KAtrU2:
+ delete iU2;
+ iU2 = NULL;
+ iU2 = aValue.AllocL();
+ break;
+ case KAtrK:
+ {
+ TLex lString ( aValue );
+ TReal32 lVal;
+ if( lString.Val( lVal, '.' ) != KErrNone )
+ lVal = 0;
+ iK = (TFloatFixPt) lVal;
+ iReqAttrFlag = 0;
+ break;
+ }
+ default: return CSvgElementImpl::SetAttributeDesL( aNameId, aValue );
+
+ }
+ return KErrNone;
+}
+
+
+// From MXmlElementOpt
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgHkernElementImpl::GetAttributeFloat( const TInt aNameId,
+ TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrK:
+ aValue = GetK();
+ break;
+ default:
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgHkernElementImpl::SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrK:
+ iK= aValue;
+ break;
+ default:
+ return CSvgElementImpl::SetAttributeFloatL( aNameId, aValue );
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgHkernElementImpl::GetAttributeDes( const TInt aNameId, TPtrC16& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrG1:
+ if ( iG1->Length() > 0 )
+ {
+ aValue.Set( *iG1 );
+ break;
+ }
+ else
+ return KErrNoAttribute;
+ case KAtrG2:
+ if ( iG2->Length() > 0 )
+ {
+ aValue.Set( *iG2 );
+ break;
+ }
+ else
+ return KErrNoAttribute;
+ case KAtrU1:
+ if ( iU1->Length() > 0 )
+ {
+ aValue.Set( *iU1 );
+ break;
+ }
+ else
+ return KErrNoAttribute;
+ case KAtrU2:
+ if ( iU2->Length() > 0 )
+ {
+ aValue.Set( *iU2 );
+ break;
+ }
+ else
+ return KErrNoAttribute;
+
+ default:
+ return CSvgElementImpl::GetAttributeDes( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+
+// ===================================
+// From CSvgElementImpl
+// ===================================
+
+// ---------------------------------------------------------------------------
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgHkernElementImpl::CloneL(MXmlElement*)
+ {
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgHkernElementImpl::DrawL( CGfx2dGc* /* aGc */,
+ CSvgElementImpl* /* aElement */ )
+ {
+ return EFalse;
+ }
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+CSvgHkernElementImpl::CSvgHkernElementImpl( CSvgDocumentImpl* aDoc )
+ {
+ SetOwnerDocument(aDoc);
+ }
+
+void CSvgHkernElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<hkern u1=\"hmm\" u2=\"hmm\" g1=\"hmm\" g2=\"hmm\" k=\"%d\" \\>", /*iU1->Des(), iU2->Des(), iG1->Des(), iG2->Des(),*/ (int)iK);
+ #endif
+ }
+}
+
+#endif //ifdef SVG_FONTS_INCLUDE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGImpl/src/Svgsvgelementimpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,944 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation source file
+ *
+*/
+
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include "SVGSvgElementImpl.h"
+#include "SVGDocumentImpl.h"
+#include "SVGEngineImpl.h"
+#include "SVGSchemaData.h"
+
+#include "SVGClrCssValueImpl.h"
+#include "SVGPaintCssValueImpl.h"
+#include "SVGIntCssValueImpl.h"
+#include "SVGFloatCssValueImpl.h"
+#include "SVGStrCssValueImpl.h"
+#include "SVGVectorCssValueImpl.h"
+#include "SVGPathElementImpl.h"
+#include "SVGAnimTimingParser.h"
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgSvgElementImpl* CSvgSvgElementImpl::NewL( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgSvgElementImpl* self = new ( ELeave ) CSvgSvgElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID);
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgSvgElementImpl* CSvgSvgElementImpl::NewLC( const TUint8 aElemID,
+ CSvgDocumentImpl* aDoc )
+ {
+ CSvgSvgElementImpl* self = new ( ELeave ) CSvgSvgElementImpl( aDoc );
+ CleanupStack::PushL( self );
+ self->ConstructL( aElemID);
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgSvgElementImpl::ConstructL( const TUint8 aElemID )
+ {
+
+ CSvgElementImpl::InitializeL( aElemID );
+
+ iSvgStyleProperties = new(ELeave) RPointerArray<CCssValue>(KCSS_MAX_ATTR);
+
+ CSvgDocumentImpl* lDocument = (CSvgDocumentImpl*)OwnerDocument();
+
+ if (!lDocument)
+ return;
+
+ // This is required to allocate buffer up to granularity so that the
+ // following Insert calls cannot leave.
+
+ User::LeaveIfError( iSvgStyleProperties->Append( NULL ) );
+ iSvgStyleProperties->Remove( 0 );
+
+ iSvgTransformable = CSvgTransformableImpl::NewL();
+
+ // Initilaise Svg Element with default values
+
+ CPaintCssValueImpl* lPaintObject = lDocument->iMemoryManager->GetCssPaintObjectL( _L("black"),(CSvgElementImpl *)this );
+ iSvgStyleProperties->InsertL(lPaintObject,KCSS_ATTR_FILL);
+
+ CClrCssValueImpl* lClrObject = lDocument->iMemoryManager->GetCssClrObjectL(_L("none"));
+ iSvgStyleProperties->InsertL(lClrObject,KCSS_ATTR_STROKE);
+
+ CFloatCssValueImpl* lFloatObject = lDocument->iMemoryManager->GetCssFloatObjectL(_L("1"));
+ iSvgStyleProperties->InsertL(lFloatObject,KCSS_ATTR_STROKEWIDTH);
+
+ //set default to visible
+ CIntCssValueImpl* lIntObject = lDocument->iMemoryManager->GetCssIntObjectL(_L("0"));
+ iSvgStyleProperties->InsertL(lIntObject,KCSS_ATTR_VISIBILITY);
+
+ iSvgStyleProperties->InsertL(NULL,KCSS_ATTR_FONTFAMILY);
+
+ CFloatCssValueImpl* lFloatObject2 = lDocument->iMemoryManager->GetCssFloatObjectL(_L("10"));
+ iSvgStyleProperties->InsertL(lFloatObject2,KCSS_ATTR_FONTSIZE);
+
+ CIntCssValueImpl* lIntObject2 = lDocument->iMemoryManager->GetCssIntObjectL(_L("0"));
+ iSvgStyleProperties->InsertL(lIntObject2,KCSS_ATTR_FONTSTYLE);
+
+ CIntCssValueImpl* lIntObject3 = lDocument->iMemoryManager->GetCssIntObjectL(_L("0"));
+ iSvgStyleProperties->InsertL(lIntObject3,KCSS_ATTR_FONTWEIGHT);
+
+ iSvgStyleProperties->InsertL(NULL,KCSS_ATTR_STROKE_DASHARRAY);
+
+ //set default to inline
+ CIntCssValueImpl* lIntObject4 = lDocument->iMemoryManager->GetCssIntObjectL(_L("0"));
+ iSvgStyleProperties->InsertL(lIntObject4,KCSS_ATTR_DISPLAY);
+
+ CStrCssValueImpl* lStrObject1 = lDocument->iMemoryManager->GetCssStrObjectL(_L("nonzero"));
+ iSvgStyleProperties->InsertL(lStrObject1,KCSS_ATTR_FILLRULE);
+
+ CStrCssValueImpl* lStrObject2 = lDocument->iMemoryManager->GetCssStrObjectL(_L("butt"));
+ iSvgStyleProperties->InsertL(lStrObject2,KCSS_ATTR_STROKE_LINECAP);
+
+ CStrCssValueImpl* lStrObject3 = lDocument->iMemoryManager->GetCssStrObjectL(_L("miter"));
+ iSvgStyleProperties->InsertL(lStrObject3,KCSS_ATTR_STROKE_LINEJOIN);
+
+ CFloatCssValueImpl* lFloatObject3 = lDocument->iMemoryManager->GetCssFloatObjectL(_L("0"));
+ iSvgStyleProperties->InsertL(lFloatObject3,KCSS_ATTR_STROKE_DASHOFFSET);
+
+ CFloatCssValueImpl* lFloatObject4 = lDocument->iMemoryManager->GetCssFloatObjectL(_L("4"));
+ iSvgStyleProperties->InsertL(lFloatObject4,KCSS_ATTR_STROKE_MITERLIMIT);
+
+ CClrCssValueImpl* lClrObject2 = lDocument->iMemoryManager->GetCssClrObjectL(_L("black"));
+ iSvgStyleProperties->InsertL(lClrObject2,KCSS_ATTR_COLOR);
+
+ CIntCssValueImpl* lIntObject5 = lDocument->iMemoryManager->GetCssIntObjectL(_L("0"));
+ iSvgStyleProperties->InsertL(lIntObject5,KCSS_ATTR_TEXTANCHOR);
+
+ CIntCssValueImpl* lIntObject6 = lDocument->iMemoryManager->GetCssIntObjectL(_L("-1"));
+ iSvgStyleProperties->InsertL(lIntObject6,KCSS_ATTR_TEXTDECORATION);
+
+ //default value is indeterminate at this point
+ iSvgStyleProperties->InsertL(NULL,KCSS_ATTR_COLORINTERPOLATION);
+
+ iSvgStyleProperties->InsertL(NULL,KCSS_ATTR_COLORRENDERING);
+
+ iSvgStyleProperties->InsertL(NULL,KCSS_ATTR_LETTERSPACING);
+
+ iSvgStyleProperties->InsertL(NULL,KCSS_ATTR_WORDSPACING);
+
+ CFloatCssValueImpl* lFloatObject5 = lDocument->iMemoryManager->GetCssFloatObjectL(_L("1"));
+ iSvgStyleProperties->InsertL(lFloatObject5,KCSS_ATTR_FILL_OPACITY);
+
+ CFloatCssValueImpl* lFloatObject6 = lDocument->iMemoryManager->GetCssFloatObjectL(_L("1"));
+ iSvgStyleProperties->InsertL(lFloatObject6,KCSS_ATTR_STROKE_OPACITY);
+
+ CFloatCssValueImpl* lFloatObject7 = lDocument->iMemoryManager->GetCssFloatObjectL(_L("1"));
+ iSvgStyleProperties->InsertL(lFloatObject7,KCSS_ATTR_GROUP_OPACITY);
+
+ iViewBoxImpl = CSvgFitToViewBoxImpl::NewL();
+
+ iBaseProfile = HBufC::NewL( 0 );
+ iVersion = HBufC::NewL( 0 );
+ SetBaseProfileL(_L("tiny"));
+ SetVersion(_L("1.1"));
+
+ iWidthInUserCoordinate = 100;
+ iHeightInUserCoordinate= 100;
+
+ }
+
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+CSvgSvgElementImpl::~CSvgSvgElementImpl()
+ {
+
+ if (iContent)
+ {
+ delete iContent;
+ iContent = NULL;
+ }
+
+ if ( iViewBoxImpl )
+ {
+ delete iViewBoxImpl;
+ iViewBoxImpl = NULL;
+ }
+
+ if ( iBaseProfile )
+ {
+ delete iBaseProfile;
+ iBaseProfile = NULL;
+ }
+ if ( iVersion )
+ {
+ delete iVersion;
+ iVersion = NULL;
+ }
+
+ if ( iSvgStyleProperties )
+ {
+ iSvgStyleProperties->Close();
+ delete iSvgStyleProperties;
+ iSvgStyleProperties = NULL;
+ }
+
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+CSvgSvgElementImpl::CSvgSvgElementImpl( CSvgDocumentImpl* aDoc ) : iZoomAndPan( ESvgZoomAndPanMagnify ),
+ iWidth(100),
+ iHeight(100),
+ iWidthInPercentage(ETrue),
+ iHeightInPercentage(ETrue),
+ iIsWidthSet(EFalse),
+ iIsHeightSet(EFalse)
+ {
+ SetOwnerDocument(aDoc);
+
+ // Obtain the default sync behaviour/tolerance from the document
+ if ( aDoc )
+ {
+ iSyncBehaviorDefault = aDoc->SyncBehaviorDefault();
+ iSyncToleranceDefault = aDoc->SyncToleranceDefault();
+ }
+
+ }
+
+
+
+// *******************************************************
+// From SVG DOM
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgSvgElementImpl::X()
+ {
+ return iX;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgSvgElementImpl::Y()
+ {
+ return iY;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgSvgElementImpl::Width()
+ {
+ return iWidth;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TFloatFixPt CSvgSvgElementImpl::Height()
+ {
+ return iHeight;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor funciton for SyncBehaviorDefault value
+// ---------------------------------------------------------------------------
+TSvgSyncBehaviour CSvgSvgElementImpl::SyncBehaviorDefault()
+ {
+ return iSyncBehaviorDefault;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor funciton for SyncBehaviorDefault value
+// ---------------------------------------------------------------------------
+TUint32 CSvgSvgElementImpl::SyncToleranceDefault()
+ {
+ return iSyncToleranceDefault;
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgSvgElementImpl::GetElementById( const TDesC& /* aElementId */ )
+ {
+ return ( CSvgElementImpl * ) NULL;
+ }
+
+// *******************************************************
+// SVG Implementation
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgSvgElementImpl::SetWidth( TFloatFixPt aWidth )
+ {
+ iWidth = aWidth;
+ }
+
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgSvgElementImpl::SetHeight( TFloatFixPt aHeight )
+ {
+ iHeight = aHeight;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+
+// *******************************************************
+// From MXmlElement
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+EXPORT_C TInt CSvgSvgElementImpl::GetAttribute( const TDesC& aName,
+ TDes& aValue )
+ {
+ _LIT( KTmpWidth, "width" );
+ _LIT( KTmpHeight, "height" );
+
+ if ( aName == KTmpWidth )
+ {
+ TFloatFixPt width;
+ GetAttributeFloat( KAtrWidth, width );
+ #ifdef SVG_FLOAT_BUILD
+ TFloatFixPt::GetString( width, aValue );
+ #else
+ width.GetString( aValue );
+ #endif
+ }
+ else if ( aName == KTmpHeight )
+ {
+ TFloatFixPt height;
+ GetAttributeFloat( KAtrHeight, height );
+ #ifdef SVG_FLOAT_BUILD
+ TFloatFixPt::GetString( height, aValue );
+ #else
+ height.GetString( aValue );
+ #endif
+ }
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgSvgElementImpl::SetAttributeL( const TDesC& aName,
+ const TDesC& aValue )
+ {
+
+
+ CSvgElementImpl::SetAttributeL(aName,aValue);
+
+ // Encapsulates both viewBox and preserveAspectRatio attributes.
+ if ( iViewBoxImpl->SetViewBoxL( aName, aValue ) )
+ {
+ return KErrNone;
+ }
+
+
+ _LIT( KTmpBaseProfile, "baseProfile" );
+ _LIT( KTmpVersion, "version" );
+ _LIT( KTmpZoomAndPan, "zoomAndPan" );
+ _LIT( KTmpDisable, "disable" );
+ _LIT( KTmpMagnify, "magnify" );
+ _LIT( KNameSpace, "xmlns" );
+ _LIT( KSvgNameSpace, "http://www.w3.org/2000/svg" );
+ _LIT( KTmpSyncBehaviorDefault, "syncBehaviorDefault" );
+ _LIT( KTmpSyncToleranceDefault,"syncToleranceDefault" );
+
+
+ TLex input ( aValue );
+
+ if ( aName == KTmpBaseProfile )
+ {
+ SetBaseProfileL( aValue );
+ }
+ else if ( aName == KTmpVersion )
+ {
+ //if (input.Val( tmpFloat, '.' ) == KErrNone)
+ SetVersion( aValue );
+ }
+ else if ( aName == KTmpZoomAndPan )
+ {
+ if ( aValue == KTmpDisable )
+ iZoomAndPan = ESvgZoomAndPanDisable;
+ else if ( aValue == KTmpMagnify )
+ iZoomAndPan = ESvgZoomAndPanMagnify;
+ }
+ else if ( aName == KNameSpace && aValue != KSvgNameSpace )
+ {
+ if ( iOwnerDocument )
+ {
+ _LIT( KMsg, "Invalid <svg> namespace: " );
+ ((CSvgDocumentImpl*)iOwnerDocument)->SetError( KErrNotFound, KMsg, aValue );
+ }
+ }
+ else if ( aName == KTmpSyncBehaviorDefault )
+ {
+ SetSyncBehaviorDefault( aValue );
+ }
+ else if ( aName == KTmpSyncToleranceDefault )
+ {
+ SetSyncToleranceDefault( aValue );
+ }
+
+ return KErrNone;
+ }
+
+// *******************************************************
+// From MXmlElementOpt
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgSvgElementImpl::GetAttributeFloat( const TInt aNameId, TFloatFixPt& aValue )
+ {
+ switch ( aNameId )
+ {
+ case KAtrX:
+ aValue = X();
+ break;
+ case KAtrY:
+ aValue = Y();
+ break;
+ case KAtrWidth:
+ aValue = Width();
+ break;
+ case KAtrHeight:
+ aValue = Height();
+ break;
+ default:
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+ return CSvgElementImpl::GetAttributeFloat( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TInt CSvgSvgElementImpl::SetAttributeFloatL( const TInt aNameId,
+ const TFloatFixPt aValue )
+ {
+ TGfxRectangle2D lViewBox;
+ switch ( aNameId )
+ {
+ case KAtrX:
+ iX = aValue;
+ break;
+ case KAtrY:
+ iY = aValue;
+ break;
+ case KAtrWidth:
+
+ iWidth = aValue;
+ if(!iIsWidthSet) // make sure that this is set only once
+ {
+ iWidthInUserCoordinate = (TReal32)aValue;
+ iIsWidthSet = ETrue;
+ }
+ break;
+ case KAtrHeight:
+
+ iHeight = aValue;
+ if(!iIsHeightSet ) // make sure that this is set only once
+ {
+ iHeightInUserCoordinate = (TReal32)aValue;
+ iIsHeightSet= ETrue;
+ }
+ break;
+
+ default:
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+ return CSvgElementImpl::SetAttributeFloatL( aNameId, aValue );
+ }
+ return KErrNone;
+ }
+
+// *******************************************************
+// From CSvgElementImpl
+
+// perform a deep clone of this object
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+MXmlElement* CSvgSvgElementImpl::CloneL(MXmlElement* aParentElement)
+ {
+
+ CSvgSvgElementImpl* retValue = CSvgSvgElementImpl::NewL(this->ElemID(), ((CSvgDocumentImpl*)iOwnerDocument));
+
+ CleanupStack::PushL(retValue);
+ retValue->iParentNode = aParentElement;
+
+ // *** have base class copy what it needs to
+ this->CopyL(retValue);
+
+ // *** copy iViewBoxImpl
+ if (this->iViewBoxImpl != NULL)
+ {
+ if (retValue->iViewBoxImpl != NULL)
+ {
+ delete retValue->iViewBoxImpl;
+ retValue->iViewBoxImpl= NULL;
+ }
+ retValue->iViewBoxImpl = this->iViewBoxImpl->CloneL();
+ }
+
+ // *** copy iBaseProfile
+ if (retValue->iBaseProfile != NULL)
+ {
+ delete retValue->iBaseProfile;
+ retValue->iBaseProfile = NULL;
+ }
+ retValue->iBaseProfile = this->iBaseProfile->AllocL();
+
+ // *** copy others
+ retValue->iZoomAndPan = this->iZoomAndPan;
+ retValue->iX = this->iX;
+ retValue->iY = this->iY;
+ retValue->iWidth = this->iWidth;
+ retValue->iHeight = this->iHeight;
+ retValue->iVersion = this->iVersion->AllocL();
+ CleanupStack::Pop();
+
+ return retValue;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgSvgElementImpl::DrawL( CGfx2dGc* /* aGc */,
+ CSvgElementImpl* /* aElement */ )
+ {
+ return ETrue;
+ }
+
+// *******************************************************
+// From MSvgZoomAndPan
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TSvgZoomAndPanType CSvgSvgElementImpl::GetZoomAndPan()
+ {
+ return iZoomAndPan;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgSvgElementImpl::SetZoomAndPan( TSvgZoomAndPanType aZoomAndPan )
+ {
+ iZoomAndPan = aZoomAndPan;
+ }
+
+// *******************************************************
+// From MSvgFitToWindow
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgSvgElementImpl::GetPreserveAspectRatio( MSvgPreserveAspectRatio*& aAspectRatio )
+ {
+ iViewBoxImpl->GetPreserveAspectRatio( aAspectRatio );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgSvgElementImpl::SetPreserveAspectRatioL( TSvgPreserveAspectAlignType aAlign, TSvgMeetOrSliceType aMeetslice )
+ {
+ iViewBoxImpl->SetPreserveAspectRatioL( aAlign, aMeetslice);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgSvgElementImpl::GetViewBox( TGfxRectangle2D& aViewBox )
+ {
+ return iViewBoxImpl->GetViewBox( aViewBox );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgSvgElementImpl::SetViewBoxL( TGfxRectangle2D aViewBox )
+ {
+ iViewBoxImpl->SetViewBoxL(aViewBox);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+TBool CSvgSvgElementImpl::ViewBoxDefined()
+ {
+ return iViewBoxImpl->ViewBoxDefined();
+ }
+
+// *******************************************************
+// Baseprofile
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TDesC& CSvgSvgElementImpl::BaseProfile()
+ {
+ return *iBaseProfile;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgSvgElementImpl::SetBaseProfileL( const TDesC& aValue )
+ {
+ if ( iBaseProfile )
+ {
+ delete iBaseProfile;
+ iBaseProfile = NULL;
+ }
+ iBaseProfile = aValue.AllocL();
+ }
+
+// Version
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+const TDesC& CSvgSvgElementImpl::Version()
+ {
+ return *iVersion;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgSvgElementImpl::SetVersion( const TDesC& aValue )
+ {
+ if ( iVersion )
+ {
+ delete iVersion;
+ iVersion = NULL;
+ }
+ TInt error = KErrNone;
+ TRAP(error,iVersion = aValue.AllocL());
+ }
+
+// ---------------------------------------------------------------------------
+// set synchronised behaviour default
+// ---------------------------------------------------------------------------
+void CSvgSvgElementImpl::SetSyncBehaviorDefault( const TDesC& aValue )
+ {
+ _LIT( KTmpCanSlip, "canSlip" );
+ _LIT( KTmpLocked, "locked" );
+ _LIT( KTmpIndependent, "independent" );
+ _LIT( KTmpInherit, "inherit" );
+
+ if ( !aValue.CompareF( KTmpCanSlip ) )
+ {
+ iSyncBehaviorDefault = ESvgSyncCanSlip;
+ }
+ else if ( !aValue.CompareF( KTmpLocked ) )
+ {
+ iSyncBehaviorDefault = ESvgSyncLocked;
+ }
+ else if ( !aValue.CompareF( KTmpIndependent ) )
+ {
+ iSyncBehaviorDefault = ESvgSyncIndependent;
+ }
+ else if ( !aValue.CompareF( KTmpInherit ) )
+ {
+ // Obtain the sync behaviour from the document
+ CSvgDocumentImpl* lSvgDoc = (( CSvgDocumentImpl* )
+ iOwnerDocument);
+ iSyncBehaviorDefault = lSvgDoc->SyncBehaviorDefault();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// set synchronised tolerance default
+// ---------------------------------------------------------------------------
+void CSvgSvgElementImpl::SetSyncToleranceDefault( const TDesC& aValue )
+ {
+ _LIT( KTmpInherit, "inherit" );
+ if ( !aValue.CompareF( KTmpInherit ) )
+ {
+ CSvgAnimTimingParser* lATParserPtr = NULL;
+ // Treat as clock value
+ TRAPD( lCreateATPErr,
+ {
+ lATParserPtr = CSvgAnimTimingParser::NewL( aValue, this );
+ } );
+
+ if ( lCreateATPErr != KErrNone )
+ {
+ // Error Processing
+ return;
+ }
+ TInt32 lClockValue;
+ TLex lLex( aValue );
+ lATParserPtr->ParseClockValue( lLex, lClockValue );
+ delete lATParserPtr;
+ iSyncToleranceDefault = lClockValue; // TODO: Convert Units
+ }
+ else
+ {
+ // Get clock value from parent
+ CSvgDocumentImpl* lSvgDoc = (( CSvgDocumentImpl* )
+ iOwnerDocument);
+ iSyncToleranceDefault = lSvgDoc->SyncToleranceDefault();
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgSvgElementImpl::SetSyncBehaviorDefault
+// Set the Synchronised behaviour(default)
+// -----------------------------------------------------------------------------
+//
+void CSvgSvgElementImpl::SetSyncBehaviorDefault(
+ const TSvgSyncBehaviour aValue )
+ {
+ if ( aValue == ESvgSyncDefault )
+ {
+ // Obtain the sync behaviour from the document
+ CSvgDocumentImpl* lSvgDoc = (( CSvgDocumentImpl* )
+ iOwnerDocument);
+ iSyncBehaviorDefault = lSvgDoc->SyncBehaviorDefault();
+ }
+ else
+ {
+ iSyncBehaviorDefault = aValue;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSvgSvgElementImpl::SetSyncToleranceDefault
+// Set the Synchronised Tolerance (Default)
+// -----------------------------------------------------------------------------
+//
+void CSvgSvgElementImpl::SetSyncToleranceDefault( const TInt32 aValue ,
+ const TBool aUseDefault )
+ {
+ if ( aUseDefault )
+ {
+ // Get clock value from parent
+ CSvgDocumentImpl* lSvgDoc = (( CSvgDocumentImpl* )
+ iOwnerDocument);
+ iSyncToleranceDefault = lSvgDoc->SyncToleranceDefault();
+ }
+ else
+ {
+ iSyncToleranceDefault = aValue;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgSvgElementImpl::GetBBox( TGfxRectangle2D& aBbox )
+ {
+ if (!HasChildNodes())
+ {
+ return;
+ }
+
+ CSvgGElementImpl::GetGroupBounding( aBbox, this );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgSvgElementImpl::GetUnscaledBBox( TGfxRectangle2D& aBbox )
+ {
+ if (!HasChildNodes())
+ {
+ return;
+ }
+
+ CSvgGElementImpl::GetGroupBoundingUnscaled( aBbox, this );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CSvgSvgElementImpl::SetWindowViewportTrans( TGfxRectangle2D aXYWH,
+ TGfxAffineTransform& aTr )
+ {
+ //this is a problem for the JSR. There isn't an engine associated here yet.
+ if ( (CSvgDocumentImpl*)iOwnerDocument)
+ {
+ TSize lSize;
+
+ TFloatFixPt width, height;
+ TGfxRectangle2D viewBox;
+
+ // Is engine defined
+ TBool engine = EFalse;
+
+ // Does the client define the viewPort
+ TBool clientDefinedViewport = EFalse;
+
+ TBool viewBoxDefined = iViewBoxImpl->GetViewBox(viewBox);
+ if(((CSvgDocumentImpl*)iOwnerDocument)->Engine())
+ engine = ETrue;
+
+ // if Client like browser or viewer has set the viewport
+ // take the width/height got by using GetViewPort()
+ if ( engine )
+ {
+ clientDefinedViewport = ((CSvgDocumentImpl*)iOwnerDocument )->Engine()->iClientDefinedViewPort;
+ }
+
+ if( clientDefinedViewport )
+ {
+ width = Width();
+ height = Height();
+ }
+ else
+ {
+ if(iWidthInPercentage && engine)
+ {
+ lSize = ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->GetSize();
+ TReal32 per = 100;
+ width = ( TFloatFixPt ) (( lSize.iWidth/per ) * iWidthInUserCoordinate);
+ }
+ else if(iWidthInPercentage && !engine && viewBoxDefined)
+ {
+ aXYWH.iWidth = viewBox.iWidth;
+ aXYWH.iX = viewBox.iX;
+ width = viewBox.iWidth;
+ }
+ else
+ {
+ width = Width();
+ }
+
+ if(iHeightInPercentage && engine)
+ {
+ lSize = ((CSvgDocumentImpl*)iOwnerDocument)->Engine()->GetSize();
+ TReal32 per = 100;
+ height = ( TFloatFixPt ) (( lSize.iHeight/per ) * iHeightInUserCoordinate);
+ }
+ else if( iHeightInPercentage && !engine && viewBoxDefined)
+ {
+ aXYWH.iHeight = viewBox.iHeight;
+ aXYWH.iY = viewBox.iY;
+ height = viewBox.iHeight;
+ }
+ else
+ {
+ height = Height();
+ }
+
+ }
+
+
+ TFloatFixPt KZero;
+ if ( ( width < KZero ) && ( height < KZero ) )
+ {
+ width = lSize.iWidth;
+ height = lSize.iHeight;
+ }
+ else if ( width <= KZero )
+ {
+ width = height;
+ }
+ else if ( height <= KZero )
+ {
+ height = width;
+ }
+
+ TSize lTmpViewBox(width,height);
+
+ //this should update the CTM based for the new viewbox...hopefully
+ iViewBoxImpl->SetWindowViewportTrans( aXYWH, aTr, lTmpViewBox );
+ }
+ else
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("SvgSvgElement:SetWindowViewportTrans Owner Document Not Found! Maybe JSR226?");
+ #endif
+ }
+}
+
+//Added as a part of update of Set/Get API's
+TInt CSvgSvgElementImpl::GetAttributeDes( const TInt aNameId,
+ TPtrC16& aValue )
+{
+ if(aNameId == KAtrBaseProfile)
+ {
+ aValue.Set( BaseProfile() );
+ return KErrNone;
+ }
+ else if (aNameId == KAtrVersion)
+ {
+ aValue.Set( Version() );
+ return KErrNone;
+ }
+
+ return CSvgElementImpl::GetAttributeDes( aNameId, aValue );
+}
+TInt CSvgSvgElementImpl::SetAttributeDesL( const TInt aNameId,
+ TDesC& aValue )
+{
+ if(aNameId == KAtrBaseProfile)
+ {
+ SetBaseProfileL(aValue);
+ return KErrNone;
+ }
+ else if (aNameId == KAtrVersion)
+ {
+ SetVersion(aValue);
+ return KErrNone;
+ }
+ return CSvgElementImpl::SetAttributeDesL( aNameId, aValue );
+
+}
+
+void CSvgSvgElementImpl::Print( TBool aIsEncodeOn )
+{
+ if (!aIsEncodeOn)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("<svg x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\">", (int)iX, (int)iY, (int)iWidth, (int)iHeight);
+ #endif
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGRecog/BWINSCW/SVGRECOGU.DEF Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+ ?CreateRecognizer@@YAPAVCApaDataRecognizerType@@XZ @ 1 NONAME ; class CApaDataRecognizerType * CreateRecognizer(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGRecog/Group/SvgRecog.MMP Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This mmp file generates makefile for SVG Recognizer
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET svgrecog.dll
+TARGETTYPE PLUGIN
+
+UID 0x10009D8D 0x101F8570
+SOURCEPATH ../src
+
+// This is a SYSTEMINCLUDE macro containing the middleware
+// layer specific include directories
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+
+START RESOURCE 101f8570.rss
+TARGET svgrecog.rsc
+END
+//RESOURCE 101F8570.rss
+
+VENDORID VID_DEFAULT
+CAPABILITY CAP_RECOGNISER
+
+USERINCLUDE ../inc
+SOURCEPATH ../src
+SOURCE SvgRecognizer.cpp
+
+LIBRARY euser.lib
+LIBRARY apmime.lib
+LIBRARY efsrv.lib
+
+START WINS
+ baseaddress 0x70800000
+END
+
+START MARM
+END
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGRecog/Group/bld.inf Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file creates build information for SVG MIME type Recognizer
+*
+*/
+
+
+//Platforms listed are not built by SVGT Recognizer
+PRJ_PLATFORMS
+DEFAULT -ARMI -ARM4 -TOOLS
+
+PRJ_MMPFILES
+
+SVGRecog.mmp
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGRecog/eabi/SvgRecogU.DEF Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,5 @@
+EXPORTS
+ _Z16CreateRecognizerv @ 1 NONAME
+ _ZTI14CSvgRecognizer @ 2 NONAME ; #<TI>#
+ _ZTV14CSvgRecognizer @ 3 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGRecog/inc/SvgRecognizer.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+ *
+*/
+
+
+
+#if !defined(__SVGRECOG_H__)
+#define __SVGRECOG_H__
+
+#if !defined(__APMREC_H__)
+#include <apmrec.h>
+#endif
+
+const TInt KMimeSvgRecognizerValue = 0x101F8570;
+const TUid KUidMimeSvgRecognizer =
+ {
+ KMimeSvgRecognizerValue
+ };
+
+const TInt KImplementationValue = 0x101F8571;
+const TUid KUidImplementation =
+ {
+ KImplementationValue
+ };
+
+
+// minimum amount of file needed to determine a text file IF it's not called .TXT
+const TInt KMinBufferLength = 42;
+// maximum amount of buffer space we will ever use
+const TInt KMaxBufferLength = 1024;
+
+_LIT8( KDataTypeImageSvg, "image/svg+xml" );
+
+/**
+ * A standard Symbian Recognizer for SVG MIME Type.
+ * Inherits from CApaDataRecognizerType
+ * Provides recognition for MIME Type 'image\svg+xml'
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CSvgRecognizer : public CApaDataRecognizerType
+ {
+ public: // from CApaDataRecognizerType
+
+ /**
+ * Constructor
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ CSvgRecognizer();
+
+ /**
+ * Return the preferred buffer size
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TUint PreferredBufSize();
+
+ /**
+ * Return the Supported Data Type
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TDataType SupportedDataTypeL( TInt /*aIndex*/ ) const;
+ private: // from CApaDataRecognizerType
+
+ /**
+ * Perform the required recognition process
+ *
+ * @since 1.0
+ * @param aName - A string buffer containing file name
+ * @param aBuffer - A binary buffer that has the contents of the file
+ * @return
+ */
+ void DoRecognizeL( const TDesC& aName, const TDesC8& aBuffer );
+
+ public:
+ /**
+ * This is passes to the ECom Framework as an handle to the implementation
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CApaDataRecognizerType* CreateRecognizerL();
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGRecog/src/101f8570.rss Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This Resource file is part of ECom Style SVG Recognizer
+*
+*/
+
+
+#include <registryinfo.rh>
+
+RESOURCE REGISTRY_INFO r_registry
+ {
+ dll_uid = 0x101F8570; //should match name of this file
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ interface_uid = 0x101F7D87; //Const for all Data Recognizers
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x101F8571;
+ version_no = 1;
+ display_name = "Svgt Recognizer";
+ default_data = "image/svg+xml";
+ opaque_data = "";
+ }
+ };
+ }
+ };
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/SVGRecog/src/SvgRecognizer.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+ *
+*/
+
+
+#include <apmrec.h>
+#include <apmstd.h>
+#include <f32file.h>
+
+#include <implementationproxy.h>
+
+#include "SvgRecognizer.h"
+
+// --------------------------------------------------------------------------
+// CSvgRecognizer::CSvgRecognizer() : CApaDataRecognizerType( KUidMimeSvgRecognizer,
+// ---------------------------------------------------------------------------
+CSvgRecognizer::CSvgRecognizer() : CApaDataRecognizerType( KUidMimeSvgRecognizer,
+ CApaDataRecognizerType::ELow )
+ {
+ iCountDataTypes = 1;
+ }
+
+// --------------------------------------------------------------------------
+// TUint CSvgRecognizer::PreferredBufSize()
+// ---------------------------------------------------------------------------
+TUint CSvgRecognizer::PreferredBufSize()
+ {
+ return KMaxBufferLength;
+ }
+
+// --------------------------------------------------------------------------
+// TDataType CSvgRecognizer::SupportedDataTypeL( TInt /*aIndex */) const
+// ---------------------------------------------------------------------------
+TDataType CSvgRecognizer::SupportedDataTypeL( TInt /*aIndex */) const
+ {
+ return TDataType( KDataTypeImageSvg );
+ }
+
+// --------------------------------------------------------------------------
+// void CSvgRecognizer::DoRecognizeL( const TDesC& aName,
+// ---------------------------------------------------------------------------
+void CSvgRecognizer::DoRecognizeL( const TDesC& aName,
+ const TDesC8& /*aBuffer */)
+ {
+ iConfidence = ENotRecognized;
+
+ const TInt positionOfLastDot = aName.LocateReverse( '.' );
+
+ if ( positionOfLastDot >= 0 )
+ { //check the extension
+ const TPtrC ext = aName.Mid( positionOfLastDot );
+ /* SVGEngine suppported file extensions */
+ _LIT(KSvgExt1, ".svg");
+ _LIT(KSvgExt2, ".svgz");
+ _LIT(KSvgExt3, ".svgb");
+
+ if ( ext.CompareF( KSvgExt1 ) == 0 ||
+ ext.CompareF( KSvgExt2 ) == 0 ||
+ ext.CompareF( KSvgExt3 ) == 0 )
+ {
+ iConfidence = ECertain;
+ iDataType = TDataType( KDataTypeImageSvg );
+ }
+ }
+ }
+
+// --------------------------------------------------------------------------
+// CApaDataRecognizerType* CSvgRecognizer::CreateRecognizerL()
+// ---------------------------------------------------------------------------
+CApaDataRecognizerType* CSvgRecognizer::CreateRecognizerL()
+ {
+ CApaDataRecognizerType* lSvgDataRecogType = NULL;
+ lSvgDataRecogType = new (ELeave) CSvgRecognizer();
+ return lSvgDataRecogType; // NULL if new failed
+ }
+
+// --------------------------------------------------------------------------
+// const TImplementationProxy SvgRecogImplTable[] =
+// ---------------------------------------------------------------------------
+const TImplementationProxy SvgRecogImplTable[] =
+ {
+ IMPLEMENTATION_PROXY_ENTRY(KImplementationValue, CSvgRecognizer::CreateRecognizerL)
+ };
+
+// --------------------------------------------------------------------------
+// EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aImplTableCount)
+// ---------------------------------------------------------------------------
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aImplTableCount)
+ {
+ aImplTableCount = sizeof(SvgRecogImplTable) / sizeof(TImplementationProxy);
+ return SvgRecogImplTable;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/Xmldomimpl/inc/SVGXmlDOMImplementation.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XML DOM Implementation header file
+ *
+*/
+
+
+#ifndef SVGXMLDOMIMPLEMENTATION_H
+#define SVGXMLDOMIMPLEMENTATION_H
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+class MXmlDocument;
+class MXmlElement;
+class MXmlDocumentType;
+
+
+/**
+ * Class description
+ */
+class MXmlDOMImplementation
+ {
+ public:
+ /**
+ * Create a document object for the XML file
+ *
+ * @since 1.0
+ * @param aNamespaceUri - A string buffer containting the name space for this XML file
+ * @param aQualifiedName - A string buffer containing qualified name for the document
+ * @return A document object as a pointer of interface MXmlDocument
+ */
+ IMPORT_C virtual MXmlDocument* CreateDocumentL( const TDesC& aNamespaceUri,
+ const TDesC& aQualifiedName/*,MXmlDocumentType* aDocType*/ ) = 0;
+ };
+
+#endif // SVGXMLDOMIMPLEMENTATION_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/Xmldomimpl/inc/SVGXmlDocument.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XML DOM Implementation header file
+ *
+*/
+
+
+#ifndef SVGXMLDOCUMENT_H
+#define SVGXMLDOCUMENT_H
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include "SVGXmlElement.h"
+
+
+/**
+ * Class description
+ */
+class MXmlDocument
+ {
+ public:
+
+ /**
+ * Create a XML element with the given tag
+ *
+ * @since 1.0
+ * @param aTagName - A string buffer containing the name tag for the XML element
+ * @return An element object as a pointer to a MXmlElement interface
+ */
+ virtual MXmlElement* CreateElementL( const TDesC& aTagName ) = 0;
+
+ virtual MXmlElement* CreateElementL( const TUint8 aTagName ) = 0;
+
+
+ /**
+ * Create an attribute for a given attribute name
+ * Strictly speaking a Node element should be created for an attribute
+ * This is not implemented for this release
+ *
+ * @since 1.0
+ * @param aName - A string buffer containing the name of the attribute
+ * @return An integer containing success/failure information
+ */
+ virtual TInt CreateAttribute( const TDesC& aName ) = 0;
+
+
+ /**
+ * Find an element that matches a given element ID
+ *
+ * @since 1.0
+ * @param aElementId - A string buffer containing the required element ID
+ * @return An element object as a pointer to a MXmlElement interface
+ */
+ virtual MXmlElement* GetElementById( const TDesC& aElementId ) = 0;
+
+
+ /**
+ * Append an 'svg' element to its document
+ *
+ * @since 1.0
+ * @param aAppendChild - An XML element pointer to the object that needs
+ * to be appended
+ * @return A pointer to the element just appended if it is an 'svg'
+ Otherwise NULL
+ */
+ virtual MXmlElement* AppendChildL( MXmlElement* aAppendChild ) = 0;
+
+ /**
+ * Method for notification from child element of AppendChildL or
+ * RemoveChild.
+ *
+ * @since 1.0
+ * @return none
+ */
+ virtual void ElementAppendedOrRemoved() = 0;
+ };
+
+#endif // SVGXMLDOCUMENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/Xmldomimpl/inc/SVGXmlElement.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,210 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XML DOM Implementation header file
+ *
+*/
+
+
+#ifndef SVGXMLELEMENT_H
+#define SVGXMLELEMENT_H
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+class MXmlDocument;
+
+
+/**
+ * Class description
+ */
+class MXmlElement
+ {
+ public:
+ /**
+ * Set attribute interface for an XML element
+ *
+ * @since 1.0
+ * @param aName - A string buffer containing the name of the attribute
+ * @param aValue - A string buffer containing the value of the attribute
+ * @return An integer containing success/failure for this action
+ */
+ virtual TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue ) = 0;
+
+ /**
+ * Remove attribute interface for an XML element
+ *
+ * @since 1.0
+ * @param aName - A string buffer containing the name of the attribute to
+ * be removed
+ * @return An integer containing success/failure for this action
+ */
+ virtual TInt RemoveAttribute( const TDesC& aName ) = 0;
+
+
+ /**
+ * Accessor interface for the tag name of an XML element
+ *
+ * @since 1.0
+ * @param None
+ * @return A string buffer containing the tag name
+ */
+ virtual const TDesC& TagName() = 0;
+
+
+ /**
+ * Append child interface for an XML element
+ *
+ * @since 1.0
+ * @param aAppendChild - The element object that needs to be appended
+ * @return NULL if failed to append;
+ * A MXmlElement pointer to the object that was just appended
+ */
+ virtual MXmlElement* AppendChildL( MXmlElement* aAppendChild, TBool aIsJSR226Element = EFalse ) = 0;
+
+
+ /**
+ * Remove child interface for an XML element
+ *
+ * @since 1.0
+ * @param aRemoveChild - A pointer to the object that is to be removed
+ * @return None
+ */
+ virtual void RemoveChild ( MXmlElement* aRemoveChild ) = 0;
+
+
+ /**
+ * 'Has child nodes' interface that finds out if the current element has any child
+ * nodes
+ *
+ * @since 1.0
+ * @param None
+ * @return A boolean
+ * ETrue if there are child nodes; EFalse otherwise
+ */
+ virtual TBool HasChildNodes() = 0 ;
+
+
+ /**
+ * Accessor interface for 'first child' of an XML element
+ *
+ * @since 1.0
+ * @param None
+ * @return An MXmlElement pointer to the first child of the current XML element
+ */
+ virtual MXmlElement* FirstChild() = 0;
+
+
+ /**
+ * Accessor interface for 'last child' of an XML element
+ *
+ * @since 1.0
+ * @param None
+ * @return An MXmlElement pointer to the last child of the current XML element
+ */
+ virtual MXmlElement* LastChild() = 0;
+
+
+ /**
+ * Accessor interface for 'owner document' of an XML element
+ *
+ * @since 1.0
+ * @param None
+ * @return A MXmlDocument pointer to the document object for this XML document
+ */
+ virtual MXmlDocument* OwnerDocument() = 0;
+
+
+ /**
+ * Accessor interface for 'next sibling' of an XML element
+ *
+ * @since 1.0
+ * @param None
+ * @return An MXmlElement pointer to the next sibling of the current XML element
+ */
+ virtual MXmlElement* NextSibling() = 0;
+
+ /**
+ * Accessor interface for 'parent node' of an XML element
+ *
+ * @since 1.0
+ * @param None
+ * @return An MXmlElement pointer to the parent node of the current XML element
+ */
+ virtual MXmlElement* ParentNode() = 0;
+
+
+ /**
+ * Accessor to set first child of an XML element
+ *
+ * @since 1.0
+ * @param An MXmlElement pointer to the object that is being set as first child
+ * @return None
+ */
+ void virtual SetFirstChild( MXmlElement* ) = 0;
+
+
+ /**
+ * Accessor to set last child of an XML element
+ *
+ * @since 1.0
+ * @param An MXmlElement pointer to the object that is being set as last child
+ * @return None
+ */
+ void virtual SetLastChild( MXmlElement* ) = 0;
+
+
+ /**
+ * Accessor to set owner document of an XML element
+ *
+ * @since 1.0
+ * @param An MXmlDocument pointer to the object that is being set as owner document
+ * @return None
+ */
+ void virtual SetOwnerDocument( MXmlDocument* ) = 0;
+
+
+ /**
+ * Accessor to set next sibling of an XML element
+ *
+ * @since 1.0
+ * @param An MXmlElement pointer to the object that is being set as next sibling
+ * @return None
+ */
+ void virtual SetNextSibling( MXmlElement* ) = 0;
+
+
+ /**
+ * Accessor to set parent node of an XML element
+ *
+ * @since 1.0
+ * @param An MXmlElement pointer to the object that is being set as parent node
+ * @return None
+ */
+ void virtual SetParentNode( MXmlElement* ) = 0;
+
+
+ /**
+ * A method to (deep) clone the current element
+ *
+ * @since 1.0
+ * @param None
+ * @return An MXmlElement pointer to the object that is a copy of the current element
+ */
+ virtual MXmlElement* CloneL(MXmlElement* aParentElement) = 0;
+
+ };
+
+#endif // SVGXMLELEMENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/Xmldomimpl/inc/SVGXmlElementImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,305 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XML DOM Implementation header file
+ *
+*/
+
+
+#ifndef __INC_CXMLELEMENTIMPL__
+#define __INC_CXMLELEMENTIMPL__
+
+#if !defined(__E32BASE_H__)
+#include <e32base.h>
+#endif
+
+#include "SVGXmlElement.h"
+
+
+
+class MXmlDocument;
+
+
+/**
+ * Class description
+ */
+class CXmlElementImpl : public CBase, public MXmlElement
+ {
+ public:
+
+ /**
+ * Set the attribute value for a given attribute name of the current XML element
+ * Actual specification requires a new node object be created for the new attribute
+ * This implementation just sets a variable in the element class instance
+ *
+ * @since 1.0
+ * @param aName - A string buffer containig the name of the attribute to be set
+ * @param aValue - A string buffer containig the value of the attribute to be set
+ * @return An integer containing success/failure for this action
+ */
+ virtual TInt SetAttributeL( const TDesC& aName,
+ const TDesC& aValue );
+
+
+ /**
+ * Remove attribute for an XML element
+ * Actual specification requires the attribute node be removed
+ * Since this implementation does not create an attribute node, it
+ * just changes the state of the corresponding variable
+ *
+ * @since 1.0
+ * @param aName - A string buffer containing the name of the attribute to
+ * be removed
+ * @return An integer containing success/failure for this action
+ */
+ virtual TInt RemoveAttribute( const TDesC& aName );
+
+
+ /**
+ * Accessor for the tag name of an XML element
+ *
+ * @since 1.0
+ * @param None
+ * @return A string buffer containing the tag name
+ */
+ virtual const TDesC& TagName();
+
+
+ /**
+ * Append child method for an XML element
+ *
+ * @since 1.0
+ * @param aAppendChild - The element object that needs to be appended
+ * @return NULL if failed to append;
+ * A MXmlElement pointer to the object that was just appended
+ */
+ virtual MXmlElement* AppendChildL( MXmlElement* aAppendChild, TBool aIsJSR226Element = EFalse );
+
+
+ /**
+ * Remove child method for an XML element
+ *
+ * @since 1.0
+ * @param aRemoveChild - A pointer to the object that is to be removed
+ * @return None
+ */
+ virtual void RemoveChild ( MXmlElement* aRemoveChild );
+
+
+ /**
+ * 'Has child nodes' method that finds out if the current element has any child
+ * nodes
+ *
+ * @since 1.0
+ * @param None
+ * @return A boolean
+ * ETrue if there are child nodes; EFalse otherwise
+ */
+ virtual TBool HasChildNodes();
+
+
+ /**
+ * Accessor method for 'first child' of an XML element
+ *
+ * @since 1.0
+ * @param None
+ * @return An MXmlElement pointer to the first child of the current XML element
+ */
+ virtual MXmlElement* FirstChild();
+
+
+ /**
+ * Accessor method for 'last child' of an XML element
+ *
+ * @since 1.0
+ * @param None
+ * @return An MXmlElement pointer to the last child of the current XML element
+ */
+ virtual MXmlElement* LastChild();
+
+
+ /**
+ * Accessor method for 'owner document' of an XML element
+ *
+ * @since 1.0
+ * @param None
+ * @return A MXmlDocument pointer to the document object for this XML document
+ */
+ virtual MXmlDocument* OwnerDocument();
+
+
+ /**
+ * Accessor method for 'next sibling' of an XML element
+ *
+ * @since 1.0
+ * @param None
+ * @return An MXmlElement pointer to the next sibling of the current XML element
+ */
+ virtual MXmlElement* NextSibling();
+ virtual MXmlElement* PreviousSibling();
+
+ /**
+ * Accessor method for 'parent node' of an XML element
+ *
+ * @since 1.0
+ * @param None
+ * @return An MXmlElement pointer to the parent node of the current XML element
+ */
+ virtual MXmlElement* ParentNode();
+
+
+ /**
+ * Accessor to set first child of an XML element
+ *
+ * @since 1.0
+ * @param An MXmlElement pointer to the object that is being set as first child
+ * @return None
+ */
+ virtual void SetFirstChild( MXmlElement* );
+
+
+ /**
+ * Accessor to set last child of an XML element
+ *
+ * @since 1.0
+ * @param An MXmlElement pointer to the object that is being set as last child
+ * @return None
+ */
+ virtual void SetLastChild( MXmlElement* );
+
+
+ /**
+ * Accessor to set owner document of an XML element
+ *
+ * @since 1.0
+ * @param An MXmlDocument pointer to the object that is being set as owner document
+ * @return None
+ */
+ virtual void SetOwnerDocument( MXmlDocument* );
+
+
+ /**
+ * Accessor to set next sibling of an XML element
+ *
+ * @since 1.0
+ * @param An MXmlElement pointer to the object that is being set as next sibling
+ * @return None
+ */
+ virtual void SetNextSibling( MXmlElement* );
+
+
+ /**
+ * Accessor to set parent node of an XML element
+ *
+ * @since 1.0
+ * @param An MXmlElement pointer to the object that is being set as parent node
+ * @return None
+ */
+ virtual void SetParentNode( MXmlElement* );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ // static CXmlElementImpl* NewL( const TDesC& aTagName );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ // static CXmlElementImpl* NewLC( const TDesC& aTagName );
+
+
+ /**
+ * Need method description
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual ~CXmlElementImpl();
+
+ protected:
+
+
+
+ TUint8 iElemID;
+ /**
+ * Initialize the state of XML element object
+ *
+ * @since 1.0
+ * @param aTagName - A string buffer containing the tag name with which
+ * the element object is being built
+ * @return None
+ */
+ virtual void InitializeL( const TUint8 aElemID );
+
+
+
+
+ MXmlElement* iParentNode;
+
+ MXmlElement* iFirstChild;
+
+ MXmlElement* iLastChild;
+
+ MXmlElement* iNextSibling;
+
+ MXmlDocument* iOwnerDocument;
+
+ public:
+
+ /**
+ * A method that performs deep copy for this object
+ *
+ * @since 1.0
+ * @param None
+ * @return An MXmlElement pointer to the newly created object
+ */
+ MXmlElement* CloneL(MXmlElement* aParentElement);
+
+ /**
+ * A method that return integer ID of the element
+ *
+ * @since 1.0
+ * @param None
+ * @return An TUint8 value correspondign the ID of the element
+ */
+
+ virtual TUint8 ElemID();
+
+ protected:
+
+ /**
+ * Copy this object to an object that is already created and initialized
+ *
+ * @since 1.0
+ * @param aDestElement - A CXmlElementImpl pointer to an object
+ * requiring the copy
+ * @return None
+ */
+ void CopyL( CXmlElementImpl* aDestElement );
+
+ };
+
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVG/Xmldomimpl/src/SVGXmlElementImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,345 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: XML DOM Implementation source file
+ *
+*/
+
+
+#include "SVGXmlElementImpl.h"
+#include "SVGXmlDocument.h"
+
+// ---------------------------------------------------------------------------
+// This method acts like a ConstructL.
+// This class is never instantiated
+// The derived classes that are instantiated, call this method within
+// their ConstructL methods
+// ---------------------------------------------------------------------------
+
+void CXmlElementImpl::InitializeL( const TUint8 aElemID )
+ {
+ iElemID=aElemID;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the integer ID of the current element
+// ---------------------------------------------------------------------------
+TUint8 CXmlElementImpl::ElemID()
+ {
+ return iElemID;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+CXmlElementImpl::~CXmlElementImpl()
+ {
+
+ CXmlElementImpl* child = (CXmlElementImpl*)FirstChild();
+ while ( child != NULL )
+ {
+ CXmlElementImpl* sibling = (CXmlElementImpl*)child->NextSibling();
+ delete child;
+ child = sibling;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Set the value for a given attribute
+// ---------------------------------------------------------------------------
+TInt CXmlElementImpl::SetAttributeL( const TDesC& /* aName */,
+ const TDesC& /* aValue */ )
+ {
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// Remove a given attribute
+// At this time this method is not implemented
+// ---------------------------------------------------------------------------
+TInt CXmlElementImpl::RemoveAttribute( const TDesC& /* aName */ )
+ {
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the tag name of the current element
+// ---------------------------------------------------------------------------
+const TDesC& CXmlElementImpl::TagName()
+ {
+
+ HBufC *lEmptyBuf = NULL;
+ return *lEmptyBuf;
+
+ }
+
+// ---------------------------------------------------------------------------
+// Find out if the current element has child elements
+// ---------------------------------------------------------------------------
+TBool CXmlElementImpl::HasChildNodes()
+ {
+ return ( iFirstChild != NULL );
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the first child object of the current element
+// ---------------------------------------------------------------------------
+MXmlElement* CXmlElementImpl::FirstChild()
+ {
+ return iFirstChild;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the last child object of the current element
+// ---------------------------------------------------------------------------
+MXmlElement* CXmlElementImpl::LastChild()
+ {
+ return iLastChild;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the document object of the current element
+// ---------------------------------------------------------------------------
+MXmlDocument* CXmlElementImpl::OwnerDocument()
+ {
+ return iOwnerDocument;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the next sibling (element) object of the current element
+// ---------------------------------------------------------------------------
+MXmlElement* CXmlElementImpl::NextSibling()
+ {
+ return iNextSibling;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the previous sibling (element) object of the current element
+// ---------------------------------------------------------------------------
+MXmlElement* CXmlElementImpl::PreviousSibling()
+ {
+ CXmlElementImpl* sibling = this;
+ CXmlElementImpl* previousSibling = NULL;
+
+ while ( sibling != NULL )
+ {
+ sibling = (CXmlElementImpl*)sibling->NextSibling();
+
+ if (sibling == this)
+ {
+ return previousSibling;
+ }
+
+ previousSibling = sibling;
+ }
+
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor for the parent element object of the current element
+// ---------------------------------------------------------------------------
+MXmlElement* CXmlElementImpl::ParentNode()
+ {
+ return iParentNode;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor to set the first child object of the current element
+// ---------------------------------------------------------------------------
+void CXmlElementImpl::SetFirstChild( MXmlElement* aElement )
+ {
+ iFirstChild = aElement;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor to set the last child object of the current element
+// ---------------------------------------------------------------------------
+void CXmlElementImpl::SetLastChild( MXmlElement* aElement )
+ {
+ iLastChild = aElement;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor to set the document object of the current element
+// ---------------------------------------------------------------------------
+void CXmlElementImpl::SetOwnerDocument( MXmlDocument* aElement )
+ {
+ iOwnerDocument = aElement;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor to set the next sibling (element) object of the current element
+// ---------------------------------------------------------------------------
+void CXmlElementImpl::SetNextSibling( MXmlElement* aElement )
+ {
+ iNextSibling = aElement;
+ }
+
+// ---------------------------------------------------------------------------
+// Accessor to set the parent element object of the current element
+// ---------------------------------------------------------------------------
+void CXmlElementImpl::SetParentNode( MXmlElement* aElement )
+ {
+ iParentNode = aElement;
+ }
+
+// ---------------------------------------------------------------------------
+// Append a new object as the child of the current element
+// Place the new object in the proper location, as the last child
+// ---------------------------------------------------------------------------
+MXmlElement* CXmlElementImpl::AppendChildL( MXmlElement* aNewChild, TBool /*aIsJSR226Element*/ )
+ {
+ // if no node was passed, then nothing to do
+ if ( aNewChild == NULL )
+ {
+ return NULL;
+ }
+
+ // first remove the node from its parent if it has one
+ MXmlElement* lparent = aNewChild->ParentNode();
+
+
+ //AJD the parent != this needs to be removed so AppendChild works correctly
+// if ( parent != NULL && parent != this)
+
+ if ( lparent != NULL )
+ {
+ lparent->RemoveChild(aNewChild);
+ }
+
+ // Set the new node's parent
+ aNewChild->SetParentNode( this );
+ // Set the new node's next sibling
+ aNewChild->SetNextSibling( NULL );
+ // If previous sibling is tracked:
+ // Set the new node's previous sibling
+ // aNewChild->SetPreviousSibling(iXmlElementImpl->LastChild());
+ // Set new node as the first child, if it is
+ if ( FirstChild() == NULL )
+ {
+ SetFirstChild( aNewChild );
+ }
+ // Set the new node as the next sibling of previously last child
+ MXmlElement* lLast = LastChild();
+ if ( lLast )
+ {
+ lLast->SetNextSibling( aNewChild );
+ }
+ // Set the new node as last child
+ SetLastChild( aNewChild );
+
+ // notity of change to document
+ if ( iOwnerDocument )
+ {
+ aNewChild->SetOwnerDocument(iOwnerDocument);
+
+ iOwnerDocument->ElementAppendedOrRemoved();
+ }
+
+ return aNewChild;
+ }
+
+// ---------------------------------------------------------------------------
+// Remove a given object from the list of child elements
+// ---------------------------------------------------------------------------
+void CXmlElementImpl::RemoveChild ( MXmlElement* aRemoveChild )
+ {
+ if ( aRemoveChild )
+ {
+ // the remove child is the first child
+ if ( FirstChild() == aRemoveChild )
+ {
+ if( aRemoveChild->NextSibling() )
+ {
+ SetFirstChild( aRemoveChild->NextSibling() );
+ }
+ else
+ {
+ // the remove child is the only child
+ SetFirstChild( NULL );
+ SetLastChild ( NULL );
+ }
+ }
+ // the remove child is any sibling
+ else
+ {
+ // find the child pointing to remove child
+ MXmlElement*preSibling = FirstChild();
+ if (preSibling)
+ {
+ while ( preSibling && (( preSibling->NextSibling() ) != aRemoveChild) )
+ {
+ preSibling = preSibling->NextSibling();
+ }
+
+ if (preSibling)
+ {
+ // check if the remove child is the end child
+ if ( LastChild() != aRemoveChild )
+ {
+ preSibling->SetNextSibling(aRemoveChild->NextSibling());
+ }
+ else
+ {
+ SetLastChild(preSibling);
+ preSibling->SetNextSibling(NULL);
+ }
+ }
+ }
+ }
+
+ // remove child
+ aRemoveChild->SetParentNode( NULL );
+ aRemoveChild->SetNextSibling( NULL );
+ }
+
+ // notity of change to document
+ if ( iOwnerDocument )
+ {
+ iOwnerDocument->ElementAppendedOrRemoved();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// Perform a deep clone of this object
+// This method is not currently implemented
+// ---------------------------------------------------------------------------
+MXmlElement* CXmlElementImpl::CloneL(MXmlElement* )
+ {
+ return NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// Copy the contents of this object to the passed object
+// This method assumes that the passed object has already been
+// Created using the proper NewL method.
+// ---------------------------------------------------------------------------
+void CXmlElementImpl::CopyL( CXmlElementImpl* aDestElement )
+ {
+
+ // copy the children and everything down the tree
+ MXmlElement* currentChild = FirstChild();
+
+ while ( currentChild != NULL)
+ {
+ MXmlElement* newElement = currentChild->CloneL(aDestElement);
+ if( newElement == NULL )/*Duplicate Cloning of Use returns NULL*/
+ {
+ break; //breaking out of the while in case of loop
+ }
+ aDestElement->CXmlElementImpl::AppendChildL(newElement);
+ currentChild = currentChild->NextSibling();
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGEngineJI/BWINSCW/SVGEngineJIU.def Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,90 @@
+EXPORTS
+ ??0CSvgJavaInterfaceImpl@@AAE@XZ @ 1 NONAME ; CSvgJavaInterfaceImpl::CSvgJavaInterfaceImpl(void)
+ ??1CSvgJavaInterfaceImpl@@UAE@XZ @ 2 NONAME ; CSvgJavaInterfaceImpl::~CSvgJavaInterfaceImpl(void)
+ ?NewL@CSvgJavaInterfaceImpl@@SAPAV1@XZ @ 3 NONAME ; class CSvgJavaInterfaceImpl * CSvgJavaInterfaceImpl::NewL(void)
+ ?SvgDocumentActivate@CSvgJavaInterfaceImpl@@QAEXH@Z @ 4 NONAME ; void CSvgJavaInterfaceImpl::SvgDocumentActivate(int)
+ ?SvgDocumentBeginElementAt@CSvgJavaInterfaceImpl@@QAEXHHM@Z @ 5 NONAME ; void CSvgJavaInterfaceImpl::SvgDocumentBeginElementAt(int, int, float)
+ ?SvgDocumentCreateEmpty@CSvgJavaInterfaceImpl@@QAEHXZ @ 6 NONAME ; int CSvgJavaInterfaceImpl::SvgDocumentCreateEmpty(void)
+ ?SvgDocumentCreateL@CSvgJavaInterfaceImpl@@QAEHABVTPtrC16@@@Z @ 7 NONAME ; int CSvgJavaInterfaceImpl::SvgDocumentCreateL(class TPtrC16 const &)
+ ?SvgDocumentDestroy@CSvgJavaInterfaceImpl@@QAEXH@Z @ 8 NONAME ; void CSvgJavaInterfaceImpl::SvgDocumentDestroy(int)
+ ?SvgDocumentDispatchMouseEvent@CSvgJavaInterfaceImpl@@QAEHHHH@Z @ 9 NONAME ; int CSvgJavaInterfaceImpl::SvgDocumentDispatchMouseEvent(int, int, int)
+ ?SvgDocumentEndElementAt@CSvgJavaInterfaceImpl@@QAEXHHM@Z @ 10 NONAME ; void CSvgJavaInterfaceImpl::SvgDocumentEndElementAt(int, int, float)
+ ?SvgDocumentFocusOn@CSvgJavaInterfaceImpl@@QAEXHH@Z @ 11 NONAME ; void CSvgJavaInterfaceImpl::SvgDocumentFocusOn(int, int)
+ ?SvgDocumentFocusOut@CSvgJavaInterfaceImpl@@QAEXHH@Z @ 12 NONAME ; void CSvgJavaInterfaceImpl::SvgDocumentFocusOut(int, int)
+ ?SvgDocumentGetElementById@CSvgJavaInterfaceImpl@@QAEHHABVTPtrC16@@@Z @ 13 NONAME ; int CSvgJavaInterfaceImpl::SvgDocumentGetElementById(int, class TPtrC16 const &)
+ ?SvgDocumentGetExternalListItem@CSvgJavaInterfaceImpl@@QAEHHHAAVTPtrC16@@@Z @ 14 NONAME ; int CSvgJavaInterfaceImpl::SvgDocumentGetExternalListItem(int, int, class TPtrC16 &)
+ ?SvgDocumentGetExternalListSize@CSvgJavaInterfaceImpl@@QAEHH@Z @ 15 NONAME ; int CSvgJavaInterfaceImpl::SvgDocumentGetExternalListSize(int)
+ ?SvgDocumentGetFocus@CSvgJavaInterfaceImpl@@QAEHH@Z @ 16 NONAME ; int CSvgJavaInterfaceImpl::SvgDocumentGetFocus(int)
+ ?SvgDocumentGetId@CSvgJavaInterfaceImpl@@QAEHHHAAVTPtrC16@@@Z @ 17 NONAME ; int CSvgJavaInterfaceImpl::SvgDocumentGetId(int, int, class TPtrC16 &)
+ ?SvgDocumentGetMediaTime@CSvgJavaInterfaceImpl@@QAEMH@Z @ 18 NONAME ; float CSvgJavaInterfaceImpl::SvgDocumentGetMediaTime(int)
+ ?SvgDocumentGetNumberOfIds@CSvgJavaInterfaceImpl@@QAEHH@Z @ 19 NONAME ; int CSvgJavaInterfaceImpl::SvgDocumentGetNumberOfIds(int)
+ ?SvgDocumentGetRootElement@CSvgJavaInterfaceImpl@@QAEHH@Z @ 20 NONAME ; int CSvgJavaInterfaceImpl::SvgDocumentGetRootElement(int)
+ ?SvgDocumentGetViewportHeight@CSvgJavaInterfaceImpl@@QAEHH@Z @ 21 NONAME ; int CSvgJavaInterfaceImpl::SvgDocumentGetViewportHeight(int)
+ ?SvgDocumentGetViewportHeightUnits@CSvgJavaInterfaceImpl@@QAEHH@Z @ 22 NONAME ; int CSvgJavaInterfaceImpl::SvgDocumentGetViewportHeightUnits(int)
+ ?SvgDocumentGetViewportWidth@CSvgJavaInterfaceImpl@@QAEHH@Z @ 23 NONAME ; int CSvgJavaInterfaceImpl::SvgDocumentGetViewportWidth(int)
+ ?SvgDocumentGetViewportWidthUnits@CSvgJavaInterfaceImpl@@QAEHH@Z @ 24 NONAME ; int CSvgJavaInterfaceImpl::SvgDocumentGetViewportWidthUnits(int)
+ ?SvgDocumentHasAnimation@CSvgJavaInterfaceImpl@@QAEHH@Z @ 25 NONAME ; int CSvgJavaInterfaceImpl::SvgDocumentHasAnimation(int)
+ ?SvgDocumentRequestCompleted@CSvgJavaInterfaceImpl@@QAEHHABVTPtrC16@@ABVTPtrC8@@@Z @ 26 NONAME ; int CSvgJavaInterfaceImpl::SvgDocumentRequestCompleted(int, class TPtrC16 const &, class TPtrC8 const &)
+ ?SvgDocumentSetMediaTime@CSvgJavaInterfaceImpl@@QAEXHM@Z @ 27 NONAME ; void CSvgJavaInterfaceImpl::SvgDocumentSetMediaTime(int, float)
+ ?SvgDocumentSetViewportHeight@CSvgJavaInterfaceImpl@@QAEXHH@Z @ 28 NONAME ; void CSvgJavaInterfaceImpl::SvgDocumentSetViewportHeight(int, int)
+ ?SvgDocumentSetViewportWidth@CSvgJavaInterfaceImpl@@QAEXHH@Z @ 29 NONAME ; void CSvgJavaInterfaceImpl::SvgDocumentSetViewportWidth(int, int)
+ ?SvgDocumentViewportInit@CSvgJavaInterfaceImpl@@QAEXH@Z @ 30 NONAME ; void CSvgJavaInterfaceImpl::SvgDocumentViewportInit(int)
+ ?SvgElementAddEventListener@CSvgJavaInterfaceImpl@@QAEXHHF@Z @ 31 NONAME ; void CSvgJavaInterfaceImpl::SvgElementAddEventListener(int, int, short)
+ ?SvgElementAppendChild@CSvgJavaInterfaceImpl@@QAEXHH@Z @ 32 NONAME ; void CSvgJavaInterfaceImpl::SvgElementAppendChild(int, int)
+ ?SvgElementCheckRemoveable@CSvgJavaInterfaceImpl@@QAEHH@Z @ 33 NONAME ; int CSvgJavaInterfaceImpl::SvgElementCheckRemoveable(int)
+ ?SvgElementCreate@CSvgJavaInterfaceImpl@@QAEHF@Z @ 34 NONAME ; int CSvgJavaInterfaceImpl::SvgElementCreate(short)
+ ?SvgElementDestroy@CSvgJavaInterfaceImpl@@QAEXH@Z @ 35 NONAME ; void CSvgJavaInterfaceImpl::SvgElementDestroy(int)
+ ?SvgElementElementInDOM@CSvgJavaInterfaceImpl@@QAEHHH@Z @ 36 NONAME ; int CSvgJavaInterfaceImpl::SvgElementElementInDOM(int, int)
+ ?SvgElementGetBBox@CSvgJavaInterfaceImpl@@QAEXHFPAM000@Z @ 37 NONAME ; void CSvgJavaInterfaceImpl::SvgElementGetBBox(int, short, float *, float *, float *, float *)
+ ?SvgElementGetColorAttribute@CSvgJavaInterfaceImpl@@QAEHHFPAH00@Z @ 38 NONAME ; int CSvgJavaInterfaceImpl::SvgElementGetColorAttribute(int, short, int *, int *, int *)
+ ?SvgElementGetEnumAttribute@CSvgJavaInterfaceImpl@@QAEFHF@Z @ 39 NONAME ; short CSvgJavaInterfaceImpl::SvgElementGetEnumAttribute(int, short)
+ ?SvgElementGetFirstElementChild@CSvgJavaInterfaceImpl@@QAEHH@Z @ 40 NONAME ; int CSvgJavaInterfaceImpl::SvgElementGetFirstElementChild(int)
+ ?SvgElementGetFloatAttribute@CSvgJavaInterfaceImpl@@QAEMHF@Z @ 41 NONAME ; float CSvgJavaInterfaceImpl::SvgElementGetFloatAttribute(int, short)
+ ?SvgElementGetMatrixAttribute@CSvgJavaInterfaceImpl@@QAEHHFPAM00000@Z @ 42 NONAME ; int CSvgJavaInterfaceImpl::SvgElementGetMatrixAttribute(int, short, float *, float *, float *, float *, float *, float *)
+ ?SvgElementGetNextElementSibling@CSvgJavaInterfaceImpl@@QAEHH@Z @ 43 NONAME ; int CSvgJavaInterfaceImpl::SvgElementGetNextElementSibling(int)
+ ?SvgElementGetParent@CSvgJavaInterfaceImpl@@QAEHH@Z @ 44 NONAME ; int CSvgJavaInterfaceImpl::SvgElementGetParent(int)
+ ?SvgElementGetPathAttribute@CSvgJavaInterfaceImpl@@QAEHHF@Z @ 45 NONAME ; int CSvgJavaInterfaceImpl::SvgElementGetPathAttribute(int, short)
+ ?SvgElementGetRectAttribute@CSvgJavaInterfaceImpl@@QAEHHFPAM000@Z @ 46 NONAME ; int CSvgJavaInterfaceImpl::SvgElementGetRectAttribute(int, short, float *, float *, float *, float *)
+ ?SvgElementGetScreenBBox@CSvgJavaInterfaceImpl@@QAEXHPAM000@Z @ 47 NONAME ; void CSvgJavaInterfaceImpl::SvgElementGetScreenBBox(int, float *, float *, float *, float *)
+ ?SvgElementGetStringAttribute@CSvgJavaInterfaceImpl@@QAEHHFAAVTPtrC16@@@Z @ 48 NONAME ; int CSvgJavaInterfaceImpl::SvgElementGetStringAttribute(int, short, class TPtrC16 &)
+ ?SvgElementGetType@CSvgJavaInterfaceImpl@@QAEHH@Z @ 49 NONAME ; int CSvgJavaInterfaceImpl::SvgElementGetType(int)
+ ?SvgElementGetUsedFromElement@CSvgJavaInterfaceImpl@@QAEHH@Z @ 50 NONAME ; int CSvgJavaInterfaceImpl::SvgElementGetUsedFromElement(int)
+ ?SvgElementHasAnimation@CSvgJavaInterfaceImpl@@QAEHH@Z @ 51 NONAME ; int CSvgJavaInterfaceImpl::SvgElementHasAnimation(int)
+ ?SvgElementInsertBefore@CSvgJavaInterfaceImpl@@QAEXHHH@Z @ 52 NONAME ; void CSvgJavaInterfaceImpl::SvgElementInsertBefore(int, int, int)
+ ?SvgElementIsActive@CSvgJavaInterfaceImpl@@QAEHH@Z @ 53 NONAME ; int CSvgJavaInterfaceImpl::SvgElementIsActive(int)
+ ?SvgElementIsUsed@CSvgJavaInterfaceImpl@@QAEHH@Z @ 54 NONAME ; int CSvgJavaInterfaceImpl::SvgElementIsUsed(int)
+ ?SvgElementRemoveChild@CSvgJavaInterfaceImpl@@QAEHHH@Z @ 55 NONAME ; int CSvgJavaInterfaceImpl::SvgElementRemoveChild(int, int)
+ ?SvgElementRemoveEventListener@CSvgJavaInterfaceImpl@@QAEXHHF@Z @ 56 NONAME ; void CSvgJavaInterfaceImpl::SvgElementRemoveEventListener(int, int, short)
+ ?SvgElementSetColorAttribute@CSvgJavaInterfaceImpl@@QAEXHFHHH@Z @ 57 NONAME ; void CSvgJavaInterfaceImpl::SvgElementSetColorAttribute(int, short, int, int, int)
+ ?SvgElementSetEnumAttribute@CSvgJavaInterfaceImpl@@QAEXHFF@Z @ 58 NONAME ; void CSvgJavaInterfaceImpl::SvgElementSetEnumAttribute(int, short, short)
+ ?SvgElementSetFloatAttribute@CSvgJavaInterfaceImpl@@QAEXHFM@Z @ 59 NONAME ; void CSvgJavaInterfaceImpl::SvgElementSetFloatAttribute(int, short, float)
+ ?SvgElementSetMatrixAttribute@CSvgJavaInterfaceImpl@@QAEXHFMMMMMM@Z @ 60 NONAME ; void CSvgJavaInterfaceImpl::SvgElementSetMatrixAttribute(int, short, float, float, float, float, float, float)
+ ?SvgElementSetPathAttribute@CSvgJavaInterfaceImpl@@QAEXHFH@Z @ 61 NONAME ; void CSvgJavaInterfaceImpl::SvgElementSetPathAttribute(int, short, int)
+ ?SvgElementSetRectAttribute@CSvgJavaInterfaceImpl@@QAEXHFMMMM@Z @ 62 NONAME ; void CSvgJavaInterfaceImpl::SvgElementSetRectAttribute(int, short, float, float, float, float)
+ ?SvgElementSetStringAttribute@CSvgJavaInterfaceImpl@@QAEXHFABVTPtrC16@@@Z @ 63 NONAME ; void CSvgJavaInterfaceImpl::SvgElementSetStringAttribute(int, short, class TPtrC16 const &)
+ ?SvgElementUpdatePath@CSvgJavaInterfaceImpl@@QAEXHH@Z @ 64 NONAME ; void CSvgJavaInterfaceImpl::SvgElementUpdatePath(int, int)
+ ?SvgEngineCreate@CSvgJavaInterfaceImpl@@QAEHXZ @ 65 NONAME ; int CSvgJavaInterfaceImpl::SvgEngineCreate(void)
+ ?SvgEngineDestroy@CSvgJavaInterfaceImpl@@QAEXH@Z @ 66 NONAME ; void CSvgJavaInterfaceImpl::SvgEngineDestroy(int)
+ ?SvgEngineRenderDocument@CSvgJavaInterfaceImpl@@QAEXHHHHM@Z @ 67 NONAME ; void CSvgJavaInterfaceImpl::SvgEngineRenderDocument(int, int, int, int, float)
+ ?SvgEngineRenderDocumentL@CSvgJavaInterfaceImpl@@QAEXHHHABVTPoint@@ABVTRect@@MM@Z @ 68 NONAME ; void CSvgJavaInterfaceImpl::SvgEngineRenderDocumentL(int, int, int, class TPoint const &, class TRect const &, float, float)
+ ?SvgEngineResume@CSvgJavaInterfaceImpl@@QAEXH@Z @ 69 NONAME ; void CSvgJavaInterfaceImpl::SvgEngineResume(int)
+ ?SvgEngineSetRenderQuality@CSvgJavaInterfaceImpl@@QAEXHH@Z @ 70 NONAME ; void CSvgJavaInterfaceImpl::SvgEngineSetRenderQuality(int, int)
+ ?SvgEngineStart@CSvgJavaInterfaceImpl@@QAEXH@Z @ 71 NONAME ; void CSvgJavaInterfaceImpl::SvgEngineStart(int)
+ ?SvgEngineStop@CSvgJavaInterfaceImpl@@QAEXH@Z @ 72 NONAME ; void CSvgJavaInterfaceImpl::SvgEngineStop(int)
+ ?SvgPathAddClose@CSvgJavaInterfaceImpl@@QAEXH@Z @ 73 NONAME ; void CSvgJavaInterfaceImpl::SvgPathAddClose(int)
+ ?SvgPathAddCurveTo@CSvgJavaInterfaceImpl@@QAEXHMMMMMM@Z @ 74 NONAME ; void CSvgJavaInterfaceImpl::SvgPathAddCurveTo(int, float, float, float, float, float, float)
+ ?SvgPathAddLineTo@CSvgJavaInterfaceImpl@@QAEXHMM@Z @ 75 NONAME ; void CSvgJavaInterfaceImpl::SvgPathAddLineTo(int, float, float)
+ ?SvgPathAddMoveTo@CSvgJavaInterfaceImpl@@QAEXHMM@Z @ 76 NONAME ; void CSvgJavaInterfaceImpl::SvgPathAddMoveTo(int, float, float)
+ ?SvgPathAddQuadTo@CSvgJavaInterfaceImpl@@QAEXHMMMM@Z @ 77 NONAME ; void CSvgJavaInterfaceImpl::SvgPathAddQuadTo(int, float, float, float, float)
+ ?SvgPathCreate@CSvgJavaInterfaceImpl@@QAEHXZ @ 78 NONAME ; int CSvgJavaInterfaceImpl::SvgPathCreate(void)
+ ?SvgPathDestroy@CSvgJavaInterfaceImpl@@QAEXH@Z @ 79 NONAME ; void CSvgJavaInterfaceImpl::SvgPathDestroy(int)
+ ?SvgPathGetSegmentCount@CSvgJavaInterfaceImpl@@QAEHH@Z @ 80 NONAME ; int CSvgJavaInterfaceImpl::SvgPathGetSegmentCount(int)
+ ?SvgPathGetSegmentParameter@CSvgJavaInterfaceImpl@@QAEMHHH@Z @ 81 NONAME ; float CSvgJavaInterfaceImpl::SvgPathGetSegmentParameter(int, int, int)
+ ?SvgPathGetSegmentType@CSvgJavaInterfaceImpl@@QAEHHH@Z @ 82 NONAME ; int CSvgJavaInterfaceImpl::SvgPathGetSegmentType(int, int)
+ ?SvgRenderingSurfaceCreate@CSvgJavaInterfaceImpl@@QAEHHH@Z @ 83 NONAME ; int CSvgJavaInterfaceImpl::SvgRenderingSurfaceCreate(int, int)
+ ?SvgRenderingSurfaceDestroy@CSvgJavaInterfaceImpl@@QAEXH@Z @ 84 NONAME ; void CSvgJavaInterfaceImpl::SvgRenderingSurfaceDestroy(int)
+ ?SvgRenderingSurfaceGetBuffer@CSvgJavaInterfaceImpl@@QAEPAIH@Z @ 85 NONAME ; unsigned int * CSvgJavaInterfaceImpl::SvgRenderingSurfaceGetBuffer(int)
+ ?SvgRenderingSurfaceGetHeight@CSvgJavaInterfaceImpl@@QAEHH@Z @ 86 NONAME ; int CSvgJavaInterfaceImpl::SvgRenderingSurfaceGetHeight(int)
+ ?SvgRenderingSurfaceGetWidth@CSvgJavaInterfaceImpl@@QAEHH@Z @ 87 NONAME ; int CSvgJavaInterfaceImpl::SvgRenderingSurfaceGetWidth(int)
+ ?NewL@CSvgJavaInterfaceImpl@@SAPAV1@AAVTFontSpec@@@Z @ 88 NONAME ; class CSvgJavaInterfaceImpl * CSvgJavaInterfaceImpl::NewL(class TFontSpec &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGEngineJI/eabi/SVGEngineJIU.def Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,97 @@
+EXPORTS
+ _ZN21CSvgJavaInterfaceImpl13SvgEngineStopEi @ 1 NONAME
+ _ZN21CSvgJavaInterfaceImpl13SvgPathCreateEv @ 2 NONAME
+ _ZN21CSvgJavaInterfaceImpl14SvgEngineStartEi @ 3 NONAME
+ _ZN21CSvgJavaInterfaceImpl14SvgPathDestroyEi @ 4 NONAME
+ _ZN21CSvgJavaInterfaceImpl15SvgEngineCreateEv @ 5 NONAME
+ _ZN21CSvgJavaInterfaceImpl15SvgEngineResumeEi @ 6 NONAME
+ _ZN21CSvgJavaInterfaceImpl15SvgPathAddCloseEi @ 7 NONAME
+ _ZN21CSvgJavaInterfaceImpl16SvgDocumentGetIdEiiR7TPtrC16 @ 8 NONAME
+ _ZN21CSvgJavaInterfaceImpl16SvgElementCreateEs @ 9 NONAME
+ _ZN21CSvgJavaInterfaceImpl16SvgElementIsUsedEi @ 10 NONAME
+ _ZN21CSvgJavaInterfaceImpl16SvgEngineDestroyEi @ 11 NONAME
+ _ZN21CSvgJavaInterfaceImpl16SvgPathAddLineToEiff @ 12 NONAME
+ _ZN21CSvgJavaInterfaceImpl16SvgPathAddMoveToEiff @ 13 NONAME
+ _ZN21CSvgJavaInterfaceImpl16SvgPathAddQuadToEiffff @ 14 NONAME
+ _ZN21CSvgJavaInterfaceImpl17SvgElementDestroyEi @ 15 NONAME
+ _ZN21CSvgJavaInterfaceImpl17SvgElementGetBBoxEisPfS0_S0_S0_ @ 16 NONAME
+ _ZN21CSvgJavaInterfaceImpl17SvgElementGetTypeEi @ 17 NONAME
+ _ZN21CSvgJavaInterfaceImpl17SvgPathAddCurveToEiffffff @ 18 NONAME
+ _ZN21CSvgJavaInterfaceImpl18SvgDocumentCreateLERK7TPtrC16 @ 19 NONAME
+ _ZN21CSvgJavaInterfaceImpl18SvgDocumentDestroyEi @ 20 NONAME
+ _ZN21CSvgJavaInterfaceImpl18SvgDocumentFocusOnEii @ 21 NONAME
+ _ZN21CSvgJavaInterfaceImpl18SvgElementIsActiveEi @ 22 NONAME
+ _ZN21CSvgJavaInterfaceImpl19SvgDocumentActivateEi @ 23 NONAME
+ _ZN21CSvgJavaInterfaceImpl19SvgDocumentFocusOutEii @ 24 NONAME
+ _ZN21CSvgJavaInterfaceImpl19SvgDocumentGetFocusEi @ 25 NONAME
+ _ZN21CSvgJavaInterfaceImpl19SvgElementGetParentEi @ 26 NONAME
+ _ZN21CSvgJavaInterfaceImpl20SvgElementUpdatePathEii @ 27 NONAME
+ _ZN21CSvgJavaInterfaceImpl21SvgElementAppendChildEii @ 28 NONAME
+ _ZN21CSvgJavaInterfaceImpl21SvgElementRemoveChildEii @ 29 NONAME
+ _ZN21CSvgJavaInterfaceImpl21SvgPathGetSegmentTypeEii @ 30 NONAME
+ _ZN21CSvgJavaInterfaceImpl22SvgDocumentCreateEmptyEv @ 31 NONAME
+ _ZN21CSvgJavaInterfaceImpl22SvgElementElementInDOMEii @ 32 NONAME
+ _ZN21CSvgJavaInterfaceImpl22SvgElementHasAnimationEi @ 33 NONAME
+ _ZN21CSvgJavaInterfaceImpl22SvgElementInsertBeforeEiii @ 34 NONAME
+ _ZN21CSvgJavaInterfaceImpl22SvgPathGetSegmentCountEi @ 35 NONAME
+ _ZN21CSvgJavaInterfaceImpl23SvgDocumentEndElementAtEiif @ 36 NONAME
+ _ZN21CSvgJavaInterfaceImpl23SvgDocumentGetMediaTimeEi @ 37 NONAME
+ _ZN21CSvgJavaInterfaceImpl23SvgDocumentHasAnimationEi @ 38 NONAME
+ _ZN21CSvgJavaInterfaceImpl23SvgDocumentSetMediaTimeEif @ 39 NONAME
+ _ZN21CSvgJavaInterfaceImpl23SvgDocumentViewportInitEi @ 40 NONAME
+ _ZN21CSvgJavaInterfaceImpl23SvgElementGetScreenBBoxEiPfS0_S0_S0_ @ 41 NONAME
+ _ZN21CSvgJavaInterfaceImpl23SvgEngineRenderDocumentEiiiif @ 42 NONAME
+ _ZN21CSvgJavaInterfaceImpl24SvgEngineRenderDocumentLEiiiRK6TPointRK5TRectff @ 43 NONAME
+ _ZN21CSvgJavaInterfaceImpl25SvgDocumentBeginElementAtEiif @ 44 NONAME
+ _ZN21CSvgJavaInterfaceImpl25SvgDocumentGetElementByIdEiRK7TPtrC16 @ 45 NONAME
+ _ZN21CSvgJavaInterfaceImpl25SvgDocumentGetNumberOfIdsEi @ 46 NONAME
+ _ZN21CSvgJavaInterfaceImpl25SvgDocumentGetRootElementEi @ 47 NONAME
+ _ZN21CSvgJavaInterfaceImpl25SvgElementCheckRemoveableEi @ 48 NONAME
+ _ZN21CSvgJavaInterfaceImpl25SvgEngineSetRenderQualityEii @ 49 NONAME
+ _ZN21CSvgJavaInterfaceImpl25SvgRenderingSurfaceCreateEii @ 50 NONAME
+ _ZN21CSvgJavaInterfaceImpl26SvgElementAddEventListenerEiis @ 51 NONAME
+ _ZN21CSvgJavaInterfaceImpl26SvgElementGetEnumAttributeEis @ 52 NONAME
+ _ZN21CSvgJavaInterfaceImpl26SvgElementGetPathAttributeEis @ 53 NONAME
+ _ZN21CSvgJavaInterfaceImpl26SvgElementGetRectAttributeEisPfS0_S0_S0_ @ 54 NONAME
+ _ZN21CSvgJavaInterfaceImpl26SvgElementSetEnumAttributeEiss @ 55 NONAME
+ _ZN21CSvgJavaInterfaceImpl26SvgElementSetPathAttributeEisi @ 56 NONAME
+ _ZN21CSvgJavaInterfaceImpl26SvgElementSetRectAttributeEisffff @ 57 NONAME
+ _ZN21CSvgJavaInterfaceImpl26SvgPathGetSegmentParameterEiii @ 58 NONAME
+ _ZN21CSvgJavaInterfaceImpl26SvgRenderingSurfaceDestroyEi @ 59 NONAME
+ _ZN21CSvgJavaInterfaceImpl27SvgDocumentGetViewportWidthEi @ 60 NONAME
+ _ZN21CSvgJavaInterfaceImpl27SvgDocumentRequestCompletedEiRK7TPtrC16RK6TPtrC8 @ 61 NONAME
+ _ZN21CSvgJavaInterfaceImpl27SvgDocumentSetViewportWidthEii @ 62 NONAME
+ _ZN21CSvgJavaInterfaceImpl27SvgElementGetColorAttributeEisPiS0_S0_ @ 63 NONAME
+ _ZN21CSvgJavaInterfaceImpl27SvgElementGetFloatAttributeEis @ 64 NONAME
+ _ZN21CSvgJavaInterfaceImpl27SvgElementSetColorAttributeEisiii @ 65 NONAME
+ _ZN21CSvgJavaInterfaceImpl27SvgElementSetFloatAttributeEisf @ 66 NONAME
+ _ZN21CSvgJavaInterfaceImpl27SvgRenderingSurfaceGetWidthEi @ 67 NONAME
+ _ZN21CSvgJavaInterfaceImpl28SvgDocumentGetViewportHeightEi @ 68 NONAME
+ _ZN21CSvgJavaInterfaceImpl28SvgDocumentSetViewportHeightEii @ 69 NONAME
+ _ZN21CSvgJavaInterfaceImpl28SvgElementGetMatrixAttributeEisPfS0_S0_S0_S0_S0_ @ 70 NONAME
+ _ZN21CSvgJavaInterfaceImpl28SvgElementGetStringAttributeEisR7TPtrC16 @ 71 NONAME
+ _ZN21CSvgJavaInterfaceImpl28SvgElementGetUsedFromElementEi @ 72 NONAME
+ _ZN21CSvgJavaInterfaceImpl28SvgElementSetMatrixAttributeEisffffff @ 73 NONAME
+ _ZN21CSvgJavaInterfaceImpl28SvgElementSetStringAttributeEisRK7TPtrC16 @ 74 NONAME
+ _ZN21CSvgJavaInterfaceImpl28SvgRenderingSurfaceGetBufferEi @ 75 NONAME
+ _ZN21CSvgJavaInterfaceImpl28SvgRenderingSurfaceGetHeightEi @ 76 NONAME
+ _ZN21CSvgJavaInterfaceImpl29SvgDocumentDispatchMouseEventEiii @ 77 NONAME
+ _ZN21CSvgJavaInterfaceImpl29SvgElementRemoveEventListenerEiis @ 78 NONAME
+ _ZN21CSvgJavaInterfaceImpl30SvgDocumentGetExternalListItemEiiR7TPtrC16 @ 79 NONAME
+ _ZN21CSvgJavaInterfaceImpl30SvgDocumentGetExternalListSizeEi @ 80 NONAME
+ _ZN21CSvgJavaInterfaceImpl30SvgElementGetFirstElementChildEi @ 81 NONAME
+ _ZN21CSvgJavaInterfaceImpl31SvgElementGetNextElementSiblingEi @ 82 NONAME
+ _ZN21CSvgJavaInterfaceImpl32SvgDocumentGetViewportWidthUnitsEi @ 83 NONAME
+ _ZN21CSvgJavaInterfaceImpl33SvgDocumentGetViewportHeightUnitsEi @ 84 NONAME
+ _ZN21CSvgJavaInterfaceImpl4NewLEv @ 85 NONAME
+ _ZN21CSvgJavaInterfaceImplC1Ev @ 86 NONAME
+ _ZN21CSvgJavaInterfaceImplC2Ev @ 87 NONAME
+ _ZN21CSvgJavaInterfaceImplD0Ev @ 88 NONAME
+ _ZN21CSvgJavaInterfaceImplD1Ev @ 89 NONAME
+ _ZN21CSvgJavaInterfaceImplD2Ev @ 90 NONAME
+ _ZTI10CJavaError @ 91 NONAME ; #<TI>#
+ _ZTI21CSvgJavaInterfaceImpl @ 92 NONAME ; #<TI>#
+ _ZTV10CJavaError @ 93 NONAME ; #<VT>#
+ _ZTV21CSvgJavaInterfaceImpl @ 94 NONAME ; #<VT>#
+ _ZN21CSvgJavaInterfaceImpl4NewLER9TFontSpec @ 95 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGEngineJI/group/SVGEngineJI.mmp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This mmp file generates makefile for SVG Engine
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET svgengineji.dll
+TARGETTYPE dll
+
+VENDORID VID_DEFAULT
+
+UID 0x1000008D 0x101F8821
+
+
+#if defined( ARMCC )
+deffile ../eabi/SVGEngineJI.def
+#elif defined( WINSCW )
+deffile ../BWINSCW/SVGEngineJI.def
+#elif defined( WINS )
+deffile ../bwins/SVGEngineJI.def
+#else
+deffile ../bmarm/SVGEngineJI.def
+#endif
+
+CAPABILITY CAP_GENERAL_DLL DRM
+
+SOURCEPATH ../src
+
+SOURCE SvgJavaInterfaceImpl.cpp
+
+USERINCLUDE ../inc
+
+// This is a SYSTEMINCLUDE macro containing the middleware
+// layer specific include directories
+MW_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE /epoc32/include/libc
+
+LIBRARY svgengine.lib
+
+LIBRARY euser.lib
+LIBRARY fbscli.lib
+
+//utility libraries only....can be removed in final version
+LIBRARY hal.lib
+//LIBRARY imageconversion.lib
+//LIBRARY efsrv.lib
+
+//#define JAVA_POPUP
+
+#ifdef JAVA_POPUP
+//used for debugging the java side accessing the native side
+LIBRARY eikcore.lib
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGEngineJI/inc/SVGjsrconstants.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,393 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+ #ifndef _INC_SVGJSRCONSTANTS_
+ #define _INC_SVGJSRCONSTANTS_
+// The error flag
+ #define TEXT_NOT_SHORT -3
+ #define DEFAULT_INHERIT -2 // null on native engine
+ #define SVG_ERROR -1
+ const TInt KJavaIOException = -10;
+
+ // A constant for each element in SVGT
+ #define EL_A 0
+ #define EL_ANIMATE 1
+ #define EL_ANIMATECOLOR 2
+ #define EL_ANIMATEMOTION 3
+ #define EL_ANIMATETRANSFORM 4
+ #define EL_CIRCLE 5
+ #define EL_DEFS 6
+ #define EL_DESC 7
+ #define EL_ELLIPSE 8
+ #define EL_FONT 9
+ #define EL_FONTFACE 10
+ #define EL_FONTFACENAME 11
+ #define EL_FONTFACESRC 12
+ #define EL_FOREIGNOBJECT 13
+ #define EL_G 14
+ #define EL_GLYPH 15
+ #define EL_HKERN 16
+ #define EL_IMAGE 17
+ #define EL_LINE 18
+ #define EL_METADATA 19
+ #define EL_MISSINGGLYPH 20
+ #define EL_MPATH 21
+ #define EL_PATH 22
+ #define EL_POLYGON 23
+ #define EL_POLYLINE 24
+ #define EL_RECT 25
+ #define EL_SET 26
+ #define EL_SVG 27
+ #define EL_SWITCH 28
+ #define EL_TEXT 29
+ #define EL_TITLE 30
+ #define EL_USE 31
+
+ // A constant for each attribute in SVGT
+ #define AT_ACCENTHEIGHT 50 // Not supported by SVGT Engine
+ #define AT_ACCUMULATE 51 // SVGT - Int and JSR Enum
+ #define AT_ADDITIVE 52 // SVGT - Int and JSR Enum
+ #define AT_ALPHABETIC 53 // SVGT - Float and JSR
+ #define AT_ARABICFORM 54 // Not supported by SVGT Engine
+ #define AT_ASCENT 55 // SVGT - Float and JSR
+ #define AT_ATTRIBUTENAME 56 // SVGT - Int and JSR
+ #define AT_ATTRIBUTETYPE 57 // Not supported by SVGT Engine
+ #define AT_BASEPROFILE 58 // SVGT - String and JSR
+ #define AT_BBOX 59 // SVGT doesn't support as such as a attribute but GetBBox can be implemented
+ #define AT_BEGIN 60 // SVGT - Int and JSR
+ #define AT_BY 61 // SVGT- different data types JSR
+ #define AT_CALCMODE 62 // SVGT - Int and JSR - Enum
+ #define AT_CAPHEIGHT 63 // Not supported by SVGT Engine
+ #define AT_COLOR 64 // SVGT - RGB and and JSR - RGB
+ #define AT_COLORRENDERING 65 // Not supported by SVGT Engine
+ // #define AT_CONTENT 66
+ #define AT_CX 67 // SVGT - Flaot and JSR
+ #define AT_CY 68 // SVGT - Float and JSR
+ #define AT_D 69 // SVGT - Path and JSR
+ #define AT_DESCENT 70 // SVGT - Float and JSR
+ #define AT_DISPLAY 71 // SVGT - Int and JSR Enum
+ #define AT_DUR 72 // SVGT - Int and JSR
+ #define AT_END 73 // SVGT - Int and JSR
+ #define AT_FILL 74 // SVGT - Int and JSR Enum and also SVGT - RGB and JSr - RGB
+ #define AT_FILLRULE 75 // SVGT - String and JSR Enum
+ #define AT_FONTFAMILY 76 // SVGT - String and JSR String
+ #define AT_FONTSIZE 77 // SVGT - Float and JSR - How to convert the JSR Enums
+ #define AT_FONTSTRETCH 78 // Not supported by SVGT Engine
+ #define AT_FONTSTYLE 79 // SVGT - Enum and JSR - Enum
+ #define AT_FONTVARIANT 80 // Not supported by SVGT Engine
+ #define AT_FONTWEIGHT 81 // SVGT - Enum and JSR - Enum
+ #define AT_FROM 82 // SVGT- different data types JSR
+ #define AT_G1 83 // SVGT - String and JSR
+ #define AT_G2 84 // SVGT - String and JSR
+ #define AT_GLYPHNAME 85 // SVGT - String and JSR
+ #define AT_HANGING 86 // Not supported by SVGT Engine
+ #define AT_HEIGHT 87 // SVGT - Float and JSR
+ #define AT_HORIZADVX 88 // SVGT - Float and JSR
+ #define AT_HORIZORIGINX 89 // SVGT - Float and JSR
+ #define AT_ID 90 // SVGT - String and JSR
+ #define AT_IDEOGRAPHIC 91 // Not supported by SVGT Engine
+ #define AT_K 92 // SVGT - String and JSR
+ #define AT_KEYPOINTS 93 // Not supported by SVGT Engine
+ #define AT_KEYSPLINES 94 // Not clear how the data will be sent by JSR
+ #define AT_KEYTIMES 95 // Not clear how the data will be sent by JSR
+ #define AT_LANG 96 // SVGT - String and JSR
+ #define AT_MATHEMATICAL 97 // Not supported by SVGT Engine
+ #define AT_MAX 98 // Not supported by SVGT Engine
+ #define AT_MIN 99 // Not supported by SVGT Engine
+ #define AT_NAME 100 // Not supported by SVGT Engine
+ #define AT_ORIGIN 101 // Not supported by SVGT Engine
+ #define AT_OVERLINEPOSITION 102 // SVGT - Float and JSR
+ #define AT_OVERLINETHICKNESS 103 // SVGT - Float and JSR
+ #define AT_PANOSE1 104 // Not supported by SVGT Engine
+ #define AT_PATH 105 // SVGT - Path and JSR
+ #define AT_PATHLENGTH 106 // Currently on implemented in SVGT
+ #define AT_POINTS 107 // SVGT - Path and JSR
+ #define AT_PRESERVEASPECTRATIO 108 // SVGT - String and JSR - Enum
+ #define AT_R 109 // SVGT - Float and JSR
+ #define AT_REPEATCOUNT 110 // SVGT - Int and JSR
+ #define AT_REPEATDUR 111 // SVGT - Int and JSR
+ #define AT_REQUIREDEXTENSIONS 112 // SVGT - String and JSR
+ #define AT_REQUIREDFEATURES 113 // SVGT - String and JSR
+ #define AT_RESTART 114 // SVGT - Int and JSR
+ #define AT_ROTATE 115 // JSR
+ #define AT_RX 116 // SVGT - Float and JSR
+ #define AT_RY 117 // SVGT - Float and JSR
+ #define AT_SLOPE 118 // Not supported by SVGT Engine
+ #define AT_STEMH 119 // Not supported by SVGT Engine
+ #define AT_STEMV 120 // Not supported by SVGT Engine
+ #define AT_STRIKETHROUGHPOSITION 121 // SVGT - Float and JSR
+ #define AT_STRIKETHROUGHTHICKNESS 122 // SVGT - Float and JSR
+ #define AT_STROKE 123 // SVGT - color and JSR
+ #define AT_STROKEDASHARRAY 124 // SVGT - Vector and JSr
+ #define AT_STROKEDASHOFFSET 125 // SVGT - Float and JSR
+ #define AT_STROKELINECAP 126 // SVGT - String and JSR - Enum
+ #define AT_STROKELINEJOIN 127 // SVGT - String and JSR - Enum
+ #define AT_STROKEMITERLIMIT 128 // SVGT - Float and JSR
+ #define AT_STROKEWIDTH 129 // SVGT - Float and JSR
+ #define AT_STYLE 130 // JSR ?
+ #define AT_SYSTEMLANGUAGE 131 // SVGT - String and JSR
+ #define AT_TARGET 132 // Not supported by SVGT Engine
+ #define AT_TEXTANCHOR 133 // SVGT - Enum and JSR - Enum
+ #define AT_TO 134 // SVGT- different data types JSR
+ #define AT_TRANSFORM 135 // SVGT - Matrix and JSR - matrix
+ #define AT_TYPE 136 // SVGT - one case Matrix and another String JSR
+ #define AT_U1 137 // SVGT - String and JSr
+ #define AT_U2 138 // SVGT - String and JSr
+ #define AT_UNDERLINEPOSITION 139 // SVGT - Float and JSR
+ #define AT_UNDERLINETHICKNESS 140 // SVGT - Float and JSR
+ #define AT_UNICODE 141 // SVGT - String and JSR
+ #define AT_UNICODERANGE 142 // SVGT - String and JSR
+ #define AT_UNITSPEREM 143 // SVGT - Float and JSR
+ #define AT_VALUES 144 // SVGT - matrix and JSR
+ #define AT_VERSION 145 // SVGT - Float and JSR
+ #define AT_VIEWBOX 146 // SVGT - Rect and JSR
+ #define AT_VISIBILITY 147 // SVGT - Enum and JSR - Enum
+ #define AT_WIDTH 148 // SVGT - Float and JSR
+ #define AT_WIDTHS 149 // unknown attribute
+ #define AT_X 150 // SVGT - Float and JSR
+ #define AT_XHEIGHT 151 // unknown attribute
+ #define AT_X1 152 // SVGT - Float and JSR
+ #define AT_X2 153 // SVGT - Float and JSR
+ #define AT_XLINKACTUATE 154 // SVGT - String and JSR
+ #define AT_XLINKARCROLE 155 // SVGT - String and JSR
+ #define AT_XLINKHREF 156 // SVGT - String and JSR
+ #define AT_XLINKROLE 157 // SVGT - String and JSR
+ #define AT_XLINKSHOW 158 // SVGT - String and JSR
+ #define AT_XLINKTITLE 159 // SVGT - String and JSR
+ #define AT_XLINKTYPE 160 // SVGT - String and JSR
+ #define AT_XMLBASE 161 // SVGT - String and JSR
+ #define AT_XMLLANG 162 // SVGT - String and JSR
+ #define AT_XMLSPACE 163 // SVGT - String and JSR
+ #define AT_Y 164 // SVGT - Float and JSR
+ #define AT_Y1 165 // SVGT - Float and JSR
+ #define AT_Y2 166 // SVGT - Float and JSR
+ #define AT_ZOOMANDPAN 167 // SVGT - Enum and JSR -Enum
+
+ // not in the spec but used to correctly implement animateMotion
+ #define AT_MOTIONTRANSFORM 168 /// No corresponding SVGT Attribute
+
+ // not actually an attribute, but needed for desc, title, and text
+ #define AT_STRING 169 // No corresponding SVGT Attribute
+ #define AT_TEXTDECORATION 170 // SVGT - Enum and JSR -Enum
+
+ #define AT_HORIZORIGINY 171 // No corresponding SVGT Attribute
+ #define AT_MOUSEEVENT 172 // No corresponding SVGT Attribute
+ #define AT_USERBBOX 173 // No corresponding SVGT Attribute
+
+ // A constant for each type of value
+ #define VAL_EVENT 200
+ #define VAL_INTEGER 201
+ #define VAL_PAINT 202
+ #define VAL_POINT 203
+ #define VAL_REAL 204
+ #define VAL_STRING 205
+ #define VAL_TIME 206
+ #define VAL_TRANSFORM 207
+ #define VAL_VECTOR 208
+
+ // These are used for animation purposes
+ #define VAL_VECTOR_POINT 215
+ #define VAL_VECTOR_REAL 216
+ #define VAL_VECTOR_STRING 217
+ #define VAL_VECTOR_PATH 218
+
+ // VAL_VECTOR_X + VECTOR_TO_VAL VAL_X
+ #define VECTOR_TO_VAL -12
+
+ //
+ // Constants for "choices"
+ //
+
+ // Preserve aspect ratio constants
+ #define PAR_NONE 310
+ #define PAR_XMIDYMID 311
+
+ // Zoom and pan constants
+ #define ZPN_MAGNIFY 320
+ #define ZPN_DISABLE 321
+
+ // Paint
+ #define PAINT_NONE 325
+ #define PAINT_CURRENT 326
+ #define PAINT_COLOR 327
+ #define PAINT_INHERIT 328
+
+ // Fonts
+ #define FONT_ALL 330
+ #define FONT_NORMAL 331
+
+ #define FONT_STYLE_ITALIC 332
+ #define FONT_STYLE_OBLIQUE 333
+
+ #define FONT_VARIANT_SMALLCAPS 334
+
+ #define FONT_WEIGHT_BOLD 335
+ #define FONT_WEIGHT_BOLDER 336
+ #define FONT_WEIGHT_LIGHTER 337
+ #define FONT_WEIGHT_100 338
+ #define FONT_WEIGHT_200 339
+ #define FONT_WEIGHT_300 340
+ #define FONT_WEIGHT_400 341
+ #define FONT_WEIGHT_500 342
+ #define FONT_WEIGHT_600 343
+ #define FONT_WEIGHT_700 344
+ #define FONT_WEIGHT_800 345
+ #define FONT_WEIGHT_900 346
+
+ #define FONT_STRETCH_WIDER 347
+ #define FONT_STRETCH_NARROWER 348
+ #define FONT_STRETCH_ULTRA_COND 349
+ #define FONT_STRETCH_EXTRA_COND 350
+ #define FONT_STRETCH_COND 351
+ #define FONT_STRETCH_SEMI_COND 352
+ #define FONT_STRETCH_SEMI_EXPD 353
+ #define FONT_STRETCH_EXPD 354
+ #define FONT_STRETCH_EXTRA_EXPD 355
+ #define FONT_STRETCH_ULTRA_EXPD 356
+
+ // Text
+ #define TEXT_ANCHOR_START 360
+ #define TEXT_ANCHOR_MIDDLE 361
+ #define TEXT_ANCHOR_END 362
+ #define TEXT_UNDER_LINE 363
+ #define TEXT_OVER_LINE 364
+ #define TEXT_LINE_THROUGH 365
+
+ // These are actual sizes in 8:8 fixed point, not "choices"
+ #define FONT_SIZE_XXSMALL 0x20000
+ #define FONT_SIZE_XSMALL 0x40000
+ #define FONT_SIZE_SMALL 0x60000
+ #define FONT_SIZE_MEDIUM 0xa0000
+ #define FONT_SIZE_LARGE 0x100000
+ #define FONT_SIZE_XLARGE 0x140000
+ #define FONT_SIZE_XXLARGE 0x180000
+
+ //
+ // Styles
+ //
+
+ // Fill
+ #define FILL_RULE_EVENODD 375
+ #define FILL_RULE_NONZERO 376
+
+ // Display
+ #define DISPLAY_NONE 380
+ #define DISPLAY_OTHER 381
+
+ // Visibility
+ #define VISIBILITY_VISIBLE 385
+ #define VISIBILITY_OTHER 386
+
+ // Color-rendering
+ #define COLOR_RENDERING_AUTO 390
+ #define COLOR_RENDERING_SPEED 391
+ #define COLOR_RENDERING_QUALITY 392
+
+ // Strokes
+ // MUST PRESERVE ORDER!!
+ #define STROKE_LINECAP_BUTT 395
+ #define STROKE_LINECAP_ROUND 396
+ #define STROKE_LINECAP_SQUARE 397
+
+ #define STROKE_LINEJOIN_MITER 400
+ #define STROKE_LINEJOIN_ROUND 401
+ #define STROKE_LINEJOIN_BEVEL 402
+
+ //
+ // Animation
+ //
+
+ #define ANIM_INDEFINITE 445
+
+ #define ACCUMULATE_NONE 450
+ #define ACCUMULATE_SUM 451
+
+ #define ADDITIVE_REPLACE 455
+ #define ADDITIVE_SUM 456
+
+ #define CALC_MODE_DISCRETE 460
+ #define CALC_MODE_LINEAR 461
+ #define CALC_MODE_PACED 462
+ #define CALC_MODE_SPLINE 463
+
+ #define FILL_REMOVE 465
+ #define FILL_FREEZE 466
+
+ #define RESTART_ALWAYS 470
+ #define RESTART_NEVER 471
+ #define RESTART_WHENNOTACTIVE 472
+
+ #define TYPE_TRANSLATE 475
+ #define TYPE_SCALE 476
+ #define TYPE_ROTATE 477
+ #define TYPE_SKEWX 478
+ #define TYPE_SKEWY 479
+
+ #define ATTR_TYPE_CSS 485
+ #define ATTR_TYPE_XML 486
+ #define ATTR_TYPE_AUTO 487
+
+ #define ROTATE_AUTO 490
+ #define ROTATE_AUTOREVERSE 491
+
+ #define ANIM_FROM_TO 500
+ #define ANIM_FROM_BY 501
+ #define ANIM_BY 502
+ #define ANIM_TO 503
+ #define ANIM_VALUES 504
+ #define ANIM_PATH 505
+
+ //
+ // Path Commands
+ //
+
+ #define PATH_COMMAND_M 600
+ #define PATH_COMMAND_m 601
+
+ #define PATH_COMMAND_Z 602
+
+ #define PATH_COMMAND_L 603
+ #define PATH_COMMAND_l 604
+
+ #define PATH_COMMAND_H 605
+ #define PATH_COMMAND_h 606
+
+ #define PATH_COMMAND_V 607
+ #define PATH_COMMAND_v 608
+
+ #define PATH_COMMAND_C 609
+ #define PATH_COMMAND_c 610
+
+ #define PATH_COMMAND_S 611
+ #define PATH_COMMAND_s 612
+
+ #define PATH_COMMAND_Q 613
+ #define PATH_COMMAND_q 614
+
+ #define PATH_COMMAND_T 615
+ #define PATH_COMMAND_t 616
+
+ //
+ // Events
+ //
+
+ #define EVENT_BEGIN 650 // the animation has started
+ #define EVENT_END 651 // the animation has finished
+ #define EVENT_REPEAT 652 // the animation has repeated
+ #define EVENT_BEGIN_EL 653
+ #define EVENT_END_EL 654
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGEngineJI/src/SvgJavaInterfaceImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,2989 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Engine source file
+ *
+*/
+
+#include <SvgJavaInterfaceImpl.h>
+#include "SVGErrorImpl.h"
+#include "SVGjsrconstants.h"
+
+//utility classes only can be removed in final version
+#include <hal.h>
+#include <hal_data.h>
+#include <imageconversion.h>
+
+// ***********************************************************************
+// Java error
+// ***********************************************************************
+
+// ==========================================================================
+// Two-phase constructor
+// ==========================================================================
+TInt CJavaError::NewL( CSvgErrorImpl& aError )
+ {
+ CJavaError* self = new ( ELeave ) CJavaError();
+ CleanupStack::PushL( self );
+ self->ConstructL( aError );
+ CleanupStack::Pop();
+ MJavaError* selfInterface = self;
+ return ( reinterpret_cast<TUint>( selfInterface ) >> 2 );
+ }
+
+// ==========================================================================
+// Destructor
+// ==========================================================================
+CJavaError::~CJavaError()
+ {
+ if(iDescription)
+ {
+ delete iDescription;
+ iDescription = NULL;
+ }
+ }
+
+// ==========================================================================
+// return Etrue if an error is indicated by this object.
+// ==========================================================================
+TBool CJavaError::HasError() const
+{
+ return iErrorCode != KErrNone;
+}
+
+// ==========================================================================
+// return Etrue if the error indicated by this object is only a warning.
+// ==========================================================================
+TBool CJavaError::IsWarning() const
+{
+ return iIsWarning;
+}
+
+// ==========================================================================
+// Get the error code.
+// ==========================================================================
+TInt CJavaError::ErrorCode() const
+{
+ return iErrorCode;
+}
+
+// ==========================================================================
+// Get the error description.
+// ==========================================================================
+TDesC8& CJavaError::Description()
+{
+ return *iDescription;
+}
+
+// ==========================================================================
+// Second phase of construction
+// ==========================================================================
+void CJavaError::ConstructL( CSvgErrorImpl& aError )
+{
+ // Error code
+ switch( aError.ErrorCode() )
+ {
+ case ESvgInvalidAttributeValue:
+ case ESvgUnknown:
+ {
+ iErrorCode = KJavaIOException;
+ break;
+ }
+ case KErrNoMemory:
+ {
+ iErrorCode = KErrNoMemory;
+ break;
+ }
+ default: iErrorCode = KJavaIOException;
+ }
+ // Warning
+ iIsWarning = aError.IsWarning();
+ // Description
+ iDescription = HBufC8::NewL( aError.Description().Length() + 1);
+ TPtr8 ptr = iDescription->Des();
+ ptr.Copy( aError.Description() );
+ ptr.ZeroTerminate();
+ }
+
+// ==========================================================================
+// Constructor
+// ==========================================================================
+CJavaError::CJavaError()
+: iErrorCode( KErrNone ),
+ iIsWarning( EFalse ),
+ iDescription( NULL )
+{
+}
+// ***********************************************************************
+// SVG Engine
+// ***********************************************************************
+
+EXPORT_C CSvgJavaInterfaceImpl::CSvgJavaInterfaceImpl(): iTempDoc( NULL )
+{
+}
+
+EXPORT_C CSvgJavaInterfaceImpl* CSvgJavaInterfaceImpl::NewL( TFontSpec& aFontSpec )
+{
+ CSvgJavaInterfaceImpl* self = new ( ELeave ) CSvgJavaInterfaceImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL(aFontSpec);
+ CleanupStack::Pop();
+ return self;
+}
+
+EXPORT_C CSvgJavaInterfaceImpl* CSvgJavaInterfaceImpl::NewL()
+{
+ CSvgJavaInterfaceImpl* self = new ( ELeave ) CSvgJavaInterfaceImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+}
+
+void CSvgJavaInterfaceImpl::ConstructL( TFontSpec& aFontSpec )
+{
+ CSvgEngineInterfaceImpl::ConstructL(aFontSpec);
+ iTempDoc = (CSvgDocumentImpl*)SvgDocumentCreateEmpty();
+
+ AddListener( (MSvgMouseListener*)this, ESvgMouseListener );
+
+ //TO BE ADDED IN THE FUTURE FOR TEXT AREA AND PROGRESSIVE RENDERING
+ //AddListener( (MSvgTextAreaListener*)this, ESvgTextAreaListener );
+ //AddListener( (MSvgTextListener*)this, ESvgTextListener );
+ //AddListener( (MSvgLoadingListener*)this, ESvgLoadingListener );
+}
+
+void CSvgJavaInterfaceImpl::ConstructL()
+{
+ CSvgEngineInterfaceImpl::ConstructL();
+ iTempDoc = (CSvgDocumentImpl*)SvgDocumentCreateEmpty();
+
+ AddListener( (MSvgMouseListener*)this, ESvgMouseListener );
+
+ //TO BE ADDED IN THE FUTURE FOR TEXT AREA AND PROGRESSIVE RENDERING
+ //AddListener( (MSvgTextAreaListener*)this, ESvgTextAreaListener );
+ //AddListener( (MSvgTextListener*)this, ESvgTextListener );
+ //AddListener( (MSvgLoadingListener*)this, ESvgLoadingListener );
+}
+
+EXPORT_C CSvgJavaInterfaceImpl::~CSvgJavaInterfaceImpl()
+{
+ if (iTempDoc)
+ {
+ DestroyDocument( iTempDoc );
+ iTempDoc = NULL;
+ }
+}
+
+/**
+ * Create an SvgEngine instance.
+ */
+EXPORT_C SvgEngineHandle CSvgJavaInterfaceImpl::SvgEngineCreate()
+{
+ CSvgEngineImpl *lSvgEngine = NULL;
+ TRAPD(error,lSvgEngine = SvgEngineNewL());
+ if(error == KErrNone)
+ {
+ return (SvgEngineHandle)lSvgEngine;
+ }
+ return 0;
+}
+/**
+ * Request to set render quality.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgEngineSetRenderQuality( SvgEngineHandle aEngineHandle, TInt aQuality )
+{
+ SetRenderQuality( aQuality, aEngineHandle );
+}
+
+/**
+ * Request to render the SVG document.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgEngineRenderDocument( SvgEngineHandle aEngineHandle, SvgDocumentHandle aDocumentHandle, TInt aSurfaceHandle, TInt aSurfaceMaskHandle, TReal32 aCurrentTime )
+{
+ CSvgEngineInterfaceImpl::iFileIsLoaded = ETrue;
+
+ SetDocument( (CSvgEngineImpl*)aEngineHandle, (CSvgDocumentImpl*)aDocumentHandle );
+
+ // GfxContext creation
+ TRAPD(error, SetGdiContextL( (CSvgEngineImpl*)aEngineHandle, (CFbsBitmap*)aSurfaceHandle ) );
+ if ( error != KErrNone )
+ {
+ // ignore trap error
+ }
+
+ //this udpates things like Viewport with whatever preserveAspectRatio and widths are set
+ //InitializeEngine((CSvgEngineImpl*)aEngineHandle);
+
+ if ( ((CFbsBitmap*)aSurfaceMaskHandle) != NULL)
+ GenerateMask((CFbsBitmap*)aSurfaceMaskHandle);
+
+ RenderFrame( (CSvgEngineImpl*)aEngineHandle, (TUint)(aCurrentTime * 1000) );
+
+ //utility functions
+ /*//TDisplayMode lDisplay = ((CFbsBitmap*)aSurfaceHandle)->DisplayMode();
+
+ //call it like this:
+ TBuf<KMaxName> myText;
+ myText.Copy(_L("Andrew's Test Bitmap"));
+
+ ConvertBitmapToFileL((CFbsBitmap*)aSurfaceHandle, myText);
+ */
+}
+
+/**
+ *
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgEngineRenderDocumentL(
+ SvgEngineHandle aEngineHandle, SvgDocumentHandle aDocumentHandle,
+ TInt aSurfaceHandle, const TPoint& aAnchor, const TRect& aRenderArea, TReal32 aCurrentTime, TReal32 aAlpha ) __SOFTFP
+ {
+ CSvgEngineInterfaceImpl::iFileIsLoaded = ETrue;
+ SetDocument( (CSvgEngineImpl*)aEngineHandle, (CSvgDocumentImpl*)aDocumentHandle );
+
+ CFbsBitmap* target = reinterpret_cast<CFbsBitmap*>( aSurfaceHandle );
+ CFbsBitmap* source = new ( ELeave ) CFbsBitmap();
+
+ User::LeaveIfError( source->Create(
+ TSize( SvgDocumentGetViewportWidth( aDocumentHandle ),
+ SvgDocumentGetViewportHeight( aDocumentHandle ) ),
+ EColor16MA ) );
+
+ // GfxContext creation
+ TRAPD(error, SetGdiContextL( (CSvgEngineImpl*)aEngineHandle, source ) );
+ if ( error != KErrNone )
+ {
+ // ignore trap error
+ }
+
+ RenderFrame( (CSvgEngineImpl*)aEngineHandle, (TUint)(aCurrentTime * 1000) );
+
+ source->LockHeap();
+ target->LockHeap();
+
+ // Source
+ TUint32* sourceBuffer = source->DataAddress();
+ const TInt sourceBufferWidth( source->SizeInPixels().iWidth );
+
+ // Target
+ TUint32* targetBuffer = target->DataAddress();
+ const TInt targetBufferWidth( target->SizeInPixels().iWidth );
+
+ // Set source buffer x position
+ if( aAnchor.iX < aRenderArea.iTl.iX )
+ {
+ sourceBuffer += ( aRenderArea.iTl.iX - aAnchor.iX );
+ }
+ // Set source buffer y position
+ if( aAnchor.iY < aRenderArea.iTl.iY )
+ {
+ sourceBuffer += sourceBufferWidth * ( aAnchor.iY - aRenderArea.iTl.iY );
+ }
+
+ // Set target buffer x position
+ targetBuffer += aRenderArea.iTl.iX;
+ // Set target buffer y position
+ targetBuffer += targetBufferWidth * aRenderArea.iTl.iY;
+
+ TInt heightIndex = 0;
+ TInt widthIndex = 0;
+ // If fully opaque
+ if( aAlpha == 1.0f )
+ {
+ // Line loop
+ for( heightIndex = 0; heightIndex < aRenderArea.Height(); heightIndex++ )
+ {
+ // Pixel loop
+ for( widthIndex = 0; widthIndex < aRenderArea.Width(); widthIndex++ )
+ {
+ // If alpha channel is not zero then do pixel coping
+ if( ( 0xff000000 & *sourceBuffer ) != 0x0 )
+ {
+ *targetBuffer = *sourceBuffer;
+ // Set the alpha value 0xFF
+ *targetBuffer |= 0xff000000;
+ }
+ // Next pixel
+ sourceBuffer++;
+ targetBuffer++;
+ }
+ sourceBuffer = sourceBuffer - aRenderArea.Width() + sourceBufferWidth;
+ targetBuffer = targetBuffer - aRenderArea.Width() + targetBufferWidth;
+ }
+ }
+ // Partly opaque
+ else
+ {
+
+ TUint alpha = STATIC_CAST( TUint8, ( aAlpha * 255 ) );
+ TUint antiAlpha = 255 - alpha;
+
+ TUint8* sourcePtr = NULL;
+ TUint8* targetPtr = NULL;
+ for( heightIndex = 0; heightIndex < aRenderArea.Height(); heightIndex++ )
+ {
+ // Pixel loop
+ for( widthIndex = 0; widthIndex < aRenderArea.Width(); widthIndex++ )
+ {
+ // If alpha channel is not zero then do alpha plending
+ if( ( 0xff000000 & *sourceBuffer ) != 0x0 )
+ {
+ targetPtr = REINTERPRET_CAST( TUint8*, targetBuffer );
+ sourcePtr = REINTERPRET_CAST( TUint8*, sourceBuffer );
+ // Blue component
+ *targetPtr = ( TUint8 )( ( ( TUint )( *sourcePtr ) * alpha +
+ ( TUint )( *targetPtr ) * antiAlpha ) / 255 );
+ sourcePtr++;
+ targetPtr++;
+ // Green component
+ *targetPtr = ( TUint8 )( ( ( TUint )( *sourcePtr ) * alpha +
+ ( TUint )( *targetPtr ) * antiAlpha ) / 255 );
+ sourcePtr++;
+ targetPtr++;
+ // Red component
+ *targetPtr = ( TUint8 )( ( ( TUint )( *sourcePtr ) * alpha +
+ ( TUint )( *targetPtr ) * antiAlpha ) / 255 );
+ // Alpha component
+ sourcePtr++;
+ targetPtr++;
+ *targetPtr = *sourcePtr;
+ // Set the alpha value 0xFF
+ *targetPtr |= 0xff000000;
+ }
+ // Next pixel
+ sourceBuffer++;
+ targetBuffer++;
+ }
+ // Next line
+ sourceBuffer = sourceBuffer - aRenderArea.Width() + sourceBufferWidth;
+ targetBuffer = targetBuffer - aRenderArea.Width() + targetBufferWidth;
+ }
+ }
+ source->UnlockHeap();
+ target->UnlockHeap();
+ delete source;
+
+ }
+
+/**
+ * Request to destroy the given engine by handle.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgEngineDestroy( SvgEngineHandle aEngineHandle )
+
+{
+ DestroyEngine( (CSvgEngineImpl *)aEngineHandle );
+}
+
+/*
+* Sets the animation back to time 0 and then starts the internal engine timer
+*/
+EXPORT_C void CSvgJavaInterfaceImpl::SvgEngineStart( SvgEngineHandle aEngineHandle )
+{
+ Start((CSvgEngineImpl*)aEngineHandle);
+}
+
+/*
+* Stops the internal SVG engine timer
+*/
+EXPORT_C void CSvgJavaInterfaceImpl::SvgEngineStop( SvgEngineHandle aEngineHandle )
+{
+ Stop((CSvgEngineImpl*)aEngineHandle);
+}
+
+/*
+* Resumes the internal SVG engine timer
+*/
+EXPORT_C void CSvgJavaInterfaceImpl::SvgEngineResume( SvgEngineHandle aEngineHandle )
+{
+ Resume((CSvgEngineImpl*)aEngineHandle);
+}
+
+
+// *****************************************************************************
+// *** SVG Rendering Surface Functions
+// *****************************************************************************
+/**
+ * Create a Svg Rendering Surface.
+ */
+
+ // SVG Engine creates the buffer for the surface according width and height. Currently, application gives us the buffer.
+
+EXPORT_C SvgSurfaceHandle CSvgJavaInterfaceImpl::SvgRenderingSurfaceCreate( TInt aWidth, TInt aHeight )
+{
+ // First create the frame buffer with aWidth and aHeight
+ TSize size(aWidth, aHeight);
+
+ // Can't use ELeave because this function can't leave
+ // Using ELeave but didn't handle (no trap or propagate to parents) causes more confusing.
+ // Check for NULL is good enough.
+ // Ignore CodeScanner error (Code Review Guide)
+ CFbsBitmap *lFrameBuffer = new CFbsBitmap();
+
+ // Has same effect as using ELeave
+ if ( !lFrameBuffer )
+ {
+ return NULL;
+ }
+
+ TInt lErrorCode = KErrNone;
+ TInt displayColors = 256*256;
+ HAL::Get( HALData::EDisplayColors, displayColors );
+ if ( displayColors == 256*256*256 )
+ {
+ lErrorCode = lFrameBuffer->Create( size, EColor16MU );
+ }
+ else
+ {
+ lErrorCode = lFrameBuffer->Create( size, EColor64K );
+ }
+
+ if(lErrorCode != KErrNone)
+ {
+ return NULL;
+ }
+
+ return (SvgSurfaceHandle) lFrameBuffer;
+
+}
+/**
+ * Destroy a Svg Rendering Surface.
+ */
+
+EXPORT_C void CSvgJavaInterfaceImpl::SvgRenderingSurfaceDestroy( SvgSurfaceHandle aSurface )
+{
+ if(aSurface)
+ {
+ delete (CFbsBitmap*)aSurface;
+ return;
+ }
+}
+/**
+ * Get a pointer to the Svg Rendering surface.
+ */
+
+EXPORT_C TUint* CSvgJavaInterfaceImpl::SvgRenderingSurfaceGetBuffer( SvgSurfaceHandle aSurface )
+{
+ return (TUint*)aSurface;
+}
+/**
+ * Get the width of the Svg Rendering Surface.
+ */
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgRenderingSurfaceGetWidth( SvgSurfaceHandle aSurface )
+{
+ if(aSurface)
+ {
+ return ((CFbsBitmap *)aSurface)->SizeInPixels().iWidth;
+ }
+ else
+ {
+ return 0;
+ }
+}
+/**
+ * Get the height of the Svg Rendering Surface
+ */
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgRenderingSurfaceGetHeight( SvgSurfaceHandle aSurface )
+{
+ if(aSurface)
+ {
+ return ((CFbsBitmap *)aSurface)->SizeInPixels().iHeight;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+// ***********************************************************************
+// SVG Document
+// ***********************************************************************
+
+/**
+ * Create an empty svg document.
+ */
+EXPORT_C SvgDocumentHandle CSvgJavaInterfaceImpl::SvgDocumentCreateEmpty()
+{
+ CSvgDocumentImpl *lSvgDoc = NULL;
+ TRAPD(error,lSvgDoc = SvgDocumentNewL());
+ if(error == KErrNone)
+ {
+ }
+
+ //sets up the root element
+ InitRootElement(lSvgDoc);
+
+ return ((SvgDocumentHandle)lSvgDoc);
+}
+
+/**
+ * Create a svg document by parsing the given STRING (not file).
+ */
+EXPORT_C SvgDocumentHandle CSvgJavaInterfaceImpl::SvgDocumentCreateL( const TPtrC16& aString )
+{
+ CSvgDocumentImpl *lSvgDoc = NULL;
+ TRAPD(error ,lSvgDoc = SvgDocumentNewL());
+ if(error != KErrNone)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("JavaInterfaceImpl: Document Failed to Create");
+ #endif
+
+ return NULL;
+ }
+
+ TRAPD( error2, FillDocumentL( lSvgDoc, aString ) );
+ if(error2 != KErrNone)
+ {
+ // error is set in iSvgError
+ }
+
+ if( iSvgError && iSvgError->HasError() )
+ {
+ if( lSvgDoc != NULL )
+ {
+ DestroyDocument(lSvgDoc);
+ lSvgDoc = NULL;
+ }
+
+ User::Leave( CJavaError::NewL( *iSvgError ) );
+ }
+
+ return ((SvgDocumentHandle)lSvgDoc);
+}
+
+/**
+ * Destroy the given svg document (by handle).
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgDocumentDestroy( SvgDocumentHandle aDocumentHandle )
+{
+ DestroyDocument( (CSvgDocumentImpl*)aDocumentHandle );
+}
+
+/**
+ * Svg Document RequestCompleted
+ */
+ // Returns the data from a resource handler to be attached to
+ // the elements with the corresponding uri
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgDocumentRequestCompleted( SvgDocumentHandle aDocument, const TPtrC16& aUri, const TPtrC8& aData)
+{
+ if ( aUri.Length() > 0 && aDocument != NULL)
+ {
+ AddExternalData((CSvgDocumentImpl*)aDocument, aUri, aData, ETrue, aData.Size());
+
+ return 1;
+ }
+ return 0;
+}
+
+/**
+ * Svg Document GetExternalListItem.
+ */
+ // Returns a character ptr to a URI for the element at (index) in
+ // the external elements list (any item that has a uri or image link)
+
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgDocumentGetExternalListItem(SvgDocumentHandle aDocumentHandle, TInt aIndex, TPtrC16& aItem)
+{
+ //returns the uri associated with the element(at index) that is requires an external resource
+
+ if (aIndex < GetExternalListSize( reinterpret_cast< CSvgDocumentImpl* >( aDocumentHandle ) ) )
+ {
+ TRAPD(error1, GetExternalListItemL(
+ ( reinterpret_cast< CSvgDocumentImpl* >( aDocumentHandle ) ), aIndex, aItem ));
+
+ return error1;
+ }
+
+ return KErrNotFound;
+}
+
+/**
+ * Svg Document get external list item.
+ */
+ // What is the purpose of this api
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgDocumentGetExternalListSize( SvgDocumentHandle aDocumentHandle )
+{
+ //the total number of external elements requested in the document i.e. the number of uris
+
+ return (GetExternalListSize((CSvgDocumentImpl*)aDocumentHandle));
+}
+
+/**
+ * Set Media time for the specified document.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgDocumentSetMediaTime( SvgDocumentHandle aDocumentHandle, TReal32 seconds ) __SOFTFP
+{
+ if(aDocumentHandle)
+ {
+ // this means that the current time for the document needs to be changed.
+ TUint32 lTimeInMilliSeconds = (TUint32)(seconds * 1000);
+ SvgSetMediaTime((CSvgDocumentImpl*)aDocumentHandle , lTimeInMilliSeconds);
+ }
+}
+
+/**
+ * Get Media time for the specified document.
+ */
+EXPORT_C TReal32 CSvgJavaInterfaceImpl::SvgDocumentGetMediaTime( SvgDocumentHandle aDocumentHandle ) __SOFTFP
+{
+ if(aDocumentHandle)
+ {
+ TReal32 ltime = SvgGetMediaTime((CSvgDocumentImpl*) aDocumentHandle );
+ // convert in to seconds.
+ if(ltime)
+ {
+ return (ltime / 1000);
+ }
+ // media time is 0
+ }
+ return 0;
+}
+
+/**
+ * Get the viewport width for the given document.
+ */
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgDocumentGetViewportWidth( SvgDocumentHandle aDocumentHandle)
+{
+ return ( aDocumentHandle) ? GetViewportWidth( (CSvgDocumentImpl*)aDocumentHandle ) : 0;
+}
+
+/**
+ * Get the viewport height for the given document.
+ */
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgDocumentGetViewportHeight( SvgDocumentHandle aDocumentHandle )
+{
+ return ( aDocumentHandle) ? GetViewportHeight( (CSvgDocumentImpl*)aDocumentHandle ) : 0;
+}
+
+/**
+ * Set the viewport width for the given document.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgDocumentSetViewportWidth( SvgDocumentHandle aDocumentHandle, TInt aWidth )
+{
+ if ( aDocumentHandle ) SetViewportWidth( (CSvgDocumentImpl*)aDocumentHandle, aWidth );
+}
+
+/**
+ * Set the viewport height for the given document.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgDocumentSetViewportHeight( SvgDocumentHandle aDocumentHandle, TInt aHeight )
+{
+ if ( aDocumentHandle ) SetViewportHeight( (CSvgDocumentImpl*)aDocumentHandle, aHeight );
+}
+
+EXPORT_C void CSvgJavaInterfaceImpl::SvgDocumentViewportInit( SvgDocumentHandle aDocumentHandle )
+{
+ if ( aDocumentHandle ) ViewportInit( (CSvgDocumentImpl*)aDocumentHandle );
+}
+
+/**
+ * Get the viewport width units for the given document.
+ */
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgDocumentGetViewportWidthUnits( SvgDocumentHandle aDocumentHandle )
+{
+ return ( aDocumentHandle ) ? GetViewportUnits( (CSvgDocumentImpl*)aDocumentHandle ) : 0;
+}
+
+/**
+ * Get the viewport height units for the given document.
+ */
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgDocumentGetViewportHeightUnits( SvgDocumentHandle aDocumentHandle)
+{
+ return ( aDocumentHandle) ? GetViewportUnits( (CSvgDocumentImpl*)aDocumentHandle ) : 0;
+}
+
+/**
+ * Get the root element for the given document.
+ */
+EXPORT_C SvgElementHandle CSvgJavaInterfaceImpl::SvgDocumentGetRootElement( SvgDocumentHandle aDocumentHandle )
+{
+ return (SvgElementHandle)GetRootElement( (CSvgDocumentImpl*)aDocumentHandle );
+}
+
+/**
+ * Get the svg element identified by the given id-string.
+ */
+EXPORT_C SvgElementHandle CSvgJavaInterfaceImpl::SvgDocumentGetElementById( SvgDocumentHandle aDocumentHandle, const TPtrC16& aID )
+{
+ if ( aID.Length() > 0 )
+ {
+ SvgElementHandle elementHandle =
+ (SvgElementHandle)GetElementById( (CSvgDocumentImpl*)aDocumentHandle, aID );
+
+ return elementHandle;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgDocumentGetNumberOfIds(SvgDocumentHandle aDocumentHandle )
+{
+ return GetNumberOfIds((CSvgDocumentImpl*)aDocumentHandle);
+}
+
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgDocumentGetId(SvgDocumentHandle aDocumentHandle, TInt index, TPtrC16& aId)
+{
+ TDesC* myId = GetId((CSvgDocumentImpl*)aDocumentHandle, (TInt)index);
+ if ( myId == NULL )
+ return NULL;
+
+ aId.Set( *myId );
+
+ return KErrNone;
+}
+
+/**
+ * Set the begin animation time for the given element.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgDocumentBeginElementAt( SvgDocumentHandle aDocumentHandle,
+ SvgElementHandle aElementHandle,
+ TReal32 aOffsetTime ) __SOFTFP
+{
+ if(aDocumentHandle)
+ {
+ if(aElementHandle)
+ {
+ // should their be any conversion between the time. ie possible
+ // multiplication. The below conversion is done thinking that the
+ // aOffsetTime value represents the time in seconds.
+ TUint32 lTime = (TUint32)(aOffsetTime * 1000);
+ SvgBeginElementAt( (CXmlElementImpl*)aElementHandle , lTime, (CSvgDocumentImpl*)aDocumentHandle );
+ }
+ }
+}
+/**
+ * Set the end animation time for the given element.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgDocumentEndElementAt( SvgDocumentHandle aDocumentHandle,
+ SvgElementHandle aElementHandle,
+ TReal32 aOffsetTime ) __SOFTFP
+{
+ if(aDocumentHandle)
+ {
+ if(aElementHandle)
+ {
+ // should their be any conversion between the time. ie possible
+ // multiplication. The below conversion is done thinking that the
+ // aOffsetTime value represents the time in seconds.
+ TUint32 lTime = (TUint32)(aOffsetTime * 1000);
+ SvgEndElementAt((CXmlElementImpl*)aElementHandle , lTime, (CSvgDocumentImpl*)aDocumentHandle );
+ }
+ }
+}
+
+/**
+ * Set the given element to have the focus.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgDocumentFocusOn( SvgDocumentHandle aDocumentHandle,
+ SvgElementHandle aElementHandle )
+ {
+ if(aDocumentHandle && aElementHandle)
+ {
+ SetFocusElement((CXmlElementImpl*)aElementHandle,(CSvgDocumentImpl*)aDocumentHandle);
+ DispatchFocusInEvent((CSvgDocumentImpl*)aDocumentHandle,(CSvgElementImpl *)aElementHandle);
+ }
+ }
+
+
+ /**
+ * Unset the focus from the given element passed as parameter.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgDocumentFocusOut( SvgDocumentHandle aDocumentHandle,
+ SvgElementHandle aElementHandle)
+ {
+ if(aDocumentHandle && aElementHandle)
+ {
+ DispatchFocusOutEvent((CSvgDocumentImpl*)aDocumentHandle,(CSvgElementImpl *)aElementHandle);
+ }
+ }
+
+/**
+ * Get the element having the focus.
+ */
+EXPORT_C SvgElementHandle CSvgJavaInterfaceImpl::SvgDocumentGetFocus( SvgDocumentHandle aDocumentHandle )
+{
+ if(aDocumentHandle)
+ {
+ return (SvgElementHandle)GetFocusedElement((CSvgDocumentImpl*)aDocumentHandle);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+/**
+ * Activate the element that has the focus.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgDocumentActivate( SvgDocumentHandle aDocumentHandle )
+{
+ if(aDocumentHandle)
+ {
+ SvgActivateAnimation((CSvgDocumentImpl*)aDocumentHandle);
+ }
+}
+
+/**
+ * Request a mouse event at the given coordinate.
+ */
+EXPORT_C SvgElementHandle CSvgJavaInterfaceImpl::SvgDocumentDispatchMouseEvent( SvgDocumentHandle aDocumentHandle,
+ TInt aMouseX, TInt aMouseY )
+{
+ if(aDocumentHandle)
+ {
+ // Dispatch of all mouse events.
+ return (DispatchMouseEventsAt((CSvgDocumentImpl*)aDocumentHandle, aMouseX, aMouseY, (MSvgMouseListener*)this));
+ }
+
+ return 0;
+}
+
+/**
+ * Check if document has animation.
+ */
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgDocumentHasAnimation( SvgDocumentHandle aDocumentHandle )
+{
+ if(aDocumentHandle)
+ {
+ TBool lValue = SvgHasAnimation((CSvgDocumentImpl*)aDocumentHandle);
+
+ if(lValue)
+ {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+/**
+ * Check if element has animation.
+ */
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgElementHasAnimation( SvgElementHandle aElementHandle )
+{
+ if(aElementHandle)
+ {
+ SvgElementHandle aFirstChildElement = SvgElementGetFirstElementChild(aElementHandle);
+
+ while (aFirstChildElement)
+ {
+ if ( IsAnimationElemId( GetElementType((CXmlElementImpl*)aFirstChildElement)) )
+ {
+ return 1;
+ }
+
+ aFirstChildElement = SvgElementGetNextElementSibling( aFirstChildElement );
+ }
+ }
+
+ return 0;
+}
+
+// ***********************************************************************
+// SVG Element
+// ***********************************************************************
+
+/**
+ * Create a new svg element of the given tag string and append to the given
+ * svg element parent.
+ */
+
+
+EXPORT_C SvgElementHandle CSvgJavaInterfaceImpl::SvgElementCreate( SvgAttrType aType )
+{
+ TInt lElementId = SvgGetElementTypeMappingJSRtoSVG(aType);
+
+ CXmlElementImpl* newChild = NULL;
+
+ TRAPD( error, newChild = CreateElementL( iTempDoc, lElementId ) );
+ if(error != KErrNone)
+ {
+ return 0;
+ }
+
+ //AppendChild( GetRootElement( iTempDoc ), newChild);
+ // Alan
+ TRAPD(err3, InitSvgStylePropertiesWithNullL((CSvgElementImpl*)newChild));
+ if ( err3 != KErrNone )
+ {
+ return NULL;
+ }
+
+ return (SvgElementHandle)newChild;
+}
+
+/**
+ * Destroy svg element of the given handle.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgElementDestroy( SvgElementHandle aElementHandle )
+{
+ if(aElementHandle )
+ {
+ CXmlElementImpl *lParentNode =
+ (CXmlElementImpl*)GetParentElement( (CXmlElementImpl*)aElementHandle );
+ if(lParentNode)
+ {
+ RemoveChild( (CXmlElementImpl*)lParentNode, (CXmlElementImpl*)aElementHandle );
+ }
+ DestroyElement( (CXmlElementImpl*)aElementHandle );
+ }
+}
+
+/**
+ * Get the parent element for the given svg element.
+ */
+EXPORT_C SvgElementHandle CSvgJavaInterfaceImpl::SvgElementGetParent( SvgElementHandle aElementHandle )
+{
+ return ( aElementHandle ) ? (SvgElementHandle)GetParentElement( (CXmlElementImpl*)aElementHandle ) : NULL;
+}
+/**
+ * Get the first child element for the given svg element.
+ */
+EXPORT_C SvgElementHandle CSvgJavaInterfaceImpl::SvgElementGetFirstElementChild( SvgElementHandle aElementHandle )
+{
+ return ( aElementHandle ) ? (SvgElementHandle)GetFirstChild( (CXmlElementImpl*)aElementHandle ) : NULL;
+}
+
+/**
+ * Get the next sibling element for the given svg element.
+ */
+EXPORT_C SvgElementHandle CSvgJavaInterfaceImpl::SvgElementGetNextElementSibling( SvgElementHandle aElementHandle )
+{
+ return ( aElementHandle ) ? (SvgElementHandle)GetNextSibling( (CXmlElementImpl*)aElementHandle ) : NULL;
+}
+
+/**
+ * Append the given child element to the given svg element.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgElementAppendChild( SvgElementHandle aElementHandle,
+ SvgElementHandle aChildElementHandle )
+{
+ if ( aElementHandle )
+ {
+ AppendChild( (CXmlElementImpl*)aElementHandle,
+ (CXmlElementImpl*)aChildElementHandle, ETrue );
+ }
+}
+/**
+ * Remove the given child element from the given svg element.
+ */
+EXPORT_C SvgElementHandle CSvgJavaInterfaceImpl::SvgElementRemoveChild( SvgElementHandle aElementHandle,
+ SvgElementHandle aChildElementHandle )
+{
+ if(aElementHandle)
+ {
+ RemoveChild( (CXmlElementImpl*)aElementHandle,
+ (CXmlElementImpl*)aChildElementHandle );
+ }
+ return aChildElementHandle;
+}
+/**
+ * Add the given child element to the given svg element, before
+ * the given reference element.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgElementInsertBefore( SvgElementHandle aElementHandle,
+ SvgElementHandle aChildElementHandle,
+ SvgElementHandle aReferenceElementHandle )
+{
+ if ( aReferenceElementHandle )
+ {
+ CXmlElementImpl* lTempChild = GetFirstChild( (CXmlElementImpl*)aElementHandle );
+
+ if (lTempChild == (CXmlElementImpl*)aReferenceElementHandle)
+ {
+ //the first child happens to be the reference child to insert before
+
+ //set the parent up for the new child
+ SetParentElement( (CXmlElementImpl*)aChildElementHandle,
+ (CXmlElementImpl*)aElementHandle );
+
+ SetFirstChildElement( (CXmlElementImpl*)aChildElementHandle,
+ (CXmlElementImpl*)aElementHandle );
+
+ //set the new child up in front of the reference sibling
+ SetNextSibling( (CXmlElementImpl*)aChildElementHandle, lTempChild );
+
+ return;
+ }
+
+ while ( lTempChild && GetNextSibling( lTempChild ) !=
+ (CXmlElementImpl*)aReferenceElementHandle )
+ {
+ lTempChild = GetNextSibling( lTempChild );
+ }
+ if ( lTempChild != NULL )
+ {
+ SetParentElement( (CXmlElementImpl*)aChildElementHandle,
+ (CXmlElementImpl*)aElementHandle );
+ SetNextSibling( lTempChild, (CXmlElementImpl*)aChildElementHandle );
+ SetNextSibling( (CXmlElementImpl*)aChildElementHandle,
+ (CXmlElementImpl*)aReferenceElementHandle );
+ }
+ }
+}
+
+/**
+ * Request element type.
+ */
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgElementGetType( SvgElementHandle aElementHandle )
+{
+ return ( !aElementHandle ) ? 0 :
+ SvgGetElementTypeMappingSVGtoJSR( GetElementType( (CXmlElementImpl*)aElementHandle ) );
+}
+
+/**
+ * Get a string attribute from the given element.
+ * returning 16 bit characters now instead of 8 bit ones that the original JSR used...
+ */
+
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgElementGetStringAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aAttributeName, TPtrC16& aStrAttribute )
+{
+ if(aElementHandle)
+ {
+ TInt lSvgAttrId =
+ SvgGetAttributeTypeMappingJSRtoSVG(aAttributeName);
+ if(lSvgAttrId != KSvgUnknownAttribute)
+ {
+ return ( GetElementDesAttribute( ( CSvgElementImpl* )aElementHandle, lSvgAttrId, aStrAttribute ) );
+ }
+ }
+ return KErrNotFound;
+}
+
+/**
+ * Set a string attribute on the given element.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgElementSetStringAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aAttributeName,
+ const TPtrC16& aAttributeValue )
+{
+
+if(aElementHandle)
+ {
+ TInt lSvgAttrId = SvgGetAttributeTypeMappingJSRtoSVG(aAttributeName);
+ if(lSvgAttrId != KSvgUnknownAttribute)
+ {
+ // This will not work with the animation elements.
+ SetElementDesAttribute((CSvgElementImpl*)aElementHandle,lSvgAttrId, aAttributeValue);
+ }
+ }
+return ;
+}
+
+/**
+ * Get a color attribute from the given element.
+ * The values are copied into the color object given.
+ */
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgElementGetColorAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aAttribute,
+ TInt* aRedValue, TInt* aGreenValue, TInt* aBlueValue )
+{
+ if(aElementHandle)
+ {
+ TInt lSvgAttrId = SvgGetAttributeTypeMappingJSRtoSVG(aAttribute);
+ // find if it is a valid attribute.
+ if(lSvgAttrId != KSvgUnknownAttribute)
+ {
+ TInt32 lColorValue;
+
+ // now the rgb values need to be fused. for this we take the
+ // least significant 8 bits of each integer.
+
+ lColorValue = GetElementColorAttribute((CSvgElementImpl*) aElementHandle,lSvgAttrId);
+
+ // extract the 8-bits corressponding to the specific color attribute.
+ // the color is in BGR format so
+
+ //KGfxColorNull == 0x1ffffff
+ if (lColorValue == 0x1ffffff)
+ {
+ *aBlueValue = -1; //Initialize BGR values
+ *aGreenValue = -1;
+ *aRedValue = -1;
+ }
+
+ //KSvgCurrentColor = 0x2ffffff
+ else if (lColorValue == 0x2ffffff)
+ {
+ *aBlueValue = 0; //Initialize BGR values
+ *aGreenValue = 0;
+ *aRedValue = 0;
+ }
+
+ //KErrNoAttribute
+ else if (lColorValue == -10 && (aAttribute == AT_FILL) )
+ {
+ *aBlueValue = 0;
+ *aGreenValue = 0;
+ *aRedValue = 0;
+ }
+ else if (lColorValue == -10 && (aAttribute == AT_STROKE) )
+ {
+ *aBlueValue = -1;
+ *aGreenValue = -1;
+ *aRedValue = -1;
+ }
+
+ else if (lColorValue == -10 && (aAttribute == AT_COLOR) )
+ {
+ *aBlueValue = 0;
+ *aGreenValue = 0;
+ *aRedValue = 0;
+ }
+ else if (lColorValue != KInvalidEnumAttribute)
+ {
+ *aRedValue = ( lColorValue >> 16 ) & 0x0000ff;
+ *aGreenValue = ( lColorValue >> 8 ) & 0x0000ff;
+ *aBlueValue = lColorValue & 0x0000ff;
+ }
+ return 0;
+ }
+ }
+ return -1;
+}
+
+/**
+ * Set a color attribute for the given element.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgElementSetColorAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aAttribute,
+ TInt aRedValue, TInt aGreenValue, TInt aBlueValue )
+
+{
+ if(aElementHandle)
+ {
+ TInt lSvgAttrId = SvgGetAttributeTypeMappingJSRtoSVG(aAttribute);
+ // find if it is a valid attribute.
+ if(lSvgAttrId != KSvgUnknownAttribute)
+ {
+ TInt32 lColorValue;
+
+ // now the rgb values need to be fused. for this we take the
+ // least significant 8 bits of each integer.
+
+ TInt32 red = aRedValue & 0x0000ff;
+ TInt32 green = aGreenValue & 0x0000ff;
+ TInt32 blue = aBlueValue & 0x0000ff;
+
+ lColorValue = (((red << 16) | green << 8) | blue);
+
+
+ SetElementColorAttribute((CSvgElementImpl*) aElementHandle,lSvgAttrId,lColorValue);
+ }
+ }
+}
+
+/**
+ * Get a float attribute value.
+ */
+EXPORT_C TReal32 CSvgJavaInterfaceImpl::SvgElementGetFloatAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aAttribute ) __SOFTFP
+
+{
+ if(aElementHandle)
+ {
+ TInt lSvgAttrId = SvgGetAttributeTypeMappingJSRtoSVG(aAttribute);
+ // The following function can not be called for the animation elements
+ if(lSvgAttrId != KSvgUnknownAttribute)
+ {
+ TReal32 lValue = GetElementFloatAttribute((CSvgElementImpl*)aElementHandle,lSvgAttrId);
+
+ return lValue;
+ }
+ }
+ return KInvalidFloatAttribute;
+}
+
+/**
+ * Set a float attribute value.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgElementSetFloatAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aAttribute,
+ TReal32 aFloatValue ) __SOFTFP
+{
+ if(aElementHandle)
+ {
+ TInt lSvgAttrId = SvgGetAttributeTypeMappingJSRtoSVG(aAttribute);
+ // The following function can not be called for the animation elements
+ if(lSvgAttrId != KSvgUnknownAttribute)
+ {
+ SetElementFloatAttribute((CSvgElementImpl*)aElementHandle,lSvgAttrId, aFloatValue);
+ }
+ }
+ return;
+}
+
+/**
+ * Set enum attribute value.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgElementSetEnumAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aAttribute, short aValue)
+{
+ /**********************************************************
+ // this function needs mapping of the enumeration values.
+ // preserve aspect ratio
+ // Zoom And Pan
+ // Paint ? is it fill or stroke.
+ // Fonts
+ // Font_Style
+ // Font_weight
+ // Font_stretch
+ // Text_Anchor
+ // Font_Size
+ // Fill_Rule
+ // Display
+ // Visibility
+ // Color-rendering // This is not supported in the SVGEngine.
+ // Strokes
+ // accumulate
+ // additive
+ // calc_mode
+ // fill
+ // restart
+ // type (animate Transform)
+ // attributeType
+ ********************************************************/
+ if(aElementHandle)
+ {
+ //TInt32 lValue = 0;
+
+ TInt lSvgAttrId = SvgGetAttributeTypeMappingJSRtoSVG(aAttribute);
+ if(lSvgAttrId != KSvgUnknownAttribute)
+ {
+ TInt lValue = SvgEnumerationMappingJSRtoSVG(lSvgAttrId , (TInt)aValue);
+ /*
+ lValue = SvgEnumerationMappingJSRtoSVG(lSvgAttrId , (TInt)aValue);
+
+ if ( lValue == KErrNotFound && aValue == ATTRIBUTE_INHERIT )
+ lValue = KSVGAttributeInherit;*/
+ if(lSvgAttrId == KCSS_ATTR_FONTSIZE)
+ {
+ if(lValue != KErrNotFound)
+ {
+ // font is internally considered to be a float.
+
+ SetElementFloatAttribute((CSvgElementImpl*)aElementHandle,lSvgAttrId, (TReal32)lValue);
+ return;
+ }
+ return;
+ }
+ if(lValue == KErrNotFound)
+ {
+ TBuf<40> lValueDes;
+ TInt lResult = SvgEnumerationtoStringMappingJSRtoSVG(lSvgAttrId , aValue ,lValueDes);
+ if(lResult == KErrNotFound)
+ {
+ // this is not valid Attribute.
+ return;
+ }
+ else
+ {
+ SetElementDesAttribute((CSvgElementImpl*)aElementHandle,lSvgAttrId,lValueDes );
+ return;
+ }
+ // Call for the string Attribute.
+ }
+ SetEnumAttribute((CSvgElementImpl*)aElementHandle,lSvgAttrId,lValue);
+ }
+ }
+}
+
+/**
+ * Get enum attribute value.
+ */
+EXPORT_C short CSvgJavaInterfaceImpl::SvgElementGetEnumAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aAttribute )
+{
+ if(aElementHandle)
+ {
+ TInt lSvgAttrId = SvgGetAttributeTypeMappingJSRtoSVG(aAttribute);
+ if(lSvgAttrId != KSvgUnknownAttribute)
+ {
+ // following swicth is for all the attributes for which constants
+ // are specified in Svgjsrconstants.h
+ TInt32 lValue = KErrNone;
+ if( lSvgAttrId == KCSS_ATTR_FILLRULE ||
+ lSvgAttrId == KCSS_ATTR_STROKE_LINECAP ||
+ lSvgAttrId == KCSS_ATTR_STROKE_LINEJOIN )
+ {
+ TPtrC16 lValue;
+ GetElementDesAttribute((CSvgElementImpl*)aElementHandle,lSvgAttrId,lValue);
+ TInt lResult = SvgStringtoEnumerationMappingSVGtoJSR(lSvgAttrId , lValue );
+ return ( short )lResult;
+ }
+ else
+ {
+ if(lSvgAttrId == KCSS_ATTR_FONTSIZE)
+ {
+ if(lValue != KErrNotFound)
+ {
+ // font is internally considered to be a float.
+ TReal32 lValue = GetElementFloatAttribute((CSvgElementImpl*)aElementHandle,lSvgAttrId);
+ return short (lValue) ;
+ }
+ return KInvalidEnumAttribute;
+ }
+ TInt lResult = GetEnumAttribute((CSvgElementImpl*)aElementHandle, lSvgAttrId , lValue);
+ if(lResult == KErrNotFound)
+ {
+ return KInvalidEnumAttribute;
+ }
+ else
+ {
+ TInt value = SvgEnumerationMappingSVGtoJSR(lSvgAttrId , lValue);
+ return (short) value;
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+/**
+ * Get the rectangle attribute value.
+ */
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgElementGetRectAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType /*aRectAttribute*/,
+ TReal32* aX, TReal32* aY, TReal32* aWidth, TReal32* aHeight ) __SOFTFP
+{
+ if ( aElementHandle )
+ {
+ if (!GetRectAttribute( (CXmlElementImpl*) aElementHandle, aX,
+ aY, aWidth, aHeight ))
+ {
+ return -1;
+ }
+
+ if ( aX != NULL )
+ {
+ return 1;
+ }
+ }
+ return -1;
+}
+
+/**
+ * Set the rectangle attribute value.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgElementSetRectAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType /*aRectAttribute*/,
+ TReal32 aX, TReal32 aY, TReal32 aWidth, TReal32 aHeight ) __SOFTFP
+{
+ if ( aElementHandle ) SetRectAttribute( (CXmlElementImpl*) aElementHandle, aX,
+ aY, aWidth, aHeight );
+}
+
+/**
+ * Get the matrix attribute value.
+ */
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgElementGetMatrixAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aMatrixAttribute,
+ TReal32* aAVal, TReal32* aBVal, TReal32* aCVal,
+ TReal32* aDVal, TReal32* aEVal, TReal32* aFVal ) __SOFTFP
+{
+ if ( aElementHandle == NULL )
+ {
+ return -1;
+ }
+
+ if( aMatrixAttribute == AT_TRANSFORM) // request to get transform for the element
+ {
+ aMatrixAttribute = SvgGetAttributeTypeMappingJSRtoSVG(aMatrixAttribute);
+ GetMatrixAttribute( (CXmlElementImpl*) aElementHandle, aMatrixAttribute, aAVal,
+ aBVal, aCVal, aDVal, aEVal, aFVal );
+ }
+ else // request for CTM
+ {
+ GetMatrixAttribute( (CXmlElementImpl*) aElementHandle, aAVal,
+ aBVal, aCVal, aDVal, aEVal, aFVal );
+ }
+
+
+ return 0;
+}
+
+/**
+ * Set the matrix attribute value.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgElementSetMatrixAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType /*aMatrixAttribute*/,
+ TReal32 aAVal, TReal32 aBVal, TReal32 aCVal,
+ TReal32 aDVal, TReal32 aEVal, TReal32 aFVal ) __SOFTFP
+{
+ if ( aElementHandle ) SetMatrixAttribute( (CXmlElementImpl*) aElementHandle, aAVal,
+ aBVal, aCVal, aDVal, aEVal, aFVal );
+}
+
+/**
+ * Get the path attribute value.
+ */
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgElementGetPathAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aPathAttribute )
+{
+ // The attributeId must be one of the following.
+ // KAtrD, KAtrTo, KAtrFrom, KAtrBy, KAtrPath
+ TInt lSvgAttrId = SvgGetAttributeTypeMappingJSRtoSVG(aPathAttribute);
+
+ return (TInt)GetPathAttribute((CXmlElementImpl*) aElementHandle, lSvgAttrId);
+}
+
+/**
+ * Get the bounding box rectangle attribute value.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgElementGetBBox( SvgElementHandle aElementHandle,
+ SvgAttrType /*aAttributeType*/,
+ TReal32* aX, TReal32* aY, TReal32* aWidth, TReal32* aHeight ) __SOFTFP
+{
+ if(aElementHandle)
+ {
+ TReal32 lX ,lY,lWidth,lHeight;
+ GetElementUnScaledBoundingBox((CSvgElementImpl*)aElementHandle,lX ,lY,lWidth,lHeight);
+ *aX = lX;
+ *aY = lY;
+ *aWidth = lWidth;
+ *aHeight = lHeight;
+ }
+}
+
+/**
+ * Add event listener to the given element.
+ * Note: need to replace void* with specific class
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgElementAddEventListener( SvgElementHandle aElementHandle,
+ TInt /*aListener*/, SvgAttrType /*aType*/ )
+{
+ if(aElementHandle)
+ {
+ // by default we have added the KEventExternalUI as the mask type.
+
+ // aListener how do you convert this to the SVGEngien's event Mask.
+ const TUint8 aEventMask = KSvgEventMaskExternalUI;
+ AddToEventReceiverList((CXmlElementImpl*) aElementHandle, aEventMask);
+ }
+}
+
+/**
+ * Remove event listener from the given element.
+ * Note: need to replace void* with specific class
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgElementRemoveEventListener( SvgElementHandle aElementHandle,
+ TInt /*aListener*/, SvgAttrType /*aType*/ )
+{
+ if(aElementHandle)
+ {
+ RemoveFromEventReceiverList((CXmlElementImpl*)aElementHandle);
+ }
+}
+
+/**
+ * Check if element is active.
+ */
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgElementIsActive( SvgElementHandle aElementHandle )
+{
+ CSvgElementImpl* hElement = (CSvgElementImpl*)aElementHandle;
+
+ return (IsElementActive( hElement ));
+}
+
+/**
+ * Check removable element.
+ * any element that doesnt have an id and its children dont have ids
+*/
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgElementCheckRemoveable( SvgElementHandle aElementHandle )
+{
+ CSvgElementImpl* hElement = (CSvgElementImpl*)aElementHandle;
+
+ return (IsRemoveable(hElement));
+}
+
+// ***********************************************************************
+// SVG Path
+// ***********************************************************************
+
+/**
+ * Create an empty path
+ */
+EXPORT_C SvgPathHandle CSvgJavaInterfaceImpl::SvgPathCreate()
+{
+ return (SvgPathHandle) SvgCreatePath();
+}
+
+/**
+ * Destroy the specified path path
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgPathDestroy( SvgPathHandle aPathHandle )
+{
+ if(aPathHandle)
+ {
+ SvgDestroyPath((CGfxGeneralPath*)aPathHandle);
+ }
+}
+
+/**
+ * Get the segment count for the given path.
+ */
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgPathGetSegmentCount( SvgPathHandle aPathHandle )
+{
+ if(aPathHandle)
+ {
+ return GetSegmentCount((CGfxGeneralPath*)aPathHandle);
+ }
+ return 0;
+}
+
+/**
+ * Get the segment type for the given path.
+ */
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgPathGetSegmentType(SvgPathHandle aPathHandle, TInt aSegmentIndex )
+{
+ if(aPathHandle)
+ {
+
+ TInt segmenttype = GetSegmentType((CGfxGeneralPath*)aPathHandle, aSegmentIndex + 1);
+ // map this to the corressponding segment type for the jsr.
+
+ return MapSegmentType(segmenttype );
+ }
+ return 0;
+}
+
+/**
+ * Get the segment parameter for the given path.
+ */
+EXPORT_C TReal32 CSvgJavaInterfaceImpl::SvgPathGetSegmentParameter( SvgPathHandle aPathHandle,
+ TInt aSegmentIndex,
+ TInt aSegmentParameterIndex ) __SOFTFP
+{
+ if(aPathHandle)
+ {
+ return (TReal32)GetSegmentParameter((CGfxGeneralPath*)aPathHandle,aSegmentIndex + 1,aSegmentParameterIndex + 1);
+ }
+ return 0;
+}
+
+ /**
+ * Add a move-to command to the given path.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgPathAddMoveTo( SvgPathHandle aPathHandle, TReal32 aX, TReal32 aY ) __SOFTFP
+{
+ if(aPathHandle)
+ {
+ ADDMoveTo((CGfxGeneralPath*)aPathHandle,aX,aY);
+ }
+}
+
+/**
+ * Add a line-to command to the given path.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgPathAddLineTo( SvgPathHandle aPathHandle, TReal32 aX, TReal32 aY ) __SOFTFP
+{
+ if(aPathHandle)
+ {
+ ADDLineTo((CGfxGeneralPath*)aPathHandle, aX, aY);
+ }
+}
+
+/**
+ * Add a quad-to command to the given path.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgPathAddQuadTo( SvgPathHandle aPathHandle,
+ TReal32 aX1, TReal32 aY1,
+ TReal32 aX2, TReal32 aY2) __SOFTFP
+{
+ if(aPathHandle)
+ {
+ ADDQuadTo((CGfxGeneralPath*)aPathHandle, aX1, aY1, aX2, aY2);
+ }
+}
+
+/**
+ * Add a curve-to command to the given path.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgPathAddCurveTo( SvgPathHandle aPathHandle,
+ TReal32 aX1, TReal32 aY1,
+ TReal32 aX2, TReal32 aY2,
+ TReal32 aX3, TReal32 aY3 ) __SOFTFP
+{
+ if(aPathHandle)
+ {
+ ADDCurveTo((CGfxGeneralPath*)aPathHandle, aX1, aY1, aX2, aY2, aX3, aY3);
+ }
+}
+
+/**
+ * Send a close-path command to the given path.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgPathAddClose( SvgPathHandle aPathHandle )
+{
+ ADDCloseTo((CGfxGeneralPath*)aPathHandle);
+}
+
+/**
+ * Update path info.
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgElementUpdatePath( SvgElementHandle aElementHandle, SvgPathHandle aPathHandle )
+{
+ //this element handle may not be necessary
+ CSvgElementImpl* myPathElement = (CSvgElementImpl*)aElementHandle;
+
+ UpdatePath(aPathHandle, myPathElement);
+}
+
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgElementElementInDOM ( TInt hDocument, TInt
+ hElement )
+{
+ if(hDocument && hElement)
+ {
+ TBool aresult= SVGElementInDom((CSvgDocumentImpl*)hDocument, (CXmlElementImpl*)hElement);
+
+ if(aresult)
+ {
+ return 1;
+ }
+ }
+
+return 0;
+}
+
+/*
+* This functions checks if the element is child of a useElement.
+*
+*/
+
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgElementIsUsed ( TInt hElement )
+{
+ if(hElement)
+ {
+ if( GetElementType( GetParentElement( (CXmlElementImpl*) hElement )) == KSvgUseElement)
+ {
+ return 1;
+ }
+ return 0;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+/*
+* This functions returns the pointer to the element which uses the current element.
+*
+*/
+EXPORT_C TInt CSvgJavaInterfaceImpl::SvgElementGetUsedFromElement ( TInt hElement )
+{
+ // this function gets the actual element which was cloned so that it can
+ // be used in a use element.
+ if(hElement)
+ {
+ // get the parent <use> elements xlink:href
+ return (int) SVGElementGetUsedElement((CXmlElementImpl*)hElement);
+ }
+ return 0;
+}
+/*
+* This functions returns the pointer to the element which uses the current element.
+*
+*/
+EXPORT_C void CSvgJavaInterfaceImpl::SvgElementGetScreenBBox( TInt aElementHandle, TReal32* x,
+ TReal32* y, TReal32* w, TReal32* h ) __SOFTFP
+ {
+ if(aElementHandle)
+ {
+ TReal32 lX ,lY,lWidth,lHeight;
+ GetElementBoundingbox((CSvgElementImpl*)aElementHandle,lX ,lY,lWidth,lHeight);
+ *x = lX;
+ *y = lY;
+ *w = lWidth;
+ *h = lHeight;
+ }
+ }
+
+EXPORT_C void CSvgJavaInterfaceImpl::SvgElementSetPathAttribute( SvgElementHandle aElementHandle,
+ SvgAttrType aPathAttribute , SvgPathHandle aPathHandle)
+{
+ if(aElementHandle)
+ {
+ if(aPathHandle)
+ {
+ TInt lSvgAttrId = SvgGetAttributeTypeMappingJSRtoSVG(aPathAttribute);
+ SetPathAttribute((CSvgElementImpl*)(CXmlElementImpl*)aElementHandle, lSvgAttrId, (CGfxGeneralPath*)aPathHandle);
+ }
+ }
+}
+
+TBool CSvgJavaInterfaceImpl::MouseEntered( RPointerArray<CSvgElementImpl>& /*aElements*/, TInt /*aX*/, TInt /*aY*/ )
+{
+ return ETrue;
+}
+
+TBool CSvgJavaInterfaceImpl::MouseExited( RPointerArray<CSvgElementImpl>& /*aElements*/, TInt /*aX*/, TInt /*aY*/ )
+{
+ return ETrue;
+}
+
+TBool CSvgJavaInterfaceImpl::MouseMoved( RPointerArray<CSvgElementImpl>& /*aElements*/, TInt /*aX*/, TInt /*aY*/ )
+{
+ return ETrue;
+}
+
+TBool CSvgJavaInterfaceImpl::MousePressed( RPointerArray<CSvgElementImpl>& /*aElements*/, TInt /*aX*/, TInt /*aY*/ )
+{
+ return ETrue;
+}
+
+TBool CSvgJavaInterfaceImpl::MouseReleased( RPointerArray<CSvgElementImpl>& /*aElements*/, TInt /*aX*/, TInt /*aY*/ )
+{
+ return ETrue;
+}
+
+/**
+* This maps the element ids form JSR specific to SVG specific
+*/
+TInt CSvgJavaInterfaceImpl::SvgGetElementTypeMappingJSRtoSVG( SvgAttrType aType )
+{
+
+switch(aType)
+ {
+ case 0: return KSvgAElement;
+
+ case 1: return KSvgAnimateElement;
+
+ case 2: return KSvgAnimateColorElement;
+
+ case 3: return KSvgAnimateMotionElement;
+
+ case 4: return KSvgAnimateTransformElement;
+
+ case 5: return KSvgCircleElement;
+
+ case 6: return KSvgDefsElement;
+
+ case 7: return KSvgDescElement;
+
+ case 8: return KSvgEllipseElement;
+
+ case 9: return KSvgFontElement;
+
+ case 10: return KSvgFontfaceElement;
+
+ case 11: return KSvgFontfacenameElement;
+
+ case 12: return KSvgFontfacesrcElement;
+
+ case 13: return KSvgForeignObjectElement;
+
+ case 14: return KSvgGElement;
+
+ case 15: return KSvgGlyphElement;
+
+ case 16: return KSvgHkernElement;
+
+ case 17: return KSvgImageElement;
+
+ case 18: return KSvgLineElement;
+
+ case 19: return KSvgMetadataElement;
+
+ case 20: return KSvgMissingglyphElement;
+
+ case 21: return KSvgMpathElement;
+
+ case 22: return KSvgPathElement;
+
+ case 23: return KSvgPolygonElement;
+
+ case 24: return KSvgPolylineElement;
+
+ case 25: return KSvgRectElement;
+
+ case 26: return KSvgSetElement;
+
+ case 27: return KSvgSvgElement;
+
+ case 28: return KSvgSwitchElement;
+
+ case 29: return KSvgTextElement;
+
+ case 30: return KSvgTitleElement;
+
+ case 31: return KSvgUseElement;
+
+ default: return KSvgUnknownElement;
+ }
+}
+
+/**
+* Tells if the element id is an animation or not.
+*/
+TBool CSvgJavaInterfaceImpl::IsAnimationElemId( const TInt aElementId )
+{
+ if ( aElementId == KSvgAnimateElement ||
+ aElementId == KSvgAnimateColorElement ||
+ aElementId == KSvgAnimateMotionElement ||
+ aElementId == KSvgAnimateTransformElement)
+ {
+ return ETrue;
+ }
+
+ return EFalse;
+}
+
+/**
+* This maps the element ids form SVG specific to JSR specific
+*/
+SvgAttrType CSvgJavaInterfaceImpl::SvgGetElementTypeMappingSVGtoJSR( const TInt aElementId)
+{
+ switch(aElementId)
+ {
+ case KSvgAElement: return 0;
+
+ case KSvgAnimateElement: return 1;
+
+ case KSvgAnimateColorElement: return 2;
+
+ case KSvgAnimateMotionElement: return 3;
+
+ case KSvgAnimateTransformElement: return 4;
+
+ case KSvgCircleElement: return 5;
+
+ case KSvgDefsElement: return 6;
+
+ case KSvgDescElement: return 7;
+
+ case KSvgEllipseElement: return 8;
+
+ case KSvgFontElement: return 9;
+
+ case KSvgFontfaceElement: return 10;
+
+ case KSvgFontfacenameElement: return 11;
+
+ case KSvgFontfacesrcElement: return 12;
+
+ case KSvgForeignObjectElement: return 13;
+
+ case KSvgGElement: return 14;
+
+ case KSvgGlyphElement: return 15;
+
+ case KSvgHkernElement: return 16;
+
+ case KSvgImageElement: return 17;
+
+ case KSvgLineElement: return 18;
+
+ case KSvgMetadataElement: return 19;
+
+ case KSvgMissingglyphElement: return 20;
+
+ case KSvgMpathElement: return 21;
+
+ case KSvgPathElement: return 22;
+
+ case KSvgPolygonElement: return 23;
+
+ case KSvgPolylineElement: return 24;
+
+ case KSvgRectElement: return 25;
+
+ case KSvgSetElement: return 26;
+
+ case KSvgSvgElement: return 27;
+
+ case KSvgSwitchElement: return 28;
+
+ case KSvgTextElement: return 29;
+
+ case KSvgTitleElement: return 30;
+
+ case KSvgUseElement: return 31;
+
+ default: return KSvgUnknownElement;
+ }
+}
+
+/**
+* This maps the Attribute ids form SVG specific to JSR specific
+*/
+
+SvgAttrType CSvgJavaInterfaceImpl::SvgGetAttributeTypeMappingSVGtoJSR( const TInt aElementId)
+{
+ switch(aElementId)
+ {
+ case KAtrAccumulate:return AT_ACCUMULATE;
+ case KAtrAdditive:return AT_ADDITIVE;
+ case KAtrAlphabetic:return AT_ALPHABETIC;
+ case KAtrAscent:return AT_ASCENT;
+ case KAtrAttributeName:return AT_ATTRIBUTENAME;
+ case KAtrBaseProfile:return AT_BASEPROFILE;
+ case KAtrBegin:return AT_BEGIN;
+ case KAtrBy:return AT_BY;
+ case KAtrCalcMode:return AT_CALCMODE;
+ case KCSS_ATTR_COLOR:return AT_COLOR;
+ case KCSS_ATTR_COLORRENDERING:return AT_COLORRENDERING;
+ case KAtrCx:return AT_CX;
+ case KAtrCy:return AT_CY;
+ case KAtrD:return AT_D;
+ case KAtrDescent:return AT_DESCENT ;
+ case KCSS_ATTR_DISPLAY:return AT_DISPLAY;
+ case KAtrDur:return AT_DUR;
+ case KAtrEnd:return AT_END;
+ case KCSS_ATTR_FILL:return AT_FILL;
+ case KCSS_ATTR_FILLRULE:return AT_FILLRULE;
+ case KCSS_ATTR_FONTFAMILY:return AT_FONTFAMILY;
+ case KCSS_ATTR_FONTSIZE:return AT_FONTSIZE;
+ case KCSS_ATTR_FONTSTYLE:return AT_FONTSTYLE;
+ case KCSS_ATTR_FONTWEIGHT:return AT_FONTWEIGHT;
+ case KAtrFrom:return AT_FROM;
+ case KAtrG1:return AT_G1;
+ case KAtrG2:return AT_G2;
+ case KAtrGlyphName:return AT_GLYPHNAME;
+ case KAtrHeight:return AT_HEIGHT;
+ case KAtrHorizAdvX:return AT_HORIZADVX;
+ case KAtrHorizOriginX:return AT_HORIZORIGINX;
+ case KAtrId:return AT_ID;
+ case KAtrK:return AT_K;
+ case KAtrKeySplines:return AT_KEYSPLINES;
+ case KAtrKeyTimes:return AT_KEYTIMES;
+ case KAtrLang:return AT_LANG;
+ case KAtrOverlinePosition:return AT_OVERLINEPOSITION;
+ case KAtrOverlineThickness:return AT_OVERLINETHICKNESS;
+ case KAtrPath:return AT_PATH;
+ case KAtrPathLength:return AT_PATHLENGTH;
+ case KAtrPoints:return AT_POINTS;
+ case KAtrPreserveAspectRatio:return AT_PRESERVEASPECTRATIO;
+ case KAtrR:return AT_R;
+ case KAtrRepeatCount:return AT_REPEATCOUNT;
+ case KAtrRepeatDur:return AT_REPEATDUR;
+ case KAtrRequiredExtensions:return AT_REQUIREDEXTENSIONS;
+ case KAtrRequiredFeatures:return AT_REQUIREDFEATURES;
+ case KAtrRestart:return AT_RESTART;
+ case KAtrRotate:return AT_ROTATE;
+ case KAtrRx :return AT_RX;
+ case KAtrRy:return AT_RY;
+ case KAtrStrikethroughPosition:return AT_STRIKETHROUGHPOSITION;
+ case KAtrStrikethroughThickness:return AT_STRIKETHROUGHTHICKNESS;
+ case KCSS_ATTR_STROKE:return AT_STROKE;
+ case KCSS_ATTR_STROKE_DASHARRAY:return AT_STROKEDASHARRAY;
+ case KCSS_ATTR_STROKE_DASHOFFSET:return AT_STROKEDASHOFFSET;
+ case KCSS_ATTR_STROKE_LINECAP:return AT_STROKELINECAP;
+ case KCSS_ATTR_STROKE_LINEJOIN:return AT_STROKELINEJOIN;
+ case KCSS_ATTR_STROKE_MITERLIMIT:return AT_STROKEMITERLIMIT;
+ case KCSS_ATTR_STROKEWIDTH:return AT_STROKEWIDTH;
+ case KAtrStyle:return AT_STYLE;
+ case KAtrCdata:return AT_STRING;
+ case KAtrSystemLanguage:return AT_SYSTEMLANGUAGE;
+ case KCSS_ATTR_TEXTANCHOR:return AT_TEXTANCHOR;
+ case KCSS_ATTR_TEXTDECORATION:return AT_TEXTDECORATION;
+ case KAtrTo:return AT_TO;
+ case KAtrTransform :return AT_TRANSFORM;
+ case KAtrType: return AT_TYPE;
+ case KAtrU1:return AT_U1;
+ case KAtrU2:return AT_U2;
+ case KAtrUnderlinePosition:return AT_UNDERLINEPOSITION;
+ case KAtrUnderlineThickness:return AT_UNDERLINETHICKNESS;
+ case KAtrUnicode:return AT_UNICODE;
+ case KAtrUnicodeRange:return AT_UNICODERANGE;
+ case KAtrUnitsPerEm:return AT_UNITSPEREM;
+ case KAtrValues:return AT_VALUES;
+ case KAtrVersion:return AT_VERSION;
+ case KAtrViewBox:return AT_VIEWBOX;
+ case KCSS_ATTR_VISIBILITY:return AT_VISIBILITY;
+ case KAtrWidth: return AT_WIDTH;
+ case KAtrX: return AT_X;
+ case KAtrX1:return AT_X1;
+ case KAtrX2:return AT_X2;
+ case KAtrXlinkactuate:return AT_XLINKACTUATE;
+ case KAtrXlinkarcrole:return AT_XLINKARCROLE;
+ case KAtrXlinkhref: return AT_XLINKHREF;
+ case KAtrXlinkrole: return AT_XLINKROLE;
+ case KAtrXlinkshow: return AT_XLINKSHOW;
+ case KAtrXlinktitle:return AT_XLINKTITLE;
+ case KAtrXlinktype:return AT_XLINKTYPE;
+ case KAtrXmlLang: return AT_XMLLANG;
+ case KAtrXmlBase: return AT_XMLBASE;
+ case KAtrXmlSpace:return AT_XMLSPACE;
+ case KAtrY: return AT_Y;
+ case KAtrY1:return AT_Y1;
+ case KAtrY2:return AT_Y2;
+ case KAtrZoomAndPan: return AT_ZOOMANDPAN;
+ default: return KSvgUnknownAttribute;
+ }
+}
+
+/**
+* This maps the Attribute ids form JSR specific to SVG specific
+*/
+TInt CSvgJavaInterfaceImpl::SvgGetAttributeTypeMappingJSRtoSVG( SvgAttrType aType )
+{
+ switch(aType)
+ {
+ case AT_ACCENTHEIGHT: return KSvgUnknownAttribute;
+
+ case AT_ACCUMULATE: return KAtrAccumulate;
+
+ case AT_ADDITIVE: return KAtrAdditive;
+
+ case AT_ALPHABETIC: return KAtrAlphabetic;
+
+ case AT_ARABICFORM: return KSvgUnknownAttribute;
+
+ case AT_ASCENT: return KAtrAscent;
+
+ case AT_ATTRIBUTENAME: return KAtrAttributeName;
+
+ case AT_ATTRIBUTETYPE: return KSvgUnknownAttribute;
+
+ case AT_BASEPROFILE: return KAtrBaseProfile;
+
+ case AT_BBOX: return KSvgUnknownAttribute;
+
+ case AT_BEGIN: return KAtrBegin;
+
+ case AT_BY: return KAtrBy;
+
+ case AT_CALCMODE: return KAtrCalcMode;
+
+ case AT_CAPHEIGHT: return KSvgUnknownAttribute;
+
+ case AT_COLOR: return KCSS_ATTR_COLOR;
+
+ case AT_COLORRENDERING: return KCSS_ATTR_COLORRENDERING;
+
+ case AT_CX: return KAtrCx;
+
+ case AT_CY: return KAtrCy;
+
+ case AT_D: return KAtrD;
+
+ case AT_DESCENT: return KAtrDescent;
+
+ case AT_DISPLAY: return KCSS_ATTR_DISPLAY;
+
+ case AT_DUR: return KAtrDur;
+
+ case AT_END: return KAtrEnd;
+
+ // it can be the fill corressponding to animation how to handle that.
+ case AT_FILL: return KCSS_ATTR_FILL;
+
+ case AT_FILLRULE: return KCSS_ATTR_FILLRULE;
+
+ case AT_FONTFAMILY: return KCSS_ATTR_FONTFAMILY;
+
+ case AT_FONTSIZE: return KCSS_ATTR_FONTSIZE;
+
+ case AT_FONTSTRETCH: return KSvgUnknownAttribute;
+
+ case AT_FONTSTYLE: return KCSS_ATTR_FONTSTYLE;
+
+ case AT_FONTVARIANT: return KSvgUnknownAttribute;
+
+ case AT_FONTWEIGHT: return KCSS_ATTR_FONTWEIGHT;
+
+ case AT_FROM: return KAtrFrom;
+
+ case AT_G1: return KAtrG1;
+
+ case AT_G2: return KAtrG2;
+
+ case AT_GLYPHNAME: return KAtrGlyphName;
+
+ case AT_HANGING: return KSvgUnknownAttribute;
+
+ case AT_HEIGHT: return KAtrHeight;
+
+ case AT_HORIZADVX: return KAtrHorizAdvX;
+
+ case AT_HORIZORIGINX: return KAtrHorizOriginX;
+
+ case AT_ID: return KAtrId;
+
+ case AT_IDEOGRAPHIC: return KSvgUnknownAttribute;
+
+ case AT_K: return KAtrK;
+
+ case AT_KEYPOINTS: return KSvgUnknownAttribute;
+
+ case AT_KEYSPLINES: return KAtrKeySplines;
+
+ case AT_KEYTIMES: return KAtrKeyTimes;
+
+ case AT_LANG: return KAtrLang;
+
+ case AT_MATHEMATICAL: return KSvgUnknownAttribute;
+
+ case AT_MAX: return KSvgUnknownAttribute;
+
+ case AT_MIN: return KSvgUnknownAttribute;
+
+ case AT_NAME: return KSvgUnknownAttribute;
+
+ case AT_ORIGIN: return KSvgUnknownAttribute;
+
+ case AT_OVERLINEPOSITION: return KAtrOverlinePosition;
+
+ case AT_OVERLINETHICKNESS: return KAtrOverlineThickness;
+
+ case AT_PANOSE1: return KSvgUnknownAttribute;
+
+ case AT_PATH: return KAtrPath;
+
+ case AT_PATHLENGTH: return KAtrPathLength;
+
+ case AT_POINTS: return KAtrPoints;
+
+ case AT_PRESERVEASPECTRATIO: return KAtrPreserveAspectRatio;
+
+ case AT_R: return KAtrR;
+
+ case AT_REPEATCOUNT: return KAtrRepeatCount;
+
+ case AT_REPEATDUR:return KAtrRepeatDur;
+
+ case AT_REQUIREDEXTENSIONS: return KAtrRequiredExtensions;
+
+ case AT_REQUIREDFEATURES: return KAtrRequiredFeatures;
+
+ case AT_RESTART: return KAtrRestart;
+
+ case AT_ROTATE: return KAtrRotate;
+
+ case AT_RX: return KAtrRx;
+
+ case AT_RY: return KAtrRy;
+
+ case AT_SLOPE: return KSvgUnknownAttribute;
+
+ case AT_STEMH: return KSvgUnknownAttribute;
+
+ case AT_STEMV: return KSvgUnknownAttribute;
+
+ case AT_STRIKETHROUGHPOSITION: return KAtrStrikethroughPosition;
+
+ case AT_STRIKETHROUGHTHICKNESS: return KAtrStrikethroughThickness;
+
+ case AT_STROKE: return KCSS_ATTR_STROKE;
+
+ case AT_STROKEDASHARRAY: return KCSS_ATTR_STROKE_DASHARRAY;
+
+ case AT_STROKEDASHOFFSET: return KCSS_ATTR_STROKE_DASHOFFSET;
+
+ case AT_STROKELINECAP: return KCSS_ATTR_STROKE_LINECAP;
+
+ case AT_STROKELINEJOIN: return KCSS_ATTR_STROKE_LINEJOIN;
+
+ case AT_STROKEMITERLIMIT: return KCSS_ATTR_STROKE_MITERLIMIT;
+
+ case AT_STROKEWIDTH: return KCSS_ATTR_STROKEWIDTH;
+
+ case AT_STYLE: return KAtrStyle;
+
+ case AT_STRING: return KAtrCdata;
+
+ case AT_SYSTEMLANGUAGE: return KAtrSystemLanguage;
+
+ case AT_TARGET: return KAtrTarget;
+
+ case AT_TEXTANCHOR: return KCSS_ATTR_TEXTANCHOR;
+ case AT_TEXTDECORATION: return KCSS_ATTR_TEXTDECORATION;
+ case AT_TO: return KAtrTo;
+
+ case AT_TRANSFORM: return KAtrTransform;
+
+ case AT_TYPE: return KAtrType;
+
+ case AT_U1: return KAtrU1;
+
+ case AT_U2: return KAtrU2;
+
+ case AT_UNDERLINEPOSITION: return KAtrUnderlinePosition;
+
+ case AT_UNDERLINETHICKNESS: return KAtrUnderlineThickness;
+
+ case AT_UNICODE: return KAtrUnicode;
+
+ case AT_UNICODERANGE:return KAtrUnicodeRange;
+
+ case AT_UNITSPEREM: return KAtrUnitsPerEm;
+
+ case AT_VALUES: return KAtrValues;
+
+ case AT_VERSION: return KAtrVersion;
+
+ case AT_VIEWBOX: return KAtrViewBox;
+
+ case AT_VISIBILITY: return KCSS_ATTR_VISIBILITY;
+
+ case AT_WIDTH: return KAtrWidth;
+
+ case AT_WIDTHS: return KSvgUnknownAttribute;
+
+ case AT_X: return KAtrX;
+
+ case AT_XHEIGHT: return KSvgUnknownAttribute;
+
+ case AT_X1: return KAtrX1;
+
+ case AT_X2:return KAtrX2;
+
+ case AT_XLINKACTUATE: return KAtrXlinkactuate;
+
+ case AT_XLINKARCROLE: return KAtrXlinkarcrole;
+
+ case AT_XLINKHREF: return KAtrXlinkhref;
+
+ case AT_XLINKROLE: return KAtrXlinkrole;
+
+ case AT_XLINKSHOW: return KAtrXlinkshow;
+
+ case AT_XLINKTITLE: return KAtrXlinktitle;
+
+ case AT_XLINKTYPE: return KAtrXlinktype;
+
+ case AT_XMLLANG: return KAtrXmlLang;
+
+ case AT_XMLBASE: return KAtrXmlBase;
+
+ case AT_XMLSPACE: return KAtrXmlSpace;
+
+ case AT_Y: return KAtrY;
+
+ case AT_Y1: return KAtrY1;
+
+ case AT_Y2: return KAtrY2;
+
+ case AT_ZOOMANDPAN: return KAtrZoomAndPan;
+
+ default: return KSvgUnknownAttribute;
+ }
+}
+/**
+* This maps the Enumeration Mapping form JSR specific to SVG specific
+*/
+TInt CSvgJavaInterfaceImpl::SvgEnumerationMappingJSRtoSVG(const TInt aAttributeId, const TInt aJsrEnumValue)
+{
+ // Most of these are style properties.
+ // COLOR_Rendering. this is not supported.
+ switch(aAttributeId)
+ {
+ // Text Anchor
+ case KAtrRotate:
+ {
+ switch(aJsrEnumValue)
+ {
+ // these are defined in animateMotion.cpp
+ case ROTATE_AUTO: return -100;
+ case ROTATE_AUTOREVERSE: return -200;
+ default:
+ return KErrNotFound;
+ }
+ }
+
+ case KAtrType:
+ {
+ switch(aJsrEnumValue)
+ {
+ // these are defined in SchemaData.cpp
+ case TYPE_TRANSLATE: return KSvgTypeTranslate;
+ case TYPE_SCALE: return KSvgTypeScale;
+ case TYPE_ROTATE:return KSvgTypeRotate;
+ case TYPE_SKEWX:return KSvgTypeSkewX;
+ case TYPE_SKEWY: return KSvgTypeSkewY;
+ default:
+ return KErrNotFound;
+ }
+ }
+
+ case KCSS_ATTR_FONTSIZE:
+ {
+ switch(aJsrEnumValue)
+ {
+ case FONT_SIZE_XXSMALL: return 2;
+ case FONT_SIZE_XSMALL: return 4;
+ case FONT_SIZE_SMALL:return 6;
+ case FONT_SIZE_MEDIUM:return 10;
+ case FONT_SIZE_LARGE: return 16;
+ case FONT_SIZE_XLARGE:return 20;
+ case FONT_SIZE_XXLARGE:return 24;
+ default:
+ return KErrNotFound;
+ }
+ }
+
+ case KCSS_ATTR_TEXTANCHOR:
+ {
+ switch(aJsrEnumValue)
+ {
+ case TEXT_ANCHOR_START:
+ // these constants are taken from schemaData.cpp any change will need
+ // to be propagated to here
+ return 0;
+ case TEXT_ANCHOR_MIDDLE:
+ return 1;
+ case TEXT_ANCHOR_END:
+ return 2;
+ default:
+ return KErrNotFound;
+ }
+
+ }
+ // Font Weight
+ case KCSS_ATTR_FONTWEIGHT:
+ {
+ switch(aJsrEnumValue)
+ {
+ case FONT_NORMAL:
+ return 0;
+ case FONT_WEIGHT_BOLD:
+ return 1;
+ case FONT_WEIGHT_BOLDER:
+ return 2;
+ case FONT_WEIGHT_LIGHTER:
+ return 3;
+ case FONT_WEIGHT_100:
+ return 4;
+ case FONT_WEIGHT_200:
+ return 5;
+ case FONT_WEIGHT_300:
+ return 6;
+ case FONT_WEIGHT_400:
+ return 7;
+ case FONT_WEIGHT_500:
+ return 8;
+ case FONT_WEIGHT_600:
+ return 9;
+ case FONT_WEIGHT_700:
+ return 10;
+ case FONT_WEIGHT_800:
+ return 11;
+ case FONT_WEIGHT_900:
+ return 12;
+ default:
+ return KErrNotFound;
+ }
+
+ }
+ // Font Style
+ case KCSS_ATTR_FONTSTYLE:
+ {
+ switch(aJsrEnumValue)
+ {
+ case FONT_NORMAL:
+ return 0;
+ case FONT_STYLE_ITALIC :
+ return 1;
+ case FONT_STYLE_OBLIQUE :
+ return 2;
+ default:
+ return KErrNotFound;
+ }
+
+ }
+ // Spread Method not given in defines.h so probably spreadmethod won't be used.
+ case KAtrPreserveAspectRatio:
+
+ {
+ switch(aJsrEnumValue)
+ {
+ case PAR_NONE:
+ return 0;
+ case PAR_XMIDYMID:
+ return 6;
+ default:
+ return KErrNotFound;
+
+ }
+
+ }
+ // TextDecoration
+ case KAtrZoomAndPan:
+ {
+ switch(aJsrEnumValue)
+ {
+ case ZPN_MAGNIFY:
+ return 1;
+
+ case ZPN_DISABLE:
+ return 0;
+ default:
+ return KErrNotFound;
+ }
+
+ }
+ // Display
+ case KCSS_ATTR_DISPLAY:
+ {
+ switch(aJsrEnumValue)
+ {
+ case DISPLAY_NONE:
+ return 16;
+
+ case DISPLAY_OTHER:
+ return 0;
+
+ default:
+ return KErrNotFound;
+
+ }
+
+ }
+ // VIsibility
+ case KCSS_ATTR_VISIBILITY:
+ {
+ switch(aJsrEnumValue)
+ {
+ case VISIBILITY_VISIBLE:
+ return 0;
+ case VISIBILITY_OTHER:
+ return 1;
+ default:
+ return KErrNotFound;
+
+ }
+
+ }
+ case KAtrAdditive:
+ {
+ switch(aJsrEnumValue)
+ {
+ case ADDITIVE_REPLACE:
+ return 0;
+ case ADDITIVE_SUM:
+ return 1;
+ default : return KErrNotFound;
+
+ }
+
+ }
+ case KAtrAccumulate:
+ {
+ switch(aJsrEnumValue)
+ {
+ case ACCUMULATE_NONE:
+ return 0;
+ case ACCUMULATE_SUM:
+ return 1;
+ default : return KErrNotFound;
+
+ }
+
+ }
+ case KAtrCalcMode:
+ {
+ switch(aJsrEnumValue)
+ {
+ case CALC_MODE_DISCRETE:
+ return 0;
+ case CALC_MODE_LINEAR:
+ return 1;
+ case CALC_MODE_PACED:
+ return 2;
+ case CALC_MODE_SPLINE:
+ return 3;
+ default: return KErrNotFound;
+
+ }
+
+ }
+ // it can not be this attribute.
+ // This fill corresponds to animation.
+ case KCSS_ATTR_FILL:
+ {
+ switch(aJsrEnumValue)
+ {
+ // these are for animation
+ case FILL_REMOVE:
+ return 0;
+ case FILL_FREEZE:
+ return 1;
+ // following is the attribute value for fill "color"
+ // these are for fill - style attributes.
+ case PAINT_NONE:
+ return KSVGColorNone;
+ case PAINT_CURRENT:
+ return KSVGCurrentColor;
+ case PAINT_INHERIT:
+ return KSVGColorInherit;
+ default: return KErrNotFound;
+ }
+
+ }
+ case KCSS_ATTR_STROKE:
+ {
+ switch(aJsrEnumValue)
+ {
+ // following is the attribute value for fill "color"
+ // these are for fill - style attributes.
+ case PAINT_NONE:
+ return KSVGColorNone;
+ case PAINT_CURRENT:
+ return KSVGCurrentColor;
+ case PAINT_INHERIT:
+ return KSVGColorInherit;
+ default: return KErrNotFound;
+ }
+
+ }
+ case KAtrRestart:
+ {
+ switch(aJsrEnumValue)
+ {
+ case RESTART_ALWAYS:
+ return 0;
+ case RESTART_NEVER:
+ return 2;
+ case RESTART_WHENNOTACTIVE:
+ return 1;
+ default :
+ return KErrNotFound;
+ }
+
+ }
+ case KCSS_ATTR_TEXTDECORATION:
+ {
+ switch(aJsrEnumValue)
+ {
+ case TEXT_UNDER_LINE:
+ return 1;
+ case TEXT_OVER_LINE:
+ return 2;
+ case TEXT_LINE_THROUGH:
+ return 3;
+ default:
+ return KErrNotFound;
+ }
+
+ }
+ default:
+ return KErrNotFound;
+
+ }
+}
+
+/**
+* This maps the Enumeration from JSR to SVG. SVG enumerated value here is string type.
+*/
+TInt CSvgJavaInterfaceImpl::SvgEnumerationtoStringMappingJSRtoSVG(const TInt aAttributeId, short aJsrEnumValue, TDes& aValue)
+{
+ // all of these are style properties.
+ switch(aAttributeId)
+ {
+ case KCSS_ATTR_FILLRULE:
+ switch(aJsrEnumValue)
+ {
+ case FILL_RULE_EVENODD:
+ {
+ aValue = _L("evenodd");
+ }
+ break;
+ case FILL_RULE_NONZERO:
+ {
+ aValue = _L("nonzero");
+ }
+ break;
+ default:
+ return KErrNotFound;
+
+ }
+ break;
+ case KCSS_ATTR_STROKE_LINECAP:
+ switch(aJsrEnumValue)
+ {
+ case STROKE_LINECAP_BUTT:
+ {
+ aValue = _L("butt");
+ }
+ break;
+ case STROKE_LINECAP_ROUND:
+ {
+ aValue = _L("round");
+ }
+ break;
+ case STROKE_LINECAP_SQUARE:
+ {
+ aValue = _L("square");
+ }
+ break;
+ default : return KErrNotFound;
+ }
+ break;
+ case KCSS_ATTR_STROKE_LINEJOIN:
+ switch(aJsrEnumValue)
+ {
+ case STROKE_LINEJOIN_MITER:
+ {
+ aValue = _L("miter");
+ }
+ break;
+ case STROKE_LINEJOIN_ROUND:
+ {
+ aValue = _L("round");
+ }
+ break;
+ case STROKE_LINEJOIN_BEVEL:
+ {
+ aValue = _L("bevel");
+ }
+ break;
+ default : return KErrNotFound;
+ }
+ break;
+ default: return KErrNotFound;
+
+ }
+ return KErrNone;
+}
+/**
+* This maps the Enumeration from SVG to JSR. SVG enumerated value here is string type.
+*/
+TInt CSvgJavaInterfaceImpl::SvgStringtoEnumerationMappingSVGtoJSR(const TInt aAttributeId , TPtrC16 aValue)
+{
+ switch(aAttributeId)
+ {
+ case KCSS_ATTR_FILLRULE:
+ {
+ if(aValue == _L("evenodd"))
+ return FILL_RULE_EVENODD;
+ if(aValue == _L("nonzero"))
+ return FILL_RULE_NONZERO;
+ }
+ case KCSS_ATTR_STROKE_LINECAP:
+ {
+ if(aValue == _L("butt"))
+ return STROKE_LINECAP_BUTT;
+ if(aValue == _L("round"))
+ return STROKE_LINECAP_ROUND;
+ if(aValue == _L("square"))
+ return STROKE_LINECAP_SQUARE;
+ }
+
+ case KCSS_ATTR_STROKE_LINEJOIN:
+
+ {
+ if(aValue == _L("miter"))
+ return STROKE_LINEJOIN_MITER;
+ if(aValue == _L("round"))
+ return STROKE_LINEJOIN_ROUND;
+ if(aValue == _L("bevel"))
+ return STROKE_LINEJOIN_BEVEL;
+ }
+ default: return KErrNotFound;
+ }
+}
+/**
+* This maps the Enumeration from SVG to JSR.
+*/
+TInt CSvgJavaInterfaceImpl::SvgEnumerationMappingSVGtoJSR(const TInt aAttributeId, TInt32 aSvgEnumValue)
+{
+ switch(aAttributeId)
+ {
+
+ case KAtrRotate:
+ {
+ switch(aSvgEnumValue)
+ {
+ case -100: return ROTATE_AUTO;
+ case -200: return ROTATE_AUTOREVERSE;
+ default:
+ return KErrNotFound;
+ }
+ }
+
+ case KAtrType:
+ {
+ switch(aSvgEnumValue)
+ {
+ case KSvgTypeTranslate: return TYPE_TRANSLATE;
+ case KSvgTypeScale: return TYPE_SCALE;
+ case KSvgTypeRotate:return TYPE_ROTATE;
+ case KSvgTypeSkewX:return TYPE_SKEWX;
+ case KSvgTypeSkewY: return TYPE_SKEWY;
+ default:
+ return KErrNotFound;
+ }
+ }
+
+ case KCSS_ATTR_TEXTANCHOR:
+ {
+ switch(aSvgEnumValue)
+ {
+ case 0:
+ // these constants are taken from schemaData.cpp any change will need
+ // to be propagated to here
+ return TEXT_ANCHOR_START;
+ case 1:
+ return TEXT_ANCHOR_MIDDLE;
+ case 2:
+ return TEXT_ANCHOR_END;
+ default:
+ return KErrNotFound;
+ }
+
+ }
+ // Font Weight
+ case KCSS_ATTR_FONTWEIGHT:
+ {
+ switch(aSvgEnumValue)
+ {
+ case 0:
+ return FONT_NORMAL;
+ case 1:
+ return FONT_WEIGHT_BOLD;
+ case 2:
+ return FONT_WEIGHT_BOLDER;
+ case 3:
+ return FONT_WEIGHT_LIGHTER;
+ case 4:
+ return FONT_WEIGHT_100;
+ case 5:
+ return FONT_WEIGHT_200;
+ case 6:
+ return FONT_WEIGHT_300;
+ case 7:
+ return FONT_WEIGHT_400;
+ case 8:
+ return FONT_WEIGHT_500;
+ case 9:
+ return FONT_WEIGHT_600;
+ case 10:
+ return FONT_WEIGHT_700;
+ case 11:
+ return FONT_WEIGHT_800;
+ case 12:
+ return FONT_WEIGHT_900;
+ default:
+ return KErrNotFound;
+ }
+
+ }
+ // Font Style
+ case KCSS_ATTR_FONTSTYLE:
+ {
+ switch(aSvgEnumValue)
+ {
+ case 0:
+ return FONT_NORMAL;
+ case 1:
+ return FONT_STYLE_ITALIC;
+ case 2:
+ return FONT_STYLE_OBLIQUE ;
+ default:
+ return KErrNotFound;
+ }
+
+ }
+ // preserve aspect ratio
+ case KAtrPreserveAspectRatio:
+
+ {
+ switch(aSvgEnumValue)
+ {
+ case 0:
+ return PAR_NONE;
+ case 6:
+ return PAR_XMIDYMID;
+ }
+
+ }
+ // Zoom and Pan
+ case KAtrZoomAndPan:
+ {
+ switch(aSvgEnumValue)
+ {
+ case 1:
+ return ZPN_MAGNIFY;
+
+ case 0:
+ return ZPN_DISABLE;
+ }
+
+ }
+ // Display
+ case KCSS_ATTR_DISPLAY:
+ {
+ switch(aSvgEnumValue)
+ {
+ case 16:
+ return DISPLAY_NONE;
+
+ case 0:
+ return DISPLAY_OTHER;
+
+ default:
+ return KErrNotFound;
+
+ }
+
+ }
+ // VIsibility
+ case KCSS_ATTR_VISIBILITY:
+ {
+ switch(aSvgEnumValue)
+ {
+ case 0:
+ return VISIBILITY_VISIBLE;
+ case 1:
+ return VISIBILITY_OTHER;
+ default:
+ return KErrNotFound;
+
+ }
+
+ }
+ // additive
+ case KAtrAdditive:
+ {
+ switch(aSvgEnumValue)
+ {
+ case 1:
+ return ADDITIVE_SUM;
+ default : return ADDITIVE_REPLACE;
+
+ }
+
+ }
+ // accumulate
+ case KAtrAccumulate:
+ {
+ switch(aSvgEnumValue)
+ {
+ case 0:
+ return ACCUMULATE_NONE;
+ case 1:
+ return ACCUMULATE_SUM;
+ default : return KErrNotFound;
+
+ }
+
+ }
+ // calc-mode
+ case KAtrCalcMode:
+ {
+ switch(aSvgEnumValue)
+ {
+ case 0:
+ return CALC_MODE_DISCRETE;
+ case 1:
+ return CALC_MODE_LINEAR;
+ case 2:
+ return CALC_MODE_PACED;
+ case 3:
+ return CALC_MODE_SPLINE;
+ default: return KErrNotFound;
+
+ }
+
+ }
+ // it can not be this attribute.
+ // This fill corresponds to animation.
+ // fill attribute
+ case KCSS_ATTR_FILL:
+ {
+ switch(aSvgEnumValue)
+ {
+ case 0:
+ return FILL_REMOVE;
+ case 1:
+ return FILL_FREEZE;
+ default: return KErrNotFound;
+ }
+
+ }
+ // restart attribute.
+ case KAtrRestart:
+ {
+ switch(aSvgEnumValue)
+ {
+ case 0:
+ return RESTART_ALWAYS;
+ case 2:
+ return RESTART_NEVER;
+ case 1:
+ return RESTART_WHENNOTACTIVE;
+ default :
+ return KErrNotFound;
+ }
+
+ }
+ // text decoration.
+ case KCSS_ATTR_TEXTDECORATION:
+ {
+ switch(aSvgEnumValue)
+ {
+ case 1:
+ return TEXT_UNDER_LINE;
+ case 2:
+ return TEXT_OVER_LINE;
+ case 3:
+ return TEXT_LINE_THROUGH;
+ default:
+ return KErrNotFound;
+ }
+
+ }
+ default:
+ return KErrNotFound;
+
+ }
+}
+
+/*
+* This functions checks if an element is in a specified document.
+*
+*/
+
+TInt CSvgJavaInterfaceImpl::MapSegmentType(TInt aSvgSegmentType)
+{
+ // the following is a limitation since in GFx2d.dll we do not store the
+ // relative or absolute nature of a command.
+ // currently we return the absolute.
+
+ switch(aSvgSegmentType)
+ {
+ case KSvgSegClose:
+ {
+ return PATH_COMMAND_Z;
+ }
+ case KSvgSegLineTo:
+ {
+ return PATH_COMMAND_L;
+ }
+ case KSvgSegQuadTo:
+ {
+ return PATH_COMMAND_Q;
+ }
+ case KSvgSegCubicTo:
+ {
+ return PATH_COMMAND_C;
+ }
+ case KSvgSegMoveTo:
+ {
+ return PATH_COMMAND_M;
+ }
+ case KSvgVertical:
+ {
+ return PATH_COMMAND_V;
+ }
+ case KSvgHorizontal:
+ {
+ return PATH_COMMAND_H;
+ }
+ default :
+ return 0;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGTPlugin/BWINSCW/NPSVGTPLUGINU.DEF Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,5 @@
+EXPORTS
+ ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+ ?InitializeFuncs@@YAFPAU_NPPluginFuncs@@@Z @ 2 NONAME ; short InitializeFuncs(struct _NPPluginFuncs *)
+ ?NPP_Shutdown@@YAXXZ @ 3 NONAME ; void NPP_Shutdown(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGTPlugin/eabi/npSvgtPluginU.DEF Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,11 @@
+EXPORTS
+ _Z24ImplementationGroupProxyRi @ 1 NONAME
+ _Z12NPP_Shutdownv @ 2 NONAME
+ _Z15InitializeFuncsP14_NPPluginFuncs @ 3 NONAME
+ _ZTI11CSvgtPlugin @ 4 NONAME ; #<TI>#
+ _ZTI18CSvgtPluginControl @ 5 NONAME ; #<TI>#
+ _ZTI19CSvgtPluginEcomMain @ 6 NONAME ; #<TI>#
+ _ZTV11CSvgtPlugin @ 7 NONAME ; #<VT>#
+ _ZTV18CSvgtPluginControl @ 8 NONAME ; #<VT>#
+ _ZTV19CSvgtPluginEcomMain @ 9 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGTPlugin/group/SVGTPluginS60.pkg Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,48 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description:
+;
+;
+; Installation file for MFP application
+;
+;Languages
+&EN
+;
+; UID is the app's UID
+;
+#{"SVGTPlugin"},(0x101F86DF),1,0,0,TYPE=SISOPTION
+;
+;Supports Series 60 v 1.1
+;This line indicates that this installation is for the Series 60 platform v0.9
+;This line must appear _exactly_ as shown below in the sis file
+;If this line is missing or incorrect, the sis file will not be able
+;to be installed on Series 60 v0.9 platforms
+(0x101F6F88), 0, 0, 0, {"Series60ProductID"}
+;
+; Two files to install
+;
+"\epoc32\release\thumb\urel\npSvgtPlugin.dll" -"!:\apps\plugin\npSvgtPlugin.dll"
+
+"\Epoc32\release\thumb\urel\gfx2d.dll" -"!:\system\libs\gfx2d.dll"
+
+"\Epoc32\release\thumb\urel\svgengine.dll" -"!:\system\libs\svgengine.dll"
+
+"\Epoc32\release\thumb\urel\SVGRECOG.MDL" -"!:\system\recogs\SVGRECOG.MDL"
+
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGTPlugin/group/SVGTPluginS60Ecom.mmp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This is the .mmp for building Ecom style SVGT Plugin for
+ * the Series60 Platform.
+ *
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET npsvgtplugin.dll
+
+TARGETTYPE PLUGIN
+
+UID 0x10009D8D 0x101F86DF
+
+CAPABILITY CAP_ECOM_PLUGIN
+VENDORID VID_DEFAULT
+
+// Defined for audio support
+
+//deffile generation
+#if defined( ARMCC )
+deffile ../eabi/npSvgtPlugin.DEF
+#else
+deffile ../BWINSCW/NPSVGTPLUGIN.DEF
+#endif
+
+SOURCEPATH ../src
+SOURCE Svgtpluginmain.cpp
+SOURCE Svgtplugin.cpp
+SOURCE Svgtplugindllapi.cpp
+SOURCE SvgtPluginControl.cpp
+
+SOURCE VolumeKeyListener.cpp
+SOURCE RepositoryVolumeListener.cpp
+
+USERINCLUDE ../inc
+
+// This is a SYSTEMINCLUDE macro containing the middleware
+// layer specific include directories
+APP_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE /epoc32/include/libc
+SYSTEMINCLUDE /epoc32/include/ecom
+SYSTEMINCLUDE /epoc32/include/http
+
+SOURCEPATH ../resource/s60
+
+START RESOURCE 101f86df.rss
+TARGET npsvgtplugin.rsc
+END
+
+LIBRARY euser.lib efsrv.lib cone.lib
+LIBRARY eikcore.lib fbscli.lib gdi.lib
+LIBRARY svgengine.lib
+LIBRARY hwrmlightclient.lib
+//LIBRARY pluginadapterutil.lib
+LIBRARY ecom.lib
+
+LIBRARY centralrepository.lib
+LIBRARY remconcoreapi.lib
+LIBRARY remconinterfacebase.lib
+LIBRARY featmgr.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGTPlugin/group/bld.inf Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This is a build file that builds SVGTPlugin alone
+*
+*/
+
+
+//Platforms listed are not built by SVGTPlugin
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+#ifdef __SERIES60_NATIVE_BROWSER
+SVGTPluginS60Ecom.mmp
+#endif // __SERIES60_NATIVE_BROWSER
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGTPlugin/inc/MRepositoryVolumeObserver.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Definition of the interface MRepositoryVolumeObserver used to
+* observer events from CRepositoryVolumeListener
+*
+*/
+
+
+//
+// JRT 22_09_04
+// Version 1.0 release.
+
+#ifndef REPOSITORYVOLUMEOBSERVER_H
+#define REPOSITORYVOLUMEOBSERVER_H
+
+class MRepositoryVolumeObserver
+{
+ public:
+ virtual void VolumeChanged(TInt aNewValue) = 0;
+};
+
+#endif //REPOSITORYVOLUMEOBSERVER_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGTPlugin/inc/RepositoryVolumeListener.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: AO that completes on a change in the volume property. Used for
+* the new Central Repository Server. Used in EKA2 builds only
+*
+*/
+
+
+//
+#ifndef REPOSITORYVOLUMELISTENER_H
+#define REPOSITORYVOLUMELISTENER_H
+
+#include <e32std.h>
+#include <e32base.h>
+#include <e32property.h>
+
+//
+// for emulator max volume = 65535
+#define WINS_DEFAULT_VOLUME 43690
+
+//
+// For HW max volume = 9
+#define HW_DEFAULT_VOLUME 6
+
+#include <centralrepository.h>
+
+class MRepositoryVolumeObserver;
+
+NONSHARABLE_CLASS( CRepositoryVolumeListener ) : public CActive
+ {
+public:
+ enum TPropertyWatchState
+ {
+ EConnected = 1,
+ EUnableToConnect
+ };
+
+ static CRepositoryVolumeListener* NewL(MRepositoryVolumeObserver* aObserver);
+ virtual ~CRepositoryVolumeListener();
+ TInt GetCurrentVolume();
+
+private:
+ CRepositoryVolumeListener();
+ void ConstructL(MRepositoryVolumeObserver* aObserver);
+ TInt GetDefaultVolume();
+
+ //From CActive
+ void RunL();
+ void DoCancel();
+
+
+ CRepository* iCenRepos;
+
+ TPropertyWatchState iState;
+
+ MRepositoryVolumeObserver* iObserver;
+ };
+
+#endif //REPOSITORYVOLUMELISTENER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGTPlugin/inc/SvgtPlugin.hrh Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVGT Plugin Implementation source file
+ *
+*/
+
+#ifndef SVGTPLUGIN_HRH
+#define SVGTPLUGIN_HRH
+
+enum TSVGTPluginCommandIds
+ {
+ ESVGTPluginPause = 1,
+ ESVGTPluginResume,
+ ESVGTPluginReset,
+ ESVGTPluginReplay,
+ ESVGTPluginZoomSubMenu,
+ ESVGTPluginRotateSubMenu,
+ ESVGTPluginZoomIn,
+ ESVGTPluginZoomOut,
+ ESVGTPluginRotate90,
+ ESVGTPluginRotate180,
+ ESVGTPluginRotate270
+ };
+
+
+
+
+#endif // SVGTPLUGIN_HRH
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGTPlugin/inc/Svgtplugin.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,333 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVGT Plugin Implementation header file
+ *
+*/
+
+
+#ifndef __SVGTPLUGIN_H
+#define __SVGTPLUGIN_H
+
+#include <e32std.h>
+#include <coecntrl.h>
+#include <coemain.h>
+#include <fbs.h>
+#include <barsread.h>
+
+#include <hwrmlight.h>
+//SVGT Engine interface
+#include <SVGRequestObserver.h>
+#include <SVGEngineInterfaceImpl.h>
+#include <SVGHyperlinkListener.h>
+#include "SVGListener.h"
+
+#include <npupp.h>
+#include <pluginadapterinterface.h>
+
+#include <cecombrowserplugininterface.h>
+
+#include "MRepositoryVolumeObserver.h"
+
+class CSvgtPlugin;
+class CSvgEngineInterfaceImpl;
+class CFbsBitmap;
+
+class CVolumeKeyListener;
+class CRepositoryVolumeListener;
+/******************************************
+This class is specific to ECom Style Plugin.
+This is used for passing plugin specific initialization information to and from
+browser.
+*******************************************/
+
+IMPORT_C NPError InitializeFuncs(NPPluginFuncs* aPpf);
+
+const TInt KSvgtPluginImplementationValue = 0x101F8823; //implementation id Svgt Ecom Plugin
+
+class CSvgtPluginEcomMain : public CEcomBrowserPluginInterface
+ {
+ public: // Functions from base classes
+ static CSvgtPluginEcomMain* NewL(TAny* aInitParam);
+ ~CSvgtPluginEcomMain();
+ NPNetscapeFuncs* Funcs() {return iNpf;}
+ private:
+ CSvgtPluginEcomMain(NPNetscapeFuncs* aNpf);
+ void ConstructL(NPPluginFuncs* aPluginFuncs);
+ NPNetscapeFuncs* iNpf;
+ };
+
+/****************************************
+Class CSvgtPluginControl
+Class to Handle UI related actions
+****************************************/
+
+class CSvgtPluginControl : public CCoeControl, public MCoeControlObserver,
+ public MPluginNotifier, public MHWRMLightObserver
+
+ {
+public:
+ ~CSvgtPluginControl();
+ void ConstructL(CSvgtPlugin *aPlugin, const CCoeControl *aParentControl);
+ TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
+ void FocusChanged(TDrawNow aDrawNow);
+private: // new - possible notifications
+#ifndef ER5
+ TCoeInputCapabilities InputCapabilities() const;
+#endif
+ void ApplicationFocusChanged(TBool aInFocus);
+ void SystemNotification();
+ void Draw(const TRect& aRect) const;
+ TInt CountComponentControls() const;
+ CCoeControl* ComponentControl(TInt aIndex) const;
+ void HandlePointerEventL(const TPointerEvent& aPointerEvent);
+ void SizeChanged();
+ void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType);
+private: // in MPluginNottify in S60
+ TInt NotifyL(TNotificationType aCallType, void* aParam);
+public: //From MEikMenuObserver
+
+
+public:
+ void LightStatusChanged(TInt aTarget, CHWRMLight::TLightStatus aStatus);
+ CHWRMLight* iLightObserver;
+ void AsFile(const TDesC& fname,NPStream* stream);
+ TBool IsAsFileCalled();
+ TDesC& GetFilename();
+
+private:
+ void UpdatePointer(TInt aShiftX =0 , TInt aShiftY=0);
+
+public:
+ TSize iContentDimension;
+private:
+ CSvgtPlugin *iPlugin;
+ TInt iPointerDx, iPointerDy;// increment decrement
+ TInt iPointerX, iPointerY;//actual Pointer position with respect to Document.
+ TBool iAsFileCalled;
+ TBuf<256> iFilename;
+ TBool iShowCursor;
+ TInt iXPosAtMouseDown;
+ TInt iYPosAtMouseDown;
+ TKeyEvent iPreviousScanCode; //Introduced to differentiate long keypress and short key press
+
+ };
+
+
+/*******************************************************
+Class CSvgtPlugin
+********************************************************/
+
+class CSvgtPlugin : public CBase,
+ public MSvgRequestObserver,
+ public MSvgHyperlinkListener,
+ public MSvgViewPortListener
+ ,
+ public MRepositoryVolumeObserver
+ {
+ struct ImageInfo
+ {
+ TBuf<256> iImageRefUri;
+ TBool iImagePendingOps;
+ };
+
+public:
+ static CSvgtPlugin* NewL(NPP anInstance);
+ ~CSvgtPlugin();
+ void ConstructL(NPP anInstance);
+ void PrepareToExitL();
+ CSvgtPluginControl* Control();
+ void GetSizeOfRenderBuffer(TSize& aSize);
+ NPP Instance();
+ void SetWindowL(const NPWindow *aWindow,const TRect& aRect);
+ /**
+ * ResizeWindow This function set width & height to the browser
+ * and tell brower to resize.
+ *
+ * @since S60 3.1
+ * @param TInt width that needed to be used.
+ * @param TInt height that needed to be used.
+ * @return void
+ */
+ void ResizeWindow(TInt width, TInt height);
+
+ /**
+ * AdjustDimention
+ *
+ * @since S60 3.1
+ * @return ETrue if dimention needs to be changed. EFalse if dimention
+ * remains the same.
+ */
+ TBool AdjustDimention( TBool aWidthInPercentage,
+ TBool aHeightInPercentage );
+
+ /**
+ * This function retrieves attributes from HTML that is
+ * passed in by browser engine.
+ *
+ * @since S60 3.1
+ * @param NPMIMEType
+ * @param NPP
+ * @param uint16
+ * @param DesC16Array* attribute names
+ * @param CDesC16Array* attribute values
+ * @param NPSavedData*
+ * @return NPError
+ */
+ NPError SvgPluginNew(NPMIMEType pluginType, NPP instance, uint16 mode,
+ CDesC16Array* argn, CDesC16Array* argv, NPSavedData* saved);
+
+public: // implements MSvgRequestObserver
+
+ void UpdateScreen();
+
+ TBool ScriptCall( const TDesC& aScript,
+ CSvgElementImpl* aCallerElement );
+
+ TInt FetchImage( const TDesC& aUri, RFs& aSession, RFile& aFileHandle );
+
+ TInt FetchFont( const TDesC& aUri, RFs& aSession, RFile& aFileHandle );
+
+ void GetSmilFitValue(TDes& aSmilValue);
+
+ void UpdatePresentation(const TInt32& aNoOfAnimation);
+ // MHyperlinkListener interface methods
+ TBool LinkEntered( const TDesC& aUri );
+ TBool LinkExited( const TDesC& aUri );
+ TBool LinkActivated( const TDesC& aUri );
+ TBool LinkActivatedWithShow(const TDesC& aUri,const TDesC& aShow);
+ //MSvgViewPortListener method
+ void GetViewPort(TInt getWidth, TInt getHeight,TBool isWidthInPer, TBool isHeightInPer, TInt &setWidth, TInt &setHeight);
+
+ // From MRepositoryVolumeObserver
+ void VolumeChanged(TInt aNewValue);
+
+ TBool LoadSvgFile( const TDesC& aFilename );
+
+private:
+
+ void FetchImageL(const TDesC& aUri);
+public:
+ CFbsBitmap * iRenderBuffer;
+ TSize iControlSize;
+ TBool iSetWindowCalled;
+ TBool iStartCalled;
+ CSvgEngineInterfaceImpl * iSvgModule;
+ TInt iRenderWidth;
+ TInt iRenderHeight;
+ TInt iObjectWidth;
+ TInt iObjectHeight;
+ NPWindow iCurrentWindow;
+
+ TBool iTotalNumerOfAnimation, iStaticContent;
+
+ /*Image Rendering*/
+ RPointerArray<HBufC> iImageUrlInfoList;
+
+ TInt iViewPortWidth;
+ TInt iViewPortHeight;
+private:
+
+ CVolumeKeyListener* iKeyListener;
+ CRepositoryVolumeListener* iRepositoryListener;
+
+ MPluginAdapter* iPluginAdapter;
+
+ //Control of UI for SVGT Engine
+ CCoeControl * iParentControl;
+ CSvgtPluginControl * iControl;
+ NPP iInstance;
+ TBool iIsRenderBufferDefined;
+ TInt iResourceFileIndex;
+ TBool iExpectedDefaultSize;
+ TBool iAdjusted;
+ // Flag indicates whether object height is specified
+ // as percentage value
+ TBool iObjHeightInPercentage;
+ // Flag indicates whether object width is specified
+ // as percentage value
+ TBool iObjWidthInPercentage;
+
+ //While parsing are object width height are specified or not
+ TBool iObjectWidthSpecified;
+ TBool iObjectHeightSpecified;
+ };
+
+
+/*********************************************************************************
+
+ Plugin API methods
+
+*/
+
+/**
+ * Create a plugin.
+ */
+NPError SvgtPluginNewp(NPMIMEType pluginType, NPP instance, uint16 mode, CDesCArray* argn, CDesCArray* argv, NPSavedData* saved);
+
+/**
+ * Destroy a plugin.
+ */
+NPError SvgtPluginDestroy(NPP instance, NPSavedData** save);
+
+/**
+ * This is the parent window of a plugin.
+ */
+NPError SvgtPluginSetWindow(NPP instance, NPWindow* window);
+
+/**
+ * A new data stream has been created for sending data to the plugin.
+ */
+NPError SvgtPluginNewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
+
+/**
+ * A data stream has been terminated.
+ */
+NPError SvgtPluginDestroyStream(NPP instance, NPStream* stream, NPReason reason);
+
+/**
+ * A data stream has been fully saved to a file.
+ */
+void SvgtPluginAsFile(NPP instance, NPStream* stream, const TDesC& fname);
+
+/**
+ * Return the maximum number of bytes this plugin can accept from the stream.
+ */
+int32 SvgtPluginWriteReady(NPP instance, NPStream* stream);
+
+/**
+ * Receive more data - return number of bytes processed.
+ */
+int32 SvgtPluginWrite(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer);
+
+/**
+ * Generic hook to set values/attributes within the plugin.
+ */
+NPError SvgtPluginSetValue(NPP instance, NPNVariable variable, void *ret_value);
+
+/**
+ * Generic hook to get values/attributes from the plugin.
+ */
+NPError SvgtPluginGetValue(NPP instance, NPNVariable variable, void* *ret_value);
+
+/**
+ * Event
+ */
+int16 SvgtPluginEvent(NPP instance, void* event);
+
+
+void SvgtPluginURLNotify(NPP instance, const TDesC& url, NPReason reason, void* notifyData);
+
+void SvgtPluginPrint(NPP instance, NPPrint* platformPrint);
+
+#endif // __PLGPLUGIN_H
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGTPlugin/inc/VolumeKeyListener.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: It completes on a change in the volume property. Used for
+* the new Central Repository Server. Used in EKA2 builds only
+*
+*/
+
+
+#ifndef VOLUMEKEYLISTENER_H
+#define VOLUMEKEYLISTENER_H
+
+#include <e32std.h>
+#include <e32base.h>
+#include <e32property.h>
+
+#include <centralrepository.h>
+#include<remconcoreapitargetobserver.h> //for MRemConCoreApiTargetObserver
+#include<remconinterfaceselector.h> //for CRemConInterfaceSelector
+#include<remconcoreapitarget.h> //for CRemConCoreApiTarget
+
+//
+// for emulator max volume = 65535
+#define WINS_DEFAULT_VOLUME 43690
+
+//
+// For HW max volume = 9
+#define HW_DEFAULT_VOLUME 6
+
+class MRepositoryVolumeObserver;
+
+// DATA TYPES
+// Used for volume up/down events
+enum TVolumeControlCommands
+ {
+ EVolumeControlCmdVolumeUpByOne,
+ EVolumeControlCmdVolumeDownByOne
+ };
+
+NONSHARABLE_CLASS( CVolumeKeyListener ) : public CBase,
+ public MRemConCoreApiTargetObserver
+ {
+public:
+
+ static CVolumeKeyListener* NewL( MRepositoryVolumeObserver* aObserver );
+ virtual ~CVolumeKeyListener();
+ TInt GetCurrentVolume();
+ /**
+ * Function to add an observer
+ */
+ void SetObserver( MRepositoryVolumeObserver* aObserver );
+
+private:
+ CVolumeKeyListener( MRepositoryVolumeObserver* aObserver );
+ void ConstructL();
+
+ //From MRemConCoreApiTargetObserver (remconcoreapitargetobserver.h)
+ void MrccatoCommand( TRemConCoreApiOperationId aOperationId,
+ TRemConCoreApiButtonAction aButtonAct );
+
+ /**
+ * Handle repeat event
+ */
+ void HandleRepeatEvent();
+
+ /**
+ * Send play command to app UI or view.
+ * @since 3.1
+ */
+ void FilterAndSendCommand(TInt aCommandId);
+ /**
+ * Callback for timer
+ */
+ static TInt TimerCallback(TAny* aPtr);
+
+private:
+ CRemConCoreApiTarget* iInterfaceSelector;
+ CRemConInterfaceSelector* iSelector;
+ CRepository* iCenRepos;
+ CPeriodic* iTimer; // owned
+ TInt iCommandId;
+ // Stores the observers.
+ MRepositoryVolumeObserver* iObserver;
+ };
+
+#endif //VOLUMEKEYLISTENER_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGTPlugin/loc/npSVGTPlugin.loc Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+// r: GSM/CDMA
+// v:
+// i: LOCALISATION_TARGET = S90
+
+
+//b: n/a
+//e: n/a
+//f: n/a
+//s: SVG-MEN001
+//w: S90MenuHdr
+//d: This is the menu command in the Svg Browser plugin. The Menu appears
+//d: when the user taps and holds the stylus for predefined time on the
+//d: svg display area in the browser window. "Pause" is used to pause
+//d: current svg animation
+#define SVGT_ME_MEN001_PAUSE "Pause"
+
+
+//b: n/a
+//e: n/a
+//f: n/a
+//s: SVG-MEN001
+//w: S90MenuHdr
+//d: This is the menu command in the Svg Browser plugin. The Menu appears
+//d: when the user taps and holds the stylus for predefined time on the
+//d: svg display area in the browser window. "Resume" is used to resume playing of
+//d: paused svg animation
+#define SVGT_ME_MEN001_RESUME "Resume"
+
+
+//b: n/a
+//e: n/a
+//f: n/a
+//s: SVG-MEN001
+//w: S90MenuHdr
+//d: This is the menu command in the Svg Browser plugin. The Menu appears
+//d: when the user taps and holds the stylus for predefined time on the
+//d: svg display area in the browser window. "Reset" is used to reset current
+//d: svg animation
+#define SVGT_ME_MEN001_RESET "Reset"
+
+//b: n/a
+//e: n/a
+//f: n/a
+//s: SVG-MEN001
+//w: S90MenuHdr
+//d: This is the menu command in the Svg Browser plugin. The Menu appears
+//d: when the user taps and holds the stylus for predefined time on the
+//d: svg display area in the browser window. "Replay" is used to play the
+//d: current svg animation from the start.
+#define SVGT_ME_MEN001_REPLAY "Replay"
+
+//b: n/a
+//e: n/a
+//f: n/a
+//s: SVG-MEN001
+//w: S90MenuHdr
+//d: This is the menu command in the Svg Browser plugin. The Menu appears
+//d: when the user taps and holds the stylus for predefined time on the
+//d: svg display area in the browser window. "Zoom" is used to pop out a
+//d: cascade menu for "Zoom In" and "Zoom Out" options
+#define SVGT_ME_MEN001_ZOOM "Zoom"
+
+//b: n/a
+//e: n/a
+//f: n/a
+//s: SVG-MEN001
+//w: S90MenuHdr
+//d: This is the menu command in the Svg Browser plugin. The Menu appears
+//d: when the user taps and holds the stylus for predefined time on the
+//d: svg display area in the browser window. "Rotate" is used to pop out a
+//d: cascade menu for "Rotate by 90°", "Rotate by 180°" and "Rotate by 270°" options
+#define SVGT_ME_MEN001_ROTATE "Rotate"
+
+//b: n/a
+//e: n/a
+//f: n/a
+//s: SVG-MEN001
+//w: S90MenuCmd
+//d: This is the menu command in the Svg Browser plugin. The Menu appears
+//d: when the user taps and holds the stylus for predefined time on the
+//d: svg display area in the browser window. "In" is used to Zoom In to the
+//d: current svg content
+#define SVGT_ME_MEN001_ZOOM_IN "In"
+
+//b: n/a
+//e: n/a
+//f: n/a
+//s: SVG-MEN001
+//w: S90MenuCmd
+//d: This is the menu command in the Svg Browser plugin. The Menu appears
+//d: when the user taps and holds the stylus for predefined time on the
+//d: svg display area in the browser window. "Out" is used to Zoom Out of the
+//d: current svg content
+#define SVGT_ME_MEN001_ZOOM_OUT "Out"
+
+//b: n/a
+//e: n/a
+//f: n/a
+//s: SVG-MEN001
+//w: S90MenuCmd
+//d: This is the menu command in the Svg Browser plugin. The Menu appears
+//d: when the user taps and holds the stylus for predefined time on the
+//d: svg display area in the browser window. "90°" is used to display current
+//d: svg content by rotating it by 90 degrees
+#define SVGT_ME_MEN001_ROTATE_90 "90°"
+
+//b: n/a
+//e: n/a
+//f: n/a
+//s: SVG-MEN001
+//w: S90MenuCmd
+//d: This is the menu command in the Svg Browser plugin. The Menu appears
+//d: when the user taps and holds the stylus for predefined time on the
+//d: svg display area in the browser window. "180°" is used to display current
+//d: svg content by rotating it by 180 degrees
+#define SVGT_ME_MEN001_ROTATE_180 "180°"
+
+//b: n/a
+//e: n/a
+//f: n/a
+//s: SVG-MEN001
+//w: S90MenuCmd
+//d: This is the menu command in the Svg Browser plugin. The Menu appears
+//d: when the user taps and holds the stylus for predefined time on the
+//d: svg display area in the browser window. "270°" is used to display current
+//d: svg content by rotating it by 270 degrees
+#define SVGT_ME_MEN001_ROTATE_270 "270°"
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGTPlugin/resource/s60/101f86df.rss Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Registry file for Ecom style SVGT Plugin.
+*
+*/
+
+
+
+
+
+#include "registryinfo.rh"
+
+// RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// Registry info
+// The UIDs for the filters implemented in this DLL
+//
+// -----------------------------------------------------------------------------
+//
+
+RESOURCE REGISTRY_INFO theInfo
+ {
+ dll_uid = 0x101F86DF; // should match the name of the file.
+ // 3-d Uid of associeted plugin dll (declared in the dll mmp file)
+
+ interfaces=
+ {
+ INTERFACE_INFO
+ {
+ interface_uid = 0x101F8810; // identifies plugin type (used by ECom)
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x101F8823; // specify specific implementation (must
+ // match an implementation entry in the dll
+ version_no = 1;
+ display_name = "npsvgtplugin.dll;SVGT Plugin";// file name; plugin's name
+ default_data = "image/svg+xml;svg,svgb,svgz,dcf;SVG Content";
+ // suppored mime types
+ // mime Extensions
+ // and mime descriptions
+ opaque_data = "Scalable Vector Graphics Tiny Model Plugin"; // plugin's description
+ }
+ };
+ }
+ };
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGTPlugin/resource/s90/npsvgtplugin.rss Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This file contains all the resources for the SVGT Plugin.
+*
+*/
+
+
+// RESOURCE IDENTIFIER
+NAME SVGT
+
+// INCLUDES
+#include <eikon.rh>
+#include "SvgtPlugin.hrh"
+#include <npSvgtPlugin.loc>
+
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF { buf=""; }
+
+RESOURCE EIK_APP_INFO
+{
+}
+
+RESOURCE MNBUT r_svgtplugin_menu_button
+{
+ popout = r_svgtplugin_menu_pane;
+}
+
+RESOURCE MENU_PANE r_svgtplugin_menu_pane
+ {
+ items=
+ {
+ MENU_ITEM { command=ESVGTPluginPause; txt=SVGT_ME_MEN001_PAUSE; },
+ MENU_ITEM { command=ESVGTPluginResume; txt=SVGT_ME_MEN001_RESUME; },
+ MENU_ITEM { command=ESVGTPluginReset; txt=SVGT_ME_MEN001_RESET; },
+ MENU_ITEM { command=ESVGTPluginReplay; txt=SVGT_ME_MEN001_REPLAY; },
+ MENU_ITEM { command=ESVGTPluginZoomSubMenu; txt=SVGT_ME_MEN001_ZOOM; cascade=r_svgtplugin_zoom_cascaded_menu; },
+ MENU_ITEM { command=ESVGTPluginRotateSubMenu; txt=SVGT_ME_MEN001_ROTATE; cascade=r_svgtplugin_rotate_cascaded_menu;}
+ };
+ }
+
+RESOURCE MENU_PANE r_svgtplugin_zoom_cascaded_menu
+ {
+ items =
+ {
+ MENU_ITEM { command = ESVGTPluginZoomIn; txt = SVGT_ME_MEN001_ZOOM_IN; },
+ MENU_ITEM { command = ESVGTPluginZoomOut; txt = SVGT_ME_MEN001_ZOOM_OUT; }
+ };
+ }
+
+RESOURCE MENU_PANE r_svgtplugin_rotate_cascaded_menu
+ {
+ items =
+ {
+ MENU_ITEM { command = ESVGTPluginRotate90; txt = SVGT_ME_MEN001_ROTATE_90;},
+ MENU_ITEM { command = ESVGTPluginRotate180; txt = SVGT_ME_MEN001_ROTATE_180; },
+ MENU_ITEM { command = ESVGTPluginRotate270; txt = SVGT_ME_MEN001_ROTATE_270; }
+ };
+ }
+
+
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGTPlugin/src/RepositoryVolumeListener.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,150 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: AO that completes on a change in the volume property. Used for
+* the new Central Repository Server. Used in EKA2 builds only
+*
+*/
+
+
+//#include <SharedDataClient.h>
+
+
+#include "RepositoryVolumeListener.h"
+//#include <SharedDataKeys.h> //include this file when KSDUidMediaVolumeControl and KMediaVolume will be needed
+//#include "epocdebug.h"
+#include <browseruisdkcrkeys.h>
+#include "MRepositoryVolumeObserver.h"
+
+CRepositoryVolumeListener* CRepositoryVolumeListener::NewL(MRepositoryVolumeObserver* aObserver)
+ {
+ CRepositoryVolumeListener* self = new(ELeave) CRepositoryVolumeListener;
+ CleanupStack::PushL(self);
+ self->ConstructL(aObserver);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+CRepositoryVolumeListener::CRepositoryVolumeListener() : CActive(CActive::EPriorityStandard)
+ {
+ iState = EUnableToConnect;
+ CActiveScheduler::Add(this) ; // add to active scheduler
+ }
+
+void CRepositoryVolumeListener::ConstructL(MRepositoryVolumeObserver* aObserver)
+ {
+ //
+ // Open a connection to the Central Repository...
+ iCenRepos = CRepository::NewL(KCRUidBrowser);
+
+ if ( iCenRepos->NotifyRequest(KBrowserMediaVolumeControl, iStatus) == KErrNone )
+ {
+ iState = EConnected;
+ SetActive();
+ }
+ else
+ {
+ iState = EUnableToConnect;
+ }
+
+ iObserver = aObserver;
+ }
+
+CRepositoryVolumeListener::~CRepositoryVolumeListener()
+ {
+ Cancel();
+ delete iCenRepos; // close the client session
+ }
+
+//
+// Get the current volume
+TInt CRepositoryVolumeListener::GetCurrentVolume()
+ {
+ TInt currentVolume = 0;
+
+ if ( iState == EUnableToConnect )
+ {
+ //
+ // Connection to CenRepos not available so return the default volume
+ currentVolume = GetDefaultVolume();
+ }
+ else
+ {
+ //
+ // Get the current volume
+ if ( iCenRepos->Get(KBrowserMediaVolumeControl, currentVolume) != KErrNone )
+ {
+ // Error retrieving value... return default value
+ //PLAYEROUTPUT("*ERROR* CRepositoryVolumeListener::GetCurrentVolume() - Unable to retreive volume value");
+ currentVolume = GetDefaultVolume();
+ }
+ }
+
+ return currentVolume;
+ }
+
+//
+// Return the default volume in this case 2/3 of the max support by the system
+TInt CRepositoryVolumeListener::GetDefaultVolume()
+ {
+ TInt defaultVol = 0;
+
+ #if defined(__WINS__)
+ defaultVol = WINS_DEFAULT_VOLUME;
+ #else
+ defaultVol = HW_DEFAULT_VOLUME;
+ #endif
+
+ return defaultVol;
+ }
+
+void CRepositoryVolumeListener::DoCancel()
+ {
+ iCenRepos->NotifyCancel(KBrowserMediaVolumeControl);
+ }
+
+//
+// Activated when the watched value updates.
+void CRepositoryVolumeListener::RunL()
+ {
+ TInt currentVolume = 0;
+
+ if (EUnableToConnect == iState)
+ {
+ return;
+ }
+
+ //
+ // Get the current volume
+ if ( iCenRepos->Get(KBrowserMediaVolumeControl, currentVolume) == KErrNone )
+ {
+ //
+ // Inform the observer
+ iObserver->VolumeChanged(currentVolume);
+ if ( iCenRepos->NotifyRequest(KBrowserMediaVolumeControl, iStatus) == KErrNone )
+ {
+ SetActive();
+ }
+ else
+ {
+ iState = EUnableToConnect;
+ }
+ }
+ else
+ {
+ //
+ // error
+ iState = EUnableToConnect;
+ }
+
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGTPlugin/src/SvgtPluginControl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,589 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVGT Plugin Implementation source file
+ *
+*/
+
+#include <featmgr.h>
+#include <eikenv.h>
+#include <w32std.h>
+#include <e32base.h>
+#include <barsread.h>
+#include <SVGEngineInterfaceImpl.h>
+//#include <Svgengineinterface.h>
+#include <f32file.h>
+
+#include "Svgtplugin.h"
+
+#define SVGT_PLUGIN_DEVICE_KEY_0 48
+#define SVGT_PLUGIN_DEVICE_KEY_1 49
+#define SVGT_PLUGIN_DEVICE_KEY_2 50
+#define SVGT_PLUGIN_DEVICE_KEY_3 51
+#define SVGT_PLUGIN_DEVICE_KEY_4 52
+#define SVGT_PLUGIN_DEVICE_KEY_5 53
+#define SVGT_PLUGIN_DEVICE_KEY_6 54
+#define SVGT_PLUGIN_DEVICE_KEY_7 55
+#define SVGT_PLUGIN_DEVICE_KEY_8 56
+#define SVGT_PLUGIN_DEVICE_KEY_9 57
+#define SVGT_PLUGIN_DEVICE_KEY_ASTERIX 42
+
+
+void CSvgtPluginControl::ConstructL(CSvgtPlugin* aPlugin, const CCoeControl* aParentControl)
+ {
+ iAsFileCalled = EFalse;
+ iShowCursor = EFalse;
+ iPointerX = 5;
+ iPointerY = 5;
+ iPlugin=aPlugin;
+ this->CreateWindowL(aParentControl);
+ ActivateL();
+ EnableDragEvents();
+ iLightObserver = CHWRMLight::NewL(this);
+ }
+
+CSvgtPluginControl::~CSvgtPluginControl()
+ {
+ delete iLightObserver;
+ }
+
+void CSvgtPluginControl::Draw(const TRect& aRect) const
+ {
+ CWindowGc &gc = SystemGc();
+ if (iPlugin && iPlugin->iRenderBuffer !=NULL)
+ {
+
+ // Fix for the iframe scrolling.
+ TRect lCliprect;
+
+ lCliprect.iTl.iY = iPlugin->iCurrentWindow.clipRect.top;
+ lCliprect.iTl.iX = iPlugin->iCurrentWindow.clipRect.left;
+ lCliprect.iBr.iY = iPlugin->iCurrentWindow.clipRect.bottom;
+ lCliprect.iBr.iX = iPlugin->iCurrentWindow.clipRect.right;
+
+ TSize lWindowSize(iPlugin->iCurrentWindow.width,iPlugin->iCurrentWindow.height);
+
+ if(lWindowSize!=(lCliprect.Size()))
+ {
+ // Get the Abs(x,y) of the window and render with the size of the cliprect
+ TPoint lpt(Abs(iPlugin->iCurrentWindow.x),Abs(iPlugin->iCurrentWindow.y ));
+ TRect lrect(lpt,lCliprect.Size());
+ gc.BitBlt( aRect.iTl, (iPlugin->iRenderBuffer), lrect );
+ }
+ else
+ {
+ gc.BitBlt( aRect.iTl, (iPlugin->iRenderBuffer), aRect );
+ }
+
+
+ if ( iShowCursor )
+ {
+ TInt lX = iPointerX + aRect.iTl.iX;
+ TInt lY = iPointerY + aRect.iTl.iY;
+ TRect csrh ( lX - 2,
+ lY - 5,
+ lX + 2,
+ lY + 5 );
+ TRect csrv ( lX - 5,
+ lY - 2,
+ lX + 5,
+ lY + 2 );
+ gc.SetPenSize( TSize( 1, 1 ) );
+ gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+ gc.SetBrushColor( TRgb( 0, 0, 0 ) );
+ gc.SetPenColor( TRgb( 0, 0, 0 ) );
+ gc.DrawRect( csrh );
+ gc.DrawRect( csrv );
+ csrh.Shrink( 1, 1 );
+ csrv.Shrink( 1, 1 );
+ gc.SetBrushColor( TRgb( 255, 225, 225 ) );
+ gc.SetPenColor( TRgb( 255, 225, 225 ) );
+ gc.DrawRect( csrh );
+ gc.DrawRect( csrv );
+ }
+ }
+ }
+
+TInt CSvgtPluginControl::CountComponentControls() const
+ {
+ return 0;
+ }
+
+CCoeControl* CSvgtPluginControl::ComponentControl(TInt /*aIndex*/) const
+ {
+ return NULL;
+ }
+
+void CSvgtPluginControl::SizeChanged()
+ {
+ }
+
+#ifndef ER5
+TCoeInputCapabilities CSvgtPluginControl::InputCapabilities() const
+ {
+ return TCoeInputCapabilities(TCoeInputCapabilities::ENavigation);
+ }
+#endif
+
+void CSvgtPluginControl::HandleControlEventL(CCoeControl* /*aControl*/, TCoeEvent /*aEventType*/)
+ {
+ }
+
+void CSvgtPluginControl::FocusChanged(TDrawNow /*aDrawNow*/)
+ {
+ }
+
+TKeyResponse CSvgtPluginControl::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
+ {
+ TKeyResponse retVal = EKeyWasNotConsumed;
+ if( iPlugin->iSvgModule && iPlugin->iSvgModule->SvgDocument() )
+ {
+ if ( aType == EEventKeyUp )
+ {
+ iPointerDx = 0;
+ iPointerDy = 0;
+ if ( aKeyEvent.iScanCode == EStdKeyDevice3 ) // Center button of rocker key
+ {
+ iPlugin->iSvgModule->MouseUp( iPointerX, iPointerY );
+ retVal = EKeyWasConsumed;
+ }
+ if(iPreviousScanCode.iScanCode == SVGT_PLUGIN_DEVICE_KEY_0)
+ {
+ if(!iPreviousScanCode.iRepeats) /*Short Key Press of 'Zero' Do Zoom Out*/
+ {
+ iPlugin->iSvgModule->Zoom(0.5f);
+ iPlugin->iSvgModule->Redraw();
+ }
+ else /*Long Key Press of 'Zero' Reset to Original View*/
+ {
+ iPlugin->iSvgModule->OriginalView();
+ iPlugin->iSvgModule->Redraw();
+ }
+ retVal = EKeyWasConsumed;
+
+ }
+ iPreviousScanCode.iRepeats = 0;
+ iPreviousScanCode.iCode = 0;
+ iPreviousScanCode.iScanCode = 0;
+ }
+ else if ( aType == EEventKey )
+ {
+ retVal = EKeyWasConsumed;
+ // aKeyEvent.iScanCode does not recognize EStdKeyNkpAsterisk
+ switch ( aKeyEvent.iScanCode )
+ {
+ case EStdKeyLeftArrow:
+ iPointerDx -= 5;
+ iPointerDy = 0;
+ break;
+ case EStdKeyRightArrow:
+ iPointerDx += 5;
+ iPointerDy = 0;
+ break;
+ case EStdKeyUpArrow:
+ iPointerDx = 0;
+ iPointerDy -= 5;
+ break;
+ case EStdKeyDownArrow:
+ iPointerDx = 0;
+ iPointerDy += 5;
+ break;
+ case EStdKeyDevice3:
+ // Center button of rocker key
+ iPlugin->iSvgModule->MouseDown( iPointerX, iPointerY );
+ break;
+ case EStdKeyHash: // Pause/Resume
+ if(iPlugin->iSvgModule->CurrentState() == 0)
+ iPlugin->iSvgModule->Stop();
+ else if(iPlugin->iSvgModule->CurrentState() == 1)
+ iPlugin->iSvgModule->Resume();
+ break;
+
+ case SVGT_PLUGIN_DEVICE_KEY_5: //Zoom In
+ iPlugin->iSvgModule->Zoom(2.0f);
+ iPlugin->iSvgModule->Redraw();
+ break;
+
+ case SVGT_PLUGIN_DEVICE_KEY_1: //Rotate ClockWise 90
+ iPlugin->iSvgModule->Rotate( (float) (3.1415926/2), iContentDimension.iWidth/2, iContentDimension.iHeight/2);
+ iPlugin->iSvgModule->Redraw();
+ break;
+
+ case SVGT_PLUGIN_DEVICE_KEY_3: //Rotate Counter ClockWise 90
+ iPlugin->iSvgModule->Rotate( (float) (-3.1415926/2), iContentDimension.iWidth/2, iContentDimension.iHeight/2);
+ iPlugin->iSvgModule->Redraw();
+ break;
+ case SVGT_PLUGIN_DEVICE_KEY_7: //Rotate ClockWise 45
+ iPlugin->iSvgModule->Rotate( (float) (3.1415926/4), iContentDimension.iWidth/2, iContentDimension.iHeight/2);
+ iPlugin->iSvgModule->Redraw();
+ break;
+ case SVGT_PLUGIN_DEVICE_KEY_9: //Rotate Counter ClockWise 45
+ iPlugin->iSvgModule->Rotate( (float) (-3.1415926/4), iContentDimension.iWidth/2, iContentDimension.iHeight/2);
+ iPlugin->iSvgModule->Redraw();
+ break;
+ case SVGT_PLUGIN_DEVICE_KEY_0:
+ iPreviousScanCode = aKeyEvent;
+ break;
+ default:
+ retVal = EKeyWasNotConsumed;
+ }
+ }
+
+ else if ( aType == EEventKeyDown)
+ {
+ // Send the mousedown event for triggering any animation
+ // Since the EEventKey is not recieved when MSK is pressed,
+ // the mousedown doesn't occur on engine. Hence EEventKey
+ // handled here
+ if ( aKeyEvent.iScanCode == EStdKeyDevice3 ) // Center button of rocker key
+ {
+ iPlugin->iSvgModule->MouseDown( iPointerX, iPointerY );
+ retVal=EKeyWasConsumed;
+ }
+ }
+
+ if ( (iPointerDx != 0) || (iPointerDy != 0) )
+ {
+ UpdatePointer(iPointerDx,iPointerDy);
+ }
+ }
+ return retVal;
+ }
+
+
+void CSvgtPluginControl::AsFile(const TDesC& fname,NPStream* stream)
+ {
+ // -----------------------------------
+ // Check for image was requested
+ // -----------------------------------
+ if( iPlugin && iFilename.Length() > 0 )
+ {
+ TInt lFileSize = 0;
+ RFile lSvgFile;
+ CEikonEnv* iEikEnv = CEikonEnv::Static();
+
+ // Attempt to open the file in read mode
+ User::LeaveIfError( lSvgFile.Open(iEikEnv->FsSession(),fname,EFileRead ) );
+
+ // Save on cleanup stack
+ CleanupClosePushL( lSvgFile );
+
+ // Get the size of the data to create read buffer
+ User::LeaveIfError( lSvgFile.Size(lFileSize) );
+
+ // Create buffer that will contain the file data
+ HBufC8* lFileData = HBufC8::NewLC(lFileSize);
+ TPtr8 lFileDataPtr(lFileData->Des());
+
+ // Read from the file
+ User::LeaveIfError( lSvgFile.Read(lFileDataPtr) );
+
+ TInt index = reinterpret_cast<TInt>((stream->notifyData));
+
+ iPlugin->iSvgModule->AssignImageData(*(iPlugin->iImageUrlInfoList[index]), lFileData );
+ iPlugin->iSvgModule->Redraw();
+
+ // The ownership of lFileData is with the respective Image Element.
+ CleanupStack::Pop(1);
+ CleanupStack::PopAndDestroy(&lSvgFile); // lSvgFile.Close()
+
+ return;
+ }
+
+ // Svg file
+ iFilename.Zero();
+ iFilename.Copy(fname);
+
+ if ( ( iPlugin && iPlugin->iSvgModule ) )
+ {
+ iPlugin->iSvgModule->Stop();
+ iPlugin->LoadSvgFile( iFilename );
+ // After loading the content, the width & height will be visible to plugin.
+ // It is time to adjust the size if needed.
+ TBool widthInPercentage = EFalse;
+ TBool heightInPercentage = EFalse;
+ iContentDimension = iPlugin->iSvgModule->ContentDimensionsInPercentage();
+
+ if(iContentDimension.iWidth == -1)
+ {
+ widthInPercentage = EFalse;
+ if(iPlugin->iSvgModule->SvgDocument())
+ {
+ iContentDimension.iWidth = iPlugin->iSvgModule->GetViewportWidth(iPlugin->iSvgModule->SvgDocument());
+ }
+ else
+ {
+ return;
+ }
+ }
+ else
+ {
+ widthInPercentage = ETrue;
+ }
+
+ if(iContentDimension.iHeight == -1)
+ {
+ heightInPercentage = EFalse;
+ if(iPlugin->iSvgModule->SvgDocument())
+ {
+ iContentDimension.iHeight = iPlugin->iSvgModule->GetViewportHeight(iPlugin->iSvgModule->SvgDocument());
+ }
+ else
+ {
+ return;
+ }
+
+ }
+ else
+ {
+ heightInPercentage = ETrue;
+ }
+ if(iPlugin->AdjustDimention(widthInPercentage, heightInPercentage))
+ {
+ // dimention change is needed so return and notify Browser.
+ iAsFileCalled = ETrue;
+ return;
+ }
+
+ iPlugin->iSvgModule->Start();
+ }
+ iAsFileCalled = ETrue;
+ }
+
+
+TBool CSvgtPluginControl::IsAsFileCalled()
+ {
+ return iAsFileCalled;
+ }
+
+TDesC& CSvgtPluginControl::GetFilename()
+ {
+ return iFilename;
+ }
+
+
+void CSvgtPluginControl::LightStatusChanged(TInt aTarget, CHWRMLight::TLightStatus aStatus)
+{
+ //TInt lState = iPlugin->iSvgModule->CurrentState();
+ if((aTarget == CHWRMLight::EPrimaryDisplay) || (aTarget == CHWRMLight::EPrimaryDisplayAndKeyboard))
+ {
+ if(aStatus == CHWRMLight::ELightOff)
+ {
+
+ if (iPlugin && iPlugin->iSvgModule)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("Backlight Off");
+ #endif //_DEBUG
+
+ iPlugin->iSvgModule->Pause();
+ }
+
+ }
+ else if(aStatus == CHWRMLight::ELightOn)
+ {
+
+ if (iPlugin && iPlugin->iSvgModule)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("Backlight On");
+ #endif //_DEBUG
+
+ iPlugin->iSvgModule->Resume();
+ }
+ }
+ }
+
+}
+/**
+* MOperaPluginNotifier methods
+* - Handle notifications browser
+*/
+TInt CSvgtPluginControl::NotifyL(TNotificationType aCallType, void* aParam)
+ {
+ if ( (iPlugin == NULL ) || ( iPlugin->iSvgModule == NULL ) )
+ {
+ return KErrNone;
+ }
+
+ if(aCallType == EApplicationFocusChanged)
+ {
+ TInt lState = iPlugin->iSvgModule->CurrentState();
+ TBool lInFocus = (TBool) aParam;
+
+ if ( lInFocus )
+ {
+ // iShowCursor = ETrue;
+ if ( lState == 1 )
+ {
+ iPlugin->iSvgModule->Resume();
+ }
+ DrawNow();
+ }
+ else if ( !lInFocus )
+ {
+ //ShowCursor = EFalse;
+ if ( lState == 0 )
+ {
+ iPlugin->iSvgModule->Pause();
+ }
+ DrawNow();
+ }
+ }
+ else if(aCallType == EPluginActivated)
+ {
+ iShowCursor = ETrue;
+ DrawNow();
+ }
+ else if(aCallType == EPluginDeactivated)
+ {
+ iShowCursor = EFalse;
+ DrawNow();
+ }
+ else if(aCallType == EPluginInvisible )
+ {
+ }
+ return KErrNone;
+ }
+
+
+void CSvgtPluginControl::ApplicationFocusChanged(TBool /*aInFocus*/)
+ {
+ }
+
+void CSvgtPluginControl::SystemNotification()
+ {
+ }
+
+void CSvgtPluginControl::HandlePointerEventL(const TPointerEvent& aPointerEvent)
+ {
+
+
+ if ( iPlugin->iSvgModule && iPlugin->iSvgModule->SvgDocument() )
+ {
+ iPointerDx = 0;
+ iPointerDy = 0;
+
+ if(aPointerEvent.iType == TPointerEvent::EButton1Down)
+ {
+ if(aPointerEvent.iPosition.iX <=iPlugin->iRenderWidth && aPointerEvent.iPosition.iY <=iPlugin->iRenderHeight)
+ {
+ iPointerX = aPointerEvent.iPosition.iX;
+ iPointerY = aPointerEvent.iPosition.iY;
+
+ iXPosAtMouseDown = iPointerX;
+ iYPosAtMouseDown = iPointerY;
+
+ iPlugin->iSvgModule->MouseDown( iPointerX, iPointerY );
+ UpdatePointer();
+ }
+ }
+ else if(aPointerEvent.iType == TPointerEvent::EButton1Up)
+ {
+ iPlugin->iSvgModule->MouseUp( iPointerX, iPointerY );
+ DrawDeferred();
+ }
+ else if (aPointerEvent.iType == TPointerEvent::EDrag)
+ {
+ if((iPointerX != aPointerEvent.iPosition.iX || iPointerY != aPointerEvent.iPosition.iY) &&
+ (aPointerEvent.iPosition.iX <=iPlugin->iRenderWidth && aPointerEvent.iPosition.iY <=iPlugin->iRenderHeight))
+ {
+ iPointerX = aPointerEvent.iPosition.iX;
+ iPointerY = aPointerEvent.iPosition.iY;
+
+ iPlugin->iSvgModule->MouseMove( iPointerX, iPointerY );
+
+ UpdatePointer((iXPosAtMouseDown-iPointerX),(iYPosAtMouseDown-iPointerY));
+ }
+ }
+ }
+ }
+
+void CSvgtPluginControl::UpdatePointer(
+#ifdef __PEN_SUPPORT
+ TInt aShiftX , TInt aShiftY
+#else
+ TInt , TInt
+#endif
+ )
+ {
+ #ifdef __PEN_SUPPORT
+ if(FeatureManager::FeatureSupported(KFeatureIdPenSupport))
+ {
+ if(aShiftX != 0 || aShiftY != 0 )
+ {
+ iPlugin->iSvgModule->Pan(-aShiftX,-aShiftY);
+ iPlugin->iSvgModule->Redraw();
+ iXPosAtMouseDown = iPointerX;
+ iYPosAtMouseDown = iPointerY;
+ iPlugin->iSvgModule->MouseMove( iPointerX, iPointerY );
+ User::After(10);
+ DrawNow();
+ }
+ }
+ #else//_PEN_SUPPORT
+ {
+ if (iPlugin->iRenderBuffer !=NULL)
+ {
+ // Due to the iframe scrolling the pointer will run out
+ // of the iframe window when tried to pan inside the plugin.
+ // So the control rect for the pointer is now the cliprect.
+
+ // TRect lControlRect(TSize(iPlugin->iViewPortWidth, iPlugin->iViewPortHeight));
+ TRect lControlRect;
+
+ lControlRect.iTl.iY = iPlugin->iCurrentWindow.clipRect.top;
+ lControlRect.iTl.iX = iPlugin->iCurrentWindow.clipRect.left;
+ lControlRect.iBr.iY = iPlugin->iCurrentWindow.clipRect.bottom;
+ lControlRect.iBr.iX = iPlugin->iCurrentWindow.clipRect.right;
+
+ //X value
+ iPointerX += iPointerDx;
+ if ( iPointerX < 5 )
+ {
+ iPointerX = 5;
+ iPlugin->iSvgModule->Pan( 30, 0 );
+ //iPlugin->iSvgModule->Pan( -30, 0 );
+ iPlugin->iSvgModule->Redraw();
+ }
+ else if ( lControlRect.Width() - 5 < iPointerX )
+ {
+ iPointerX = lControlRect.Width() - 5;
+ iPlugin->iSvgModule->Pan( -30, 0 );
+ //iPlugin->iSvgModule->Pan( 30, 0 );
+ iPlugin->iSvgModule->Redraw();
+ }
+ //Y value
+ iPointerY += iPointerDy;
+ if ( iPointerY < 5 )
+ {
+ iPointerY = 5;
+ iPlugin->iSvgModule->Pan( 0, 30 );
+ //iPlugin->iSvgModule->Pan( 0, -30 );
+ iPlugin->iSvgModule->Redraw();
+ }
+ else if ( lControlRect.Height() - 5 < iPointerY )
+ {
+ iPointerY = lControlRect.Height() - 5;
+ iPlugin->iSvgModule->Pan( 0,-30 );
+ //iPlugin->iSvgModule->Pan( 0,30 );
+ iPlugin->iSvgModule->Redraw();
+ }
+ iPlugin->iSvgModule->MouseMove( iPointerX, iPointerY );
+ DrawNow();
+ }
+ }
+ #endif //_PEN_SUPPORT
+
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGTPlugin/src/Svgtplugin.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,740 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVGT Plugin Implementation source file
+ *
+*/
+
+
+
+#include <e32std.h>
+#include <eikenv.h>
+#include <barsread.h>
+#include <fbs.h>
+#include <gdi.h>
+#include <f32file.h>
+
+#include <featmgr.h>
+
+#include <eikappui.h>
+
+#include <SVGEngineInterfaceImpl.h>
+
+#include "Svgtplugin.h"
+
+#include "VolumeKeyListener.h"
+#include "RepositoryVolumeListener.h"
+
+_LIT(KWidth, "width");
+_LIT(KHeight, "height");
+
+CSvgtPlugin* CSvgtPlugin::NewL(NPP anInstance)
+ {
+ CSvgtPlugin *self = new (ELeave) CSvgtPlugin;
+ CleanupStack::PushL( self );
+ self->ConstructL(anInstance);
+
+ CleanupStack::Pop();
+ return self;
+ }
+
+
+CSvgtPlugin::~CSvgtPlugin()
+ {
+ if ( iControl )
+ {
+ delete iControl;
+ iControl=NULL;
+ }
+
+ if ( iSvgModule )
+ {
+ iSvgModule->Stop();
+ delete iSvgModule;
+ iSvgModule = NULL;
+ }
+
+ if ( iRenderBuffer )
+ {
+ delete iRenderBuffer;
+ iRenderBuffer = NULL;
+ }
+
+ iImageUrlInfoList.ResetAndDestroy();
+ iImageUrlInfoList.Close();
+
+ if(iKeyListener)
+ {
+ delete iKeyListener;
+ iKeyListener = NULL;
+ }
+
+ if(iRepositoryListener)
+ {
+ delete iRepositoryListener;
+ iRepositoryListener = NULL;
+ }
+ }
+
+void CSvgtPlugin::PrepareToExitL()
+ {
+ if (iPluginAdapter)
+ iPluginAdapter->PluginFinishedL();
+ }
+
+void CSvgtPlugin::ConstructL(NPP anInstance)
+ {
+ iInstance=anInstance;
+ iRenderBuffer = new ( ELeave ) CFbsBitmap();
+
+ iObjectWidth = 0;
+ iObjectHeight = 0;
+ // By default obj height is not in percentage
+ iObjHeightInPercentage = EFalse;
+ // By default obj width is not in percentage
+ iObjWidthInPercentage = EFalse;
+ iExpectedDefaultSize = EFalse;
+
+ //While parsing are object width height are specified or not
+ iObjectWidthSpecified = EFalse;
+ iObjectHeightSpecified = EFalse;
+ TFontSpec lFontSpec;
+ iSvgModule = CSvgEngineInterfaceImpl::NewL( iRenderBuffer, this, lFontSpec );
+
+ // Clear background white
+ iSvgModule->SetBackgroundColor(0xffffffff);
+ iSvgModule->AddHyperlinkListener( this );
+ iAdjusted = EFalse;
+
+ if (FeatureManager::FeatureSupported(KFeatureIdSideVolumeKeys))
+ {
+ User::InfoPrint(_L("Volume Key supported"));
+ iKeyListener = CVolumeKeyListener::NewL(this);
+ }
+ else
+ {
+ User::InfoPrint(_L("Key not supported"));
+ iRepositoryListener = CRepositoryVolumeListener::NewL(this);
+ }
+ }
+
+void CSvgtPlugin::SetWindowL(const NPWindow *aWindow,const TRect& aRect)
+ {
+ iCurrentWindow.x = aWindow->x;
+ iCurrentWindow.y = aWindow->y;
+ iCurrentWindow.window = aWindow->window;
+ iCurrentWindow.clipRect = aWindow->clipRect;
+ iCurrentWindow.type = aWindow->type;
+ iCurrentWindow.width = aWindow->width;
+ iCurrentWindow.height = aWindow->height;
+
+ iPluginAdapter = static_cast<MPluginAdapter*>(aWindow->window);
+ iParentControl = iPluginAdapter->GetParentControl();
+ if (iControl == NULL)
+ {
+ iControl = new (ELeave) CSvgtPluginControl;
+ iControl->ConstructL(this,iParentControl);
+ iPluginAdapter->PluginConstructedL(iControl);
+ iPluginAdapter->SetPluginNotifier(iControl);
+ }
+
+ if ( !iControl || !iSvgModule || aRect.Width() <= 0 || aRect.Height() <= 0 )
+ {
+ return;
+ }
+ iSetWindowCalled = ETrue;
+
+ iControl->SetRect(aRect);
+
+ if ( iRenderWidth != aRect.Width() ||
+ iRenderHeight != aRect.Height() )
+ {
+ iRenderWidth = aRect.Width();
+ iRenderHeight = aRect.Height();
+
+ // Browser initially sends width/height as zero
+ // if width/height are not specified
+ // Later if svg is available to us we call resize after adjustDimention
+ // But if we dont do adjustDimention quick enough
+ // Browser sends default width/Height as 300x150
+
+ // To Ensure that we are setting the object width/height and
+ // browser is not setting default width/height ahead of us doing resize
+
+ // In adjustDimention if width/height are specified at the browser level
+ // iAdjusted is set to false, the second condition is to ensure that
+ // if the browser does a resize at a later point it should be allowed
+ if(iAdjusted || (iObjectWidthSpecified && iObjectHeightSpecified))
+ {
+ iObjectWidth = iRenderWidth;
+ iObjectHeight = iRenderHeight;
+ }
+ iSvgModule->Pause(); //fix for CGSR-7CN7T7
+
+ User::LeaveIfError( iRenderBuffer->Create(
+ TSize( iRenderWidth, iRenderHeight ), EColor64K ) );
+ iSvgModule->SetFrameBuffer( iRenderBuffer );
+ iSvgModule->Resume(); // fix for CGSR-7CN7T7
+ }
+
+
+ if ( iExpectedDefaultSize )
+ {
+ iExpectedDefaultSize = EFalse;
+ AdjustDimention(ETrue,ETrue);
+ }
+
+ if(iControlSize != aRect.Size())
+ {
+ iRenderWidth = aRect.Width();
+ iRenderHeight = aRect.Height();
+ CFbsBitmap * lTempRenderBuffer = new (ELeave) CFbsBitmap();
+ CleanupStack::PushL(lTempRenderBuffer);
+ User::LeaveIfError( lTempRenderBuffer->Create( TSize(iRenderWidth,iRenderHeight), EColor64K ));
+ iSvgModule->SetFrameBuffer(lTempRenderBuffer);
+
+ delete iRenderBuffer;
+ iRenderBuffer = lTempRenderBuffer;
+ CleanupStack::Pop(lTempRenderBuffer);
+ lTempRenderBuffer = NULL;
+ iControlSize = aRect.Size();
+ iControl->iContentDimension = iSvgModule->ContentDimensions();
+ }
+ // For autoloading feature.
+ if ( iControl->IsAsFileCalled() && iControl->GetFilename().Length() > 0 &&
+ !iStartCalled )
+ {
+
+ TBool widthInPercentage;
+ TBool heightInPercentage;
+
+ iControl->iContentDimension = iSvgModule->ContentDimensionsInPercentage();
+ if(iControl->iContentDimension.iWidth == -1 )
+ {
+ widthInPercentage = EFalse;
+ if(iSvgModule->SvgDocument())
+ {
+ iControl->iContentDimension.iWidth = iSvgModule->GetViewportWidth(iSvgModule->SvgDocument());
+ }
+ else
+ {
+ return;
+ }
+
+ }
+ else
+ {
+ widthInPercentage = ETrue;
+ }
+
+ if(iControl->iContentDimension.iHeight == -1)
+ {
+ heightInPercentage = EFalse;
+ if(iSvgModule->SvgDocument())
+ {
+ iControl->iContentDimension.iHeight = iSvgModule->GetViewportHeight(iSvgModule->SvgDocument());
+ }
+ else
+ {
+ return;
+ }
+ }
+ else
+ {
+ heightInPercentage = ETrue;
+ }
+ // After loading the content, the width & height will be visible to plugin.
+ // It is time to adjust the size if needed.
+ if ( AdjustDimention(widthInPercentage,heightInPercentage) )
+ {
+ // dimention change is needed so return and notify Browser.
+ return;
+ }
+ iSvgModule->Start();
+ iStartCalled = ETrue;
+ }
+
+ }
+
+
+CSvgtPluginControl* CSvgtPlugin::Control()
+ {
+ return iControl;
+ }
+
+NPP CSvgtPlugin::Instance()
+ {
+ return iInstance;
+ }
+
+void CSvgtPlugin::GetSizeOfRenderBuffer(TSize& aSize)
+ {
+ if ( iRenderBuffer )
+ {
+ aSize = iRenderBuffer->SizeInPixels();
+ }
+ else
+ {
+ aSize = TSize ( 0, 0 );
+ }
+ }
+
+
+
+/**********************************************************************/
+// implements MSvgRequestObserver
+/**********************************************************************/
+
+void CSvgtPlugin::UpdateScreen()
+ {
+ iControl->DrawNow();
+ }
+
+
+TBool CSvgtPlugin::ScriptCall( const TDesC& /*aScript*/,
+ CSvgElementImpl* /*aCallerElement*/ )
+ {
+ return EFalse;
+ }
+
+TBool CSvgtPlugin::LinkEntered( const TDesC& /* aUri */ )
+{
+ // update mouse pointer here
+ return ETrue;
+}
+
+TBool CSvgtPlugin::LinkExited( const TDesC& /* aUri */ )
+{
+ // update mouse pointer here
+ return ETrue;
+}
+TBool CSvgtPlugin::LinkActivated( const TDesC& aUrl )
+ {
+ CSvgtPluginEcomMain* lSvgtPluginEcomMain = (CSvgtPluginEcomMain*) Dll :: Tls ();
+ NPNetscapeFuncs* lNetscapeFuncs = lSvgtPluginEcomMain->Funcs();
+ if(lNetscapeFuncs)
+ {
+ TPtrC lTarget('\0',0);
+ lTarget.Set(_L("_parent"));
+ lNetscapeFuncs->geturl(iInstance,aUrl,&lTarget);
+ }
+ return ETrue;
+ }
+
+void CSvgtPlugin::VolumeChanged(TInt aNewValue)
+ {
+ RDebug::Print(_L("Volume level: %d"), aNewValue);
+ aNewValue *= 10; //to make the volume in percentage
+ iSvgModule->SetAudioVolume( aNewValue );
+ }
+
+TInt CSvgtPlugin::FetchImage(const TDesC& aUri, RFs& /*aSession*/, RFile& /*aFileHandle*/ )
+{
+ TRAPD(err,FetchImageL(aUri));
+
+ return err;
+
+}
+
+void CSvgtPlugin::FetchImageL(const TDesC& aUri)
+ {
+ TInt lCount = iImageUrlInfoList.Count();
+ HBufC* lListItem = NULL;
+ HBufC* lUrl = NULL;
+
+ //checks whether the request is already made for same Uri.
+ for(TInt i = 0; i < lCount; i++)
+ {
+ lListItem = HBufC::NewLC(iImageUrlInfoList[i]->Length());
+ lUrl = aUri.AllocLC();
+
+ *lListItem = *iImageUrlInfoList[i];
+
+ // Convert the List Item to Lower case
+ TPtr lListItemPtr = lListItem->Des();
+ lListItemPtr.LowerCase();
+
+ // Convert the Url to Lower case
+ TPtr lUrlPtr = lUrl->Des();
+ lUrlPtr.LowerCase();
+
+ if( lListItemPtr.Compare(lUrlPtr) == 0 )
+ {
+ CleanupStack::PopAndDestroy(2);
+
+ lListItem = NULL;
+ lUrl = NULL;
+ // Same Url is already requested in the past, no need to continue.
+ User::Leave(KErrAlreadyExists); // Indicates the download is pending
+ }
+
+ CleanupStack::PopAndDestroy(2);
+
+ lListItem = NULL;
+ lUrl = NULL;
+ }
+
+
+ // --------------------------------------
+ // Request file from browser
+ // --------------------------------------
+ CSvgtPluginEcomMain* lSvgtPluginEcomMain = (CSvgtPluginEcomMain*) Dll :: Tls ();
+ NPNetscapeFuncs* lNetscapeFuncs = lSvgtPluginEcomMain->Funcs();
+ if(lNetscapeFuncs)
+ {
+ TPtrC lTarget('\0',0);
+
+ lUrl = aUri.AllocL();
+
+ // Current count is used as a context data.
+ void* contextptr = (void*)(lCount);
+ NPError error = lNetscapeFuncs->geturlnotify(iInstance,aUri,NULL,contextptr);
+
+ // Add the Url and RequestID to the List
+ iImageUrlInfoList.Append(lUrl);
+
+ if ( error != 0 )
+ {
+ #ifdef _DEBUG
+ lNetscapeFuncs->status(iInstance,_L("Image failed"));
+ #endif
+
+ User::LeaveIfError(error);
+ }
+ #ifdef _DEBUG
+ lNetscapeFuncs->status(iInstance,_L("Downloading Image"));
+ #endif
+ }
+
+
+
+ User::Leave(KRequestPending); // Indicate the download is pending
+ }
+
+TInt CSvgtPlugin::FetchFont( const TDesC& /* aUri */, RFs& /* aSession */, RFile& /* aFileHandle */)
+ {
+ // Fix for ANAE-775B7E. There is a limitaiton. For rendering text with
+ // external font synchronous fetching of the file is needed. But the
+ // external font file is fetched asynchronously by browser when we say
+ // geturlnotify(). There is no API to pass the font data after fetching
+ // asynchronously. Hence the code here is removed by returning an error.
+ return KErrNotFound;
+ }
+
+
+TBool CSvgtPlugin::LinkActivatedWithShow(const TDesC& aUri,const TDesC& /*aShow*/)
+ {
+ CSvgtPluginEcomMain* lSvgtPluginEcomMain = (CSvgtPluginEcomMain*) Dll :: Tls ();
+ NPNetscapeFuncs* lNetscapeFuncs = lSvgtPluginEcomMain->Funcs();
+ if(lNetscapeFuncs)
+ {
+ TPtrC lTarget('\0',0);
+ lTarget.Set(_L("_parent"));
+ lNetscapeFuncs->geturl(iInstance,aUri,&lTarget);
+ }
+ return ETrue;
+ }
+
+void CSvgtPlugin::GetSmilFitValue(TDes16 &aSmilValue)
+ {
+ aSmilValue.Copy(_L("meet"));
+ }
+
+void CSvgtPlugin::UpdatePresentation(const TInt32& aNoOfAnimation)
+ {
+ if (iTotalNumerOfAnimation < 0)
+ {
+ if (aNoOfAnimation != 0)
+ {
+ iStaticContent = EFalse;
+ iTotalNumerOfAnimation = aNoOfAnimation;
+ }
+ else
+ {
+ iStaticContent = ETrue;
+ }
+ }
+ else
+ {
+ iTotalNumerOfAnimation--;
+ }
+ }
+
+void CSvgtPlugin::GetViewPort(TInt /*getWidth*/, TInt /*getHeight*/, TBool /*isWidthInPer*/, TBool /*isHeightInPer*/, TInt &setWidth, TInt &setHeight)
+{
+
+ setWidth = iRenderWidth;
+ setHeight = iRenderHeight;
+
+ iViewPortWidth = setWidth;
+ iViewPortHeight = setHeight;
+}
+// ---------------------------------------------------------------------------
+// This function extracts attributes from the list that is passed from Browser.
+// Use to check if width & height are defined in XHTML tag
+// ---------------------------------------------------------------------------
+//
+NPError CSvgtPlugin::SvgPluginNew(NPMIMEType /*pluginType*/, NPP instance,
+ uint16 /*mode*/, CDesC16Array* argn, CDesC16Array* argv, NPSavedData* )
+ {
+ if (instance->pdata != this)
+ {
+ return NPERR_INVALID_INSTANCE_ERROR;
+ }
+
+ for (TInt i = 0; i < argn->Count(); i++)
+ {
+ TPtrC16 namePtr((*argn)[i]);
+ TPtrC16 valPtr((*argv)[i]);
+
+ if (KWidth().FindF(namePtr) == 0)
+ {
+ TLex lString( valPtr );
+ lString.SkipSpace();
+ TInt result = lString.Val(iRenderWidth);
+ // Check if object width was specified as
+ // percentage value.
+ if ( valPtr.Locate( '%' ) != KErrNotFound )
+ {
+ // Do not store the value, browser takes
+ // care of computing the width
+ iObjWidthInPercentage = ETrue;
+ }
+ if (( result != KErrNone) || (iRenderWidth < 0))
+ {
+ iObjectWidth = 0;
+ }
+ else
+ {
+ iObjectWidth = iRenderWidth;
+ }
+ iObjectWidthSpecified = ETrue;
+ }
+ else if (KHeight().FindF(namePtr) == 0)
+ {
+ TLex lString( valPtr );
+ lString.SkipSpace();
+ TInt result = lString.Val(iRenderHeight);
+ // Check if object height was specified as a
+ // percentage value.
+ if ( valPtr.Locate( '%' ) != KErrNotFound )
+ {
+ // Do not store the value, browser takes
+ // care of computing the height
+ iObjHeightInPercentage = ETrue;
+ }
+ if (( result != KErrNone) || ( iRenderHeight < 0 ))
+ {
+ iObjectHeight = 0;
+ }
+ else
+ {
+ iObjectHeight = iRenderHeight;
+ }
+ iObjectHeightSpecified = ETrue ;
+ }
+ }
+
+ return NPERR_NO_ERROR;
+ }
+
+
+// ---------------------------------------------------------------------------
+// ResizeWindow() This function is to notify that a new set of dimention value
+// should be taken into consideration. The new w&h is determined from
+// AdjustDimention().
+//
+// ---------------------------------------------------------------------------
+//
+void CSvgtPlugin::ResizeWindow(TInt aWidth, TInt aHeight)
+ {
+ NPPVariable variable;
+ CSvgtPluginEcomMain* lSvgtPluginEcomMain = (CSvgtPluginEcomMain*) Dll::Tls();
+ NPNetscapeFuncs* lNetscapeFuncs = lSvgtPluginEcomMain->Funcs();
+ NPWindow newWindow;
+ variable = NPPVpluginWindowSize;
+ newWindow.x = iCurrentWindow.x;
+ newWindow.y = iCurrentWindow.y;
+ newWindow.window = iCurrentWindow.window;
+ newWindow.clipRect = iCurrentWindow.clipRect;
+ newWindow.type = iCurrentWindow.type;
+ newWindow.width = aWidth;
+ newWindow.height = aHeight;
+ TInt err = lNetscapeFuncs->setvalue(iInstance, variable, (void*)&newWindow);
+ }
+
+
+// ---------------------------------------------------------------------------
+// AdjustDimention() This function does the logic to check if width & height
+// is needed to be adjusted
+// ---------------------------------------------------------------------------
+//
+TBool CSvgtPlugin::AdjustDimention( TBool aWidthInPercentage, TBool aHeightInPercentage)
+ {
+ iSvgModule->AddListener( static_cast < MSvgViewPortListener*>(this), ESvgViewPortListener );
+ if ( iAdjusted )
+ return EFalse;
+
+ // we set the width height in all cases except when width/height has been
+ // explicitly specified in the browser hence its set here for all cases
+ iAdjusted = ETrue;
+ // html provides absolute width, no height
+ // svg provides absolute width and absolute height
+ if (
+ ( iObjectWidthSpecified && !iObjWidthInPercentage && !iObjectHeightSpecified )
+ && ( !aWidthInPercentage && !aHeightInPercentage)
+ )
+ {
+ // only iObjectWidth is valid
+ // Adjust missing object value as per aspect ratio of
+ // svg's viewport
+ if(iControl->iContentDimension.iWidth)
+ {
+ TReal newHeight = (TInt)((TReal32)iObjectWidth *
+ ( (TReal32)iControl->iContentDimension.iHeight /
+ (TReal32)iControl->iContentDimension.iWidth));
+
+ ResizeWindow(iObjectWidth, newHeight);
+
+ }
+ return ETrue;
+ }
+
+ // html provides no width and absolute height
+ // svg provides absolute width and absolute height
+ else if (
+ ( !iObjectWidthSpecified && iObjectHeightSpecified && !iObjHeightInPercentage )
+ && ( !aWidthInPercentage && !aHeightInPercentage)
+ )
+ {
+ // only iObjectHeight is valid
+ // Adjust missing object value as per aspect ratio of
+ // svg's viewport
+ if(iControl->iContentDimension.iHeight)
+ {
+ TInt newWidth = (TInt)((TReal32)iObjectHeight *
+ ( (TReal32)iControl->iContentDimension.iWidth /
+ (TReal32)iControl->iContentDimension.iHeight));
+ ResizeWindow(newWidth, iObjectHeight);
+
+ }
+ return ETrue;
+ }
+ // html provides no width and no height
+ // svg provides absolute width and absolute height
+ else if(
+ (!iObjectWidthSpecified && !iObjectHeightSpecified)
+ && ( !aWidthInPercentage && !aHeightInPercentage)
+ )
+ {
+ ResizeWindow(iControl->iContentDimension.iWidth, iControl->iContentDimension.iHeight);
+ return ETrue;
+ }
+ // html provides width and height be it percentages or absolute values
+ else if(iObjectWidthSpecified && iObjectHeightSpecified)
+ {
+ iAdjusted = EFalse;
+ return EFalse;
+ }
+ else
+ {
+ TReal newWidth = 0.0f;
+ TReal newHeight = 0.0f;
+ CEikonEnv* lEnv = STATIC_CAST( CEikonEnv*, iControl->ControlEnv() );
+
+ TRect lClientRect = TRect( TPoint( 0,0 ), lEnv->EikAppUi()->ClientRect().Size());
+
+ // if the browser has specified a valid absolute value width
+ if ( !iObjWidthInPercentage && iObjectWidthSpecified)
+ {
+ newWidth = iObjectWidth;
+ }
+ // if the browser has specified a valid percentage value width
+ else if (iObjWidthInPercentage && iObjectWidthSpecified )
+ {
+ // Compute the new dimension by scaling clientRect dimension
+ newWidth = lClientRect.Width() * iObjectWidth / 100;
+ }
+ // if the browser has specified a valid absolute value height
+ if ( !iObjHeightInPercentage && iObjectHeightSpecified)
+ {
+ newHeight = iObjectHeight;
+ }
+ // if the browser has specified a valid percentage value Height
+ else if(iObjHeightInPercentage && iObjectHeightSpecified)
+ {
+ // Compute the new dimension by scaling clientRect dimension
+ newHeight = lClientRect.Height() * iObjectHeight / 100;
+ }
+
+ // if the browser has not specified the width
+ if(!iObjectWidthSpecified)
+ {
+ if(aWidthInPercentage)
+ {
+ newWidth = lClientRect.Width() * iControl->iContentDimension.iWidth / 100;
+ }
+ else
+ {
+ newWidth = iControl->iContentDimension.iWidth;
+ }
+ }
+ // if the browser has not specified the height
+ if(!iObjectHeightSpecified)
+ {
+ if(aHeightInPercentage)
+ {
+ newHeight = lClientRect.Height() * iControl->iContentDimension.iHeight / 100;
+ }
+ else
+ {
+ newHeight = iControl->iContentDimension.iHeight;
+ }
+ }
+ ResizeWindow(newWidth, newHeight);
+ return ETrue;
+ }
+ }
+
+TBool CSvgtPlugin::LoadSvgFile( const TDesC& aFilename )
+ {
+ if ( !iSvgModule )
+ {
+ return EFalse;
+ }
+ MSvgError* error = iSvgModule->Load( aFilename );
+ if ( !error )
+ {
+ return EFalse;
+ }
+
+ // Loading error
+ if ( error->HasError() && !error->IsWarning() )
+ {
+ return EFalse;
+ }
+ TInt currentVolume;
+ if (FeatureManager::FeatureSupported(KFeatureIdSideVolumeKeys))
+ {
+ currentVolume = iKeyListener->GetCurrentVolume();
+ }
+ else
+ {
+ currentVolume = iRepositoryListener->GetCurrentVolume();
+ }
+
+ VolumeChanged(currentVolume );
+ iTotalNumerOfAnimation = -1;
+ return ETrue;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGTPlugin/src/Svgtplugindllapi.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,186 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVGT Plugin Implementation source file
+ *
+*/
+
+
+/*
+************************************************************************************
+* Contents: Example plugin implementation
+* Implementation of the API used by Opera to control the plugin
+************************************************************************************
+*/
+
+
+#include "Svgtplugin.h"
+
+/**
+ * Create a new instance of a SVG plugin.
+**/
+
+NPError SvgtPluginNewp(NPMIMEType pluginType, NPP instance, uint16 mode,
+ CDesCArray* argn, CDesCArray* argv, NPSavedData* saved)
+ {
+ CSvgtPlugin* lSvgtPlugin = NULL;
+ TRAPD(err,lSvgtPlugin = CSvgtPlugin::NewL(instance));
+
+ if (err == KErrNoMemory)
+ return NPERR_OUT_OF_MEMORY_ERROR;
+ if (err != KErrNone)
+ return NPERR_MODULE_LOAD_FAILED_ERROR;
+
+ instance->pdata = (void *) lSvgtPlugin;
+ NPError nerr = lSvgtPlugin->SvgPluginNew(pluginType, instance,
+ mode, argn, argv, saved);
+ return nerr;
+ }
+
+/**
+ * Destroy a plugin.
+**/
+NPError SvgtPluginDestroy(NPP instance, NPSavedData** /*save*/)
+ {
+ CSvgtPlugin* lSvgtPlugin = (CSvgtPlugin *)instance->pdata;
+ if ( lSvgtPlugin )
+ {
+ TRAPD(err,lSvgtPlugin->PrepareToExitL());
+ if (err != KErrNone)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("SvgtPluginDestroy Error when printing Warning.");
+ #endif //_DEBUG
+ }
+ /**Ignoring the error*/
+ delete lSvgtPlugin;
+ lSvgtPlugin = NULL;
+ }
+ return NPERR_NO_ERROR;
+ }
+
+/**
+ * This is the parent window of a plugin.
+ */
+NPError SvgtPluginSetWindow(NPP instance, NPWindow *window)
+ {
+ CSvgtPlugin* lSvgtPlugin = (CSvgtPlugin *) instance->pdata;
+ TUint lWidth = window->width;
+ TUint lHeight = window->height;
+
+ TRAPD(err,lSvgtPlugin->SetWindowL(window,TRect(TSize(lWidth,lHeight))));
+
+ if (err == KErrNoMemory)
+ return NPERR_OUT_OF_MEMORY_ERROR;
+ if (err != KErrNone)
+ return NPERR_GENERIC_ERROR;
+ return NPERR_NO_ERROR;
+ }
+
+/**
+ * A new data stream has been created for sending data to the plugin.
+ * @param stream - A pointer to plugin specific data can be placed in stream->pdata
+ *
+ */
+
+NPError SvgtPluginNewStream(NPP /*instance*/, NPMIMEType /*type*/, NPStream* /*stream*/, NPBool /*seekable*/, uint16* stype)
+ {
+ *stype = NP_ASFILEONLY;
+ return NPERR_NO_ERROR;
+ }
+
+/**
+ * A data stream has been terminated.
+ */
+NPError SvgtPluginDestroyStream(NPP /*instance*/, NPStream* /*stream*/, NPReason /*reason*/)
+ {
+ return NPERR_NO_ERROR;
+ }
+
+/**
+ * A data stream has been fully saved to a file.
+ */
+void SvgtPluginAsFile(NPP instance, NPStream* stream, const TDesC& fname)
+ {
+ CSvgtPlugin* lSvgtPlugin = (CSvgtPlugin*)instance->pdata;
+
+ if (lSvgtPlugin && lSvgtPlugin->Control())
+ {
+ lSvgtPlugin->Control()->AsFile(fname, stream );
+ }
+ }
+
+/**
+ * Return the maximum number of bytes this plugin can accept from the stream.
+ */
+int32 SvgtPluginWriteReady(NPP /*instance*/, NPStream* /*stream*/)
+ {
+ return 65536;
+ }
+
+/**
+ * Receive more data
+ * @param buffer - contains the data.
+ * @param len - the number of bytes in buffer.
+ * @param offset - the number of bytes already sent/processed.
+ * @return TInt number of bytes processed.
+ */
+int32 SvgtPluginWrite(NPP /*instance*/, NPStream* /*stream*/, int32 /*offset*/, int32 len, void* /*buffer*/)
+ {
+ return len;
+ }
+
+/**
+ * Event
+ */
+int16 SvgtPluginEvent(NPP /*instance*/, void* /*event*/)
+ {
+ return 0;
+ }
+
+
+/**
+ * Generic hook to set values/attributes within the plugin.
+ */
+NPError SvgtPluginSetValue(NPP /*instance*/, NPNVariable /*variable*/, void* /*ret_value*/)
+ {
+ return NPERR_NO_ERROR;
+ }
+
+/**
+ * Generic hook to get values/attributes from the plugin.
+ */
+NPError SvgtPluginGetValue(NPP instance, NPNVariable variable, void*
+*ret_value)
+ {
+ CSvgtPlugin* lSvgtPlugin = (CSvgtPlugin *)instance->pdata;
+ if(lSvgtPlugin)
+ {
+ // A response of false when enum passed is NPPVpluginInteractiveBool
+ // must be interpreted as "Plugin is interactive"
+ // Since operations such as panning, zooming can be performed
+ // on all svg contents plugin can be considered always interactive
+ if(variable==NPPVpluginInteractiveBool)
+ {
+ *(TBool*) ret_value=EFalse;
+ }
+ }
+ return NPERR_NO_ERROR;
+ }
+void SvgtPluginURLNotify(NPP /*instance*/, const TDesC& /*url*/, NPReason /*reason*/, void* /*notifyData*/)
+ {
+ }
+
+void SvgtPluginPrint(NPP /*instance*/, NPPrint* /*platformPrint*/)
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGTPlugin/src/Svgtpluginmain.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVGT Plugin Implementation source file
+ *
+*/
+
+
+#include "Svgtplugin.h"
+
+
+#include <implementationproxy.h>
+#include <cecombrowserplugininterface.h>
+/***************************************************/
+/**********ECOM STYLE SVGT PLUGIN ENTRY POINTS******/
+/***************************************************/
+CSvgtPluginEcomMain* CSvgtPluginEcomMain::NewL(TAny* aInitParam)
+{
+ TFuncs* funcs = REINTERPRET_CAST( TFuncs*, aInitParam);
+ CSvgtPluginEcomMain* self = new(ELeave)CSvgtPluginEcomMain(funcs->iNetscapeFuncs);
+ CleanupStack::PushL(self);
+ self->ConstructL(funcs->iPluginFuncs);
+ CleanupStack::Pop();
+
+ Dll :: SetTls ( (void*) self );
+
+ return self;
+}
+
+void CSvgtPluginEcomMain::ConstructL(NPPluginFuncs* aPluginFuncs)
+{
+ InitializeFuncs(aPluginFuncs);
+}
+
+CSvgtPluginEcomMain::CSvgtPluginEcomMain(NPNetscapeFuncs* aNpf) : CEcomBrowserPluginInterface(),iNpf(aNpf)
+{
+}
+
+CSvgtPluginEcomMain::~CSvgtPluginEcomMain()
+{
+
+}
+const TImplementationProxy KImplementationTable[] =
+ {
+ {{KSvgtPluginImplementationValue}, (TProxyNewLPtr) CSvgtPluginEcomMain::NewL}
+ };
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy
+// Returns the filters implemented in this DLL
+// Returns: The filters implemented in this DLL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+{
+ aTableCount = sizeof(KImplementationTable) / sizeof(TImplementationProxy);
+ return KImplementationTable;
+}
+
+
+
+/**
+ * The E32Dll() entry point function.
+**/
+
+
+EXPORT_C NPError InitializeFuncs(NPPluginFuncs* aPpf)
+{
+ aPpf->size = sizeof(NPPluginFuncs);
+ aPpf->version = 1;
+ aPpf->newp = NewNPP_NewProc(SvgtPluginNewp);
+ aPpf->destroy = NewNPP_DestroyProc(SvgtPluginDestroy);
+ aPpf->setwindow = NewNPP_SetWindowProc(SvgtPluginSetWindow);
+ aPpf->newstream = NewNPP_NewStreamProc(SvgtPluginNewStream);
+ aPpf->destroystream = NewNPP_DestroyStreamProc(SvgtPluginDestroyStream);
+ aPpf->asfile = NewNPP_StreamAsFileProc(SvgtPluginAsFile);
+ aPpf->writeready = NewNPP_WriteReadyProc(SvgtPluginWriteReady);
+ aPpf->write = NewNPP_WriteProc(SvgtPluginWrite);
+ aPpf->print = NewNPP_PrintProc(SvgtPluginPrint);
+ aPpf->event = NewNPP_HandleEventProc(SvgtPluginEvent);
+ aPpf->urlnotify = NewNPP_URLNotifyProc(SvgtPluginURLNotify);
+ aPpf->javaClass = NULL;
+ aPpf->getvalue = NewNPP_GetValueProc(SvgtPluginGetValue);
+ aPpf->setvalue = NewNPP_SetValueProc(SvgtPluginSetValue);
+
+ return NPERR_NO_ERROR;
+}
+
+EXPORT_C void NPP_Shutdown(void)
+{
+ CSvgtPluginEcomMain* npm = (CSvgtPluginEcomMain*) Dll :: Tls ();
+ delete npm;
+ Dll :: SetTls ( NULL );
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/SVGTPlugin/src/VolumeKeyListener.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,289 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: It completes on a change in the volume property. Used for
+* the new Central Repository Server. Used in EKA2 builds only
+*
+*/
+
+
+#include <eikapp.h>
+#include <aknconsts.h>
+#include <browseruisdkcrkeys.h>
+
+#include "VolumeKeyListener.h"
+#include "MRepositoryVolumeObserver.h"
+
+// CONSTANTS
+const TInt KFirstTimerExpiryInterval = 1; // Expire immediately
+const TInt KTimerExpiryInterval = KAknStandardKeyboardRepeatRate;
+
+const TInt KMinVolume = 0; // Minimum volume level(Mute)
+const TInt KMaxVolume = 10; // Maximum volume level
+
+// ----------------------------------------------------
+// CVolumeKeyListener::NewL
+// Description: static constructor.
+// Output: none
+// Return: CVolumeKeyListener object
+// ----------------------------------------------------
+CVolumeKeyListener* CVolumeKeyListener::NewL( MRepositoryVolumeObserver* aObserver )
+ {
+ CVolumeKeyListener* self = new(ELeave) CVolumeKeyListener(
+ aObserver);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+// ----------------------------------------------------
+// CVolumeKeyListener::CVolumeKeyListener
+// Description: constructor.
+// Output: none
+// Return: none
+// ----------------------------------------------------
+CVolumeKeyListener::CVolumeKeyListener( MRepositoryVolumeObserver* aObserver ):
+ iInterfaceSelector(NULL),
+ iSelector(NULL),
+ iCenRepos(NULL),
+ iObserver(aObserver)
+ {
+ }
+
+// ----------------------------------------------------
+// CVolumeKeyListener::ConstructL
+// Description: second phase constructor.
+// Input: aObserver: link to the calling object
+// Output: none
+// Return: none
+// ----------------------------------------------------
+void CVolumeKeyListener::ConstructL()
+ {
+ //
+ // Open a connection to receive Volume Key events.
+ iSelector = CRemConInterfaceSelector::NewL();
+ iInterfaceSelector = CRemConCoreApiTarget::NewL(*iSelector,*this);
+ TRAP_IGNORE(iSelector->OpenTargetL());
+ // Timer for implementing repeat
+ iTimer = CPeriodic::NewL(CActive::EPriorityStandard);
+
+ //
+ // Open a connection to the Central Repository...
+ iCenRepos = CRepository::NewL(KCRUidBrowser);
+ // iObservers=new(ELeave)CArrayFixSeg<MVolumePropertyWatchObserver*>
+ // (KVolumeObserversArrayGranularity);
+ }
+
+// ----------------------------------------------------
+// CVolumeKeyListener::~CVolumeKeyListener
+// Description: destructor.
+// Input: none
+// Output: none
+// ----------------------------------------------------
+CVolumeKeyListener::~CVolumeKeyListener()
+ {
+ if(iSelector)
+ {
+ delete iSelector;
+ iInterfaceSelector=NULL;
+ iSelector=NULL; //iSelector has been deleted by "delete iInterfaceSelector"
+ }
+
+ if(iTimer)
+ {
+ iTimer->Cancel();
+ delete iTimer;
+ }
+
+ if(iCenRepos)
+ {
+ delete iCenRepos;
+ }
+ }
+
+// ----------------------------------------------------
+// CVolumeKeyListener::SetObserver
+// Description: Used to set an observer
+// Input: aObserver: Point to observer
+// Output: none
+// Return: none
+// ----------------------------------------------------
+void CVolumeKeyListener::SetObserver( MRepositoryVolumeObserver* aObserver)
+ {
+ iObserver = aObserver;
+ }
+
+// ----------------------------------------------------
+// CVolumeKeyListener::GetCurrentVolume
+// Description: gets the current volume level from the
+// central directory.
+// Input: none
+// Output: none
+// Return: volume level
+// ----------------------------------------------------
+TInt CVolumeKeyListener::GetCurrentVolume()
+ {
+ TInt currentVolume = 0;
+ //
+ // Get the current volume
+ if(iCenRepos)
+ iCenRepos->Get(KBrowserMediaVolumeControl, currentVolume);
+
+/*
+ #if defined(__WINSCW__) //offset required on the emulator
+ currentVolume += WINS_DEFAULT_VOLUME;
+ #endif
+*/
+ return currentVolume;
+ }
+
+// ----------------------------------------------------
+// CVolumeKeyListener::MrccatoCommand
+// Description: A Volume key command has been received
+// (from MRemConCoreApiTargetObserver)
+// Input:aOperationId The operation ID of the command
+// aButtonAct The button action associated with the command.
+// Output: none
+// Return: none
+// ----------------------------------------------------
+void CVolumeKeyListener::MrccatoCommand(TRemConCoreApiOperationId aOperationId,
+ TRemConCoreApiButtonAction aButtonAct )
+ {
+
+ switch(aOperationId)
+ {
+ case ERemConCoreApiVolumeUp:
+ {
+ switch (aButtonAct)
+ {
+ case ERemConCoreApiButtonPress:
+ {
+ //Start Timer
+ if (!iTimer->IsActive())
+ {
+ iCommandId = EVolumeControlCmdVolumeUpByOne;
+ iTimer->Start(KFirstTimerExpiryInterval,
+ KTimerExpiryInterval,
+ TCallBack(TimerCallback, this));
+ }
+ break;
+ }
+ case ERemConCoreApiButtonRelease:
+ {
+ iTimer->Cancel();
+ break;
+ }
+ case ERemConCoreApiButtonClick:
+ {
+ FilterAndSendCommand(EVolumeControlCmdVolumeUpByOne);
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ break;
+ }
+ case ERemConCoreApiVolumeDown:
+ {
+ switch (aButtonAct)
+ {
+ case ERemConCoreApiButtonPress:
+ {
+ //Start Timer
+ iCommandId = EVolumeControlCmdVolumeDownByOne;
+ if (!iTimer->IsActive())
+ {
+ iTimer->Start(KFirstTimerExpiryInterval,
+ KTimerExpiryInterval,
+ TCallBack(TimerCallback, this));
+ }
+ break;
+ }
+ case ERemConCoreApiButtonRelease:
+ {
+ iTimer->Cancel();
+ break;
+ }
+ case ERemConCoreApiButtonClick:
+ {
+ FilterAndSendCommand(EVolumeControlCmdVolumeDownByOne);
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------
+// CVolumeKeyListener::HandleRepeatEvent
+// -----------------------------------------------------------------------
+//
+void CVolumeKeyListener::HandleRepeatEvent()
+ {
+ FilterAndSendCommand(iCommandId);
+ }
+
+// -----------------------------------------------------------------------
+// CVolumeKeyListener::TimerCallback
+// -----------------------------------------------------------------------
+//
+TInt CVolumeKeyListener::TimerCallback(TAny* aPtr)
+ {
+ static_cast<CVolumeKeyListener*>(aPtr)->HandleRepeatEvent();
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------
+// CVolumeKeyListener::FilterAndSendCommand
+// -----------------------------------------------------------------------
+//
+void CVolumeKeyListener::FilterAndSendCommand(TInt aCommandId)
+ {
+ TInt currentVolume = 0;
+
+ iCenRepos->Get(KBrowserMediaVolumeControl,currentVolume);
+ switch(aCommandId)
+ {
+ case EVolumeControlCmdVolumeUpByOne:
+ currentVolume=(currentVolume< KMaxVolume)? ++currentVolume : KMaxVolume;
+ break;
+ case EVolumeControlCmdVolumeDownByOne:
+ currentVolume=(currentVolume> KMinVolume)? --currentVolume : KMinVolume;
+ break;
+ default:
+ break;
+ }
+
+ iCenRepos->Set(KBrowserMediaVolumeControl,currentVolume);
+
+#if defined(__WINS__) //offset required on the emulator
+ currentVolume += WINS_DEFAULT_VOLUME;
+#endif
+
+ if(iObserver)
+ iObserver->VolumeChanged(currentVolume);
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/Doc/Instructions.txt Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,15 @@
+VGRenderer is the interface class which interfaces with the underlying 3 renderer classes - TLV , Software and Hardware renderers.
+
+TLV Renderer Class - This class captures the openvg command sequence into a encoded form of TLV(Type-Length-Value)command buffer and fills
+into an Extended CFbsBitmap. This extended bitmap is returned back to the calling method. It would be redundant to mention that TLV renderer class
+doesnot interface with Openvg or EGL in any form.
+
+Software Renderer class - Traditional software renderer which interfaces with Openvg and renders content using software renderer.Makes use of
+VG and VGI calls for its job.
+
+Harware Renderer Class - Hardware renderer which makes use of hardware openvg APIs in combination with EGL APIs.The context information is created
+and maintained by egl in this case.Please look out for the TRUE return value of any egl function(eglcreate..eglget) as eglGetError might return an
+EGL_SUCCESS even if an egl function returns FALSE.
+
+EGL and Openvg have to be compiled before compiling VGRenderer
+VGRenderer has to be compiled before compiling SVGEngine or AknIcon.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/HWVG/bwins/HWVG.def Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+ ?CreateVGRendererImplL@@YAPAVMVGRendererImpl@@XZ @ 1 NONAME ; class MVGRendererImpl * CreateVGRendererImplL(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/HWVG/eabi/HWVG.def Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,9 @@
+EXPORTS
+ _Z21CreateVGRendererImplLv @ 1 NONAME
+ _ZTI15COpenVGRenderer @ 2 NONAME ; #<TI>#
+ _ZTI16CHWVGSurfaceImpl @ 3 NONAME ; #<TI>#
+ _ZTI21CHWOpenVGRendererImpl @ 4 NONAME ; #<TI>#
+ _ZTV15COpenVGRenderer @ 5 NONAME ; #<VT>#
+ _ZTV16CHWVGSurfaceImpl @ 6 NONAME ; #<VT>#
+ _ZTV21CHWOpenVGRendererImpl @ 7 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/HWVG/group/HWVG.mmp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+MACRO HWRENDERER DEBUG_RENDERER
+TARGET hwvg.dll
+TARGETTYPE dll
+UID 0x1000008d 0x09AE7FEA
+
+USERINCLUDE ../inc ../../inc ../../OpenVGRenderer/inc
+
+SYSTEMINCLUDE /epoc32/include/middleware /epoc32/include/vg /epoc32/include +/include/osextensions +/include/domain/osextensions
+
+SOURCEPATH ../src ../../OpenVGRenderer/src
+
+SOURCE HWVGDllMain.cpp HWOpenVGRendererImpl.cpp ../../OpenVGRenderer/src/OpenVGRenderer.cpp HWVGSurfaceImpl.cpp
+
+
+//By default, the build tools look for the WINSCW def file in a BWINS directory
+//(at the same level as the directory containing the mmp file),
+//the GCC ARM def file in a BMARM directory, and the ARMV5 def file in a EABI directory.
+//If def files are stored in these locations, the project files does not need to specify
+//the location of the def files explicitly. If you want to store the def files in some other
+//location, you will need to specify in the project file where the .def files are using
+//the deffile keyword.
+
+//The following commented out code shows how the build system uses the implicit
+// location for defiles. To create the DEF files Choose Project > Freeze Exports from Carbide
+// or run 'abld freeze' from the command-line
+//#if defined (WINS)
+// DEFFILE ../bwins/HWVG.def
+//#elif defined (GCC32)
+// DEFFILE ../bmarm/HWVG.def
+//#else
+// DEFFILE ../eabi/HWVG.def
+//#endif
+
+nostrictdef
+
+LIBRARY euser.lib
+LIBRARY avkon.lib fbscli.lib efsrv.lib
+LIBRARY ws32.lib gdi.lib
+
+// mixedcase exception
+LIBRARY libEGL.lib libOpenVG.lib libOpenVGU.lib
+
+#ifdef ENABLE_ABIV2_MODE
+DEBUGGABLE
+#endif
+
+CAPABILITY CAP_GENERAL_DLL
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/HWVG/inc/HWOpenVGRendererImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CHWOpenVGRendererImpl header file
+ *
+*/
+
+#ifndef HWOPENVGRENDERERIMPL_H_
+#define HWOPENVGRENDERERIMPL_H_
+
+#include "HWVG.h"
+#include "OpenVGRenderer.h"
+
+class CHWOpenVGRendererImpl : public COpenVGRenderer
+ {
+ static const TUint KMAJOR_VERSION;
+ static const TUint KMINOR_VERSION;
+ static const TUint KBUILD_VERSION;
+public:
+ static CHWOpenVGRendererImpl* NewL();
+ static CHWOpenVGRendererImpl* NewLC();
+ ~CHWOpenVGRendererImpl();
+
+public:
+ TVersion Version() const;
+
+ virtual TVersion GetVersion() const;
+ virtual const TDesC GetName() const;
+
+public:
+
+ virtual void ToggleReset();
+
+ virtual MVGSurfaceImpl* CreateVGSurfaceL(TInt aOption);
+
+private:
+ CHWOpenVGRendererImpl();
+ void ConstructL();
+ };
+
+#endif /*HWOPENVGRENDERERIMPL_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/HWVG/inc/HWVG.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: HWVG header file
+ *
+*/
+
+// This file defines the API for HWVG.dll
+
+#ifndef __HWVG_H__
+#define __HWVG_H__
+
+// Include Files
+
+#include <e32base.h>
+#include <e32std.h>
+
+#endif // __HWVG_H__
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/HWVG/inc/HWVG.pan Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef __HWVG_PAN__
+#define __HWVG_PAN__
+
+// Data Types
+
+enum THWVGPanic
+ {
+ EHWVGNullPointer
+ };
+
+// Function Prototypes
+
+GLREF_C void Panic(THWVGPanic aPanic);
+
+#endif // __HWVG_PAN__
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/HWVG/inc/HWVGSurfaceImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CHWVGSurfaceImpl header file
+ *
+*/
+
+#ifndef HWVGSURFACEIMPL_H_
+#define HWVGSURFACEIMPL_H_
+
+#include <e32base.h>
+
+#include "MVGSurfaceImpl.h"
+
+#ifdef HWRENDERER
+#include <EGL\egl.h>
+#endif
+
+class CHWVGSurfaceImpl : public CBase, public MVGSurfaceImpl
+{
+public:
+ enum HWSurfaceType
+ {
+ SURFACE_PBUFFER = 0,
+ SURFACE_WINDOW = 1,
+ SURFACE_PIXMAP = 2
+ };
+public:
+ static CHWVGSurfaceImpl* NewL(TUint8 aOption);
+ static CHWVGSurfaceImpl* NewLC(TUint8 aOption);
+
+ virtual ~CHWVGSurfaceImpl();
+
+ virtual TInt InitializeSurface(TSize aSize, TInt aColorSpace);
+
+ virtual TInt CreateSurface(TInt aDisplayMode, RWindow *aSurface, CFbsBitmap *aBitmap);
+
+ virtual TInt ResizeSurface(TSize aSize);
+
+ virtual TInt CopyBitmap(TInt aDisplayMode,TInt aMaskMode, CFbsBitmap *aBitmap, CFbsBitmap *aMask, TSize aSize = TSize(0,0));
+
+ virtual TInt PrepareToBindClientBuffer();
+ virtual TInt BindClientBuffer(TInt buffer);
+
+ virtual TInt UnBindClientBuffer();
+
+ virtual void TerminateSurface();
+
+ virtual void SetConfiguration(TInt aOption, const TAny* aValue);
+
+
+private:
+ CHWVGSurfaceImpl(TUint8 aOption);
+ void ConstructL();
+ TInt CreatePBufferSurface();
+ TInt MapEGLErrorCodeToSymbian(TInt aErrorCode);
+
+ TUint8 iSurfaceType;
+ TSize iSize;
+#ifdef HWRENDERER
+ EGLDisplay iEglDisplay;
+ EGLSurface iEglSurface;
+ EGLSurface iEglPBufferSurface_Client;
+ EGLContext iEglContext;
+ EGLConfig iConfig;
+#endif
+};
+
+#endif /*HWVGSURFACEIMPL_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/HWVG/src/HWOpenVGRendererImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CHWOpenVGRendererImpl source file
+ *
+*/
+
+#include "HWOpenVGRendererImpl.h"
+#include "HWVGSurfaceImpl.h"
+
+#include <vg/vgu.h>
+
+const TUint CHWOpenVGRendererImpl::KMAJOR_VERSION = 1;
+const TUint CHWOpenVGRendererImpl::KMINOR_VERSION = 0;
+const TUint CHWOpenVGRendererImpl::KBUILD_VERSION = 1;
+
+EXPORT_C MVGRendererImpl* CreateVGRendererImplL()
+ {
+ return CHWOpenVGRendererImpl::NewL();
+ }
+
+
+CHWOpenVGRendererImpl::CHWOpenVGRendererImpl()
+ {
+ }
+
+CHWOpenVGRendererImpl::~CHWOpenVGRendererImpl()
+ {
+ }
+
+CHWOpenVGRendererImpl* CHWOpenVGRendererImpl::NewLC()
+ {
+ CHWOpenVGRendererImpl* self = new (ELeave) CHWOpenVGRendererImpl;
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+CHWOpenVGRendererImpl* CHWOpenVGRendererImpl::NewL()
+ {
+ CHWOpenVGRendererImpl* self = CHWOpenVGRendererImpl::NewLC();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+inline void CHWOpenVGRendererImpl::ConstructL()
+ {
+ }
+
+
+TVersion CHWOpenVGRendererImpl::Version() const
+ {
+ return TVersion(KMAJOR_VERSION, KMINOR_VERSION, KBUILD_VERSION);
+ }
+
+TVersion CHWOpenVGRendererImpl::GetVersion() const
+ {
+ return TVersion(KMAJOR_VERSION, KMINOR_VERSION, KBUILD_VERSION);
+ }
+
+const TDesC CHWOpenVGRendererImpl::GetName() const
+ {
+ _LIT(KHWVGRenderer, "HWVGRenderer");
+ return KHWVGRenderer;
+ }
+
+void CHWOpenVGRendererImpl::ToggleReset()
+ {
+ }
+
+
+MVGSurfaceImpl* CHWOpenVGRendererImpl::CreateVGSurfaceL(TInt aOption)
+ {
+ return CHWVGSurfaceImpl::NewL(aOption);
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/HWVG/src/HWVGDllMain.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: HWVGDllMain Source file
+ *
+*/
+
+// Include Files
+
+#include <e32std.h> // GLDEF_C
+#include "HWVG.pan" // panic codes
+
+class MVGRendererImpl;
+
+IMPORT_C MVGRendererImpl* CreateVGRendererImplL();
+
+#ifndef EKA2 // for EKA1 only
+EXPORT_C TInt E32Dll(TDllReason /*aReason*/)
+// Called when the DLL is loaded and unloaded. Note: have to define
+// epoccalldllentrypoints in MMP file to get this called in THUMB.
+
+ {
+ return KErrNone;
+ }
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/HWVG/src/HWVGSurfaceImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,353 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CHWVGSurfaceImpl source file
+ *
+*/
+
+#include <eikenv.h>
+
+#ifdef DEBUG_RENDERER
+#include <e32debug.h>
+#endif
+
+#include "HWVGSurfaceImpl.h"
+
+CHWVGSurfaceImpl::CHWVGSurfaceImpl(TUint8 aOption)
+ : iSurfaceType (aOption)
+ {
+#ifdef HWRENDERER
+ iEglDisplay = EGL_NO_DISPLAY;
+ iEglSurface = EGL_NO_SURFACE;
+ iEglPBufferSurface_Client = EGL_NO_SURFACE;
+ iEglContext = EGL_NO_CONTEXT;
+#endif
+ }
+
+CHWVGSurfaceImpl::~CHWVGSurfaceImpl()
+ {
+ }
+
+inline void CHWVGSurfaceImpl::ConstructL()
+ {
+ }
+
+CHWVGSurfaceImpl* CHWVGSurfaceImpl::NewL(TUint8 aOption)
+ {
+ CHWVGSurfaceImpl* self = CHWVGSurfaceImpl::NewLC(aOption);
+ CleanupStack::Pop();
+ return self;
+ }
+
+CHWVGSurfaceImpl* CHWVGSurfaceImpl::NewLC(TUint8 aOption)
+ {
+ CHWVGSurfaceImpl* self = new (ELeave)CHWVGSurfaceImpl(aOption);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+TInt CHWVGSurfaceImpl::MapEGLErrorCodeToSymbian(TInt aErrorCode)
+ {
+ switch (aErrorCode)
+ {
+ case EGL_SUCCESS:
+ return KErrNone;
+ case EGL_NOT_INITIALIZED:
+ return KErrNotReady;
+ case EGL_BAD_ACCESS:
+ return KErrPermissionDenied;
+ case EGL_BAD_ALLOC:
+ return KErrNoMemory;
+ case EGL_BAD_CONTEXT:
+ case EGL_BAD_CURRENT_SURFACE:
+ case EGL_BAD_DISPLAY:
+ case EGL_BAD_SURFACE:
+ case EGL_BAD_NATIVE_PIXMAP:
+ case EGL_BAD_NATIVE_WINDOW:
+ case EGL_CONTEXT_LOST:
+ return KErrBadHandle;
+ case EGL_BAD_CONFIG:
+ case EGL_BAD_PARAMETER:
+ case EGL_BAD_MATCH:
+ case EGL_BAD_ATTRIBUTE:
+ return KErrArgument;
+ default:
+ return KErrUnknown;
+ }
+ }
+
+TInt CHWVGSurfaceImpl::InitializeSurface(TSize aSize, TInt /*aColorSpace*/)
+ {
+#ifdef HWRENDERER
+ if((aSize.iWidth==iSize.iWidth) && (aSize.iHeight==iSize.iHeight))
+ {
+ return 0;
+ }
+
+ if (iSurfaceType == SURFACE_PBUFFER)
+ {
+ iSize = aSize;
+ iEglDisplay = eglGetDisplay( EGL_DEFAULT_DISPLAY );
+ if ( iEglDisplay == EGL_NO_DISPLAY )
+ {
+ return MapEGLErrorCodeToSymbian(eglGetError());
+ }
+ if ( eglInitialize( iEglDisplay, 0, 0 ) == EGL_FALSE )
+ {
+ return MapEGLErrorCodeToSymbian(eglGetError());
+ }
+ if ( eglBindAPI(EGL_OPENVG_API) == EGL_FALSE)
+ {
+ return MapEGLErrorCodeToSymbian(eglGetError());
+ }
+ }
+ else
+ {
+ return KErrNotSupported;
+ }
+ return KErrNone;
+#else
+ return KErrNotSupported;
+#endif
+ }
+
+void CHWVGSurfaceImpl::SetConfiguration(TInt /*aOption*/, const TAny* /*aValue*/)
+ {
+ //TODO
+ }
+
+TInt CHWVGSurfaceImpl::CreateSurface(TInt aDisplayMode, RWindow */*aSurface*/, CFbsBitmap *aBitmap)
+ {
+#ifdef HWRENDERER
+ if (iSurfaceType == SURFACE_PBUFFER)
+ {
+ EGLConfig *configList = 0;
+ EGLint numOfConfigs = 0;
+ EGLint configSize = 0;
+
+ if ( eglGetConfigs( iEglDisplay, configList, configSize, &numOfConfigs ) == EGL_FALSE )
+ {
+ return MapEGLErrorCodeToSymbian(eglGetError());
+ }
+
+ configSize = numOfConfigs;
+
+ configList = (EGLConfig*) User::Alloc( sizeof(EGLConfig)*configSize );
+ if ( configList == NULL )
+ {
+ return MapEGLErrorCodeToSymbian(eglGetError());
+ }
+
+
+ TInt BufferSize = TDisplayModeUtils::NumDisplayModeBitsPerPixel(EColor16MA);// / 8;
+
+/* const EGLint attribList[] =
+ {
+ EGL_BUFFER_SIZE, BufferSize,
+ EGL_RED_SIZE, 5,
+ EGL_GREEN_SIZE, 6,
+ EGL_BLUE_SIZE, 5,
+ EGL_ALPHA_SIZE, 0,
+ EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
+ EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
+ EGL_NONE
+ };
+*/
+
+ const EGLint attribList[] = {
+ EGL_RENDERABLE_TYPE,EGL_OPENVG_BIT,
+ EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
+ EGL_RED_SIZE, 8,
+ EGL_GREEN_SIZE, 8,
+ EGL_BLUE_SIZE, 8,
+ EGL_ALPHA_SIZE, 8,
+ EGL_NONE
+ };
+
+ if ( eglChooseConfig( iEglDisplay, attribList, configList, configSize,
+ &numOfConfigs ) == EGL_FALSE )
+ {
+ User::Free( configList );
+ return MapEGLErrorCodeToSymbian(eglGetError());
+ }
+
+ iConfig = configList[0];
+ User::Free( configList );
+
+ if ( aBitmap != 0 )
+ {
+ iSize = aBitmap->SizeInPixels();
+ }
+
+ return CreatePBufferSurface();
+ }
+ else
+ {
+ return KErrNotSupported;
+ }
+#else
+ return KErrNotSupported;
+#endif
+ }
+
+TInt CHWVGSurfaceImpl::CreatePBufferSurface()
+ {
+#ifdef HWRENDERER
+ const EGLint attribList[] = { EGL_WIDTH,
+ iSize.iWidth,
+ EGL_HEIGHT,
+ iSize.iHeight,
+ EGL_NONE };
+
+ iEglSurface = eglCreatePbufferSurface( iEglDisplay, iConfig, attribList );
+ if (iEglSurface == EGL_NO_SURFACE)
+ {
+ return MapEGLErrorCodeToSymbian(eglGetError());
+ }
+
+ if (iEglContext == EGL_NO_CONTEXT)
+ {
+ iEglContext = eglCreateContext( iEglDisplay, iConfig, EGL_NO_CONTEXT, NULL );
+ }
+
+ if (iEglContext == EGL_NO_CONTEXT)
+ {
+ return MapEGLErrorCodeToSymbian(eglGetError());
+ }
+ if ( eglMakeCurrent( iEglDisplay, iEglSurface, iEglSurface, iEglContext ) == EGL_FALSE )
+ {
+ return MapEGLErrorCodeToSymbian(eglGetError());
+ }
+ return KErrNone;
+#else
+ return KErrNotSupported;
+#endif
+ }
+
+TInt CHWVGSurfaceImpl::ResizeSurface(TSize aSize)
+ {
+#ifdef HWRENDERER
+ if((aSize.iWidth==iSize.iWidth) && (aSize.iHeight==iSize.iHeight))
+ return KErrNone;
+
+ if (iSurfaceType == SURFACE_PBUFFER)
+ {
+ if (iEglDisplay)
+ {
+ eglMakeCurrent( iEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
+ eglDestroySurface( iEglDisplay, iEglSurface );
+ //eglDestroyContext( iEglDisplay, iEglContext );
+ }
+
+ iSize = aSize;
+ return CreatePBufferSurface();
+ }
+ else
+ {
+ return KErrNotSupported;
+ }
+#else
+ return KErrNotSupported;
+#endif
+ }
+
+TInt CHWVGSurfaceImpl::CopyBitmap(TInt /*aDisplayMode*/,TInt aMaskMode, CFbsBitmap *aBitmap, CFbsBitmap */*aMask*/, TSize /*BmpSize*/)
+ {
+#ifdef HWRENDERER
+ if (iSurfaceType == SURFACE_PBUFFER)
+ {
+ eglCopyBuffers( iEglDisplay, iEglSurface, aBitmap );
+ }
+#endif
+ }
+
+TInt CHWVGSurfaceImpl::PrepareToBindClientBuffer()
+ {
+ return KErrNone;
+ }
+
+
+
+TInt CHWVGSurfaceImpl::BindClientBuffer(TInt buffer)
+ {
+#ifdef HWRENDERER
+ iEglPBufferSurface_Client = eglCreatePbufferFromClientBuffer(iEglDisplay, EGL_OPENVG_IMAGE, buffer, iConfig, 0);
+
+ if (iEglPBufferSurface_Client == EGL_NO_SURFACE)
+ {
+#ifdef DEBUG_RENDERER
+ RDebug::Print(_L("eglCreatePbufferFromClientBuffer Failed %x "), eglGetError());
+#endif
+ return KErrGeneral;
+ }
+
+ eglMakeCurrent( iEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
+ if ( eglMakeCurrent( iEglDisplay, iEglPBufferSurface_Client, iEglPBufferSurface_Client, iEglContext ) == EGL_FALSE )
+ {
+
+#ifdef DEBUG_RENDERER
+ RDebug::Print(_L("eglMakeCurrent Failed %x "), eglGetError());
+#endif
+ return KErrGeneral;
+ }
+
+#endif
+ return KErrNone;
+ }
+
+
+
+TInt CHWVGSurfaceImpl::UnBindClientBuffer()
+ {
+#ifdef HWRENDERER
+
+ eglMakeCurrent( iEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
+
+ if (iEglPBufferSurface_Client)
+ {
+ eglDestroySurface( iEglDisplay, iEglPBufferSurface_Client );
+ iEglPBufferSurface_Client = EGL_NO_SURFACE;
+ }
+
+ if ( eglMakeCurrent( iEglDisplay, iEglSurface, iEglSurface, iEglContext ) == EGL_FALSE )
+ {
+ return KErrGeneral;
+ }
+#endif
+ return KErrNone;
+ }
+
+
+
+void CHWVGSurfaceImpl::TerminateSurface()
+ {
+#ifdef HWRENDERER
+ if (iEglDisplay != EGL_NO_DISPLAY)
+ {
+ eglMakeCurrent( iEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
+ if (iEglSurface)
+ {
+ eglDestroySurface( iEglDisplay, iEglSurface );
+ }
+
+ if (iEglContext)
+ {
+ eglDestroyContext( iEglDisplay, iEglContext );
+ }
+
+ eglTerminate( iEglDisplay );
+ iEglDisplay = EGL_NO_DISPLAY;
+ }
+#endif
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/OpenVGRenderer/inc/OpenVGRenderer.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: COpenVGRenderer header file
+ *
+*/
+
+#ifndef __OPENVGRENDERER_H__
+#define __OPENVGRENDERER_H__
+
+#include <e32base.h>
+#include <e32std.h>
+
+#include "MVGRendererImpl.h"
+
+
+class COpenVGRenderer : public CBase, public MVGRendererImpl
+ {
+public:
+ ~COpenVGRenderer(){}
+ COpenVGRenderer() {}
+
+public:
+ virtual void vgClear(TInt x, TInt y, TInt width, TInt height);
+ virtual void vgSeti(TInt type, TInt value);
+ virtual void vgSetf (TInt type, TReal32 value);
+ virtual void vgSetfv(TInt type, TInt count, const TReal32 * values);
+ virtual void vgSetiv(TInt type, TInt count, const TInt * values);
+ virtual void vgSetParameteri(TUint handle, TInt paramType, TInt value);
+ virtual void vgSetParameterf(TUint handle,TInt paramType,TReal32 value);
+ virtual void vgSetParameterfv(TUint object,TInt paramType,TInt count, const TReal32 * values);
+ virtual TInt vgGeti(TInt type);
+
+
+ virtual void vgSetColor(TUint paint, TUint rgba);
+ virtual void vgSetPaint(TUint paint, TUint paintModes);
+ virtual TUint vgCreatePaint();
+ virtual TUint vgCreatePath(TInt pathFormat, TInt datatype, TReal32 scale, TReal32 bias,
+ TInt segmentCapacityHint, TInt coordCapacityHint, TInt capabilities);
+
+ virtual void vgLoadMatrix(const TReal32 * m);
+ virtual void vgMultMatrix(const TReal32 * m);
+ virtual void vgLoadIdentity();
+ virtual void vgScale(TReal32 sx, TReal32 sy);
+ virtual void vgRotate(TReal32 angle);
+ virtual void vgTranslate(TReal32 tx, TReal32 ty);
+ virtual void vgReadPixels(void * data, TInt dataStride,TInt dataFormat,TInt sx, TInt sy,TInt width, TInt height);
+ void vgWritePixels(const void * data, TInt dataStride, TInt dataFormat,
+ TInt dx, TInt dy, TInt width, TInt height);
+
+ virtual void vgAppendPathData(TUint path,TInt numSegments,
+ const TUint8 * pathSegments,
+ const void * pathData);
+
+ virtual void vgDrawPath(TUint path, TUint paintModes);
+ virtual void vgClearPath(TUint path, TUint capabilities);
+
+ virtual TInt vguRect(TUint path, TReal32 x, TReal32 y,
+ TReal32 width, TReal32 height);
+
+ virtual TInt vguEllipse(TUint path, TReal32 cx, TReal32 cy,
+ TReal32 width, TReal32 height);
+
+ virtual TInt vguRoundRect(TUint path, TReal32 x, TReal32 y,
+ TReal32 width, TReal32 height, TReal32 arcWidth, TReal32 arcHeight);
+ virtual TInt vguLine(TUint path,TReal32 x0, TReal32 y0,TReal32 x1, TReal32 y1);
+ virtual void DumpToLogFile();
+ virtual void CloseLogFile();
+ virtual TUint vgCreateImage(TInt format, TInt width, TInt height, TInt allowedQuality);
+ virtual void vgGetPixels(TUint dst, TInt dx, TInt dy, TInt sx, TInt sy, TInt width, TInt height);
+ virtual void vgDrawImage(TUint image);
+
+
+ virtual void vgClearImage(TUint image, TInt x, TInt y, TInt width, TInt height);
+
+ virtual void vgImageSubData(TUint image, const void * data, TInt dataStride,
+ TInt dataFormat, TInt x, TInt y, TInt width, TInt height);
+
+
+ virtual void vgMask(TUint mask, TInt operation, TInt x, TInt y, TInt width, TInt height);
+
+ virtual void vgDestroyImage(TUint aHandle);
+ virtual void vgDestroyPaint(TUint aHandle);
+ virtual void vgDestroyPath(TUint aHandle);
+
+ virtual void vgFlush();
+ virtual TInt vgGetError();
+ //Dummy added for getting TLV data from pseudorenderer.
+ virtual const TPtrC8 TLVEncodedData() const;
+
+ };
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/OpenVGRenderer/src/OpenVGRenderer.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,235 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: COpenVGRenderer source file
+ *
+*/
+
+#include "OpenVGRenderer.h"
+
+#include <VG/vgu.h>
+
+#include <e32debug.h>
+void COpenVGRenderer::vgClear(TInt x, TInt y, TInt width, TInt height)
+ {
+ ::vgClear(x, y, width, height);
+ }
+
+void COpenVGRenderer::vgSeti(TInt type, TInt value)
+ {
+ ::vgSeti((VGParamType)type, value);
+ }
+TInt COpenVGRenderer::vgGeti(TInt type)
+ {
+ return ::vgGeti((VGParamType)type);
+ }
+
+void COpenVGRenderer::vgSetf (TInt type, TReal32 value)
+ {
+ ::vgSetf((VGParamType)type, value);
+ }
+void COpenVGRenderer::vgSetiv(TInt type, TInt count, const TInt * values)
+ {
+ ::vgSetiv((VGParamType)type, count, (const VGint*)values);
+ }
+
+void COpenVGRenderer::vgSetfv(TInt type, TInt count, const TReal32 * values)
+ {
+ ::vgSetfv((VGParamType)type, count, values);
+ }
+
+void COpenVGRenderer::vgSetParameteri(TUint handle, TInt paramType, TInt value)
+ {
+ ::vgSetParameteri(handle, paramType, value);
+ }
+
+void COpenVGRenderer::vgSetParameterf(TUint handle, TInt paramType, TReal32 value)
+ {
+ ::vgSetParameterf(handle, paramType, value);
+ }
+
+void COpenVGRenderer::vgSetParameterfv(TUint object, TInt paramType, TInt count, const TReal32 * values)
+ {
+ ::vgSetParameterfv(object, paramType, count, values);
+ }
+
+void COpenVGRenderer::vgSetColor(TUint paint, TUint rgba)
+ {
+ ::vgSetColor(paint, rgba);
+ }
+
+void COpenVGRenderer::vgSetPaint(TUint paint, TUint paintModes)
+ {
+ ::vgSetPaint(paint, paintModes);
+ }
+
+TUint COpenVGRenderer::vgCreatePaint()
+ {
+ return ::vgCreatePaint();
+ }
+
+TUint COpenVGRenderer::vgCreatePath(TInt pathFormat, TInt datatype, TReal32 scale, TReal32 bias,
+ TInt segmentCapacityHint, TInt coordCapacityHint, TInt capabilities)
+ {
+ return ::vgCreatePath(pathFormat, (VGPathDatatype)datatype, scale, bias, segmentCapacityHint, coordCapacityHint, capabilities);
+ }
+
+void COpenVGRenderer::vgLoadMatrix(const TReal32 * m)
+ {
+ ::vgLoadMatrix(m);
+ }
+
+void COpenVGRenderer::vgMultMatrix(const TReal32 * m)
+ {
+ ::vgMultMatrix(m);
+ }
+
+void COpenVGRenderer::vgLoadIdentity()
+ {
+ ::vgLoadIdentity();
+ }
+
+void COpenVGRenderer::vgScale(TReal32 sx, TReal32 sy)
+ {
+ ::vgScale(sx, sy);
+ }
+
+void COpenVGRenderer::vgRotate(TReal32 angle)
+ {
+ ::vgRotate(angle);
+ }
+void COpenVGRenderer::vgReadPixels(void * data, TInt dataStride,TInt dataFormat,TInt sx, TInt sy,TInt width, TInt height)
+ {
+ ::vgReadPixels(data,dataStride,(VGImageFormat)dataFormat,sx,sy,width,height);
+ }
+
+void COpenVGRenderer::vgWritePixels(const void * data, TInt dataStride, TInt dataFormat,
+ TInt dx, TInt dy, TInt width, TInt height)
+ {
+ ::vgWritePixels(data, dataStride, (VGImageFormat)dataFormat, dx, dy, width, height);
+ }
+
+void COpenVGRenderer::vgTranslate(TReal32 tx, TReal32 ty)
+ {
+ ::vgTranslate(tx, ty);
+ }
+
+void COpenVGRenderer::vgAppendPathData(TUint path, TInt numSegments,
+ const TUint8 * pathSegments,
+ const void * pathData)
+ {
+ ::vgAppendPathData(path, numSegments, pathSegments, pathData);
+ }
+
+void COpenVGRenderer::vgDrawPath(TUint path, TUint paintModes)
+ {
+ ::vgDrawPath(path, paintModes);
+ }
+
+void COpenVGRenderer::vgClearPath(TUint path, TUint capabilities)
+ {
+ ::vgClearPath(path, capabilities);
+ }
+
+TInt COpenVGRenderer::vguRect(TUint path, TReal32 x, TReal32 y,
+ TReal32 width, TReal32 height)
+ {
+ return ::vguRect(path, x, y, width, height);
+ }
+
+ TInt COpenVGRenderer::vguEllipse(TUint path,
+ TReal32 cx, TReal32 cy,
+ TReal32 width, TReal32 height)
+ {
+ return ::vguEllipse(path, cx, cy, width, height);
+ }
+
+TInt COpenVGRenderer::vguRoundRect(TUint path, TReal32 x, TReal32 y,
+ TReal32 width, TReal32 height, TReal32 arcWidth, TReal32 arcHeight)
+ {
+ return ::vguRoundRect(path, x, y, width, height, arcWidth, arcHeight);
+ }
+
+TInt COpenVGRenderer::vguLine(TUint path, TReal32 x0, TReal32 y0, TReal32 x1, TReal32 y1)
+ {
+ return ::vguLine(path, x0, y0, x1, y1);
+ }
+
+void COpenVGRenderer::DumpToLogFile()
+ {
+// Nothing TO DO here
+ }
+void COpenVGRenderer::CloseLogFile()
+ {
+// Nothing TO DO here
+ }
+
+TUint COpenVGRenderer::vgCreateImage(TInt format, TInt width, TInt height, TInt allowedQuality)
+ {
+ return ::vgCreateImage((VGImageFormat)format, width, height, allowedQuality);
+ }
+
+void COpenVGRenderer::vgGetPixels(TUint dst, TInt dx, TInt dy, TInt sx, TInt sy, TInt width, TInt height)
+ {
+ ::vgGetPixels(dst, dx, dy, sx, sy, width, height);
+ }
+
+void COpenVGRenderer::vgDrawImage(TUint image)
+ {
+ ::vgDrawImage(image);
+ }
+
+void COpenVGRenderer::vgClearImage(TUint image, TInt x, TInt y, TInt width, TInt height)
+ {
+ return ::vgClearImage(image, x, y, width, height);
+ }
+
+void COpenVGRenderer::vgImageSubData(TUint image, const void * data, TInt dataStride,
+ TInt dataFormat, TInt x, TInt y, TInt width, TInt height)
+ {
+ return ::vgImageSubData(image, data, dataStride, (VGImageFormat)dataFormat, x, y, width, height);
+ }
+
+void COpenVGRenderer::vgMask(TUint mask, TInt operation, TInt x, TInt y, TInt width, TInt height)
+ {
+ return ::vgMask(mask, (VGMaskOperation)operation, x, y, width, height);
+ }
+
+void COpenVGRenderer::vgDestroyImage(TUint aHandle)
+ {
+ ::vgDestroyImage(aHandle);
+ }
+
+void COpenVGRenderer::vgDestroyPaint(TUint aHandle)
+ {
+ ::vgDestroyPaint(aHandle);
+ }
+
+void COpenVGRenderer::vgDestroyPath(TUint aHandle)
+ {
+ ::vgDestroyPath(aHandle);
+ }
+
+void COpenVGRenderer::vgFlush()
+ {
+ ::vgFlush();
+ }
+
+TInt COpenVGRenderer::vgGetError()
+ {
+ return ::vgGetError();
+ }
+const TPtrC8 COpenVGRenderer::TLVEncodedData() const
+ {
+ return TPtrC8();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/PseudoVG/bwins/PseudoVG.def Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+ ?CreateVGRendererImplL@@YAPAVMVGRendererImpl@@XZ @ 1 NONAME ; class MVGRendererImpl * CreateVGRendererImplL(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/PseudoVG/eabi/PseudoVG.def Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,7 @@
+EXPORTS
+ _Z21CreateVGRendererImplLv @ 1 NONAME
+ _ZTI20CPseudoVGSurfaceImpl @ 2 NONAME ; #<TI>#
+ _ZTI21CPseodoVGRendererImpl @ 3 NONAME ; #<TI>#
+ _ZTV20CPseudoVGSurfaceImpl @ 4 NONAME ; #<VT>#
+ _ZTV21CPseodoVGRendererImpl @ 5 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/PseudoVG/group/PseudoVG.mmp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET pseudovg.dll
+TARGETTYPE dll
+UID 0x1000008d 0x06D64B59
+VENDORID VID_DEFAULT
+
+USERINCLUDE ../inc ../../inc
+SYSTEMINCLUDE /epoc32/include /epoc32/include/VG
+
+SOURCEPATH ../src
+
+SOURCE PseudoVGDllMain.cpp PseodoVGRendererImpl.cpp PseudoVGSurfaceImpl.cpp
+//PTFloatFixPt.cpp
+
+//By default, the build tools look for the WINSCW def file in a BWINS directory
+//(at the same level as the directory containing the mmp file),
+//the GCC ARM def file in a BMARM directory, and the ARMV5 def file in a EABI directory.
+//If def files are stored in these locations, the project files does not need to specify
+//the location of the def files explicitly. If you want to store the def files in some other
+//location, you will need to specify in the project file where the .def files are using
+//the deffile keyword.
+
+//The following commented out code shows how the build system uses the implicit
+// location for defiles. To create the DEF files Choose Project > Freeze Exports from Carbide
+// or run 'abld freeze' from the command-line
+
+MW_LAYER_SYSTEMINCLUDE
+
+nostrictdef
+
+LIBRARY euser.lib
+LIBRARY estor.lib efsrv.lib fbscli.lib flogger.lib
+#ifdef ENABLE_ABIV2_MODE
+DEBUGGABLE
+#endif
+
+CAPABILITY CAP_GENERAL_DLL DRM
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/PseudoVG/inc/NVGIconHeader.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NvgIconHeader header file
+ *
+*/
+
+
+#ifndef _NVGICONHEADER_H_
+#define _NVGICONHEADER_H_
+
+#include <e32std.h>
+
+/**
+* TNVGHeaderData
+*
+* Datastructure to hold NVG Icon Header information
+*/
+struct TNVGHeaderData // be aware of padding!
+{
+ TUint16 sign;
+ TUint8 version;
+ TUint8 headerSize;
+ TUint32 reserved1;
+ TUint16 reserved2;
+ TUint8 reserved3;
+ TUint8 reserved4:4; // flag
+ TUint8 isMarginCorrection:1; // flag
+ TUint8 isMask:1; // flag
+ TUint8 aspectRatio:2; // flag
+ TInt32 rotation;
+ TInt32 iconColor;
+ TInt32 bitmapid;
+};
+
+
+
+// CONSTANTS
+static const TInt KIconHeaderLength = sizeof(TNVGHeaderData);
+
+// FIXME: find an appropriate place for me.
+
+/**
+* Class TNVGIconHeader
+*
+* Class to hold NVG Icon Header information & operations
+*/
+class TNVGIconHeader
+ {
+
+public:
+ /**
+ * Constructor
+ *
+ * @param aData Descriptor to store the icon header data
+ */
+ inline TNVGIconHeader(TDes8 &aData)
+ {
+ __ASSERT_ALWAYS(aData.Length() >= KIconHeaderLength, User::Panic(_L("not sufficient size"), KErrBadDescriptor));
+ iHeader = (TNVGHeaderData *)(aData.LeftTPtr(KIconHeaderLength).Ptr());
+ }
+
+ /**
+ * Initializes icon header before writing any data
+ *
+ * @param None
+ */
+ inline void Initialize()
+ {
+ Mem::FillZ(iHeader,KIconHeaderLength);
+ iHeader->headerSize = KIconHeaderLength;
+ }
+
+
+ /**
+ * Set the mask flag in icon header
+ *
+ * @param isMask Flag to turn mask on/off
+ */
+ inline void SetIsMask(TBool isMask)
+ {
+ iHeader->isMask = isMask;
+ }
+
+ /**
+ * Get the mask flag from icon header
+ *
+ * @param None
+ */
+ inline TBool IsMask() const
+ {
+ return iHeader->isMask;
+ }
+
+private:
+
+ TNVGHeaderData *iHeader;
+ };
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/PseudoVG/inc/PseodoVGRendererImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CPseodoVGRendererImpl header file
+ *
+*/
+
+#ifndef PSEODOVGRENDERERIMPL_H
+#define PSEODOVGRENDERERIMPL_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <VG/vgu.h>
+#include <platform/vg/vgcontext_symbian.h>
+
+#include "PseudoVG.h"
+#include "MVGRendererImpl.h"
+#include "NVGIconHeader.h"
+#ifdef VGRENDERER_LOG
+#include<flogger.h>
+#endif
+
+/**
+ * CPseodoVGRendererImpl
+ *
+ */
+class CPseodoVGRendererImpl : public CBase, public MVGRendererImpl
+ {
+ static const TUint KMAJOR_VERSION;
+ static const TUint KMINOR_VERSION;
+ static const TUint KBUILD_VERSION;
+
+public:
+ // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ ~CPseodoVGRendererImpl();
+
+ /**
+ * Two-phased constructor.
+ */
+ static CPseodoVGRendererImpl* NewL();
+
+ /**
+ * Two-phased constructor.
+ */
+ static CPseodoVGRendererImpl* NewLC();
+
+ virtual TVersion GetVersion() const;
+ virtual const TDesC GetName() const;
+ virtual void vgClear(TInt x, TInt y, TInt width, TInt height);
+ virtual void vgSeti(TInt type, TInt value);
+ virtual void vgSetf (TInt type, TReal32 value);
+ virtual void vgSetfv(TInt type, TInt count, const TReal32 * values);
+ virtual void vgSetiv(TInt type, TInt count, const TInt * values);
+ virtual void vgSetParameteri(TUint handle, TInt paramType, TInt value);
+ virtual void vgSetParameterf(TUint handle,TInt paramType,TReal32 value);
+ virtual void vgSetParameterfv(TUint object,TInt paramType,TInt count, const TReal32 * values);
+ virtual TInt vgGeti(TInt type);
+ virtual void vgSetColor(TUint paint, TUint rgba);
+ virtual void vgSetPaint(TUint paint, TUint paintModes);
+ virtual TUint vgCreatePaint();
+ virtual TUint vgCreatePath(TInt pathFormat, TInt datatype, TReal32 scale, TReal32 bias,
+ TInt segmentCapacityHint, TInt coordCapacityHint, TInt capabilities);
+ virtual void vgLoadMatrix(const TReal32 * m);
+ virtual void vgMultMatrix(const TReal32 * m);
+ virtual void vgLoadIdentity();
+ virtual void vgScale(TReal32 sx, TReal32 sy);
+ virtual void vgRotate(TReal32 angle);
+ virtual void vgTranslate(TReal32 tx, TReal32 ty);
+ virtual void vgReadPixels(void * data, TInt dataStride,TInt dataFormat,TInt sx, TInt sy,TInt width, TInt height);
+ virtual void vgWritePixels(const void * data, TInt dataStride, TInt dataFormat,
+ TInt dx, TInt dy, TInt width, TInt height);
+ virtual void vgAppendPathData(TUint path,TInt numSegments,
+ const TUint8 * pathSegments,
+ const void * pathData);
+ virtual void vgDrawPath(TUint path, TUint paintModes);
+ virtual void vgClearPath(TUint path, TUint capabilities);
+ virtual TInt vguRect(TUint path,
+ TReal32 x, TReal32 y,
+ TReal32 width, TReal32 height);
+ virtual TInt vguEllipse(TUint path,
+ TReal32 cx, TReal32 cy,
+ TReal32 width, TReal32 height);
+ virtual TInt vguRoundRect(TUint path, TReal32 x, TReal32 y,
+ TReal32 width, TReal32 height, TReal32 arcWidth, TReal32 arcHeight);
+ virtual TInt vguLine(TUint path,TReal32 x0, TReal32 y0,TReal32 x1, TReal32 y1);
+ virtual void DumpToLogFile();
+ virtual void CloseLogFile();
+ virtual TUint vgCreateImage(TInt format, TInt width, TInt height, TInt allowedQuality);
+ virtual void vgGetPixels(TUint dst, TInt dx, TInt dy, TInt sx, TInt sy, TInt width, TInt height);
+ virtual void vgDrawImage(TUint image);
+ virtual void vgClearImage(TUint image, TInt x, TInt y, TInt width, TInt height);
+ virtual void vgImageSubData(TUint image, const void * data, TInt dataStride,
+ TInt dataFormat, TInt x, TInt y, TInt width, TInt height);
+ virtual void vgMask(TUint mask, TInt operation, TInt x, TInt y, TInt width, TInt height);
+ virtual void vgDestroyImage(TUint aHandle);
+ virtual void vgDestroyPaint(TUint aHandle);
+ virtual void vgDestroyPath(TUint aHandle);
+ virtual void ToggleReset();
+ virtual void vgFlush();
+ virtual TInt vgGetError();
+ virtual MVGSurfaceImpl* CreateVGSurfaceL(TInt aOption);
+
+ const TPtr8 GetEncodedData()
+ {
+ return iEncodedData->Des();
+ }
+ const TPtrC8 TLVEncodedData() const
+ {
+ const TPtr8 ptr=iEncodedData->Des();
+ const TPtrC8 data(const_cast<unsigned char*>(ptr.Ptr()+ KIconHeaderLength), ptr.Length() - KIconHeaderLength);
+ return data;
+ }
+
+ void EmptyEncodedData();
+ TInt AddCommand(TInt aType, TUint8 * aValue, TInt aLength);
+ void SetCommonHeader(const TDesC8& aHeader);
+ void SetMaskFlag(TBool aVal = ETrue);
+
+private:
+
+ /**
+ * Constructor for performing 1st stage construction
+ */
+ CPseodoVGRendererImpl();
+
+ /**
+ * EPOC default constructor for performing 2nd stage construction
+ */
+ void ConstructL();
+
+ void WriteHeader();
+
+ TUint8 GetPathCoordianteSize(TUint8 aHandle);
+
+ TInt EncodeInt8(TUint8 aVal);
+
+ TInt EncodeInt16(TUint16 aVal);
+
+ TInt EncodeInt32(TUint32 aVal);
+
+ TInt EncodeReal32(TReal32 aVal);
+
+ TInt EncodeReal64(TReal64 aVal);
+
+ TInt EncodeData(const TAny *aData, TUint aLength);
+
+ TInt ExpandEncodedData(TUint aNewLength);
+
+ HBufC8 * iEncodedData;
+ TUint iPaintHandleCount;
+ TUint iPathHandleCount;
+ TUint iHandle;
+ static const TUint ENCODEDDATALENGTH;
+ static const TUint ENCODEDDATAGRANULARITY;
+ TInt iCommonHeaderLength;
+ const TUint8* iCommonHeader;
+ VGErrorCode iVgErrorCode;
+ //Command specific logging methods
+#ifdef VGRENDERER_LOG
+ RFileLogger iLog;//logs
+ void LogvgSeti(VGParamType type, VGint fvalue,TInt cmdsize);
+ void LogvgSetf (VGParamType type, VGfloat fvalue,TInt cmdsize);
+ void LogvgSetParameteri(VGHandle handle, VGint paramType, VGint pvalue,TInt cmdsize,TInt Lpvalue);
+ void LogvgSetPaint(VGPaint paint, VGbitfield paintModes,TInt cmdsize,TInt Lpvalue);
+ void LogvgDrawPath(VGbitfield paintModes,int cmdsize);
+#endif
+ };
+
+#endif // PSEODOVGRENDERERIMPL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/PseudoVG/inc/PseudoVG.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PseudoVG header file
+ *
+*/
+
+#ifndef PSEUDOVG_H_
+#define PSEUDOVG_H_
+
+enum OpenVGAPI
+ {
+ EvgClear = 0,
+ EvgSeti,
+ EvgSetf,
+ EvgSetfv,
+ EvgSetParameteri,
+ EvgSetParameterf,
+ EvgSetParameterfv,
+ EvgSetColor,
+ EvgSetPaint,
+ EvgLoadMatrix,
+ EvgMultMatrix,
+ EvgLoadIdentity,
+ EvgScale,
+ EvgRotate,
+ EvgTranslate,
+ EvgAppendPathData,
+ EvgDrawPath,
+ EvgClearPath,
+ EvguRect,
+ EvguEllipse,
+ EvguRoundRect,
+ EvguLine,
+ EvgCreatePaint,
+ EvgCreatePath,
+ EvgGetPixels,
+ EvgDestroyImage,
+ EvgDestroyPaint,
+ EvgDestroyPath,
+ EvgSetiv,
+ EvgCreateImage,
+ EvgDrawImage,
+ EvgClearImage,
+ EvgImageSubData,
+ EvgPrepareToBindImage,
+ EvgBindImage,
+ EvgUnBindImage,
+ EvgFlush,
+ };
+
+/*
+enum OpenVGAPI
+ {
+ EvgClear = 0,
+ EvgSeti,
+ EvgSetf,
+ EvgSetfv,
+ EvgSetParameteri,
+ EvgSetParameterf,
+ EvgSetParameterfv,
+ EvgSetColor,
+ EvgSetPaint,
+ EvgLoadMatrix,
+ EvgMultMatrix,
+ EvgLoadIdentity,
+ EvgScale,
+ EvgRotate,
+ EvgTranslate,
+ EvgAppendPathData,
+ EvgDrawPath,
+ EvguRect,
+ EvguEllipse,
+ EvguRoundRect,
+ EvguLine,
+ EvgCreatePaint,
+ EvgCreatePath,
+ EvgCreateImage,
+ EvgGetPixels,
+ EvgDrawImage,
+ EvgDestroyImage,
+ EvgDestroyPaint,
+ EvgDestroyPath,
+ EvgFlush,
+ EvgSetiv
+ };
+*/
+
+static const TUint OpenVGAPICount = EvgFlush + 1;
+
+static const TInt8 KNVGFileVersion = 0x00; // file version is not really required for pseudo
+static const TInt16 KNVGHeaderSize = 0x34;
+static const TInt16 KNVGReserved1 = 0x01; // 1 is for TLV type
+
+static const TUid KUidPseudo = { 968435518 }; // TODO?
+
+#endif /*PSEUDOVG_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/PseudoVG/inc/PseudoVG.pan Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef __PSEUDOVG_PAN__
+#define __PSEUDOVG_PAN__
+
+// Data Types
+
+enum TPseudoVGPanic
+ {
+ EPseudoVGNullPointer
+ };
+
+// Function Prototypes
+
+GLREF_C void Panic(TPseudoVGPanic aPanic);
+
+#endif // __PSEUDOVG_PAN__
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/PseudoVG/inc/PseudoVGSurfaceImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CPseudoVGSurfaceImpl header file
+ *
+*/
+
+#ifndef PSEUDOVGSURFACEIMPL_H
+#define PSEUDOVGSURFACEIMPL_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "MVGSurfaceImpl.h"
+
+static const TUid KUidNvgProprietaryFormat = { 968435518 };
+class CPseodoVGRendererImpl;
+/**
+ * CPseudoVGSurfaceImpl
+ *
+ */
+class CPseudoVGSurfaceImpl : public CBase, public MVGSurfaceImpl
+ {
+public:
+ // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ ~CPseudoVGSurfaceImpl();
+
+ /**
+ * Two-phased constructor.
+ */
+ static CPseudoVGSurfaceImpl* NewL(CPseodoVGRendererImpl * aVGRendererImpl);
+
+ /**
+ * Two-phased constructor.
+ */
+ static CPseudoVGSurfaceImpl* NewLC(CPseodoVGRendererImpl * aVGRendererImpl);
+
+ virtual TInt InitializeSurface( TSize aSize, TInt aColorSpace );
+
+ virtual TInt CreateSurface(TInt aDisplayMode, RWindow *aSurface, CFbsBitmap *aBitmap);
+
+ virtual TInt ResizeSurface( TSize aSize );
+
+ virtual TInt CopyBitmap(TInt aDisplayMode, TInt aMaskMode, CFbsBitmap *aBitmap, CFbsBitmap *aMask, TSize aSize = TSize(0,0));
+
+ virtual TInt PrepareToBindClientBuffer();
+ virtual TInt BindClientBuffer(TInt buffer);
+
+ virtual void SetConfiguration(TInt aOption, const TAny* aValue);
+
+ virtual TInt UnBindClientBuffer();
+
+ virtual void TerminateSurface();
+
+private:
+
+ /**
+ * Constructor for performing 1st stage construction
+ */
+ CPseudoVGSurfaceImpl();
+
+ /**
+ * EPOC default constructor for performing 2nd stage construction
+ */
+ void ConstructL(CPseodoVGRendererImpl * aVGRendererImpl);
+
+ TSize iSize;
+ CPseodoVGRendererImpl * iPseodoVGRendererImpl;
+ };
+
+#endif // PSEUDOVGSURFACEIMPL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/PseudoVG/src/PseodoVGRendererImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,1550 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CPseodoVGRendererImpl source file
+ *
+*/
+
+#include "PseodoVGRendererImpl.h"
+#include "PseudoVGSurfaceImpl.h"
+#include <f32file.h>
+#include <s32mem.h>
+#include <VG/vgu.h>
+const TUint CPseodoVGRendererImpl::ENCODEDDATALENGTH = 1024;
+const TUint CPseodoVGRendererImpl::ENCODEDDATAGRANULARITY = 64;
+const TUint CPseodoVGRendererImpl::KMAJOR_VERSION = 1;
+const TUint CPseodoVGRendererImpl::KMINOR_VERSION = 0;
+const TUint CPseodoVGRendererImpl::KBUILD_VERSION = 1;
+
+EXPORT_C MVGRendererImpl* CreateVGRendererImplL()
+ {
+ return CPseodoVGRendererImpl::NewL();
+ }
+
+CPseodoVGRendererImpl::CPseodoVGRendererImpl()
+ {
+ iPaintHandleCount = 0;
+ iPathHandleCount = 0;
+ iEncodedData = 0;
+ iHandle = 1;
+ iCommonHeaderLength = 0;
+ iCommonHeader = 0;
+ iVgErrorCode = VG_NO_ERROR;
+ }
+
+CPseodoVGRendererImpl::~CPseodoVGRendererImpl()
+ {
+ delete iEncodedData;
+ }
+
+CPseodoVGRendererImpl* CPseodoVGRendererImpl::NewLC()
+ {
+ CPseodoVGRendererImpl* self = new (ELeave)CPseodoVGRendererImpl();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+CPseodoVGRendererImpl* CPseodoVGRendererImpl::NewL()
+ {
+ CPseodoVGRendererImpl* self=CPseodoVGRendererImpl::NewLC();
+ CleanupStack::Pop();
+ return self;
+ }
+
+inline void CPseodoVGRendererImpl::ConstructL()
+ {
+ iEncodedData = HBufC8::NewL(CPseodoVGRendererImpl::ENCODEDDATALENGTH);
+ WriteHeader();
+ }
+
+TVersion CPseodoVGRendererImpl::GetVersion() const
+ {
+ return TVersion(KMAJOR_VERSION, KMINOR_VERSION, KBUILD_VERSION);
+ }
+
+const TDesC CPseodoVGRendererImpl::GetName() const
+ {
+ _LIT(KPseudoVGRenderer, "TLVVGRenderer");
+ return KPseudoVGRenderer;
+ }
+
+void CPseodoVGRendererImpl::WriteHeader()
+ {
+ TUint8 EmptyHeader[KIconHeaderLength];
+ if(iCommonHeader)
+ {
+ EncodeData(iCommonHeader, KIconHeaderLength);
+ }
+ else
+ {
+ EncodeData(EmptyHeader, KIconHeaderLength);
+ }
+
+ const TInt8 * KNVGFileIdentifier = (const TInt8*)"nvg";
+
+ EncodeData(KNVGFileIdentifier, 3);
+ EncodeInt8(KNVGFileVersion);
+ EncodeInt16(KNVGHeaderSize);
+ EncodeInt16(KNVGReserved1);
+
+ // Rest of the headers are not used in TLV format
+ const TInt8 KUnusedHeaderLength = 0x2C;
+
+ for (TInt i = 0; i < KUnusedHeaderLength; ++i)
+ {
+ EncodeInt8(0);
+ }
+ }
+
+void CPseodoVGRendererImpl::vgClear(TInt x, TInt y, TInt width, TInt height)
+ {
+ EncodeInt8(EvgClear);
+ EncodeReal32(x);
+ EncodeReal32(y);
+ EncodeReal32(width);
+ EncodeReal32(height);
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vgClear"));
+#endif
+ }
+
+void CPseodoVGRendererImpl::vgSeti(TInt type, TInt value)
+ {
+ EncodeInt8(EvgSeti);
+ EncodeInt16(type);
+ EncodeInt16(value);
+#ifdef VGRENDERER_LOG
+ LogvgSeti((VGParamType)type,value,0);
+#endif
+ }
+TInt CPseodoVGRendererImpl::vgGeti(TInt type)
+ {
+
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vgGeti"));
+#endif
+ switch( type )
+ {
+ case VG_IMAGE_MODE:
+ return (VGint)VG_DRAW_IMAGE_MULTIPLY;
+ case VG_BLEND_MODE:
+ return (VGint)VG_BLEND_SRC_OVER;
+ case VG_FILTER_CHANNEL_MASK:
+ return (VGint)0;
+ default:
+ return 0;
+ }
+ }
+
+void CPseodoVGRendererImpl::vgSetf (TInt type, TReal32 value)
+ {
+ EncodeInt8(EvgSetf);
+ EncodeInt16(type);
+ EncodeReal32(value);
+#ifdef VGRENDERER_LOG
+ LogvgSetf((VGParamType)type,value,0);
+#endif
+ }
+
+void CPseodoVGRendererImpl::vgSetfv(TInt type, TInt count, const TReal32 * values)
+ {
+ EncodeInt8(EvgSetfv);
+ EncodeInt16(type);
+ EncodeInt16(count);
+ EncodeData(values, count * sizeof(TReal32));
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vgSetfv"));
+#endif
+ }
+void CPseodoVGRendererImpl::vgSetiv(TInt type, TInt count, const TInt * values)
+ {
+ EncodeInt8(EvgSetiv);
+ EncodeInt16(type);
+ EncodeInt16(count);
+ EncodeData(values, count * sizeof(TInt));
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vgSetiv"));
+#endif
+ }
+void CPseodoVGRendererImpl::vgSetParameteri(TUint handle, TInt paramType, TInt value)
+ {
+ EncodeInt8(EvgSetParameteri);
+ EncodeInt32(handle);
+ EncodeInt16(paramType);
+ EncodeInt16(value);
+#ifdef VGRENDERER_LOG
+ LogvgSetParameteri(handle,paramType,value,0,handle);
+#endif
+ }
+
+void CPseodoVGRendererImpl::vgSetParameterf(TUint handle,TInt paramType,TReal32 value)
+ {
+ EncodeInt8(EvgSetParameterf);
+ EncodeInt32(handle);
+ EncodeInt16(paramType);
+ EncodeReal32(value);
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vgSetParameterf"));
+#endif
+ }
+
+void CPseodoVGRendererImpl::vgSetParameterfv(TUint handle,TInt paramType,TInt count, const TReal32 * values)
+ {
+ EncodeInt8(EvgSetParameterfv);
+ EncodeInt32(handle);
+ EncodeInt16(paramType);
+ EncodeInt32(count);
+ EncodeData(values, count * sizeof(TReal32));
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vgSetParameterfv"));
+#endif
+ }
+
+void CPseodoVGRendererImpl::vgSetColor(TUint paint, TUint rgba)
+ {
+ EncodeInt8(EvgSetColor);
+ EncodeInt32(paint);
+ EncodeInt32(rgba);
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vgSetColor"));
+#endif
+ }
+
+void CPseodoVGRendererImpl::vgSetPaint(TUint paint, TUint paintModes)
+ {
+ EncodeInt8(EvgSetPaint);
+ EncodeInt32(paint);
+ EncodeInt8(paintModes);
+#ifdef VGRENDERER_LOG
+ LogvgSetPaint(paint,paintModes,0,paint);
+#endif
+ }
+
+TUint CPseodoVGRendererImpl::vgCreatePaint()
+ {
+ if(iVgErrorCode != VG_NO_ERROR)
+ return VG_INVALID_HANDLE;
+
+ iHandle++;
+ EncodeInt8(EvgCreatePaint);
+ EncodeInt32(iHandle);
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vgCreatePaint"));
+#endif
+ return iHandle;
+ }
+
+TUint CPseodoVGRendererImpl::vgCreatePath(TInt pathFormat, TInt datatype, TReal32 scale, TReal32 bias,
+ TInt segmentCapacityHint, TInt coordCapacityHint, TInt capabilities)
+ {
+ if(iVgErrorCode != VG_NO_ERROR)
+ return VG_INVALID_HANDLE;
+
+
+ iHandle++;
+ EncodeInt8(EvgCreatePath);
+ EncodeInt32(pathFormat);
+ EncodeInt8(datatype);
+ EncodeReal32(scale);
+ EncodeReal32(bias);
+ EncodeInt32(segmentCapacityHint);
+ EncodeInt32(coordCapacityHint);
+ EncodeInt32(capabilities);
+ EncodeInt32(iHandle);
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vgCreatePath"));
+#endif
+ return iHandle;
+ }
+
+void CPseodoVGRendererImpl::vgLoadMatrix(const TReal32 * m)
+ {
+ EncodeInt8(EvgLoadMatrix);
+ EncodeData(m, 9 * sizeof(TReal32));
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vgLoadMatrix"));
+#endif
+ }
+
+void CPseodoVGRendererImpl::vgMultMatrix(const TReal32 * m)
+ {
+ EncodeInt8(EvgMultMatrix);
+ EncodeData(m, 9 * sizeof(TReal32));
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vgMultMatrix"));
+#endif
+ }
+
+void CPseodoVGRendererImpl::vgLoadIdentity()
+ {
+ EncodeInt8(EvgLoadIdentity);
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vgLoadIdentity"));
+#endif
+ }
+
+void CPseodoVGRendererImpl::vgScale(TReal32 sx, TReal32 sy)
+ {
+ EncodeInt8(EvgScale);
+ EncodeReal32(sx);
+ EncodeReal32(sy);
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vgScale"));
+#endif
+ }
+
+void CPseodoVGRendererImpl::vgTranslate(TReal32 tx, TReal32 ty)
+ {
+ EncodeInt8(EvgTranslate);
+ EncodeReal32(tx);
+ EncodeReal32(ty);
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vgTranslate"));
+#endif
+ }
+
+void CPseodoVGRendererImpl::vgRotate(TReal32 angle)
+ {
+ EncodeInt8(EvgRotate);
+ EncodeReal32(angle);
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vgRotate"));
+#endif
+ }
+
+void CPseodoVGRendererImpl::vgReadPixels(void * /*data*/, TInt /*dataStride*/, TInt /*dataFormat*/, TInt /*sx*/, TInt /*sy*/, TInt /*width*/, TInt /*height*/)
+ {
+ //TODO
+ return;
+ }
+
+void CPseodoVGRendererImpl::vgWritePixels(const void * /*data*/, TInt /*dataStride*/, TInt /*dataFormat*/,
+ TInt /*dx*/, TInt /*dy*/, TInt /*width*/, TInt /*height*/)
+ {
+ //TODO
+ return;
+ }
+
+void CPseodoVGRendererImpl::vgAppendPathData(TUint path,TInt numSegments,
+ const TUint8 * pathSegments,
+ const void * pathData)
+ {
+ EncodeInt8(EvgAppendPathData);
+ EncodeInt32(path);
+ EncodeInt16(numSegments);
+ EncodeData(pathSegments, numSegments);
+
+ TInt coordinateCount = 0;
+ for (TInt i = 0; i < numSegments; ++i)
+ {
+ switch (pathSegments[i])
+ {
+ case VG_HLINE_TO:
+ case VG_VLINE_TO:
+ coordinateCount += 1;
+ break;
+ case VG_MOVE_TO:
+ case VG_LINE_TO:
+ case VG_SQUAD_TO:
+ coordinateCount += 2;
+ break;
+ case VG_QUAD_TO:
+ case VG_SCUBIC_TO:
+ coordinateCount += 4;
+ break;
+ case VG_SCCWARC_TO:
+ case VG_SCWARC_TO:
+ case VG_LCCWARC_TO:
+ case VG_LCWARC_TO:
+ coordinateCount += 5;
+ break;
+ case VG_CUBIC_TO:
+ coordinateCount += 6;
+ break;
+ default:
+ break;
+ }
+ }
+ EncodeInt16(coordinateCount);
+ EncodeData(pathData, coordinateCount * GetPathCoordianteSize(path));
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vgAppendPathData"));
+#endif
+ }
+
+void CPseodoVGRendererImpl::vgDrawPath(TUint path, TUint capabilities)
+
+ {
+ EncodeInt8(EvgDrawPath);
+ EncodeInt32(path);
+ EncodeInt16(capabilities);
+
+#ifdef VGRENDERER_LOG
+ LogvgDrawPath(path,0);
+#endif
+
+ }
+
+void CPseodoVGRendererImpl::vgClearPath(TUint path, TUint capabilities)
+ {
+ EncodeInt8(EvgClearPath);
+ EncodeInt32(path);
+ EncodeInt16(capabilities);
+ }
+
+TInt CPseodoVGRendererImpl::vguRect(TUint path,
+ TReal32 x, TReal32 y,
+ TReal32 width, TReal32 height)
+ {
+ EncodeInt8(EvguRect);
+ EncodeInt32(path);
+ EncodeReal32(x);
+ EncodeReal32(y);
+ EncodeReal32(width);
+ EncodeReal32(height);
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vguRect"));
+#endif
+ return KErrNone;
+ }
+
+TInt CPseodoVGRendererImpl::vguEllipse(TUint path,
+ TReal32 cx, TReal32 cy,
+ TReal32 width, TReal32 height)
+ {
+ EncodeInt8(EvguEllipse);
+ EncodeInt32(path);
+ EncodeReal32(cx);
+ EncodeReal32(cy);
+ EncodeReal32(width);
+ EncodeReal32(height);
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vguEllipse"));
+#endif
+ return KErrNone;
+ }
+
+TInt CPseodoVGRendererImpl::vguRoundRect(TUint path, TReal32 x, TReal32 y,
+ TReal32 width, TReal32 height, TReal32 arcWidth, TReal32 arcHeight)
+ {
+ EncodeInt8(EvguRoundRect);
+ EncodeInt32(path);
+ EncodeReal32(x);
+ EncodeReal32(y);
+ EncodeReal32(width);
+ EncodeReal32(height);
+ EncodeReal32(arcWidth);
+ EncodeReal32(arcHeight);
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vguRoundRect"));
+#endif
+ return KErrNone;
+ }
+
+TInt CPseodoVGRendererImpl::vguLine(TUint path,TReal32 x0, TReal32 y0,TReal32 x1, TReal32 y1)
+ {
+ EncodeInt8(EvguLine);
+ EncodeInt32(path);
+ EncodeReal32(x0);
+ EncodeReal32(y0);
+ EncodeReal32(x1);
+ EncodeReal32(y1);
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vguLine"));
+#endif
+ return KErrNone;
+ }
+
+TUint CPseodoVGRendererImpl::vgCreateImage(TInt format, TInt width, TInt height, TInt allowedQuality)
+ {
+ if(iVgErrorCode != VG_NO_ERROR)
+ return VG_INVALID_HANDLE;
+
+ iHandle++;
+ EncodeInt8(EvgCreateImage);
+ EncodeInt32(format);
+ EncodeInt32(width);
+ EncodeInt32(height);
+ EncodeInt8(allowedQuality);
+ EncodeInt32(iHandle);
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vgcreateimage"));
+#endif
+ return iHandle;
+ }
+
+void CPseodoVGRendererImpl::vgGetPixels(TUint /*dst*/, TInt /*dx*/, TInt /*dy*/, TInt /*sx*/, TInt /*sy*/, TInt /*width*/, TInt /*height*/)
+ {
+ //TODO: not used in SVGEngine
+ }
+
+void CPseodoVGRendererImpl::vgDrawImage(TUint image)
+ {
+ EncodeInt8(EvgDrawImage);
+ EncodeInt32(image);
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vgdrawimage"));
+#endif
+ }
+
+void CPseodoVGRendererImpl::vgClearImage(TUint image, TInt x, TInt y, TInt width, TInt height)
+ {
+ EncodeInt8(EvgClearImage);
+ EncodeInt32(image);
+ EncodeInt32(x);
+ EncodeInt32(y);
+ EncodeInt32(width);
+ EncodeInt32(height);
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vgclearimage"));
+#endif
+ }
+
+void CPseodoVGRendererImpl::vgImageSubData(TUint image, const void * data, TInt dataStride,
+ TInt dataFormat, TInt x, TInt y, TInt width, TInt height)
+ {
+ EncodeInt8(EvgImageSubData);
+ EncodeInt32(image);
+ EncodeInt32(dataStride);
+ EncodeInt32(dataFormat);
+ EncodeInt32(x);
+ EncodeInt32(y);
+ EncodeInt32(width);
+ EncodeInt32(height);
+
+ // append the actual data
+ struct
+ {
+
+ VGImageFormat format;
+ VGuint depth;
+ VGuint bytePerPixels;
+ VGuint redBits;
+ VGuint greenBits;
+ VGuint blueBits;
+ VGuint alphaBits;
+ } const static vgiSurfaceFormatDesc[] =
+
+ {
+ { VG_sRGBX_8888, 32, 32/8, 8, 8, 8, 0 },
+ { VG_sRGBA_8888, 32, 32/8, 8, 8, 8, 8 },
+ { VG_sRGBA_8888_PRE, 32, 32/8, 8, 8, 8, 8 },
+ { VG_sRGB_565, 16, 16/8, 5, 6, 5, 0 },
+ { VG_sRGBA_5551, 16, 16/8, 5, 5, 5, 1 },
+ { VG_sRGBA_4444, 16, 16/8, 4, 4, 4, 4 },
+ { VG_sL_8, 8, 8/8, 8, 0, 0, 0 },
+ { VG_lRGBX_8888, 32, 32/8, 8, 8, 8, 0 },
+ { VG_lRGBA_8888, 32, 32/8, 8, 8, 8, 8 },
+ { VG_lRGBA_8888_PRE, 32, 32/8, 8, 8, 8, 8 },
+ { VG_lL_8, 8, 8/8, 8, 0, 0, 0 },
+ { VG_A_8, 8, 8/8, 0, 0, 0, 8 },
+ { VG_BW_1, 8, 8/8, 8, 0, 0, 0 },
+
+ { VG_sXRGB_8888, 32, 32/8, 8, 8, 8, 0 },
+ { VG_sARGB_8888, 32, 32/8, 8, 8, 8, 8 },
+ { VG_sARGB_8888_PRE, 32, 32/8, 8, 8, 8, 8 },
+ { VG_sARGB_1555, 16, 16/8, 5, 5, 5, 1 },
+ { VG_sARGB_4444, 16, 16/8, 4, 4, 4, 4 },
+ { VG_lXRGB_8888, 32, 32/8, 8, 8, 8, 0 },
+ { VG_lARGB_8888, 32, 32/8, 8, 8, 8, 8 },
+ { VG_lARGB_8888_PRE, 32, 32/8, 8, 8, 8, 8 },
+
+ { VG_sBGRX_8888, 32, 32/8, 8, 8, 8, 0 },
+ { VG_sBGRA_8888, 32, 32/8, 8, 8, 8, 8 },
+ { VG_sBGRA_8888_PRE, 32, 32/8, 8, 8, 8, 8 },
+ { VG_sBGR_565, 16, 16/8, 5, 6, 5, 0 },
+ { VG_sBGRA_5551, 16, 16/8, 5, 5, 5, 1 },
+ { VG_sBGRA_4444, 16, 16/8, 4, 4, 4, 4 },
+ { VG_lBGRX_8888, 32, 32/8, 8, 8, 8, 0 },
+ { VG_lBGRA_8888, 32, 32/8, 8, 8, 8, 8 },
+ { VG_lBGRA_8888_PRE, 32, 32/8, 8, 8, 8, 8 },
+
+ { VG_sXBGR_8888, 32, 32/8, 8, 8, 8, 0 },
+ { VG_sABGR_8888, 32, 32/8, 8, 8, 8, 8 },
+ { VG_sABGR_8888_PRE, 32, 32/8, 8, 8, 8, 8 },
+ { VG_sABGR_1555, 16, 16/8, 5, 5, 5, 1 },
+
+ { VG_sABGR_4444, 16, 16/8, 4, 4, 4, 4 },
+ { VG_lXBGR_8888, 32, 32/8, 8, 8, 8, 0 },
+ { VG_lABGR_8888, 32, 32/8, 8, 8, 8, 8 },
+ { VG_lABGR_8888_PRE, 32, 32/8, 8, 8, 8, 8 }
+ };
+
+ TInt bytePerPixels = 0;
+
+ for (TInt i = 0; i < sizeof(vgiSurfaceFormatDesc)/sizeof(vgiSurfaceFormatDesc[0]); ++i)
+ {
+ if (dataFormat == vgiSurfaceFormatDesc[i].format)
+ {
+ bytePerPixels = vgiSurfaceFormatDesc[i].bytePerPixels;
+ break;
+ }
+ }
+
+ TUint dataLength;
+
+ if (dataStride < 0)
+ {
+ dataLength = -dataStride * height;
+ }
+ else
+ {
+ dataLength = dataStride * height;
+ }
+
+ TInt M = width * bytePerPixels;
+ TInt imageSize = M * height;
+
+ if (imageSize > dataLength)
+ {
+ dataLength = imageSize;
+ }
+
+ if (dataLength == 0)
+ {
+ EncodeInt32(0);
+ return;
+ }
+
+ TUint8 * dstData = new TUint8[dataLength];
+ if (dstData)
+ {
+ Mem::FillZ(dstData, dataLength);
+ TUint8 * dstDataPtr;
+ TUint8 * srcDataPtr = (TUint8 *)data;
+ EncodeInt32(dataLength);
+ if (dataStride < 0)
+ {
+ dstDataPtr = dstData + ( height - 1 ) * (-dataStride);
+ }
+ else
+ {
+ dstDataPtr = dstData;
+ }
+
+ do
+ {
+ Mem::Copy(dstDataPtr, srcDataPtr, M );
+ srcDataPtr += dataStride;
+ dstDataPtr += dataStride;
+ } while( --height );
+
+
+ EncodeData(dstData, dataLength);
+ delete [] dstData;
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vgimagesubdata"));
+#endif
+ }
+ else
+ {
+
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("Allocating memory in vgImageSubData failed"));
+#endif
+
+ EncodeInt32(0);
+ }
+ }
+
+void CPseodoVGRendererImpl::vgMask(TUint /*mask*/, TInt /*operation*/, TInt /*x*/, TInt /*y*/, TInt /*width*/, TInt /*height*/)
+ {
+ //TODO: not used in SVGEngine
+ }
+
+void CPseodoVGRendererImpl::ToggleReset()
+ {
+ }
+
+void CPseodoVGRendererImpl::vgDestroyImage(TUint aHandle)
+ {
+ EncodeInt8(EvgDestroyImage);
+ EncodeInt32(aHandle);
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("vgdestroyimage"));
+#endif
+ }
+
+void CPseodoVGRendererImpl::vgDestroyPaint(TUint /*aHandle*/)
+ {
+ //TODO
+ }
+
+void CPseodoVGRendererImpl::vgDestroyPath(TUint /*aHandle*/)
+ {
+ //TODO
+ }
+
+void CPseodoVGRendererImpl::vgFlush()
+ {
+ //TODO
+ }
+
+TInt CPseodoVGRendererImpl::vgGetError()
+ {
+ return iVgErrorCode;
+ }
+
+MVGSurfaceImpl* CPseodoVGRendererImpl::CreateVGSurfaceL(TInt /*aOption*/)
+ {
+ return CPseudoVGSurfaceImpl::NewL(this);
+ }
+
+TUint8 CPseodoVGRendererImpl::GetPathCoordianteSize(TUint8 /*aHandle*/)
+ {
+ return sizeof(TReal32);
+ }
+
+inline TInt CPseodoVGRendererImpl::EncodeInt8(TUint8 aVal)
+ {
+ return EncodeData(&aVal, sizeof(aVal));
+ }
+
+inline TInt CPseodoVGRendererImpl::EncodeInt16(TUint16 aVal)
+ {
+ return EncodeData(&aVal, sizeof(aVal));
+ }
+
+inline TInt CPseodoVGRendererImpl::EncodeInt32(TUint32 aVal)
+ {
+ return EncodeData(&aVal, sizeof(aVal));
+ }
+
+inline TInt CPseodoVGRendererImpl::EncodeReal32(TReal32 aVal)
+ {
+ return EncodeData(&aVal, sizeof(aVal));
+ }
+
+inline TInt CPseodoVGRendererImpl::EncodeReal64(TReal64 aVal)
+ {
+ return EncodeData(&aVal, sizeof(aVal));
+ }
+
+TInt CPseodoVGRendererImpl::EncodeData(const TAny *aData, TUint aLength)
+ {
+
+ if(iVgErrorCode==VG_NO_ERROR)
+ {
+ TInt result = KErrNone;
+ TPtr8 lPtr( iEncodedData->Des() );
+ TInt encodedDataLength = lPtr.Length() + aLength;
+ TInt encodedDataMaxLength = lPtr.MaxLength();
+
+ if (encodedDataLength >= encodedDataMaxLength)
+ {
+ if ((result = ExpandEncodedData(encodedDataLength)) == KErrNone)
+ {
+ TPtr8 lPtr1( iEncodedData->Des() );
+ lPtr1.Append((TUint8*)(aData), aLength);
+ }
+ }
+ else
+ {
+ lPtr.Append((TUint8*)(aData), aLength);
+ }
+
+ return result;
+ }
+ else
+ {
+ return iVgErrorCode;
+ }
+ }
+
+TInt CPseodoVGRendererImpl::ExpandEncodedData(TUint aNewLength)
+ {
+ TInt result = KErrNone;
+ TPtr8 lPtr( iEncodedData->Des() );
+ TInt encodedDataMaxLength = lPtr.MaxLength();
+ TUint granularities = ((aNewLength - encodedDataMaxLength) / CPseodoVGRendererImpl::ENCODEDDATAGRANULARITY) + 1;
+ HBufC8 * tmpBuf = HBufC8::New(encodedDataMaxLength + granularities * CPseodoVGRendererImpl::ENCODEDDATAGRANULARITY);
+
+ if (tmpBuf == 0)
+ {
+ result = KErrNoMemory;
+ iVgErrorCode = VG_OUT_OF_MEMORY_ERROR;
+ }
+
+ else
+ {
+ TPtr8 tmpBufPtr (tmpBuf->Des());
+ tmpBufPtr.Copy(*iEncodedData);
+
+ delete iEncodedData;
+ iEncodedData = tmpBuf;
+ }
+
+ return result;
+ }
+
+
+void CPseodoVGRendererImpl::EmptyEncodedData()
+ {
+ iVgErrorCode = VG_NO_ERROR;
+ if(iEncodedData->Length() > CPseodoVGRendererImpl::ENCODEDDATALENGTH)
+ {
+ delete iEncodedData;
+ iEncodedData = HBufC8::New(CPseodoVGRendererImpl::ENCODEDDATALENGTH);
+ if(!iEncodedData)
+ {
+ iVgErrorCode = VG_OUT_OF_MEMORY_ERROR;
+ return;
+ }
+ }
+ TPtr8 lPtr( iEncodedData->Des() );
+ lPtr.Zero();
+ WriteHeader();
+
+#ifdef VGRENDERER_LOG
+ iLog.WriteFormat(_L("InitializeSurface-EmptyEncodedData and WriteheaderData"));
+#endif
+ }
+
+TInt CPseodoVGRendererImpl::AddCommand(TInt aType, TUint8 * aValue, TInt aLength)
+ {
+ TInt ret = 0;
+ ret = EncodeInt8(aType);
+ if (aValue && aLength > 0)
+ {
+ ret |= EncodeData(aValue, aLength);
+ }
+
+ return ret;
+ }
+
+void CPseodoVGRendererImpl::SetCommonHeader(const TDesC8& aHeader)
+ {
+ iCommonHeader = aHeader.Ptr();
+ iCommonHeaderLength = aHeader.Length();
+ TPtr8 lPtr( iEncodedData->Des() );
+
+ if (iCommonHeaderLength != 0)
+ {
+ lPtr.Replace(0, iCommonHeaderLength, aHeader);
+ }
+ }
+
+void CPseodoVGRendererImpl::SetMaskFlag(TBool aVal)
+ {
+ TPtr8 lPtr( iEncodedData->Des() );
+ TNVGIconHeader iconheader(lPtr);
+ iconheader.SetIsMask(aVal);
+ }
+
+void CPseodoVGRendererImpl::DumpToLogFile()
+ {
+#ifdef VGRENDERER_LOG
+ TInt err = iLog.Connect();
+ TRAPD(logerror,iLog.CreateLog(_L("PseodoEncoder"),_L("PseodoEncoder.txt"),EFileLoggingModeOverwrite));
+#endif
+ }
+
+void CPseodoVGRendererImpl::CloseLogFile()
+ {
+#ifdef VGRENDERER_LOG
+ iLog.CloseLog();
+ iLog.Close();
+#endif
+ }
+
+
+
+#ifdef VGRENDERER_LOG
+void CPseodoVGRendererImpl::LogvgSetf(VGParamType type, VGfloat value,TInt cmdsize)
+ {
+ TBufC8<70> logbuf;
+ TPtr8 logptr = logbuf.Des();
+
+ logptr.Append(_L("vgSetf("));
+
+ switch( type )
+ {
+ case VG_STROKE_LINE_WIDTH:
+ {
+ logptr.Append(_L("VG_STROKE_LINE_WIDTH"));
+ }
+ break;
+
+ case VG_STROKE_MITER_LIMIT:
+ {
+ logptr.Append(_L("VG_STROKE_MITER_LIMIT"));
+ }
+ break;
+ case VG_STROKE_DASH_PHASE:
+ {
+ logptr.Append(_L("VG_STROKE_DASH_PHASE"));
+ }
+ break;
+
+
+ case VG_MATRIX_MODE:
+ {
+ logptr.Append(_L("VG_MATRIX_MODE"));
+ }
+ break;
+ case VG_FILL_RULE:
+ {
+ logptr.Append(_L("VG_FILL_RULE"));
+ }
+ break;
+ case VG_IMAGE_QUALITY:
+ {
+ logptr.Append(_L("VG_IMAGE_QUALITY"));
+ }
+ break;
+ case VG_IMAGE_MODE:
+ {
+ logptr.Append(_L("VG_IMAGE_MODE"));
+ }
+ break;
+ case VG_RENDERING_QUALITY:
+ {
+ logptr.Append(_L("VG_RENDERING_QUALITY"));
+ }
+ break;
+ case VG_BLEND_MODE:
+ {
+ logptr.Append(_L("VG_BLEND_MODE"));
+ }
+ break;
+ case VG_MASKING:
+ {
+ logptr.Append(_L("VG_MASKING"));
+ }
+ break;
+ case VG_SCISSORING:
+ {
+ logptr.Append(_L("VG_SCISSORING"));
+ }
+ break;
+ case VG_PIXEL_LAYOUT:
+ {
+ logptr.Append(_L("VG_PIXEL_LAYOUT"));
+ }
+ break;
+ case VG_FILTER_FORMAT_LINEAR:
+ {
+ logptr.Append(_L("VG_FILTER_FORMAT_LINEAR"));
+ }
+ break;
+ case VG_FILTER_FORMAT_PREMULTIPLIED:
+ {
+ logptr.Append(_L("VG_FILTER_FORMAT_PREMULTIPLIED"));
+ }
+ break;
+ case VG_FILTER_CHANNEL_MASK:
+ {
+ logptr.Append(_L("VG_FILTER_CHANNEL_MASK"));
+ }
+ break;
+ case VG_STROKE_CAP_STYLE:
+ {
+ logptr.Append(_L("VG_STROKE_CAP_STYLE"));
+ }
+ break;
+ case VG_STROKE_JOIN_STYLE:
+ {
+ logptr.Append(_L("VG_STROKE_JOIN_STYLE"));
+ }
+ break;
+ case VG_STROKE_DASH_PHASE_RESET:
+ {
+ logptr.Append(_L("VG_STROKE_DASH_PHASE_RESET"));
+ }
+ break;
+ /* Implementation limits (read-only) */
+ case VG_SCREEN_LAYOUT:
+ {
+ logptr.Append(_L("VG_SCREEN_LAYOUT"));
+ }
+ break;
+ case VG_MAX_SCISSOR_RECTS:
+ {
+ logptr.Append(_L("VG_MAX_SCISSOR_RECTS"));
+ }
+ break;
+ case VG_MAX_DASH_COUNT:
+ {
+ logptr.Append(_L("VG_MAX_DASH_COUNT"));
+ }
+ break;
+ case VG_MAX_KERNEL_SIZE:
+ {
+ logptr.Append(_L("VG_MAX_KERNEL_SIZE"));
+ }
+ break;
+ case VG_MAX_SEPARABLE_KERNEL_SIZE:
+ {
+ logptr.Append(_L("VG_MAX_SEPARABLE_KERNEL_SIZE"));
+ }
+ break;
+ case VG_MAX_COLOR_RAMP_STOPS:
+ {
+ logptr.Append(_L("VG_MAX_COLOR_RAMP_STOPS"));
+ }
+ break;
+ case VG_MAX_IMAGE_WIDTH:
+ {
+ logptr.Append(_L("VG_MAX_IMAGE_WIDTH"));
+ }
+ break;
+ case VG_MAX_IMAGE_HEIGHT:
+ {
+ logptr.Append(_L("VG_MAX_IMAGE_HEIGHT"));
+ }
+ break;
+ case VG_MAX_IMAGE_PIXELS:
+ {
+ logptr.Append(_L("VG_MAX_IMAGE_PIXELS"));
+ }
+ break;
+ case VG_MAX_IMAGE_BYTES:
+ {
+ logptr.Append(_L("VG_MAX_IMAGE_BYTES"));
+ }
+ break;
+ case VG_MAX_FLOAT:
+ {
+ logptr.Append(_L("VG_MAX_FLOAT"));
+ }
+ break;
+ case VG_MAX_GAUSSIAN_STD_DEVIATION:
+ {
+ logptr.Append(_L("VG_MAX_GAUSSIAN_STD_DEVIATION"));
+ }
+ break;
+
+ default:
+ {
+ logptr.Append(_L("INVALID PARAMTYPE"));
+ }
+ break;
+ };
+
+ logptr.Append(_L(","));
+ logptr.AppendNum(value);
+ logptr.Append(_L("):size="));
+ logptr.AppendNum(cmdsize);
+ iLog.WriteFormat(logbuf);
+ return;
+ }
+
+void CPseodoVGRendererImpl::LogvgSeti (VGParamType type, VGint value,TInt cmdsize)
+ {
+ TBufC8<70> logbuf;
+ TPtr8 logptr = logbuf.Des();
+ logptr.Append(_L("vgSeti("));
+
+ switch( type )
+ {
+ case VG_STROKE_LINE_WIDTH:
+ {
+ logptr.Append(_L("VG_STROKE_LINE_WIDTH"));
+ }
+ break;
+ case VG_STROKE_MITER_LIMIT:
+ {
+ logptr.Append(_L("VG_STROKE_MITER_LIMIT"));
+ }
+ break;
+ case VG_STROKE_DASH_PHASE:
+ {
+ logptr.Append(_L("VG_STROKE_DASH_PHASE"));
+ }
+ break;
+
+ case VG_MATRIX_MODE:
+ {
+ logptr.Append(_L("VG_MATRIX_MODE"));
+ }
+ break;
+ case VG_FILL_RULE:
+ {
+ logptr.Append(_L("VG_FILL_RULE"));
+ }
+ break;
+ case VG_IMAGE_QUALITY:
+ {
+ logptr.Append(_L("VG_IMAGE_QUALITY"));
+ }
+ break;
+ case VG_IMAGE_MODE:
+ {
+ logptr.Append(_L("VG_IMAGE_MODE"));
+ }
+ break;
+ case VG_RENDERING_QUALITY:
+ {
+ logptr.Append(_L("VG_RENDERING_QUALITY"));
+ }
+ break;
+ case VG_BLEND_MODE:
+ {
+ logptr.Append(_L("VG_BLEND_MODE"));
+ }
+ break;
+ case VG_MASKING:
+ {
+ logptr.Append(_L("VG_MASKING"));
+ }
+ break;
+ case VG_SCISSORING:
+ {
+ logptr.Append(_L("VG_SCISSORING"));
+ }
+ break;
+ case VG_PIXEL_LAYOUT:
+ {
+ logptr.Append(_L("VG_PIXEL_LAYOUT"));
+ }
+ break;
+ case VG_FILTER_FORMAT_LINEAR:
+ {
+ logptr.Append(_L("VG_FILTER_FORMAT_LINEAR"));
+ }
+ break;
+ case VG_FILTER_FORMAT_PREMULTIPLIED:
+ {
+ logptr.Append(_L("VG_FILTER_FORMAT_PREMULTIPLIED"));
+ }
+ break;
+ case VG_FILTER_CHANNEL_MASK:
+ {
+ logptr.Append(_L("VG_FILTER_CHANNEL_MASK"));
+ }
+ break;
+ case VG_STROKE_CAP_STYLE:
+ {
+ logptr.Append(_L("VG_STROKE_CAP_STYLE"));
+ }
+ break;
+ case VG_STROKE_JOIN_STYLE:
+ {
+ logptr.Append(_L("VG_STROKE_JOIN_STYLE"));
+ }
+ break;
+ case VG_STROKE_DASH_PHASE_RESET:
+ {
+ logptr.Append(_L("VG_STROKE_DASH_PHASE_RESET"));
+ }
+ break;
+ /* Implementation limits (read-only) */
+ case VG_SCREEN_LAYOUT:
+ {
+ logptr.Append(_L("VG_SCREEN_LAYOUT"));
+ }
+ break;
+ case VG_MAX_SCISSOR_RECTS:
+ {
+ logptr.Append(_L("VG_MAX_SCISSOR_RECTS"));
+ }
+ break;
+ case VG_MAX_DASH_COUNT:
+ {
+ logptr.Append(_L("VG_MAX_DASH_COUNT"));
+ }
+ break;
+ case VG_MAX_KERNEL_SIZE:
+ {
+ logptr.Append(_L("VG_MAX_KERNEL_SIZE"));
+ }
+ break;
+ case VG_MAX_SEPARABLE_KERNEL_SIZE:
+ {
+ logptr.Append(_L("VG_MAX_SEPARABLE_KERNEL_SIZE"));
+ }
+ break;
+ case VG_MAX_COLOR_RAMP_STOPS:
+ {
+ logptr.Append(_L("VG_MAX_COLOR_RAMP_STOPS"));
+ }
+ break;
+ case VG_MAX_IMAGE_WIDTH:
+ {
+ logptr.Append(_L("VG_MAX_IMAGE_WIDTH"));
+ }
+ break;
+ case VG_MAX_IMAGE_HEIGHT:
+ {
+ logptr.Append(_L("VG_MAX_IMAGE_HEIGHT"));
+ }
+ break;
+ case VG_MAX_IMAGE_PIXELS:
+ {
+ logptr.Append(_L("VG_MAX_IMAGE_PIXELS"));
+ }
+ break;
+ case VG_MAX_IMAGE_BYTES:
+ {
+ logptr.Append(_L("VG_MAX_IMAGE_BYTES"));
+ }
+ break;
+ case VG_MAX_FLOAT:
+ {
+ logptr.Append(_L("VG_MAX_FLOAT"));
+ }
+ break;
+ case VG_MAX_GAUSSIAN_STD_DEVIATION:
+ {
+ logptr.Append(_L("VG_MAX_GAUSSIAN_STD_DEVIATION"));
+ }
+ break;
+
+ default:
+ {
+ logptr.Append(_L("INVALID PARAMTYPE"));
+ }
+ break;
+ };
+
+ logptr.Append(_L(","));
+ switch(value)
+ {
+ case VG_RENDERING_QUALITY_NONANTIALIASED:
+ {
+ logptr.Append(_L("VG_RENDERING_QUALITY_NONANTIALIASED"));
+ }
+ break;
+ case VG_RENDERING_QUALITY_FASTER:
+ {
+ logptr.Append(_L("VG_RENDERING_QUALITY_FASTER"));
+ }
+ break;
+ case VG_RENDERING_QUALITY_BETTER:
+ {
+ logptr.Append(_L("VG_RENDERING_QUALITY_BETTER"));
+ }
+ break;
+ case VG_MATRIX_PATH_USER_TO_SURFACE:
+ {
+ logptr.Append(_L("VG_MATRIX_PATH_USER_TO_SURFACE"));
+ }
+ break;
+ case VG_MATRIX_IMAGE_USER_TO_SURFACE:
+ {
+ logptr.Append(_L("VG_MATRIX_IMAGE_USER_TO_SURFACE"));
+ }
+ break;
+ case VG_MATRIX_FILL_PAINT_TO_USER :
+ {
+ logptr.Append(_L("VG_MATRIX_FILL_PAINT_TO_USER"));
+ }
+ break;
+ case VG_MATRIX_STROKE_PAINT_TO_USER:
+ {
+ logptr.Append(_L("VG_MATRIX_STROKE_PAINT_TO_USER"));
+ }
+ break;
+ case VG_CAP_BUTT:
+ {
+ logptr.Append(_L("VG_CAP_BUTT"));
+ }
+ break;
+ case VG_CAP_ROUND:
+ {
+ logptr.Append(_L("VG_CAP_ROUND"));
+ }
+ break;
+ case VG_CAP_SQUARE:
+ {
+ logptr.Append(_L("VG_CAP_SQUARE"));
+ }
+ break;
+ case VG_BLEND_SRC:
+ {
+ logptr.Append(_L("VG_BLEND_SRC"));
+ }
+ break;
+ case VG_BLEND_SRC_OVER:
+ {
+ logptr.Append(_L("VG_BLEND_SRC_OVER"));
+ }
+ break;
+ case VG_BLEND_DST_OVER:
+ {
+ logptr.Append(_L("VG_BLEND_DST_OVER"));
+ }
+ break;
+ case VG_BLEND_SRC_IN:
+ {
+ logptr.Append(_L("VG_BLEND_SRC_IN"));
+ }
+ break;
+ case VG_BLEND_DST_IN:
+ {
+ logptr.Append(_L("VG_BLEND_DST_IN"));
+ }
+ break;
+ case VG_BLEND_MULTIPLY:
+ {
+ logptr.Append(_L("VG_BLEND_MULTIPLY"));
+ }
+ break;
+ case VG_BLEND_SCREEN:
+ {
+ logptr.Append(_L("VG_BLEND_SCREEN"));
+ }
+ break;
+ case VG_BLEND_DARKEN:
+ {
+ logptr.Append(_L("VG_BLEND_DARKEN"));
+ }
+ break;
+ case VG_BLEND_LIGHTEN:
+ {
+ logptr.Append(_L("VG_BLEND_LIGHTEN"));
+ }
+ break;
+ case VG_BLEND_ADDITIVE:
+ {
+ logptr.Append(_L("VG_BLEND_ADDITIVE"));
+ }
+ break;
+ case VG_IMAGE_QUALITY_NONANTIALIASED:
+ {
+ logptr.Append(_L("VG_IMAGE_QUALITY_NONANTIALIASED"));
+ }
+ break;
+ case VG_IMAGE_QUALITY_FASTER:
+ {
+ logptr.Append(_L("VG_IMAGE_QUALITY_FASTER"));
+ }
+ break;
+ case VG_IMAGE_QUALITY_BETTER:
+ {
+ logptr.Append(_L("VG_IMAGE_QUALITY_BETTER"));
+ }
+ break;
+ case VG_FALSE:
+ {
+ logptr.Append(_L("VG_FALSE"));
+ }
+ break;
+ case VG_RED:
+ {
+ logptr.Append(_L("VG_RED"));
+ }
+ break;
+
+ case VG_DRAW_IMAGE_NORMAL:
+ {
+ logptr.Append(_L("VG_DRAW_IMAGE_NORMAL"));
+ }
+ break;
+ case VG_DRAW_IMAGE_MULTIPLY:
+ {
+ logptr.Append(_L("VG_DRAW_IMAGE_MULTIPLY"));
+ }
+ break;
+ case VG_DRAW_IMAGE_STENCIL:
+ {
+ logptr.Append(_L("VG_DRAW_IMAGE_STENCIL"));
+ }
+ break;
+ case VG_JOIN_MITER:
+ {
+ logptr.Append(_L("VG_DRAW_IMAGE_STENCIL"));
+ }
+ break;
+ case VG_JOIN_ROUND:
+ {
+ logptr.Append(_L("VG_DRAW_IMAGE_STENCIL"));
+ }
+ break;
+ case VG_JOIN_BEVEL:
+ {
+ logptr.Append(_L("VG_DRAW_IMAGE_STENCIL"));
+ }
+ break;
+ default:
+ {
+ logptr.AppendNum(value);
+ }
+ break;
+ };
+
+ logptr.Append(_L("):size="));
+ logptr.AppendNum(cmdsize);
+ iLog.WriteFormat(logbuf);
+ return;
+ }
+
+void CPseodoVGRendererImpl::LogvgSetParameteri(VGHandle handle, VGint paramType, VGint value,TInt cmdsize,TInt Lpvalue)
+ {
+ TBufC8<90> logbuf;
+ TPtr8 logptr = logbuf.Des();
+ logptr.Append(_L("vgsetparameteri("));
+ logptr.AppendNum(handle);
+ logptr.Append(_L(","));
+
+ switch(paramType)
+ {
+ case VG_PAINT_TYPE:
+ {
+ logptr.Append(_L("VG_STROKE_LINE_WIDTH"));
+ }
+ break;
+ case VG_PAINT_COLOR:
+ {
+ logptr.Append(_L("VG_STROKE_LINE_WIDTH"));
+ }
+ break;
+ case VG_PAINT_COLOR_RAMP_SPREAD_MODE:
+ {
+ logptr.Append(_L("VG_STROKE_LINE_WIDTH"));
+ }
+ break;
+ case VG_PAINT_COLOR_RAMP_PREMULTIPLIED:
+ {
+ logptr.Append(_L("VG_STROKE_LINE_WIDTH"));
+ }
+ break;
+ case VG_PAINT_COLOR_RAMP_STOPS:
+ {
+ logptr.Append(_L("VG_STROKE_LINE_WIDTH"));
+ }
+ break;
+
+ /* Linear gradient paint parameters */
+ case VG_PAINT_LINEAR_GRADIENT:
+ {
+ logptr.Append(_L("VG_STROKE_LINE_WIDTH"));
+ }
+ break;
+ /* Radial gradient paint parameters */
+ case VG_PAINT_RADIAL_GRADIENT:
+ {
+ logptr.Append(_L("VG_STROKE_LINE_WIDTH"));
+ }
+ break;
+ /* Pattern paint parameters */
+ case VG_PAINT_PATTERN_TILING_MODE:
+ {
+ logptr.Append(_L("VG_STROKE_LINE_WIDTH"));
+ }
+ break;
+ default:
+ {
+ logptr.AppendNum(paramType);
+ }
+ break;
+ };
+ logptr.Append(_L(","));
+
+ switch(value)
+ {
+ case VG_PAINT_TYPE_COLOR:
+ {
+ logptr.Append(_L("VG_STROKE_LINE_WIDTH"));
+ }
+ break;
+ case VG_PAINT_TYPE_LINEAR_GRADIENT:
+ {
+ logptr.Append(_L("VG_STROKE_LINE_WIDTH"));
+ }
+ break;
+ case VG_PAINT_TYPE_RADIAL_GRADIENT:
+ {
+ logptr.Append(_L("VG_STROKE_LINE_WIDTH"));
+ }
+ break;
+ case VG_PAINT_TYPE_PATTERN:
+ {
+ logptr.Append(_L("VG_STROKE_LINE_WIDTH"));
+ }
+ break;
+ default:
+ {
+ logptr.AppendNum(value);
+ }
+ break;
+ };
+ logptr.Append(_L("):size="));
+ logptr.AppendNum(cmdsize);
+ logptr.Append(_L(":hnum="));
+ logptr.AppendNum(Lpvalue);
+ iLog.WriteFormat(logbuf);
+ return;
+ }
+
+void CPseodoVGRendererImpl::LogvgSetPaint(VGPaint paint, VGbitfield paintModes,TInt cmdsize,TInt Lpvalue)
+ {
+ TBufC8<50> logbuf;
+ TPtr8 logptr = logbuf.Des();
+ logptr.Append(_L("vgSetPaint("));
+ logptr.AppendNum(paint);
+ logptr.Append(_L(","));
+
+ switch(paintModes)
+ {
+ case VG_STROKE_PATH:
+ {
+ logptr.Append(_L("VG_STROKE_PATH"));
+ }
+ break;
+ case VG_FILL_PATH:
+ {
+ logptr.Append(_L("VG_FILL_PATH"));
+ }
+ break;
+ default:
+ {
+ logptr.AppendNum(paintModes);
+ }
+ break;
+ };
+ logptr.Append(_L("):size="));
+ logptr.AppendNum(cmdsize);
+ logptr.Append(_L(":hnum="));
+ logptr.AppendNum(Lpvalue);
+ iLog.WriteFormat(logbuf);
+ return;
+ }
+
+void CPseodoVGRendererImpl::LogvgDrawPath(VGbitfield paintModes,int cmdsize)
+ {
+ TBufC8<50> logbuf;
+ TPtr8 logptr = logbuf.Des();
+ logptr.Append(_L("vgDrawPath("));
+ switch(paintModes)
+ {
+ case VG_STROKE_PATH:
+ {
+ logptr.Append(_L("VG_STROKE_PATH"));
+ }
+ break;
+ case VG_FILL_PATH:
+ {
+ logptr.Append(_L("VG_FILL_PATH"));
+ }
+ break;
+ case 3:
+ {
+ logptr.Append(_L("FILL & STROKE"));
+ }
+ break;
+ default:
+ {
+ logptr.AppendNum(paintModes);
+ }
+ break;
+ };
+ logptr.Append(_L("):size="));
+ logptr.AppendNum(cmdsize);
+ iLog.WriteFormat(logbuf);
+ return;
+ }
+#endif
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/PseudoVG/src/PseudoVGDllMain.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PseudoVGDllMain source file
+ *
+*/
+
+// Include Files
+
+#include <e32std.h> // GLDEF_C
+#include "PseudoVG.pan" // panic codes
+
+class MVGRendererImpl;
+
+IMPORT_C MVGRendererImpl* CreateVGRendererImplL();
+
+// Global Functions
+
+GLDEF_C void Panic(TPseudoVGPanic aPanic)
+// Panics the thread with given panic code
+ {
+ User::Panic(_L("PseudoVG"), aPanic);
+ }
+
+// Exported Functions
+
+#ifndef EKA2 // for EKA1 only
+EXPORT_C TInt E32Dll(TDllReason /*aReason*/)
+// Called when the DLL is loaded and unloaded. Note: have to define
+// epoccalldllentrypoints in MMP file to get this called in THUMB.
+
+ {
+ return KErrNone;
+ }
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/PseudoVG/src/PseudoVGSurfaceImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CPseudoVGSurfaceImpl source file
+ *
+*/
+
+#include "PseudoVGSurfaceImpl.h"
+#include "PseodoVGRendererImpl.h"
+#include "fbs.h"
+
+CPseudoVGSurfaceImpl::CPseudoVGSurfaceImpl()
+ {
+ }
+
+CPseudoVGSurfaceImpl::~CPseudoVGSurfaceImpl()
+ {
+ }
+
+CPseudoVGSurfaceImpl* CPseudoVGSurfaceImpl::NewLC(CPseodoVGRendererImpl * aVGRendererImpl)
+ {
+ CPseudoVGSurfaceImpl* self = new (ELeave)CPseudoVGSurfaceImpl();
+ CleanupStack::PushL(self);
+ self->ConstructL(aVGRendererImpl);
+ return self;
+ }
+
+CPseudoVGSurfaceImpl* CPseudoVGSurfaceImpl::NewL(CPseodoVGRendererImpl * aVGRendererImpl)
+ {
+ CPseudoVGSurfaceImpl* self = CPseudoVGSurfaceImpl::NewLC(aVGRendererImpl);
+ CleanupStack::Pop();
+ return self;
+ }
+
+inline void CPseudoVGSurfaceImpl::ConstructL(CPseodoVGRendererImpl * aVGRendererImpl)
+ {
+ iPseodoVGRendererImpl = aVGRendererImpl;
+ }
+
+TInt CPseudoVGSurfaceImpl::InitializeSurface(TSize aSize, TInt /*aColorSpace*/)
+ {
+ iSize = aSize;
+ return iPseodoVGRendererImpl->vgGetError();
+
+ }
+
+void CPseudoVGSurfaceImpl::SetConfiguration(TInt aOption, const TAny* aValue)
+ {
+ if (aOption == BTIMAP_HEADER)
+ {
+ iPseodoVGRendererImpl->SetCommonHeader(*(const TDesC8*)aValue);
+ }
+ }
+
+TInt CPseudoVGSurfaceImpl::CreateSurface(TInt /*aDisplayMode*/, RWindow */*aSurface*/, CFbsBitmap */*aBitmap*/)
+ {
+ return KErrNone;
+ }
+
+TInt CPseudoVGSurfaceImpl::ResizeSurface(TSize aSize)
+ {
+ iSize = aSize;
+ iPseodoVGRendererImpl->EmptyEncodedData();
+ return iPseodoVGRendererImpl->vgGetError();
+ }
+
+TInt CPseudoVGSurfaceImpl::CopyBitmap(TInt aDisplayMode, TInt aMaskMode,CFbsBitmap *aBitmap, CFbsBitmap *aMask, TSize /*aSize*/)
+ {
+ const TPtr8 vgStream = iPseodoVGRendererImpl->GetEncodedData();
+ aBitmap->CreateExtendedBitmap(iSize, (TDisplayMode)aDisplayMode, KUidNvgProprietaryFormat, (TAny*)&(vgStream[0]), vgStream.Length());
+ if (aMask)
+ {
+ iPseodoVGRendererImpl->SetMaskFlag();
+ const TPtr8 vgStream = iPseodoVGRendererImpl->GetEncodedData();
+ aMask->CreateExtendedBitmap(iSize, (TDisplayMode)aMaskMode, KUidNvgProprietaryFormat, (TAny*)&(vgStream[0]), vgStream.Length() );
+ }
+ return KErrNone;
+ }
+
+TInt CPseudoVGSurfaceImpl::PrepareToBindClientBuffer()
+ {
+ return iPseodoVGRendererImpl->AddCommand((TInt)EvgPrepareToBindImage, 0, 0);;
+ }
+
+TInt CPseudoVGSurfaceImpl::BindClientBuffer(TInt buffer)
+ {
+ return iPseodoVGRendererImpl->AddCommand((TInt)EvgBindImage, (TUint8 *)&buffer, sizeof(buffer));
+ }
+
+TInt CPseudoVGSurfaceImpl::UnBindClientBuffer()
+ {
+ return iPseodoVGRendererImpl->AddCommand((TInt)EvgUnBindImage, 0, 0);
+ }
+
+void CPseudoVGSurfaceImpl::TerminateSurface()
+ {
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/SWVG/bwins/SWVG.def Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+ ?CreateVGRendererImplL@@YAPAVMVGRendererImpl@@XZ @ 1 NONAME ; class MVGRendererImpl * CreateVGRendererImplL(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/SWVG/eabi/SWVG.def Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,9 @@
+EXPORTS
+ _Z21CreateVGRendererImplLv @ 1 NONAME
+ _ZTI15COpenVGRenderer @ 2 NONAME ; #<TI>#
+ _ZTI16CSWVGSurfaceImpl @ 3 NONAME ; #<TI>#
+ _ZTI21CSWOpenVGRendererImpl @ 4 NONAME ; #<TI>#
+ _ZTV15COpenVGRenderer @ 5 NONAME ; #<VT>#
+ _ZTV16CSWVGSurfaceImpl @ 6 NONAME ; #<VT>#
+ _ZTV21CSWOpenVGRendererImpl @ 7 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/SWVG/group/SWVG.mmp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET swvg.dll
+TARGETTYPE dll
+UID 0x1000008d 0x03EAEF3D
+VENDORID VID_DEFAULT
+CAPABILITY CAP_GENERAL_DLL
+
+USERINCLUDE ../inc ../../inc ../../OpenVGRenderer/inc
+SYSTEMINCLUDE /epoc32/include /epoc32/include/VG
+
+SOURCEPATH ../src
+SOURCE SWVGDllMain.cpp
+SOURCE SWOpenVGRendererImpl.cpp
+SOURCE SWVGSurfaceImpl.cpp
+
+SOURCEPATH ../../OpenVGRenderer/src
+SOURCE OpenVGRenderer.cpp
+
+
+//By default, the build tools look for the WINSCW def file in a BWINS directory
+//(at the same level as the directory containing the mmp file),
+//the GCC ARM def file in a BMARM directory, and the ARMV5 def file in a EABI directory.
+//If def files are stored in these locations, the project files does not need to specify
+//the location of the def files explicitly. If you want to store the def files in some other
+//location, you will need to specify in the project file where the .def files are using
+//the deffile keyword.
+
+//The following commented out code shows how the build system uses the implicit
+// location for defiles. To create the DEF files Choose Project > Freeze Exports from Carbide
+// or run 'abld freeze' from the command-line
+#if defined (WINS)
+ DEFFILE ../bwins/SWVG.def
+#elif defined (GCC32)
+ DEFFILE ../bmarm/SWVG.def
+#else
+ DEFFILE ../eabi/SWVG.def
+#endif
+MW_LAYER_SYSTEMINCLUDE
+
+nostrictdef
+
+LIBRARY euser.lib
+LIBRARY libopenvgu_sw.lib libopenvg_sw.lib fbscli.lib libvgi.lib
+
+#ifdef ENABLE_ABIV2_MODE
+DEBUGGABLE
+#endif
+
+//EXPORTUNFROZEN
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/SWVG/inc/SWOpenVGRendererImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSWOpenVGRendererImpl header file
+ *
+*/
+
+#ifndef __SWVGRENDERER_H__
+#define __SWVGRENDERER_H__
+
+#include "SWVG.h"
+#include "OpenVGRenderer.h"
+
+
+class CSWOpenVGRendererImpl : public COpenVGRenderer
+ {
+ static const TUint KMAJOR_VERSION;
+ static const TUint KMINOR_VERSION;
+ static const TUint KBUILD_VERSION;
+public:
+ static CSWOpenVGRendererImpl* NewL();
+ static CSWOpenVGRendererImpl* NewLC();
+ ~CSWOpenVGRendererImpl();
+
+public:
+ TVersion Version() const;
+ virtual TVersion GetVersion() const;
+ virtual const TDesC GetName() const;
+
+public:
+
+ virtual void ToggleReset();
+
+ virtual MVGSurfaceImpl* CreateVGSurfaceL(TInt aOption);
+
+private:
+ CSWOpenVGRendererImpl();
+ void ConstructL();
+ };
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/SWVG/inc/SWVG.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SWVG header file
+ *
+*/
+
+// This file defines the API for SWVG.dll
+
+#ifndef __SWVG_H__
+#define __SWVG_H__
+
+#include <e32base.h>
+#include <e32std.h>
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/SWVG/inc/SWVG.pan Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef __SWVG_PAN__
+#define __SWVG_PAN__
+
+// Data Types
+
+enum TSWVGPanic
+ {
+ ESWVGNullPointer
+ };
+
+// Function Prototypes
+
+GLREF_C void Panic(TSWVGPanic aPanic);
+
+#endif // __SWVG_PAN__
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/SWVG/inc/SWVGSurfaceImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSWVGSurfaceImpl source file
+ *
+*/
+
+#ifndef SWVGSURFACEIMPL_H_
+#define SWVGSURFACEIMPL_H_
+
+#include "SWVG.h"
+#include "MVGSurfaceImpl.h"
+
+class CSWVGSurfaceImpl : public CBase, public MVGSurfaceImpl
+{
+public:
+ static CSWVGSurfaceImpl* NewL();
+ static CSWVGSurfaceImpl* NewLC();
+
+ virtual ~CSWVGSurfaceImpl();
+
+ virtual TInt InitializeSurface(TSize aSize, TInt aColorSpace);
+
+ virtual TInt CreateSurface(TInt aDisplayMode, RWindow *aSurface, CFbsBitmap *aBitmap);
+
+ virtual TInt ResizeSurface(TSize aSize);
+
+ virtual void SetConfiguration(TInt aOption, const TAny* aValue);
+
+ virtual TInt CopyBitmap(TInt aDisplayMode,TInt aMaskMode,CFbsBitmap *aBitmap, CFbsBitmap *aMask, TSize aSize = TSize(0,0));
+
+ virtual TInt PrepareToBindClientBuffer();
+ virtual TInt BindClientBuffer(TInt buffer);
+
+ virtual TInt UnBindClientBuffer();
+
+ virtual void TerminateSurface();
+
+private:
+ CSWVGSurfaceImpl();
+ void ConstructL();
+ TSize iSize;
+};
+
+#endif /*SWVGSURFACEIMPL_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/SWVG/src/SWOpenVGRendererImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSWOpenVGRendererImpl source file
+ *
+*/
+
+#include "SWOpenVGRendererImpl.h"
+#include "SWVGSurfaceImpl.h"
+
+#include <VG/vgu.h>
+
+const TUint CSWOpenVGRendererImpl::KMAJOR_VERSION = 1;
+const TUint CSWOpenVGRendererImpl::KMINOR_VERSION = 0;
+const TUint CSWOpenVGRendererImpl::KBUILD_VERSION = 1;
+
+EXPORT_C MVGRendererImpl* CreateVGRendererImplL()
+ {
+ return CSWOpenVGRendererImpl::NewL();
+ }
+
+
+CSWOpenVGRendererImpl* CSWOpenVGRendererImpl::NewLC()
+ {
+ CSWOpenVGRendererImpl* self = new (ELeave) CSWOpenVGRendererImpl;
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+CSWOpenVGRendererImpl* CSWOpenVGRendererImpl::NewL()
+ {
+ CSWOpenVGRendererImpl* self = CSWOpenVGRendererImpl::NewLC();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+CSWOpenVGRendererImpl::CSWOpenVGRendererImpl()
+ {
+ }
+
+void CSWOpenVGRendererImpl::ConstructL()
+ {
+ }
+
+CSWOpenVGRendererImpl::~CSWOpenVGRendererImpl()
+ {
+ }
+
+TVersion CSWOpenVGRendererImpl::Version() const
+ {
+ return TVersion(KMAJOR_VERSION, KMINOR_VERSION, KBUILD_VERSION);
+ }
+
+TVersion CSWOpenVGRendererImpl::GetVersion() const
+ {
+ return TVersion(KMAJOR_VERSION, KMINOR_VERSION, KBUILD_VERSION);
+ }
+
+const TDesC CSWOpenVGRendererImpl::GetName() const
+ {
+ _LIT(KSWVGRenderer, "SWVGRenderer");
+ return KSWVGRenderer;
+ }
+
+void CSWOpenVGRendererImpl::ToggleReset()
+ {
+ }
+
+MVGSurfaceImpl* CSWOpenVGRendererImpl::CreateVGSurfaceL(TInt /*aOption*/)
+ {
+ return CSWVGSurfaceImpl::NewL();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/SWVG/src/SWVGDllMain.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SWVGDllMain source file
+ *
+*/
+
+// Include Files
+
+#include <e32std.h> // GLDEF_C
+#include "SWVG.pan" // panic codes
+
+class MVGRendererImpl;
+
+IMPORT_C MVGRendererImpl* CreateVGRendererImplL();
+
+// Global Functions
+
+GLDEF_C void Panic(TSWVGPanic aPanic)
+// Panics the thread with given panic code
+ {
+ User::Panic(_L("SWVG"), aPanic);
+ }
+
+// Exported Functions
+
+#ifndef EKA2 // for EKA1 only
+EXPORT_C TInt E32Dll(TDllReason /*aReason*/)
+// Called when the DLL is loaded and unloaded. Note: have to define
+// epoccalldllentrypoints in MMP file to get this called in THUMB.
+
+ {
+ return KErrNone;
+ }
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/SWVG/src/SWVGSurfaceImpl.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSWVGSurfaceImpl source file
+ *
+*/
+
+#include "SWVGSurfaceImpl.h"
+
+#include <platform/vg/vgcontext_symbian.h>
+
+
+CSWVGSurfaceImpl::CSWVGSurfaceImpl()
+ {
+ }
+
+CSWVGSurfaceImpl::~CSWVGSurfaceImpl()
+ {
+ }
+
+CSWVGSurfaceImpl* CSWVGSurfaceImpl::NewL()
+ {
+ CSWVGSurfaceImpl* self = CSWVGSurfaceImpl::NewLC();
+ CleanupStack::Pop();
+ return self;
+ }
+
+CSWVGSurfaceImpl* CSWVGSurfaceImpl::NewLC()
+ {
+ CSWVGSurfaceImpl* self = new (ELeave)CSWVGSurfaceImpl();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+inline void CSWVGSurfaceImpl::ConstructL()
+ {
+ }
+
+TInt CSWVGSurfaceImpl::InitializeSurface(TSize aSize, TInt aColorSpace)
+ {
+ iSize = aSize;
+ return ::VGISymbianInitialize(aSize, (VGIColorSpace)aColorSpace);
+ }
+
+void CSWVGSurfaceImpl::SetConfiguration(TInt /*aOption*/, const TAny* /*aValue*/)
+ {
+ }
+
+TInt CSWVGSurfaceImpl::CreateSurface(TInt /*aDisplayMode*/, RWindow */*aSurface*/, CFbsBitmap */*aBitmap*/)
+ {
+ return KErrNone;
+ }
+
+TInt CSWVGSurfaceImpl::ResizeSurface(TSize aSize)
+ {
+ iSize = aSize;
+ return ::VGISymbianResize(aSize);
+ }
+
+TInt CSWVGSurfaceImpl::CopyBitmap(TInt aDisplayMode,TInt aMaskMode,CFbsBitmap *aBitmap, CFbsBitmap *aMask, TSize aSize)
+ {
+ int ret = KErrNone;
+
+ if (aBitmap->Handle() == 0)
+ {
+ ret = aBitmap->Create(aSize, (TDisplayMode)aDisplayMode);
+ }
+
+ if (ret != KErrNone)
+ {
+ return ret;
+ }
+
+ if (aMask)
+ {
+ if (aMask->Handle() == 0)
+ {
+ ret = aMask->Create(aSize, (TDisplayMode)aMaskMode);
+ }
+ }
+
+ if (ret != KErrNone)
+ {
+ return ret;
+ }
+
+ if(aMask)
+ {
+ ret = ::VGISymbianCopyToBitmap(aBitmap, aMask, VGI_SKIP_TRANSPARENT_PIXELS);
+ }
+ else
+ {
+ ret = ::VGISymbianCopyToBitmap(aBitmap, aMask, VGI_COPY_TRANSPARENT_PIXELS);
+ }
+
+ return ret;
+ }
+
+TInt CSWVGSurfaceImpl::PrepareToBindClientBuffer()
+ {
+ return KErrNone;
+ }
+
+TInt CSWVGSurfaceImpl::BindClientBuffer(TInt buffer)
+ {
+ return ::VGISymbianBindToImage(buffer);
+ }
+
+TInt CSWVGSurfaceImpl::UnBindClientBuffer()
+ {
+ return ::VGISymbianUnBindImage();
+ }
+
+void CSWVGSurfaceImpl::TerminateSurface()
+ {
+ ::VGISymbianTerminate();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/bwins/VGRendereru.def Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+ ?NewL@CVGRenderer@@SAPAV1@W4SVGRendererId@@H@Z @ 1 NONAME ; class CVGRenderer * CVGRenderer::NewL(enum SVGRendererId, int)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/eabi/VGRendereru.def Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,7 @@
+EXPORTS
+ _ZTI10CVGSurface @ 1 NONAME ; #<TI>#
+ _ZTI11CVGRenderer @ 2 NONAME ; #<TI>#
+ _ZTV10CVGSurface @ 3 NONAME ; #<VT>#
+ _ZTV11CVGRenderer @ 4 NONAME ; #<VT>#
+ _ZN11CVGRenderer4NewLE13SVGRendererIdi @ 5 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/group/VGRenderer.mmp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET vgrenderer.dll
+TARGETTYPE dll
+
+VENDORID VID_DEFAULT
+
+UID 0x1000008D 0x0152D27E
+
+USERINCLUDE ../inc
+SYSTEMINCLUDE /epoc32/include
+
+SOURCEPATH ../src
+LIBRARY euser.lib
+
+MW_LAYER_SYSTEMINCLUDE
+
+#ifdef ENABLE_ABIV2_MODE
+DEBUGGABLE
+#endif
+SOURCE VGRenderer.cpp VGSurface.cpp
+
+CAPABILITY CAP_GENERAL_DLL DRM
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/inc/MVGRendererImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MVGSurfaceImpl header file
+ *
+*/
+
+#ifndef MVGRENDERERIMPL_H_
+#define MVGRENDERERIMPL_H_
+
+class MVGSurfaceImpl;
+
+class MVGRendererImpl
+ {
+protected:
+ MVGRendererImpl(){}
+
+public:
+ virtual ~MVGRendererImpl(){}
+
+ virtual TVersion GetVersion() const = 0;
+ virtual const TDesC GetName() const = 0;
+
+ virtual void vgClear(TInt x, TInt y, TInt width, TInt height) = 0;
+
+ virtual void vgSeti(TInt type, TInt value) = 0;
+ virtual void vgSetf (TInt type, TReal32 value) = 0;
+ virtual void vgSetfv(TInt type, TInt count, const TReal32 * values) = 0;
+ virtual void vgSetiv(TInt type, TInt count, const TInt * values) = 0;
+ virtual void vgSetParameteri(TUint handle, TInt paramType, TInt value) = 0;
+ virtual void vgSetParameterf(TUint handle,TInt paramType,TReal32 value) = 0;
+ virtual void vgSetParameterfv(TUint object,TInt paramType,TInt count, const TReal32 * values) = 0;
+ virtual TInt vgGeti(TInt type)=0;
+
+
+ virtual void vgSetColor(TUint paint, TUint rgba) = 0;
+ virtual void vgSetPaint(TUint paint, TUint paintModes) = 0;
+ virtual TUint vgCreatePaint() = 0;
+ virtual TUint vgCreatePath(TInt pathFormat, TInt datatype, TReal32 scale, TReal32 bias,
+ TInt segmentCapacityHint, TInt coordCapacityHint, TInt capabilities) = 0;
+
+ virtual void vgLoadMatrix(const TReal32 * m) = 0;
+ virtual void vgMultMatrix(const TReal32 * m) = 0;
+ virtual void vgLoadIdentity() = 0;
+ virtual void vgScale(TReal32 sx, TReal32 sy) = 0;
+ virtual void vgRotate(TReal32 angle) = 0;
+ virtual void vgTranslate(TReal32 tx, TReal32 ty) = 0;
+ virtual void vgReadPixels(void * data, TInt dataStride,TInt dataFormat,TInt sx, TInt sy,TInt width, TInt height)=0;
+ virtual void vgWritePixels(const void * data, TInt dataStride, TInt dataFormat,
+ TInt dx, TInt dy, TInt width, TInt height) = 0;
+
+ virtual void vgAppendPathData(TUint path,TInt numSegments,
+ const TUint8 * pathSegments,
+ const void * pathData) = 0;
+
+ virtual void vgDrawPath(TUint path, TUint paintModes) = 0;
+
+ virtual void vgClearPath(TUint path, TUint capabilities) = 0;
+
+ virtual TInt vguRect(TUint path,
+ TReal32 x, TReal32 y,
+ TReal32 width, TReal32 height) = 0;
+ virtual TInt vguEllipse(TUint path,
+ TReal32 cx, TReal32 cy,
+ TReal32 width, TReal32 height) = 0;
+ virtual TInt vguRoundRect(TUint path, TReal32 x, TReal32 y,
+ TReal32 width, TReal32 height, TReal32 arcWidth, TReal32 arcHeight) = 0;
+ virtual TInt vguLine(TUint path,TReal32 x0, TReal32 y0,TReal32 x1, TReal32 y1) = 0;
+
+ virtual TUint vgCreateImage(TInt format, TInt width, TInt height, TInt allowedQuality) = 0;
+ virtual void vgGetPixels(TUint dst, TInt dx, TInt dy, TInt sx, TInt sy, TInt width, TInt height) = 0;
+ virtual void vgDrawImage(TUint image) = 0;
+
+ virtual void vgClearImage(TUint image, TInt x, TInt y, TInt width, TInt height) = 0;
+ virtual void vgImageSubData(TUint image, const void * data, TInt dataStride,
+ TInt dataFormat, TInt x, TInt y, TInt width, TInt height) = 0;
+ virtual void vgMask(TUint mask, TInt operation, TInt x, TInt y, TInt width, TInt height) = 0;
+
+ virtual void vgDestroyImage(TUint aHandle) = 0;
+ virtual void vgDestroyPaint(TUint aHandle) = 0;
+ virtual void vgDestroyPath(TUint aHandle) = 0;
+
+ virtual void ToggleReset() = 0;
+ virtual void vgFlush() = 0;
+ virtual TInt vgGetError() = 0;
+ virtual void DumpToLogFile() =0;
+ virtual void CloseLogFile() =0;
+ virtual MVGSurfaceImpl* CreateVGSurfaceL(TInt aOption) = 0;
+ virtual const TPtrC8 TLVEncodedData() const=0;
+
+};
+
+#endif /*MVGRENDERERIMPL_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/inc/MVGSurfaceImpl.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MVGSurfaceImpl header file
+ *
+*/
+
+#ifndef MVGSURFACEIMPL_H_
+#define MVGSURFACEIMPL_H_
+
+#include <e32std.h>
+#include <e32base.h>
+
+class RWindow;
+class CFbsBitmap;
+
+class MVGSurfaceImpl
+{
+public:
+ enum SurfaceConfig
+ {
+ BTIMAP_HEADER,
+ ALPHA_SIZE,
+ ALPHA_MASK_SIZE
+ };
+
+ virtual ~MVGSurfaceImpl(){}
+
+ virtual TInt InitializeSurface(TSize aSize, TInt aColorSpace) = 0;
+
+ virtual TInt CreateSurface(TInt aDisplayMode, RWindow *aSurface, CFbsBitmap *aBitmap) = 0;
+
+ virtual TInt ResizeSurface(TSize aSize) = 0;
+
+ virtual void SetConfiguration(TInt aOption, const TAny* aValue) = 0;
+
+ virtual TInt CopyBitmap(TInt aDisplayMode, TInt aMaskMode, CFbsBitmap *aBitmap, CFbsBitmap *aMask, TSize aSize = TSize(0,0)) = 0;
+
+ virtual TInt BindClientBuffer(TInt aBuffer) = 0;
+
+ virtual TInt PrepareToBindClientBuffer() = 0;
+ virtual TInt UnBindClientBuffer() = 0;
+
+ virtual void TerminateSurface() = 0;
+
+protected:
+ MVGSurfaceImpl(){}
+};
+
+#endif /*MVGSURFACEIMPL_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/inc/VGRenderer.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,324 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#ifndef VGRENDERER_H
+#define VGRENDERER_H
+
+#include <e32std.h>
+#include <e32base.h>
+
+#include "MVGRendererImpl.h"
+#include <SVGRendererId.h>
+
+class CVGSurface;
+
+/**
+ * CVGRenderer
+ *
+ */
+class CVGRenderer : public CBase
+ {
+
+public:
+ /**
+ * Destructor.
+ */
+ ~CVGRenderer();
+
+ /*!
+ * @fn NewL()
+ * @bief Creates the renderer abstraction
+ * @param aRendererType Type of the renderer
+ * @param aSurface Type of the surface
+ * @return Renderer abstraction
+ */
+ IMPORT_C static CVGRenderer* NewL(SVGRendererId aRendererType = ESVGRendererSW, TInt aSurface = 0);
+
+ /*!
+ * @fn NewLC()
+ * @bief Creates the renderer abstraction
+ * @param aRendererType Type of the renderer
+ * @param aSurface Type of the surface
+ * @return Renderer abstraction
+ */
+ static CVGRenderer* NewLC(SVGRendererId aRendererType = ESVGRendererSW, TInt aSurface = 0);
+
+public:
+
+ /*!
+ * @fn GetRendererName()
+ * @bief Retrieves the renderer implementation's version
+ * @return version of renderer implementation
+ */
+ TVersion GetRendererVersion()
+ {
+ return iImpl->GetVersion();
+ }
+
+ /*!
+ * @fn GetRendererName()
+ * @bief Retrieves the renderer implementation's name
+ * @return name of renderer implementation
+ */
+ const TDesC GetRendererName()
+ {
+ return iImpl->GetName();
+ }
+
+ // OpenVG function calls
+
+ void vgClear(TInt x, TInt y, TInt width, TInt height)
+ {
+ iImpl->vgClear(x, y, width, height);
+ }
+
+ void vgSeti(TInt type, TInt value)
+ {
+ iImpl->vgSeti(type, value);
+ }
+ TInt vgGeti(TInt type)
+ {
+ return iImpl->vgGeti(type);
+ }
+ void vgSetf (TInt type, TReal32 value)
+ {
+ iImpl->vgSetf(type, value);
+ }
+
+ void vgSetfv(TInt type, TInt count, const TReal32 * values)
+ {
+ iImpl->vgSetfv(type, count, values);
+ }
+ void vgSetiv(TInt type, TInt count, const TInt * values)
+ {
+ iImpl->vgSetiv(type, count, values);
+ }
+ void vgSetParameteri(TUint handle, TInt paramType, TInt value)
+ {
+ iImpl->vgSetParameteri(handle, paramType, value);
+ }
+
+ void vgSetParameterf(TUint handle, TInt paramType, TReal32 value)
+ {
+ iImpl->vgSetParameterf(handle, paramType, value);
+ }
+
+ void vgSetParameterfv(TUint object, TInt paramType, TInt count, const TReal32 * values)
+ {
+ iImpl->vgSetParameterfv(object, paramType, count, values);
+ }
+
+ void vgSetColor(TUint paint, TUint rgba)
+ {
+ iImpl->vgSetColor(paint, rgba);
+ }
+
+ void vgSetPaint(TUint paint, TUint paintModes)
+ {
+ iImpl->vgSetPaint(paint, paintModes);
+ }
+
+ TUint vgCreatePaint()
+ {
+ return iImpl->vgCreatePaint();
+ }
+
+ TUint vgCreatePath(TInt pathFormat, TInt datatype, TReal32 scale, TReal32 bias,
+ TInt segmentCapacityHint, TInt coordCapacityHint, TInt capabilities)
+ {
+ return iImpl->vgCreatePath(pathFormat, datatype, scale, bias, segmentCapacityHint, coordCapacityHint, capabilities);
+ }
+
+ void vgLoadMatrix(const TReal32 * m)
+ {
+ iImpl->vgLoadMatrix(m);
+ }
+
+ void vgMultMatrix(const TReal32 * m)
+ {
+ iImpl->vgMultMatrix(m);
+ }
+
+ void vgLoadIdentity()
+ {
+ iImpl->vgLoadIdentity();
+ }
+
+ void vgScale(TReal32 sx, TReal32 sy)
+ {
+ iImpl->vgScale(sx, sy);
+ }
+
+ void vgRotate(TReal32 angle)
+ {
+ iImpl->vgRotate(angle);
+ }
+ void vgReadPixels(void * data, TInt dataStride,TInt dataFormat,TInt sx, TInt sy,TInt width, TInt height)
+ {
+ iImpl->vgReadPixels(data,dataStride,dataFormat,sx,sy,width,height);
+ }
+
+ void vgWritePixels(const void * data, TInt dataStride, TInt dataFormat,
+ TInt dx, TInt dy, TInt width, TInt height)
+ {
+ iImpl->vgWritePixels(data, dataStride, dataFormat, dx, dy, width, height);
+ }
+
+ void vgTranslate(TReal32 tx, TReal32 ty)
+ {
+ iImpl->vgTranslate(tx, ty);
+ }
+
+ void vgAppendPathData(TUint path, TInt numSegments,
+ const TUint8 * pathSegments,
+ const void * pathData)
+ {
+ iImpl->vgAppendPathData(path, numSegments, pathSegments, pathData);
+ }
+
+ void vgDrawPath(TUint path, TUint paintModes)
+ {
+ iImpl->vgDrawPath(path, paintModes);
+ }
+
+ void vgClearPath(TUint path, TUint capabilities)
+ {
+ iImpl->vgClearPath(path, capabilities);
+ }
+
+ TInt vguRect(TUint path, TReal32 x, TReal32 y,
+ TReal32 width, TReal32 height)
+ {
+ return iImpl->vguRect(path, x, y, width, height);
+ }
+
+ TInt vguEllipse(TUint path, TReal32 cx, TReal32 cy,
+ TReal32 width, TReal32 height)
+ {
+ return iImpl->vguEllipse(path, cx, cy, width, height);
+ }
+
+ TInt vguRoundRect(TUint path, TReal32 x, TReal32 y,
+ TReal32 width, TReal32 height, TReal32 arcWidth, TReal32 arcHeight)
+ {
+ return iImpl->vguRoundRect(path, x, y, width, height, arcWidth, arcHeight);
+ }
+
+ TInt vguLine(TUint path, TReal32 x0, TReal32 y0, TReal32 x1, TReal32 y1)
+ {
+ return iImpl->vguLine(path, x0, y0, x1, y1);
+ }
+
+ void DumpToLogFile()
+ {
+ return iImpl->DumpToLogFile();
+ }
+ void CloseLogFile()
+ {
+ return iImpl->CloseLogFile();
+ }
+ TUint vgCreateImage(TInt format, TInt width, TInt height, TInt allowedQuality)
+ {
+ return iImpl->vgCreateImage(format, width, height, allowedQuality);
+ }
+
+ void vgClearImage(TUint image, TInt x, TInt y, TInt width, TInt height)
+ {
+ return iImpl->vgClearImage(image, x, y, width, height);
+ }
+
+ void vgImageSubData(TUint image, const void * data, TInt dataStride,
+ TInt dataFormat, TInt x, TInt y, TInt width, TInt height)
+ {
+ return iImpl->vgImageSubData(image, data, dataStride, dataFormat, x, y, width, height);
+ }
+
+ void vgGetPixels(TUint dst, TInt dx, TInt dy, TInt sx, TInt sy, TInt width, TInt height)
+ {
+ iImpl->vgGetPixels(dst, dx, dy, sx, sy, width, height);
+ }
+
+ void vgDrawImage(TUint image)
+ {
+ iImpl->vgDrawImage(image);
+ }
+
+ void vgMask(TUint mask, TInt operation, TInt x, TInt y, TInt width, TInt height)
+ {
+ return iImpl->vgMask(mask, operation, x, y, width, height);
+ }
+
+ void vgDestroyImage(TUint aHandle)
+ {
+ iImpl->vgDestroyImage(aHandle);
+ }
+
+ void vgDestroyPaint(TUint aHandle)
+ {
+ iImpl->vgDestroyPaint(aHandle);
+ }
+
+ void vgDestroyPath(TUint aHandle)
+ {
+ iImpl->vgDestroyPath(aHandle);
+ }
+
+ void ToggleReset()
+ {
+ iImpl->ToggleReset();
+ }
+
+ TInt vgGetError()
+ {
+ return iImpl->vgGetError();
+ }
+
+ void vgFlush()
+ {
+ iImpl->vgFlush();
+ }
+
+ /*!
+ * @fn GetCurrentSurface()
+ * @bief Retrieves the surface associated with the renderer
+ * @return Renderer surface
+ */
+ CVGSurface * GetCurrentSurface()
+ {
+ return this->iCurrentSurface;
+ }
+ const TPtrC8 TLVEncodedData() const
+ {
+ return (iImpl->TLVEncodedData());
+ }
+
+private:
+
+ CVGRenderer();
+
+ /**
+ * default constructor for performing 2nd stage construction
+ */
+ void ConstructL(SVGRendererId , TInt );
+
+ MVGRendererImpl * iImpl;
+ CVGSurface * iCurrentSurface;
+ RLibrary iLibrary;
+ };
+
+#endif // VGRENDERER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/inc/VGSurface.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CVGSurface header file
+ *
+*/
+
+#ifndef VGSURFACE_H
+#define VGSURFACE_H
+
+#include <e32std.h>
+#include <e32base.h>
+
+#include "MVGSurfaceImpl.h"
+
+class RWindow;
+class CFbsBitmap;
+class CVGRenderer;
+
+/**
+ * CVGSurface
+ *
+ */
+class CVGSurface : public CBase
+ {
+public:
+ enum SurfaceConfig
+ {
+ BTIMAP_HEADER = MVGSurfaceImpl::BTIMAP_HEADER,
+ ALPHA_SIZE = MVGSurfaceImpl::ALPHA_SIZE,
+ ALPHA_MASK_SIZE = MVGSurfaceImpl::ALPHA_MASK_SIZE
+ };
+
+ /**
+ * Destructor.
+ */
+ ~CVGSurface();
+
+ /*!
+ * @fn NewL()
+ * @bief Creates the renderer surface abstraction
+ * @param aVGSurfaceImpl The surface implementation
+ * @return Renderer surface abstraction
+ */
+ static CVGSurface* NewL(MVGSurfaceImpl *aVGSurfaceImpl);
+
+ /*!
+ * @fn NewL()
+ * @bief Creates the renderer surface abstraction
+ * @param aVGSurfaceImpl The surface implementation
+ * @return Renderer surface abstraction
+ */
+ static CVGSurface* NewLC(MVGSurfaceImpl *aVGSurfaceImpl);
+
+ /*!
+ * @fn InitializeSurface(TSize aSize, TInt aColorSpace)
+ * @bief Initialize the surface
+ * @param aSize The surface size
+ * @param aColorSpace This is optional with egl
+ * @return KErrNone in case of succesfull, appropriate error code otherwise
+ */
+ TInt InitializeSurface(TSize aSize, TInt aColorSpace)
+ {
+ return iImpl->InitializeSurface(aSize, aColorSpace);
+ }
+
+ /*!
+ * @fn CreateSurface(RWindow *aSurface, CFbsBitmap *aBitmap)
+ * @bief Creates the actual rendering surface
+ * @param aDisplayMode The display mode
+ * @param aSurface The window object
+ * @param aBitmap The bitmao object, is optional
+ * @return KErrNone in case of succesfull, appropriate error code otherwise
+ */
+ TInt CreateSurface(TInt aDisplayMode, RWindow *aSurface, CFbsBitmap *aBitmap)
+ {
+ return iImpl->CreateSurface(aDisplayMode, aSurface, aBitmap);
+ }
+
+ /*!
+ * @fn ResizeSurface(TSize aSize)
+ * @bief Resizes the surface
+ * @param aSize The new size
+ * @return KErrNone in case of succesfull, appropriate error code otherwise
+ */
+ TInt ResizeSurface(TSize aSize)
+ {
+ return iImpl->ResizeSurface(aSize);
+ }
+
+ /*!
+ * @fn SetConfiguration
+ * @brief sets surface/context/display configuration options
+ * @param aOption name of the option
+ * @param aValue value(s) for the option
+ */
+ void SetConfiguration(TInt aOption, const TAny* aValue)
+ {
+ return iImpl->SetConfiguration(aOption, aValue);
+ }
+ /*!
+ * @fn CopyBitmap(CFbsBitmap *aBitmap, CFbsBitmap *aMask, TInt aOption)
+ * @brief copies the bitmap from the surface to the given bitmap
+ * @param aDisplayMode The display mode
+ * @param aBitmap The bitmap where the content will be copied
+ * @param aMask Mask
+ * @param aOption Options, may be required for VGI calls
+ */
+ TInt CopyBitmap(TInt aDisplayMode,TInt aMaskMode,CFbsBitmap *aBitmap, CFbsBitmap *aMask, TSize aSize)
+ {
+ return iImpl->CopyBitmap(aDisplayMode,aMaskMode, aBitmap, aMask, aSize);
+ }
+
+ /**
+ * @fn PrepareToBindClientBuffer
+ * Prepares the renderer to bind to an image.
+ * This is added to allow some performance improvement the TLV renderer
+ * This method should be called before creating the VGImage, which should be made as the surface.
+ * No other image should be created after calling this function
+ */
+ TInt PrepareToBindClientBuffer()
+ {
+ return iImpl->PrepareToBindClientBuffer();
+ }
+ /*!
+ * @fn BindSurfaces(TInt buffer)
+ * @brief This function is used for Binding Off-Screen Rendering Surfaces To Client Buffers
+ * @param buffer is a client API reference to the buffer to be bound. buffer must be a valid VGImage handle.
+ * @return 0 if success
+ */
+ TInt BindClientBuffer(TInt buffer)
+ {
+ return iImpl->BindClientBuffer(buffer);
+ }
+
+ /*!
+ * @fn UnbindSurface(TInt surface)
+ * @brief copies the bitmap from the surface to the given bitmap
+ * @param aBitmap The bitmap where the content will be copied
+ * @param aMask Mask
+ * @param aOption Options, may be required for VGI calls
+ * @return 0 if success
+ */
+ TInt UnBindClientBuffer()
+ {
+ return iImpl->UnBindClientBuffer();
+ }
+ /*!
+ * @fn TerminateSurface()
+ * @brief Will destroy the surface
+ */
+ void TerminateSurface()
+ {
+ iImpl->TerminateSurface();
+ }
+
+
+private:
+
+ CVGSurface();
+
+ /**
+ * default constructor for performing 2nd stage construction
+ */
+ void ConstructL(MVGSurfaceImpl *aVGSurfaceImpl);
+
+ MVGSurfaceImpl *iImpl;
+ };
+
+#endif // VGSURFACE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/rom/VGRenderer.iby Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IBY file for SVGT Engine
+*
+*/
+
+
+#ifndef VGRENDERER_IBY
+#define VGRENDERER_IBY
+
+file=ABI_DIR\BUILD_DIR\VGRenderer.dll SHARED_LIB_DIR\VGRenderer.dll
+file=ABI_DIR\BUILD_DIR\PseudoVG.dll SHARED_LIB_DIR\PseudoVG.dll
+file=ABI_DIR\BUILD_DIR\SWVG.dll SHARED_LIB_DIR\SWVG.dll
+#endif
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/src/VGRenderer.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SVG Implementation header file
+ *
+*/
+
+
+#include "VGRenderer.h"
+#include "VGSurface.h"
+#include <SVGRendererId.h>
+
+_LIT(KPseudoVGDLL, "Z:\\sys\\bin\\PseudoVG.dll");
+_LIT(KSWVGDLL, "Z:\\sys\\bin\\SWVG.dll");
+_LIT(KHWVGDLL, "Z:\\sys\\bin\\HWVG.dll");
+
+CVGRenderer::CVGRenderer()
+ {
+ iImpl = 0;
+ iCurrentSurface = 0;
+ }
+
+CVGRenderer::~CVGRenderer()
+ {
+
+ delete iImpl;
+
+ delete iCurrentSurface;
+
+ iLibrary.Close();
+ }
+
+CVGRenderer* CVGRenderer::NewLC(SVGRendererId aRendererType, TInt aOption)
+ {
+ CVGRenderer* self = new (ELeave)CVGRenderer();
+ CleanupStack::PushL(self);
+ self->ConstructL(aRendererType, aOption);
+ return self;
+ }
+
+EXPORT_C CVGRenderer* CVGRenderer::NewL(SVGRendererId aRendererType, TInt aOption)
+ {
+ CVGRenderer* self = CVGRenderer::NewLC(aRendererType, aOption);
+ CleanupStack::Pop();
+ return self;
+ }
+
+void CVGRenderer::ConstructL(SVGRendererId aRendererType, TInt aOption)
+ {
+ TInt ret = KErrNotFound;
+ if (aRendererType == ESVGRendererTLV)
+ {
+ ret = iLibrary.Load(KPseudoVGDLL);
+ }
+ else if (aRendererType == ESVGRendererSW)
+ {
+ ret = iLibrary.Load(KSWVGDLL);
+ }
+ else if (aRendererType == ESVGRendererHW)
+ {
+ ret = iLibrary.Load(KHWVGDLL);
+ }
+
+ User::LeaveIfError(ret);
+
+ TLibraryFunction VGRendererImpl = iLibrary.Lookup(1);
+ this->iImpl = reinterpret_cast<MVGRendererImpl *>(VGRendererImpl());
+ User::LeaveIfNull(this->iImpl);
+ iCurrentSurface = CVGSurface::NewL(iImpl->CreateVGSurfaceL(aOption));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/src/VGSurface.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CVGSurface source file
+ *
+*/
+
+#include "VGSurface.h"
+
+CVGSurface::CVGSurface()
+ {
+ }
+
+CVGSurface::~CVGSurface()
+ {
+ delete this->iImpl;
+ }
+
+CVGSurface* CVGSurface::NewLC(MVGSurfaceImpl *aVGSurfaceImpl)
+ {
+ CVGSurface* self = new (ELeave)CVGSurface();
+ CleanupStack::PushL(self);
+ self->ConstructL(aVGSurfaceImpl);
+ return self;
+ }
+
+CVGSurface* CVGSurface::NewL(MVGSurfaceImpl *aVGSurfaceImpl)
+ {
+ CVGSurface* self=CVGSurface::NewLC(aVGSurfaceImpl);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+void CVGSurface::ConstructL(MVGSurfaceImpl *aVGSurfaceImpl)
+ {
+ this->iImpl = aVGSurfaceImpl;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/Gfx2dDevice.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFX2DDEVICE_H
+#define GFX2DDEVICE_H
+
+#include <e32std.h>
+#include <fbs.h>
+#include <bitdev.h>
+
+#include "GfxFloatFixPt.h"
+
+
+
+/**
+ * This class provides the interface create a graphics device representation.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class CGfx2dDevice : public CBase
+ {
+ public:
+
+ /**
+ * Two-phase constructor.
+ *
+ * @since 1.0
+ * @param : aBitmap -- offscreen bitmap.
+ * @return
+ */
+ static CGfx2dDevice* NewL( CFbsBitmap* aBitmap );
+
+ /**
+ * Destructor
+ */
+ virtual ~CGfx2dDevice();
+
+ /**
+ * Create a graphics context.
+ *
+ * @since 1.0
+ * @param : aGc -- reference to store the new context.
+ * @return error code if any
+ */
+ TInt CreateContext( CGfx2dGc*& aGc, TFontSpec& aFontSpec );
+
+ /**
+ * Get size of the of the graphics context.
+ *
+ * @since 1.0
+ * @param
+ * @return size of graphics context.
+ */
+ TSize SizeInPixels();
+
+
+ protected:
+
+ /**
+ * Two-phase constructor.
+ *
+ * @since 1.0
+ * @param : aBitmap -- offscreen bitmap.
+ * @return
+ */
+ void ConstructL( CFbsBitmap* aBitmap );
+
+ private:
+
+ /**
+ * Constructor.
+ *
+ * @since 1.0
+ * @param : aBitmap -- offscreen bitmap.
+ * @return
+ */
+ CGfx2dDevice();
+
+ protected:
+ CFbsDevice* iGdiDevice;
+ CFbsBitmap* iBitmap;
+
+
+
+ private:
+ friend class CGfx2dGc;
+ friend class CGfxFont;
+ };
+
+#endif // GFX2DDEVICE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/Gfx2dGcInterface.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,945 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFX2DGCINT_H
+#define GFX2DGCINT_H
+
+
+#include <w32std.h>
+#include <e32std.h>
+#include <bitstd.h>
+#include <badesca.h>
+#include <fbs.h>
+#include <gdi.h>
+
+#include "GfxRenderingHints.h"
+#include "GfxStroke.h"
+#include "GfxColor.h"
+
+#include "SvgBitmapFontProvider.h"
+class MGfxShape;
+class MGfxPaint;
+
+typedef enum
+{
+ SVG_CAP_BUTT = 0,
+ SVG_CAP_ROUND = 1,
+ SVG_CAP_SQUARE = 2,
+ SVG_INVALID_LINE_CAP = -1
+} SVGLineCap;
+
+typedef enum
+{
+ SVG_JOIN_MITER = 0,
+ SVG_JOIN_ROUND = 1,
+ SVG_JOIN_BEVEL = 2,
+ SVG_INVALID_LINE_JOIN = -1
+} SVGLineJoin;
+
+/**
+ * This class provides the interface create a graphics context.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class CGfx2dGc : public CBase
+ {
+ public:
+
+ /**
+ * Draw the given shape.
+ *
+ * @since 1.0
+ * @param aShape : shape to draw.
+ * @return
+ */
+ virtual void DrawL( MGfxShape* aShape )=0;
+
+ /**
+ * Draw the given string starting at the given context coordinate,
+ * and stylized by the given parameters.
+ *
+ * @since 1.0
+ * @param aDesc : string to draw
+ * @param aX : x coordinate
+ * @param aTextAnchor : text anchor
+ * @param aTextDecoration : text decoration
+ * @param aFamilies : font family names
+ * @param aWordSpacing : spacing description for each word
+ * @param aLetterSpacing : spacing description for each letter
+ * @param aArrayRotate : angle of rotation
+ * @param aArrayX : array of x coordinates
+ * @param aArrayY : array of x coordinates
+ * @return
+ */
+ virtual void DrawStringL( const TDesC& aDesc,
+ TFloatFixPt aX,
+ TFloatFixPt aY,
+ TInt8 aTextAnchor,
+ TInt8 aTextDecoration,
+ CDesCArrayFlat* aFamilies,
+ TReal aWordSpacing,
+ TReal aLetterSpacing,
+ CArrayFix<TReal32>* aArrayRotate,
+ CArrayFix<TFloatFixPt>* aArrayX,
+ CArrayFix<TFloatFixPt>* aArrayY,
+ TSize& aBoundingBoxResult,
+ CFont*& aFont,
+ TFontSpec& aFontSpec )=0;
+
+ /**
+ * Draw the given bitmap at the given top-left coordinates.
+ *
+ * @since 1.0
+ * @param aDesc : bitmap image to draw
+ * @param aX : x coordinate
+ * @param aY : y coordinate
+ * @return
+ */
+ virtual void DrawImage( CFbsBitmap* aImage,
+ const TGfxRectangle2D& aImageRect,
+ TBool aHasAlpha = EFalse )=0;
+
+ /**
+ * Clear the whole graphics context.
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ virtual void Clear(TUint32 aRGBA8888Color)=0;
+
+ /**
+ * Get the foreground color setting.
+ *
+ * @since 1.0
+ * @param
+ * @return foreground color.
+ */
+ virtual TGfxColor ForegroundColor()=0;
+
+ /**
+ * Get the paint setting.
+ *
+ * @since 1.0
+ * @param
+ * @return paint.
+ */
+ virtual MGfxPaint* Paint()=0;
+
+ /**
+ * Get the rendering hints setting.
+ *
+ * @since 1.0
+ * @param
+ * @return rendering hints.
+ */
+ virtual TGfxRenderingHints* RenderingHints()=0;
+
+ /**
+ * Get the stroke setting.
+ *
+ * @since 1.0
+ * @param
+ * @return stroke.
+ */
+ virtual TGfxStroke Stroke()=0;
+
+ /**
+ * Get the boundary setting.
+ *
+ * @since 1.0
+ * @param
+ * @return boundary.
+ */
+ virtual TSize DeviceBounds()=0;
+ /**
+ * Get the font setting.
+ *
+ * @since 1.0
+ * @param
+ * @return font.
+ */
+
+ virtual CFont* Font()=0;
+
+
+ /**
+ * Set the foreground color.
+ *
+ * @since 1.0
+ * @param aColor : foreground color
+ * @return
+ */
+ virtual void SetForegroundColor( const TGfxColor& aColor )=0;
+
+
+ /**
+ * Set the background color.
+ *
+ * @since 1.0
+ * @param aColor : background color
+ * @return
+ */
+ virtual void SetBackgroundColor( const TGfxColor& aColor )=0;
+
+
+ /**
+ * Set the stroke-width.
+ *
+ * @since 3.2
+ * @param aWidth : stroke-width
+ * @return none.
+ */
+ virtual void SetStrokeWidth( const TFloatFixPt& aWidth )=0;
+
+
+ /**
+ * Set the paint info.
+ *
+ * @since 1.0
+ * @param aPaint : paint info
+ * @return
+ */
+ virtual void SetPaint( MGfxPaint* aPaint )=0;
+
+ /**
+ * Set the stroke info.
+ *
+ * @since 1.0
+ * @param aStroke : stroke info
+ * @return
+ */
+ virtual void SetStroke( TGfxStroke aStroke )=0;
+
+ /**
+ * Set the rendering hints.
+ *
+ * @since 1.0
+ * @param aRenderingHints : rendering hints
+ * @return
+ */
+ virtual void SetRenderingHints( const TGfxRenderingHints& aRenderingHints )=0;
+
+ /**
+ * Set the transform info.
+ *
+ * @since 1.0
+ * @param aTransform : transform info
+ * @return
+ */
+ virtual void SetTransform( const TGfxAffineTransform& aTransform )=0;
+
+ /**
+ * Set the clipping info.
+ *
+ * @since 1.0
+ * @param aClip : clipping rectangle
+ * @return
+ */
+ virtual void SetClip( const TGfxRectangle2D& aClip )=0;
+
+ /**
+ * Set the dash array info.
+ *
+ * @since 1.0
+ * @param aArray : array of points
+ * @param aOffset : offset point
+ * @return
+ */
+ virtual void SetDashArrayL( CArrayFix<TFloatFixPt>* aArray)=0;
+ virtual void SetDashOffset( TFloatFixPt aDashOffset ) =0;
+ /**
+ * Set the font size.
+ *
+ * @since 1.0
+ * @param aFontSize : font size
+ * @return
+ */
+ virtual void SetFontSize( const TFloatFixPt aFontSize )=0;
+
+ /**
+ * Set the winding rule.
+ *
+ * @since 1.0
+ * @param aRule : winding rule
+ * @return
+ */
+ virtual void SetWindingRule( TGfxWindingRule aRule )=0;
+
+ /**
+ * Set the font weight.
+ *
+ * @since 1.0
+ * @param aFontWeight : font weight value
+ * @return
+ */
+ virtual void SetFontWeight( const TInt32 aFontWeight )=0;
+
+ /**
+ * Set the font style.
+ *
+ * @since 1.0
+ * @param aFontStyle : font style
+ * @return
+ */
+ virtual void SetFontStyle( const TInt32 aFontStyle )=0;
+
+ /**
+ * Set the font family.
+ *
+ * @since 1.0
+ * @param aFamilies : font family names
+ * @return
+ */
+ virtual void SetFontFamily( CDesCArrayFlat* aFamilies )=0;
+
+ /**
+ * Set the text anchor
+ *
+ * @since 1.0
+ * @param aTextAnchor : text anchor value
+ * @return
+ */
+ virtual void SetTextanchor( const TInt32 aTextAnchor )=0;
+
+ /**
+ * Set the text decoration
+ *
+ * @since 1.0
+ * @param aTextDecoration : text decoration value
+ * @return
+ */
+ virtual void SetTextDecoration( const TInt32 aTextDecoration )=0;
+
+ /**
+ * Set the anti-alias mode
+ *
+ * @since 1.0
+ * @param aTextDecoration : anti-alias mode value
+ * @return
+ */
+ virtual void SetAntialiasingMode( const TInt32 aAntialiasingEnable )=0;
+
+ /**
+ * This method copies the internal RGBA8888 framebuffer to CfbsBitmap that
+ * is specified in constructor. The CfbsBitmap could be 4k color (RGB0444),
+ * 64k color (RGB565), or 16M color (RGB888).
+ *
+ * @since
+ * @param
+ * @return
+ */
+ virtual void UpdateFramebufferL( CFbsBitmap* aFrameBuffer, CFbsBitmap* aMask ) = 0;
+ virtual void UpdateFramebufferL( CFbsBitmap* aFrameBuffer, CFbsBitmap* aMask,TSize aFrameBufferSize,TDisplayMode aFrameBufferMode,TDisplayMode aMaskDspMode ) =0;
+ /**
+ * Blend aFrameBuffer with background buffer using the opacity value
+ *
+ * @since 1.0
+ * @param aFrameBuffer: Buffer to be blended with background
+ * aOpacity: opacity value (0<=aOpacity<=1.0)
+ * @return
+ */
+ virtual void BlendWithBackground(TUint32* aFrameBuffer, TReal32 aOpacity)=0;
+
+ /**
+ * Generate mask
+ *
+ * @since
+ * @param aMask: pointer to the mask
+ * @return
+ */
+ virtual void GenerateMask(CFbsBitmap* aMask)=0;
+
+ /**
+ * Set the fill opacity value
+ *
+ * @since 1.0
+ * @param aFillOpacity : opacity value (0<=aFillOpacity<=1.0)
+ * @return
+ */
+ virtual void SetFillOpacity(TFloatFixPt aFillOpacity)=0;
+
+ /**
+ * Set the stroke opacity value
+ *
+ * @since 1.0
+ * @param aStrokeOpacity : opacity value (0<=aStrokeOpacity<=1.0)
+ * @return
+ */
+ virtual void SetStrokeOpacity(TFloatFixPt aStrokeOpacity)=0;
+
+ /**
+ * Set the flag to do or ignore dithering.
+ *
+ * @since 1.0
+ * @param aDoDithering : TRUE or False
+ * @return
+ */
+ virtual void SetDoDithering( TBool aDoDithering )=0;
+
+ /**
+ * Request to change the buffer size.
+ *
+ * @since 1.0
+ * @param aSize : size of new buffer
+ * @return
+ */
+ virtual void ChangeBufferSizeL( const TSize aSize ) = 0;
+
+ // Rasterizer methods for group-opacity
+ virtual TUint32* ColorBuffer() { return NULL; };
+ virtual void UpdateColorBuffer() {};
+
+ // OpenVG methods for group-opacity
+ virtual void BindToImageL() {};
+ virtual void UnbindFromImageL( TReal32 /*aOpacity*/ ) {};
+
+ virtual void GetFontScaled( TFloatFixPt aHeight,
+ const TDesC& aTypefaceName,
+ CFont*& aFont,
+ TFontSpec& aFontSpec ) = 0;
+
+ // This is for work-around for OpenVG to simulate multiple contexts
+ // VGR does not need to do anything.
+ virtual void SetupContextL() {};
+ virtual void Flush() {};
+ virtual void DestroyContext()=0;
+ /**
+ * Get the NVG-TLV Encoded data.
+ *
+ * @since 1.0
+ * @return : pointer to the NVG-TLV data
+ */
+ virtual const TPtrC8 TLVEncodedData() const=0;
+
+ protected:
+
+ //Stores Font Type information as passed by CSvgEngineInterfaceImpl
+ CSvgBitmapFontProvider *iSvgBitmapFontProvider;
+ };
+
+/**
+ * DUMMY placeholder to prevent BC break in SVGEngine - deprecated and not used.
+ *
+ * @since 1.0
+ */
+class CGfx2dGcVGR : public CGfx2dGc
+ {
+
+ /**
+ * Two-phase constructor.
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CGfx2dGcVGR* NewL( const TSize aBufferSize, TFontSpec& aFontSpec, CSvgBitmapFontProvider *aSvgBitmapFontProvider );
+
+ /**
+ * Destructor
+ */
+ virtual ~CGfx2dGcVGR();
+
+ //old CFont* GetFontScaled( TFixPt aHeight, const TDesC& aTypefaceName );
+ void GetFontScaled( TFloatFixPt aHeight,
+ const TDesC& aTypefaceName,
+ CFont*& aFont,
+ TFontSpec& aFontSpec );
+
+ /**
+ * Adjust the shape complexity.
+ *
+ * @since 1.0
+ * @param aVertexSize : size of vertices to render.
+ * @return
+ */
+ void AdjustShapeComplexityL( TInt32 aVertexSize );
+
+ /**
+ * Draw the given shape.
+ *
+ * @since 1.0
+ * @param aShape : shape to draw.
+ * @return
+ */
+ void DrawL( MGfxShape* aShape );
+
+ /**
+ * Determine if given string should be drawn right to left
+ *
+ * @since 1.0
+ * @param aDesc : string to check if right to left
+ * @return true if right to left false otherwise
+ */
+ TBool IsRightToLeft(const TDesC& aDesc );
+
+ /**
+ * Draw the given string starting at the given context coordinate,
+ * and stylized by the given parameters.
+ *
+ * @since 1.0
+ * @param aDesc : string to draw
+ * @param aX : x coordinate
+ * @param aTextAnchor : text anchor
+ * @param aTextDecoration : text decoration
+ * @param aFamilies : font family names
+ * @param aWordSpacing : spacing description for each word
+ * @param aLetterSpacing : spacing description for each letter
+ * @param aArrayRotate : angle of rotation
+ * @param aArrayX : array of x coordinates
+ * @param aArrayY : array of x coordinates
+ * @return
+ */
+ void DrawStringL( const TDesC& aDesc,
+ TFloatFixPt aX,
+ TFloatFixPt aY,
+ TInt8 aTextAnchor,
+ TInt8 aTextDecoration,
+ CDesCArrayFlat* aFamilies,
+ TReal aWordSpacing,
+ TReal aLetterSpacing,
+ CArrayFix<TReal32>* aArrayRotate,
+ CArrayFix<TFloatFixPt>* aArrayX,
+ CArrayFix<TFloatFixPt>* aArrayY,
+ TSize& aBboxSizeResult,
+ CFont*& aFont,
+ TFontSpec& aFontSpec);
+
+ /**
+ * Draw the given bitmap at the given top-left coordinates.
+ *
+ * @since 1.0
+ * @param aDesc : bitmap image to draw
+ * @param aX : x coordinate
+ * @param aY : y coordinate
+ * @return
+ */
+ void DrawImage( CFbsBitmap* aImage,
+ const TGfxRectangle2D& aImageRect,
+ TBool aHasAlpha = EFalse );
+
+ /**
+ * Clear the whole graphics context.
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void Clear(TUint32 aRGBA8888Color);
+
+ /**
+ * Get the composite setting.
+ *
+ * @since 1.0
+ * @param
+ * @return composite value.
+ */
+ TUint8 Composite();
+
+ /**
+ * Get the foreground color setting.
+ *
+ * @since 1.0
+ * @param
+ * @return foreground color.
+ */
+ TGfxColor ForegroundColor() ;
+
+ /**
+ * Get the background color setting.
+ *
+ * @since 1.0
+ * @param
+ * @return background color.
+ */
+ TGfxColor BackgroundColor();
+
+ /**
+ * Get the paint setting.
+ *
+ * @since 1.0
+ * @param
+ * @return paint.
+ */
+ MGfxPaint* Paint();
+
+ /**
+ * Get the rendering hints setting.
+ *
+ * @since 1.0
+ * @param
+ * @return rendering hints.
+ */
+ TGfxRenderingHints* RenderingHints();
+
+ /**
+ * Get the stroke setting.
+ *
+ * @since 1.0
+ * @param
+ * @return stroke.
+ */
+ TGfxStroke Stroke();
+
+ /**
+ * Get the transform setting.
+ *
+ * @since 1.0
+ * @param
+ * @return transform.
+ */
+ TGfxAffineTransform Transform();
+
+ /**
+ * Get the clipping area setting.
+ *
+ * @since 1.0
+ * @param
+ * @return clipping area.
+ */
+ MGfxShape* Clip();
+
+ /**
+ * Get the boundary setting.
+ *
+ * @since 1.0
+ * @param
+ * @return boundary.
+ */
+ TSize DeviceBounds();
+ /**
+ * Get the font setting.
+ *
+ * @since 1.0
+ * @param
+ * @return font.
+ */
+
+ CFont* Font();
+
+ /**
+ * Get the stroke setting.
+ *
+ * @since 1.0
+ * @param aArray : array of points to store dash array info
+ * @param aOffset : offset point dash array offset info
+ * @return
+ */
+ void GetDashArray( CArrayFix<TFloatFixPt>*& aArray,
+ TFloatFixPt& aOffset );
+
+ /**
+ * Set the composite info.
+ *
+ * @since 1.0
+ * @param aComposite : composite info
+ * @return
+ */
+ void SetComposite( const TUint8 aComposite );
+
+ /**
+ * Set the foreground color.
+ *
+ * @since 1.0
+ * @param aColor : foreground color
+ * @return
+ */
+ void SetForegroundColor( const TGfxColor& aColor );
+
+ /**
+ * Set the background color.
+ *
+ * @since 1.0
+ * @param aColor : background color
+ * @return
+ */
+ void SetBackgroundColor( const TGfxColor& aColor );
+
+ /**
+ * Set the paint info.
+ *
+ * @since 1.0
+ * @param aPaint : paint info
+ * @return
+ */
+ void SetPaint( MGfxPaint* aPaint );
+
+ /**
+ * Set the stroke info.
+ *
+ * @since 1.0
+ * @param aStroke : stroke info
+ * @return
+ */
+ void SetStroke( TGfxStroke aStroke );
+
+ /**
+ * Set the rendering hints.
+ *
+ * @since 1.0
+ * @param aRenderingHints : rendering hints
+ * @return
+ */
+ void SetRenderingHints( const TGfxRenderingHints& aRenderingHints );
+
+ /**
+ * Set the transform info.
+ *
+ * @since 1.0
+ * @param aTransform : transform info
+ * @return
+ */
+ void SetTransform( const TGfxAffineTransform& aTransform );
+
+ /**
+ * Set the clipping info.
+ *
+ * @since 1.0
+ * @param aClip : clipping rectangle
+ * @return
+ */
+ void SetClip( const TGfxRectangle2D& aClip );
+
+ /**
+ * Set the font.
+ *
+ * @since 1.0
+ * @param aFont : font
+ * @return
+ */
+
+ void SetFont( const CFont* aFont );
+
+ /**
+ * Set the dash array info.
+ *
+ * @since 1.0
+ * @param aArray : array of points
+ * @param aOffset : offset point
+ * @return
+ */
+ void SetDashArrayL( CArrayFix<TFloatFixPt>* aArray);
+ void SetDashOffset( TFloatFixPt aDashOffset );
+ /**
+ * Set the font size.
+ *
+ * @since 1.0
+ * @param aFontSize : font size
+ * @return
+ */
+ void SetFontSize( const TFloatFixPt aFontSize );
+
+ /**
+ * Set the winding rule.
+ *
+ * @since 1.0
+ * @param aRule : winding rule
+ * @return
+ */
+ void SetWindingRule( TGfxWindingRule aRule );
+
+ /**
+ * Set the font weight.
+ *
+ * @since 1.0
+ * @param aFontWeight : font weight value
+ * @return
+ */
+ void SetFontWeight( const TInt32 aFontWeight );
+
+ /**
+ * Set the font style.
+ *
+ * @since 1.0
+ * @param aFontStyle : font style
+ * @return
+ */
+ void SetFontStyle( const TInt32 aFontStyle );
+
+ /**
+ * Set the font family.
+ *
+ * @since 1.0
+ * @param aFamilies : font family names
+ * @return
+ */
+ void SetFontFamily( CDesCArrayFlat* aFamilies );
+
+ /**
+ * Set the text anchor
+ *
+ * @since 1.0
+ * @param aTextAnchor : text anchor value
+ * @return
+ */
+ void SetTextanchor( const TInt32 aTextAnchor );
+
+ /**
+ * Set the text decoration
+ *
+ * @since 1.0
+ * @param aTextDecoration : text decoration value
+ * @return
+ */
+ void SetTextDecoration( const TInt32 aTextDecoration );
+
+ /**
+ * Set the anti-alias mode
+ *
+ * @since 1.0
+ * @param aTextDecoration : anti-alias mode value
+ * @return
+ */
+ void SetAntialiasingMode( const TInt32 aAntialiasingEnable );
+
+ /**
+ * This method copies the internal RGBA8888 framebuffer to CfbsBitmap that
+ * is specified in constructor. The CfbsBitmap could be 4k color (RGB0444),
+ * 64k color (RGB565), or 16M color (RGB888).
+ *
+ * @since
+ * @param
+ * @return
+ */
+
+ void UpdateFramebufferL( CFbsBitmap* aBitmap, CFbsBitmap* aMask );
+ void UpdateFramebufferL( CFbsBitmap* aFrameBuffer, CFbsBitmap* aMask,TSize aFrameBufferSize,TDisplayMode aFrameBufferMode,TDisplayMode aMaskDspMode );
+
+ /**
+ * Blend aFrameBuffer with background buffer using the opacity value
+ *
+ * @since 1.0
+ * @param aFrameBuffer: Buffer to be blended with background
+ * aOpacity: opacity value (0<=aOpacity<=1.0)
+ * @return
+ */
+ void BlendWithBackground(TUint32* aFrameBuffer, TReal32 aOpacity);
+
+ /**
+ * return ibuffer
+ *
+ * @since 1.0
+ * @param
+ *
+ * @return pointer
+ */
+
+ void GenerateMask(CFbsBitmap* aMask);
+
+ /**
+ * Set the fill opacity value
+ *
+ * @since 1.0
+ * @param aFillOpacity : opacity value (0<=aFillOpacity<=1.0)
+ * @return
+ */
+ void SetFillOpacity(TFloatFixPt aFillOpacity);
+
+ /**
+ * Set the stroke opacity value
+ *
+ * @since 1.0
+ * @param aStrokeOpacity : opacity value (0<=aStrokeOpacity<=1.0)
+ * @return
+ */
+ void SetStrokeOpacity(TFloatFixPt aStrokeOpacity);
+
+ /**
+ * Set the flag to do or ignore dithering.
+ *
+ * @since 1.0
+ * @param aDoDithering : TRUE or False
+ * @return
+ */
+ void SetDoDithering( TBool aDoDithering );
+
+ /**
+ * Request to change the buffer size.
+ *
+ * @since 1.0
+ * @param aSize : size of new buffer
+ * @return
+ */
+ void ChangeBufferSizeL( const TSize aBufferSize );
+
+ /**
+ * Request to update the context color buffer.
+ *
+ * @since 1.0
+ * @return
+ */
+ void UpdateColorBuffer();
+
+ /**
+ * Get the 32-bit color buffer for this gfx context.
+ *
+ * @since 1.0
+ * @return
+ */
+ TUint32* ColorBuffer();
+
+private:
+
+ /**
+ * Constructor
+ */
+ CGfx2dGcVGR();
+
+ /**
+ * Two-phase constructor
+ */
+ void ConstructL( const TSize aBufferSize, TFontSpec& aFontSpec, CSvgBitmapFontProvider *aSvgBitmapFontProvider);
+
+ /**
+ * Perform the drawing operations of the given shape.
+ *
+ * @since 1.0
+ * @param aShape : shape to draw
+ * @return
+ */
+ void DoDrawL( MGfxShape* aShape );
+
+
+ /**
+ * Clear context routine in assembly for performance.
+ * @since 1.0
+ * @param pBitmap : pointer to bitmap
+ * @param aColor : color to clear background
+ * @param aSize : number of pixels to clear
+ * @return
+ */
+ void ClearAsm( TInt* pBitmap,
+ TInt aColor,
+ TInt aSize );
+
+ /**
+ * Activate this context with the given graphics device.
+ *
+ * @since 1.0
+ * @param : aDevice -- graphics device.
+ * @return
+ */
+ void ActivateL();
+
+
+ void ColorConvertTo64K( TUint32* aDestAddress, const TSize& aSize );
+
+ void PostDraw();
+ };
+#endif // GFX2DGCINT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/Gfx2dGcOpenVG.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,562 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFX2DGCOPENVG_H
+#define GFX2DGCOPENVG_H
+
+#include "Gfx2dGcInterface.h"
+#include "GfxRendererInfoP.h"
+#include "VGRenderer.h"
+#include <SVGRendererId.h>
+#include "VGSurface.h"
+#include <VG/openvg.h>
+
+const TUint8 KMediaAnimationVisible = 2;
+
+/**
+ * This class provides the interface create a graphics context.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class CGfx2dGcOpenVG : public CGfx2dGc
+ {
+ public:
+
+ /**
+ * Two-phase constructor.
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ static CGfx2dGcOpenVG* NewL( const TSize aBufferSize, TFontSpec& aFontSpec, CSvgBitmapFontProvider* aSvgBitmapFontProvider, TBool aIsMain = ETrue );
+
+ static CGfx2dGcOpenVG* NewL( const TSize aBufferSize, TFontSpec& aFontSpec, CSvgBitmapFontProvider* aSvgBitmapFontProvider,SVGRendererId aRendererType,TBool aIsMain = ETrue );
+ void GetFontScaled( TFloatFixPt aHeight, const TDesC& aTypefaceName, CFont*& aFont, TFontSpec& aFontSpec );
+
+ /**
+ * Destructor
+ */
+ virtual ~CGfx2dGcOpenVG();
+
+
+ /**
+ * Draw the given shape.
+ *
+ * @since 1.0
+ * @param aShape : shape to draw.
+ * @return
+ */
+ void DrawL( MGfxShape* aShape );
+
+ /**
+ * Draw the given string starting at the given context coordinate,
+ * and stylized by the given parameters.
+ *
+ * @since 1.0
+ * @param aDesc : string to draw
+ * @param aX : x coordinate
+ * @param aTextAnchor : text anchor
+ * @param aTextDecoration : text decoration
+ * @param aFamilies : font family names
+ * @param aWordSpacing : spacing description for each word
+ * @param aLetterSpacing : spacing description for each letter
+ * @param aArrayRotate : angle of rotation
+ * @param aArrayX : array of x coordinates
+ * @param aArrayY : array of x coordinates
+ * @return
+ */
+ void DrawStringL( const TDesC& aDesc,
+ TFloatFixPt aX,
+ TFloatFixPt aY,
+ TInt8 aTextAnchor,
+ TInt8 aTextDecoration,
+ CDesCArrayFlat* aFamilies,
+ TReal aWordSpacing,
+ TReal aLetterSpacing,
+ CArrayFix<TReal32>* aArrayRotate,
+ CArrayFix<TFloatFixPt>* aArrayX,
+ CArrayFix<TFloatFixPt>* aArrayY,
+ TSize& aBoundingBoxResult,
+ CFont*& aFont,
+ TFontSpec& aFontSpec);
+
+ /**
+ * Draw the given bitmap at the given top-left coordinates.
+ *
+ * @since 1.0
+ * @param aDesc : bitmap image to draw
+ * @param aX : x coordinate
+ * @param aY : y coordinate
+ * @return
+ */
+ void DrawImage( CFbsBitmap* aImage,
+ const TGfxRectangle2D& aImageRect,
+ TBool aHasAlpha = EFalse );
+
+ /**
+ * Clear the whole graphics context.
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ void Clear(TUint32 aRGBA8888Color);
+
+ /**
+ * Get the foreground color setting.
+ *
+ * @since 1.0
+ * @param
+ * @return foreground color.
+ */
+ TGfxColor ForegroundColor();
+
+ /**
+ * Get the paint setting.
+ *
+ * @since 1.0
+ * @param
+ * @return paint.
+ */
+ MGfxPaint* Paint();
+
+ /**
+ * Get the rendering hints setting.
+ *
+ * @since 1.0
+ * @param
+ * @return rendering hints.
+ */
+ TGfxRenderingHints* RenderingHints();
+
+ /**
+ * Get the stroke setting.
+ *
+ * @since 1.0
+ * @param
+ * @return stroke.
+ */
+ TGfxStroke Stroke();
+
+ /**
+ * Get the boundary setting.
+ *
+ * @since 1.0
+ * @param
+ * @return boundary.
+ */
+ TSize DeviceBounds();
+ /**
+ * Get the font setting.
+ *
+ * @since 1.0
+ * @param
+ * @return font.
+ */
+
+ CFont* Font();
+
+
+ /**
+ * Set the foreground color.
+ *
+ * @since 1.0
+ * @param aColor : foreground color
+ * @return
+ */
+ void SetForegroundColor( const TGfxColor& aColor );
+
+ /**
+ * Set the background color.
+ *
+ * @since 1.0
+ * @param aColor : background color
+ * @return
+ */
+ void SetBackgroundColor( const TGfxColor& aColor );
+
+
+ /**
+ * Set the stroke-width.
+ *
+ * @since 3.2
+ * @param aWidth : stroke-width
+ * @return none.
+ */
+ void SetStrokeWidth( const TFloatFixPt& aWidth );
+
+
+ /**
+ * Set the paint info.
+ *
+ * @since 1.0
+ * @param aPaint : paint info
+ * @return
+ */
+ void SetPaint( MGfxPaint* aPaint );
+
+ /**
+ * Set the stroke info.
+ *
+ * @since 1.0
+ * @param aStroke : stroke info
+ * @return
+ */
+ void SetStroke( TGfxStroke aStroke );
+
+ /**
+ * Set the rendering hints.
+ *
+ * @since 1.0
+ * @param aRenderingHints : rendering hints
+ * @return
+ */
+ void SetRenderingHints( const TGfxRenderingHints& aRenderingHints );
+
+ /**
+ * Set the transform info.
+ *
+ * @since 1.0
+ * @param aTransform : transform info
+ * @return
+ */
+ void SetTransform( const TGfxAffineTransform& aTransform );
+
+ /**
+ * Set the clipping info.
+ *
+ * @since 1.0
+ * @param aClip : clipping rectangle
+ * @return
+ */
+ void SetClip( const TGfxRectangle2D& aClip );
+
+ /**
+ * Set the font.
+ *
+ * @since 1.0
+ * @param aFont : font
+ * @return
+ */
+
+ void SetFont( const CFont* aFont );
+
+ /**
+ * Set the dash array info.
+ *
+ * @since 1.0
+ * @param aArray : array of points
+ * @param aOffset : offset point
+ * @return
+ */
+ void SetDashArrayL( CArrayFix<TFloatFixPt>* aArray);
+ void SetDashOffset( TFloatFixPt aDashOffset ) ;
+ /**
+ * Set the font size.
+ *
+ * @since 1.0
+ * @param aFontSize : font size
+ * @return
+ */
+ void SetFontSize( const TFloatFixPt aFontSize );
+
+ /**
+ * Set the winding rule.
+ *
+ * @since 1.0
+ * @param aRule : winding rule
+ * @return
+ */
+ void SetWindingRule( TGfxWindingRule aRule );
+
+ /**
+ * Set the font weight.
+ *
+ * @since 1.0
+ * @param aFontWeight : font weight value
+ * @return
+ */
+ void SetFontWeight( const TInt32 aFontWeight );
+
+ /**
+ * Set the font style.
+ *
+ * @since 1.0
+ * @param aFontStyle : font style
+ * @return
+ */
+ void SetFontStyle( const TInt32 aFontStyle );
+
+ /**
+ * Set the font family.
+ *
+ * @since 1.0
+ * @param aFamilies : font family names
+ * @return
+ */
+ void SetFontFamily( CDesCArrayFlat* aFamilies );
+
+ /**
+ * Set the text anchor
+ *
+ * @since 1.0
+ * @param aTextAnchor : text anchor value
+ * @return
+ */
+ void SetTextanchor( const TInt32 aTextAnchor );
+
+ /**
+ * Set the text decoration
+ *
+ * @since 1.0
+ * @param aTextDecoration : text decoration value
+ * @return
+ */
+ void SetTextDecoration( const TInt32 aTextDecoration );
+
+ /**
+ * Set the anti-alias mode
+ *
+ * @since 1.0
+ * @param aTextDecoration : anti-alias mode value
+ * @return
+ */
+ void SetAntialiasingMode( const TInt32 aAntialiasingEnable );
+
+ /**
+ * This method copies the internal RGBA8888 framebuffer to CfbsBitmap that
+ * is specified in constructor. The CfbsBitmap could be 4k color (RGB0444),
+ * 64k color (RGB565), or 16M color (RGB888).
+ *
+ * @since
+ * @param
+ * @return
+ */
+ void UpdateFramebufferL( CFbsBitmap* aBitmap, CFbsBitmap* aMask );
+
+ void UpdateFramebufferL( CFbsBitmap* aBitmap, CFbsBitmap* aMask,TSize BitmapSize,TDisplayMode aBitmapDspMode,TDisplayMode aMaskDspMode );
+ /**
+ * Blend aFrameBuffer with background buffer using the opacity value
+ *
+ * @since 1.0
+ * @param aFrameBuffer: Buffer to be blended with background
+ * aOpacity: opacity value (0<=aOpacity<=1.0)
+ * @return
+ */
+ void BlendWithBackground(TUint32* aFrameBuffer, TReal32 aOpacity);
+
+ /**
+ * Generate mask
+ *
+ * @since
+ * @param aMask: pointer to the mask
+ * @return
+ */
+ void GenerateMask(CFbsBitmap* aMask);
+
+ /**
+ * Set the fill opacity value
+ *
+ * @since 1.0
+ * @param aFillOpacity : opacity value (0<=aFillOpacity<=1.0)
+ * @return
+ */
+ void SetFillOpacity(TFloatFixPt aFillOpacity);
+
+ /**
+ * Set the stroke opacity value
+ *
+ * @since 1.0
+ * @param aStrokeOpacity : opacity value (0<=aStrokeOpacity<=1.0)
+ * @return
+ */
+ void SetStrokeOpacity(TFloatFixPt aStrokeOpacity);
+
+ /**
+ * Set the flag to do or ignore dithering.
+ *
+ * @since 1.0
+ * @param aDoDithering : TRUE or False
+ * @return
+ */
+ void SetDoDithering( TBool aDoDithering );
+
+ /**
+ * Request to change the buffer size.
+ *
+ * @since 1.0
+ * @param aSize : size of new buffer
+ * @return
+ */
+ void ChangeBufferSizeL( const TSize aBufferSize );
+
+ // Group opacity methods
+ void BindToImageL();
+ void UnbindFromImageL( TReal32 aOpacity );
+
+ void BindToMediaImageL(TInt aWidth, TInt aHeigth);
+ void UnbindFromMediaImageL(const TGfxAffineTransform& aAffineTransform,TReal32 aOpacity,TInt aWidth, TInt aHeight, TInt aDraw );
+ void SetClipMediaElement( TSize aSize );
+ void GetMatrix(TReal32 * m);
+ void SetBitmapHeader(const TDesC* aHeaderData);
+ /**
+ * Get the NVG-TLV data
+ *
+ * @since 1.0
+ * @return : pointer to the NVG-TLV data
+ */
+ const TPtrC8 TLVEncodedData() const;
+ private:
+
+ /**
+ * Constructor
+ */
+ CGfx2dGcOpenVG( TBool aIsMainContext );
+ /**
+
+ /**
+ * Constructor
+ */
+ CGfx2dGcOpenVG();
+
+ /**
+ * Two-phase constructor
+ */
+ void ConstructL(const TSize aBufferSize, TFontSpec& aFontSpec, CSvgBitmapFontProvider* aSvgBitmapFontProvider);
+
+ /**
+
+ * Constructor NGA with the renderer selector parameter
+
+ */
+
+ void ConstructL(const TSize aBufferSize, TFontSpec& aFontSpec, CSvgBitmapFontProvider* aSvgBitmapFontProvider,SVGRendererId aRendererType);
+
+ /**
+ * Perform the drawing operations of the given shape.
+ *
+ * @since 1.0
+ * @param aShape : shape to draw
+ * @return
+ */
+ void DoDrawL( MGfxShape* aShape );
+
+ void PseudoDoDrawL( MGfxShape* aShape );
+
+ /**
+ * Destroy the OpenVG context and delete the 32-bit intermediate color buffer
+ *
+ * @since 1.0
+ * @return
+ */
+ void DestroyContext();
+ /**
+ * Converts OpenVG Errors into Symbian error codes
+ *
+ * @since
+ * @return TInt
+ */
+ TInt OpenVGErrorToSymbianError( TInt aError );
+
+ void ApplyTransform( TGfxAffineTransform& aAffineTransform );
+ void ApplyTransformMediaElement(const TGfxAffineTransform& aAffineTransform,TSize& aSize );
+
+ VGbitfield SetFillStroke(VGPaint aFillPaint, VGPaint aStrokePaint, TGfxRectangle2D& bBox);
+
+ VGImage CreateVGImage( void* aBuffer, TSize aSize, TDisplayMode aDisplayMode, TBool aPreMultiplied = ETrue );
+
+ // This is for work-around for OpenVG to simulate multiple contexts
+ void SetupContextL();
+ void Flush();
+ /**
+ * Sets the Paint,Stroke and Path handle back to VG_INVALID_HANDLE
+ *
+ * @since
+ * @return void
+ */
+ void ResetContextHandle();
+ //To find the bounding box for system text..
+ TGfxRectangle2D GetBBoxForSystemText( const TDesC& aText,
+ TFloatFixPt aX,
+ TFloatFixPt aY );
+
+ TGfxRectangle2D GetTRect(TGfxPoint2D lTransTopLeftCorner,
+ TGfxPoint2D lTransTopRightCorner,
+ TGfxPoint2D lTransBottomLeftCorner,
+ TGfxPoint2D lTransBottomRightCorner);
+
+ // Method to handle cleanup (turning off settings, such as dasharray) for efficiency.
+ void PostDraw();
+
+ private:
+ // 32-bit buffer for OpenVG to draw to
+ // Color conversion/copy to Symbian bitmap is needed as final step
+ TSize iColorBufferSize;
+
+ TGfxRectangle2D iClip;
+ MGfxPaint* iFillColor;
+ TFloatFixPt iFillOpacity;
+ TFloatFixPt iScale;
+ TGfxStroke iStroke;
+ TGfxAffineTransform iTransform;
+ TGfxColor iStrokeColor;
+ TFloatFixPt iStrokeOpacity;
+ TGfxColor iBackgroundColor;
+ CFont* iFont;
+ CArrayFix<VGfloat>* iDashArray;
+ TFloatFixPt iDashOffset;
+ TFloatFixPt iFontSize;
+ TInt32 iFontWeight;
+ TInt32 iFontStyle;
+ CDesCArrayFlat* iFamilies;
+ TInt32 iTextAnchor;
+ TInt32 iTextDecoration;
+ TGfxRendererInfoP iRenderInfo;
+
+ // Flag used for using CFbsBitmap::DataAddress() instead of allocating
+ // TInt32 array to draw shapes.
+ TFontSpec iFontSpec;
+ //OpenVG stuff
+
+ TDisplayMode iDisplayMode;
+ TBool iGraphicsContextCreated;
+ TBool iIsMainContext;
+
+ VGPaint iFillPaint;
+ VGPaint iStrokePaint;
+ VGPath iPath;
+
+ RArray<VGImage> iGroupOpacityImages;
+ RPointerArray<TUint32> iGroupOpacityBuffers;
+
+ VGubyte* iPathSegmentTypes;
+ TInt iPathSegmentTypeCount;
+ TGfxRectangle2D iClipMain;
+ TSize iColorBufferSizeMain;
+ TInt32 iRenderQuality;
+
+ CVGRenderer * iVgRenderer;
+
+ CVGSurface * iVgSurface;
+
+ SVGRendererId iCurrentRendererType;
+ };
+
+#endif // GFX2DGCOPENVG_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxAffineTransform.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,473 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXAFFINETRANSFORM_H
+#define GFXAFFINETRANSFORM_H
+
+
+#include <e32std.h>
+#include <e32base.h>
+
+#include "GfxFloatFixPt.h"
+
+
+// These constants are used because enumeration cannot
+// accept bit operation
+const TInt32 KTransformIdentity = 0;
+const TInt32 KTransformTranslate = 1;
+const TInt32 KTransformScale = 2;
+const TInt32 KTransformShear = 4;
+
+typedef TFloatFixPt TMatrixElType;
+typedef TUint32 TGfxTransformType;
+
+class TGfxAffineTransform;
+class CGfxShape;
+class TGfxPoint2D;
+
+
+/**
+ * This class implements operations of a 2D transform matrix.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TGfxAffineTransform
+ {
+ public:
+
+ /**
+ * Construct an identity matrix.
+ *
+ * @since 1.0
+ * @param
+ * @return
+ */
+ TGfxAffineTransform();
+
+ /**
+ * Constructor.
+ *
+ * @since 1.0
+ * @param aM00 : row 0, column 0 value of matrix.
+ * @param aM10 : row 1, column 0 value of matrix.
+ * @param aM01 : row 0, column 1 value of matrix.
+ * @param aM11 : row 1, column 1 value of matrix.
+ * @param aM02 : row 0, column 2 value of matrix.
+ * @param aM12 : row 1, column 2 value of matrix.
+ * @return
+ */
+ TGfxAffineTransform( TReal32 aM00,
+ TReal32 aM10,
+ TReal32 aM01,
+ TReal32 aM11,
+ TReal32 aM02,
+ TReal32 aM12 );
+
+
+ /**
+ * Return a TGfxAffineTransform object with the rotation info
+ * of the given angle applied.
+ *
+ * @since 1.0
+ * @param aTheta : angle to create a rotation affine transform.
+ * @return
+ */
+ static TGfxAffineTransform GetRotateInstance( TReal32 aTheta );
+
+ /**
+ * Return a TGfxAffineTransform object with the rotation info
+ * of the given angle, rotated at the given point.
+ *
+ * @since 1.0
+ * @param aTheta : angle to create a rotation affine transform.
+ * @param aX : x value of rotation center.
+ * @param aY : x value of rotation center.
+ * @return
+ */
+ static TGfxAffineTransform GetRotateInstance( TReal32 aTheta,
+ const TFloatFixPt& aX,
+ const TFloatFixPt& aY );
+
+/**
+ * Return a TGfxAffineTransform object with the zoom info
+ * of the given scalefactor, scaled at the given point.
+ *
+ * @since 1.0
+ * @param aScaleFactor : scaling factor
+ * @param aX : x value of scaling center.
+ * @param aY : x value of scaling center.
+ * @return
+ */
+ static TGfxAffineTransform GetZoomInstance( TReal32 aScaleFactor,
+ const TFloatFixPt& aX,
+ const TFloatFixPt& aY );
+
+ /**
+ * Return a TGfxAffineTransform object with the scaling info
+ * applied.
+ *
+ * @since 1.0
+ * @param aSx : scaling factor in the x axis.
+ * @param aSy : scaling factor in the y axis.
+ * @return
+ */
+ static TGfxAffineTransform GetScaleInstance( TReal32 aSx,
+ TReal32 aSy );
+
+ /**
+ * Return a TGfxAffineTransform object with the shearing info
+ * applied.
+ *
+ * @since 1.0
+ * @param aShx : shearing factor in the x axis.
+ * @param aShy : shearing factor in the y axis.
+ * @return
+ */
+ static TGfxAffineTransform GetShearInstance( TReal32 aShx,
+ TReal32 aShy );
+
+ /**
+ * Return a TGfxAffineTransform object with the translation info
+ * applied.
+ *
+ * @since 1.0
+ * @param aTx : translation value in the x axis.
+ * @param aTy : translation value in the y axis.
+ * @return
+ */
+ static TGfxAffineTransform GetTranslateInstance( const TFloatFixPt& aTx,
+ const TFloatFixPt& aTy );
+
+ /**
+ * Return the determinate value of this matrix.
+ *
+ * @since 1.0
+ * @return the determinate value
+ */
+ TReal32 Determinant() const;
+
+ /**
+ * Return wether this matrix is an indentity matrix.
+ *
+ * @since 1.0
+ * @return true if this matrix is an identity matrix.
+ */
+ TBool IsIdentity() const;
+
+ /**
+ * Return the scaling factor in the x axis.
+ *
+ * @since 1.0
+ * @return scaling factor in the x axis.
+ */
+ TReal32 ScaleX() const;
+
+ /**
+ * Return the scaling factor in the y axis.
+ *
+ * @since 1.0
+ * @return scaling factor in the y axis.
+ */
+ TReal32 ScaleY() const;
+
+ /**
+ * Return the shearing factor in the x axis.
+ *
+ * @since 1.0
+ * @return shearing factor in the x axis.
+ */
+ TReal32 ShearX() const;
+
+ /**
+ * Return the shearing factor in the y axis.
+ *
+ * @since 1.0
+ * @return shearing factor in the y axis.
+ */
+ TReal32 ShearY() const;
+
+ /**
+ * Return the translation value in the x axis.
+ *
+ * @since 1.0
+ * @return translation value in the x axis.
+ */
+ TReal32 TranslateX() const;
+
+ /**
+ * Return the translation value in the y axis.
+ *
+ * @since 1.0
+ * @return translation value in the y axis.
+ */
+ TReal32 TranslateY() const;
+
+ /**
+ * Create the inverse tranformation matrix of this matrix.
+ *
+ * @since 1.0
+ * @return inverse matrix.
+ */
+ TGfxAffineTransform CreateInverse();
+
+
+ /**
+ * Muliply this given matrix with this matrix.
+ *
+ * @since 1.0
+ * @return
+ */
+ void Concatenate( const TGfxAffineTransform& aTransform );
+
+
+ /**
+ * Appends this transform with the existing transform
+ * Multiply in reverse order
+ * For Ex: In cases of zoom, rotate and pan of already transformed content.
+ * If T is the existing transform and zoom operation has to be applied to it
+ * the resultant transform would be Z*T.
+ * @since 1.0
+ * @return
+ */
+ void AppendTransform( const TGfxAffineTransform& aTransform );
+
+ /**
+ * Apply the given rotation angle to this matrix.
+ *
+ * @since 1.0
+ * @param aTheta : angle of rotation
+ * @return
+ */
+ void Rotate( TReal32 aTheta );
+
+ /**
+ * Apply the given rotation angle about this given point to this matrix.
+ *
+ * @since 1.0
+ * @param aTheta : angle of rotation
+ * @param aX : x coordinate for center of rotation.
+ * @param aY : y coordinate for center of rotation.
+ * @return
+ */
+ void Rotate( TReal32 aTheta,
+ const TFloatFixPt& aX,
+ const TFloatFixPt& aY );
+
+ /**
+ * Apply the given rotation angle about this given point to this matrix.
+ *
+ * @since 1.0
+ * @param aTheta : angle of rotation
+ * @param aX : x coordinate for center of rotation.
+ * @param aY : y coordinate for center of rotation.
+ * @return
+ */
+
+ void UserRotate( TReal32 aTheta,
+ const TFloatFixPt& aX,
+ const TFloatFixPt& aY );
+
+ /*
+ * Apply the given scaling factor for this given point to this matrix.
+ *
+ *
+ * @since 1.0
+ * @param aScaleFactor : scaling factor
+ * @param aX : x value of scaling center.
+ * @param aY : x value of scaling center.
+ * @return
+ */
+
+ void UserZoom( TReal32 aScaleFactor,
+ const TFloatFixPt& aX,
+ const TFloatFixPt& aY );
+
+ /**
+ * Apply the given scale factors to this matrix.
+ *
+ * @since 1.0
+ * @param aSx : scaling factor in the x axis.
+ * @param aSy : scaling factor in the y axis.
+ * @return
+ */
+ void Scale( TReal32 aSx, TReal32 aSy );
+
+ /**
+ * Apply the given translation values to this matrix.
+ *
+ * @since 1.0
+ * @param aTx : translation value in the x axis.
+ * @param aTy : translation value in the y axis.
+ * @return
+ */
+ void Translate( const TFloatFixPt& aTx,
+ const TFloatFixPt& aTy );
+
+ /**
+ * Apply the given translation values to this matrix.
+ *
+ * @since 1.0
+ * @param aTx : translation value in the x axis.
+ * @param aTy : translation value in the y axis.
+ * @return
+ */
+ void UserPan( const TFloatFixPt& aTx,
+ const TFloatFixPt& aTy );
+
+ /**
+ * Apply the given shearing values to this matrix.
+ *
+ * @since 1.0
+ * @param aTx : shearing value in the x axis.
+ * @param aTy : shearing value in the y axis.
+ * @return
+ */
+ void Shear( TReal32 aShX, TReal32 aShY );
+
+ /**
+ * Set the transformation info of this matrix to the given values.
+ *
+ * @since 1.0
+ * @param aM00 : row 0, column 0 value of matrix.
+ * @param aM10 : row 1, column 0 value of matrix.
+ * @param aM01 : row 0, column 1 value of matrix.
+ * @param aM11 : row 1, column 1 value of matrix.
+ * @param aM02 : row 0, column 2 value of matrix.
+ * @param aM12 : row 1, column 2 value of matrix.
+ * @return
+ */
+ void SetTransform( TReal32 aM00,
+ TReal32 aM10,
+ TReal32 aM01,
+ TReal32 aM11,
+ TReal32 aM02,
+ TReal32 aM12 );
+
+ /**
+ * Apply the transformation described by this matrix to the
+ * array of TGfxPoint2D.
+ *
+ * @since 1.0
+ * @param aSrcPts : array of TGfxPoint2D values to transform.
+ * @param aDstPts : array to store transformed points.
+ * @param aNumPts : number of points to transform.
+ * @return
+ */
+ void Transform( TGfxPoint2D* aSrcPts,
+ TGfxPoint2D* aDstPts,
+ TInt32 aNumPts ) const;
+
+ /**
+ * Apply the transformation described by this matrix to the
+ * array of TFloatFixPt.
+ *
+ * @since 1.0
+ * @param aSrcPts : array of TFloatFixPt values to transform.
+ * @param aDstPts : array to store transformed points.
+ * @param aNumPts : number of points to transform.
+ * @return
+ */
+ void Transform( TFloatFixPt* aSrcPts,
+ TFloatFixPt* aDstPts,
+ TInt32 aNumPts ) const;
+
+ /**
+ * Apply the transformation described by this matrix to the
+ * array of TFloatFixPt. Old values are replaced.
+ *
+ * @since 1.0
+ * @param aSrcPts : array of TFloatFixPt values to transform.
+ * @param aNumPts : number of points to transform.
+ * @return
+ */
+ void Transform( TFloatFixPt* aSrcDstPts,
+ TInt32 aNumPts ) const;
+
+
+ /**
+ * Return the transformation type of this matrix.
+ *
+ * @since 1.0
+ * @return transformation type
+ */
+ TUint32 TransformType();
+
+ void Print();
+
+ /**
+ * Get the scaling factor set in this transform. This function returns correctly
+ * for a uniform scaling in both directions only.
+ * @since 1.0
+ * @return
+ */
+ TFloatFixPt ScalingFactor() const;
+
+ private:
+
+ /**
+ * Constructor.
+ *
+ * @since 1.0
+ * @param aM00 : row 0, column 0 value of matrix.
+ * @param aM10 : row 1, column 0 value of matrix.
+ * @param aM01 : row 0, column 1 value of matrix.
+ * @param aM11 : row 1, column 1 value of matrix.
+ * @param aM02 : row 0, column 2 value of matrix.
+ * @param aM12 : row 1, column 2 value of matrix.
+ * @param aType : transform type.
+ * @return
+ */
+ TGfxAffineTransform( TReal32 aM00,
+ TReal32 aM10,
+ TReal32 aM01,
+ TReal32 aM11,
+ TReal32 aM02,
+ TReal32 aM12,
+ TGfxTransformType aType );
+ /**
+ * Update this matrix.
+ *
+ * @since 1.0
+ * @return
+ */
+ void UpdateState();
+
+ /**
+ * The the the rotation info to the give angle.
+ *
+ * @since 1.0
+ * @return
+ */
+ void SetToRotate( TReal32 aTheta );
+
+ public:
+
+ TFloatFixPt iM00;
+ TFloatFixPt iM10;
+ TFloatFixPt iM01;
+ TFloatFixPt iM11;
+ TFloatFixPt iM02;
+ TFloatFixPt iM12;
+
+ TGfxTransformType iTransType;
+
+
+ };
+
+#endif // GFXAFFINETRANSFORM_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxColor.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXCOLOR_H
+#define GFXCOLOR_H
+
+#include <e32std.h>
+#include <fbs.h>
+
+#include "GfxPaint.h"
+
+#include <VG/openvg.h>
+
+#include "VGRenderer.h"
+
+/**
+ * This class is an implementation of a color.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TGfxColor : public MGfxPaint
+ {
+ public:
+
+
+ /**
+ * Construct a TGfxColor from an integer value.
+ *
+ * @since 1.0
+ * @param aRgb : integer color value.
+ * @return
+ */
+ TGfxColor( TUint32 aValue );
+
+ /**
+ * Construct a TGfxColor from r, g, b values.
+ *
+ * @since 1.0
+ * @param aRed : red component
+ * @param aGreen : green component
+ * @param aBlue : blue component
+ * @return
+ */
+ TGfxColor( TInt aRed, TInt aGreen, TInt aBlue );
+
+
+ /**
+ * Return the integer representation of this color.
+ *
+ * @since 1.0
+ * @return integer representation of color.
+ */
+ TUint16 ColorRgb();
+
+ /**
+ * Return 4-bits for red, 4-bits for green, 4-bits for blue
+ * integer representation of this color.
+ *
+ * @since 1.0
+ * @return 4x4x4 bits integer representation of color.
+ */
+ TUint16 ColorRgb444();
+
+ /**
+ * Return 5-bits for red, 6-bits for green, 5-bits for blue
+ * integer representation of this color.
+ *
+ * @since 1.0
+ * @return 5x6x5 bits integer representation of color.
+ */
+ TUint16 ColorRgb565();
+
+ /**
+ * Return an integer representation of a color after blending
+ * the two colors given by integer values.
+ *
+ * @since 1.0
+ * @param aAlpha : the alpha channel value to blend.
+ * @param aCs1 : color 1 to blend
+ * @param aCs2 : color 2 to blend
+ * @return integer representation of color.
+ */
+ static TUint32 BlendRgb444( TUint32 aAlpha,
+ TUint32 aCs1,
+ TUint32 aCs2 );
+
+ /**
+ * Implementation of MGfxPaint method to get an array of color values.
+ * The given buffer array is filled with this color value.
+ *
+ * @since 1.0
+ * @param aBuf : color array to holder color values
+ * @param aLength : number of color values to fill.
+ * @param x : not used by this class
+ * @param y : not used by this class
+ * @return
+ */
+ // void GetScanline( TUint8* aBuf,
+ // TInt32 aLength,
+ // TInt32 x,
+ // TInt32 y );
+
+ /**
+ * Return an integer representation of this color.
+ * This method should be renamed!
+ *
+ * @since 1.0
+ * @return integer representation of color.
+ */
+ TUint32 GetColor();
+ TUint32 GetARGB();
+ TUint32 GetABGR();
+
+
+
+
+ void SetFill(VGPaint aFillPaint, TGfxRectangle2D& aBBox, TFloatFixPt aOpacity,void* GfxContext);
+ public:
+ TUint32 iColor;
+ };
+
+
+#endif // GFXCOLOR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxCurveFlattenerP.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXCURVEFLATTENERP_H
+#define GFXCURVEFLATTENERP_H
+
+#include <e32base.h>
+#include <e32std.h>
+
+#include "GfxFloatFixPt.h"
+
+class TGfxAffineTransform;
+
+
+/**
+ * This class provides the methods to smooth a curve defined by control points.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TGfxCurveFlattener
+ {
+ public:
+
+ /**
+ * Construct a TGfxCurveFlattener with a transform matrix.
+ *
+ * @since 1.0
+ * @param aTransform : Transformation matrix.
+ * @return
+ */
+ TGfxCurveFlattener( TGfxAffineTransform* aTransform );
+
+ /**
+ * Add a quadratic curve to this object.
+ *
+ * @since 1.0
+ * @param aRenderer : edge point list
+ * @param aCtrlPoints : control points.
+ * @param aLimit : number of points to flatten curve with.
+ * @return
+ */
+ void AddSubCurveQuadL( CGfxEdgeListP* aRenderer,
+ TFloatFixPt * aCtrlPoints,
+ TInt32 aLimit );
+
+ /**
+ * Add a cubic curve to this object.
+ *
+ * @since 1.0
+ * @param aRenderer : edge point list
+ * @param aCtrlPoints : control points.
+ * @param aLimit : number of points to flatten curve with.
+ * @return
+ */
+ void AddSubCurveCubicL( CGfxEdgeListP* aRenderer,
+ TFloatFixPt * aCtrlPoints,
+ TInt32 aLimit );
+ private:
+
+ TGfxAffineTransform* iTransform;
+ };
+
+#endif // GFXCURVEFLATTENERP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxEdgeListP.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,414 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXEDGELISTP_H
+#define GFXEDGELISTP_H
+
+#include <e32std.h>
+#include <e32base.h>
+
+#include "GfxFloatFixPt.h"
+
+class TSegSet;
+class TGfxRendererInfoP;
+
+
+//****************************************************
+
+enum TAddSegStatus
+ {
+ ESegAdd,
+ ESegMerge,
+ ESegStartNew,
+ ESegIgnore
+ };
+
+/**
+ * Helping class to store a point using 16 bits for each value.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TPoint16
+ {
+ public:
+ TInt16 iX;
+ TInt16 iY;
+ };
+
+/**
+ * Helping class to store a size using 16 bits for each value.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TSize16
+ {
+ public:
+ TInt16 iWidth;
+ TInt16 iHeight;
+ };
+
+/**
+ * Helping class to store a segment edge info.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TGfxSegEdge
+ {
+ public:
+ TInt16 iStart;
+ TInt16 iEnd;
+ TInt16 iOnlyForFill;
+ TInt16 iSign;
+ TGfxSegEdge* iNext;
+ };
+
+/**
+ * Helping class to store a segment set info.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TSegSet
+ {
+ public:
+ /**
+ * Constructor
+ *
+ * @since 1.0
+ * @param aP1 : initial segment point 1
+ * @param aP2 : initial segment point 2
+ * @return
+ */
+ void Construct( TPoint16* aP1, TPoint16* aP2 );
+
+ /**
+ * Add a new segment to this set.
+ *
+ * @since 1.0
+ * @param aX : x coordinate of new segment end point
+ * @param aY : y coordinate of new segment end point
+ * @param aLastSegLenSq : storage for new segment length squared value
+ * @param aClosePath : flag to indicate closing of path.
+ * @return
+ */
+ TAddSegStatus AddSegment( TInt aX,
+ TInt aY,
+ TUint& aLastSegLenSq,
+ TBool aClosePath );
+
+ /**
+ *
+ *
+ * @since 1.0
+ * @param aX1 :
+ * @param aX2 :
+ * @return
+ */
+ TBool GetEdge( TInt& aX1, TInt& aX2 );
+
+
+ /**
+ * Initialize the Digital Differential Analyzer (DDA)
+ *
+ * @since 1.0
+ * @return
+ */
+ void InitDDA();
+
+ public:
+ TPoint16* iTopPoint;
+ TPoint16* iBottomPoint;
+ TPoint16* iFillOnlySeg;
+ TSegSet* iNext;
+ TSegSet* iConnect;
+
+ TInt16 iPointAryInc; // -1 or 1
+ TInt16 iSign; // -1, 0, or 1
+ TInt16 iValid;
+ TInt16 iActualBottomY;
+ TInt16 iConnectFlag;
+
+ protected:
+ // DDA info
+ TPoint16* iStart;
+ TPoint16* iFinish;
+
+ TPoint16 iInc;
+ TPoint16 iPos;
+ TSize16 iDifference;
+ TInt16 iGradient;
+ TInt16 iCount;
+ TInt16 iStatus;
+
+ protected:
+
+ /**
+ * Construct the Digital Differential Analyzer (DDA)
+ *
+ * @since 1.0
+ * @param aStart : start point
+ * @param aFinish : end point
+ * @return
+ */
+ void ConstructDDA( TPoint16* aStart, TPoint16* aFinish );
+
+ /**
+ *
+ *
+ * @since 1.0
+ * @param aPosition :
+ * @return
+ */
+ TBool SingleStep( TPoint16& aPosition );
+
+ /**
+ *
+ *
+ * @since 1.0
+ * @param aStartPosition :
+ * @param aEndPosition :
+ * @return
+ */
+ TBool SingleScanline( TPoint16& aStartPosition,
+ TPoint16& aEndPosition );
+
+ /**
+ *
+ *
+ * @since 1.0
+ * @return
+ */
+ void UpdatePosition();
+ };
+
+
+
+
+/**
+ * This class maintains a list of segment edges, used for scanning a line
+ * inside two edges.
+ *
+ * @lib SVGEngine.lib
+ * @since 1.0
+ */
+class CGfxEdgeListP : public CBase
+ {
+ public:
+
+ /**
+ * Two-phase constructor.
+ *
+ * @since 1.0
+ * @param aRenderInfo : rendering info
+ * @return
+ */
+ static CGfxEdgeListP* NewLC( TGfxRendererInfoP* aRenderInfo );
+
+ /**
+ * Two-phase constructor.
+ *
+ * @since 1.0
+ * @param aRenderInfo : rendering info
+ * @return
+ */
+ static CGfxEdgeListP* NewL( TGfxRendererInfoP* aRenderInfo );
+
+ /**
+ * Destructor.
+ *
+ * @since 1.0
+ * @return
+ */
+ ~CGfxEdgeListP();
+
+ public:
+
+ /**
+ * Get the start point in the edge list.
+ *
+ * @since 1.0
+ * @param aX : storage for starting point x coordinate.
+ * @param aY : storage for starting point y coordinate.
+ * @return
+ */
+ void StartPoint( TFloatFixPt& aX, TFloatFixPt& aY );
+
+ /**
+ * Add a new point to this list.
+ *
+ * @since 1.0
+ * @param aX : x coordinate of point
+ * @param aY : y coordinate of point
+ * @param aFillOnly : fill-onyl flag
+ * @param aClosePath : close-path flag
+ * @return
+ */
+ void AddPoint( TFloatFixPt & aX,
+ TFloatFixPt & aY,
+ TBool aFillOnly,
+ TBool aClosePath );
+ /**
+ * Clear all points in this list.
+ *
+ * @since 1.0
+ * @return
+ */
+ void Reset();
+
+ /**
+ * Intialize this edge list.
+ *
+ * @since 1.0
+ * @return
+ */
+ void SetupEdgeList();
+
+ /**
+ * Update the active edge.
+ *
+ * @since 1.0
+ * @param aY : line y coordinate
+ * @return
+ */
+ void UpdateActiveEdge( TInt aY );
+
+ /**
+ * Get the active segment edge.
+ *
+ * @since 1.0
+ * @return segment edge.
+ */
+ TGfxSegEdge* EdgeList();
+
+ /**
+ * Adjust the level of detail to the given vertex size.
+ *
+ * @since 1.0
+ * @param aVertexSize : vertex size
+ * @return
+ */
+ void AdjustShapeComplexityL( TInt32 aVertexSize );
+
+ protected:
+
+ /**
+ * Constructor
+ *
+ * @since 1.0
+ * @return
+ */
+ CGfxEdgeListP();
+
+ /**
+ * Constructor
+ *
+ * @since 1.0
+ * @param iRenderInfo : rendering info
+ * @return
+ */
+ CGfxEdgeListP( TGfxRendererInfoP* iRenderInfo );
+
+ /**
+ * Second-phase of construction
+ *
+ * @since 1.0
+ * @return
+ */
+ void ConstructL();
+
+ private:
+
+ /**
+ * Add a new edge.
+ *
+ * @since 1.0
+ * @param aSt : start point
+ * @param aEd : end point
+ * @return
+ */
+ TGfxSegEdge* AddEdge( TInt32 aSt, TInt32 aEd );//, TInt aSegSign);
+
+ /**
+ * Add the given set of segments to this list.
+ *
+ * @since 1.0
+ * @param aWaitingList : flag to wait
+ * @param aSegSet : set of segments
+ * @return
+ */
+ void InsertToList( TBool aWaitingList, TSegSet& aSegSet );
+
+ /**
+ * Check and Connect
+ *
+ * @since 1.0
+ * @return
+ */
+ void CheckAndConnect();
+
+ /**
+ * Simple update of active edge.
+ *
+ * @since 1.0
+ * @param aY : line y coordinate
+ * @return
+ */
+ void UpdateActiveEdgeSimple( TInt aY );
+
+ protected:
+ TInt32 iMinX, iMinY;
+ TInt32 iMaxX, iMaxY;
+
+ TGfxSegEdge* iEdges;
+ TInt iEdgesCount;
+
+ TUint iPolygonAreaSize;
+ TUint iLastSegLenSq;
+
+ TPoint16* iPoints;
+ TSegSet* iSegset;
+ TSegSet* iWaitingSegList;
+ TSegSet* iActiveSegList;
+ TGfxSegEdge* iSortedEdges;
+
+ TInt iPointsCount;
+ TInt iSegsetCount;
+ TInt iPointsCountMax;
+ TInt iSegsetCountMax;
+ TInt iEdgesCountMax;
+
+ TGfxRendererInfoP* iRenderInfo;
+
+ private:
+ TSegSet* iSegListForSimple[2];
+ TSegSet* iStartSeg;
+ TBool iIsNewOutlineStarted;
+ TInt iSubPathSegmentCount;
+
+ private:
+ friend class TGfxPolygonRendererP;
+ friend class TGfxStrokeRendererP;
+ friend class CGfx2dGc;
+ friend class TSegSet;
+ };
+
+#endif // GFXEDGELISTP_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxEllipse2D.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXELLIPSE2D_H
+#define GFXELLIPSE2D_H
+
+#include <e32std.h>
+#include "GfxFloatFixPt.h"
+
+#include "GfxRectangle2D.h"
+#include "GfxRectangularShape.h"
+#include "GfxPoint2D.h"
+#include "GfxPathIterator.h"
+#include "GfxAffineTransform.h"
+
+
+
+enum TEllipseConstructType
+ {
+ EElipseCenterAndRadius, // cx, cy, rx, ry
+ EElipseRectangular // x, y, w, h
+ };
+
+
+/**
+ * Implementation of an ellipse.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TGfxEllipse2D : public TGfxRectangularShape
+ {
+ public:
+
+ /**
+ * Construct a TGfxEllipse2D object.
+ *
+ * @since 1.0
+ * @param aX1 : focus point 1 or top-left x coordinate
+ * @param aY1 : focus point 1 or top-left y coordinate
+ * @param aWidth : focus point 2 or width
+ * @param aHeight : focus point 2 or height
+ * @return
+ */
+ TGfxEllipse2D( const TFloatFixPt & aX,
+ const TFloatFixPt & aY,
+ const TFloatFixPt & aWidth,
+ const TFloatFixPt & aHeight );
+
+ /**
+ * Construct a TGfxEllipse2D object. The TEllipseConstructType
+ * parameter defines the type of ellipse to create.
+ *
+ * @since 1.0
+ * @param aX1 : focus point 1 or top-left x coordinate
+ * @param aY1 : focus point 1 or top-left y coordinate
+ * @param aX1 : focus point 2 or width
+ * @param aY1 : focus point 2 or height
+ * @param aEtype : elliptical or rectangular data given
+ * @return
+ */
+ TGfxEllipse2D( const TFloatFixPt & aX1,
+ const TFloatFixPt & aY1,
+ const TFloatFixPt & aX2,
+ const TFloatFixPt & aY2,
+ TEllipseConstructType aEtype );
+
+ /**
+ * Get the path iterator for this shape.
+ * Implementation of MGfxShape method.
+ *
+ * @since 1.0
+ * @param aAt : transform to apply the defining points.
+ * @param aPitr : path iterator data storage.
+ * @return
+ */
+ void GetPathIteratorL( TGfxAffineTransform* aAt,
+ CGfxPathIterator*& aPitr );
+
+ /**
+ * Get the path iterator for this shape.
+ * Implementation of MGfxShape method.
+ *
+ * @since 1.0
+ * @param aAt : transform to apply the defining points.
+ * @param aLimit : number of points defining the path.
+ * @param aPitr : path iterator data storage.
+ * @return
+ */
+ void GetPathIteratorL( TGfxAffineTransform* aAt,
+ TInt aLimit,
+ CGfxPathIterator*& aPitr );
+
+
+ /* Return shape type */
+ inline virtual TInt ShapeType () { return EEllipse; };
+
+ };
+
+#endif // GFXELLIPSE2D_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxEllipseIteratorP.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXELLIPSEITERATORP_H
+#define GFXELLIPSEITERATORP_H
+
+
+
+#include <e32std.h>
+
+#include "GfxFloatFixPt.h"
+#include "GfxPathIterator.h"
+
+class TGfxEllipse2D;
+class TGfxAffineTransform;
+
+
+/**
+ * Implementation of an ellipse iterator.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class CGfxEllipseIteratorP : public CGfxPathIterator
+ {
+ public:
+
+ /**
+ * Construct an ellipse iterator.
+ *
+ * @since 1.0
+ * @param aEllipse : ellipse to create iterator for.
+ * @param aTransform : transform to apply to defining points.
+ * @return
+ */
+ CGfxEllipseIteratorP( TGfxEllipse2D* aEllipse,
+ TGfxAffineTransform* aTransform );
+
+ /**
+ * Get the points defining the ellipse and the segment type.
+ *
+ * @since 1.0
+ * @param aCoords : point storage
+ * @return segment type
+ */
+ TGfxSegType CurrentSegment( TFloatFixPt * aCoords );
+
+ /**
+ * Determine wether end of iterator has been reached.
+ *
+ * @since 1.0
+ * @return true if end of iterator
+ */
+ TBool IsDone();
+
+ /**
+ * Cycle to the next point of this iterator.
+ *
+ * @since 1.0
+ * @return
+ */
+ void NextL();
+
+ /**
+ * Write points of the ellipse to be a polygon.
+ *
+ * @since 1.0
+ * @param aRenderer : point storage
+ * @param aFlatness : number of points to generate.
+ * @return
+ */
+
+ private:
+ TGfxEllipse2D* iEllipse;
+
+ TInt32 iIdx;
+ };
+
+#endif // GFXELLIPSEITERATORP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxFlatteningPathIterator.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,198 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXFLATTENINGPATHITERATOR_H
+#define GFXFLATTENINGPATHITERATOR_H
+
+#include <e32base.h>
+#include <e32std.h>
+
+#include "GfxFloatFixPt.h"
+#include "GfxPathIterator.h"
+
+
+
+class TGfxAffineTransform;
+class MGfxShape;
+
+/**
+ * This class provides the methods to smooth a path.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class CGfxFlatteningPathIterator : public CGfxPathIterator
+ {
+ public:
+
+ /**
+ * Two-phase constructor.
+ *
+ * @since 1.0
+ * @param aSrc : source of path of flatten
+ * @param aAt : transform to apply.
+ * @param aFlatness : degree of flattening to apply.
+ * @param aLimit : maximum number of points used for flattening.
+ * @return
+ */
+ static CGfxFlatteningPathIterator* NewL( MGfxShape* aSrc,
+ TGfxAffineTransform* aAt,
+ TInt32 aLimit );
+
+
+ /**
+ * Destructor
+ *
+ * @since 1.0
+ * @return
+ */
+ virtual ~CGfxFlatteningPathIterator();
+
+
+ /**
+ * Set the degree of flattening to apply.
+ *
+ * @since 1.0
+ * @param aFlatness : degree of flattening.
+ * @return
+ */
+
+ void SetFlatness( TFloatFixPt& aFlatness );
+
+ /**
+ * Set the recursion level.
+ *
+ * @since 1.0
+ * @param aLimit : recursion level.
+ * @return
+ */
+ void SetRecursionLimit( TInt32 aLimit );
+
+ /**
+ * Get the flattening level..
+ *
+ * @since 1.0
+ * @param aLimit : recursion level.
+ * @return flattening value.
+ */
+
+ TFloatFixPt Flatness();
+
+ /**
+ * Get the recursion level.
+ *
+ * @since 1.0
+ * @return the recursion level.
+ */
+ TInt32 RecursionLimit();
+
+
+ /**
+ * Get the points defining the current segment of iteration.
+ *
+ * @since 1.0
+ * @param aCoords : array to store segment points.
+ * @return segment type.
+ */
+ TGfxSegType CurrentSegment( TFloatFixPt* aCoords );
+
+ /**
+ * Determine wether the end has been reached.
+ *
+ * @since 1.0
+ * @return true, if end of iterator reached.
+ */
+ TBool IsDone();
+
+ /**
+ * Cycle to the next segment of this iterator.
+ *
+ * @since 1.0
+ * @return
+ */
+ void NextL();
+
+
+ /**
+ * Create a polygon from iterator. This method is does nothing.
+ *
+ * @since 1.0
+ * @return
+ */
+ void PolygonizeL( CGfxEdgeListP* aRenderer, TInt aFlatness );
+
+ private:
+
+ /**
+ * Constructor
+ *
+ * @since 1.0
+ * @param aFlatness : degree of flattening to apply.
+ * @param aLimit : maximum number of points used for flattening.
+ * @return
+ */
+ CGfxFlatteningPathIterator( TInt32 aLimit );
+
+ /**
+ * Second phase of constrction.
+ *
+ * @since 1.0
+ * @param aSrc : source of path of flatten
+ * @param aAt : transform to apply.
+ * @return
+ */
+ void ConstructL( MGfxShape* aSrc,
+ TGfxAffineTransform* aAt );
+
+
+ /**
+ * Create a quadratic sub-curve.
+ *
+ * @since 1.0
+ * @param aCtrlPoints : quadratic control points.
+ * @return
+ */
+ void CreateSubcurveQuadL( RArray<TFloatFixPt>* aCtrlPoints );
+
+ /**
+ * Create a cubic sub-curve.
+ *
+ * @since 1.0
+ * @param aCtrlPoints : cubic control points.
+ * @return
+ */
+ void CreateSubcurveCubicL( RArray<TFloatFixPt>* aCtrlPoints );
+
+ private:
+ RArray<TFloatFixPt>* iCoords;
+ TInt32 iIdx;
+ CGfxPathIterator* iSrc;
+ TFloatFixPt iLastX;
+ TFloatFixPt iLastY;
+ TGfxSegType iSegType;
+ TBool iIsDone;
+
+ TInt32 iLimit;
+
+ TFloatFixPt iFlatness;
+
+
+
+ };
+
+#endif // GFXFLATTENINGPATHITERATOR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxFloatFixPt.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,639 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXFIXPT_H
+#define GFXFIXPT_H
+#include <VG/openvg.h>
+// Enumeration
+//#define SVG_FLOAT_BUILD
+
+enum TGfxTextAnchor
+ {
+ EGfxTextAnchorStart,
+ EGfxTextAnchorMiddle,
+ EGfxTextAnchorEnd,
+ EGfxTextAnchorNone = -1
+ };
+
+enum TGfxTextDecoration
+ {
+ EGfxTextDecorationReserved,
+ EGfxTextDecorationUnderLine,
+ EGfxTextDecorationOverLine,
+ EGfxTextDecorationLineThrough,
+ EGfxTextDecorationNone = -1
+ };
+
+enum TGfxCapType
+ {
+ EGfxCapButt = 0,
+ EGfxCapRound = 1,
+ EGfxCapSquare = 2
+ };
+
+enum TGfxFilterEdgeCondition
+ {
+ EGfxEdgeNoOp,
+ EGfxEdgeZeroFill,
+ EGfxEdgeMirror
+ };
+
+// Image interporation enumeration
+enum TGfxImageInterpolation
+ {
+ EGfxInterpolationBiLinear,
+ EGfxInterpolationBiCubic,
+ EGfxInterpolationNearestNeighbor
+ };
+
+// Join type enumeration
+enum TGfxJoinType
+ {
+ EGfxJoinMiter = 0,
+ EGfxJoinRound = 1,
+ EGfxJoinBevel = 2
+ };
+
+enum TGfxWindingRule
+ {
+ EGfxWindEvenOdd,
+ EGfxWindNonZero
+ };
+
+enum TGfxSegType
+ {
+ EGfxSegMoveTo=VG_MOVE_TO_ABS,
+ EGfxSegLineTo=VG_LINE_TO_ABS,
+ EGfxSegQuadTo=VG_QUAD_TO_ABS,
+ EGfxSegCubicTo=VG_CUBIC_TO_ABS,
+ EGfxSegClose=VG_CLOSE_PATH
+ };
+
+#ifdef SVG_FLOAT_BUILD
+
+typedef float SVGReal;
+
+class TFloatFixPt
+ {
+ public:
+
+ static void GetString( float aFloat, TDes& aBuf );
+
+ static float ConvertString( const TDesC& aVal );
+
+ static TInt ConvertString( const TDesC& aString, float& aValue );
+
+ static TInt ConvertString( const TDesC& aString, TFloatFixPt& aValue );
+
+ static float Sqrt( float aValue );
+
+ static float Cos(float angle);
+
+ static float SinFloatDouble(float angle);
+
+ static float CosFloatDouble(float angle);
+
+ static float CosineDouble(float x);
+
+ static float TanFloatDouble(float angle);
+
+ static float SinApprox(float angle);
+
+ static float CosApprox(float angle);
+
+ static float FastSin( const float val );
+
+ static float FastCos( const float val );
+
+ static float FastTan( const float val );
+
+ static float FastASin( const float val );
+
+ static float FastACos( const float val );
+
+ static float FastATan( const float val );
+
+ inline TFloatFixPt();
+
+ inline TFloatFixPt( TInt aVal );
+
+ inline TFloatFixPt( TInt32 aVal );
+
+ inline TFloatFixPt( TReal32 aVal );
+
+ inline TFloatFixPt( const TFloatFixPt& aFixpt );
+
+ inline operator TInt32() const;
+
+ inline operator TInt() const;
+
+ inline operator TReal32() const;
+
+ inline TFloatFixPt& operator=( TInt32 aVal );
+
+ inline TFloatFixPt& operator=( TInt aVal );
+
+ inline TFloatFixPt& operator=( TReal32 aVal );
+
+ inline TFloatFixPt& operator+=( const TFloatFixPt& aVal );
+
+ inline TFloatFixPt& operator-=( const TFloatFixPt& aVal );
+
+ inline TFloatFixPt& operator*=( const TFloatFixPt& aVal );
+
+ inline TFloatFixPt& operator/=( const TFloatFixPt& aVal );
+
+ inline TFloatFixPt operator+( const TFloatFixPt& aVal ) const;
+
+ inline TFloatFixPt operator+( const double& aVal ) const;
+
+ inline TFloatFixPt operator+( const float& aVal ) const;
+
+ inline TFloatFixPt operator-( const TFloatFixPt& aVal ) const;
+
+ inline TFloatFixPt operator-( const double aVal ) const;
+
+ inline TFloatFixPt operator-( const float aVal ) const;
+
+ inline TFloatFixPt operator*( const TFloatFixPt& aVal ) const;
+
+ inline TFloatFixPt operator*( const double aVal ) const;
+
+ inline TFloatFixPt operator*( const float aVal ) const;
+
+ inline TFloatFixPt operator/( const TFloatFixPt& aVal ) const;
+
+ inline TFloatFixPt operator/( const double aVal ) const;
+
+ inline TFloatFixPt operator/( const float aVal ) const;
+
+ inline TInt operator==( const TFloatFixPt& aVal ) const;
+
+ inline TInt operator!=( const TFloatFixPt& aVal ) const;
+
+ inline TInt operator>=( const TFloatFixPt& aVal ) const;
+
+ inline TInt operator<=( const TFloatFixPt& aVal ) const;
+
+ inline TInt operator>( const TFloatFixPt& aVal ) const;
+
+ inline TInt operator<( const TFloatFixPt& aVal ) const;
+
+ /**
+ * Return the number rounded to the next whole number.
+ *
+ * @since 1.0
+ * @return
+ */
+ inline TInt32 Round();
+
+ /**
+ * Return the 32-bit data for this TFixPt.
+ *
+ * @since 1.0
+ * @return 32-bit value
+ */
+ inline TInt32 RawData();
+
+ /**
+ * Return the absolute value for the given number.
+ *
+ * @since 1.0
+ * @param aValue : real number to find absolute value
+ * @return absolute value
+ */
+ TFloatFixPt Abs( TFloatFixPt& aValue );
+
+
+ /**
+ * Return the square root value for this number.
+ *
+ * @since 1.0
+ * @param aValue : real number to find square root
+ * @return square root value
+ */
+ static TFloatFixPt Sqrt( TFloatFixPt aValue );
+
+ public:
+
+ float iValue; // Must be the first data member of this class!
+
+ };
+
+#include "GfxFloatFixPt.inl"
+
+#else /*FIXED POINT BUILD*/
+
+typedef int SVGReal;
+
+const TInt32 KFixPtFrac = 16;
+const TInt32 KFixPtFracVal = ( 1 << KFixPtFrac );
+
+/**
+ * Implementation of a real number using 16.16 bits.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TFloatFixPt
+ {
+ public:
+
+ /**
+ * Construct a TFixPt. The default value is 0.0.
+ *
+ * @since 1.0
+ * @return
+ */
+ inline TFloatFixPt();
+
+ /**
+ * Construct a TFixPt from the given integer value.
+ *
+ * @since 1.0
+ * @param aVal : integer value
+ * @return
+ */
+ inline TFloatFixPt( TInt aVal );
+
+ /**
+ * Construct a TFixPt from the given integer value.
+ *
+ * @since 1.0
+ * @param aVal : integer value
+ * @return
+ */
+ inline TFloatFixPt( TInt32 aVal );
+
+ /**
+ * Construct a TFixPt from the given real 32-bit int.
+ *
+ * @since 1.0
+ * @param aVal : integer value
+ * @param aBool : not used.
+ * @return
+ */
+ inline TFloatFixPt( TInt aVal, TBool aBool );
+
+ /**
+ * Construct a TFixPt from the given TReal32.
+ *
+ * @since 1.0
+ * @param aVal : value to copy from
+ * @return
+ */
+ inline TFloatFixPt( TReal32 aVal );
+
+ /**
+ * Construct a TFixPt from the given TFixPt.
+ *
+ * @since 1.0
+ * @param aFixpt : value to copy from
+ * @return
+ */
+ inline TFloatFixPt( const TFloatFixPt& aFixpt );
+
+
+ /**
+ * Return the fractional portion as an int representation.
+ *
+ * @since 1.0
+ * @return the fractional portion value
+ */
+ inline TInt32 FracAsInt();
+
+
+ /**
+ * Casting operator to TInt32.
+ *
+ * @since 1.0
+ * @return
+ */
+
+ inline operator TInt32() const;
+
+ /**
+ * Casting operator to TInt.
+ *
+ * @since 1.0
+ * @return
+ */
+ inline operator TInt() const;
+
+ /**
+ * Casting operator to TReal32.
+ *
+ * @since 1.0
+ * @return
+ */
+ inline operator TReal32() const;
+
+ /**
+ * Assignment operator.
+ *
+ * @since 1.0
+ * @param aVal : value to assign from.
+ * @return
+ */
+ inline TFloatFixPt& operator=( TInt32 aVal );
+
+ /**
+ * Assignment operator.
+ *
+ * @since 1.0
+ * @param aVal : value to assign from.
+ * @return
+ */
+ inline TFloatFixPt& operator=( TInt aVal );
+
+ /**
+ * Assignment operator.
+ *
+ * @since 1.0
+ * @param aVal : value to assign from.
+ * @return
+ */
+ inline TFloatFixPt& operator=( TReal32 aVal );
+
+ /**
+ * Addition assignment operator.
+ *
+ * @since 1.0
+ * @param aVal : value to add with.
+ * @return
+ */
+ inline TFloatFixPt& operator+=( const TFloatFixPt& aVal );
+
+ /**
+ * Subtraction assignment operator.
+ *
+ * @since 1.0
+ * @param aVal : value to substract.
+ * @return
+ */
+ inline TFloatFixPt& operator-=( const TFloatFixPt& aVal );
+
+ /**
+ * Multiplication assignment operator.
+ *
+ * @since 1.0
+ * @param aVal : value to multiply with.
+ * @return
+ */
+ inline TFloatFixPt& operator*=( const TFloatFixPt& aVal );
+
+ /**
+ * Division assignment operator.
+ *
+ * @since 1.0
+ * @param aVal : value to divide with.
+ * @return
+ */
+ inline TFloatFixPt& operator/=( const TFloatFixPt& aVal );
+
+
+ /**
+ * Addition operator.
+ *
+ * @since 1.0
+ * @param aVal : value to add with.
+ * @return
+ */
+ inline TFloatFixPt operator+( const TFloatFixPt& aVal ) const;
+
+ /**
+ * Subtraction operator.
+ *
+ * @since 1.0
+ * @param aVal : value to subtract.
+ * @return
+ */
+ inline TFloatFixPt operator-( const TFloatFixPt& aVal ) const;
+
+ /**
+ * Multiplication operator.
+ *
+ * @since 1.0
+ * @param aVal : value to multiply with.
+ * @return
+ */
+
+ inline TFloatFixPt operator*( const TFloatFixPt& aVal ) const;
+
+ /**
+ * Division operator.
+ *
+ * @since 1.0
+ * @param aVal : value to divide with.
+ * @return
+ */
+ inline TFloatFixPt operator/( const TFloatFixPt& aVal ) const;
+
+ /**
+ * Equal operator.
+ *
+ * @since 1.0
+ * @param aVal : value to compare.
+ * @return non-zero if equal
+ */
+
+ inline TInt operator==( const TFloatFixPt& aVal ) const;
+
+ /**
+ * Not Equals operator.
+ *
+ * @since 1.0
+ * @param aVal : value to compare.
+ * @return non-zero if not equal
+ */
+ inline TInt operator!=( const TFloatFixPt& aVal ) const;
+
+ /**
+ * Greater than or equal to operator.
+ *
+ * @since 1.0
+ * @param aVal : value to compare.
+ * @return non-zero if greater than or equal to
+ */
+ inline TInt operator>=( const TFloatFixPt& aVal ) const;
+
+ /**
+ * Less than or equal to operator.
+ *
+ * @since 1.0
+ * @param aVal : value to compare.
+ * @return non-zero if less than or equal to
+ */
+ inline TInt operator<=( const TFloatFixPt& aVal ) const;
+
+ /**
+ * Greater than operator.
+ *
+ * @since 1.0
+ * @param aVal : value to compare.
+ * @return non-zero if greater than
+ */
+ inline TInt operator>( const TFloatFixPt& aVal ) const;
+
+ /**
+ * Less than operator.
+ *
+ * @since 1.0
+ * @param aVal : value to compare.
+ * @return non-zero if less than
+ */
+ inline TInt operator<( const TFloatFixPt& aVal ) const;
+
+ /**
+ * Operator to left shift
+ *
+ * @since 1.0
+ * @param aN : bits to be shifted.
+ * @return
+ */
+
+ inline TFloatFixPt operator<<( const TInt aN ) const;
+
+ /**
+ * operator to right shift.
+ *
+ * @since 1.0
+ * @param aBuf : string output storage.
+ * @return value obtained after shifeting
+ */
+
+ inline TFloatFixPt operator>>( const TInt aN ) const;
+
+
+
+ /**
+ * Get the string representation of this real number.
+ *
+ * @since 1.0
+ * @param aN : bits to be shifted
+ * @return value obtained after shifeting
+ */
+ void GetString( TDes& aBuf ) const;
+
+ /**
+ * Parse the given string for a TFixPt.
+ *
+ * @since 1.0
+ * @param aVal : string containing a real number.
+ * @return TFixPt equal to string representation.
+ */
+ static TFloatFixPt ConvertString( const TDesC& aVal );
+
+ /**
+ * Parse the given string for a TFixPt.
+ *
+ * @since 1.0
+ * @param aVal : string containing a real number.
+ * @param aVal : parsed number.
+ * @return Error code (KErrNone if no errors).
+ */
+ static TInt ConvertString( const TDesC& aValueString, TFloatFixPt& aValue );
+
+ /**
+ * Return the number rounded to the next whole number.
+ *
+ * @since 1.0
+ * @return
+ */
+ inline TInt32 Round();
+
+ /**
+ * Return the 32-bit data for this TFixPt.
+ *
+ * @since 1.0
+ * @return 32-bit value
+ */
+ inline TInt32 RawData();
+
+ /**
+ * Return the absolute value for the given number.
+ *
+ * @since 1.0
+ * @param aValue : real number to find absolute value
+ * @return absolute value
+ */
+ TFloatFixPt Abs( TFloatFixPt& aValue );
+
+
+ /**
+ * Return the square root value for this number.
+ *
+ * @since 1.0
+ * @param aValue : real number to find square root
+ * @return square root value
+ */
+ static TFloatFixPt Sqrt( TFloatFixPt aValue );
+
+ /**
+ * Return the square root value for the given number.
+ *
+ * @since 1.0
+ * @param aValue : 32-bit representation of real number
+ * @param aFracbits: number of bits allocated for fractional portion.
+ * @return square root value
+ */
+ static TInt32 FixedSqrtGeneral( TInt32 aValue, TUint32 aFracbits );
+
+ private:
+
+ /**
+ * Optimized method to do multiplication using assembly.
+ *
+ * @since 1.0
+ * @param aValue : real number to find multiply with
+ * @return
+ */
+ inline void GfxMultiplyAsm( TInt aValue );
+
+ public:
+
+ TInt iValue; // Must be the first data member of this class!
+
+ };
+
+#ifdef SVG_FLOAT_BUILD
+#define KFloatFixOne = (TFloatFixPt(1))
+#define KFloatFixZero = (TFloatFixPt())
+#define KMAXFLOATFIXVALUE (1e38f)
+#define KMINFLOATFIXVALUE (-1e38f)
+#define KMAXFLOATFIX (TFloatFixPt( KMAXFLOATFIXVALUE ))
+#define KMINFLOATFIX (TFloatFixPt( KMINFLOATFIXVALUE ))
+#else
+#define KFloatFixOne (TFloatFixPt( 0x10000, ETrue ))
+#define KFloatFixZero (TFloatFixPt())
+#define KMAXFLOATFIXVALUE (0x7fff)
+#define KMINFLOATFIXVALUE (-0x7fff)
+#define KMAXFLOATFIX (TFloatFixPt( 0x7fff0000, ETrue ))
+#define KMINFLOATFIX (TFloatFixPt( -0x7fff0000, ETrue ))
+
+#endif
+
+typedef struct
+ {
+ SVGReal matrix[2][3];
+ } SVGMatrix2x3;
+
+#include "GfxFloatFixPt.inl"
+
+#endif
+#endif // GFXFIXPT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxFloatFixPt.inl Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,611 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+extern "C" {
+#include "Gfxmath.h"
+}
+#ifdef SVG_FLOAT_BUILD
+// ==========================================================================
+// Constructor, default to zero
+// ==========================================================================
+inline TFloatFixPt::TFloatFixPt() : iValue( 0 )
+ {
+ }
+
+// ==========================================================================
+// Constructor
+// ==========================================================================
+
+inline TFloatFixPt::TFloatFixPt( TInt aVal )
+ {
+ iValue = float(aVal);
+ }
+
+// ==========================================================================
+// Constructor
+// ==========================================================================
+inline TFloatFixPt::TFloatFixPt( TInt32 aVal )
+ {
+ iValue = float(aVal);
+ }
+
+// ==========================================================================
+// Constructor
+// ==========================================================================
+inline TFloatFixPt::TFloatFixPt( TReal32 aVal )
+{
+ iValue = aVal;
+}
+
+// ==========================================================================
+// Copy constructor
+// ==========================================================================
+inline TFloatFixPt::TFloatFixPt( const TFloatFixPt& aFixpt )
+ {
+ iValue = aFixpt.iValue;
+ }
+
+// ==========================================================================
+// Conversion to TInt32 operator
+// ==========================================================================
+inline TFloatFixPt::operator TInt32() const
+ {
+ return ((TInt32)iValue);
+ }
+
+// ==========================================================================
+// Conversion to TInt operator
+// ==========================================================================
+inline TFloatFixPt::operator TInt() const
+ {
+ return ((TInt)iValue);
+ }
+
+// ==========================================================================
+// Conversion to TReal32 operator
+// ==========================================================================
+inline TFloatFixPt::operator TReal32() const
+{
+return iValue;
+}
+
+// ==========================================================================
+// Assignment operator
+// ==========================================================================
+inline TFloatFixPt& TFloatFixPt::operator=( TInt32 aVal )
+
+ {
+ iValue = (float)aVal;
+ return *this;
+ }
+
+// ==========================================================================
+// Assignment operator
+// ==========================================================================
+inline TFloatFixPt& TFloatFixPt::operator=( TInt aVal )
+ {
+ iValue = (float)aVal;
+ return *this;
+ }
+
+// ==========================================================================
+// Assignment operator
+// ==========================================================================
+inline TFloatFixPt& TFloatFixPt::operator=( TReal32 aVal )
+{
+ iValue = aVal;
+ return *this;
+}
+
+// ==========================================================================
+// Addition Assignment operator
+// ==========================================================================
+inline TFloatFixPt& TFloatFixPt::operator+=( const TFloatFixPt& aVal )
+ {
+ iValue += aVal.iValue;
+ return*this;
+ }
+
+// ==========================================================================
+// Subtraction Assignment operator
+// ==========================================================================
+inline TFloatFixPt& TFloatFixPt::operator-=( const TFloatFixPt& aVal )
+ {
+ iValue -= aVal.iValue;
+ return *this;
+ }
+
+
+// ==========================================================================
+// Multipication Assignment operator
+// ==========================================================================
+inline TFloatFixPt& TFloatFixPt::operator*=( const TFloatFixPt& aVal )
+{
+ iValue *= aVal.iValue;
+ return *this;
+}
+
+
+
+// ==========================================================================
+// Division Assignment operator
+// Note: This may require more optimization...
+// ==========================================================================
+inline TFloatFixPt& TFloatFixPt::operator/=( const TFloatFixPt& aVal )
+{
+ iValue /= aVal.iValue;
+ return *this;
+}
+
+// ===================================================================
+// Addition operation
+// ==========================================================================
+inline TFloatFixPt TFloatFixPt::operator+( const TFloatFixPt& aVal ) const
+ {
+ return TFloatFixPt( iValue + aVal.iValue );
+ }
+
+// ===================================================================
+// Addition operation
+// ==========================================================================
+inline TFloatFixPt TFloatFixPt::operator+( const double& aVal ) const
+ {
+ return TFloatFixPt( iValue + (float)aVal );
+ }
+
+// ===================================================================
+// Addition operation
+// ==========================================================================
+inline TFloatFixPt TFloatFixPt::operator+( const float& aVal ) const
+ {
+ return TFloatFixPt( iValue + aVal );
+ }
+
+// ==========================================================================
+// Subtraction operation
+// ==========================================================================
+inline TFloatFixPt TFloatFixPt::operator-( const TFloatFixPt& aVal ) const
+ {
+ return TFloatFixPt( iValue - aVal.iValue );
+ }
+
+// ==========================================================================
+// Subtraction operation
+// ==========================================================================
+inline TFloatFixPt TFloatFixPt::operator-( const double aVal ) const
+ {
+ float difference = iValue - aVal;
+ return TFloatFixPt( difference );
+ }
+
+// ==========================================================================
+// Subtraction operation
+// ==========================================================================
+inline TFloatFixPt TFloatFixPt::operator-( const float aVal ) const
+ {
+ return TFloatFixPt( iValue - aVal );
+ }
+
+// ==========================================================================
+// Multiplication operator
+// ==========================================================================
+
+inline TFloatFixPt TFloatFixPt::operator*( const TFloatFixPt& aVal ) const
+ {
+ TFloatFixPt tmp( iValue );
+ tmp *= aVal;
+ return tmp;
+ }
+
+// ==========================================================================
+// Multiplication operator
+// ==========================================================================
+inline TFloatFixPt TFloatFixPt::operator*( const double aVal ) const
+ {
+ float multans = iValue * aVal;
+ return TFloatFixPt(multans);
+ }
+
+// ==========================================================================
+// Multiplication operator
+// ==========================================================================
+inline TFloatFixPt TFloatFixPt::operator*( const float aVal ) const
+ {
+ return TFloatFixPt(iValue * aVal);
+ }
+
+// ==========================================================================
+// Division operator
+// ==========================================================================
+inline TFloatFixPt TFloatFixPt::operator/( const TFloatFixPt& aVal ) const
+ {
+ TFloatFixPt tmp( iValue );
+ tmp /= aVal;
+ return tmp;
+ }
+
+// ==========================================================================
+// Division operator
+// ==========================================================================
+inline TFloatFixPt TFloatFixPt::operator/( const double aVal ) const
+ {
+ float divans = iValue / aVal;
+ return TFloatFixPt(divans);
+ }
+
+// ==========================================================================
+// Division operator
+// ==========================================================================
+inline TFloatFixPt TFloatFixPt::operator/( const float aVal ) const
+ {
+ return TFloatFixPt(iValue / aVal);
+ }
+
+// ==========================================================================
+// Equals operator
+// ==========================================================================
+inline TInt TFloatFixPt::operator==( const TFloatFixPt& aVal ) const
+ {
+ return ( iValue == aVal.iValue );
+ }
+
+// ==========================================================================
+// Not Equals operator
+// ==========================================================================
+inline TInt TFloatFixPt::operator!=( const TFloatFixPt& aVal ) const
+ {
+ return ( iValue != aVal.iValue );
+ }
+
+// ==========================================================================
+// Greater than or equal to operator
+// ==========================================================================
+inline TInt TFloatFixPt::operator>=( const TFloatFixPt& aVal ) const
+ {
+ return ( iValue >= aVal.iValue );
+ }
+
+// ==========================================================================
+// Less than or equal to operator
+// ==========================================================================
+inline TInt TFloatFixPt::operator<=( const TFloatFixPt& aVal ) const
+ {
+ return ( iValue <= aVal.iValue );
+ }
+
+// ==========================================================================
+// Greater than operator
+// ==========================================================================
+inline TInt TFloatFixPt::operator>( const TFloatFixPt& aVal ) const
+ {
+ return ( iValue > aVal.iValue );
+ }
+
+// ==========================================================================
+// Less than operator
+// ==========================================================================
+inline TInt TFloatFixPt::operator<( const TFloatFixPt& aVal ) const
+ {
+ return ( iValue < aVal.iValue );
+ }
+
+// ==========================================================================
+// Round to the nearest whole number
+// ==========================================================================
+inline TInt32 TFloatFixPt::Round()
+ {
+ TInt aInt = (TInt)iValue;
+ return (TInt32)aInt;
+ }
+
+// ==========================================================================
+// Get 32-bit representation
+// ==========================================================================
+inline TInt32 TFloatFixPt::RawData()
+ {
+ return ((TInt32)iValue);
+ }
+
+
+#else
+
+#define FIXPT_USE_INTS
+
+// ==========================================================================
+// Constructor, default to zero
+// ==========================================================================
+inline TFloatFixPt::TFloatFixPt() : iValue( 0 )
+ {
+ }
+
+// ==========================================================================
+// Constructor
+// ==========================================================================
+
+inline TFloatFixPt::TFloatFixPt( TInt aVal )
+ {
+ iValue = ( aVal << KFixPtFrac );
+ }
+
+inline TFloatFixPt::TFloatFixPt( TInt aVal, TBool /*a*/ )
+ {
+ iValue = aVal;
+ }
+
+// ==========================================================================
+// Constructor
+// ==========================================================================
+inline TFloatFixPt::TFloatFixPt( TInt32 aVal )
+ {
+ iValue = ( aVal << KFixPtFrac );
+ }
+
+// ==========================================================================
+// Constructor
+// ==========================================================================
+inline TFloatFixPt::TFloatFixPt( TReal32 aVal )
+{
+ iValue = svgScalarFromFloat(aVal);//( TInt32 ) ( aVal * KFixPtFracVal );
+}
+
+// ==========================================================================
+// Copy constructor
+// ==========================================================================
+inline TFloatFixPt::TFloatFixPt( const TFloatFixPt& aFixpt )
+ {
+ iValue = aFixpt.iValue;
+ }
+
+// ==========================================================================
+// Return the fractional portion as an integer
+// ==========================================================================
+inline TInt32 TFloatFixPt::FracAsInt()
+ {
+ return iValue & 0xFFFF;
+ }
+
+// ==========================================================================
+// Conversion to TInt32 operator
+// ==========================================================================
+inline TFloatFixPt::operator TInt32() const
+ {
+ return ( iValue >> KFixPtFrac );
+ }
+
+// ==========================================================================
+// Conversion to TInt operator
+// ==========================================================================
+inline TFloatFixPt::operator TInt() const
+ {
+ return ( iValue >> KFixPtFrac );
+ }
+
+// ==========================================================================
+// Conversion to TReal32 operator
+// ==========================================================================
+inline TFloatFixPt::operator TReal32() const
+{
+#ifdef FIXPT_USE_INTS
+ return svgFixedToFloat(iValue);
+#else
+ return ( ( TReal32 ) iValue ) / KFixPtFracVal;
+#endif
+}
+
+// ==========================================================================
+// Assignment operator
+// ==========================================================================
+inline TFloatFixPt& TFloatFixPt::operator=( TInt32 aVal )
+
+ {
+ iValue = ( aVal << KFixPtFrac );
+ return *this;
+ }
+
+// ==========================================================================
+// Assignment operator
+// ==========================================================================
+inline TFloatFixPt& TFloatFixPt::operator=( TInt aVal )
+ {
+ iValue = ( aVal << KFixPtFrac );
+ return *this;
+ }
+
+// ==========================================================================
+// Assignment operator
+// ==========================================================================
+inline TFloatFixPt& TFloatFixPt::operator=( TReal32 aVal )
+{
+ iValue = svgScalarFromFloat(aVal);//( TInt32 ) ( aVal * KFixPtFracVal );
+ return *this;
+}
+
+// ==========================================================================
+// Addition Assignment operator
+// ==========================================================================
+inline TFloatFixPt& TFloatFixPt::operator+=( const TFloatFixPt& aVal )
+ {
+ iValue += aVal.iValue;
+ return*this;
+ }
+
+// ==========================================================================
+// Subtraction Assignment operator
+// ==========================================================================
+inline TFloatFixPt& TFloatFixPt::operator-=( const TFloatFixPt& aVal )
+ {
+ iValue -= aVal.iValue;
+ return *this;
+ }
+
+
+// ==========================================================================
+// Multipication Assignment operator
+// ==========================================================================
+inline TFloatFixPt& TFloatFixPt::operator*=( const TFloatFixPt& aVal )
+{
+#ifdef FIXPT_USE_INTS
+ iValue = svgScalarMul(iValue, aVal.iValue);
+ return *this;
+#else
+ TInt64 rslt( ( TInt ) iValue ), val( ( TInt ) aVal.iValue );
+ rslt *= val;
+ iValue = ( I64HIGH(rslt) << KFixPtFrac ) | ( I64LOW ( rslt) >> KFixPtFrac );
+
+ return *this;
+#endif
+}
+
+
+
+// ==========================================================================
+// Division Assignment operator
+// Note: This may require more optimization...
+// ==========================================================================
+inline TFloatFixPt& TFloatFixPt::operator/=( const TFloatFixPt& aVal )
+{
+#ifdef FIXPT_USE_INTS
+ iValue = svgScalarDiv(iValue, aVal.iValue);
+ return *this;
+#else
+ TInt64 z = MAKE_TINT64( iValue ,0 ) ;
+ TInt64 temp = aVal.iValue ;
+ z /= temp;
+ z >>= KFixPtFrac;
+ iValue = I64INT ( z );
+ return *this;
+#endif
+}
+
+// ===================================================================
+// Addition operation
+// ==========================================================================
+inline TFloatFixPt TFloatFixPt::operator+( const TFloatFixPt& aVal ) const
+ {
+ return TFloatFixPt( iValue + aVal.iValue, ETrue );
+ }
+// ==========================================================================
+// Subtraction operation
+// ==========================================================================
+inline TFloatFixPt TFloatFixPt::operator-( const TFloatFixPt& aVal ) const
+ {
+ return TFloatFixPt( iValue - aVal.iValue, ETrue );
+ }
+
+// ==========================================================================
+// Multiplication operator
+// ==========================================================================
+
+inline TFloatFixPt TFloatFixPt::operator*( const TFloatFixPt& aVal ) const
+ {
+ TFloatFixPt tmp( iValue, ETrue );
+ tmp *= aVal;
+ return tmp;
+ }
+// ==========================================================================
+// Division operator
+// ==========================================================================
+inline TFloatFixPt TFloatFixPt::operator/( const TFloatFixPt& aVal ) const
+ {
+ TFloatFixPt tmp( iValue, ETrue );
+ tmp /= aVal;
+ return tmp;
+ }
+// ==========================================================================
+// Equals operator
+// ==========================================================================
+inline TInt TFloatFixPt::operator==( const TFloatFixPt& aVal ) const
+ {
+ return ( iValue == aVal.iValue );
+ }
+
+// ==========================================================================
+// Not Equals operator
+// ==========================================================================
+inline TInt TFloatFixPt::operator!=( const TFloatFixPt& aVal ) const
+ {
+ return ( iValue != aVal.iValue );
+ }
+
+// ==========================================================================
+// Greater than or equal to operator
+// ==========================================================================
+inline TInt TFloatFixPt::operator>=( const TFloatFixPt& aVal ) const
+ {
+ return ( iValue >= aVal.iValue );
+ }
+
+// ==========================================================================
+// Less than or equal to operator
+// ==========================================================================
+inline TInt TFloatFixPt::operator<=( const TFloatFixPt& aVal ) const
+ {
+ return ( iValue <= aVal.iValue );
+ }
+
+// ==========================================================================
+// Greater than operator
+// ==========================================================================
+inline TInt TFloatFixPt::operator>( const TFloatFixPt& aVal ) const
+ {
+ return ( iValue > aVal.iValue );
+ }
+
+// ==========================================================================
+// Less than operator
+// ==========================================================================
+inline TInt TFloatFixPt::operator<( const TFloatFixPt& aVal ) const
+ {
+ return ( iValue < aVal.iValue );
+ }
+// ==========================================================================
+// Left shift operator
+// ==========================================================================
+inline TFloatFixPt TFloatFixPt::operator<<( const TInt aN ) const
+ {
+ TFloatFixPt tmp( iValue<<aN, ETrue );
+ return tmp;
+ }
+// ==========================================================================
+// Right shift operator
+// ==========================================================================
+inline TFloatFixPt TFloatFixPt::operator>>( const TInt aN ) const
+ {
+ TFloatFixPt tmp( iValue>>aN, ETrue );
+ return tmp;
+ }
+
+// ==========================================================================
+// Round to the nearest whole number
+// ==========================================================================
+inline TInt32 TFloatFixPt::Round()
+ {
+ if ( 0 != ( iValue & 0x8000 ) )
+ return ( iValue >> KFixPtFrac ) + 1;
+ else
+ return ( iValue >> KFixPtFrac );
+ }
+
+// ==========================================================================
+// Get 32-bit representation
+// ==========================================================================
+inline TInt32 TFloatFixPt::RawData()
+ {
+ return iValue;
+ }
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxGeneralPath.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,371 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXGENERALPATH_H
+#define GFXGENERALPATH_H
+
+#include <e32base.h>
+#include <e32std.h>
+
+#include "GfxFloatFixPt.h"
+#include "GfxShape.h"
+#include "GfxAffineTransform.h"
+#include "GfxRectangle2D.h"
+#include "GfxPoint2D.h"
+#include "GfxPathIterator.h"
+
+#include <VG/openvg.h>
+
+
+/**
+ * Implementation of a path.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+
+class CGfxGeneralPath : public CBase, public MGfxShape
+ {
+ public:
+ /**
+ * Two-phase constructor.
+ *
+ * @since 1.0
+ * @return
+ */
+ static CGfxGeneralPath* NewL();
+
+ /**
+ * Two-phase constructor.
+ *
+ * @since 1.0
+ * @return
+ */
+ static CGfxGeneralPath* NewLC();
+
+ /**
+ * Destructor.
+ *
+ * @since 1.0
+ * @return
+ */
+ virtual ~CGfxGeneralPath();
+
+ /**
+ * Signal end of path to connect starting point to ending point.
+ *
+ * @since 1.0
+ * @return
+ */
+ void ClosePathL();
+
+ void RemoveLastPathCommand();
+
+ /**
+ * Add a cubic curve.
+ *
+ * @since 1.0
+ * @param aX1 : x coordinate for control point 1.
+ * @param aY1 : y coordinate for control point 1.
+ * @param aX2 : x coordinate for control point 2.
+ * @param aY2 : y coordinate for control point 2.
+ * @param aX3 : x coordinate for control point 3.
+ * @param aY3 : y coordinate for control point 3.
+ * @param aAbsolute : flag to indicate values are absolute or not.
+ * @return
+ */
+ void CubicToL( TFloatFixPt& aX1,
+ TFloatFixPt& aY1,
+ TFloatFixPt& aX2,
+ TFloatFixPt& aY2,
+ TFloatFixPt& aX3,
+ TFloatFixPt& aY3,
+ TBool aAbsolute );
+
+ /**
+ * Add a line.
+ *
+ * @since 1.0
+ * @param aX1 : x coordinate of line end point.
+ * @param aY1 : y coordinate of line end point.
+ * @param aAbsolute : flag to indicate values are absolute or not.
+ * @return
+ */
+ void LineToL( TFloatFixPt& aX,
+ TFloatFixPt& aY,
+ TBool aAbsolute );
+
+ /**
+ * Start a new sub-path at the given location.
+ *
+ * @since 1.0
+ * @param aX1 : x coordinate of new location.
+ * @param aY1 : y coordinate of new location.
+ * @param aAbsolute : flag to indicate values are absolute or not.
+ * @return
+ */
+ void MoveToL( TFloatFixPt& aX,
+ TFloatFixPt& aY,
+ TBool aAbsolute );
+
+ /**
+ * Add a quadratic curve.
+ *
+ * @since 1.0
+ * @param aX1 : x coordinate for control point 1.
+ * @param aY1 : y coordinate for control point 1.
+ * @param aX2 : x coordinate for control point 2.
+ * @param aY2 : y coordinate for control point 2.
+ * @param aAbsolute : flag to indicate values are absolute or not.
+ * @return
+ */
+ void QuadToL( TFloatFixPt& aX1,
+ TFloatFixPt& aY1,
+ TFloatFixPt& aX2,
+ TFloatFixPt& aY2,
+ TBool aAbsolute );
+
+ /**
+ * Add a horizontal line from the current location.
+ *
+ * @since 1.0
+ * @param aX : x coordinate for ending point.
+ * @param aAbsolute : flag to indicate values are absolute or not.
+ * @return
+ */
+ void HorizonToL( TFloatFixPt& aX,
+ TBool aAbsolute );
+
+ /**
+ * Add a vertical line from the current location.
+ *
+ * @since 1.0
+ * @param aY : y coordinate for ending point.
+ * @param aAbsolute : flag to indicate values are absolute or not.
+ * @return
+ */
+ void VertToL( TFloatFixPt& aY,
+ TBool aAbsolute );
+
+ /**
+ * Add a cubic curve, using the current location as the
+ * first control point.
+ *
+ * @since 1.0
+ * @param aX2 : x coordinate for control point 2.
+ * @param aY2 : y coordinate for control point 2.
+ * @param aX3 : x coordinate for control point 3.
+ * @param aY3 : y coordinate for control point 3.
+ * @param aAbsolute : flag to indicate values are absolute or not.
+ * @return
+ */
+ void ShortCubicToL( TFloatFixPt& aX2,
+ TFloatFixPt& aY2,
+ TFloatFixPt& aX3,
+ TFloatFixPt& aY3,
+ TBool aAbsolute );
+ /**
+ * Add a quadratic curve, using the current location as the
+ * first control point.
+ *
+ * @since 1.0
+ * @param aX2 : x coordinate for control point 2.
+ * @param aY2 : y coordinate for control point 2.
+ * @param aAbsolute : flag to indicate values are absolute or not.
+ * @return
+ */
+ void ShortQuadToL( TFloatFixPt& aX2,
+ TFloatFixPt& aY2,
+ TBool aAbsolute );
+
+
+
+ /**
+ * Clear all path info.
+ *
+ * @since 1.0
+ * @return
+ */
+ void Reset();
+
+ /**
+ * Append the given points to this path.
+ *
+ * @since 1.0
+ * @param aItr : points to append.
+ * @return
+ */
+ void AppendL( CGfxPathIterator* aItr );
+
+
+ // Implementation of MGfxShape
+
+ /**
+ * Get the bounding box for this path.
+ *
+ * @since 1.0
+ * @param aAt : transform to apply.
+ * @param aRect : bounding box info holder.
+ * @return
+ */
+ void GetBounds( const TGfxAffineTransform& aAt,
+ TGfxRectangle2D& aRect );
+
+ /**
+ * Get the iterator for this path.
+ *
+ * @since 1.0
+ * @param aAt : transform to apply.
+ * @param aPitr : iterator info for this path.
+ * @return
+ */
+ void GetPathIteratorL( TGfxAffineTransform* aAt,
+ CGfxPathIterator*& aPitr );
+
+ /**
+ * Get the iterator for this path.
+ *
+ * @since 1.0
+ * @param aAt : transform to apply.
+ * @param aLimit : maximum number of points to define path.
+ * @param aPitr : iterator info for this path.
+ * @return
+ */
+ void GetPathIteratorL( TGfxAffineTransform* aAt,
+ TInt aLimit,
+ CGfxPathIterator*& aPitr );
+ /**
+ * Get the area for this path.
+ *
+ * @since 1.0
+ * @return area of path.
+ */
+ TFloatFixPt AreaSize();
+
+ /**
+ * Get the pointer to the type array.
+ *
+ * @since 1.0
+ * @return type info array pointer
+ */
+ RArray<TUint32>* PointTypeArray();
+ unsigned char* PathSegmentTypeArray();
+ void PathSegmentTypeArray(unsigned char* aSegmentTypeArray);
+ TUint8 CGfxGeneralPath::Count();
+ void CGfxGeneralPath::Count(TUint8 aCount);
+
+ /**
+ * Get the pointer to the coordinate array.
+ *
+ * @since 1.0
+ * @return coordinate array.
+ */
+ TFloatFixPt* PointCoordsArray();
+
+ /**
+ * Get the pointer to the type array.
+ *
+ * @since 1.0
+ * @return type info array pointer
+ */
+ RArray<TFloatFixPt>* PointCoordsArrayAll();
+
+ /**
+ * Set the pointer to the type array.
+ *
+ * @since 1.0
+ * @param aTypesArray : type info array pointer
+ * @return
+ */
+ void SetPointTypeArrayL( RArray<TUint32>* aTypesArray );
+
+ // used in decoding to avoid local copying
+ void SetPointTypeArrayRef( RArray<TUint32>*& aTypesArray );
+
+ /**
+ * Set the pointer to the coordinate array.
+ *
+ * @since 1.0
+ * @param aPointCoords : coordinate array.
+ * @return
+ */
+ void SetPointCoordsArrayL( RArray<TFloatFixPt>* aPointCoords );
+
+ // used in decoding to avoid local copying
+ void SetPointCoordsArrayRef( RArray<TFloatFixPt>*& aPointCoords );
+
+
+ /* Return shape type */
+ inline virtual TInt ShapeType () { return EPath; };
+
+ /* gives the total number of segments in the path elementL */
+ TInt GetSegmentCount();
+
+ /* gives the segmentType in the path elementL */
+ TInt GetSegmentType(TInt aSegmentIndex );
+
+ /* gives the */
+ TReal32 GetSegmentParameter(TInt aSegmentIndex ,TInt aParameterIndex);
+ void IsHorizontalLineOrVertical(TInt aSegmentIndex, TBool& aHorizontal, TBool& aVertical);
+
+ CGfxGeneralPath* CloneL();
+ void QuadToLWithNoControlPoint(TFloatFixPt aX, TFloatFixPt aY);
+
+ protected:
+
+ /**
+ * Constructor
+ *
+ * @since 1.0
+ * @return
+ */
+ CGfxGeneralPath();
+
+ /**
+ * Second phase of construction.
+ *
+ * @since 1.0
+ * @return
+ */
+ void ConstructL();
+
+
+ /**
+ * Get the curve reference point for this last curve.
+ *
+ * @since 1.0
+ * @param aX : storage for x coordinate of reference point.
+ * @param aY : storage for y coordinate of reference point.
+ * @return
+ */
+ void GetCurveRefPoint( TFloatFixPt& aX, TFloatFixPt& aY );
+
+ protected:
+ RArray<TUint32>* iPointTypes;
+ unsigned char* iPathSegmentTypeArray;
+ TUint8 iCount;
+ RArray<TFloatFixPt>* iPointCoords;
+
+ TFloatFixPt iLastX;
+ TFloatFixPt iLastY;
+
+ private:
+ friend class CGfxGeneralPathIteratorP;
+ };
+
+#endif // GFXGENERALPATH_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxGeneralPathIteratorP.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef CGFXGENERALPATHITERATORP
+#define CGFXGENERALPATHITERATORP
+
+#include <e32std.h>
+#include <e32base.h>
+
+#include "GfxFloatFixPt.h"
+#include "GfxPathIterator.h"
+#include "GfxAffineTransform.h"
+#include "GfxPoint2D.h"
+
+
+
+class CGfxGeneralPath;
+
+
+/**
+ * This class provides the methods to cycle through points in a path.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class CGfxGeneralPathIteratorP : public CGfxPathIterator
+ {
+ public:
+
+ /**
+ * Contructor.
+ *
+ * @since 1.0
+ * @param aPath : path to cycle through.
+ * @param aTransform : transform to apply.
+ * @return
+ */
+ CGfxGeneralPathIteratorP( CGfxGeneralPath* aPath,
+ TGfxAffineTransform* aTransform );
+
+ /**
+ * Destructor.
+ *
+ * @since 1.0
+ * @return
+ */
+ ~CGfxGeneralPathIteratorP();
+
+ // implementation of CGfxPathIterator
+
+ /**
+ * Get the point defining the current segment.
+ *
+ * @since 1.0
+ * @param aCoords : storage for points.
+ * @return segment type.
+ */
+ TGfxSegType CurrentSegment( TFloatFixPt* aCoords );
+
+ /**
+ * Determine if end of iterator has been reached.
+ *
+ * @since 1.0
+ * @return true, if iterator reached end.
+ */
+ TBool IsDone();
+
+ /**
+ * Cycle to the next segment of the path.
+ *
+ * @since 1.0
+ * @return
+ */
+ void NextL();
+
+
+
+ private:
+ TInt32 iTypeIdx;
+ TInt32 iPointIdx;
+ CGfxGeneralPath* iPath;
+
+
+
+ TGfxPoint2D iStartPoint;
+ };
+
+#endif // CGFXGENERALPATHITERATORP
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxGradientPaint.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#ifndef GFXGRADIENTPAINT_H
+#define GFXGRADIENTPAINT_H
+
+#include <e32std.h>
+#include <fbs.h>
+
+#include "GfxPaint.h"
+#include "GfxAffineTransform.h"
+
+#include <VG/openvg.h>
+
+//
+#include "VGRenderer.h"
+const TUint16 KuserSpaceOnUse = 0;
+const TUint16 KobjectBoundingBox = 1;
+const TUint16 KspreadMethodPad = 0; //SVG_GRADIENT_PAD;
+const TUint16 KspreadMethodReflect = 1; //SVG_GRADIENT_REFLECT;
+const TUint16 KspreadMethodRepeat= 2; //SVG_GRADIENT_REPEAT;
+
+/**
+ * This class holds stop color information for gradient.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TSvgStopData
+ {
+ public:
+ TFloatFixPt iOffset;
+ TUint32 iStopColor;
+ TFloatFixPt iStopOpacity;
+ };
+
+/**
+ * This class provides the common properties and methods for linear and radial gradient.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TGfxGradientPaint : public MGfxPaint
+ {
+ public:
+ /**
+ * Constructor.
+ *
+ * @since 1.0
+ * @return
+ */
+ TGfxGradientPaint();
+ ~TGfxGradientPaint();
+
+
+
+
+ void SetFill(VGPaint aFillPaint, TGfxRectangle2D& aBBox, TFloatFixPt aOpacity,void* GfxContext);
+
+ TUint16 iGradientUnits;
+ TUint16 iSpreadMethod;
+ SVGMatrix2x3 iGradientTransform;
+ RArray<TSvgStopData> *iStopData;
+
+ VGPaint iFillPaint;
+
+ };
+
+/**
+ *
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TGfxLinearGradientPaint : public TGfxGradientPaint
+ {
+ public:
+ /**
+ * Constructor.
+ *
+ * @since 1.0
+ * @return
+ */
+ TGfxLinearGradientPaint();
+ public:
+ /**
+ *
+ *
+ * @since 1.0
+ * @param aRect : rectangle to iterator through.
+ * @param aTransform : transform to apply.
+ * @return
+ */
+ TUint32 GetColor() {return KGfxColorLinearGradient;}
+
+
+
+
+ void SetFill(VGPaint aFillPaint, TGfxRectangle2D& aBBox, TFloatFixPt aOpacity,void* GfxContext);
+ TFloatFixPt iX1, iY1, iX2, iY2;
+ };
+
+/**
+ *
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TGfxRadialGradientPaint : public TGfxGradientPaint
+ {
+ public:
+ /**
+ * Constructor.
+ *
+ * @since 1.0
+ * @return
+ */
+ TGfxRadialGradientPaint();
+
+ /**
+ * Constructor.
+ *
+ * @since 1.0
+ * @param aRect : rectangle to iterator through.
+ * @param aTransform : transform to apply.
+ * @return
+ */
+ TUint32 GetColor() {return KGfxColorRadialGradient;}
+
+
+
+
+ void SetFill(VGPaint aFillPaint, TGfxRectangle2D& aBBox, TFloatFixPt aOpacity,void* GfxContext);
+ TFloatFixPt iCx, iCy, iR, iFx, iFy;
+ };
+
+#endif /* GFXGRADIENTPAINT_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxImageTransformer.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXIMAGETRANSFORMER_H
+#define GFXIMAGETRANSFORMER_H
+
+#include <e32std.h>
+#include <fbs.h>
+#include <bitstd.h>
+
+#include "GfxFloatFixPt.h"
+#include "GfxAffineTransform.h"
+#include "GfxRenderingHints.h"
+#include "GfxRectangle2D.h"
+#include "GfxPoint2D.h"
+#include "GfxColor.h"
+
+
+class CVGRenderer;
+
+/**
+ * Class to perform transformation on an image.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TGfxImageTransformer
+ {
+ public:
+
+ /**
+ * Contructor.
+ *
+ * @since 1.0
+ * @param aTransform : transform to apply.
+ * @param aInterpolation : image interpolation
+ * @return
+ */
+ TGfxImageTransformer( TGfxAffineTransform* aTransform, CVGRenderer * aRenderer);
+
+
+ /**
+ * Draw the source image onto the destination with the transformation defined by
+ * this object, blending with the alpha value.
+ *
+ * @since 1.0
+ * @param aSrc : source image
+ * @param aPoint : origin point of the text rectangle.
+ * @param aDst : destination image buffer.
+ * @param aDstWidth : destination image width.
+ * @param aDstHeight : destination image height.
+ * @param aAlpha : blending alpha value.
+ * @param aClipRect :
+ * @param aReverse : ETrue if copying image from aDst to aSrc.
+ * This is a special case and used to copy background image to text box.
+ * EFalse is for regular use.
+ * @return
+ */
+ void Draw( CFbsBitmap* aSrc,
+ const TGfxPoint2D& p,
+ TUint32* aDst,
+ TInt aDstWidth,
+ TInt aDstHeight,
+ TUint8 aAlpha,
+ TGfxColor aTransparentColor,
+ const TRect& aClipRect,
+ TBool aReverse = EFalse
+ );
+
+ /**
+ * Draw the source image onto the destination with the transformation defined by
+ * this object. Uses the alpha bits of the EColor16MU to blend. Only EColor16MU mode
+ * for aSrc is allowed.
+ *
+ * @since 1.0
+ * @param aSrc : source image
+ * @param aPoint : origin point of the text rectangle.
+ * @param aDst : destination image buffer.
+ * @param aDstWidth : destination image width.
+ * @param aDstHeight : destination image height.
+ * @param aClipRect :
+ * @param aReverse : ETrue if copying image from aDst to aSrc.
+ * This is a special case and used to copy background image to text box.
+ * EFalse is for regular use.
+ * @return
+ */
+ void Draw( CFbsBitmap* aSrc,
+ const TGfxPoint2D& p,
+ TUint32* aDst,
+ TInt aDstWidth,
+ TInt aDstHeight,
+ const TRect& aClipRect
+ );
+
+
+ /**
+ * Get the bounding box for the given image once transformed.
+ *
+ * @since 1.0
+ * @param aSrc : source image
+ * @param aOffset : offset.
+ * @return
+ */
+ TGfxRectangle2D GetTransformedBound( CFbsBitmap* aSrc,
+ const TGfxPoint2D& aOffset );
+ /**
+ * Draw the source image onto the destination with the transformation defined by
+ * this object, blending with the alpha value. When aReverse is ETrue, do the reverse.
+ *
+ * @since 1.0
+ * @param aSrc : source image
+ * @param aPoint : origin point of the text rectangle.
+ * @param aDstWidth : destination image width.
+ * @param aDstHeight : destination image height.
+ * @param aClipRect :
+ * @param aReverse : ETrue if copying image from aDst to aSrc.
+ * This is a special case and used to copy background image to text box.
+ * EFalse is for regular use.
+ * @return
+ */
+ void ImageBlend( CFbsBitmap* aSrc,
+ const TGfxPoint2D& p,
+ TInt aDstWidth,
+ TInt aDstHeight,
+ const TRect& aClipRect,
+ TBool aReverse = EFalse
+ );
+
+ /**
+ * Compute scanline starting/end position for the rectangle.
+ *
+ * @since 1.0
+ * @param y : current rectangle's height
+ * @param rect : rectangle that needs to be computed.
+ * @param north : transformed corner.
+ * @param west : transformed corner.
+ * @param east : transformed corner.
+ * @param south : transformed corner.
+ * @param xstart : computed x coordinates for start position
+ * @param xend : computed x coordinates for end position
+ *
+ * @return none
+ */
+ void ComputeXPositions(TFloatFixPt y, TRect rect, TGfxPoint2D north, TGfxPoint2D west,
+ TGfxPoint2D east, TGfxPoint2D south, TInt& xstart, TInt& xend);
+
+ /**
+ * compute coordinates from transformed 4 points.
+ *
+ * @since 1.0
+ *
+ * @return none
+ */
+ void SortCoordinates(TGfxPoint2D& origin, TGfxPoint2D& top,
+ TGfxPoint2D& north, TGfxPoint2D& south, TGfxPoint2D& right,
+ TGfxPoint2D& east, TGfxPoint2D& west, TGfxPoint2D& corner,
+ TGfxPoint2D aP, const TInt srcWidth, const TInt srcHeight);
+
+ private:
+
+ TGfxAffineTransform* iTransform;
+ CVGRenderer * iVgRenderer;
+ };
+
+#endif // GFXIMAGETRANSFORMER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxLine2D.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXLINE2D_H
+#define GFXLINE2D_H
+
+#include <e32std.h>
+
+
+#include "GfxFloatFixPt.h"
+#include "GfxRectangle2D.h"
+#include "GfxRectangularShape.h"
+#include "GfxPoint2D.h"
+#include "GfxPathIterator.h"
+#include "GfxAffineTransform.h"
+
+
+
+/**
+ * Implementation of a line.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TGfxLine2D : public MGfxShape
+ {
+ public:
+
+ /**
+ * Contructor.
+ *
+ * @since 1.0
+ * @param aX1 : x coordinate of starting point.
+ * @param aY1 : y coordinate of starting point.
+ * @param aX2 : x coordinate of ending point.
+ * @param aY2 : y coordinate of ending point.
+ * @return
+ */
+ TGfxLine2D( const TFloatFixPt& aX1,
+ const TFloatFixPt& aY1,
+ const TFloatFixPt& aX2,
+ const TFloatFixPt& aY2 );
+
+ /**
+ * Contructor.
+ *
+ * @since 1.0
+ * @param aP1 : starting point.
+ * @param aP2 : ending point.
+ * @return
+ */
+ TGfxLine2D( TGfxPoint2D aP1, TGfxPoint2D aP2 );
+
+ //
+
+ /**
+ * Get the length of this line.
+ *
+ * @since 1.0
+ * @return length
+ */
+ TFloatFixPt Length();
+
+ // Implementation of MGfShape
+
+ /**
+ * Get the bounding box.
+ *
+ * @since 1.0
+ * @param aAt : transform to apply.
+ * @param aRect : storage of bounding box info.
+ * @return
+ */
+ void GetBounds( const TGfxAffineTransform& aAt,
+ TGfxRectangle2D& aRect );
+
+ /**
+ * Get the path iterator for this line.
+ *
+ * @since 1.0
+ * @param aAt : transform to apply.
+ * @param aPitr : storage for iterator.
+ * @return
+ */
+ void GetPathIteratorL( TGfxAffineTransform* aAt,
+ CGfxPathIterator*& aPitr );
+
+ /**
+ * Get the path iterator for this line.
+ *
+ * @since 1.0
+ * @param aAt : transform to apply.
+ * @param aLimit : maximum of point to define iterator.
+ * @param aPitr : storage for iterator.
+ * @return
+ */
+ void GetPathIteratorL( TGfxAffineTransform* aAt,
+ TInt aLimit,
+ CGfxPathIterator*& aPitr );
+
+ /**
+ * Get area of this line: zero.
+ *
+ * @since 1.0
+ * @return
+ */
+ TFloatFixPt AreaSize();
+
+
+ /* Return shape type */
+ inline virtual TInt ShapeType () { return ELine; };
+
+ public:
+ TFloatFixPt iX1;
+ TFloatFixPt iY1;
+ TFloatFixPt iX2;
+ TFloatFixPt iY2;
+ };
+
+#endif // GFXLINE2D_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxLineIteratorP.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXLINEITERATORP_H
+#define GFXLINEITERATORP_H
+
+#include <e32std.h>
+
+#include "GfxFloatFixPt.h"
+#include "GfxLine2D.h"
+#include "GfxAffineTransform.h"
+
+class MGfxPathIterator;
+
+
+/**
+ * This class provides the methods to cycle through points in a line.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class CGfxLineIteratorP : public CGfxPathIterator
+ {
+ public:
+ /**
+ * Contructor.
+ *
+ * @since 1.0
+ * @param aLine : line to cycle through.
+ * @param aAffine : transform to apply.
+ * @return
+ */
+ CGfxLineIteratorP( TGfxLine2D* aLine, TGfxAffineTransform* aAffine );
+
+ /**
+ * Destructor.
+ *
+ * @since 1.0
+ * @return
+ */
+ ~CGfxLineIteratorP();
+
+ // Implementing MGfxPathIterator
+
+ /**
+ * Get the point defining the current segment.
+ *
+ * @since 1.0
+ * @param aCoords : storage for points.
+ * @return segment type.
+ */
+ TGfxSegType CurrentSegment( TFloatFixPt* aCoords );
+
+ /**
+ * Determine if end of iterator has been reached.
+ *
+ * @since 1.0
+ * @return true, if iterator reached end.
+ */
+ TBool IsDone();
+
+ /**
+ * Cycle to the next segment of the path.
+ *
+ * @since 1.0
+ * @return
+ */
+ void NextL();
+
+ /**
+ * Convert to a polygon.
+ *
+ * @since 1.0
+ * @param aRenderer : storage for points of polygon.
+ * @param aFlatness : level of smoothness.
+ * @return true, if iterator reached end.
+ */
+
+ private:
+ TGfxLine2D* iLine;
+ TInt32 iIdx;
+ };
+
+#endif // GFXLINEITERATORP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxPaint.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXPAINT_H
+#define GFXPAINT_H
+
+#include <e32std.h>
+#include <fbs.h>
+
+#include "GfxFloatFixPt.h"
+#include "GfxRectangle2D.h"
+
+#include <VG/openvg.h>
+
+const TUint32 KGfxColorLinearGradient = 0x10ffffff;
+const TUint32 KGfxColorRadialGradient = 0x11ffffff;
+const TUint32 KGfxColorNull = 0x1ffffff;
+
+
+/**
+ * Abstract class to define methods for a paint implementation, such as
+ * a gradient painter.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class MGfxPaint
+ {
+ public:
+ /**
+ * Get an array of color values for a scanline.
+ * The given buffer array is filled with this color value.
+ *
+ * @since 1.0
+ * @param aBuf : color array to holder color values
+ * @param aLength : number of color values to fill.
+ * @param x : x coordinate
+ * @param y : y coordinate
+ * @return
+ */
+ //virtual void GetScanline( TUint8* aBuf,
+ // TInt32 aLength,
+ // TInt32 x,
+ // TInt32 y ) = 0;
+
+ /**
+ * Get the "flat" color.
+ *
+ * @since 1.0
+ * @return KGfxColorNull, if implementator is gradient paint, otherwise
+ * an RGB888.
+ */
+ virtual TUint32 GetColor() = 0;
+
+
+
+
+ virtual void SetFill(VGPaint aFillPaint, TGfxRectangle2D& aBBox, TFloatFixPt aOpacity,void* GfxContext) = 0;
+ };
+
+#endif // GFXPAINT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxPathIterator.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXPATHITERATOR_H
+#define GFXPATHITERATOR_H
+
+#include <e32base.h>
+#include <e32std.h>
+#include "GfxFloatFixPt.h"
+
+class TGfxAffineTransform;
+class MGfxShape;
+class CGfxEdgeListP;
+
+
+/**
+ * This class defines the methods to cycle through points in a path.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class CGfxPathIterator : public CBase
+ {
+ public:
+
+ /**
+ * Get the point defining the current segment.
+ *
+ * @since 1.0
+ * @param aCoords : storage for points.
+ * @return segment type.
+ */
+ virtual TGfxSegType CurrentSegment( TFloatFixPt* aCoords ) = 0;
+
+ /**
+ * Determine if end of iterator has been reached.
+ *
+ * @since 1.0
+ * @return true, if iterator reached end.
+ */
+ virtual TBool IsDone() = 0;
+
+ /**
+ * Cycle to the next segment of the path.
+ *
+ * @since 1.0
+ * @return
+ */
+ virtual void NextL() = 0;
+
+ /**
+ * Convert to a polygon.
+ *
+ * @since 1.0
+ * @param aRenderer : storage for points of polygon.
+ * @param aFlatness : level of smoothness.
+ * @return true, if iterator reached end.
+ */
+ virtual void PolygonizeL( CGfxEdgeListP* /*aRenderer*/,
+ TInt /*aFlatness*/ ) {};
+
+
+ protected:
+ TGfxAffineTransform* iTransform;
+ };
+
+#endif // GFXPATHITERATOR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxPoint2D.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXPOINT2D_H
+#define GFXPOINT2D_H
+
+#include <e32std.h>
+#include "GfxFloatFixPt.h"
+
+
+/**
+ * Implementation of a 2D point.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TGfxPoint2D
+ {
+ public:
+
+ /**
+ * Constructor. Default coordinates to (0, 0).
+ *
+ * @since 1.0
+ * @return
+ */
+ TGfxPoint2D();
+
+ /**
+ * Constructor. Define point to be at the given coordinates.
+ *
+ * @since 1.0
+ * @param aX : x coordinate
+ * @param aY : y coordinate
+ * @return
+ */
+ TGfxPoint2D( TFloatFixPt aX, TFloatFixPt aY );
+
+ /**
+ * Get distance between this point and the given point.
+ *
+ * @since 1.0
+ * @param aPoint : point for distance calculation
+ * @return distance between two points.
+ */
+ TFloatFixPt Distance( const TGfxPoint2D& aPoint );
+
+ /**
+ * Get distance squared between this point and the given point.
+ *
+ * @since 1.0
+ * @param aPoint : point for distance calculation
+ * @return distance squared between two points.
+ */
+ TFloatFixPt DistanceSq( const TGfxPoint2D& aPoint );
+
+ TInt operator==( const TGfxPoint2D& aPoint ) const;
+
+ TInt operator!=( const TGfxPoint2D& aPoint ) const;
+
+ public:
+ // Coordinates
+ TFloatFixPt iX;
+ TFloatFixPt iY;
+ };
+
+#endif // GFXPOINT2D_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxPolygonRendererP.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXPOLYGONRENDERERP_H
+#define GFXPOLYGONRENDERERP_H
+
+#include <e32std.h>
+#include <e32base.h>
+
+#include "GfxFloatFixPt.h"
+#include "GfxColor.h"
+
+
+
+class TGfxColor;
+class MGfxPaint;
+class CGfxEdgeListP;
+class TGfxRendererInfoP;
+
+
+/**
+ * Implementation of a rendering class for polygons.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+
+class TGfxPolygonRendererP
+ {
+ public:
+
+ /**
+ * constructor
+ */
+ TGfxPolygonRendererP();
+
+ /**
+ * initiatize
+ */
+ void InitializeP( CGfxEdgeListP* aEdgeList,
+ TGfxRendererInfoP* aRenderInfo,
+ MGfxPaint* aPaint,
+ TBool aWindingNoneZero );
+
+ /**
+ * render scan line
+ */
+ void RenderScanlineL( TInt aY, TUint32 aAlpha );
+
+
+ /**
+ * blit scan line
+ */
+ void BlitScanline( TUint8* aSrc,
+ TInt aY,
+ TInt aStart,
+ TInt aEnd );
+
+
+ /**
+ * draw HLine
+ */
+ static void DrawHLine( TUint16* aBuf,
+ TUint32 aColor,
+ TInt aLeftX,
+ TInt aWidth );
+
+ protected:
+
+
+
+ CGfxEdgeListP* iEdgeList;
+ TGfxRendererInfoP* iRenderInfo;
+ MGfxPaint* iPaint;
+
+
+
+ TBool iWindingNoneZero;
+ };
+
+
+#endif // GFXPOLYGONRENDERERP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxRectangle2D.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXRECTANGLE2D_H
+#define GFXRECTANGLE2D_H
+
+#include <e32std.h>
+
+
+#include "GfxFloatFixPt.h"
+#include "GfxRectangularShape.h"
+#include "GfxPoint2D.h"
+#include "GfxPathIterator.h"
+#include "GfxAffineTransform.h"
+
+
+/**
+ * Implementation of a rectangle.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TGfxRectangle2D : public TGfxRectangularShape
+ {
+ public:
+
+ /**
+ * Construct a rectangle.
+ *
+ * @since 1.0
+ * @return
+ */
+ TGfxRectangle2D();
+
+ /**
+ * Construct a rectangle from another TGfxRectangle2D.
+ *
+ * @since 1.0
+ * @param aRect : rectangle to copy
+ * @return
+ */
+ TGfxRectangle2D( const TGfxRectangle2D& aRect );
+
+
+ /**
+ * Construct a rectangle from top-left, width/height info.
+ *
+ * @since 1.0
+ * @param aX : x coordinate of top-left corner
+ * @param aY : y coordinate of top-left corner
+ * @param aWidth: width of rectangle
+ * @param aHeight : height of rectangle
+ * @return
+ */
+ TGfxRectangle2D( const TFloatFixPt& aX,
+ const TFloatFixPt& aY,
+ const TFloatFixPt& aWidth,
+ const TFloatFixPt& aHeight );
+
+ /**
+ * Determine if the given rectangle intersects with this rectangle.
+ *
+ * @since 1.0
+ * @param aRect : rectangle to check for intersection.
+ * @return true, if intersection occurs.
+ */
+ TBool Intersects( const TGfxRectangle2D& aRect );
+
+ /**
+ * Determine if the given point is contained within this rectangle.
+ *
+ * @since 1.0
+ * @param aRect : rectangle to check for intersection.
+ * @return true, if points is contained within rectangle
+ */
+ TBool Contains( TGfxPoint2D aPoint );
+
+ /**
+ * Get the path iterator for this rectangle.
+ *
+ * @since 1.0
+ * @param aAt : transform to apply.
+ * @param aPitr : path iterator holder.
+ * @return
+ */
+ void GetPathIteratorL( TGfxAffineTransform* aAt,
+ CGfxPathIterator*& aPitr );
+
+ /**
+ * Get the path iterator for this rectangle.
+ *
+ * @since 1.0
+ * @param aAt : transform to apply.
+ * @param aLimit : maximum of points to define the iterator.
+ * @param aPitr : path iterator holder.
+ * @return
+ */
+ void GetPathIteratorL( TGfxAffineTransform* aAt,
+ TInt aLimit,
+ CGfxPathIterator*& aPitr );
+
+ /* Return shape type */
+ inline virtual TInt ShapeType () { return ERect; };
+
+ TInt operator==( const TGfxRectangle2D& aRect ) const;
+
+ TInt operator!=( const TGfxRectangle2D& aRect ) const;
+ };
+
+#endif // GFXRECTANGLE2D_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxRectangleIteratorP.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXRECTANGLEITERATORP_H
+#define GFXRECTANGLEITERATORP_H
+
+#include <e32base.h>
+#include <e32std.h>
+
+
+#include "GfxFloatFixPt.h"
+#include "GfxPathIterator.h"
+
+class TGfxAffineTransform;
+class TGfxRectangularShape;
+
+
+/**
+ * This class provides the methods to cycle through points in a rectangle.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class CGfxRectangleIteratorP : public CGfxPathIterator
+ {
+ public:
+ /**
+ * Constructor.
+ *
+ * @since 1.0
+ * @param aRect : rectangle to iterator through.
+ * @param aTransform : transform to apply.
+ * @return
+ */
+ CGfxRectangleIteratorP( TGfxRectangularShape* aRect,
+ TGfxAffineTransform* aTransform );
+
+ /**
+ * Destructor.
+ *
+ * @since 1.0
+ * @return
+ */
+ virtual ~CGfxRectangleIteratorP();
+
+ // Implementation of MGfxPathIterator
+
+ /**
+ * Get the point defining the current segment.
+ *
+ * @since 1.0
+ * @param aCoords : storage for points.
+ * @return segment type.
+ */
+ TGfxSegType CurrentSegment( TFloatFixPt* aCoords );
+
+ /**
+ * Determine if end of iterator has been reached.
+ *
+ * @since 1.0
+ * @return true, if iterator reached end.
+ */
+ TBool IsDone();
+
+ /**
+ * Cycle to the next segment of the path.
+ *
+ * @since 1.0
+ * @return
+ */
+ void NextL();
+
+ /**
+ * Convert to a polygon.
+ *
+ * @since 1.0
+ * @param aRenderer : storage for points of polygon.
+ * @param aFlatness : level of smoothness.
+ * @return true, if iterator reached end.
+ */
+
+ private:
+ TGfxRectangularShape* iRect;
+ TUint32 iIdx;
+ };
+
+#endif // GFXRECTANGLEITERATORP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxRectangularShape.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXRECTANGULARSHAPE_H
+#define GFXRECTANGULARSHAPE_H
+
+#include <e32base.h>
+#include <e32std.h>
+
+#include <VG/openvg.h>
+
+#include "GfxFloatFixPt.h"
+#include "GfxShape.h"
+
+
+/**
+ * This class implements the properties of a rectangle.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TGfxRectangularShape : public MGfxShape
+ {
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @since 1.0
+ * @return
+ */
+ TGfxRectangularShape();
+
+ /**
+ * Construct a rectangle from top-left, width/height info.
+ *
+ * @since 1.0
+ * @param aX : x coordinate of top-left corner
+ * @param aY : y coordinate of top-left corner
+ * @param aWidth: width of rectangle
+ * @param aHeight : height of rectangle
+ * @return
+ */
+ TGfxRectangularShape( const TFloatFixPt& aX,
+ const TFloatFixPt& aY,
+ const TFloatFixPt& aWidth,
+ const TFloatFixPt& aHeight );
+
+ /**
+ * Get the center x coordinate.
+ *
+ * @since 1.0
+ * @return x coordinate of the center.
+ */
+ TFloatFixPt CenterX();
+
+ /**
+ * Get the center y coordinate.
+ *
+ * @since 1.0
+ * @return y coordinate of the center.
+ */
+ TFloatFixPt CenterY();
+
+ /**
+ * Get the minimum x coordinate value.
+ *
+ * @since 1.0
+ * @return minimum x coordinate value.
+ */
+ TFloatFixPt MinX();
+
+ /**
+ * Get the minimum y coordinate value.
+ *
+ * @since 1.0
+ * @return minimum y coordinate value.
+ */
+ TFloatFixPt MinY();
+
+ /**
+ * Get the maximum x coordinate value.
+ *
+ * @since 1.0
+ * @return maximum x coordinate value.
+ */
+ TFloatFixPt MaxX();
+
+ /**
+ * Get the maximum y coordinate value.
+ *
+ * @since 1.0
+ * @return maximum y coordinate value.
+ */
+ TFloatFixPt MaxY();
+
+ /**
+ * Get the bounding box for this rectangle.
+ *
+ * @since 1.0
+ * @param aAt : transform to apply.
+ * @param aRect : rectangle to store bounding box info.
+ * @return maximum y coordinate value.
+ */
+ void GetBounds( const TGfxAffineTransform& aAt,
+ TGfxRectangle2D& aRect );
+
+ /**
+ * Get the area.
+ *
+ * @since 1.0
+ * @return area
+ */
+
+ TFloatFixPt AreaSize();
+
+ //
+ // OpenVG Path accessor methods..
+ //
+ //
+
+ public:
+ TFloatFixPt iWidth;
+ TFloatFixPt iHeight;
+ TFloatFixPt iX;
+ TFloatFixPt iY;
+ };
+
+#endif // GFXRECTANGULARSHAPE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxRendererInfoP.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXRENDERERINFOP_H
+#define GFXRENDERERINFOP_H
+
+#include <e32std.h>
+#include <e32base.h>
+
+#include "GfxFloatFixPt.h"
+#include "GfxRectangle2D.h"
+
+
+/**
+ * This class implements the base properties of a renderer.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TGfxRendererInfoP
+ {
+ class CGfxFont;
+
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @since 1.0
+ * @return
+ */
+ TGfxRendererInfoP();
+
+ /**
+ * Set the device info to rendering.
+ *
+ * @since 1.0
+ * @param aDstBuf : data holder for pixel info.
+ * @param aWidth : width of rendering area.
+ * @param aHeight : height of rendering area.
+ * @param aBytePerPixel : bytes per pixel
+ * @return
+ */
+ void SetDevice( TUint8* aDstBuf,
+ TInt32 aWidth,
+ TInt32 aHeight,
+ TInt32 aBytePerPixel );
+
+ /**
+ * Set the area to apply rendering operations.
+ *
+ * @since 1.0
+ * @param aClip : rectangle to define clipping area.
+ * @return
+ */
+ void SetClip( const TGfxRectangle2D& aClip );
+
+ protected:
+
+ TInt32 iWidth;
+ TInt32 iHeight;
+
+ TInt32 iClipMinX, iClipMinY;
+ TInt32 iClipMaxX, iClipMaxY;
+
+
+ private:
+ friend class CGfx2dGcVGR;
+ friend class CGfx2dGcOpenVG;
+ };
+
+#endif // GFXRENDERERINFOP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxRenderingHints.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXRENDERINGHINTS_H
+#define GFXRENDERINGHINTS_H
+
+#include <e32std.h>
+#include <fbs.h>
+#include "GfxFloatFixPt.h"
+
+
+/**
+ * This class implements the properties for renderer hints.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TGfxRenderingHints
+ {
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @since 1.0
+ * @return
+ */
+ TGfxRenderingHints();
+
+ /**
+ * Set the flag for visiblity.
+ *
+ * @since 1.0
+ * @param aVisibility : ETrue = visible
+ * @return
+ */
+ void SetVisibility( TBool aVisibility );
+
+ /**
+ * Get the flag for visiblity.
+ *
+ * @since 1.0
+ * @param aVisibility : ETrue = visible
+ * @return visibility flag
+ */
+ TBool Visibility();
+
+ /**
+ * Set the level of curve quality.
+ *
+ * @since 1.0
+ * @param aCurveQuality : level of quality
+ * @return
+ */
+ void SetCurveQuality( TInt aCurveQuality );
+
+ /**
+ * Get the level of curve quality.
+ *
+ * @since 1.0
+ * @return level of quality of curves.
+ */
+ TInt CurveQuality();
+
+ /**
+ * Set the flag for fast font rendering
+ *
+ * @since 1.0
+ * @param aFastFontRendering : ETrue = fast
+ * @return
+ */
+ void SetFastFontRendering( TBool aFastFontRendering );
+
+ /**
+ * Get the flag for fast font rendering
+ *
+ * @since 1.0
+ * @return fast font rendering flag
+ */
+ TBool FastFontRendering();
+
+ /**
+ * Set the flag for anti-aliasing rendering of shapes
+ *
+ * @since 1.0
+ * @param aFastFontRendering : ETrue = should render with anti-alias.
+ * @return
+ */
+ void SetShapeAntiAliasing( TBool aShapeAntiAliasing );
+
+ /**
+ * Get the flag for anti-aliasing rendering of shapes
+ *
+ * @since 1.0
+ * @return anti-aliasing rendering of shapes flag
+ */
+ TBool ShapeAntiAliasing();
+
+ /**
+ * Get the image interpolation object.
+ *
+ * @since 1.0
+ * @return image interpolation object.
+ */
+ TGfxImageInterpolation ImageInterpolation();
+
+ private:
+ TUint32 iHintBits;
+
+ };
+
+#endif // GFXRENDERINGHINTS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxRoundRectangle2D.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXROUNDRECTANGLE2D_H
+#define GFXROUNDRECTANGLE2D_H
+
+#include <e32std.h>
+
+#include "GfxFloatFixPt.h"
+#include "GfxRectangularShape.h"
+#include "GfxRectangle2D.h"
+#include "GfxPoint2D.h"
+#include "GfxPathIterator.h"
+#include "GfxAffineTransform.h"
+
+
+
+/**
+ * Implementation of a rounded-corner rectangle
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TGfxRoundRectangle2D : public TGfxRectangularShape
+ {
+ public:
+ /**
+ * Constructor.
+ *
+ * @since 1.0
+ * @return
+ */
+ TGfxRoundRectangle2D();
+
+ /**
+ * Construct a rounded rectangle from top-left, width/height info.
+ *
+ * @since 1.0
+ * @param aX : x coordinate of top-left corner
+ * @param aY : y coordinate of top-left corner
+ * @param aWidth: width of rectangle
+ * @param aHeight : height of rectangle
+ * @param aArcWidth : rounded corner width
+ * @param aArcHeight : rounded corner height
+ * @return
+ */
+ TGfxRoundRectangle2D( const TFloatFixPt& aX,
+ const TFloatFixPt& aY,
+ const TFloatFixPt& aW,
+ const TFloatFixPt& aH,
+ const TFloatFixPt& aArcWidth,
+ const TFloatFixPt& aArcHeight );
+
+ /**
+ * Get the path iterator for this rounded rectangle.
+ *
+ * @since 1.0
+ * @param aAt : transform to apply.
+ * @param aPitr : path iterator holder.
+ * @return
+ */
+ void GetPathIteratorL( TGfxAffineTransform* aAt,
+ CGfxPathIterator*& aPitr );
+
+ /**
+ * Get the path iterator for rounded rectangle.
+ *
+ * @since 1.0
+ * @param aAt : transform to apply.
+ * @param aLimit : maximum of points to define the iterator.
+ * @param aPitr : path iterator holder.
+ * @return
+ */
+ void GetPathIteratorL( TGfxAffineTransform* aAt,
+ TInt aLimit,
+ CGfxPathIterator*& aPitr );
+
+
+ /* Return shape type */
+ inline virtual TInt ShapeType () { return ERoundRect; };
+
+
+ public:
+ TFloatFixPt iArcWidth;
+ TFloatFixPt iArcHeight;
+
+ private:
+ friend class CGfxRoundRectangleIteratorP;
+
+ };
+
+#endif // GFXROUNDRECTANGLE2D_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxRoundRectangleIteratorP.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXROUNDRECTANGLEITERATORP_H
+#define GFXROUNDRECTANGLEITERATORP_H
+
+#include <e32base.h>
+#include <e32std.h>
+
+
+#include "GfxFloatFixPt.h"
+#include "GfxPathIterator.h"
+#include "GfxAffineTransform.h"
+
+class TGfxRoundRectangle2D;
+
+
+
+/**
+ * This class provides the methods to cycle through points in a rounded rectangle.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class CGfxRoundRectangleIteratorP : public CGfxPathIterator
+ {
+ public:
+
+ /**
+ * Constructor.
+ *
+ * @since 1.0
+ * @param aRect : rounded rectangle to iterator through.
+ * @param aTransform : transform to apply.
+ * @return
+ */
+ CGfxRoundRectangleIteratorP( TGfxRoundRectangle2D* aRoundRect,
+ TGfxAffineTransform* aAffine );
+
+
+ /**
+ * Destructor.
+ *
+ * @since 1.0
+ * @return
+ */
+ virtual ~CGfxRoundRectangleIteratorP();
+
+ // Implementation of MGfxPathIterator
+
+ /**
+ * Get the point defining the current segment.
+ *
+ * @since 1.0
+ * @param aCoords : storage for points.
+ * @return segment type.
+ */
+ TGfxSegType CurrentSegment( TFloatFixPt* aCoords );
+
+ /**
+ * Determine if end of iterator has been reached.
+ *
+ * @since 1.0
+ * @return true, if iterator reached end.
+ */
+ TBool IsDone();
+
+ /**
+ * Cycle to the next segment of the path.
+ *
+ * @since 1.0
+ * @return
+ */
+ void NextL();
+
+
+ /**
+ * Convert to a polygon.
+ *
+ * @since 1.0
+ * @param aRenderer : storage for points of polygon.
+ * @param aFlatness : level of smoothness.
+ * @return true, if iterator reached end.
+ */
+
+ private:
+ TGfxRoundRectangle2D* iRoundRect;
+
+ TInt32 iIdx;
+ TFloatFixPt iRx, iRy;
+ };
+
+#endif // GFXROUNDRECTANGLEITERATORP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxShape.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXSHAPE_H
+#define GFXSHAPE_H
+
+#include <e32std.h>
+
+#include "GfxFloatFixPt.h"
+#include "GfxPoint2D.h"
+
+
+class CGfxPathIterator;
+class TGfxRectangle2D;
+class TGfxAffineTransform;
+
+
+/**
+ * This interface defines the methods that must be implement to be a 'Shape'.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class MGfxShape
+ {
+ public:
+ /**
+ * Get the bounding box
+ *
+ * @since 1.0
+ * @param aAt : transform to apply.
+ * @param aRect : rectangle to store bounding box info.
+ * @return
+ */ virtual void GetBounds( const TGfxAffineTransform& aAt,
+ TGfxRectangle2D& aRect ) = 0;
+
+ /**
+ * Get the path iterator for this rectangle.
+ *
+ * @since 1.0
+ * @param aAt : transform to apply.
+ * @param aPitr : path iterator holder.
+ * @return
+ */
+ virtual void GetPathIteratorL( TGfxAffineTransform* aAt,
+ CGfxPathIterator*& aPitr ) = 0;
+
+ /**
+ * Get the path iterator for this rectangle.
+ *
+ * @since 1.0
+ * @param aAt : transform to apply.
+ * @param aLimit : maximum of points to define the iterator.
+ * @param aPitr : path iterator holder.
+ * @return
+ */
+ virtual void GetPathIteratorL( TGfxAffineTransform* aAt,
+ TInt aLimit,
+ CGfxPathIterator*& aPitr ) = 0;
+
+ /**
+ * Get the area of this shape.
+ *
+ * @since 1.0
+ * @return area of shape.
+ */
+ virtual TFloatFixPt AreaSize() = 0;
+
+
+ /* Return shape type */
+ virtual TInt ShapeType () = 0;
+
+ enum HYB_SHAPE_TYPE
+ {
+ ELine, ERect, ERoundRect, EEllipse, EPath
+ };
+
+ };
+
+#endif // GFXSHAPE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxStroke.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+
+#ifndef GFXSTROKE_H
+#define GFXSTROKE_H
+
+#include <e32std.h>
+#include <e32base.h>
+#include <fbs.h>
+#include "GfxFloatFixPt.h"
+
+
+
+class CGfxGeneralPath;
+class MGfxShape;
+class CGfx2dGc;
+
+
+/**
+ * Implementation of a Stroke.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TGfxStroke
+ {
+ public:
+
+ /**
+ * Constructor. Default values for width, join, cap and miter-limit.
+ *
+ * @since 1.0
+ * @return
+ */
+ TGfxStroke();
+
+ /**
+ * Constructor.
+ *
+ * @since 1.0
+ * @param aStrokeWidth : width of stroke.
+ * @return
+ */
+ TGfxStroke( TFloatFixPt aStrokeWidth );
+
+ /**
+ * Constructor.
+ *
+ * @since 1.0
+ * @param aStrokeWidth : width of stroke.
+ * @param aJoin : join type
+ * @param aCap : cap type
+ * @param aMiterLimit : miter-limit value.
+ * @return
+ */
+ TGfxStroke( TFloatFixPt aStrokeWidth,
+ TGfxJoinType aJoin,
+ TGfxCapType aCap,
+ TFloatFixPt& aMiterLimit );
+
+ void SetMiterLimit( TFloatFixPt aMiterLimit);
+ void SetJoinType( TGfxJoinType aJoin );
+ void SetCapType( TGfxCapType aCap );
+
+ /**
+ * Set the stroke width
+ *
+ * @since 1.0
+ * @param aWidth : width of stroke.
+ * @return
+ */
+ void SetStrokeWidth( TFloatFixPt aWidth );
+
+ /**
+ * Get the stroke width
+ *
+ * @since 1.0
+ * @return stroke width
+ */
+ TFloatFixPt StrokeWidth();
+ TGfxJoinType StrokeJoin();
+ TGfxCapType StrokeCap();
+ TFloatFixPt StrokeMiterLimit();
+
+ protected:
+
+ /**
+ * Get the stroke width, join type, cap type and miter-limit.
+ *
+ * @since 1.0
+ * @param aStrokeWidth : width of stroke.
+ * @param aJoin : join type
+ * @param aCap : cap type
+ * @param aMiterLimit : miter-limit value.
+ * @return
+ */
+ void SetVars( TFloatFixPt aStrokeWidth,
+ TGfxJoinType aJoin,
+ TGfxCapType aCap,
+ const TFloatFixPt& aMiterLimit );
+
+ protected:
+ TFloatFixPt iStrokeWidth;
+ TGfxJoinType iJoin;
+ TGfxCapType iCap;
+ TFloatFixPt iMiterLimit;
+
+
+ private:
+ friend class CGfx2dGc;
+
+ };
+
+
+#endif // GFXSTROKE_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/GfxStrokeRendererP.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library header file
+*
+*/
+
+
+#ifndef GFXSTROKERENDERERP_H
+#define GFXSTROKERENDERERP_H
+
+#include <e32std.h>
+#include <e32base.h>
+
+#include "GfxFloatFixPt.h"
+#include "GfxColor.h"
+
+
+
+class TGfxColor;
+class MGfxPaint;
+class CGfxEdgeListP;
+class TGfxRendererInfoP;
+
+
+class CFbsBitGc;
+
+/**
+ * Implementation of a rendering class for a stroke.
+ *
+ * @lib Gfx2D.lib
+ * @since 1.0
+ */
+class TGfxStrokeRendererP
+ {
+ public:
+ /**
+ * Constructor.
+ *
+ * @since 1.0
+ * @return
+ */
+ TGfxStrokeRendererP();
+
+
+ /**
+ * Intialize this object.
+ *
+ * @since 1.0
+ * @param aEdgeList : list of edge points.
+ * @param aRenderInfo : rendering info.
+ * @param aColor : color to draw.
+ * @param aPolbuf : pixel output buffer.
+ * @return
+ */
+ void InitializeP( CGfxEdgeListP* aEdgeList,
+ TGfxRendererInfoP* aRenderInfo,
+ TGfxColor aColor );
+
+ /**
+ * Render at the given horizontal line.
+ *
+ * @since 1.0
+ * @param aY : y coordinate of line to render.
+ * @return
+ */
+ void RenderScanlineL( TInt aY );
+
+ /**
+ * Render at the given horizontal line.
+ *
+ * @since 1.0
+ * @param aY : y coordinate of line to render.
+ * @param aAlpha : alpha value for blending.
+ * @return
+ */
+ void RenderScanlineL( TInt aY, TUint32 aAlpha );
+
+ protected:
+
+
+ CGfxEdgeListP* iEdgeList;
+ TGfxRendererInfoP* iRenderInfo;
+ TGfxColor iStrokeColor;
+
+ CFbsBitGc* iGdiGc;
+ };
+
+
+#endif // GFXSTROKERENDERERP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/Gfxmath.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Math function header
+ *
+*/
+
+#ifndef GFXMATH_H
+#define GFXMATH_H
+
+
+
+
+#include "e32def.h"
+
+/*define this to make all math to use floating point (otherwise uses 16:16 fixed point)*/
+
+//#define SVG_FLOAT_BUILD
+
+
+typedef signed __int64 svgInt64;
+typedef unsigned __int64 svgUint64;
+
+float svgFixedToFloat(int x);
+int svgScalarFromFloat(float f);
+
+int svgScalarMul(int r1, int r2);
+int svgScalarDiv(int x, int y);
+
+
+#endif /*GFXMATH_H*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/inc/Gfxtrignometric.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <e32std.h>
+
+class GfxMath
+{
+private:
+
+class TGfxInt64
+{
+public:
+ TInt32 l; /* low part */
+ TInt32 h; /* high part */
+} ;
+
+public:
+ static TInt svgScalarSin( TInt r1 );
+ static TInt svgScalarCos( TInt r1 );
+ static TInt svgScalarTan( TInt r1 );
+private:
+ static TInt32 hgAbs32( TInt32 x );
+ static TUint32 hgMulu64h (TUint32 a, TUint32 b);
+ static TGfxInt64 hgMulu64 (TUint32 a, TUint32 b);
+ static TGfxInt64 hgMul64 (TInt32 a, TInt32 b);
+ static TGfxInt64 hgMadd64 (TGfxInt64 a, TInt32 b, TInt32 c);
+ static TGfxInt64 hgSet64(TInt32 hh,TInt32 ll);
+ static TInt32 hgLsl64h_0_31 (const TGfxInt64 a, TInt32 sh);
+ static TInt svgiRCos( TInt32 _x );
+ static TGfxInt64 hgAdd64 (const TGfxInt64 a, const TGfxInt64 b);
+ static TInt32 hgMul64h (TInt32 a, TInt32 b);
+ static TInt32 hgGet64h (const GfxMath::TGfxInt64 a);
+};// class GfxMath
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxFloatFixPt.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,435 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include <e32std.h>
+#include "GfxFloatFixPt.h"
+
+
+#ifdef SVG_FLOAT_BUILD
+#include <e32math.h>
+
+// --------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+ void TFloatFixPt::GetString( float aFloat, TDes& aBuf )
+ {
+ TRealFormat rf( 10, 3 );
+ rf.iType = KRealFormatFixed | KDoNotUseTriads;
+ aBuf.Num( ( aFloat ), rf );
+ }
+
+// --------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+ float TFloatFixPt::ConvertString( const TDesC& aVal )
+ {
+ TLex aString( aVal );
+ TReal32 val;
+ aString.SkipSpace();
+ aString.Val( val, '.' );
+ return float( val );
+ }
+
+// --------------------------------------------------------------------------
+// Error code is returned
+// ---------------------------------------------------------------------------
+ TInt TFloatFixPt::ConvertString( const TDesC& aString, float& aValue )
+ {
+ TLex lex( aString );
+ lex.SkipSpace();
+ return lex.Val( aValue, '.' );
+ }
+
+// --------------------------------------------------------------------------
+// Error code is returned
+// ---------------------------------------------------------------------------
+ TInt TFloatFixPt::ConvertString( const TDesC& aString, TFloatFixPt& aValue )
+ {
+ TLex lex( aString );
+ lex.SkipSpace();
+ return lex.Val( aValue.iValue, '.' );
+ }
+
+// --------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+ float TFloatFixPt::Sqrt( float number )
+{
+ long i;
+ float x, y;
+ const float f = 1.5F;
+
+ x = number * 0.5F;
+ y = number;
+ i = * ( long * ) &y;
+ i = 0x5f3759df - ( i >> 1 );
+ y = * ( float * ) &i;
+ y = y * ( f - ( x * y * y ) );
+ y = y * ( f - ( x * y * y ) );
+ return number * y;
+}
+
+// --------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+ float TFloatFixPt::SinFloatDouble(float angle)
+{
+ double sn = 0;
+ Math::Sin(sn, double(angle));
+ return float(sn);
+}
+
+// --------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+ float TFloatFixPt::CosFloatDouble(float angle)
+{
+ //double cs = 0;
+ float cs = 0;
+ //Math::Cos(cs, double(angle));
+ //cs = CosineDouble(double(angle));
+ cs = CosineDouble(angle);
+ return float(cs);
+}
+
+float TFloatFixPt::CosineDouble(float x)
+{
+float p0,p1,p2,p3,p4,p5,y,t,absx,frac,quad,pi2;
+p0= 0.999999999781;
+p1=-0.499999993585;
+p2= 0.041666636258;
+p3=-0.0013888361399;
+p4= 0.00002476016134;
+p5=-0.00000026051495;
+pi2=1.570796326794896; /* pi/2 */
+absx=x;
+if (x<0) absx=-absx; /* absolute value of input */
+quad=(int) (absx/pi2); /* quadrant (0 to 3) */
+frac= (absx/pi2) - quad; /* fractional part of input */
+if(quad==0) t=frac * pi2;
+if(quad==1) t=(1-frac) * pi2;
+if(quad==2) t=frac * pi2;
+if(quad==3) t=(frac-1) * pi2;
+t=t * t;
+y=p0 + (p1*t) + (p2*t*t) + (p3*t*t*t) + (p4*t*t*t*t) + (p5*t*t*t*t*t);
+if(quad==2 | quad==1) y=-y; /* correct sign */
+return(y);
+}
+
+// --------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+ float TFloatFixPt::TanFloatDouble(float angle)
+{
+ double tn = 0;
+ Math::Tan(tn, double(angle));
+ return float(tn);
+}
+
+
+// --------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+ float TFloatFixPt::SinApprox(float angle)
+{
+ float c = 0.70710678118654752440f;
+ return ((2 - 4 * c) * angle * angle + c + angle);
+}
+
+// --------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+ float TFloatFixPt::CosApprox(float angle)
+{
+ float c = 0.70710678118654752440f;
+ return ((2 - 4 * c) * angle * angle + c - angle);
+}
+
+// --------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+ float TFloatFixPt::FastSin(const float val)
+{
+ float fASqr = val*val;
+ float fResult = -2.39e-08f;
+ fResult *= fASqr;
+ fResult += 2.7526e-06f;
+ fResult *= fASqr;
+ fResult -= 1.98409e-04f;
+ fResult *= fASqr;
+ fResult += 8.3333315e-03f;
+ fResult *= fASqr;
+ fResult -= 1.666666664e-01f;
+ fResult *= fASqr;
+ fResult += 1.0f;
+ fResult *= val;
+
+ return fResult;
+}
+
+// --------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+ float TFloatFixPt::FastCos(const float val)
+{
+ float fASqr = val*val;
+ float fResult = -2.605e-07f;
+ fResult *= fASqr;
+ fResult += 2.47609e-05f;
+ fResult *= fASqr;
+ fResult -= 1.3888397e-03f;
+ fResult *= fASqr;
+ fResult += 4.16666418e-02f;
+ fResult *= fASqr;
+ fResult -= 4.999999963e-01f;
+ fResult *= fASqr;
+ fResult += 1.0f;
+
+ return fResult;
+}
+
+// --------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+ float TFloatFixPt::FastTan(const float val)
+{
+ float fASqr = val*val;
+ float fResult = 9.5168091e-03f;
+ fResult *= fASqr;
+ fResult += 2.900525e-03f;
+ fResult *= fASqr;
+ fResult += 2.45650893e-02f;
+ fResult *= fASqr;
+ fResult += 5.33740603e-02f;
+ fResult *= fASqr;
+ fResult += 1.333923995e-01f;
+ fResult *= fASqr;
+ fResult += 3.333314036e-01f;
+ fResult *= fASqr;
+ fResult += 1.0f;
+ fResult *= val;
+
+ return fResult;
+
+}
+
+// --------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+ float TFloatFixPt::FastASin(float val)
+{
+ float fRoot = Sqrt(1.0f-val);
+ float fResult = -0.0187293f;
+ fResult *= val;
+ fResult += 0.0742610f;
+ fResult *= val;
+ fResult -= 0.2121144f;
+ fResult *= val;
+ fResult += 1.5707288f;
+ fResult = 1.57079632679489661923 - fRoot*fResult;
+
+ return fResult;
+}
+
+// --------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+ float TFloatFixPt::FastACos(float val)
+{
+ float fRoot = Sqrt(1.0f-val);
+ float fResult = -0.0187293f;
+ fResult *= val;
+ fResult += 0.0742610f;
+ fResult *= val;
+ fResult -= 0.2121144f;
+ fResult *= val;
+ fResult += 1.5707288f;
+ fResult *= fRoot;
+
+ return fResult;
+}
+
+// --------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+ float TFloatFixPt::FastATan(float val)
+{
+ float fVSqr = val*val;
+ float fResult = 0.0028662257f;
+ fResult *= fVSqr;
+ fResult -= 0.0161657367f;
+ fResult *= fVSqr;
+ fResult += 0.0429096138f;
+ fResult *= fVSqr;
+ fResult -= 0.0752896400f;
+ fResult *= fVSqr;
+ fResult += 0.1065626393f;
+ fResult *= fVSqr;
+ fResult -= 0.1420889944f;
+ fResult *= fVSqr;
+ fResult += 0.1999355085f;
+ fResult *= fVSqr;
+ fResult -= 0.3333314528f;
+ fResult *= fVSqr;
+ fResult += 1.0f;
+ fResult *= val;
+
+ return fResult;
+}
+
+// --------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+ float TFloatFixPt::Cos(float angle)
+/* computes cos of x (x in radians) by an expansion */
+{
+ float result = 1.0;
+ int factor = 1;
+ float power = angle;
+
+ for ( int i = 2; i <= 10; i++ )
+ {
+ factor = factor * i;
+ power = power * angle;
+
+ if ( (i & 1) == 0 )
+ {
+ if ( (i & 3) == 0 )
+ {
+ result += power/factor;
+ }
+ else
+ {
+ result -= power/factor;
+ }
+ }
+ }
+ return (result);
+}
+
+// --------------------------------------------------------------------------
+// TFloatFixPt TFloatFixPt::Sqrt( TFloatFixPt aA )
+// ---------------------------------------------------------------------------
+ TFloatFixPt TFloatFixPt::Sqrt( TFloatFixPt aA )
+ {
+ TFloatFixPt tmp;
+ tmp.iValue = Sqrt( aA.iValue );
+ return tmp;
+ }
+
+// --------------------------------------------------------------------------
+// TFloatFixPt TFloatFixPt::Abs( TFixPt& aA )
+// ---------------------------------------------------------------------------
+ TFloatFixPt TFloatFixPt::Abs( TFloatFixPt& aA )
+ {
+ return ( aA.iValue > 0.0f ) ? TFloatFixPt( aA.iValue ) : ( TFloatFixPt( -aA.iValue ) );
+ }
+
+// --------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+#else /*FIXED POINT BUILD*/
+// --------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------
+// void TFixPt::GetString( TDes& aBuf ) const
+// ---------------------------------------------------------------------------
+ void TFloatFixPt::GetString( TDes& aBuf ) const
+ {
+ TRealFormat rf( 10, 3 );
+ rf.iType = KRealFormatFixed | KDoNotUseTriads;
+ aBuf.Num( ( ( TReal32 ) iValue ) / KFixPtFracVal, rf );
+ }
+
+// --------------------------------------------------------------------------
+// TFloatFixPt TFloatFixPt::ConvertString( const TDesC& aVal )
+// ---------------------------------------------------------------------------
+ TFloatFixPt TFloatFixPt::ConvertString( const TDesC& aVal )
+ {
+ TLex aString( aVal );
+ TReal32 val;
+ aString.SkipSpace();
+ aString.Val( val, '.' );
+ return TFloatFixPt( val );
+ }
+
+// --------------------------------------------------------------------------
+// TInt TFloatFixPt::ConvertString( const TDesC& aValueString, TFloatFixPt& aValue )
+// ---------------------------------------------------------------------------
+ TInt TFloatFixPt::ConvertString( const TDesC& aValueString, TFloatFixPt& aValue )
+ {
+ TLex aString( aValueString );
+ TReal32 value;
+ aString.SkipSpace();
+ TInt errorCode = aString.Val( value, '.' );
+ aValue = (float)value;
+ return errorCode;
+ }
+// --------------------------------------------------------------------------
+// TFloatFixPt TFloatFixPt::Abs( TFixPt& aA )
+// ---------------------------------------------------------------------------
+ TFloatFixPt TFloatFixPt::Abs( TFloatFixPt& aA )
+ {
+ TFloatFixPt KZero;
+ return ( aA > KZero ) ? aA : ( KZero - aA );
+ }
+
+// ==========================================================================
+// fixed point SQRT from Graphics Gems
+// ==========================================================================
+// --------------------------------------------------------------------------
+// TFloatFixPt TFloatFixPt::Sqrt( TFloatFixPt aA )
+// ---------------------------------------------------------------------------
+ TFloatFixPt TFloatFixPt::Sqrt( TFloatFixPt aA )
+ {
+ TFloatFixPt tmp;
+ tmp.iValue = FixedSqrtGeneral( aA.iValue, KFixPtFrac );
+ return tmp;
+ }
+
+// ==========================================================================
+// Fixed point sqrt from Graphics Gems
+// ==========================================================================
+// --------------------------------------------------------------------------
+// TInt32 TFloatFixPt::FixedSqrtGeneral( TInt32 aX, TUint32 aFracbits )
+// ---------------------------------------------------------------------------
+ TInt32 TFloatFixPt::FixedSqrtGeneral( TInt32 aX, TUint32 aFracbits )
+ {
+ TUint32 root, remHi, remLo, testDiv, count;
+ root = 0;
+ remHi = 0;
+ remLo = aX;
+ count = 15 + ( aFracbits >> 1 );
+
+ do
+ {
+ remHi = ( remHi << 2 ) | ( remLo >> 30 );
+ remLo <<= 2;
+ root <<= 1;
+ testDiv = ( root << 1 ) + 1;
+ if ( remHi >= testDiv )
+ {
+ remHi -= testDiv;
+ root += 1;
+ }
+ }
+ while ( count-- != 0 );
+
+ return root;
+ }
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGc/Gfx2dDevice.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,17 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGc/Gfx2dGc.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,463 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+#include "Gfx2dGcInterface.h"
+
+// --------------------------------------------------------------------------
+// CGfx2dGcVGR::CGfx2dGcVGR() : iScale( 1 ),
+// ---------------------------------------------------------------------------
+CGfx2dGcVGR::CGfx2dGcVGR()
+ {
+ }
+
+//
+// ==========================================================================
+// Create a new instance.
+// ==========================================================================
+// --------------------------------------------------------------------------
+// CGfx2dGcVGR* CGfx2dGcVGR::NewL( CFbsBitmap* aFrameBuffer, TFontSpec& aFontSpec )
+// ---------------------------------------------------------------------------
+ CGfx2dGcVGR* CGfx2dGcVGR::NewL( const TSize /*aBufferSize*/, TFontSpec& /*aFontSpec*/, CSvgBitmapFontProvider */*aSvgBitmapFontProvider*/ )
+ {
+ return NULL;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::ConstructL( CFbsBitmap* aFrameBuffer, TFontSpec& aFontSpec )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::ConstructL( const TSize /*aBufferSize*/, TFontSpec& /*aFontSpec*/, CSvgBitmapFontProvider* /*aSvgBitmapFontProvider*/ )
+ {
+ }
+
+// ==========================================================================
+// Destructor.
+// ==========================================================================
+// --------------------------------------------------------------------------
+// CGfx2dGcVGR::~CGfx2dGcVGR()
+// ---------------------------------------------------------------------------
+CGfx2dGcVGR::~CGfx2dGcVGR()
+ {
+ }
+
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetFrameBufferL( CFbsBitmap* aFrameBuffer )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::ChangeBufferSizeL( const TSize /*aSize */)
+{
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::ActivateL()
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::ActivateL()
+ {
+ }
+
+// void CGfx2dGcVGR::AdjustShapeComplexityL( TInt32 /*aVertexSize*/ )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::AdjustShapeComplexityL( TInt32 /*aVertexSize*/ )
+ {
+ }
+
+
+void CGfx2dGcVGR::DoDrawL( MGfxShape* /*aShape*/ )
+ {
+ }
+
+void CGfx2dGcVGR::PostDraw()
+{
+}
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetWindingRule( TGfxWindingRule aRule )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetWindingRule( TGfxWindingRule /*aRule*/ )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::Draw( MGfxShape* aShape )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::DrawL( MGfxShape* /*aShape*/ )
+ {
+ }
+
+
+// --------------------------------------------------------------------------
+// TUint8 CGfx2dGcVGR::Composite()
+// ---------------------------------------------------------------------------
+TUint8 CGfx2dGcVGR::Composite()
+ {
+ return 0;
+ }
+
+// --------------------------------------------------------------------------
+// TGfxColor CGfx2dGcVGR::ForegroundColor()
+// ---------------------------------------------------------------------------
+TGfxColor CGfx2dGcVGR::ForegroundColor()
+ {
+ return TGfxColor(0);
+ }
+
+// --------------------------------------------------------------------------
+// TGfxColor CGfx2dGcVGR::BackgroundColor()
+// ---------------------------------------------------------------------------
+TGfxColor CGfx2dGcVGR::BackgroundColor()
+ {
+ return TGfxColor(0);
+ }
+
+// --------------------------------------------------------------------------
+// MGfxPaint* CGfx2dGcVGR::Paint()
+// ---------------------------------------------------------------------------
+MGfxPaint* CGfx2dGcVGR::Paint()
+ {
+ return NULL;
+ }
+
+// --------------------------------------------------------------------------
+// TGfxRenderingHints* CGfx2dGcVGR::RenderingHints()
+// ---------------------------------------------------------------------------
+TGfxRenderingHints* CGfx2dGcVGR::RenderingHints()
+ {
+ return NULL;
+ }
+
+// --------------------------------------------------------------------------
+// TGfxStroke CGfx2dGcVGR::Stroke()
+// ---------------------------------------------------------------------------
+TGfxStroke CGfx2dGcVGR::Stroke()
+ {
+ return TGfxStroke();
+ }
+
+// --------------------------------------------------------------------------
+// TGfxAffineTransform CGfx2dGcVGR::Transform()
+// ---------------------------------------------------------------------------
+TGfxAffineTransform CGfx2dGcVGR::Transform()
+ {
+ return TGfxAffineTransform();
+ }
+
+
+// --------------------------------------------------------------------------
+// MGfxShape* CGfx2dGcVGR::Clip()
+// ---------------------------------------------------------------------------
+MGfxShape* CGfx2dGcVGR::Clip()
+ {
+ return NULL;
+ }
+
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::GetDashArray( CArrayFix<TFixPt>*& aArray,
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::GetDashArray( CArrayFix<TFloatFixPt>*& /*aArray*/,
+ TFloatFixPt& /*aOffset*/ )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetDashOffset( TFixPt aDashOffset )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetDashOffset( TFloatFixPt /*aDashOffset*/ )
+{
+}
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetComposite( const TUint8 aComposite )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetComposite( const TUint8 /*aComposite*/ )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetForegroundColor( const TGfxColor& aColor )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetForegroundColor( const TGfxColor& /*aColor*/ )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetBackgroundColor( const TGfxColor& aColor )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetBackgroundColor( const TGfxColor& /*aColor*/ )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetPaint( MGfxPaint* aPaint )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetPaint( MGfxPaint* /* aPaint*/ )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetStroke( TGfxStroke aStroke )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetStroke( TGfxStroke /*aStroke*/ )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetRenderingHints( const TGfxRenderingHints& aRenderingHints )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetRenderingHints( const TGfxRenderingHints& /*aRenderingHints*/ )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetTransform( const TGfxAffineTransform& aTransform )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetTransform( const TGfxAffineTransform& /*aTransform*/ )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetClip( const TGfxRectangle2D& aClip )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetClip( const TGfxRectangle2D& /*aClip*/ )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetDashArrayL( CArrayFix<TFloatFixPt>* aArray )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetDashArrayL( CArrayFix<TFloatFixPt>* /*aArray*/ )
+ {
+ }
+
+
+// --------------------------------------------------------------------------
+// TSize CGfx2dGcVGR::DeviceBounds()
+// ---------------------------------------------------------------------------
+TSize CGfx2dGcVGR::DeviceBounds()
+ {
+ return TSize();
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetAntialiasingMode( const TInt32 /*aAntialiasingEnable*/)
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetAntialiasingMode( const TInt32 /*aAntialiasingEnable*/)
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetFont( const CFont* aFont )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetFont( const CFont* /*aFont*/ )
+ {
+ }
+// --------------------------------------------------------------------------
+// CFont* CGfx2dGcVGR::Font()
+// ---------------------------------------------------------------------------
+CFont* CGfx2dGcVGR::Font()
+ {
+ return NULL;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::GetSystemFontScaled(TFloatFixPt aHeight,
+// const TDesC& aTypefaceName,
+// CFont*& aFont,
+// TFontSpec& aFontSpec )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::GetFontScaled( TFloatFixPt /*aHeight*/,
+ const TDesC& /*aTypefaceName*/,
+ CFont*& /*aFont*/,
+ TFontSpec& /*aFontSpec */)
+{
+}
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetFontSize( const TFloatFixPt aFontSize )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetFontSize( const TFloatFixPt /* aFontSize */)
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetFontWeight( const TInt32 aFontWeight )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetFontWeight( const TInt32 /* aFontWeight */)
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetFontStyle( const TInt32 aFontStyle )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetFontStyle( const TInt32 /*aFontStyle*/ )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetFontFamily( CDesCArrayFlat* aFamilies )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetFontFamily( CDesCArrayFlat* /*aFamilies*/ )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetTextanchor( const TInt32 aTextAnchor )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetTextanchor( const TInt32 /*aTextAnchor*/ )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetTextDecoration( const TInt32 aTextDecoration )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetTextDecoration( const TInt32 /*aTextDecoration*/ )
+ {
+ }
+
+
+// Text Drawing
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::DrawStringL( const TDesC& aDesc,
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::DrawStringL( const TDesC& /*aDesc*/,
+ TFloatFixPt /*aX*/,
+ TFloatFixPt /*aY*/,
+ TInt8 /* aTextAnchor */,
+ TInt8 /* aTextDecoration */,
+ CDesCArrayFlat* /* aFamilies */,
+ TReal /*aWordSpacing*/,
+ TReal /*aLetterSpacing*/,
+ CArrayFix<TReal32>* /*aArrayRotate*/,
+ CArrayFix<TFloatFixPt>* /*aArrayX*/,
+ CArrayFix<TFloatFixPt>* /*aArrayY*/,
+ TSize& /*aBboxSizeResult*/,
+ CFont*& /*aFont*/,
+ TFontSpec& /*aFontSpec*/ )
+ {
+ }
+
+
+
+// Raster image drawing
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::DrawImage( CFbsBitmap* aImage,
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::DrawImage( CFbsBitmap* /*aImage*/,
+ const TGfxRectangle2D& /*aImageRect*/,
+ TBool /*aHasAlpha*/ )
+ {
+ }
+
+
+// ==========================================================================
+// Clear the whole graphics context with the background color
+// ==========================================================================
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::Clear(TUint32 aRGBA8888Color)
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::Clear(TUint32 /*aRGBA8888Color*/)
+ {
+ }
+
+// ==========================================================================
+// This method copies the internal RGBA8888 framebuffer to CfbsBitmap that
+// is specified in constructor. The CfbsBitmap could be 4k color (RGB0444),
+// 64k color (RGB565), or 16M color (RGB888).
+// ==========================================================================
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::UpdateFramebufferL()
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::UpdateFramebufferL( CFbsBitmap* /*aBitmap*/, CFbsBitmap* /*aMask*/ )
+ {
+ }
+
+void CGfx2dGcVGR::UpdateFramebufferL( CFbsBitmap* /*aBitmap*/, CFbsBitmap* /*aMask*/,TSize /*BitmapSize*/,TDisplayMode /*aBitmapDspMode*/,TDisplayMode /*aMaskDspMode*/ )
+
+ {
+
+
+
+ }
+// ====================================================================================
+// Blend bitmap with background according to group opacity
+// This function gets called with the opacity framebuffer and the group opacity value
+// The opacity buffer is initialized with the 0xAA55AA55 value. The pixels not matching
+// ====================================================================================
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::BlendWithBackground(TUint32* aFrameBuffer, TReal32 aOpacity)
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::BlendWithBackground(TUint32* /*aColorBuffer*/, TReal32 /*aOpacity*/)
+{
+}
+
+// ====================================================================================
+// return iBuffer
+// ==========================================================================
+// Generate 8 bit gray or 1bit B/W mask from internal ARGB8888 frame buffer.
+// ==========================================================================
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::GenerateMask(CFbsBitmap* aMask)
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::GenerateMask(CFbsBitmap* /*aMask*/)
+ {
+ }
+
+// ==========================================================================
+// This function calls the low level function to set fill opacity value
+// ==========================================================================
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetFillOpacity(TFixPt aFillOpacity)
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetFillOpacity(TFloatFixPt /*aFillOpacity*/)
+ {
+ }
+// ==========================================================================
+// This function calls the low level function to set stroke opacity value
+// ==========================================================================
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetStrokeOpacity(TFixPt aStrokeOpacity)
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetStrokeOpacity(TFloatFixPt /*aStrokeOpacity*/)
+ {
+ }
+// ==========================================================================
+// This function is called to set the dithering flag
+// ==========================================================================
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::SetDoDithering( TBool aDoDithering )
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::SetDoDithering( TBool /*aDoDithering*/ )
+ {
+ }
+
+TUint32* CGfx2dGcVGR::ColorBuffer()
+{
+ return NULL;
+}
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::ColorConvertTo64K
+// ---------------------------------------------------------------------------
+void CGfx2dGcVGR::ColorConvertTo64K( TUint32* /*aDestAddress*/, const TSize& /*aSize*/ )
+ {
+}
+
+void CGfx2dGcVGR::UpdateColorBuffer()
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGc/Gfx2dGcOpenVG.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,2989 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "Gfx2dGcOpenVG.h"
+//#include "Gfx2dDevice.h"
+#include "GfxLine2D.h"
+#include "GfxStroke.h"
+#include "GfxGeneralPath.h"
+#include "GfxFlatteningPathIterator.h"
+#include "GfxColor.h"
+#include "GfxImageTransformer.h"
+//#include "hal.h"
+//#include "hal_data.h"
+
+#include "gdi.h"
+#include "biditext.h"
+
+#include "GfxFloatFixPt.h"
+#include "GfxShape.h"
+#include "GfxEllipse2D.h"
+#include "GfxRoundRectangle2D.h"
+//#include "svgBackendStd.h"
+//#include "gulutil.h"
+#include <AknFontAccess.h>
+//#include <AknUtils.h>
+//#include <featmgr.h>
+#include<e32cmn.h>
+#include<e32uid.h>//NGA
+#include <e32math.h>
+// OpenVG Includes
+#include <VG/vgu.h>
+#include <vg/vgcontext.h>
+// OpenVG API Binding Symbian specific
+#include <vg/vgcontext_symbian.h>
+
+// For allocating path segment type array
+// Found 130 to be max size at bootup
+const TInt KPathSegmentTypeInitialSize = 130;
+const TInt KPathSegmentTypeMaxSize = 1000;
+
+const TInt KRenderQualityLow = 1;
+const TInt KRenderQualityHigh = 2;
+_LIT( KDefaultFont, "serif" ); // Similar changes should be applied to \
+ //SvgTextElementImpl.cpp file
+
+// --------------------------------------------------------------------------
+// CGfx2dGcOpenVG::CGfx2dGcOpenVG() : iScale( 1 ),
+// ---------------------------------------------------------------------------
+CGfx2dGcOpenVG::CGfx2dGcOpenVG( TBool /* aIsMainContext */ ) :
+ iFillOpacity( 1 ),
+ iScale( 1 ),
+ iStrokeColor( 0 ),
+ iStrokeOpacity( 1 ),
+ iBackgroundColor( 0xffffff ),
+ iFontSize( 10 ),
+ iFontWeight( -1 ),
+ iFontStyle( -1 ),
+ iFamilies( NULL ),
+ iTextAnchor( EGfxTextAnchorNone ),
+ iTextDecoration( EGfxTextDecorationNone ),
+ iGraphicsContextCreated( EFalse ),
+ iRenderQuality(VG_RENDERING_QUALITY_BETTER),
+ iCurrentRendererType(ESVGRendererSW)
+
+ {
+ }
+//
+// ==========================================================================
+// Create a new instance.
+// ==========================================================================
+// --------------------------------------------------------------------------
+// CGfx2dGcOpenVG* CGfx2dGcOpenVG::NewL( CFbsBitmap* aFrameBuffer, TFontSpec& aFontSpec )
+// ---------------------------------------------------------------------------
+ CGfx2dGcOpenVG* CGfx2dGcOpenVG::NewL( const TSize aBufferSize, TFontSpec& aFontSpec, CSvgBitmapFontProvider* aSvgBitmapFontProvider, TBool aIsMainContext )
+ {
+ CGfx2dGcOpenVG* self = new( ELeave ) CGfx2dGcOpenVG( aIsMainContext );
+ CleanupStack::PushL( self );
+ self->ConstructL( aBufferSize, aFontSpec, aSvgBitmapFontProvider);
+ CleanupStack::Pop();
+ return self;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::ConstructL( CFbsBitmap* aFrameBuffer, TFontSpec& aFontSpec )
+// ---------------------------------------------------------------------------
+void CGfx2dGcOpenVG::ConstructL( const TSize aBufferSize, TFontSpec& aFontSpec, CSvgBitmapFontProvider* aSvgBitmapFontProvider )
+ {
+ /* iApacAvailable = EFalse;
+ FeatureManager::InitializeLibL();
+ iApacAvailable = ( AknLayoutUtils::Variant() == EApacVariant );
+ FeatureManager::UnInitializeLib();*/
+
+
+ iFontSpec = aFontSpec;
+
+ if (iFontSpec.iTypeface.iName.Length() == 0)
+ {
+ //just for a safety check in case client didnt put it in
+ iFontSpec = TFontSpec(KDefaultFont, 100);
+ }
+
+
+ iSvgBitmapFontProvider = aSvgBitmapFontProvider ;
+
+ // Allocate path segment type array
+ iPathSegmentTypeCount = KPathSegmentTypeInitialSize;
+ iPathSegmentTypes = new (ELeave) VGubyte[KPathSegmentTypeInitialSize];
+
+ iDashArray = new ( ELeave ) CArrayFixFlat<VGfloat>( 32 );
+
+ iVgRenderer = CVGRenderer::NewL(ESVGRendererSW, 0);
+ iVgSurface = iVgRenderer->GetCurrentSurface();
+ ChangeBufferSizeL( aBufferSize );
+ }
+//NGA
+// --------------------------------------------------------------------------
+// CGfx2dGcOpenVG* CGfx2dGcOpenVG::NewL( CFbsBitmap* aFrameBuffer, TFontSpec& aFontSpec )
+// ---------------------------------------------------------------------------
+ CGfx2dGcOpenVG* CGfx2dGcOpenVG::NewL( const TSize aBufferSize, TFontSpec& aFontSpec, CSvgBitmapFontProvider* aSvgBitmapFontProvider,SVGRendererId aRendererType,TBool aIsMainContext )
+ {
+ CGfx2dGcOpenVG* self = new( ELeave ) CGfx2dGcOpenVG( aIsMainContext );
+ CleanupStack::PushL( self );
+ self->ConstructL( aBufferSize, aFontSpec, aSvgBitmapFontProvider,aRendererType);
+ CleanupStack::Pop();
+ return self;
+ }
+//NGA
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::ConstructL( CFbsBitmap* aFrameBuffer, TFontSpec& aFontSpec )
+// ---------------------------------------------------------------------------
+void CGfx2dGcOpenVG::ConstructL( const TSize aBufferSize, TFontSpec& aFontSpec, CSvgBitmapFontProvider* aSvgBitmapFontProvider,SVGRendererId aRendererType )
+ {
+
+ iFontSpec = aFontSpec;
+
+ if (iFontSpec.iTypeface.iName.Length() == 0)
+ {
+ //just for a safety check in case client didnt put it in
+ iFontSpec = TFontSpec(KDefaultFont, 100);
+ }
+ iSvgBitmapFontProvider = aSvgBitmapFontProvider ;
+
+ // Allocate path segment type array
+ iPathSegmentTypeCount = KPathSegmentTypeInitialSize;
+ iPathSegmentTypes = new (ELeave) VGubyte[KPathSegmentTypeInitialSize];
+
+ iDashArray = new ( ELeave ) CArrayFixFlat<VGfloat>( 32 );
+ iCurrentRendererType = aRendererType;
+ iVgRenderer = CVGRenderer::NewL(aRendererType, 0);
+ iVgSurface = iVgRenderer->GetCurrentSurface();
+
+ iVgSurface->InitializeSurface( aBufferSize, VGI_COLORSPACE_SRGB );
+ iVgSurface->CreateSurface(EColor16MA, 0, 0);
+
+ ChangeBufferSizeL( aBufferSize );
+
+ }
+// ==========================================================================
+// Destructor.
+// ==========================================================================
+// --------------------------------------------------------------------------
+// CGfx2dGcOpenVG::~CGfx2dGcOpenVG()
+// ---------------------------------------------------------------------------
+ CGfx2dGcOpenVG::~CGfx2dGcOpenVG()
+ {
+ if ( iDashArray )
+ {
+ delete iDashArray;
+ iDashArray = NULL;
+ }
+
+ // This is no longer needed, the Font is owned by TextElement
+ // now as each text element may have its own specific font
+ // and keeping one copy at Gc level will not work.
+ // Gc is just refering to the Font from Textelement, so
+ // now need to free it here.
+ //
+ //if (iFont && iWsScreenDevice)
+ // {
+ // iWsScreenDevice->ReleaseFont(iFont);
+ // iFont = NULL;
+ // }
+
+
+ DestroyContext();
+
+ iGroupOpacityImages.Close();
+
+ TInt bufferCount = iGroupOpacityBuffers.Count();
+ for ( TInt i = 0; i < bufferCount; i++ )
+ {
+ delete [] iGroupOpacityBuffers[i];
+ }
+ iGroupOpacityBuffers.Close();
+
+ if ( iPathSegmentTypes )
+ {
+ delete [] iPathSegmentTypes;
+ }
+ delete iVgRenderer;
+
+ }
+
+// private method
+void CGfx2dGcOpenVG::DestroyContext()
+ {
+ if ( iGraphicsContextCreated )
+ {
+ // Destroy OpenVG context
+ iVgSurface->TerminateSurface();
+ ResetContextHandle();
+ iFillOpacity = 1;
+ iScale = 1;
+ iStrokeOpacity = 1;
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetFrameBufferL( CFbsBitmap* aFrameBuffer )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::ChangeBufferSizeL( const TSize aBufferSize )
+ {
+ if ( aBufferSize.iWidth <= 0 || aBufferSize.iHeight <= 0 || aBufferSize == iColorBufferSize )
+ {
+ return;
+ }
+
+ iColorBufferSize = aBufferSize;
+
+ // First time: creating OpenVG context
+ if( !iGraphicsContextCreated )
+ {
+ // Create OpenVG context
+ TInt err = iVgSurface->InitializeSurface( iColorBufferSize, VGI_COLORSPACE_SRGB );
+ if (!((err == KErrNone) || (err == KErrAlreadyExists)))
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("SVG can't initialize OpenVG Context %d", err);
+ #endif //_DEBUG
+ iGraphicsContextCreated = EFalse;
+ User::Leave(err);
+ }
+ iGraphicsContextCreated = ETrue;
+ // By default the Rendering quality is VG_RENDERING_QUALITY_BETTER
+ iVgRenderer->vgSeti( VG_RENDERING_QUALITY, iRenderQuality );
+ }
+ // Only need to update context with color-buffer info
+ // when frame buffer size changes
+ else
+ {
+ TInt err = iVgSurface->ResizeSurface( iColorBufferSize );
+
+ if( err != KErrNone )
+ {
+ if(err == KErrNoMemory )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("OpenVG Context destroyed %d", err);
+ #endif //_DEBUG
+ // This indicates that OpenVG has destroyed the current context handle
+ // and also the Path, StrokePaint and FillPaint handles are no more valid.
+ // Thus reinitialize them to 0, so that they can be recreated.
+ ResetContextHandle();
+ }
+
+ #ifdef _DEBUG
+ RDebug::Printf("SVG can't RESIZE OpenVG Context %d", err);
+ #endif //_DEBUG
+ User::Leave(err);
+ }
+ }
+
+ iRenderInfo.SetDevice( 0, /*this parameter will be ignored */
+ iColorBufferSize.iWidth,
+ iColorBufferSize.iHeight,
+ 0 /*this parameter will be ignored */);
+ }
+
+// --------------------------------------------------------------------------
+// TInt CGfx2dGcOpenVG::OpenVGErrorToSymbianError( int aError )
+// ---------------------------------------------------------------------------
+TInt CGfx2dGcOpenVG::OpenVGErrorToSymbianError( TInt aError )
+{
+ TInt error = KErrNone;
+ switch( aError )
+ {
+ case VGI_OK:
+ {
+ error = KErrNone;
+ break;
+ }
+
+ case VGU_OUT_OF_MEMORY_ERROR:
+ case VG_OUT_OF_MEMORY_ERROR:
+ case VGI_ERROR_OUT_OF_MEMORY:
+ {
+ error = KErrNoMemory;
+ break;
+ }
+
+ case VG_ILLEGAL_ARGUMENT_ERROR:
+ case VGI_ERROR_INVALID_ARGUMENTS:
+ case VGU_ILLEGAL_ARGUMENT_ERROR:
+ {
+ error = KErrArgument;
+ break;
+ }
+
+ case VGI_ERROR_ALREADY_EXISTS:
+ {
+ error = KErrAlreadyExists;
+ break;
+ }
+
+ case VG_UNSUPPORTED_PATH_FORMAT_ERROR:
+ case VGI_ERROR_COLORSPACE_NOT_SUPPORTED:
+ case VG_UNSUPPORTED_IMAGE_FORMAT_ERROR:
+ case VGI_ERROR_NOT_SUPPORTED:
+ {
+ error = KErrNotSupported;
+ break;
+ }
+
+ case VGI_ERROR_ILLEGAL_IMAGE_HANDLE:
+ {
+ error = KErrBadHandle;
+ break;
+ }
+
+ case VG_IMAGE_IN_USE_ERROR:
+ case VGI_ERROR_IMAGE_IN_USE:
+ {
+ error = KErrInUse;
+ break;
+ }
+
+ case VGI_ERROR_ILLEGAL_OPERATION:
+ {
+ error = KErrPermissionDenied;
+ break;
+ }
+
+ case VG_BAD_HANDLE_ERROR:
+ case VG_PATH_CAPABILITY_ERROR:
+ case VGU_PATH_CAPABILITY_ERROR:
+ case VGU_BAD_WARP_ERROR:
+ case VGU_BAD_HANDLE_ERROR:
+ {
+ error = KErrUnknown;
+ break;
+ }
+
+ default:
+ {
+ error = KErrUnknown;
+ }
+ }
+
+ return error;
+}
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::DoDrawL( MGfxShape* aShape )
+// ---------------------------------------------------------------------------
+void CGfx2dGcOpenVG::DoDrawL( MGfxShape* aShape )
+ {
+ VGbitfield drawMode = 0x0;
+ VGUErrorCode vguret;
+
+ // Do not render if both stroke and fill are none
+ if ( iStrokeColor.GetARGB() == KGfxColorNull && iFillColor == NULL )
+ return;
+
+ iVgRenderer->vgSeti( VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE );
+
+ if ( !iPath )
+ {
+ const float KScale = 1.0f / 65536.0f;
+ iPath = iVgRenderer->vgCreatePath( VG_PATH_FORMAT_STANDARD,
+ VG_PATH_DATATYPE_S_32, KScale, 0.0f, 0, 0,
+ VG_PATH_CAPABILITY_APPEND_TO );
+ if ( iPath == VG_INVALID_HANDLE )
+ {
+ VGErrorCode error = (VGErrorCode)iVgRenderer->vgGetError();
+ if (error == VG_OUT_OF_MEMORY_ERROR)
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("OOM: vgCreatePath");
+ #endif
+ User::Leave(KErrNoMemory);
+ }
+ // handle other errors...
+ #ifdef _DEBUG
+ RDebug::Printf("SVG GFX2D Error: vgCreatePath");
+ #endif
+ }
+ }
+
+ if (iFillColor)
+ {
+ if(!iFillPaint)
+ {
+ iFillPaint = iVgRenderer->vgCreatePaint();
+ if ( iFillPaint == VG_INVALID_HANDLE )
+ {
+ VGErrorCode error = (VGErrorCode)iVgRenderer->vgGetError();
+ if (error == VG_OUT_OF_MEMORY_ERROR)
+ {
+ RDebug::Printf("SVG GFX2D Error OOMs: vgCreatePaint");
+ User::Leave(KErrNoMemory);
+ }
+ // handle other errors...
+ #ifdef _DEBUG
+ RDebug::Printf("SVG GFX2D Error: vgCreatePaint");
+ #endif
+ }
+ }
+ }
+
+ if(iStrokeColor.GetARGB() != KGfxColorNull)
+ {
+ if(!iStrokePaint)
+ {
+ iStrokePaint = iVgRenderer->vgCreatePaint();
+ if ( iStrokePaint == VG_INVALID_HANDLE )
+ {
+ VGErrorCode error = (VGErrorCode)iVgRenderer->vgGetError();
+ if (error == VG_OUT_OF_MEMORY_ERROR)
+ {
+ RDebug::Printf("SVGT CGfx2dGcOpenVG::DoDrawL vgCreatePaint OOM");
+ User::Leave(KErrNoMemory);
+ }
+ #ifdef _DEBUG
+ RDebug::Printf("SVGT CGfx2dGcOpenVG::DoDrawL vgCreatePaint failed %d", error);
+ #endif
+ }
+ }
+ }
+
+ TGfxRectangle2D bbRect;
+ TGfxAffineTransform identityMat;
+
+ //vgClear( 0, 0, VG_MAXINT, VG_MAXINT );
+ switch(aShape->ShapeType())
+ {
+ case MGfxShape::ERect:
+ {
+ TGfxRectangle2D* rect = (TGfxRectangle2D*)aShape;
+
+ rect->GetBounds( identityMat, bbRect );
+ drawMode = SetFillStroke(iFillPaint, iStrokePaint, bbRect);
+
+ vguret = (VGUErrorCode)iVgRenderer->vguRect(
+ iPath,
+ (VGfloat)rect->iX,
+ (VGfloat)rect->iY,
+ (VGfloat)rect->iWidth,
+ (VGfloat)rect->iHeight );
+
+ if( vguret != KErrNone )
+ {
+ User::LeaveIfError(OpenVGErrorToSymbianError(vguret));
+ }
+ iVgRenderer->vgDrawPath( iPath, drawMode );
+ }
+ break;
+
+ case MGfxShape::ERoundRect:
+ {
+ float rx, ry;
+ TGfxRoundRectangle2D* rect = (TGfxRoundRectangle2D*)aShape;
+
+ TFloatFixPt tWidth = rect->iArcWidth;
+ TFloatFixPt tHeight = rect->iArcHeight;
+
+ tWidth.iValue <<= 1;
+ tHeight.iValue <<= 1;
+
+ rx = (VGfloat)tWidth;
+ ry = (VGfloat)tHeight;
+
+ //If a properly specified value is provided for ry but not for rx,
+ // then the user agent must process the 'rect' element with the
+ // effective value for rx as equal to ry. However clamp to 0.
+ if ( rx <= 0 )
+ {
+ rx = ry;
+ }
+ if ( ry <= 0)
+ {
+ ry = rx;
+ }
+
+ if(rx < 0)
+ {
+ rx = 0;
+ }
+ if(ry < 0)
+ {
+ ry = 0;
+ }
+
+ rect->GetBounds( identityMat, bbRect );
+ drawMode = SetFillStroke(iFillPaint, iStrokePaint, bbRect);
+
+ // Rounded rectangle
+ if ( rx == 0.0f && ry == 0.0f )
+ {
+ vguret = (VGUErrorCode)iVgRenderer->vguRect(iPath,
+ (VGfloat)rect->iX, (VGfloat)rect->iY,
+ (VGfloat)rect->iWidth, (VGfloat)rect->iHeight );
+ }
+ else
+ {
+ vguret = (VGUErrorCode)iVgRenderer->vguRoundRect( iPath,
+ (VGfloat)rect->iX, (VGfloat)rect->iY,
+ (VGfloat)rect->iWidth, (VGfloat)rect->iHeight,
+ rx, ry );
+ }
+ if( vguret != KErrNone )
+ {
+ User::LeaveIfError(OpenVGErrorToSymbianError(vguret));
+ }
+ iVgRenderer->vgDrawPath( iPath, drawMode );
+ }
+ break;
+
+ case MGfxShape::EEllipse:
+ {
+ TGfxEllipse2D* ellipse = (TGfxEllipse2D*)aShape;
+ #ifdef SVG_FLOAT_BUILD
+ TFloatFixPt rx = ellipse->iWidth * TFloatFixPt(.5f);
+ TFloatFixPt ry = ellipse->iHeight * TFloatFixPt(.5f);
+ #else
+ TFloatFixPt rx = ellipse->iWidth >> 1; // rx = width / 2
+ TFloatFixPt ry = ellipse->iHeight >> 1; // ry = height / 2
+ #endif
+ ellipse->GetBounds( identityMat, bbRect );
+ drawMode = SetFillStroke(iFillPaint, iStrokePaint, bbRect);
+
+ // Element
+ vguret = (VGUErrorCode)iVgRenderer->vguEllipse(iPath,
+ (VGfloat)(ellipse->iX + rx),
+ (VGfloat)(ellipse->iY + ry),
+ (VGfloat)ellipse->iWidth,
+ (VGfloat)ellipse->iHeight);
+ if( vguret != KErrNone )
+ {
+ User::LeaveIfError(OpenVGErrorToSymbianError(vguret));
+ }
+ iVgRenderer->vgDrawPath(iPath,drawMode);
+ }
+ break;
+
+
+ case MGfxShape::EPath:
+ {
+ CGfxGeneralPath* gPath = (CGfxGeneralPath*)aShape;
+ RArray<TFloatFixPt>* coordArray = gPath->PointCoordsArrayAll();
+ if (coordArray->Count() > 0)
+ {
+ TFloatFixPt* coord = gPath->PointCoordsArray();
+ TUint8 count = gPath->Count();
+ RArray<TUint32>* type = gPath->PointTypeArray();
+ TInt typeCount = type->Count();
+ if(count && ( typeCount == count))
+ {
+ iVgRenderer->vgAppendPathData(iPath, count,gPath->PathSegmentTypeArray(),coord);
+ }
+ else
+ {
+ //RArray<TUint32>* type = gPath->PointTypeArray();
+ //TInt typeCount = type->Count();
+ // this is a multi path
+ // Using non-ELeave version and checking for NULL to avoid (ELeave) and TRAP
+ if ( iPathSegmentTypeCount < typeCount )
+ {
+ if ( iPathSegmentTypes )
+ {
+ delete [] iPathSegmentTypes;
+ iPathSegmentTypes = NULL;
+ }
+ iPathSegmentTypes = new VGubyte[typeCount];
+ iPathSegmentTypeCount = typeCount;
+ }
+ if ( !iPathSegmentTypes )
+ {
+ break;
+ }
+ for (TInt i=0; i < typeCount; i++)
+ {
+ iPathSegmentTypes[i] = (TGfxSegType) (*type)[i];
+ }
+ iVgRenderer->vgAppendPathData(iPath, typeCount, iPathSegmentTypes, coord);
+ }
+ gPath->GetBounds( identityMat, bbRect );
+ drawMode = SetFillStroke(iFillPaint, iStrokePaint, bbRect);
+ iVgRenderer->vgDrawPath(iPath,drawMode);
+ }
+ }
+ break;
+
+ case MGfxShape::ELine:
+ {
+ TGfxLine2D* line = (TGfxLine2D*)aShape;
+
+ // Force Stroke color... if not present
+ if(iFillColor && iStrokeColor.GetARGB() == KGfxColorNull)
+ {
+ iStrokeColor = iFillColor->GetColor();
+ }
+
+ line->GetBounds( identityMat, bbRect );
+ drawMode = SetFillStroke(iFillPaint, iStrokePaint, bbRect);
+
+ vguret = (VGUErrorCode)iVgRenderer->vguLine(
+ iPath,
+ (VGfloat)line->iX1,
+ (VGfloat)line->iY1,
+ (VGfloat)line->iX2,
+ (VGfloat)line->iY2);
+
+ if( vguret != KErrNone )
+ {
+ User::LeaveIfError(OpenVGErrorToSymbianError(vguret));
+ }
+
+ iVgRenderer->vgDrawPath(iPath,drawMode);
+ }
+ break;
+ }
+ iVgRenderer->vgClearPath( iPath, VG_PATH_CAPABILITY_APPEND_TO );
+
+ // Delete path segment type array to avoid large memory to persist,
+ // created by some content, but the larget size is not needed later.
+ if ( iPathSegmentTypeCount > KPathSegmentTypeMaxSize )
+ {
+ if ( iPathSegmentTypes )
+ {
+ delete [] iPathSegmentTypes;
+ iPathSegmentTypes = NULL;
+ iPathSegmentTypeCount = 0;
+ }
+ }
+
+ // Turn off any settings that are not needed by default
+ PostDraw();
+ }
+
+void CGfx2dGcOpenVG::PostDraw()
+{
+ if ( iDashArray && iDashArray->Count() > 0 )
+ {
+ iVgRenderer->vgSetfv(VG_STROKE_DASH_PATTERN, 0, NULL);
+ iDashArray->Reset();
+ }
+}
+
+// --------------------------------------------------------------------------
+// VGbitfield CGfx2dGcOpenVG::SetFillStroke(VGPaint aFillPaint, VGPaint aStrokePaint, TGfxRectangle2D& bBox)
+// ---------------------------------------------------------------------------
+VGbitfield CGfx2dGcOpenVG::SetFillStroke(VGPaint aFillPaint, VGPaint aStrokePaint, TGfxRectangle2D& bBox)
+{
+ VGbitfield returnVal = 0x0;
+
+ // Fill Color
+ if (iFillColor)
+ {
+ if( aFillPaint != VG_INVALID_HANDLE )
+ {
+ iFillColor->SetFill(aFillPaint, bBox, iFillOpacity, iVgRenderer);
+ returnVal |= VG_FILL_PATH;
+ }
+ }
+
+ //
+ // Color Correction for Symbian->OpenVG
+ // Symbian argb
+ // OpenVg rgba
+ //
+ // Stroke
+ //
+ if( iStrokeColor.GetARGB() != KGfxColorNull && iStrokeColor.GetARGB() != 0x1ffffff )
+ {
+ iVgRenderer->vgSetf( VG_STROKE_LINE_WIDTH, (VGfloat)iStroke.StrokeWidth() );
+
+ //SET LINECAP INFORMATION
+ SVGLineCap lineCap = (SVGLineCap)iStroke.StrokeCap();
+
+ if (lineCap == SVG_CAP_ROUND)
+ {
+ iVgRenderer->vgSeti( VG_STROKE_CAP_STYLE, VG_CAP_ROUND);
+ }
+ else if ( lineCap == SVG_CAP_SQUARE )
+ {
+ iVgRenderer->vgSeti( VG_STROKE_CAP_STYLE, VG_CAP_SQUARE);
+ }
+ else
+ {
+ iVgRenderer->vgSeti( VG_STROKE_CAP_STYLE, VG_CAP_BUTT);
+ }
+
+ //SET LINEJOIN INFORMATION
+ SVGLineJoin linejoin = (SVGLineJoin)iStroke.StrokeJoin();
+ if (linejoin == SVG_JOIN_ROUND)
+ {
+ iVgRenderer->vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_ROUND);
+ }
+ else if (linejoin == SVG_JOIN_BEVEL)
+ {
+ iVgRenderer->vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_BEVEL);
+ }
+ else
+ {
+ iVgRenderer->vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_MITER);
+ }
+
+ iVgRenderer->vgSetf( VG_STROKE_MITER_LIMIT, (VGfloat)iStroke.StrokeMiterLimit() );
+ if(aStrokePaint != VG_INVALID_HANDLE)
+ {
+ iVgRenderer->vgSetParameteri( aStrokePaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR );
+ TUint32 opacity = (TInt)(iStrokeOpacity * TFloatFixPt(255.0f));
+ iVgRenderer->vgSetColor( aStrokePaint, iStrokeColor.GetARGB() << 8 | opacity );
+ iVgRenderer->vgSetPaint( aStrokePaint, VG_STROKE_PATH );
+ returnVal |= VG_STROKE_PATH;
+ }
+ }
+
+ return returnVal;
+}
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetWindingRule( TGfxWindingRule aRule )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetWindingRule( TGfxWindingRule aRule )
+ {
+ if ( aRule == EGfxWindEvenOdd )
+ {
+ iVgRenderer->vgSeti(VG_FILL_RULE, VG_EVEN_ODD);
+ }
+ else
+ {
+ iVgRenderer->vgSeti(VG_FILL_RULE, VG_NON_ZERO);
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::Draw( MGfxShape* aShape )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::DrawL( MGfxShape* aShape )
+ {
+ DoDrawL( aShape );
+ }
+
+
+
+// --------------------------------------------------------------------------
+// TGfxColor CGfx2dGcOpenVG::ForegroundColor()
+// ---------------------------------------------------------------------------
+ TGfxColor CGfx2dGcOpenVG::ForegroundColor()
+ {
+ return iStrokeColor;
+ }
+
+
+// --------------------------------------------------------------------------
+// MGfxPaint* CGfx2dGcOpenVG::Paint()
+// ---------------------------------------------------------------------------
+ MGfxPaint* CGfx2dGcOpenVG::Paint()
+ {
+ return iFillColor;
+ }
+
+// --------------------------------------------------------------------------
+// TGfxRenderingHints* CGfx2dGcOpenVG::RenderingHints()
+// ---------------------------------------------------------------------------
+ TGfxRenderingHints* CGfx2dGcOpenVG::RenderingHints()
+ {
+ //return &iRenderingHints;
+ return NULL;
+ }
+
+// --------------------------------------------------------------------------
+// TGfxStroke CGfx2dGcOpenVG::Stroke()
+// ---------------------------------------------------------------------------
+ TGfxStroke CGfx2dGcOpenVG::Stroke()
+ {
+ return iStroke;
+ }
+
+
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetDashOffset( TFloatFixPt aDashOffset )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetDashOffset( TFloatFixPt aDashOffset )
+{
+ iDashOffset = aDashOffset;
+ iVgRenderer->vgSetf(VG_STROKE_DASH_PHASE, (VGfloat)iDashOffset);
+// svgSetStrokeDashOffset(iHyb2dContext, svgScalarFromFloat(iDashOffset));
+}
+
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetForegroundColor( const TGfxColor& aColor )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetForegroundColor( const TGfxColor& aColor )
+ {
+ // Both GDI and Gfx2D need to keep color value...
+ iStrokeColor = aColor;
+ }
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetStrokeWidth( const TGfxStroke& aColor )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetStrokeWidth( const TFloatFixPt& aWidth )
+ {
+ // Both GDI and Gfx2D need to keep stroke-width value...
+ iStroke.SetStrokeWidth(aWidth);
+
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetBackgroundColor( const TGfxColor& aColor )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetBackgroundColor( const TGfxColor& aColor )
+ {
+ // Only Gfx2D need to keep background color value.
+ iBackgroundColor = aColor;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetPaint( MGfxPaint* aPaint )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetPaint( MGfxPaint* aPaint )
+ {
+ iFillColor = aPaint;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetStroke( TGfxStroke aStroke )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetStroke( TGfxStroke aStroke )
+ {
+ iStroke = aStroke;
+ iVgRenderer->vgSetf( VG_STROKE_LINE_WIDTH, (VGfloat)iStroke.StrokeWidth() );
+
+ //SET LINECAP INFORMATION
+ SVGLineCap lineCap = (SVGLineCap)iStroke.StrokeCap();
+
+ if (lineCap == SVG_CAP_ROUND)
+ {
+ iVgRenderer->vgSeti( VG_STROKE_CAP_STYLE, VG_CAP_ROUND);
+ }
+ else if ( lineCap == SVG_CAP_SQUARE )
+ {
+ iVgRenderer->vgSeti( VG_STROKE_CAP_STYLE, VG_CAP_SQUARE);
+ }
+ else
+ {
+ iVgRenderer->vgSeti( VG_STROKE_CAP_STYLE, VG_CAP_BUTT);
+ }
+
+ //SET LINEJOIN INFORMATION
+ SVGLineJoin linejoin = (SVGLineJoin)iStroke.StrokeJoin();
+ if (linejoin == SVG_JOIN_ROUND)
+ {
+ iVgRenderer->vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_ROUND);
+ }
+ else if (linejoin == SVG_JOIN_BEVEL)
+ {
+ iVgRenderer->vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_BEVEL);
+ }
+ else
+ {
+ iVgRenderer->vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_MITER);
+ }
+
+ iVgRenderer->vgSetf( VG_STROKE_MITER_LIMIT, (VGfloat)iStroke.StrokeMiterLimit() );
+
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetRenderingHints( const TGfxRenderingHints& aRenderingHints )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetRenderingHints( const TGfxRenderingHints& /*aRenderingHints*/ )
+ {
+ //iRenderingHints = aRenderingHints;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetTransform( const TGfxAffineTransform& aTransform )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetTransform( const TGfxAffineTransform& aTransform )
+ {
+ iTransform = aTransform;
+
+ // Calculate scale
+ TGfxPoint2D ep( 1, 0 ), org( 2, 0 );
+ iTransform.Transform( &ep, & ep, 1 );
+ iTransform.Transform( &org, & org, 1 );
+ ep.iX -= org.iX;
+ ep.iY -= org.iY;
+ iScale = TFloatFixPt::Sqrt( ep.iX * ep.iX + ep.iY * ep.iY );
+
+ // activate Graphics 2D engine
+ // set viewport coordinate system to map from canvas coordinates to pixels
+ // in order to provide resolution independent results
+ // SVGMatrix2x3 vmat;
+ // svgMatrix2x3Set( &vmat,
+ // iTransform.iM00.iValue,
+ // iTransform.iM01.iValue,
+ // iTransform.iM02.iValue,
+ // iTransform.iM10.iValue,
+ // iTransform.iM11.iValue,
+ // iTransform.iM12.iValue
+ // );
+// svgSetViewportCoordinateSystem( iHyb2dContext, vmat.matrix );
+ ApplyTransform(iTransform);
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetClip( const TGfxRectangle2D& aClip )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetClip( const TGfxRectangle2D& aClip )
+ {
+ iClip = aClip;
+ TFloatFixPt newY = iColorBufferSize.iHeight - (TInt)aClip.iHeight - (TInt)aClip.iY;
+ VGint clipRect[4] =
+ {
+ (TInt)aClip.iX, (TInt)newY, (TInt)aClip.iWidth, (TInt)aClip.iHeight
+ };
+
+ // Set VG_SCISSORING to True
+ iVgRenderer->vgSeti(VG_SCISSORING, VG_TRUE);
+
+ // Set Clippling rectangle
+ iVgRenderer->vgSetiv(VG_SCISSOR_RECTS, 4,(const TInt*) clipRect);
+ }
+
+ void CGfx2dGcOpenVG::SetClipMediaElement( TSize aSize )
+ {
+ TFloatFixPt width = (TFloatFixPt)aSize.iWidth;
+ TFloatFixPt height = (TFloatFixPt)aSize.iHeight;
+ TFloatFixPt x = (TFloatFixPt)0;
+ TFloatFixPt y = (TFloatFixPt)0;
+ TGfxRectangle2D aClip(x,y,width,height);
+ iClipMain = iClip;
+ iClip = aClip;
+ // TFloatFixPt newY = aSize.iHeight - (TInt)aClip.iHeight - (TInt)aClip.iY;
+ VGint clipRect[4] =
+ {
+ (TInt)aClip.iX, (TInt)aClip.iY, (TInt)aClip.iWidth, (TInt)aClip.iHeight
+ };
+
+ // Set VG_SCISSORING to True
+ iVgRenderer->vgSeti(VG_SCISSORING, VG_TRUE);
+
+ // Set Clippling rectangle
+ iVgRenderer->vgSetiv(VG_SCISSOR_RECTS, 4, (const TInt*)clipRect);
+
+ }
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetDashArrayL( CArrayFix<TFloatFixPt>* aArray )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetDashArrayL( CArrayFix<TFloatFixPt>* aArray )
+ {
+ if ( !aArray || !iDashArray )
+ {
+ return;
+ }
+
+ TInt32 count = aArray->Count();
+
+ if ( count == 0 )
+ {
+ return;
+ }
+
+ if ( iDashArray->Count() > 0 )
+ {
+ iDashArray->Reset();
+ }
+
+ for ( TInt32 i = 0; i < count; i++ )
+ {
+ iDashArray->AppendL( (VGfloat)aArray->At( i ) );
+ }
+
+ if ( count & 0x00000001 )
+ {
+ //count was odd so we need to duplicate the current ones on the array
+ for (TInt32 i=0; i < count; i++)
+ {
+ iDashArray->AppendL( (VGfloat)aArray->At( i ) );
+ }
+ }
+
+ iVgRenderer->vgSetfv(VG_STROKE_DASH_PATTERN, iDashArray->Count(), (VGfloat*)&(*iDashArray)[0] );
+ }
+
+// --------------------------------------------------------------------------
+// TSize CGfx2dGcOpenVG::DeviceBounds()
+// ---------------------------------------------------------------------------
+ TSize CGfx2dGcOpenVG::DeviceBounds()
+ {
+ return iColorBufferSize;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetAntialiasingMode( const TInt32 /*aAntialiasingEnable*/)
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetAntialiasingMode( const TInt32 aAntialiasingMode )
+ {
+
+ // JSR226 has two values for Render Quality
+ //--------------------------------------------------------------------------------
+ // JSR226/M2G Values : TInt Value : OpenVG Constants
+ //--------------------------------------------------------------------------------
+ // RENDERING_QUALITY_LOW : = 1 = : VG_RENDERING_QUALITY_NONANTIALIASED
+ // RENDERING_QUALITY_HIGH : = 2 = : VG_RENDERING_QUALITY_BETTER
+ //--------------------------------------------------------------------------------.
+
+ if( aAntialiasingMode == KRenderQualityLow ) // RENDERING_QUALITY_LOW
+ {
+ iRenderQuality = VG_RENDERING_QUALITY_NONANTIALIASED ;
+ }
+ else if( aAntialiasingMode == KRenderQualityHigh ) // RENDERING_QUALITY_HIGH
+ {
+ iRenderQuality = VG_RENDERING_QUALITY_BETTER ;
+ }
+
+ iVgRenderer->vgSeti(VG_RENDERING_QUALITY, iRenderQuality );
+
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetFont( const CFont* aFont )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetFont( const CFont* aFont )
+ {
+ iFont = (CFont*)aFont;
+ }
+// --------------------------------------------------------------------------
+// CFont* CGfx2dGcOpenVG::Font()
+// ---------------------------------------------------------------------------
+ CFont* CGfx2dGcOpenVG::Font()
+ {
+ if (iFont == NULL)
+ {
+ iSvgBitmapFontProvider->GetNearestFontToDesignHeightInTwips( iFont, iFontSpec );
+
+ }
+ return iFont;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::GetSystemFontScaled(TFloatFixPt aHeight,
+// const TDesC& aTypefaceName,
+// CFont*& aFont,
+// TFontSpec& aFontSpec )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::GetFontScaled( TFloatFixPt /* aHeight */,
+ const TDesC& /* aTypefaceName */,
+ CFont*& /* aFont */,
+ TFontSpec& /* aFontSpec */ )
+{
+}
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetFontSize( const TFloatFixPt aFontSize )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetFontSize( const TFloatFixPt aFontSize )
+ {
+ iFontSize = aFontSize;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetFontWeight( const TInt32 aFontWeight )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetFontWeight( const TInt32 aFontWeight )
+ {
+ iFontWeight = aFontWeight;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetFontStyle( const TInt32 aFontStyle )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetFontStyle( const TInt32 aFontStyle )
+ {
+ iFontStyle = aFontStyle;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetFontFamily( CDesCArrayFlat* aFamilies )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetFontFamily( CDesCArrayFlat* aFamilies )
+ {
+ iFamilies = aFamilies;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetTextanchor( const TInt32 aTextAnchor )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetTextanchor( const TInt32 aTextAnchor )
+ {
+ iTextAnchor = (TGfxTextAnchor)aTextAnchor;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetTextDecoration( const TInt32 aTextDecoration )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetTextDecoration( const TInt32 aTextDecoration )
+ {
+ iTextDecoration = (TGfxTextDecoration)aTextDecoration;
+ }
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::GetBBoxForSystemText( TSvgFourPointRect& aFourPointBbox )
+// ---------------------------------------------------------------------------
+TGfxRectangle2D CGfx2dGcOpenVG::GetBBoxForSystemText( const TDesC& aText,
+ TFloatFixPt aX,
+ TFloatFixPt aY )
+{
+ //bbox for bitmap fonts
+ TGfxRectangle2D lBbox;
+ TGfxPoint2D pt(aX,aY);
+ //iScale = GetCurrentScale();
+
+ //scaled already for bitmap text...
+
+ TInt textAdvance = iFont->TextWidthInPixels( aText );
+ TInt fontMaxHeight = iFont->FontMaxHeight();
+ TFloatFixPt lascent = iFont->AscentInPixels();
+ TFloatFixPt ldescent = TFloatFixPt(fontMaxHeight) - (TFloatFixPt)iFont->AscentInPixels();
+
+
+ lBbox.iWidth = textAdvance;
+ lBbox.iHeight = fontMaxHeight;
+
+ //need to work in the rotation factor somehow...
+ //without doing the scaling again
+ //at this point the bbox already scaled,translated but not rotated
+
+ //should we create 1/scale factor or create with scale factor then get inverse
+ //iScale scaling factor from the graphics context
+ TReal32 linverseScale = 1.0/(TReal)iScale;
+ TGfxAffineTransform lInverseScaleMat = TGfxAffineTransform::GetScaleInstance(linverseScale, linverseScale);
+
+ //this is with scale and rotation
+ TGfxPoint2D transformedPoint( pt.iX, pt.iY );
+
+ const TGfxAffineTransform& ctm = iTransform;
+ ctm.Transform(&pt, &transformedPoint, 1);
+
+ //remove the double scaling effect that we would have
+ TGfxAffineTransform ctmWithoutScale = iTransform;
+ ctmWithoutScale.Concatenate(lInverseScaleMat);
+
+ TGfxPoint2D scaledPoint( pt.iX * iScale, pt.iY * iScale );
+
+ //set up the initial box with just scale in it and not rotation.
+ // The base line is position at x,y co-ordinate of the text, but
+ // the bottom of bound box would be further below by amount ldescent.
+ TGfxPoint2D lTopLeftCorner(scaledPoint.iX, scaledPoint.iY + ldescent );
+ TGfxPoint2D lTopRightCorner(scaledPoint.iX + lBbox.iWidth , scaledPoint.iY + ldescent );
+ TGfxPoint2D lBottomLeftCorner(scaledPoint.iX, scaledPoint.iY - lascent);
+ TGfxPoint2D lBottomRightCorner(scaledPoint.iX + lBbox.iWidth, scaledPoint.iY - lascent );
+
+ TGfxPoint2D lTransTopLeftCorner;
+ TGfxPoint2D lTransBottomLeftCorner;
+ TGfxPoint2D lTransTopRightCorner;
+ TGfxPoint2D lTransBottomRightCorner;
+
+ //applying current rotation transform without the scale.
+ ctmWithoutScale.Transform(&lTopLeftCorner, &lTransTopLeftCorner,1);
+ ctmWithoutScale.Transform(&lTopRightCorner, &lTransTopRightCorner,1);
+ ctmWithoutScale.Transform(&lBottomLeftCorner, &lTransBottomLeftCorner,1);
+ ctmWithoutScale.Transform(&lBottomRightCorner, &lTransBottomRightCorner,1);
+
+ TFloatFixPt lXTranslation = transformedPoint.iX - lTransTopLeftCorner.iX;
+ //TFixPt lXTranslation = transformedPoint.iX - iPoint.iX;
+
+ TFloatFixPt lYTranslation = transformedPoint.iY - lTransTopLeftCorner.iY;
+ //TFixPt lYTranslation = transformedPoint.iY - iPoint.iY;
+
+ // X position is affected by anchor
+ switch( iTextAnchor )
+ {
+ case EGfxTextAnchorMiddle:
+ lXTranslation = lXTranslation - ( lBbox.iWidth / TFloatFixPt( 2 ) );
+ break;
+ case EGfxTextAnchorEnd:
+ lXTranslation = lXTranslation - lBbox.iWidth;
+ break;
+ default:
+ //do nothing
+ break;
+ }
+
+ lTransTopLeftCorner.iX += lXTranslation;
+ lTransTopLeftCorner.iY += lYTranslation;
+
+ lTransTopRightCorner.iX += lXTranslation;
+ lTransTopRightCorner.iY += lYTranslation;
+
+ lTransBottomLeftCorner.iX += lXTranslation;
+ lTransBottomLeftCorner.iY += lYTranslation;
+
+ lTransBottomRightCorner.iX += lXTranslation;
+ lTransBottomRightCorner.iY += lYTranslation;
+
+ //at this point I have the exact path coordinates of the bbox
+ //aFourPointBbox.SetRectPoints(lTransTopLeftCorner, lTransTopRightCorner, lTransBottomLeftCorner, lTransBottomRightCorner);
+ return GetTRect(lTransTopLeftCorner, lTransTopRightCorner, lTransBottomLeftCorner, lTransBottomRightCorner);
+}
+
+
+TGfxRectangle2D CGfx2dGcOpenVG::GetTRect(TGfxPoint2D lTransTopLeftCorner,TGfxPoint2D lTransTopRightCorner,TGfxPoint2D lTransBottomLeftCorner,TGfxPoint2D lTransBottomRightCorner)
+{
+ TFloatFixPt lMaxX = lTransTopLeftCorner.iX;
+
+ if (lTransTopRightCorner.iX > lMaxX)
+ {
+ lMaxX = lTransTopRightCorner.iX;
+ }
+ if (lTransBottomLeftCorner.iX > lMaxX)
+ {
+ lMaxX = lTransBottomLeftCorner.iX;
+ }
+ if (lTransBottomRightCorner.iX > lMaxX)
+ {
+ lMaxX = lTransBottomRightCorner.iX;
+ }
+
+ TFloatFixPt lMaxY = lTransTopLeftCorner.iY;
+
+ if (lTransTopRightCorner.iY > lMaxY)
+ {
+ lMaxY = lTransTopRightCorner.iY;
+ }
+ if (lTransBottomLeftCorner.iY > lMaxY)
+ {
+ lMaxY = lTransBottomLeftCorner.iY;
+ }
+ if (lTransBottomRightCorner.iY > lMaxY)
+ {
+ lMaxY = lTransBottomRightCorner.iY;
+ }
+
+ TFloatFixPt lMinX = lTransTopLeftCorner.iX;
+
+ if (lTransTopRightCorner.iX < lMinX)
+ {
+ lMinX = lTransTopRightCorner.iX;
+ }
+ if (lTransBottomLeftCorner.iX < lMinX)
+ {
+ lMinX = lTransBottomLeftCorner.iX;
+ }
+ if (lTransBottomRightCorner.iX < lMinX)
+ {
+ lMinX = lTransBottomRightCorner.iX;
+ }
+
+ TFloatFixPt lMinY = lTransTopLeftCorner.iY;
+
+ if (lTransTopRightCorner.iY < lMinY)
+ {
+ lMinY = lTransTopRightCorner.iY;
+ }
+ if (lTransBottomLeftCorner.iY < lMinY)
+ {
+ lMinY = lTransBottomLeftCorner.iY;
+ }
+ if (lTransBottomRightCorner.iY < lMinY)
+ {
+ lMinY = lTransBottomRightCorner.iY;
+ }
+ TGfxRectangle2D aRect;
+ aRect.iX = lMinX;
+ aRect.iY = lMinY;
+ aRect.iWidth = lMaxX - lMinX;
+ aRect.iHeight = lMaxY - lMinY;
+ return aRect;
+
+}
+
+// Text Drawing
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::DrawStringL( const TDesC& aDesc,
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::DrawStringL( const TDesC& aDesc,
+ TFloatFixPt aX,
+ TFloatFixPt aY,
+ TInt8 ,// aTextAnchor
+ TInt8 ,// aTextDecoration
+ CDesCArrayFlat*, // aFamilies,
+ TReal aWordSpacing,
+ TReal aLetterSpacing,
+ CArrayFix<TReal32>* aArrayRotate,
+ CArrayFix<TFloatFixPt>* aArrayX,
+ CArrayFix<TFloatFixPt>* aArrayY,
+ TSize& aBoundingBox,
+ CFont*& aFont,
+ TFontSpec& /* aFontSpec */ )
+ {
+
+ if ( iStrokeColor.GetARGB() == KGfxColorNull &&
+ iFillColor == NULL )
+ return;
+
+ if(iFillOpacity == TFloatFixPt(0))
+ return;
+
+ if ( aDesc.Length() <= 0 )
+ return;
+
+ TPtrC outputText;
+ if ( *( aDesc.Right( 1 ).Ptr() ) < ' ' )
+ outputText.Set( aDesc.Left( aDesc.Length() - 1 ) );
+ else
+ outputText.Set( aDesc );
+
+ TBool rtl=EFalse;
+ if(TBidiText::TextDirectionality(outputText) == TBidiText::ERightToLeft)
+ {
+ rtl=ETrue;
+ }
+
+ if ( aFont == NULL )
+ {
+ return;
+ }
+ iFont = aFont;
+
+ float aFloat = 0.5;
+
+ //put in .50 for rounding issues 10.99 was going to 10
+ // iFontSize has been initialised at the SetGCL time for the
+ // this specific text element in question.
+ TInt32 fontsize = (TInt32)( iScale * iFontSize + TFloatFixPt(aFloat) );
+
+ if ( fontsize == 0 )
+ {
+ return;
+ }
+
+
+ CFont::TMeasureTextOutput myTextOutput;
+
+ TInt textAdvance = iFont->TextWidthInPixels( outputText );
+ if ( textAdvance == 0 )
+ {
+ return;
+ }
+ TInt fontMaxHeight = iFont->FontMaxHeight() + 2; //Tweak factor needed
+ TInt fontMaxAscent = iFont->FontMaxAscent() + 1; //Tweak factor needed
+ TInt fontAscent = iFont->AscentInPixels();
+ TInt fontDescent = iFont->DescentInPixels();
+ TInt maxDescent = fontMaxHeight-fontMaxAscent; //iFont->FontMaxDescent();
+ TInt fontHeightInPixels = iFont->HeightInPixels();
+ //added to correct for text clipping that system font has
+ TInt fontTweakFactor = (TInt)(TFloatFixPt( 1.5f ) * iScale);
+ TInt fontHorizontalTweakFactor = (TInt)(TFloatFixPt( 5.0f ) * iScale);
+ TInt numSpaces = myTextOutput.iSpaces;
+ TInt numChars = myTextOutput.iChars;
+ TGfxRectangle2D tempRect( aX,
+ aY,
+ textAdvance,
+ fontMaxHeight );
+
+ /******************************************************************
+ * Boundary Check to see if the Text to be drawn is within Bounds. *
+ ******************************************************************/
+
+ TGfxAffineTransform tMatrix;
+ tMatrix = iTransform;
+ TInt32 transx = tMatrix.TranslateX();
+ TInt32 transy = tMatrix.TranslateY();
+ TGfxRectangle2D aRect = GetBBoxForSystemText( outputText , aX , aY );
+
+ TInt32 rectmaxx = aRect.MaxX(); //+ (TFloatFixPt)transx;
+ TInt32 rectmaxy = aRect.MaxY();//- (TFloatFixPt)fontMaxAscent; //+ (TFloatFixPt)transy;
+ TInt32 rectminx = aRect.MinX(); //- (TFloatFixPt)transx;
+ TInt32 rectminy = aRect.MinY();// - (TFloatFixPt)fontMaxHeight;//- (TFloatFixPt)fontMaxAscent; //- (TFloatFixPt)transy;
+ TInt32 clipminx = iRenderInfo.iClipMinX;// + transx;
+ TInt32 clipmaxx = iRenderInfo.iClipMaxX;// + transx;
+ TInt32 clipmaxy = iRenderInfo.iClipMaxY;// + transy;
+ TInt32 clipminy = iRenderInfo.iClipMinY;// + transy;
+
+ TInt advanceWidth = 0;
+ TInt advanceX = 0;
+ TInt excessSpace = 0;
+ TInt aMultipleXY = 0;
+
+ //Checking for multiple XY values.
+ if ( aArrayX != NULL && aArrayY != NULL )
+ {
+ if ( ( aArrayX->Count() > 1 ) || ( aArrayY->Count() > 1 ) )
+ aMultipleXY = 1;
+ }
+
+ // setting the boundbox for simple text with no xy and rotate
+ //this is set here because bound box should get always set as it is used in GetBBoxForSystemText in TextElement.
+ if ( ( aArrayRotate == NULL ) &&
+ ( aMultipleXY == 0 ) &&
+ ( aLetterSpacing == 0.0 ) &&
+ ( aWordSpacing == 0.0 ) )
+ {
+ aBoundingBox.iWidth = textAdvance;
+ aBoundingBox.iHeight = fontMaxHeight;
+ }
+
+ if( rectmaxx < clipminx || rectmaxy < clipminy ||
+ rectminx > clipmaxx || rectminy > clipmaxy )
+ return;
+
+ /****************************************************************************
+ * Code to Draw Simple Text with only x, y and transform values and return.*
+ ****************************************************************************/
+
+ if ( ( aArrayRotate == NULL ) &&
+ ( aMultipleXY == 0 ) &&
+ ( aLetterSpacing == 0.0 ) &&
+ ( aWordSpacing == 0.0 ) )
+ {
+ CFbsBitmap* offScreenBitmap = new ( ELeave ) CFbsBitmap();
+
+ User::LeaveIfError( offScreenBitmap->Create( TSize( textAdvance, fontMaxHeight), EGray256 ) );
+// User::LeaveIfError( offScreenBitmap->Create( TSize( textAdvance + fontHorizontalTweakFactor, fontMaxHeight + fontTweakFactor ), EGray256 ) );
+ CleanupStack::PushL( offScreenBitmap );
+
+ CGraphicsContext* bitmapContext = NULL;
+ CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL( offScreenBitmap );
+
+ CleanupStack::PushL( bitmapDevice );
+ User::LeaveIfError( bitmapDevice->CreateContext( bitmapContext ) );
+ CleanupStack::PushL( bitmapContext );
+
+ bitmapContext->SetBrushStyle( CGraphicsContext::ESolidBrush );
+ bitmapContext->SetBrushColor( 0x000000 );
+ bitmapContext->DrawRect( TRect( TPoint( 0, 0 ), offScreenBitmap->SizeInPixels() ) );
+ bitmapContext->UseFont( iFont );
+ bitmapContext->SetPenSize( TSize( 1, 1 ) );
+ bitmapContext->SetPenColor( 0xFFFFFF );
+ bitmapContext->SetPenStyle( CGraphicsContext::ESolidPen );
+ bitmapContext->SetBrushStyle( CGraphicsContext::ENullBrush );
+
+ if (iTextAnchor == EGfxTextAnchorEnd)
+ {
+ aX -= TFloatFixPt(textAdvance) / iScale;
+ }
+ if (iTextAnchor == EGfxTextAnchorMiddle)
+ {
+ aX -= (TFloatFixPt(textAdvance) / iScale) / TFloatFixPt(2);
+ }
+
+ // While drawing the text which has both arabic & normal left-to-right
+ // characters the DrawTextExtended should be used since there is no way
+ // to split the text according to the directionality.
+
+ CGraphicsContext::TDrawTextExtendedParam param;
+ param.iParRightToLeft = rtl;
+ bitmapContext->DrawTextExtended(outputText,
+ TPoint( 0, fontMaxAscent ), param);
+
+ VGint width = offScreenBitmap->SizeInPixels().iWidth;
+ VGint height = offScreenBitmap->SizeInPixels().iHeight;
+
+ /* The bilinear causes the text to blur a bit, but rotated (& scaled) text will look better, of course */
+ VGImage img = iVgRenderer->vgCreateImage( VG_A_8, width, height, VG_IMAGE_QUALITY_NONANTIALIASED );
+ //VGImage img = vgCreateImage( VG_A_8, width, height, VG_IMAGE_QUALITY_BETTER );
+ //VGImage img = vgCreateImage( VG_A_8, width, height, VG_IMAGE_QUALITY_FASTER );
+
+ VGPaint paint = iVgRenderer->vgCreatePaint();
+
+ if( img && paint )
+ {
+ offScreenBitmap->LockHeap();
+
+ /* OpenVG images have their y-axis flipped,
+ that is why when calling vgImageSubData we pass the address of offScreenBitmap's last scanline,
+ and use a negated stride value */
+ VGint stride = CFbsBitmap::ScanLineLength( width, EGray256 ); /* EGray256 == offScreenBitmap->DisplayMode() */
+ VGbyte *lastScanline = ( (VGbyte*)offScreenBitmap->DataAddress() ) + ( height - 1 ) * stride;
+
+ iVgRenderer->vgImageSubData( img, lastScanline, -stride, VG_A_8, 0, 0, width, height );
+
+ offScreenBitmap->UnlockHeap();
+
+ TGfxColor color( iFillColor ? iFillColor->GetColor() : iStrokeColor.GetColor() );
+ VGuint argb = color.GetARGB() | ( 0xff000000 ); /* set alpha to 255 */
+ VGfloat rgba_f[4];
+
+ int tr, tg, tb;
+
+ tr = (argb >> 16) & 0xff;
+ tg = (argb >> 8 ) & 0xff;
+ tb = (argb ) & 0xff;
+
+ rgba_f[0] = tr / 255.0f;
+ rgba_f[1] = tg / 255.0f;
+ rgba_f[2] = tb / 255.0f;
+ //rgba_f[3] = ( ( argb >> 24 ) & 0xff ) / 255.0f;
+ rgba_f[3] = 1.0f; /* was set to 255 */
+ if( paint != VG_INVALID_HANDLE )
+ {
+ iVgRenderer->vgSetParameteri( paint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR );
+ iVgRenderer->vgSetParameterfv( paint, VG_PAINT_COLOR, 4, rgba_f );
+ iVgRenderer->vgSetPaint( paint, VG_FILL_PATH );
+ }
+
+ // Get the current blend mode (set back at end of operation)
+ const TInt KBlendModeValue = iVgRenderer->vgGeti( VG_BLEND_MODE );
+ const TInt KImageModeValue = iVgRenderer->vgGeti( VG_IMAGE_MODE );
+
+
+ iVgRenderer->vgSeti( VG_BLEND_MODE, VG_BLEND_SRC_OVER );
+ iVgRenderer->vgSeti( VG_IMAGE_MODE, VG_DRAW_IMAGE_MULTIPLY );
+ VGfloat mat[9];
+
+ /* Retreive the Path transformation matrix */
+ GetMatrix( mat );
+ iVgRenderer->vgSeti( VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE );
+
+
+ iVgRenderer->vgSeti( VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE );
+
+ /* Since the text rendering has to match AA done by ext, we'll round the transformation.
+ Seems like Symbian does not have a 32-bit float round... */
+
+ TReal tx = mat[6], ty = mat[7];
+ Math::Round(tx, tx, 0); Math::Round(ty, ty, 0);
+
+ mat[6] = (VGfloat)tx;
+ mat[7] = (VGfloat)ty;
+
+ /* Load Path transformation matrix to Image transformation matrix */
+/*nga vgLoadMatrix( mat );
+
+// TFloatFixPt aY1( aY * iScale );
+// aY -= ( iFont->AscentInPixels());
+ //vgTranslate( (VGfloat)aX, (VGfloat)aY + fontTweakFactor);
+ vgTranslate( (VGfloat)aX, (VGfloat)aY );
+ vgScale( 1.0f/(VGfloat)iScale, -1.0f/(VGfloat)iScale );
+ vgTranslate( (VGfloat)0, -(VGfloat)maxDescent);
+ vgDrawImage( img );
+
+ vgSeti( VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE );
+ vgLoadIdentity();
+
+ vgSeti( VG_IMAGE_MODE, KImageModeValue );
+ vgSeti( VG_BLEND_MODE, KBlendModeValue );*/
+ iVgRenderer->vgLoadMatrix( mat );
+ iVgRenderer->vgTranslate( (VGfloat)aX, (VGfloat)aY );
+ iVgRenderer->vgScale( 1.0f/(VGfloat)iScale, -1.0f/(VGfloat)iScale );
+ iVgRenderer->vgTranslate( (VGfloat)0, -(VGfloat)maxDescent);
+ iVgRenderer->vgDrawImage( img );
+
+ iVgRenderer->vgSeti( VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE );
+ iVgRenderer->vgLoadIdentity();
+
+ iVgRenderer->vgSeti( VG_IMAGE_MODE, KImageModeValue );
+ iVgRenderer->vgSeti( VG_BLEND_MODE, KBlendModeValue );
+ }
+
+ if( img )
+ {
+ iVgRenderer->vgDestroyImage( img );
+ }
+ if( paint )
+ {
+ iVgRenderer->vgDestroyPaint( paint );
+ }
+
+ bitmapContext->DiscardFont();
+
+ CleanupStack::PopAndDestroy( 3 );
+
+ if ( iTextDecoration == EGfxTextDecorationUnderLine )
+ {
+ TGfxLine2D aLine( aX,
+ aY,
+ (aX + ( TFloatFixPt )textAdvance / iScale ),
+ aY); //+ ( TFloatFixPt )(2));
+ DrawL( &aLine );
+ }
+ else if ( iTextDecoration == EGfxTextDecorationOverLine )
+ {
+ TGfxLine2D aLine( aX,
+// aY - ( TFloatFixPt )fontMaxHeight / iScale,
+ aY,
+ (aX + ( TFloatFixPt )textAdvance / iScale ),
+ aY);// - ( TFloatFixPt )fontMaxHeight / iScale );
+ DrawL( &aLine );
+ }
+ else if ( iTextDecoration == EGfxTextDecorationLineThrough )
+ {
+ TGfxLine2D aLine( aX ,
+ aY - ( TFloatFixPt )( fontMaxHeight / 2 ) / iScale,
+ (aX + ( TFloatFixPt )textAdvance /iScale ),
+ aY - ( TFloatFixPt )( fontMaxHeight / 2 ) / iScale );
+ DrawL( &aLine );
+ }
+
+ //-----------------------------------------------------------------
+ return;
+ }
+
+
+ //Check Word/Letter Spacing.
+ if ( aWordSpacing > 0.0 )
+ excessSpace += ( TInt )
+ ( aWordSpacing * ( TReal ) iScale ) * numSpaces;
+ if ( aLetterSpacing > 0.0 )
+ excessSpace += ( TInt )
+ ( aLetterSpacing * ( TReal ) iScale ) * numChars;
+
+ textAdvance += excessSpace;
+
+ /*****************************************************************************
+ * Drawing one glyph(character) at a time for multiple XY and rotation Values.*
+ ******************************************************************************/
+ if (rtl)
+ {
+ TBidiText* biditext = TBidiText::NewL(outputText,1);
+ biditext->WrapText(textAdvance,*iFont,0,1);
+ outputText.Set(biditext->DisplayText());
+ delete biditext;
+ biditext = NULL;
+
+ }
+ TLex aOutputText( outputText );
+ for ( TInt count = 0; count < outputText.Length() ; count++ )
+ {
+ TPtrC outputChar;
+ TChar ch( aOutputText.Get() );
+ outputChar.Set( &( outputText.operator[]( count ) ), 1 );
+
+ TInt charWidth = iFont->CharWidthInPixels( ch );
+
+ CFbsBitmap* offScreenBitmap = new ( ELeave ) CFbsBitmap();
+ User::LeaveIfError( offScreenBitmap->Create( TSize( charWidth,
+ fontMaxHeight + fontTweakFactor ),
+ EColor16MU ) );
+ CleanupStack::PushL( offScreenBitmap );
+
+ CGraphicsContext* bitmapContext = NULL;
+ CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL( offScreenBitmap );
+
+ CleanupStack::PushL( bitmapDevice );
+ User::LeaveIfError( bitmapDevice->CreateContext( bitmapContext ) );
+ CleanupStack::PushL( bitmapContext );
+
+ TBool isWhite = EFalse;
+ if ( iFillColor != NULL )
+ {
+ if ( ( ( TGfxColor * ) iFillColor )->GetARGB() == 0xffffff )
+ isWhite = ETrue;
+ }
+ else
+ {
+ if ( iStrokeColor.GetARGB() == 0xffffff )
+ isWhite = ETrue;
+ }
+ if ( isWhite )
+ {
+ // Fill with black if text color is white
+ TRect bmprect( 0, 0, charWidth, fontMaxHeight );
+ bitmapContext->SetBrushStyle( CGraphicsContext::ESolidBrush );
+ bitmapContext->SetBrushColor( 0x000000 );
+ bitmapContext->SetPenColor( 0x000000 );
+ bitmapContext->DrawRect( bmprect );
+ }
+
+ bitmapContext->UseFont( iFont );
+ bitmapContext->SetPenSize( TSize( 1, 1 ) );
+ if ( iFillColor != NULL )
+ {
+ TGfxColor lColor(iFillColor->GetColor());
+ bitmapContext->SetBrushColor( lColor.GetABGR() );
+ bitmapContext->SetPenColor( lColor.GetABGR() );
+ }
+ else
+ {
+ bitmapContext->SetBrushColor( iStrokeColor.GetABGR() );
+ bitmapContext->SetPenColor( iStrokeColor.GetABGR() );
+ }
+
+ bitmapContext->SetPenStyle( CGraphicsContext::ESolidPen );
+ bitmapContext->SetBrushStyle( CGraphicsContext::ENullBrush );
+
+
+ if ( ( aArrayX != NULL ) && ( count < aArrayX->Count() ) )
+ aX = aArrayX->At( count );
+
+ if ( ( aArrayY != NULL ) && ( count < aArrayY->Count() ) )
+ aY = aArrayY->At( count );
+
+ TFloatFixPt aY1( aY * iScale ), aX1( aX * iScale );
+
+ TFloatFixPt ScaleAA;
+ TGfxAffineTransform tempMatrix;
+ tempMatrix = iTransform;
+
+ ScaleAA = 1;
+
+ #ifdef SVG_FLOAT_BUILD
+ tempMatrix.Scale( ( TFloatFixPt( 1 ) / ( iScale ) ),
+ ( TFloatFixPt( 1 ) / ( iScale ) ));
+ #else
+ tempMatrix.Scale( ( TFloatFixPt( 0x10000,ETrue ) / ( iScale ) ),
+ ( TFloatFixPt( 0x10000,ETrue ) / ( iScale ) ));
+ #endif
+
+
+
+ if ( aMultipleXY == 1 )
+ {
+ aX1 = aX1 + ( TFloatFixPt ) advanceX;
+ }
+ else
+ aX1 = aX1 + ( TFloatFixPt ) advanceWidth;
+
+ aY1 -= ( iFont->AscentInPixels() );
+
+ if ( aMultipleXY == 0 )
+ {
+ if ( iTextAnchor == EGfxTextAnchorMiddle )
+ {
+ aX1 -= textAdvance / 2;
+ }
+ else if ( iTextAnchor == EGfxTextAnchorEnd )
+ {
+ aX1 -= textAdvance;
+ }
+ }
+
+ TGfxPoint2D p( aX1, aY1 );
+
+ TFloatFixPt trnsx, trnsy;
+
+ trnsx = aX1 ;
+ trnsy = aY1 + ( TFloatFixPt ) ( (fontMaxHeight / 2) + fontDescent);
+
+ //"rotate" Attribute Implementation
+ // If only one value is present, it is applied to all the glyphs
+ //otherwise, one-to-one mapping is taken. Any extra values are ignored!
+ if ( aArrayRotate != NULL )
+ {
+ if(count < aArrayRotate->Count())
+ {
+ TFloatFixPt KZero;
+ tempMatrix.Translate( trnsx, trnsy );
+ TReal32 aAngle( ( TReal32 ) aArrayRotate->At( count ) );
+ tempMatrix.Rotate( aAngle * 3.1415926f / 180.0f );
+ TFloatFixPt negX( KZero - trnsx );
+ TFloatFixPt negY( KZero - trnsy );
+ tempMatrix.Translate( negX, negY );
+ }
+ }
+
+ TGfxImageTransformer imgtrns( &tempMatrix, iVgRenderer);
+
+
+ TRect clip(iClip.iX, iClip.iY,
+ iClip.iWidth + iClip.iX, iClip.iHeight + iClip.iY);
+
+ p.iY -= fontTweakFactor;
+ imgtrns.ImageBlend( offScreenBitmap,
+ p,
+ iRenderInfo.iWidth,
+ iRenderInfo.iHeight,
+ clip,
+ ETrue);
+
+ if (rtl) // IsRightToLeft(outputText)
+ {
+ CGraphicsContext::TDrawTextExtendedParam param;
+ param.iParRightToLeft = ETrue;
+
+ bitmapContext->DrawTextExtended(outputText,
+ TPoint( 0, fontHeightInPixels - fontDescent + fontTweakFactor ), param);
+ }
+ else
+ {
+ bitmapContext->DrawText( outputChar, TPoint( 0, fontMaxAscent ) );
+// bitmapContext->DrawText( outputChar, TPoint( 0, fontHeightInPixels - fontDescent + fontTweakFactor ));
+ }
+ TGfxRectangle2D textRect(p.iX, p.iY, textAdvance, fontMaxHeight);
+
+ imgtrns.ImageBlend( offScreenBitmap,
+ p,
+ iRenderInfo.iWidth,
+ iRenderInfo.iHeight,
+ clip);
+
+ bitmapContext->DiscardFont();
+ CleanupStack::PopAndDestroy( 3 );
+
+ if ( aMultipleXY == 0 )
+ {
+ TInt aSpacing = 0;
+ if ( aLetterSpacing > 0.0 )
+ {
+ if ( ch != 0x0020 )
+ aSpacing += ( TInt )
+ ( aLetterSpacing * ( TReal ) iScale ) ;
+ }
+ if ( aWordSpacing > 0.0 )
+ {
+ if ( ch == 0x0020 )
+ aSpacing += ( TInt ) ( aWordSpacing * ( TReal ) iScale ) ;
+ }
+
+ if ( iStrokeColor.GetARGB() == KGfxColorNull )
+ {
+ if ( iFillColor != NULL )
+ this->iStrokeColor = TGfxColor( iFillColor->GetColor() );
+ }
+
+ if ( iTextDecoration == EGfxTextDecorationUnderLine )
+ {
+ if ( iTextAnchor == EGfxTextAnchorMiddle )
+ {
+ TGfxLine2D aLine( aX + (ScaleAA *
+ ( TFloatFixPt )
+ ( advanceWidth - textAdvance / 2 ) /
+ iScale),
+ aY,
+ ( aX + (ScaleAA * ( ( TFloatFixPt )
+ ( advanceWidth + charWidth + aSpacing - textAdvance / 2 ) /
+ iScale ) ) ),
+ aY );
+ DrawL( &aLine );
+ }
+ else if ( iTextAnchor == EGfxTextAnchorEnd )
+ {
+ TGfxLine2D aLine( aX + (ScaleAA *
+ ( TFloatFixPt )
+ ( advanceWidth - textAdvance ) /
+ iScale),
+ aY,
+ ( aX + (ScaleAA * ( ( TFloatFixPt )
+ ( advanceWidth + charWidth + aSpacing - textAdvance ) /
+ iScale ) ) ),
+ aY );
+ DrawL( &aLine );
+ }
+ else //Start
+ {
+ TGfxLine2D aLine( aX + (ScaleAA *
+ ( TFloatFixPt )
+ advanceWidth /
+ iScale),
+ aY,
+ ( aX + (ScaleAA * ( ( TFloatFixPt )
+ ( advanceWidth + charWidth + aSpacing ) /
+ iScale ) ) ),
+ aY );
+ DrawL( &aLine );
+ }
+ }
+ if ( iTextDecoration == EGfxTextDecorationOverLine )
+ {
+ if ( iTextAnchor == EGfxTextAnchorMiddle )
+ {
+ TGfxLine2D aLine( aX + (ScaleAA *
+ ( TFloatFixPt )
+ ( advanceWidth - textAdvance / 2 ) /
+ iScale),
+ aY -
+ ( TFloatFixPt )
+ fontMaxHeight /
+ iScale,
+ ( aX + (ScaleAA * ( ( TFloatFixPt )
+ ( advanceWidth + charWidth + aSpacing - textAdvance / 2 ) /
+ iScale ) ) ),
+ aY -
+ ( TFloatFixPt )
+ fontMaxHeight /
+ iScale );
+ DrawL( &aLine );
+ }
+ else if ( iTextAnchor == EGfxTextAnchorEnd )
+ {
+ TGfxLine2D aLine( aX + (ScaleAA *
+ ( TFloatFixPt )
+ ( advanceWidth - textAdvance ) /
+ iScale),
+ aY -
+ ( TFloatFixPt )
+ fontMaxHeight /
+ iScale,
+ ( aX + (ScaleAA * ( ( TFloatFixPt )
+ ( advanceWidth + charWidth + aSpacing - textAdvance ) /
+ iScale ) ) ),
+ aY -
+ ( TFloatFixPt )
+ fontMaxHeight /
+ iScale );
+ DrawL( &aLine );
+ }
+ else //Start
+ {
+ TGfxLine2D aLine( aX + (ScaleAA *
+ ( TFloatFixPt )
+ advanceWidth /
+ iScale),
+ aY -
+ ( TFloatFixPt )
+ fontMaxHeight /
+ iScale,
+ ( aX + (ScaleAA * ( ( TFloatFixPt )
+ ( advanceWidth + charWidth + aSpacing ) /
+ iScale ) ) ),
+ aY -
+ ( TFloatFixPt )
+ fontMaxHeight /
+ iScale );
+ DrawL( &aLine );
+ }
+ }
+ if ( iTextDecoration == EGfxTextDecorationLineThrough )
+ {
+ if ( iTextAnchor == EGfxTextAnchorMiddle )
+ {
+ TGfxLine2D aLine( aX + (ScaleAA *
+ ( TFloatFixPt )
+ ( advanceWidth - (textAdvance >> 1) ) /
+ iScale),
+ aY -
+ ( TFloatFixPt )
+ ( fontMaxHeight >> 1 ) /
+ iScale,
+ ( aX + (ScaleAA * ( ( TFloatFixPt )
+ ( advanceWidth + charWidth + aSpacing - ( textAdvance >> 1 )) /
+ iScale ) ) ),
+ aY -
+ ( TFloatFixPt )
+ ( fontMaxHeight >> 1 ) /
+ iScale );
+ DrawL( &aLine );
+ }
+ else if ( iTextAnchor == EGfxTextAnchorEnd )
+ {
+ TGfxLine2D aLine( aX + (ScaleAA *
+ ( TFloatFixPt )
+ ( advanceWidth - textAdvance ) /
+ iScale),
+ aY -
+ ( TFloatFixPt )
+ ( fontMaxHeight >> 1 ) /
+ iScale,
+ ( aX + (ScaleAA * ( ( TFloatFixPt )
+ ( advanceWidth + charWidth + aSpacing - textAdvance ) /
+ iScale ) ) ),
+ aY -
+ ( TFloatFixPt )
+ ( fontMaxHeight >> 1 ) /
+ iScale );
+ DrawL( &aLine );
+ }
+ else //Start
+ {
+ TGfxLine2D aLine( aX + (ScaleAA *
+ ( TFloatFixPt )
+ advanceWidth /
+ iScale),
+ aY -
+ ( TFloatFixPt )
+ ( fontMaxHeight >> 1 ) /
+ iScale,
+ ( aX + (ScaleAA * ( ( TFloatFixPt )
+ ( advanceWidth + charWidth + aSpacing ) /
+ iScale ) ) ),
+ aY -
+ ( TFloatFixPt )
+ ( fontMaxHeight >> 1 ) /
+ iScale );
+ DrawL( &aLine );
+ }
+ }
+ advanceWidth += charWidth + aSpacing;
+ }
+
+ if ( aMultipleXY == 1 )
+ {
+ if ( count >= aArrayX->Count() - 1 )
+ advanceX += charWidth;
+ }
+ } //end for(Drawing single glyph)
+ }
+
+// Raster image drawing
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::DrawImage( CFbsBitmap* aImage,
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::DrawImage( CFbsBitmap* aImage,
+ const TGfxRectangle2D& aImageRect,
+ TBool aHasAlpha )
+ {
+ if ( !aImage )
+ return;
+
+ TSize imageSize = aImage->SizeInPixels();
+
+ aImage->LockHeap();
+ VGImage vgImage = CreateVGImage( aImage->DataAddress(), imageSize, aImage->DisplayMode(), EFalse );
+
+ aImage->UnlockHeap();
+
+ // Transform to flip drawing to be like screen drawing (from Cartesian)
+ TGfxAffineTransform flipTransform = TGfxAffineTransform::GetScaleInstance( 1.0f, -1.0f );
+
+ // Shift x=0 line to top of screen (buffer)
+ flipTransform.Translate( TFloatFixPt ( 0 ), TFloatFixPt ( -iColorBufferSize.iHeight ) );
+
+ // Application transformations from element
+ flipTransform.Concatenate( iTransform );
+
+ // Set the topleft corner of image to draw
+ flipTransform.Translate( aImageRect.iX, aImageRect.iY );
+
+ // Caller to DrawImage already check for image size zero
+ float scaleX = (VGfloat)( TFloatFixPt ( aImageRect.iWidth ) / TFloatFixPt ( imageSize.iWidth ) );
+ float scaleY = (VGfloat)( TFloatFixPt ( aImageRect.iHeight ) / TFloatFixPt ( imageSize.iHeight ) );
+
+ // Scale to fit image to drawing area
+ flipTransform.Scale( scaleX, scaleY );
+
+ VGfloat matrix[] = { (VGfloat)flipTransform.iM00, (VGfloat)flipTransform.iM10, 0,
+ (VGfloat)flipTransform.iM01, (VGfloat)flipTransform.iM11, 0,
+ (VGfloat)flipTransform.iM02, (VGfloat)flipTransform.iM12, 1 };
+
+ iVgRenderer->vgSeti( VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE );
+ iVgRenderer->vgLoadMatrix( matrix );
+
+ // Get current blend-mode
+ const TInt KBlendMode = iVgRenderer->vgGeti( VG_BLEND_MODE );
+
+ iVgRenderer->vgSeti( VG_BLEND_MODE, aHasAlpha ? VG_BLEND_SRC_OVER : VG_BLEND_SRC );
+
+ /* Disable bilinear filtering -> faster, but lower rendering quality */
+ iVgRenderer->vgSeti( VG_IMAGE_QUALITY, VG_IMAGE_QUALITY_NONANTIALIASED );
+
+ iVgRenderer->vgDrawImage( vgImage );
+
+ iVgRenderer->vgSeti( VG_BLEND_MODE, KBlendMode );
+
+ iVgRenderer->vgDestroyImage( vgImage );
+ }
+
+
+// ==========================================================================
+// Clear the whole graphics context with the background color
+// ==========================================================================
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::Clear(TUint32 aRGBA8888Color)
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::Clear(TUint32 aARGB )
+ {
+ TUint32 rgba = ( aARGB << 8 ) | ( aARGB >> 24 );
+ TInt32 r, g, b, a;
+ r = (TInt)((rgba & 0xFF000000) >> 24);
+ g = (TInt)((rgba & 0x00FF0000) >> 16);
+ b = (TInt)((rgba & 0x0000FF00) >> 8);
+ a = (TInt)( rgba & 0x000000FF);
+
+ r += r >> 7; g += g >> 7; b += b >> 7; a += a >> 7;
+
+ const TFloatFixPt KInverse255 = TFloatFixPt ( 1.0f/256.0f );
+ const VGfloat clearColor[4] = { (VGfloat)(KInverse255 * TFloatFixPt (r)),
+ (VGfloat)(KInverse255 * TFloatFixPt (g)),
+ (VGfloat)(KInverse255 * TFloatFixPt (b)),
+ (VGfloat)(KInverse255 * TFloatFixPt (a)) };
+
+ iVgRenderer->vgSeti( VG_SCISSORING, VG_FALSE );
+ iVgRenderer->vgSetfv( VG_CLEAR_COLOR, 4, clearColor );
+ iVgRenderer->vgClear( 0, 0, iColorBufferSize.iWidth, iColorBufferSize.iHeight );
+ iVgRenderer->vgSeti( VG_SCISSORING, VG_TRUE );
+ }
+
+// ==========================================================================
+// This method copies the internal RGBA8888 framebuffer to CfbsBitmap that
+// is specified in constructor. The CfbsBitmap could be 4k color (RGB0444),
+// 64k color (RGB565), or 16M color (RGB888).
+// ==========================================================================
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::UpdateFramebufferL()
+// --------------------------------------------------------------------------
+void CGfx2dGcOpenVG::UpdateFramebufferL( CFbsBitmap* aBitmap, CFbsBitmap* aMask)
+ {
+ if ( !aBitmap || aBitmap->SizeInPixels() != iColorBufferSize )
+ {
+ return;
+ }
+
+ const TDisplayMode KBitmapDisplayMode = aBitmap->DisplayMode();
+ // This check just before VGISymbianCopyToBitmap avoid putting lot
+ // many similar error checks in the code. If there is any problem
+ // during OpenVG call we simply leave without drawing any thing.
+ VGErrorCode vgret = (VGErrorCode)iVgRenderer->vgGetError();
+
+ if(vgret != VG_NO_ERROR )
+ {
+ User::LeaveIfError(OpenVGErrorToSymbianError(vgret));
+ }
+
+ // EGray2 is not support in VGISymbianCopyToBitmap API
+ if ( KBitmapDisplayMode == EGray2 )
+ {
+ const TInt KStride = CFbsBitmap::ScanLineLength( iColorBufferSize.iWidth, KBitmapDisplayMode );
+
+ aBitmap->LockHeap();
+
+ // Get data address of last line and move upwards (negative stride)
+ // OpenVG uses Cartesian coordinate system and Symbian uses Screen coordinate system.
+ TUint* data = (TUint*)((TUint)aBitmap->DataAddress() + ( KStride * ( iColorBufferSize.iHeight - 1 ) ) );
+
+ iVgRenderer->vgReadPixels( data, -KStride, VG_BW_1, 0, 0,
+ iColorBufferSize.iWidth, iColorBufferSize.iHeight );
+
+ aBitmap->UnlockHeap();
+
+ if ( aMask )
+ {
+ GenerateMask( aMask );
+ }
+ }
+ // All other color modes
+ else
+ {
+ // No Mask -- to be generated in GenerateMask
+ TInt error=KErrNone;
+
+ //In cases, where the mask/aMaskBitmap != NULL, the hint should be defined as VGI_SKIP_TRANSPARENT_PIXELS.
+ //In all other cases, i.e., when mask/aMaskBitmap == NULL, the definition should be VGI_COPY_TRANSPARENT_PIXELS
+ error = iVgSurface->CopyBitmap(ENone,ENone, aBitmap, aMask, iColorBufferSize);
+
+ if ( error != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("VGISymbianCopyToBitmap failed: error code: %d", error );
+ RDebug::Printf(" - Color mode: %d", aBitmap->DisplayMode() );
+ RDebug::Printf(" - Bitmap size: %dx%d", iColorBufferSize.iWidth, iColorBufferSize.iHeight );
+ #endif
+ User::LeaveIfError(error);
+ }
+
+ // VGISymbianCopyToBitmap only generates Gray256 mask
+ if ( aMask && aMask->DisplayMode() == EGray2 )
+ {
+ GenerateMask( aMask );
+ }
+ }
+ }
+//NGA
+// ---------------------------------------------------------------------------------------------------------------------------------------
+//void UpdateFramebufferL( CFbsBitmap* aBitmap, CFbsBitmap* aMask,TSize BitmapSize,TDisplayMode aBitmapDspMode,TDisplayMode aMaskDspMode )
+// ---------------------------------------------------------------------------------------------------------------------------------------
+
+void CGfx2dGcOpenVG::UpdateFramebufferL( CFbsBitmap* aBitmap, CFbsBitmap* aMask,TSize /*BitmapSize*/,TDisplayMode aBitmapDspMode,TDisplayMode aMaskDspMode )
+ {
+ if ( !aBitmap)
+ {
+ return;
+ }
+
+ const TDisplayMode KBitmapDisplayMode = aBitmap->DisplayMode();
+ // This check just before VGISymbianCopyToBitmap avoid putting lot
+ // many similar error checks in the code. If there is any problem
+ // during OpenVG call we simply leave without drawing any thing.
+ VGErrorCode vgret = (VGErrorCode)iVgRenderer->vgGetError();
+
+ if(vgret != VG_NO_ERROR )
+ {
+ User::LeaveIfError(OpenVGErrorToSymbianError(vgret));
+ }
+
+ // EGray2 is not support in VGISymbianCopyToBitmap API
+ if ( KBitmapDisplayMode == EGray2 )
+ {
+ const TInt KStride = CFbsBitmap::ScanLineLength( iColorBufferSize.iWidth, KBitmapDisplayMode );
+
+ aBitmap->LockHeap();
+
+ // Get data address of last line and move upwards (negative stride)
+ // OpenVG uses Cartesian coordinate system and Symbian uses Screen coordinate system.
+ TUint* data = (TUint*)((TUint)aBitmap->DataAddress() + ( KStride * ( iColorBufferSize.iHeight - 1 ) ) );
+
+
+ iVgRenderer->vgReadPixels( data, -KStride, VG_BW_1, 0, 0,
+ iColorBufferSize.iWidth, iColorBufferSize.iHeight );
+
+ aBitmap->UnlockHeap();
+
+ if ( aMask )
+ {
+ GenerateMask( aMask );
+ }
+ }
+ // All other color modes
+ else
+ {
+ // No Mask -- to be generated in GenerateMask
+ TInt error=KErrNone;
+
+ //In cases, where the mask/aMaskBitmap != NULL, the hint should be defined as VGI_SKIP_TRANSPARENT_PIXELS.
+ //In all other cases, i.e., when mask/aMaskBitmap == NULL, the definition should be VGI_COPY_TRANSPARENT_PIXELS
+
+ error = iVgSurface->CopyBitmap(aBitmapDspMode, aMaskDspMode, aBitmap, aMask, iColorBufferSize);
+
+ if ( error != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("VGISymbianCopyToBitmap failed: error code: %d", error );
+ RDebug::Printf(" - Color mode: %d", aBitmap->DisplayMode() );
+ RDebug::Printf(" - Bitmap size: %dx%d", iColorBufferSize.iWidth, iColorBufferSize.iHeight );
+ #endif
+ User::LeaveIfError(error);
+ }
+
+ // VGISymbianCopyToBitmap only generates Gray256 mask
+ if ( aMask && aMask->DisplayMode() == EGray2 )
+ {
+ GenerateMask( aMask );
+ }
+ }
+ }
+
+// ====================================================================================
+// Blend bitmap with background according to group opacity
+// This function gets called with the opacity framebuffer and the group opacity value
+// The opacity buffer is initialized with the 0xAA55AA55 value. The pixels not matching
+// the initialiazation value are the pixels that have to be blended with the background.
+// ====================================================================================
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcVGR::BlendWithBackground(TUint32* aFrameBuffer, TReal32 aOpacity)
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::BlendWithBackground(TUint32* /* aColorBuffer */, TReal32 /* aOpacity */)
+ {
+/*
+ if ( !iColorBuffer || !aColorBuffer )
+ {
+ return;
+ }
+
+ TReal32 inverseAlpha = 1.0f - aOpacity;
+ const TInt KMax = iColorBufferSize.iWidth * iColorBufferSize.iHeight;
+ TUint32* dst = iColorBuffer;
+ TUint32* src = aColorBuffer;
+
+ for ( TInt i = KMax - 1; i >= 0; i-- )
+ {
+ TUint32 srcColor = src[i];
+ TUint32 dstColor = dst[i];
+ if ( srcColor != dstColor )
+ {
+ dst[i] = ((((TUint)((srcColor >> 24 ) * aOpacity) +
+ (TUint)((dstColor >> 24 ) * inverseAlpha))) << 24) | // red
+ ((((TUint)((srcColor >> 16 & 0xff) * aOpacity) +
+ (TUint)((dstColor >> 16 & 0xff) * inverseAlpha))) << 16) | // green
+ ((((TUint)((srcColor >> 8 & 0xff) * aOpacity) +
+ (TUint)((dstColor >> 8 & 0xff) * inverseAlpha))) << 8 ) | // blue
+ (srcColor & 0x000000FF); // keep orignal alpha
+ }
+ }
+*/
+ }
+
+// ==========================================================================
+// Generate 8 bit gray or 1bit B/W mask from internal ARGB8888 frame buffer.
+// ==========================================================================
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::GenerateMask(CFbsBitmap* aMask)
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::GenerateMask(CFbsBitmap* aMask)
+ {
+ if ( !aMask || aMask->SizeInPixels() != iColorBufferSize )
+ {
+ return;
+ }
+
+ const TDisplayMode KMaskDisplayMode = aMask->DisplayMode();
+
+ if ( KMaskDisplayMode != EGray256 && KMaskDisplayMode != EGray2 )
+ {
+ return;
+ }
+
+ const TInt KOriginalFilterMasks = iVgRenderer->vgGeti( VG_FILTER_CHANNEL_MASK );//
+ const TInt KStride = CFbsBitmap::ScanLineLength( iColorBufferSize.iWidth, KMaskDisplayMode );
+
+ // Change to get alpha values from OpenVG
+ iVgRenderer->vgSeti( VG_FILTER_CHANNEL_MASK, VG_ALPHA );
+
+ VGImageFormat format = ( KMaskDisplayMode == EGray256 ) ? VG_A_8 : VG_BW_1;
+
+ aMask->LockHeap();
+
+ // Get data address of last line and move upwards (negative stride)
+ // OpenVG uses Cartesian coordinate system and Symbian uses Screen coordinate system.
+ TUint* data = (TUint*)((TUint)aMask->DataAddress() + ( KStride * ( iColorBufferSize.iHeight - 1 ) ) );
+
+ iVgRenderer->vgReadPixels( data, -KStride, format, 0, 0,
+ iColorBufferSize.iWidth, iColorBufferSize.iHeight );
+ aMask->UnlockHeap();
+
+ // Set back the original filter-masks
+ iVgRenderer->vgSeti( VG_FILTER_CHANNEL_MASK, KOriginalFilterMasks );
+ }
+
+
+// ==========================================================================
+// This function calls the low level function to set fill opacity value
+// ==========================================================================
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetFillOpacity(TFloatFixPt aFillOpacity)
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetFillOpacity(TFloatFixPt aFillOpacity)
+ {
+ iFillOpacity = aFillOpacity;
+ }
+// ==========================================================================
+// This function calls the low level function to set stroke opacity value
+// ==========================================================================
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetStrokeOpacity(TFloatFixPt aStrokeOpacity)
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetStrokeOpacity(TFloatFixPt aStrokeOpacity)
+ {
+ iStrokeOpacity = aStrokeOpacity;
+ }
+// ==========================================================================
+// This function is called to set the dithering flag
+// ==========================================================================
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::SetDoDithering( TBool aDoDithering )
+// ---------------------------------------------------------------------------
+ void CGfx2dGcOpenVG::SetDoDithering( TBool /*aDoDithering*/ )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::ApplyTransform
+// ---------------------------------------------------------------------------
+void CGfx2dGcOpenVG::ApplyTransform( TGfxAffineTransform& aAffineTransform )
+ {
+ iVgRenderer->vgSeti( VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE );
+
+ TUint transformType = aAffineTransform.iTransType;
+
+ // Only translation is applied
+ if ( transformType == KTransformTranslate )
+ {
+ iVgRenderer->vgLoadIdentity();
+ iVgRenderer->vgScale( 1.0f, -1.0f );
+ iVgRenderer->vgTranslate( (VGfloat)aAffineTransform.iM02,
+ (VGfloat)(TFloatFixPt (-iColorBufferSize.iHeight) + aAffineTransform.iM12 ) );
+ }
+ // General case: Rotate and/or scaling, translation
+ else
+ {
+ TGfxAffineTransform flipTransform = TGfxAffineTransform::GetScaleInstance( 1.0f, -1.0f );
+ flipTransform.Translate( TFloatFixPt ( 0 ), TFloatFixPt ( -iColorBufferSize.iHeight ) );
+ flipTransform.Concatenate( aAffineTransform );
+
+ VGfloat matrix[] = { (VGfloat)flipTransform.iM00, (VGfloat)flipTransform.iM10, 0,
+ (VGfloat)flipTransform.iM01, (VGfloat)flipTransform.iM11, 0,
+ (VGfloat)flipTransform.iM02, (VGfloat)flipTransform.iM12, 1 };
+ iVgRenderer->vgLoadMatrix( matrix );
+ }
+ }
+ void CGfx2dGcOpenVG::ApplyTransformMediaElement( const TGfxAffineTransform& aAffineTransform,TSize& /*aSize*/ )
+ {
+ iVgRenderer->vgSeti( VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE );
+
+ // TUint transformType = aAffineTransform.iTransType;
+
+ // Only translation is applied
+ /* if ( transformType == KTransformTranslate )
+ {
+ vgLoadIdentity();
+ vgScale( 1.0f, -1.0f );
+ vgTranslate( (VGfloat)aAffineTransform.iM02,
+ (VGfloat)(TFloatFixPt (-iColorBufferSize.iHeight) + aAffineTransform.iM12 ) );
+ }
+ // General case: Rotate and/or scaling, translation
+ else
+ {
+ TGfxAffineTransform flipTransform = TGfxAffineTransform::GetScaleInstance( 1.0f, -1.0f );
+ flipTransform.Translate( TFloatFixPt ( 0 ), TFloatFixPt ( -iColorBufferSize.iHeight ) );
+ flipTransform.Concatenate( aAffineTransform );
+
+ VGfloat matrix[] = { (VGfloat)flipTransform.iM00, (VGfloat)flipTransform.iM10, 0,
+ (VGfloat)flipTransform.iM01, (VGfloat)flipTransform.iM11, 0,
+ (VGfloat)flipTransform.iM02, (VGfloat)flipTransform.iM12, 1 };
+ vgLoadMatrix( matrix );
+ }*/
+ TGfxAffineTransform flipTransform = TGfxAffineTransform::GetScaleInstance( 1.0f, -1.0f );
+ flipTransform.Translate( TFloatFixPt ( 0 ), TFloatFixPt ( -iColorBufferSize.iHeight ) );
+ //flipTransform.Concatenate( aAffineTransform );
+ TGfxAffineTransform flipTransformTemp = aAffineTransform;
+ flipTransformTemp.Concatenate( flipTransform );
+ flipTransform.Concatenate( flipTransformTemp );
+
+
+ VGfloat matrix[] = { (VGfloat)flipTransform.iM00, (VGfloat)flipTransform.iM10, 0,
+ (VGfloat)flipTransform.iM01, (VGfloat)flipTransform.iM11, 0,
+ (VGfloat)flipTransform.iM02, (VGfloat)flipTransform.iM12, 1 };
+ iVgRenderer->vgLoadMatrix( matrix );
+ }
+
+VGImage CGfx2dGcOpenVG::CreateVGImage( void* aBuffer, TSize aSize, TDisplayMode aDisplayMode, TBool aPreMultiplied )
+ {
+ VGImage vgImage = VGImage( -1 );
+
+ if ( aBuffer )
+ {
+ VGint stride = CFbsBitmap::ScanLineLength( aSize.iWidth, aDisplayMode );
+
+ if ( aDisplayMode == EColor64K )
+ {
+ vgImage = iVgRenderer->vgCreateImage( VG_sRGB_565, aSize.iWidth, aSize.iHeight, VG_IMAGE_QUALITY_FASTER );
+ iVgRenderer->vgImageSubData( vgImage, aBuffer, stride, VG_sRGB_565,
+ 0, 0, aSize.iWidth, aSize.iHeight );
+ }
+ else if ( aDisplayMode == EColor16MU )
+ {
+ VGImageFormat format = aPreMultiplied ? VG_sRGBA_8888_PRE :VG_sRGBA_8888;
+ vgImage = iVgRenderer->vgCreateImage( format, aSize.iWidth, aSize.iHeight, VG_IMAGE_QUALITY_FASTER );
+ iVgRenderer->vgImageSubData( vgImage, aBuffer, stride, format,
+ 0, 0, aSize.iWidth, aSize.iHeight );
+ }
+ else
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("SVGT CreateVGImage:: Color Mode not supported: %d ", aDisplayMode );
+ #endif
+ }
+ }
+
+ return vgImage;
+ }
+
+ void CGfx2dGcOpenVG::BindToImageL()
+ {
+ TUint32* buffer = NULL;
+ buffer = new (ELeave) TUint32[ iColorBufferSize.iWidth * iColorBufferSize.iHeight ] ;
+
+ iVgSurface->PrepareToBindClientBuffer();
+ //VGImage vgImage = CreateVGImage( buffer, iColorBufferSize, EColor16MU, ETrue );
+ VGImage vgImage = iVgRenderer->vgCreateImage( VG_sRGBA_8888_PRE,iColorBufferSize.iWidth, iColorBufferSize.iHeight, VG_IMAGE_QUALITY_FASTER );
+ //Clear VGImage
+ VGfloat color[4] = { 1.0f, 1.0f, 1.0f, 0.0f };
+ iVgRenderer->vgSetfv(VG_CLEAR_COLOR, 4, color);
+iVgRenderer->vgClearImage(vgImage,0,0,iColorBufferSize.iWidth,iColorBufferSize.iHeight);
+ //Clear VGImage
+ TInt error = iVgSurface->BindClientBuffer( vgImage );
+ if ( error != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("SVGT CGfx2dGcOpenVG::BindToImageL--VGISymbianBindToImageL failed: %d", error);
+ #endif
+
+ iVgRenderer->vgDestroyImage(vgImage) ;
+ // Delete color-buffer to match count with vgImage
+ delete[] buffer;
+
+ if( error == KErrNoMemory )
+ {
+ // Need to reset values at our side as OpenVG calls VGISymbianTerminate.
+ ResetContextHandle();
+ }
+
+ User::Leave(error);
+ }
+
+ iGroupOpacityBuffers.Append( buffer );
+ iGroupOpacityImages.Append( vgImage );
+
+ iVgRenderer->vgLoadIdentity();
+ }
+
+
+ void CGfx2dGcOpenVG::BindToMediaImageL(TInt aWidth, TInt aHeight)
+ {
+ TUint32* buffer = NULL;
+ buffer = new (ELeave) TUint32[ iColorBufferSize.iWidth * iColorBufferSize.iHeight ];
+
+ iVgSurface->PrepareToBindClientBuffer();
+ VGImage vgImage = CreateVGImage( buffer, iColorBufferSize, EColor16MU, ETrue );
+ VGfloat color[4] = { 1.0f, 1.0f, 1.0f, 0.0f };
+ iVgRenderer->vgSetfv(VG_CLEAR_COLOR, 4, color);
+ iVgRenderer->vgClearImage(vgImage,0,0,iColorBufferSize.iWidth,iColorBufferSize.iHeight);
+ //vgClearImage(vgImage,0,0,aWidth,aHeight);
+ TInt error = iVgSurface->BindClientBuffer( vgImage );
+ if ( error != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("SVGT CGfx2dGcOpenVG::BindToImage--VGISymbianBindToImage failed: %d", error);
+ #endif
+
+ iVgRenderer->vgDestroyImage(vgImage) ;
+ // Delete color-buffer to match count with vgImage
+ delete[] buffer;
+
+ if( error == KErrNoMemory )
+ {
+ // Need to reset values at our side as OpenVG calls VGISymbianTerminate.
+ ResetContextHandle();
+ }
+
+ User::Leave(error);
+ }
+
+ iGroupOpacityBuffers.Append( buffer );
+ iGroupOpacityImages.Append( vgImage );
+ iVgRenderer->vgLoadIdentity();
+
+ TGfxRectangle2D aClip(0,0,aWidth,aHeight);
+ iClipMain = iClip;
+ SetClip(aClip);
+ }
+
+ void CGfx2dGcOpenVG::UnbindFromImageL( TReal32 aOpacity )
+ {
+ if ( iGroupOpacityImages.Count() == 0 )
+ {
+ return;
+ }
+
+ TInt error = iVgSurface->UnBindClientBuffer();
+ if ( error != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("SVGT CGfx2dGcOpenVG::UnbindFromImage--VGISymbianUnBindImage failed: %d", error);
+ #endif
+
+ if( error == KErrNoMemory )
+ {
+ // Need to reset values at our side as OpenVG calls VGITerminate.
+ ResetContextHandle();
+ }
+ User::LeaveIfError(error);
+ }
+
+ // Need to bind to previous level image
+ // Else VGISymbianUnBindImage binds to non-image
+ if ( iGroupOpacityImages.Count() > 1 )
+ {
+ iVgSurface->PrepareToBindClientBuffer();
+ TInt error = iVgSurface->BindClientBuffer( iGroupOpacityImages[iGroupOpacityImages.Count()-2] );
+ if ( error != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("SVGT CGfx2dGcOpenVG::UnbindFromImage--VGISymbianBindToImage failed: %d", error);
+ #endif
+
+ iVgSurface->UnBindClientBuffer();
+
+ // Remove and Destroy all the previous images and buffer
+ TInt iIndex = iGroupOpacityImages.Count()-1;
+ for( ;iIndex >= 0 ; iIndex-- )
+ {
+ iVgRenderer->vgDestroyImage( iGroupOpacityImages[ iIndex ] );
+ iGroupOpacityImages.Remove( iIndex );
+ }
+
+ iIndex = iGroupOpacityBuffers.Count()-1;
+ for( ;iIndex >= 0 ; iIndex-- )
+ {
+ delete [] iGroupOpacityBuffers[ iIndex ];
+ iGroupOpacityBuffers.Remove( iIndex );
+ }
+
+ if( error == KErrNoMemory )
+ {
+ // Need to reset values at our side as OpenVG calls VGISymbianTerminate.
+ ResetContextHandle();
+ }
+
+ User::LeaveIfError(error);
+ }
+ }
+
+ // Check if default fill paint needs to be created
+ if ( iFillPaint == VG_INVALID_HANDLE )
+ {
+ iFillPaint = iVgRenderer->vgCreatePaint();
+ }
+
+ // Check if default stroke paint needs to be created
+ if ( iStrokePaint == VG_INVALID_HANDLE )
+ {
+ iStrokePaint = iVgRenderer->vgCreatePaint();
+ }
+
+ VGfloat opaquePaint[] = { 1.0f, 1.0f, 1.0f, aOpacity };
+
+ // Create paint object
+ VGPaint paint = iVgRenderer->vgCreatePaint();
+
+ if ( paint != VG_INVALID_HANDLE )
+ {
+
+ // Set solid paint of opacity
+ iVgRenderer->vgSetParameteri( paint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
+ iVgRenderer->vgSetParameterfv( paint, VG_PAINT_COLOR, 4, opaquePaint);
+ iVgRenderer->vgSetPaint( paint, VG_FILL_PATH | VG_STROKE_PATH );
+
+ // Set image mode to multiply
+ iVgRenderer->vgSeti( VG_IMAGE_MODE, VG_DRAW_IMAGE_MULTIPLY );
+
+ // Draw opacity image
+ iVgRenderer->vgSeti( VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE );
+ iVgRenderer->vgLoadIdentity();
+ iVgRenderer->vgDrawImage( iGroupOpacityImages[iGroupOpacityImages.Count()-1] );
+
+ // Reset the image draw mode
+ iVgRenderer->vgSeti( VG_IMAGE_MODE, VG_DRAW_IMAGE_NORMAL );
+
+ // Restore the fill and paint
+ if ( iFillPaint != VG_INVALID_HANDLE )
+ {
+ iVgRenderer->vgSetPaint( iFillPaint, VG_FILL_PATH );
+ }
+
+ if ( iStrokePaint != VG_INVALID_HANDLE )
+ {
+ iVgRenderer->vgSetPaint( iStrokePaint, VG_STROKE_PATH );
+ }
+
+ iVgRenderer->vgDestroyPaint( paint );
+ }
+ else
+ {
+ VGErrorCode error = (VGErrorCode)iVgRenderer->vgGetError();
+ if (error == VG_OUT_OF_MEMORY_ERROR)
+ {
+ RDebug::Printf("SVGT CGfx2dGcOpenVG::UnbindFromImage vgCreatePaint OOM");
+ // Remove and Destroy all the previous images and buffer
+ TInt iIndex = iGroupOpacityImages.Count()-1;
+ for( ;iIndex >= 0 ; iIndex-- )
+ {
+ iVgRenderer->vgDestroyImage( iGroupOpacityImages[ iIndex ] );
+ iGroupOpacityImages.Remove( iIndex );
+ }
+
+ iIndex = iGroupOpacityBuffers.Count()-1;
+ for( ;iIndex >= 0 ; iIndex-- )
+ {
+ delete [] iGroupOpacityBuffers[ iIndex ];
+ iGroupOpacityBuffers.Remove( iIndex );
+ }
+ ResetContextHandle();
+ User::Leave(KErrNoMemory);
+ }
+ #ifdef _DEBUG
+ RDebug::Printf("SVGT CGfx2dGcOpenVG::UnbindFromImage vgCreatePaint failed");
+ #endif
+ }
+
+ // Remove/Delete OpenVG Image object
+ TInt imageIndex = iGroupOpacityImages.Count() - 1;
+ if ( imageIndex >= 0 )
+ {
+ iVgRenderer->vgDestroyImage( iGroupOpacityImages[ imageIndex ] );
+ iGroupOpacityImages.Remove( imageIndex );
+ }
+
+ // Remove/Delete color-buffer
+ TInt bufferIndex = iGroupOpacityBuffers.Count() - 1;
+ if ( bufferIndex >= 0 )
+ {
+ delete [] iGroupOpacityBuffers[ bufferIndex ];
+ iGroupOpacityBuffers.Remove( bufferIndex );
+ }
+
+ }
+
+// --------------------------------------------------------------------------
+// void CGfx2dGcOpenVG::UnbindFromMediaImageL(
+// const TGfxAffineTransform& aAffineTransform,
+// TReal32 aOpacity,
+// TInt aWidth,
+// TInt aHeight )
+// ---------------------------------------------------------------------------
+void CGfx2dGcOpenVG::UnbindFromMediaImageL(
+ const TGfxAffineTransform& aAffineTransform,
+ TReal32 aOpacity,
+ TInt aWidth,
+ TInt aHeight, TInt aDraw )
+ {
+ if ( iGroupOpacityImages.Count() == 0 )
+ {
+ return;
+ }
+
+ TInt error = iVgSurface->UnBindClientBuffer();
+ if ( error != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf( "SVGT CGfx2dGcOpenVG::UnbindFromMediaImage--VGISymbianUnBindImage failed: %d", error);
+ #endif
+ if( error == KErrNoMemory )
+ {
+ // Need to reset values at our side as OpenVG calls
+ // VGITerminate.
+ ResetContextHandle();
+ }
+ User::LeaveIfError(error);
+ }
+
+ // Restore the clipping window back to main window
+ SetClip(iClipMain);
+
+ // Need to bind to previous level image
+ // Else VGISymbianUnBindImage binds to non-image
+ if ( iGroupOpacityImages.Count() > 1 )
+ {
+ iVgSurface->PrepareToBindClientBuffer();
+ TInt error = iVgSurface->BindClientBuffer( iGroupOpacityImages[iGroupOpacityImages.Count()-2] );
+ if ( error != KErrNone )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("SVGT CGfx2dGcOpenVG::UnbindFromMediaImage--VGISymbianBindToImage failed: %d", error);
+ #endif
+
+ iVgSurface->UnBindClientBuffer();
+
+ // Remove and Destroy all the previous images and buffer
+ TInt iIndex = iGroupOpacityImages.Count()-1;
+ for( ;iIndex >= 0 ; iIndex-- )
+ {
+ iVgRenderer->vgDestroyImage( iGroupOpacityImages[ iIndex ] );
+ iGroupOpacityImages.Remove( iIndex );
+ }
+
+ iIndex = iGroupOpacityBuffers.Count()-1;
+ for( ;iIndex >= 0 ; iIndex-- )
+ {
+ delete [] iGroupOpacityBuffers[ iIndex ];
+ iGroupOpacityBuffers.Remove( iIndex );
+ }
+
+ // Destroy the Previous two Opacity buffer
+ if( error == KErrNoMemory )
+ {
+ // Need to reset values at our side as OpenVG calls VGISymbianTerminate.
+ ResetContextHandle();
+ }
+
+ User::LeaveIfError(error);
+ }
+ }
+
+ // Create opaque paint
+ VGfloat opaquePaint[] = { 1.0f, 1.0f, 1.0f, aOpacity };
+
+ // Check if default fill paint needs to be created
+ if ( iFillPaint == VG_INVALID_HANDLE )
+ {
+ iFillPaint = iVgRenderer->vgCreatePaint();
+ }
+
+ // Check if default stroke paint needs to be created
+ if ( iStrokePaint == VG_INVALID_HANDLE )
+ {
+ iStrokePaint = iVgRenderer->vgCreatePaint();
+ }
+
+ // Create paint object
+ VGPaint paint = iVgRenderer->vgCreatePaint();
+
+ if ( paint != VG_INVALID_HANDLE )
+ {
+ // Set solid paint of opacity
+ iVgRenderer->vgSetParameteri( paint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
+ iVgRenderer->vgSetParameterfv( paint, VG_PAINT_COLOR, 4, opaquePaint);
+ iVgRenderer->vgSetPaint( paint, VG_FILL_PATH | VG_STROKE_PATH );
+
+ // Set image mode to normal
+ iVgRenderer->vgSeti( VG_IMAGE_MODE, VG_DRAW_IMAGE_NORMAL );
+
+ // Draw the animation element with transforms applied on the
+ // main colour buffer
+ TSize size(aWidth,aHeight);
+ ApplyTransformMediaElement(aAffineTransform,size);
+
+ // Check so that animation element is drawn only when animation has started
+ if ( aDraw == KMediaAnimationVisible )
+ {
+ iVgRenderer->vgDrawImage( iGroupOpacityImages[iGroupOpacityImages.Count()-1] );
+ }
+
+
+ // Restore the fill and paint
+ if ( iFillPaint != VG_INVALID_HANDLE )
+ {
+ iVgRenderer->vgSetPaint( iFillPaint, VG_FILL_PATH );
+ }
+
+ if ( iStrokePaint != VG_INVALID_HANDLE )
+ {
+ iVgRenderer->vgSetPaint( iStrokePaint, VG_STROKE_PATH );
+ }
+
+ iVgRenderer->vgDestroyPaint( paint );
+ }
+ else
+ {
+ VGErrorCode error = (VGErrorCode)iVgRenderer->vgGetError();
+ if (error == VG_OUT_OF_MEMORY_ERROR)
+ {
+ RDebug::Printf("SVGT CGfx2dGcOpenVG::UnbindFromMediaImage vgCreatePaint OOM");
+ // Remove and Destroy all the previous images and buffer
+ TInt iIndex = iGroupOpacityImages.Count()-1;
+ for( ;iIndex >= 0 ; iIndex-- )
+ {
+ iVgRenderer->vgDestroyImage( iGroupOpacityImages[ iIndex ] );
+ iGroupOpacityImages.Remove( iIndex );
+ }
+
+ iIndex = iGroupOpacityBuffers.Count()-1;
+ for( ;iIndex >= 0 ; iIndex-- )
+ {
+ delete [] iGroupOpacityBuffers[ iIndex ];
+ iGroupOpacityBuffers.Remove( iIndex );
+ }
+ ResetContextHandle();
+ User::Leave(KErrNoMemory);
+ }
+ #ifdef _DEBUG
+ RDebug::Printf("SVGT CGfx2dGcOpenVG::UnbindFromMediaImage vgCreatePaint failed");
+ #endif
+ }
+ // Remove/Delete OpenVG Image object
+ TInt imageIndex = iGroupOpacityImages.Count() - 1;
+ if ( imageIndex >= 0 )
+ {
+ iVgRenderer->vgDestroyImage( iGroupOpacityImages[ imageIndex ] );
+ iGroupOpacityImages.Remove( imageIndex );
+ }
+
+ // Remove/Delete color-buffer
+ TInt bufferIndex = iGroupOpacityBuffers.Count() - 1;
+ if ( bufferIndex >= 0 )
+ {
+ delete [] iGroupOpacityBuffers[ bufferIndex ];
+ iGroupOpacityBuffers.Remove( bufferIndex );
+ }
+
+ }
+// These are for work-around for OpenVG to simulate multiple contexts
+void CGfx2dGcOpenVG::SetupContextL()
+{
+ // Ensure OpenVG is initialized: could have been terminated by another Svg engine
+ // Returns immediately if already initialized
+ TInt err = iVgSurface->InitializeSurface( iColorBufferSize, VGI_COLORSPACE_SRGB );
+ if (!((err == KErrNone) || (err == KErrAlreadyExists)))
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("SVG can't initialize OpenVG Context %d", err);
+ #endif
+ iGraphicsContextCreated = EFalse;
+ User::Leave(err);
+ }
+
+ iGraphicsContextCreated = ETrue;
+ // Ensure context size is correct: could have been change by another Svg engine
+ // Returns immediately if size is the same
+
+ err = iVgSurface->ResizeSurface( iColorBufferSize );
+
+ if( err != KErrNone )
+ {
+ if(err == KErrNoMemory )
+ {
+ #ifdef _DEBUG
+ RDebug::Printf("OpenVG Context destroyed %d", err);
+ #endif //_DEBUG
+ // This indicates that OpenVG has destroyed the current context handle
+ // and also the Path, StrokePaint and FillPaint handles are no more valid.
+ // Thus reinitialize them to 0, so that they can be recreated.
+ ResetContextHandle();
+ }
+
+ #ifdef _DEBUG
+ RDebug::Printf("SVG can't RESIZE OpenVG Context %d", err);
+ #endif //_DEBUG
+ User::Leave(err);
+ }
+}
+
+void CGfx2dGcOpenVG::Flush()
+ {
+ if (iCurrentRendererType == ESVGRendererTLV)
+ {
+ iPath = VG_INVALID_HANDLE;
+ iFillPaint = VG_INVALID_HANDLE;
+ iStrokePaint = VG_INVALID_HANDLE;
+ }
+
+ iVgRenderer->vgFlush();
+ }
+/**
+* Sets the Paint,Stroke and Path handle back to VG_INVALID_HANDLE
+*
+* @since
+* @return void
+*/
+void CGfx2dGcOpenVG::ResetContextHandle()
+ {
+ iPath = VG_INVALID_HANDLE;
+ iFillPaint = VG_INVALID_HANDLE;
+ iStrokePaint = VG_INVALID_HANDLE;
+ iGraphicsContextCreated = EFalse;
+ }
+
+void CGfx2dGcOpenVG::GetMatrix(TReal32 * m)
+ {
+ //Below is the replacement for vgGetMatrix
+ TGfxAffineTransform flipTransform;
+ if ( iTransform.iTransType == KTransformTranslate )
+ {
+
+ flipTransform = TGfxAffineTransform::GetScaleInstance( 1.0f, -1.0f );//get and identity matrix and scale the x,y axis to (1,-1)
+ flipTransform.Translate((VGfloat)iTransform.iM02, (VGfloat)(TFloatFixPt (-iColorBufferSize.iHeight) + iTransform.iM12 ) );
+
+ m[0] = (VGfloat)flipTransform.iM00;
+ m[1] = (VGfloat)flipTransform.iM10;
+ m[2] = 0;
+ m[3] = (VGfloat)flipTransform.iM01;
+ m[4] = (VGfloat)flipTransform.iM11;
+ m[5] = 0;
+ m[6] = (VGfloat)flipTransform.iM02;
+ m[7] = (VGfloat)flipTransform.iM12;
+ m[8] = 1;
+
+ }
+ // General case: Rotate and/or scaling, translation
+ else
+ {
+ flipTransform = TGfxAffineTransform::GetScaleInstance( 1.0f, -1.0f );
+ flipTransform.Translate( TFloatFixPt ( 0 ), TFloatFixPt ( -iColorBufferSize.iHeight ) );
+ flipTransform.Concatenate( iTransform );
+
+ m[0] = (VGfloat)flipTransform.iM00;
+ m[1] = (VGfloat)flipTransform.iM10;
+ m[2] = 0;
+ m[3] = (VGfloat)flipTransform.iM01;
+ m[4] = (VGfloat)flipTransform.iM11;
+ m[5] = 0;
+ m[6] = (VGfloat)flipTransform.iM02;
+ m[7] = (VGfloat)flipTransform.iM12;
+ m[8] = 1;
+
+ }
+
+ }
+
+void CGfx2dGcOpenVG::SetBitmapHeader(const TDesC* aHeaderData)
+ {
+ iVgSurface->SetConfiguration(CVGSurface::BTIMAP_HEADER, aHeaderData);
+ }
+
+const TPtrC8 CGfx2dGcOpenVG::TLVEncodedData() const
+ {
+ return(iVgRenderer->TLVEncodedData());
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGc/GfxClear.s Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+ *
+*/
+
+
+@
+@ ClearAsm - Clear a contiguous block of memory Fast!
+@
+@ This function writes a contiguous block of memory very fast with a single
+@ color. The size of the block must be a multiple of 16 pixels (32 bytes).
+@
+@ r0 = Pointer to this class (not used).
+@ r1 = Address of memory block to clear.
+@ r2 = Color.
+@ r3 = Size of block to clear (in 16 pixel increments).
+
+ .align 2
+ .globl ClearAsm__8CGfx2dGcPiii
+@ .thumb_func
+@ .code 16
+
+ClearAsm__8CGfx2dGcPiii:
+ stmfd sp!, {r4-r9}
+ mov r0,r1 @ Save address and size.
+ mov r9,r3
+ orr r2,r2,r2,lsl #16 @ Replicate color pattern.
+ mov r1,r2
+ mov r3,r2
+ mov r4,r2
+ mov r5,r2
+ mov r6,r2
+ mov r7,r2
+ mov r8,r2
+loop: stmia r0!,{r1-r8}
+ subs r9,r9,#1
+ bne loop
+
+ ldmfd sp!, {r4-r9}
+ bx lr
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGc/GfxColor.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxColor.h"
+
+// --------------------------------------------------------------------------
+// TGfxColor::TGfxColor( TUint32 aValue )
+// ---------------------------------------------------------------------------
+ TGfxColor::TGfxColor( TUint32 aValue )
+ {
+ iColor = aValue;
+ }
+
+// --------------------------------------------------------------------------
+// TGfxColor::TGfxColor( TInt aRed, TInt aGreen, TInt aBlue )
+// ---------------------------------------------------------------------------
+ TGfxColor::TGfxColor( TInt aRed, TInt aGreen, TInt aBlue )
+ {
+ iColor = (aRed<<16)|(aGreen<<8)|aBlue;
+ }
+
+// --------------------------------------------------------------------------
+// TUint32 TGfxColor::FlatColor()
+// ---------------------------------------------------------------------------
+ TUint32 TGfxColor::GetColor()
+ {
+ return iColor;
+ }
+
+ TUint32 TGfxColor::GetARGB()
+ {
+ return iColor;
+ }
+
+ TUint32 TGfxColor::GetABGR()
+ {
+ return (iColor&0xFF000000) |
+ ((iColor&0x00FF0000) >> 16) |
+ (iColor&0x0000FF00) |
+ ((iColor&0x000000FF) << 16);
+ }
+
+
+
+// ==========================================================================
+// BGR888 -> RGB565 - needed for future consideration
+// ==========================================================================
+ // --------------------------------------------------------------------------
+ // TUint16 TGfxColor::ColorRgb565()
+ // ---------------------------------------------------------------------------
+ TUint16 TGfxColor::ColorRgb565()
+ {
+
+ const TInt32 KRmask = 0xf800;
+ const TInt32 KGmask = 0x07e0;
+ const TInt32 KBmask = 0x001f;
+
+ TUint32 r, g, b;
+ TUint32 val = iColor;
+ b = val << 8 & KRmask;
+ g = val >> 5 & KGmask;
+ r = val >> 19 & KBmask;
+ return ( TUint16 ) ( r | g | b );
+ }
+
+
+// --------------------------------------------------------------------------
+// TUint16 TGfxColor::ColorRgb444()
+// ---------------------------------------------------------------------------
+ TUint16 TGfxColor::ColorRgb444()
+ {
+ const TInt32 KRmask = 0x0f00;
+ const TInt32 KGmask = 0x00f0;
+ const TInt32 KBmask = 0x000f;
+
+ TUint32 r, g, b;
+ TUint32 val = iColor;
+ b = val << 4 & KRmask;
+ g = val >> 8 & KGmask;
+ r = val >> 20 & KBmask;
+ return ( TUint16 ) ( r | g | b );
+ }
+
+// --------------------------------------------------------------------------
+// TUint16 TGfxColor::ColorRgb()
+// ---------------------------------------------------------------------------
+ TUint16 TGfxColor::ColorRgb()
+ {
+ return ColorRgb444(); // For EColor4K pixel format mode.
+
+ }
+
+
+// --------------------------------------------------------------------------
+// void TGfxColor::SetFill(VGPaint aFillPaint)
+// ---------------------------------------------------------------------------
+ void TGfxColor::SetFill(VGPaint aFillPaint, TGfxRectangle2D& aBBox, TFloatFixPt aOpacity,void* aPseudo)
+ {
+ TGfxRectangle2D lBox = aBBox;
+ CVGRenderer *iVgRenderer=(CVGRenderer*) aPseudo;
+ if ( aFillPaint != VG_INVALID_HANDLE )
+ {
+ iVgRenderer->vgSetParameteri( aFillPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR );//pseudo
+ TUint32 opacity = (TInt)(aOpacity * TFloatFixPt(255.0f));
+ iVgRenderer->vgSetColor( aFillPaint, iColor << 8 | opacity);//pseudo
+ iVgRenderer->vgSetPaint( aFillPaint, VG_FILL_PATH );//pseudo
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGc/GfxGradientPaint.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,594 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+
+#include "GfxGradientPaint.h"
+#include "GfxFloatFixPt.h"
+
+static inline void svgMatrix2x3Identity(SVGMatrix2x3* m)
+ {
+ TInt i, j;
+ for (i=0; i<2; i++)
+ for (j=0; j<3; j++)
+ m->matrix[i][j] = (i == j) ? KFloatFixOne : KFloatFixZero;
+ }
+
+// ==========================================================================
+// Common Constructor
+// ==========================================================================
+// --------------------------------------------------------------------------
+// TGfxGradientPaint::TGfxGradientPaint(): iGradientUnits(KobjectBoundingBox),
+// ---------------------------------------------------------------------------
+ TGfxGradientPaint::TGfxGradientPaint(): iGradientUnits(KobjectBoundingBox),
+ iSpreadMethod(KspreadMethodPad)
+ {
+
+ svgMatrix2x3Identity(&iGradientTransform);
+
+ }
+
+ TGfxGradientPaint::~TGfxGradientPaint()
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxColor::SetFill(VGPaint aFillPaint)
+// ---------------------------------------------------------------------------
+ void TGfxGradientPaint::SetFill(VGPaint aFillPaint, TGfxRectangle2D& aBBox, TFloatFixPt aOpacity,void* Renderer)
+ {
+ TGfxRectangle2D lBox = aBBox;
+ TUint32 flatColor = GetColor();
+ TUint32 opacity = (TInt)(aOpacity * TFloatFixPt(255.0f));
+// VGuint fillColor = ((flatColor&0x000000FF)<<24) |
+// ((flatColor&0x0000FF00)<<8) |
+// ((flatColor&0x00FF0000)>>8) |
+// opacity;
+ CVGRenderer *aVgRenderer=(CVGRenderer*) Renderer;
+
+
+
+
+ aVgRenderer->vgSetParameteri( aFillPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR );
+
+ aVgRenderer->vgSetColor( aFillPaint, flatColor << 8 | opacity );
+
+ aVgRenderer->vgSetPaint( aFillPaint, VG_FILL_PATH );
+
+ }
+
+
+// ==========================================================================
+// Linear Gradient Constructor
+// ==========================================================================
+// --------------------------------------------------------------------------
+// TGfxLinearGradientPaint::TGfxLinearGradientPaint():TGfxGradientPaint(),
+// ---------------------------------------------------------------------------
+ TGfxLinearGradientPaint::TGfxLinearGradientPaint():TGfxGradientPaint(),
+ iX1(0),
+ iY1(0),
+ iX2(1),
+ iY2(0)
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxColor::SetFill(VGPaint aFillPaint)
+// ---------------------------------------------------------------------------
+
+ void TGfxLinearGradientPaint::SetFill(VGPaint aFillPaint, TGfxRectangle2D& aBBox, TFloatFixPt aOpacity,void* aPseudo)
+ {
+ const TFloatFixPt KInverse255 = TFloatFixPt( 1.0f / 255.0f );
+
+ CVGRenderer *iVgRenderer=(CVGRenderer*) aPseudo;
+ VGint colorRamp = VG_COLOR_RAMP_SPREAD_PAD; // default value
+ VGfloat offsetVal = 0.0f;
+ VGfloat rVal = 0.0f;
+ VGfloat gVal = 0.0f;
+ VGfloat bVal = 0.0f;
+
+ VGfloat fX0 = 0.0f;
+ VGfloat fY0 = 0.0f;
+ VGfloat fX1 = 0.0f;
+ VGfloat fY1 = 0.0f;
+
+ iVgRenderer->vgSeti(VG_MATRIX_MODE, VG_MATRIX_FILL_PAINT_TO_USER);
+ //vgLoadIdentity();
+
+ // need to determine the gradient units... determines how the gradient is applied.
+ if(iGradientUnits==KobjectBoundingBox)
+ {
+ /*
+ fX0 = (VGfloat)( aBBox.iX + ( aBBox.iWidth * iX1 ) );
+ fY0 = (VGfloat)( aBBox.iY + ( aBBox.iHeight* iY1 ) );
+ fX1 = (VGfloat)( aBBox.iX + ( aBBox.iWidth * iX2 ) );
+ fY1 = (VGfloat)( aBBox.iY + ( aBBox.iHeight* iY2 ) );
+ */
+ fX0 = (VGfloat)( iX1 );
+ fY0 = (VGfloat)( iY1 );
+ fX1 = (VGfloat)( iX2 );
+ fY1 = (VGfloat)( iY2 );
+
+ VGfloat gradientTrMatrix[] =
+ { svgFixedToFloat(iGradientTransform.matrix[0][0]) , svgFixedToFloat(iGradientTransform.matrix[1][0]), 0,
+ svgFixedToFloat(iGradientTransform.matrix[0][1]) , svgFixedToFloat(iGradientTransform.matrix[1][1]), 0,
+ svgFixedToFloat(iGradientTransform.matrix[0][2]) , svgFixedToFloat(iGradientTransform.matrix[1][2]), 1 };
+
+ VGfloat boundsMatrix[] =
+ { svgFixedToFloat(aBBox.iWidth.iValue) , 0, 0,
+ 0 , svgFixedToFloat(aBBox.iHeight.iValue), 0,
+ svgFixedToFloat(aBBox.iX.iValue) , svgFixedToFloat(aBBox.iY.iValue), 1 };
+
+ iVgRenderer->vgLoadMatrix(boundsMatrix);
+ iVgRenderer->vgMultMatrix(gradientTrMatrix);
+
+ }
+ else //KuserSpaceOnUse
+ {
+ fX0 = (VGfloat)iX1;
+ fY0 = (VGfloat)iY1;
+ fX1 = (VGfloat)iX2;
+ fY1 = (VGfloat)iY2;
+ VGfloat gradientMatrix[] =
+ { svgFixedToFloat(iGradientTransform.matrix[0][0]) , svgFixedToFloat(iGradientTransform.matrix[1][0]), 0,
+ svgFixedToFloat(iGradientTransform.matrix[0][1]) , svgFixedToFloat(iGradientTransform.matrix[1][1]), 0,
+ svgFixedToFloat(iGradientTransform.matrix[0][2]) , svgFixedToFloat(iGradientTransform.matrix[1][2]), 1 };
+
+ iVgRenderer->vgLoadMatrix(gradientMatrix);
+ }
+
+ // format { x0, y0, x1, y1}
+ VGfloat gradient[4] = { fX0, fY0, fX1, fY1 };
+
+ if (!iStopData)
+ return;
+
+ TInt stopCount = iStopData->Count();
+
+
+
+ //If no 'stop' elements are defined, then painting shall occur as if
+
+ //none were specified as the paint style.
+
+ if(0 == stopCount)
+ {
+ iVgRenderer->vgSetParameteri( aFillPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR );
+ VGfloat colorRGBA[] = {0.0f, 0.0f, 0.0f, 0.0f};
+ iVgRenderer->vgSetParameterfv( aFillPaint, VG_PAINT_COLOR, 4, colorRGBA);
+ iVgRenderer->vgSetPaint( aFillPaint, VG_FILL_PATH );
+ return ;
+ }
+ // If one 'stop' is defined, then painting shall occur with the solid
+ // color fill using the color defined for that gradient stop.
+ else if(1 == stopCount)
+ {
+ VGfloat colorRGBA[4];
+ TInt col,r,g,b;
+ VGfloat alpha;
+
+ col = iStopData->operator[](0).iStopColor;
+ alpha = (VGfloat)iStopData->operator[](0).iStopOpacity;
+ r = (col & 0x00ff0000)>>16;
+ g = (col & 0x0000ff00)>>8;
+ b = (col & 0x000000ff);
+
+ colorRGBA[0] = (VGfloat)(TFloatFixPt( r ) * KInverse255);
+ colorRGBA[1] = (VGfloat)(TFloatFixPt( g ) * KInverse255);
+ colorRGBA[2] = (VGfloat)(TFloatFixPt( b ) * KInverse255);
+ colorRGBA[3] = alpha * (VGfloat)aOpacity;
+
+ iVgRenderer->vgSetParameteri( aFillPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR );
+ iVgRenderer->vgSetParameterfv( aFillPaint, VG_PAINT_COLOR, 4, colorRGBA);
+ iVgRenderer->vgSetPaint( aFillPaint, VG_FILL_PATH );
+ return ;
+ }
+ else if(stopCount > 0)
+ {
+
+ // Check if X1=X2 and Y1=Y2 , then the painting shall occur with the solid
+ // color fill using the color defined in the last gradient stop.
+ if( ( iX1 == iX2 ) && ( iY1 == iY2 ) && ( iGradientUnits == KuserSpaceOnUse) )
+ {
+ VGfloat colorRGBA[4];
+ TInt col,r,g,b;
+ VGfloat alpha;
+
+ col = iStopData->operator[]( stopCount - 1 ).iStopColor;
+ alpha = (VGfloat)iStopData->operator[]( stopCount - 1 ).iStopOpacity;
+ r = (col & 0x00ff0000)>>16;
+ g = (col & 0x0000ff00)>>8;
+ b = (col & 0x000000ff);
+
+ colorRGBA[0] = (VGfloat)(TFloatFixPt( r ) * KInverse255);
+ colorRGBA[1] = (VGfloat)(TFloatFixPt( g ) * KInverse255);
+ colorRGBA[2] = (VGfloat)(TFloatFixPt( b ) * KInverse255);
+ colorRGBA[3] = alpha * (VGfloat)aOpacity;
+
+ iVgRenderer->vgSetParameteri( aFillPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR );
+ iVgRenderer->vgSetParameterfv( aFillPaint, VG_PAINT_COLOR, 4, colorRGBA);
+ iVgRenderer->vgSetPaint( aFillPaint, VG_FILL_PATH );
+ return ;
+ }
+ // Using non-ELeave version and checking for NULL to avoid (ELeave) and TRAP
+ VGfloat *stops = new VGfloat [(stopCount+2)*5];
+ if ( !stops )
+ {
+ return;
+ }
+
+ VGfloat *lclStop = stops;
+
+ TInt i=0;
+
+ TInt col,r,g,b;
+ VGfloat alpha = 0.0f;
+ TInt additionalStopsAdded = 0;
+
+ if( iStopData->operator[](0).iOffset != TFloatFixPt(0) )
+ {
+ //if the first stop didn't have an offset == 0 then we need to force a zero on it
+ //for safety in OpenVG and VGR
+ *lclStop++ = 0.0f;
+ col = iStopData->operator[](0).iStopColor;
+ alpha = (VGfloat)iStopData->operator[](0).iStopOpacity;
+ r = (col & 0x00ff0000)>>16;
+ g = (col & 0x0000ff00)>>8;
+ b = (col & 0x000000ff);
+
+ rVal = (VGfloat)(TFloatFixPt( r ) * KInverse255);
+ *lclStop++ = rVal;
+
+ gVal = (VGfloat)(TFloatFixPt( g ) * KInverse255);
+ *lclStop++ = gVal;
+
+ bVal = (VGfloat)(TFloatFixPt( b ) * KInverse255);
+ *lclStop++ = bVal;
+
+ *lclStop++ = alpha * (VGfloat)aOpacity;
+ additionalStopsAdded++;
+ }
+
+ for( ; i < stopCount; i++)
+ {
+ offsetVal = (VGfloat)(iStopData->operator[](i).iOffset);
+ *lclStop++ = offsetVal;
+
+ col = iStopData->operator[](i).iStopColor;
+ alpha = (VGfloat)iStopData->operator[](i).iStopOpacity;
+ r = (col & 0x00ff0000)>>16;
+ g = (col & 0x0000ff00)>>8;
+ b = (col & 0x000000ff);
+
+ rVal = (VGfloat)(TFloatFixPt( r ) * KInverse255);
+ *lclStop++ = rVal;
+
+ gVal = (VGfloat)(TFloatFixPt( g ) * KInverse255);
+ *lclStop++ = gVal;
+
+ bVal = (VGfloat)(TFloatFixPt( b ) * KInverse255);
+ *lclStop++ = bVal;
+
+ *lclStop++ = alpha * (VGfloat)aOpacity;
+ }
+
+ if (offsetVal != 1.0f)
+ {
+ //if the last stop didn't have an offset == 1 then we need to force one on it
+ //for safety in OpenVG and VGR
+ *lclStop++ = 1.0f;
+ col = iStopData->operator[](i-1).iStopColor;
+ r = (col & 0x00ff0000)>>16;
+ g = (col & 0x0000ff00)>>8;
+ b = (col & 0x000000ff);
+
+ rVal = (VGfloat)(TFloatFixPt( r ) * KInverse255);
+ *lclStop++ = rVal;
+
+ gVal = (VGfloat)(TFloatFixPt( g ) * KInverse255);
+ *lclStop++ = gVal;
+
+ bVal = (VGfloat)(TFloatFixPt( b ) * KInverse255);
+ *lclStop++ = bVal;
+
+ *lclStop++ = alpha * (VGfloat)aOpacity;
+ additionalStopsAdded++;
+ }
+
+ iVgRenderer->vgSetParameterfv( aFillPaint, VG_PAINT_COLOR_RAMP_STOPS, (stopCount+additionalStopsAdded)*5, stops );
+ delete [] stops;
+ }
+
+ iVgRenderer->vgSetParameteri( aFillPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_LINEAR_GRADIENT );
+
+ if(iSpreadMethod==KspreadMethodReflect)
+ {
+ colorRamp = VG_COLOR_RAMP_SPREAD_REFLECT;
+ }
+ else if(iSpreadMethod==KspreadMethodRepeat)
+ {
+ colorRamp = VG_COLOR_RAMP_SPREAD_REPEAT;
+ }
+
+
+
+
+ iVgRenderer->vgSetParameteri( aFillPaint, VG_PAINT_COLOR_RAMP_SPREAD_MODE, colorRamp );
+ iVgRenderer->vgSetParameterfv( aFillPaint, VG_PAINT_LINEAR_GRADIENT, 4, gradient);
+ iVgRenderer->vgSetPaint( aFillPaint, VG_FILL_PATH );
+ }
+
+// ==========================================================================
+// Radial Gradient Constructor
+// ==========================================================================
+// --------------------------------------------------------------------------
+// TGfxRadialGradientPaint::TGfxRadialGradientPaint():TGfxGradientPaint(),
+// ---------------------------------------------------------------------------
+ TGfxRadialGradientPaint::TGfxRadialGradientPaint():TGfxGradientPaint(),
+ iCx(TReal32(0.5)),
+ iCy(TReal32(0.5)),
+ iR(TReal32(0.5)),
+ iFx( KMAXFLOATFIX ),
+ iFy( KMAXFLOATFIX )
+
+// iFx(0x7fff),
+// iFy(0x7fff)
+// iFx(1e38),
+// iFy(1e38)
+
+ {
+ }
+
+
+
+// --------------------------------------------------------------------------
+// void TGfxColor::SetFill(VGPaint aFillPaint)
+// ---------------------------------------------------------------------------
+
+ void TGfxRadialGradientPaint::SetFill(VGPaint aFillPaint, TGfxRectangle2D& aBBox, TFloatFixPt aOpacity,void* aPseudo)
+ {
+ const TFloatFixPt KInverse255 = TFloatFixPt( 1.0f / 255.0f );
+ CVGRenderer *iVgRenderer=(CVGRenderer*) aPseudo;
+ VGint colorRamp = VG_COLOR_RAMP_SPREAD_PAD; // default value
+
+ //TGfxRectangle2D lBox = aBBox;
+ TFloatFixPt invalid(KMAXFLOATFIX);
+ VGfloat offsetVal = 0.0f;
+ VGfloat rVal = 0.0f;
+ VGfloat gVal = 0.0f;
+ VGfloat bVal = 0.0f;
+ VGfloat fCx = 0.0f;
+ VGfloat fCy = 0.0f;
+ VGfloat fR = 0.0f;
+ VGfloat fFx = 0.0f;
+ VGfloat fFy = 0.0f;
+
+
+ iVgRenderer->vgSeti(VG_MATRIX_MODE, VG_MATRIX_FILL_PAINT_TO_USER);
+ //vgLoadIdentity();
+
+ if(iGradientUnits==KobjectBoundingBox)
+ {
+ fCx = (VGfloat)iCx;
+ fCy = (VGfloat)iCy;
+
+ fR = (VGfloat)iR;
+
+ fFx = (VGfloat)iFx;
+ if(iFx == invalid)
+ fFx = fCx; //Fx was not set
+ else
+ fFx = (VGfloat)iFx;
+
+ fFy = (VGfloat)iFy;
+ if(iFy == invalid)
+ fFy = fCy; //Fy was not set
+ else
+ fFy = (VGfloat)iFy;
+ VGfloat gradientTrMatrix[] =
+ { svgFixedToFloat(iGradientTransform.matrix[0][0]) , svgFixedToFloat(iGradientTransform.matrix[1][0]), 0,
+ svgFixedToFloat(iGradientTransform.matrix[0][1]) , svgFixedToFloat(iGradientTransform.matrix[1][1]), 0,
+ svgFixedToFloat(iGradientTransform.matrix[0][2]) , svgFixedToFloat(iGradientTransform.matrix[1][2]), 1 };
+
+ VGfloat boundsMatrix[] =
+ { svgFixedToFloat(aBBox.iWidth.iValue) , 0, 0,
+ 0 , svgFixedToFloat(aBBox.iHeight.iValue), 0,
+ svgFixedToFloat(aBBox.iX.iValue) , svgFixedToFloat(aBBox.iY.iValue), 1 };
+
+ iVgRenderer->vgLoadMatrix(boundsMatrix);
+ iVgRenderer->vgMultMatrix(gradientTrMatrix);
+
+ }
+ else //if(iGradientUnits==KuserSpaceOnUse)
+ {
+ // values are user defined coordinates
+ fCx = (VGfloat)iCx;
+ fCy = (VGfloat)iCy;
+
+ fR = (VGfloat)iR;
+
+ fFx = (VGfloat)iFx;
+ if(iFx == invalid)
+ fFx = fCx; //Fx was not set
+ else
+ fFx = (VGfloat)iFx;
+
+ fFy = (VGfloat)iFy;
+ if(iFy == invalid)
+ fFy = fCy; //Fy was not set
+ else
+ fFy = (VGfloat)iFy;
+
+ VGfloat gradientMatrix[] =
+ { svgFixedToFloat(iGradientTransform.matrix[0][0]) , svgFixedToFloat(iGradientTransform.matrix[1][0]), 0,
+ svgFixedToFloat(iGradientTransform.matrix[0][1]) , svgFixedToFloat(iGradientTransform.matrix[1][1]), 0,
+ svgFixedToFloat(iGradientTransform.matrix[0][2]) , svgFixedToFloat(iGradientTransform.matrix[1][2]), 1 };
+ iVgRenderer->vgLoadMatrix(gradientMatrix);
+ }
+
+ // format { cx, cy, fx, fy, r}
+ VGfloat gradient[5] = { fCx, fCy, fFx, fFy, fR};
+
+ if (!iStopData)
+ return;
+
+
+
+
+ TInt stopCount = iStopData->Count();
+
+ //If no 'stop' elements are defined, then painting shall occur as if
+ //none were specified as the paint style.
+ if(0 == stopCount)
+ {
+ iVgRenderer->vgSetParameteri( aFillPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR );
+ VGfloat colorRGBA[] = {0.0f, 0.0f, 0.0f, 0.0f};
+ iVgRenderer->vgSetParameterfv( aFillPaint, VG_PAINT_COLOR, 4, colorRGBA);
+ iVgRenderer->vgSetPaint( aFillPaint, VG_FILL_PATH );
+ return ;
+ }
+ // If one 'stop' is defined, then painting shall occur with the solid
+ // color fill using the color defined for that gradient stop.
+ else if(1 == stopCount)
+ {
+ VGfloat colorRGBA[4];
+ TInt col,r,g,b;
+ VGfloat alpha=0.0f;
+
+ col = iStopData->operator[](0).iStopColor;
+ alpha = (VGfloat)iStopData->operator[](0).iStopOpacity;
+ r = (col & 0x00ff0000)>>16;
+ g = (col & 0x0000ff00)>>8;
+ b = (col & 0x000000ff);
+
+ colorRGBA[0] = (VGfloat)(TFloatFixPt( r ) * KInverse255);
+ colorRGBA[1] = (VGfloat)(TFloatFixPt( g ) * KInverse255);
+ colorRGBA[2] = (VGfloat)(TFloatFixPt( b ) * KInverse255);
+ colorRGBA[3] = alpha * (VGfloat)aOpacity;
+
+ iVgRenderer->vgSetParameteri( aFillPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR );
+ iVgRenderer->vgSetParameterfv( aFillPaint, VG_PAINT_COLOR, 4, colorRGBA);
+ iVgRenderer->vgSetPaint( aFillPaint, VG_FILL_PATH );
+ return ;
+ }
+ else if(stopCount > 0)
+ {
+ // Using non-ELeave version and checking for NULL to avoid (ELeave) and TRAP
+ VGfloat *stops = new VGfloat [(stopCount+2)*5];
+ if ( !stops )
+ {
+ return;
+ }
+
+ VGfloat *lclStop = stops;
+
+ TInt i=0;
+ TInt col,r,g,b;
+ VGfloat alpha;
+ TInt additionalStopsAdded = 0;
+
+ if( iStopData->operator[](0).iOffset != TFloatFixPt(0) )
+ {
+ //if the first stop didn't have an offset == 0 then we need to force a zero on it
+ //for safety in OpenVG and VGR
+ *lclStop++ = 0.0f;
+ col = iStopData->operator[](0).iStopColor;
+ alpha = (VGfloat)iStopData->operator[](0).iStopOpacity;
+ r = (col & 0x00ff0000)>>16;
+ g = (col & 0x0000ff00)>>8;
+ b = (col & 0x000000ff);
+
+ rVal = (VGfloat)(TFloatFixPt( r ) * KInverse255);
+ *lclStop++ = rVal;
+
+ gVal = (VGfloat)(TFloatFixPt( g )* KInverse255);
+ *lclStop++ = gVal;
+
+ bVal = (VGfloat)(TFloatFixPt( b ) * KInverse255);
+ *lclStop++ = bVal;
+
+ *lclStop++ = alpha * (VGfloat)aOpacity;
+ additionalStopsAdded++;
+
+ }
+ for( ; i < stopCount; i++)
+ {
+ offsetVal = (VGfloat)(iStopData->operator[](i).iOffset);
+ *lclStop++ = offsetVal;
+
+ col = iStopData->operator[](i).iStopColor;
+ alpha = (VGfloat)iStopData->operator[](i).iStopOpacity;
+ r = (col & 0x00ff0000)>>16;
+ g = (col & 0x0000ff00)>>8;
+ b = (col & 0x000000ff);
+
+ rVal = (VGfloat)(TFloatFixPt( r ) * KInverse255);
+ *lclStop++ = rVal;
+
+ gVal = (VGfloat)(TFloatFixPt( g ) * KInverse255);
+ *lclStop++ = gVal;
+
+ bVal = (VGfloat)(TFloatFixPt( b ) * KInverse255);
+ *lclStop++ = bVal;
+
+ *lclStop++ = alpha * (VGfloat)aOpacity;
+ }
+
+ if (offsetVal != 1.0f)
+ {
+ //if the last stop didn't have an offset == 1 then we need to force one on it
+ //for safety in OpenVG and VGR
+ *lclStop++ = 1.0f;
+ col = iStopData->operator[](i-1).iStopColor;
+ alpha = (VGfloat)iStopData->operator[](i-1).iStopOpacity;
+ r = (col & 0x00ff0000)>>16;
+ g = (col & 0x0000ff00)>>8;
+ b = (col & 0x000000ff);
+
+ rVal = (VGfloat)(TFloatFixPt( r ) * KInverse255);
+ *lclStop++ = rVal;
+
+ gVal = (VGfloat)(TFloatFixPt( g ) * KInverse255);
+ *lclStop++ = gVal;
+
+ bVal = (VGfloat)(TFloatFixPt( b ) * KInverse255);
+ *lclStop++ = bVal;
+
+ *lclStop++ = alpha * (VGfloat)aOpacity;
+ additionalStopsAdded++;
+ }
+
+ iVgRenderer->vgSetParameterfv( aFillPaint, VG_PAINT_COLOR_RAMP_STOPS, (stopCount+additionalStopsAdded)*5, stops );
+ delete [] stops;
+ }
+
+ iVgRenderer->vgSetParameteri( aFillPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_RADIAL_GRADIENT );
+
+ if(iSpreadMethod==KspreadMethodReflect)
+ {
+ colorRamp = VG_COLOR_RAMP_SPREAD_REFLECT;
+ }
+ else if(iSpreadMethod==KspreadMethodRepeat)
+ {
+ colorRamp = VG_COLOR_RAMP_SPREAD_REPEAT;
+ }
+
+
+ iVgRenderer->vgSetParameteri( aFillPaint, VG_PAINT_COLOR_RAMP_SPREAD_MODE, colorRamp );
+ iVgRenderer->vgSetParameterfv( aFillPaint, VG_PAINT_RADIAL_GRADIENT, 5, gradient);
+ iVgRenderer->vgSetPaint( aFillPaint, VG_FILL_PATH );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGc/GfxRenderingHints.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxRenderingHints.h"
+
+
+const TUint32 KCurveQualityMask = 0x00000007; // bit 0-2
+const TUint32 KVisibilityMask = 0x00000008; // bit 3
+const TUint32 KFontEngineMask = 0x00000010; // bit 4
+
+
+// --------------------------------------------------------------------------
+// TGfxRenderingHints::TGfxRenderingHints()
+// ---------------------------------------------------------------------------
+ TGfxRenderingHints::TGfxRenderingHints()
+ {
+ iHintBits = KVisibilityMask; // Default visibility = visible
+ iHintBits |= ( KCurveQualityMask & 2 ); // Default Flattening level = 2
+
+ // Notes:
+ // KFontEngineMask bitp is 0 -> use scalable font as default
+ }
+
+
+// ==========================================================================
+// Visibility
+// ==========================================================================
+// --------------------------------------------------------------------------
+// void TGfxRenderingHints::SetVisibility( TBool aVisibility )
+// ---------------------------------------------------------------------------
+ void TGfxRenderingHints::SetVisibility( TBool aVisibility )
+ {
+ if ( aVisibility )
+ {
+ iHintBits |= KVisibilityMask;
+ }
+ else
+ {
+ iHintBits &= ~KVisibilityMask;
+ }
+ }
+
+// --------------------------------------------------------------------------
+// TBool TGfxRenderingHints::Visibility()
+// ---------------------------------------------------------------------------
+ TBool TGfxRenderingHints::Visibility()
+ {
+ return ( ( iHintBits & KVisibilityMask ) != 0 );
+ }
+
+// ==========================================================================
+// Curve quality
+// ==========================================================================
+// --------------------------------------------------------------------------
+// void TGfxRenderingHints::SetCurveQuality( TInt aCurveQuality )
+// ---------------------------------------------------------------------------
+ void TGfxRenderingHints::SetCurveQuality( TInt aCurveQuality )
+ {
+ iHintBits &= ~KCurveQualityMask; // clear
+ iHintBits |= ( KCurveQualityMask & aCurveQuality ); // set
+ }
+
+// --------------------------------------------------------------------------
+// TInt TGfxRenderingHints::CurveQuality()
+// ---------------------------------------------------------------------------
+ TInt TGfxRenderingHints::CurveQuality()
+ {
+ return ( iHintBits & KCurveQualityMask );
+ }
+
+// ==========================================================================
+// switch rendering engine (Open Font system/bitmap font)
+// ==========================================================================
+// --------------------------------------------------------------------------
+// void TGfxRenderingHints::SetFastFontRendering( TBool aFastFontRendering )
+// ---------------------------------------------------------------------------
+ void TGfxRenderingHints::SetFastFontRendering( TBool aFastFontRendering )
+ {
+ if ( aFastFontRendering )
+ {
+ iHintBits |= KFontEngineMask;
+ }
+ else
+ {
+ iHintBits &= ~KFontEngineMask;
+ }
+ }
+
+// --------------------------------------------------------------------------
+// TBool TGfxRenderingHints::FastFontRendering()
+// ---------------------------------------------------------------------------
+ TBool TGfxRenderingHints::FastFontRendering()
+ {
+ return ( ( iHintBits & KFontEngineMask ) != 0 );
+ }
+
+
+// --------------------------------------------------------------------------
+// void TGfxRenderingHints::SetShapeAntiAliasing( TBool /* aShapeAntiAliasing */ )
+// ---------------------------------------------------------------------------
+ void TGfxRenderingHints::SetShapeAntiAliasing( TBool /* aShapeAntiAliasing */ )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// TBool TGfxRenderingHints::ShapeAntiAliasing()
+// ---------------------------------------------------------------------------
+ TBool TGfxRenderingHints::ShapeAntiAliasing()
+ {
+ return EFalse;
+ }
+
+// --------------------------------------------------------------------------
+// TGfxImageInterpolation TGfxRenderingHints::ImageInterpolation()
+// ---------------------------------------------------------------------------
+ TGfxImageInterpolation TGfxRenderingHints::ImageInterpolation()
+ {
+ return EGfxInterpolationNearestNeighbor;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGc/GfxStroke.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxStroke.h"
+#include "GfxGeneralPath.h"
+
+// --------------------------------------------------------------------------
+// TGfxStroke::TGfxStroke()
+// ---------------------------------------------------------------------------
+ TGfxStroke::TGfxStroke()
+ {
+ SetVars( 1, EGfxJoinMiter, EGfxCapButt, TFloatFixPt( 4 ) );
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxStroke::SetStrokeWidth( TFloatFixPt aWidth )
+// ---------------------------------------------------------------------------
+ void TGfxStroke::SetStrokeWidth( TFloatFixPt aWidth )
+ {
+ iStrokeWidth = aWidth;
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxStroke::SetMiterLimit( TFixPt aMiterLimit )
+// ---------------------------------------------------------------------------
+ void TGfxStroke::SetMiterLimit( TFloatFixPt aMiterLimit )
+ {
+ iMiterLimit = aMiterLimit;
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxStroke::SetJoinType( TGfxJoinType aJoin )
+// ---------------------------------------------------------------------------
+ void TGfxStroke::SetJoinType( TGfxJoinType aJoin )
+ {
+ iJoin = aJoin;
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxStroke::SetCapType( TGfxCapType aCap )
+// ---------------------------------------------------------------------------
+ void TGfxStroke::SetCapType( TGfxCapType aCap )
+ {
+ iCap = aCap;
+ }
+
+// --------------------------------------------------------------------------
+// TFloatFixPt TGfxStroke::StrokeWidth()
+// ---------------------------------------------------------------------------
+ TFloatFixPt TGfxStroke::StrokeWidth()
+ {
+ return iStrokeWidth;
+ }
+
+// --------------------------------------------------------------------------
+// TGfxJoinType TGfxStroke::StrokeJoin()
+// ---------------------------------------------------------------------------
+ TGfxJoinType TGfxStroke::StrokeJoin()
+ {
+ return iJoin;
+ }
+
+// --------------------------------------------------------------------------
+// TGfxCapType TGfxStroke::StrokeCap()
+// ---------------------------------------------------------------------------
+ TGfxCapType TGfxStroke::StrokeCap()
+ {
+ return iCap;
+ }
+
+// --------------------------------------------------------------------------
+// TFloatFixPt TGfxStroke::StrokeMiterLimit()
+// ---------------------------------------------------------------------------
+ TFloatFixPt TGfxStroke::StrokeMiterLimit()
+ {
+ return iMiterLimit;
+ }
+
+// --------------------------------------------------------------------------
+// TGfxStroke::TGfxStroke( TFloatFixPt aStrokeWidth )
+// ---------------------------------------------------------------------------
+ TGfxStroke::TGfxStroke( TFloatFixPt aStrokeWidth )
+ {
+ SetVars( aStrokeWidth, EGfxJoinMiter, EGfxCapButt, TFloatFixPt( 4 ) );
+ }
+
+// --------------------------------------------------------------------------
+// TGfxStroke::TGfxStroke( TFloatFixPt aStrokeWidth,
+// ---------------------------------------------------------------------------
+ TGfxStroke::TGfxStroke( TFloatFixPt aStrokeWidth,
+ TGfxJoinType aJoin,
+ TGfxCapType aCap,
+ TFloatFixPt& aMiterLimit )
+ {
+ SetVars( aStrokeWidth, aJoin, aCap, aMiterLimit );
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxStroke::SetVars( TFloatFixPt aStrokeWidth,
+// ---------------------------------------------------------------------------
+void TGfxStroke::SetVars( TFloatFixPt aStrokeWidth,
+ TGfxJoinType aJoin,
+ TGfxCapType aCap,
+ const TFloatFixPt& aMiterLimit )
+ {
+ iStrokeWidth = aStrokeWidth;
+ iJoin = aJoin;
+ iCap = aCap;
+ iMiterLimit = aMiterLimit;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGeom/GfxAffineTransform.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,733 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxAffineTransform.h"
+
+#include "GfxGeneralPath.h"
+#include "Gfxtrignometric.h"
+
+#include "e32debug.h"
+
+// ==========================================================================
+// Notes:
+//
+// [ x'] [ m00 m01 m02 ] [ x ] [ m00x + m01y + m02 ]
+// [ y'] = [ m10 m11 m12 ] [ y ] = [ m10x + m11y + m12 ]
+// [ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ]
+//
+// ==========================================================================
+
+// ==========================================================================
+// Constructor
+// ==========================================================================
+// --------------------------------------------------------------------------
+// TGfxAffineTransform::TGfxAffineTransform()
+// ---------------------------------------------------------------------------
+ TGfxAffineTransform::TGfxAffineTransform()
+ :iM00(KFloatFixOne),
+ iM10(KFloatFixZero),
+ iM01(KFloatFixZero),
+ iM11(KFloatFixOne),
+ iM02(KFloatFixZero),
+ iM12(KFloatFixZero)
+ {
+ iTransType = KTransformIdentity;
+ }
+
+
+// ==========================================================================
+// Constructor with elements
+// ==========================================================================
+// --------------------------------------------------------------------------
+// TGfxAffineTransform::TGfxAffineTransform( TReal32 aM00,
+// ---------------------------------------------------------------------------
+ TGfxAffineTransform::TGfxAffineTransform( TReal32 aM00,
+ TReal32 aM10,
+ TReal32 aM01,
+ TReal32 aM11,
+ TReal32 aM02,
+ TReal32 aM12 )
+ {
+ SetTransform( aM00, aM10, aM01, aM11, aM02, aM12 );
+ }
+
+// --------------------------------------------------------------------------
+// TGfxAffineTransform::TGfxAffineTransform( TReal32 aM00,
+// ---------------------------------------------------------------------------
+TGfxAffineTransform::TGfxAffineTransform( TReal32 aM00,
+ TReal32 aM10,
+ TReal32 aM01,
+ TReal32 aM11,
+ TReal32 aM02,
+ TReal32 aM12,
+ TGfxTransformType aType )
+ :iM00(aM00),
+ iM10(aM10),
+ iM01(aM01),
+ iM11(aM11),
+ iM02(aM02),
+ iM12(aM12)
+ {
+ iTransType = aType;
+ }
+
+// ==========================================================================
+// Generally used instance creation: Rotation matrix
+// ==========================================================================
+// --------------------------------------------------------------------------
+// TGfxAffineTransform TGfxAffineTransform::GetRotateInstance( TReal32 aTheta )
+// ---------------------------------------------------------------------------
+ TGfxAffineTransform TGfxAffineTransform::GetRotateInstance( TReal32 aTheta )
+ {
+ TGfxAffineTransform tmp;
+ tmp.SetToRotate( aTheta );
+ return tmp;
+ }
+
+// ==========================================================================
+// Generally used instance creation: another Rotation matrix
+// ==========================================================================
+// --------------------------------------------------------------------------
+// TGfxAffineTransform TGfxAffineTransform::GetRotateInstance( TReal32 aTheta,
+// ---------------------------------------------------------------------------
+ TGfxAffineTransform TGfxAffineTransform::GetRotateInstance( TReal32 aTheta,
+ const TFloatFixPt& aX,
+ const TFloatFixPt& aY )
+ {
+ TGfxAffineTransform tmp;
+ tmp.SetToRotate( aTheta );
+
+ TFloatFixPt x = aX;
+ TFloatFixPt y = aY;
+ TFloatFixPt KOne( KFloatFixOne );
+ tmp.iM02 = x * ( KOne - tmp.iM00 ) + y * tmp.iM10;
+ tmp.iM12 = y * ( KOne - tmp.iM00 ) - x * tmp.iM10;
+ tmp.iTransType |= KTransformTranslate;
+ return tmp;
+ }
+
+// ==========================================================================
+// Added Zoom Instance for better calculation
+// ==========================================================================
+// --------------------------------------------------------------------------
+// TGfxAffineTransform TGfxAffineTransform::GetZoomInstance( sf,ax,ay);
+// ---------------------------------------------------------------------------
+ TGfxAffineTransform TGfxAffineTransform::GetZoomInstance( TReal32 aScaleFactor,
+ const TFloatFixPt& aX,
+ const TFloatFixPt& aY )
+ {
+ TFloatFixPt KOne( KFloatFixOne );
+ TGfxAffineTransform tmp;
+ tmp.iM00 = aScaleFactor;
+ tmp.iM11 = aScaleFactor;
+
+ TMatrixElType x = ( TMatrixElType ) aX;
+ TMatrixElType y = ( TMatrixElType ) aY;
+ tmp.iM02 = x * ( KOne - tmp.iM00 );
+ tmp.iM12 = y * ( KOne - tmp.iM11 );
+ tmp.iTransType |= KTransformTranslate | KTransformScale;
+ return tmp;
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxAffineTransform::SetToRotate( TReal32 aTheta )
+// ---------------------------------------------------------------------------
+void TGfxAffineTransform::SetToRotate( TReal32 aTheta )
+ {
+ TFloatFixPt KZero;
+ #ifdef SVG_FLOAT_BUILD
+ TFloatFixPt cs = TFloatFixPt::CosFloatDouble( aTheta ); //(GfxMath::svgScalarCos((TInt32)(aTheta * TReal(0x10000))));
+ TFloatFixPt sn = TFloatFixPt::SinFloatDouble( aTheta ); //(GfxMath::svgScalarSin((TInt32)(aTheta * TReal(0x10000))));
+ #else
+ TFloatFixPt cs (GfxMath::svgScalarCos((TInt32)(aTheta * TReal(0x10000))), ETrue);
+ TFloatFixPt sn (GfxMath::svgScalarSin((TInt32)(aTheta * TReal(0x10000))), ETrue);
+ #endif
+ iM00 = cs;
+ iM10 = sn;
+ iM01 = KZero - sn;
+ iM11 = cs;
+
+ iM02 = KZero;
+ iM12 = KZero;
+ iTransType = KTransformShear | KTransformScale;
+ }
+
+// ==========================================================================
+// Generally used instance creation: Scale matrix
+// ==========================================================================
+// --------------------------------------------------------------------------
+// TGfxAffineTransform TGfxAffineTransform::GetScaleInstance( TReal32 aSx,
+// ---------------------------------------------------------------------------
+ TGfxAffineTransform TGfxAffineTransform::GetScaleInstance( TReal32 aSx,
+ TReal32 aSy )
+ {
+ return TGfxAffineTransform( ( TReal32 ) aSx,
+ 0.0f,
+ 0.0f,
+ ( TReal32 ) aSy,
+ 0.0f,
+ 0.0f,
+ KTransformScale );
+ }
+
+// ==========================================================================
+// Generally used instance creation: Shear matrix
+// ==========================================================================
+// --------------------------------------------------------------------------
+// TGfxAffineTransform TGfxAffineTransform::GetShearInstance( TReal32 aShx,
+// ---------------------------------------------------------------------------
+ TGfxAffineTransform TGfxAffineTransform::GetShearInstance( TReal32 aShx,
+ TReal32 aShy )
+ {
+ #ifdef SVG_FLOAT_BUILD
+ TFloatFixPt tnshx = TFloatFixPt::TanFloatDouble( aShx ); //(GfxMath::svgScalarTan(TInt(aShx*0x10000)));
+ TFloatFixPt tnshy = TFloatFixPt::TanFloatDouble( aShy ); //(GfxMath::svgScalarTan(TInt(aShy*0x10000)));
+ #else
+ TFloatFixPt tnshx(GfxMath::svgScalarTan(TInt(aShx*0x10000)), ETrue);
+ TFloatFixPt tnshy(GfxMath::svgScalarTan(TInt(aShy*0x10000)), ETrue);
+ #endif
+
+ return TGfxAffineTransform( 1.0f,
+ TReal32(tnshy),
+ TReal32(tnshx),
+ 1.0f,
+ 0.0f,
+ 0.0f,
+ KTransformShear );
+ }
+
+
+// ==========================================================================
+// Generally used instance creation: Translate matrix
+// ==========================================================================
+// --------------------------------------------------------------------------
+// TGfxAffineTransform TGfxAffineTransform::GetTranslateInstance( const TFixPt& aTx,
+// ---------------------------------------------------------------------------
+ TGfxAffineTransform TGfxAffineTransform::GetTranslateInstance( const TFloatFixPt& aTx,
+ const TFloatFixPt& aTy )
+ {
+ return TGfxAffineTransform( 1.0f,
+ 0.0f,
+ 0.0f,
+ 1.0f,
+ ( TReal32 ) aTx,
+ ( TReal32 ) aTy,
+ KTransformTranslate );
+ }
+
+// --------------------------------------------------------------------------
+// TReal32 TGfxAffineTransform::Determinant() const
+// ---------------------------------------------------------------------------
+ TReal32 TGfxAffineTransform::Determinant() const
+ {
+ return iM00 * iM11 - iM10 * iM01;
+ }
+
+// --------------------------------------------------------------------------
+// TBool TGfxAffineTransform::IsIdentity() const
+// ---------------------------------------------------------------------------
+ TBool TGfxAffineTransform::IsIdentity() const
+ {
+ return ( (int)iTransType == KTransformIdentity );
+ }
+
+// --------------------------------------------------------------------------
+// TReal32 TGfxAffineTransform::ScaleX() const
+// ---------------------------------------------------------------------------
+ TReal32 TGfxAffineTransform::ScaleX() const
+ {
+ return iM00;
+ }
+
+// --------------------------------------------------------------------------
+// TReal32 TGfxAffineTransform::ScaleY() const
+// ---------------------------------------------------------------------------
+ TReal32 TGfxAffineTransform::ScaleY() const
+ {
+ return iM11;
+ }
+
+// --------------------------------------------------------------------------
+// TReal32 TGfxAffineTransform::ShearX() const
+// ---------------------------------------------------------------------------
+ TReal32 TGfxAffineTransform::ShearX() const
+ {
+ return iM01;
+ }
+
+// --------------------------------------------------------------------------
+// TReal32 TGfxAffineTransform::ShearY() const
+// ---------------------------------------------------------------------------
+ TReal32 TGfxAffineTransform::ShearY() const
+ {
+ return iM10;
+ }
+
+// --------------------------------------------------------------------------
+// TReal32 TGfxAffineTransform::TranslateX() const
+// ---------------------------------------------------------------------------
+ TReal32 TGfxAffineTransform::TranslateX() const
+ {
+ return iM02;
+ }
+
+// --------------------------------------------------------------------------
+// TReal32 TGfxAffineTransform::TranslateY() const
+// ---------------------------------------------------------------------------
+ TReal32 TGfxAffineTransform::TranslateY() const
+ {
+ return iM12;
+ }
+
+
+// --------------------------------------------------------------------------
+// void TGfxAffineTransform::Concatenate( const TGfxAffineTransform& aTransform )
+// ---------------------------------------------------------------------------
+ void TGfxAffineTransform::Concatenate( const TGfxAffineTransform& aTransform )
+ {
+
+ if ( IsIdentity() )
+ {
+ iM00 = aTransform.iM00;
+ iM01 = aTransform.iM01;
+ iM02 = aTransform.iM02;
+ iM11 = aTransform.iM11;
+ iM10 = aTransform.iM10;
+ iM12 = aTransform.iM12;
+ iTransType = aTransform.iTransType;
+ }
+ else if ( aTransform.IsIdentity() )
+ {
+ // Do nothing
+ }
+ else
+ {
+ TFloatFixPt m0, m1;
+ m0 = iM00;
+ m1 = iM01;
+ iM00 = aTransform.iM00 * m0 + aTransform.iM10 * m1;
+ iM01 = aTransform.iM01 * m0 + aTransform.iM11 * m1;
+ iM02 += aTransform.iM02 * m0 + aTransform.iM12 * m1;
+ m0 = iM10;
+ m1 = iM11;
+ iM11 = aTransform.iM01 * m0 + aTransform.iM11 * m1;
+ iM10 = aTransform.iM00 * m0 + aTransform.iM10 * m1;
+ iM12 += aTransform.iM02 * m0 + aTransform.iM12 * m1;
+ iTransType |= aTransform.iTransType;
+ }
+ }
+
+// --------------------------------------------------------------------------
+// TGfxAffineTransform TGfxAffineTransform::CreateInverse()
+// ---------------------------------------------------------------------------
+ TGfxAffineTransform TGfxAffineTransform::CreateInverse()
+ {
+ TFloatFixPt KZero;
+ TFloatFixPt det = iM00* iM11 - iM01* iM10;
+ if ( det == KZero )
+ return TGfxAffineTransform();
+ else
+ {
+ #ifdef SVG_FLOAT_BUILD
+ TFloatFixPt idet = TFloatFixPt(1.0f) / det;
+ #else
+ TFloatFixPt idet = TFloatFixPt(0x10000,ETrue)/ det;
+
+ #endif
+ return TGfxAffineTransform( iM11 * idet,
+ KZero - iM10 * idet,
+ KZero - iM01 * idet,
+ iM00 * idet,
+ ( iM01 * iM12 - iM11 * iM02 ) * idet,
+ ( iM10 * iM02 - iM00 * iM12 ) * idet );
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxAffineTransform::Rotate( TReal32 aTheta )
+// ---------------------------------------------------------------------------
+ void TGfxAffineTransform::Rotate( TReal32 aTheta )
+ {
+ Concatenate( GetRotateInstance( aTheta ) );
+ iTransType |= ( KTransformShear | KTransformScale );
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxAffineTransform::Rotate( TReal32 aTheta,
+// ---------------------------------------------------------------------------
+ void TGfxAffineTransform::Rotate( TReal32 aTheta,
+ const TFloatFixPt& aX,
+ const TFloatFixPt& aY )
+ {
+ Concatenate( GetRotateInstance( aTheta, aX, aY ) );
+ iTransType |= ( KTransformShear | KTransformScale | KTransformTranslate );
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxAffineTransform::Scale( TReal32 aSx, TReal32 aSy )
+// ---------------------------------------------------------------------------
+ void TGfxAffineTransform::Scale( TReal32 aSx, TReal32 aSy )
+ {
+ Concatenate( GetScaleInstance( aSx, aSy ) );
+ iTransType |= KTransformScale;
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxAffineTransform::Translate( const TFixPt& aTx,
+// ---------------------------------------------------------------------------
+ void TGfxAffineTransform::Translate( const TFloatFixPt& aTx,
+ const TFloatFixPt& aTy )
+ {
+ Concatenate( GetTranslateInstance( aTx, aTy ) );
+ iTransType |= KTransformTranslate;
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxAffineTransform::Shear( TReal32 aShX, TReal32 aShY )
+// ---------------------------------------------------------------------------
+ void TGfxAffineTransform::Shear( TReal32 aShX, TReal32 aShY )
+ {
+ Concatenate( GetShearInstance( aShX, aShY ) );
+ iTransType |= KTransformShear;
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxAffineTransform::SetTransform( TReal32 aM00,
+// ---------------------------------------------------------------------------
+ void TGfxAffineTransform::SetTransform( TReal32 aM00,
+ TReal32 aM10,
+ TReal32 aM01,
+ TReal32 aM11,
+ TReal32 aM02,
+ TReal32 aM12 )
+ {
+ iM00 = aM00;
+ iM01 = aM01;
+ iM02 = aM02;
+ iM10 = aM10;
+ iM11 = aM11;
+ iM12 = aM12;
+ UpdateState();
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxAffineTransform::Transform( TGfxPoint2D* aSrcPts,
+// ---------------------------------------------------------------------------
+ void TGfxAffineTransform::Transform( TGfxPoint2D* aSrcPts,
+ TGfxPoint2D* aDstPts,
+ TInt32 aNumPts ) const
+ {
+
+ if ( (int)iTransType == KTransformIdentity )
+ {
+ if ( aSrcPts != aDstPts )
+ {
+ for ( TInt32 i = 0; i < aNumPts; i++ )
+ {
+ aDstPts[i] = aSrcPts[i];
+ }
+ }
+ return;
+ }
+
+ if ( (int)iTransType == KTransformScale )
+ {
+ for ( TInt32 i = 0; i < aNumPts; i++ )
+ {
+ aDstPts[i].iX = aSrcPts[i].iX * iM00;
+ aDstPts[i].iY = aSrcPts[i].iY * iM11;
+ }
+ }
+ else if ( (int)iTransType == KTransformTranslate )
+ {
+ for ( TInt32 i = 0; i < aNumPts; i++ )
+ {
+ aDstPts[i].iX = aSrcPts[i].iX + iM02;
+ aDstPts[i].iY = aSrcPts[i].iY + iM12;
+ }
+ }
+ else if ( (int)iTransType == ( KTransformScale | KTransformTranslate ) )
+ {
+ for ( TInt32 i = 0; i < aNumPts; i++ )
+ {
+ aDstPts[i].iX = ( aSrcPts[i].iX * iM00 ) + iM02;
+ aDstPts[i].iY = ( aSrcPts[i].iY * iM11 ) + iM12;
+ }
+ }
+ else
+ {
+ TFloatFixPt x, y;
+
+ for ( TInt32 i = 0; i < aNumPts; i++ )
+ {
+ x = aSrcPts[i].iX;
+ y = aSrcPts[i].iY;
+ aDstPts[i].iX = ( iM00 * x ) + ( iM01 * y ) + iM02;
+ aDstPts[i].iY = ( iM10 * x ) + ( iM11 * y ) + iM12;
+ }
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxAffineTransform::Transform( TFixPt* aSrcPts,
+// ---------------------------------------------------------------------------
+ void TGfxAffineTransform::Transform( TFloatFixPt* aSrcPts,
+ TFloatFixPt* aDstPts,
+ TInt32 aNumPts ) const
+ {
+ aNumPts <<= 1;
+
+ if ( (int)iTransType == KTransformIdentity )
+ {
+ if ( aSrcPts != aDstPts )
+ {
+ for ( TInt32 i = 0; i < aNumPts; i++ )
+ {
+ *aDstPts++ = *aSrcPts++;
+ *aDstPts++ = *aSrcPts++;
+ }
+ }
+ return;
+ }
+
+ if ( (int)iTransType == KTransformScale )
+ {
+ for ( TInt32 i = 0; i < aNumPts; i += 2 )
+ {
+ *aDstPts++ = *aSrcPts++ * iM00;
+ *aDstPts++ = *aSrcPts++ * iM11;
+ }
+ }
+ else if ( (int)iTransType == KTransformTranslate )
+ {
+ for ( TInt32 i = 0; i < aNumPts; i += 2 )
+ {
+ *aDstPts++ = *aSrcPts++ + iM02;
+ *aDstPts++ = *aSrcPts++ + iM12;
+ }
+ }
+ else if ( (int)iTransType == ( KTransformScale | KTransformTranslate ) )
+ {
+ for ( TInt32 i = 0; i < aNumPts; i += 2 )
+ {
+ *aDstPts++ = ( *aSrcPts++ * iM00 ) + iM02;
+ *aDstPts++ = ( *aSrcPts++ * iM11 ) + iM12;
+ }
+ }
+ else
+ {
+ TFloatFixPt x, y;
+
+ for ( TInt32 i = 0; i < aNumPts; i += 2 )
+ {
+ x = *aSrcPts++;
+ y = *aSrcPts++;
+ *aDstPts++ = ( iM00 * x ) + ( iM01 * y ) + iM02;
+ *aDstPts++ = ( iM10 * x ) + ( iM11 * y ) + iM12;
+ }
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxAffineTransform::Transform( TFixPt* aSrcDstPts,
+// ---------------------------------------------------------------------------
+ void TGfxAffineTransform::Transform( TFloatFixPt* aSrcDstPts,
+ TInt32 aNumPts ) const
+ {
+ if ( (int)iTransType == KTransformIdentity )
+ return;
+
+ aNumPts <<= 1;
+
+ if ( (int)iTransType == KTransformScale )
+ {
+ for ( TInt32 i = 0; i < aNumPts; i += 2 )
+ {
+ *aSrcDstPts++ *= iM00;
+ *aSrcDstPts++ *= iM11;
+ }
+ }
+ else if ( (int)iTransType == KTransformTranslate )
+ {
+ for ( TInt32 i = 0; i < aNumPts; i += 2 )
+ {
+ *aSrcDstPts++ += iM02;
+ *aSrcDstPts++ += iM12;
+ }
+ }
+ else if ( (int)iTransType == ( KTransformScale | KTransformTranslate ) )
+ {
+ for ( TInt32 i = 0; i < aNumPts; i += 2 )
+ {
+ *aSrcDstPts *= iM00;
+ *aSrcDstPts++ += iM02;
+ *aSrcDstPts *= iM11;
+ *aSrcDstPts++ += iM12;
+ }
+ }
+ else
+ {
+ TFloatFixPt x, y;
+
+ for ( TInt32 i = 0; i < aNumPts; i += 2 )
+ {
+ x = *aSrcDstPts;
+ y = *( aSrcDstPts + 1 );
+ *aSrcDstPts++ = ( iM00 * x ) + ( iM01 * y ) + iM02;
+ *aSrcDstPts++ = ( iM10 * x ) + ( iM11 * y ) + iM12;
+ }
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxAffineTransform::UpdateState()
+// ---------------------------------------------------------------------------
+void TGfxAffineTransform::UpdateState()
+ {
+ TFloatFixPt KZero;
+ TFloatFixPt KOne( KFloatFixOne );
+ iTransType = KTransformIdentity;
+
+ if ( iM02 != KZero || iM12 != KZero )
+ iTransType |= KTransformTranslate;
+
+ if ( iM00 != KZero || iM11 != KZero )
+ iTransType |= KTransformScale;
+
+ if ( iM01 != KZero || iM10 != KZero )
+ iTransType |= KTransformShear;
+
+ if ( (int)iTransType == KTransformScale && iM00 == KOne && iM11 == KOne )
+ iTransType = KTransformIdentity;
+ }
+
+// --------------------------------------------------------------------------
+// TUint32 TGfxAffineTransform::TransformType()
+// ---------------------------------------------------------------------------
+TUint32 TGfxAffineTransform::TransformType()
+ {
+ return iTransType;
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxAffineTransform::Print()
+// prints out the matrix
+// ---------------------------------------------------------------------------
+ void TGfxAffineTransform::Print()
+{
+ RDebug::Printf("a=%f b=%f c=%f d=%f e=%f f=%f", (TReal32)iM00, (TReal32)iM10, (TReal32)iM01, (TReal32)iM11, (TReal32)iM02, (TReal32)iM12);
+}
+
+// --------------------------------------------------------------------------
+// Get the scaling factor set in this transform. This function returns correctly
+// for a uniform scaling in both directions only.
+// ---------------------------------------------------------------------------
+ TFloatFixPt TGfxAffineTransform::ScalingFactor() const
+{
+ TGfxPoint2D ep( 1, 0 ), org( 2, 0 );
+ Transform( &ep, & ep, 1 );
+ Transform( &org, & org, 1 );
+ ep.iX -= org.iX;
+ ep.iY -= org.iY;
+ return TFloatFixPt::Sqrt( ep.iX * ep.iX + ep.iY * ep.iY );
+}
+
+
+
+// --------------------------------------------------------------------------
+//
+// Appends this transform with the existing transform
+// Multiply in reverse order
+// For Ex: In cases of zoom, rotate and pan of already transformed content.
+// If T is the existing transform and zoom operation has to be applied to it
+// the resultant transform would be Z*T.
+//
+// void TGfxAffineTransform::AppendTransform( const TGfxAffineTransform& aTransform )
+// ---------------------------------------------------------------------------
+ void TGfxAffineTransform::AppendTransform( const TGfxAffineTransform& aTransform )
+ {
+
+ if ( IsIdentity() )
+ {
+ iM00 = aTransform.iM00;
+ iM01 = aTransform.iM01;
+ iM02 = aTransform.iM02;
+ iM11 = aTransform.iM11;
+ iM10 = aTransform.iM10;
+ iM12 = aTransform.iM12;
+ iTransType = aTransform.iTransType;
+ }
+ else if ( aTransform.IsIdentity() )
+ {
+ // Do nothing
+ }
+ else
+ {
+ TMatrixElType m00, m01,m02,m10,m11,m12;
+ m00 = iM00;
+ m01 = iM01;
+ m02 = iM02;
+ m10 = iM10;
+ m11 = iM11;
+ m12 = iM12;
+ iM00 = aTransform.iM00 * m00 + aTransform.iM01 * m10;
+ iM01 = aTransform.iM00 * m01 + aTransform.iM01 * m11;
+ iM02 = aTransform.iM00 * m02 + aTransform.iM01 * m12 + aTransform.iM02;
+
+ iM10 = aTransform.iM10 * m00 + aTransform.iM11 * m10;
+ iM11 = aTransform.iM10 * m01 + aTransform.iM11 * m11;
+ iM12 = aTransform.iM10 * m02 + aTransform.iM11 * m12 + aTransform.iM12;
+
+ iTransType |= aTransform.iTransType;
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxAffineTransform::UserRoatate( TReal32 aTheta,
+// ---------------------------------------------------------------------------
+ void TGfxAffineTransform::UserRotate( TReal32 aTheta,
+ const TFloatFixPt& aX,
+ const TFloatFixPt& aY )
+ {
+ AppendTransform( GetRotateInstance( aTheta, aX, aY ) );
+ iTransType |= ( KTransformShear | KTransformScale | KTransformTranslate );
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxAffineTransform::UserZoom( TReal32 aScaleFactor,
+// ---------------------------------------------------------------------------
+ void TGfxAffineTransform::UserZoom( TReal32 aScaleFactor,
+ const TFloatFixPt& aX,
+ const TFloatFixPt& aY )
+ {
+ AppendTransform( GetZoomInstance( aScaleFactor, aX, aY ) );
+ iTransType |= ( KTransformScale | KTransformTranslate );
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxAffineTransform::UserPan( const TFloatFixPt& aTx,
+// ---------------------------------------------------------------------------
+ void TGfxAffineTransform::UserPan( const TFloatFixPt& aTx,
+ const TFloatFixPt& aTy )
+ {
+ AppendTransform( GetTranslateInstance( aTx, aTy ) );
+ iTransType |= KTransformTranslate;
+ }
+
+
+//
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGeom/GfxEllipse2D.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxEllipse2D.h"
+#include "GfxEllipseIteratorP.h"
+#include "GfxFlatteningPathIterator.h"
+
+// --------------------------------------------------------------------------
+// TGfxEllipse2D::TGfxEllipse2D( const TFloatFixPt& aX,
+// ---------------------------------------------------------------------------
+ TGfxEllipse2D::TGfxEllipse2D( const TFloatFixPt& aX,
+ const TFloatFixPt& aY,
+ const TFloatFixPt& aWidth,
+ const TFloatFixPt& aHeight ) :
+ TGfxRectangularShape( aX, aY, aWidth, aHeight )
+{
+}
+
+
+// --------------------------------------------------------------------------
+// TGfxEllipse2D::TGfxEllipse2D( const TFloatFixPt& aX1,
+// ---------------------------------------------------------------------------
+ TGfxEllipse2D::TGfxEllipse2D( const TFloatFixPt& aX1,
+ const TFloatFixPt& aY1,
+ const TFloatFixPt& aX2,
+ const TFloatFixPt& aY2,
+ TEllipseConstructType aEtype )
+ {
+ if ( aEtype == EElipseRectangular )
+ {
+ iX = aX1;
+ iY = aY1;
+ iWidth = aX2;
+ iHeight = aY2;
+ }
+ else
+ {
+ // convert cx,cy,rx,ry -> x,y,w,h
+ iX = aX1 - aX2;
+ iY = aY1 - aY2;
+ iWidth = aX2 + aX2;
+ iHeight = aY2 + aY2;
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxEllipse2D::GetPathIteratorL( TGfxAffineTransform* aAt,
+// ---------------------------------------------------------------------------
+ void TGfxEllipse2D::GetPathIteratorL( TGfxAffineTransform* aAt,
+ CGfxPathIterator*& aPitr )
+ {
+ aPitr = new( ELeave ) CGfxEllipseIteratorP( this, aAt );
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxEllipse2D::GetPathIteratorL( TGfxAffineTransform* aAt,
+// ---------------------------------------------------------------------------
+ void TGfxEllipse2D::GetPathIteratorL( TGfxAffineTransform* aAt,
+ TInt aLimit,
+ CGfxPathIterator*& aPitr )
+ {
+ aPitr = CGfxFlatteningPathIterator::NewL( this, aAt, aLimit );
+
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGeom/GfxEllipseIteratorP.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,155 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxEllipseIteratorP.h"
+#include "GfxEllipse2D.h"
+
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// CGfxEllipseIteratorP::CGfxEllipseIteratorP( TGfxEllipse2D* aEllipse,
+// ---------------------------------------------------------------------------
+CGfxEllipseIteratorP::CGfxEllipseIteratorP( TGfxEllipse2D* aEllipse,
+ TGfxAffineTransform* aTransform )
+ {
+ TFloatFixPt KZero;
+ if ( aEllipse->iWidth < KZero )
+ aEllipse->iWidth = KZero;
+
+ if ( aEllipse->iHeight < KZero )
+ aEllipse->iHeight = KZero;
+
+ iEllipse = aEllipse;
+ iTransform = aTransform;
+ }
+
+// --------------------------------------------------------------------------
+// TGfxSegType CGfxEllipseIteratorP::CurrentSegment( TFloatFixPt* aCoords )
+// ---------------------------------------------------------------------------
+TGfxSegType CGfxEllipseIteratorP::CurrentSegment( TFloatFixPt* aCoords )
+ {
+ TGfxSegType segtype;
+
+ TInt32 pts = 3;
+
+ TFloatFixPt px[12], py[12];
+
+ #ifdef SVG_FLOAT_BUILD
+ TFloatFixPt cx = iEllipse->iX + (iEllipse->iWidth * TFloatFixPt(.5f));
+ TFloatFixPt cy = iEllipse->iY + (iEllipse->iHeight * TFloatFixPt(.5f));
+ TFloatFixPt offx = iEllipse->iWidth * TFloatFixPt(.257f);
+ TFloatFixPt offy = iEllipse->iHeight * TFloatFixPt(.257f);
+ #else
+ TFloatFixPt cx = iEllipse->iX + (iEllipse->iWidth >> 1);
+ TFloatFixPt cy = iEllipse->iY + (iEllipse->iHeight >> 1);
+ TFloatFixPt offx = TFloatFixPt( 0x41ca, ETrue ) * iEllipse->iWidth;
+ TFloatFixPt offy = TFloatFixPt( 0x41ca, ETrue ) * iEllipse->iHeight;
+ #endif
+
+ px[0] = px[1] = px[11] = iEllipse->iX;
+ px[2] = px[10] = cx - offx;
+ px[3] = px[9] = cx;
+ px[4] = px[8] = cx + offx;
+ px[5] = px[6] = px[7] = iEllipse->iX + iEllipse->iWidth;
+
+ py[2] = py[3] = py[4] = iEllipse->iY;
+ py[1] = py[5] = cy - offy;
+ py[0] = py[6] = cy;
+ py[7] = py[11] = cy + offy;
+ py[8] = py[9] = py[10] = iEllipse->iY + iEllipse->iHeight;
+
+ TFloatFixPt* p = aCoords;
+ switch ( iIdx )
+ {
+ case 0:
+ p[0] = px[0];
+ p[1] = py[0];
+ segtype = EGfxSegMoveTo;
+ pts = 1;
+ break;
+ case 1:
+ p[0] = px[1];
+ p[1] = py[1];
+ p[2] = px[2];
+ p[3] = py[2];
+ p[4] = px[3];
+ p[5] = py[3];
+ segtype = EGfxSegCubicTo;
+ break;
+ case 2:
+ p[0] = px[4];
+ p[1] = py[4];
+ p[2] = px[5];
+ p[3] = py[5];
+ p[4] = px[6];
+ p[5] = py[6];
+ segtype = EGfxSegCubicTo;
+ break;
+ case 3:
+ p[0] = px[7];
+ p[1] = py[7];
+ p[2] = px[8];
+ p[3] = py[8];
+ p[4] = px[9];
+ p[5] = py[9];
+ segtype = EGfxSegCubicTo;
+ break;
+ case 4:
+ p[0] = px[10];
+ p[1] = py[10];
+ p[2] = px[11];
+ p[3] = py[11];
+ p[4] = px[0];
+ p[5] = py[0];
+ segtype = EGfxSegCubicTo;
+ break;
+ default:
+ segtype = EGfxSegClose;
+ pts = 0;
+ }
+
+
+
+ if ( !iTransform->IsIdentity() && pts > 0 )
+ {
+ iTransform->Transform( aCoords, aCoords, pts );
+ }
+
+ return segtype;
+ }
+
+// --------------------------------------------------------------------------
+// TBool CGfxEllipseIteratorP::IsDone()
+// ---------------------------------------------------------------------------
+TBool CGfxEllipseIteratorP::IsDone()
+ {
+ return ( iIdx > 4 );
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxEllipseIteratorP::NextL()
+// ---------------------------------------------------------------------------
+void CGfxEllipseIteratorP::NextL()
+ {
+ iIdx++;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGeom/GfxFlatteningPathIterator.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,349 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxFlatteningPathIterator.h"
+#include "GfxShape.h"
+#include "GfxAffineTransform.h"
+
+
+// ---------------------------------------------------------------------------
+// Constructors
+// ---------------------------------------------------------------------------
+CGfxFlatteningPathIterator::CGfxFlatteningPathIterator( TInt32 aLimit )
+ : iIdx( 0 ),
+ iSegType( EGfxSegClose ),
+ iIsDone( EFalse ),
+ iLimit( aLimit )
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// Create a new instance.
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// CGfxFlatteningPathIterator* CGfxFlatteningPathIterator::NewL( MGfxShape* aSrc,
+// ---------------------------------------------------------------------------
+ CGfxFlatteningPathIterator* CGfxFlatteningPathIterator::NewL( MGfxShape* aSrc,
+ TGfxAffineTransform* aAt,
+ TInt32 aLimit )
+ {
+ CGfxFlatteningPathIterator* self = new ( ELeave )
+ CGfxFlatteningPathIterator( aLimit );
+
+ CleanupStack::PushL( self );
+ self->ConstructL( aSrc, aAt );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Second phase in constructing this object.
+// ---------------------------------------------------------------------------
+void CGfxFlatteningPathIterator::ConstructL( MGfxShape* aSrc,
+ TGfxAffineTransform* aAt )
+ {
+ aSrc->GetPathIteratorL( aAt, iSrc );
+ iCoords = new ( ELeave ) RArray<TFloatFixPt>( 10 );
+ iCoords->AppendL( NULL );
+ iCoords->Remove(0);
+ NextL();
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor.
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// CGfxFlatteningPathIterator::~CGfxFlatteningPathIterator()
+// ---------------------------------------------------------------------------
+ CGfxFlatteningPathIterator::~CGfxFlatteningPathIterator()
+ {
+ if ( iSrc )
+ {
+ delete iSrc;
+ iSrc = NULL;
+ }
+ if ( iCoords )
+ {
+ iCoords->Close();
+ delete iCoords;
+ iCoords = NULL;
+ }
+ }
+
+
+// --------------------------------------------------------------------------
+// TGfxSegType CGfxFlatteningPathIterator::CurrentSegment( TFloatFixPt* aCoords )
+// ---------------------------------------------------------------------------
+ TGfxSegType CGfxFlatteningPathIterator::CurrentSegment( TFloatFixPt* aCoords )
+ {
+ if ( iCoords->Count() > 0 && iCoords->Count() > iIdx )
+ {
+ aCoords[0] = ( *iCoords )[iIdx];
+ aCoords[1] = ( *iCoords )[iIdx + 1];
+ }
+
+ return iSegType;
+ }
+
+
+// --------------------------------------------------------------------------
+// TBool CGfxFlatteningPathIterator::IsDone()
+// ---------------------------------------------------------------------------
+ TBool CGfxFlatteningPathIterator::IsDone()
+ {
+ return iIsDone;
+ }
+
+
+// --------------------------------------------------------------------------
+// void CGfxFlatteningPathIterator::Next()
+// ---------------------------------------------------------------------------
+ void CGfxFlatteningPathIterator::NextL()
+ {
+ iIdx += 2;
+
+ if ( iCoords->Count() <= 0 || iCoords->Count() <= iIdx )
+ {
+ TFloatFixPt tmpcoords[6];
+ TInt i;
+
+ iCoords->Reset();
+ iIdx = 0;
+ if ( iSrc->IsDone() )
+ {
+ iIsDone = ETrue;
+ }
+ else
+ {
+ iSegType = iSrc->CurrentSegment( tmpcoords );
+ switch ( iSegType )
+ {
+ case EGfxSegMoveTo:
+ iLastX = tmpcoords[0];
+ iLastY = tmpcoords[1];
+ iCoords->AppendL( iLastX );
+ iCoords->AppendL( iLastY );
+ break;
+ case EGfxSegLineTo:
+ iLastX = tmpcoords[0];
+ iLastY = tmpcoords[1];
+ iCoords->AppendL( iLastX );
+ iCoords->AppendL( iLastY );
+ break;
+ case EGfxSegQuadTo:
+ iCoords->AppendL( iLastX );
+ iCoords->AppendL( iLastY );
+ iCoords->AppendL( tmpcoords[0] );
+ iCoords->AppendL( tmpcoords[1] );
+ iCoords->AppendL( tmpcoords[2] );
+ iCoords->AppendL( tmpcoords[3] );
+
+ for ( i = 0; i < iLimit; i++ )
+ CreateSubcurveQuadL( iCoords );
+ //CreateSubcurveQuad(iCoords);
+ //CreateSubcurveQuad(iCoords);
+ //CreateSubcurveQuad(iCoords);
+
+ iIdx = 2;
+ iLastX = tmpcoords[2];
+ iLastY = tmpcoords[3];
+ iSegType = EGfxSegLineTo;
+ break;
+ case EGfxSegCubicTo:
+ iCoords->AppendL( iLastX );
+ iCoords->AppendL( iLastY );
+ iCoords->AppendL( tmpcoords[0] );
+ iCoords->AppendL( tmpcoords[1] );
+ iCoords->AppendL( tmpcoords[2] );
+ iCoords->AppendL( tmpcoords[3] );
+ iCoords->AppendL( tmpcoords[4] );
+ iCoords->AppendL( tmpcoords[5] );
+
+ for ( i = 0; i < iLimit; i++ )
+ CreateSubcurveCubicL( iCoords );
+
+ iIdx = 2;
+ iLastX = tmpcoords[4];
+ iLastY = tmpcoords[5];
+ iSegType = EGfxSegLineTo;
+ break;
+ case EGfxSegClose: // (cdm)
+ iLastX = tmpcoords[0];
+ iLastY = tmpcoords[1];
+ iCoords->AppendL( iLastX );
+ iCoords->AppendL( iLastY );
+ break;
+
+ default:
+ break;
+ }
+ iSrc->NextL();
+ }
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxFlatteningPathIterator::SetFlatness( TFloatFixPt& aFlatness )
+// ---------------------------------------------------------------------------
+ void CGfxFlatteningPathIterator::SetFlatness( TFloatFixPt& aFlatness )
+ {
+ iFlatness = aFlatness;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxFlatteningPathIterator::SetRecursionLimit( TInt32 aLimit )
+// ---------------------------------------------------------------------------
+ void CGfxFlatteningPathIterator::SetRecursionLimit( TInt32 aLimit )
+ {
+ iLimit = aLimit;
+ }
+
+// --------------------------------------------------------------------------
+// TFloatFixPt CGfxFlatteningPathIterator::Flatness()
+// ---------------------------------------------------------------------------
+ TFloatFixPt CGfxFlatteningPathIterator::Flatness()
+ {
+ return iFlatness;
+ }
+
+// --------------------------------------------------------------------------
+// TInt32 CGfxFlatteningPathIterator::RecursionLimit()
+// ---------------------------------------------------------------------------
+ TInt32 CGfxFlatteningPathIterator::RecursionLimit()
+ {
+ return iLimit;
+ }
+
+
+
+
+// --------------------------------------------------------------------------
+// void CGfxFlatteningPathIterator::CreateSubcurveQuad( RArray<TFloatFixPt>* aCtrlPoints )
+// ---------------------------------------------------------------------------
+void CGfxFlatteningPathIterator::CreateSubcurveQuadL( RArray<TFloatFixPt>* aCtrlPoints )
+ {
+ TInt32 ix = 0;
+ TFloatFixPt x0, y0, xm, ym, x1, y1;
+ TInt32 lCount;
+
+ while ( ix + 5 < aCtrlPoints->Count() )
+ {
+ lCount = ix;
+ x0 = ( *aCtrlPoints )[lCount++];
+ y0 = ( *aCtrlPoints )[lCount++];
+ xm = ( *aCtrlPoints )[lCount++];
+ ym = ( *aCtrlPoints )[lCount++];
+ x1 = ( *aCtrlPoints )[lCount++];
+ y1 = ( *aCtrlPoints )[lCount++];
+ #ifdef SVG_FLOAT_BUILD
+ x0 = ( x0 + xm ) * .5f;
+ y0 = ( y0 + ym ) * .5f;
+ x1 = ( x1 + xm ) * .5f;
+ y1 = ( y1 + ym ) * .5f;
+ xm = ( x0 + x1 ) * .5f;
+ ym = ( y0 + y1 ) * .5f;
+ #else
+ x0 = ( x0 + xm ) >> 1;
+ y0 = ( y0 + ym ) >> 1;
+ x1 = ( x1 + xm ) >> 1;
+ y1 = ( y1 + ym ) >> 1;
+ xm = ( x0 + x1 ) >> 1;
+ ym = ( y0 + y1 ) >> 1;
+ #endif
+ lCount=ix + 2;
+ ( *aCtrlPoints )[lCount] = xm;
+ ( *aCtrlPoints )[lCount + 1] = ym;
+ aCtrlPoints->InsertL( TFloatFixPt( x0 ), lCount++);
+ aCtrlPoints->InsertL( TFloatFixPt( y0 ), lCount );
+ aCtrlPoints->InsertL( TFloatFixPt( x1 ), ix + 6 );
+ aCtrlPoints->InsertL( TFloatFixPt( y1 ), ix + 7 );
+ ix += 8;
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxFlatteningPathIterator::CreateSubcurveCubic( RArray<TFloatFixPt>* aCtrlPoints )
+// ---------------------------------------------------------------------------
+void CGfxFlatteningPathIterator::CreateSubcurveCubicL( RArray<TFloatFixPt>* aCtrlPoints )
+ {
+ TInt32 ix = 0;
+ TFloatFixPt x0, y0, xm, ym, xm1, ym1, xm2, ym2, x1, y1;
+ TInt32 lCount;
+ while ( ix + 7 < aCtrlPoints->Count() )
+ {
+ lCount = ix;
+ x0 = ( *aCtrlPoints )[lCount++];
+ y0 = ( *aCtrlPoints )[lCount++];
+ xm1 = ( *aCtrlPoints )[lCount++];
+ ym1 = ( *aCtrlPoints )[lCount++];
+ xm2 = ( *aCtrlPoints )[lCount++];
+ ym2 = ( *aCtrlPoints )[lCount++];
+ x1 = ( *aCtrlPoints )[lCount++];
+ y1 = ( *aCtrlPoints )[lCount ];
+
+ #ifdef SVG_FLOAT_BUILD
+ x0 = ( x0 + xm1 ) * .5f;
+ y0 = ( y0 + ym1 ) * .5f;
+ x1 = ( x1 + xm2 ) * .5f;
+ y1 = ( y1 + ym2 ) * .5f;
+ xm = ( xm1 + xm2 ) * .5f;
+ ym = ( ym1 + ym2 ) * .5f;
+ xm1 = ( x0 + xm ) * .5f;
+ ym1 = ( y0 + ym ) * .5f;
+ xm2 = ( x1 + xm ) * .5f;
+ ym2 = ( y1 + ym ) * .5f;
+ xm = ( xm1 + xm2 ) * .5f;
+ ym = ( ym1 + ym2 ) * .5f;
+ #else
+ x0 = ( x0 + xm1 ) >> 1;
+ y0 = ( y0 + ym1 ) >> 1;
+ x1 = ( x1 + xm2 ) >> 1;
+ y1 = ( y1 + ym2 ) >> 1;
+ xm = ( xm1 + xm2 ) >> 1;
+ ym = ( ym1 + ym2 ) >> 1;
+ xm1 = ( x0 + xm ) >> 1;
+ ym1 = ( y0 + ym ) >> 1;
+ xm2 = ( x1 + xm ) >> 1;
+ ym2 = ( y1 + ym ) >> 1;
+ xm = ( xm1 + xm2 ) >> 1;
+ ym = ( ym1 + ym2 ) >> 1;
+ #endif
+ lCount=ix + 2;
+ ( *aCtrlPoints )[lCount++] = x0;
+ ( *aCtrlPoints )[lCount++] = y0;
+ ( *aCtrlPoints )[lCount++] = xm1;
+ ( *aCtrlPoints )[lCount++] = ym1;
+
+ aCtrlPoints->InsertL( TFloatFixPt( y1 ), lCount);
+ aCtrlPoints->InsertL( TFloatFixPt( x1 ), lCount );
+ aCtrlPoints->InsertL( TFloatFixPt( ym2 ), lCount );
+ aCtrlPoints->InsertL( TFloatFixPt( xm2 ), lCount );
+ aCtrlPoints->InsertL( TFloatFixPt( ym ), lCount );
+ aCtrlPoints->InsertL( TFloatFixPt( xm ), lCount );
+ ix += 12;
+ }
+ }
+
+
+// --------------------------------------------------------------------------
+// void CGfxFlatteningPathIterator::PolygonizeL( CGfxEdgeListP* /* aRenderer */, TInt /* aFlatness */ )
+// ---------------------------------------------------------------------------
+ void CGfxFlatteningPathIterator::PolygonizeL( CGfxEdgeListP* /* aRenderer */, TInt /* aFlatness */ )
+{
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGeom/GfxGeneralPath.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,850 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxGeneralPath.h"
+#include "GfxGeneralPathIteratorP.h"
+#include "GfxFlatteningPathIterator.h"
+
+
+
+// ---------------------------------------------------------------------------
+// Constructors
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// CGfxGeneralPath* CGfxGeneralPath::NewL()
+// ---------------------------------------------------------------------------
+ CGfxGeneralPath* CGfxGeneralPath::NewL()
+ {
+ CGfxGeneralPath* self = NewLC();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// --------------------------------------------------------------------------
+// CGfxGeneralPath* CGfxGeneralPath::NewLC()
+// ---------------------------------------------------------------------------
+ CGfxGeneralPath* CGfxGeneralPath::NewLC()
+ {
+ CGfxGeneralPath* self = new ( ELeave ) CGfxGeneralPath;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// --------------------------------------------------------------------------
+// CGfxGeneralPath::CGfxGeneralPath()
+// ---------------------------------------------------------------------------
+CGfxGeneralPath::CGfxGeneralPath()
+{
+}
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::ConstructL()
+// ---------------------------------------------------------------------------
+void CGfxGeneralPath::ConstructL()
+ {
+ iPointTypes = new ( ELeave ) RArray<TUint32>( 4 );
+ iPointTypes->AppendL(NULL);
+ iPointTypes->Remove(0);
+ iPointCoords = new ( ELeave ) RArray<TFloatFixPt>( 8 );
+ iPointCoords->AppendL(NULL);
+ iPointCoords->Remove(0);
+ iPathSegmentTypeArray = NULL;
+ iCount = 0;
+ }
+
+// --------------------------------------------------------------------------
+// CGfxGeneralPath::~CGfxGeneralPath()
+// ---------------------------------------------------------------------------
+ CGfxGeneralPath::~CGfxGeneralPath()
+ {
+ if ( iPointTypes )
+ {
+ iPointTypes->Close();
+ delete iPointTypes;
+ iPointTypes = NULL;
+ }
+
+ if ( iPointCoords )
+ {
+ iPointCoords->Close();
+ delete iPointCoords;
+ iPointCoords = NULL;
+ }
+ if (iPathSegmentTypeArray)
+ {
+ delete [] iPathSegmentTypeArray;
+ iPathSegmentTypeArray = NULL;
+ }
+ }
+
+const TUint32 KSegClose = ( TUint32 ) EGfxSegClose;
+
+// --------------------------------------------------------------------------
+// TFloatFixPt CGfxGeneralPath::AreaSize()
+// ---------------------------------------------------------------------------
+TFloatFixPt CGfxGeneralPath::AreaSize()
+ {
+ return TFloatFixPt(0);
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::ClosePathL()
+// ---------------------------------------------------------------------------
+ void CGfxGeneralPath::ClosePathL()
+ {
+ TInt count = iPointTypes->Count();
+ if ( count > 0 && (*iPointTypes)[count - 1] != KSegClose )
+ {
+ iPointTypes->AppendL( KSegClose );
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::HorizonToL( TFloatFixPt& aX, TBool aAbsolute )
+// ---------------------------------------------------------------------------
+ void CGfxGeneralPath::HorizonToL( TFloatFixPt& aX, TBool aAbsolute )
+ {
+ if ( !aAbsolute && iPointCoords->Count() >= 2 )
+ {
+ // If the last command was 'Z'/'z'
+ // the current point is the initial point
+ // of the previous segment - 'M'/'m' usually
+ if ( iPointTypes->operator[]( iPointTypes->Count() - 1 ) == KSegClose )
+ {
+ aX += iLastX;
+ }
+ else
+ {
+ aX += iPointCoords->operator[]( iPointCoords->Count() - 2 );
+ }
+ }
+
+ TUint32 KSegLineto = ( TUint32 ) EGfxSegLineTo; // const
+
+ iPointTypes->AppendL( KSegLineto );
+ iPointCoords->AppendL( aX );
+ TFloatFixPt tmpY = ( iPointCoords->Count() < 2 ) ? TFloatFixPt( 0 ) : iPointCoords->operator[]( iPointCoords->Count() - 2 );
+ iPointCoords->AppendL( tmpY );
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::VertToL( TFloatFixPt& aY, TBool aAbsolute )
+// ---------------------------------------------------------------------------
+ void CGfxGeneralPath::VertToL( TFloatFixPt& aY, TBool aAbsolute )
+ {
+ if ( !aAbsolute && iPointCoords->Count() >= 2 )
+ {
+ // If the last command was 'Z'/'z'
+ // the current point is the initial point
+ // of the previous segment - 'M'/'m' usually
+ if ( iPointTypes->operator[]( iPointTypes->Count() - 1 ) == KSegClose )
+ {
+ aY += iLastY;
+ }
+ else
+ {
+ aY += iPointCoords->operator[]( iPointCoords->Count() - 1 );
+ }
+ }
+
+ TUint32 KSegLineto = ( TUint32 ) EGfxSegLineTo; // const
+
+ iPointTypes->AppendL( KSegLineto );
+ TFloatFixPt tmpX = ( iPointCoords->Count() < 2 ) ? TFloatFixPt( 0 ) : iPointCoords->operator[]( iPointCoords->Count() - 2 );
+ iPointCoords->AppendL( tmpX );
+ iPointCoords->AppendL( aY );
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::LineToL( TFloatFixPt& aX,
+// ---------------------------------------------------------------------------
+ void CGfxGeneralPath::LineToL( TFloatFixPt& aX,
+ TFloatFixPt& aY,
+ TBool aAbsolute )
+ {
+ if ( !aAbsolute && iPointCoords->Count() >= 2 )
+ {
+ TFloatFixPt lastX = iPointCoords->operator[]( iPointCoords->Count() - 2 );
+ TFloatFixPt lastY = iPointCoords->operator[]( iPointCoords->Count() - 1 );
+ // If the last command was 'Z'/'z'
+ // the current point is the initial point
+ // of the previous segment - 'M'/'m' usually
+ if ( iPointTypes->operator[]( iPointTypes->Count() - 1 ) == KSegClose )
+ {
+ lastX = iLastX;
+ lastY = iLastY;
+ }
+ aX += lastX;
+ aY += lastY;
+ }
+
+ TUint32 KSegLineto = ( TUint32 ) EGfxSegLineTo; // const
+
+ iPointTypes->AppendL( KSegLineto );
+ iPointCoords->AppendL( aX );
+ iPointCoords->AppendL( aY );
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::RemoveLastPathCommand()
+// ---------------------------------------------------------------------------
+ void CGfxGeneralPath::RemoveLastPathCommand()
+ {
+ TInt aTypeCount = iPointTypes->Count();
+ TInt aPointCount = iPointCoords->Count();
+
+ if ( aPointCount >= 2 )
+ {
+ //we need to remove the last amount from iLastX
+ iLastX -= (*iPointCoords)[aPointCount - 2];
+ iLastY -= (*iPointCoords)[aPointCount - 1];
+ }
+
+ if ( aTypeCount > 0 )
+ {
+ iPointTypes->Remove( aTypeCount - 1 );
+
+ if ( aPointCount >= 2 )
+ {
+ iPointCoords->Remove( aPointCount - 1 );
+ iPointCoords->Remove( aPointCount - 2 );
+ }
+ }
+ }
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::MoveToL( TFloatFixPt& aX,
+// ---------------------------------------------------------------------------
+ void CGfxGeneralPath::MoveToL( TFloatFixPt& aX,
+ TFloatFixPt& aY,
+ TBool aAbsolute )
+ {
+ if ( !aAbsolute && iPointCoords->Count() >= 2 )
+ {
+ // If the last command was 'Z'/'z'
+ // the current point is the initial point
+ // of the previous segment - 'M'/'m' usually
+ if ( iPointTypes->operator[]( iPointTypes->Count() - 1 ) == KSegClose )
+ {
+ aX += iLastX;
+ aY += iLastY;
+ }
+ else
+ {
+ TFloatFixPt lastX = iPointCoords->operator[]( iPointCoords->Count() -
+ 2 );
+ TFloatFixPt lastY = iPointCoords->operator[]( iPointCoords->Count() -
+ 1 );
+ aX += lastX;
+ aY += lastY;
+ }
+ }
+
+ TUint32 KSegMoveto = ( TUint32 ) EGfxSegMoveTo; // const
+
+ iPointTypes->AppendL( KSegMoveto );
+ iPointCoords->AppendL( aX );
+ iPointCoords->AppendL( aY );
+ // Save initial point of a new segment
+ // Could be the next initial point
+ iLastX = aX;
+ iLastY = aY;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::QuadToL( TFloatFixPt& aX1,
+// ---------------------------------------------------------------------------
+ void CGfxGeneralPath::QuadToL( TFloatFixPt& aX1,
+ TFloatFixPt& aY1,
+ TFloatFixPt& aX2,
+ TFloatFixPt& aY2,
+ TBool aAbsolute )
+ {
+ if ( !aAbsolute && iPointCoords->Count() >= 2 )
+ {
+ TFloatFixPt lastX = iPointCoords->operator[]( iPointCoords->Count() - 2 );
+ TFloatFixPt lastY = iPointCoords->operator[]( iPointCoords->Count() - 1 );
+
+ // If the last command was 'Z'/'z'
+ // the current point is the initial point
+ // of the previous segment - 'M'/'m' usually
+ if ( iPointTypes->operator[]( iPointTypes->Count() - 1 ) == KSegClose )
+ {
+ lastX = iLastX;
+ lastY = iLastY;
+ }
+
+ aX1 += lastX;
+ aY1 += lastY;
+ aX2 += lastX;
+ aY2 += lastY;
+ }
+
+ TUint32 KSegQuadto = ( TUint32 ) EGfxSegQuadTo;
+ iPointTypes->AppendL( KSegQuadto );
+ iPointCoords->AppendL( aX1 );
+ iPointCoords->AppendL( aY1 );
+ iPointCoords->AppendL( aX2 );
+ iPointCoords->AppendL( aY2 );
+
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::CubicToL( TFloatFixPt& aX1,
+// ---------------------------------------------------------------------------
+ void CGfxGeneralPath::CubicToL( TFloatFixPt& aX1,
+ TFloatFixPt& aY1,
+ TFloatFixPt& aX2,
+ TFloatFixPt& aY2,
+ TFloatFixPt& aX3,
+ TFloatFixPt& aY3,
+ TBool aAbsolute )
+ {
+ if ( !aAbsolute && iPointCoords->Count() >= 2 )
+ {
+ TFloatFixPt lastX = iPointCoords->operator[]( iPointCoords->Count() - 2 );
+ TFloatFixPt lastY = iPointCoords->operator[]( iPointCoords->Count() - 1 );
+ // If the last command was 'Z'/'z'
+ // the current point is the initial point
+ // of the previous segment - 'M'/'m' usually
+ if ( iPointTypes->operator[]( iPointTypes->Count() - 1 ) == KSegClose )
+ {
+ lastX = iLastX;
+ lastY = iLastY;
+ }
+ aX1 += lastX;
+ aY1 += lastY;
+ aX2 += lastX;
+ aY2 += lastY;
+ aX3 += lastX;
+ aY3 += lastY;
+ }
+
+ TUint32 KSegCubicto = ( TUint32 ) EGfxSegCubicTo; // const
+
+ iPointTypes->AppendL( KSegCubicto );
+ iPointCoords->AppendL( aX1 );
+ iPointCoords->AppendL( aY1 );
+ iPointCoords->AppendL( aX2 );
+ iPointCoords->AppendL( aY2 );
+ iPointCoords->AppendL( aX3 );
+ iPointCoords->AppendL( aY3 );
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::ShortQuadToL( TFloatFixPt& aX2,
+// ---------------------------------------------------------------------------
+ void CGfxGeneralPath::ShortQuadToL( TFloatFixPt& aX2,
+ TFloatFixPt& aY2,
+ TBool aAbsolute )
+ {
+ if ( !aAbsolute && iPointCoords->Count() >= 2 )
+ {
+ // If the last command was 'Z'/'z'
+ // the current point is the initial point
+ // of the previous segment - 'M'/'m' usually
+ if ( iPointTypes->operator[]( iPointTypes->Count() - 1 ) == KSegClose )
+ {
+ aX2 += iLastX;
+ aY2 += iLastY;
+ }
+ else
+ {
+ aX2 += iPointCoords->operator[]( iPointCoords->Count() - 2 );
+ aY2 += iPointCoords->operator[]( iPointCoords->Count() - 1 );
+ }
+ }
+
+ TFloatFixPt aX1, aY1;
+ GetCurveRefPoint( aX1, aY1 );
+ QuadToL( aX1, aY1, aX2, aY2, ETrue );
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::ShortCubicToL( TFloatFixPt& aX2,
+// ---------------------------------------------------------------------------
+ void CGfxGeneralPath::ShortCubicToL( TFloatFixPt& aX2,
+ TFloatFixPt& aY2,
+ TFloatFixPt& aX3,
+ TFloatFixPt& aY3,
+ TBool aAbsolute )
+ {
+ if ( !aAbsolute && iPointCoords->Count() >= 2 )
+ {
+ TFloatFixPt lastX = iPointCoords->operator[]( iPointCoords->Count() - 2 );
+ TFloatFixPt lastY = iPointCoords->operator[]( iPointCoords->Count() - 1 );
+ // If the last command was 'Z'/'z'
+ // the current point is the initial point
+ // of the previous segment - 'M'/'m' usually
+ if ( iPointTypes->operator[]( iPointTypes->Count() - 1 ) == KSegClose )
+ {
+ lastX = iLastX;
+ lastY = iLastY;
+ }
+ aX2 += lastX;
+ aY2 += lastY;
+ aX3 += lastX;
+ aY3 += lastY;
+ }
+ TFloatFixPt aX1, aY1;
+ GetCurveRefPoint( aX1, aY1 );
+ // If there is no previous command or if the previous command
+ // was not an C, c, S or s, the first control point shall be coincident
+ // with the current point.
+ TUint32 KSegCubicto = ( TUint32 ) EGfxSegCubicTo; // const
+ if ( iPointTypes->operator[]( iPointTypes->Count() - 1 ) != KSegCubicto )
+ {
+ aX1 = iLastX;
+ aY1 = iLastY;
+ }
+
+ CubicToL( aX1, aY1, aX2, aY2, aX3, aY3, ETrue );
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::GetCurveRefPoint( TFloatFixPt& aX, TFloatFixPt& aY )
+// ---------------------------------------------------------------------------
+void CGfxGeneralPath::GetCurveRefPoint( TFloatFixPt& aX, TFloatFixPt& aY )
+ {
+ if ( iPointCoords->Count() < 4 )
+ {
+ aX = TFloatFixPt( 0 );
+ aY = TFloatFixPt( 0 );
+ return;
+ }
+ TFloatFixPt x0 = iPointCoords->operator[]( iPointCoords->Count() - 4 );
+ TFloatFixPt y0 = iPointCoords->operator[]( iPointCoords->Count() - 3 );
+ TFloatFixPt x1 = iPointCoords->operator[]( iPointCoords->Count() - 2 );
+ TFloatFixPt y1 = iPointCoords->operator[]( iPointCoords->Count() - 1 );
+ aX = x1 + x1 - x0;
+ aY = y1 + y1 - y0;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::Reset()
+// ---------------------------------------------------------------------------
+ void CGfxGeneralPath::Reset()
+ {
+ iPointTypes->Reset();
+ iPointCoords->Reset();
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::AppendL( CGfxPathIterator* aItr )
+// ---------------------------------------------------------------------------
+ void CGfxGeneralPath::AppendL( CGfxPathIterator* aItr )
+ {
+ TFloatFixPt tmpcoords[6];
+
+ // Set path data...
+ while ( !aItr->IsDone() )
+ {
+ switch ( aItr->CurrentSegment( tmpcoords ) )
+ {
+ case EGfxSegMoveTo:
+ MoveToL( tmpcoords[0], tmpcoords[1], ETrue );
+ break;
+ case EGfxSegLineTo:
+ LineToL( tmpcoords[0], tmpcoords[1], ETrue );
+ break;
+ case EGfxSegQuadTo:
+ QuadToL( tmpcoords[0],
+ tmpcoords[1],
+ tmpcoords[2],
+ tmpcoords[3],
+ ETrue );
+ break;
+ case EGfxSegCubicTo:
+ CubicToL( tmpcoords[0],
+ tmpcoords[1],
+ tmpcoords[2],
+ tmpcoords[3],
+ tmpcoords[4],
+ tmpcoords[5],
+ ETrue );
+ break;
+ case EGfxSegClose:
+ ClosePathL();
+ }
+ aItr->NextL();
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::GetBounds( const TGfxAffineTransform& aAt,
+// ---------------------------------------------------------------------------
+ void CGfxGeneralPath::GetBounds( const TGfxAffineTransform& aAt,
+ TGfxRectangle2D& aRect )
+ {
+ TFloatFixPt xMin(KMAXFLOATFIX), yMin(KMAXFLOATFIX), xMax(KMINFLOATFIX), yMax(KMINFLOATFIX);
+ for (TInt i=0; i<iPointCoords->Count(); i+=2)
+ {
+ TGfxPoint2D p((*iPointCoords)[i], (*iPointCoords)[i+1]);
+ aAt.Transform(&p, &p, 1);
+ if (p.iX < xMin) xMin = p.iX;
+ if (p.iX > xMax) xMax = p.iX;
+ if (p.iY < yMin) yMin = p.iY;
+ if (p.iY > yMax) yMax = p.iY;
+ }
+ aRect.iX = xMin;
+ aRect.iY = yMin;
+ aRect.iWidth = xMax - xMin;
+ aRect.iHeight = yMax - yMin;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::GetPathIteratorL( TGfxAffineTransform* aAt,
+// ---------------------------------------------------------------------------
+ void CGfxGeneralPath::GetPathIteratorL( TGfxAffineTransform* aAt,
+ CGfxPathIterator*& aPitr )
+ {
+ aPitr = new ( ELeave ) CGfxGeneralPathIteratorP( this, aAt );
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::GetPathIteratorL( TGfxAffineTransform* aAt,
+// ---------------------------------------------------------------------------
+ void CGfxGeneralPath::GetPathIteratorL( TGfxAffineTransform* aAt,
+ TInt aLimit,
+ CGfxPathIterator*& aPitr )
+ {
+ aPitr = CGfxFlatteningPathIterator::NewL( this, aAt, aLimit );
+
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::SetPointTypeArrayL( RArray<TUint32>* aTypesArray )
+// ---------------------------------------------------------------------------
+ void CGfxGeneralPath::SetPointTypeArrayL( RArray<TUint32>* aTypesArray )
+ {
+ TInt count = aTypesArray->Count();
+ iPointTypes->Reset();
+
+ for ( TInt i = 0; i < count; i++ )
+ {
+ iPointTypes->AppendL( (*aTypesArray)[i] );
+ }
+ }
+
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::SetPointTypeArrayRef( RArray<TUint32>*& aTypesArray )
+// ---------------------------------------------------------------------------
+ void CGfxGeneralPath::SetPointTypeArrayRef( RArray<TUint32>*& aTypesArray )
+ {
+ if (iPointTypes)
+ {
+ iPointTypes->Reset();
+ delete iPointTypes;
+ iPointTypes= NULL;
+ }
+ iPointTypes= aTypesArray;
+ }
+
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::SetPointCoordsArrayRef( RArray<TFloatFixPt>*& aPointCoords )
+// ---------------------------------------------------------------------------
+ void CGfxGeneralPath::SetPointCoordsArrayRef( RArray<TFloatFixPt>*& aPointCoords )
+ {
+ TInt count = aPointCoords->Count();
+ if (iPointCoords)
+ {
+ iPointCoords->Reset();
+ delete iPointCoords;
+ iPointCoords= NULL;
+ }
+ iPointCoords= aPointCoords;
+ }
+
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::SetPointCoordsArrayL( RArray<TFloatFixPt>* aPointCoords )
+// ---------------------------------------------------------------------------
+ void CGfxGeneralPath::SetPointCoordsArrayL( RArray<TFloatFixPt>* aPointCoords )
+ {
+ TInt count = aPointCoords->Count();
+ iPointCoords->Reset();
+
+ for ( TInt i = 0; (i+1) < count; i+=2 )
+ {
+ iPointCoords->AppendL( (*aPointCoords)[i] );
+ iPointCoords->AppendL( (*aPointCoords)[i+1] );
+ }
+ }
+
+// --------------------------------------------------------------------------
+// RArray<TUint32>* CGfxGeneralPath::PointTypeArray()
+// ---------------------------------------------------------------------------
+ RArray<TUint32>* CGfxGeneralPath::PointTypeArray()
+ {
+ return iPointTypes;
+ }
+
+ unsigned char* CGfxGeneralPath::PathSegmentTypeArray()
+ {
+ return iPathSegmentTypeArray;
+ }
+
+ void CGfxGeneralPath::PathSegmentTypeArray(unsigned char* aSegmentTypeArray)
+ {
+ iPathSegmentTypeArray = aSegmentTypeArray;
+ }
+// --------------------------------------------------------------------------
+// TFloatFixPt* CGfxGeneralPath::PointCoordsArray()
+// ---------------------------------------------------------------------------
+ TFloatFixPt* CGfxGeneralPath::PointCoordsArray()
+ {
+ if((iPointCoords) && (iPointCoords->Count() > 0))
+ return &( iPointCoords->operator[]( 0 ) );
+ else
+ return NULL;
+ }
+
+// --------------------------------------------------------------------------
+// RArray<TFloatFixPt>* CGfxGeneralPath::PointCoordsArrayAll()
+// ---------------------------------------------------------------------------
+ RArray<TFloatFixPt>* CGfxGeneralPath::PointCoordsArrayAll()
+ {
+ return iPointCoords;
+ }
+// --------------------------------------------------------------------------
+// TInt CGfxGeneralPath::GetSegmentCount()
+// ---------------------------------------------------------------------------
+ TInt CGfxGeneralPath::GetSegmentCount()
+ {
+ return iPointTypes->Count();
+ }
+// --------------------------------------------------------------------------
+// TInt CGfxGeneralPath::GetSegmentType(TInt aSegmentIndex)
+// ---------------------------------------------------------------------------
+ TInt CGfxGeneralPath::GetSegmentType(TInt aSegmentIndex)
+ {
+ if(aSegmentIndex > 0 && aSegmentIndex <= iPointTypes->Count())
+ {
+ TInt SegmentType = iPointTypes->operator[]( aSegmentIndex - 1 );
+ TInt KSegLineto = ( TInt ) EGfxSegLineTo;
+ if( SegmentType == KSegLineto)
+ {
+ // differentiate between vertical and horizontal lines.
+ TBool isVertical = EFalse;
+ TBool isHorizontal = EFalse;
+ // the following function will tel us that this line segment is horizontal
+ // or vertical.
+ IsHorizontalLineOrVertical(aSegmentIndex-1, isHorizontal, isVertical);
+ if( !isHorizontal )
+ {
+ if(isVertical)
+ {
+ TUint32 KVertical = 6;
+ return KVertical ;
+ }
+ }
+ else
+ {
+ TUint32 KHorizontal = 5;
+ return KHorizontal ;
+ }
+ return SegmentType;
+ }
+ return SegmentType;
+ }
+ else
+ {
+ return KErrBadHandle;
+ }
+ }
+// --------------------------------------------------------------------------
+// TReal32 CGfxGeneralPath::GetSegmentParameter(TInt aSegmentIndex , TInt aParameterIndex)
+// ---------------------------------------------------------------------------
+ TReal32 CGfxGeneralPath::GetSegmentParameter(TInt aSegmentIndex , TInt aParameterIndex)
+{
+ if( aSegmentIndex <= 0 && aSegmentIndex >= iPointTypes->Count())
+ {
+ return 0.0;
+ }
+
+ TInt count =0;
+ TInt Param = 0;
+
+ while(count < (aSegmentIndex -1))
+ {
+
+ switch(iPointTypes->operator[]( count))
+ {
+
+ case EGfxSegClose:
+ break;
+ case EGfxSegLineTo:
+ Param+=2;
+ break;
+ case EGfxSegQuadTo:
+ Param+= 4;
+ break;
+ case EGfxSegCubicTo:
+ Param +=6;
+ break;
+ case EGfxSegMoveTo:
+ Param+= 2;
+ break;
+ default:
+ break;
+ }
+ count++;
+ }
+
+ Param--;
+
+ if((Param + aParameterIndex) >= iPointCoords->Count())
+ {
+ return 0;
+ }
+
+ return (TReal32)iPointCoords->operator[](Param + aParameterIndex);
+}
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::IsHorizontalLineOrVertical(TInt aSegmentIndex, TBool& aHorizontal, TBool& aVertical)
+// ---------------------------------------------------------------------------
+void CGfxGeneralPath::IsHorizontalLineOrVertical(TInt aSegmentIndex, TBool& aHorizontal, TBool& aVertical)
+{
+ // see the previous segment.
+ if( aSegmentIndex <= 0 && aSegmentIndex >= iPointTypes->Count())
+ {
+ return;
+ }
+ TInt count =0;
+ TInt Param =0;
+ TInt LastPram = 0;
+ while(count <= aSegmentIndex )
+ {
+ // this will contain the Index to the last Segment.
+ LastPram= Param;
+
+ // search for the current segment.
+ switch(iPointTypes->operator[]( count))
+ {
+ // here increment the Param based on the number of attribute each command needs.
+ case EGfxSegClose:
+ break;
+ case EGfxSegLineTo:
+ Param+=2;
+ break;
+ case EGfxSegQuadTo:
+ Param+= 4;
+ break;
+ case EGfxSegCubicTo:
+ Param +=6;
+ break;
+ case EGfxSegMoveTo:
+ Param+= 2;
+ break;
+ default:
+ break;
+ }
+ count++;
+ }
+
+
+ Param--;
+ LastPram--;
+
+ if ( ( (Param-1) >= 0) && ( (LastPram - 1) >= 0) )
+ {
+
+ if(iPointCoords->operator[](Param-1) == iPointCoords->operator[](LastPram-1))
+ {
+ aVertical = ETrue;
+ return;
+ }
+ if(iPointCoords->operator[](Param) == iPointCoords->operator[](LastPram))
+ {
+ aHorizontal = ETrue;
+ return;
+ }
+ }
+ else if ( (Param - 1 ) >= 0 )
+ {
+ //this is the case where there is just a LineTo and nothing else
+ if ( iPointCoords->operator[](Param - 1) >= TFloatFixPt(0) )
+ {
+ aHorizontal = ETrue;
+ return;
+ }
+ else if ( iPointCoords->operator[](Param) >= TFloatFixPt(0) )
+ {
+ aVertical = ETrue;
+ return;
+ }
+ }
+}
+
+TUint8 CGfxGeneralPath::Count()
+{
+ return iCount;
+}
+
+void CGfxGeneralPath::Count(TUint8 aCount)
+{
+ iCount = aCount;
+}
+// --------------------------------------------------------------------------
+// CGfxGeneralPath* CGfxGeneralPath::CloneL()
+// ---------------------------------------------------------------------------
+ CGfxGeneralPath* CGfxGeneralPath::CloneL()
+{
+ CGfxGeneralPath* path = CGfxGeneralPath::NewLC();
+ TInt index = 0;
+
+ for( index = 0; index < iPointTypes->Count(); index++ )
+ {
+ path->iPointTypes->AppendL( iPointTypes->operator[]( index ) );
+ }
+ for( index = 0; index < iPointCoords->Count(); index++ )
+ {
+ path->iPointCoords->AppendL( iPointCoords->operator[]( index ) );
+ }
+ path->iLastX = iLastX;
+ path->iLastY = iLastY;
+ if(TUint8 count = path->Count())
+ {
+ path->iPathSegmentTypeArray = new unsigned char[count];
+ for(int i =0; i<count ; i++)
+ path->iPathSegmentTypeArray[i] = iPathSegmentTypeArray[i];
+ }
+ else
+ {
+ path->iPathSegmentTypeArray = NULL;
+ }
+ CleanupStack::Pop();
+ return path;
+}
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPath::QuadToLWithNoControlPoint()
+// If there is no previous command or if the previous command was not a
+// Q, q, T or t, the control point shall be current point.
+// ---------------------------------------------------------------------------
+void CGfxGeneralPath::QuadToLWithNoControlPoint(TFloatFixPt aX, TFloatFixPt aY)
+{
+ TUint32 KSegQuadto = ( TUint32 ) EGfxSegQuadTo;
+ iPointTypes->AppendL( KSegQuadto );
+ iPointCoords->AppendL( iLastX );
+ iPointCoords->AppendL( iLastY );
+ iPointCoords->AppendL( aX );
+ iPointCoords->AppendL( aY );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGeom/GfxGeneralPathIteratorP.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,149 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxGeneralPathIteratorP.h"
+#include "GfxGeneralPath.h"
+
+
+
+// --------------------------------------------------------------------------
+// CGfxGeneralPathIteratorP::CGfxGeneralPathIteratorP( CGfxGeneralPath* aPath,
+// ---------------------------------------------------------------------------
+ CGfxGeneralPathIteratorP::CGfxGeneralPathIteratorP( CGfxGeneralPath* aPath,
+ TGfxAffineTransform* aTransform )
+ {
+ iPath = aPath;
+ iTransform = aTransform;
+ }
+
+//
+// ---------------------------------------------------------------------------
+// Destructor.
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// CGfxGeneralPathIteratorP::~CGfxGeneralPathIteratorP()
+// ---------------------------------------------------------------------------
+ CGfxGeneralPathIteratorP::~CGfxGeneralPathIteratorP()
+ {
+ }
+
+
+
+// --------------------------------------------------------------------------
+// TGfxSegType CGfxGeneralPathIteratorP::CurrentSegment( TFloatFixPt* aCoords )
+// ---------------------------------------------------------------------------
+ TGfxSegType CGfxGeneralPathIteratorP::CurrentSegment( TFloatFixPt* aCoords )
+ {
+ TGfxSegType segtype = EGfxSegClose;
+ TInt32 pts = 1;
+
+ TFloatFixPt* pd = aCoords;
+ if(iPath->iPointCoords->Count() <= 0)
+ {
+ return segtype;
+ }
+ TFloatFixPt* ps = &( iPath->iPointCoords->operator[]( 0 ) );
+ switch ( ( TGfxSegType ) ( *( iPath->iPointTypes ) )[iTypeIdx] )
+ {
+ case EGfxSegMoveTo:
+ pd[0] = ps[iPointIdx];
+ pd[1] = ps[iPointIdx + 1];
+ iStartPoint.iX = pd[0];
+ iStartPoint.iY = pd[1];
+ segtype = EGfxSegMoveTo;
+ break;
+ case EGfxSegLineTo:
+ pd[0] = ps[iPointIdx];
+ pd[1] = ps[iPointIdx + 1];
+ segtype = EGfxSegLineTo;
+ break;
+ case EGfxSegQuadTo:
+ pd[0] = ps[iPointIdx];
+ pd[1] = ps[iPointIdx + 1];
+ pd[2] = ps[iPointIdx + 2];
+ pd[3] = ps[iPointIdx + 3];
+ segtype = EGfxSegQuadTo;
+ pts = 2;
+ break;
+ case EGfxSegCubicTo:
+ pd[0] = ps[iPointIdx];
+ pd[1] = ps[iPointIdx + 1];
+ pd[2] = ps[iPointIdx + 2];
+ pd[3] = ps[iPointIdx + 3];
+ pd[4] = ps[iPointIdx + 4];
+ pd[5] = ps[iPointIdx + 5];
+ segtype = EGfxSegCubicTo;
+ pts = 3;
+ break;
+ case EGfxSegClose:
+ pd[0] = iStartPoint.iX;
+ pd[1] = iStartPoint.iY;
+ segtype = EGfxSegClose;
+ break;
+ default:
+ segtype = EGfxSegClose;
+ pts = 0;
+ break;
+ }
+
+ if ( !iTransform->IsIdentity() && pts > 0 )
+ {
+ iTransform->Transform( aCoords, aCoords, pts );
+ }
+
+ return segtype;
+ }
+
+// --------------------------------------------------------------------------
+// TBool CGfxGeneralPathIteratorP::IsDone()
+// ---------------------------------------------------------------------------
+ TBool CGfxGeneralPathIteratorP::IsDone()
+ {
+ return ( iPath->iPointTypes->Count() <= iTypeIdx );
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxGeneralPathIteratorP::Next()
+// ---------------------------------------------------------------------------
+ void CGfxGeneralPathIteratorP::NextL()
+ {
+ if ( iPath->iPointTypes->Count() <= iTypeIdx - 1 )
+ {
+ return;
+ }
+ switch ( ( TGfxSegType ) ( *( iPath->iPointTypes ) )[iTypeIdx] )
+ {
+ case EGfxSegMoveTo:
+ iPointIdx += 2;
+ break;
+ case EGfxSegLineTo:
+ iPointIdx += 2;
+ break;
+ case EGfxSegQuadTo:
+ iPointIdx += 4;
+ break;
+ case EGfxSegCubicTo:
+ iPointIdx += 6;
+ break;
+ default:
+ break;
+ }
+
+ iTypeIdx++;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGeom/GfxLine2D.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxLine2D.h"
+#include "GfxLineIteratorP.h"
+
+#include "GfxFloatFixPt.h"
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// TGfxLine2D::TGfxLine2D( const TFloatFixPt& aX1,
+// ---------------------------------------------------------------------------
+ TGfxLine2D::TGfxLine2D( const TFloatFixPt& aX1,
+ const TFloatFixPt& aY1,
+ const TFloatFixPt& aX2,
+ const TFloatFixPt& aY2 ) :
+ iX1( aX1 ),
+ iY1( aY1 ),
+ iX2( aX2 ),
+ iY2( aY2 )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// TGfxLine2D::TGfxLine2D( TGfxPoint2D /* aP1 */, TGfxPoint2D /* aP2 */ )
+// ---------------------------------------------------------------------------
+ TGfxLine2D::TGfxLine2D( TGfxPoint2D /* aP1 */, TGfxPoint2D /* aP2 */ )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// From MGfxShape
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// void TGfxLine2D::GetBounds( const TGfxAffineTransform& aAt,
+// ---------------------------------------------------------------------------
+ void TGfxLine2D::GetBounds( const TGfxAffineTransform& aAt,
+ TGfxRectangle2D& aRect )
+ {
+ TGfxPoint2D p1( iX1, iY1 ), p2( iX2, iY2 );
+ aAt.Transform( &p1, & p1, 1 );
+ aAt.Transform( &p2, & p2, 1 );
+ aRect.iX = ( p1.iX > p2.iX ) ? p2.iX : p1.iX;
+ aRect.iY = ( p1.iY > p2.iY ) ? p2.iY : p1.iY;
+ aRect.iWidth = ( p1.iX > p2.iX ) ? p1.iX - p2.iX : p2.iX - p1.iX;
+ aRect.iHeight = ( p1.iY > p2.iY ) ? p1.iY - p2.iY : p2.iY - p1.iY;
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxLine2D::GetPathIteratorL( TGfxAffineTransform* aAt,
+// ---------------------------------------------------------------------------
+ void TGfxLine2D::GetPathIteratorL( TGfxAffineTransform* aAt,
+ CGfxPathIterator*& aPitr )
+ {
+ aPitr = ( CGfxPathIterator * ) new( ELeave )
+ CGfxLineIteratorP( this, aAt );
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxLine2D::GetPathIteratorL( TGfxAffineTransform* aAt,
+// ---------------------------------------------------------------------------
+ void TGfxLine2D::GetPathIteratorL( TGfxAffineTransform* aAt,
+ TInt /* aLimit */,
+ CGfxPathIterator*& aPitr )
+ {
+ aPitr = new( ELeave ) CGfxLineIteratorP( this, aAt );
+ }
+
+// --------------------------------------------------------------------------
+// TFloatFixPt TGfxLine2D::Length()
+// ---------------------------------------------------------------------------
+ TFloatFixPt TGfxLine2D::Length()
+ {
+ TFloatFixPt dx, dy, int0x7f( KMAXFLOATFIX );
+
+ dx = iX1 - iX2;
+ dy = iY1 - iY2;
+ if ( dx > int0x7f || dy > int0x7f )
+ {
+ // calculate as integer
+ TInt32 tmplen, tx, ty;
+ tx = ( TInt32 ) dx;
+ ty = ( TInt32 ) dy;
+ #ifdef SVG_FLOAT_BUILD
+ tmplen = TFloatFixPt::Sqrt( tx * tx + ty * ty );
+ #else
+ tmplen = TFloatFixPt::FixedSqrtGeneral( tx * tx + ty * ty, 0 );
+ #endif
+ return TFloatFixPt( tmplen );
+ }
+
+ return TFloatFixPt::Sqrt( dx * dx + dy * dy );
+ }
+
+// --------------------------------------------------------------------------
+// TFloatFixPt TGfxLine2D::AreaSize()
+// ---------------------------------------------------------------------------
+TFloatFixPt TGfxLine2D::AreaSize()
+ {
+ return TFloatFixPt( 0 );
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGeom/GfxLineIteratorP.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxLineIteratorP.h"
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// CGfxLineIteratorP::CGfxLineIteratorP( TGfxLine2D* aLine,
+// ---------------------------------------------------------------------------
+CGfxLineIteratorP::CGfxLineIteratorP( TGfxLine2D* aLine,
+ TGfxAffineTransform* aAffine ) :
+ iLine( aLine ),
+ iIdx( 0 )
+ {
+ iTransform = aAffine;
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// CGfxLineIteratorP::~CGfxLineIteratorP()
+// ---------------------------------------------------------------------------
+CGfxLineIteratorP::~CGfxLineIteratorP()
+{
+}
+
+// --------------------------------------------------------------------------
+// TGfxSegType CGfxLineIteratorP::CurrentSegment( TFloatFixPt* aCoords )
+// ---------------------------------------------------------------------------
+TGfxSegType CGfxLineIteratorP::CurrentSegment( TFloatFixPt* aCoords )
+ {
+ TGfxSegType segtype;
+
+ if ( iIdx == 0 )
+ {
+ aCoords[0] = iLine->iX1;
+ aCoords[1] = iLine->iY1;
+ segtype = EGfxSegMoveTo;
+ }
+ else
+ {
+ aCoords[0] = iLine->iX2;
+ aCoords[1] = iLine->iY2;
+ segtype = EGfxSegLineTo;
+ }
+ if ( !iTransform->IsIdentity() )
+ {
+ iTransform->Transform( aCoords, aCoords, 1 );
+ }
+
+ return segtype;
+ }
+
+// --------------------------------------------------------------------------
+// TBool CGfxLineIteratorP::IsDone()
+// ---------------------------------------------------------------------------
+TBool CGfxLineIteratorP::IsDone()
+ {
+ return ( iIdx > 1 );
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxLineIteratorP::Next()
+// ---------------------------------------------------------------------------
+void CGfxLineIteratorP::NextL()
+ {
+ iIdx++;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGeom/GfxPoint2D.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxPoint2D.h"
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// TGfxPoint2D::TGfxPoint2D()
+// ---------------------------------------------------------------------------
+ TGfxPoint2D::TGfxPoint2D()
+ {
+ }
+
+// --------------------------------------------------------------------------
+// TGfxPoint2D::TGfxPoint2D( TFloatFixPt aX, TFloatFixPt aY ) : iX( aX ), iY( aY )
+// ---------------------------------------------------------------------------
+ TGfxPoint2D::TGfxPoint2D( TFloatFixPt aX, TFloatFixPt aY ) : iX( aX ), iY( aY )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// TFloatFixPt TGfxPoint2D::Distance( const TGfxPoint2D& aPoint )
+// ---------------------------------------------------------------------------
+ TFloatFixPt TGfxPoint2D::Distance( const TGfxPoint2D& aPoint )
+ {
+ return TFloatFixPt::Sqrt( DistanceSq( aPoint ) );
+ }
+
+// --------------------------------------------------------------------------
+// TFloatFixPt TGfxPoint2D::DistanceSq( const TGfxPoint2D& aPoint )
+// ---------------------------------------------------------------------------
+ TFloatFixPt TGfxPoint2D::DistanceSq( const TGfxPoint2D& aPoint )
+ {
+ TFloatFixPt dx = iX - aPoint.iX;
+ TFloatFixPt dy = iY - aPoint.iY;
+ return dx * dx + dy * dy;
+ }
+
+// ==========================================================================
+// Equals operator
+// ==========================================================================
+ TInt TGfxPoint2D::operator==( const TGfxPoint2D& aVal ) const
+ {
+ return (iX == aVal.iX && iY == aVal.iY);
+ }
+
+// ==========================================================================
+// Equals operator
+// ==========================================================================
+ TInt TGfxPoint2D::operator!=( const TGfxPoint2D& aVal ) const
+ {
+ return (!(iX == aVal.iX && iY == aVal.iY));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGeom/GfxRectangle2D.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxRectangle2D.h"
+#include "GfxRectangleIteratorP.h"
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// TGfxRectangle2D::TGfxRectangle2D()
+// ---------------------------------------------------------------------------
+ TGfxRectangle2D::TGfxRectangle2D()
+ {
+ }
+
+// --------------------------------------------------------------------------
+// TGfxRectangle2D::TGfxRectangle2D( const TFloatFixPt& aX,
+// ---------------------------------------------------------------------------
+ TGfxRectangle2D::TGfxRectangle2D( const TFloatFixPt& aX,
+ const TFloatFixPt& aY,
+ const TFloatFixPt& aWidth,
+ const TFloatFixPt& aHeight )
+ : TGfxRectangularShape( aX,
+ aY,
+ aWidth,
+ aHeight )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// TGfxRectangle2D::TGfxRectangle2D( const TGfxRectangle2D& aRect )
+// ---------------------------------------------------------------------------
+ TGfxRectangle2D::TGfxRectangle2D( const TGfxRectangle2D& aRect )
+ :TGfxRectangularShape(aRect.iX,
+ aRect.iY,
+ aRect.iWidth,
+ aRect.iHeight)
+ {
+ }
+
+// --------------------------------------------------------------------------
+// TBool TGfxRectangle2D::Intersects( const TGfxRectangle2D& aRect )
+// ---------------------------------------------------------------------------
+ TBool TGfxRectangle2D::Intersects( const TGfxRectangle2D& aRect )
+ {
+ return ( !( aRect.iX + aRect.iWidth < iX ||
+ iX + iWidth < aRect.iX ||
+ aRect.iY + aRect.iHeight < iY ||
+ iY + iHeight < aRect.iY ) );
+ }
+
+// --------------------------------------------------------------------------
+// TBool TGfxRectangle2D::Contains( TGfxPoint2D aPoint )
+// ---------------------------------------------------------------------------
+ TBool TGfxRectangle2D::Contains( TGfxPoint2D aPoint )
+ {
+ return ( iX <= aPoint.iX &&
+ aPoint.iX <= ( iX + iWidth ) &&
+ iY <= aPoint.iY &&
+ aPoint.iY <= ( iY + iHeight ) );
+ }
+
+
+// --------------------------------------------------------------------------
+// void TGfxRectangle2D::GetPathIteratorL( TGfxAffineTransform* aAt,
+// ---------------------------------------------------------------------------
+ void TGfxRectangle2D::GetPathIteratorL( TGfxAffineTransform* aAt,
+ CGfxPathIterator*& aPitr )
+ {
+ aPitr = new ( ELeave ) CGfxRectangleIteratorP( this, aAt );
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxRectangle2D::GetPathIteratorL( TGfxAffineTransform* aAt,
+// ---------------------------------------------------------------------------
+ void TGfxRectangle2D::GetPathIteratorL( TGfxAffineTransform* aAt,
+ TInt /* aLimit */,
+ CGfxPathIterator*& aPitr )
+ {
+ aPitr = new ( ELeave ) CGfxRectangleIteratorP( this, aAt );
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxRectangle2D::operator==( const TGfxRectangle2D& aRect ) const;
+// ---------------------------------------------------------------------------
+ TInt TGfxRectangle2D::operator==( const TGfxRectangle2D& aRect ) const
+{
+ return (iX == aRect.iX && iY == aRect.iY && iWidth == aRect.iWidth && iHeight == aRect.iHeight);
+}
+
+// --------------------------------------------------------------------------
+// void TGfxRectangle2D::operator!=( const TGfxRectangle2D& aRect ) const;
+// ---------------------------------------------------------------------------
+ TInt TGfxRectangle2D::operator!=( const TGfxRectangle2D& aRect ) const
+{
+ return (!(iX == aRect.iX && iY == aRect.iY && iWidth == aRect.iWidth && iHeight == aRect.iHeight));
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGeom/GfxRectangleIteratorP.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxRectangleIteratorP.h"
+#include "GfxRectangle2D.h"
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// CGfxRectangleIteratorP::CGfxRectangleIteratorP( TGfxRectangularShape* aRect,
+// ---------------------------------------------------------------------------
+CGfxRectangleIteratorP::CGfxRectangleIteratorP( TGfxRectangularShape* aRect,
+ TGfxAffineTransform* aTransform )
+ {
+ TFloatFixPt KZero;
+ if ( aRect->iWidth < KZero )
+ aRect->iWidth = KZero;
+
+ if ( aRect->iHeight < KZero )
+ aRect->iHeight = KZero;
+
+ iRect = aRect;
+ iTransform = aTransform;
+ }
+
+// ---------------------------------------------------------------------------
+// destructor
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// CGfxRectangleIteratorP::~CGfxRectangleIteratorP( )
+// ---------------------------------------------------------------------------
+CGfxRectangleIteratorP::~CGfxRectangleIteratorP( )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// TGfxSegType CGfxRectangleIteratorP::CurrentSegment( TFloatFixPt* aCoords )
+// ---------------------------------------------------------------------------
+TGfxSegType CGfxRectangleIteratorP::CurrentSegment( TFloatFixPt* aCoords )
+ {
+ TGfxSegType segtype;
+
+ switch ( iIdx )
+ {
+ case 0:
+ aCoords[0] = iRect->iX;
+ aCoords[1] = iRect->iY;
+ segtype = EGfxSegMoveTo;
+ break;
+ case 1:
+ aCoords[0] = iRect->iX + iRect->iWidth;
+ aCoords[1] = iRect->iY ;
+ segtype = EGfxSegLineTo;
+ break;
+ case 2:
+ aCoords[0] = iRect->iX + iRect->iWidth;
+ aCoords[1] = iRect->iY + iRect->iHeight;
+ segtype = EGfxSegLineTo;
+ break;
+ case 3:
+ aCoords[0] = iRect->iX;
+ aCoords[1] = iRect->iY + iRect->iHeight;
+ segtype = EGfxSegLineTo;
+ break;
+ default:
+ segtype = EGfxSegClose;
+ }
+
+ if ( !iTransform->IsIdentity() )
+ {
+ iTransform->Transform( aCoords, aCoords, 1 );
+ }
+
+ return segtype;
+ }
+
+// --------------------------------------------------------------------------
+// TBool CGfxRectangleIteratorP::IsDone()
+// ---------------------------------------------------------------------------
+TBool CGfxRectangleIteratorP::IsDone()
+ {
+ return ( iIdx > 4 );
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxRectangleIteratorP::Next()
+// ---------------------------------------------------------------------------
+void CGfxRectangleIteratorP::NextL()
+ {
+ iIdx++;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGeom/GfxRectangularShape.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,160 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxRectangularShape.h"
+#include "GfxRectangle2D.h"
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// TGfxRectangularShape::TGfxRectangularShape()
+// ---------------------------------------------------------------------------
+ TGfxRectangularShape::TGfxRectangularShape()
+ {
+ }
+
+// --------------------------------------------------------------------------
+// TGfxRectangularShape::TGfxRectangularShape( const TFloatFixPt& aX,
+// ---------------------------------------------------------------------------
+ TGfxRectangularShape::TGfxRectangularShape( const TFloatFixPt& aX,
+ const TFloatFixPt& aY,
+ const TFloatFixPt& aWidth,
+ const TFloatFixPt& aHeight )
+ :iWidth(aWidth),
+ iHeight(aHeight),
+ iX(aX),
+ iY(aY)
+ {
+ }
+
+
+// --------------------------------------------------------------------------
+// void TGfxRectangularShape::GetBounds( const TGfxAffineTransform& aAt,
+// ---------------------------------------------------------------------------
+ void TGfxRectangularShape::GetBounds( const TGfxAffineTransform& aAt,
+ TGfxRectangle2D& aRect )
+ {
+ TGfxPoint2D p[4];
+ p[0].iX = iX;
+ p[0].iY = iY;
+ p[1].iX = iX + iWidth;
+ p[1].iY = iY;
+ p[2].iX = iX + iWidth;
+ p[2].iY = iY + iHeight;
+ p[3].iX = iX;
+ p[3].iY = iY + iHeight;
+ aAt.Transform( p, p, 4 );
+
+ TFloatFixPt xMin( KMAXFLOATFIX ), yMin( KMAXFLOATFIX ), xMax( KMINFLOATFIX ), yMax( KMINFLOATFIX );
+ for ( TInt32 i = 0; i < 4; i++ )
+ {
+ if ( p[i].iX < xMin )
+ xMin = p[i].iX;
+ if ( p[i].iX > xMax )
+ xMax = p[i].iX;
+ if ( p[i].iY < yMin )
+ yMin = p[i].iY;
+ if ( p[i].iY > yMax )
+ yMax = p[i].iY;
+ }
+
+ aRect.iX = xMin;
+ aRect.iY = yMin;
+ aRect.iWidth = xMax - xMin;
+ aRect.iHeight = yMax - yMin;
+ }
+
+// --------------------------------------------------------------------------
+// TFloatFixPt TGfxRectangularShape::AreaSize()
+// ---------------------------------------------------------------------------
+ TFloatFixPt TGfxRectangularShape::AreaSize()
+ {
+ if ( iWidth > KMAXFLOATFIX || iHeight > KMAXFLOATFIX )
+ {
+ TInt area = ( ( TInt ) iWidth ) * ( ( TInt ) iHeight );
+ if ( area < KMAXFLOATFIXVALUE )
+ return TFloatFixPt( area );
+ else
+ return KMAXFLOATFIX;
+ }
+ else
+ {
+ return iWidth * iHeight;
+ }
+ }
+
+// --------------------------------------------------------------------------
+// TFloatFixPt TGfxRectangularShape::CenterX()
+// ---------------------------------------------------------------------------
+ TFloatFixPt TGfxRectangularShape::CenterX()
+ {
+ #ifdef SVG_FLOAT_BUILD
+ return ( iX + (iWidth * TFloatFixPt(.5f)));
+ #else
+ return ( iX + (iWidth >> 1));
+ #endif
+ }
+
+
+// --------------------------------------------------------------------------
+// TFloatFixPt TGfxRectangularShape::CenterY()
+// ---------------------------------------------------------------------------
+ TFloatFixPt TGfxRectangularShape::CenterY()
+ {
+ #ifdef SVG_FLOAT_BUILD
+ return ( iY + (iHeight * TFloatFixPt(.5f))) ;
+ #else
+ return ( iY + (iHeight >> 1)) ;
+ #endif
+ }
+
+
+// --------------------------------------------------------------------------
+// TFloatFixPt TGfxRectangularShape::MinX()
+// ---------------------------------------------------------------------------
+ TFloatFixPt TGfxRectangularShape::MinX()
+ {
+ return TFloatFixPt( iX );
+ }
+
+// --------------------------------------------------------------------------
+// TFloatFixPt TGfxRectangularShape::MinY()
+// ---------------------------------------------------------------------------
+ TFloatFixPt TGfxRectangularShape::MinY()
+ {
+ return TFloatFixPt( iY );
+ }
+
+// --------------------------------------------------------------------------
+// TFloatFixPt TGfxRectangularShape::MaxX()
+// ---------------------------------------------------------------------------
+ TFloatFixPt TGfxRectangularShape::MaxX()
+ {
+ return TFloatFixPt( iX + iWidth );
+ }
+
+// --------------------------------------------------------------------------
+// TFloatFixPt TGfxRectangularShape::MaxY()
+// ---------------------------------------------------------------------------
+ TFloatFixPt TGfxRectangularShape::MaxY()
+ {
+ return TFloatFixPt( iY + iHeight );
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGeom/GfxRoundRectangle2D.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxRoundRectangle2D.h"
+#include "GfxRoundRectangleIteratorP.h"
+#include "GfxFlatteningPathIterator.h"
+#include "GfxRectangleIteratorP.h"
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// TGfxRoundRectangle2D::TGfxRoundRectangle2D()
+// ---------------------------------------------------------------------------
+ TGfxRoundRectangle2D::TGfxRoundRectangle2D()
+ : TGfxRectangularShape( 0,
+ 0,
+ 0,
+ 0 ),
+ iArcWidth( 0 ),
+ iArcHeight( 0 )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// TGfxRoundRectangle2D::TGfxRoundRectangle2D( const TFloatFixPt& aX,
+// ---------------------------------------------------------------------------
+ TGfxRoundRectangle2D::TGfxRoundRectangle2D( const TFloatFixPt& aX,
+ const TFloatFixPt& aY,
+ const TFloatFixPt& aW,
+ const TFloatFixPt& aH,
+ const TFloatFixPt& aArcWidth,
+ const TFloatFixPt& aArcHeight )
+ : TGfxRectangularShape( aX,
+ aY,
+ aW,
+ aH ),
+ iArcWidth( aArcWidth ),
+ iArcHeight( aArcHeight )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxRoundRectangle2D::GetPathIteratorL( TGfxAffineTransform* aAt,
+// ---------------------------------------------------------------------------
+ void TGfxRoundRectangle2D::GetPathIteratorL( TGfxAffineTransform* aAt,
+ CGfxPathIterator*& aPitr )
+ {
+ TFloatFixPt KZero;
+ if ( iArcWidth <= KZero && iArcHeight <= KZero )
+ aPitr = new ( ELeave ) CGfxRectangleIteratorP( this, aAt );
+ else
+ aPitr = new ( ELeave ) CGfxRoundRectangleIteratorP( this, aAt );
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxRoundRectangle2D::GetPathIteratorL( TGfxAffineTransform* aAt,
+// ---------------------------------------------------------------------------
+ void TGfxRoundRectangle2D::GetPathIteratorL( TGfxAffineTransform* aAt,
+ TInt aLimit,
+ CGfxPathIterator*& aPitr )
+ {
+ aPitr = CGfxFlatteningPathIterator::NewL( this, aAt, aLimit );
+
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxGeom/GfxRoundRectangleIteratorP.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,185 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxRoundRectangleIteratorP.h"
+#include "GfxRoundRectangle2D.h"
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// CGfxRoundRectangleIteratorP::CGfxRoundRectangleIteratorP( TGfxRoundRectangle2D* aRoundRect,
+// ---------------------------------------------------------------------------
+CGfxRoundRectangleIteratorP::CGfxRoundRectangleIteratorP( TGfxRoundRectangle2D* aRoundRect,
+ TGfxAffineTransform* aAffine )
+ : iRoundRect( aRoundRect )
+ {
+ iTransform = aAffine;
+
+
+
+ TFloatFixPt invalid( -1 );
+ TFloatFixPt KZero;
+
+ iRx = aRoundRect->iArcWidth;
+ iRy = aRoundRect->iArcHeight;
+
+ if ( ( ( iRx == invalid ) && ( iRy == invalid ) ) ||
+ ( iRx < invalid ) || ( iRy < invalid ) )
+ {
+ iRx = KZero;
+ iRy = KZero;
+ }
+ else if ( iRx == invalid )
+ {
+ iRx = iRy;
+ }
+ else if ( iRy == invalid )
+ {
+ iRy = iRx;
+ }
+
+ if ( aRoundRect->iWidth < KZero )
+ aRoundRect->iWidth = KZero;
+
+ if ( aRoundRect->iHeight < KZero )
+ aRoundRect->iHeight = KZero;
+
+ #ifdef SVG_FLOAT_BUILD
+ TFloatFixPt hw = aRoundRect->iWidth * TFloatFixPt(.5f);
+ TFloatFixPt hh = aRoundRect->iHeight * TFloatFixPt(.5f);
+ #else
+ TFloatFixPt hw = aRoundRect->iWidth >> 1;
+ TFloatFixPt hh = aRoundRect->iHeight >> 1;
+ #endif
+ if ( iRx > hw )
+ iRx = hw;
+ if ( iRy > hh )
+ iRy = hh;
+
+ aRoundRect->iArcWidth = iRx;
+ aRoundRect->iArcHeight = iRy;
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// CGfxRoundRectangleIteratorP::~CGfxRoundRectangleIteratorP()
+// ---------------------------------------------------------------------------
+CGfxRoundRectangleIteratorP::~CGfxRoundRectangleIteratorP()
+{
+}
+
+// --------------------------------------------------------------------------
+// TGfxSegType CGfxRoundRectangleIteratorP::CurrentSegment( TFloatFixPt* aCoords )
+// ---------------------------------------------------------------------------
+TGfxSegType CGfxRoundRectangleIteratorP::CurrentSegment( TFloatFixPt* aCoords )
+ {
+ TGfxSegType segtype;
+ TInt32 pts = 1;
+
+ switch ( iIdx )
+ {
+ case 0:
+ aCoords[0] = iRoundRect->iX + iRx;
+ aCoords[1] = iRoundRect->iY;
+ segtype = EGfxSegMoveTo;
+ break;
+ case 1:
+ aCoords[0] = iRoundRect->iX + iRoundRect->iWidth - iRx;
+ aCoords[1] = iRoundRect->iY ;
+ segtype = EGfxSegLineTo;
+ break;
+ case 2:
+ aCoords[0] = iRoundRect->iX + iRoundRect->iWidth;
+ aCoords[1] = iRoundRect->iY ;
+ aCoords[2] = iRoundRect->iX + iRoundRect->iWidth;
+ aCoords[3] = iRoundRect->iY + iRy;
+ segtype = EGfxSegQuadTo;
+ pts = 2;
+ break;
+ case 3:
+ aCoords[0] = iRoundRect->iX + iRoundRect->iWidth;
+ aCoords[1] = iRoundRect->iY + iRoundRect->iHeight - iRy;
+ segtype = EGfxSegLineTo;
+ break;
+ case 4:
+ aCoords[0] = iRoundRect->iX + iRoundRect->iWidth;
+ aCoords[1] = iRoundRect->iY + iRoundRect->iHeight;
+ aCoords[2] = iRoundRect->iX + iRoundRect->iWidth - iRx;
+ aCoords[3] = iRoundRect->iY + iRoundRect->iHeight;
+ segtype = EGfxSegQuadTo;
+ pts = 2;
+ break;
+ case 5:
+ aCoords[0] = iRoundRect->iX + iRx;
+ aCoords[1] = iRoundRect->iY + iRoundRect->iHeight;
+ segtype = EGfxSegLineTo;
+ break;
+ case 6:
+ aCoords[0] = iRoundRect->iX;
+ aCoords[1] = iRoundRect->iY + iRoundRect->iHeight;
+ aCoords[2] = iRoundRect->iX;
+ aCoords[3] = iRoundRect->iY + iRoundRect->iHeight - iRy;
+ segtype = EGfxSegQuadTo;
+ pts = 2;
+ break;
+ case 7:
+ aCoords[0] = iRoundRect->iX;
+ aCoords[1] = iRoundRect->iY + iRy;
+ segtype = EGfxSegLineTo;
+ break;
+ case 8:
+ aCoords[0] = iRoundRect->iX;
+ aCoords[1] = iRoundRect->iY;
+ aCoords[2] = iRoundRect->iX + iRx;
+ aCoords[3] = iRoundRect->iY;
+ segtype = EGfxSegQuadTo;
+ pts = 2;
+ break;
+ default:
+ segtype = EGfxSegClose;
+ pts = 0;
+ }
+
+ if ( !iTransform->IsIdentity() && pts > 0 )
+ {
+ iTransform->Transform( aCoords, aCoords, pts );
+ }
+
+ return segtype;
+ }
+
+// --------------------------------------------------------------------------
+// TBool CGfxRoundRectangleIteratorP::IsDone()
+// ---------------------------------------------------------------------------
+TBool CGfxRoundRectangleIteratorP::IsDone()
+ {
+ return ( iIdx > 9 );
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxRoundRectangleIteratorP::Next()
+// ---------------------------------------------------------------------------
+void CGfxRoundRectangleIteratorP::NextL()
+ {
+ iIdx++;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxImage/GfxImageTransformer.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,880 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxImageTransformer.h"
+#include "GfxColor.h"
+
+#define RGB565toRGB888(rgb565) (0xff000000|((rgb565 << 8) & 0xf80000) | ((rgb565 << 5) & 0x00fc00) | ((rgb565 << 3) & 0x000f8))
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// TGfxImageTransformer::TGfxImageTransformer( TGfxAffineTransform* aTransform )
+// ---------------------------------------------------------------------------
+ TGfxImageTransformer::TGfxImageTransformer( TGfxAffineTransform* aTransform, CVGRenderer * aRenderer )
+ {
+ iTransform = aTransform;
+ iVgRenderer = aRenderer;
+ }
+
+
+
+
+// --------------------------------------------------------------------------
+// void TGfxImageTransformer::ImageBlend( CFbsBitmap* aSrc,
+// ---------------------------------------------------------------------------
+ void TGfxImageTransformer::ImageBlend( CFbsBitmap* aSrc,
+ const TGfxPoint2D& aP,
+ TInt aDstWidth,
+ TInt aDstHeight,
+ const TRect& aClipRect,
+ TBool aReverse)
+{
+
+ TRect srcrect( TPoint( aP.iX, aP.iY ), aSrc->SizeInPixels() );
+ TRect dstrect( TPoint( 0, 0 ), TSize(aDstWidth, aDstHeight) );
+ TInt srcWidth = aSrc->SizeInPixels().iWidth;
+ TInt srcHeight = aSrc->SizeInPixels().iHeight;
+
+ TGfxRectangle2D rect2d = GetTransformedBound( aSrc, aP );
+ TRect rect (TPoint( rect2d.iX, rect2d.iY ), TSize( rect2d.iWidth, rect2d.iHeight ) );
+ rect.Intersection(aClipRect); // Clipping
+
+ if ( !rect.Intersects( dstrect ) ) // clip rect with dst image
+ return;
+
+ aSrc->LockHeap();
+ rect.Intersection( dstrect );
+
+ TUint32* bufsrc32 = (TUint32*) aSrc->DataAddress();
+ TUint bufLimit = aDstWidth * aDstHeight;
+
+ TGfxAffineTransform inv = iTransform->CreateInverse();
+
+ TInt xstart, xend, yend;
+ TGfxPoint2D horizDeriv;
+ TGfxPoint2D origin, top, right, corner, east, west, south, north;
+
+ // sort four corners into appropriate order
+ SortCoordinates(origin, top, north, south, right, east, west,
+ corner, aP, srcWidth, srcHeight);
+
+ // compute derivitives for scanline in source.
+ TPoint pinv;
+ TGfxPoint2D p;
+ p.iX = 8;
+ p.iY = 0;
+ inv.Transform( &p, & p, 1 );
+ horizDeriv.iX = p.iX;
+ horizDeriv.iY = p.iY;
+ p.iX = 0;
+ p.iY = 0;
+ inv.Transform( &p, & p, 1 );
+ horizDeriv.iX -= p.iX;
+ horizDeriv.iY -= p.iY;
+ horizDeriv.iX = horizDeriv.iX >> 3;
+ horizDeriv.iY = horizDeriv.iY >> 3;
+
+ yend = rect.iBr.iY;
+ TInt bufLength = rect.iTl.iX + ( rect.iTl.iY * aDstWidth );
+ TInt tempBufLength = bufLength;
+
+ TInt x, y;
+ TInt sx, sy;
+ TUint32 pixel;
+ TInt offset;
+ VGint stride = CFbsBitmap::ScanLineLength( aDstWidth, aSrc->DisplayMode() );
+ for ( y = rect.iTl.iY; y <= yend; y++ )
+ {
+ p.iY = y;
+ // compute scanline starting position
+ ComputeXPositions((TFloatFixPt)y, rect, north, west, east, south, xstart, xend);
+
+ p.iX = xstart;
+ // transform that starting position to the source image
+ inv.Transform( &p, & p, 1 );
+ bufLength += xstart - rect.iTl.iX;
+
+ #ifdef SVG_FLOAT_BUILD
+ p.iY -= TFloatFixPt( .5f );
+ #else
+ p.iY -= TFloatFixPt(0x8000, ETrue);
+ #endif
+ for ( x = xstart; x <= xend; x++ )
+ {
+ //increment the location of the position by one horizontal location
+ pinv.iX = p.iX;
+ pinv.iY = p.iY;
+
+ if ( srcrect.Contains( pinv ) )
+ {
+ pinv.iX -= ( TInt32 ) aP.iX;
+ pinv.iY -= ( TInt32 ) aP.iY;
+ // find out cooresponding x & y in OpenVG
+ offset = bufLength;
+ sy = aDstHeight - (offset / aDstWidth);
+ sx = offset % aDstWidth;
+ if (aReverse)
+ {
+ iVgRenderer->vgReadPixels((void *)&pixel, stride, VG_sRGBA_8888_PRE, sx, sy, 1, 1);
+ *(bufsrc32 + ( TInt32 ) pinv.iX + (srcWidth)*( TInt32 ) (pinv.iY)) =
+ (pixel >> 8) | (pixel << 24) ;
+ }
+ else
+ {
+ pixel = *(bufsrc32 + ( TInt32 ) pinv.iX + (srcWidth)*( TInt32 ) (pinv.iY));
+ pixel = (pixel << 8) | (pixel >> 24);
+ iVgRenderer->vgWritePixels((void *)&pixel, stride, VG_sRGBA_8888_PRE, sx, sy, 1, 1);
+ }
+ }
+ p.iX += horizDeriv.iX;
+ p.iY += horizDeriv.iY;
+ bufLength++;
+ }
+ tempBufLength += aDstWidth;
+ bufLength = tempBufLength;
+ if (tempBufLength + aDstWidth >= bufLimit)
+ {
+ aSrc->UnlockHeap();
+ return;
+ }
+ }
+ aSrc->UnlockHeap();
+
+ }
+
+
+
+
+
+
+// --------------------------------------------------------------------------
+// void TGfxImageTransformer::SortCoordinates
+// ---------------------------------------------------------------------------
+
+void TGfxImageTransformer::SortCoordinates(
+ TGfxPoint2D& origin, TGfxPoint2D& top,
+ TGfxPoint2D& north, TGfxPoint2D& south, TGfxPoint2D& right,
+ TGfxPoint2D& east, TGfxPoint2D& west, TGfxPoint2D& corner,
+ const TGfxPoint2D aP, const TInt srcWidth, const TInt srcHeight)
+ {
+
+ origin.iX = aP.iX;
+ origin.iY = aP.iY;
+ corner.iX = aP.iX + (TFloatFixPt)srcWidth;
+ corner.iY = aP.iY + (TFloatFixPt)srcHeight;
+ top.iX = aP.iX;
+ top.iY = aP.iY + (TFloatFixPt)srcHeight;
+ right.iX = aP.iX + (TFloatFixPt)srcWidth;
+ right.iY = aP.iY;
+
+ // transform corners of the source rectangle.
+ iTransform->Transform(&origin, &origin, 1);
+ iTransform->Transform(&top, &top, 1);
+ iTransform->Transform(&right, &right, 1);
+ iTransform->Transform(&corner, &corner, 1);
+
+ west = origin; east = corner; north = top; south = right;
+ if (top.iX < origin.iX)
+ {
+ west = top;
+ east = right;
+ north = corner;
+ south = origin;
+ }
+ else
+ {
+ west = origin;
+ east = corner;
+ north = top;
+ south = right;
+ }
+
+ if (corner.iX < west.iX)
+ {
+ west = corner;
+ east = origin;
+ north = right;
+ south = top;
+ }
+
+ if (right.iX < west.iX)
+ {
+ west = right;
+ east = top;
+ north = origin;
+ south = corner;
+ }
+ }
+
+
+
+
+
+// --------------------------------------------------------------------------
+// void TGfxImageTransformer::ComputeXPositions
+// ---------------------------------------------------------------------------
+
+void TGfxImageTransformer::ComputeXPositions(TFloatFixPt y, TRect rect,
+ TGfxPoint2D north, TGfxPoint2D west, TGfxPoint2D east,
+ TGfxPoint2D south, TInt& xstart, TInt& xend)
+ {
+
+ if ( y > west.iY )
+ {
+ if (north.iY - west.iY == (TFloatFixPt)0)
+ xstart = (TInt32) west.iX;
+ else
+ xstart = (TInt32) (west.iX + (north.iX - west.iX) *
+ ( (y - west.iY) / (north.iY - west.iY) ));
+ }
+ else
+ {
+ if (west.iY - south.iY == (TFloatFixPt)0)
+ xstart = (TInt32) south.iX;
+ else
+ xstart = (TInt32) (south.iX + (west.iX - south.iX) *
+ ( (y - south.iY) / (west.iY - south.iY) ));
+ }
+
+ // compute scanline edges end position
+ if ( y > east.iY )
+ {
+ if ( north.iY - east.iY == (TFloatFixPt)0 )
+ xend = (TInt32) north.iX;
+ else
+ xend = (TInt32) (east.iX + (north.iX - east.iX) *
+ ( (((TFloatFixPt)y) - east.iY) / (north.iY - east.iY) ));
+ }
+ else
+ {
+ if ( (east.iY - south.iY) == (TFloatFixPt)0 )
+ xend = (TInt32) east.iX;
+ else
+ xend = (TInt32) (south.iX + (east.iX - south.iX) *
+ ( (((TFloatFixPt)y) - south.iY) / (east.iY - south.iY) ));
+ }
+
+ // does span clip against edges
+ if(xstart < rect.iTl.iX)
+ xstart = rect.iTl.iX;
+
+ if(xend >= rect.iBr.iX) // iX-1 seems to be the limit, using iX rolls over to next line
+ xend = rect.iBr.iX-1;
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxImageTransformer::Draw( CFbsBitmap* aSrc,
+// ---------------------------------------------------------------------------
+ void TGfxImageTransformer::Draw( CFbsBitmap* aSrc,
+ const TGfxPoint2D& aP,
+ TUint32* aDst,
+ TInt aDstWidth,
+ TInt aDstHeight,
+ TUint8 /*aAlpha*/,
+ TGfxColor aTransparentColor,
+ const TRect& aClipRect,
+ TBool aReverse
+ )
+ {
+ TRect rect;
+ TInt32 x, y;
+
+ TFloatFixPt currentScale = iTransform->ScalingFactor();
+ TSize bitmapSize = aSrc->SizeInPixels();
+ TRect srcrect( TPoint( aP.iX, aP.iY ),
+ TSize( bitmapSize.iWidth-1, bitmapSize.iHeight-1 ) );
+ TRect dstrect( TPoint( 0, 0 ), TSize(aDstWidth-1, aDstHeight-1) );
+ TInt32 srcWidth = bitmapSize.iWidth;
+ TInt32 srcHeight = bitmapSize.iHeight;
+ TInt32 pad = (srcWidth & 1);
+
+ TGfxRectangle2D rect2d = GetTransformedBound( aSrc, aP );
+ rect.SetRect( TPoint( rect2d.iX, rect2d.iY ), TSize( rect2d.iWidth, rect2d.iHeight ) );
+ rect.Intersection(aClipRect); // Clipping
+
+ if ( !rect.Intersects( dstrect ) ) // clip rect with dst image
+ return;
+
+ aSrc->LockHeap();
+ rect.Intersection( dstrect );
+ TDisplayMode dispmode = aSrc->DisplayMode();
+
+ TUint16* bufsrc16 = NULL;
+ TUint32* bufsrc32 = NULL;
+ if ( dispmode == EColor16MU)
+ {
+ bufsrc32 = (TUint32*) aSrc->DataAddress();
+ }
+ else
+ {
+ bufsrc16 = (TUint16*) aSrc->DataAddress();
+ }
+ TUint32* buf = aDst + rect.iTl.iX + ( rect.iTl.iY * aDstWidth );
+ TUint32* bufLimit = aDst + aDstWidth * aDstHeight;
+ TUint32 pix = 0;
+ TInt dstStride = aDstWidth;
+
+ TGfxAffineTransform inv = iTransform->CreateInverse();
+
+ if ( aTransparentColor.GetARGB() == KGfxColorNull /* && aAlpha == 0xff */ &&
+ (int)inv.TransformType() == KTransformIdentity && aReverse == EFalse)
+ {
+ // Fast case; no alpha or transform (cdm).
+ TPoint p;
+ TInt lScrPp = (srcWidth+pad);
+ for ( y = rect.iTl.iY; y <= rect.iBr.iY; y++ )
+ {
+ for ( x = rect.iTl.iX; x <= rect.iBr.iX; x++ )
+ {
+ p.iX = x;
+ p.iY = y;
+
+ if ( srcrect.Contains( p ) )
+ {
+ p.iX -= ( TInt32 ) aP.iX;
+ p.iY -= ( TInt32 ) aP.iY;
+ if ( dispmode == EColor16MU)
+ {
+ buf[x] = (TUint32) *(bufsrc32 + ( TInt32 ) p.iX + (lScrPp)*( TInt32 ) p.iY);
+ *buf = pix;
+ }
+ else
+ {
+ // src:RGB565 -> dst:ARGB8888
+ pix = (TUint32) *(bufsrc16 + ( TInt32 ) p.iX + (lScrPp)*( TInt32 ) p.iY);
+ buf[x] = RGB565toRGB888(pix);
+ }
+ }
+ }
+ buf += dstStride;
+ if (buf + dstStride >= bufLimit)
+ {
+ aSrc->UnlockHeap();
+ return;
+ }
+ }
+ }
+ else // Alpha blending and/or transform is required.
+ {
+ TPoint pinv;
+ TGfxPoint2D p;
+
+ TUint32* obuf = buf;
+ TInt32 xstart, xend, yend;
+ TGfxPoint2D horizDeriv;
+ TGfxPoint2D origin, top, right, corner;
+ TGfxPoint2D east, west, south, north;
+
+ origin.iX = aP.iX;
+ origin.iY = aP.iY;
+ corner.iX = aP.iX + (TFloatFixPt)srcWidth;
+ corner.iY = aP.iY + (TFloatFixPt)srcHeight;
+ top.iX = aP.iX;
+ top.iY = aP.iY + (TFloatFixPt)srcHeight;
+ right.iX = aP.iX + (TFloatFixPt)srcWidth;
+ right.iY = aP.iY;
+
+ // transform corners of the source rectangle.
+ iTransform->Transform(&origin, &origin, 1);
+ iTransform->Transform(&top, &top, 1);
+ iTransform->Transform(&right, &right, 1);
+ iTransform->Transform(&corner, &corner, 1);
+
+ // sort four corners into appropriate order
+ west = origin; east = corner; north = top; south = right;
+ if (top.iX < origin.iX)
+ {
+ west = top;
+ east = right;
+ north = corner;
+ south = origin;
+ }
+ else
+ {
+ west = origin;
+ east = corner;
+ north = top;
+ south = right;
+ }
+
+ if (corner.iX < west.iX)
+ {
+ west = corner;
+ east = origin;
+ north = right;
+ south = top;
+ }
+
+ if (right.iX < west.iX)
+ {
+ west = right;
+ east = top;
+ north = origin;
+ south = corner;
+ }
+
+ // compute derivitives for scanline in source.
+ p.iX = 1;
+ p.iY = 0;
+ inv.Transform( &p, & p, 1 );
+ horizDeriv.iX = p.iX;
+ horizDeriv.iY = p.iY;
+ p.iX = 0;
+ p.iY = 0;
+ inv.Transform( &p, & p, 1 );
+ horizDeriv.iX -= p.iX;
+ horizDeriv.iY -= p.iY;
+
+ yend = rect.iBr.iY;
+ TInt lScrPp = 0;
+ if ( dispmode == EColor16MU)
+ {
+ lScrPp = srcWidth;
+ }
+ else
+ {
+ lScrPp = srcWidth+pad;
+ }
+
+ TUint32 transparentColorRgb565 = aTransparentColor.ColorRgb565();
+
+ for ( y = rect.iTl.iY; y <= yend; y++ )
+ {
+ p.iY = y;
+
+ // compute scanline starting position
+
+ if ( ((TFloatFixPt)y) > west.iY )
+ {
+ if(north.iY - west.iY == (TFloatFixPt)0)
+ xstart = (TInt32) west.iX;
+ else
+ xstart = (TInt32) (west.iX + (north.iX - west.iX) * ( (((TFloatFixPt)y) - west.iY) / (north.iY - west.iY) ));
+ }
+ else
+ {
+ if(west.iY - south.iY == (TFloatFixPt)0)
+ xstart = (TInt32) south.iX;
+ else
+ xstart = (TInt32) (south.iX + (west.iX - south.iX) * ( (((TFloatFixPt)y) - south.iY) / (west.iY - south.iY) ));
+ }
+
+ // compute scanline edges end position
+ if ( (TFloatFixPt)y > east.iY )
+ {
+ if(north.iY - east.iY == (TFloatFixPt)0)
+ xend = (TInt32) north.iX;
+ else
+ xend = (TInt32) (east.iX + (north.iX - east.iX) * ( (((TFloatFixPt)y) - east.iY) / (north.iY - east.iY) ));
+ }
+ else
+ {
+ if ( (east.iY - south.iY) == (TFloatFixPt)0 )
+ xend = (TInt32) east.iX;
+ else
+ xend = (TInt32) (south.iX + (east.iX - south.iX) * ( (((TFloatFixPt)y) - south.iY) / (east.iY - south.iY) ));
+ }
+
+ // does span clip against edges
+ if(xstart < rect.iTl.iX)
+ xstart = rect.iTl.iX;
+
+ if(xend >= rect.iBr.iX) // iX-1 seems to be the limit, using iX rolls over to next line
+ xend = rect.iBr.iX-1;
+
+ p.iX = xstart;
+ // transform that starting position to the source image
+ inv.Transform( &p, & p, 1 );
+ buf += xstart-rect.iTl.iX;
+
+ p.iY -= TFloatFixPt(.5f) * currentScale;
+
+ if (aTransparentColor.GetARGB() == KGfxColorNull)
+ {
+ for ( x = xstart; x <= xend; x++ )
+ {
+ //increment the location of the position by one horizontal location
+ pinv.iX = p.iX;
+ pinv.iY = p.iY;
+ if ( srcrect.Contains( pinv ) )
+ {
+ pinv.iX -= ( TInt32 ) aP.iX;
+ pinv.iY -= ( TInt32 ) aP.iY;
+ if ( dispmode == EColor16MU )
+ {
+ *buf = (TUint32)*(bufsrc32 + ( TInt32 ) pinv.iX + (lScrPp)*( TInt32 ) (pinv.iY));
+ }
+ else
+ {
+ // src:RGB565 -> dst:ARGB8888
+ pix = (TUint32)*(bufsrc16 + ( TInt32 ) pinv.iX + (lScrPp)*( TInt32 ) (pinv.iY));
+ *buf = RGB565toRGB888(pix);
+ }
+ }
+ p.iX += horizDeriv.iX;
+ p.iY += horizDeriv.iY;
+ buf++;
+ }
+ }
+ else
+ {
+ for ( x = xstart; x <= xend; x++ )
+ {
+ //increment the location of the position by one horizontal location
+ pinv.iX = p.iX;
+ pinv.iY = p.iY;
+
+ if ( srcrect.Contains( pinv ) )
+ {
+ pinv.iX -= ( TInt32 ) aP.iX;
+ pinv.iY -= ( TInt32 ) aP.iY;
+
+ if ( aReverse ) // copy source to destination. Used for Text blending with final framebufer.
+ { // this used for text only
+ if ( dispmode == EColor16MU )
+ {
+ *(bufsrc32 + ( TInt32 ) pinv.iX + (lScrPp)*( TInt32 ) (pinv.iY)) = *buf ;
+ }
+ else
+ {
+ *(bufsrc16 + ( TInt32 ) pinv.iX + (lScrPp)*( TInt32 ) (pinv.iY)) = *buf ;
+ }
+ }
+ else
+ {
+ if ( dispmode == EColor16MU )
+ {
+ pix = (TUint32)*(bufsrc32 + ( TInt32 ) pinv.iX + (lScrPp)*( TInt32 ) (pinv.iY));
+ if (pix != transparentColorRgb565)
+ {
+ *buf = pix;
+ }
+ }
+ else
+ {
+ pix = (TUint32) *(bufsrc16 + ( TInt32 ) pinv.iX + (lScrPp)*( TInt32 ) (pinv.iY));
+ if (pix != transparentColorRgb565)
+ {
+ *buf = RGB565toRGB888(pix);
+ }
+ }
+ }
+ }
+ p.iX += horizDeriv.iX;
+ p.iY += horizDeriv.iY;
+ buf++;
+ }
+ }
+ buf = obuf+aDstWidth;
+ obuf += aDstWidth;
+ if (obuf + aDstWidth >= bufLimit)
+ {
+ aSrc->UnlockHeap();
+ return;
+ }
+ }
+ }
+
+ aSrc->UnlockHeap();
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxImageTransformer::Draw( CFbsBitmap* aSrc,
+// ---------------------------------------------------------------------------
+ void TGfxImageTransformer::Draw( CFbsBitmap* aSrc,
+ const TGfxPoint2D& aP,
+ TUint32* aDst,
+ TInt aDstWidth,
+ TInt aDstHeight,
+ const TRect& aClipRect
+ )
+ {
+ TDisplayMode dispmode = aSrc->DisplayMode();
+ if ( dispmode != EColor16MU )
+ {
+ return;
+ }
+
+ TRect rect;
+ TInt32 x, y;
+
+ TFloatFixPt currentScale = iTransform->ScalingFactor();
+
+ TRect srcrect( TPoint( aP.iX, aP.iY ), aSrc->SizeInPixels() );
+ TRect dstrect( TPoint( 0, 0 ), TSize(aDstWidth, aDstHeight) );
+ TInt32 srcWidth = aSrc->SizeInPixels().iWidth;
+ TInt32 srcHeight = aSrc->SizeInPixels().iHeight;
+
+ TGfxRectangle2D rect2d = GetTransformedBound( aSrc, aP );
+ rect.SetRect( TPoint( rect2d.iX, rect2d.iY ), TSize( rect2d.iWidth, rect2d.iHeight ) );
+ rect.Intersection(aClipRect); // Clipping
+
+ if ( !rect.Intersects( dstrect ) ) // clip rect with dst image
+ return;
+
+ aSrc->LockHeap();
+ rect.Intersection( dstrect );
+
+ TUint32* bufsrc32 = (TUint32*) aSrc->DataAddress();
+
+ TUint32* buf = aDst + rect.iTl.iX + ( rect.iTl.iY * aDstWidth );
+ TUint32* bufLimit = aDst + aDstWidth * aDstHeight;
+ TUint32 pix = 0;
+
+ TGfxAffineTransform inv = iTransform->CreateInverse();
+
+ {
+ TPoint pinv;
+ TGfxPoint2D p;
+
+ TUint32* obuf = buf;
+ TInt32 xstart, xend, yend;
+ TGfxPoint2D horizDeriv;
+ TGfxPoint2D origin, top, right, corner;
+ TGfxPoint2D east, west, south, north;
+
+ origin.iX = aP.iX;
+ origin.iY = aP.iY;
+ corner.iX = aP.iX + (TFloatFixPt)srcWidth;
+ corner.iY = aP.iY + (TFloatFixPt)srcHeight;
+ top.iX = aP.iX;
+ top.iY = aP.iY + (TFloatFixPt)srcHeight;
+ right.iX = aP.iX + (TFloatFixPt)srcWidth;
+ right.iY = aP.iY;
+
+ // transform corners of the source rectangle.
+ iTransform->Transform(&origin, &origin, 1);
+ iTransform->Transform(&top, &top, 1);
+ iTransform->Transform(&right, &right, 1);
+ iTransform->Transform(&corner, &corner, 1);
+
+ // sort four corners into appropriate order
+ west = origin; east = corner; north = top; south = right;
+ if (top.iX < origin.iX)
+ {
+ west = top;
+ east = right;
+ north = corner;
+ south = origin;
+ }
+ else
+ {
+ west = origin;
+ east = corner;
+ north = top;
+ south = right;
+ }
+
+ if (corner.iX < west.iX)
+ {
+ west = corner;
+ east = origin;
+ north = right;
+ south = top;
+ }
+
+ if (right.iX < west.iX)
+ {
+ west = right;
+ east = top;
+ north = origin;
+ south = corner;
+ }
+
+ // compute derivitives for scanline in source.
+ p.iX = 8;
+ p.iY = 0;
+ inv.Transform( &p, & p, 1 );
+ horizDeriv.iX = p.iX;
+ horizDeriv.iY = p.iY;
+ p.iX = 0;
+ p.iY = 0;
+ inv.Transform( &p, & p, 1 );
+ horizDeriv.iX -= p.iX;
+ horizDeriv.iY -= p.iY;
+ horizDeriv.iX = horizDeriv.iX >> 3;
+ horizDeriv.iY = horizDeriv.iY >> 3;
+
+ yend = rect.iBr.iY;
+ TInt lScrPp = 0;
+ lScrPp = srcWidth;
+
+
+ for ( y = rect.iTl.iY; y <= yend; y++ )
+ {
+ p.iY = y;
+
+ // compute scanline starting position
+
+ if ( ((TFloatFixPt)y) > west.iY )
+ {
+ if(north.iY - west.iY == (TFloatFixPt)0)
+ xstart = (TInt32) west.iX;
+ else
+ xstart = (TInt32) (west.iX + (north.iX - west.iX) * ( (((TFloatFixPt)y) - west.iY) / (north.iY - west.iY) ));
+ }
+ else
+ {
+ if(west.iY - south.iY == (TFloatFixPt)0)
+ xstart = (TInt32) south.iX;
+ else
+ xstart = (TInt32) (south.iX + (west.iX - south.iX) * ( (((TFloatFixPt)y) - south.iY) / (west.iY - south.iY) ));
+ }
+
+ // compute scanline edges end position
+ if ( (TFloatFixPt)y > east.iY )
+ {
+ if(north.iY - east.iY == (TFloatFixPt)0)
+ xend = (TInt32) north.iX;
+ else
+ xend = (TInt32) (east.iX + (north.iX - east.iX) * ( (((TFloatFixPt)y) - east.iY) / (north.iY - east.iY) ));
+ }
+ else
+ {
+ if ( (east.iY - south.iY) == (TFloatFixPt)0 )
+ xend = (TInt32) east.iX;
+ else
+ xend = (TInt32) (south.iX + (east.iX - south.iX) * ( (((TFloatFixPt)y) - south.iY) / (east.iY - south.iY) ));
+ }
+
+ // does span clip against edges
+ if(xstart < rect.iTl.iX)
+ xstart = rect.iTl.iX;
+
+ if(xend >= rect.iBr.iX) // iX-1 seems to be the limit, using iX rolls over to next line
+ xend = rect.iBr.iX-1;
+
+ p.iX = xstart;
+ // transform that starting position to the source image
+ inv.Transform( &p, & p, 1 );
+ buf += xstart-rect.iTl.iX;
+ // Change here
+ p.iY -= TFloatFixPt(0.5f) * currentScale;
+
+ {
+ for ( x = xstart; x <= xend; x++ )
+ {
+ //increment the location of the position by one horizontal location
+ pinv.iX = p.iX;
+ pinv.iY = p.iY;
+ if ( srcrect.Contains( pinv ) )
+ {
+ pinv.iX -= ( TInt32 ) aP.iX;
+ pinv.iY -= ( TInt32 ) aP.iY;
+
+ pix = (TUint32)*(bufsrc32 + ( TInt32 ) pinv.iX + (lScrPp)*( TInt32 ) (pinv.iY));
+ TUint srcAlpha = ( pix & 0xFF000000 ) >> 24;
+ if ( srcAlpha == 0xFF )
+ {
+ *buf = pix;
+ }
+ else if ( srcAlpha > 0 )
+ {
+ TUint destPix = *buf;
+ TUint destAlpha = ( destPix & 0xFF000000 ) >> 24;
+ // Blending needed: blend with background as opaque
+ if ( destAlpha == 0xFF )
+ {
+ TReal32 alpha = 0.0039215686 * srcAlpha; // 0.0039.. = 1/255
+ TReal32 inverseAlpha = 1.0f - alpha;
+ *buf = ((((TUint)((pix >> 16 & 0xff) * alpha) +
+ (TUint)((destPix >> 16 & 0xff) * inverseAlpha))) << 16) | // red
+ ((((TUint)((pix >> 8 & 0xff) * alpha) +
+ (TUint)((destPix >> 8 & 0xff) * inverseAlpha))) << 8 ) | // green
+ ((((TUint)((pix & 0xff) * alpha) +
+ (TUint)((destPix & 0xff) * inverseAlpha))) ) | // blue
+ (0xFF000000); // full alpha (already blended)
+ }
+ // Apply alpha to each color channel of source only
+ // Important: use original alpha
+ else
+ {
+ TReal32 alpha = 0.0039215686 * srcAlpha;
+ *buf = (srcAlpha << 24)|
+ ((TUint)((pix >> 16 & 0xff) * alpha) << 16) |
+ ((TUint)((pix >> 8 & 0xff) * alpha) << 8) |
+ ((TUint)((pix & 0xff) * alpha));
+ }
+ }
+ }
+ p.iX += horizDeriv.iX;
+ p.iY += horizDeriv.iY;
+ buf++;
+ }
+ }
+
+ buf = obuf+aDstWidth;
+ obuf += aDstWidth;
+ if (obuf + aDstWidth >= bufLimit)
+ {
+ aSrc->UnlockHeap();
+ return;
+ }
+ }
+ }
+
+ aSrc->UnlockHeap();
+ }
+
+// TGfxRectangle2D TGfxImageTransformer::GetTransformedBound( CFbsBitmap* aSrc,
+// ---------------------------------------------------------------------------
+ TGfxRectangle2D TGfxImageTransformer::GetTransformedBound( CFbsBitmap* aSrc,
+ const TGfxPoint2D& aOffset )
+ {
+ TGfxRectangle2D rect;
+ TGfxPoint2D rectp[4];
+
+ rectp[0].iX = aOffset.iX;
+ rectp[0].iY = aOffset.iY;
+ rectp[1].iX = aOffset.iX + ( TFloatFixPt ) aSrc->SizeInPixels().iWidth;
+ rectp[1].iY = aOffset.iY;
+ rectp[2].iX = aOffset.iX + ( TFloatFixPt ) aSrc->SizeInPixels().iWidth;
+ rectp[2].iY = aOffset.iY + ( TFloatFixPt ) aSrc->SizeInPixels().iHeight;
+ rectp[3].iX = aOffset.iX;
+ rectp[3].iY = aOffset.iY + ( TFloatFixPt ) aSrc->SizeInPixels().iHeight;
+ iTransform->Transform( rectp, rectp, 4 );
+
+ TInt32 i;
+ //MinX
+ rect.iX = rectp[0].iX;
+ rect.iY = rectp[0].iY;
+ rect.iWidth = rectp[0].iX;
+ rect.iHeight = rectp[0].iY;
+
+ for ( i = 1; i < 4; i++ )
+ {
+ if ( rectp[i].iX < rect.iX )
+ rect.iX = rectp[i].iX;
+ //MinY
+ if ( rectp[i].iY < rect.iY )
+ rect.iY = rectp[i].iY;
+ //MaxX -> width
+ if ( rectp[i].iX > rect.iWidth )
+ rect.iWidth = rectp[i].iX;
+ //MaxY -> height
+ if ( rectp[i].iY > rect.iHeight )
+ rect.iHeight = rectp[i].iY;
+ }
+ rect.iWidth -= rect.iX;
+ rect.iHeight -= rect.iY;
+
+ return rect;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxMain.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,18 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxMath.c Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,243 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Math Utility functions
+*
+*/
+
+#include "Gfxmath.h"
+
+
+/*-------------------------------------------------------------------*//*!
+ * \brief Counts number of leading zeroes in an integer
+ * \param value Integer value
+ * \return Number of leading zeroes [0,32]
+ * \note Example outputs: clz(0)=32, clz(1)=31, clz(-1)=0
+ * \todo We want to generate clz instruction for ARM if supported by the CPU
+ *//*-------------------------------------------------------------------*/
+
+static int svgClz32(unsigned int value)
+ {
+ int c = 0;
+
+ if (value<(1u<<( 16 )))
+ c+=( 16 );
+ else
+ value >>= ( 16 );;
+ if (value<(1u<<( 8 )))
+ c+=( 8 );
+ else
+ value >>= ( 8 );;
+ if (value<(1u<<( 4 )))
+ c+=( 4 );
+ else
+ value >>= ( 4 );;
+ if (value<(1u<<( 2 )))
+ c+=( 2 );
+ else
+ value >>= ( 2 );;
+ c += 2 >> value;
+
+ return c;
+
+ }
+
+/*-------------------------------------------------------------------*//*!
+ * \brief Returns absolute value of an integer
+ * \param a 32-bit input value
+ * \return abs(a)
+ * \todo On many platforms it might be best to use native abs() ?
+ *//*-------------------------------------------------------------------*/
+static int svgAbs32 (int a)
+ {
+ return (a >= 0) ? a : -a;
+ }
+
+static int svgGTEFloat(int lhs, int rhs)
+ {
+ int cmp;
+ if ((lhs & rhs) >> 31)
+ {
+ cmp = (int)lhs <= (int)rhs;
+ }
+ else
+ {
+ cmp = (int)lhs >= (int)rhs;
+ }
+ return cmp;
+ }
+
+static int svgLTEFloat(int lhs, int rhs)
+ {
+ /* Compare signed, if both are negative, we need to invert the result */
+ int cmp;
+ if ((lhs & rhs) >> 31)
+ {
+ cmp = (int)lhs >= (int)rhs;
+ }
+ else
+ {
+ cmp = (int)lhs <= (int)rhs;
+ }
+ return cmp;
+ }
+
+/**
+ * \brief Clamping version of the fixed -> float conversion routine. That is, will not
+ * create incorrect results on values > ~32768.0 or < -32768.0
+ *
+ * \param f Input floating-point
+ * \return Fixed-point number within 16.16 fixed-point range.
+ */
+ int svgScalarFromFloat(float f)
+ {
+ int a;
+ int sign;
+ int exponent;
+
+ int r;
+
+ if (svgGTEFloat((*(int*)&f ), 0x47000000) )
+ {
+ return 0x7fffffff;
+ }
+ else
+ if (svgLTEFloat((*(int*)&f ), 0xc7000000) )
+ {
+ return 0x80000000;
+ }
+ else
+ {
+ a = (*(int*)&f );
+ sign = a >> 31;
+ exponent = (127 + 15) - ((a >> 23) & 0xff);
+
+ r = (int)((((int)(a) << 8) | (1U << 31)) >> exponent);
+ r &= ((exponent - 32) >> 31);
+
+ r = (r ^ sign) - sign;
+
+ return r;
+ }
+ }
+
+/*********************************************************************//*!
+ * \internal
+ *
+ * \brief Converts a 16.16 fixed point value into a floating point
+ * value
+ * \param x Fixed point value
+ * \returns Corresponding floating point value
+ * \note This is essentially exactly the same routine as nglIntToFloat,
+ * except that the exponent bias value is 16 smaller (thus
+ * dividing the float by 65536). If we run out of space and
+ * want to squeeze out a few extra bytes, we could write a
+ * common routine where the scale factor is passed in as
+ * a parameter.
+ *
+ ************************************************************************/
+
+float svgFixedToFloat(int x)
+ {
+ unsigned int d = (unsigned int)(x) & 0x80000000u; /* get copy of sign */
+ int exponent;
+
+ if (!x) /* special case handling for 0 */
+ return (float)(0);
+
+ x = svgAbs32(x); /* get rid of sign (the code works only for unsigned values -> we add the sign later back) */
+
+ /*exponent = nglGetHighestSetBit((unsigned int)(x))-23;*//* get exponent and divide value */
+ exponent = 31 - svgClz32((unsigned int)(x)) - 23;
+
+ if (exponent >= 0) /* "signed shift right" (we shift the mantissa to the proper place) */
+ x>>=exponent;
+ else
+ x<<=(-exponent); /*lint !e504 *//* yes, it is an unusual shift.. */
+
+ exponent += 127+23-16; /* convert exponent into biased form (divide by 65536 simultaneously!) */
+ exponent <<=23; /* shift exponent to proper place */
+ d |= (unsigned int)(exponent); /* combine sign with exponent */
+ x &= ((1<<23)-1); /* mask the mantissa */
+ d |= (unsigned int)(x); /* combine sign and exponent with mantissa */
+
+ return *(float*)&d; /* done */
+ }
+
+/*-------------------------------------------------------------------*//*!
+ * \brief 32x32->64-bit signed multiplication
+ * \param a 32-bit signed integer
+ * \param b 32-bit signed integer
+ * \return 64-bit signed result of the multiplication
+ *//*-------------------------------------------------------------------*/
+
+static svgInt64 svgMul64(int a, int b)
+ {
+ return (svgInt64)(a) * (int)(b);
+ }
+/*=======================================================================*/
+/*=======================================================================*/
+
+int svgScalarMul(int r1, int r2)
+ {
+
+ svgInt64 a = svgMul64(r1, r2);
+ int l = (int)(a);
+ int h = (int)((svgUint64)(a)>>32);
+ int r = (h << 16) | (((unsigned int)l) >> 16); /* r = 32 middle bits of the 64 bit result */
+ int hs = h >> 31; /* hs is either 0 or 0xffffffff */
+ /* test if there is data in the upper 17 bits of h */
+ if ( (h >> 15) != hs)
+ r = (~hs) ^ 0x80000000; /* saturate (~hs to avoid a big constant on ARM) */
+
+ return r;
+ }
+
+/*=======================================================================*/
+/*=======================================================================*/
+
+int svgScalarDiv(int x, int y)
+ {
+ unsigned int ax = x < 0 ? -x : x;
+ unsigned int ay = y < 0 ? -y : y;
+ unsigned int axh = ax >> 14;
+ unsigned int axl = ax << 18;
+ int q = 0, i;
+
+ if ((axh >> 1) >= ay)
+ { /* saturate when overflows */
+ if ( (x < 0) ^ (y < 0))
+ q = 0x80000000;
+ else
+ q = 0x7fffffff;
+ }
+ else
+ {
+ for (i = 30; i>=0; i--)
+ {
+ if (axh >= ay)
+ {
+ axh -= ay;
+ q += 1<<i;
+ }
+ /* lsl64 #1 */
+ axh <<= 1;
+ axh |= axl >> 31; /* add carry */
+ axl <<= 1;
+ }
+ if ( (x < 0) ^ (y < 0))
+ q = -q;
+ }
+
+ return q;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxMultiply.s Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+ *
+*/
+
+
+
+@
+@ GfxMultiplyAsm - Multiply a 16:16 fixed point factor into iValue.
+@
+@ This function multiplies a 16:16 fixed point factor into iValue using
+@ an ARM 64 bit multiply instruction. This is much faster than using the
+@ Symbian TInt64 class. Note that iValue MUST be the first data member of
+@ this class.
+@
+@ r0 = Pointer to iValue (First data item in TFixPt class).
+@ r1 = Second factor to multiply.
+
+ .align 2
+ .globl GfxMultiplyAsm__6TFixPti
+ .thumb_func
+ .code 16
+
+GfxMultiplyAsm__6TFixPti:
+
+ add r2, pc, #4 @ Switch from Thumb to ARM execution.
+ bx r2
+ nop
+
+ .align 2
+ .code 32
+
+ ldr r2, [r0] @ r2 = *this, r1 = aVal.iValue.
+ smull r3, r2, r1, r2 @ r2:r3 = iValue * aVal.iValue.
+ mov r2, r2, lsl #16
+ orr r2, r2, r3, lsr #16 @ Extract middle 32 bits from 64 bit product.
+ str r2, [r0] @ Store into iValue.
+ bx lr
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxRenderer/GfxCurveFlattenerP.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,146 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxShape.h"
+#include "GfxAffineTransform.h"
+
+
+// ---------------------------------------------------------------------------
+// Constructors
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// TGfxCurveFlattener::TGfxCurveFlattener( TGfxAffineTransform* aTransform )
+// ---------------------------------------------------------------------------
+TGfxCurveFlattener::TGfxCurveFlattener( TGfxAffineTransform* aTransform )
+ {
+ iTransform = aTransform;
+ }
+
+
+
+// --------------------------------------------------------------------------
+// void TGfxCurveFlattener::AddSubCurveQuadL( CGfxEdgeListP* aRenderer,
+// ---------------------------------------------------------------------------
+void TGfxCurveFlattener::AddSubCurveQuadL( CGfxEdgeListP* aRenderer,
+ TFixPt* aCtrlPoints,
+ TInt32 aLimit )
+ {
+ if ( aLimit <= 0 )
+ {
+ // Add segments to renderer
+ // the first point doesn't have to be transformed
+ // because it is same as the last vertex
+ TFixPt* p2 = aCtrlPoints + 2;
+ iTransform->Transform( p2, 2 );
+ aRenderer->AddPoint( aCtrlPoints[2], aCtrlPoints[3], EFalse, EFalse );
+ aRenderer->AddPoint( aCtrlPoints[4], aCtrlPoints[5], EFalse, EFalse );
+ return;
+ }
+
+ TFixPt left[6], right[6];
+ TFixPt x0, y0, xm, ym, x1, y1;
+ x0 = aCtrlPoints[0];
+ y0 = aCtrlPoints[1];
+ xm = aCtrlPoints[2];
+ ym = aCtrlPoints[3];
+ x1 = aCtrlPoints[4];
+ y1 = aCtrlPoints[5];
+ x0 = ( x0 + xm ) >> 1;
+ y0 = ( y0 + ym ) >> 1;
+ x1 = ( x1 + xm ) >> 1;
+ y1 = ( y1 + ym ) >> 1;
+ xm = ( x0 + x1 ) >> 1;
+ ym = ( y0 + y1 ) >> 1;
+ left[0] = aCtrlPoints[0];
+ left[1] = aCtrlPoints[1];
+ left[2] = x0;
+ left[3] = y0;
+ left[4] = xm;
+ left[5] = ym;
+ right[0] = xm;
+ right[1] = ym;
+ right[2] = x1;
+ right[3] = y1;
+ right[4] = aCtrlPoints[4];
+ right[5] = aCtrlPoints[5];
+ AddSubCurveQuadL( aRenderer, left, aLimit - 1 );
+ AddSubCurveQuadL( aRenderer, right, aLimit - 1 );
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxCurveFlattener::AddSubCurveCubicL( CGfxEdgeListP* aRenderer,
+// ---------------------------------------------------------------------------
+void TGfxCurveFlattener::AddSubCurveCubicL( CGfxEdgeListP* aRenderer,
+ TFixPt* aCtrlPoints,
+ TInt32 aLimit )
+ {
+ if ( aLimit <= 0 )
+ {
+ // Add segments to renderer
+ TFixPt* p2 = aCtrlPoints + 2;
+ iTransform->Transform( p2, 3 );
+ aRenderer->AddPoint( aCtrlPoints[2], aCtrlPoints[3], EFalse, EFalse );
+ aRenderer->AddPoint( aCtrlPoints[4], aCtrlPoints[5], EFalse, EFalse );
+ aRenderer->AddPoint( aCtrlPoints[6], aCtrlPoints[7], EFalse, EFalse );
+ return;
+ }
+
+ TFixPt left[8], right[8];
+ TFixPt x0, y0, xm, ym, xm1, ym1, xm2, ym2, x1, y1;
+
+ x0 = aCtrlPoints[0];
+ y0 = aCtrlPoints[1];
+ xm1 = aCtrlPoints[2];
+ ym1 = aCtrlPoints[3];
+ xm2 = aCtrlPoints[4];
+ ym2 = aCtrlPoints[5];
+ x1 = aCtrlPoints[6];
+ y1 = aCtrlPoints[7];
+
+ x0 = ( x0 + xm1 ) >> 1;
+ y0 = ( y0 + ym1 ) >> 1;
+ x1 = ( x1 + xm2 ) >> 1;
+ y1 = ( y1 + ym2 ) >> 1;
+ xm = ( xm1 + xm2 ) >> 1;
+ ym = ( ym1 + ym2 ) >> 1;
+ xm1 = ( x0 + xm ) >> 1;
+ ym1 = ( y0 + ym ) >> 1;
+ xm2 = ( x1 + xm ) >> 1;
+ ym2 = ( y1 + ym ) >> 1;
+ xm = ( xm1 + xm2 ) >> 1;
+ ym = ( ym1 + ym2 ) >> 1;
+
+ left[0] = aCtrlPoints[0];
+ left[1] = aCtrlPoints[1];
+ left[2] = x0;
+ left[3] = y0;
+ left[4] = xm1;
+ left[5] = ym1;
+ left[6] = xm;
+ left[7] = ym;
+ right[0] = xm;
+ right[1] = ym;
+ right[2] = xm2;
+ right[3] = ym2;
+ right[4] = x1;
+ right[5] = y1;
+ right[6] = aCtrlPoints[6];
+ right[7] = aCtrlPoints[7];
+ AddSubCurveCubicL( aRenderer, left, aLimit - 1 );
+ AddSubCurveCubicL( aRenderer, right, aLimit - 1 );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxRenderer/GfxDrawHLine.s Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+ *
+*/
+
+@
+@ DrawHLine - Draw a horizontal line Fast!
+@
+@ Draws a horizontal line using a very fast inner loop which writes pixels
+@ in pairs. If either the first and/or last pixels are not aligned to a
+@ 4 byte boundary, they are masked into the frame buffer appropriately.
+@
+@ Entry Parameters:
+@
+@ r0 = pBuffer.
+@ r1 = Color (High 16 bits must be zero).
+@ r2 = LeftX.
+@ r3 = Width (Can be zero).
+
+ .align 2
+ .globl DrawHLine__20TGfxPolygonRendererPPUsUlii
+ .thumb_func
+ .code 16
+
+DrawHLine__20TGfxPolygonRendererPPUsUlii:
+
+ push {r4}
+ mov r4, #3 @ Round pointer to 4 byte boundary.
+ bic r0, r0, r4
+ lsl r4, r1, #16
+ lsr r2, r2, #1 @ First pixel aligned to 4 byte boundary?
+ bcc skip @ Yes, skip to loop.
+
+ sub r3, r3, #1 @ No, decrement count.
+ bcc exit @ Width was 0!
+
+ ldrh r2, [r0] @ Draw first pixel with masking.
+ orr r2, r2, r4
+ stmia r0!, {r2}
+skip: sub r3, r3, #1 @ Two or more pixels remaining?
+ bls last @ No, skip to last pixel.
+
+ orr r4, r4, r1 @ Yes, combine two pixel patterns.
+loop: stmia r0!, {r4} @ Loop to draw aligned pixel pairs.
+ sub r3, r3, #2
+ bhi loop @ Two or more pixels remain.
+
+last: bcc exit @ Last pixel remaining?
+
+ ldrh r4, [r0, #2] @ Yes, draw last pixel with masking.
+ lsl r4, r4, #16
+ orr r4, r4, r1
+ str r4, [r0]
+exit: pop {r4}
+ bx lr
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxRenderer/GfxEdgeListP.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,848 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxRendererInfoP.h"
+
+#define EInitialised 0
+#define ECurrent 1
+#define EComplete 2
+
+
+// ---------------------------------------------------------------------------
+// Create a new instance and push it onto the cleanup stack.
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// CGfxEdgeListP* CGfxEdgeListP::NewLC( TGfxRendererInfoP* aRenderInfo )
+// ---------------------------------------------------------------------------
+CGfxEdgeListP* CGfxEdgeListP::NewLC( TGfxRendererInfoP* aRenderInfo )
+ {
+ CGfxEdgeListP* self = new ( ELeave ) CGfxEdgeListP( aRenderInfo );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Create a new instance.
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// CGfxEdgeListP* CGfxEdgeListP::NewL( TGfxRendererInfoP* aRenderInfo )
+// ---------------------------------------------------------------------------
+CGfxEdgeListP* CGfxEdgeListP::NewL( TGfxRendererInfoP* aRenderInfo )
+ {
+ CGfxEdgeListP* self = NewLC( aRenderInfo );
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor.
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// CGfxEdgeListP::~CGfxEdgeListP()
+// ---------------------------------------------------------------------------
+CGfxEdgeListP::~CGfxEdgeListP()
+ {
+ delete[] iPoints;
+ iPoints = NULL;
+ delete[] iSegset;
+ iSegset = NULL;
+ delete[] iEdges;
+ iEdges = NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// CGfxEdgeListP::CGfxEdgeListP( TGfxRendererInfoP* aRenderInfo ) : iWaitingSegList( NULL ),
+// ---------------------------------------------------------------------------
+CGfxEdgeListP::CGfxEdgeListP( TGfxRendererInfoP* aRenderInfo ) : iWaitingSegList( NULL ),
+ iActiveSegList( NULL ),
+ iPointsCount( 0 ),
+ iSegsetCount( 0 ),
+ iPointsCountMax( 20 ),
+ iSegsetCountMax( 10 ),
+ iEdgesCountMax( 10 )
+ {
+ // From CGfxEdgeListP
+ iRenderInfo = aRenderInfo;
+ iMinX = KMAXFLOATFIX;
+ iMinY = KMAXFLOATFIX;
+ iMaxX = KMINFLOATFIX;
+ iMaxY = KMINFLOATFIX;
+ iEdgesCount = 0;
+ iLastSegLenSq = 0xffffffff;
+ }
+
+// ---------------------------------------------------------------------------
+// Second phase in constructing this object.
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// void CGfxEdgeListP::ConstructL()
+// ---------------------------------------------------------------------------
+void CGfxEdgeListP::ConstructL()
+ {
+ iPoints = new ( ELeave ) TPoint16[iPointsCountMax];
+ iSegset = new ( ELeave ) TSegSet[iSegsetCountMax];
+ iEdges = new ( ELeave ) TGfxSegEdge[iEdgesCountMax];
+ }
+
+
+// ---------------------------------------------------------------------------
+// reset
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// void CGfxEdgeListP::Reset()
+// ---------------------------------------------------------------------------
+void CGfxEdgeListP::Reset()
+ {
+ // From CGfxEdgeListP
+ iEdgesCount = 0;
+ iLastSegLenSq = 0xffffffff;
+ iPolygonAreaSize = 0;
+ iMinX = KMAXFLOATFIX;
+ iMinY = KMAXFLOATFIX;
+ iMaxX = KMINFLOATFIX;
+ iMaxY = KMINFLOATFIX;
+
+ iPointsCount = 0;
+ iSegsetCount = 0;
+
+ iActiveSegList = 0;
+ iWaitingSegList = 0;
+ iSortedEdges = 0;
+
+ iStartSeg = iSegset;
+ iIsNewOutlineStarted = EFalse;
+ iSubPathSegmentCount = 0;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxEdgeListP::AdjustShapeComplexityL( TInt32 aVertexSize )
+// ---------------------------------------------------------------------------
+void CGfxEdgeListP::AdjustShapeComplexityL( TInt32 aVertexSize )
+ {
+ if ( aVertexSize < iPointsCountMax )
+ return;
+ //
+ delete[] iPoints;
+ delete[] iSegset;
+ delete[] iEdges;
+ iPoints = NULL;
+ iSegset = NULL;
+ iEdges = NULL;
+ iPointsCountMax = aVertexSize + 4;
+ iSegsetCountMax = aVertexSize;
+ iEdgesCountMax = aVertexSize;
+ iPoints = new ( ELeave ) TPoint16[iPointsCountMax];
+ iSegset = new ( ELeave ) TSegSet[iSegsetCountMax];
+ iEdges = new ( ELeave ) TGfxSegEdge[iEdgesCountMax];
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxEdgeListP::StartPoint( TFixPt& aX, TFixPt& aY )
+// ---------------------------------------------------------------------------
+void CGfxEdgeListP::StartPoint( TFixPt& aX, TFixPt& aY )
+ {
+ if ( iPointsCount >= iPointsCountMax - 1 ) // No more segments?
+ return;
+
+ // New segment set. Add one point and set flag
+ TPoint16& p1 = iPoints[iPointsCount++];
+ p1.iX = ( TInt16 ) ( TInt ) aX;
+ p1.iY = ( TInt16 ) ( TInt ) aY;
+
+ // Min/Max update
+ if ( p1.iY < iMinY )
+ iMinY = p1.iY;
+ else if ( p1.iY > iMaxY )
+ iMaxY = p1.iY;
+ if ( p1.iX < iMinX )
+ iMinX = p1.iX;
+ else if ( p1.iX > iMaxX )
+ iMaxX = p1.iX;
+
+ iIsNewOutlineStarted = ETrue;
+ iSubPathSegmentCount = 0;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxEdgeListP::AddPoint( TFixPt& aX, TFixPt& aY, TBool aFillOnly, TBool aClosePath )
+// ---------------------------------------------------------------------------
+void CGfxEdgeListP::AddPoint( TFixPt& aX, TFixPt& aY, TBool aFillOnly, TBool aClosePath )
+ {
+ if ( iPointsCount >= iPointsCountMax - 1 ) // No more segments?
+ return;
+
+ TBool newSegsetFlag = EFalse;
+ TBool completeSubPathFlag = EFalse;
+
+ if ( iIsNewOutlineStarted )
+ {
+ CheckAndConnect();
+ newSegsetFlag = ETrue;
+ }
+ else if ( aClosePath && ( iSubPathSegmentCount == 1 ) )
+ {
+ completeSubPathFlag = ETrue;
+ newSegsetFlag = ETrue;
+ }
+ else
+ {
+ TInt x = ( TInt ) aX, y = ( TInt ) aY;
+ switch ( iSegset[iSegsetCount - 1].AddSegment( x,
+ y,
+ iLastSegLenSq,
+ aClosePath ) )
+ {
+ case ESegAdd:
+ // Add point
+ iPointsCount++;
+ break;
+ case ESegMerge:
+ // Do nothing
+ break;
+ case ESegStartNew:
+ newSegsetFlag = ETrue;
+ break;
+ default:
+ return;// ESegIgnore - do nothing
+ }
+ }
+
+ if ( newSegsetFlag && iSegsetCount < iSegsetCountMax )
+ {
+ // New segment set. Add two points
+ TPoint16* p =& iPoints[iPointsCount++];
+ p->iX = ( TInt16 ) ( TInt ) aX;
+ p->iY = ( TInt16 ) ( TInt ) aY;
+
+ iSubPathSegmentCount++;
+ TSegSet& seg = iSegset[iSegsetCount++];
+ seg.Construct( p - 1, p );
+
+ if ( iSegsetCount > 1 )
+ iSegset[iSegsetCount - 2].iNext = &seg;
+
+ if ( iIsNewOutlineStarted )
+ iStartSeg = &seg;
+
+ if ( completeSubPathFlag ) // (cdm)
+ {
+ iSegset[iSegsetCount - 1].iSign = -1;
+ iSegset[iSegsetCount - 2].iSign = 1;
+ iSegset[iSegsetCount - 1].iConnectFlag = EFalse;
+ iSegset[iSegsetCount - 2].iConnectFlag = EFalse;
+ }
+ }
+
+ // Min/Max update
+ TPoint16& p = iPoints[iPointsCount - 1];
+ if ( p.iY < iMinY )
+ iMinY = p.iY;
+ else if ( p.iY > iMaxY )
+ iMaxY = p.iY;
+ if ( p.iX < iMinX )
+ iMinX = p.iX;
+ else if ( p.iX > iMaxX )
+ iMaxX = p.iX;
+
+ if ( aFillOnly )
+ {
+ iSegset[iSegsetCount - 1].iFillOnlySeg = &iPoints[iPointsCount - 1];
+ }
+
+ iIsNewOutlineStarted = EFalse;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxEdgeListP::SetupEdgeList()
+// ---------------------------------------------------------------------------
+void CGfxEdgeListP::SetupEdgeList()
+ {
+ TInt i;
+
+ //
+ CheckAndConnect();
+
+ // Sort waiting list
+ TSegSet* segset = iSegset;
+ for ( i = 0; i < iSegsetCount; i++ )
+ {
+ if ( segset->iValid )
+ {
+ InsertToList( ETrue, * segset );
+ if ( segset->iActualBottomY < 0 )
+ segset->iActualBottomY = segset->iBottomPoint->iY;
+ }
+ segset++;
+ }
+
+ // Normalize x coordinates
+ for ( i = 0; i < iPointsCount; i++ )
+ {
+ iPoints[i].iX = ( TInt16 ) ( iPoints[i].iX - iMinX );
+ }
+
+ // Setting up for simple polygon, if applicable
+ if ( iSegsetCount < 4 )
+ {
+ TInt ix = 0;
+ segset = iWaitingSegList;
+
+ iSegListForSimple[0] = iSegListForSimple[1] = NULL; // (cdm).
+
+ while ( segset )
+ {
+ if ( segset->iTopPoint->iY <= iMinY )
+ {
+ iSegListForSimple[ix++] = segset;
+ segset->InitDDA();
+ if ( ix > 2 )
+ break;
+ }
+ segset = segset->iNext;
+ }
+ }
+
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxEdgeListP::UpdateActiveEdge( TInt aY )
+// ---------------------------------------------------------------------------
+void CGfxEdgeListP::UpdateActiveEdge( TInt aY )
+ {
+ // if number of segment is less than 4, it means the polygon is
+ // a simple polygon, which we can reduce some processing.
+ if ( iSegsetCount < 4 )
+ {
+ UpdateActiveEdgeSimple( aY );
+ return;
+ }
+
+ // Remove from active segment list
+ while ( iActiveSegList )
+ {
+ if ( aY <= iActiveSegList->iActualBottomY )
+ break;
+
+
+ iActiveSegList = iActiveSegList->iNext;
+ }
+
+ // Add newly activated segment to active segment list
+ while ( iWaitingSegList )
+ {
+ if ( aY < iWaitingSegList->iTopPoint->iY )
+ break;
+ TSegSet* seg = iWaitingSegList;
+ iWaitingSegList = iWaitingSegList->iNext;
+
+ InsertToList( EFalse, * seg ); // add to active list
+
+ seg->InitDDA();
+ }
+
+ // Add edges from active segements
+ TSegSet* asl = iActiveSegList;
+ TGfxSegEdge* edge;
+ TInt x1, x2;
+ TBool fillOnly;
+
+ iSortedEdges = 0;
+ iEdgesCount = 0;
+ while ( asl )
+ {
+ fillOnly = asl->GetEdge( x1, x2 );
+ edge = AddEdge( x1, x2 );
+ if ( !edge ) // no more edges can be added.
+ return;
+ edge->iSign = ( TInt16 ) asl->iSign;
+ edge->iOnlyForFill = ( TInt16 ) fillOnly;
+
+ asl = asl->iNext;
+ }
+ }
+
+// --------------------------------------------------------------------------
+// TGfxSegEdge* CGfxEdgeListP::EdgeList()
+// ---------------------------------------------------------------------------
+TGfxSegEdge* CGfxEdgeListP::EdgeList()
+ {
+ return iSortedEdges;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxEdgeListP::UpdateActiveEdgeSimple( TInt aY ) // (cdm)
+// ---------------------------------------------------------------------------
+void CGfxEdgeListP::UpdateActiveEdgeSimple( TInt aY ) // (cdm)
+ {
+ // Add edges from active segments
+ TGfxSegEdge* edge;
+ TInt x01, x02, x11, x12;
+ TBool fillOnly0, fillOnly1;
+ iEdgesCount = 0;
+
+ if ( iSegListForSimple[0] && iSegListForSimple[1] )
+ {
+
+ if ( aY > iSegListForSimple[0]->iActualBottomY ) // (cdm)
+ iSegListForSimple[0] = iSegListForSimple[0]->iNext;
+
+ if ( aY > iSegListForSimple[1]->iActualBottomY )
+ iSegListForSimple[1] = iSegListForSimple[1]->iNext;
+
+ if ( !iSegListForSimple[0] || !iSegListForSimple[1] )
+ return;
+
+ iEdgesCount = 2;
+ fillOnly0 = iSegListForSimple[0]->GetEdge( x01, x02 );
+ fillOnly1 = iSegListForSimple[1]->GetEdge( x11, x12 );
+
+ if ( x01 < x11 )
+ {
+ // iSegListForSimple[0] is left
+ iSortedEdges = iEdges;
+ edge = iSortedEdges;
+ edge->iStart = ( TInt16 ) x01;
+ edge->iEnd = ( TInt16 ) x02;
+ edge->iSign = ( TInt16 ) iSegListForSimple[0]->iSign;
+ edge->iOnlyForFill = ( TInt16 ) fillOnly0;
+ edge->iNext = iEdges + 1;
+
+ edge = edge->iNext;
+ edge->iStart = ( TInt16 ) x11;
+ edge->iEnd = ( TInt16 ) x12;
+ edge->iSign = ( TInt16 ) iSegListForSimple[1]->iSign;
+ edge->iOnlyForFill = ( TInt16 ) fillOnly1;
+ edge->iNext = NULL;
+ }
+ else
+ {
+ // iSegListForSimple[1] is left
+ iSortedEdges = iEdges;
+ edge = iSortedEdges;
+ edge->iStart = ( TInt16 ) x11;
+ edge->iEnd = ( TInt16 ) x12;
+ edge->iSign = ( TInt16 ) iSegListForSimple[1]->iSign;
+ edge->iOnlyForFill = ( TInt16 ) fillOnly1;
+ edge->iNext = iEdges + 1;
+
+ edge = edge->iNext;
+ edge->iStart = ( TInt16 ) x01;
+ edge->iEnd = ( TInt16 ) x02;
+ edge->iSign = ( TInt16 ) iSegListForSimple[0]->iSign;
+ edge->iOnlyForFill = ( TInt16 ) fillOnly0;
+ edge->iNext = NULL;
+ }
+ }
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxEdgeListP::InsertToList( TBool aWaitingList, TSegSet& aSegSet )
+// ---------------------------------------------------------------------------
+void CGfxEdgeListP::InsertToList( TBool aWaitingList, TSegSet& aSegSet )
+ {
+ TSegSet** next;
+ if ( aWaitingList )
+ next = &iWaitingSegList;
+ else
+ next = &iActiveSegList;
+ if(aWaitingList)
+ {
+ while ( *next )
+ {
+ if ( ( *next )->iTopPoint->iY >= aSegSet.iTopPoint->iY )
+ break;
+ next = &( ( *next )->iNext );
+ }
+ }
+ else
+ {
+ while( *next )
+ {
+ if ( ( *next )->iActualBottomY >= aSegSet.iActualBottomY )
+ break;
+ next = &( ( *next )->iNext );
+
+ }
+ }
+ //
+ aSegSet.iNext = *next;
+ *next = &aSegSet;
+ }
+
+// --------------------------------------------------------------------------
+// TGfxSegEdge* CGfxEdgeListP::AddEdge( TInt32 aSt, TInt32 aEd )//, TInt aSegSign)
+// ---------------------------------------------------------------------------
+TGfxSegEdge* CGfxEdgeListP::AddEdge( TInt32 aSt, TInt32 aEd )//, TInt aSegSign)
+{
+ if ( iEdgesCount >= iEdgesCountMax - 1 ) // No more edges?
+ return NULL;
+
+ TGfxSegEdge& newEdge = iEdges[iEdgesCount++];
+ newEdge.iStart = ( TInt16 ) aSt;
+ newEdge.iEnd = ( TInt16 ) aEd;
+
+ // Insert this edge in sorted link list
+ TGfxSegEdge** next;
+ next = &iSortedEdges;
+ TInt16 lastEnd = KMINFLOATFIX;
+ while ( *next )
+ {
+ if ( newEdge.iStart < ( *next )->iStart ) // (cdm).
+ break;
+
+ lastEnd = ( *next )->iEnd;
+ next = &( ( *next )->iNext );
+ }
+ //
+ newEdge.iNext = *next;
+ *next = &newEdge;
+
+ return &newEdge;
+ }
+
+// --------------------------------------------------------------------------
+// void CGfxEdgeListP::CheckAndConnect()
+// ---------------------------------------------------------------------------
+void CGfxEdgeListP::CheckAndConnect()
+ {
+ if ( iSegsetCount < 3 ) // (cdm)
+ return;
+
+ // Merge the first one and the last one if they have same sign
+ TSegSet* lastSegset =& iSegset[iSegsetCount - 1];
+ TPoint16* ps1 = iStartSeg->iTopPoint;
+ TPoint16* ps2 = iStartSeg->iBottomPoint;
+ TPoint16* pl1 = lastSegset->iTopPoint;
+ TPoint16* pl2 = lastSegset->iBottomPoint;
+
+ if ( iStartSeg->iPointAryInc == lastSegset->iPointAryInc &&
+ iStartSeg->iConnectFlag &&
+ ( ( ps1->iX == pl1->iX && ps1->iY == pl1->iY ) ||
+ ( ps1->iX == pl2->iX && ps1->iY == pl2->iY ) ||
+ ( ps2->iX == pl1->iX && ps2->iY == pl1->iY ) ||
+ ( ps2->iX == pl2->iX && ps2->iY == pl2->iY ) ) )
+ {
+ if ( iStartSeg->iPointAryInc == 1 )
+ {
+ iStartSeg->iValid = EFalse;
+ lastSegset->iConnect = iStartSeg;
+ lastSegset->iActualBottomY = iStartSeg->iBottomPoint->iY;
+ }
+ else
+ {
+ lastSegset->iValid = EFalse;
+ iStartSeg->iConnect = lastSegset;
+ iStartSeg->iActualBottomY = lastSegset->iBottomPoint->iY;
+ }
+ }
+ }
+
+void TSegSet::Construct( TPoint16* aP1, TPoint16* aP2 )
+ {
+ if ( aP1->iY < aP2->iY )
+ {
+ iTopPoint = aP1;
+ iBottomPoint = aP2;
+ iSign = 1;
+ iPointAryInc = 1;
+ }
+ else if ( aP1->iY == aP2->iY )
+ {
+ iTopPoint = aP1;
+ iBottomPoint = aP2;
+ iSign = 0;
+ iPointAryInc = 1;
+ }
+ else
+ {
+ iTopPoint = aP2;
+ iBottomPoint = aP1;
+ iSign = -1;
+ iPointAryInc = -1;
+ }
+
+ iNext = NULL;
+ iConnect = NULL;
+ iValid = ETrue;
+ iActualBottomY = KMINFLOATFIX;
+ iFillOnlySeg = NULL;
+ iConnectFlag = ETrue;
+ }
+
+TAddSegStatus TSegSet::AddSegment( TInt aX,
+ TInt aY,
+ TUint& aLastSegLenSq,
+ TBool aClosePath )
+ {
+ TPoint16* p; // the last vertex in the array of vertex
+ if ( iPointAryInc == 1 )
+ p = iBottomPoint;
+ else
+ p = iTopPoint;
+
+ // Check sign of y diff
+ TInt16 x3 = ( TInt16 ) aX, y3 = ( TInt16 ) aY;
+
+ if ( p->iX == x3 && p->iY == y3 )
+ return ESegIgnore;
+
+ TInt sign;
+ if ( p->iY < y3 )
+ sign = 1;
+ else if ( p->iY == y3 )
+ sign = 0;
+ else
+ sign = -1;
+ if ( iSign == 0 )
+ {
+ iSign = ( TInt16 ) sign;
+ if ( sign == -1 )
+ {
+ // swap top point and bottom point
+ TPoint16* tmp = iTopPoint;
+ iTopPoint = iBottomPoint;
+ iBottomPoint = tmp;
+ iPointAryInc = -1;
+ }
+ }
+ else if ( sign != 0 && iSign != sign )
+ return ESegStartNew; // sign is different. start new segment
+
+ // Vertex merging
+ TUint lenSq = ( p->iX - x3 ) * ( p->iX - x3 ) +
+ ( p->iY - y3 ) * ( p->iY - y3 );
+ if ( !aClosePath )
+ {
+ if ( aLastSegLenSq < 9 && lenSq < 9 )
+ {
+ p->iX = x3;
+ p->iY = y3;
+ TPoint16* pp = p + iPointAryInc;
+ aLastSegLenSq = ( p->iX - pp->iX ) * ( p->iX - pp->iX ) +
+ ( p->iY - pp->iY ) * ( p->iY - pp->iY );
+ return ESegMerge;
+ }
+ }
+ aLastSegLenSq = lenSq;
+
+
+ // Add point
+ TPoint16* nextp;
+ if ( iPointAryInc == 1 )
+ nextp = ++iBottomPoint;
+ else
+ nextp = ++iTopPoint;
+ nextp->iX = x3;
+ nextp->iY = y3;
+
+ return ESegAdd;
+ }
+
+TBool TSegSet::GetEdge( TInt& aX1, TInt& aX2 )
+ {
+ TPoint16 p1, p2;
+ TBool fillOnly;
+ TBool done = SingleScanline( p1, p2 );
+
+ if ( p1.iX < p2.iX )
+ {
+ aX1 = p1.iX;
+ aX2 = p2.iX;
+ }
+ else
+ {
+ aX1 = p2.iX;
+ aX2 = p1.iX;
+ }
+
+ if ( done ) // if done, construct new DDA with next segment
+ {
+ do
+ {
+ fillOnly = ( ( iTopPoint += iPointAryInc ) == iFillOnlySeg ); // (cdm)
+
+ if ( iTopPoint == iBottomPoint )
+ {
+ if ( iConnect )
+ {
+ iTopPoint = iConnect->iTopPoint;
+ iBottomPoint = iConnect->iBottomPoint;
+ iFillOnlySeg = iConnect->iFillOnlySeg;
+ iConnect = NULL;
+ }
+ else
+ {
+ return fillOnly;
+ }
+ }
+ ConstructDDA( iTopPoint, iTopPoint + iPointAryInc );
+
+ done = SingleScanline( p1, p2 );
+
+ if ( p1.iX < p2.iX ) // update edge minX & maxX
+ {
+ if ( p1.iX < aX1 )
+ aX1 = p1.iX;
+ if ( aX2 < p2.iX )
+ aX2 = p2.iX;
+ }
+ else
+ {
+ if ( p2.iX < aX1 )
+ aX1 = p2.iX;
+ if ( aX2 < p1.iX )
+ aX2 = p1.iX;
+ }
+ }
+ while ( done );
+ }
+ else
+ {
+ fillOnly = ( iTopPoint == iFillOnlySeg || iTopPoint + iPointAryInc == iFillOnlySeg );
+ }
+ return fillOnly;
+ }
+
+void TSegSet::InitDDA()
+ {
+ ConstructDDA( iTopPoint, iTopPoint + iPointAryInc );
+ }
+
+// ---------------------------------------------------------------------------
+// DDA functions, which is mostly from Symbian's TLinearDDA
+// ---------------------------------------------------------------------------
+void TSegSet::ConstructDDA( TPoint16* aStart, TPoint16* aFinish )
+ {
+ iStart = aStart;
+ iFinish = aFinish;
+ iDifference.iWidth = ( TInt16 ) Abs( iStart->iX - iFinish->iX );
+ iDifference.iHeight = ( TInt16 ) Abs( iStart->iY - iFinish->iY );
+ iInc.iX = ( TInt16 ) ( ( iStart->iX > iFinish->iX ) ? -1 : 1 );
+ iInc.iY = ( TInt16 ) ( ( iStart->iY > iFinish->iY ) ? -1 : 1 );
+ if ( iDifference.iWidth )
+ {
+ iGradient = ( TInt16 )
+ ( ( iFinish->iY - iStart->iY ) /
+ ( iFinish->iX - iStart->iX ) );
+ }
+ else
+ {
+ iGradient = 0; // (cdm)
+ }
+
+ iPos = *iStart;
+ if ( !iGradient )
+ {
+ iCount = iDifference.iWidth;
+ }
+ else
+ {
+ iCount = iDifference.iHeight;
+ }
+ iCount >>= 1;
+ iStatus = EInitialised;
+ if ( aStart == aFinish )
+ iStatus = EComplete;
+ }
+
+TBool TSegSet::SingleStep( TPoint16& aPosition )
+ {
+ if ( iStatus == ECurrent )
+ {
+ UpdatePosition();
+ aPosition = iPos;
+ if ( iPos.iX == iFinish->iX && iPos.iY == iFinish->iY )
+ {
+ iStatus = EComplete;
+ return( ETrue );
+ }
+ return( EFalse );
+ }
+ else if ( iStatus == EInitialised )
+ {
+ aPosition = *iStart;
+ iStatus = ECurrent;
+ return( EFalse );
+ }
+ else
+ {
+ aPosition = *iFinish;
+ return( ETrue );
+ };
+ }
+
+TBool TSegSet::SingleScanline( TPoint16& aStartPosition,
+ TPoint16& aEndPosition )
+ {
+ TBool done = EFalse;
+ if ( iDifference.iHeight == 0 )
+ {
+ aStartPosition = *iStart;
+ aEndPosition = *iFinish;
+ iStatus = EComplete; //KM
+ return( ETrue );
+ }
+ if ( iDifference.iWidth == 0 || iGradient )
+ {
+ done = SingleStep( aStartPosition );
+ aEndPosition = aStartPosition;
+ return( done );
+ }
+ done = SingleStep( aStartPosition );
+ aEndPosition = aStartPosition;
+ while ( iCount - iDifference.iHeight >= 0 && !done )
+ {
+ done = SingleStep( aEndPosition );
+ }
+ return( done );
+ }
+
+void TSegSet::UpdatePosition()
+ {
+ if ( iDifference.iHeight == 0 ) // horizontal line
+ iPos.iX = ( TInt16 ) ( iPos.iX + iInc.iX );
+ else if ( iDifference.iWidth == 0 ) // vertical line
+ iPos.iY = ( TInt16 ) ( iPos.iY + iInc.iY );
+ else
+ {
+ if ( !iGradient )
+ {
+ iCount = ( TInt16 ) ( iCount - iDifference.iHeight );
+ if ( iCount < 0 )
+ {
+ iCount = ( TInt16 ) ( iCount + iDifference.iWidth );
+ iPos.iY = ( TInt16 ) ( iPos.iY + iInc.iY );
+ }
+ iPos.iX = ( TInt16 ) ( iPos.iX + iInc.iX );
+ }
+ else
+ {
+ iCount = ( TInt16 ) ( iCount - iDifference.iWidth );
+ if ( iCount < 0 )
+ {
+ iCount = ( TInt16 ) ( iCount + iDifference.iHeight );
+ iPos.iX = ( TInt16 ) ( iPos.iX + iInc.iX );
+ }
+ iPos.iY = ( TInt16 ) ( iPos.iY + iInc.iY );
+ }
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxRenderer/GfxPolygonRendererP.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxPolygonRendererP.h"
+#include "GfxPaint.h"
+#include "GfxColor.h"
+#include "GfxRendererInfoP.h"
+#include "GfxEdgeListP.h"
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// TGfxPolygonRendererP::TGfxPolygonRendererP()
+// ---------------------------------------------------------------------------
+TGfxPolygonRendererP::TGfxPolygonRendererP()
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxPolygonRendererP::InitializeP( CGfxEdgeListP* aEdgeList,
+// ---------------------------------------------------------------------------
+void TGfxPolygonRendererP::InitializeP( CGfxEdgeListP* aEdgeList,
+ TGfxRendererInfoP* aRenderInfo,
+ MGfxPaint* aPaint,
+ TBool aWindingNoneZero )
+ {
+ iEdgeList = aEdgeList;
+ iRenderInfo = aRenderInfo;
+ iPaint = aPaint;
+ iWindingNoneZero = aWindingNoneZero;
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxPolygonRendererP::RenderScanlineL( TInt aY, TUint32 /* aAlpha */ )
+// ---------------------------------------------------------------------------
+void TGfxPolygonRendererP::RenderScanlineL( TInt aY, TUint32 /* aAlpha */ )
+ {
+ if ( iRenderInfo->iClipMinY >= aY || aY > iRenderInfo->iClipMaxY )
+ return;
+
+ TInt edgeCount = iEdgeList->iEdgesCount;
+ TGfxSegEdge dummyEdge;
+ dummyEdge.iEnd = -1; // less than 0
+ dummyEdge.iSign = 100; // neither -1, 0, or 1
+
+ TUint16 flatColor;
+ flatColor = TGfxColor( iPaint->FlatColor() ).ColorRgb();
+
+ // ************ Buffer is 2 bytes per pixel **********
+ TUint16* fb;
+
+ fb = ( ( TUint16 * ) iRenderInfo->iDstBuf ) +
+ aY * iRenderInfo->iWidth;
+
+
+ TInt i, j;
+
+ TInt edgeSignSum = 0;
+ TBool fill = EFalse;
+ TGfxSegEdge* lastEdge =& dummyEdge; // iEdgeList->EdgeList();
+ TGfxSegEdge* currentEdge = iEdgeList->EdgeList();
+ for ( i = 0; i < edgeCount; i++ )
+ {
+ // Fill between edges
+ TInt32 fbXmin, fbXmax;
+ if ( fill )
+ {
+ fbXmin = lastEdge->iStart + iEdgeList->iMinX;
+ fbXmax = currentEdge->iEnd + iEdgeList->iMinX;
+ if ( fbXmax >= iRenderInfo->iClipMinX &&
+ fbXmin < iRenderInfo->iClipMaxX ) // inside clipping
+ {
+ if ( fbXmin < iRenderInfo->iClipMinX )
+ {
+ fbXmin = iRenderInfo->iClipMinX;
+ }
+ if ( iRenderInfo->iClipMaxX <= fbXmax )
+ {
+ fbXmax = iRenderInfo->iClipMaxX - 1;
+ }
+ TUint16* fbb =& fb[fbXmin];
+
+ TInt fbw = fbXmax - fbXmin;
+ if ( fbw > 10 )
+ {
+ DrawHLine( fbb, flatColor, fbXmin, fbw );
+ }
+ else
+ {
+ for ( j = fbXmin; j <= fbXmax ; j++ )
+ *fbb++ = flatColor;
+ }
+ }
+ } // end if (fill)
+
+ // update sum of sign and determine fill/non-fill
+
+ if ( iWindingNoneZero )
+ {
+ fill = ( edgeSignSum += currentEdge->iSign ); // Non-zero rule.
+ }
+ else
+ {
+ fill = ( ++edgeSignSum & 1 ); // Even/odd rule.
+ }
+
+ lastEdge = currentEdge;
+ currentEdge = currentEdge->iNext;
+ } // end for i (each edges)
+ }
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxRenderer/GfxRendererInfoP.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxRendererInfoP.h"
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// TGfxRendererInfoP::TGfxRendererInfoP()
+// ---------------------------------------------------------------------------
+TGfxRendererInfoP::TGfxRendererInfoP()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// set device
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// void TGfxRendererInfoP::SetDevice( TUint8* /*aDstBuf*/,
+// ---------------------------------------------------------------------------
+void TGfxRendererInfoP::SetDevice( TUint8* /*aDstBuf*/,
+ TInt32 aWidth,
+ TInt32 aHeight,
+ TInt32 /*aBytePerPixel*/ )
+ {
+ iWidth = aWidth;
+ iHeight = aHeight;
+ iClipMinX = 0;
+ iClipMinY = 0;
+ iClipMaxX = aWidth;
+ iClipMaxY = aHeight;
+ }
+
+
+// ---------------------------------------------------------------------------
+// set clip
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// void TGfxRendererInfoP::SetClip( const TGfxRectangle2D& aClip )
+// ---------------------------------------------------------------------------
+void TGfxRendererInfoP::SetClip( const TGfxRectangle2D& aClip )
+ {
+ iClipMinX = ( TInt32 ) aClip.iX;
+ iClipMinY = ( TInt32 ) aClip.iY;
+ iClipMaxX = ( TInt32 ) ( aClip.iX + aClip.iWidth );
+ iClipMaxY = ( TInt32 ) ( aClip.iY + aClip.iHeight );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/GfxRenderer/GfxStrokeRendererP.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+#include "GfxStrokeRendererP.h"
+#include "GfxPolygonRendererP.h"
+#include "GfxPaint.h"
+#include "GfxColor.h"
+#include "GfxRendererInfoP.h"
+#include "GfxEdgeListP.h"
+
+#include <fbs.h>
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// TGfxStrokeRendererP::TGfxStrokeRendererP() : iStrokeColor( 0 )
+// ---------------------------------------------------------------------------
+TGfxStrokeRendererP::TGfxStrokeRendererP() : iStrokeColor( 0 )
+ {
+ }
+
+// --------------------------------------------------------------------------
+// void TGfxStrokeRendererP::InitializeP( CGfxEdgeListP* aEdgeList,
+// ---------------------------------------------------------------------------
+void TGfxStrokeRendererP::InitializeP( CGfxEdgeListP* aEdgeList,
+ TGfxRendererInfoP* aRenderInfo,
+ TGfxColor aColor )
+ {
+ iEdgeList = aEdgeList;
+ iRenderInfo = aRenderInfo;
+ iStrokeColor = aColor;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Draw one pixel width stroke
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+// void TGfxStrokeRendererP::RenderScanlineL( TInt aY, TUint32 /* aAlpha */ )
+// ---------------------------------------------------------------------------
+void TGfxStrokeRendererP::RenderScanlineL( TInt aY, TUint32 /* aAlpha */ )
+ {
+ if ( iRenderInfo->iClipMinY > aY || aY > iRenderInfo->iClipMaxY )
+ return;
+
+ if ( iStrokeColor.Value() == KGfxColorNull )
+ return;
+
+ TGfxSegEdge* edges = iEdgeList->iEdges;
+ TInt edgeCount = iEdgeList->iEdgesCount;
+
+ // ************ Buffer is 2 bytes per pixel **********
+ TUint16* fb;
+ fb = ( ( TUint16 * ) iRenderInfo->iDstBuf ) +
+ aY * iRenderInfo->iWidth;
+
+ TUint16 strokeCol = iStrokeColor.ColorRgb();
+
+ for ( TInt i = 0; i < edgeCount; i++ )
+ {
+ if ( !edges[i].iOnlyForFill )
+ {
+ TInt32 pbufXmin, pbufXmax;
+ TInt32 fbXmin, fbXmax;
+ pbufXmin = edges[i].iStart;
+ pbufXmax = edges[i].iEnd;
+ fbXmin = pbufXmin + iEdgeList->iMinX;
+ fbXmax = pbufXmax + iEdgeList->iMinX;
+ if ( fbXmax >= iRenderInfo->iClipMinX &&
+ fbXmin < iRenderInfo->iClipMaxX ) // inside clipping
+ {
+ if ( fbXmin < iRenderInfo->iClipMinX )
+ {
+ pbufXmin += iRenderInfo->iClipMinX - fbXmin; // equivalent to 'pbufXmin += -fbXmin;'
+ fbXmin = iRenderInfo->iClipMinX;
+ }
+ if ( iRenderInfo->iClipMaxX <= fbXmax )
+ {
+ pbufXmax -= fbXmax - iRenderInfo->iClipMaxX;
+ fbXmax = iRenderInfo->iClipMaxX - 1;
+ }
+ TUint16* fbb =& fb[fbXmin];
+ TInt fbw = fbXmax - fbXmin;
+ if ( fbw > 10 )
+ {
+ TGfxPolygonRendererP::DrawHLine( fbb,
+ strokeCol,
+ fbXmin,
+ fbw );
+ }
+ else
+ {
+ for ( TInt j = fbXmin; j <= fbXmax ; j++ )
+ *fbb++ = strokeCol;
+ }
+ }
+ }
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/Gfxtrignometric.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,302 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Graphics Extension Library source file
+*
+*/
+
+
+
+
+//File to implement functions to calculate trignomtric function
+
+#include "Gfxtrignometric.h"
+
+
+ /*-------------------------------------------------------------------*/
+// --------------------------------------------------------------------------
+// TInt32 GfxMath::hgAbs32 (TInt32 a)
+// ---------------------------------------------------------------------------
+TInt32 GfxMath::hgAbs32 (TInt32 a)
+{
+
+ return (a >= 0) ? a : -a;
+}
+
+
+/*-------------------------------------------------------------------*//*!
+ * \brief Performs signed 32x32->64 multiplication, returns high 32 bits
+ * \param a First 32-bit signed integer
+ * \param b Second 32-bit signed integer
+ * \return ((int64)(a)*b)>>32
+ *//*-------------------------------------------------------------------*/
+
+// --------------------------------------------------------------------------
+// TInt32 GfxMath::hgLsl64h_0_31 (
+ // ---------------------------------------------------------------------------
+ TInt32 GfxMath::hgLsl64h_0_31 (
+ // --------------------------------------------------------------------------
+ // const GfxMath::TGfxInt64 a,
+ // ---------------------------------------------------------------------------
+ const GfxMath::TGfxInt64 a,
+ TInt32 sh)
+{
+
+ return ((a.h << sh) | ((TUint32)(a.l) >> (32-sh)));
+}
+
+// --------------------------------------------------------------------------
+// GfxMath::TGfxInt64 GfxMath::hgSet64(TInt32 hh,TInt32 ll)
+// ---------------------------------------------------------------------------
+GfxMath::TGfxInt64 GfxMath::hgSet64(TInt32 hh,TInt32 ll)
+{
+ TGfxInt64 a;
+ a.l=ll;
+ a.h=hh;
+ return a;
+}
+
+
+// --------------------------------------------------------------------------
+// GfxMath::TGfxInt64 GfxMath::hgMul64 (
+ // ---------------------------------------------------------------------------
+ GfxMath::TGfxInt64 GfxMath::hgMul64 (
+ TInt32 a,
+ TInt32 b)
+{
+
+ TUint32 hh = (TUint32)((a>>16) *(b>>16));
+ TUint32 lh = (TUint32)((a&0xFFFF)*(b>>16));
+ TUint32 hl = (TUint32)((a>>16) *(b&0xFFFF));
+ TUint32 ll = (TUint32)((a&0xFFFF)*(b&0xFFFF));
+ TUint32 oldlo;
+
+ hh += (TInt32)(lh)>>16;
+ hh += (TInt32)(hl)>>16;
+
+ oldlo = ll;
+ ll += lh<<16;
+ if (ll < oldlo)
+ hh++;
+
+ oldlo = ll;
+ ll += hl<<16;
+ if (ll < oldlo)
+ hh++;
+
+ return hgSet64((TInt32)hh,(TInt32)ll);
+}
+
+
+// --------------------------------------------------------------------------
+// GfxMath::TGfxInt64 GfxMath::hgAdd64 (
+ // ---------------------------------------------------------------------------
+ GfxMath::TGfxInt64 GfxMath::hgAdd64 (
+ const TGfxInt64 a,
+ const TGfxInt64 b)
+{
+ TInt32 hi = a.h+b.h;
+ TInt32 lo = a.l+b.l;
+
+ hi += ((TUint32)(lo) < (TUint32)(a.l)) ? 1 : 0;
+ return hgSet64(hi, lo);
+}
+
+
+
+
+// --------------------------------------------------------------------------
+// GfxMath::TGfxInt64 GfxMath::hgMadd64 (
+ // ---------------------------------------------------------------------------
+ GfxMath::TGfxInt64 GfxMath::hgMadd64 (
+ // --------------------------------------------------------------------------
+ // GfxMath::TGfxInt64 a,
+ // ---------------------------------------------------------------------------
+ GfxMath::TGfxInt64 a,
+ TInt32 b,
+ TInt32 c)
+{
+
+ return hgAdd64(a,hgMul64(b,c));
+}
+
+
+
+
+/*-------------------------------------------------------------------*//*!
+ * \brief Performs unsigned 32x32->64 multiplication, returns high
+ * 32 bits
+ * \param a First 32-bit unsigned integer
+ * \param b Second 32-bit unsigned integer
+ * \return ((unsigned int64)(a)*b)>>32
+ *//*-------------------------------------------------------------------*/
+ // --------------------------------------------------------------------------
+ // TUint32 GfxMath::hgMulu64h (
+ // ---------------------------------------------------------------------------
+ TUint32 GfxMath::hgMulu64h (
+ TUint32 a,
+ TUint32 b)
+{
+
+ TUint32 hh = (a>>16) * (b>>16);
+ TUint32 lh = (a&0xFFFF)* (b>>16);
+ TUint32 hl = (a>>16) * (b&0xFFFFu);
+ TUint32 ll = (a&0xFFFF)* (b&0xFFFFu);
+ TUint32 oldlo;
+
+ hh += (lh>>16);
+ hh += (hl>>16);
+
+ oldlo = ll;
+ ll += lh<<16;
+ if (ll < oldlo)
+ hh++;
+
+ oldlo = ll;
+ ll += hl<<16;
+ if (ll < oldlo)
+ hh++;
+
+ return hh;
+}
+
+//-----------------------------------------------*/
+
+
+ // --------------------------------------------------------------------------
+ // GfxMath::TGfxInt64 GfxMath::hgMulu64 (
+ // ---------------------------------------------------------------------------
+ GfxMath::TGfxInt64 GfxMath::hgMulu64 (
+ TUint32 a,
+ TUint32 b)
+{
+
+ TUint32 hh = (a>>16) * (b>>16);
+ TUint32 lh = (a&0xFFFF)* (b>>16);
+ TUint32 hl = (a>>16) * (b&0xFFFFu);
+ TUint32 ll = (a&0xFFFF)* (b&0xFFFFu);
+ TUint32 oldlo;
+
+ hh += (lh>>16);
+ hh += (hl>>16);
+
+ oldlo = ll;
+ ll += lh<<16;
+ if (ll < oldlo)
+ hh++;
+
+ oldlo = ll;
+ ll += hl<<16;
+ if (ll < oldlo)
+ hh++;
+
+ return hgSet64((TInt32)(hh),(TInt32)(ll));
+}
+
+
+// --------------------------------------------------------------------------
+// TInt GfxMath::svgiRCos( TInt32 _x )
+// ---------------------------------------------------------------------------
+TInt GfxMath::svgiRCos( TInt32 _x )
+{
+ TUint32 fpi = 0x6487ED51;
+ TUint32 y;
+ TUint32 x = hgAbs32(_x);
+ y = x;
+
+ if(y > fpi>>1)
+ y = fpi-y;
+
+ y <<= 1;
+
+ /* Taylor series expansion around point x */
+ /* NOTE: to adjust approximation accuracy vs speed, remove or add iterations in pairs */
+ {
+ TUint32 t;
+ TGfxInt64 c = hgMulu64(y,y<<1);
+ TInt32 x2 = hgLsl64h_0_31(c,1);
+ t = hgMulu64h(x2,x2);
+ c = hgMadd64(c, t,-(0x55555555>>1)-1);
+ t = hgMulu64h(t,x2);
+ c = hgMadd64(c, t, (0x5B05B05B>>4));
+ t = hgMulu64h(t,x2);
+ c = hgMadd64(c, t,-(0x68068068>>8)+1);
+ t = hgMulu64h(t,x2);
+ c = hgMadd64(c, t, (0x49F93EDD>>12)+1);
+ t = hgMulu64h(t,x2);
+ c = hgMadd64(c, t,-(0x47BB63BF>>17));
+ {
+ TInt32 r = c.h;
+ r = (0x40000000 - r)>>1;
+
+ if(x > (fpi>>1))
+ r =-r;
+
+ return r;
+ }
+ }
+}
+
+
+/*=======================================================================*/
+/*=======================================================================*/
+
+// --------------------------------------------------------------------------
+// TInt GfxMath::svgScalarSin( TInt r1 )
+// ---------------------------------------------------------------------------
+TInt GfxMath::svgScalarSin( TInt r1 )
+{
+ TInt32 foo;
+ r1 -= 0x6487ED51>>14;
+ foo = hgLsl64h_0_31(hgMul64(r1,0x517CC1B7),15);
+ foo = hgMulu64h(foo,0x6487ED51);
+ if( foo >= 0x6487ED51>>1 )
+ foo -= 0x6487ED51>>0;
+ return svgiRCos(foo<<1) >> 13;
+}
+
+/*=======================================================================*/
+/*=======================================================================*/
+
+// --------------------------------------------------------------------------
+// TInt GfxMath::svgScalarCos( TInt r1 )
+// ---------------------------------------------------------------------------
+TInt GfxMath::svgScalarCos( TInt r1 )
+{
+ TInt32 foo;
+ foo = hgLsl64h_0_31(hgMul64(r1,0x517CC1B7),15);
+ foo = hgMulu64h(foo,0x6487ED51);
+ if( foo >= 0x6487ED51>>1 )
+ foo -= 0x6487ED51>>0;
+ return svgiRCos(foo<<1) >> 13;
+}
+
+/*=======================================================================*/
+/*=======================================================================*/
+
+// --------------------------------------------------------------------------
+// TInt GfxMath::svgScalarTan( TInt r1 )
+// ---------------------------------------------------------------------------
+TInt GfxMath::svgScalarTan( TInt r1 )
+{
+ TInt lSin = svgScalarSin(r1);
+ if(!lSin)
+ return 0xffffffff; //highest value possible to indicate error
+ TInt lCos = svgScalarCos(r1);
+
+ if ( !lCos )
+ {
+ return 0xffffffff;
+ }
+ return (((lSin << 15) / lCos)<<1);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/gfx2d/src/RastSymbianWrapper.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <e32std.h>
+
+extern "C" void external_memset(void* dst, int data, int size)
+{
+ Mem::Fill(dst, size, data);
+}
+
+extern "C" void external_memcpy(void* dst, void* src, int size)
+{
+ Mem::Copy(dst, src, size);
+}
+
+extern "C" void *external_memmove(void* dst, void* src, int size)
+{
+ return Mem::Move(dst, src, size);
+}
+
+extern "C" void *external_malloc(int size)
+{
+ return User::Alloc(size);
+}
+
+extern "C" void external_free(void *buf)
+{
+ User::Free(buf);
+}
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/group/bld.inf Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This is a top level bld file that drives all sub-components
+* that make up SVGT Engine
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+//Platforms listed are not built by the SVGT Engine
+PRJ_PLATFORMS
+DEFAULT
+
+
+#define __JAVA_JSR_226_2D_SVG_API
+PRJ_MMPFILES
+// ../cXML/Group/cXML.mmp
+
+../SVG/SVGEngine/group/SVGEngine.mmp
+../SVG/SVGRecog/Group/SvgRecog.MMP
+../nvgdecoder/group/nvgdecoder.mmp
+../nvgdecoder/group/NVGDecoder_SW.mmp
+../VGRenderer/group/VGRenderer.mmp
+../VGRenderer/PseudoVG/group/PseudoVG.mmp
+../VGRenderer/SWVG/group/SWVG.mmp
+//#ifdef __JAVA_JSR_226_2D_SVG_API
+../SVGEngineJI/group/SVGEngineJI.mmp
+//#endif
+
+
+PRJ_EXPORTS
+/*
+* Changes for CP50 Build Improvement
+*/
+../rom/SVGEngine.iby CORE_MW_LAYER_IBY_EXPORT_PATH(SVGEngine.iby)
+../rom/SvgtPluginEcom.iby CORE_MW_LAYER_IBY_EXPORT_PATH(SvgtPluginEcom.iby)
+ ../rom/nvgdecoder.iby CORE_MW_LAYER_IBY_EXPORT_PATH(NVGDecoder.iby)
+ ../rom/NVGDecoder_SW.iby CORE_MW_LAYER_IBY_EXPORT_PATH(NVGDecoder_SW.iby)
+../rom/VGRenderer.iby CORE_MW_LAYER_IBY_EXPORT_PATH(VGRenderer.iby)
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/bwins/NVGDecoder_SWu.def Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,11 @@
+EXPORTS
+ ?Rotate@CNvgEngine@@QAEXMMM@Z @ 1 NONAME ; void CNvgEngine::Rotate(float, float, float)
+ ?ContentDimensions@CNvgEngine@@QAE?AVTSize@@ABVTDesC8@@@Z @ 2 NONAME ; class TSize CNvgEngine::ContentDimensions(class TDesC8 const &)
+ ?SetPreserveAspectRatio@CNvgEngine@@QAEXW4TNvgAlignStatusType@@W4TNvgMeetOrSliceType@@@Z @ 3 NONAME ; void CNvgEngine::SetPreserveAspectRatio(enum TNvgAlignStatusType, enum TNvgMeetOrSliceType)
+ ?ResetNvgState@CNvgEngine@@QAEXXZ @ 4 NONAME ; void CNvgEngine::ResetNvgState(void)
+ ?CreateNVGIcon@CNvgEngine@@QAEPAVMNVGIcon@@ABVTDesC8@@ABVTSize@@@Z @ 5 NONAME ; class MNVGIcon * CNvgEngine::CreateNVGIcon(class TDesC8 const &, class TSize const &)
+ ?DrawNvg@CNvgEngine@@QAEHABVTDesC8@@ABVTSize@@PAVCFbsBitmap@@2@Z @ 6 NONAME ; int CNvgEngine::DrawNvg(class TDesC8 const &, class TSize const &, class CFbsBitmap *, class CFbsBitmap *)
+ ??1CNvgEngine@@UAE@XZ @ 7 NONAME ; CNvgEngine::~CNvgEngine(void)
+ ?NewL@CNvgEngine@@SAPAV1@XZ @ 8 NONAME ; class CNvgEngine * CNvgEngine::NewL(void)
+ ?SetBackgroundColor@CNvgEngine@@QAEXK@Z @ 9 NONAME ; void CNvgEngine::SetBackgroundColor(unsigned long)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/bwins/nvgdecoderu.def Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,11 @@
+EXPORTS
+ ?Rotate@CNvgEngine@@QAEXMMM@Z @ 1 NONAME ; void CNvgEngine::Rotate(float, float, float)
+ ?ContentDimensions@CNvgEngine@@QAE?AVTSize@@ABVTDesC8@@@Z @ 2 NONAME ; class TSize CNvgEngine::ContentDimensions(class TDesC8 const &)
+ ?SetPreserveAspectRatio@CNvgEngine@@QAEXW4TNvgAlignStatusType@@W4TNvgMeetOrSliceType@@@Z @ 3 NONAME ; void CNvgEngine::SetPreserveAspectRatio(enum TNvgAlignStatusType, enum TNvgMeetOrSliceType)
+ ?ResetNvgState@CNvgEngine@@QAEXXZ @ 4 NONAME ; void CNvgEngine::ResetNvgState(void)
+ ?CreateNVGIcon@CNvgEngine@@QAEPAVMNVGIcon@@ABVTDesC8@@ABVTSize@@@Z @ 5 NONAME ; class MNVGIcon * CNvgEngine::CreateNVGIcon(class TDesC8 const &, class TSize const &)
+ ?DrawNvg@CNvgEngine@@QAEHABVTDesC8@@ABVTSize@@PAVCFbsBitmap@@2@Z @ 6 NONAME ; int CNvgEngine::DrawNvg(class TDesC8 const &, class TSize const &, class CFbsBitmap *, class CFbsBitmap *)
+ ??1CNvgEngine@@UAE@XZ @ 7 NONAME ; CNvgEngine::~CNvgEngine(void)
+ ?NewL@CNvgEngine@@SAPAV1@XZ @ 8 NONAME ; class CNvgEngine * CNvgEngine::NewL(void)
+ ?SetBackgroundColor@CNvgEngine@@QAEXK@Z @ 9 NONAME ; void CNvgEngine::SetBackgroundColor(unsigned long)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/eabi/NVGDecoder_SWu.def Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,33 @@
+EXPORTS
+ _ZN10CNvgEngine13CreateNVGIconERK6TDesC8RK5TSize @ 1 NONAME
+ _ZN10CNvgEngine13ResetNvgStateEv @ 2 NONAME
+ _ZN10CNvgEngine17ContentDimensionsERK6TDesC8 @ 3 NONAME
+ _ZN10CNvgEngine18SetBackgroundColorEm @ 4 NONAME
+ _ZN10CNvgEngine22SetPreserveAspectRatioE19TNvgAlignStatusType19TNvgMeetOrSliceType @ 5 NONAME
+ _ZN10CNvgEngine4NewLEv @ 6 NONAME
+ _ZN10CNvgEngine6RotateEfff @ 7 NONAME
+ _ZN10CNvgEngine7DrawNvgERK6TDesC8RK5TSizeP10CFbsBitmapS7_ @ 8 NONAME
+ _ZN10CNvgEngineD0Ev @ 9 NONAME
+ _ZN10CNvgEngineD1Ev @ 10 NONAME
+ _ZN10CNvgEngineD2Ev @ 11 NONAME
+ _ZTI10CNVGCSIcon @ 12 NONAME ; #<TI>#
+ _ZTI10CNvgEngine @ 13 NONAME ; #<TI>#
+ _ZTI11CNVGTLVIcon @ 14 NONAME ; #<TI>#
+ _ZTI12CNVGIconData @ 15 NONAME ; #<TI>#
+ _ZTI12CTLVRenderer @ 16 NONAME ; #<TI>#
+ _ZTI15CTLVIconCreator @ 17 NONAME ; #<TI>#
+ _ZTI16CTLVIconRenderer @ 18 NONAME ; #<TI>#
+ _ZTI18COpenVGHandleStore @ 19 NONAME ; #<TI>#
+ _ZTI20CNvgFitToViewBoxImpl @ 20 NONAME ; #<TI>#
+ _ZTI8MNVGIcon @ 21 NONAME ; #<TI>#
+ _ZTV10CNVGCSIcon @ 22 NONAME ; #<VT>#
+ _ZTV10CNvgEngine @ 23 NONAME ; #<VT>#
+ _ZTV11CNVGTLVIcon @ 24 NONAME ; #<VT>#
+ _ZTV12CNVGIconData @ 25 NONAME ; #<VT>#
+ _ZTV12CTLVRenderer @ 26 NONAME ; #<VT>#
+ _ZTV15CTLVIconCreator @ 27 NONAME ; #<VT>#
+ _ZTV16CTLVIconRenderer @ 28 NONAME ; #<VT>#
+ _ZTV18COpenVGHandleStore @ 29 NONAME ; #<VT>#
+ _ZTV20CNvgFitToViewBoxImpl @ 30 NONAME ; #<VT>#
+ _ZTV8MNVGIcon @ 31 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/eabi/nvgdecoderu.def Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,33 @@
+EXPORTS
+ _ZN10CNvgEngine13CreateNVGIconERK6TDesC8RK5TSize @ 1 NONAME
+ _ZN10CNvgEngine13ResetNvgStateEv @ 2 NONAME
+ _ZN10CNvgEngine17ContentDimensionsERK6TDesC8 @ 3 NONAME
+ _ZN10CNvgEngine18SetBackgroundColorEm @ 4 NONAME
+ _ZN10CNvgEngine22SetPreserveAspectRatioE19TNvgAlignStatusType19TNvgMeetOrSliceType @ 5 NONAME
+ _ZN10CNvgEngine4NewLEv @ 6 NONAME
+ _ZN10CNvgEngine6RotateEfff @ 7 NONAME
+ _ZN10CNvgEngine7DrawNvgERK6TDesC8RK5TSizeP10CFbsBitmapS7_ @ 8 NONAME
+ _ZN10CNvgEngineD0Ev @ 9 NONAME
+ _ZN10CNvgEngineD1Ev @ 10 NONAME
+ _ZN10CNvgEngineD2Ev @ 11 NONAME
+ _ZTI10CNVGCSIcon @ 12 NONAME ; #<TI>#
+ _ZTI10CNvgEngine @ 13 NONAME ; #<TI>#
+ _ZTI11CNVGTLVIcon @ 14 NONAME ; #<TI>#
+ _ZTI12CNVGIconData @ 15 NONAME ; #<TI>#
+ _ZTI12CTLVRenderer @ 16 NONAME ; #<TI>#
+ _ZTI15CTLVIconCreator @ 17 NONAME ; #<TI>#
+ _ZTI16CTLVIconRenderer @ 18 NONAME ; #<TI>#
+ _ZTI18COpenVGHandleStore @ 19 NONAME ; #<TI>#
+ _ZTI20CNvgFitToViewBoxImpl @ 20 NONAME ; #<TI>#
+ _ZTI8MNVGIcon @ 21 NONAME ; #<TI>#
+ _ZTV10CNVGCSIcon @ 22 NONAME ; #<VT>#
+ _ZTV10CNvgEngine @ 23 NONAME ; #<VT>#
+ _ZTV11CNVGTLVIcon @ 24 NONAME ; #<VT>#
+ _ZTV12CNVGIconData @ 25 NONAME ; #<VT>#
+ _ZTV12CTLVRenderer @ 26 NONAME ; #<VT>#
+ _ZTV15CTLVIconCreator @ 27 NONAME ; #<VT>#
+ _ZTV16CTLVIconRenderer @ 28 NONAME ; #<VT>#
+ _ZTV18COpenVGHandleStore @ 29 NONAME ; #<VT>#
+ _ZTV20CNvgFitToViewBoxImpl @ 30 NONAME ; #<VT>#
+ _ZTV8MNVGIcon @ 31 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/group/NVGDecoder.mmh Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#if defined(GCC32)
+ALWAYS_BUILD_AS_ARM
+#endif
+
+OPTION_REPLACE ARMCC -O3 -Otime --cpu 6 //--fpu vfpv2
+
+//MACRO NVG_DEBUG
+//MACRO OPENVG_OBJECT_CACHING
+//#define OPENVG_OBJECT_CACHING
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/group/NVGDecoder_SW.mmp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+OPTION_REPLACE ARMCC --arm -O3 -Otime --cpu 6
+#include <platform_paths.hrh>
+
+#include "NVGDecoder.mmh"
+
+TARGET nvgdecoder_sw.dll
+TARGETTYPE dll
+MACRO __MIRROR_
+UID 0x1000008D 0x101FF572
+
+VENDORID VID_DEFAULT
+CAPABILITY CAP_GENERAL_DLL
+
+LANG sc
+
+
+USERINCLUDE ../inc
+USERINCLUDE ../../VGRenderer/PseudoVG/inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE /epoc32/include/libc
+SYSTEMINCLUDE /epoc32/include/VG
+SYSTEMINCLUDE /epoc32/include/platform/mw
+SYSTEMINCLUDE /epoc32/include/platform/vg
+
+LIBRARY euser.lib
+LIBRARY fbscli.lib
+LIBRARY libopenvg_sw.lib libopenvgu_sw.lib
+LIBRARY efsrv.lib
+LIBRARY estor.lib
+LIBRARY aknnotify.lib
+LIBRARY libc.lib libm.lib
+LIBRARY flogger.lib
+
+
+SOURCEPATH ../src
+SOURCE NVGIconData.cpp
+SOURCE NVGCSIcon.cpp
+SOURCE NVGTLVIcon.cpp
+SOURCE nvg.cpp
+SOURCE nvgfittoviewbox.cpp
+SOURCE OpenVGHandleStore.cpp
+SOURCE FloatFixPt.cpp
+SOURCE TLVRenderer.cpp
+SOURCE TLVIconCreator.cpp
+SOURCE TLVIconRenderer.cpp
+SOURCE NVGIcon.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/group/nvgdecoder.mmp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+#include "NVGDecoder.mmh"
+
+TARGET nvgdecoder.dll
+TARGETTYPE dll
+
+UID 0x1000008D 0x101FF461
+
+VENDORID VID_DEFAULT
+CAPABILITY CAP_GENERAL_DLL
+
+LANG sc
+
+USERINCLUDE ../inc
+USERINCLUDE ../../VGRenderer/PseudoVG/inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+
+SYSTEMINCLUDE /epoc32/include/libc
+SYSTEMINCLUDE /epoc32/include/VG
+SYSTEMINCLUDE /epoc32/include/platform/mw
+SYSTEMINCLUDE /epoc32/include/platform/vg
+
+LIBRARY euser.lib
+LIBRARY fbscli.lib
+
+// mixedcase exception
+LIBRARY libOpenVG.lib libOpenVGU.lib
+
+LIBRARY efsrv.lib
+LIBRARY estor.lib
+LIBRARY aknnotify.lib
+LIBRARY libc.lib libm.lib
+LIBRARY flogger.lib
+
+
+SOURCEPATH ../src
+SOURCE NVGIconData.cpp
+SOURCE nvg.cpp
+SOURCE nvgfittoviewbox.cpp
+SOURCE NVGIcon.cpp
+SOURCE NVGCSIcon.cpp
+SOURCE NVGTLVIcon.cpp
+SOURCE FloatFixPt.cpp
+SOURCE TLVRenderer.cpp
+SOURCE TLVIconRenderer.cpp
+SOURCE TLVIconCreator.cpp
+SOURCE OpenVGHandleStore.cpp
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/inc/FloatFixPt.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder header file
+*
+*/
+
+#ifndef NVGFLOATFIX_H_
+#define NVGFLOATFIX_H_
+
+#include <e32def.h>
+#include <s32mem.h>
+
+const TInt32 KFixPtFrac = 16;
+const TInt32 KFixPtFracVal = (1 << KFixPtFrac);
+# define svgFloatBits(f) (*(int*)&f)
+
+inline int svgScalarFromFloat(float f)
+ {
+ int a;
+ int sign;
+ int exponent;
+
+ int r;
+
+
+ a = svgFloatBits(f);
+ sign = a >> 31;
+ exponent = (127 + 15) - ((a >> 23) & 0xff);
+
+ r = (int)((((int)(a) << 8) | (1U << 31)) >> exponent);
+ r &= ((exponent - 32) >> 31);
+
+ r = (r ^ sign) - sign;
+
+ return r;
+
+ }
+class TFloatFixPt
+ {
+ public:
+
+ /**
+ * Construct a TFixPt. The default value is 0.0.
+ *
+ * @since 1.0
+ * @return
+ */
+ TFloatFixPt();
+
+ /**
+ * Construct a TFixPt from the given integer value.
+ *
+ * @since 1.0
+ * @param aVal : integer value
+ * @return
+ */
+ TFloatFixPt(TInt aVal);
+ TFloatFixPt(TInt32 aVal);
+ TFloatFixPt(TReal32 aVal);
+ TFloatFixPt(TInt aVal, TBool aBool);
+ TFloatFixPt& operator=(TReal32 aVal);
+ TFloatFixPt operator+(const TFloatFixPt& aVal) const;
+ operator TReal32() const;
+ TInt32 Round();
+ TInt32 RawData();
+ void copyfloatfix(TInt aVal);
+ public:
+ TInt iValue; // Must be the first data member of this class!
+
+ };
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/inc/NVGCSIcon.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,231 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder header file
+ *
+*/
+
+
+#ifndef NVGCSICON_H_
+#define NVGCSICON_H_
+
+#include <e32base.h>
+#include <openvg.h>
+
+#include "NVGIcon.h"
+
+class CNVGIconData;
+class CNvgEngine;
+class COpenVGHandleStore;
+
+class CNVGCSIcon : public CBase, public MNVGIcon
+ {
+private:
+ enum TNVGCSIconCommands
+ {
+ EPath,
+ EPathData,
+ EPaint,
+ EColorRamp,
+ ETransform,
+ EStrokeWidth,
+ EStrokeMiterLimit,
+ EStrokeLineJoinCap,
+ EStrokePaint,
+ EStrokeColorRamp
+ };
+
+ CNVGCSIcon();
+ void ConstructL(const TDesC8& aBuf);
+
+public:
+ static CNVGCSIcon * NewL(const TDesC8& aBuf);
+ static CNVGCSIcon * NewLC(const TDesC8& aBuf);
+ virtual ~CNVGCSIcon();
+
+ virtual TInt Draw(const TSize aSize, CNvgEngine * aNVGEngine);
+
+ TInt SetViewBox(TReal32 x, TReal32 y, TReal32 w, TReal32 h) __SOFTFP;
+
+ TInt SetPreserveAspectRatio(TInt aPreserveAspectSetting,
+ TInt aSmilFitSetting);
+
+ TInt Rotate(TReal32 aAngle, TReal32 aX, TReal32 aY) __SOFTFP;
+
+ /**
+ * Adds new path drawing command.
+ * @param aPath vgPath to be appended
+ */
+ void AddDrawPathCommandL(VGPath aPath, VGbitfield aPaintMode);
+
+ /**
+ * Adds path data. This is required if vgCreatePath fails.
+ */
+ void AddPathDataL(VGint numSegments, const VGubyte * pathSegments, const void * pathData);
+
+ /**
+ * Adds linear gradient drawing command. Stores the gradient data and matrix
+ * to be used with VG_MATRIX_FILL_PAINT_TO_USER mode.
+ *
+ * @param aCount Gradient data parameter count
+ * @param aGradientData Linear gradient data to be given to vgSetParameterfv
+ * @param aGradientMatrix Linear gradient matrix used for FILL_PAINT_TO_USER matrix mode
+ */
+ void AddLinearGradientCommandL(VGint aCount, VGfloat* aGradientData, VGfloat* aGradientMatrix, VGPaint aPaint);
+
+ /**
+ * Adds radial gradient drawing command. Stores the gradient data and matrix
+ * to be used with VG_MATRIX_FILL_PAINT_TO_USER mode.
+ *
+ * @param aCount Gradient data parameter count
+ * @param aGradientData Linear gradient data to be given to vgSetParameterfv
+ * @param aGradientMatrix Linear gradient matrix used for FILL_PAINT_TO_USER matrix mode
+ */
+ void AddRadialGradientCommandL(VGint aCount, VGfloat* aGradientData, VGfloat* aGradientMatrix, VGPaint aPaint);
+
+ /**
+ * Adds a setColor command to be used with paints.
+ *
+ * @param aRgba RGBA color in hex format to be set with vgSetColor
+ */
+ void AddSetColorCommandL(VGuint aRgba);
+
+ /**
+ * Adds color ramp to the icon data structure.
+ *
+ * @param aStopCount Count of the color ramps, has to be multiple of 5
+ * @param aColorRamps Color ramp data
+ */
+ void AddColorRampCommandL(VGPaint aPaint);
+
+ /**
+ * Adds a transformation command which is multiplied to the current matrix
+ *
+ * @param aTransformMatrix Transformation matrix used for multiplication
+ * @param aFlag 1 multiplies aTransformMatrix with current matrix, 0 loads original matrix
+ */
+ void AddSetTransformCommandL(const VGfloat* aTransformMatrix, TInt aFlag);
+
+ /**
+ * Adds set stroke-width command
+ *
+ * @param aStrokeWidth stroke width
+ */
+ void AddSetStrokeWidthCommandL(VGfloat aStrokeWidth);
+
+ /**
+ * Adds set stroke-miterlimit command
+ *
+ * @param aMiterLimit miter length
+ */
+ void AddSetStrokeMiterLimitCommandL(VGfloat aMiterLimit);
+
+ /**
+ * Adds set line join cap command
+ *
+ * @param aCapStyle end cap style
+ * @param aJoinStyle line join style
+ */
+ void AddStrokeLineJoinCapCommandL(VGint aCapStyle, VGint aJoinStyle);
+
+ /**
+ * Adds linear gradient drawing command. Stores the gradient data and matrix
+ *
+ * @param aCount Gradient data parameter count
+ * @param aGradientData Linear gradient data to be given to vgSetParameterfv
+ * @param aGradientMatrix Linear gradient matrix used for STROKE_PAINT_TO_USER matrix mode
+ */
+ void AddStrokeLinearGradientCommandL(VGint aCount, VGfloat* aGradientData, VGfloat* aGradientMatrix, VGPaint aPaint);
+
+ /**
+ * Adds radial gradient drawing command. Stores the gradient data and matrix
+ * to be used with VG_MATRIX_STROKE_PAINT_TO_USER mode.
+ *
+ * @param aCount Gradient data parameter count
+ * @param aGradientData Linear gradient data to be given to vgSetParameterfv
+ * @param aGradientMatrix Linear gradient matrix used for VG_MATRIX_STROKE_PAINT_TO_USER matrix mode
+ */
+ void AddStrokeRadialGradientCommandL(VGint aCount, VGfloat* aGradientData, VGfloat* aGradientMatrix, VGPaint aPaint);
+
+ /**
+ * Adds a setColor command to be used with stroke.
+ *
+ * @param aRgba RGBA color in hex format
+ */
+ void AddStrokeSetColorCommandL(VGuint aRgba);
+
+ /**
+ * Adds color ramp to the icon data structure.
+ *
+ * @param aStopCount Count of the color ramps, has to be multiple of 5
+ * @param aColorRamps Color ramp data
+ */
+ void AddStrokeColorRampCommandL(VGPaint aPaint);
+
+private:
+
+ TInt DoDrawL(const TSize aSize);
+
+ void AddLinearGradientCommandDataL(VGPaint aPaint, VGint aCount, VGfloat* aGradientData, VGfloat* aGradientMatrix);
+ void AddRadialGradientCommandDataL(VGPaint aPaint, VGint aCount, VGfloat* aGradientData, VGfloat* aGradientMatrix);
+ void AddSetColorCommandDataL(VGuint aRgba);
+
+ void DrawPaintL(VGPaint aPaint, VGMatrixMode aMatrixMode, TUint & aLastPaintType, TUint & aLastPaintColor, VGPaintMode aPaintMode);
+ void DrawColorRampL(VGPaint aPaint);
+ void SetViewBoxToViewTransformationL(const TSize aSize);
+ void SetRotation();
+
+ void UpdateClientMatrices();
+ void RestoreClientMatrices();
+
+private:
+ TReal32 iViewBoxX;
+ TReal32 iViewBoxY;
+ TReal32 iViewBoxW;
+ TReal32 iViewBoxH;
+
+ TReal32 iRotationAngle;
+ TReal32 iRotationX;
+ TReal32 iRotationY;
+
+ TInt iPreserveAspectSetting;
+ TInt iSmilFitSetting;
+
+ CNVGIconData * iNVGIconData;
+
+ VGPath iPath; // when create path fails this handle will be used
+ VGPaint iFillPaint; // currently just one object for fill paint
+ VGPaint iStrokePaint; // currently just one object for stroke paint
+
+ // caller's parameters
+ VGPaint iUserStrokePaint;
+ VGPaint iUserFillPaint;
+
+ VGint iMatrixMode;
+ TReal32 iImageMatrix[9];
+ TReal32 iPathMatrix[9];
+ TReal32 iFillPaintMatrix[9];
+ TReal32 iStrokePaintMatrix[9];
+ CNvgEngine * iNVGEngine;
+ COpenVGHandleStore* iOpenVGHandles;
+
+ TUint iLastFillPaintType;
+ TUint iLastStrokePaintType;
+ TUint iLastFillPaintColor;
+ TUint iLastStrkePaintColor;
+
+ TUint iResetFillPaint;
+ VGPaint iResetStrokePaint;
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/inc/NVGIconData.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,251 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder header file
+*
+*/
+
+
+#ifndef CNVGICONDATA_H_
+#define CNVGICONDATA_H_
+
+#include <e32base.h>
+#include <s32mem.h>
+
+
+/**
+ * @class CNVGIconData
+ * This class is useful when you want to read nd write data from and to memory
+ * This class check for buffer overflow
+ * This is much faster than stream classes provided by symbian
+ * During the ETM traces we found that those classes are 3 FPS less than these utility classes
+ * This class will be checking for data alignment
+ */
+class CNVGIconData : public CBase
+ {
+private:
+ CNVGIconData();
+ void ConstructL(TUint aLength);
+ void ConstructL(const TDesC8& aBuf);
+
+public:
+
+ /**
+ * Here the user should only read. Will Behave undefinitly if try to write.
+ */
+ static CNVGIconData * NewL(const TDesC8& aBuf);
+
+ static CNVGIconData * NewL(TInt aLength = 0);
+
+ static CNVGIconData * NewLC(const TDesC8& aBuf);
+
+ static CNVGIconData * NewLC(TInt aLength = 0);
+
+ static CNVGIconData * NewL(TUint8 * aBuf, TInt aLength);
+
+ static CNVGIconData * NewLC(TUint8 * aBuf, TInt aLength);
+
+ virtual ~CNVGIconData();
+
+ void Set(const TDesC8& aBuf);
+
+ void Set(TUint8 * aBuf, TInt aLength);
+
+ TInt EncodeInt8(TUint8 aVal);
+
+ TInt EncodeInt16(TUint16 aVal);
+
+ TInt EncodeInt32(TUint32 aVal);
+
+ TInt EncodeReal32(TReal32 aVal);
+
+ TInt EncodeReal64(TReal64 aVal);
+
+ TInt EncodeData(const TAny *aData, TUint aLength);
+
+ void EncodeInt8L(TUint8 aVal);
+
+ void EncodeInt16L(TUint16 aVal);
+
+ void EncodeInt32L(TUint32 aVal);
+
+ void EncodeReal32L(TReal32 aVal);
+
+ void EncodeReal64L(TReal64 aVal);
+
+ void EncodeDataL(const TAny *aData, TUint aLength);
+
+ TInt ExpandEncodedData(TUint aNewLength);
+
+ const HBufC8 * GetNVGData() const;
+
+ const HBufC8 * GetNVGData();
+
+ void BeginRead();
+ void EndRead();
+
+ TInt16 ReadInt16L();
+
+ TInt32 ReadInt32L();
+
+ TInt8 ReadInt8L();
+
+ void ReadL(TDes8 &aDes, TInt aLength);
+
+ void ReadL(TUint8 *aPtr, TInt aLength);
+
+ TReal32 ReadReal32L();
+
+ TReal64 ReadReal64L();
+
+ void SkipL(TInt aLength);
+
+ TInt ReadPos();
+
+ TBool EOF();
+
+ TInt DataLength();
+
+private:
+
+ void CheckOutOfBoundL(TInt aLength);
+
+ HBufC8 * iNVGData;
+ TPtr8 iNVGDataPtr;
+ TInt iTotalRead;
+ TInt iDataLength;
+ TUint8 * iReadStream;
+ };
+
+/**
+ * @class TDereferencer
+ * This class is useful when you want to dereference character data
+ * This class check for buffer overflow
+ * This is much faster than stream classes provided by symbian
+ * During the ETM traces we found that those classes are 3 FPS less than these utility classes
+ * This class won't be checking for data alignment.
+ */
+class TDereferencer
+ {
+public:
+
+ TDereferencer(TUint8 * aBuf, TInt aLength);
+
+ TDereferencer(const TDesC8& aBuf);
+
+ /**
+ * @fn SkipL
+ * Advances the read pointer with the given length
+ */void SkipL(TInt aLength);
+
+ /**
+ * @fn DerefInt16L
+ * Converts current position to TInt16 *. The caller should take care of alignment
+ * The advantage of this method is that you don't have to copy the data
+ * Bound check will happen
+ * @param aAt dereference from this position
+ * @exception Leaves if data size is not sufficient
+ */
+ TInt16 DerefInt16L(TInt aAt = 0);
+ operator TInt16();
+
+ /**
+ * @fn DerefInt32L
+ * Converts current position to TInt32 *. The caller should take care of alignment
+ * The advantage of this method is that you don't have to copy the data
+ * Bound check will happen
+ * @param aAt dereference from this position
+ * @exception Leaves if data size is not sufficient
+ */
+ TInt32 DerefInt32L(TInt aAt = 0);
+ operator TInt32();
+
+ /**
+ * @fn DerefInt8L
+ * Converts current position to TInt8 *. The caller should take care of alignment
+ * The advantage of this method is that you don't have to copy the data
+ * Bound check will happen
+ * @param aAt dereference from this position
+ * @exception Leaves if data size is not sufficient
+ */
+ TInt8 DerefInt8L(TInt aAt = 0);
+ operator TInt8();
+
+ /**
+ * @fn DerefInt8ArrayL
+ * Converts current position to TUint8 *. The caller should take care of alignment
+ * The advantage of this method is that you don't have to copy the data
+ * Bound check will happen
+ * @param aLength making safe to dereference for this size
+ * @param aAt dereference from this position
+ * @exception Leaves if data size is not sufficient
+ */
+ TUint8 * DerefInt8ArrayL(TInt aLength, TInt aAt = 0);
+
+ /**
+ * @fn ReadReal32L
+ * Converts current position to TReal32 *. The caller should take care of alignment
+ * The advantage of this method is that you don't have to copy the data
+ * Bound check will happen
+ * @param aAt dereference from this position
+ * @exception Leaves if data size is not sufficient
+ */
+ TReal32 DerefReal32L(TInt aAt = 0);
+ operator TReal32();
+
+ /**
+ * @fn ReadReal64L
+ * Converts current position to TReal64 *. The caller should take care of alignment
+ * The advantage of this method is that you don't have to copy the data
+ * Bound check will happen
+ * @param aAt dereference from this position
+ * @exception Leaves if data size is not sufficient
+ */
+ TReal64 DerefReal64L(TInt aAt = 0);
+ operator TReal64();
+
+ /**
+ * @fn IsSafeL
+ * Checks whether dereferencing is safe for the given length from the given offset
+ * @param aLength length for dereferencing
+ * @param aAt offset from where the dereferencing should start
+ */
+ void IsSafeL(TInt aLength, TInt aAt = 0);
+
+ /**
+ * @fn GetPtr
+ * Retrieves the ptr to the data stream
+ */
+ TPtr8 GetPtr();
+
+ /**
+ * Retrieves the silze of the buffer
+ */
+ TInt GetLength();
+
+ /**
+ * Returns current reading position
+ */
+ TInt GetReadingPos();
+
+private:
+ void CheckOutOfBoundL(TInt aLength);
+
+ TInt iTotalRead;
+ TInt iDataLength;
+ TUint8 * iReadStream;
+ };
+
+#include "NVGIconData.inl"
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/inc/NVGIconData.inl Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,227 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder header file
+*
+*/
+
+#ifndef NVGICONDATA_INL_
+#define NVGICONDATA_INL_
+
+inline void CNVGIconData::CheckOutOfBoundL(TInt aLength)
+ {
+ if (iTotalRead + aLength > iDataLength ||
+ iTotalRead + aLength < 0)
+ {
+ User::Leave(KErrEof);
+ }
+ }
+
+inline TInt CNVGIconData::ReadPos()
+ {
+ return iTotalRead;
+ }
+
+inline TInt CNVGIconData::DataLength()
+ {
+ return iDataLength;
+ }
+
+
+inline const HBufC8 * CNVGIconData::GetNVGData()
+ {
+ return iNVGData;
+ }
+
+inline TBool CNVGIconData::EOF()
+ {
+ return (iTotalRead >= iDataLength);
+ }
+
+inline TInt CNVGIconData::EncodeInt8(TUint8 aVal)
+ {
+ return EncodeData(&aVal, sizeof(aVal));
+ }
+
+inline TInt CNVGIconData::EncodeInt16(TUint16 aVal)
+ {
+ return EncodeData(&aVal, sizeof(aVal));
+ }
+
+inline TInt CNVGIconData::EncodeInt32(TUint32 aVal)
+ {
+ return EncodeData(&aVal, sizeof(aVal));
+ }
+
+inline TInt CNVGIconData::EncodeReal32(TReal32 aVal)
+ {
+ return EncodeData(&aVal, sizeof(aVal));
+ }
+
+inline TInt CNVGIconData::EncodeReal64(TReal64 aVal)
+ {
+ return EncodeData(&aVal, sizeof(aVal));
+ }
+
+inline void CNVGIconData::EncodeInt8L(TUint8 aVal)
+ {
+ return EncodeDataL(&aVal, sizeof(aVal));
+ }
+
+inline void CNVGIconData::EncodeInt16L(TUint16 aVal)
+ {
+ return EncodeDataL(&aVal, sizeof(aVal));
+ }
+
+inline void CNVGIconData::EncodeInt32L(TUint32 aVal)
+ {
+ return EncodeDataL(&aVal, sizeof(aVal));
+ }
+
+inline void CNVGIconData::EncodeReal32L(TReal32 aVal)
+ {
+ return EncodeDataL(&aVal, sizeof(aVal));
+ }
+
+inline void CNVGIconData::EncodeReal64L(TReal64 aVal)
+ {
+ return EncodeDataL(&aVal, sizeof(aVal));
+ }
+
+inline const HBufC8 * CNVGIconData::GetNVGData() const
+ {
+ return iNVGData;
+ }
+
+inline void CNVGIconData::Set(const TDesC8& aBuf)
+ {
+ iNVGDataPtr.Set((TUint8 *)aBuf.Ptr(), aBuf.Length(), aBuf.Length());
+ }
+
+inline void CNVGIconData::Set(TUint8 * aBuf, TInt aLength)
+ {
+ iNVGDataPtr.Set(aBuf, aLength, aLength);
+ }
+
+inline TDereferencer::TDereferencer(TUint8 * aBuf, TInt aLength)
+ : iTotalRead(0),
+ iDataLength(aLength),
+ iReadStream(aBuf)
+ {
+
+ }
+
+inline TDereferencer::TDereferencer(const TDesC8& aBuf)
+ : iTotalRead(0),
+ iDataLength(aBuf.Length()),
+ iReadStream((unsigned char *)aBuf.Ptr())
+ {
+ }
+
+inline void TDereferencer::CheckOutOfBoundL(TInt aLength)
+ {
+ if (iTotalRead + aLength > iDataLength ||
+ iTotalRead + aLength < 0)
+ {
+ User::Leave(KErrEof);
+ }
+ }
+
+inline void TDereferencer::SkipL(TInt aLength)
+ {
+ CheckOutOfBoundL(aLength);
+ iTotalRead += aLength;
+ }
+
+#define DEREF_PTR(TOTYPE, Offset, Size) do {\
+ CheckOutOfBoundL(Offset + Size); \
+ return * (TOTYPE *)&iReadStream[iTotalRead + Offset];\
+ } while (0)
+
+inline TReal64 TDereferencer::DerefReal64L(TInt aAt)
+ {
+ DEREF_PTR(TReal64, aAt, sizeof(TReal64));
+ }
+
+inline TReal32 TDereferencer::DerefReal32L(TInt aAt)
+ {
+ DEREF_PTR(TReal32, aAt, sizeof(TReal32));
+ }
+
+inline TUint8 * TDereferencer::DerefInt8ArrayL(TInt aLength, TInt aAt)
+ {
+ CheckOutOfBoundL(aAt + aLength);
+ return (TUint8 *)&iReadStream[iTotalRead + aAt];
+ }
+
+inline void TDereferencer::IsSafeL(TInt aLength, TInt aAt)
+ {
+ CheckOutOfBoundL(aAt + aLength);
+ }
+
+inline TInt8 TDereferencer::DerefInt8L(TInt aAt)
+ {
+ DEREF_PTR(TInt8, aAt, sizeof(TInt8));
+ }
+
+inline TInt32 TDereferencer::DerefInt32L(TInt aAt)
+ {
+ DEREF_PTR(TInt32, aAt, sizeof(TInt32));
+ }
+
+inline TInt16 TDereferencer::DerefInt16L(TInt aAt)
+ {
+ DEREF_PTR(TInt16, aAt, sizeof(TInt16));
+ }
+
+inline TDereferencer::operator TReal64()
+ {
+ return DerefReal64L();
+ }
+
+inline TDereferencer::operator TReal32()
+ {
+ return DerefReal32L();
+ }
+
+inline TDereferencer::operator TInt8()
+ {
+ return DerefInt8L();
+ }
+
+inline TDereferencer::operator TInt32()
+ {
+ return DerefInt32L();
+ }
+
+inline TDereferencer::operator TInt16()
+ {
+ return DerefInt16L();
+ }
+
+inline TPtr8 TDereferencer::GetPtr()
+ {
+ return TPtr8(iReadStream, iDataLength, iDataLength);
+ }
+
+inline TInt TDereferencer::GetLength()
+ {
+ return iDataLength;
+ }
+
+inline TInt TDereferencer::GetReadingPos()
+ {
+ return iTotalRead;
+ }
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/inc/NVGTLVIcon.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder header file
+ *
+*/
+
+
+#ifndef NVGTLVICON_H_
+#define NVGTLVICON_H_
+
+#include <e32base.h>
+#include <openvg.h>
+#include "NVGIcon.h"
+
+class CNVGIconData;
+class MVGImageBinder;
+class COpenVGHandleStore;
+
+class CNVGTLVIcon : public CBase, public MNVGIcon
+ {
+private:
+ CNVGTLVIcon();
+ void ConstructL();
+
+public:
+ enum TNVGTLVIconCommands
+ {
+ EPath = 0x50,
+ ENone
+ };
+
+public:
+ static CNVGTLVIcon * NewL();
+
+ static CNVGTLVIcon * NewLC();
+
+ virtual ~CNVGTLVIcon();
+
+ TInt SetPreserveAspectRatio(TInt aPreserveAspectSetting,
+ TInt aSmilFitSetting);
+
+ TInt Rotate(TReal32 aAngle, TReal32 aX, TReal32 aY) __SOFTFP;
+
+ virtual TInt Draw(const TSize aSize, CNvgEngine * aNVGEngine);
+
+ void AddDrawPathCommandL(VGPath aPath, VGPaintMode aPaintMode);
+
+ void AddCommandL(const TUint8 * aCommandBuffer, TInt aCommandBufferLength);
+
+ void AddCommandL(TInt8 aCommandType, const TUint8 * aCommandBuffer, TInt aCommandBufferLength);
+
+ TInt DirectDrawL(const TDesC8& aBuf, const TSize& aTargetSize);
+
+ TInt CreateL(const TDesC8& aBuf, const TSize& aTargetSize);
+
+ void SetVGImageBinder(MVGImageBinder *aImageBinder)
+ {
+ iVGImageBinder = aImageBinder;
+ }
+
+private:
+ TInt DoDrawL(const TSize aSize);
+ void UpdateClientMatrices();
+ void RestoreClientMatrices();
+
+ VGint iMatrixMode;
+ TReal32 iImageMatrix[9];
+ TReal32 iPathMatrix[9];
+ CNvgEngine * iNVGEngine;
+ CNVGIconData * iNVGIconData;
+ MVGImageBinder * iVGImageBinder;
+ COpenVGHandleStore* iOpenVGHandles;
+ };
+
+#endif
+//--------------------------------EndOfFile------------------------------------
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/inc/NVGUtil.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,267 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder header file
+*
+*/
+
+
+#ifndef NVGUTIL_H_
+#define NVGUTIL_H_
+
+#include <e32base.h>
+
+#ifndef NVG_DEBUG
+ #define NVG_DEBUGP1(x1)
+ #define NVG_DEBUGP2(x1, x2)
+ #define NVG_DEBUGP3(x1, x2, x3)
+ #define NVG_DEBUGP4(x1, x2, x3, x4)
+ #define NVG_DEBUGP5(x1, x2, x3, x4, x5)
+ #define NVG_DEBUGP6(x1, x2, x3, x4, x5, x6)
+ #define NVG_DEBUGP7(x1, x2, x3, x4, x5, x6, x7)
+ #define NVG_DEBUGP8(x1, x2, x3, x4, x5, x6, x7, x8)
+ #define NVG_DEBUGP9(x1, x2, x3, x4, x5, x6, x7, x8, x9)
+
+ #define NVG_DEBUGSTMT(x1)
+
+ #define VGCREATEPAINT() vgCreatePaint()
+ #define VGDESTROYPAINT(h) vgDestroyPaint(h)
+
+ #define VGCREATEPATH(a1, a2, a3, a4, a5, a6, a7) vgCreatePath(a1, a2, a3, a4, a5, a6, a7)
+ #define VGDESTROYPATH(h) vgDestroyPath(h)
+
+ #define VGCREATEIMAGE(a1, a2, a3, a4) vgCreateImage(a1, a2, a3, a4)
+ #define VGDESTROYIMAGE(h) vgDestroyImage(h)
+
+ #define DECLARE_HANDLECHECKER_GLOBAL()
+ #define DECLARE_HANDLECHECKER()
+ #define INIT_HANDLECHECKER()
+ #define ASSERT_HANDLE_COUNT()
+
+#else
+#include <e32debug.h>
+ #define NVG_DEBUGP1(x1) RDebug::Printf(x1)
+ #define NVG_DEBUGP2(x1, x2) RDebug::Printf(x1, x2)
+ #define NVG_DEBUGP3(x1, x2, x3) RDebug::Printf(x1, x2, x3)
+ #define NVG_DEBUGP4(x1, x2, x3, x4) RDebug::Printf(x1, x2, x3, x4)
+ #define NVG_DEBUGP5(x1, x2, x3, x4, x5) RDebug::Printf(x1, x2, x3, x4, x5)
+ #define NVG_DEBUGP6(x1, x2, x3, x4, x5, x6) RDebug::Printf(x1, x2, x3, x4, x5, x6)
+ #define NVG_DEBUGP7(x1, x2, x3, x4, x5, x6, x7) RDebug::Printf(x1, x2, x3, x4, x5, x6, x7)
+ #define NVG_DEBUGP8(x1, x2, x3, x4, x5, x6, x7, x8) RDebug::Printf(x1, x2, x3, x4, x5, x6, x7, x8)
+ #define NVG_DEBUGP9(x1, x2, x3, x4, x5, x6, x7, x8, x9) RDebug::Printf(x1, x2, x3, x4, x5, x6, x7, x8, x9)
+
+ #define NVG_DEBUGSTMT(x1) do { x1; } while (0)
+
+ struct THandleCounter
+ {
+ TInt paintHC;
+ TInt pathHC;
+ TInt imageHC;
+ THandleCounter() : paintHC(0), pathHC(0), imageHC(0) {}
+ };
+
+inline void incrementPaintHandleCountL(THandleCounter * handleCounter)
+ {
+ if (handleCounter)
+ handleCounter->paintHC++;
+ }
+
+inline void decrementPaintHandleCountL(THandleCounter * handleCounter)
+ {
+ if (handleCounter)
+ handleCounter->paintHC--;
+ }
+
+inline void decrementImageHandleCountL(THandleCounter * handleCounter)
+ {
+ if (handleCounter)
+ handleCounter->imageHC--;
+ }
+
+inline void decrementPathHandleCountL(THandleCounter * handleCounter)
+ {
+ if (handleCounter)
+ handleCounter->pathHC--;
+ }
+
+inline void incrementPathHandleCountL(THandleCounter * handleCounter)
+ {
+ if (handleCounter)
+ handleCounter->pathHC++;
+ }
+
+inline void incrementImageHandleCountL(THandleCounter * handleCounter)
+ {
+ if (handleCounter)
+ handleCounter->imageHC++;
+ }
+
+inline void checkHandleCout(THandleCounter * handleCounter)
+ {
+ if (handleCounter)
+ {
+ if (handleCounter->paintHC != 0)
+ {
+ User::Panic(_L("Paint Handle Deallocation Not Matching"), 1);
+ }
+
+ if (handleCounter->pathHC != 0)
+ {
+ User::Panic(_L("Path Handle Deallocation Not Matching"), 1);
+ }
+
+ if (handleCounter->imageHC != 0)
+ {
+ User::Panic(_L("Image Handle Deallocation Not Matching"), 1);
+ }
+ }
+
+ delete handleCounter;
+ handleCounter = 0;
+ }
+
+inline VGHandle vgCreatePaintWrapper(THandleCounter * handleCounter)
+ {
+ VGPaint pH = vgCreatePaint();
+ if (pH)
+ {
+ incrementPaintHandleCountL(handleCounter);
+ }
+ return pH;
+ }
+
+inline void vgDestroyPaintWrapper(THandleCounter * handleCounter, VGHandle h)
+ {
+ if (h)
+ {
+ vgDestroyPaint(h);
+ decrementPaintHandleCountL(handleCounter);
+ }
+ }
+
+
+inline VGHandle vgCreatePathWrapper(THandleCounter * handleCounter, VGint a1,
+ VGPathDatatype a2,
+ VGfloat a3, VGfloat a4,
+ VGint a5,
+ VGint a6,
+ VGbitfield a7)
+ {
+ VGPath pH = vgCreatePath(a1, a2, a3, a4, a5, a6, a7);
+ if (pH)
+ {
+ incrementPathHandleCountL(handleCounter);
+ }
+ return pH;
+ }
+
+inline void vgDestroyPathWrapper(THandleCounter * handleCounter, VGHandle h)
+ {
+ if (h)
+ {
+ vgDestroyPath(h);
+ decrementPathHandleCountL(handleCounter);
+ }
+ }
+
+inline VGHandle vgCreateImageWrapper(THandleCounter * handleCounter, VGImageFormat a1,
+ VGint a2, VGint a3,
+ VGbitfield a4)
+ {
+ VGImage iH = vgCreateImage(a1, a2, a3, a4);
+ if (iH)
+ {
+ incrementImageHandleCountL(handleCounter);
+ }
+ return iH;
+ }
+
+inline void vgDestroyImageWrapper(THandleCounter * handleCounter, VGHandle h)
+ {
+ if (h)
+ {
+ vgDestroyImage(h);
+ decrementImageHandleCountL(handleCounter);
+ }
+ }
+
+
+ #define DECLARE_HANDLECHECKER_GLOBAL() THandleCounter * __handleCounter;
+ #define DECLARE_HANDLECHECKER() private: THandleCounter * __handleCounter;
+ #define INIT_HANDLECHECKER() __handleCounter = new THandleCounter;
+ #define ASSERT_HANDLE_COUNT() checkHandleCout(__handleCounter);
+
+ #define VGCREATEPAINT() (NVG_DEBUGP3("/*vgCreatePaint() %s:%d*/", __FILE__, __LINE__), vgCreatePaintWrapper(__handleCounter))
+ #define VGDESTROYPAINT(h) (NVG_DEBUGP3("/*vgDestroyPaint() %s:%d*/", __FILE__, __LINE__), vgDestroyPaintWrapper(__handleCounter, h))
+
+ #define VGCREATEPATH(a1, a2, a3, a4, a5, a6, a7) (NVG_DEBUGP3("/*vgCreatePath() %s:%d*/", __FILE__, __LINE__), vgCreatePathWrapper(__handleCounter, a1, a2, a3, a4, a5, a6, a7))
+ #define VGDESTROYPATH(h) (NVG_DEBUGP3("/*vgDestroyPath() %s:%d*/", __FILE__, __LINE__), vgDestroyPathWrapper(__handleCounter, h))
+
+ #define VGCREATEIMAGE(a1, a2, a3, a4) (NVG_DEBUGP3("/*vgCreateImage() %s:%d*/", __FILE__, __LINE__), vgCreateImageWrapper(__handleCounter, a1, a2, a3, a4))
+ #define VGDESTROYIMAGE(h) (NVG_DEBUGP3("/*vgDestroyImage() %s:%d*/", __FILE__, __LINE__), vgDestroyImageWrapper(__handleCounter, h))
+
+#endif
+
+#ifdef OPENVG_OBJECT_CACHING
+
+// first one is for openVG object caching, the macro is used for testing purpose
+#define COND_COM_OC(obj, s1, s2) if (obj) { s1; } else { s2; }
+
+// if object caching is enabled take the first one, which is for object caching,
+// else the second one
+#define COND_COM_OC_NOC(s1, s2) s1
+
+// if object caching is enabled take the first one, which is for object caching
+// else don't do anything
+#define COND_COM_OC_OOC(s1) s1
+
+#else
+
+// first one is for openVG object caching, the macro is used for testing purpose
+#define COND_COM_OC(obj, s1, s2) s2
+
+// if object caching is enabled take the first one, which is for object caching,
+// else the second one
+#define COND_COM_OC_NOC(s1, s2) s2
+
+// if object caching is enabled take the first one, which is for object caching
+// else don't do anything
+// if object caching is enabled take the first one, which is for object caching
+// else don't do anything
+#define COND_COM_OC_OOC(s1)
+
+// if object caching is enabled take the first one, which is for object caching
+// else don't do anything
+#endif
+
+GLDEF_C void CleanupArray( TAny * aObj );
+GLDEF_C void CleanupTFloatFixArray( TAny * aObj );
+
+/*
+ * There is an Align4 function in symbian which does the alignement
+ * this is just to check whether the given pointer is aligned or not
+ */
+template <class T>
+inline TBool IsAligned4(T aValue)
+ {return !((TUint32)aValue & (sizeof(TUint32) - 1));}
+
+/*
+ * There is an Align2 function in symbian which does the alignement
+ * this is just to check whether the given pointer is aligned or not
+ */
+template <class T>
+inline TBool IsAligned2(T aValue)
+ {return !((TUint16)aValue & (sizeof(TUint16) - 1));}
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/inc/OpenVGHandleStore.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder header file
+ *
+*/
+
+
+#ifndef OPENVGHANDLESTORE_H_
+#define OPENVGHANDLESTORE_H_
+
+#include <e32base.h>
+#include <openvg.h>
+
+class COpenVGHandleStore : public CBase
+ {
+public:
+ struct TLVVGHandlePair
+ {
+ enum THandleType
+ {
+ EVGPath,
+ EVGPaint,
+ EVGImage
+ };
+ VGHandle iVGHandle;
+ THandleType iHandleType;
+
+ explicit TLVVGHandlePair(VGHandle aVGHandle, THandleType aHandleType = EVGPath)
+ : iVGHandle(aVGHandle),
+ iHandleType(aHandleType)
+ {
+ }
+ };
+
+ virtual ~COpenVGHandleStore();
+
+ static COpenVGHandleStore * NewL();
+
+ static COpenVGHandleStore * NewLC();
+
+ void AddPathDHL(VGPath aHandle)
+ {
+ TInt error = AddPath(aHandle);
+ if (error != KErrNone)
+ {
+ vgDestroyPath(aHandle);
+ User::Leave(error);
+ }
+ }
+
+ void AddPaintDHL(VGPaint aHandle)
+ {
+ TInt error = AddPaint(aHandle);
+ if (error != KErrNone)
+ {
+ vgDestroyPaint(aHandle);
+ User::Leave(error);
+ }
+ }
+
+ void AddImageDHL(VGImage aHandle)
+ {
+ TInt error = AddImage(aHandle);
+ if (error != KErrNone)
+ {
+ vgDestroyImage(aHandle);
+ User::Leave(error);
+ }
+ }
+
+ TInt AddPath(VGPath aHandle)
+ {
+ return iHandles.Append(TLVVGHandlePair(aHandle, TLVVGHandlePair::EVGPath));
+ }
+
+ TInt AddPaint(VGPaint aHandle)
+ {
+ return iHandles.Append(TLVVGHandlePair(aHandle, TLVVGHandlePair::EVGPaint));
+ }
+
+ TInt AddImage(VGImage aHandle)
+ {
+ return iHandles.Append(TLVVGHandlePair(aHandle, TLVVGHandlePair::EVGImage));
+ }
+
+ TInt AddHandle(VGHandle aHandle, TLVVGHandlePair::THandleType aType)
+ {
+ return iHandles.Append(TLVVGHandlePair(aHandle, aType));
+ }
+
+private:
+ COpenVGHandleStore();
+
+ void ConstructL();
+
+ RArray<TLVVGHandlePair> iHandles;
+ };
+
+#endif
+//--------------------------------EndOfFile------------------------------------
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/inc/TLVIconCreator.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder header file
+ *
+*/
+
+
+#ifndef TLVICONCREATER_H_
+#define TLVICONCREATER_H_
+
+#include <e32base.h>
+#include <VG/openvg.h>
+#include <VG/vgu.h>
+#include "FloatFixPt.h"
+#include "PseudoVG.h"
+
+class CNVGTLVIcon;
+class CNVGIconData;
+class CTLVIconCreator : public CBase
+ {
+
+public:
+ static CTLVIconCreator * NewL(const TDesC8& aPtr, TInt aWidth, TInt aHeight, CNVGTLVIcon * aNVGTLVIcon);
+
+ static CTLVIconCreator * NewLC(const TDesC8& aPtr, TInt aWidth, TInt aHeight, CNVGTLVIcon * aNVGTLVIcon);
+
+ virtual ~CTLVIconCreator();
+
+ TInt ExecuteL();
+
+ void SetTLVIcon(CNVGTLVIcon * aNVGTLVIcon)
+ {
+ iNVGTLVIcon = aNVGTLVIcon;
+ }
+
+private:
+ CTLVIconCreator(TInt aWidth, TInt aHeight, CNVGTLVIcon * aNVGTLVIcon);
+ void ConstructL(const TDesC8& aPtr);
+
+ void DvgAddCommandL(TInt aLength, TInt aPos);
+ void DvgAddCommandL();
+ void DvgSetParameterfvL( );
+ void DvgSetPaintL( );
+ void DvgAppendPathDataL( );
+ void DvgDrawPathL( );
+ void DvgClearPathL();
+ void DvgCreatePaintL( );
+ void DvgSetivL( );
+ void DvgClearL();
+ void DvgSetfvL();
+ void DvgCreatePathL();
+ void DvgCreateImageL();
+ void DvgGetPixelsL();
+ void DvgClearImageL();
+ void DvgImageSubDataL();
+ void DvgDrawImageL();
+ void DvgDestroyImageL();
+ void DvgDestroyPaintL();
+ void DvgDestroyPathL();
+
+ void DvguRectL();
+ void DvguEllipseL();
+ void DvguRoundRectL();
+ void DvguLineL();
+
+ void DvgPrepareToBindImageL();
+ void DvgBindImageL();
+ void DvgUnBindImageL();
+
+ void DvgFlushL();
+
+ TInt ExecuteL(TInt index);
+
+#ifdef NVG_DEBUG
+ //Command specific logging methods
+ void LogvgSeti(VGParamType type, VGint fvalue, TInt cmdsize);
+ void LogvgSetf (VGParamType type, VGfloat fvalue, TInt cmdsize);
+ void LogvgSetParameteri(VGHandle handle, VGint paramType, VGint pvalue, TInt cmdsize, TInt Lpvalue);
+ void LogvgSetPaint(VGPaint paint, VGbitfield paintModes, TInt cmdsize, TInt Lpvalue);
+ void LogvgDrawPath(VGbitfield paintModes, int cmdsize);
+ void LogvgSetParameterfv(VGPaint handle, VGint paramtype, TInt count, TInt handlenum);
+#endif
+
+private:
+
+ typedef void (CTLVIconCreator::*pvgapi)( );
+
+ VGPath CreatePathL();
+
+ pvgapi vgapi[EvgFlush + 1];
+
+ CNVGIconData * iNVGIconData;
+ TInt iDataLength;
+ TSize iResizedCanvasSize;
+
+
+ TUint8 iNvgHeader[KNVGHeaderSize];
+ TInt iTargetWidth;
+ TInt iTargetHeight;
+ TBool iScaled;
+
+ TReal32 iUserMatrix[9];
+ TUint iPrepareToBindImage;
+
+ TPtrC8 iNVGDataPtr;
+
+ CNVGTLVIcon * iNVGTLVIcon;
+
+ TInt8 iCurrentCommand;
+ TUint8 * iCommandBuffer;
+ VGPath iLastVGPath;
+
+ friend class CNVGTLVIcon;
+ };
+
+#endif
+//--------------------------------EndOfFile------------------------------------
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/inc/TLVIconRenderer.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder header file
+ *
+*/
+
+
+#ifndef _TLVICONRENDERER_H_
+#define _TLVICONRENDERER_H_
+
+#include "TLVRenderer.h"
+
+class CTLVIconRenderer : public CTLVRenderer
+ {
+public:
+ static CTLVIconRenderer * NewL(const TDesC8& aBuf, TInt aWidth, TInt aHeight);
+
+ static CTLVIconRenderer * NewLC(const TDesC8& aBuf, TInt aWidth, TInt aHeight);
+
+ virtual ~CTLVIconRenderer();
+
+protected:
+ TInt DrawPathL();
+ virtual TInt ExecuteL(TInt index);
+
+private:
+ CTLVIconRenderer(TInt aWidth, TInt aHeight);
+ };
+
+#endif
+//--------------------------------EndOfFile------------------------------------
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/inc/TLVRenderer.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,172 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder header file
+ *
+*/
+
+
+#ifndef _TLVRENDERER_H_
+#define _TLVRENDERER_H_
+
+#include <e32base.h>
+#include <openvg.h>
+#include <vgu.h>
+#include "FloatFixPt.h"
+#include "PseudoVG.h"
+#include "NVGUtil.h"
+
+class CNVGTLVIcon;
+class CNVGIconData;
+
+class MVGImageBinder;
+
+class CTLVRenderer : public CBase
+ {
+
+public:
+ static CTLVRenderer * NewL(const TDesC8& aPtr, TInt aWidth, TInt aHeight);
+
+ static CTLVRenderer * NewLC(const TDesC8& aPtr, TInt aWidth, TInt aHeight);
+
+ virtual ~CTLVRenderer();
+
+ virtual TInt ExecuteL();
+
+ void SetVGImageBinder(MVGImageBinder *aImageBinder)
+ {
+ iVGImageBinder = aImageBinder;
+ }
+
+protected:
+ void ConstructL(const TDesC8& aPtr);
+ CTLVRenderer(TInt aWidth, TInt aHeight);
+
+ void DvgSetiL( );
+ void DvgSetfL( );
+ void DvgSetParameteriL( );
+ void DvgSetParameterfL( );
+ void DvgSetParameterfvL( );
+ void DvgSetColorL( );
+ void DvgSetPaintL( );
+ void DvgLoadMatrixL( );
+ void DvgMultMatrixL( );
+ void DvgLoadIdentityL( );
+ void DvgScaleL( );
+ void DvgTranslateL( );
+ void DvgAppendPathDataL( );
+ void DvgDrawPathL( );
+ void DvgClearPathL();
+ void DvguRectL( );
+ void DvguEllipseL( );
+ void DvguRoundRectL( );
+ void DvguLineL( );
+ void DvgCreatePaintL( );
+ void DvgSetivL( );
+ void DvgClearL();
+ void DvgSetfvL();
+ void DvgRotateL();
+ void DvgCreatePathL();
+ void DvgCreateImageL();
+ void DvgGetPixelsL();
+ void DvgClearImageL();
+ void DvgImageSubDataL();
+ void DvgDrawImageL();
+ void DvgDestroyImageL();
+ void DvgDestroyPaintL();
+ void DvgDestroyPathL();
+
+ void DvgPrepareToBindImageL();
+ void DvgBindImageL();
+ void DvgUnBindImageL();
+
+ void DvgFlushL();
+
+ virtual TInt ExecuteL(TInt index);
+
+#ifdef NVG_DEBUG
+ //Command specific logging methods
+ void LogvgSeti(VGParamType type, VGint fvalue);
+ void LogvgSetf (VGParamType type, VGfloat fvalue);
+ void LogvgSetXv(VGParamType type, VGint count, TInt8 vtype, VGint * LogvgSetXv);
+ void LogvgSetParameteri(VGHandle handle, VGint paramType, VGint pvalue, TInt Lpvalue);
+ void LogvgSetPaint(VGPaint paint, VGbitfield paintModes, TInt Lpvalue);
+ void LogvgDrawPath(VGuint path, VGbitfield paintModes);
+ void LogvgSetParameterfv(VGPaint handle, VGint paramtype, TInt count, VGfloat * data);
+ void LogvgImageSubData(VGImage imageHandle, const void * dataPtr, TInt dataLength, VGint dataStride,
+ VGImageFormat dataFormat, VGint x, VGint y, VGint width, VGint height);
+#endif
+
+protected:
+
+ typedef void (CTLVRenderer::*pvgapi)( );
+ pvgapi vgapi[EvgFlush + 1];
+
+ CNVGIconData * iNVGIconData;
+ TInt iDataLength;
+ TSize iResizedCanvasSize;
+
+ struct TLVVGHandlePair
+ {
+ enum THandleType
+ {
+ EVGPATH,
+ EVGPAINT,
+ EVGIMAGE
+ };
+ VGHandle iVGHandle;
+ TInt iTLVHandle;
+ THandleType iHandleType;
+ TInt iCustomData;
+
+ explicit TLVVGHandlePair(VGHandle aVGHandle = 0, TInt aTLVHandle = 0,
+ THandleType aHandleType = EVGPAINT, TInt aCustomData = 0)
+ : iVGHandle(aVGHandle),
+ iTLVHandle(aTLVHandle),
+ iHandleType(aHandleType),
+ iCustomData(aCustomData)
+ {
+ }
+ };
+
+ VGHandle GetHandleL(int aIndex);
+ VGHandle GetHandle(int aIndex);
+ VGHandle RemoveHandleL(int aIndex);
+
+ void GetHandlePair(int aIndex, TLVVGHandlePair & aPair);
+
+ void SetHandle(int aIndex, VGHandle aHandle);
+
+ TPoint GetTranslatedPoint(VGfloat matrix[9], TPoint aPoint);
+ VGfloat MinVal4(VGfloat x1, VGfloat x2, VGfloat x3, VGfloat x4);
+ VGfloat MaxVal4(VGfloat x1, VGfloat x2, VGfloat x3, VGfloat x4);
+
+ VGPath iPathHandle;
+
+ TUint8 iNvgHeader[KNVGHeaderSize];
+ TInt iTargetWidth;
+ TInt iTargetHeight;
+ TBool iScaled;
+
+ TReal32 iUserMatrix[9];
+ MVGImageBinder * iVGImageBinder;
+ TUint iPrepareToBindImage;
+ RArray<TLVVGHandlePair> iTLVVGHandleList;
+
+ CNVGTLVIcon * iNVGTLVIcon;
+ friend class CNVGTLVIcon;
+
+ DECLARE_HANDLECHECKER()
+ };
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/inc/nvgfittoviewbox.h Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,169 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder header file
+ *
+*/
+
+#ifndef NVGFITTOVIEWBOX_H
+#define NVGFITTOVIEWBOX_H
+
+
+#include <e32std.h>
+#include <e32base.h>
+#include <VG/openvg.h>
+#include <nvg.h>
+
+
+class CNvgFitToViewBoxImpl: public CBase
+ {
+private:
+ CNvgFitToViewBoxImpl();
+
+ /**
+ * @Purpose: 2 Phase Constructor
+ * @Version
+ * @parameter: None
+ * @return: None
+ */
+ void ConstructL();
+
+ /**
+ * @Purpose: Destructor
+ * @Version
+ * @parameter: None
+ * @return: None
+ */
+ public:
+
+ /**
+ * @Purpose: 2 Phase Constructor
+ * @Version
+ * @parameter: None
+ * @return: None
+ */
+ static CNvgFitToViewBoxImpl* NewL();
+
+ /**
+ * @Purpose: 2 Phase Constructor
+ * @Version
+ * @parameter: None
+ * @return: None
+ */
+ static CNvgFitToViewBoxImpl* NewLC();
+
+ /**
+ * @Purpose: Constructor
+ * @Version
+ * @parameter: None
+ * @return: None
+ */
+
+ virtual ~CNvgFitToViewBoxImpl();
+
+ /**
+ * @Purpose: Setter function for viewbox
+ * @Version:
+ * @parameter: TRect which will be the viewbox for the content
+ * @return: None
+ */
+ inline void SetViewBox(TReal avbX, TReal avbY,TReal avbW,TReal avbH);
+
+ /**
+ * @Purpose: Setter function for Aligning
+ * @Version
+ * @parameter: Indicates to fit the viewport in the viewbox
+ * @return: None
+ */
+ inline void SetAlign(TNvgAlignStatusType aAlignStatus);
+
+ /**
+ * @Purpose: Setter function for MeetorSlice
+ * @Version
+ * @parameter: Indicates whether to streach or slice the content
+ * @return: None
+ */
+ inline void SetScaling(TNvgMeetOrSliceType aMeetSlice);
+
+ /**
+ * @Purpose: Setter function for Transformation matrix
+ * @Version
+ * @parameter: The first two rows of the transformation matrix
+ * @return: None
+ */
+ inline void SetTransform(TReal aM00,TReal aM01,TReal aM02,TReal aM10,TReal aM11,TReal aM12);
+
+
+ /**
+ * @Purpose: Update the transformation matrix for Translating the
+ Contnet
+ * @Version
+ * @parameter: Translation components by aX, aY
+ coordinates
+ * @return: None
+ */
+ inline void Translate(TReal aX, TReal aY);
+
+ /**
+ * @Purpose: Update the transformation matrix for
+ Scaling the Contnet
+ * @Version
+ * @parameter: Scaling factors Sx, Sy
+ * @return: None
+ */
+ inline void Scale(TReal aX, TReal aY);
+
+ /**
+ * @Purpose: Calculating the transfomation matrix to
+ carry out the viewport to viewbox
+ transformation
+ * @Version
+ * @parameter: The viewport which is to be transformed
+ If viewbox is not defined, set the size of the viewbox
+ * @return: None
+ */
+ void SetWindowViewportTrans( TRect aViewPort, TSize aSize );
+
+
+ void Concatenate(TReal aMatrix[]);
+
+ void Concatenate(TReal aM00, TReal aM01, TReal aM02, TReal aM10, TReal aM11, TReal aM12);
+
+public:
+ // viewbox to viewport transformation matrix
+ TReal iM00;
+ TReal iM01;
+ TReal iM02;
+ TReal iM10;
+ TReal iM11;
+ TReal iM12;
+
+ //The viewBox onto which the content will be drawn
+ TReal ivbX;
+ TReal ivbY;
+ TReal ivbW;
+ TReal ivbH;
+
+ //Indicate that the content has a viewbox defined
+ TBool iViewBoxDefined;
+
+ //Define how to fit the content into the viewport
+ TNvgAlignStatusType iAlign;
+
+ //Weather to streach or clip the content to fit it into the viewbox |
+ TNvgMeetOrSliceType iMeetSlice;
+ };
+
+#include "nvgfittoviewbox.inl"
+#endif
+//----------------------------EndOfFile-----------------------
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/inc/nvgfittoviewbox.inl Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+// ---------------------------------------------------------------------------
+// Setter function for viewBox
+// ---------------------------------------------------------------------------
+inline void CNvgFitToViewBoxImpl::SetViewBox(TReal avbX, TReal avbY, TReal avbW, TReal avbH)
+ {
+ ivbX = avbX;
+ ivbY = avbY;
+ ivbW = avbW;
+ ivbH = avbH;
+ iViewBoxDefined = ETrue;
+ }
+
+
+
+// ---------------------------------------------------------------------------
+// Setter function for Alignment
+// ---------------------------------------------------------------------------
+inline void CNvgFitToViewBoxImpl::SetAlign(TNvgAlignStatusType aAlignStatus)
+ {
+ iAlign = aAlignStatus;
+ }
+
+
+
+// ---------------------------------------------------------------------------
+// Setter function for Scaling of viewport to viewbox
+// ---------------------------------------------------------------------------
+inline void CNvgFitToViewBoxImpl::SetScaling(TNvgMeetOrSliceType aMeetSlice)
+ {
+ iMeetSlice = aMeetSlice;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Setter function for setting current transformation matrix
+// ---------------------------------------------------------------------------
+inline void CNvgFitToViewBoxImpl::SetTransform(TReal aM00, TReal aM01, TReal aM02, TReal aM10, TReal aM11, TReal aM12)
+ {
+ iM00 = aM00;
+ iM01 = aM01;
+ iM02 = aM02;
+ iM10 = aM10;
+ iM11 = aM11;
+ iM12 = aM12;
+ }
+
+
+
+// ---------------------------------------------------------------------------
+// Setter function for translation factors
+// ---------------------------------------------------------------------------
+inline void CNvgFitToViewBoxImpl::Translate(TReal aTx, TReal aTy)
+ {
+ TReal lTranslateMatrix[6] = { 1, 0, aTx, 0, 1, aTy};
+ Concatenate(lTranslateMatrix);
+ }
+
+
+
+// ---------------------------------------------------------------------------
+// Setter function for Scaling factors
+// ---------------------------------------------------------------------------
+inline void CNvgFitToViewBoxImpl::Scale(TReal aSx, TReal aSy)
+ {
+ TReal lScaleMatrix[6] = { aSx, 0, 0, 0, aSy, 0};
+ Concatenate(lScaleMatrix);
+ }
+
+
+inline void CNvgFitToViewBoxImpl::Concatenate(TReal aMatrix[6])
+ {
+ Concatenate(aMatrix[0], aMatrix[1], aMatrix[2], aMatrix[3], aMatrix[4], aMatrix[5]);
+ }
+//===========================End Of File=================================================
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/rom/NVGDecoder_SW.iby Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef __NVGDECODERSW_IBY__
+
+#define __NVGDECODERSW_IBY__
+
+
+// NVG Decoder
+file=ABI_DIR\BUILD_DIR\NVGDecoder_SW.dll SHARED_LIB_DIR\NVGDecoder_SW.dll
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/rom/nvgdecoder.iby Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef __NVGDECODER_IBY__
+
+#define __NVGDECODER_IBY__
+
+
+// NVG Decoder
+file=ABI_DIR\BUILD_DIR\nvgdecoder.dll SHARED_LIB_DIR\nvgdecoder.dll
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/src/FloatFixPt.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder source file
+ *
+*/
+#include "FloatFixPt.h"
+
+//==============================floatfixpt functions============================
+// ==========================================================================
+// Constructor, default to zero
+// ==========================================================================
+TFloatFixPt::TFloatFixPt() : iValue(0)
+ {
+ }
+
+// ==========================================================================
+// Constructor
+// ==========================================================================
+
+TFloatFixPt::TFloatFixPt(TInt aVal)
+ {
+ iValue = (aVal << KFixPtFrac);
+ }
+// ==========================================================================
+// Constructor
+// ==========================================================================
+ TFloatFixPt::TFloatFixPt(TInt32 aVal)
+ {
+ iValue = (aVal << KFixPtFrac);
+ }
+ TFloatFixPt::TFloatFixPt(TInt aVal, TBool /*a*/)
+ {
+ iValue = aVal;
+ }
+// ==========================================================================
+// Constructor
+// ==========================================================================
+ TFloatFixPt::TFloatFixPt(TReal32 aVal)
+{
+ iValue = svgScalarFromFloat(aVal);
+}
+
+// ==========================================================================
+// Assignment operator
+// ==========================================================================
+ TFloatFixPt& TFloatFixPt::operator=(TReal32 aVal)
+{
+ iValue = svgScalarFromFloat(aVal);
+ return *this;
+}
+
+ void TFloatFixPt::copyfloatfix(TInt aVal)
+{
+ iValue = aVal;
+}
+// ==========================================================================
+// Round to the nearest whole number
+// ==========================================================================
+ TInt32 TFloatFixPt::Round()
+ {
+ if (0 != (iValue & 0x8000))
+ return (iValue >> KFixPtFrac) + 1;
+ else
+ return (iValue >> KFixPtFrac);
+ }
+// ===================================================================
+// Addition operation
+// ==========================================================================
+ TFloatFixPt TFloatFixPt::operator+(const TFloatFixPt& aVal) const
+ {
+ return TFloatFixPt(iValue + aVal.iValue, ETrue);
+ }
+//==============================floatfixpt functions============================
+
+ TFloatFixPt::operator TReal32() const
+{
+ return ((TReal32) iValue) / KFixPtFracVal;
+
+}
+// ==========================================================================
+// Get 32-bit representation
+// ==========================================================================
+ TInt32 TFloatFixPt::RawData()
+ {
+ return iValue;
+ }
+ //--------------------------------EndOfFile------------------------------------
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/src/NVGCSIcon.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,588 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder source file
+*
+*/
+
+#include "NVGCSIcon.h"
+#include "NVGIconData.h"
+#include "nvgfittoviewbox.h"
+#include "nvg.h"
+#include "NVGUtil.h"
+#include "OpenVGHandleStore.h"
+
+#include <string.h>
+#include <e32math.h>
+
+
+CNVGCSIcon::CNVGCSIcon()
+ : iNVGIconData(0),
+ iPath(VG_INVALID_HANDLE),
+ iFillPaint(VG_INVALID_HANDLE),
+ iStrokePaint(VG_INVALID_HANDLE),
+ iLastFillPaintType(0),
+ iLastStrokePaintType(0),
+ iLastFillPaintColor(0),
+ iLastStrkePaintColor(0),
+ iResetFillPaint(0),
+ iResetStrokePaint(0)
+ {
+ }
+
+CNVGCSIcon::~CNVGCSIcon()
+ {
+ vgSetPaint(VG_INVALID_HANDLE, VG_FILL_PATH);
+ vgSetPaint(VG_INVALID_HANDLE, VG_STROKE_PATH);
+
+ delete iNVGIconData;
+ delete iOpenVGHandles;
+ }
+
+CNVGCSIcon * CNVGCSIcon::NewL(const TDesC8& aBuf)
+ {
+ CNVGCSIcon* self = CNVGCSIcon::NewLC(aBuf);
+
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+CNVGCSIcon * CNVGCSIcon::NewLC(const TDesC8& aBuf)
+ {
+ CNVGCSIcon* self = new (ELeave) CNVGCSIcon;
+ CleanupStack::PushL(self);
+
+ self->ConstructL(aBuf);
+
+ return self;
+ }
+
+void CNVGCSIcon::ConstructL(const TDesC8& aBuf)
+ {
+ iNVGIconData = CNVGIconData::NewL(aBuf.Length());
+ iOpenVGHandles = COpenVGHandleStore::NewL();
+
+ if (iPath == VG_INVALID_HANDLE)
+ {
+ iPath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
+ VG_PATH_DATATYPE_S_32, 1.0f/65536.0f, 0.0f, 0, 0,
+ VG_PATH_CAPABILITY_APPEND_TO);
+ iOpenVGHandles->AddPathDHL(iPath);
+ }
+
+ if (iFillPaint == VG_INVALID_HANDLE)
+ {
+ iFillPaint = vgCreatePaint();
+ iOpenVGHandles->AddPaintDHL(iFillPaint);
+ }
+ vgSetPaint(iFillPaint, VG_FILL_PATH);
+
+ if (iStrokePaint == VG_INVALID_HANDLE)
+ {
+ iStrokePaint = vgCreatePaint();
+ iOpenVGHandles->AddPaintDHL(iStrokePaint);
+ }
+ vgSetPaint(iStrokePaint, VG_STROKE_PATH);
+ }
+
+TInt CNVGCSIcon::SetViewBox(TReal32 x, TReal32 y, TReal32 w, TReal32 h) __SOFTFP
+ {
+ iViewBoxX = x;
+ iViewBoxY = y;
+ iViewBoxW = w;
+ iViewBoxH = h;
+
+ return KErrNone;
+ }
+
+TInt CNVGCSIcon::SetPreserveAspectRatio(TInt aPreserveAspectSetting,
+ TInt aSmilFitSetting)
+ {
+ iPreserveAspectSetting = aPreserveAspectSetting;
+ iSmilFitSetting = aSmilFitSetting;
+
+ return KErrNone;
+ }
+
+TInt CNVGCSIcon::Rotate(TReal32 aAngle, TReal32 aX, TReal32 aY) __SOFTFP
+ {
+ iRotationAngle = aAngle;
+ iRotationX = aX;
+ iRotationY = aY;
+
+ return KErrNone;
+ }
+
+void CNVGCSIcon::AddPathDataL(VGint numSegments, const VGubyte * pathSegments, const void * pathData)
+ {
+ iNVGIconData->EncodeInt32L(EPathData);
+ iNVGIconData->EncodeInt32L(numSegments);
+ iNVGIconData->EncodeDataL(pathSegments, numSegments);
+
+ TInt coordinateCount = 0;
+ for (TInt i = 0; i < numSegments; ++i)
+ {
+ switch (pathSegments[i])
+ {
+ case VG_HLINE_TO:
+ case VG_VLINE_TO:
+ coordinateCount += 1;
+ break;
+ case VG_MOVE_TO:
+ case VG_LINE_TO:
+ case VG_SQUAD_TO:
+ coordinateCount += 2;
+ break;
+ case VG_QUAD_TO:
+ case VG_SCUBIC_TO:
+ coordinateCount += 4;
+ break;
+ case VG_SCCWARC_TO:
+ case VG_SCWARC_TO:
+ case VG_LCCWARC_TO:
+ case VG_LCWARC_TO:
+ coordinateCount += 5;
+ break;
+ case VG_CUBIC_TO:
+ coordinateCount += 6;
+ break;
+ default:
+ break;
+ }
+ }
+ iNVGIconData->EncodeInt16L(coordinateCount);
+ iNVGIconData->EncodeDataL(pathData, coordinateCount * 4);
+ }
+
+void CNVGCSIcon::AddDrawPathCommandL(VGPath aPath, VGbitfield aPaintMode)
+ {
+ iOpenVGHandles->AddPathDHL(aPath);
+ iNVGIconData->EncodeInt32L(EPath);
+ iNVGIconData->EncodeInt32L(aPath);
+ iNVGIconData->EncodeInt32L(aPaintMode);
+ }
+
+void CNVGCSIcon::AddLinearGradientCommandL(VGint aCount, VGfloat* aGradientData, VGfloat* aGradientMatrix, VGPaint aPaint)
+ {
+ iOpenVGHandles->AddPaintDHL(aPaint);
+ iNVGIconData->EncodeInt32L(EPaint);
+ AddLinearGradientCommandDataL(aPaint, aCount, aGradientData, aGradientMatrix);
+ }
+
+void CNVGCSIcon::AddRadialGradientCommandL(VGint aCount, VGfloat* aGradientData, VGfloat* aGradientMatrix, VGPaint aPaint)
+ {
+ iOpenVGHandles->AddPaintDHL(aPaint);
+ iNVGIconData->EncodeInt32L(EPaint);
+ AddRadialGradientCommandDataL(aPaint, aCount, aGradientData, aGradientMatrix);
+ }
+
+void CNVGCSIcon::AddSetColorCommandL(VGuint aRgba)
+ {
+ iNVGIconData->EncodeInt32L(EPaint);
+ iNVGIconData->EncodeInt32L(VG_PAINT_TYPE_COLOR);
+ iNVGIconData->EncodeInt32L(aRgba);
+ }
+
+void CNVGCSIcon::AddColorRampCommandL(VGPaint aPaint)
+ {
+ iNVGIconData->EncodeInt32L(EColorRamp);
+ iNVGIconData->EncodeInt32L(aPaint);
+ }
+
+void CNVGCSIcon::AddSetTransformCommandL(const VGfloat* aTransformMatrix, TInt aFlag)
+ {
+ iNVGIconData->EncodeInt32L(ETransform);
+ iNVGIconData->EncodeDataL(aTransformMatrix, 9 * sizeof(VGfloat));
+ iNVGIconData->EncodeInt32L(aFlag);
+ }
+
+void CNVGCSIcon::AddSetStrokeWidthCommandL(VGfloat aStrokeWidth)
+ {
+ iNVGIconData->EncodeInt32L(EStrokeWidth);
+ iNVGIconData->EncodeReal32L(aStrokeWidth);
+ }
+
+void CNVGCSIcon::AddSetStrokeMiterLimitCommandL(VGfloat aMiterLimit)
+ {
+ iNVGIconData->EncodeInt32L(EStrokeMiterLimit);
+ iNVGIconData->EncodeReal32L(aMiterLimit);
+ }
+
+void CNVGCSIcon::AddStrokeLineJoinCapCommandL(VGint aCapStyle, VGint aJoinStyle)
+ {
+ iNVGIconData->EncodeInt32L(EStrokeLineJoinCap);
+ iNVGIconData->EncodeInt32L(aCapStyle);
+ iNVGIconData->EncodeInt32L(aJoinStyle);
+ }
+
+void CNVGCSIcon::AddStrokeLinearGradientCommandL(VGint aCount, VGfloat* aGradientData, VGfloat* aGradientMatrix, VGPaint aPaint)
+ {
+ iOpenVGHandles->AddPaintDHL(aPaint);
+ iNVGIconData->EncodeInt32L(EStrokePaint);
+ AddLinearGradientCommandDataL(aPaint, aCount, aGradientData, aGradientMatrix);
+ }
+
+void CNVGCSIcon::AddStrokeRadialGradientCommandL(VGint aCount, VGfloat* aGradientData, VGfloat* aGradientMatrix, VGPaint aPaint)
+ {
+ iOpenVGHandles->AddPaintDHL(aPaint);
+ iNVGIconData->EncodeInt32L(EStrokePaint);
+ AddRadialGradientCommandDataL(aPaint, aCount, aGradientData, aGradientMatrix);
+ }
+
+void CNVGCSIcon::AddStrokeSetColorCommandL(VGuint aRgba)
+ {
+ iNVGIconData->EncodeInt32L(EStrokePaint);
+ AddSetColorCommandDataL(aRgba);
+ }
+
+void CNVGCSIcon::AddStrokeColorRampCommandL(VGPaint aPaint)
+ {
+ iNVGIconData->EncodeInt32L(EStrokeColorRamp);
+ iNVGIconData->EncodeInt32L(aPaint);
+ }
+
+void CNVGCSIcon::AddLinearGradientCommandDataL(VGPaint aPaint, VGint aCount, VGfloat* aGradientData, VGfloat* aGradientMatrix)
+ {
+ iNVGIconData->EncodeInt32L(VG_PAINT_TYPE_LINEAR_GRADIENT);
+ iNVGIconData->EncodeInt32L(aPaint);
+ iNVGIconData->EncodeInt32L(aCount);
+ iNVGIconData->EncodeDataL(aGradientData, aCount * sizeof(VGfloat));
+ iNVGIconData->EncodeDataL(aGradientMatrix, 9 * sizeof(VGfloat));
+ }
+
+void CNVGCSIcon::AddRadialGradientCommandDataL(VGPaint aPaint, VGint aCount, VGfloat* aGradientData, VGfloat* aGradientMatrix)
+ {
+ iNVGIconData->EncodeInt32L(VG_PAINT_TYPE_RADIAL_GRADIENT);
+ iNVGIconData->EncodeInt32L(aPaint);
+ iNVGIconData->EncodeInt32L(aCount);
+ iNVGIconData->EncodeDataL(aGradientData, aCount * sizeof(VGfloat));
+ iNVGIconData->EncodeDataL(aGradientMatrix, 9 * sizeof(VGfloat));
+ }
+
+void CNVGCSIcon::AddSetColorCommandDataL(VGuint aRgba)
+ {
+ iNVGIconData->EncodeInt32L(VG_PAINT_TYPE_COLOR);
+ iNVGIconData->EncodeInt32L(aRgba);
+ }
+
+TInt CNVGCSIcon::Draw(const TSize aSize, CNvgEngine * aNVGEngine)
+ {
+ NVG_DEBUGP2("DRAWING NVGCSIcon %s, ", __FUNCTION__);
+
+ TInt error = KErrNone;
+
+ iNVGEngine = aNVGEngine;
+
+ // Get Matrix modes and all caller matrices (must be restored afterwards)
+ UpdateClientMatrices();
+
+ TRAP(error, DoDrawL(aSize));
+
+ // restore everything as we may have changed matrix mode
+ RestoreClientMatrices();
+
+ return error;
+ }
+
+TInt CNVGCSIcon::DoDrawL(const TSize aSize)
+ {
+ TInt ret = KErrNone;
+
+ vgSetPaint(iFillPaint, VG_FILL_PATH);
+ vgSetPaint(iStrokePaint, VG_STROKE_PATH);
+ iLastFillPaintColor = 0;
+ iLastStrkePaintColor = 0;
+ iLastFillPaintType = 0;
+ iLastStrokePaintType = 0;
+
+ VGfloat lCurrentPathMatrix[9];
+ vgGetMatrix(lCurrentPathMatrix);
+
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
+ vgLoadMatrix(lCurrentPathMatrix);
+ SetRotation();
+#ifdef __MIRROR_
+ vgScale(1.0f, -1.0f);
+ vgTranslate(0, (VGfloat)(-aSize.iHeight) );
+#endif
+
+ SetViewBoxToViewTransformationL(aSize);
+
+
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
+
+ VGfloat currentMatrix[9];
+
+ vgGetMatrix(currentMatrix);
+
+ iNVGIconData->BeginRead();
+
+ while (!iNVGIconData->EOF())
+ {
+ switch (iNVGIconData->ReadInt32L())
+ {
+ case EPath:
+ {
+ VGPath path = (VGPath)iNVGIconData->ReadInt32L();
+ VGPaintMode paintMode = (VGPaintMode)iNVGIconData->ReadInt32L();
+
+ if (path == VG_INVALID_HANDLE)
+ {
+ vgDrawPath(iPath, paintMode);
+ }
+ else
+ {
+ vgDrawPath(path, paintMode);
+ }
+
+ break;
+ }
+ case EPathData:
+ {
+ if (iPath != VG_INVALID_HANDLE)
+ {
+ VGint numSegments;
+ VGubyte * pathSegments = 0;
+ VGubyte * pathData = 0;
+
+ numSegments = iNVGIconData->ReadInt32L();
+ pathSegments = new (ELeave) VGubyte[numSegments];
+ CleanupStack::PushL(TCleanupItem(CleanupArray, pathSegments));
+ if (pathSegments)
+ {
+ iNVGIconData->ReadL(pathSegments, numSegments);
+ VGint coordinateCount = iNVGIconData->ReadInt32L();
+ pathData = new (ELeave) VGubyte[coordinateCount * 4];
+ if (pathData)
+ {
+ CleanupStack::PushL(TCleanupItem(CleanupArray, pathData));
+ iNVGIconData->ReadL(pathData, coordinateCount * 4);
+ vgClearPath(iPath, VG_PATH_CAPABILITY_APPEND_TO);
+ vgAppendPathData(iPath, numSegments, pathSegments, pathData);
+ CleanupStack::PopAndDestroy();
+ }
+ }
+ CleanupStack::PopAndDestroy();
+ }
+ break;
+ }
+ case EPaint:
+ {
+ DrawPaintL(iFillPaint, VG_MATRIX_FILL_PAINT_TO_USER, iLastFillPaintType, iLastFillPaintColor, VG_FILL_PATH);
+ break;
+ }
+ case EColorRamp:
+ {
+ iNVGIconData->ReadInt32L();
+ break;
+ }
+ case ETransform:
+ {
+ TInt flag;
+ VGfloat transformMatrix[9];
+
+ TPtr8 tmPtr((TUint8 *)transformMatrix, 9 * sizeof(VGfloat));
+
+ iNVGIconData->ReadL(tmPtr, 9 * sizeof(VGfloat));
+ flag = iNVGIconData->ReadInt32L();
+
+ vgLoadMatrix(currentMatrix);
+ if (flag)
+ {
+ vgMultMatrix(transformMatrix);
+ }
+ }
+ break;
+ case EStrokeWidth:
+ {
+ VGfloat strokeWidth = iNVGIconData->ReadReal32L();
+ vgSetf(VG_STROKE_LINE_WIDTH, strokeWidth);
+ break;
+ }
+ case EStrokeMiterLimit:
+ {
+ VGfloat miterLimit = iNVGIconData->ReadReal32L();
+ vgSetf(VG_STROKE_MITER_LIMIT, miterLimit);
+ break;
+ }
+ case EStrokeLineJoinCap:
+ {
+ VGint lineJoin = iNVGIconData->ReadInt32L();
+ VGint cap = iNVGIconData->ReadInt32L();
+
+ vgSeti(VG_STROKE_JOIN_STYLE, (VGJoinStyle)lineJoin);
+ vgSeti(VG_STROKE_CAP_STYLE, (VGCapStyle)cap);
+ break;
+ }
+ case EStrokePaint:
+ {
+ DrawPaintL(iStrokePaint, VG_MATRIX_STROKE_PAINT_TO_USER, iLastStrokePaintType, iLastStrkePaintColor, VG_STROKE_PATH);
+ break;
+ }
+ case EStrokeColorRamp:
+ {
+ iNVGIconData->ReadInt32L();
+ break;
+ }
+ default:
+ {
+ User::Leave(KErrCorrupt);
+ break;
+ }
+ }
+ }
+
+ iNVGIconData->EndRead();
+
+ return ret;
+ }
+
+void CNVGCSIcon::DrawColorRampL(VGPaint aPaint)
+ {
+ TInt stopCount = iNVGIconData->ReadInt32L();
+ VGfloat * colorRamps = new (ELeave) VGfloat[stopCount];
+ CleanupStack::PushL(TCleanupItem(CleanupArray, colorRamps));
+
+ iNVGIconData->ReadL((TUint8 *)colorRamps, stopCount * sizeof(VGfloat));
+ vgSetParameteri(aPaint, VG_PAINT_COLOR_RAMP_SPREAD_MODE, VG_COLOR_RAMP_SPREAD_PAD);
+ vgSetParameterfv(aPaint, VG_PAINT_COLOR_RAMP_STOPS, stopCount, colorRamps);
+
+ CleanupStack::PopAndDestroy();
+ }
+
+void CNVGCSIcon::DrawPaintL(VGPaint aPaint, VGMatrixMode aMatrixMode, TUint & aLastPaintType, TUint & aLastPaintColor, VGPaintMode aPaintMode)
+ {
+ VGPaintType paintType = (VGPaintType)iNVGIconData->ReadInt32L();
+
+ if (paintType == VG_PAINT_TYPE_LINEAR_GRADIENT ||
+ paintType == VG_PAINT_TYPE_RADIAL_GRADIENT)
+ {
+ VGPaintParamType paintPType = VG_PAINT_LINEAR_GRADIENT;
+ if (paintType == VG_PAINT_TYPE_RADIAL_GRADIENT)
+ {
+ paintPType = VG_PAINT_RADIAL_GRADIENT;
+ }
+
+ VGPaint paintHandle = iNVGIconData->ReadInt32L();
+ TInt count = iNVGIconData->ReadInt32L();
+ VGfloat gradientData[5];
+ VGfloat gradientMatrix[9];
+
+ iNVGIconData->ReadL((TUint8 *)gradientData, count * sizeof(VGfloat));
+ iNVGIconData->ReadL((TUint8 *)gradientMatrix, 9 * sizeof(VGfloat));
+
+ if (paintHandle)
+ {
+ vgSetPaint(paintHandle, aPaintMode);
+ vgSeti(VG_MATRIX_MODE, aMatrixMode);
+ vgLoadMatrix(gradientMatrix);
+ if (aPaintMode == VG_FILL_PATH)
+ {
+ iResetFillPaint = 1;
+ }
+ else
+ {
+ iResetStrokePaint = 1;
+ }
+ }
+ else
+ {
+ if (aLastPaintType != paintType)
+ {
+ vgSetParameteri(aPaint, VG_PAINT_TYPE, paintType);
+ }
+ vgSetParameterfv(aPaint, paintPType, count, gradientData);
+
+ vgSeti(VG_MATRIX_MODE, aMatrixMode);
+ vgLoadMatrix(gradientMatrix);
+ }
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
+ }
+ else if (paintType == VG_PAINT_TYPE_COLOR)
+ {
+ if (aPaintMode == VG_FILL_PATH && iResetFillPaint)
+ {
+ iResetFillPaint = 0;
+ vgSetPaint(aPaint, aPaintMode);
+ }
+ else if (aPaintMode == VG_STROKE_PATH && iResetStrokePaint)
+ {
+ iResetStrokePaint = 0;
+ vgSetPaint(aPaint, aPaintMode);
+ }
+ TUint color = static_cast<TUint>(iNVGIconData->ReadInt32L());
+ if (aLastPaintType != paintType)
+ {
+ vgSetParameteri(aPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
+ vgSetColor(aPaint, color);
+ }
+ else
+ {
+ if (aLastPaintColor != color)
+ {
+ vgSetColor(aPaint, color);
+ }
+ }
+ aLastPaintColor = color;
+ }
+ else
+ {
+ User::Leave(KErrCorrupt);
+ }
+ aLastPaintType = paintType;
+ }
+
+void CNVGCSIcon::SetViewBoxToViewTransformationL(const TSize aSize)
+ {
+ CNvgFitToViewBoxImpl * fitToViewBoxImpl = CNvgFitToViewBoxImpl::NewLC();
+
+ fitToViewBoxImpl->SetAlign((TNvgAlignStatusType)iPreserveAspectSetting);
+ fitToViewBoxImpl->SetScaling((TNvgMeetOrSliceType)iSmilFitSetting);
+
+ fitToViewBoxImpl->SetViewBox(iViewBoxX, iViewBoxY, iViewBoxW, iViewBoxH);
+
+ fitToViewBoxImpl->SetWindowViewportTrans(TRect(0, 0, aSize.iWidth, aSize.iHeight), TSize(0, 0));
+
+ CleanupStack::PopAndDestroy(fitToViewBoxImpl);
+ }
+
+void CNVGCSIcon::SetRotation()
+ {
+ if (iRotationAngle)
+ {
+ vgTranslate(iRotationX, iRotationY);
+
+ vgRotate(iRotationAngle);
+
+ vgTranslate(-iRotationX, -iRotationY);
+ }
+ }
+
+void CNVGCSIcon::UpdateClientMatrices()
+ {
+ iMatrixMode = vgGeti(VG_MATRIX_MODE);
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
+ vgGetMatrix(iPathMatrix);
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
+ vgGetMatrix(iImageMatrix);
+ vgSeti(VG_MATRIX_MODE, iMatrixMode);
+ }
+
+void CNVGCSIcon::RestoreClientMatrices()
+ {
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
+ vgLoadMatrix(iPathMatrix);
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
+ vgLoadMatrix(iImageMatrix);
+ vgSeti(VG_MATRIX_MODE, iMatrixMode);
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/src/NVGIcon.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,22 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder source file
+ *
+*/
+
+#include "NVGIcon.h"
+
+MNVGIcon::~MNVGIcon()
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/src/NVGIconData.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,251 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder source file
+ *
+*/
+
+#include "NVGIconData.h"
+
+//const TUint KEncodedDataLength = 1024;
+const TUint KEncodedDataGranularity = 64;
+
+CNVGIconData::CNVGIconData()
+ : iNVGData(0),
+ iNVGDataPtr(0, 0),
+ iTotalRead(0),
+ iReadStream(0)
+ {
+ }
+
+CNVGIconData::~CNVGIconData()
+ {
+ delete iNVGData;
+ }
+
+CNVGIconData * CNVGIconData::NewL(TInt aLength)
+ {
+ CNVGIconData* self = CNVGIconData::NewLC(aLength);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+CNVGIconData * CNVGIconData::NewLC(TInt aLength)
+ {
+ CNVGIconData* self = new (ELeave) CNVGIconData;
+ CleanupStack::PushL(self);
+
+ self->ConstructL(aLength);
+ return self;
+ }
+
+CNVGIconData * CNVGIconData::NewL(const TDesC8& aBuf)
+ {
+ CNVGIconData* self = CNVGIconData::NewLC(aBuf);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+CNVGIconData * CNVGIconData::NewLC(const TDesC8& aBuf)
+ {
+ CNVGIconData* self = new (ELeave) CNVGIconData;
+ CleanupStack::PushL(self);
+
+ self->ConstructL(aBuf);
+
+ return self;
+ }
+
+CNVGIconData * CNVGIconData::NewL(TUint8 * aBuf, TInt aLength)
+ {
+ return CNVGIconData::NewL(TPtr8(aBuf, aLength, aLength));
+ }
+
+CNVGIconData * CNVGIconData::NewLC(TUint8 * aBuf, TInt aLength)
+ {
+ return CNVGIconData::NewLC(TPtr8(aBuf, aLength, aLength));
+ }
+
+void CNVGIconData::ConstructL(const TDesC8& aBuf)
+ {
+ iNVGDataPtr.Set((TUint8 *)aBuf.Ptr(), aBuf.Length(), aBuf.Length());
+
+ //set the reading pointers
+ BeginRead();
+ }
+
+void CNVGIconData::ConstructL(TUint aLength)
+ {
+ iNVGData = HBufC8::NewL(aLength);
+ iNVGDataPtr = iNVGData->Des();
+ }
+
+void CNVGIconData::EncodeDataL(const TAny *aData, TUint aLength)
+ {
+ TInt result = KErrNone;
+
+ TInt encodedDataLength = iNVGDataPtr.Length() + aLength;
+ TInt encodedDataMaxLength = iNVGDataPtr.MaxLength();
+
+ if (encodedDataLength >= encodedDataMaxLength)
+ {
+ result = ExpandEncodedData(encodedDataLength);
+ if (result != KErrNone)
+ {
+ User::Leave(result);
+ }
+
+ iNVGDataPtr.Append((TUint8*)(aData), aLength);
+ }
+ else
+ {
+ iNVGDataPtr.Append((TUint8*)(aData), aLength);
+ }
+ }
+
+TInt CNVGIconData::EncodeData(const TAny *aData, TUint aLength)
+ {
+ TInt result = KErrNone;
+
+ TInt encodedDataLength = iNVGDataPtr.Length() + aLength;
+ TInt encodedDataMaxLength = iNVGDataPtr.MaxLength();
+
+ if (encodedDataLength >= encodedDataMaxLength)
+ {
+ result = ExpandEncodedData(encodedDataLength);
+ if (result == KErrNone)
+ {
+ iNVGDataPtr.Append((TUint8*)(aData), aLength);
+ }
+ }
+ else
+ {
+ iNVGDataPtr.Append((TUint8*)(aData), aLength);
+ }
+
+ return result;
+ }
+
+TInt CNVGIconData::ExpandEncodedData(TUint aNewLength)
+ {
+ TInt result = KErrNone;
+
+ TInt encodedDataMaxLength = iNVGDataPtr.MaxLength();
+ TUint granularities = ((aNewLength - encodedDataMaxLength) / KEncodedDataGranularity) + 1;
+
+ HBufC8 * tmpBuf = HBufC8::New(encodedDataMaxLength + granularities * KEncodedDataGranularity);
+ if (tmpBuf == 0)
+ {
+ result = KErrNoMemory;
+ }
+ else
+ {
+ TPtr8 tmpBufPtr (tmpBuf->Des());
+ tmpBufPtr.Copy(*iNVGData);
+
+ delete iNVGData;
+ iNVGData = tmpBuf;
+ iNVGDataPtr.Set(iNVGData->Des());
+ }
+
+ return result;
+ }
+
+void CNVGIconData::BeginRead()
+ {
+ iDataLength = iNVGDataPtr.Length();
+ iTotalRead = 0;
+ iReadStream = (TUint8 *)iNVGDataPtr.Ptr();
+ }
+
+void CNVGIconData::EndRead()
+ {
+ }
+
+#define STR_TO_OTHER_DIR(TOTYPE) do {\
+ TOTYPE data = *(TOTYPE *)&iReadStream[iTotalRead];\
+ iTotalRead += sizeof(TOTYPE);\
+ return data;\
+ } while (0)
+
+
+#define STR_TO_OTHER_IDIR(TOTYPE) do {\
+ TOTYPE data;\
+ TUint8 * dataPtr = (TUint8 *)&data;\
+ for (TInt i = 0; i < sizeof(TOTYPE); ++i)\
+ {\
+ dataPtr[i] = iReadStream[iTotalRead+i];\
+ }\
+ iTotalRead += sizeof(TOTYPE);\
+ return data;\
+ } while (0)
+
+#define STR_TO_OTHER(TOTYPE) do {\
+ CheckOutOfBoundL(sizeof(TOTYPE));\
+ if (reinterpret_cast<int>(&iReadStream[iTotalRead]) & (sizeof(TOTYPE) - 1))\
+ {\
+ STR_TO_OTHER_IDIR(TOTYPE);\
+ }\
+ else\
+ {\
+ STR_TO_OTHER_DIR(TOTYPE);\
+ }\
+ } while (0)
+
+
+TInt16 CNVGIconData::ReadInt16L()
+ {
+ STR_TO_OTHER(TInt16);
+ }
+
+TInt32 CNVGIconData::ReadInt32L()
+ {
+ STR_TO_OTHER(TInt32);
+ }
+
+TInt8 CNVGIconData::ReadInt8L()
+ {
+ CheckOutOfBoundL(sizeof(TInt8));
+ STR_TO_OTHER_DIR(TInt8);
+ }
+
+TReal32 CNVGIconData::ReadReal32L()
+ {
+ STR_TO_OTHER(TReal32);
+ }
+
+TReal64 CNVGIconData::ReadReal64L()
+ {
+ CheckOutOfBoundL(sizeof(TReal64));
+ STR_TO_OTHER_IDIR(TReal64);
+ }
+
+void CNVGIconData::ReadL(TDes8 &aDes, TInt aLength)
+ {
+ CheckOutOfBoundL(aLength);
+ aDes.Copy(&iReadStream[iTotalRead], aLength);
+ iTotalRead += aLength;
+ }
+
+void CNVGIconData::ReadL(TUint8 *aPtr, TInt aLength)
+ {
+ CheckOutOfBoundL(aLength);
+ memcpy(aPtr, &iReadStream[iTotalRead], aLength);
+ iTotalRead += aLength;
+ }
+
+void CNVGIconData::SkipL(TInt aLength)
+ {
+ CheckOutOfBoundL(aLength);
+ iTotalRead += aLength;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/src/NVGTLVIcon.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,170 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder source file
+*
+*/
+
+
+
+#include "NVGTLVIcon.h"
+#include "NVGIconData.h"
+#include "NVGUtil.h"
+#include "TLVRenderer.h"
+#include "TLVIconCreator.h"
+#include "TLVIconRenderer.h"
+#include "OpenVGHandleStore.h"
+
+CNVGTLVIcon::CNVGTLVIcon()
+ : iNVGIconData(0),
+ iVGImageBinder(0)
+ {
+ }
+
+CNVGTLVIcon::~CNVGTLVIcon()
+ {
+ delete iNVGIconData;
+ delete iOpenVGHandles;
+ }
+
+CNVGTLVIcon * CNVGTLVIcon::NewL()
+ {
+ CNVGTLVIcon* self = CNVGTLVIcon::NewLC();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+CNVGTLVIcon * CNVGTLVIcon::NewLC()
+ {
+ CNVGTLVIcon* self = new (ELeave) CNVGTLVIcon;
+ CleanupStack::PushL(self);
+
+ self->ConstructL();
+ return self;
+ }
+
+void CNVGTLVIcon::ConstructL()
+ {
+ iNVGIconData = CNVGIconData::NewL();
+ iOpenVGHandles = COpenVGHandleStore::NewL();
+ }
+
+TInt CNVGTLVIcon::SetPreserveAspectRatio(TInt aPreserveAspectSetting,
+ TInt aSmilFitSetting)
+ {
+ (void)aPreserveAspectSetting;
+ (void)aSmilFitSetting;
+
+ return KErrNotSupported;
+ }
+
+TInt CNVGTLVIcon::Rotate(TReal32 aAngle, TReal32 aX, TReal32 aY) __SOFTFP
+ {
+ (void)aAngle;
+ (void)aX;
+ (void)aY;
+
+ return KErrNotSupported;
+ }
+
+TInt CNVGTLVIcon::DirectDrawL(const TDesC8& aBuf, const TSize& aTargetSize)
+ {
+ TInt error = KErrNone;
+
+ CTLVRenderer * iconRenderer = CTLVRenderer::NewLC(aBuf, aTargetSize.iWidth, aTargetSize.iHeight);
+
+ iconRenderer->SetVGImageBinder(iVGImageBinder);
+
+ iconRenderer->ExecuteL();
+
+ CleanupStack::PopAndDestroy(iconRenderer);
+
+ return error;
+ }
+
+TInt CNVGTLVIcon::CreateL(const TDesC8& aBuf, const TSize& aTargetSize)
+ {
+ TInt error = KErrNone;
+
+ CTLVIconCreator * iconCreater = CTLVIconCreator::NewLC(aBuf, aTargetSize.iWidth, aTargetSize.iHeight, this);
+
+ iconCreater->ExecuteL();
+
+ CleanupStack::PopAndDestroy(iconCreater);
+ return error;
+ }
+
+TInt CNVGTLVIcon::Draw(const TSize aSize, CNvgEngine * aNVGEngine)
+ {
+ TInt error = KErrNone;
+ iNVGEngine = aNVGEngine;
+ UpdateClientMatrices();
+
+ TRAP(error, DoDrawL(aSize));
+ RestoreClientMatrices();
+ return error;
+ }
+TInt CNVGTLVIcon::DoDrawL(const TSize aSize)
+ {
+ TPtr8 bufPtr = ((HBufC8 *)(iNVGIconData->GetNVGData()))->Des();
+
+ CTLVRenderer * iconRenderer = CTLVIconRenderer::NewLC(bufPtr, aSize.iWidth, aSize.iHeight);
+
+ iconRenderer->SetVGImageBinder(iVGImageBinder);
+
+#ifndef __MIRROR_
+ vgScale(1.0f, -1.0f);
+ vgTranslate(0, (VGfloat)(-aSize.iHeight));
+#endif
+ iconRenderer->ExecuteL();
+
+ CleanupStack::PopAndDestroy(iconRenderer);
+ return KErrNone;
+ }
+
+void CNVGTLVIcon::AddDrawPathCommandL(VGPath aPath, VGPaintMode aPaintMode)
+ {
+ iOpenVGHandles->AddPathDHL(aPath);
+ iNVGIconData->EncodeInt8L(EPath);
+ iNVGIconData->EncodeInt32L(aPath);
+ iNVGIconData->EncodeInt32L(aPaintMode);
+ }
+
+void CNVGTLVIcon::AddCommandL(const TUint8 * aCommandBuffer, TInt aCommandBufferLength)
+ {
+ iNVGIconData->EncodeDataL(aCommandBuffer, aCommandBufferLength);
+ }
+
+void CNVGTLVIcon::AddCommandL(TInt8 aCommandType, const TUint8 * aCommandBuffer, TInt aCommandBufferLength)
+ {
+ iNVGIconData->EncodeInt8L(aCommandType);
+ iNVGIconData->EncodeDataL(aCommandBuffer, aCommandBufferLength);
+ }
+void CNVGTLVIcon::UpdateClientMatrices()
+ {
+ iMatrixMode = vgGeti(VG_MATRIX_MODE);
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
+ vgGetMatrix(iPathMatrix);
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
+ vgGetMatrix(iImageMatrix);
+ vgSeti(VG_MATRIX_MODE, iMatrixMode);
+ }
+
+void CNVGTLVIcon::RestoreClientMatrices()
+ {
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
+ vgLoadMatrix(iPathMatrix);
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
+ vgLoadMatrix(iImageMatrix);
+ vgSeti(VG_MATRIX_MODE, iMatrixMode);
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/src/OpenVGHandleStore.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder source file
+ *
+*/
+
+#include "OpenVGHandleStore.h"
+
+COpenVGHandleStore::COpenVGHandleStore()
+ {
+ }
+
+COpenVGHandleStore::~COpenVGHandleStore()
+ {
+ TInt handleListCount = iHandles.Count();
+ for (TInt i = 0; i < handleListCount; i++)
+ {
+ if (iHandles[i].iVGHandle)
+ {
+ switch (iHandles[i].iHandleType)
+ {
+ case TLVVGHandlePair::EVGPath:
+ vgDestroyPath(iHandles[i].iVGHandle);
+ break;
+ case TLVVGHandlePair::EVGPaint:
+ vgDestroyPaint(iHandles[i].iVGHandle);
+ break;
+ case TLVVGHandlePair::EVGImage:
+ vgDestroyImage(iHandles[i].iVGHandle);
+ break;
+ }
+ }
+ }
+ iHandles.Close();
+ }
+
+COpenVGHandleStore * COpenVGHandleStore::NewL()
+ {
+ COpenVGHandleStore* self = COpenVGHandleStore::NewLC();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+COpenVGHandleStore * COpenVGHandleStore::NewLC()
+ {
+ COpenVGHandleStore* self = new (ELeave) COpenVGHandleStore;
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+void COpenVGHandleStore::ConstructL()
+ {
+
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/src/TLVIconCreator.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,419 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder source file
+*
+*/
+
+#include "TLVIconCreator.h"
+#include "MVGImageBinder.h"
+#include "NVGUtil.h"
+#include "NVGIconData.h"
+#include "NVGTLVIcon.h"
+#include "nvg.h"
+
+/*
+ * Length of each encoded OpenVG API in bytes. -1 if not pre known.
+ * The order here and in the enum TOpenVGAPI should be same.
+ */
+const TInt APICommandLength[] =
+ {
+ 16, //EvgClear
+ 4, //EvgSeti
+ 6, //EvgSetf
+ -1, //EvgSetfv
+ 8, //EvgSetParameteri
+ 10, //EvgSetParameterf
+ -1, //EvgSetParameterfv
+ 8, //EvgSetColor
+ 5, //EvgSetPaint
+ 36, //EvgLoadMatrix
+ 36, //EvgMultMatrix
+ 0, //EvgLoadIdentity
+ 8, //EvgScale
+ 4, //EvgRotate
+ 8, //EvgTranslate
+ -1, //EvgAppendPathData
+ 6, //EvgDrawPath
+ 6, //EvgClearPath
+ 20, //EvguRect
+ 20, //EvguEllipse
+ 28, //EvguRoundRect
+ 20, //EvguLine
+ 4, //EvgCreatePaint
+ 29, //EvgCreatePath
+ 0, //EvgGetPixels
+ 4, //EvgDestroyImage
+ 0, //EvgDestroyPaint
+ 0, //EvgDestroyPath
+ -1, //EvgSetiv
+ 17, //EvgCreateImage
+ 4, //EvgDrawImage
+ 20, //EvgClearImage
+ -1, //EvgImageSubData
+ 0, //EvgPrepareToBindImage
+ 4, //EvgBindImage
+ 0, //EvgUnBindImage
+ 0 //EvgFlush
+ };
+
+CTLVIconCreator::CTLVIconCreator(TInt aWidth, TInt aHeight, CNVGTLVIcon * aNVGTLVIcon)
+ :
+ iNVGDataPtr((TUint8 *)&aWidth, 1)
+ {
+ vgapi[EvgSeti] = &DvgAddCommandL;
+ vgapi[EvgSetf] = &DvgAddCommandL;
+ vgapi[EvgSetParameteri] = &DvgAddCommandL;
+ vgapi[EvgSetParameterf] = &DvgAddCommandL;
+ vgapi[EvgSetParameterfv] = &DvgSetParameterfvL;
+ vgapi[EvgSetColor] = &DvgAddCommandL;
+ vgapi[EvgSetPaint] = &DvgAddCommandL;
+ vgapi[EvgLoadMatrix] = &DvgAddCommandL;
+ vgapi[EvgMultMatrix] = &DvgAddCommandL;
+ vgapi[EvgLoadIdentity] = &DvgAddCommandL;
+ vgapi[EvgScale] = &DvgAddCommandL;
+ vgapi[EvgTranslate] = &DvgAddCommandL;
+ vgapi[EvgAppendPathData] = &DvgAppendPathDataL;
+ vgapi[EvgDrawPath] = &DvgDrawPathL;
+ vgapi[EvgClearPath] = &DvgAddCommandL;
+ vgapi[EvguRect] = &DvguRectL;
+ vgapi[EvguEllipse] = &DvguEllipseL;
+ vgapi[EvguRoundRect] = &DvguRoundRectL;
+ vgapi[EvguLine] = &DvguLineL;
+ vgapi[EvgCreatePaint] = &DvgAddCommandL;
+ vgapi[EvgSetiv] = &DvgSetivL;
+ vgapi[EvgClear] = &DvgAddCommandL;
+ vgapi[EvgSetfv] = &DvgSetfvL;
+ vgapi[EvgRotate] = &DvgAddCommandL;
+ vgapi[EvgCreatePath] = &DvgCreatePathL;
+ vgapi[EvgCreateImage] = &DvgAddCommandL;
+ vgapi[EvgGetPixels] = &DvgGetPixelsL;
+ vgapi[EvgDrawImage] = &DvgAddCommandL;
+ vgapi[EvgClearImage] = &DvgAddCommandL;
+ vgapi[EvgImageSubData] = &DvgImageSubDataL;
+ vgapi[EvgDestroyImage] = &DvgAddCommandL;
+ vgapi[EvgDestroyPaint] = &DvgDestroyPaintL;
+ vgapi[EvgDestroyPath] = &DvgDestroyPathL;
+
+ vgapi[EvgPrepareToBindImage]= &DvgAddCommandL;
+ vgapi[EvgBindImage] = &DvgAddCommandL;
+ vgapi[EvgUnBindImage] = &DvgAddCommandL;
+
+ vgapi[EvgFlush] = &DvgAddCommandL;
+
+ iTargetWidth = aWidth;
+ iTargetHeight = aHeight;
+ iPrepareToBindImage = 0;
+ iNVGTLVIcon = aNVGTLVIcon;
+ iLastVGPath = 0;
+ }
+
+CTLVIconCreator * CTLVIconCreator::NewL(const TDesC8& aBuf, TInt aWidth, TInt aHeight, CNVGTLVIcon * aNVGTLVIcon)
+ {
+ CTLVIconCreator* self = CTLVIconCreator::NewLC(aBuf,aWidth, aHeight, aNVGTLVIcon);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+CTLVIconCreator * CTLVIconCreator::NewLC(const TDesC8& aBuf, TInt aWidth, TInt aHeight, CNVGTLVIcon * aNVGTLVIcon)
+ {
+ CTLVIconCreator* self = new (ELeave) CTLVIconCreator(aWidth, aHeight, aNVGTLVIcon);
+ CleanupStack::PushL(self);
+ self->ConstructL(aBuf);
+ return self;
+ }
+
+void CTLVIconCreator::ConstructL(const TDesC8& aBuf)
+ {
+ vgGetMatrix(iUserMatrix);
+
+ iNVGIconData = CNVGIconData::NewL(aBuf);
+ iDataLength = aBuf.Length();
+
+ iCommandBuffer = (TUint8 *)aBuf.Ptr();
+ iNVGIconData->BeginRead();
+ iNVGIconData->ReadL(iNvgHeader, sizeof(iNvgHeader));
+ iNVGTLVIcon->AddCommandL(iNvgHeader, sizeof(iNvgHeader));
+ }
+
+CTLVIconCreator::~CTLVIconCreator()
+ {
+ delete iNVGIconData;
+ }
+
+void CTLVIconCreator::DvgAddCommandL(TInt aLength, TInt aPos)
+ {
+ iNVGTLVIcon->AddCommandL(iCurrentCommand, iCommandBuffer + aPos, aLength);
+ }
+
+void CTLVIconCreator::DvgAddCommandL()
+ {
+ iNVGTLVIcon->AddCommandL(iCurrentCommand, iCommandBuffer + iNVGIconData->ReadPos(),
+ APICommandLength[iCurrentCommand]);
+ iNVGIconData->SkipL(APICommandLength[iCurrentCommand]);
+ }
+
+void CTLVIconCreator::DvgSetParameterfvL()
+ {
+ TInt length = 0;
+ TInt cpos = iNVGIconData->ReadPos();
+
+ TUint32 pvalue = iNVGIconData->ReadInt32L();
+ iNVGIconData->ReadInt16L();
+ TUint32 countt = iNVGIconData->ReadInt32L();
+ length = length + sizeof(TUint32) + sizeof(TUint16) + sizeof(TUint32) + countt * sizeof(float);
+
+ iNVGIconData->SkipL(countt * sizeof(TReal32));
+
+ DvgAddCommandL(length, cpos);
+ }
+
+void CTLVIconCreator::DvgSetivL()
+ {
+ TInt length = 0;
+ TInt cpos = iNVGIconData->ReadPos();
+ TUint16 type = iNVGIconData->ReadInt16L();
+ TUint16 count = iNVGIconData->ReadInt16L();
+
+ length = sizeof(TInt16) + sizeof(TInt16);
+ length += count * sizeof(TInt32);
+
+ iNVGIconData->SkipL(count * sizeof(TInt32));
+
+ DvgAddCommandL(length, cpos);
+ }
+
+
+VGPath CTLVIconCreator::CreatePathL()
+ {
+ const float KScale = 1.0f / 65536.0f;
+
+ VGPath pathH = vgCreatePath( VG_PATH_FORMAT_STANDARD,
+ VG_PATH_DATATYPE_S_32, KScale, 0.0f, 0, 0,
+ VG_PATH_CAPABILITY_APPEND_TO );
+ if (pathH == VG_INVALID_HANDLE)
+ {
+ User::LeaveIfError(CNvgEngine::OpenVGErrorToSymbianError(vgGetError()));
+ }
+
+ return pathH;
+ }
+
+void CTLVIconCreator::DvgAppendPathDataL()
+ {
+ TUint16 numSegments;
+ TUint16 coordinatecount;
+ VGubyte * pathSegments;
+ TFloatFixPt * pathData;
+ TFloatFixPt * coordhandle;
+
+ iNVGIconData->ReadInt32L();
+ numSegments = iNVGIconData->ReadInt16L();
+
+ pathSegments = new (ELeave) VGubyte[numSegments];
+ CleanupStack::PushL(TCleanupItem(CleanupArray, pathSegments));
+
+ for(int j=0; j < numSegments; j++)
+ {
+ pathSegments[j] = iNVGIconData->ReadInt8L();
+ }
+
+ coordinatecount = iNVGIconData->ReadInt16L();
+ pathData = new (ELeave) TFloatFixPt[coordinatecount];
+ CleanupStack::PushL(TCleanupItem(CleanupArray, pathData));
+
+ TInt lFloatFixVal = 0;
+
+ coordhandle = pathData;
+ for(int i = 0; i < coordinatecount; i++, coordhandle++)
+ {
+ lFloatFixVal = iNVGIconData->ReadInt32L();
+ coordhandle->copyfloatfix(lFloatFixVal);
+ }
+
+ iLastVGPath = CreatePathL();
+ vgAppendPathData(iLastVGPath, numSegments, pathSegments, pathData);
+
+ CleanupStack::PopAndDestroy(2);
+ }
+
+void CTLVIconCreator::DvgDrawPathL()
+ {
+ iNVGIconData->ReadInt32L();
+ TUint16 value = iNVGIconData->ReadInt16L();
+
+ iNVGTLVIcon->AddDrawPathCommandL(iLastVGPath, (VGPaintMode)value);
+ }
+
+void CTLVIconCreator::DvguRectL()
+ {
+ iNVGIconData->ReadInt32L();
+
+ TReal32 x = iNVGIconData->ReadReal32L();
+ TReal32 y = iNVGIconData->ReadReal32L();
+
+ TReal32 width = iNVGIconData->ReadReal32L();
+ TReal32 height = iNVGIconData->ReadReal32L();
+
+ iLastVGPath = CreatePathL();
+ vguRect(iLastVGPath, x, y, width, height);
+ }
+
+void CTLVIconCreator::DvguEllipseL()
+ {
+ TReal32 cx;
+ TReal32 cy;
+ TReal32 width;
+ TReal32 height;
+
+ iNVGIconData->ReadInt32L();
+
+ cx = iNVGIconData->ReadReal32L();
+ cy = iNVGIconData->ReadReal32L();
+
+ width = iNVGIconData->ReadReal32L();
+ height = iNVGIconData->ReadReal32L();
+
+ iLastVGPath = CreatePathL();
+ vguEllipse(iLastVGPath, cx, cy, width, height);
+ }
+
+void CTLVIconCreator::DvguRoundRectL()
+ {
+ TReal32 x;
+ TReal32 y;
+ TReal32 width;
+ TReal32 height;
+ TReal32 arcWidth;
+ TReal32 arcHeight;
+
+ iNVGIconData->ReadInt32L();
+
+ x = iNVGIconData->ReadReal32L();
+ y = iNVGIconData->ReadReal32L();
+
+ width = iNVGIconData->ReadReal32L();
+ height= iNVGIconData->ReadReal32L();
+
+ arcWidth = iNVGIconData->ReadReal32L();
+ arcHeight= iNVGIconData->ReadReal32L();
+
+ iLastVGPath = CreatePathL();
+ vguRoundRect(iLastVGPath, x, y, width, height, arcWidth, arcHeight);
+ }
+
+void CTLVIconCreator::DvguLineL()
+ {
+ TReal32 x0;
+ TReal32 y0;
+ TReal32 x1;
+ TReal32 y1;
+
+ iNVGIconData->ReadInt32L();
+
+ x0 = iNVGIconData->ReadReal32L();
+ y0 = iNVGIconData->ReadReal32L();
+
+ x1 = iNVGIconData->ReadReal32L();
+ y1 = iNVGIconData->ReadReal32L();
+
+ iLastVGPath = CreatePathL();
+ vguLine(iLastVGPath, x0, y0, x1, y1);
+ }
+
+void CTLVIconCreator::DvgSetfvL()
+ {
+ TUint16 count;
+ TInt length = 0;
+ TInt cpos = iNVGIconData->ReadPos();
+
+ iNVGIconData->ReadInt16L();
+ count = iNVGIconData->ReadInt16L();
+
+ iNVGIconData->SkipL(sizeof(TReal32) * count);
+
+ length = length + 2 * sizeof(TUint16) + count * sizeof(VGfloat);
+
+ DvgAddCommandL(length, cpos);
+ }
+
+void CTLVIconCreator::DvgCreatePathL()
+ {
+ iNVGIconData->SkipL(APICommandLength[EvgCreatePath]);
+ }
+
+void CTLVIconCreator::DvgImageSubDataL()
+ {
+ TInt cpos = iNVGIconData->ReadPos();
+
+ TInt encodedImageHandle = iNVGIconData->ReadInt32L();
+ TInt dataLength = 0;
+
+ iNVGIconData->ReadInt32L();
+ iNVGIconData->ReadInt32L();
+ iNVGIconData->ReadInt32L();
+ iNVGIconData->ReadInt32L();
+ iNVGIconData->ReadInt32L();
+ iNVGIconData->ReadInt32L();
+ dataLength = iNVGIconData->ReadInt32L();
+ iNVGIconData->SkipL(dataLength);
+
+ DvgAddCommandL(iNVGIconData->ReadPos() - cpos, cpos);
+ }
+
+void CTLVIconCreator::DvgGetPixelsL()
+ {
+ }
+
+void CTLVIconCreator::DvgDestroyPaintL()
+ {
+ }
+
+void CTLVIconCreator::DvgDestroyPathL()
+ {
+ }
+
+void CTLVIconCreator::DvgFlushL()
+ {
+ }
+
+TInt CTLVIconCreator::ExecuteL(TInt aIndex)
+ {
+ iCurrentCommand = aIndex;
+ if (0 <= aIndex && aIndex < EvgFlush + 1)
+ {
+ (this->*(vgapi[aIndex]))();
+ }
+ else
+ {
+ return KErrCorrupt;
+ }
+
+ return KErrNone;
+ }
+
+TInt CTLVIconCreator::ExecuteL()
+ {
+ TInt error = KErrNone;
+
+ while (!iNVGIconData->EOF())
+ {
+ error = ExecuteL(iNVGIconData->ReadInt8L());
+ if (error != KErrNone)
+ {
+ break;
+ }
+ }
+
+ return error;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/src/TLVIconRenderer.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder source file
+*
+*/
+
+#include <openvg.h>
+
+#include "TLVIconRenderer.h"
+#include "MVGImageBinder.h"
+#include "NVGUtil.h"
+#include "NVGIconData.h"
+#include "NVGTLVIcon.h"
+
+CTLVIconRenderer::CTLVIconRenderer(TInt aWidth, TInt aHeight)
+ : CTLVRenderer(aWidth, aHeight)
+ {
+ }
+
+CTLVIconRenderer * CTLVIconRenderer::NewL(const TDesC8& aBuf, TInt aWidth, TInt aHeight)
+ {
+ CTLVIconRenderer* self = CTLVIconRenderer::NewLC(aBuf,aWidth, aHeight);
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+CTLVIconRenderer * CTLVIconRenderer::NewLC(const TDesC8& aBuf, TInt aWidth, TInt aHeight)
+ {
+ CTLVIconRenderer* self = new (ELeave) CTLVIconRenderer(aWidth, aHeight);
+ CleanupStack::PushL(self);
+ self->ConstructL(aBuf);
+ return self;
+ }
+
+CTLVIconRenderer::~CTLVIconRenderer()
+ {
+ }
+
+TInt CTLVIconRenderer::ExecuteL(TInt aIndex)
+ {
+ TInt ret = KErrNone;
+
+ if (aIndex == CNVGTLVIcon::EPath)
+ {
+ ret = DrawPathL();
+ }
+ else
+ {
+ ret = CTLVRenderer::ExecuteL(aIndex);
+ }
+
+ return ret;
+ }
+
+TInt CTLVIconRenderer::DrawPathL()
+ {
+ VGPath path = (VGPath)iNVGIconData->ReadInt32L();
+ VGPaintMode paintMode = (VGPaintMode)iNVGIconData->ReadInt32L();
+ vgDrawPath(path, paintMode);
+
+ NVG_DEBUGSTMT(LogvgDrawPath(path, paintMode));
+
+ return KErrNone;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/src/TLVRenderer.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,2128 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder source file
+*
+*/
+
+#include "TLVRenderer.h"
+#include "MVGImageBinder.h"
+#include "NVGUtil.h"
+#include "NVGIconData.h"
+#include "NVGTLVIcon.h"
+#include "nvg.h"
+
+#ifdef NVG_DEBUG
+#include <time.h>
+#endif
+
+CTLVRenderer::CTLVRenderer(TInt aWidth, TInt aHeight)
+ : iTargetWidth(aWidth),
+ iTargetHeight(aHeight),
+ iVGImageBinder(0),
+ iPrepareToBindImage(0)
+
+ {
+ }
+
+CTLVRenderer * CTLVRenderer::NewL(const TDesC8& aBuf, TInt aWidth, TInt aHeight)
+ {
+ CTLVRenderer* self = CTLVRenderer::NewLC(aBuf,aWidth, aHeight);
+ CleanupStack::Pop(self);
+ return self;
+ }
+CTLVRenderer * CTLVRenderer::NewLC(const TDesC8& aBuf, TInt aWidth, TInt aHeight)
+ {
+ CTLVRenderer* self = new (ELeave) CTLVRenderer(aWidth, aHeight);
+ CleanupStack::PushL(self);
+ self->ConstructL(aBuf);
+ return self;
+ }
+
+void CTLVRenderer::ConstructL(const TDesC8& aBuf)
+ {
+ vgapi[EvgSeti] = &DvgSetiL;
+ vgapi[EvgSetf] = &DvgSetfL;
+ vgapi[EvgSetParameteri] = &DvgSetParameteriL;
+ vgapi[EvgSetParameterf] = &DvgSetParameterfL;
+ vgapi[EvgSetParameterfv] = &DvgSetParameterfvL;
+ vgapi[EvgSetColor] = &DvgSetColorL;
+ vgapi[EvgSetPaint] = &DvgSetPaintL;
+ vgapi[EvgLoadMatrix] = &DvgLoadMatrixL;
+ vgapi[EvgMultMatrix] = &DvgMultMatrixL;
+ vgapi[EvgLoadIdentity] = &DvgLoadIdentityL;
+ vgapi[EvgScale] = &DvgScaleL;
+ vgapi[EvgTranslate] = &DvgTranslateL;
+ vgapi[EvgAppendPathData] = &DvgAppendPathDataL;
+ vgapi[EvgDrawPath] = &DvgDrawPathL;
+ vgapi[EvgClearPath] = &DvgClearPathL;
+ vgapi[EvguRect] = &DvguRectL;
+ vgapi[EvguEllipse] = &DvguEllipseL;
+ vgapi[EvguRoundRect] = &DvguRoundRectL;
+ vgapi[EvguLine] = &DvguLineL;
+ vgapi[EvgCreatePaint] = &DvgCreatePaintL;
+ vgapi[EvgSetiv] = &DvgSetivL;
+ vgapi[EvgClear] = &DvgClearL;
+ vgapi[EvgSetfv] = &DvgSetfvL;
+ vgapi[EvgRotate] = &DvgRotateL;
+ vgapi[EvgCreatePath] = &DvgCreatePathL;
+ vgapi[EvgCreateImage] = &DvgCreateImageL;
+ vgapi[EvgGetPixels] = &DvgGetPixelsL;
+ vgapi[EvgDrawImage] = &DvgDrawImageL;
+ vgapi[EvgClearImage] = &DvgClearImageL;
+ vgapi[EvgImageSubData] = &DvgImageSubDataL;
+ vgapi[EvgDestroyImage] = &DvgDestroyImageL;
+ vgapi[EvgDestroyPaint] = &DvgDestroyPaintL;
+ vgapi[EvgDestroyPath] = &DvgDestroyPathL;
+ vgapi[EvgPrepareToBindImage]= &DvgPrepareToBindImageL;
+ vgapi[EvgBindImage] = &DvgBindImageL;
+ vgapi[EvgUnBindImage] = &DvgUnBindImageL;
+ vgapi[EvgFlush] = &DvgFlushL;
+
+ vgGetMatrix(iUserMatrix);
+
+ iNVGIconData = CNVGIconData::NewL(aBuf);
+ iDataLength = aBuf.Length();
+
+ iNVGIconData->BeginRead();
+ iNVGIconData->ReadL(iNvgHeader, sizeof(iNvgHeader));
+
+ INIT_HANDLECHECKER()
+ }
+
+CTLVRenderer::~CTLVRenderer()
+ {
+ if (iPathHandle != VG_INVALID_HANDLE)
+ {
+ VGDESTROYPATH(iPathHandle);
+ }
+
+ TInt handleListCount = iTLVVGHandleList.Count();
+
+ if (handleListCount > 0)
+ {
+ vgSetPaint(VG_INVALID_HANDLE, VG_FILL_PATH);
+ vgSetPaint(VG_INVALID_HANDLE, VG_STROKE_PATH);
+ }
+
+ for (TInt i = 0; i < handleListCount; i++)
+ {
+ if (iTLVVGHandleList[i].iVGHandle)
+ {
+ switch (iTLVVGHandleList[i].iHandleType)
+ {
+ case TLVVGHandlePair::EVGPATH:
+ VGDESTROYPATH(iTLVVGHandleList[i].iVGHandle);
+ break;
+ case TLVVGHandlePair::EVGPAINT:
+ VGDESTROYPAINT(iTLVVGHandleList[i].iVGHandle);
+ break;
+ case TLVVGHandlePair::EVGIMAGE:
+ VGDESTROYIMAGE(iTLVVGHandleList[i].iVGHandle);
+ break;
+ }
+ }
+ }
+
+ iTLVVGHandleList.Close();
+ if (iNVGIconData)
+ {
+ iNVGIconData->EndRead();
+ delete iNVGIconData;
+ }
+ ASSERT_HANDLE_COUNT()
+ }
+
+void CTLVRenderer::DvgSetiL()
+ {
+ TUint16 type;
+ TUint16 value;
+ type = iNVGIconData->ReadInt16L();
+ value = iNVGIconData->ReadInt16L();
+
+ //if ((VGParamType)LargVGParam_value != VG_SCISSORING)
+ {
+ vgSeti((VGParamType)type, value);
+ }
+
+ NVG_DEBUGSTMT(LogvgSeti((VGParamType)type, value));
+ }
+
+void CTLVRenderer::DvgSetfL()
+ {
+ TUint16 type = iNVGIconData->ReadInt16L();
+ VGfloat value = iNVGIconData->ReadReal32L();
+
+ vgSetf((VGParamType)type, value);
+
+ NVG_DEBUGSTMT(LogvgSetf((VGParamType)type, value));
+ }
+
+void CTLVRenderer::DvgSetParameteriL()
+ {
+ TUint handle;
+ TUint16 type;
+ TUint16 value;
+
+ handle = iNVGIconData->ReadInt32L();
+ type = iNVGIconData->ReadInt16L();
+ value = iNVGIconData->ReadInt16L();
+
+ vgSetParameteri(GetHandleL(handle), type, value);
+
+ NVG_DEBUGSTMT(LogvgSetParameteri(GetHandleL(handle), type, value, handle));
+ }
+
+void CTLVRenderer::DvgSetParameterfL()
+ {
+ TUint handle = iNVGIconData->ReadInt32L();
+ TUint16 type = iNVGIconData->ReadInt16L();
+ TUint32 value = iNVGIconData->ReadReal32L();
+
+
+ vgSetParameterf(GetHandleL(handle), type, value);
+
+ NVG_DEBUGP4("vgSetParameterf(%d, %d, %d);\n", handle, type, value);
+ }
+
+void CTLVRenderer::DvgSetParameterfvL()
+ {
+ TUint handle = iNVGIconData->ReadInt32L();
+ TUint16 type = iNVGIconData->ReadInt16L();
+ float * value;
+ TUint32 count = iNVGIconData->ReadInt32L();
+
+ value = new (ELeave) float[count];
+ CleanupStack::PushL(TCleanupItem(CleanupArray, value));
+
+ for(int i=0; i<count; i++)
+ {
+ value[i] = iNVGIconData->ReadReal32L();
+ }
+
+ vgSetParameterfv(GetHandleL(handle), type, count, value);
+
+ NVG_DEBUGSTMT(LogvgSetParameterfv(GetHandle(handle), type, count, value));
+ CleanupStack::PopAndDestroy();
+ }
+
+void CTLVRenderer::DvgSetColorL()
+ {
+
+ TUint paintvalue = iNVGIconData->ReadInt32L();
+ TUint32 rgba = iNVGIconData->ReadInt32L();
+
+ vgSetColor(GetHandleL(paintvalue), rgba);
+
+ NVG_DEBUGP6("vgSetColor(%d, ((%d << 24) | (%d << 16) | (%d << 8) | %d));\n", GetHandleL(paintvalue), (rgba & 0xFF000000) >> 24, (rgba & 0x00FF0000) >> 16,
+ (rgba & 0x0000FF00) >> 8, (rgba & 0x000000FF));
+ }
+
+void CTLVRenderer::DvgSetPaintL()
+ {
+ TUint paintvalue = iNVGIconData->ReadInt32L();
+ TUint8 value = iNVGIconData->ReadInt8L();
+
+ vgSetPaint(GetHandleL(paintvalue), value);
+
+ NVG_DEBUGSTMT(LogvgSetPaint(GetHandleL(paintvalue), value, paintvalue));
+ }
+
+TPoint CTLVRenderer::GetTranslatedPoint(VGfloat aTRMatrix[9], TPoint aPoint)
+ {
+ TPoint trPoint;
+
+ trPoint.iX = aTRMatrix[0] * aPoint.iX + aTRMatrix[3] * aPoint.iY + aTRMatrix[6];
+ trPoint.iY = aTRMatrix[1] * aPoint.iX + aTRMatrix[4] * aPoint.iY + aTRMatrix[7];
+
+ return trPoint;
+ }
+
+VGfloat CTLVRenderer::MinVal4(VGfloat x1, VGfloat x2, VGfloat x3, VGfloat x4 )
+ {
+ VGfloat min = x1;
+
+ if (min > x2)
+ {
+ min = x2;
+ }
+ if (min > x3)
+ {
+ min = x3;
+ }
+ if (min > x4)
+ {
+ min = x4;
+ }
+
+ return min;
+ }
+
+VGfloat CTLVRenderer::MaxVal4(VGfloat x1, VGfloat x2, VGfloat x3, VGfloat x4 )
+ {
+ VGfloat max = x1;
+
+ if (max < x2)
+ {
+ max = x2;
+ }
+ if (max < x3)
+ {
+ max = x3;
+ }
+ if (max < x4)
+ {
+ max = x4;
+ }
+
+ return max;
+ }
+
+void CTLVRenderer::DvgSetivL()
+ {
+ TUint16 type = iNVGIconData->ReadInt16L();
+ TUint16 count = iNVGIconData->ReadInt16L();
+ VGint * value;
+
+ value = new (ELeave) VGint[count];
+ CleanupStack::PushL(TCleanupItem(CleanupArray, value));
+
+ for(int i = 0; i < count; i++)
+ {
+ value[i] = iNVGIconData->ReadInt32L();
+ }
+
+ if (type == VG_SCISSOR_RECTS)
+ {
+ VGfloat * matrix = iUserMatrix;
+
+ // calculate the rectangle with respect to the transformation applied
+ for(int i = 0; i < count; i += 4)
+ {
+ TInt sx = i + 0;
+ TInt sy = i + 1;
+ TInt sw = i + 2;
+ TInt sh = i + 3;
+
+ TPoint leftBottom = GetTranslatedPoint(matrix,
+ TPoint(value[sx], value[sy]));
+ TPoint leftTop = GetTranslatedPoint(matrix,
+ TPoint(value[sx], value[sy] + value[sh]));
+ TPoint rightBottom = GetTranslatedPoint(matrix,
+ TPoint(value[sx] + value[sw], value[sy]));
+ TPoint rightTop = GetTranslatedPoint(matrix,
+ TPoint(value[sx] + value[sw], value[sy] + value[sh]));
+
+
+ VGfloat minX = leftBottom.iX;
+ VGfloat minY = leftBottom.iY;
+ VGfloat maxX = leftBottom.iX;
+ VGfloat maxY = leftBottom.iY;
+
+ minX = MinVal4(leftBottom.iX, leftTop.iX, rightBottom.iX, rightTop.iX);
+ minY = MinVal4(leftBottom.iY, leftTop.iY, rightBottom.iY, rightTop.iY);
+
+ maxX = MaxVal4(leftBottom.iX, leftTop.iX, rightBottom.iX, rightTop.iX);
+ maxY = MaxVal4(leftBottom.iY, leftTop.iY, rightBottom.iY, rightTop.iY);
+
+ VGfloat newW = maxX - minX;
+ VGfloat newH = maxY - minY;
+
+ value[sx] = minX;
+ value[sy] = minY;
+ value[sw] = newW;
+ value[sh] = newH;
+
+ /*
+ if (newW > iTargetWidth)
+ {
+ newW = iTargetWidth;
+ }
+ if (newH > iTargetHeight)
+ {
+ newH = iTargetHeight;
+ }
+ */
+ }
+ }
+
+ vgSetiv((VGParamType)type, count, value);
+
+ NVG_DEBUGSTMT(LogvgSetXv((VGParamType)type, count, 'i', value));
+ CleanupStack::PopAndDestroy();
+ }
+
+void CTLVRenderer::DvgLoadMatrixL()
+ {
+ VGfloat matrix[9];
+ for(int i=0;i<9;i++)
+ {
+ matrix[i] = iNVGIconData->ReadReal32L();
+ }
+ // keep the caller's matrix as base
+ TInt matrixMode = vgGeti(VG_MATRIX_MODE);
+
+ if (matrixMode == VG_MATRIX_PATH_USER_TO_SURFACE ||
+ matrixMode == VG_MATRIX_IMAGE_USER_TO_SURFACE /* need to check?*/)
+ {
+ vgLoadMatrix(iUserMatrix);
+ vgMultMatrix(matrix);
+ }
+ else
+ {
+ vgLoadMatrix(matrix);
+ }
+
+#ifdef NVG_DEBUG
+ int matrixCount = clock() % 1000;
+ NVG_DEBUGP2("VGfloat ldMatrix%d[] = {", matrixCount);
+
+ NVG_DEBUGP4(" %f, %f, %f, ", matrix[0], matrix[1], matrix[2]);
+ NVG_DEBUGP4(" %f, %f, %f, ", matrix[3], matrix[4], matrix[5]);
+ NVG_DEBUGP4(" %f, %f, %f};\n", matrix[6], matrix[7], matrix[8]);
+
+ NVG_DEBUGP2("vgLoadMatrix(ldMatrix%d);\n", matrixCount);
+#endif
+ }
+
+void CTLVRenderer::DvgMultMatrixL()
+ {
+ VGfloat matrix[9];
+ for (int i = 0; i < 9; i++)
+ {
+ matrix[i] = iNVGIconData->ReadReal32L();
+ }
+
+ vgMultMatrix(matrix);
+
+#ifdef NVG_DEBUG
+ int matrixCount = clock() % 1000;
+ NVG_DEBUGP2("VGfloat mlMatrix%d[] = {", ++matrixCount);
+
+ NVG_DEBUGP1("VGfloat matrix[] = {");
+ NVG_DEBUGP4(" %f, %f, %f, ", matrix[0], matrix[1], matrix[2]);
+ NVG_DEBUGP4(" %f, %f, %f, ", matrix[3], matrix[4], matrix[5]);
+ NVG_DEBUGP4(" %f, %f, %f};\n", matrix[6], matrix[7], matrix[8]);
+
+ NVG_DEBUGP2("vgMultMatrix(mlMatrix%d);\n", matrixCount);
+#endif
+ }
+
+void CTLVRenderer::DvgLoadIdentityL()
+ {
+ if (vgGeti(VG_MATRIX_MODE) == (VGint)VG_MATRIX_IMAGE_USER_TO_SURFACE)
+ {
+ vgLoadIdentity();
+ }
+ NVG_DEBUGP1("vgLoadIdentity();\n");
+ }
+
+void CTLVRenderer::DvgScaleL()
+ {
+ VGfloat sx = iNVGIconData->ReadReal32L();
+ VGfloat sy = iNVGIconData->ReadReal32L();
+ vgScale(sx, sy);
+
+ NVG_DEBUGP3("vgScale(%f, %f);\n", sx, sy);
+ }
+
+void CTLVRenderer::DvgTranslateL()
+ {
+ VGfloat tx = iNVGIconData->ReadReal32L();
+ VGfloat ty = iNVGIconData->ReadReal32L();
+
+ vgTranslate(tx, ty);
+
+ NVG_DEBUGP3("vgTranslate(%f, %f);\n", tx, ty);
+ }
+
+void CTLVRenderer::DvgAppendPathDataL()
+ {
+ TUint16 numSegments;
+ TUint16 coordinatecount;
+ VGubyte * pathSegments;
+ VGubyte * segmenthandle;
+ TFloatFixPt * pathData;
+ TFloatFixPt * coordhandle;
+
+ iNVGIconData->ReadInt32L();
+ numSegments = iNVGIconData->ReadInt16L();
+
+ pathSegments = new (ELeave) VGubyte[numSegments];
+ CleanupStack::PushL(TCleanupItem(CleanupArray, pathSegments));
+
+ segmenthandle = pathSegments;
+ for(int j=0;j<numSegments;j++, segmenthandle++)
+ {
+ *segmenthandle = iNVGIconData->ReadInt8L();
+ }
+
+ coordinatecount = iNVGIconData->ReadInt16L();
+ pathData = new (ELeave) TFloatFixPt[coordinatecount];
+ CleanupStack::PushL(TCleanupItem(CleanupTFloatFixArray, pathData));
+
+ TInt lFloatFixVal = 0;
+ coordhandle= pathData;
+ for(int i=0;i<coordinatecount;i++, coordhandle++)
+ {
+ lFloatFixVal = iNVGIconData->ReadInt32L();
+ coordhandle->copyfloatfix(lFloatFixVal);
+ }
+
+ vgAppendPathData(iPathHandle, numSegments, pathSegments, pathData);
+
+ NVG_DEBUGP3("vgAppendPathData((VGPath)%d, (SENGMENTS)%d);\n", iPathHandle, numSegments);
+
+ CleanupStack::PopAndDestroy();
+ CleanupStack::PopAndDestroy();
+ }
+
+void CTLVRenderer::DvgDrawPathL()
+ {
+ TUint16 value;
+
+ iNVGIconData->ReadInt32L();
+ value = iNVGIconData->ReadInt16L();
+
+ vgDrawPath(iPathHandle, value);
+ vgClearPath(iPathHandle, VG_PATH_CAPABILITY_APPEND_TO);
+
+ NVG_DEBUGSTMT(LogvgDrawPath(iPathHandle, value));
+ }
+
+void CTLVRenderer::DvgClearPathL()
+ {
+ TUint16 value;
+
+ iNVGIconData->ReadInt32L();
+ value = iNVGIconData->ReadInt16L();
+
+ vgClearPath(iPathHandle, value);
+ NVG_DEBUGP1("vgClearPath();\n");
+ }
+
+void CTLVRenderer::DvgCreatePaintL()
+ {
+ TUint encodedHandle = iNVGIconData->ReadInt32L();
+
+ VGPaint paintH = VGCREATEPAINT();
+ if (paintH == VG_INVALID_HANDLE)
+ {
+ User::LeaveIfError(CNvgEngine::OpenVGErrorToSymbianError(vgGetError()));
+ }
+
+ TInt error = iTLVVGHandleList.Append(TLVVGHandlePair(paintH, encodedHandle, TLVVGHandlePair::EVGPAINT));
+ if (error != KErrNone)
+ {
+ VGDESTROYPAINT(paintH);
+ User::Leave(error);
+ }
+
+ NVG_DEBUGP2("%d = vgCreatePaint();\n", GetHandleL(encodedHandle));
+ }
+
+void CTLVRenderer::DvguRectL()
+ {
+
+ TReal32 x;
+ TReal32 y;
+ TReal32 width;
+ TReal32 height;
+
+ iNVGIconData->ReadInt32L();
+
+ x = iNVGIconData->ReadReal32L();
+ y = iNVGIconData->ReadReal32L();
+
+ width = iNVGIconData->ReadReal32L();
+ height = iNVGIconData->ReadReal32L();
+
+ vguRect(iPathHandle, x, y, width, height);
+
+ NVG_DEBUGP6("vguRect(%d, %f, %f, %f, %f);\n", iPathHandle, x, y, width, height);
+
+ //##########workaround for graphics library which doesnt support vgu libraries:Start########
+ /*
+ const VGubyte pathSegments[] =
+ {
+ VG_MOVE_TO_ABS, VG_HLINE_TO_REL,
+ VG_VLINE_TO_REL, VG_HLINE_TO_REL,
+ VG_CLOSE_PATH
+ };
+ TFloatFixPt dataff[5];
+
+ dataff[0]=x;
+ dataff[1]= y;
+ dataff[2]= width;
+ dataff[3]= height;
+ dataff[4]= -width;
+
+ TInt32 numCommands = sizeof(pathSegments)/sizeof(pathSegments[0]);
+ vgAppendPathData(iPathHandle, numCommands, pathSegments, dataff);
+ */
+ //##########workaround for graphics library which doesnt support vgu libraries:End########
+ }
+
+void CTLVRenderer::DvguEllipseL()
+ {
+ TReal32 cx;
+ TReal32 cy;
+ TReal32 width;
+ TReal32 height;
+
+ iNVGIconData->ReadInt32L();
+
+ cx = iNVGIconData->ReadReal32L();
+ cy = iNVGIconData->ReadReal32L();
+
+ width = iNVGIconData->ReadReal32L();
+ height = iNVGIconData->ReadReal32L();
+
+ vguEllipse(iPathHandle, cx, cy, width, height);
+
+ NVG_DEBUGP6("vguEllipse(%d, %f, %f, %f, %f);\n",iPathHandle, cx, cy, width, height);
+
+ //##########workaround for graphics library which doesnt support vgu libraries:Start########
+ /*
+ {
+ const VGubyte pathSegments[] =
+ {
+ VG_MOVE_TO_ABS,
+ VG_SCCWARC_TO_REL,
+ VG_SCCWARC_TO_REL,
+ VG_CLOSE_PATH
+ };
+
+ VGfloat widthDiv2 = width / 2;
+ VGfloat heightDiv2 = height / 2;
+
+ TFloatFixPt data[12];
+ data[0] = cx + widthDiv2;
+ data[1] = cy;
+ data[2] = widthDiv2;
+ data[3] = heightDiv2;
+ data[4] = 0;
+ data[5] = -width;
+ data[6] = 0;
+ data[7] = widthDiv2;
+ data[8] = heightDiv2;
+ data[9] = 0;
+ data[10] = width;
+ data[11] = 0;
+
+ TInt32 numCommands = sizeof(pathSegments)/sizeof(pathSegments[0]);
+
+ vgAppendPathData(iPathHandle, numCommands, pathSegments, data);
+ } */
+ //##########workaround for graphics library which doesnt support vgu libraries:End########
+ }
+
+void CTLVRenderer::DvguRoundRectL()
+ {
+ TReal32 x;
+ TReal32 y;
+ TReal32 width;
+ TReal32 height;
+ TReal32 arcWidth;
+ TReal32 arcHeight;
+
+ iNVGIconData->ReadInt32L();
+
+ x = iNVGIconData->ReadReal32L();
+ y = iNVGIconData->ReadReal32L();
+
+ width = iNVGIconData->ReadReal32L();
+ height= iNVGIconData->ReadReal32L();
+
+ arcWidth = iNVGIconData->ReadReal32L();
+ arcHeight= iNVGIconData->ReadReal32L();
+
+ //uncomment
+ //vguRoundRect(iPathHandle, x, y, width, height, arcWidth, arcHeight);
+
+ NVG_DEBUGP8("vguRoundRect(%d, %f, %f, %f, %f, %f, %f);\n", iPathHandle, x, y, width, height, arcWidth, arcHeight);
+
+ //##########workaround for graphics library which doesnt support vgu libraries:Start########
+ /* commented*/ {
+ if(arcWidth < 0.0f)
+ arcWidth = 0.0f;
+ else if(arcWidth > width)
+ arcWidth = width;
+
+ if(arcHeight < 0.0f)
+ arcHeight = 0.0f;
+ else if(arcHeight > height)
+ arcHeight = height;
+
+ const VGubyte pathSegments[] =
+ {
+ VG_MOVE_TO_ABS, VG_HLINE_TO_REL,
+ VG_SCCWARC_TO_REL, VG_VLINE_TO_REL,
+ VG_SCCWARC_TO_REL, VG_HLINE_TO_REL,
+ VG_SCCWARC_TO_REL, VG_VLINE_TO_REL,
+ VG_SCCWARC_TO_REL, VG_CLOSE_PATH
+ };
+
+ VGfloat arcWidthDiv2 = arcWidth / 2;
+ VGfloat arcHeightDiv2 = arcHeight / 2;
+
+ TFloatFixPt data[26];
+ data[0] = (x + arcWidthDiv2);
+ data[1] = y;
+ data[2] = width - arcWidth;
+ data[3] = arcWidthDiv2;
+ data[4] = arcHeightDiv2;
+ data[5] = 0;
+ data[6] = arcWidthDiv2;
+ data[7] = arcHeightDiv2;
+ data[8] = height - arcHeight;
+ data[9] = arcWidthDiv2;
+ data[10] = arcHeightDiv2;
+ data[11] = 0;
+ data[12] = -arcWidthDiv2;
+ data[13] = arcHeightDiv2;
+ data[14] = -(width - arcWidth);
+ data[15] = arcWidthDiv2;
+ data[16] = arcHeightDiv2;
+ data[17] = 0;
+ data[18] = -arcWidthDiv2;
+ data[19] = -arcHeightDiv2;
+ data[20] = -(height - arcHeight);
+ data[21] = arcWidthDiv2;
+ data[22] = arcHeightDiv2;
+ data[23] = 0;
+ data[24] = arcWidthDiv2;
+ data[25] = -arcHeightDiv2;
+
+ TInt32 numCommands = sizeof(pathSegments)/sizeof(pathSegments[0]);
+
+ vgAppendPathData(iPathHandle, numCommands, pathSegments, data);
+
+ }/* commented */
+ //##########workaround for graphics library which doesnt support vgu libraries:End########
+ }
+
+void CTLVRenderer::DvguLineL()
+ {
+ TReal32 x0;
+ TReal32 y0;
+ TReal32 x1;
+ TReal32 y1;
+
+ iNVGIconData->ReadInt32L();
+
+ x0 = iNVGIconData->ReadReal32L();
+ y0 = iNVGIconData->ReadReal32L();
+
+ x1 = iNVGIconData->ReadReal32L();
+ y1 = iNVGIconData->ReadReal32L();
+
+ vguLine(iPathHandle, x0, y0, x1, y1);
+
+ NVG_DEBUGP6("vguLine(%d, %f, %f, %f, %f);\n", iPathHandle, x0, y0, x1, y1);
+
+ //##########workaround for graphics library which doesnt support vgu libraries:Start########
+ /* {
+ const VGubyte pathSegments[] =
+ {
+ VG_MOVE_TO_ABS, VG_LINE_TO_ABS
+ };
+
+ TFloatFixPt data[4];
+ data[0] = x0;
+ data[1] = y0;
+ data[2] = x1;
+ data[3] = y1;
+
+ TInt32 numCommands = sizeof(pathSegments)/sizeof(pathSegments[0]);
+
+ vgAppendPathData(iPathHandle, numCommands, pathSegments, data);
+ }*/
+ //##########workaround for graphics library which doesnt support vgu libraries:End########
+
+ }
+
+void CTLVRenderer::DvgClearL()
+ {
+
+ TReal32 width;
+ TReal32 height;
+
+ iNVGIconData->ReadReal32L();
+ iNVGIconData->ReadReal32L();
+ width = iNVGIconData->ReadReal32L();
+ height = iNVGIconData->ReadReal32L();
+
+ if (!iScaled)
+ {
+ VGfloat scaleX = ((VGfloat)iTargetWidth) / width;
+ VGfloat scaleY = ((VGfloat)iTargetHeight) / height;
+ vgLoadMatrix(iUserMatrix);
+ vgTranslate(((VGfloat)iTargetWidth) / 2, ((VGfloat)iTargetHeight) / 2);
+ vgScale(scaleX, scaleY);
+ vgTranslate(- width / 2, - height / 2);
+
+ vgGetMatrix(iUserMatrix);
+ iScaled = ETrue;
+ }
+#if 0
+ // create a path and fill with color.
+ VGint color = vgGeti(VG_CLEAR_COLOR);
+ NVG_DEBUGP2("\nclear color %d", color);
+ vgClearPath(iPathHandle, VG_PATH_CAPABILITY_APPEND_TO);
+
+ const VGubyte pathSegments[] =
+ {
+ VG_MOVE_TO_ABS,
+ VG_LINE_TO_ABS,
+ VG_LINE_TO_ABS,
+ VG_LINE_TO_ABS,
+ VG_CLOSE_PATH
+ };
+ VGfloat* coords = NULL;
+ coords = new VGfloat[8];
+ coords[0] = x;
+ coords[1] = y;
+ coords[2] = x + width;
+ coords[3] = y;
+ coords[4] = x + width;
+ coords[5] = y + height;
+ coords[6] = x;
+ coords[7] = y + height;
+
+ VGint orgPaint = vgGetPaint(VG_FILL_PATH);
+ VGint paint = VGCREATEPAINT();
+ vgSetPaint(paint, VG_FILL_PATH);
+ vgSetColor(paint, color);
+ vgAppendPathData(iPathHandle, 5, pathSegments, coords);
+
+ vgDrawPath(iPathHandle, VG_FILL_PATH);
+ vgClearPath(iPathHandle, VG_PATH_CAPABILITY_APPEND_TO);
+ vgSetPaint(orgPaint, VG_FILL_PATH);
+ VGDESTROYPAINT(paint);
+#endif
+
+ NVG_DEBUGP1("vgClear();\n");
+ }
+
+void CTLVRenderer::DvgSetfvL()
+ {
+ TInt innerpos = 1;
+ TUint16 type;
+ TUint16 count;
+ VGfloat * value;
+
+ type = iNVGIconData->ReadInt16L();
+ count = iNVGIconData->ReadInt16L();
+
+ value = new (ELeave) VGfloat[count];
+ CleanupStack::PushL(TCleanupItem(CleanupArray, value));
+
+ for(int i=0; i<count; i++)
+ {
+ value[i] = iNVGIconData->ReadReal32L();
+ }
+
+ innerpos = innerpos + 2*sizeof(TUint16) + count*sizeof(VGfloat);
+
+ vgSetfv((VGParamType)type, count, value);
+
+ NVG_DEBUGSTMT(LogvgSetXv((VGParamType)type, count, 'f', (VGint *)value));
+
+ CleanupStack::PopAndDestroy();
+ }
+
+void CTLVRenderer::DvgRotateL()
+ {
+ TReal32 angle;
+
+ angle = iNVGIconData->ReadReal32L();
+
+ vgRotate(angle);
+
+ NVG_DEBUGP2("vgRotate(%f);\n", angle);
+ }
+
+void CTLVRenderer::DvgCreatePathL()
+ {
+ TUint32 pathFormat;
+ TUint8 datatype;
+ TReal32 scale;
+ TReal32 bias;
+ TUint32 segmentCapacityHint;
+ TUint32 coordCapacityHint;
+ TUint32 capabilities;
+
+ pathFormat = iNVGIconData->ReadInt32L();
+ datatype = iNVGIconData->ReadInt8L();
+
+ scale = iNVGIconData->ReadReal32L();
+ bias = iNVGIconData->ReadReal32L();
+
+ segmentCapacityHint = iNVGIconData->ReadInt32L();
+ coordCapacityHint = iNVGIconData->ReadInt32L();
+ capabilities = iNVGIconData->ReadInt32L();
+ iNVGIconData->ReadInt32L();
+
+ iPathHandle = VGCREATEPATH(pathFormat, (VGPathDatatype)datatype, scale, bias, segmentCapacityHint, coordCapacityHint,
+ (VGbitfield)capabilities);
+
+ if (iPathHandle == VG_INVALID_HANDLE)
+ {
+ User::LeaveIfError(CNvgEngine::OpenVGErrorToSymbianError(vgGetError()));
+ }
+
+ NVG_DEBUGP9("%d = vgCreatePath(%d, (VGPathDatatype)%d, %f, %f, %d, %d, (VGPathCapabilities)%d);\n",
+ iPathHandle, pathFormat, datatype, scale, bias, segmentCapacityHint, coordCapacityHint, capabilities);
+ }
+
+void CTLVRenderer::DvgCreateImageL()
+ {
+ TInt32 format = (VGImageFormat)iNVGIconData->ReadInt32L();
+ TInt width = (VGImageFormat)iNVGIconData->ReadInt32L();
+ TInt height = (VGImageFormat)iNVGIconData->ReadInt32L();
+ TUint8 aq = (VGImageFormat)iNVGIconData->ReadInt8L();
+
+ TInt encodedHandle = iNVGIconData->ReadInt32L();
+ VGImage image = 0;
+
+ if (iPrepareToBindImage)
+ {
+ TPoint leftBottom = GetTranslatedPoint(iUserMatrix, TPoint(0, 0));
+ TPoint rightBottom = GetTranslatedPoint(iUserMatrix, TPoint(width, 0));
+ TPoint leftTop = GetTranslatedPoint(iUserMatrix, TPoint(0, height));
+ TPoint rightTop = GetTranslatedPoint(iUserMatrix, TPoint(width, height));
+
+ VGfloat maxX = leftBottom.iX;
+ VGfloat maxY = leftBottom.iY;
+
+ maxX = MaxVal4(leftBottom.iX, leftTop.iX, rightBottom.iX, rightTop.iX);
+ maxY = MaxVal4(leftBottom.iY, leftTop.iY, rightBottom.iY, rightTop.iY);
+
+ width = maxX - 0;
+ height = maxY - 0;
+
+ iPrepareToBindImage = 0;
+ }
+
+ image = VGCREATEIMAGE((VGImageFormat)format,
+ width, height, aq);
+
+ if (image == VG_INVALID_HANDLE)
+ {
+ User::LeaveIfError(CNvgEngine::OpenVGErrorToSymbianError(vgGetError()));
+ }
+
+ TInt error = iTLVVGHandleList.Append(TLVVGHandlePair(image, encodedHandle, TLVVGHandlePair::EVGIMAGE, aq));
+ if (error != KErrNone)
+ {
+ VGDESTROYIMAGE(image);
+ User::Leave(error);
+ }
+
+ NVG_DEBUGP6("%d = vgCreateImage(%d, %d, %d, %d);\n", GetHandleL(encodedHandle), format, width, height, (TInt32)aq);
+ }
+
+void CTLVRenderer::DvgClearImageL()
+ {
+ TInt encodedImageHandle = iNVGIconData->ReadInt32L();
+ VGImage imageHandle = GetHandleL(encodedImageHandle);
+
+ TInt x = iNVGIconData->ReadInt32L();
+ TInt y = iNVGIconData->ReadInt32L();
+ TInt width = iNVGIconData->ReadInt32L();
+ TInt height = iNVGIconData->ReadInt32L();
+ vgClearImage(imageHandle, x, y, width, height);
+
+ NVG_DEBUGP6("vgClearImage(%d, %d, %d, %d, %d);\n", imageHandle, x, y, width, height);
+ }
+
+void CTLVRenderer::DvgDrawImageL()
+ {
+ TInt encodedImageHandle = iNVGIconData->ReadInt32L();
+ VGImage imageHandle = GetHandleL(encodedImageHandle);
+
+ vgDrawImage(imageHandle);
+
+ NVG_DEBUGP2("vgDrawImage(%d);\n", imageHandle);
+ }
+
+void CTLVRenderer::DvgImageSubDataL()
+ {
+ TInt encodedImageHandle = iNVGIconData->ReadInt32L();
+ VGImage imageHandle = GetHandleL(encodedImageHandle);
+ TInt dataLength = 0;
+
+ TInt dataStride = iNVGIconData->ReadInt32L();
+ TInt dataFormat = iNVGIconData->ReadInt32L();
+ TInt x = iNVGIconData->ReadInt32L();
+ TInt y = iNVGIconData->ReadInt32L();
+ TInt width = iNVGIconData->ReadInt32L();
+ TInt height = iNVGIconData->ReadInt32L();
+
+ dataLength = iNVGIconData->ReadInt32L();
+ if (dataLength)
+ {
+ TUint8 * data = new (ELeave) TUint8[dataLength];
+ CleanupStack::PushL(TCleanupItem(CleanupArray, data));
+
+ iNVGIconData->ReadL(data, dataLength);
+ TUint8 * dataPtr;
+ if (dataStride < 0)
+ {
+ dataPtr = data + ( height - 1 ) * (-dataStride);
+ }
+ else
+ {
+ dataPtr = data;
+ }
+
+ vgImageSubData(imageHandle, dataPtr, dataStride, (VGImageFormat)dataFormat, x, y, width, height);
+
+ NVG_DEBUGSTMT(LogvgImageSubData(imageHandle, dataPtr, dataLength, dataStride, (VGImageFormat)dataFormat, x, y, width, height));
+ CleanupStack::PopAndDestroy();
+ }
+ else
+ {
+ User::Leave(KErrCorrupt);
+ }
+ }
+
+void CTLVRenderer::DvgGetPixelsL()
+ {
+ //not used in SVGEngine
+ }
+
+void CTLVRenderer::DvgDestroyImageL()
+ {
+ VGImage imageHandle = RemoveHandleL(iNVGIconData->ReadInt32L());
+ VGDESTROYIMAGE(imageHandle);
+ NVG_DEBUGP2("vgDestroyImage(%d);\n", imageHandle);
+ }
+
+void CTLVRenderer::DvgDestroyPaintL()
+ {
+ TInt paint = iNVGIconData->ReadInt32L();
+ VGDESTROYPAINT(RemoveHandleL(paint));
+ NVG_DEBUGP2("vgDestroyPaint(%d);\n", GetHandleL(paint));
+ }
+
+void CTLVRenderer::DvgDestroyPathL()
+ {
+ // only one path handle is maintained, which is a member variable
+ NVG_DEBUGP2("vgDestroyPath(%d);\n", iPathHandle);
+ }
+
+void CTLVRenderer::DvgFlushL()
+ {
+ //no need to implement?
+ NVG_DEBUGP1("vgFlush();\n");
+ }
+
+TInt CTLVRenderer::ExecuteL(TInt aIndex)
+ {
+ if (0 <= aIndex && aIndex < EvgFlush + 1)
+ {
+ (this->*(vgapi[aIndex]))();
+ }
+ else
+ {
+ return KErrCorrupt;
+ }
+
+ return KErrNone;
+ }
+
+TInt CTLVRenderer::ExecuteL()
+ {
+ TInt error = KErrNone;
+
+ NVG_DEBUGP1("TLV rendering starts");
+
+ while (!iNVGIconData->EOF())
+ {
+ error = ExecuteL(iNVGIconData->ReadInt8L());
+ if (error != KErrNone)
+ {
+ break;
+ }
+ }
+
+ NVG_DEBUGP1("TLV rendering ends");
+
+ return error;
+ }
+
+void CTLVRenderer::GetHandlePair(int aIndex, TLVVGHandlePair & aPair)
+ {
+ TInt handleListCount = iTLVVGHandleList.Count();
+
+ for (TInt i = 0; i < handleListCount; i++)
+ {
+ if (iTLVVGHandleList[i].iTLVHandle == aIndex)
+ {
+ aPair = iTLVVGHandleList[i];
+ break;
+ }
+ }
+ }
+
+VGHandle CTLVRenderer::RemoveHandleL(int aIndex)
+ {
+ TInt handleListCount = iTLVVGHandleList.Count();
+ VGHandle handle = 0;
+
+ for (TInt i = 0; i < handleListCount; i++)
+ {
+ if (iTLVVGHandleList[i].iTLVHandle == aIndex)
+ {
+ handle = iTLVVGHandleList[i].iVGHandle;
+ iTLVVGHandleList.Remove(i);
+ break;
+ }
+ }
+
+ if (!handle)
+ {
+ User::Leave(KErrCorrupt);
+ }
+ return handle;
+ }
+
+VGHandle CTLVRenderer::GetHandleL(int aIndex)
+ {
+ VGHandle handle = GetHandle(aIndex);
+
+ if (!handle)
+ {
+ User::Leave(KErrCorrupt);
+ }
+ return handle;
+ }
+
+VGHandle CTLVRenderer::GetHandle(int aIndex)
+ {
+ TInt handleListCount = iTLVVGHandleList.Count();
+ VGHandle handle = 0;
+
+ for (TInt i = 0; i < handleListCount; i++)
+ {
+ if (iTLVVGHandleList[i].iTLVHandle == aIndex)
+ {
+ handle = iTLVVGHandleList[i].iVGHandle;
+ break;
+ }
+ }
+ return handle;
+ }
+
+void CTLVRenderer::SetHandle(int aIndex, VGHandle aHandle)
+ {
+ TInt handleListCount = iTLVVGHandleList.Count();
+
+ for (TInt i = 0; i < handleListCount; i++)
+ {
+ if (iTLVVGHandleList[i].iTLVHandle == aIndex)
+ {
+ iTLVVGHandleList[i].iVGHandle = aHandle;
+ break;
+ }
+ }
+ }
+
+void CTLVRenderer::DvgPrepareToBindImageL()
+ {
+ iPrepareToBindImage = 1;
+ NVG_DEBUGP1("vgPrepareToBindImage();\n");
+ }
+
+void CTLVRenderer::DvgBindImageL()
+ {
+ iPrepareToBindImage = 0;
+
+ TInt imageHandle = iNVGIconData->ReadInt32L();
+
+ if (iVGImageBinder)
+ {
+ iVGImageBinder->BindClientBuffer((VGHandle)GetHandleL(imageHandle));
+ }
+ NVG_DEBUGP2("vgBindImage(%d);\n", imageHandle);
+ }
+
+void CTLVRenderer::DvgUnBindImageL()
+ {
+ if (iVGImageBinder)
+ {
+ iVGImageBinder->UnBindClientBuffer();
+ }
+ NVG_DEBUGP1("vgUnBindImage();\n");
+ }
+
+#ifdef NVG_DEBUG
+void CTLVRenderer::LogvgSetf(VGParamType type, VGfloat value)
+ {
+ RDebug::Print(_L("vgSetf("));
+ switch(type)
+ {
+ case VG_STROKE_LINE_WIDTH:
+ {
+ RDebug::Print(_L("VG_STROKE_LINE_WIDTH"));
+ }
+ break;
+ case VG_STROKE_MITER_LIMIT:
+ {
+ RDebug::Print(_L("VG_STROKE_MITER_LIMIT"));
+ }
+ break;
+ case VG_STROKE_DASH_PHASE:
+ {
+ RDebug::Print(_L("VG_STROKE_DASH_PHASE"));
+ }
+ break;
+
+ case VG_MATRIX_MODE:
+ {
+ RDebug::Print(_L("VG_MATRIX_MODE"));
+ }
+ break;
+ case VG_FILL_RULE:
+ {
+ RDebug::Print(_L("VG_FILL_RULE"));
+ }
+ break;
+ case VG_IMAGE_QUALITY:
+ {
+ RDebug::Print(_L("VG_IMAGE_QUALITY"));
+ }
+ break;
+ case VG_IMAGE_MODE:
+ {
+ RDebug::Print(_L("VG_IMAGE_MODE"));
+ }
+ break;
+ case VG_RENDERING_QUALITY:
+ {
+ RDebug::Print(_L("VG_RENDERING_QUALITY"));
+ }
+ break;
+ case VG_BLEND_MODE:
+ {
+ RDebug::Print(_L("VG_BLEND_MODE"));
+ }
+ break;
+ case VG_MASKING:
+ {
+ RDebug::Print(_L("VG_MASKING"));
+ }
+ break;
+ case VG_SCISSORING:
+ {
+ RDebug::Print(_L("VG_SCISSORING"));
+ }
+ break;
+ case VG_PIXEL_LAYOUT:
+ {
+ RDebug::Print(_L("VG_PIXEL_LAYOUT"));
+ }
+ break;
+ case VG_FILTER_FORMAT_LINEAR:
+ {
+ RDebug::Print(_L("VG_FILTER_FORMAT_LINEAR"));
+ }
+ break;
+ case VG_FILTER_FORMAT_PREMULTIPLIED:
+ {
+ RDebug::Print(_L("VG_FILTER_FORMAT_PREMULTIPLIED"));
+ }
+ break;
+ case VG_FILTER_CHANNEL_MASK:
+ {
+ RDebug::Print(_L("VG_FILTER_CHANNEL_MASK"));
+ }
+ break;
+ case VG_STROKE_CAP_STYLE:
+ {
+ RDebug::Print(_L("VG_STROKE_CAP_STYLE"));
+ }
+ break;
+ case VG_STROKE_JOIN_STYLE:
+ {
+ RDebug::Print(_L("VG_STROKE_JOIN_STYLE"));
+ }
+ break;
+ case VG_STROKE_DASH_PHASE_RESET:
+ {
+ RDebug::Print(_L("VG_STROKE_DASH_PHASE_RESET"));
+ }
+ break;
+ /* Implementation limits (read-only) */
+ case VG_SCREEN_LAYOUT:
+ {
+ RDebug::Print(_L("VG_SCREEN_LAYOUT"));
+ }
+ break;
+ case VG_MAX_SCISSOR_RECTS:
+ {
+ RDebug::Print(_L("VG_MAX_SCISSOR_RECTS"));
+ }
+ break;
+ case VG_MAX_DASH_COUNT:
+ {
+ RDebug::Print(_L("VG_MAX_DASH_COUNT"));
+ }
+ break;
+ case VG_MAX_KERNEL_SIZE:
+ {
+ RDebug::Print(_L("VG_MAX_KERNEL_SIZE"));
+ }
+ break;
+ case VG_MAX_SEPARABLE_KERNEL_SIZE:
+ {
+ RDebug::Print(_L("VG_MAX_SEPARABLE_KERNEL_SIZE"));
+ }
+ break;
+ case VG_MAX_COLOR_RAMP_STOPS:
+ {
+ RDebug::Print(_L("VG_MAX_COLOR_RAMP_STOPS"));
+ }
+ break;
+ case VG_MAX_IMAGE_WIDTH:
+ {
+ RDebug::Print(_L("VG_MAX_IMAGE_WIDTH"));
+ }
+ break;
+ case VG_MAX_IMAGE_HEIGHT:
+ {
+ RDebug::Print(_L("VG_MAX_IMAGE_HEIGHT"));
+ }
+ break;
+ case VG_MAX_IMAGE_PIXELS:
+ {
+ RDebug::Print(_L("VG_MAX_IMAGE_PIXELS"));
+ }
+ break;
+ case VG_MAX_IMAGE_BYTES:
+ {
+ RDebug::Print(_L("VG_MAX_IMAGE_BYTES"));
+ }
+ break;
+ case VG_MAX_FLOAT:
+ {
+ RDebug::Print(_L("VG_MAX_FLOAT"));
+ }
+ break;
+ case VG_MAX_GAUSSIAN_STD_DEVIATION:
+ {
+ RDebug::Print(_L("VG_MAX_GAUSSIAN_STD_DEVIATION"));
+ }
+ break;
+
+ default:
+ {
+ RDebug::Print(_L("%d"), type);
+ }
+ break;
+ };
+
+ RDebug::Print(_L(", "));
+ RDebug::Print(_L("%f"), value);
+ RDebug::Print(_L(");\n"));
+ return;
+ }
+
+void CTLVRenderer::LogvgSeti (VGParamType type, VGint value)
+ {
+ RDebug::Print(_L("vgSeti("));
+
+ switch(type)
+ {
+ case VG_STROKE_LINE_WIDTH:
+ {
+ RDebug::Print(_L("VG_STROKE_LINE_WIDTH"));
+ }
+ break;
+ case VG_STROKE_MITER_LIMIT:
+ {
+ RDebug::Print(_L("VG_STROKE_MITER_LIMIT"));
+ }
+ break;
+ case VG_STROKE_DASH_PHASE:
+ {
+ RDebug::Print(_L("VG_STROKE_DASH_PHASE"));
+ }
+ break;
+
+ case VG_MATRIX_MODE:
+ {
+ RDebug::Print(_L("VG_MATRIX_MODE"));
+ }
+ break;
+ case VG_FILL_RULE:
+ {
+ RDebug::Print(_L("VG_FILL_RULE"));
+ }
+ break;
+ case VG_IMAGE_QUALITY:
+ {
+ RDebug::Print(_L("VG_IMAGE_QUALITY"));
+ }
+ break;
+ case VG_IMAGE_MODE:
+ {
+ RDebug::Print(_L("VG_IMAGE_MODE"));
+ }
+ break;
+ case VG_RENDERING_QUALITY:
+ {
+ RDebug::Print(_L("VG_RENDERING_QUALITY"));
+ }
+ break;
+ case VG_BLEND_MODE:
+ {
+ RDebug::Print(_L("VG_BLEND_MODE"));
+ }
+ break;
+ case VG_MASKING:
+ {
+ RDebug::Print(_L("VG_MASKING"));
+ }
+ break;
+ case VG_SCISSORING:
+ {
+ RDebug::Print(_L("VG_SCISSORING"));
+ }
+ break;
+ case VG_PIXEL_LAYOUT:
+ {
+ RDebug::Print(_L("VG_PIXEL_LAYOUT"));
+ }
+ break;
+ case VG_FILTER_FORMAT_LINEAR:
+ {
+ RDebug::Print(_L("VG_FILTER_FORMAT_LINEAR"));
+ }
+ break;
+ case VG_FILTER_FORMAT_PREMULTIPLIED:
+ {
+ RDebug::Print(_L("VG_FILTER_FORMAT_PREMULTIPLIED"));
+ }
+ break;
+ case VG_FILTER_CHANNEL_MASK:
+ {
+ RDebug::Print(_L("VG_FILTER_CHANNEL_MASK"));
+ }
+ break;
+ case VG_STROKE_CAP_STYLE:
+ {
+ RDebug::Print(_L("VG_STROKE_CAP_STYLE"));
+ }
+ break;
+ case VG_STROKE_JOIN_STYLE:
+ {
+ RDebug::Print(_L("VG_STROKE_JOIN_STYLE"));
+ }
+ break;
+ case VG_STROKE_DASH_PHASE_RESET:
+ {
+ RDebug::Print(_L("VG_STROKE_DASH_PHASE_RESET"));
+ }
+ break;
+ /* Implementation limits (read-only) */
+ case VG_SCREEN_LAYOUT:
+ {
+ RDebug::Print(_L("VG_SCREEN_LAYOUT"));
+ }
+ break;
+ case VG_MAX_SCISSOR_RECTS:
+ {
+ RDebug::Print(_L("VG_MAX_SCISSOR_RECTS"));
+ }
+ break;
+ case VG_MAX_DASH_COUNT:
+ {
+ RDebug::Print(_L("VG_MAX_DASH_COUNT"));
+ }
+ break;
+ case VG_MAX_KERNEL_SIZE:
+ {
+ RDebug::Print(_L("VG_MAX_KERNEL_SIZE"));
+ }
+ break;
+ case VG_MAX_SEPARABLE_KERNEL_SIZE:
+ {
+ RDebug::Print(_L("VG_MAX_SEPARABLE_KERNEL_SIZE"));
+ }
+ break;
+ case VG_MAX_COLOR_RAMP_STOPS:
+ {
+ RDebug::Print(_L("VG_MAX_COLOR_RAMP_STOPS"));
+ }
+ break;
+ case VG_MAX_IMAGE_WIDTH:
+ {
+ RDebug::Print(_L("VG_MAX_IMAGE_WIDTH"));
+ }
+ break;
+ case VG_MAX_IMAGE_HEIGHT:
+ {
+ RDebug::Print(_L("VG_MAX_IMAGE_HEIGHT"));
+ }
+ break;
+ case VG_MAX_IMAGE_PIXELS:
+ {
+ RDebug::Print(_L("VG_MAX_IMAGE_PIXELS"));
+ }
+ break;
+ case VG_MAX_IMAGE_BYTES:
+ {
+ RDebug::Print(_L("VG_MAX_IMAGE_BYTES"));
+ }
+ break;
+ case VG_MAX_FLOAT:
+ {
+ RDebug::Print(_L("VG_MAX_FLOAT"));
+ }
+ break;
+ case VG_MAX_GAUSSIAN_STD_DEVIATION:
+ {
+ RDebug::Print(_L("VG_MAX_GAUSSIAN_STD_DEVIATION"));
+ }
+ break;
+
+ default:
+ {
+ RDebug::Print(_L("%d"), type);
+ }
+ break;
+ };
+
+ RDebug::Print(_L(", "));
+ switch(value)
+ {
+ case VG_RENDERING_QUALITY_NONANTIALIASED:
+ {
+ RDebug::Print(_L("VG_RENDERING_QUALITY_NONANTIALIASED"));
+ }
+ break;
+ case VG_RENDERING_QUALITY_FASTER:
+ {
+ RDebug::Print(_L("VG_RENDERING_QUALITY_FASTER"));
+ }
+ break;
+ case VG_RENDERING_QUALITY_BETTER:
+ {
+ RDebug::Print(_L("VG_RENDERING_QUALITY_BETTER"));
+ }
+ break;
+ case VG_MATRIX_PATH_USER_TO_SURFACE:
+ {
+ RDebug::Print(_L("VG_MATRIX_PATH_USER_TO_SURFACE"));
+ }
+ break;
+ case VG_MATRIX_IMAGE_USER_TO_SURFACE:
+ {
+ RDebug::Print(_L("VG_MATRIX_IMAGE_USER_TO_SURFACE"));
+ }
+ break;
+ case VG_MATRIX_FILL_PAINT_TO_USER :
+ {
+ RDebug::Print(_L("VG_MATRIX_FILL_PAINT_TO_USER"));
+ }
+ break;
+ case VG_MATRIX_STROKE_PAINT_TO_USER:
+ {
+ RDebug::Print(_L("VG_MATRIX_STROKE_PAINT_TO_USER"));
+ }
+ break;
+ case VG_CAP_BUTT:
+ {
+ RDebug::Print(_L("VG_CAP_BUTT"));
+ }
+ break;
+ case VG_CAP_ROUND:
+ {
+ RDebug::Print(_L("VG_CAP_ROUND"));
+ }
+ break;
+ case VG_CAP_SQUARE:
+ {
+ RDebug::Print(_L("VG_CAP_SQUARE"));
+ }
+ break;
+ case VG_BLEND_SRC:
+ {
+ RDebug::Print(_L("VG_BLEND_SRC"));
+ }
+ break;
+ case VG_BLEND_SRC_OVER:
+ {
+ RDebug::Print(_L("VG_BLEND_SRC_OVER"));
+ }
+ break;
+ case VG_BLEND_DST_OVER:
+ {
+ RDebug::Print(_L("VG_BLEND_DST_OVER"));
+ }
+ break;
+ case VG_BLEND_SRC_IN:
+ {
+ RDebug::Print(_L("VG_BLEND_SRC_IN"));
+ }
+ break;
+ case VG_BLEND_DST_IN:
+ {
+ RDebug::Print(_L("VG_BLEND_DST_IN"));
+ }
+ break;
+ case VG_BLEND_MULTIPLY:
+ {
+ RDebug::Print(_L("VG_BLEND_MULTIPLY"));
+ }
+ break;
+ case VG_BLEND_SCREEN:
+ {
+ RDebug::Print(_L("VG_BLEND_SCREEN"));
+ }
+ break;
+ case VG_BLEND_DARKEN:
+ {
+ RDebug::Print(_L("VG_BLEND_DARKEN"));
+ }
+ break;
+ case VG_BLEND_LIGHTEN:
+ {
+ RDebug::Print(_L("VG_BLEND_LIGHTEN"));
+ }
+ break;
+ case VG_BLEND_ADDITIVE:
+ {
+ RDebug::Print(_L("VG_BLEND_ADDITIVE"));
+ }
+ break;
+ case VG_IMAGE_QUALITY_NONANTIALIASED:
+ {
+ RDebug::Print(_L("1"));
+ }
+ break;
+ case VG_IMAGE_QUALITY_FASTER:
+ {
+ RDebug::Print(_L("VG_IMAGE_QUALITY_FASTER"));
+ }
+ break;
+ case VG_IMAGE_QUALITY_BETTER:
+ {
+ RDebug::Print(_L("VG_IMAGE_QUALITY_BETTER"));
+ }
+ break;
+ case VG_FALSE:
+ {
+ RDebug::Print(_L("VG_FALSE"));
+ }
+ break;
+ case VG_RED:
+ {
+ RDebug::Print(_L("VG_RED"));
+ }
+ break;
+
+ case VG_DRAW_IMAGE_NORMAL:
+ {
+ RDebug::Print(_L("VG_DRAW_IMAGE_NORMAL"));
+ }
+ break;
+ case VG_DRAW_IMAGE_MULTIPLY:
+ {
+ RDebug::Print(_L("VG_DRAW_IMAGE_MULTIPLY"));
+ }
+ break;
+ case VG_DRAW_IMAGE_STENCIL:
+ {
+ RDebug::Print(_L("VG_DRAW_IMAGE_STENCIL"));
+ }
+ break;
+ case VG_JOIN_MITER:
+ {
+ RDebug::Print(_L("VG_JOIN_MITER"));
+ }
+ break;
+ case VG_JOIN_ROUND:
+ {
+ RDebug::Print(_L("VG_JOIN_ROUND"));
+ }
+ break;
+ case VG_JOIN_BEVEL:
+ {
+ RDebug::Print(_L("VG_JOIN_BEVEL"));
+ }
+ case VG_EVEN_ODD:
+ RDebug::Print(_L("VG_EVEN_ODD"));
+ break;
+ case VG_NON_ZERO:
+ RDebug::Print(_L("VG_NON_ZERO"));
+ break;
+ default:
+ {
+ RDebug::Print(_L("%d"), value);
+ }
+ break;
+ };
+
+ RDebug::Print(_L(");\n"));
+ return;
+ }
+
+void CTLVRenderer::LogvgSetXv(VGParamType type, VGint count, TInt8 vtype, VGint * data)
+ {
+ int vgsetvDataCount = clock() % 1000;
+ RDebug::Print(_L("VGfloat * vgsetvData%d = new VGfloat[%d];\n"), ++vgsetvDataCount, count);
+
+ for (int i=0; i<count; ++i)
+ {
+ RDebug::Print(_L("*(vgsetvData%d+i) = "), vgsetvDataCount);
+ if (vtype == 'f')
+ {
+ TRealFormat rf;
+ RDebug::Print(_L("%f"), (TReal)*(((TReal*)data)+i), rf);
+ }
+ else if (vtype == 'i')
+ {
+ RDebug::Print(_L("%d"), (TInt)*(data+i));
+ }
+
+ RDebug::Print(_L(";\n"));
+ }
+
+ RDebug::Print(_L("vgSet%cv("), vtype);
+
+ switch(type)
+ {
+ case VG_STROKE_DASH_PATTERN:
+ RDebug::Print(_L("VG_STROKE_DASH_PATTERN"));
+ break;
+ case VG_SCISSOR_RECTS:
+ RDebug::Print(_L("VG_SCISSOR_RECTS"));
+ break;
+ case VG_CLEAR_COLOR:
+ RDebug::Print(_L("VG_CLEAR_COLOR"));
+ break;
+ case VG_STROKE_LINE_WIDTH:
+ {
+ RDebug::Print(_L("VG_STROKE_LINE_WIDTH"));
+ }
+ break;
+ case VG_STROKE_MITER_LIMIT:
+ {
+ RDebug::Print(_L("VG_STROKE_MITER_LIMIT"));
+ }
+ break;
+ case VG_STROKE_DASH_PHASE:
+ {
+ RDebug::Print(_L("VG_STROKE_DASH_PHASE"));
+ }
+ break;
+
+ case VG_MATRIX_MODE:
+ {
+ RDebug::Print(_L("VG_MATRIX_MODE"));
+ }
+ break;
+ case VG_FILL_RULE:
+ {
+ RDebug::Print(_L("VG_FILL_RULE"));
+ }
+ break;
+ case VG_IMAGE_QUALITY:
+ {
+ RDebug::Print(_L("VG_IMAGE_QUALITY"));
+ }
+ break;
+ case VG_IMAGE_MODE:
+ {
+ RDebug::Print(_L("VG_IMAGE_MODE"));
+ }
+ break;
+ case VG_RENDERING_QUALITY:
+ {
+ RDebug::Print(_L("VG_RENDERING_QUALITY"));
+ }
+ break;
+ case VG_BLEND_MODE:
+ {
+ RDebug::Print(_L("VG_BLEND_MODE"));
+ }
+ break;
+ case VG_MASKING:
+ {
+ RDebug::Print(_L("VG_MASKING"));
+ }
+ break;
+ case VG_SCISSORING:
+ {
+ RDebug::Print(_L("VG_SCISSORING"));
+ }
+ break;
+ case VG_PIXEL_LAYOUT:
+ {
+ RDebug::Print(_L("VG_PIXEL_LAYOUT"));
+ }
+ break;
+ case VG_FILTER_FORMAT_LINEAR:
+ {
+ RDebug::Print(_L("VG_FILTER_FORMAT_LINEAR"));
+ }
+ break;
+ case VG_FILTER_FORMAT_PREMULTIPLIED:
+ {
+ RDebug::Print(_L("VG_FILTER_FORMAT_PREMULTIPLIED"));
+ }
+ break;
+ case VG_FILTER_CHANNEL_MASK:
+ {
+ RDebug::Print(_L("VG_FILTER_CHANNEL_MASK"));
+ }
+ break;
+ case VG_STROKE_CAP_STYLE:
+ {
+ RDebug::Print(_L("VG_STROKE_CAP_STYLE"));
+ }
+ break;
+ case VG_STROKE_JOIN_STYLE:
+ {
+ RDebug::Print(_L("VG_STROKE_JOIN_STYLE"));
+ }
+ break;
+ case VG_STROKE_DASH_PHASE_RESET:
+ {
+ RDebug::Print(_L("VG_STROKE_DASH_PHASE_RESET"));
+ }
+ break;
+ /* Implementation limits (read-only) */
+ case VG_SCREEN_LAYOUT:
+ {
+ RDebug::Print(_L("VG_SCREEN_LAYOUT"));
+ }
+ break;
+ case VG_MAX_SCISSOR_RECTS:
+ {
+ RDebug::Print(_L("VG_MAX_SCISSOR_RECTS"));
+ }
+ break;
+ case VG_MAX_DASH_COUNT:
+ {
+ RDebug::Print(_L("VG_MAX_DASH_COUNT"));
+ }
+ break;
+ case VG_MAX_KERNEL_SIZE:
+ {
+ RDebug::Print(_L("VG_MAX_KERNEL_SIZE"));
+ }
+ break;
+ case VG_MAX_SEPARABLE_KERNEL_SIZE:
+ {
+ RDebug::Print(_L("VG_MAX_SEPARABLE_KERNEL_SIZE"));
+ }
+ break;
+ case VG_MAX_COLOR_RAMP_STOPS:
+ {
+ RDebug::Print(_L("VG_MAX_COLOR_RAMP_STOPS"));
+ }
+ break;
+ case VG_MAX_IMAGE_WIDTH:
+ {
+ RDebug::Print(_L("VG_MAX_IMAGE_WIDTH"));
+ }
+ break;
+ case VG_MAX_IMAGE_HEIGHT:
+ {
+ RDebug::Print(_L("VG_MAX_IMAGE_HEIGHT"));
+ }
+ break;
+ case VG_MAX_IMAGE_PIXELS:
+ {
+ RDebug::Print(_L("VG_MAX_IMAGE_PIXELS"));
+ }
+ break;
+ case VG_MAX_IMAGE_BYTES:
+ {
+ RDebug::Print(_L("VG_MAX_IMAGE_BYTES"));
+ }
+ break;
+ case VG_MAX_FLOAT:
+ {
+ RDebug::Print(_L("VG_MAX_FLOAT"));
+ }
+ break;
+ case VG_MAX_GAUSSIAN_STD_DEVIATION:
+ {
+ RDebug::Print(_L("VG_MAX_GAUSSIAN_STD_DEVIATION"));
+ }
+ break;
+
+ default:
+ {
+ RDebug::Print(_L("%d"), type);
+ }
+ break;
+ };
+
+ RDebug::Print(_L(", %d, vgsetvData%d);\n"), count, vgsetvDataCount);
+ RDebug::Print(_L("delete [] vgsetvData%d;\n"), vgsetvDataCount);
+ return;
+ }
+
+void CTLVRenderer::LogvgSetParameteri(VGHandle handle, VGint paramType, VGint value, TInt /*Lpvalue*/)
+ {
+
+ RDebug::Print(_L("vgSetParameteri(%d, "), handle);
+
+ switch(paramType)
+ {
+ case VG_PAINT_TYPE:
+ {
+ RDebug::Print(_L("VG_PAINT_TYPE"));
+ }
+ break;
+ case VG_PAINT_COLOR:
+ {
+ RDebug::Print(_L("VG_PAINT_COLOR"));
+ }
+ break;
+ case VG_PAINT_COLOR_RAMP_SPREAD_MODE:
+ {
+ RDebug::Print(_L("VG_PAINT_COLOR_RAMP_SPREAD_MODE"));
+ }
+ break;
+ case VG_PAINT_COLOR_RAMP_PREMULTIPLIED:
+ {
+ RDebug::Print(_L("VG_PAINT_COLOR_RAMP_PREMULTIPLIED"));
+ }
+ break;
+ case VG_PAINT_COLOR_RAMP_STOPS:
+ {
+ RDebug::Print(_L("VG_PAINT_COLOR_RAMP_STOPS"));
+ }
+ break;
+
+ /* Linear gradient paint parameters */
+ case VG_PAINT_LINEAR_GRADIENT:
+ {
+ RDebug::Print(_L("VG_PAINT_LINEAR_GRADIENT"));
+ }
+ break;
+ /* Radial gradient paint parameters */
+ case VG_PAINT_RADIAL_GRADIENT:
+ {
+ RDebug::Print(_L("VG_PAINT_RADIAL_GRADIENT"));
+ }
+ break;
+ /* Pattern paint parameters */
+ case VG_PAINT_PATTERN_TILING_MODE:
+ {
+ RDebug::Print(_L("VG_PAINT_PATTERN_TILING_MODE"));
+ }
+ break;
+ default:
+ {
+ RDebug::Print(_L("%d"), paramType);
+ }
+ break;
+ };
+
+ RDebug::Print(_L(", "));
+
+ switch(value)
+ {
+ case VG_PAINT_TYPE_COLOR:
+ {
+ RDebug::Print(_L("VG_PAINT_TYPE_COLOR"));
+ }
+ break;
+ case VG_PAINT_TYPE_LINEAR_GRADIENT:
+ {
+ RDebug::Print(_L("VG_PAINT_TYPE_LINEAR_GRADIENT"));
+ }
+ break;
+ case VG_PAINT_TYPE_RADIAL_GRADIENT:
+ {
+ RDebug::Print(_L("VG_PAINT_TYPE_RADIAL_GRADIENT"));
+ }
+ break;
+ case VG_PAINT_TYPE_PATTERN:
+ {
+ RDebug::Print(_L("VG_PAINT_TYPE_PATTERN"));
+ }
+ break;
+ default:
+ {
+ RDebug::Print(_L("%d"), value);
+ }
+ break;
+ };
+ RDebug::Print(_L(");\n"));
+ return;
+ }
+
+void CTLVRenderer::LogvgSetPaint(VGPaint paint, VGbitfield paintModes, TInt /*Lpvalue*/)
+ {
+ RDebug::Print(_L("vgSetPaint(%d, "), paint);
+
+ switch(paintModes)
+ {
+ case VG_STROKE_PATH:
+ {
+ RDebug::Print(_L("VG_STROKE_PATH"));
+ }
+ break;
+ case VG_FILL_PATH:
+ {
+ RDebug::Print(_L("VG_FILL_PATH"));
+ }
+ break;
+ default:
+ {
+ RDebug::Print(_L("%d"), paintModes);
+ }
+ break;
+ };
+ RDebug::Print(_L(");\n"));
+ return;
+ }
+
+void CTLVRenderer::LogvgDrawPath(VGuint path, VGbitfield paintModes)
+ {
+ RDebug::Print(_L("vgDrawPath(%d, "), path);
+
+ switch(paintModes)
+ {
+ case VG_STROKE_PATH:
+ {
+ RDebug::Print(_L("VG_STROKE_PATH"));
+ }
+ break;
+ case VG_FILL_PATH:
+ {
+ RDebug::Print(_L("VG_FILL_PATH"));
+ }
+ break;
+ case VG_FILL_PATH | VG_STROKE_PATH:
+ {
+ RDebug::Print(_L("VG_FILL_PATH | VG_STROKE_PATH"));
+ }
+ break;
+ default:
+ {
+ RDebug::Print(_L("%d"), paintModes);
+ }
+ break;
+ };
+ RDebug::Print(_L(");\n"));
+ return;
+ }
+
+void CTLVRenderer::LogvgSetParameterfv(VGPaint handle, VGint paramtype, TInt count, VGfloat * data)
+ {
+ int vgSetParameterfvDataCount = clock() % 1000;
+ RDebug::Print(_L("VGfloat * vgSetParameterfvData%d = new VGfloat[%d];\n"), ++vgSetParameterfvDataCount, count);
+
+ for (int i=0; i<count; ++i)
+ {
+ RDebug::Print(_L("*(vgSetParameterfvData%d+i) = %f;\n"), vgSetParameterfvDataCount, data[i]);
+ }
+
+ RDebug::Print(_L("vgSetParameterfv(%d, "), handle);
+
+ switch(paramtype)
+ {
+ case VG_PAINT_TYPE:
+ {
+ RDebug::Print(_L("VG_PAINT_TYPE"));
+ }
+ break;
+ case VG_PAINT_COLOR:
+ {
+ RDebug::Print(_L("VG_PAINT_COLOR"));
+ }
+ break;
+ case VG_PAINT_COLOR_RAMP_SPREAD_MODE:
+ {
+ RDebug::Print(_L("VG_PAINT_COLOR_RAMP_SPREAD_MODE"));
+ }
+ break;
+ case VG_PAINT_COLOR_RAMP_PREMULTIPLIED:
+ {
+ RDebug::Print(_L("VG_PAINT_COLOR_RAMP_PREMULTIPLIED"));
+ }
+ break;
+ case VG_PAINT_COLOR_RAMP_STOPS:
+ {
+ RDebug::Print(_L("VG_PAINT_COLOR_RAMP_STOPS"));
+ }
+ break;
+ case VG_PAINT_LINEAR_GRADIENT:
+ {
+ RDebug::Print(_L("VG_PAINT_LINEAR_GRADIENT"));
+ }
+ break;
+ case VG_PAINT_RADIAL_GRADIENT:
+ {
+ RDebug::Print(_L("VG_PAINT_RADIAL_GRADIENT"));
+ }
+ break;
+ case VG_PAINT_PATTERN_TILING_MODE:
+ {
+ RDebug::Print(_L("VG_PAINT_PATTERN_TILING_MODE"));
+ }
+ break;
+ default:
+ {
+ RDebug::Print(_L("%d"), paramtype);
+ }
+ break;
+ };
+ RDebug::Print(_L(", %d, vgSetParameterfvData%d);\n"), count, vgSetParameterfvDataCount);
+ RDebug::Print(_L("delete [] vgSetParameterfvData%d;\n"), vgSetParameterfvDataCount);
+ return;
+ }
+
+void CTLVRenderer::LogvgImageSubData(VGImage imageHandle, const void * dataPtr, TInt dataLength, VGint dataStride,
+ VGImageFormat dataFormat, VGint x, VGint y, VGint width, VGint height)
+ {
+ int imageDataCount = clock() % 1000;
+
+ RDebug::Print(_L("VGbyte imageData%d[] = {"), ++imageDataCount);
+
+ for (TInt i = 0; i < dataLength; ++i)
+ {
+ if (i == dataLength-1)
+ {
+ int data = (int)*(((VGbyte *)(dataPtr))+i);
+ RDebug::Print(_L("%d};\n"), data);
+ }
+ else
+ {
+ int data = (int)*(((VGbyte *)(dataPtr))+i);
+ RDebug::Print(_L("%d, "), data);
+ }
+
+ if (i % 10 == 0)
+ {
+ RDebug::Print(_L("\n\t"));
+ }
+ }
+
+ RDebug::Print(_L("vgImageSubData(%d, imageData%d, %d, (VGImageFormat)%d, %d, %d, %d, %d);\n"),
+ imageHandle, imageDataCount, dataStride, dataFormat, x, y, width, height);
+ }
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/src/nvg.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,1720 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder source file
+*
+*/
+
+
+#include <s32mem.h>
+#include <libc/math.h>
+#include <e32math.h>
+
+#include "nvg.h"
+#include "nvgfittoviewbox.h"
+#include "NVGUtil.h"
+
+#include "NVGCSIcon.h"
+#include "NVGTLVIcon.h"
+#include "FloatFixPt.h"
+
+#include "NVGIconData.h"
+
+/*
+ * may be we should use dynamic_cast?
+ */
+#define CSICON(icon) ((CNVGCSIcon *)icon)
+#define TLVICON(icon) ((CNVGTLVIcon *)icon)
+
+enum TNVGFormats
+ {
+ ENVGCS,
+ ENVGTLV
+ };
+
+/*
+ * NVG-CS version
+ */
+//const TInt KVersion1 = 1;
+const TInt KVersion2 = 2;
+
+/*
+ * constants for nvg file header offsets
+ */
+const TUint8 KNVG_SIGNATURE[] = "nvg";
+const TInt KNVG_SIGNATURE_LENGTH = sizeof(KNVG_SIGNATURE) - sizeof('\0');
+const TInt KNVG_COMMANDSECTION_OFS = 2;
+const TInt KNVG_VERSION_OFS = 3;
+const TInt KNVG_RGBA_OFS = 4;
+const TInt KNVG_HEADERSIZE_OFS = 4;
+const TInt KNVG_PATHDATATYPE_OFS = 26;
+const TInt KNVG_SCALE_OFS = 28;
+const TInt KNVG_BIAS_OFS = 32;
+const TInt KNVG_VIEWBOX_X_OFS = 36;
+const TInt KNVG_VIEWBOX_Y_OFS = 40;
+const TInt KNVG_VIEWBOX_WIDTH_OFS = 44;
+const TInt KNVG_VIEWBOX_HEIGHT_OFS = 48;
+
+const TInt KNVG_PAINTSECTION_LINEARGRAD_TRANSFORM_OFFSET = 20;
+const TInt KNVG_PAINTSECTION_RADIALGRAD_TRANSFORM_OFFSET = 24;
+
+/*
+ * nvg-cs commands
+ */
+const TInt KCMD_SET_FILL_PAINT = 4 << 24;
+const TInt KCMD_SET_COLOR_RAMP = 6 << 24;
+const TInt KCMD_DRAW_PATH = 7 << 24;
+const TInt KCMD_SET_TRANSFORMATION = 8 << 24;
+const TInt KCMD_SET_STROKE_PAINT = 5 << 24;
+const TInt KCMD_SET_STROKE_WIDTH = 9 << 24;
+const TInt KCMD_SET_STROKE_LINE_JOIN_CAP = 10 << 24;
+const TInt KCMD_SET_STROKE_MITER_LIMIT = 11 << 24;
+
+/*
+ * stroke cap style
+ */
+const TInt KCAP_BUTT = 1;
+const TInt KCAP_SQUARE = 2;
+const TInt KCAP_ROUND = 3;
+
+/*
+ * stroke join style
+ */
+const TInt KLINE_JOIN_BEVEL = 1;
+const TInt KLINE_JOIN_MITER = 2;
+const TInt KLINE_JOIN_ROUND = 3;
+
+/*
+ * fill paint type
+ */
+const TInt KPAINT_FLAT = 1;
+const TInt KPAINT_LGRAD = 2;
+const TInt KPAINT_RGRAD = 3;
+
+/*
+ * stroke paint type
+ */
+const TInt KSTROKE_LGRAD = 2;
+const TInt KSTROKE_RGRAD = 3;
+const TInt KSTROKE_COLOR_RAMP = 4;
+
+/*
+ * nvg offset
+ */
+const TInt KOffsetReserved1 = 6;
+
+/*
+ * transform encoding values
+ */
+const TInt KTRANSFORM_COMPLETE = 0;
+const TInt KTRANSFORM_SCALING = 2;
+const TInt KTRANSFORM_SHEARING = 4;
+const TInt KTRANSFORM_ROTATION = 8;
+const TInt KTRANSFORM_TRANSLATION = 16;
+
+#ifdef OPENVG_OBJECT_CACHING
+const VGfloat KIdentityMatrix[] =
+ {
+ 1.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f,
+ 0.0f, 0.0f ,1.0f
+ };
+#endif
+
+/*
+ * function to delete array, for basic types
+ */
+GLDEF_C void CleanupArray( TAny * aObj )
+ {
+ delete [] aObj;
+ }
+
+/*
+ * function to delete array of TFloatFixArray
+ */
+GLDEF_C void CleanupTFloatFixArray( TAny * aObj )
+ {
+ TFloatFixPt * ff = (TFloatFixPt *)aObj;
+ delete [] ff;
+ }
+
+/**
+ * @class TNVGEngineInternal
+ * This class is added to maintain BC.
+ * If you want to add new member variable you can add in this class, without breaking BC.
+ * It is better to add members which are depend on macro's in this class.
+ */
+class TNVGEngineInternal
+ {
+public:
+ TNVGEngineInternal()
+ {
+#ifdef OPENVG_OBJECT_CACHING
+ iCreatingNVGIcon = 0;
+ iCurrentNVGIcon = 0;
+#endif
+ }
+
+#ifdef OPENVG_OBJECT_CACHING
+ TInt iCreatingNVGIcon;
+ MNVGIcon * iCurrentNVGIcon;
+#endif
+ };
+
+CNvgEngine::CNvgEngine()
+ : iCurrentBufferSize(1, 1),
+ iPath(VG_INVALID_HANDLE),
+ iPaintFill(VG_INVALID_HANDLE),
+ iPaintStroke( VG_INVALID_HANDLE),
+ iUserStrokePaintColor(0xFFFFFFFF),
+ iRotateApplied(EFalse),
+ iLastPathDataType(0),
+ iPreserveAspectSetting(ENvgPreserveAspectRatio_XmidYmid),
+ iSmilFitSetting(ENvgMeet),
+ iVGImageBinder(0)
+ {
+ }
+
+EXPORT_C CNvgEngine* CNvgEngine::NewL()
+ {
+ CNvgEngine* self = new (ELeave) CNvgEngine;
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+void CNvgEngine::ConstructL()
+ {
+ vgSeti(VG_RENDERING_QUALITY, VG_RENDERING_QUALITY_BETTER);
+ vgSeti(VG_FILL_RULE, VG_NON_ZERO);
+
+ iInternal = new (ELeave) TNVGEngineInternal;
+ iPaintFill = vgCreatePaint();
+ }
+
+EXPORT_C CNvgEngine::~CNvgEngine()
+ {
+ if (iPath != VG_INVALID_HANDLE)
+ {
+ vgDestroyPath(iPath);
+ }
+
+ if (iPaintFill != VG_INVALID_HANDLE)
+ {
+ vgSetPaint(VG_INVALID_HANDLE, VG_FILL_PATH);
+ vgDestroyPaint(iPaintFill);
+ }
+
+ if (iPaintStroke != VG_INVALID_HANDLE)
+ {
+ vgSetPaint(VG_INVALID_HANDLE, VG_STROKE_PATH);
+ vgDestroyPaint(iPaintStroke);
+ }
+
+
+#ifdef OPENVG_OBJECT_CACHING
+ if (iInternal)
+ {
+ delete iInternal->iCurrentNVGIcon;
+ }
+#endif
+
+ delete iInternal;
+ }
+
+/**
+ * @brief Set the angle for rotation of the NVG graphic
+ * @version
+ * @param aAngle counter-clockwise rotation by a given angle (expressed in degrees)
+ * aX, aY point around which the rotation must take place
+ * @return None
+ */
+EXPORT_C void CNvgEngine::Rotate(TReal32 aAngle, TReal32 aCentreX, TReal32 aCentreY) __SOFTFP
+ {
+ if(aAngle)
+ {
+ iRotateApplied = ETrue;
+ iCentreX = aCentreX;
+ iCentreY = aCentreY;
+ iRotateAngle = aAngle;
+ }
+ else
+ {
+ iRotateApplied = EFalse;
+ iCentreX = 0;
+ iCentreY = 0;
+ iRotateAngle = 0;
+ }
+ }
+
+/**
+ * @brief Gets the viewbox width and height from the NVG bytedata
+ * @version
+ * @param aBuf NVG byte data of the file
+ * @return content dimension
+ */
+EXPORT_C TSize CNvgEngine::ContentDimensions(const TDesC8& aBuf)
+ {
+ if (aBuf.Length() < KNVG_VIEWBOX_HEIGHT_OFS + sizeof (TReal32))
+ {
+ return TSize(0, 0);
+ }
+
+ const TUint8* lBuf = aBuf.Ptr();
+ TReal32 lViewboxWidth = * (TReal32*)(lBuf + KNVG_VIEWBOX_WIDTH_OFS);
+ TReal32 lViewboxHeight = * (TReal32*)(lBuf + KNVG_VIEWBOX_HEIGHT_OFS);
+
+ if (lViewboxWidth > 0 && lViewboxHeight > 0)
+ {
+ return TSize(lViewboxWidth, lViewboxHeight);
+ }
+ else
+ {
+ return TSize(0, 0);
+ }
+ }
+
+TInt CNvgEngine::InitializeGC()
+ {
+ if (iPaintFill == VG_INVALID_HANDLE)
+ {
+ iPaintFill = vgCreatePaint();
+ if (iPaintFill == VG_INVALID_HANDLE)
+ {
+ return OpenVGErrorToSymbianError(vgGetError());
+ }
+ }
+
+ vgSetPaint(iPaintFill, VG_FILL_PATH);
+ if (iPaintStroke == VG_INVALID_HANDLE)
+ {
+ iPaintStroke = vgCreatePaint();
+ if (iPaintStroke == VG_INVALID_HANDLE)
+ {
+ return OpenVGErrorToSymbianError(vgGetError());
+ }
+ }
+
+ vgSetPaint( iPaintStroke, VG_STROKE_PATH);
+
+ return KErrNone;
+ }
+
+EXPORT_C void CNvgEngine::ResetNvgState()
+ {
+ if (iPath != VG_INVALID_HANDLE)
+ {
+ vgDestroyPath(iPath);
+ iPath = VG_INVALID_HANDLE;
+ }
+
+ if (iPaintFill != VG_INVALID_HANDLE)
+ {
+ vgSetPaint(VG_INVALID_HANDLE, VG_FILL_PATH);
+ vgDestroyPaint(iPaintFill);
+ iPaintFill = VG_INVALID_HANDLE;
+ }
+
+ if (iPaintStroke != VG_INVALID_HANDLE)
+ {
+ vgSetPaint(VG_INVALID_HANDLE, VG_STROKE_PATH);
+ vgDestroyPaint(iPaintStroke);
+ iPaintStroke = VG_INVALID_HANDLE;
+ }
+ }
+
+EXPORT_C TInt CNvgEngine::DrawNvg(const TDesC8& aBuf, const TSize& aSize, CFbsBitmap* aDstBitmap, CFbsBitmap* aMask)
+ {
+ TInt error = KErrNone;
+
+ /*
+ * Get Matrix modes and all caller matrices (must be restored afterwards)
+ */
+ UpdateClientMatrices();
+
+ TRAP(error, DoDrawNVGL(aBuf, aSize, aDstBitmap, aMask));
+
+ /*
+ * restore everything as we may have changed matrix mode
+ */
+ RestoreClientMatrices();
+ vgSeti(VG_SCISSORING, VG_FALSE);
+
+ if (error)
+ {
+ NVG_DEBUGP2("Error in NVG rendering %d", error);
+ }
+ return error;
+ }
+
+EXPORT_C MNVGIcon * CNvgEngine::CreateNVGIcon(const TDesC8& aBuf, const TSize& aSize)
+ {
+ NVG_DEBUGP1("Creating NVGCSIcon");
+
+ MNVGIcon * nvgIcon = 0;
+
+ /*
+ * this is bit unreadable,
+ * need to find a better design to separate the object caching solution from normal rendering,
+ * but anyway I guess its better than those ifdef's, in that code scanner won't give any warnings
+ */
+ COND_COM_OC_NOC(
+ {
+ if (iInternal->iCurrentNVGIcon)
+ {
+ delete iInternal->iCurrentNVGIcon;
+ }
+
+ iInternal->iCurrentNVGIcon = 0;
+ iInternal->iCreatingNVGIcon = 1;
+
+ if (DrawNvg(aBuf, aSize, 0, 0) != KErrNone)
+ {
+ delete iInternal->iCurrentNVGIcon;
+ iInternal->iCurrentNVGIcon = 0;
+ }
+
+ iInternal->iCreatingNVGIcon = 0;
+ nvgIcon = iInternal->iCurrentNVGIcon;
+ iInternal->iCurrentNVGIcon = 0;
+ },
+ {
+ (void)aBuf;
+ (void)aSize;
+ });
+
+ return nvgIcon;
+ }
+
+void CNvgEngine::DoDrawNVGL(const TDesC8& aBuffer, const TSize& aSize, CFbsBitmap* aDstBitmap, CFbsBitmap* aMask)
+ {
+ TInt drawStatus = KErrNone;
+
+ if (iCurrentBufferSize != aSize)
+ {
+ iCurrentBufferSize = aSize;
+ }
+
+ iDstBimtap = aDstBitmap;
+
+ TDereferencer nvgIconData(aBuffer);
+
+ TUint8 * signature = nvgIconData.DerefInt8ArrayL(KNVG_SIGNATURE_LENGTH);
+
+ // checking the 'nvg' signature
+ if (Mem::Compare(signature, KNVG_SIGNATURE_LENGTH, KNVG_SIGNATURE, KNVG_SIGNATURE_LENGTH) != 0)
+ {
+ NVG_DEBUGP1("Not an NVG icon");
+ User::Leave(KErrNotSupported);
+ }
+
+ // last two bits are for identifying the nvg type. currently nvg-cs or nvg-tlv
+ TUint16 nvgType = nvgIconData.DerefInt16L(KOffsetReserved1) & 0x03;
+
+ switch (nvgType)
+ {
+ case ENVGCS:
+ {
+ drawStatus = DrawCommandSectionL(&nvgIconData, aSize, aDstBitmap, aMask);
+ break;
+ }
+ case ENVGTLV:
+ {
+ drawStatus = DrawTLVL(aBuffer, aSize, aDstBitmap, aMask);
+ break;
+ }
+ default:
+ drawStatus = KErrNotSupported;
+ break;
+ }
+
+ User::LeaveIfError(drawStatus);
+ }
+
+TInt CNvgEngine::DrawTLVL(const TDesC8& aBuf, const TSize& aTargetSize, CFbsBitmap* /*aDstBitmap*/, CFbsBitmap * /*aMask*/)
+ {
+ TInt ret = KErrNone;
+
+ // Try to set user's matrix to path matrix
+ VGfloat origMatrix[9];
+ vgGetMatrix(origMatrix);
+
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
+ vgLoadMatrix(origMatrix);
+
+#ifndef __MIRROR_
+ vgScale(1.0f, -1.0f);
+ vgTranslate(0, (VGfloat)(-iCurrentBufferSize.iHeight));
+#endif
+
+ /*
+ * this is bit unreadable,
+ * need to find a better design to separate the object caching solution from normal rendering,
+ * but anyway I guess its better than those ifdef's, in that code scanner won't give any warnings
+ */
+ COND_COM_OC_NOC(
+ {
+ if (iInternal->iCreatingNVGIcon)
+ {
+ iInternal->iCurrentNVGIcon = CNVGTLVIcon::NewL();
+ TLVICON(iInternal->iCurrentNVGIcon)->SetVGImageBinder(iVGImageBinder);
+ TLVICON(iInternal->iCurrentNVGIcon)->CreateL(aBuf, aTargetSize);
+ }
+ else
+ {
+ CNVGTLVIcon * tlvIcon = CNVGTLVIcon::NewL();
+ CleanupStack::PushL(tlvIcon);
+ tlvIcon->SetVGImageBinder(iVGImageBinder);
+ tlvIcon->DirectDrawL(aBuf, aTargetSize);
+ CleanupStack::PopAndDestroy(tlvIcon);
+ }
+
+ },
+ {
+ CNVGTLVIcon * tlvIcon = CNVGTLVIcon::NewL();
+ CleanupStack::PushL(tlvIcon);
+ TLVICON(tlvIcon)->SetVGImageBinder(iVGImageBinder);
+ TLVICON(tlvIcon)->DirectDrawL(aBuf, aTargetSize);
+ CleanupStack::PopAndDestroy(tlvIcon);
+ });
+
+ vgSeti(VG_SCISSORING, VG_FALSE);
+
+ return ret;
+ }
+
+TInt CNvgEngine::CreatePathHandle(TInt16 aPathDataType, TReal32 aScale, TReal32 aBias)
+ {
+ (void) aScale;
+ (void) aBias;
+
+ TInt error = KErrNone;
+
+ if (iLastPathDataType != aPathDataType)
+ {
+ if (iPath != VG_INVALID_HANDLE)
+ {
+ vgDestroyPath(iPath);
+ iPath = VG_INVALID_HANDLE;
+ }
+ }
+
+ if (iPath == VG_INVALID_HANDLE)
+ {
+ switch (aPathDataType)
+ {
+ case EEightBitEncoding:
+ {
+ iPath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
+ VG_PATH_DATATYPE_S_16, 1.0f/2.0f, 0.0f, 0, 0,
+ VG_PATH_CAPABILITY_APPEND_TO);
+ }
+ break;
+
+ case ESixteenBitEncoding:
+ {
+ iPath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
+ VG_PATH_DATATYPE_S_16, 1.0f/16.0f, 0.0f, 0, 0,
+ VG_PATH_CAPABILITY_APPEND_TO);
+ }
+ break;
+
+ case EThirtyTwoBitEncoding:
+ {
+ iPath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
+ VG_PATH_DATATYPE_S_32, 1.0f/65536.0f, 0.0f, 0, 0,
+ VG_PATH_CAPABILITY_APPEND_TO);
+ }
+ break;
+
+ default:
+ {
+ return KErrCorrupt;
+ }
+ }
+ }
+
+ if( iPath == VG_INVALID_HANDLE )
+ {
+ // get the symbian error code
+ error = OpenVGErrorToSymbianError(vgGetError());
+
+ if (error == KErrNoMemory)
+ {
+ NVG_DEBUGP1("NVG Error OOM");
+ ResetNvgState();
+ }
+ return error;
+ }
+
+ iLastPathDataType = aPathDataType;
+
+ return error;
+ }
+
+TInt CNvgEngine::DrawCommandSectionL(TDereferencer * aIconData, const TSize& aTargetSize, CFbsBitmap * /*aDstBitmap*/, CFbsBitmap * /*aMask*/)
+ {
+ TInt16 lHeaderSize = aIconData->DerefInt16L(KNVG_HEADERSIZE_OFS);
+ TInt8 NVGVersion = aIconData->DerefInt8L(KNVG_VERSION_OFS);
+
+ User::LeaveIfError(InitializeGC());
+
+ TInt16 lPathDataType = aIconData->DerefInt16L(KNVG_PATHDATATYPE_OFS);
+ TReal32 lScale = aIconData->DerefReal32L(KNVG_SCALE_OFS);
+ TReal32 lBias = aIconData->DerefReal32L(KNVG_BIAS_OFS);
+
+ User::LeaveIfError(CreatePathHandle(lPathDataType, lScale, lBias));
+
+ vgSetPaint(iPaintFill, VG_FILL_PATH);
+
+ COND_COM_OC_OOC(
+ if (iInternal->iCreatingNVGIcon)
+ {
+ iInternal->iCurrentNVGIcon = CNVGCSIcon::NewL(aIconData->GetPtr());
+ });
+
+ VGfloat lCurrentPathMatrix[9];
+ vgGetMatrix(lCurrentPathMatrix);
+
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
+
+ /*
+ * We use the caller's base batrix regardless of which mode the caller was.
+ * The caller may have set the matrix in VG_MATRIX_IMAGE_USER_TO_SURFACE mode
+ * as it thinks it is drawing images (textures).
+ * But even though the texture gets stroked instead, we must use the caller's
+ * transformation matrix.
+ * Everything gets restored to the original values before we return.
+ */
+ vgLoadMatrix(lCurrentPathMatrix);
+
+ ApplyScissoring(lCurrentPathMatrix, aTargetSize);
+
+ /*
+ * set the rotation angle if available
+ */
+ if (iRotateApplied)
+ {
+ ApplyRotation();
+ }
+
+#ifdef __MIRROR_
+ vgScale(1.0f, -1.0f);
+ vgTranslate(0, (VGfloat)(-iCurrentBufferSize.iHeight) );
+#endif
+
+ TReal32 lViewboxX = aIconData->DerefReal32L(KNVG_VIEWBOX_X_OFS);
+ TReal32 lViewboxY = aIconData->DerefReal32L(KNVG_VIEWBOX_Y_OFS);
+ TReal32 lViewboxW = aIconData->DerefReal32L(KNVG_VIEWBOX_WIDTH_OFS);
+ TReal32 lViewboxH = aIconData->DerefReal32L(KNVG_VIEWBOX_HEIGHT_OFS);
+
+ ApplyViewboxToViewPortTransformationL(aTargetSize, lViewboxX, lViewboxY, lViewboxW, lViewboxH);
+
+ TPtr8 ptr = aIconData->GetPtr();
+
+ TInt offsetSectionLength = aIconData->GetLength() - lHeaderSize;
+ TUint8 * offsetPtr = aIconData->DerefInt8ArrayL(offsetSectionLength, lHeaderSize);
+
+ TDereferencer offsetSection(offsetPtr, offsetSectionLength);
+
+ TUint16 lOffsetVectorCount = offsetSection.DerefInt16L();
+
+ offsetPtr = aIconData->DerefInt8ArrayL(offsetSectionLength - sizeof(TUint16), lHeaderSize + sizeof(TUint16));
+ TDereferencer offsetVector(offsetPtr, offsetSectionLength - sizeof(TUint16));
+
+ idoFill = VG_FALSE;
+ idoStroke = VG_FALSE;
+
+ TPtr8 offsetTPtr = offsetVector.GetPtr();
+
+ TInt commandSectionOffset = lOffsetVectorCount * sizeof(TUint16);
+ TDereferencer commandSection((unsigned char*)(offsetTPtr.Ptr() + commandSectionOffset),
+ aIconData->GetLength() - commandSectionOffset - lHeaderSize - sizeof(TUint16));
+
+ // from version 2 onwards command section will start on word boundary
+ if (NVGVersion >= KVersion2 && ((lOffsetVectorCount & 0x01) == 0))
+ {
+ commandSection.SkipL(2);
+ }
+
+ TUint16 lCmdCount = commandSection.DerefInt16L();
+
+ commandSection.SkipL(KNVG_COMMANDSECTION_OFS);
+
+ /*
+ * from version 2 onwards there will be a padding added
+ * after the command count to make it word aligned
+ */
+ if (NVGVersion >= KVersion2)
+ {
+ commandSection.SkipL(2);
+ }
+
+ ExecuteNVGCSCommandLoopL(lCmdCount, aIconData, &offsetVector, &commandSection, NVGVersion);
+
+ return KErrNone;
+ }
+
+void CNvgEngine::ApplyRotation()
+ {
+ vgTranslate(iCentreX, iCentreY);
+ vgRotate(iRotateAngle);
+ vgTranslate(-iCentreX, -iCentreY);
+ }
+
+void CNvgEngine::ApplyScissoring(VGfloat aMatrix[], const TSize& aTargetSize)
+ {
+ /*
+ * calculate the rectangle with respect to the transformation applied
+ * and set the scissoring rect
+ */
+ TPoint leftBottom = GetTranslatedPoint(aMatrix, TPoint(0, 0));
+ TPoint leftTop = GetTranslatedPoint(aMatrix, TPoint(0, aTargetSize.iHeight));
+ TPoint rightBottom = GetTranslatedPoint(aMatrix, TPoint(aTargetSize.iWidth, 0));
+ TPoint rightTop = GetTranslatedPoint(aMatrix, TPoint(aTargetSize.iWidth,aTargetSize.iHeight));
+
+ VGfloat minX = leftBottom.iX;
+ VGfloat minY = leftBottom.iY;
+ VGfloat maxX = leftBottom.iX;
+ VGfloat maxY = leftBottom.iY;
+
+ minX = MinVal4(leftBottom.iX, leftTop.iX, rightBottom.iX, rightTop.iX);
+ minY = MinVal4(leftBottom.iY, leftTop.iY, rightBottom.iY, rightTop.iY);
+
+ maxX = MaxVal4(leftBottom.iX, leftTop.iX, rightBottom.iX, rightTop.iX);
+ maxY = MaxVal4(leftBottom.iY, leftTop.iY, rightBottom.iY, rightTop.iY);
+
+ VGfloat newW = maxX - minX;
+ VGfloat newH = maxY - minY;
+
+ VGint clipRect[] = {minX, minY, newW, newH};
+
+ vgSeti(VG_SCISSORING, VG_TRUE);
+ vgSetiv(VG_SCISSOR_RECTS, 4,(const TInt32*) clipRect);
+ }
+
+void CNvgEngine::ApplyViewboxToViewPortTransformationL(const TSize& aTargetSize, TReal32 aViewboxX, TReal32 aViewboxY, TReal32 aViewboxW, TReal32 aViewboxH)
+ {
+ CNvgFitToViewBoxImpl * viewboxTrnsfr = CNvgFitToViewBoxImpl::NewL();
+ CleanupStack::PushL(viewboxTrnsfr);
+ /*
+ * this is bit unreadable,
+ * need to find a better design to separate the object caching solution from normal rendering,
+ * but anyway I guess its better than those ifdef's, in that code scanner won't give any warnings
+ */
+ COND_COM_OC_NOC(
+ {
+ if (iInternal->iCreatingNVGIcon)
+ {
+ CSICON(iInternal->iCurrentNVGIcon)->SetViewBox(aViewboxX, aViewboxY, aViewboxW, aViewboxH);
+ CSICON(iInternal->iCurrentNVGIcon)->SetPreserveAspectRatio(iPreserveAspectSetting, iSmilFitSetting);
+ CSICON(iInternal->iCurrentNVGIcon)->Rotate(iRotateAngle, iCentreX, iCentreY);
+ }
+ else
+ {
+ viewboxTrnsfr->SetAlign(iPreserveAspectSetting);
+ viewboxTrnsfr->SetScaling(iSmilFitSetting);
+
+ if (aViewboxW > 0 && aViewboxH > 0)
+ {
+ viewboxTrnsfr->SetViewBox(aViewboxX, aViewboxY, aViewboxW, aViewboxH);
+ }
+
+ TInt lWidth = aTargetSize.iWidth;
+ TInt lHeight = aTargetSize.iHeight;
+
+ viewboxTrnsfr->SetWindowViewportTrans(TRect(0, 0, lWidth, lHeight), TSize(0, 0));
+
+ }
+ },
+ {
+ viewboxTrnsfr->SetAlign(iPreserveAspectSetting);
+ viewboxTrnsfr->SetScaling(iSmilFitSetting);
+
+ if (aViewboxW > 0 && aViewboxH > 0)
+ {
+ viewboxTrnsfr->SetViewBox(aViewboxX, aViewboxY, aViewboxW, aViewboxH);
+ }
+
+ TInt lWidth = aTargetSize.iWidth;
+ TInt lHeight = aTargetSize.iHeight;
+
+ viewboxTrnsfr->SetWindowViewportTrans(TRect(0, 0, lWidth, lHeight), TSize(0, 0));
+ });
+
+ CleanupStack::PopAndDestroy(viewboxTrnsfr);
+ }
+
+TDereferencer GetCommandSectionL(TUint16 aOffset, TDereferencer * aIconData, TInt aNVGVersion)
+ {
+ // the max length that the command section can have
+ TInt commandSectionLength = aIconData->GetLength() - aOffset;
+
+ if (commandSectionLength <= 0)
+ {
+ User::Leave(KErrCorrupt);
+ }
+
+ TDereferencer section(aIconData->DerefInt8ArrayL(commandSectionLength, aOffset), commandSectionLength);
+
+ /*
+ * all the section are expected to be word aligned
+ * all of the nvg-cs icon will be version 2 or above
+ * the else won't be there as nvg version will always be greater than 2
+ */
+ if (aNVGVersion >= KVersion2)
+ {
+ if (!IsAligned4(aOffset))
+ {
+ User::Leave(KErrCorrupt);
+ }
+ }
+ else
+ {
+ /*
+ * no need to do anything here as once the nvgdecoder release
+ * its version will be always greater than 2
+ * infact the check for version will be removed
+ */
+ }
+
+ return section;
+ }
+
+void CNvgEngine::ExecuteNVGCSCommandLoopL(TUint16 aCommandCount, TDereferencer * aIconData, TDereferencer * aOffsetVector,
+ TDereferencer * aCommandSection, TInt aNVGVersion)
+ {
+ TUint32 transVal;
+
+ VGfloat lCurrentPathMatrix[9];
+
+ vgGetMatrix(lCurrentPathMatrix);
+
+ TInt32 lOffsetIx = 0;
+ for (TInt i=0; i < aCommandCount; i++)
+ {
+ TUint32 currentCommand = aCommandSection->DerefInt32L();
+ lOffsetIx = currentCommand & 0x0000ffff;
+
+ switch (currentCommand & 0xff000000)
+ {
+ case KCMD_SET_FILL_PAINT:
+ {
+ iFillAlpha = (currentCommand & 0x00ff0000) >> 16;
+ TUint16 offset = aOffsetVector->DerefInt16L(lOffsetIx * sizeof(TUint16));
+
+ TDereferencer section = GetCommandSectionL(offset, aIconData, aNVGVersion);
+
+ SetFillPaintL(§ion);
+
+ break;
+ }
+
+ case KCMD_SET_COLOR_RAMP:
+ {
+ TUint16 offset = aOffsetVector->DerefInt16L(lOffsetIx * sizeof(TUint16));
+
+ TDereferencer section = GetCommandSectionL(offset, aIconData, aNVGVersion);
+
+ SetColorRampL(§ion);
+
+ break;
+ }
+
+ case KCMD_DRAW_PATH:
+ {
+ if ((currentCommand & 0x00010000))
+ {
+ idoStroke = VG_TRUE;
+ }
+
+ if ((currentCommand & 0x00020000))
+ {
+ idoFill = VG_TRUE;
+ }
+
+ if (idoStroke != VG_FALSE || idoFill != VG_FALSE)
+ {
+ TUint16 offset = aOffsetVector->DerefInt16L(lOffsetIx * sizeof(TUint16));
+ TDereferencer section = GetCommandSectionL(offset, aIconData, aNVGVersion);
+
+ DrawPathL(§ion);
+ }
+
+ break;
+ }
+
+ case KCMD_SET_TRANSFORMATION:
+ {
+ SetTransformL(aCommandSection, transVal, lCurrentPathMatrix);
+ aCommandSection->SkipL(transVal * sizeof(TUint32));
+ break;
+ }
+
+ case KCMD_SET_STROKE_PAINT:
+ {
+ iStrokeAlpha = (currentCommand & 0x00ff0000) >> 16;
+ TUint16 offset = aOffsetVector->DerefInt16L(lOffsetIx * sizeof(TUint16));
+
+ TDereferencer section = GetCommandSectionL(offset, aIconData, aNVGVersion);
+
+ SetStrokePaintL(§ion);
+
+ break;
+ }
+
+ case KCMD_SET_STROKE_WIDTH:
+ {
+ TReal32 lStrokeWidth;
+ aCommandSection->SkipL(sizeof(TUint32));
+
+ /*
+ * check for alignment and copy data if not aligned, else directly convert
+ * version 2 or above guarantees that is always word aligned
+ */
+ TUint8 * cptr = aCommandSection->DerefInt8ArrayL(sizeof(TReal32), 0);
+ if (aNVGVersion < KVersion2 && !IsAligned4(cptr))
+ {
+
+ Mem::Copy(reinterpret_cast<void *>(&lStrokeWidth),
+ reinterpret_cast<void *>(cptr), sizeof(lStrokeWidth));
+ }
+ else
+ {
+ lStrokeWidth = aCommandSection->DerefReal32L();
+ }
+
+ COND_COM_OC(iInternal->iCreatingNVGIcon,
+ CSICON(iInternal->iCurrentNVGIcon)->AddSetStrokeWidthCommandL(lStrokeWidth),
+ vgSetf(VG_STROKE_LINE_WIDTH, lStrokeWidth));
+ break;
+ }
+
+ case KCMD_SET_STROKE_MITER_LIMIT:
+ {
+ TReal32 lMiterLimit;
+ aCommandSection->SkipL(sizeof(TUint32));
+
+ /*
+ * check for alignment and copy data if not aligned, else directly convert
+ * version 2 or above guarantees that is always word aligned
+ */
+ TUint8 * cptr = aCommandSection->DerefInt8ArrayL(sizeof(TReal32), 0);
+
+ if (aNVGVersion < KVersion2 && !IsAligned4(cptr))
+ {
+ Mem::Copy(reinterpret_cast<void *>(&lMiterLimit),
+ reinterpret_cast<void *>(cptr), sizeof(lMiterLimit));
+ }
+ else
+ {
+ lMiterLimit = aCommandSection->DerefReal32L();
+ }
+
+ COND_COM_OC(iInternal->iCreatingNVGIcon,
+ CSICON(iInternal->iCurrentNVGIcon)->AddSetStrokeMiterLimitCommandL(lMiterLimit),
+ vgSetf(VG_STROKE_MITER_LIMIT, lMiterLimit));
+
+ break;
+ }
+
+ case KCMD_SET_STROKE_LINE_JOIN_CAP:
+ {
+ TUint8 lJoinType =(currentCommand & 0x0000ff00)>>8;
+ TUint8 lCapType = (currentCommand & 0x000000ff);
+
+ VGCapStyle capStyle;
+ switch(lCapType)
+ {
+ case KCAP_SQUARE:
+ capStyle = VG_CAP_SQUARE;
+ break;
+ case KCAP_ROUND:
+ capStyle = VG_CAP_ROUND;
+ break;
+ case KCAP_BUTT:
+ default:
+ capStyle = VG_CAP_BUTT;
+ break;
+ }
+
+ VGJoinStyle lineJoinStyle;
+ switch(lJoinType)
+ {
+ case KLINE_JOIN_BEVEL:
+ lineJoinStyle = VG_JOIN_BEVEL;
+ break;
+ case KLINE_JOIN_ROUND:
+ lineJoinStyle = VG_JOIN_ROUND;
+ break;
+ case KLINE_JOIN_MITER:
+ default:
+ lineJoinStyle = VG_JOIN_MITER;
+ break;
+ }
+
+ COND_COM_OC(iInternal->iCreatingNVGIcon,
+ CSICON(iInternal->iCurrentNVGIcon)->AddStrokeLineJoinCapCommandL(capStyle, lineJoinStyle),
+ vgSeti(VG_STROKE_CAP_STYLE, capStyle);
+ vgSeti(VG_STROKE_JOIN_STYLE, lineJoinStyle););
+ break;
+ }
+
+ default:
+ {
+ User::Leave(KErrCorrupt);
+ break;
+ }
+ }
+
+ // go to the next command
+ aCommandSection->SkipL(sizeof(TUint32));
+ }
+ }
+
+EXPORT_C void CNvgEngine::SetPreserveAspectRatio(
+ TNvgAlignStatusType aPreserveAspectSetting,
+ TNvgMeetOrSliceType aSmilFitSetting)
+ {
+ iPreserveAspectSetting = aPreserveAspectSetting;
+ iSmilFitSetting = aSmilFitSetting;
+ }
+
+EXPORT_C void CNvgEngine::SetBackgroundColor(TUint32 aRGBA8888Color)
+ {
+ iBackgroundColor = aRGBA8888Color;
+ }
+
+TInt CNvgEngine::SetFillPaintL(TDereferencer * aIconData)
+ {
+ COND_COM_OC_OOC(register int drawingMode = iInternal->iCreatingNVGIcon);
+
+ TUint32 lCommonData = aIconData->DerefInt32L();
+ TUint lPaintType = lCommonData & 0x07;
+ TUint16 lSpecifcData = (lCommonData >> 16) & 0xff;
+
+ switch (lPaintType)
+ {
+ case KPAINT_LGRAD:
+ {
+ iGradPaintFill = iPaintFill;
+
+ COND_COM_OC_OOC(
+ if (iInternal->iCreatingNVGIcon)
+ {
+ // CNVGCSIcon will destroy the paint handle
+ iGradPaintFill = vgCreatePaint();
+ if (iGradPaintFill == VG_INVALID_HANDLE)
+ {
+ User::LeaveIfError(CNvgEngine::OpenVGErrorToSymbianError(vgGetError()));
+ }
+ });
+
+ // gradient data, the data will be word aligned
+ TReal32* lGradData = (TReal32*)aIconData->DerefInt8ArrayL(4 * sizeof(VGfloat), sizeof(TUint32));
+
+ vgSetParameteri(iGradPaintFill, VG_PAINT_TYPE, VG_PAINT_TYPE_LINEAR_GRADIENT);
+ vgSetParameterfv(iGradPaintFill, VG_PAINT_LINEAR_GRADIENT, 4, lGradData);
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_FILL_PAINT_TO_USER);
+
+ if (lSpecifcData & 0x1)
+ {
+ TReal32* lGradMatrix1 = (TReal32*) aIconData->DerefInt8ArrayL(6 * sizeof (VGfloat),
+ KNVG_PAINTSECTION_LINEARGRAD_TRANSFORM_OFFSET);
+
+ TReal32 lGradMatrix[9] = {lGradMatrix1[0], lGradMatrix1[3], 0.0f,
+ lGradMatrix1[1], lGradMatrix1[4], 0.0f,
+ lGradMatrix1[2], lGradMatrix1[5], 1.0f};
+
+ COND_COM_OC(drawingMode,
+ CSICON(iInternal->iCurrentNVGIcon)->AddLinearGradientCommandL(4, lGradData, lGradMatrix, iGradPaintFill),
+ vgLoadMatrix(lGradMatrix););
+ }
+ else
+ {
+ COND_COM_OC(drawingMode,
+ CSICON(iInternal->iCurrentNVGIcon)->AddLinearGradientCommandL(4, lGradData, (VGfloat*)KIdentityMatrix, iGradPaintFill),
+ vgLoadIdentity());
+ }
+
+ COND_COM_OC(drawingMode, ;,
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE));
+
+ break;
+ }
+
+ case KPAINT_RGRAD:
+ {
+ // gradient data, the data will be word aligned
+ TReal32* lGradData = (TReal32*)aIconData->DerefInt8ArrayL(5 * sizeof(VGfloat), sizeof(TUint32));
+ iGradPaintFill = iPaintFill;
+
+ COND_COM_OC_OOC(
+ if (iInternal->iCreatingNVGIcon)
+ {
+ iGradPaintFill = vgCreatePaint();
+ if (iGradPaintFill == VG_INVALID_HANDLE)
+ {
+ User::LeaveIfError(CNvgEngine::OpenVGErrorToSymbianError(vgGetError()));
+ }
+ });
+
+ vgSetParameteri(iGradPaintFill, VG_PAINT_TYPE, VG_PAINT_TYPE_RADIAL_GRADIENT);
+ vgSetParameterfv(iGradPaintFill, VG_PAINT_RADIAL_GRADIENT, 5, lGradData);
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_FILL_PAINT_TO_USER);
+
+
+ if (lSpecifcData & 0x1)
+ {
+ TReal32* lGradMatrix1 = (TReal32*)aIconData->DerefInt8ArrayL(6 * sizeof (VGfloat),
+ KNVG_PAINTSECTION_RADIALGRAD_TRANSFORM_OFFSET);
+
+ TReal32 lGradMatrix[9] = {lGradMatrix1[0], lGradMatrix1[3], 0.0f,
+ lGradMatrix1[1], lGradMatrix1[4], 0.0f,
+ lGradMatrix1[2], lGradMatrix1[5], 1.0f};
+
+ COND_COM_OC(drawingMode,
+ CSICON(iInternal->iCurrentNVGIcon)->AddRadialGradientCommandL(5, lGradData, lGradMatrix, iGradPaintFill),
+ vgLoadMatrix(lGradMatrix));
+ }
+ else
+ {
+ COND_COM_OC(drawingMode,
+ CSICON(iInternal->iCurrentNVGIcon)->AddRadialGradientCommandL(5, lGradData, (VGfloat*)KIdentityMatrix, iGradPaintFill),
+ vgLoadIdentity());
+ }
+
+ COND_COM_OC(drawingMode, ;,
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE));
+ break;
+ }
+
+ case KPAINT_FLAT:
+ {
+ TUint32 lRgba = aIconData->DerefInt32L(KNVG_RGBA_OFS);
+
+ lRgba = (lRgba & 0xffffff00) | iFillAlpha;
+
+ COND_COM_OC(drawingMode,
+ CSICON(iInternal->iCurrentNVGIcon)->AddSetColorCommandL(lRgba),
+ vgSetParameteri(iPaintFill, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
+ vgSetColor(iPaintFill, lRgba));
+ break;
+ }
+
+ default:
+ {
+ User::Leave(KErrCorrupt);
+ break;
+ }
+ }
+ return KErrNone;
+ }
+
+TInt CNvgEngine::SetColorRampL(TDereferencer * aIconData)
+ {
+ TUint32 lCommonData = aIconData->DerefInt32L();
+
+ TInt lStopCount = (lCommonData >> 16) & 0x00ff;
+ TReal32* lStopData = (TReal32*)aIconData->DerefInt8ArrayL(lStopCount * 5 * sizeof(TReal32), sizeof(TUint32));
+
+ VGfloat * colorRamps = new (ELeave) VGfloat[lStopCount * 5];
+ CleanupStack::PushL(TCleanupItem(CleanupArray, colorRamps));
+
+ if (iFillAlpha == 0xff)
+ {
+ vgSetParameteri(iGradPaintFill, VG_PAINT_COLOR_RAMP_SPREAD_MODE, VG_COLOR_RAMP_SPREAD_PAD);
+ vgSetParameterfv(iGradPaintFill, VG_PAINT_COLOR_RAMP_STOPS, lStopCount * 5, lStopData);
+ }
+ else
+ {
+ // Copy color ramps and modify alpha
+ memcpy(colorRamps, lStopData, lStopCount * 5 * sizeof(VGfloat));
+
+ VGfloat lAlphaInFloat = iFillAlpha * (1.0f/255.0f);
+ VGfloat* lAlphaValue = &colorRamps[4];
+
+ for (int i=0; i<lStopCount; i++)
+ {
+ *lAlphaValue *= lAlphaInFloat;
+ lAlphaValue += 5;
+ }
+
+ vgSetParameteri(iGradPaintFill, VG_PAINT_COLOR_RAMP_SPREAD_MODE, VG_COLOR_RAMP_SPREAD_PAD);
+ vgSetParameterfv(iGradPaintFill, VG_PAINT_COLOR_RAMP_STOPS, lStopCount * 5, colorRamps);
+ }
+
+ CleanupStack::PopAndDestroy();
+ return KErrNone;
+ }
+
+void CNvgEngine::SetStrokePaintL(TDereferencer * aIconData)
+ {
+ COND_COM_OC_OOC(register int drawingMode = iInternal->iCreatingNVGIcon;);
+
+ TUint32 lCommonData = aIconData->DerefInt32L();
+ TUint lStrokeType = lCommonData & 0x07;
+ TUint16 lSpecifcData = (lCommonData >> 16) & 0xff;
+
+ switch (lStrokeType)
+ {
+ case KSTROKE_LGRAD:
+ {
+ iGradPaintStroke = iPaintStroke;
+
+ COND_COM_OC_OOC(
+ if (iInternal->iCreatingNVGIcon)
+ {
+ iGradPaintStroke = vgCreatePaint();
+ User::LeaveIfNull((TAny *)iGradPaintStroke);
+ });
+
+ // gradient data, the data will be word aligned
+ TReal32* lGradData = (TReal32*)aIconData->DerefInt8ArrayL(4 * sizeof(VGfloat), sizeof(TUint32));
+
+ COND_COM_OC(drawingMode, ;,
+ vgSetParameteri( iGradPaintStroke, VG_PAINT_TYPE, VG_PAINT_TYPE_LINEAR_GRADIENT );
+ vgSetParameterfv( iGradPaintStroke, VG_PAINT_LINEAR_GRADIENT, 4, lGradData);
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_STROKE_PAINT_TO_USER));
+
+ if (lSpecifcData & 0x1)
+ {
+ TReal32* lGradMatrix1 = (TReal32*)aIconData->DerefInt8ArrayL(6 * sizeof(VGfloat),
+ 4 + 4 * sizeof(VGfloat));
+ TReal32 lGradMatrix[9] = {lGradMatrix1[0], lGradMatrix1[3], 0.0f,
+ lGradMatrix1[1], lGradMatrix1[4], 0.0f,
+ lGradMatrix1[2], lGradMatrix1[5], 1.0f};
+
+ COND_COM_OC(drawingMode,
+ CSICON(iInternal->iCurrentNVGIcon)->AddStrokeLinearGradientCommandL(4, lGradData, lGradMatrix, iGradPaintStroke),
+ vgLoadMatrix(lGradMatrix));
+ }
+ else
+ {
+ COND_COM_OC(drawingMode,
+ CSICON(iInternal->iCurrentNVGIcon)->AddStrokeLinearGradientCommandL(4, lGradData, (VGfloat*)KIdentityMatrix, iGradPaintStroke),
+ vgLoadIdentity());
+ }
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
+ break;
+ }
+
+ case KSTROKE_RGRAD:
+ {
+ iGradPaintStroke = iPaintStroke;
+
+ COND_COM_OC_OOC(
+ if (iInternal->iCreatingNVGIcon)
+ {
+ iGradPaintStroke = vgCreatePaint();
+ User::LeaveIfNull((TAny *)iGradPaintStroke);
+ });
+
+ // gradient data, the data will be word aligned
+ TReal32* lGradData = (TReal32*)aIconData->DerefInt8ArrayL(5 * sizeof(VGfloat), sizeof(TUint32));
+
+ COND_COM_OC(drawingMode, ;,
+ vgSetParameteri( iGradPaintStroke, VG_PAINT_TYPE, VG_PAINT_TYPE_RADIAL_GRADIENT );
+ vgSetParameterfv( iGradPaintStroke, VG_PAINT_RADIAL_GRADIENT, 5, lGradData);
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_STROKE_PAINT_TO_USER));
+
+ if (lSpecifcData & 0x1)
+ {
+ TReal32* lGradMatrix1 = (TReal32*)aIconData->DerefInt8ArrayL(6 * sizeof(VGfloat),
+ 4 + 5 * sizeof(VGfloat));
+ TReal32 lGradMatrix[9] = {lGradMatrix1[0], lGradMatrix1[3], 0.0f,
+ lGradMatrix1[1], lGradMatrix1[4], 0.0f,
+ lGradMatrix1[2], lGradMatrix1[5], 1.0f};
+
+ COND_COM_OC(drawingMode,
+ CSICON(iInternal->iCurrentNVGIcon)->AddStrokeRadialGradientCommandL(4, lGradData, lGradMatrix, iGradPaintStroke),
+ vgLoadMatrix(lGradMatrix));
+ }
+ else
+ {
+ COND_COM_OC(drawingMode,
+ CSICON(iInternal->iCurrentNVGIcon)->AddStrokeRadialGradientCommandL(4, lGradData, (VGfloat*)KIdentityMatrix, iGradPaintStroke),
+ vgLoadIdentity());
+ }
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
+ break;
+ }
+
+ case KSTROKE_COLOR_RAMP:
+ {
+ TInt lStopCount = lSpecifcData;
+ TReal32* lStopData = (TReal32*) aIconData->DerefInt8ArrayL(lStopCount * 5 * sizeof(VGfloat), 4);
+
+ if (iStrokeAlpha == 0xff)
+ {
+ vgSetParameteri(iGradPaintStroke, VG_PAINT_COLOR_RAMP_SPREAD_MODE, VG_COLOR_RAMP_SPREAD_PAD);
+ vgSetParameterfv(iGradPaintStroke, VG_PAINT_COLOR_RAMP_STOPS, lStopCount*5, lStopData);
+ }
+ else
+ {
+ VGfloat * colorRamps = new (ELeave) VGfloat[lStopCount * 5];
+ CleanupStack::PushL(TCleanupItem(CleanupArray, colorRamps));
+
+ memcpy(colorRamps, lStopData, lStopCount * 5 * sizeof(VGfloat));
+
+ VGfloat lAlphaInFloat = iStrokeAlpha * (1.0f/255.0f);
+ VGfloat* lAlphaValue = &colorRamps[4];
+
+ for (int i=0; i<lStopCount; i++)
+ {
+ *lAlphaValue *= lAlphaInFloat;
+ lAlphaValue += 5;
+ }
+
+ vgSetParameteri(iGradPaintStroke, VG_PAINT_COLOR_RAMP_SPREAD_MODE, VG_COLOR_RAMP_SPREAD_PAD);
+ vgSetParameterfv(iGradPaintStroke, VG_PAINT_COLOR_RAMP_STOPS, lStopCount * 5, colorRamps);
+ CleanupStack::PopAndDestroy();
+ }
+ break;
+ }
+
+ default:
+ {
+ TUint32 lRgba = aIconData->DerefInt32L(KNVG_RGBA_OFS);
+ lRgba = (lRgba & 0xffffff00)|iStrokeAlpha; // replace alpha
+
+ COND_COM_OC(drawingMode,
+ CSICON(iInternal->iCurrentNVGIcon)->AddStrokeSetColorCommandL(lRgba),
+ vgSetParameteri( iPaintStroke, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR );
+ vgSetColor(iPaintStroke, lRgba));
+ break;
+ }
+ }
+ }
+
+void CNvgEngine::DrawPathL(TDereferencer * aIconData)
+ {
+ TInt numSegments = aIconData->DerefInt16L();
+ const VGubyte * pathSegments = aIconData->DerefInt8ArrayL(numSegments, sizeof(TUint16));
+
+ /*
+ * verify that what we got is proper data
+ * for that calculate the path co-ordinate length
+ * and check that the path data does not overflow
+ */
+ TInt coordinateCount = 0;
+ for (TInt i = 0; i < numSegments; ++i)
+ {
+ switch (pathSegments[i])
+ {
+ case VG_HLINE_TO:
+ case VG_VLINE_TO:
+ coordinateCount += 1;
+ break;
+ case VG_MOVE_TO:
+ case VG_LINE_TO:
+ case VG_SQUAD_TO:
+ coordinateCount += 2;
+ break;
+ case VG_QUAD_TO:
+ case VG_SCUBIC_TO:
+ coordinateCount += 4;
+ break;
+ case VG_SCCWARC_TO:
+ case VG_SCWARC_TO:
+ case VG_LCCWARC_TO:
+ case VG_LCWARC_TO:
+ coordinateCount += 5;
+ break;
+ case VG_CUBIC_TO:
+ coordinateCount += 6;
+ break;
+ default:
+ break;
+ }
+ }
+
+ // this one is just to check the alignment
+ TUint8* pathData = aIconData->DerefInt8ArrayL(sizeof(TUint32), sizeof(TUint16) + numSegments);
+
+ /*
+ * path data need to be word aligned
+ * alignment are done according to the path format
+ */
+ TUint sizeofpathdata = sizeof(TUint32);
+ TUint alignSkip = 0;
+ TUint8 * alignedPtr = 0;
+ if (iLastPathDataType == ESixteenBitEncoding)
+ {
+ alignedPtr = Align2(pathData);
+ sizeofpathdata = sizeof(TUint16);
+ }
+ else if (iLastPathDataType == EThirtyTwoBitEncoding)
+ {
+ alignedPtr = Align4(pathData);
+ }
+ else
+ {
+ User::Leave(KErrCorrupt); // no other path data type is supported
+ }
+
+ alignSkip = alignedPtr - pathData;
+
+ /*
+ * check to see whether we have enough path data
+ */
+ aIconData->IsSafeL(coordinateCount * sizeofpathdata + alignSkip, sizeof(TUint16) + numSegments);
+
+ pathData = alignedPtr;
+
+ VGint paintMode = (idoFill ? VG_FILL_PATH : 0)|(idoStroke ? VG_STROKE_PATH : 0);
+ if (paintMode == 0)
+ {
+ paintMode = VG_FILL_PATH;
+ }
+
+ COND_COM_OC(iInternal->iCreatingNVGIcon,
+ {
+ VGPath path = CreatePath();
+
+ if (path != VG_INVALID_HANDLE)
+ {
+ vgAppendPathData(path, numSegments, pathSegments, pathData);
+ }
+ else
+ {
+ CSICON(iInternal->iCurrentNVGIcon)->AddPathDataL(numSegments, pathSegments, pathData);
+ }
+ CSICON(iInternal->iCurrentNVGIcon)->AddDrawPathCommandL(path, paintMode);
+ },
+ {
+ vgClearPath(iPath, VG_PATH_CAPABILITY_APPEND_TO);
+
+ vgAppendPathData(iPath, numSegments, pathSegments, pathData);
+ vgDrawPath(iPath, paintMode);
+ });
+
+ idoStroke = VG_FALSE;
+ idoFill = VG_FALSE;
+ }
+
+#ifdef OPENVG_OBJECT_CACHING
+VGPath CNvgEngine::CreatePath()
+ {
+ VGPath path = VG_INVALID_HANDLE;
+ switch (iLastPathDataType)
+ {
+ case EEightBitEncoding:
+ {
+ path = vgCreatePath(VG_PATH_FORMAT_STANDARD,
+ VG_PATH_DATATYPE_S_16, 1.0f/2.0f, 0.0f, 0, 0,
+ VG_PATH_CAPABILITY_APPEND_TO);
+ }
+ break;
+
+ case ESixteenBitEncoding:
+ {
+ path = vgCreatePath(VG_PATH_FORMAT_STANDARD,
+ VG_PATH_DATATYPE_S_16, 1.0f/16.0f, 0.0f, 0, 0,
+ VG_PATH_CAPABILITY_APPEND_TO);
+ }
+ break;
+
+ case EThirtyTwoBitEncoding:
+ {
+ path = vgCreatePath(VG_PATH_FORMAT_STANDARD,
+ VG_PATH_DATATYPE_S_32, 1.0f/65536.0f, 0.0f, 0, 0,
+ VG_PATH_CAPABILITY_APPEND_TO);
+ }
+ break;
+
+ default:
+ {
+
+ }
+ break;
+ }
+ return path;
+ }
+#endif
+
+void CNvgEngine::SetTransformL(TDereferencer * aIconData, TUint32 & aCounter, const VGfloat* aCurrentMatrix)
+ {
+
+ COND_COM_OC(iInternal->iCreatingNVGIcon, ;,
+ vgLoadMatrix(aCurrentMatrix));
+
+ TUint32 lCommonData = aIconData->DerefInt32L();
+ TUint32 lTransformType = (lCommonData & 0x00ff0000)>>16 ;
+
+ VGfloat matrixTemp[9] = {
+ 1.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f };
+
+ aCounter = 0;
+
+ if (lTransformType != 1)
+ {
+ if (lTransformType == KTRANSFORM_COMPLETE)
+ {
+ matrixTemp[0] = aIconData->DerefReal32L((++aCounter) * sizeof (VGfloat));
+ matrixTemp[4] = aIconData->DerefReal32L((++aCounter) * sizeof (VGfloat));
+ matrixTemp[3] = aIconData->DerefReal32L((++aCounter) * sizeof (VGfloat));
+ matrixTemp[1] = aIconData->DerefReal32L((++aCounter) * sizeof (VGfloat));
+ matrixTemp[6] = aIconData->DerefReal32L((++aCounter) * sizeof (VGfloat));
+ matrixTemp[7] = aIconData->DerefReal32L((++aCounter) * sizeof (VGfloat));
+ }
+ else
+ {
+ if (lTransformType & KTRANSFORM_ROTATION)
+ {
+ //vgScale
+ matrixTemp[0] = aIconData->DerefReal32L((++aCounter) * sizeof (VGfloat));
+ matrixTemp[4] = aIconData->DerefReal32L((++aCounter) * sizeof (VGfloat));
+
+ //vgShear
+ matrixTemp[3] = aIconData->DerefReal32L((++aCounter) * sizeof (VGfloat));
+ matrixTemp[1] = aIconData->DerefReal32L((++aCounter) * sizeof (VGfloat));
+ }
+ else
+ {
+ if (lTransformType & KTRANSFORM_SCALING)
+ {
+ //vgScale
+ matrixTemp[0] = aIconData->DerefReal32L((++aCounter) * sizeof (VGfloat));
+ matrixTemp[4] = aIconData->DerefReal32L((++aCounter) * sizeof (VGfloat));
+ }
+
+ if (lTransformType & KTRANSFORM_SHEARING)
+ {
+ //vgShear
+ matrixTemp[3] = aIconData->DerefReal32L((++aCounter) * sizeof (VGfloat));
+ matrixTemp[1] = aIconData->DerefReal32L((++aCounter) * sizeof (VGfloat));
+ }
+ }
+
+ if (lTransformType & KTRANSFORM_TRANSLATION)
+ {
+ //vgTranslate
+ matrixTemp[6] = aIconData->DerefReal32L((++aCounter) * sizeof (VGfloat));
+ matrixTemp[7] = aIconData->DerefReal32L((++aCounter) * sizeof (VGfloat));
+ }
+ }
+
+ COND_COM_OC(iInternal->iCreatingNVGIcon,
+ CSICON(iInternal->iCurrentNVGIcon)->AddSetTransformCommandL(matrixTemp, 1),
+ vgMultMatrix(matrixTemp));
+ }
+ else
+ {
+ COND_COM_OC(iInternal->iCreatingNVGIcon,
+ CSICON(iInternal->iCurrentNVGIcon)->AddSetTransformCommandL(matrixTemp, 0), ;);
+ }
+ }
+
+void CNvgEngine::GenerateMask(CFbsBitmap* aMask)
+ {
+ if (!aMask || aMask->SizeInPixels() != iCurrentBufferSize)
+ {
+ return;
+ }
+
+ const TDisplayMode KMaskDisplayMode = aMask->DisplayMode();
+
+ if (KMaskDisplayMode != EGray256 && KMaskDisplayMode != EGray2)
+ {
+ return;
+ }
+
+ const TInt KOriginalFilterMasks = vgGeti(VG_FILTER_CHANNEL_MASK);
+ const TInt KStride = CFbsBitmap::ScanLineLength(iCurrentBufferSize.iWidth, KMaskDisplayMode);
+
+ // Change to get alpha values from OpenVG
+ vgSeti(VG_FILTER_CHANNEL_MASK, VG_ALPHA);
+
+ VGImageFormat format = (KMaskDisplayMode == EGray256) ? VG_A_8 : VG_BW_1;
+
+ aMask->LockHeap();
+
+ /*
+ * Get data address of last line and move upwards (negative stride)
+ * OpenVG uses Cartesian coordinate system and Symbian uses Screen coordinate system.
+ */
+ TUint* data = (TUint*)((TUint)aMask->DataAddress() + (KStride * (iCurrentBufferSize.iHeight - 1 )));
+
+ vgReadPixels(data, -KStride, format, 0, 0,
+ iCurrentBufferSize.iWidth, iCurrentBufferSize.iHeight);
+ aMask->UnlockHeap();
+
+ // Set back the original filter-masks
+ vgSeti(VG_FILTER_CHANNEL_MASK, KOriginalFilterMasks);
+ }
+
+void CNvgEngine::ClearBackground()
+ {
+ TUint32 rgba = (iBackgroundColor << 8) | (iBackgroundColor >> 24);
+ TInt32 r, g, b, a;
+ r = (TInt)((rgba & 0xFF000000) >> 24);
+ g = (TInt)((rgba & 0x00FF0000) >> 16);
+ b = (TInt)((rgba & 0x0000FF00) >> 8);
+ a = (TInt)(rgba & 0x000000FF);
+
+ r += r >> 7; g += g >> 7; b += b >> 7; a += a >> 7;
+
+ const VGfloat KInverse255 = 1.0f/256.0f;
+ const VGfloat clearColor[4] = { (KInverse255 * VGfloat (r)),
+ (KInverse255 * VGfloat (g)),
+ (KInverse255 * VGfloat (b)),
+ (KInverse255 * VGfloat (a)) };
+
+ vgSeti(VG_SCISSORING, VG_FALSE);
+ vgSetfv(VG_CLEAR_COLOR, 4, clearColor);
+ vgClear(0, 0, iCurrentBufferSize.iWidth, iCurrentBufferSize.iHeight);
+ vgSeti(VG_SCISSORING, VG_TRUE);
+ }
+
+TBool CNvgEngine::IsIdentity(VGfloat array[])
+ {
+ return ((array[0] == 1.0f && array[4] == 1.0f && array[8] == 1.0f)&&
+ (array[1] == 0.0f && array[2] == 0.0f && array[3] == 0.0f &&
+ array[5] == 0.0f && array[6] == 0.0f && array[7] == 0.0f));
+ }
+
+TInt CNvgEngine::OpenVGErrorToSymbianError( TInt aError )
+ {
+ TInt error = KErrNone;
+ switch (aError)
+ {
+ case VGU_OUT_OF_MEMORY_ERROR:
+ case VG_OUT_OF_MEMORY_ERROR:
+ {
+ error = KErrNoMemory;
+ break;
+ }
+
+ case VG_ILLEGAL_ARGUMENT_ERROR:
+ case VGU_ILLEGAL_ARGUMENT_ERROR:
+ {
+ error = KErrArgument;
+ break;
+ }
+
+ case VG_UNSUPPORTED_PATH_FORMAT_ERROR:
+ case VG_UNSUPPORTED_IMAGE_FORMAT_ERROR:
+ {
+ error = KErrNotSupported;
+ break;
+ }
+
+ case VG_IMAGE_IN_USE_ERROR:
+ {
+ error = KErrInUse;
+ break;
+ }
+
+ case VG_BAD_HANDLE_ERROR:
+ case VGU_BAD_HANDLE_ERROR:
+ {
+ error = KErrBadHandle;
+ break;
+ }
+
+ case VG_PATH_CAPABILITY_ERROR:
+ case VGU_PATH_CAPABILITY_ERROR:
+ case VGU_BAD_WARP_ERROR:
+ {
+ error = KErrUnknown;
+ break;
+ }
+
+ case VG_NO_CONTEXT_ERROR:
+ {
+ error = KErrNotReady;
+ break;
+ }
+
+ default:
+ {
+ error = KErrUnknown;
+ }
+ }
+
+ return error;
+ }
+
+void CNvgEngine::UpdateClientMatrices()
+ {
+ iMatrixMode = vgGeti(VG_MATRIX_MODE);
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
+ vgGetMatrix(iPathMatrix);
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
+ vgGetMatrix(iImageMatrix);
+ vgSeti(VG_MATRIX_MODE, iMatrixMode);
+ }
+
+void CNvgEngine::RestoreClientMatrices()
+ {
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
+ vgLoadMatrix(iPathMatrix);
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
+ vgLoadMatrix(iImageMatrix);
+ vgSeti(VG_MATRIX_MODE, iMatrixMode);
+ }
+
+TPoint CNvgEngine::GetTranslatedPoint(VGfloat aTRMatrix[9], TPoint aPoint)
+ {
+ TPoint trPoint;
+
+ trPoint.iX = aTRMatrix[0] * aPoint.iX + aTRMatrix[3] * aPoint.iY + aTRMatrix[6];
+ trPoint.iY = aTRMatrix[1] * aPoint.iX + aTRMatrix[4] * aPoint.iY + aTRMatrix[7];
+
+ return trPoint;
+ }
+
+VGfloat CNvgEngine::MinVal4(VGfloat x1, VGfloat x2, VGfloat x3, VGfloat x4 )
+ {
+ VGfloat min = x1;
+
+ if (min > x2)
+ {
+ min = x2;
+ }
+ if (min > x3)
+ {
+ min = x3;
+ }
+ if (min > x4)
+ {
+ min = x4;
+ }
+
+ return min;
+ }
+
+VGfloat CNvgEngine::MaxVal4(VGfloat x1, VGfloat x2, VGfloat x3, VGfloat x4 )
+ {
+ VGfloat max = x1;
+
+ if (max < x2)
+ {
+ max = x2;
+ }
+ if (max < x3)
+ {
+ max = x3;
+ }
+ if (max < x4)
+ {
+ max = x4;
+ }
+
+ return max;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/nvgdecoder/src/nvgfittoviewbox.cpp Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,506 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: NVG Decoder source file
+ *
+*/
+
+
+#include "nvgfittoviewbox.h"
+
+const TReal KZero = 0.0;
+const TReal KOne = 1.0;
+
+
+// ---------------------------------------------------------------------------
+// 2 Phase Constructor
+// ---------------------------------------------------------------------------
+CNvgFitToViewBoxImpl* CNvgFitToViewBoxImpl::NewL()
+ {
+ CNvgFitToViewBoxImpl* self = new ( ELeave ) CNvgFitToViewBoxImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop(self);
+
+ return self;
+ }
+
+
+
+// ---------------------------------------------------------------------------
+// 2 Phase Constructor
+// ---------------------------------------------------------------------------
+CNvgFitToViewBoxImpl* CNvgFitToViewBoxImpl::NewLC()
+ {
+ CNvgFitToViewBoxImpl* self = new ( ELeave ) CNvgFitToViewBoxImpl();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+
+ return self;
+ }
+
+
+
+// ---------------------------------------------------------------------------
+// Constuctor
+// ---------------------------------------------------------------------------
+CNvgFitToViewBoxImpl::CNvgFitToViewBoxImpl(): iM00(KOne),
+ iM01(KZero),
+ iM02(KZero),
+ iM10(KZero),
+ iM11(KOne),
+ iM12(KZero),
+ iViewBoxDefined(EFalse),
+ iAlign(ENvgPreserveAspectRatio_XmidYmid),
+ iMeetSlice(ENvgMeet)
+ {
+ ivbX = 0.0;
+ ivbY = 0.0;
+ ivbW = 0.0;
+ ivbH = 0.0;
+
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void CNvgFitToViewBoxImpl::ConstructL()
+ {
+
+ }
+
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+CNvgFitToViewBoxImpl::~CNvgFitToViewBoxImpl()
+ {
+
+ }
+
+
+
+// ---------------------------------------------------------------------------
+// Computation of the viewport to viewbox transformation matrix
+// ---------------------------------------------------------------------------
+void CNvgFitToViewBoxImpl::SetWindowViewportTrans(TRect aViewPort, TSize aSize)
+ {
+
+ //VIEWPORT NUMBERS
+ TReal lViewPortX = aViewPort.iTl.iX;
+ TReal lViewPortY = aViewPort.iTl.iY;
+ TReal lViewPortWidth = aViewPort.Width();
+ TReal lViewPortHeight = aViewPort.Height();
+
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
+ vgTranslate(lViewPortX, lViewPortY );
+
+ /* 2. Scale */
+
+ TReal lViewBoxXmin;
+ TReal lViewBoxYmin;
+ TReal lViewBoxWidth;
+ TReal lViewBoxHeight;
+
+ if ( iViewBoxDefined )
+ {
+ lViewBoxXmin = ivbX;
+ lViewBoxYmin = ivbY;
+ lViewBoxWidth = ivbW;
+ lViewBoxHeight = ivbH;
+ }
+ else
+ {
+ //this will default viewBox to <svg> element width and height
+ lViewBoxXmin = 0;
+ lViewBoxYmin = 0;
+ lViewBoxWidth = aSize.iWidth;
+ lViewBoxHeight = aSize.iHeight;
+ }
+
+
+ if ( lViewBoxWidth == 0.0f || lViewBoxHeight == 0.0f )
+ {
+ return;
+ }
+
+
+ TReal sx = lViewPortWidth / lViewBoxWidth;
+ TReal sy = lViewPortHeight / lViewBoxHeight;
+
+ if ( sx == 0.0f || sy == 0.0f )
+ {
+ return;
+ }
+
+
+
+ TReal xtrans = TReal( -1.0f ) * lViewBoxXmin;
+ TReal ytrans = TReal( -1.0f ) * lViewBoxYmin;
+
+ switch ( iAlign )
+ {
+ case ENvgPreserveAspectRatio_None:
+ /* Non uniform scaling */
+ //none - Do not force uniform scaling.
+ //Scale the graphic content of the given element
+ //non-uniformly if necessary such that the element's
+ //bounding box exactly matches the viewport rectangle.
+
+ //(Note: if <align> is none, then the optional <meetOrSlice> value is ignored.)
+ break;
+
+ case ENvgPreserveAspectRatio_XminYmin:
+ //Align the <min-x> of the element's viewBox with the smallest X value of the viewport.
+ //Align the <min-y> of the element's viewBox with the smallest Y value of the viewport.
+
+ if (iMeetSlice == ENvgMeet)
+ {
+ if ( sx > sy )
+ {
+ sx = sy;
+ //no change for xtrans...default above
+ }
+ else // ( sx < sy )
+ {
+ sy = sx;
+ //no change for ytrans...default above
+ }
+ }
+ else if (iMeetSlice == ENvgSlice)
+ {
+ if (sx > sy)
+ {
+ sy = sx;
+ }
+ else // ( sx < sy )
+ {
+ sx = sy;
+ }
+ }
+ break;
+
+ case ENvgPreserveAspectRatio_XmidYmin:
+ //Align the midpoint X value of the element's viewBox with the midpoint X value of the viewport.
+ //Align the <min-y> of the element's viewBox with the smallest Y value of the viewport.
+ //Align the <min-x> of the element's viewBox with the smallest X value of the viewport.
+ //Align the <min-y> of the element's viewBox with the smallest Y value of the viewport.
+
+ if (iMeetSlice == ENvgMeet)
+ {
+ if ( sx > sy )
+ {
+ sx = sy;
+ xtrans = ( ( lViewPortWidth - (( lViewBoxWidth / lViewBoxHeight ) * lViewPortHeight ) )\
+ * 0.5 ) / sx - lViewBoxXmin;
+ }
+ else // ( sx < sy )
+ {
+ sy = sx;
+ //no change for ytrans...default above
+ }
+ }
+ else if (iMeetSlice == ENvgSlice)
+ {
+ if ( sx > sy )
+ {
+ sy = sx;
+ }
+ else //( sx < sy )
+ {
+ sx = sy;
+ xtrans = lViewPortWidth - sx*lViewBoxWidth;
+ xtrans = xtrans/sx;
+ xtrans = xtrans/2.0 - lViewBoxXmin;
+ }
+ }
+ break;
+
+ case ENvgPreserveAspectRatio_XmaxYmin:
+ //Align the <min-x>+<width> of the element's viewBox with the maximum X value of the viewport.
+ //Align the <min-y> of the element's viewBox with the smallest Y value of the viewport.
+ if (iMeetSlice == ENvgMeet)
+ {
+ if ( sx > sy )
+ {
+ sx = sy;
+
+ xtrans = (( lViewPortWidth - ( ( lViewBoxWidth / lViewBoxHeight ) * lViewPortHeight ) ) ) / sx\
+ - lViewBoxXmin;
+ }
+ else // ( sx < sy )
+ {
+ sy = sx;
+ //no change for ytrans...default above
+ }
+ }
+ else if (iMeetSlice == ENvgSlice)
+ {
+ if ( sx > sy )
+ {
+ sy = sx;
+ //no change for ytrans...default above
+ }
+ else // ( sx < sy )
+ {
+ sx = sy;
+ xtrans = lViewPortWidth - sx*lViewBoxWidth;
+ xtrans = xtrans/sx - lViewBoxXmin;
+ }
+ }
+ break;
+
+ case ENvgPreserveAspectRatio_XminYmid:
+ //Align the <min-x> of the element's viewBox with the smallest X value of the viewport.
+ //Align the midpoint Y value of the element's viewBox with the midpoint Y value of the viewport.
+ if (iMeetSlice == ENvgMeet)
+ {
+ if ( sx > sy )
+ {
+ sx = sy;
+ //no change for xtrans...default above
+ }
+ else // ( sx < sy )
+ {
+ sy = sx;
+ ytrans = ( ( TReal )
+ ( lViewPortHeight - ( ( TReal ) ( lViewBoxHeight / lViewBoxWidth ) * lViewPortWidth ) )\
+ * TReal(.5) ) /sy - lViewBoxYmin;
+ }
+ }
+ else if (iMeetSlice == ENvgSlice)
+ {
+ if ( sx > sy )
+ {
+ sy = sx;
+ ytrans = lViewPortHeight - sx*lViewBoxHeight;
+ ytrans = ytrans/sx;
+ ytrans = ytrans/2.0 - lViewBoxYmin;
+ }
+ else
+ {
+ sx = sy;
+ }
+ }
+ break;
+
+ case ENvgPreserveAspectRatio_XmidYmid:
+ //(default) case
+ //Align the midpoint X value of the element's viewBox with the midpoint X value of the viewport.
+ //Align the midpoint Y value of the element's viewBox with the midpoint Y value of the viewport.
+ if (iMeetSlice == ENvgMeet)
+ {
+ if ( sx > sy )
+ {
+ sx = sy;
+ xtrans = (( lViewPortWidth - (( lViewBoxWidth / lViewBoxHeight ) * lViewPortHeight ) ) * \
+ 0.5 ) / sx - lViewBoxXmin;
+
+ }
+ else if ( sx < sy )
+ {
+ sy = sx;
+
+ ytrans = (( lViewPortHeight - (( lViewBoxHeight / lViewBoxWidth ) * lViewPortWidth ) ) * \
+ 0.5 ) /sy - lViewBoxYmin;
+ }
+ }
+ else if (iMeetSlice == ENvgSlice)
+ {
+ if ( sx > sy )
+ {
+ sy = sx;
+ ytrans = lViewPortHeight - sx*lViewBoxHeight;
+ ytrans = ytrans/sx;
+ ytrans = ytrans/2.0 - lViewBoxYmin;
+ }
+ else // ( sx < sy )
+ {
+ sx = sy;
+ xtrans = lViewPortWidth - sx*lViewBoxWidth;
+ xtrans = xtrans/sx;
+ xtrans = xtrans/2.0 - lViewBoxXmin;
+ }
+ }
+ break;
+
+ case ENvgPreserveAspectRatio_XmaxYmid:
+ //Align the <min-x>+<width> of the element's viewBox with the maximum X value of the viewport.
+ //Align the midpoint Y value of the element's viewBox with the midpoint Y value of the viewport.
+ if (iMeetSlice == ENvgMeet)
+ {
+ if ( sx > sy )
+ {
+ sx = sy;
+ xtrans = (( lViewPortWidth - (( lViewBoxWidth / lViewBoxHeight ) * lViewPortHeight ) ) ) / sx \
+ - lViewBoxXmin;
+ }
+ else //( sx < sy )
+ {
+ sy = sx;
+
+ ytrans = (( lViewPortHeight - (( lViewBoxHeight / lViewBoxWidth ) * lViewPortWidth ) ) \
+ * 0.5 ) /sy - lViewBoxYmin;
+ }
+ }
+ else if (iMeetSlice == ENvgSlice)
+ {
+ if ( sx > sy )
+ {
+ sy = sx;
+ ytrans = lViewPortHeight - sx*lViewBoxHeight;
+ ytrans = ytrans/sx;
+ ytrans = ytrans/2.0 - lViewBoxYmin;
+ }
+ else //( sx < sy )
+ {
+ sx = sy;
+ xtrans = lViewPortWidth - sx*lViewBoxWidth;
+ xtrans = xtrans/sx - lViewBoxXmin;
+ }
+ }
+ break;
+
+ case ENvgPreserveAspectRatio_XminYmax:
+ //Align the <min-x> of the element's viewBox with the smallest X value of the viewport.
+ //Align the <min-y>+<height> of the element's viewBox with the maximum Y value of the viewport.
+ if (iMeetSlice == ENvgMeet)
+ {
+ if ( sx > sy )
+ {
+ sx = sy;
+ //no change for xtrans...default above
+ }
+ else //( sx < sy )
+ {
+ sy = sx;
+
+ ytrans = (( lViewPortHeight - (( lViewBoxHeight / lViewBoxWidth ) * lViewPortWidth ) ) ) /sy \
+ - lViewBoxYmin;
+ }
+ }
+ else if (iMeetSlice == ENvgSlice)
+ {
+ if ( sx > sy )
+ {
+ sy = sx;
+ ytrans = lViewPortHeight - sx*lViewBoxHeight;
+ ytrans = ytrans/sx - lViewBoxYmin;
+ }
+ else //( sx < sy )
+ {
+ sx = sy;
+ }
+ }
+ break;
+
+ case ENvgPreserveAspectRatio_XmidYmax:
+ //Align the midpoint X value of the element's viewBox with the midpoint X value of the viewport.
+ //Align the <min-y>+<height> of the element's viewBox with the maximum Y value of the viewport.
+ if (iMeetSlice == ENvgMeet)
+ {
+ if ( sx > sy )
+ {
+ sx = sy;
+
+ xtrans = (( lViewPortWidth - (( lViewBoxWidth / lViewBoxHeight ) * lViewPortHeight ) ) \
+ * 0.5 ) / sx - lViewBoxXmin;
+ }
+ else //( sx < sy )
+ {
+ sy = sx;
+
+ ytrans = (( lViewPortHeight - (( lViewBoxHeight / lViewBoxWidth ) * lViewPortWidth ) ) ) /sy \
+ - lViewBoxYmin;
+ }
+ }
+ else if (iMeetSlice == ENvgSlice)
+ {
+ if ( sx > sy )
+ {
+ sy = sx;
+ ytrans = lViewPortHeight - sx*lViewBoxHeight;
+ ytrans = ytrans/sx - lViewBoxYmin;
+ }
+ else //( sx < sy )
+ {
+ sx = sy;
+ xtrans = lViewPortWidth - sx*lViewBoxWidth;
+ xtrans = xtrans/sx;
+ xtrans = xtrans/2.0 - lViewBoxXmin;
+ }
+ }
+ break;
+
+ case ENvgPreserveAspectRatio_XmaxYmax:
+ //Align the <min-x>+<width> of the element's viewBox with the maximum X value of the viewport.
+ //Align the <min-y>+<height> of the element's viewBox with the maximum Y value of the viewport.
+ if (iMeetSlice == ENvgMeet)
+ {
+ if ( sx > sy )
+ {
+ sx = sy;
+
+ xtrans = (( lViewPortWidth - (( lViewBoxWidth / lViewBoxHeight ) * lViewPortHeight ) ) ) / sx\
+ - lViewBoxXmin;
+ }
+ else //( sx < sy )
+ {
+ sy = sx;
+
+ ytrans = (( lViewPortHeight - (( lViewBoxHeight / lViewBoxWidth ) * lViewPortWidth ) ) ) /sy \
+ - lViewBoxYmin;
+ }
+ }
+ else if (iMeetSlice == ENvgSlice)
+ {
+ if ( sx > sy )
+ {
+ sy = sx;
+ ytrans = lViewPortHeight - sx*lViewBoxHeight;
+ ytrans = ytrans/sx - lViewBoxYmin;
+ }
+ else //( sx < sy )
+ {
+ sx = sy;
+ xtrans = lViewPortWidth - sx*lViewBoxWidth;
+ xtrans = xtrans/sx - lViewBoxXmin;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ vgScale( sx, sy);
+
+ vgTranslate( xtrans, ytrans );
+
+ }
+
+ void CNvgFitToViewBoxImpl::Concatenate( TReal aM00, TReal aM01, TReal aM02, TReal aM10, TReal aM11, TReal aM12 )
+ {
+ TReal m0, m1;
+ m0 = iM00;
+ m1 = iM01;
+ iM00 = aM00 * m0 + aM10 * m1;
+ iM01 = aM01 * m0 + aM11 * m1;
+ iM02 += aM02 * m0 + aM12 * m1;
+ m0 = iM10;
+ m1 = iM11;
+ iM11 = aM01 * m0 + aM11 * m1;
+ iM10 = aM00 * m0 + aM10 * m1;
+ iM12 += aM02 * m0 + aM12 * m1;
+ }
+//--------------------------------EndOfFile------------------------------------
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/rom/NVGDecoder_SW.iby Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef __NVGDECODERSW_IBY__
+
+#define __NVGDECODERSW_IBY__
+
+
+// NVG Decoder
+file=ABI_DIR\BUILD_DIR\NVGDecoder_SW.dll SHARED_LIB_DIR\NVGDecoder_SW.dll
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/rom/SVGEngine.iby Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IBY file for SVGT Engine
+*
+*/
+
+
+#ifndef SVGTENGINE_IBY
+#define SVGTENGINE_IBY
+
+file=ABI_DIR\BUILD_DIR\SVGEngine.dll SHARED_LIB_DIR\SVGEngine.dll
+ECOM_PLUGIN(Svgrecog.dll, 101F8570.rsc)
+file=ABI_DIR\BUILD_DIR\SVGEngineJI.dll SHARED_LIB_DIR\SVGEngineJI.dll
+
+#endif
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/rom/SvgtPluginEcom.iby Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __SVGTPLUGINECOM_IBY__
+#define __SVGTPLUGINECOM_IBY__
+
+#include <bldvariant.hrh>
+#ifdef __SERIES60_NATIVE_BROWSER
+ECOM_PLUGIN(npsvgtplugin.dll, 101F86DF.rsc)
+#endif __SERIES60_NATIVE_BROWSER
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/rom/VGRenderer.iby Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IBY file for SVGT Engine
+*
+*/
+
+
+#ifndef VGRENDERER_IBY
+#define VGRENDERER_IBY
+
+file=ABI_DIR\BUILD_DIR\VGRenderer.dll SHARED_LIB_DIR\VGRenderer.dll
+file=ABI_DIR\BUILD_DIR\PseudoVG.dll SHARED_LIB_DIR\PseudoVG.dll
+file=ABI_DIR\BUILD_DIR\SWVG.dll SHARED_LIB_DIR\SWVG.dll
+#endif
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/rom/nvgdecoder.iby Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef __NVGDECODER_IBY__
+
+#define __NVGDECODER_IBY__
+
+
+// NVG Decoder
+file=ABI_DIR\BUILD_DIR\nvgdecoder.dll SHARED_LIB_DIR\nvgdecoder.dll
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_4_0.dtd Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,86 @@
+ <!ELEMENT SystemDefinition (systemModel?, build?)>
+ <!ATTLIST SystemDefinition
+ name CDATA #REQUIRED
+ schema CDATA #REQUIRED>
+ <!ELEMENT systemModel (layer+)>
+ <!ELEMENT layer (logicalset* | module*)*>
+ <!ATTLIST layer
+ name CDATA #REQUIRED
+ levels CDATA #IMPLIED
+ span CDATA #IMPLIED>
+ <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalset name CDATA #REQUIRED>
+ <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalsubset name CDATA #REQUIRED>
+ <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
+ <!ATTLIST module
+ name CDATA #REQUIRED
+ level CDATA #IMPLIED>
+ <!ELEMENT component (unit* | package* | prebuilt*)*>
+ <!ATTLIST component name CDATA #REQUIRED>
+ <!ELEMENT unit EMPTY>
+ <!ATTLIST unit
+ unitID ID #REQUIRED
+ name CDATA #REQUIRED
+ mrp CDATA #REQUIRED
+ filter CDATA #IMPLIED
+ bldFile CDATA #REQUIRED
+ priority CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT package EMPTY>
+ <!ATTLIST package
+ name CDATA #REQUIRED
+ mrp CDATA #REQUIRED
+ filter CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT prebuilt EMPTY>
+ <!ATTLIST prebuilt
+ name CDATA #REQUIRED
+ version CDATA #REQUIRED
+ late (Y|N) #IMPLIED
+ filter CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
+ <!ELEMENT unitList (unitRef+)>
+ <!ATTLIST unitList
+ name ID #REQUIRED
+ description CDATA #REQUIRED>
+ <!ELEMENT unitRef EMPTY>
+ <!ATTLIST unitRef unit IDREF #REQUIRED>
+ <!ELEMENT targetList EMPTY>
+ <!ATTLIST targetList
+ name ID #REQUIRED
+ description CDATA #REQUIRED
+ target IDREFS #REQUIRED>
+ <!ELEMENT target EMPTY>
+ <!ATTLIST target
+ name ID #REQUIRED
+ abldTarget CDATA #REQUIRED
+ description CDATA #REQUIRED>
+ <!ELEMENT option EMPTY>
+ <!ATTLIST option
+ name ID #REQUIRED
+ abldOption CDATA #REQUIRED
+ description CDATA #REQUIRED
+ enable (Y | N | y | n) #REQUIRED>
+ <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
+ <!ATTLIST configuration
+ name ID #REQUIRED
+ description CDATA #REQUIRED
+ filter CDATA #REQUIRED>
+ <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
+ <!ELEMENT unitListRef EMPTY>
+ <!ATTLIST unitListRef unitList IDREF #REQUIRED>
+ <!ELEMENT layerRef EMPTY>
+ <!ATTLIST layerRef layerName CDATA #REQUIRED>
+ <!ELEMENT buildLayer EMPTY>
+ <!ATTLIST buildLayer
+ command CDATA #REQUIRED
+ targetList IDREFS #IMPLIED
+ unitParallel (Y | N | y | n) #REQUIRED
+ targetParallel (Y | N | y | n) #IMPLIED>
+ <!ELEMENT specialInstructions EMPTY>
+ <!ATTLIST specialInstructions
+ name CDATA #REQUIRED
+ cwd CDATA #REQUIRED
+ command CDATA #REQUIRED>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/systemDefinition.xml Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "systemDefinition.dtd"[
+
+ <!ENTITY layer_real_source_path "\sf\mw\svgt">
+ <!ENTITY layer_name "svgt">
+
+ <!ENTITY layer_file SYSTEM "systemDefinitionLayer.xml">
+ <!ENTITY targetDefinition_file SYSTEM "/epoc32/tools/systemDefinition/targetDefinition.xml">
+ <!ENTITY defaultbuild_file SYSTEM "/epoc32/tools/systemDefinition/default_build.xml">
+ <!ENTITY defaultclean_file SYSTEM "/epoc32/tools/systemDefinition/default_clean.xml">
+]>
+
+<SystemDefinition name="SystemDefinition" schema="1.4.0">
+ <systemModel>
+&layer_file;
+ </systemModel>
+ <build>
+&targetDefinition_file;
+
+ <configuration name="build" description="build layer" filter="">
+ <layerRef layerName="&layer_name;"/>
+
+&defaultbuild_file;
+ </configuration>
+
+ <configuration name="clean" description="clean layer" filter="">
+ <layerRef layerName="&layer_name;"/>
+
+&defaultclean_file;
+ </configuration>
+
+ </build>
+</SystemDefinition>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/systemDefinitionLayer.xml Wed Nov 03 18:56:10 2010 +0200
@@ -0,0 +1,7 @@
+<layer name="svgt">
+ <module name="group_svgt">
+ <component name="group_svgt">
+ <unit unitID="svgt" mrp="" bldFile="&layer_real_source_path;\group" name="svgt" />
+ </component>
+ </module>
+</layer>