Remerge NVGRenderStage component and fixes for Bug 26, Bug 1361, Bug 2098 RCL_3 PDK_3.0.i
authorWilliam Roberts <williamr@symbian.org>
Fri, 30 Apr 2010 12:31:01 +0100
branchRCL_3
changeset 49 d3ab1e9a27d1
parent 45 6ef40bf8fd34 (current diff)
parent 44 14a1a9556453 (diff)
child 57 1cd1c067a146
Remerge NVGRenderStage component and fixes for Bug 26, Bug 1361, Bug 2098
fontsupport/fontutils/iTypeRaster/armv5/ityperast.RSC
fontsupport/fontutils/iTypeRaster/armv5/ityperast.dll
fontsupport/fontutils/iTypeRaster/winscw/ityperast.RSC
fontsupport/fontutils/iTypeRaster/winscw/ityperast.dll
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fontsupport/fontutils/FontUtils/group/bld.inf	Fri Apr 30 12:31:01 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Bldmake component description file for the FontUtils component
+*
+*/
+
+PRJ_EXPORTS
+
+// Export IBY files
+../../rom/FontUtils.iby                              CORE_MW_LAYER_IBY_EXPORT_PATH(FontUtils.iby)
+../../rom/fonts_variant.iby                          CUSTOMER_MW_LAYER_IBY_EXPORT_PATH(fonts_variant.iby)
+
+PRJ_MMPFILES
+#ifndef TOOLS
+  FontUtils.mmp
+#endif
+
--- a/fontsupport/fontutils/group/bld.inf	Wed Apr 14 17:02:13 2010 +0300
+++ b/fontsupport/fontutils/group/bld.inf	Fri Apr 30 12:31:01 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -16,14 +16,6 @@
 */
 
 
-
-// BLD.INF
-//
-// Copyright (c) 1999 Symbian Ltd.  All rights reserved.
-//
-
-#include <platform_paths.hrh>
-
 PRJ_EXPORTS
 
 // Copy font rasterizer
@@ -99,10 +91,6 @@
 ../Vectorfonts/Series60Korean.ttf                        /epoc32/release/armv5/udeb/Series60Korean.ttf
 ../Vectorfonts/Series60Korean.ttf                        /epoc32/release/armv5/urel/Series60Korean.ttf
 
-// Export IBY files
-../rom/FontUtils.iby                              CORE_MW_LAYER_IBY_EXPORT_PATH(FontUtils.iby)
-../rom/fonts_variant.iby                          CUSTOMER_MW_LAYER_IBY_EXPORT_PATH(fonts_variant.iby)
-
 ./removegtfiles.meta                             /epoc32/tools/makefile_templates/s60/removegtfiles.meta
 ./removegtfiles.flm                              /epoc32/tools/makefile_templates/s60/removegtfiles.flm
 
@@ -114,8 +102,6 @@
 
 PRJ_MMPFILES
 #ifndef TOOLS
-    ../FontUtils/group/FontUtils.mmp
-
     // Remove Symbian fonts
     #ifndef SBSV2
       gnumakefile removegtfiles.mk
Binary file fontsupport/fontutils/iTypeRaster/armv5/ityperast.RSC has changed
Binary file fontsupport/fontutils/iTypeRaster/armv5/ityperast.dll has changed
Binary file fontsupport/fontutils/iTypeRaster/winscw/ityperast.RSC has changed
Binary file fontsupport/fontutils/iTypeRaster/winscw/ityperast.dll has changed
--- a/fontsupport/group/bld.inf	Wed Apr 14 17:02:13 2010 +0300
+++ b/fontsupport/group/bld.inf	Fri Apr 30 12:31:01 2010 +0100
@@ -17,4 +17,4 @@
 
 
 #include "../fontprovider/Group/bld.inf"
-#include "../fontutils/group/bld.inf"
+#include "../fontutils/FontUtils/group/bld.inf"
--- a/skins/AknSkinContent/group/bld.inf	Wed Apr 14 17:02:13 2010 +0300
+++ b/skins/AknSkinContent/group/bld.inf	Fri Apr 30 12:31:01 2010 +0100
@@ -55,8 +55,26 @@
   ./skingenerator.meta                      /epoc32/tools/makefile_templates/skins/skingenerator.meta
   ./skingenerator.xml                       /epoc32/tools/makefile_templates/skins/skingenerator.xml
 
-  :zip ../srcdata/haze/haze.zip             |../srcdata/haze
-  :zip ../srcdata/jing/jing.zip             |../srcdata/jing
+  :zip ../srcdata/haze/haze.zip             /epoc32/s60/skins/haze
+  :zip ../srcdata/jing/jing.zip             /epoc32/s60/skins/jing
+
+//MattD 200912015 - Really nasty workaround for ${EXTENSION_ROOT} having a getting the wrong value during a platform build.
+//Exporting the default skin and running it from the epoc32/s60/skins location like the other ones... 
+  
+../srcdata/scalableseries60skin/scalableseries60skin.txt                      /epoc32/s60/skins/scalableseries60skin/
+../srcdata/scalableseries60skin/gfx/qgn_graf_bg_gene.svg                      /epoc32/s60/skins/scalableseries60skin/gfx/
+../srcdata/scalableseries60skin/gfx/qgn_graf_dim_wipe_lsc_left.bmp            /epoc32/s60/skins/scalableseries60skin/gfx/
+../srcdata/scalableseries60skin/gfx/qgn_graf_dim_wipe_lsc_left_mask_soft.bmp  /epoc32/s60/skins/scalableseries60skin/gfx/
+../srcdata/scalableseries60skin/gfx/qgn_graf_idle_fade.bmp                    /epoc32/s60/skins/scalableseries60skin/gfx/
+../srcdata/scalableseries60skin/gfx/qgn_graf_idle_fade_lsc.bmp                /epoc32/s60/skins/scalableseries60skin/gfx/
+../srcdata/scalableseries60skin/gfx/qgn_graf_idle_fade_lsc_mask_soft.bmp      /epoc32/s60/skins/scalableseries60skin/gfx/
+../srcdata/scalableseries60skin/gfx/qgn_graf_idle_fade_mask_soft.bmp          /epoc32/s60/skins/scalableseries60skin/gfx/
+../srcdata/scalableseries60skin/gfx-ah/qgn_graf_idle_fade.bmp                 /epoc32/s60/skins/scalableseries60skin/gfx-ah/
+../srcdata/scalableseries60skin/gfx-ah/qgn_graf_idle_fade_mask_soft.bmp       /epoc32/s60/skins/scalableseries60skin/gfx-ah/
+../srcdata/scalableseries60skin/gfx-ah/qgn_graf_pb_status_backg.bmp           /epoc32/s60/skins/scalableseries60skin/gfx-ah/
+../srcdata/scalableseries60skin/gfx-ah/qgn_graf_pb_status_backg_mask.bmp      /epoc32/s60/skins/scalableseries60skin/gfx-ah/
+../srcdata/scalableseries60skin/gfx-ah/qgn_graf_simpd_status_backg.bmp        /epoc32/s60/skins/scalableseries60skin/gfx-ah/
+../srcdata/scalableseries60skin/gfx-ah/qgn_graf_simpd_status_backg_mask.bmp   /epoc32/s60/skins/scalableseries60skin/gfx-ah/
 #endif
 
 PRJ_EXTENSIONS
@@ -66,19 +84,20 @@
   OPTION AKNSSKINNAME scalableseries60skin
   OPTION AKNSSKINREALNAME series60skin
   OPTION AKNSSKINUID 101f84b9
-  OPTION AKNSSRCDIR ../srcdata/scalableseries60skin
+//OPTION AKNSSRCDIR $(EXTENSION_ROOT)/../srcdata/scalableseries60skin  
+  OPTION AKNSSRCDIR $(EPOCROOT)/epoc32/s60/skins/scalableseries60skin
 END
 START EXTENSION skins/skingenerator
   OPTION AKNSSKINNAME jing
   OPTION AKNSSKINREALNAME jing
   OPTION AKNSSKINUID 2000B12E
-  OPTION AKNSSRCDIR ../srcdata/jing
+  OPTION AKNSSRCDIR $(EPOCROOT)/epoc32/s60/skins/jing
 END
 START EXTENSION skins/skingenerator
   OPTION AKNSSKINNAME haze
   OPTION AKNSSKINREALNAME haze
   OPTION AKNSSKINUID 2000B12D
-  OPTION AKNSSRCDIR ../srcdata/haze
+  OPTION AKNSSRCDIR $(EPOCROOT)/epoc32/s60/skins/haze
 END
 START EXTENSION s60/mif2cdlindex
   OPTION TARGETFILE series60skinindexdll_inst.cpp
--- a/skins/AknSkinContent/group/scalableseries60skin.mk	Wed Apr 14 17:02:13 2010 +0300
+++ b/skins/AknSkinContent/group/scalableseries60skin.mk	Fri Apr 30 12:31:01 2010 +0100
@@ -95,7 +95,7 @@
 
 RESOURCE :
 	cd $(AKNSSRCDIR) && \
-	mifconv $(AKNSSKINREALNAME).mif /F$(AKNSDATAGENDIR)\$(AKNSSKINREALNAME)_MIFList.txt && \
+	mifconv $(AKNSSKINREALNAME).mif -v3 /F$(AKNSDATAGENDIR)\$(AKNSSKINREALNAME)_MIFList.txt && \
 	MifToCdlIndex -p..\..\srcdata\scalableseries60skin\MifIndexDll -s $(AKNSSKINREALNAME).mif $(AKNSSKINREALNAME)IndexDll 0x$(AKNSSKINUID) && \
 	perl -S ecopyfile.pl $(AKNSSKINREALNAME).mbm $(AKNSDATAGENDIR)\$(AKNSSKINREALNAME).mbm && \
 	perl -S ecopyfile.pl $(AKNSSKINREALNAME).mif $(AKNSDATAGENDIR)\$(AKNSSKINREALNAME).mif && \
--- a/skins/AknSkinContent/group/skingenerator.flm	Wed Apr 14 17:02:13 2010 +0300
+++ b/skins/AknSkinContent/group/skingenerator.flm	Fri Apr 30 12:31:01 2010 +0100
@@ -40,40 +40,34 @@
 
 # AKNSTARGETDIR    --> to copy .skn files
 # AKNSBMPTARGETDIR --> to copy .mif/.mbm files
