--- a/svgt_plat/svgt_api/group/bld.inf Fri Jun 25 18:09:18 2010 +0100
+++ b/svgt_plat/svgt_api/group/bld.inf Thu Jul 22 16:43:33 2010 +0100
@@ -33,3 +33,7 @@
../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)
+
+../inc/svgtbitmap.h MW_LAYER_PLATFORM_EXPORT_PATH(svgtbitmap.h)
+../inc/svgtbitmap.inl MW_LAYER_PLATFORM_EXPORT_PATH(svgtbitmap.inl)
+
--- a/svgt_plat/svgt_api/inc/SVGEngineInterfaceImpl.h Fri Jun 25 18:09:18 2010 +0100
+++ b/svgt_plat/svgt_api/inc/SVGEngineInterfaceImpl.h Thu Jul 22 16:43:33 2010 +0100
@@ -105,6 +105,9 @@
class CSvgTextElementImpl;
class CSvgBitmapFontProvider;
+
+class CSvgtBitmap;
+
class MRect
{
public:
@@ -647,6 +650,8 @@
*/
IMPORT_C void GenerateMask( CFbsBitmap* aMask, TInt aEngine = NULL );
+ IMPORT_C void GenerateMask( CSvgtBitmap* aMask, TInt aEngine = NULL );
+
/**
* Set the color for clearing background.
*
@@ -871,6 +876,7 @@
*/
IMPORT_C void SetGdiContextL( CSvgEngineImpl* aEngine, CFbsBitmap* aFrameBuffer );
+ IMPORT_C void SetGdiContextL( CSvgEngineImpl* aEngine, CSvgtBitmap* aFrameBuffer );
/**
* Associate the given document with the given engine.
*
--- a/svgt_plat/svgt_api/inc/SvgJavaInterfaceImpl.h Fri Jun 25 18:09:18 2010 +0100
+++ b/svgt_plat/svgt_api/inc/SvgJavaInterfaceImpl.h Thu Jul 22 16:43:33 2010 +0100
@@ -33,6 +33,8 @@
typedef int SvgPathHandle;
typedef short SvgAttrType;
+typedef unsigned int SvgtBitmapHandle;
+
class CSvgEngineImpl;
class CSvgDocumentImpl;
class CFbsBitmap;
@@ -1488,7 +1490,12 @@
SvgEngineHandle aEngineHandle, SvgDocumentHandle aDocumentHandle,
TInt aSurfaceHandle, TInt aSurfaceMaskHandle = NULL, TReal32 aCurrentTime = 0.0f ) __SOFTFP;
- IMPORT_C void SvgEngineRenderDocumentL(
+ IMPORT_C void SvgEngineRenderDocument(
+ SvgEngineHandle aEngineHandle, SvgDocumentHandle aDocumentHandle,
+ SvgtBitmapHandle aSurfaceHandle, SvgtBitmapHandle 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;
--- a/svgt_plat/svgt_api/inc/SvgListener.h Fri Jun 25 18:09:18 2010 +0100
+++ b/svgt_plat/svgt_api/inc/SvgListener.h Thu Jul 22 16:43:33 2010 +0100
@@ -23,7 +23,7 @@
#include <e32base.h>
#endif
-#include "MXMLAttributes.h"
+#include "xml/mxmlattributes.h"
class CSvgElementImpl;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgt_plat/svgt_api/inc/svgtbitmap.h Thu Jul 22 16:43:33 2010 +0100
@@ -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: SVGTbitmap header file
+ *
+*/
+
+#ifndef SVGTBITMAP_H_
+#define SVGTBITMAP_H_
+
+#include <e32base.h>
+#include <displaymode.h>
+
+class CSvgtBitmap : public CBase
+ {
+public: // constructors
+ inline CSvgtBitmap( TInt8* aBitmapBuffer, TSize aBitmapSize,
+ TDisplayMode aDisplayMode, TInt aStride);
+
+public: //class methods
+ /*
+ * returns target image buffer
+ */
+ inline TInt8* BitmapBuffer() const;
+
+ /*
+ * returns target image size in pixels
+ */
+ inline TSize SizeInPixels() const;
+
+ /*
+ * returns target image display mode
+ */
+ inline TDisplayMode DisplayMode() const;
+
+ /*
+ * returns target image bytes per scanline
+ */
+ inline TInt Stride() const;
+
+private:
+ TInt8* iBitmapBuffer;
+ TSize iBitmapSize;
+ TDisplayMode iDisplayMode;
+ TInt iStride;
+ };
+
+#include <svgtbitmap.inl>
+
+#endif /* SVGTBITMAP_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgt_plat/svgt_api/inc/svgtbitmap.inl Thu Jul 22 16:43:33 2010 +0100
@@ -0,0 +1,44 @@
+/*
+* 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: SVGTbitmap header file
+ *
+*/
+
+inline CSvgtBitmap::CSvgtBitmap( TInt8* aBitmapBuffer, TSize aBitmapSize,
+ TDisplayMode aDisplayMode, TInt aStride):iBitmapBuffer(aBitmapBuffer),
+ iBitmapSize(aBitmapSize),
+ iDisplayMode(aDisplayMode),
+ iStride(aStride)
+ {
+ }
+
+inline TInt8* CSvgtBitmap::BitmapBuffer() const
+ {
+ return iBitmapBuffer;
+ }
+
+inline TSize CSvgtBitmap::SizeInPixels() const
+ {
+ return iBitmapSize;
+ }
+
+inline TDisplayMode CSvgtBitmap::DisplayMode() const
+ {
+ return iDisplayMode;
+ }
+
+inline TInt CSvgtBitmap::Stride() const
+ {
+ return iStride;
+ }
--- a/svgtopt/SVG/SVGEngine/BWINSCW/SVGENGINE-OpenVGU.def Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/SVG/SVGEngine/BWINSCW/SVGENGINE-OpenVGU.def Thu Jul 22 16:43:33 2010 +0100
@@ -191,4 +191,6 @@
?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
+ ?GenerateMask@CSvgEngineInterfaceImpl@@QAEXPAVCSvgtBitmap@@H@Z @ 193 NONAME ; void CSvgEngineInterfaceImpl::GenerateMask(class CSvgtBitmap *, int)
+ ?SetGdiContextL@CSvgEngineInterfaceImpl@@QAEXPAVCSvgEngineImpl@@PAVCSvgtBitmap@@@Z @ 194 NONAME ; void CSvgEngineInterfaceImpl::SetGdiContextL(class CSvgEngineImpl *, class CSvgtBitmap *)
--- a/svgtopt/SVG/SVGEngine/eabi/SVGENGINE-OpenVGU.def Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/SVG/SVGEngine/eabi/SVGENGINE-OpenVGU.def Thu Jul 22 16:43:33 2010 +0100
@@ -388,4 +388,6 @@
_ZN23CSvgEngineInterfaceImpl5StartERP9MSvgErrorPK6TDesC8P14CSvgEngineImpl @ 387 NONAME
_ZN23CSvgEngineInterfaceImpl6UseDomEiP10CFbsBitmapS1_5TSize12TDisplayModeS3_i @ 388 NONAME
_ZNK23CSvgEngineInterfaceImpl14TLVEncodedDataEv @ 389 NONAME
+ _ZN23CSvgEngineInterfaceImpl12GenerateMaskEP11CSvgtBitmapi @ 390 NONAME
+ _ZN23CSvgEngineInterfaceImpl14SetGdiContextLEP14CSvgEngineImplP11CSvgtBitmap @ 391 NONAME
--- a/svgtopt/SVG/SVGEngine/group/SVGEngine.mmp Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/SVG/SVGEngine/group/SVGEngine.mmp Thu Jul 22 16:43:33 2010 +0100
@@ -62,6 +62,7 @@
SOURCE Svgdecoder.cpp
SOURCE SVGFourPointRect.cpp
+
SOURCEPATH ../../SVGImpl/src
SOURCE SVGElementImpl.cpp
--- a/svgtopt/SVG/SVGEngine/inc/SVGContentHandler.h Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/SVG/SVGEngine/inc/SVGContentHandler.h Thu Jul 22 16:43:33 2010 +0100
@@ -28,8 +28,8 @@
#include "SVGAttributeVerifier.h"
#include "SVGErrorImpl.h"
-#include "mxmlattributes.h"
-#include "mxmlcontenthandler.h"
+#include "xml/mxmlattributes.h"
+#include "xml/mxmlcontenthandler.h"
#include "SVGSchemaData.h"
#include "SVGDocumentImpl.h"
--- a/svgtopt/SVG/SVGEngine/inc/SVGEngineImpl.h Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/SVG/SVGEngine/inc/SVGEngineImpl.h Thu Jul 22 16:43:33 2010 +0100
@@ -68,6 +68,7 @@
class CSvgTimer;
// temporary for debugging
+class CSvgtBitmap;
//This includes the main rendering loop.
/**
@@ -327,6 +328,8 @@
*/
void GenerateMask( CFbsBitmap* aMask );
+ void GenerateMask(CSvgtBitmap* aMask);
+
/**
* Set background color
*
@@ -365,6 +368,9 @@
void SetGdiContextL(CFbsBitmap* aCurrentBitmap, CFbsBitmap* aMask = NULL);
void SetGdiContextL(CFbsBitmap* aCurrentBitmap, CFbsBitmap* aMask,TSize aCurrentBitmapSize,TDisplayMode aRenderDspMode,TDisplayMode aMaskDspMode);
+
+ void SetGdiContextL(CSvgtBitmap* aCurrentBitmap, CSvgtBitmap* aMask = NULL);
+
/**
* Start the Engine so that the first frame is drawn when the call is finished.
*
@@ -611,6 +617,10 @@
TBool IsSVGEnginePaused();
void SetBitmapHeader(const TDesC* aHeaderData);
+
+ void EnableTargetRendering(TBool aTargetRendering );
+ TBool IsTargetRenderingEnabled() const;
+
public: // Functions from base classes
// From CSvgElementImpl
/**
@@ -916,7 +926,7 @@
CFbsBitmap* iFrameBuffer;
CFbsBitmap* iMask;
-
+
TSize iFrameBufferSize; //NGA
TDisplayMode iRenderDspMode;
TDisplayMode iMaskDspMode;
@@ -931,6 +941,10 @@
TPtrC iLinkShow;
TBool iShowDebugInfo;
+ //M2G: target bitmap buffer and mask buffer
+ CSvgtBitmap* iTargetBitmapBuffer;
+ CSvgtBitmap* iTargetMaskBuffer;
+
TGfxRectangle2D iClipRect;
TSvgEngineState iSvgEngineState;
TAnimStatus iAnimationState;
@@ -960,6 +974,7 @@
//Stores Font Type information as passed by CSvgEngineInterfaceImpl
CSvgBitmapFontProvider *iSvgBitmapFontProvider;
+ TBool iIsTargetRenderingEnabled;
public:
TBool iCustomOption;
TBool iFrameBufferOverridesViewport;
--- a/svgtopt/SVG/SVGEngine/src/SVGContentHandler.cpp Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/SVG/SVGEngine/src/SVGContentHandler.cpp Thu Jul 22 16:43:33 2010 +0100
@@ -26,7 +26,7 @@
#include "SVGUseElementImpl.h"
#include "SVGAnimationElementImpl.h"
-#include "rxmlreader.h"
+#include <xml/rxmlreader.h>
#include "SVGPaintCssValueImpl.h"
#include "SVGPathElementImpl.h"
--- a/svgtopt/SVG/SVGEngine/src/SVGEngineImpl.cpp Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/SVG/SVGEngine/src/SVGEngineImpl.cpp Thu Jul 22 16:43:33 2010 +0100
@@ -59,6 +59,7 @@
#include "SVGTimeContainer.h"
#include "SVGMediaAnimationElementImpl.h"
+#include <svgtbitmap.h>
// Constants
// length of </text>
const TInt KClosingTextTagLength = 7;
@@ -748,9 +749,24 @@
// Get the redering result onto CFbsBitmap.
if(iFrameBufferSize.iWidth > 0)
- iGfxContext->UpdateFramebufferL( iFrameBuffer, iMask,iFrameBufferSize,iRenderDspMode,iMaskDspMode );
+ {
+ if(iIsTargetRenderingEnabled)
+ { // M2G
+ iGfxContext->UpdateFramebufferL( iTargetBitmapBuffer, iTargetMaskBuffer,iFrameBufferSize,
+ iTargetBitmapBuffer->DisplayMode(),iTargetMaskBuffer->DisplayMode());
+ }
+ else
+ iGfxContext->UpdateFramebufferL( iFrameBuffer, iMask,iFrameBufferSize,iRenderDspMode,
+ iMaskDspMode );
+ }
else
- iGfxContext->UpdateFramebufferL( iFrameBuffer, iMask );
+ {
+ if(iIsTargetRenderingEnabled) //M2G
+ iGfxContext->UpdateFramebufferL( iTargetBitmapBuffer, iTargetMaskBuffer );
+ else
+ iGfxContext->UpdateFramebufferL( iFrameBuffer, iMask );
+
+ }
if ( !iIgnoreUpdateScreen && iRequestObserver != NULL )
{
@@ -1259,6 +1275,13 @@
}
}
+void CSvgEngineImpl::GenerateMask(CSvgtBitmap* aMask)
+ {
+ if ( iGfxContext )
+ {
+ iGfxContext->GenerateMask( aMask );
+ }
+ }
//
// ---------------------------------------------------------------------------
// set background color
@@ -1372,7 +1395,38 @@
iGfxContext->ChangeBufferSizeL( TSize( 0,0 ) );
}
}
-
+//----------------------------------------------------------------------------------------------
+//M2G: SetGdiContextL() is overloaded to accept CSvgtBitmap to enable rendering on target buffer.
+//-----------------------------------------------------------------------------------------------
+void CSvgEngineImpl::SetGdiContextL(CSvgtBitmap* aCurrentBitmap, CSvgtBitmap* aMask)
+ {
+
+ // Handle for both Non-NULL and NULL parameter
+ iTargetBitmapBuffer = aCurrentBitmap;
+ iTargetMaskBuffer = aMask;
+
+ if ( aCurrentBitmap )
+ {
+ if ( !iGfxContext )
+ {
+ iGfxContext = CGfx2dGcOpenVG::NewL( iTargetBitmapBuffer->SizeInPixels(), iBitmapFontSpec, iSvgBitmapFontProvider, EFalse );
+
+ // 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( iTargetBitmapBuffer->SizeInPixels() );
+ }
+ }
+ else if ( iGfxContext )
+ {
+ iGfxContext->ChangeBufferSizeL( TSize( 0,0 ) );
+ }
+
+ }
// ---------------------------------------------------------------------------
// void CSvgEngineImpl::StartEngine(CSvgErrorImpl* aError)
// ---------------------------------------------------------------------------
@@ -1460,12 +1514,24 @@
// ---------------------------------------------------------------------------
void CSvgEngineImpl::RenderFrame( TUint aCurrentTime )
{
- if ( !iFrameBuffer || !iSvgDocument ||
- iFrameBuffer->SizeInPixels().iWidth == 0 || iFrameBuffer->SizeInPixels().iHeight == 0 )
+ if(iIsTargetRenderingEnabled) //M2G: If target rendering is enabled
{
- return;
+ if ( !iTargetBitmapBuffer || !iSvgDocument ||
+ iTargetBitmapBuffer->SizeInPixels().iWidth == 0 ||
+ iTargetBitmapBuffer->SizeInPixels().iHeight == 0 )
+ {
+ return;
+ }
}
-
+ else
+ {
+ if (!iFrameBuffer || !iSvgDocument
+ || iFrameBuffer->SizeInPixels().iWidth == 0
+ || iFrameBuffer->SizeInPixels().iHeight == 0)
+ {
+ return;
+ }
+ }
if ( aCurrentTime == 0 )
{
SeekEngine( 0 );
@@ -3153,6 +3219,21 @@
((CGfx2dGcOpenVG *)iGfxContext)->SetBitmapHeader(aHeaderData);
}
}
+//---------------------------------------------------------------
+// M2G: Enable rendering on target buffer.
+//----------------------------------------------------------------
+void CSvgEngineImpl::EnableTargetRendering(TBool aTargetRendering )
+ {
+ iIsTargetRenderingEnabled = aTargetRendering;
+ }
+
+//---------------------------------------------------------------
+// M2G: TBool CSvgEngineImpl::IsTargetRenderingEnabled() const
+//----------------------------------------------------------------
+TBool CSvgEngineImpl::IsTargetRenderingEnabled() const
+ {
+ return iIsTargetRenderingEnabled;
+ }
//NGA
// ---------------------------------------------------------------------------
// SetGdiContext File
--- a/svgtopt/SVG/SVGEngine/src/SVGEngineInterfaceImpl.cpp Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/SVG/SVGEngine/src/SVGEngineInterfaceImpl.cpp Thu Jul 22 16:43:33 2010 +0100
@@ -1499,6 +1499,13 @@
}
}
+EXPORT_C void CSvgEngineInterfaceImpl::GenerateMask(CSvgtBitmap* aMask, TInt aEngine )
+ {
+ if ( ChooseEngine( aEngine ) )
+ {
+ iSvgEngine->GenerateMask(aMask);
+ }
+ }
// --------------------------------------------------------------------------
// EXPORT_C void CSvgEngineInterfaceImpl::SetBackgroundColor(TUint32 aRGBA8888Color, CSvgEngineImpl* aEngine)
@@ -2465,6 +2472,19 @@
aEngine->SetGdiContextL( aFrameBuffer );
}
}
+
+// --------------------------------------------------------------------------
+// M2G: Overloaded SetGdiContextL() for CSvgtBitmap to enable rendering on target buffer.
+// ---------------------------------------------------------------------------
+EXPORT_C void CSvgEngineInterfaceImpl::SetGdiContextL( CSvgEngineImpl* aEngine, CSvgtBitmap* aFrameBuffer )
+ {
+ if( aEngine )
+ {
+ aEngine->EnableTargetRendering(ETrue);
+ aEngine->SetGdiContextL( aFrameBuffer );
+ }
+ }
+
// --------------------------------------------------------------------------
// EXPORT_C void CSvgEngineInterfaceImpl::SetDocument( CSvgEngineImpl* aEngine, CSvgDocumentImpl* aDocument )
// ---------------------------------------------------------------------------
--- a/svgtopt/SVG/SVGImpl/src/SVGDocumentImpl.cpp Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/SVG/SVGImpl/src/SVGDocumentImpl.cpp Thu Jul 22 16:43:33 2010 +0100
@@ -77,7 +77,7 @@
#include "SVGTimeContainer.h"
#include <ezgzip.h>
-#include <caf/caf.h>
+//#include <caf/caf.h>
#include <bautils.h>
// ==========================================================================
--- a/svgtopt/SVG/SVGImpl/src/SVGImageElementImpl.cpp Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/SVG/SVGImpl/src/SVGImageElementImpl.cpp Thu Jul 22 16:43:33 2010 +0100
@@ -29,7 +29,7 @@
#include <imcvcodc.h>
-#include <caf/caf.h>
+//#include <caf/caf.h>
const TInt KErrNoAttributeSet = -1;
#define KSVGWAITFORIMAGEDOWNLOAD 1
--- a/svgtopt/SVGEngineJI/BWINSCW/SVGEngineJIU.def Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/SVGEngineJI/BWINSCW/SVGEngineJIU.def Thu Jul 22 16:43:33 2010 +0100
@@ -87,4 +87,5 @@
?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 &)
+ ?SvgEngineRenderDocument@CSvgJavaInterfaceImpl@@QAEXHHIIM@Z @ 89 NONAME ; void CSvgJavaInterfaceImpl::SvgEngineRenderDocument(int, int, unsigned int, unsigned int, float)
--- a/svgtopt/SVGEngineJI/eabi/SVGEngineJIU.def Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/SVGEngineJI/eabi/SVGEngineJIU.def Thu Jul 22 16:43:33 2010 +0100
@@ -94,4 +94,5 @@
_ZTV10CJavaError @ 93 NONAME ; #<VT>#
_ZTV21CSvgJavaInterfaceImpl @ 94 NONAME ; #<VT>#
_ZN21CSvgJavaInterfaceImpl4NewLER9TFontSpec @ 95 NONAME
+ _ZN21CSvgJavaInterfaceImpl23SvgEngineRenderDocumentEiijjf @ 96 NONAME
--- a/svgtopt/SVGEngineJI/src/SvgJavaInterfaceImpl.cpp Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/SVGEngineJI/src/SvgJavaInterfaceImpl.cpp Thu Jul 22 16:43:33 2010 +0100
@@ -241,6 +241,34 @@
*/
}
+/*
+ * M2G: SvgEngineRenderDocument() overloaded to pass the CSvgtBitmap object to SvgEngine
+ */
+EXPORT_C void CSvgJavaInterfaceImpl::SvgEngineRenderDocument(
+ SvgEngineHandle aEngineHandle, SvgDocumentHandle aDocumentHandle,
+ SvgtBitmapHandle aSurfaceHandle, SvgtBitmapHandle aSurfaceMaskHandle,
+ TReal32 aCurrentTime )
+ {
+ CSvgEngineInterfaceImpl::iFileIsLoaded = ETrue;
+
+ SetDocument( (CSvgEngineImpl*)aEngineHandle, (CSvgDocumentImpl*)aDocumentHandle );
+
+ // GfxContext creation
+ TRAPD(error, SetGdiContextL( (CSvgEngineImpl*)aEngineHandle, (CSvgtBitmap*)aSurfaceHandle ) );
+ if ( error != KErrNone )
+ {
+ // ignore trap error
+ }
+
+ //this udpates things like Viewport with whatever preserveAspectRatio and widths are set
+ //InitializeEngine((CSvgEngineImpl*)aEngineHandle);
+
+ if ( ((CSvgtBitmap*)aSurfaceMaskHandle) != NULL)
+ GenerateMask((CSvgtBitmap*)aSurfaceMaskHandle);
+
+ RenderFrame( (CSvgEngineImpl*)aEngineHandle, (TUint)(aCurrentTime * 1000) );
+ }
+
/**
*
*/
@@ -2688,8 +2716,8 @@
default:
attribVal = KErrNotFound;
+ }
return attribVal;
- }
}
/**
* This maps the Enumeration from SVG to JSR.
--- a/svgtopt/VGRenderer/SWVG/eabi/SWVG.def Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/VGRenderer/SWVG/eabi/SWVG.def Thu Jul 22 16:43:33 2010 +0100
@@ -6,4 +6,6 @@
_ZTV15COpenVGRenderer @ 5 NONAME ; #<VT>#
_ZTV16CSWVGSurfaceImpl @ 6 NONAME ; #<VT>#
_ZTV21CSWOpenVGRendererImpl @ 7 NONAME ; #<VT>#
+ _ZTI22CSWVGTargetSurfaceImpl @ 8 NONAME
+ _ZTV22CSWVGTargetSurfaceImpl @ 9 NONAME
--- a/svgtopt/VGRenderer/SWVG/group/SWVG.mmp Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/VGRenderer/SWVG/group/SWVG.mmp Thu Jul 22 16:43:33 2010 +0100
@@ -32,7 +32,7 @@
SOURCE SWVGSurfaceImpl.cpp
SOURCEPATH ../../OpenVGRenderer/src
-SOURCE OpenVGRenderer.cpp
+SOURCE ../../SWVG/src/swopenvgtargetsurfaceimpl.cpp OpenVGRenderer.cpp
//By default, the build tools look for the WINSCW def file in a BWINS directory
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/SWVG/inc/swopenvgtargetsurfaceimpl.h Thu Jul 22 16:43:33 2010 +0100
@@ -0,0 +1,64 @@
+/*
+ * 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: CSWVGTargetSurfaceImpl header file
+ *
+*/
+
+#ifndef SWOPENVGTARGETSURFACEIMPL_H_
+#define SWOPENVGTARGETSURFACEIMPL_H_
+
+#include "SWVG.h"
+#include "MVGSurfaceImpl.h"
+
+#include <displaymode.h>
+
+class CSvgtBitmap;
+
+class CSWVGTargetSurfaceImpl : public CBase, public MVGSurfaceImpl
+{
+public:
+ static CSWVGTargetSurfaceImpl* NewL();
+ static CSWVGTargetSurfaceImpl* NewLC();
+
+ virtual ~CSWVGTargetSurfaceImpl();
+
+ virtual TInt InitializeSurface(TSize aSize, TInt aColorSpace);
+
+ virtual TInt CreateSurface(TInt /*aDisplayMode*/, RWindow */*aSurface*/, CFbsBitmap */*aBitmap*/);
+ virtual TInt CreateSurface(TInt aDisplayMode, RWindow *aSurface, CSvgtBitmap *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 CopyBitmap(TInt aDisplayMode,TInt aMaskMode,CSvgtBitmap *aBitmap, CSvgtBitmap *aMask, TSize aSize = TSize(0,0));
+
+ virtual TInt PrepareToBindClientBuffer();
+ virtual TInt BindClientBuffer(TInt buffer);
+
+ virtual TInt UnBindClientBuffer();
+
+ virtual void TerminateSurface();
+
+ TInt MapSymbianDisplayModeToOpenVG( TDisplayMode aMode) const;
+ TInt MapOpenVGErrorToSymbianError( TInt aError ) const;
+
+private:
+ CSWVGTargetSurfaceImpl();
+ void ConstructL();
+ TSize iSize;
+};
+
+#endif /* SWOPENVGTARGETSURFACEIMPL_H_ */
--- a/svgtopt/VGRenderer/SWVG/src/SWOpenVGRendererImpl.cpp Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/VGRenderer/SWVG/src/SWOpenVGRendererImpl.cpp Thu Jul 22 16:43:33 2010 +0100
@@ -17,6 +17,7 @@
#include "SWOpenVGRendererImpl.h"
#include "SWVGSurfaceImpl.h"
+#include "swopenvgtargetsurfaceimpl.h"
#include <VG/vgu.h>
@@ -77,7 +78,10 @@
{
}
-MVGSurfaceImpl* CSWOpenVGRendererImpl::CreateVGSurfaceL(TInt /*aOption*/)
+MVGSurfaceImpl* CSWOpenVGRendererImpl::CreateVGSurfaceL(TInt aOption)
{
- return CSWVGSurfaceImpl::NewL();
+ if(aOption)
+ return CSWVGSurfaceImpl::NewL();
+ else
+ return CSWVGTargetSurfaceImpl::NewL(); //M2G: Enable rendering on target buffer.
}
--- a/svgtopt/VGRenderer/SWVG/src/SWVGSurfaceImpl.cpp Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/VGRenderer/SWVG/src/SWVGSurfaceImpl.cpp Thu Jul 22 16:43:33 2010 +0100
@@ -104,7 +104,7 @@
ret = ::VGISymbianCopyToBitmap(aBitmap, aMask, VGI_COPY_TRANSPARENT_PIXELS);
}
- return KErrNone;
+ return ret;
}
TInt CSWVGSurfaceImpl::PrepareToBindClientBuffer()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/svgtopt/VGRenderer/SWVG/src/swopenvgtargetsurfaceimpl.cpp Thu Jul 22 16:43:33 2010 +0100
@@ -0,0 +1,226 @@
+/*
+ * 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: CSWVGTargetSurfaceImpl source file
+ *
+*/
+
+#include "swopenvgtargetSurfaceImpl.h"
+
+#include <platform/vg/vgcontext.h>
+
+#include <svgtbitmap.h>
+
+CSWVGTargetSurfaceImpl::CSWVGTargetSurfaceImpl()
+ {
+ }
+
+CSWVGTargetSurfaceImpl::~CSWVGTargetSurfaceImpl()
+ {
+ }
+
+CSWVGTargetSurfaceImpl* CSWVGTargetSurfaceImpl::NewL()
+ {
+ CSWVGTargetSurfaceImpl* self = CSWVGTargetSurfaceImpl::NewLC();
+ CleanupStack::Pop();
+ return self;
+ }
+
+CSWVGTargetSurfaceImpl* CSWVGTargetSurfaceImpl::NewLC()
+ {
+ CSWVGTargetSurfaceImpl* self = new (ELeave) CSWVGTargetSurfaceImpl();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+inline void CSWVGTargetSurfaceImpl::ConstructL()
+ {
+ }
+
+TInt CSWVGTargetSurfaceImpl::InitializeSurface(TSize aSize, TInt aColorSpace)
+ {
+ iSize = aSize;
+ TInt vgError = ::VGIInitialize(aSize.iWidth,aSize.iHeight, (VGIColorSpace)aColorSpace);
+ return MapOpenVGErrorToSymbianError(vgError);
+ }
+
+void CSWVGTargetSurfaceImpl::SetConfiguration(TInt /*aOption*/, const TAny* /*aValue*/)
+ {
+ }
+
+TInt CSWVGTargetSurfaceImpl::CreateSurface(TInt /*aDisplayMode*/, RWindow */*aSurface*/, CFbsBitmap */*aBitmap*/)
+ {
+ return KErrNotSupported;
+ }
+
+TInt CSWVGTargetSurfaceImpl::CreateSurface(TInt /*aDisplayMode*/, RWindow */*aSurface*/, CSvgtBitmap */*aBitmap*/)
+ {
+ return KErrNone;
+ }
+
+TInt CSWVGTargetSurfaceImpl::ResizeSurface(TSize aSize)
+ {
+ iSize = aSize;
+ TInt vgError = ::VGIResize(aSize.iWidth,aSize.iHeight);
+ return MapOpenVGErrorToSymbianError(vgError);
+ }
+
+TInt CSWVGTargetSurfaceImpl::CopyBitmap(TInt /*aDisplayMode*/, TInt /*aMaskMode*/, CFbsBitmap */*aBitmap*/, CFbsBitmap */*aMask*/, TSize /*aSize*/)
+ {
+ return KErrNotSupported;
+ }
+TInt CSWVGTargetSurfaceImpl::CopyBitmap(TInt /*aDisplayMode*/,TInt /*aMaskMode*/,CSvgtBitmap *aBitmap, CSvgtBitmap *aMask, TSize /*aSize*/)
+ {
+ VGIColorBufferFormat format =
+ (VGIColorBufferFormat)MapSymbianDisplayModeToOpenVG( (TDisplayMode)aBitmap->DisplayMode() );
+
+ TInt vgError = KErrNone;
+ if(aMask)
+ {
+ vgError = ::VGICopyToTarget(format,
+ aBitmap->Stride(), aBitmap->BitmapBuffer(),
+ aMask->Stride(), aMask->BitmapBuffer(),
+ VGI_SKIP_TRANSPARENT_PIXELS);
+ }
+ else
+ {
+ vgError = ::VGICopyToTarget(format,
+ aBitmap->Stride(), aBitmap->BitmapBuffer(),
+ 0, NULL,
+ VGI_COPY_TRANSPARENT_PIXELS);
+ }
+
+ return MapOpenVGErrorToSymbianError(vgError);
+ }
+
+TInt CSWVGTargetSurfaceImpl::PrepareToBindClientBuffer()
+ {
+ return KErrNone;
+ }
+
+TInt CSWVGTargetSurfaceImpl::BindClientBuffer(TInt buffer)
+ {
+ return MapOpenVGErrorToSymbianError(::VGIBindToImage(buffer));
+ }
+
+TInt CSWVGTargetSurfaceImpl::UnBindClientBuffer()
+ {
+ return MapOpenVGErrorToSymbianError(::VGIUnBindImage());
+ }
+
+void CSWVGTargetSurfaceImpl::TerminateSurface()
+ {
+ ::VGITerminate();
+ }
+
+TInt CSWVGTargetSurfaceImpl::MapSymbianDisplayModeToOpenVG( TDisplayMode aMode) const
+ {
+ VGIColorBufferFormat format;
+ switch( aMode )
+ {
+ case EColor16MA:
+ format = VGI_COLOR_BUFFER_FORMAT_ARGB8888;
+ break;
+
+ case EColor16MU:
+ format = VGI_COLOR_BUFFER_FORMAT_XRGB8888;
+ break;
+
+ case EColor16MAP:
+ format = VGI_COLOR_BUFFER_FORMAT_ARGB8888_PRE;
+ break;
+
+ case EColor16M:
+ format = VGI_COLOR_BUFFER_FORMAT_RGB888;
+ break;
+
+ case EColor64K:
+ format = VGI_COLOR_BUFFER_FORMAT_RGB565;
+ break;
+
+ case EColor4K:
+ format = VGI_COLOR_BUFFER_FORMAT_XRGB4444;
+ break;
+
+ default:
+ return KErrNotSupported;
+ }
+ return format;
+ }
+
+TInt CSWVGTargetSurfaceImpl::MapOpenVGErrorToSymbianError( TInt aError ) const
+ {
+ TInt error = KErrNone;
+ switch (aError)
+ {
+ case VGI_OK:
+ {
+ error = KErrNone;
+ break;
+ }
+ 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:
+ {
+ 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:
+ {
+ error = KErrUnknown;
+ break;
+ }
+ default:
+ {
+ error = KErrUnknown;
+ }
+ }
+
+ return error;
+ }
--- a/svgtopt/VGRenderer/inc/MVGSurfaceImpl.h Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/VGRenderer/inc/MVGSurfaceImpl.h Thu Jul 22 16:43:33 2010 +0100
@@ -23,6 +23,7 @@
class RWindow;
class CFbsBitmap;
+class CSvgtBitmap;
class MVGSurfaceImpl
{
@@ -39,12 +40,14 @@
virtual TInt InitializeSurface(TSize aSize, TInt aColorSpace) = 0;
virtual TInt CreateSurface(TInt aDisplayMode, RWindow *aSurface, CFbsBitmap *aBitmap) = 0;
+ virtual TInt CreateSurface(TInt /*aDisplayMode*/, RWindow */*aSurface*/, CSvgtBitmap */*aBitmap*/){ return KErrNotSupported; }
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 CopyBitmap(TInt /*aDisplayMode*/, TInt /*aMaskMode*/, CSvgtBitmap* /*aBitmap*/, CSvgtBitmap */*aMask*/, TSize /*aSize*/ = TSize(0,0)) { return KErrNotSupported; }
virtual TInt BindClientBuffer(TInt aBuffer) = 0;
--- a/svgtopt/VGRenderer/inc/VGSurface.h Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/VGRenderer/inc/VGSurface.h Thu Jul 22 16:43:33 2010 +0100
@@ -27,6 +27,8 @@
class CFbsBitmap;
class CVGRenderer;
+class CSvgtBitmap;
+
/**
* CVGSurface
*
@@ -121,6 +123,11 @@
return iImpl->CopyBitmap(aDisplayMode,aMaskMode, aBitmap, aMask, aSize);
}
+ TInt CopyBitmap(TInt aDisplayMode,TInt aMaskMode,CSvgtBitmap *aBitmap, CSvgtBitmap *aMask, TSize aSize)
+ {
+ return iImpl->CopyBitmap(aDisplayMode,aMaskMode, aBitmap, aMask, aSize);
+ }
+
/**
* @fn PrepareToBindClientBuffer
* Prepares the renderer to bind to an image.
--- a/svgtopt/gfx2d/inc/Gfx2dGcInterface.h Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/gfx2d/inc/Gfx2dGcInterface.h Thu Jul 22 16:43:33 2010 +0100
@@ -34,6 +34,7 @@
#include "SvgBitmapFontProvider.h"
class MGfxShape;
class MGfxPaint;
+class CSvgtBitmap;
typedef enum
{
@@ -347,6 +348,10 @@
*/
virtual void UpdateFramebufferL( CFbsBitmap* aFrameBuffer, CFbsBitmap* aMask ) = 0;
virtual void UpdateFramebufferL( CFbsBitmap* aFrameBuffer, CFbsBitmap* aMask,TSize aFrameBufferSize,TDisplayMode aFrameBufferMode,TDisplayMode aMaskDspMode ) =0;
+
+
+ virtual void UpdateFramebufferL( CSvgtBitmap* /*aFrameBuffer*/, CSvgtBitmap* /*aMask*/ ){}
+ virtual void UpdateFramebufferL( CSvgtBitmap* /*aFrameBuffer*/, CSvgtBitmap* /*aMask*/,TSize /*aFrameBufferSize*/,TDisplayMode /*aFrameBufferMode*/,TDisplayMode /*aMaskDspMode*/ ){}
/**
* Blend aFrameBuffer with background buffer using the opacity value
*
@@ -365,6 +370,7 @@
* @return
*/
virtual void GenerateMask(CFbsBitmap* aMask)=0;
+ virtual void GenerateMask(CSvgtBitmap* /*aMask*/){};
/**
* Set the fill opacity value
--- a/svgtopt/gfx2d/inc/Gfx2dGcOpenVG.h Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/gfx2d/inc/Gfx2dGcOpenVG.h Thu Jul 22 16:43:33 2010 +0100
@@ -26,6 +26,8 @@
#include "VGSurface.h"
#include <VG/openvg.h>
+class CSvgtBitmap;
+
const TUint8 KMediaAnimationVisible = 2;
/**
@@ -47,7 +49,7 @@
*/
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 );
+ static CGfx2dGcOpenVG* NewL( const TSize aBufferSize, TFontSpec& aFontSpec, CSvgBitmapFontProvider* aSvgBitmapFontProvider,SVGRendererId aRendererType,TBool aRenderOption = ETrue );
void GetFontScaled( TFloatFixPt aHeight, const TDesC& aTypefaceName, CFont*& aFont, TFontSpec& aFontSpec );
/**
@@ -352,7 +354,10 @@
void UpdateFramebufferL( CFbsBitmap* aBitmap, CFbsBitmap* aMask );
void UpdateFramebufferL( CFbsBitmap* aBitmap, CFbsBitmap* aMask,TSize BitmapSize,TDisplayMode aBitmapDspMode,TDisplayMode aMaskDspMode );
- /**
+
+ void UpdateFramebufferL( CSvgtBitmap* aBitmap, CSvgtBitmap* aMask );
+ void UpdateFramebufferL( CSvgtBitmap* aBitmap, CSvgtBitmap* aMask,TSize BitmapSize,TDisplayMode aBitmapDspMode,TDisplayMode aMaskDspMode );
+ /**
* Blend aFrameBuffer with background buffer using the opacity value
*
* @since 1.0
@@ -370,7 +375,8 @@
* @return
*/
void GenerateMask(CFbsBitmap* aMask);
-
+ void GenerateMask(CSvgtBitmap* aMask);
+
/**
* Set the fill opacity value
*
@@ -510,6 +516,12 @@
// Color conversion/copy to Symbian bitmap is needed as final step
TSize iColorBufferSize;
+ TDisplayMode iDisplayMode;
+
+ // M2G: Variable to specify the target rendering option (rendering onto bitmap or onto target)
+ TBool iRenderOption;
+ TBool iGraphicsContextCreated;
+
TGfxRectangle2D iClip;
MGfxPaint* iFillColor;
TFloatFixPt iFillOpacity;
@@ -535,10 +547,6 @@
TFontSpec iFontSpec;
//OpenVG stuff
- TDisplayMode iDisplayMode;
- TBool iGraphicsContextCreated;
- TBool iIsMainContext;
-
VGPaint iFillPaint;
VGPaint iStrokePaint;
VGPath iPath;
--- a/svgtopt/gfx2d/src/GfxGc/Gfx2dGcOpenVG.cpp Fri Jun 25 18:09:18 2010 +0100
+++ b/svgtopt/gfx2d/src/GfxGc/Gfx2dGcOpenVG.cpp Thu Jul 22 16:43:33 2010 +0100
@@ -48,6 +48,7 @@
// OpenVG API Binding Symbian specific
#include <vg/vgcontext_symbian.h>
+#include <svgtbitmap.h>
// For allocating path segment type array
// Found 130 to be max size at bootup
const TInt KPathSegmentTypeInitialSize = 130;
@@ -61,20 +62,21 @@
// --------------------------------------------------------------------------
// CGfx2dGcOpenVG::CGfx2dGcOpenVG() : iScale( 1 ),
// ---------------------------------------------------------------------------
-CGfx2dGcOpenVG::CGfx2dGcOpenVG( TBool /* aIsMainContext */ ) :
+CGfx2dGcOpenVG::CGfx2dGcOpenVG( TBool aRenderOption ) :
+ iRenderOption(aRenderOption),
+ iGraphicsContextCreated( EFalse ),
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),
+ iFontSize( 10 ),
+ iFontWeight( -1 ),
+ iFontStyle( -1 ),
+ iFamilies( NULL ),
+ iTextAnchor( EGfxTextAnchorNone ),
+ iTextDecoration( EGfxTextDecorationNone ),
+ iRenderQuality(VG_RENDERING_QUALITY_BETTER),
iCurrentRendererType(ESVGRendererSW)
{
@@ -86,9 +88,9 @@
// --------------------------------------------------------------------------
// CGfx2dGcOpenVG* CGfx2dGcOpenVG::NewL( CFbsBitmap* aFrameBuffer, TFontSpec& aFontSpec )
// ---------------------------------------------------------------------------
- CGfx2dGcOpenVG* CGfx2dGcOpenVG::NewL( const TSize aBufferSize, TFontSpec& aFontSpec, CSvgBitmapFontProvider* aSvgBitmapFontProvider, TBool aIsMainContext )
+ CGfx2dGcOpenVG* CGfx2dGcOpenVG::NewL( const TSize aBufferSize, TFontSpec& aFontSpec, CSvgBitmapFontProvider* aSvgBitmapFontProvider, TBool aRenderOption )
{
- CGfx2dGcOpenVG* self = new( ELeave ) CGfx2dGcOpenVG( aIsMainContext );
+ CGfx2dGcOpenVG* self = new( ELeave ) CGfx2dGcOpenVG( aRenderOption );
CleanupStack::PushL( self );
self->ConstructL( aBufferSize, aFontSpec, aSvgBitmapFontProvider);
CleanupStack::Pop();
@@ -123,7 +125,7 @@
iDashArray = new ( ELeave ) CArrayFixFlat<VGfloat>( 32 );
- iVgRenderer = CVGRenderer::NewL(ESVGRendererSW, 0);
+ iVgRenderer = CVGRenderer::NewL(ESVGRendererSW, iRenderOption);
iVgSurface = iVgRenderer->GetCurrentSurface();
ChangeBufferSizeL( aBufferSize );
}
@@ -131,9 +133,9 @@
// --------------------------------------------------------------------------
// CGfx2dGcOpenVG* CGfx2dGcOpenVG::NewL( CFbsBitmap* aFrameBuffer, TFontSpec& aFontSpec )
// ---------------------------------------------------------------------------
- CGfx2dGcOpenVG* CGfx2dGcOpenVG::NewL( const TSize aBufferSize, TFontSpec& aFontSpec, CSvgBitmapFontProvider* aSvgBitmapFontProvider,SVGRendererId aRendererType,TBool aIsMainContext )
+ CGfx2dGcOpenVG* CGfx2dGcOpenVG::NewL( const TSize aBufferSize, TFontSpec& aFontSpec, CSvgBitmapFontProvider* aSvgBitmapFontProvider,SVGRendererId aRendererType,TBool aRenderOption )
{
- CGfx2dGcOpenVG* self = new( ELeave ) CGfx2dGcOpenVG( aIsMainContext );
+ CGfx2dGcOpenVG* self = new( ELeave ) CGfx2dGcOpenVG( aRenderOption );
CleanupStack::PushL( self );
self->ConstructL( aBufferSize, aFontSpec, aSvgBitmapFontProvider,aRendererType);
CleanupStack::Pop();
@@ -161,7 +163,7 @@
iDashArray = new ( ELeave ) CArrayFixFlat<VGfloat>( 32 );
iCurrentRendererType = aRendererType;
- iVgRenderer = CVGRenderer::NewL(aRendererType, 0);
+ iVgRenderer = CVGRenderer::NewL(aRendererType, iRenderOption);
iVgSurface = iVgRenderer->GetCurrentSurface();
iVgSurface->InitializeSurface( aBufferSize, VGI_COLORSPACE_SRGB );
@@ -2325,6 +2327,36 @@
iVgRenderer->vgSeti( VG_FILTER_CHANNEL_MASK, KOriginalFilterMasks );
}
+ void CGfx2dGcOpenVG::GenerateMask(CSvgtBitmap* 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;
+
+ // Get data address of last line and move upwards (negative stride)
+ // OpenVG uses Cartesian coordinate system and Symbian uses Screen coordinate system.
+
+ iVgRenderer->vgReadPixels( aMask->BitmapBuffer(), -KStride, format, 0, 0,
+ iColorBufferSize.iWidth, iColorBufferSize.iHeight );
+ // 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
@@ -2987,3 +3019,108 @@
{
return(iVgRenderer->TLVEncodedData());
}
+
+//--------------------------------------------------------------------------------
+// M2G: UpdateFramebufferL() is overloaded to enable rendering on target buffer.
+//--------------------------------------------------------------------------------
+void CGfx2dGcOpenVG::UpdateFramebufferL( CSvgtBitmap* aBitmap, CSvgtBitmap* 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 = aBitmap->Stride();
+
+ iVgRenderer->vgReadPixels( aBitmap->BitmapBuffer(), -KStride, VG_BW_1, 0, 0,
+ iColorBufferSize.iWidth, iColorBufferSize.iHeight );
+ }
+ // 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("VGICopyToTarget 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);
+ }
+ }
+ }
+
+//--------------------------------------------------------------------------------
+// M2G: UpdateFramebufferL() is overloaded to enable rendering on target buffer.
+//--------------------------------------------------------------------------------
+void CGfx2dGcOpenVG::UpdateFramebufferL( CSvgtBitmap* aBitmap, CSvgtBitmap* 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 = aBitmap->Stride();
+
+ iVgRenderer->vgReadPixels( aBitmap->BitmapBuffer(), -KStride, VG_BW_1, 0, 0,
+ iColorBufferSize.iWidth, iColorBufferSize.iHeight );
+
+ }
+ // 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("VGICopyToTarget 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);
+ }
+ }
+
+ }