+#MattD 20091208 - Would be prettier if I generated these, but I'm short on time...
+AKNSTARGETDIR:=$(EPOCROOT)/epoc32/data/z/private/10207114/import/$(AKNSSKINUID)
+AKNSTARGETDIR:=${AKNSTARGETDIR} $(EPOCROOT)/epoc32/release/winscw/udeb/z/private/10207114/import/$(AKNSSKINUID)
+AKNSTARGETDIR:=${AKNSTARGETDIR} $(EPOCROOT)/epoc32/release/winscw/urel/z/private/10207114/import/$(AKNSSKINUID)
 
-ifeq ($(PLATFORM),ARMV5)
-  AKNSTARGETDIR:=$(EPOCROOT)/epoc32/data/z/private/10207114/import/$(AKNSSKINUID)
-  AKNSBMPTARGETDIR:=$(EPOCROOT)/epoc32/data/z/resource/skins/$(AKNSSKINUID)
-else
-  AKNSTARGETDIR:=$(EPOCROOT)/epoc32/release/$(PLATFORM)/$(CFG)/z/private/10207114/import/$(AKNSSKINUID)
-  AKNSBMPTARGETDIR:=$(EPOCROOT)/epoc32/release/$(PLATFORM)/$(CFG)/z/resource/skins/$(AKNSSKINUID)
-endif
+AKNSBMPTARGETDIR:=$(EPOCROOT)/epoc32/data/z/resource/skins/$(AKNSSKINUID)
+AKNSBMPTARGETDIR:=${AKNSBMPTARGETDIR} $(EPOCROOT)/epoc32/release/winscw/udeb/z/resource/skins/$(AKNSSKINUID)
+AKNSBMPTARGETDIR:=${AKNSBMPTARGETDIR} $(EPOCROOT)/epoc32/release/winscw/urel/z/resource/skins/$(AKNSSKINUID)
 
 CREATABLEPATHS:=$(AKNSTARGETDIR) $(AKNSBMPTARGETDIR)
 
-ifeq ($(strip $(AKNSSRCDIR)),)
-# Output dir for the skins
-AKNSSRCDIR:=$(EPOCROOT)/epoc32/include/skins/$(AKNSSKINREALNAME)
-else
-AKNSSRCDIR:=$(EXTENSION_ROOT)/$(AKNSSRCDIR)
-endif
-
 # By default
 #AKNSGENDIR:=
-AKNSDATAGENDIR:=$(EXTENSION_ROOT)/../generated/$(AKNSSKINNAME)/data
+AKNSDATAGENDIR:=$(EPOCROOT)/epoc32/build/generated/skins/$(AKNSSKINNAME)/data
 AKNSTARGETDIR:=$(subst //,/,$(AKNSTARGETDIR))
 AKNSBMPTARGETDIR:=$(subst //,/,$(AKNSBMPTARGETDIR))
 AKNSSRCDIR:=$(subst //,/,$(AKNSSRCDIR))
 AKNSGENDIR:=$(subst //,/,$(AKNSGENDIR))
 EPOCTOOLS:=$(subst //,/,$(EPOCTOOLS))
 
+TARGETSKN:=$(subst //,/,$(patsubst %,%/$(notdir $(AKNSSKINREALNAME).skn),$(AKNSTARGETDIR)))
+TARGETMIF:=$(subst //,/,$(patsubst %,%/$(notdir $(AKNSSKINREALNAME).mif),$(AKNSBMPTARGETDIR)))
+TARGETMBM:=$(subst //,/,$(patsubst %,%/$(notdir $(AKNSSKINREALNAME).mbm),$(AKNSBMPTARGETDIR)))
 
-TARGETSKN:=$(AKNSTARGETDIR)/$(AKNSSKINREALNAME).skn
-TARGETMIF:=$(AKNSBMPTARGETDIR)/$(AKNSSKINREALNAME).mif
 CREATABLEPATHS:=$(CREATABLEPATHS) $(AKNSGENDIR) $(AKNSDATAGENDIR)
 
 ifeq ($(SKINDEBUG),0)
-$(info <AKNSSKINREALNAME aknsskinrealname=$(AKNSSKINREALNAME)'/>)
+$(info <AKNSSKINREALNAME aknsskinrealname='$(AKNSSKINREALNAME)'/>)
 $(info <TARGETSKN targetskn='$(TARGETSKN)'/>)
 $(info <TARGETMIF targetmif='$(TARGETMIF)'/>)
 $(info <AKNSSRCDIR aknssrcdir='$(AKNSSRCDIR)'/>)
@@ -87,24 +81,28 @@
 $(SKNMIFGUARD):=1
 RELEASEABLES:=$(TARGETSKN) $(TARGETMIF)
 ifeq ($(INPUTBMPS),yes)
-RELEASEABLES:=$(RELEASEABLES) $(basename $(TARGETMIF)).mbm
+RELEASEABLES:=$$(RELEASEABLES) $(TARGETMBM)
 endif
 
-BITMAP:: $(TARGETMIF)
+BITMAP:: $$(RELEASEABLES)
 
 $(TARGETMIF) : $(AKNSDATAGENDIR)/$(AKNSSKINREALNAME).mif
-	$(call startrule,mifskncopy,FORCESUCCESS) \
-	$(GNUCP) $$< $$@ && \
-	$(GNUCHMOD) a+rw "$$@" && \
-	$(GNUCP) $$(basename $$<).skn $(TARGETSKN) && \
-	$(GNUCHMOD) a+rw "$(TARGETSKN)" \
-	$(call endrule,mifskncopy)
-ifeq ($(INPUTBMPS),yes)
+	$(call startrule,mifcopy,FORCESUCCESS) \
+	$(GNUCP) '$(AKNSDATAGENDIR)/$(AKNSSKINREALNAME).mif' '$$@' \
+	$(call endrule,mifcopy)
+
+$(TARGETSKN) : $(AKNSDATAGENDIR)/$(AKNSSKINREALNAME).skn
+	$(call startrule,skincopy,FORCESUCCESS) \
+	$(GNUCP) '$(AKNSDATAGENDIR)/$(AKNSSKINREALNAME).skn' '$$@' \
+	$(call endrule,skincopy)
+
+$(TARGETMBM) : $(AKNSDATAGENDIR)/$(AKNSSKINREALNAME).mbm 
 	$(call startrule,mbmcopy,FORCESUCCESS) \
-	$(GNUCP) $$(basename $$<).mbm $$(basename $$@).mbm && \
-	$(GNUCHMOD) a+rw "$$(basename $$@).mbm" \
+	$(GNUCP) '$(AKNSDATAGENDIR)/$(AKNSSKINREALNAME).mbm' '$$@' \
 	$(call endrule,mbmcopy)
-endif
+
+# Quick patch to get it to do the right thing...
+$(AKNSDATAGENDIR)/$(AKNSSKINREALNAME).mbm : $(AKNSDATAGENDIR)/$(AKNSSKINREALNAME).mif 
 
 $(AKNSDATAGENDIR)/$(AKNSSKINREALNAME).skn : $(SKINCOMPILER) $(AKNSSRCDIR)/$(AKNSSKINNAME).txt
 	$(call startrule,generateskn,FORCESUCCESS) \
@@ -117,16 +115,8 @@
 $(AKNSDATAGENDIR)/$(AKNSSKINREALNAME).mif : $(MIFTOOL) $(AKNSDATAGENDIR)/$(AKNSSKINREALNAME).skn
 	$(call startrule,generatemif,FORCESUCCESS)\
 	cd $(AKNSSRCDIR) && \
-	$(MIFTOOL) $(AKNSSKINREALNAME).mif -F$(AKNSDATAGENDIR)/$(AKNSSKINREALNAME)_MIFList.txt && \
-	$(GNUCP) $(AKNSSKINREALNAME).mif $(AKNSDATAGENDIR)/$(AKNSSKINREALNAME).mif \
+	$(MIFTOOL) $(AKNSDATAGENDIR)/$(AKNSSKINREALNAME).mif -V$(SVGENCODINGVERSION) -F$(AKNSDATAGENDIR)/$(AKNSSKINREALNAME)_MIFList.txt \
 	$(call endrule,generatemif)
-ifeq ($(INPUTBMPS),yes)
-	$(call startrule,copymbm2generatedfolder,FORCESUCCESS)\
-	cd $(AKNSSRCDIR) && \
-	$(GNUCP) $(AKNSSKINREALNAME).mbm $(AKNSDATAGENDIR)/$(AKNSSKINREALNAME).mbm \
-	$(call endrule,copymbm2generatedfolder)
-endif	
-	
 
 CLEANTARGETS:=$$(CLEANTARGETS) $$(RELEASEABLES) $(AKNSDATAGENDIR)/$(AKNSSKINREALNAME).mif
 ifeq ($(INPUTBMPS),yes)
--- a/skins/AknSkinContent/group/skingenerator.xml	Wed Apr 14 17:02:13 2010 +0300
+++ b/skins/AknSkinContent/group/skingenerator.xml	Fri Apr 30 12:31:01 2010 +0100
@@ -37,6 +37,7 @@
 		  <param name='AKNSSKINUID' default=""/>
 		  <param name='AKNSSRCDIR' default=""/>
 		  <param name='AKNSGENDIR' default=""/>
+		  <param name='SVGENCODINGVERSION' default="3" /> <!-- Prefer SVGB files -->
 		  <param name='INPUTBMPS' default='yes'/>
 
 		  <param name='SKINDEBUG' default='1'/>
--- a/uiconfig/s60config/src/epoc_iti.ini	Wed Apr 14 17:02:13 2010 +0300
+++ b/uiconfig/s60config/src/epoc_iti.ini	Fri Apr 30 12:31:01 2010 +0100
@@ -1,4 +1,4 @@
-MegabytesOfFreeMemory 128
+MegabytesOfFreeMemory 192
 
 configuration epoc_360x640_touch.ini
 configuration epoc_640x360_touch_qwerty.ini
@@ -14,6 +14,9 @@
 symbian_base_use_gce ON
 symbian_graphics_use_gce ON
 
+SYMBIAN_GRAPHICS_USE_OPENWF on
+SYMBIAN_GRAPHICS_USE_EGL_REF on
+
 FBSRASTERIZER_DLL fbsrasterizer.dll
 
 patchdata_apserv_dll_KApaLoadDataRecognizersOnDemand 1
Binary file uiconfig/s60config/src/hw_wsini.ini has changed
Binary file uiconfig/s60config/src/wsini_iti.ini has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uigraphics/NVGRenderStage/group/bld.inf	Fri Apr 30 12:31:01 2010 +0100
@@ -0,0 +1,22 @@
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+// Symbian Foundation Ltd - conversion from nvgrenderstage
+//
+// Description:
+//
+
+PRJ_MMPFILES
+nvgrenderstage.mmp
+
+PRJ_EXPORTS
+../rom/nvgrenderstage.iby  /epoc32/rom/include/nvgrenderstage.iby
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uigraphics/NVGRenderStage/group/nvgrenderstage.mmp	Fri Apr 30 12:31:01 2010 +0100
@@ -0,0 +1,53 @@
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+// Symbian Foundation Ltd - conversion from nvgrenderstage
+//
+// Description:
+// Render Stage which converts NVG Icon extended bitmaps into simple bitmaps
+// using nvgdecoder.dll
+//
+
+TARGET		nvgrenderstage.dll
+TARGETTYPE	PLUGIN
+UID		0x10009D8D 0x1028653A
+CAPABILITY      PowerMgmt ReadDeviceData WriteDeviceData ProtServ
+VENDORID	0x70000001
+
+MACRO		SYMBIAN_GRAPHICS_GCE
+
+USERINCLUDE	../src
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/platform/vg
+
+SOURCEPATH	../src
+SOURCE	nvgrenderstage.cpp
+SOURCE	nvgrenderstagefactory.cpp
+SOURCE	nvgrenderstageplugin.cpp
+SOURCE	vgigraphicsinterface.cpp
+
+SOURCEPATH	../res
+RESOURCE	nvgrenderstage.rss
+
+LIBRARY	ecom.lib
+LIBRARY	estor.lib
+LIBRARY	fbscli.lib
+LIBRARY	euser.lib
+LIBRARY	gdi.lib
+LIBRARY	bitgdi.lib
+LIBRARY	wsgraphicdrawer.lib
+LIBRARY	graphicsresource.lib
+LIBRARY	ws32.lib // for RWsGraphicMsgBuf 
+LIBRARY nvgdecoder_sw.lib // for CNvgEngine
+LIBRARY libVGI.lib
+LIBRARY libOpenVG_sw.lib
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uigraphics/NVGRenderStage/res/nvgrenderstage.rss	Fri Apr 30 12:31:01 2010 +0100
@@ -0,0 +1,43 @@
+// nvgrenderstage.rss
+
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies 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 the standard wserv plugins
+// 
+//
+
+#include <ecom/registryinfo.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+	{
+	dll_uid = 0x1028653A;
+	interfaces =
+		{
+		INTERFACE_INFO
+			{
+			interface_uid = 0x10285A29;
+			implementations =
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x1028653B;
+					version_no = 1;
+					display_name = "NVGRenderStage";
+					default_data = "";
+					opaque_data = "";
+					}
+				};
+			}
+		};
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uigraphics/NVGRenderStage/rom/nvgrenderstage.iby	Fri Apr 30 12:31:01 2010 +0100
@@ -0,0 +1,21 @@
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies 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 NVGRENDERSTAGE_IBY
+#define NVGRENDERSTAGE_IBY
+
+ECOM_PLUGIN(nvgrenderstage.dll, nvgrenderstage.rsc)
+#endif // NVGRENDERSTAGE_IBY
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uigraphics/NVGRenderStage/src/nvgrenderstage.cpp	Fri Apr 30 12:31:01 2010 +0100
@@ -0,0 +1,1176 @@
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+// Symbian Foundation Ltd- conversion from t_extendedbitmaprenderstage
+//
+// Description:
+//
+
+#include "nvgrenderstage.h"
+#include <graphics/wsrenderstage.h>
+#include <s32mem.h>
+#include <AknIconHeader.h>
+#include <AknIconUtils.h>
+
+TCachedConversion::TCachedConversion() :
+  iLink(), iCachedResult(NULL)
+  {}
+
+TCachedConversion::~TCachedConversion()
+  {
+  delete iCachedResult;
+  }
+
+const TUid KUidNvgExtendedBitmap = {0x39b9273e};  
+
+CNvgRenderStage::CNvgRenderStage() : 	
+	iExtendedBitmapError(KErrNone), 
+	iCache(_FOFF(TCachedConversion,iLink)), 
+	iCacheIterator(iCache),
+	iCacheFree(MAX_NVG_CACHE_SIZE)
+	{	
+	}
+
+/** Called by CNvgRenderStageFactory::CreateRenderStageL() and 
+CNvgRenderStageFactory::CreateFinalRenderStageL() when a new render stage
+called "nvgbitmap" is to be created. The only parameter used by this render stage
+is aNextStage, the rest are commented out to prevent warnings.
+@see MWsRenderStageFactory::CreateRenderStageL()
+@see MWsRenderStageFactory::CreateFinalRenderStageL()
+ */
+CNvgRenderStage* CNvgRenderStage::NewL(MWsGraphicDrawerEnvironment* /*aEnv*/, MWsScreen* /*aScreen*/, MWsScreenRedraw* /*aScreenRedraw*/, CWsRenderStage* aNextStage)
+	{
+	CNvgRenderStage* stage = new(ELeave) CNvgRenderStage();
+	CleanupStack::PushL(stage);
+	stage->ConstructL(aNextStage);
+	CleanupStack::Pop(stage);
+	return stage;
+	}
+	
+void CNvgRenderStage::ConstructL(CWsRenderStage* aNextStage)
+	{
+	iBrushPattern = new(ELeave) CFbsBitmap;
+	iInternalBrushPattern = new(ELeave) CFbsBitmap;
+	iGraphicsInterface = new(ELeave) CVGIGraphicsInterface;
+  iNvgEngine = CNvgEngine::NewL();
+  iNvgEngine->SetVGImageBinder(iGraphicsInterface);
+	
+	BaseConstructL();	
+	SetNext(aNextStage);
+	}
+
+CNvgRenderStage::~CNvgRenderStage()
+	{	
+	iEmptyRegion.Close();
+	delete iBrushPattern;
+	delete iInternalBrushPattern;
+	delete iNvgEngine;
+	delete iGraphicsInterface;
+	
+	iCacheIterator.SetToFirst();
+  TCachedConversion* cached = iCacheIterator++;
+	while (cached != NULL)
+	 {
+   delete cached;
+   cached = iCacheIterator++;
+   }
+	}
+
+/** The only interface returned by this render stage is MWsGraphicsContext.
+All other interface requests are passed to the base render stage class for resolving.
+
+@see CWsRenderStage::ResolveObjectInterface()
+
+@param aTypeId The type id of the interface to be retreived, must be one of the 
+TSurfaceConfiguration interface extension IDs.
+
+@return Returns a pointer to an object that has the requested interface if found, 
+otherwise returns NULL.
+ */
+TAny* CNvgRenderStage::ResolveObjectInterface(TUint aTypeId)
+	{	
+	switch (aTypeId)
+		{
+		case MWsGraphicsContext::EWsObjectInterfaceId:
+			return static_cast<MWsGraphicsContext*>(this);
+		
+		default:
+			return CWsRenderStage::ResolveObjectInterface(aTypeId);
+		}
+	}
+
+/** Call Begin() for this render stage and for the next one as well. It is assumed
+that this renderstage is chained in front of a renderstage that can draw to a
+CGraphicsContext as this renderstage uses MWsGraphicsContext interface from the
+next stage to draw to. A pointer to the MWsGraphicsContext interface is saved here
+and is used for all subsequent MWsGraphicsContext operations called on this
+render stage. 
+
+This render stage draws all extended bitmaps of type 0x39b9273e
+and passes all other drawing operations directly to the next render stage through
+its MWsGraphicsContext interface.
+
+@see CWsRenderStage::Begin()
+
+@param aRegion The dirty region for which drawing operations are about to be issued.
+
+@post An error of KErrNotFound is set for this render stage if the MWsGraphicsContext
+interface of the next render stage cannot be obtained. This render stage relies on
+the existence of a subsequent stage with a valid MWsGraphicsContext interface to send
+its draw operations to so will not be able to draw anything if no MWsGraphicsContext
+is returned by the next render stage. The current error for this render stage can be
+retreived by calling GetError().
+ */
+void CNvgRenderStage::Begin(const TRegion* aRegion)
+	{		
+	CWsRenderStage* nextStage = Next();
+	if (nextStage)
+		{
+		nextStage->Begin(aRegion);
+		
+		// Use the graphics context from the next render stage to draw to
+		iGc = static_cast<MWsGraphicsContext*>(nextStage->ResolveObjectInterface(MWsGraphicsContext::EWsObjectInterfaceId));
+		if (iGc == NULL)
+			{
+			iExtendedBitmapError = KErrNotFound; 
+			}
+		}
+	}
+
+/** Signals that the currect batch of drawing operations is complete. This
+implementation of End() just calls End() for the next render stage in the chain.
+
+@see CWsRenderStage::End()
+
+@param aCompositorReady Will be completed when the render stage is ready to 
+receive the next batch of drawing operations.
+ */
+void CNvgRenderStage::End(TRequestStatus* aCompositorReady)
+	{
+	if (Next())
+		{		
+		Next()->End(aCompositorReady);
+		}
+	}
+
+/** If the passed bitmap is an extended bitmap of type 0x39b9273e, draw it to the stored
+graphics context of the next render stage using  DrawExtendedBitmap(), if the passed bitmap
+is not an extended bitmap just pass it on to the next render stage directly.
+
+@see CFbsBitGc::BitBlt(const TPoint&, const CFbsBitmap&)
+ */
+void CNvgRenderStage::BitBlt(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap)
+	{
+	if (iGc)
+		{
+		CFbsBitmap* sourceBitmap = const_cast<CFbsBitmap*>(&aSourceBitmap);
+		
+		if (aSourceBitmap.ExtendedBitmapType() == KUidNvgExtendedBitmap)
+			{						
+			sourceBitmap = GetConvertedBitmap(aSourceBitmap);
+			}
+		
+		iGc->BitBlt(aDestPos, *sourceBitmap);
+		}
+	}
+
+/** If the passed bitmap is an extended bitmap of type 0x39b9273e, draw it to the 
+stored graphics context of the next render stage using  DrawExtendedBitmap(), if the
+passed bitmap is not an extended bitmap just pass it on to the next render stage directly.
+
+@see CFbsBitGc::BitBlt(const TPoint&, const CFbsBitmap&, const TRect&)
+ */
+void CNvgRenderStage::BitBlt(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect)
+	{
+	if (iGc)
+		{			
+		CFbsBitmap* sourceBitmap = const_cast<CFbsBitmap*>(&aSourceBitmap);
+		
+		if (aSourceBitmap.ExtendedBitmapType() == KUidNvgExtendedBitmap)
+			{						
+			sourceBitmap = GetConvertedBitmap(aSourceBitmap);
+			}
+
+		iGc->BitBlt(aDestPos, *sourceBitmap, aSourceRect);
+		}
+	}
+
+/** If either of the passed bitmaps is an extended bitmap of type 0x39b9273e convert
+to a normal bitmap before passing to the next render stage, otherwise
+just pass to the next render stage directly.
+
+@see CFbsBitGc::BitBltMasked(const TPoint& aDestPos, const CFbsBitmap&, const TRect&, const CFbsBitmap&, TBool)
+ */
+void CNvgRenderStage::BitBltMasked(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect, const CFbsBitmap& aMaskBitmap, TBool aInvertMask)
+	{
+	if (iGc)
+		{		
+		CFbsBitmap* sourceBitmap = const_cast<CFbsBitmap*>(&aSourceBitmap);
+		CFbsBitmap* maskBitmap = const_cast<CFbsBitmap*>(&aMaskBitmap);		
+		
+		if (aSourceBitmap.ExtendedBitmapType() == KUidNvgExtendedBitmap)
+			{						
+			sourceBitmap = GetConvertedBitmap(aSourceBitmap);
+			}
+		
+		if (aMaskBitmap.ExtendedBitmapType() == KUidNvgExtendedBitmap)
+			{			
+			maskBitmap = GetConvertedBitmap(aMaskBitmap);
+			}	
+		
+		iGc->BitBltMasked(aDestPos, *sourceBitmap, aSourceRect, *maskBitmap, aInvertMask);
+		}
+	}
+
+/** If either of the passed bitmaps is an extended bitmap of type 0x39b9273e
+convert to a normal bitmap before passing to the next render stage, otherwise
+just pass to the next render stage directly.
+
+@see CFbsBitGc::BitBltMasked(const TPoint& aDestPos, const CFbsBitmap&, const TRect&, const CFbsBitmap&, TPoint)
+ */
+void CNvgRenderStage::BitBltMasked(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect, const CFbsBitmap& aMaskBitmap, const TPoint& aMaskPos)
+	{
+	if (iGc)
+		{		
+		CFbsBitmap* sourceBitmap = const_cast<CFbsBitmap*>(&aSourceBitmap);
+		CFbsBitmap* maskBitmap = const_cast<CFbsBitmap*>(&aMaskBitmap);
+		
+		if (aSourceBitmap.ExtendedBitmapType() == KUidNvgExtendedBitmap)
+			{
+			sourceBitmap = GetConvertedBitmap(aSourceBitmap);
+			}
+		
+		if (aMaskBitmap.ExtendedBitmapType() == KUidNvgExtendedBitmap)
+			{
+			maskBitmap = GetConvertedBitmap(aMaskBitmap);
+			}	
+		
+		iGc->BitBltMasked(aDestPos, *sourceBitmap, aSourceRect, *maskBitmap, aMaskPos);
+		}
+	}
+
+/** @see CFbsBitGc::ResetClippingRegion()
+ */
+void CNvgRenderStage::ResetClippingRegion()
+	{
+	if (iGc)
+		{		
+		iGc->ResetClippingRegion();
+		}
+	}
+
+/** @see CFbsBitGc::Clear()
+ */
+void CNvgRenderStage::Clear()
+	{
+	if (iGc)
+		{
+		iGc->Clear();
+		}
+	}
+
+/** @see CFbsBitGc::Clear(const TRect&)
+ */
+void CNvgRenderStage::Clear(const TRect& aRect)
+	{
+	if (iGc)
+		{
+		iGc->Clear(aRect);
+		}
+	}
+
+/** @see CFbsBitGc::ResetBrushPattern()
+ */
+void CNvgRenderStage::ResetBrushPattern()
+	{	
+	if (iGc)
+		{
+		iGc->ResetBrushPattern();
+		}
+	}
+
+/** @see CFbsBitGc::ResetFont()
+ */
+void CNvgRenderStage::ResetFont()
+	{
+	if (iGc)
+		{
+		iGc->ResetFont();
+		}
+	}
+
+/** @see CFbsBitGc::DrawArc()
+ */
+void CNvgRenderStage::DrawArc(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd)
+	{	
+	if (iGc)
+		{
+		iGc->DrawArc(aRect, aStart, aEnd);	
+		}
+	}
+
+/** @see CFbsBitGc::DrawPie()
+ */
+void CNvgRenderStage::DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd)
+	{	
+	if (iGc)
+		{
+		iGc->DrawPie(aRect, aStart, aEnd);
+		}
+	}
+
+/** If the passed bitmap is an extended bitmap of type 0x39b9273e, draw it to the 
+stored graphics context of the next render stage using DrawExtendedBitmap(), if the
+passed bitmap is not an extended bitmap just pass it on to the next render stage directly.
+
+@see CFbsBitGc::DrawBitmap(const TRect&, const CFbsBitmap&)
+ */
+void CNvgRenderStage::DrawBitmap(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap)
+	{
+	if (iGc)
+		{	
+		CFbsBitmap* sourceBitmap = const_cast<CFbsBitmap*>(&aSourceBitmap);		
+		
+		if (aSourceBitmap.ExtendedBitmapType() == KUidNvgExtendedBitmap)
+			{
+			sourceBitmap = GetConvertedBitmap(aSourceBitmap);
+			}
+				
+		iGc->DrawBitmap(aDestRect, *sourceBitmap);	
+		}
+	}
+
+/** If the passed bitmap is an extended bitmap of type 0x39b9273e, draw it to the 
+stored graphics context of the next render stage using DrawExtendedBitmap(), if the
+passed bitmap is not an extended bitmap just pass it on to the next render stage directly.
+
+@see CFbsBitGc::DrawBitmap(const TRect&, const CFbsBitmap&, const TRect&)
+ */
+void CNvgRenderStage::DrawBitmap(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect)
+	{
+	if (iGc)
+		{
+		CFbsBitmap* sourceBitmap = const_cast<CFbsBitmap*>(&aSourceBitmap);		
+		
+		if (aSourceBitmap.ExtendedBitmapType() == KUidNvgExtendedBitmap)
+			{
+			sourceBitmap = GetConvertedBitmap(aSourceBitmap);
+			}
+				
+		iGc->DrawBitmap(aDestRect, *sourceBitmap, aSourceRect);		
+		}
+	}
+
+/** If the passed bitmap or mask bitmap is an extended bitmap of type 0x39b9273e
+convert it to a normal bitmap before calling DrawBitmapMasked(), normal bitmaps
+are passed straight through to the next render stage without conversion.
+
+@see CFbsBitGc::DrawBitmapMasked(const TRect&, const CFbsBitmap&, const TRect&, const CFbsBitmap&, TBool)
+ */
+void CNvgRenderStage::DrawBitmapMasked(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap,const TRect& aSourceRect, const CFbsBitmap& aMaskBitmap, TBool aInvertMask)
+	{	
+	if (iGc)
+		{
+		CFbsBitmap* sourceBitmap = const_cast<CFbsBitmap*>(&aSourceBitmap);
+		CFbsBitmap* maskBitmap = const_cast<CFbsBitmap*>(&aMaskBitmap);
+		
+		if (aSourceBitmap.ExtendedBitmapType() == KUidNvgExtendedBitmap)
+			{
+			sourceBitmap = GetConvertedBitmap(aSourceBitmap);
+			}
+		if (aMaskBitmap.ExtendedBitmapType() == KUidNvgExtendedBitmap)
+			{
+			maskBitmap = GetConvertedBitmap(aMaskBitmap);
+			}
+	
+		iGc->DrawBitmapMasked(aDestRect, *sourceBitmap, aSourceRect, *maskBitmap, aInvertMask);
+		}	
+	}
+
+/** @see CFbsBitGc::DrawRoundRect(const TRect&, const TSize&)
+ */
+void CNvgRenderStage::DrawRoundRect(const TRect& aRect, const TSize& aEllipse)
+	{	
+	if (iGc)
+		{
+		iGc->DrawRoundRect(aRect, aEllipse);
+		}
+	}
+
+/** @see CFbsBitGc::DrawPolyLine(const TArray<TPoint>&)
+ */
+void CNvgRenderStage::DrawPolyLine(const TArray<TPoint>& aPointList) 
+	{	
+	if (iGc)
+		{
+		iGc->DrawPolyLine(aPointList);
+		}
+	}
+
+/** @see CFbsBitGc::DrawPolyLineNoEndPoint(const TArray<TPoint>&)
+ */
+void CNvgRenderStage::DrawPolyLineNoEndPoint(const TArray<TPoint>& aPointList)  
+	{	
+	if (iGc)
+		{
+		iGc->DrawPolyLineNoEndPoint(aPointList);
+		}
+	}
+
+/** @see CFbsBitGc::DrawPolygon(const TArray<TPoint>&, TFillRule)
+ */
+void CNvgRenderStage::DrawPolygon(const TArray<TPoint>& aPointList, TFillRule aFillRule)
+	{	
+	if (iGc)
+		{
+		iGc->DrawPolygon(aPointList, aFillRule);
+		}
+	}
+
+/** @see CFbsBitGc::DrawEllipse(const TRect&)
+ */
+void CNvgRenderStage::DrawEllipse(const TRect& aRect)
+	{	
+	if (iGc)
+		{
+		iGc->DrawEllipse(aRect);
+		}
+	}
+
+/** @see CFbsBitGc::DrawLine(const TPoint&, const TPoint&)
+ */
+void CNvgRenderStage::DrawLine(const TPoint& aStart, const TPoint& aEnd)
+	{
+	if (iGc)
+		{
+		iGc->DrawLine(aStart, aEnd);
+		}
+	}
+
+/** @see CFbsBitGc::DrawLineTo(const TPoint&)
+ */
+void CNvgRenderStage::DrawLineTo(const TPoint& aPoint)
+	{
+	if (iGc)
+		{
+		iGc->DrawLineTo(aPoint);
+		}
+	}
+
+/** @see CFbsBitGc::DrawLineBy(const TPoint&)
+ */
+void CNvgRenderStage::DrawLineBy(const TPoint& aVector)
+	{
+	if (iGc)
+		{
+		iGc->DrawLineBy(aVector);
+		}
+	}
+
+/** @see CFbsBitGc::DrawRect(const TRect&)
+ */
+void CNvgRenderStage::DrawRect(const TRect& aRect)
+	{
+	if (iGc)
+		{
+		iGc->DrawRect(aRect);
+		}
+	}
+
+/** @see CFbsBitGc::DrawText(const TDesC& aText, const TTextParameters*)
+ */
+void CNvgRenderStage::DrawText(const TDesC& aText, const TTextParameters* aParam)
+	{	
+	if (iGc)
+		{
+		iGc->DrawText(aText, aParam);	
+		}
+	}
+
+/** @see CFbsBitGc::DrawText(const TDesC& aText, const TTextParameters*, const TPoint&)
+ */
+void CNvgRenderStage::DrawText(const TDesC& aText, const TTextParameters* aParam, const TPoint& aPosition)
+	{	
+	if (iGc)
+		{
+		iGc->DrawText(aText, aParam, aPosition);
+		}
+	}
+
+/** @see CFbsBitGc::DrawText(const TDesC& aText, const TTextParameters*, const TRect&)
+ */
+void CNvgRenderStage::DrawText(const TDesC& aText, const TTextParameters* aParam, const TRect& aClipRect)
+	{	
+	if (iGc)
+		{
+		iGc->DrawText(aText, aParam, aClipRect);	
+		}
+	}
+
+/** @see CFbsBitGc::DrawText(const TDesC& aText, const TTextParameters*, const TRect&, TInt, TTextAlign, TInt)
+ */
+void CNvgRenderStage::DrawText(const TDesC& aText, const TTextParameters* aParam, const TRect& aClipFillRect, TInt aBaselineOffset, TTextAlign aHrz, TInt aMargin)
+	{
+	if (iGc)
+		{
+		iGc->DrawText(aText, aParam, aClipFillRect, aBaselineOffset, aHrz, aMargin);
+		}
+	}
+
+/** @see CFbsBitGc::DrawTextVertical(const TDesC&, const TTextParameters*, TBool)
+ */
+void CNvgRenderStage::DrawTextVertical(const TDesC& aText, const TTextParameters* aParam, TBool aUp)
+	{
+	if (iGc)
+		{
+		iGc->DrawTextVertical(aText, aParam, aUp);
+		}
+	}
+
+/** @see CFbsBitGc::DrawTextVertical(const TDesC&, const TTextParameters*, const TPoint&, TBool)
+ */
+void CNvgRenderStage::DrawTextVertical(const TDesC& aText, const TTextParameters* aParam, const TPoint& aPosition, TBool aUp)
+	{
+	if (iGc)
+		{
+		iGc->DrawTextVertical(aText, aParam, aPosition, aUp);
+		}
+	}
+
+/** @see CFbsBitGc::DrawTextVertical(const TDesC&, const TTextParameters*, const TRect&, TBool)
+ */
+void CNvgRenderStage::DrawTextVertical(const TDesC& aText, const TTextParameters* aParam, const TRect& aClipRect, TBool aUp)
+	{	
+	if (iGc)
+		{
+		iGc->DrawTextVertical(aText, aParam, aClipRect, aUp);		
+		}
+	}
+
+/** @see CFbsBitGc::DrawTextVertical(const TDesC&, const TTextParameters*, const TRect&, TInt aBaselineOffset, TBool, TTextAlign, TInt)
+ */
+void CNvgRenderStage::DrawTextVertical(const TDesC& aText, const TTextParameters* aParam, const TRect& aClipRect, TInt aBaselineOffset, TBool aUp, TTextAlign aVert, TInt aMargin)
+	{
+	if (iGc)
+		{
+		iGc->DrawTextVertical(aText, aParam, aClipRect, aBaselineOffset, aUp, aVert, aMargin);
+		}
+	}
+
+/** @see CFbsBitGc::DrawTextVertical(const TDesC&, const TTextParameters*, const TRect&, TInt, TInt, TBool, TTextAlign, TInt)
+ */
+void CNvgRenderStage::DrawTextVertical(const TDesC& aText, const TTextParameters* aParam, const TRect& aClipRect, TInt aBaselineOffset, TInt aTextWidth, TBool aUp, TTextAlign aVert, TInt aMargin)
+	{
+	if (iGc)
+		{
+		iGc->DrawTextVertical(aText, aParam, aClipRect, aBaselineOffset, aTextWidth, aUp, aVert, aMargin);	
+		}
+	}
+
+/** @see CFbsBitGc::MoveTo(const TPoint&)
+ */
+void CNvgRenderStage::MoveTo(const TPoint& aPoint)
+	{
+	if (iGc)
+		{
+		iGc->MoveTo(aPoint);
+		}
+	}
+
+/** @see CFbsBitGc::MoveBy(const TPoint&)
+ */
+void CNvgRenderStage::MoveBy(const TPoint& aVector)
+	{
+	if (iGc)
+		{
+		iGc->MoveBy(aVector);
+		}
+	}
+
+/** @see CFbsBitGc::Plot(const TPoint&)
+ */
+void CNvgRenderStage::Plot(const TPoint& aPoint)
+	{
+	if (iGc)
+		{
+		iGc->Plot(aPoint);
+		}
+	}
+
+/** @see CFbsBitGc::Reset()
+ */
+void CNvgRenderStage::Reset()
+	{
+	iExtendedBitmapError = KErrNone;
+	iOrigin.SetXY(0,0);
+	iBrushStyle = MWsGraphicsContext::ENullBrush;
+	if (iGc)
+		{	
+		iGc->Reset();
+		}
+	}
+
+/** @see CFbsBitGc::SetBrushColor(const TRgb&)
+ */
+void CNvgRenderStage::SetBrushColor(const TRgb& aColor)
+	{
+	if (iGc)
+		{
+		iGc->SetBrushColor(aColor);
+		}
+	}
+
+/** @see CFbsBitGc::SetBrushOrigin(const TPoint&)
+ */
+void CNvgRenderStage::SetBrushOrigin(const TPoint& aOrigin)
+	{
+	if (iGc)
+		{
+		iGc->SetBrushOrigin(aOrigin);
+		}
+	}
+
+/** @see CFbsBitGc::SetBrushStyle(TBrushStyle)
+ */
+void CNvgRenderStage::SetBrushStyle(TBrushStyle aBrushStyle)
+	{	
+	if (iGc)
+		{
+		iGc->SetBrushStyle(aBrushStyle);
+		iBrushStyle = aBrushStyle;
+		}
+	}
+
+/** @see CFbsBitGc::SetClippingRegion(const TRegion&)
+ */
+void CNvgRenderStage::SetClippingRegion(const TRegion& aRegion)
+	{
+	if (iGc)
+		{
+		iGc->SetClippingRegion(aRegion);
+		}
+	}
+
+/** @see CFbsBitGc::SetDrawMode(TDrawMode)
+ */
+void CNvgRenderStage::SetDrawMode(TDrawMode aDrawMode)
+	{
+	if (iGc)
+		{
+		iGc->SetDrawMode(aDrawMode);
+		}
+	}
+
+/** @see CFbsBitGc::SetOrigin(const TPoint&)
+ */
+void CNvgRenderStage::SetOrigin(const TPoint& aPoint)
+	{	
+	if (iGc)
+		{
+		iGc->SetOrigin(aPoint);
+		iOrigin = aPoint;
+		}
+	}
+
+/** @see CFbsBitGc::SetPenColor(const TRgb&)
+ */
+void CNvgRenderStage::SetPenColor(const TRgb& aColor)
+	{
+	if (iGc)
+		{
+		iGc->SetPenColor(aColor);
+		}
+	}
+
+/** @see CFbsBitGc::SetPenStyle(TPenStyle)
+ */
+void CNvgRenderStage::SetPenStyle(TPenStyle aPenStyle)
+	{
+	if (iGc)
+		{
+		iGc->SetPenStyle(aPenStyle);
+		}
+	}
+
+/** @see CFbsBitGc::SetPenSize(const TSize&)
+ */
+void CNvgRenderStage::SetPenSize(const TSize& aSize)
+	{
+	if (iGc)
+		{
+		iGc->SetPenSize(aSize);
+		}
+	}
+
+/** @see CFbsBitGc::SetTextShadowColor(const TRgb&)
+ */
+void CNvgRenderStage::SetTextShadowColor(const TRgb& aColor)
+	{
+	if (iGc)
+		{
+		iGc->SetTextShadowColor(aColor);
+		}
+	}
+
+/** @see CFbsBitGc::SetCharJustification(TInt, TInt)
+ */
+void CNvgRenderStage::SetCharJustification(TInt aExcessWidth, TInt aNumChars)
+	{
+	if (iGc)
+		{
+		iGc->SetCharJustification(aExcessWidth, aNumChars);
+		}
+	}
+
+/** @see CFbsBitGc::SetWordJustification(TInt, TInt)
+ */
+void CNvgRenderStage::SetWordJustification(TInt aExcessWidth, TInt aNumGaps)
+	{
+	if (iGc)
+		{
+		iGc->SetWordJustification(aExcessWidth, aNumGaps);
+		}
+	}
+
+/** @see CFbsBitGc::SetUnderlineStyle(TFontUnderline)
+ */
+void CNvgRenderStage::SetUnderlineStyle(TFontUnderline aUnderlineStyle)
+	{
+	if (iGc)
+		{
+		iGc->SetUnderlineStyle(aUnderlineStyle);
+		}
+	}
+
+/** @see CFbsBitGc::SetStrikethroughStyle(TFontStrikethrough)
+ */
+void CNvgRenderStage::SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle)
+	{
+	if (iGc)
+		{
+		iGc->SetStrikethroughStyle(aStrikethroughStyle);
+		}
+	}
+
+/** If the passed bitmap is an extended bitmap of type 0x39b9273e
+convert the extended bitmap to a normal bitmap and set the converted bitmap
+as the current brush pattern. If the passed bitmap is a normal
+bitmap just pass it on to the next render stage.
+
+@see SetBrushPattern(TInt)
+@see CFbsBitGc::SetBrushPattern(const CFbsBitmap&)
+ */
+void CNvgRenderStage::SetBrushPattern(const CFbsBitmap& aBitmap)
+	{
+	SetBrushPattern(aBitmap.Handle());	
+	}
+
+/** If the passed bitmap handle refers to an extended bitmap of type 0x39b9273e
+convert the extended bitmap to a normal bitmap and set the converted bitmap
+as the current brush pattern. If the passed bitmap handle refers to a normal
+bitmap just pass it on to the next render stage.
+
+@see SetBrushPattern(const CFbsBitmap&)
+@see CFbsBitGc::SetBrushPattern(TInt)
+ */
+void CNvgRenderStage::SetBrushPattern(TInt aFbsBitmapHandle)
+	{
+	if (iGc)
+		{
+		iBrushPattern->Duplicate(aFbsBitmapHandle);
+		if (iBrushPattern->ExtendedBitmapType() == KUidNvgExtendedBitmap)
+			{
+			iInternalBrushPattern = GetConvertedBitmap(*iBrushPattern);
+			iGc->SetBrushPattern(*iInternalBrushPattern);
+			}
+		else
+			{
+			iGc->SetBrushPattern(aFbsBitmapHandle);
+			}
+		}
+	}
+
+/** @see CFbsBitGc::SetFont(const CFont*)
+ */
+void CNvgRenderStage::SetFont(const CFont* aFont)	
+	{
+	if (iGc)
+		{
+		iGc->SetFont(aFont);
+		}
+	}
+
+/** @see CFbsBitGc::CopyRect(const TPoint&, const TRect&)
+ */
+void CNvgRenderStage::CopyRect(const TPoint& aOffset, const TRect& aRect)
+	{
+	if (iGc)
+		{
+		iGc->CopyRect(aOffset, aRect);
+		}
+	}
+
+/** @see CFbsBitGc::UpdateJustification(const TDesC&, const TTextParameters*)
+ */
+void CNvgRenderStage::UpdateJustification(const TDesC& aText, const TTextParameters* aParam)
+	{
+	if (iGc)
+		{
+		iGc->UpdateJustification(aText, aParam);
+		}
+	}
+
+/** @see CFbsBitGc::UpdateJustificationVertical(const TDesC&, const TTextParameters*, TBool)
+ */
+void CNvgRenderStage::UpdateJustificationVertical(const TDesC& aText, const TTextParameters* aParam, TBool aUp)
+	{
+	if (iGc)
+		{
+		iGc->UpdateJustificationVertical(aText, aParam, aUp);
+		}
+	}
+
+/** @see CFbsBitGc::SetFontNoDuplicate(const CFont*)
+ */
+void CNvgRenderStage::SetFontNoDuplicate(const CFont* aFont)
+	{
+	if (iGc)
+		{
+		iGc->SetFontNoDuplicate(aFont);
+		}
+	}
+
+/** @see CFbsBitGc::HasBrushPattern()
+ */
+TBool CNvgRenderStage::HasBrushPattern() const
+	{
+	if (iGc)
+		{
+		return iGc->HasBrushPattern();
+		}
+	else
+		{
+		return EFalse;
+		}
+	}
+
+/** @see CFbsBitGc::HasFont()
+ */
+TBool CNvgRenderStage::HasFont() const
+	{
+	if (iGc)
+		{
+		return iGc->HasFont();
+		}
+	else
+		{
+		return EFalse;
+		}
+	}
+
+/** @see CFbsBitGc::BrushColor()
+ */
+TRgb CNvgRenderStage::BrushColor() const
+	{
+	if (iGc)
+		{
+		return iGc->BrushColor();
+		}
+	else
+		{
+		return KRgbWhite;
+		}
+	}
+
+/** @see CFbsBitGc::PenColor()
+ */
+TRgb CNvgRenderStage::PenColor() const
+	{
+	if (iGc)
+		{
+		return iGc->PenColor();
+		}
+	else
+		{
+		return KRgbBlack;
+		}
+	}
+
+/** @see MWsGraphicsContext::TextShadowColor()
+ */
+TRgb CNvgRenderStage::TextShadowColor() const	
+	{
+	if (iGc)
+		{
+		return iGc->TextShadowColor();
+		}
+	else
+		{
+		return KRgbGray;
+		}
+	}
+
+/** If an error has been set by this render stage return that error,
+otherwise return the error from the graphics context of the next
+render stage.
+
+@see MWsGraphicsContext::GetError()
+ */
+TInt CNvgRenderStage::GetError()
+	{
+	if (iExtendedBitmapError != KErrNone)
+		{
+		return iExtendedBitmapError;
+		}
+	if (iGc)
+		{
+		return iGc->GetError();
+		}
+	return KErrNone;
+	}
+
+/** @see MWsGraphicsContext::Origin()
+ */
+TPoint CNvgRenderStage::Origin() const	
+	{
+	if (iGc)
+		{
+		return iGc->Origin();
+		}
+	else
+		{
+		return TPoint(0,0);
+		}
+	}
+
+/** @see MWsGraphicsContext::ClippingRegion()
+ */
+const TRegion& CNvgRenderStage::ClippingRegion()	
+	{
+	if (iGc)
+		{
+		return iGc->ClippingRegion();
+		}
+	else
+		{		
+		return iEmptyRegion;
+		}
+	}
+
+/** @see MWsGraphicsContext::Push()
+ */
+TInt CNvgRenderStage::Push()	
+	{
+	if (iGc)
+		{
+		return iGc->Push();
+		}
+	else
+		{
+		return KErrGeneral;
+		}
+	}
+
+/** @see MWsGraphicsContext::Pop()
+ */
+void CNvgRenderStage::Pop()
+	{
+	if (iGc)
+		{
+		iGc->Pop();
+		}
+	}
+
+
+/** Helper method that draws an NVG extended bitmap into a normal bitmap. 
+
+@param aExtendedBitmapSrc The extended bitmap to draw 
+
+@pre aExtendedBitmapSrc must be an extended bitmap of extended bitmap type 0x39b9273e
+ */
+
+CFbsBitmap* CNvgRenderStage::GetConvertedBitmap(const CFbsBitmap& aExtendedBitmapSrc)
+  {
+  aExtendedBitmapSrc.BeginDataAccess();
+  const TUint8* bmpData = (const TUint8*)aExtendedBitmapSrc.DataAddress();
+
+  TPtr8 IconHeaderPtr((TUint8*)bmpData, KIconHeaderLength, KIconHeaderLength);
+  TAknIconHeader iconheader(IconHeaderPtr);
+
+  TUint32 bitmapid = iconheader.GetBitmapId();
+  TUint32 handle = aExtendedBitmapSrc.Handle();
+  aExtendedBitmapSrc.EndDataAccess();
+  CFbsBitmap* error = const_cast<CFbsBitmap*>(&aExtendedBitmapSrc);  // not renderable, but better than panic!
+  
+  // look to see if we have this in the cache
+  iCacheIterator.SetToFirst();
+  TCachedConversion* cached = iCacheIterator++;
+  while (cached != NULL)
+    {
+    if (cached->iBitmapID == bitmapid && cached->iDiscriminator == handle)
+      {
+      // Cache hit
+#ifdef DEBUG_NVG_RENDERSTAGE
+      RDebug::Printf("NVG Render cache hit for id %08x, handle %d\n", bitmapid, handle);
+#endif
+      cached->Deque();
+      iCache.AddFirst(*cached);  // move to front of the list, to record use
+      return cached->iCachedResult;  
+      }
+    cached = iCacheIterator++;
+    }
+  
+  // missed in the cache, need to perform the conversion
+  TInt err = KErrNone;
+  if (iCacheFree > 0)
+    {
+    // just allocate a new entry, which will be added to the end
+    TRAP(err, cached = new(ELeave) TCachedConversion);
+    if (err != KErrNone)
+      {
+      return error;
+      }
+    TRAP(err, cached->iCachedResult = new(ELeave) CFbsBitmap);
+    if (err != KErrNone)
+      {
+      delete cached;
+      return error;
+      }
+    }
+  else
+    {
+    // Remove the least recently used item
+    cached = iCache.Last();
+    cached->Deque();  // remove from the cache
+    iCacheFree++;
+#ifdef DEBUG_NVG_RENDERSTAGE
+    RDebug::Printf("NVG Render cache removing id %08x, handle %d\n", cached->iBitmapID, cached->iDiscriminator);
+#endif
+    }
+  
+  // cached is now available to hold the new result
+  cached->iBitmapID = bitmapid;
+  cached->iDiscriminator = handle;
+
+  CopyExtendedBitmapToNormalBitmap(aExtendedBitmapSrc, *cached->iCachedResult);
+  if (iExtendedBitmapError != KErrNone)
+    {
+    delete cached;
+    return error;
+    }
+  
+  // Newly cached bitmap is valid
+  iCache.AddFirst(*cached);
+  iCacheFree--;
+#ifdef DEBUG_NVG_RENDERSTAGE
+  RDebug::Printf("NVG Render cache added id %08x, handle %d (%d free)\n", bitmapid, handle, iCacheFree);
+#endif
+  return cached->iCachedResult;
+  }
+
+/** Helper method that draws an NVG extended bitmap into a normal bitmap. The normal
+bitmap passed is resized before the extended bitmap is drawn into it.
+
+@param aExtendedBitmapSrc The extended bitmap to draw in to the normal bitmap aBitmapDest
+@param aBitmapDest The normal bitmap that the extended bitmap is to be drawn into
+
+@pre aExtendedBitmapSrc must be an extended bitmap of extended bitmap type 0x39b9273e
+@post aBitmapDest has been reset and resized and now contains a representation of the aExtendedBitmapSrc
+ */
+
+void CNvgRenderStage::CopyExtendedBitmapToNormalBitmap(const CFbsBitmap& aExtendedBitmapSrc, CFbsBitmap& aBitmapDst)
+	{
+	TSize size = aExtendedBitmapSrc.SizeInPixels();
+	TInt err = aBitmapDst.Create(size, aExtendedBitmapSrc.DisplayMode());
+	if (err != KErrNone)
+		{
+		iExtendedBitmapError = err;
+		return;
+		}
+	
+	TRAP(err, iGraphicsInterface->InitializeL(size));
+	if (err != KErrNone)
+		{
+		iExtendedBitmapError = err;
+		return;
+		}
+
+	// Clear to White before doing anything else
+  VGfloat color[4] = { 1.0f, 1.0f, 1.0f, 0.0f };
+  vgSeti(VG_SCISSORING, VG_FALSE);
+  vgSetfv(VG_CLEAR_COLOR, 4, color);
+  vgClear(0, 0, size.iWidth, size.iHeight);
+
+  aExtendedBitmapSrc.BeginDataAccess();
+  const TUint8* bmpData = (const TUint8*)aExtendedBitmapSrc.DataAddress();
+
+  TPtr8 IconHeaderPtr((TUint8*)bmpData, KIconHeaderLength, KIconHeaderLength);
+  TAknIconHeader iconheader(IconHeaderPtr);
+
+#ifdef DEBUG_NVG_RENDERSTAGE
+  RDebug::Printf("ConvertExtendedBitmap: id=%08x size (%d x %d)\n", iconheader.GetBitmapId(), size.iWidth, size.iHeight);
+#endif
+
+  TInt dataSize = aExtendedBitmapSrc.DataSize();
+  // skip TNVGIconHeader structure - we only know about version 0
+  if (bmpData[2] == 0)
+    {
+    TInt headerlength = bmpData[3];   // should be KIconHeaderLength
+    bmpData += headerlength;    
+    dataSize -=  headerlength;
+    }
+  TPtrC8 nvgData(bmpData,dataSize);
+
+    TInt rotAngle = iconheader.GetRotation();
+    // setting the rotation angle
+    iNvgEngine->Rotate(-rotAngle, size.iWidth >> 1, size.iHeight >>1);
+    
+    //setting preserve aspect ratio
+    TNvgAlignStatusType alignTypeValue = ENvgPreserveAspectRatio_XmidYmid;
+    TNvgMeetOrSliceType meetOrSliceTypeValue = ENvgMeet;
+    
+    switch ( iconheader.GetScaleMode() )
+        {
+        case EAspectRatioPreserved: // fall through
+            {
+            // use default
+            break;
+            }
+            // Ensures NVG content fully covers the area of the icon whilst preserving aspect ratio.
+        case EAspectRatioPreservedSlice:
+            {
+            // alignTypeValue use default
+            meetOrSliceTypeValue = ENvgSlice;
+            break;
+            } 
+            /* EAspectRatioPreservedAndUnusedSpaceRemoved is mapped to the same values as EAspectRatioNotPreserved
+             * because we already have a frame buffer with the dimensions that preserves the aspect ratio.
+             * This mapping ensures that NVG engine does not calculate aspect ratio twice and potentially resulting in precision loss.*/
+        case EAspectRatioPreservedAndUnusedSpaceRemoved:                        
+        case EAspectRatioNotPreserved:
+            {            
+            alignTypeValue = ENvgPreserveAspectRatio_None;
+            // meetOrSliceTypeValue use default
+            break;
+            }
+        }    
+    iNvgEngine->SetPreserveAspectRatio(alignTypeValue, meetOrSliceTypeValue);
+  
+  TInt error = iNvgEngine->DrawNvg(nvgData, aExtendedBitmapSrc.SizeInPixels(), &aBitmapDst, NULL);
+  aExtendedBitmapSrc.EndDataAccess(ETrue);
+  
+  TRAP(err, iGraphicsInterface->CopyBitmapL(&aBitmapDst, NULL));
+	if (err != KErrNone)
+		{
+		iExtendedBitmapError = err;
+		return;
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uigraphics/NVGRenderStage/src/nvgrenderstage.h	Fri Apr 30 12:31:01 2010 +0100
@@ -0,0 +1,173 @@
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies 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 NVGRENDERSTAGE_H
+#define NVGRENDERSTAGE_H
+
+/**
+@file
+@test
+@internalComponent - Internal Symbian test code
+*/
+
+#include <graphics/wsrenderstage.h>
+#include <graphics/wsgraphicdrawer.h>
+#include <graphics/wsgraphicscontext.h>
+#include <nvg.h>
+#include "vgigraphicsinterface.h"
+
+/** Struct to form a simple LRU cache of conversion results
+ */
+class TCachedConversion
+  {
+public:
+  TCachedConversion();
+  ~TCachedConversion();
+  inline void Deque();
+  
+public:
+  TDblQueLink iLink;
+  TUint32 iBitmapID;
+  TUint32 iDiscriminator;
+  CFbsBitmap* iCachedResult;
+  };
+
+void TCachedConversion::Deque() {iLink.Deque();}
+
+/** This is a render stage used for processing NVG Icon bitmaps in the absence of
+graphics acceleration hardware. The software implementation of OpenVG is used to
+render the NVG drawing commands onto a normal CFbsBitmap, and a simple LRU cache
+is used to keep the results for faster redrawing.
+
+This render stage implements the MWsGraphicsContext interface so that it can intercept
+any drawing commands that draw an extended bitmap, any commands that draw a normal 
+bitmap are just passed through to the next renderstage (along with any commands that
+do not involve bitmaps at all).
+
+A CNvgRenderStage object is created by a CNvgRenderStageFactory.
+ */
+class CNvgRenderStage : public CWsRenderStage, public MWsGraphicsContext
+	{
+public:
+	static CNvgRenderStage* NewL(MWsGraphicDrawerEnvironment* aEnv, MWsScreen* aScreen, MWsScreenRedraw* aScreenRedraw, CWsRenderStage* aNextStage);
+	virtual ~CNvgRenderStage();
+
+public: 
+	// Implementation of CWsRenderStage
+	TAny* ResolveObjectInterface(TUint aTypeId);
+	virtual void Begin(const TRegion* aRegion);
+	virtual void End(TRequestStatus* aCompositorReady);
+	
+public:
+	// Implementation of MWsGraphicsContext
+	void BitBlt(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap);
+	void BitBlt(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap,	const TRect& aSourceRect);
+	void BitBltMasked(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect, const CFbsBitmap& aMaskBitmap, TBool aInvertMask);
+	void BitBltMasked(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect, const CFbsBitmap& aMaskBitmap, const TPoint& aMaskPos);
+	void ResetClippingRegion();
+	void Clear();
+	void Clear(const TRect& aRect);
+	void ResetBrushPattern();
+	void ResetFont();
+	void DrawArc(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd);
+	void DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd);
+	void DrawBitmap(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap);
+	void DrawBitmap(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect);
+	void DrawBitmapMasked(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap,const TRect& aSourceRect, const CFbsBitmap& aMaskBitmap, TBool aInvertMask);
+	void DrawRoundRect(const TRect& aRect, const TSize& aEllipse);
+	void DrawPolyLine(const TArray<TPoint>& aPointList); 
+	void DrawPolyLineNoEndPoint(const TArray<TPoint>& aPointList);  
+	void DrawPolygon(const TArray<TPoint>& aPointList, TFillRule aFillRule=EAlternate);
+	void DrawEllipse(const TRect& aRect);
+	void DrawLine(const TPoint& aStart, const TPoint& aEnd);
+	void DrawLineTo(const TPoint& aPoint);
+	void DrawLineBy(const TPoint& aVector);
+	void DrawRect(const TRect& aRect);
+	void DrawText(const TDesC& aText,const TTextParameters* aParam);
+	void DrawText(const TDesC& aText,const TTextParameters* aParam,const TPoint& aPosition);
+	void DrawText(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect);
+	void DrawText(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipFillRect,TInt aBaselineOffset,TTextAlign aHrz=ELeft,TInt aMargin=0);
+	void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,TBool aUp);
+	void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TPoint& aPosition,TBool aUp);
+	void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect,TBool aUp);
+	void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);
+	void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect,TInt aBaselineOffset,TInt aTextWidth,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);
+	void MoveTo(const TPoint& aPoint);
+	void MoveBy(const TPoint& aVector);
+	void Plot(const TPoint& aPoint);
+	void Reset();
+	void SetBrushColor(const TRgb& aColor);
+	void SetBrushOrigin(const TPoint& aOrigin);
+	void SetBrushStyle(TBrushStyle aBrushStyle);
+	void SetClippingRegion(const TRegion& aRegion);
+	void SetDrawMode(TDrawMode aDrawMode);
+	void SetOrigin(const TPoint& aPoint = TPoint(0, 0));
+	void SetPenColor(const TRgb& aColor);
+	void SetPenStyle(TPenStyle aPenStyle);
+	void SetPenSize(const TSize& aSize);
+	void SetTextShadowColor(const TRgb& aColor);
+	void SetCharJustification(TInt aExcessWidth, TInt aNumChars);
+	void SetWordJustification(TInt aExcessWidth, TInt aNumGaps);
+	void SetUnderlineStyle(TFontUnderline aUnderlineStyle);
+	void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle);
+	void SetBrushPattern(const CFbsBitmap& aBitmap);
+	void SetBrushPattern(TInt aFbsBitmapHandle);
+	void SetFont(const CFont* aFont);	
+	void CopyRect(const TPoint& aOffset, const TRect& aRect);
+	void UpdateJustification(const TDesC& aText,const TTextParameters* aParam);
+	void UpdateJustificationVertical(const TDesC& aText,const TTextParameters* aParam,TBool aUp);
+	void SetFontNoDuplicate(const CFont* aFont);
+	TBool HasBrushPattern() const;
+	TBool HasFont() const;
+	TRgb BrushColor() const;
+	TRgb PenColor() const;
+	TRgb TextShadowColor() const;	
+	TInt GetError();
+	TPoint Origin() const;	
+	const TRegion& ClippingRegion();	
+	TInt Push();	
+	void Pop();
+	
+private:
+	CNvgRenderStage();
+	void ConstructL(CWsRenderStage* aNextStage);
+	
+private:
+	// Helper methods that support the implementation of MWsGraphicsContext
+	CFbsBitmap* GetConvertedBitmap(const CFbsBitmap& aSourceBitmap);
+	void CopyExtendedBitmapToNormalBitmap(const CFbsBitmap& aExtendedBitmapSrc, CFbsBitmap& aBitmapDst);
+
+private:
+	MWsGraphicsContext* iGc;	
+	TInt iExtendedBitmapError;
+	TPoint iOrigin;
+	RRegion iEmptyRegion;
+	CFbsBitmap* iBrushPattern;
+	CFbsBitmap* iInternalBrushPattern;
+	MWsGraphicsContext::TBrushStyle iBrushStyle;
+	CVGIGraphicsInterface* iGraphicsInterface;
+	CNvgEngine* iNvgEngine;
+	
+	// LRU Cache of rendered bitmaps
+#define MAX_NVG_CACHE_SIZE 128
+
+	TDblQue<TCachedConversion> iCache;
+  TDblQueIter<TCachedConversion> iCacheIterator;
+	TUint iCacheFree;
+	};
+
+// #define DEBUG_NVG_RENDERSTAGE
+
+#endif // NVGRENDERSTAGE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uigraphics/NVGRenderStage/src/nvgrenderstagefactory.cpp	Fri Apr 30 12:31:01 2010 +0100
@@ -0,0 +1,79 @@
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies 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 "nvgrenderstagefactory.h"
+#include "nvgrenderstage.h"
+#include "nvgrenderstagepanic.h"
+
+_LIT(KNvgRenderStageName, "NVGRenderStage");
+
+void Panic(TNvgRenderStagePanic aPanic)
+	{
+	_LIT(KNvgRenderStagePanic, "NvgRenderStage");
+	User::Panic(KNvgRenderStagePanic, aPanic);
+	}
+
+CNvgRenderStageFactory* CNvgRenderStageFactory::CreateL()
+	{
+	return new(ELeave) CNvgRenderStageFactory;
+	}
+	
+void CNvgRenderStageFactory::ConstructL(MWsGraphicDrawerEnvironment& aEnv, const TDesC8& /*aData*/)
+	{
+	BaseConstructL(aEnv);
+	}
+	
+CNvgRenderStageFactory::CNvgRenderStageFactory()
+	{
+	}
+	
+CNvgRenderStageFactory::~CNvgRenderStageFactory()
+	{
+	}
+
+/**
+Overidding MWsObjectProvider
+*/
+TAny* CNvgRenderStageFactory::ResolveObjectInterface(TUint aTypeId)
+	{
+	switch (aTypeId)
+		{
+		case KMWsRenderStageFactory:
+			return static_cast<MWsRenderStageFactory*>(this);
+		}
+
+	return NULL;
+	}
+
+CWsRenderStage* CNvgRenderStageFactory::CreateFinalRenderStageL(MWsScreen* /*aScreen*/, MWsScreenRedraw* /*aScreenRedraw*/, TInt /*aScreenNumber*/)
+	{	
+	Panic(EExtendedBitmapRenderStageMustNotBeFinal);
+	return NULL;
+	}
+
+#ifndef SYMBIAN_GRAPHICS_GCE
+#error ("must compile with SYMBIAN_GRAPHICS_GCE")
+#endif
+
+CWsRenderStage* CNvgRenderStageFactory::CreateRenderStageL(MWsScreen* aScreen, MWsScreenRedraw* aScreenRedraw, CWsRenderStage* aNextStage)
+	{
+	CNvgRenderStage* stage = CNvgRenderStage::NewL(&Env(), aScreen, aScreenRedraw, aNextStage);
+	return stage;
+	}
+
+const TDesC& CNvgRenderStageFactory::PluginName() const
+	{
+	return KNvgRenderStageName;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uigraphics/NVGRenderStage/src/nvgrenderstagefactory.h	Fri Apr 30 12:31:01 2010 +0100
@@ -0,0 +1,57 @@
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies 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 NVGRENDERSTAGEFACTORY_H
+#define NVGRENDERSTAGEFACTORY_H
+
+/**
+@file
+@test
+@internalComponent - Internal Symbian test code
+*/
+
+#include <graphics/wsplugin.h>
+#include <graphics/wsrenderstagefactory.h>
+
+class CWsRenderStage;
+class MWsGraphicDrawerEnvironment;
+
+/** This is an implementation of MWsRenderStageFactory, in the form of a CWsPlugin.
+The window server will use this to create standard render stages for each screen,
+if the ini file specifies them.
+*/
+class CNvgRenderStageFactory : public CWsPlugin, public MWsRenderStageFactory
+	{
+public:
+	enum { EImplUid = 0x1028653B };
+	
+public:
+	static CNvgRenderStageFactory* CreateL();
+	~CNvgRenderStageFactory();
+	void ConstructL(MWsGraphicDrawerEnvironment& aEnv,const TDesC8& aData);
+	const TDesC& PluginName() const;
+
+	// implementation of MWsObjectProvider
+	TAny* ResolveObjectInterface(TUint aTypeId);
+
+	// implementation of MWsRenderStageFactory
+	virtual CWsRenderStage* CreateFinalRenderStageL(MWsScreen* aScreen, MWsScreenRedraw* aScreenRedraw, TInt aScreenNumber);
+	virtual CWsRenderStage* CreateRenderStageL(MWsScreen* aScreen, MWsScreenRedraw* aScreenRedraw, CWsRenderStage* aNextStage);
+
+private:
+	CNvgRenderStageFactory();
+	};
+
+#endif // NVGRENDERSTAGEFACTORY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uigraphics/NVGRenderStage/src/nvgrenderstagepanic.h	Fri Apr 30 12:31:01 2010 +0100
@@ -0,0 +1,26 @@
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies 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 NVGRENDERSTAGEPANIC_H
+#define NVGRENDERSTAGEPANIC_H
+
+enum TNvgRenderStagePanic
+{
+	EExtendedBitmapRenderStageMustNotBeFinal = 1,
+};
+
+void Panic(TNvgRenderStagePanic aPanic);
+
+#endif // NVGRENDERSTAGEPANIC_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uigraphics/NVGRenderStage/src/nvgrenderstageplugin.cpp	Fri Apr 30 12:31:01 2010 +0100
@@ -0,0 +1,29 @@
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies 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 <ecom/implementationproxy.h>
+#include "nvgrenderstagefactory.h"
+
+LOCAL_C const TImplementationProxy KImplementationTable[] = 
+	{
+	IMPLEMENTATION_PROXY_ENTRY(CNvgRenderStageFactory::EImplUid, CNvgRenderStageFactory::CreateL),
+	};
+	
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+	{
+	RDebug::Printf("nvgrenderstage - ImplementationGroupProxy called\n");
+	aTableCount = (sizeof(KImplementationTable) / sizeof(TImplementationProxy));
+	return KImplementationTable;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uigraphics/NVGRenderStage/src/vgigraphicsinterface.cpp	Fri Apr 30 12:31:01 2010 +0100
@@ -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:    CVGIGraphicsInterface implementation.
+*
+*/
+
+#include "vgigraphicsinterface.h"
+#include <vgcontext_symbian.h>
+
+CVGIGraphicsInterface::CVGIGraphicsInterface()
+    {
+    }
+
+CVGIGraphicsInterface::~CVGIGraphicsInterface()
+    {
+    Terminate();
+    }
+
+void CVGIGraphicsInterface::InitializeL(TSize aSurfaceSize)
+    {
+        
+    TInt err = VGISymbianInitialize( aSurfaceSize, VGI_COLORSPACE_SRGB );
+    
+    if ((err != KErrNone) && (err != KErrAlreadyExists))
+        {
+        User::Leave(err);
+        }
+    VGISymbianResize(aSurfaceSize);
+    }
+
+void CVGIGraphicsInterface::CopyBitmapL(CFbsBitmap* aPixMap, CFbsBitmap* aMask)
+    {
+    TInt error;
+    if( !aMask )
+        {
+        error = VGISymbianCopyToBitmap(aPixMap, aMask, VGI_SKIP_TRANSPARENT_PIXELS);
+        }
+    else
+        {
+        error = VGISymbianCopyToBitmap(aPixMap, aMask, VGI_COPY_TRANSPARENT_PIXELS);
+        }
+    User::LeaveIfError(error);
+    }
+
+void CVGIGraphicsInterface::Terminate()
+    {
+    VGISymbianTerminate();
+    }
+
+TInt CVGIGraphicsInterface::BindClientBuffer(TUint aBuffer)
+    {
+        return VGISymbianBindToImage(aBuffer);
+    }
+
+TInt CVGIGraphicsInterface::UnBindClientBuffer()
+    {
+    return VGISymbianUnBindImage();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uigraphics/NVGRenderStage/src/vgigraphicsinterface.h	Fri Apr 30 12:31:01 2010 +0100
@@ -0,0 +1,41 @@
+/*
+* 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:   CVGIGraphicsInterface class.
+*
+*/
+
+#ifndef VGIGRAPHICSINTERFACE_H
+#define VGIGRAPHICSINTERFACE_H
+
+#include <e32base.h>
+#include <e32std.h>
+#include <fbs.h>
+#include "MVGImageBinder.h"
+
+NONSHARABLE_CLASS (CVGIGraphicsInterface) : public CBase, public MVGImageBinder
+    {
+public:
+    CVGIGraphicsInterface();
+    ~CVGIGraphicsInterface();
+public:
+    void InitializeL(const TSize aSurfaceSize);
+    void CopyBitmapL(CFbsBitmap* aPixMap, CFbsBitmap* aMask);
+public:
+    TInt BindClientBuffer(TUint aBuffer);
+    TInt UnBindClientBuffer();
+private:
+    void Terminate();
+    };
+
+#endif