201027_1
authorhgs
Tue, 20 Jul 2010 13:27:44 +0300
changeset 121 d72fc2aace31
parent 103 2717213c588a
child 136 62bb7c97884c
child 137 c2203c16a985
201027_1
egl/eglinterface/include/1.4/eglext.h
egl/egltest/bwins/egltestcommonu.def
egl/egltest/eabi/egltestcommonu.def
egl/egltest/group/bld.inf
egl/egltest/group/egltest.mmp
egl/egltest/group/egltest_helium.pkg
egl/egltest/inc/egltest_surfacescaling.h
egl/egltest/inc/egltestcommonsession.h
egl/egltest/inc/egltestcommonutils.h
egl/egltest/inc/eglteststep.h
egl/egltest/rom/egltest.iby
egl/egltest/scripts/egltest_run.bat
egl/egltest/scripts/egltest_settings.ini
egl/egltest/scripts/egltest_t_surfacescaling.script
egl/egltest/src/egltest_image.cpp
egl/egltest/src/egltest_image_multiprocess.cpp
egl/egltest/src/egltest_surfacescaling.cpp
egl/egltest/src/egltestcommonsession.cpp
egl/egltest/src/eglteststep.cpp
fbs/fontandbitmapserver/bwins/FBSCLI2U.DEF
fbs/fontandbitmapserver/bwins/fbservu.def
fbs/fontandbitmapserver/eabi/FBSCLI2U.DEF
fbs/fontandbitmapserver/eabi/fbservu.def
fbs/fontandbitmapserver/group/FBSCLI.MMP
fbs/fontandbitmapserver/group/FBSERV.MMP
fbs/fontandbitmapserver/group/FbservTest.iby
fbs/fontandbitmapserver/group/TFbsServer.mmp
fbs/fontandbitmapserver/group/bld.inf
fbs/fontandbitmapserver/group/fbserv.iby
fbs/fontandbitmapserver/group/fbservtest_helium.pkg
fbs/fontandbitmapserver/group/fbsoogmplugin.iby
fbs/fontandbitmapserver/group/fbsoogmplugin.mmp
fbs/fontandbitmapserver/inc/FBS.H
fbs/fontandbitmapserver/inc/FbsMessage.H
fbs/fontandbitmapserver/sfbs/FBSCLI.CPP
fbs/fontandbitmapserver/sfbs/FBSFONT.CPP
fbs/fontandbitmapserver/sfbs/FBSTOP.CPP
fbs/fontandbitmapserver/sfbs/SERVER.CPP
fbs/fontandbitmapserver/sfbs/SERVER.H
fbs/fontandbitmapserver/sfbs/SESSION.CPP
fbs/fontandbitmapserver/sfbs/UTILS.H
fbs/fontandbitmapserver/sfbs/fbsglyphdataiterator.cpp
fbs/fontandbitmapserver/sfbs/fbsglyphdataiterator.h
fbs/fontandbitmapserver/sfbs/fbsglyphmetricsarray.cpp
fbs/fontandbitmapserver/sfbs/fbsglyphmetricsarray.h
fbs/fontandbitmapserver/sfbs/fbsoogmmessage.h
fbs/fontandbitmapserver/sfbs/fbsoogmmessage.inl
fbs/fontandbitmapserver/sfbs/fbsoogmplugin.cpp
fbs/fontandbitmapserver/sfbs/fbsoogmplugin.h
fbs/fontandbitmapserver/sfbs/fbsoogmplugin.rss
fbs/fontandbitmapserver/sfbs/glyphatlas.cpp
fbs/fontandbitmapserver/sfbs/glyphatlas.h
fbs/fontandbitmapserver/sfbs/patchableconstants.cpp
fbs/fontandbitmapserver/tfbs/TALLOC.H
fbs/fontandbitmapserver/tfbs/TBitmap.h
fbs/fontandbitmapserver/tfbs/TCLEAN.H
fbs/fontandbitmapserver/tfbs/TFBS.CPP
fbs/fontandbitmapserver/tfbs/TFBSDefect.h
fbs/fontandbitmapserver/tfbs/TFbsServer.cpp
fbs/fontandbitmapserver/tfbs/TGetAllBitmapsCapability.h
fbs/fontandbitmapserver/tfbs/TRalc.h
fbs/fontandbitmapserver/tfbs/TSecureFBS.h
fbs/fontandbitmapserver/tfbs/TStreamIdCache.h
fbs/fontandbitmapserver/tfbs/glyphatlastestwrapper.cpp
fbs/fontandbitmapserver/tfbs/glyphatlastestwrapper.h
fbs/fontandbitmapserver/tfbs/scripts/fbstest_T_IPCTest.script
fbs/fontandbitmapserver/tfbs/scripts/fbstest_run.bat
fbs/fontandbitmapserver/tfbs/scripts/fbstest_t_fonttable.script
fbs/fontandbitmapserver/tfbs/scripts/fbstest_t_glyphdata.script
fbs/fontandbitmapserver/tfbs/scripts/fbstest_t_glyphdataoutlineshadow.script
fbs/fontandbitmapserver/tfbs/scripts/fbstest_t_oogm.script
fbs/fontandbitmapserver/tfbs/scripts/glyphdata_config.ini
fbs/fontandbitmapserver/tfbs/scripts/ipctest_config.ini
fbs/fontandbitmapserver/tfbs/tcompressed.h
fbs/fontandbitmapserver/tfbs/textendedbitmapcommon.h
fbs/fontandbitmapserver/tfbs/tfbsbase.h
fbs/fontandbitmapserver/tfbs/tfbsglyphdata.cpp
fbs/fontandbitmapserver/tfbs/tfbsglyphdata.h
fbs/fontandbitmapserver/tfbs/tfbsglyphdataoutlineshadow.cpp
fbs/fontandbitmapserver/tfbs/tfbsglyphdataoutlineshadow.h
fbs/fontandbitmapserver/tfbs/tfbsglyphdatapanic.cpp
fbs/fontandbitmapserver/tfbs/tfbsglyphdatapanic.h
fbs/fontandbitmapserver/tfbs/tfbsoogm.cpp
fbs/fontandbitmapserver/tfbs/tfbsoogm.h
fbs/fontandbitmapserver/tfbs/tfonttableandglyph.h
fbs/fontandbitmapserver/tfbs/tglyphatlas.cpp
fbs/fontandbitmapserver/tfbs/tglyphatlas.h
fbs/fontandbitmapserver/tfbs/tipctest.CPP
fbs/fontandbitmapserver/tfbs/tipctest.h
fbs/fontandbitmapserver/tfbs/trfile.h
fbs/fontandbitmapserver/tfbs/twdp.h
fbs/fontandbitmapserver/traces/OstTraceDefinitions.h
fbs/fontandbitmapserver/traces/fixed_id.definitions
graphicsaccelaration/vgi/group/libvgi.mmp
graphicsaccelaration/vgi/inc/vg/vgcontext.h
graphicscomposition/openwfcinterface/group/openwfc.iby
graphicscomposition/openwfsupport/bwins/WFCinteropu.def
graphicscomposition/openwfsupport/eabi/WFCinteropu.def
graphicscomposition/openwfsupport/inc/owftestexithelper.inl
graphicscomposition/openwfsupport/inc/streammap.h
graphicscomposition/openwfsupport/inc/surfacestream.h
graphicscomposition/openwfsupport/inc/symbianstream.h
graphicscomposition/openwfsupport/src/openwfcstream.cpp
graphicscomposition/openwfsupport/src/streammap.cpp
graphicscomposition/openwfsupport/src/surfacestream.cpp
graphicscomposition/openwfsupport/test/group/bld.inf
graphicscomposition/openwfsupport/test/group/tstreamoperation.mmp
graphicscomposition/openwfsupport/test/scripts/tstreamoperation.script
graphicscomposition/openwfsupport/test/tstreamoperation/tnativestream.cpp
graphicscomposition/openwfsupport/test/tstreamoperation/tnativestream.h
graphicscomposition/openwftest/group/bld.inf
graphicscomposition/openwftest/group/graphics_openwftest.mrp
graphicscomposition/openwftest/group/openwftest.mmp
graphicscomposition/openwftest/inc/eglsynchelper.h
graphicscomposition/openwftest/inc/openwftest.h
graphicscomposition/openwftest/inc/surfaceutility.h
graphicscomposition/openwftest/rom/openwftest.iby
graphicscomposition/openwftest/scripts/openwftest.script
graphicscomposition/openwftest/scripts/openwftest_automatic_c_save.ini
graphicscomposition/openwftest/scripts/openwftest_automatic_e_save.ini
graphicscomposition/openwftest/scripts/openwftest_automatic_nosave.ini
graphicscomposition/openwftest/scripts/openwftest_manual.ini
graphicscomposition/openwftest/src/eglsynchelper.c
graphicscomposition/openwftest/src/openwftest.cpp
graphicscomposition/openwftest/src/openwftestserver.cpp
graphicscomposition/openwftest/src/surfaceutility.cpp
graphicsdeviceinterface/bitgdi/sbit/FONTBMP.CPP
graphicsdeviceinterface/bitgdi/sbit/MAIN.CPP
graphicsdeviceinterface/bitgdi/tbit/TDefect2.cpp
graphicsdeviceinterface/gdi/bwins/GDI2U.def
graphicsdeviceinterface/gdi/inc/GDI.H
graphicsdeviceinterface/gdi/inc/gdiconsts.h
graphicsdeviceinterface/gdi/inc/gdiplatapi.h
graphicsdeviceinterface/screendriver/sbit/Cdsb.cpp
graphicsdeviceinterface/screendriver/sgeneric/scdraw.h
graphicsdeviceinterface/screendriver/sgeneric/scdraw.inl
graphicsdeviceinterface/screendriver/sgeneric/scnew.cpp
graphicshwdrivers/surfacemgr/inc/surface_hints.h
graphicshwdrivers/surfacemgr/test/src/tsurfacemanager.cpp
graphicstest/graphicstestharness/automation/graphicssystemgui.sysdef.xml
graphicstest/graphicstestharness/automation/h4/roms.txt
graphicstest/graphicstestharness/automation/h4/tests_00b.txt
graphicstest/graphicstestharness/automation/h4/tests_01.txt
graphicstest/graphicstestharness/automation/h4/tests_01a.txt
graphicstest/graphicstestharness/automation/h4/tests_eglhybrid.txt
graphicstest/graphicstestharness/automation/h6/tests_00b.txt
graphicstest/graphicstestharness/automation/h6/tests_01.txt
graphicstest/graphicstestharness/automation/h6/tests_01a.txt
graphicstest/graphicstestharness/automation/h6/tests_eglhybrid.txt
graphicstest/graphicstestharness/automation/ne1/tests_01.txt
graphicstest/graphicstestharness/automation/ne1/tests_01a.txt
graphicstest/graphicstestharness/automation/ne1/tests_eglhybrid.txt
graphicstest/graphicstestharness/automation/winscw/tests.txt
graphicstest/graphicstestharness/bwins/tprofileru.def
graphicstest/graphicstestharness/eabi/tprofileru.def
graphicstest/graphicstestharness/group/bld.inf
graphicstest/graphicstestharness/inc/TGraphicsHarness.h
graphicstest/graphicstestharness/inc/singletontestexithelper.inl
graphicstest/graphicstestharness/inc/tprofiler.h
graphicstest/graphicstestharness/rom/graphics_sirocco_ne_wsini.iby
graphicstest/graphicstestharness/rom/minigui_chassis_bats.oby
graphicstest/graphicstestharness/rom/minigui_naviengine_smp.oby
graphicstest/graphicstestharness/src/tprofiler.cpp
graphicstest/graphicstestharness/wsini/wsini_naviengine.ini
graphicstest/uibench/group/bld.inf
graphicstest/uibench/group/te_uibench.iby
graphicstest/uibench/group/te_uibench.mmp
graphicstest/uibench/group/te_uibench_gce.mmp
graphicstest/uibench/group/te_uibench_helium.pkg
graphicstest/uibench/s60/group/te_uibench_s60.mmp
graphicstest/uibench/scripts/te_uibench.ini
graphicstest/uibench/scripts/te_uibench.script
graphicstest/uibench/scripts/te_uibench_gce.ini
graphicstest/uibench/scripts/te_uibench_gce.script
graphicstest/uibench/src/te_graphicsperformanceSuiteDefs.h
graphicstest/uibench/src/te_graphicsperformanceSuiteServer.cpp
graphicstest/uibench/src/tfbsfonthandleperf.cpp
graphicstest/uibench/src/tfbsglyphdata.cpp
graphicstest/uibench/src/tfbsglyphdata.h
graphicstest/uibench/src/tgcesuiteserver.cpp
graphicstest/uibench/src/trenderorientation.cpp
graphicstest/uibench/src/trenderorientation.h
graphicsutils/commongraphicsheaders/rom/graphics_adaptation.hby
m3g/m3gcore11/src/m3g_loader.c
m3g/m3gcore11/src/m3g_sprite.c
m3g/m3gcore11/src/m3g_vertexarray.c
m3g/m3gcore11/src/m3g_vertexbuffer.c
printingservices/printerdriversupport/inc/prnpath.h
printingservices/printerdriversupport/tps/T_PDR.CPP
printingservices/printerdriversupport/tps/T_PDRLST.CPP
printingservices/printerdriversupport/tps/T_PDRMEM.CPP
windowing/windowserver/SERVER/openwfc/panics.h
windowing/windowserver/SERVER/w32cmd.h
windowing/windowserver/bwins/WS322U.DEF
windowing/windowserver/bwins/ws32switchu.def
windowing/windowserver/debuglog/DECODER.CPP
windowing/windowserver/eabi/WS322U.DEF
windowing/windowserver/group/openwfc/WServ_nga.MMP
windowing/windowserver/group/openwfc/bld.inf
windowing/windowserver/group/twsthemeserverpropertydefine.mmp
windowing/windowserver/group/wservu_multiscreen.ini
windowing/windowserver/group/wservu_multiscreen_changetracking.ini
windowing/windowserver/inc/Graphics/W32STDGRAPHICTEST.H
windowing/windowserver/inc/Graphics/WSGRAPHICDRAWER.H
windowing/windowserver/inc/Graphics/WSGRAPHICMSGBUF.H
windowing/windowserver/inc/Graphics/WSPLUGIN.H
windowing/windowserver/inc/Graphics/WsRenderStage.h
windowing/windowserver/inc/Graphics/WsRenderStageFactory.h
windowing/windowserver/inc/Graphics/displaycontrol.h
windowing/windowserver/inc/Graphics/displaymapping.h
windowing/windowserver/inc/Graphics/openwfc/WSGRAPHICDRAWERINTERFACE.H
windowing/windowserver/inc/Graphics/openwfc/surfaceconfiguration.inl
windowing/windowserver/inc/Graphics/openwfc/wsdisplaymapping.h
windowing/windowserver/inc/Graphics/openwfc/wselement.h
windowing/windowserver/inc/Graphics/openwfc/wsscene.h
windowing/windowserver/inc/Graphics/pointereventdata.h
windowing/windowserver/inc/Graphics/surfaceconfiguration.h
windowing/windowserver/inc/Graphics/testscreencapture.h
windowing/windowserver/inc/Graphics/windowserverconstants.h
windowing/windowserver/inc/Graphics/wscontentreadyforcomposition.h
windowing/windowserver/inc/Graphics/wscursor.h
windowing/windowserver/inc/Graphics/wsdisplaycontrol.h
windowing/windowserver/inc/Graphics/wsdisplaypolicy.h
windowing/windowserver/inc/Graphics/wsdrawablesourceprovider.h
windowing/windowserver/inc/Graphics/wsdrawresource.h
windowing/windowserver/inc/Graphics/wsgraphicdrawerinternal.h
windowing/windowserver/inc/Graphics/wsgraphicscontext.h
windowing/windowserver/inc/Graphics/wsscreendevice.h
windowing/windowserver/inc/Graphics/wsscreendeviceutils.h
windowing/windowserver/inc/Graphics/wstestscreencapture.h
windowing/windowserver/inc/Graphics/wsuibuffer.h
windowing/windowserver/inc/W32STD.H
windowing/windowserver/inc/graphics/W32STDGRAPHICTEST.H
windowing/windowserver/inc/graphics/WSGRAPHICDRAWER.H
windowing/windowserver/inc/graphics/WSGRAPHICMSGBUF.H
windowing/windowserver/inc/graphics/WSPLUGIN.H
windowing/windowserver/inc/graphics/WsRenderStage.h
windowing/windowserver/inc/graphics/WsRenderStageFactory.h
windowing/windowserver/inc/graphics/displaycontrol.h
windowing/windowserver/inc/graphics/displaymapping.h
windowing/windowserver/inc/graphics/openwfc/WSGRAPHICDRAWERINTERFACE.H
windowing/windowserver/inc/graphics/openwfc/surfaceconfiguration.inl
windowing/windowserver/inc/graphics/openwfc/wsdisplaymapping.h
windowing/windowserver/inc/graphics/openwfc/wselement.h
windowing/windowserver/inc/graphics/openwfc/wsscene.h
windowing/windowserver/inc/graphics/pointereventdata.h
windowing/windowserver/inc/graphics/surfaceconfiguration.h
windowing/windowserver/inc/graphics/testscreencapture.h
windowing/windowserver/inc/graphics/windowserverconstants.h
windowing/windowserver/inc/graphics/wscontentreadyforcomposition.h
windowing/windowserver/inc/graphics/wscursor.h
windowing/windowserver/inc/graphics/wsdisplaycontrol.h
windowing/windowserver/inc/graphics/wsdisplaypolicy.h
windowing/windowserver/inc/graphics/wsdrawablesourceprovider.h
windowing/windowserver/inc/graphics/wsdrawresource.h
windowing/windowserver/inc/graphics/wsgraphicdrawerinternal.h
windowing/windowserver/inc/graphics/wsgraphicscontext.h
windowing/windowserver/inc/graphics/wskeyrouter.h
windowing/windowserver/inc/graphics/wsscreendevice.h
windowing/windowserver/inc/graphics/wsscreendeviceutils.h
windowing/windowserver/inc/graphics/wstestscreencapture.h
windowing/windowserver/inc/graphics/wsuibuffer.h
windowing/windowserver/inc/wspublishandsubscribedata.h
windowing/windowserver/nga/CLIENT/RWINDOW.CPP
windowing/windowserver/nga/CLIENT/RWS.CPP
windowing/windowserver/nga/CLIENT/WSGRAPHIC.CPP
windowing/windowserver/nga/SERVER/CAPKEY.CPP
windowing/windowserver/nga/SERVER/EVENT.CPP
windowing/windowserver/nga/SERVER/EVENT.H
windowing/windowserver/nga/SERVER/EVQUEUE.H
windowing/windowserver/nga/SERVER/PRIKEY.CPP
windowing/windowserver/nga/SERVER/PRIKEY.H
windowing/windowserver/nga/SERVER/openwfc/CLIENT.CPP
windowing/windowserver/nga/SERVER/openwfc/CLIENT.H
windowing/windowserver/nga/SERVER/openwfc/GROUPWIN.CPP
windowing/windowserver/nga/SERVER/openwfc/ScreenRedraw.cpp
windowing/windowserver/nga/SERVER/openwfc/ScreenRedraw.h
windowing/windowserver/nga/SERVER/openwfc/WINDOW.CPP
windowing/windowserver/nga/SERVER/openwfc/WSTOP.CPP
windowing/windowserver/nga/SERVER/openwfc/cliwin.cpp
windowing/windowserver/nga/SERVER/openwfc/gc.cpp
windowing/windowserver/nga/SERVER/openwfc/playbackgc.cpp
windowing/windowserver/nga/SERVER/openwfc/redrawmsgwindow.cpp
windowing/windowserver/nga/SERVER/openwfc/screen.h
windowing/windowserver/nga/SERVER/openwfc/server.h
windowing/windowserver/nga/SERVER/openwfc/wspluginmanager.cpp
windowing/windowserver/nga/SERVER/openwfc/wspluginmanager.h
windowing/windowserver/nga/SERVER/openwfc/wstop.h
windowing/windowserver/nga/SERVER/renderorientationtracker.cpp
windowing/windowserver/nga/SERVER/renderorientationtracker.h
windowing/windowserver/nga/SERVER/renderstagemanager.cpp
windowing/windowserver/nga/SERVER/scrdev.cpp
windowing/windowserver/nga/SERVER/windowgroup.h
windowing/windowserver/nga/SERVER/wsdisplaychangeao.cpp
windowing/windowserver/nga/graphicdrawer/graphicdrawer.cpp
windowing/windowserver/nga/graphicdrawer/graphicdrawerarray.cpp
windowing/windowserver/nga/graphicdrawer/graphicdrawerenvironment.cpp
windowing/windowserver/nga/graphicdrawer/graphicdrawerfactory.cpp
windowing/windowserver/nga/graphicdrawer/graphicmsgbuf.cpp
windowing/windowserver/nga/graphicdrawer/wsplugin.cpp
windowing/windowserver/nga/graphicdrawer/wsrenderstage.cpp
windowing/windowserver/nga/remotegc/CommandBuffer.cpp
windowing/windowserver/nga/remotegc/DrawSection.cpp
windowing/windowserver/nonnga/CLIENT/RWS.CPP
windowing/windowserver/nonnga/SERVER/WSTOP.CPP
windowing/windowserver/stdgraphic/BITMAPANIMATIONGRAPHICDRAWER.CPP
windowing/windowserver/stdgraphic/stdgraphicdrawer.h
windowing/windowserver/stdgraphic/stdgraphictest.cpp
windowing/windowserver/stdgraphic/stdgraphictestdrawer.h
windowing/windowserver/test/TAutoServer/TAutoServer.cpp
windowing/windowserver/test/TAutoServer/openwfc/TAutoServer_nga.mmp
windowing/windowserver/test/TAutoServer/openwfc/TAutoServer_nonnga.mmp
windowing/windowserver/test/TAutoServer/tevent_captureapp.mmp
windowing/windowserver/test/scripts/wstest_config.cmd
windowing/windowserver/test/scripts/wstest_t_devicerotation_s0_nga.script
windowing/windowserver/test/t_gdcoverage/gdcoverage.h
windowing/windowserver/test/t_genericplugin/data/ini/wsini_naviengine_genericplugin.ini
windowing/windowserver/test/t_genericplugin/group/bld.inf
windowing/windowserver/test/t_genericplugin/src/t_testrenderstage.cpp
windowing/windowserver/test/t_ratelimiter/data/wsini_naviengine_ratelimiter.ini
windowing/windowserver/test/t_ratelimiter/group/bld.inf
windowing/windowserver/test/t_ratelimiter/tratelimitdrawer/ratelimitdrawer.h
windowing/windowserver/test/tauto/TCapKey.CPP
windowing/windowserver/test/tauto/TCapKey.H
windowing/windowserver/test/tauto/TEVENT.H
windowing/windowserver/test/tauto/TEvent.CPP
windowing/windowserver/test/tauto/TGRAPHICSDRAWER.CPP
windowing/windowserver/test/tauto/TOOM.CPP
windowing/windowserver/test/tauto/TOOM.H
windowing/windowserver/test/tauto/talphawin.cpp
windowing/windowserver/test/tauto/tdevicerotation.cpp
windowing/windowserver/test/tauto/tdevicerotation.h
windowing/windowserver/test/tauto/tevent_captureapp.cpp
windowing/windowserver/test/tauto/tgc.cpp
windowing/windowserver/test/tauto/themeserverpropertydefine.cpp
windowing/windowserver/test/tauto/themeserverpropertydefine.h
windowing/windowserver/test/tdynamicres/group/bld.inf
windowing/windowserver/test/tdynamicres/group/wstestdynamicres.iby
windowing/windowserver/test/tdynamicres/group/wstestdynamicres_helium.pkg
windowing/windowserver/test/tdynamicres/inc/wsdynamicresbase.h
windowing/windowserver/test/tdynamicres/scripts/wsdynamicresbasic_sirocco.script
windowing/windowserver/test/tdynamicres/src/t_wsdynamicreswinbase.cpp
windowing/windowserver/test/tdynamicres/src/wsdynamicresbase.cpp
windowing/windowserver/test/tdynamicres/src/wsdynamicresbasic.cpp
windowing/windowserver/test/tframerate/framerate.h
windowing/windowserver/test/tlisten/listener.h
windowing/windowserver/test/tredir/redirector.h
windowing/windowserver/wins_switching/ws32_stubs.h
windowing/windowserverplugins/group/bld.inf
windowing/windowserverplugins/keyeventrouting/bwins/keyrouteru.def
windowing/windowserverplugins/keyeventrouting/eabi/keyrouteru.def
windowing/windowserverplugins/keyeventrouting/group/bld.inf
windowing/windowserverplugins/keyeventrouting/group/keyeventrouting.iby
windowing/windowserverplugins/keyeventrouting/group/keyeventrouting.mmp
windowing/windowserverplugins/keyeventrouting/group/keyeventrouting_test.iby
windowing/windowserverplugins/keyeventrouting/group/keyeventrouting_test.mmp
windowing/windowserverplugins/keyeventrouting/src/keyaliases.h
windowing/windowserverplugins/keyeventrouting/src/keyrouter.cpp
windowing/windowserverplugins/keyeventrouting/src/keyrouterimpl.h
windowing/windowserverplugins/openwfc/group/stdplugin.mmp
windowing/windowserverplugins/openwfc/group/wserv_std_plugins.iby
windowing/windowserverplugins/openwfc/src/displayrenderstage.cpp
windowing/windowserverplugins/openwfc/src/fbrenderstage.cpp
--- a/egl/eglinterface/include/1.4/eglext.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/egl/eglinterface/include/1.4/eglext.h	Tue Jul 20 13:27:44 2010 +0300
@@ -263,17 +263,17 @@
 EGLAPI EGLBoolean EGLAPIENTRY eglEndpointCancelNotificationNOK(EGLDisplay dpy, EGLEndpointNOK endpoint);
 #endif
 
-typedef EGLEndpointNOK ( *PFNEGLCREATEENDPOINTNOKPROC) (EGLDisplay dpy, EGLenum type, EGLenum source_type, EGLEndpointSourceNOK source, const EGLint* attrib_list);
-typedef EGLBoolean ( *PFNEGLDESTROYENDPOINTNOKPROC) (EGLDisplay dpy, EGLEndpointNOK endpoint);
-typedef EGLint ( *PFNEGLGETENDPOINTATTRIBNOKPROC) (EGLDisplay dpy, EGLEndpointNOK endpoint, EGLint attrib);
-typedef EGLBoolean ( *PFNEGLSETENDPOINTATTRIBNOKPROC) (EGLDisplay dpy, EGLEndpointNOK endpoint, EGLint attrib, EGLint value);
-typedef EGLBoolean ( *PFNEGLENDPOINTBEGINSTREAMINGNOKPROC) (EGLDisplay dpy, EGLEndpointNOK endpoint);
-typedef EGLBoolean ( *PFNEGLENDPOINTENDSTREAMINGNOKPROC) (EGLDisplay dpy, EGLEndpointNOK endpoint);
-typedef EGLImageKHR  ( *PFNEGLACQUIREIMAGENOKPROC)(EGLDisplay dpy, EGLEndpointNOK endpoint);
-typedef EGLBoolean ( *PFNEGLRELEASEIMAGENOKPROC) (EGLDisplay dpy, EGLEndpointNOK endpoint, EGLImageKHR image, EGLenum api);
-typedef EGLint ( *PFNEGLGETENDPOINTDIRTYAREANOKPROC) (EGLDisplay dpy,  EGLEndpointNOK endpoint, EGLint* rects, EGLint start_rect, EGLint max_rects,  EGLBoolean collapse); 
-typedef EGLBoolean ( *PFNEGLENDPOINTREQUESTNOTIFICATIONNOKPROC) (EGLDisplay dpy, EGLEndpointNOK endpoint, EGLTRequestStatusNOK sync);
-typedef EGLBoolean ( *PFNEGLENDPOINTCANCELNOTIFICATIONNOKPROC) (EGLDisplay dpy, EGLEndpointNOK endpoint);
+typedef EGLEndpointNOK (EGLAPIENTRYP PFNEGLCREATEENDPOINTNOKPROC) (EGLDisplay dpy, EGLenum type, EGLenum source_type, EGLEndpointSourceNOK source, const EGLint* attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYENDPOINTNOKPROC) (EGLDisplay dpy, EGLEndpointNOK endpoint);
+typedef EGLint (EGLAPIENTRYP PFNEGLGETENDPOINTATTRIBNOKPROC) (EGLDisplay dpy, EGLEndpointNOK endpoint, EGLint attrib);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETENDPOINTATTRIBNOKPROC) (EGLDisplay dpy, EGLEndpointNOK endpoint, EGLint attrib, EGLint value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLENDPOINTBEGINSTREAMINGNOKPROC) (EGLDisplay dpy, EGLEndpointNOK endpoint);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLENDPOINTENDSTREAMINGNOKPROC) (EGLDisplay dpy, EGLEndpointNOK endpoint);
+typedef EGLImageKHR  (EGLAPIENTRYP PFNEGLACQUIREIMAGENOKPROC)(EGLDisplay dpy, EGLEndpointNOK endpoint);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLRELEASEIMAGENOKPROC) (EGLDisplay dpy, EGLEndpointNOK endpoint, EGLImageKHR image, EGLenum api);
+typedef EGLint (EGLAPIENTRYP PFNEGLGETENDPOINTDIRTYAREANOKPROC) (EGLDisplay dpy,  EGLEndpointNOK endpoint, EGLint* rects, EGLint start_rect, EGLint max_rects,  EGLBoolean collapse); 
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLENDPOINTREQUESTNOTIFICATIONNOKPROC) (EGLDisplay dpy, EGLEndpointNOK endpoint, EGLTRequestStatusNOK sync);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLENDPOINTCANCELNOTIFICATIONNOKPROC) (EGLDisplay dpy, EGLEndpointNOK endpoint);
 #endif
 
 #ifndef EGL_SYMBIAN_COMPOSITION
--- a/egl/egltest/bwins/egltestcommonu.def	Tue Jun 22 15:21:29 2010 +0300
+++ b/egl/egltest/bwins/egltestcommonu.def	Tue Jul 20 13:27:44 2010 +0300
@@ -84,7 +84,7 @@
 	?CheckExpectedError@CTestEglSession@@QAEHH@Z @ 83 NONAME ; int CTestEglSession::CheckExpectedError(int)
 	?GetVgFormat@CEglTestCommonIniSettings@@QAE?AW4VGImageFormat@@ABVTDesC16@@H@Z @ 84 NONAME ; enum VGImageFormat CEglTestCommonIniSettings::GetVgFormat(class TDesC16 const &, int)
 	?CleanupSurfaceFbsBitmapL@CTestEglSession@@QAEXXZ @ 85 NONAME ; void CTestEglSession::CleanupSurfaceFbsBitmapL(void)
-	?CreateWindowSurfaceAndMakeCurrentL@CTestEglSession@@QAEXHAAVRWindow@@HHH@Z @ 86 NONAME ; void CTestEglSession::CreateWindowSurfaceAndMakeCurrentL(int, class RWindow &, int, int, int)
+	?CreateWindowSurfaceAndMakeCurrentL@CTestEglSession@@QAEXHAAVRWindow@@HHHPAH@Z	 @ 86 NONAME ; void CTestEglSession::CreateWindowSurfaceAndMakeCurrentL(int, class RWindow &, int, int, int, int*)
 	?CloseSgDriver@CTestEglSession@@QAEXXZ @ 87 NONAME ; void CTestEglSession::CloseSgDriver(void)
 	?doTestStepPreambleL@CEglTestStep@@UAE?AW4TVerdict@@XZ @ 88 NONAME ; enum TVerdict CEglTestStep::doTestStepPreambleL(void)
 	??0CTestEglSession@@IAE@AAVCTestExecuteLogger@@AAHH@Z @ 89 NONAME ; CTestEglSession::CTestEglSession(class CTestExecuteLogger &, int &, int)
@@ -119,4 +119,3 @@
 	?GetThresholdGPUUsedMemory@CEglTestCommonIniSettings@@QAEHABVTDesC16@@@Z @ 118 NONAME ; int CEglTestCommonIniSettings::GetThresholdGPUUsedMemory(class TDesC16 const &)
 	?GetThresholdLastIteration@CEglTestCommonIniSettings@@QAEHABVTDesC16@@@Z @ 119 NONAME ; int CEglTestCommonIniSettings::GetThresholdLastIteration(class TDesC16 const &)
 	?GetWindowSize@CEglTestCommonIniSettings@@QAE?AVTSize@@ABVTDesC16@@@Z @ 120 NONAME ; class TSize CEglTestCommonIniSettings::GetWindowSize(class TDesC16 const &)
-
--- a/egl/egltest/eabi/egltestcommonu.def	Tue Jun 22 15:21:29 2010 +0300
+++ b/egl/egltest/eabi/egltestcommonu.def	Tue Jul 20 13:27:44 2010 +0300
@@ -82,7 +82,7 @@
 	_ZN15CTestEglSession31TryUsePixmapCFbsBitmapOpenGlesLEiRK5TSize12TDisplayModei @ 81 NONAME
 	_ZN15CTestEglSession34CreatePixmapSurfaceAndMakeCurrentLEiRK12TSgImageInfoNS_18TResourceCloseRuleEii @ 82 NONAME
 	_ZN15CTestEglSession34CreatePixmapSurfaceAndMakeCurrentLEiRK5TSize12TDisplayModeii @ 83 NONAME
-	_ZN15CTestEglSession34CreateWindowSurfaceAndMakeCurrentLEiR7RWindowiii @ 84 NONAME
+	_ZN15CTestEglSession34CreateWindowSurfaceAndMakeCurrentLEiR7RWindowiiiPi @ 84 NONAME
 	_ZN15CTestEglSession35CreatePbufferSurfaceAndMakeCurrentLEiRK5TSizeii @ 85 NONAME
 	_ZN15CTestEglSession42CreatePixmapSurfaceAndMakeCurrentAndMatchLERK12TSgImageInfoNS_18TResourceCloseRuleEii @ 86 NONAME
 	_ZN15CTestEglSession42CreatePixmapSurfaceAndMakeCurrentAndMatchLERK5TSize12TDisplayModeii @ 87 NONAME
@@ -138,4 +138,3 @@
 	_ZN25CEglTestCommonIniSettings13GetWindowSizeERK7TDesC16 @ 137 NONAME
 	_ZN25CEglTestCommonIniSettings25GetThresholdGPUUsedMemoryERK7TDesC16 @ 138 NONAME
 	_ZN25CEglTestCommonIniSettings25GetThresholdLastIterationERK7TDesC16 @ 139 NONAME
-
--- a/egl/egltest/group/bld.inf	Tue Jun 22 15:21:29 2010 +0300
+++ b/egl/egltest/group/bld.inf	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2009-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"
@@ -61,6 +61,7 @@
 ../scripts/egltest_t_oom_sgimage.script					z:/egltest/egltest_t_oom_sgimage.script
 ../scripts/egltest_t_stress_sgimage.script					z:/egltest/egltest_t_stress_sgimage.script
 ../scripts/egltest_t_benchmark_swapbuffers.script			z:/egltest/egltest_t_benchmark_swapbuffers.script
+../scripts/egltest_t_surfacescaling.script			        z:/egltest/egltest_t_surfacescaling.script
 
 //Include the endpoint test suite
 #include "../endpointtestsuite/group/bld.inf"
--- a/egl/egltest/group/egltest.mmp	Tue Jun 22 15:21:29 2010 +0300
+++ b/egl/egltest/group/egltest.mmp	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2009-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"
@@ -48,6 +48,7 @@
 SOURCE                  egltest_stress_sgimage.cpp
 SOURCE                  egltest_stress_common_sgimage.cpp
 SOURCE                  egltest_benchmark_swapbuffers.cpp
+SOURCE                  egltest_surfacescaling.cpp
 
 
 SOURCEPATH             ../scripts
@@ -69,6 +70,7 @@
 DOCUMENT               egltest_t_oom_sgimage.script
 DOCUMENT               egltest_t_stress_sgimage.script
 DOCUMENT               egltest_t_benchmark_swapbuffers.script
+DOCUMENT               egltest_t_surfacescaling.script
 
 
 LIBRARY                 rfileloggerclient.lib
--- a/egl/egltest/group/egltest_helium.pkg	Tue Jun 22 15:21:29 2010 +0300
+++ b/egl/egltest/group/egltest_helium.pkg	Tue Jul 20 13:27:44 2010 +0300
@@ -49,4 +49,6 @@
 "\epoc32\data\z\egltest\egltest_t_image_negative.script"-"c:\egltest\egltest_t_image_negative.script"
 "\epoc32\data\z\egltest\egltest_t_benchmark_sgimage.script"-"c:\egltest\egltest_t_benchmark_sgimage.script"
 "\epoc32\data\z\egltest\egltest_t_benchmark_swapbuffers.script"-"c:\egltest\egltest_t_benchmark_swapbuffers.script"
+"\epoc32\data\z\egltest\egltest_t_oom_sgimage.script"-"c:\egltest\egltest_t_oom_sgimage.script"
+"\epoc32\data\z\egltest\egltest_t_stress_sgimage.script"-"c:\egltest\egltest_t_stress_sgimage.script"
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/egl/egltest/inc/egltest_surfacescaling.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,266 @@
+// Copyright (c) 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:
+//
+
+/**
+ @file
+ @test
+*/
+
+#ifndef EGLTEST_SURFACESCALING_H
+#define EGLTEST_SURFACESCALING_H
+
+#include "eglteststep.h"
+#include <test/egltestcommonsession.h>
+#include <test/graphicsscreencomparison.h>
+
+enum TEglTestScalingConfig
+	{ 
+	EWindowAttribs_NoScaling,
+	EWindowAttribsColor16MU_Scaling 
+	};
+
+static const EGLint KScalingConfigAttribs[2][17] =
+	{
+		{
+		//Window - Scaling not supported
+		EGL_BUFFER_SIZE,    	 0,
+		EGL_RED_SIZE,			 0,
+		EGL_GREEN_SIZE, 		 0,
+		EGL_BLUE_SIZE,			 0,
+		EGL_ALPHA_SIZE, 		 0,
+		EGL_RENDERABLE_TYPE,	 EGL_OPENVG_BIT,
+		EGL_SURFACE_TYPE,		 EGL_WINDOW_BIT,
+		EGL_SURFACE_SCALING_NOK, EGL_FALSE,
+		EGL_NONE
+		},
+		{
+		//EColor16MU - Window - Scaling supported
+		EGL_BUFFER_SIZE,    	 24,
+		EGL_RED_SIZE,			 8,
+		EGL_GREEN_SIZE, 		 8,
+		EGL_BLUE_SIZE,			 8,
+		EGL_ALPHA_SIZE,     	 0,
+		EGL_RENDERABLE_TYPE,	 EGL_OPENVG_BIT,
+		EGL_SURFACE_TYPE,		 EGL_WINDOW_BIT,
+		EGL_SURFACE_SCALING_NOK, EGL_TRUE,
+		EGL_NONE
+		},
+	};
+
+//base class for all surface scaling test cases
+//all common functionality should go here
+NONSHARABLE_CLASS(CEglTest_SurfaceScalingBase) : public CEglTestStep
+    {
+public:
+    ~CEglTest_SurfaceScalingBase();
+
+protected:
+    // from CTestStep
+    TVerdict doTestStepPreambleL();
+    TVerdict doTestStepPostambleL();
+
+    // helper methods
+    void CheckBorderColorL(EGLint aExpectedRedChannelColor, EGLint aExpectedBlueChannelColor, EGLint aExpectedGreenChannelColor);
+    void CheckScalingAttributesL(EGLint aExpectedSurfaceWidth, EGLint aExpectedSurfaceHeight, EGLint aExpectedExtentWidth, EGLint aExpectedExtentHeight, EGLint aExpectedOffsetX, EGLint aExpectedOffsetY);
+    CFbsBitmap* CreateBitmapLC(const TSize& aSize, TInt aBorderTop, TInt aBorderBottom, TInt aBorderLeft, TInt aBorderRight, const TRgb& aBorderColor);
+    void WritePixelsToSurfaceL(const CFbsBitmap& aBitmap);
+    void CreateAndActivateWindowL(const TSize& aWindowSize);
+    void CloseWindow();
+
+protected:
+    CWsScreenDevice* iScreenDevice;
+    RWindow iWindow;
+    // surface scaling extension functions
+    TFPtrEglQuerySurfaceScalingCapabilityNok iPfnEglQuerySurfaceScalingCapabilityNOK;
+    TFPtrEglSetSurfaceScalingNok iPfnEglSetSurfaceScalingNOK;
+    // surface scaling attributes
+    TInt iWindowWidth;
+    TInt iWindowHeight;
+    TInt iSurfaceWidth;
+    TInt iSurfaceHeight;
+    TInt iExtentWidth;
+    TInt iExtentHeight;
+    TInt iOffsetX;
+    TInt iOffsetY;
+    TRgb iBorderColor;
+    // surface scaling related attributes for reference bitmap
+    TInt iBorderTop;
+    TInt iBorderBottom;
+    TInt iBorderLeft;
+    TInt iBorderRight;
+    // image comparison
+    CTGraphicsScreenComparison* iImageComparison;
+    // properties of the particular surface scaling implementation under testing
+    TBool iAllScalable;
+    TSize iScreenSize;
+    };
+
+
+// EGL Surface Scaling tests
+_LIT(KSurfaceScaling_Positive, "SurfaceScaling_Positive");
+NONSHARABLE_CLASS(CEglTest_SurfaceScaling_Positive) : public CEglTest_SurfaceScalingBase
+    {
+public:
+    TVerdict doTestStepL();
+    TVerdict doTestPartialStepL();
+    };
+
+_LIT(KSurfaceScaling_WindowResize, "SurfaceScaling_WindowResize");
+NONSHARABLE_CLASS(CEglTest_SurfaceScaling_WindowResize) : public CEglTest_SurfaceScalingBase
+    {
+public:
+    TVerdict doTestStepL();
+    TVerdict doTestPartialStepL();
+    };
+
+_LIT(KSurfaceScaling_ExtentPositionChange, "SurfaceScaling_ExtentPositionChange");
+NONSHARABLE_CLASS(CEglTest_SurfaceScaling_ExtentPositionChange) : public CEglTest_SurfaceScalingBase
+    {
+public:
+    TVerdict doTestStepL();
+    TVerdict doTestPartialStepL(const CFbsBitmap& aRefBitmap);
+private:
+    TInt iRefBitmapOffset;
+    };
+
+_LIT(KSurfaceScaling_ExtentSizeChange, "SurfaceScaling_ExtentSizeChange");
+NONSHARABLE_CLASS(CEglTest_SurfaceScaling_ExtentSizeChange) : public CEglTest_SurfaceScalingBase
+    {
+public:
+    TVerdict doTestStepL();
+    TVerdict doTestPartialStepL();
+    };
+
+_LIT(KSurfaceScaling_SwapBuffers, "SurfaceScaling_SwapBuffers");
+NONSHARABLE_CLASS(CEglTest_SurfaceScaling_SwapBuffers) : public CEglTest_SurfaceScalingBase
+    {
+public:
+    TVerdict doTestStepL();
+    TVerdict doTestPartialStepL();
+    };
+
+_LIT(KSurfaceScaling_WindowSurface_Check, "SurfaceScaling_WindowSurface_Check");
+NONSHARABLE_CLASS(CEglTest_SurfaceScaling_WindowSurface_Check) : public CEglTest_SurfaceScalingBase
+    {
+public:
+    TVerdict doTestStepL();
+    };
+
+_LIT(KSurfaceScaling_Negative_CreateWindowSurface, "SurfaceScaling_Negative_CreateWindowSurface");
+NONSHARABLE_CLASS(CEglTest_SurfaceScaling_Negative_CreateWindowSurface) : public CEglTest_SurfaceScalingBase
+    {
+public:
+    TVerdict doTestStepL();
+    };
+
+_LIT(KSurfaceScaling_Negative_FixedSize_NonWindowSurface, "SurfaceScaling_Negative_FixedSize_NonWindowSurface");
+NONSHARABLE_CLASS(CEglTest_SurfaceScaling_Negative_FixedSize_NonWindowSurface) : public CEglTest_SurfaceScalingBase
+    {
+public:
+    TVerdict doTestStepL();
+    };
+
+_LIT(KSurfaceScalingDefaultBorderColor, "SurfaceScalingDefaultBorderColor");
+NONSHARABLE_CLASS(CEglTest_SurfaceScalingDefaultBorderColor) : public CEglTest_SurfaceScalingBase
+    {
+public:
+    TVerdict doTestStepL();
+    };
+
+_LIT(KSurfaceScalingModifyingBorderColor, "SurfaceScalingModifyingBorderColor");
+NONSHARABLE_CLASS(CEglTest_SurfaceScalingModifyingBorderColor) : public CEglTest_SurfaceScalingBase
+    {
+public:
+    TVerdict doTestStepL();
+    };
+
+_LIT(KSurfaceScalingModifyingBorderColorNonFixed, "SurfaceScalingModifyingBorderColorNonFixed");
+NONSHARABLE_CLASS(CEglTest_SurfaceScalingModifyingBorderColorNonFixed) : public CEglTest_SurfaceScalingBase
+    {
+public:
+	TVerdict doTestStepL();
+    };
+
+_LIT(KSurfaceScalingModifyingInvalidBorderColor, "SurfaceScalingModifyingInvalidBorderColor");
+NONSHARABLE_CLASS(CEglTest_SurfaceScalingModifyingInvalidBorderColor) : public CEglTest_SurfaceScalingBase
+    {
+public:
+    TVerdict doTestStepL();
+    };
+
+_LIT(KSurfaceScalingModifyingExtent, "SurfaceScalingModifyingExtent");
+NONSHARABLE_CLASS(CEglTest_SurfaceScalingModifyingExtent) : public CEglTest_SurfaceScalingBase
+    {
+public:
+    TVerdict doTestStepL();
+    };
+
+_LIT(KSurfaceScalingModifyingExtentNonFixed, "SurfaceScalingModifyingExtentNonFixed");
+NONSHARABLE_CLASS(CEglTest_SurfaceScalingModifyingExtentNonFixed) : public CEglTest_SurfaceScalingBase
+    {
+public:
+    TVerdict doTestStepL();
+    };
+
+_LIT(KSurfaceScalingQuerySurface, "SurfaceScalingQuerySurface");
+NONSHARABLE_CLASS(CEglTest_SurfaceScalingQuerySurface) : public CEglTest_SurfaceScalingBase
+    {
+public:
+    TVerdict doTestStepL();
+    };
+
+_LIT(KSurfaceScalingQuerySurfaceNonFixed, "SurfaceScalingQuerySurfaceNonFixed");
+NONSHARABLE_CLASS(CEglTest_SurfaceScalingQuerySurfaceNonFixed) : public CEglTest_SurfaceScalingBase
+    {
+public:
+    TVerdict doTestStepL();
+    };
+
+_LIT(KSurfaceScalingCapability, "SurfaceScalingCapability");
+NONSHARABLE_CLASS(CEglTest_SurfaceScalingCapability) : public CEglTest_SurfaceScalingBase
+    {
+public:
+    TVerdict doTestStepL();
+    };
+
+_LIT(KSurfaceScalingSet, "SurfaceScalingSet");
+NONSHARABLE_CLASS(CEglTest_SurfaceScalingSet) : public CEglTest_SurfaceScalingBase
+    {
+public:
+    TVerdict doTestStepL();
+    };
+
+_LIT(KSurfaceScalingSetNonFixed, "SurfaceScalingSetNonFixed");
+NONSHARABLE_CLASS(CEglTest_SurfaceScalingSetNonFixed) : public CEglTest_SurfaceScalingBase
+    {
+public:
+    TVerdict doTestStepL();
+    };
+
+_LIT(KSurfaceScalingSetInvalidAttributes, "SurfaceScalingSetInvalidAttributes");
+NONSHARABLE_CLASS(CEglTest_SurfaceScalingSetInvalidAttributes) : public CEglTest_SurfaceScalingBase
+    {
+public:
+    TVerdict doTestStepL();
+    };
+
+_LIT(KSurfaceScalingNotInitialized, "SurfaceScalingNotInitialized");
+NONSHARABLE_CLASS(CEglTest_SurfaceScalingNotInitialized) : public CEglTest_SurfaceScalingBase
+    {
+public:
+    TVerdict doTestStepL();
+    };
+
+#endif // EGLTEST_SURFACESCALING_H
--- a/egl/egltest/inc/egltestcommonsession.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/egl/egltest/inc/egltestcommonsession.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-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"
@@ -46,6 +46,10 @@
 typedef EGLBoolean (*TFPtrEglGetSyncAttribKhr) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
 typedef EGLint (*TFPtrEglPrivateSignalSyncNok) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
 
+//pointer to function for surface scaling
+typedef EGLBoolean (*TFPtrEglQuerySurfaceScalingCapabilityNok) (EGLDisplay dpy, EGLConfig config, EGLint surface_width, EGLint surface_height, EGLint target_width, EGLint target_height, EGLint *value);
+typedef EGLBoolean (*TFPtrEglSetSurfaceScalingNok) (EGLDisplay dpy, EGLSurface surface, EGLint target_offset_x, EGLint target_offset_y, EGLint target_width, EGLint target_height);
+
 const TUint KImagesArrayGranularity = 4;
 
 // forward declarations
@@ -104,7 +108,7 @@
 	//
 	//Compound functions that construct surface 
 	//
-	IMPORT_C void CreateWindowSurfaceAndMakeCurrentL(EGLConfig aConfig, RWindow& aWindow, TBool aVgAlphaFormatPre = EFalse, EGLenum aBindAPI = EGL_OPENVG_API, TInt aRenderVersionNumber = 1);	
+	IMPORT_C void CreateWindowSurfaceAndMakeCurrentL(EGLConfig aConfig, RWindow& aWindow, TBool aVgAlphaFormatPre = EFalse, EGLenum aBindAPI = EGL_OPENVG_API, TInt aRenderVersionNumber = 1, EGLint* aAttribList = NULL);	
 	IMPORT_C void CreatePixmapSurfaceAndMakeCurrentAndMatchL(const TSgImageInfo& aImageInfo, TResourceCloseRule aResourceCloseRule, EGLenum aBindAPI = EGL_OPENVG_API, TInt aRenderVersionNumber = 1);
 	IMPORT_C void CreatePixmapSurfaceAndMakeCurrentAndMatchL(const TSize& aSize, TDisplayMode aDisplayMode, EGLenum aBindAPI = EGL_OPENVG_API, TInt aRenderVersionNumber = 1);
     IMPORT_C void CreatePbufferSurfaceAndMakeCurrentL(EGLConfig aConfig, const TSize& aSize, EGLenum aBindAPI = EGL_OPENVG_API, TInt aRenderVersionNumber = 1);
@@ -265,7 +269,7 @@
 #endif	
 	TBool 		iFbsSessionOpen;
 
-	//we will use a “lazy” initialization for iIsOpenGLESSupported, iIsOpenGLES2Supported and iIsOpenVGSupportedvariable members, 
+	//we will use a "lazy" initialization for iIsOpenGLESSupported, iIsOpenGLES2Supported and iIsOpenVGSupportedvariable members, 
 	//i.e. they will be initialized upon the first request
 	TBool       iIsSupportedRenderInitialized; //signify that iIsOpenGLESSupported, iIsOpenGLES2Supported and iIsOpenVGSupported members have been initialized   
 	TBool       iIsOpenGLESSupported;  
--- a/egl/egltest/inc/egltestcommonutils.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/egl/egltest/inc/egltestcommonutils.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-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"
@@ -372,6 +372,8 @@
 _LIT8(KEglKhrReusableSync,"EGL_KHR_reusable_sync");
 _LIT8(KEglNokPrivateSignalSync,"EGL_NOK__private__signal_sync");
 _LIT8(KEglNokiaSwapBuffers,"EGL_NOKIA_swap_buffers");
+_LIT8(KEglNokiaImageEndpoint,"EGL_NOK_image_endpoint");
+_LIT8(KEglNokiaSurfaceScaling,"EGL_NOK_surface_scaling");
 #ifndef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
 _LIT8(KEglSymbianImagePreserved,"EGL_SYMBIAN_image_preserved");
 #endif
@@ -387,7 +389,9 @@
 	KEGL_KHR_reusable_sync			= 0x10,
 	KEGL_NOK__private__signal_sync  = 0x20,
 	KEGL_NOKIA_swap_buffers         = 0x40,
-	KEGL_SYMBIAN_image_preserved	= 0x80
+    KEGL_SYMBIAN_image_preserved    = 0x80,
+    KEGL_NOK_image_endpoint         = 0x100,
+    KEGL_NOK_surface_scaling        = 0x200
 	};
 
 const TUid KUidEglTestServer={0x10281B40};
--- a/egl/egltest/inc/eglteststep.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/egl/egltest/inc/eglteststep.h	Tue Jul 20 13:27:44 2010 +0300
@@ -21,8 +21,6 @@
 #ifndef EGLTEST_STEP_H
 #define EGLTEST_STEP_H
 
-#include <e32msgqueue.h>
-
 #include <test/eglteststepfactory.h>
 
 _LIT(KEglTestStepDllName, "egltest.dll");
--- a/egl/egltest/rom/egltest.iby	Tue Jun 22 15:21:29 2010 +0300
+++ b/egl/egltest/rom/egltest.iby	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2009-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"
@@ -66,6 +66,8 @@
 data=DATAZ_\egltest\egltest_t_oom_sgimage.script                 \egltest\egltest_t_oom_sgimage.script
 data=DATAZ_\egltest\egltest_t_stress_sgimage.script              \egltest\egltest_t_stress_sgimage.script
 data=DATAZ_\egltest\egltest_t_benchmark_swapbuffers.script		 \egltest\egltest_t_benchmark_swapbuffers.script
+data=DATAZ_\egltest\egltest_t_surfacescaling.script		         \egltest\egltest_t_surfacescaling.script
 data=DATAZ_\egltest\egltest_run.bat                          	\egltest_run.bat
 
+
 #endif // __EGLTEST_IBY__
--- a/egl/egltest/scripts/egltest_run.bat	Tue Jun 22 15:21:29 2010 +0300
+++ b/egl/egltest/scripts/egltest_run.bat	Tue Jul 20 13:27:44 2010 +0300
@@ -1,5 +1,5 @@
 @rem
-@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+@rem Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 @rem All rights reserved.
 @rem This component and the accompanying materials are made available
 @rem under the terms of "Eclipse Public License v1.0"
@@ -30,6 +30,7 @@
 testexecute.exe z:\egltest\egltest_t_oom_sgimage.script
 testexecute.exe z:\egltest\egltest_t_stress_sgimage.script
 testexecute.exe z:\egltest\egltest_t_benchmark_swapbuffers.script
+testexecute.exe z:\egltest\egltest_t_surfacescaling.script
 
 :: Ignore the following if using this script for emulator testing.
 :: Logs are automatically copied on hardware to MMC
--- a/egl/egltest/scripts/egltest_settings.ini	Tue Jun 22 15:21:29 2010 +0300
+++ b/egl/egltest/scripts/egltest_settings.ini	Tue Jul 20 13:27:44 2010 +0300
@@ -31,34 +31,33 @@
 Format2	= VG_sARGB_8888_PRE
 
 [SyncObject]
-Threshold=500000
-DelaySignalling=2500000
-WaitSyncTimeout=5000000
-LongDelaySignalling=7500000
-NumIterations=1000
+Threshold = 500000
+DelaySignalling = 2500000
+WaitSyncTimeout = 5000000
+LongDelaySignalling = 7500000
+NumIterations = 1000
+
+[SurfaceScaling]
+AllScalable = ETrue
 
 [Benchmark]
-NumIterations = 300 // Needs to be set with care. Making this value greater may cause an allocation failure.
-                    // On the emulator, it fails to create SgImage at some point.
-                    // Hardware will have their own limitations which also need to be considered.
-ImageWidth = 50 // width of RSgImage
-ImageHeight = 50 // height of RSgImage
+// NumIterations needs to be set with care (and hardware limitations must be considered)
+// Making this value greater may cause an allocation failure 
+NumIterations = 300 
+ImageWidth = 50
+ImageHeight = 50
 NumFormats = 1
 Format0 = EUidPixelFormatARGB_8888_PRE
 
 [OOM]
+// Width and height need to be set with care (and hardware limitations must be considered)
+// Making these values too small may result in the test taking a very long time to reach an out of memory situation
 NumIterations = 5
-ImageWidth = 200  // width of RSgImage
-ImageHeight = 200 // height of RSgImage
-		  // Width and height need to be set with care. Making these values too small may result
-		  // in the test taking a very long time to reach an out of memory situation.
-		  // Different hardware platforms will have different memory limitations 
-ThresholdGPUUsedMemory = 5 //Deviation in percentage between max and min of GPU memory
-			   //retrieved at the end of each attempt through NOK_resource_profiling2 egl extension inteface
-ThresholdLastIteration = 5 //Deviation in percentage between max and min of successful iteration number 
-			   //retrieved at the end of each attempt
-
+ImageWidth = 200
+ImageHeight = 200
+ThresholdGPUUsedMemory = 5
+ThresholdLastIteration = 5
 
 [SwapBuffers]
-WindowWidth=200
-WindowHeight=200
\ No newline at end of file
+WindowWidth = 200
+WindowHeight = 200
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/egl/egltest/scripts/egltest_t_surfacescaling.script	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,43 @@
+// Copyright (c) 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: 
+// Run EGL surface scaling tests.
+//
+
+PRINT Run EGL surface scaling tests
+
+LOAD_SUITE egltestserver
+
+RUN_TEST_STEP 100 egltestserver SurfaceScaling_Positive
+RUN_TEST_STEP 100 egltestserver SurfaceScaling_WindowResize
+RUN_TEST_STEP 100 egltestserver SurfaceScaling_ExtentPositionChange
+RUN_TEST_STEP 100 egltestserver SurfaceScaling_ExtentSizeChange
+RUN_TEST_STEP 100 egltestserver SurfaceScaling_SwapBuffers
+RUN_TEST_STEP 100 egltestserver SurfaceScaling_WindowSurface_Check
+RUN_TEST_STEP 100 egltestserver SurfaceScaling_Negative_CreateWindowSurface
+RUN_TEST_STEP 100 egltestserver SurfaceScaling_Negative_FixedSize_NonWindowSurface
+RUN_TEST_STEP 100 egltestserver SurfaceScalingDefaultBorderColor
+RUN_TEST_STEP 100 egltestserver SurfaceScalingModifyingBorderColor
+RUN_TEST_STEP 100 egltestserver SurfaceScalingModifyingBorderColorNonFixed
+RUN_TEST_STEP 100 egltestserver SurfaceScalingModifyingInvalidBorderColor
+RUN_TEST_STEP 100 egltestserver SurfaceScalingModifyingExtent
+RUN_TEST_STEP 100 egltestserver SurfaceScalingModifyingExtentNonFixed
+RUN_TEST_STEP 100 egltestserver SurfaceScalingQuerySurface
+RUN_TEST_STEP 100 egltestserver SurfaceScalingQuerySurfaceNonFixed
+RUN_TEST_STEP 100 egltestserver SurfaceScalingCapability
+RUN_TEST_STEP 100 egltestserver SurfaceScalingSet
+RUN_TEST_STEP 100 egltestserver SurfaceScalingSetNonFixed
+RUN_TEST_STEP 100 egltestserver SurfaceScalingSetInvalidAttributes
+RUN_TEST_STEP 100 egltestserver SurfaceScalingNotInitialized
+
+PRINT Complete egltest_t_surfacescaling
--- a/egl/egltest/src/egltest_image.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/egl/egltest/src/egltest_image.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-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"
@@ -146,6 +146,7 @@
 	address += (bitmapSize.iHeight - 1) * stride;
 	vgWritePixels(address, -stride, KDefaultSurfaceFormat,0,0, bitmapSize.iWidth, bitmapSize.iHeight);
 	ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
+	eglWaitClient();   // wait for writing to finish
    	ASSERT_EGL_TRUE(eglDestroySurface(iDisplay, surface));				//Destroying Surface handle
 
 	INFO_PRINTF1(_L("Create a EGLImage out of the SgImage"));
--- a/egl/egltest/src/egltest_image_multiprocess.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/egl/egltest/src/egltest_image_multiprocess.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -1468,6 +1468,7 @@
     	TInt stride = bitmap->DataStride();
     	address += (bitmapSize.iHeight - 1) * stride;
     	vgWritePixels(address, -stride, iSurfaceFormat, 0,0, bitmapSize.iWidth, bitmapSize.iHeight);
+   	    eglWaitClient();   // wait for writing to finish
 		delete bitmap;
 		bitmap = NULL;
 		ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/egl/egltest/src/egltest_surfacescaling.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,3103 @@
+// Copyright (c) 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:
+//
+
+/**
+ @file
+ @test
+*/
+
+#include "egltest_surfacescaling.h"
+
+#include <test/tefunit.h> // for ASSERT macros
+#include <test/egltestcommonutils.h>
+#include "egltestcommoninisettings.h"
+
+//We are restricted by the screen comparison utility that requires images to be EColor16MU
+const TDisplayMode KTestSourceDisplayMode = EColor16MU;
+
+CEglTest_SurfaceScalingBase::~CEglTest_SurfaceScalingBase()
+    {
+	CleanAll();
+	delete iImageComparison;
+	delete iScreenDevice;
+    CloseWindow();
+    CloseWsSession();
+    }
+
+TVerdict CEglTest_SurfaceScalingBase::doTestStepPreambleL()
+    {
+    TVerdict verdict = CEglTestStep::doTestStepPreambleL();
+
+    INFO_PRINTF1(_L("doTestStepPreambleL() - Initialise surface scaling test settings..."));
+    if(!CheckForExtensionL(KEGL_NOK_surface_scaling))
+        {
+		ERR_PRINTF1(_L("KEGL_NOK_surface_scaling not supported!"));
+        User::Leave(KErrNotSupported);
+        }
+    //retrieve the pointers to the EGL surface scaling extension functions 
+    iPfnEglQuerySurfaceScalingCapabilityNOK = reinterpret_cast <TFPtrEglQuerySurfaceScalingCapabilityNok> (eglGetProcAddress("eglQuerySurfaceScalingCapabilityNOK"));
+    iPfnEglSetSurfaceScalingNOK = reinterpret_cast <TFPtrEglSetSurfaceScalingNok> (eglGetProcAddress("eglSetSurfaceScalingNOK"));
+	if(!iPfnEglQuerySurfaceScalingCapabilityNOK)
+		{
+		ERR_PRINTF1(_L("   Cannot retrieve address of the \"eglQuerySurfaceScalingCapabilityNOK\" function"));
+        User::Leave(KErrNotSupported);
+		}
+	if(!iPfnEglSetSurfaceScalingNOK)
+		{
+		ERR_PRINTF1(_L("   Cannot retrieve address of the \"eglSetSurfaceScalingNOK\" function"));
+        User::Leave(KErrNotSupported);
+		}
+
+    //retrieve surface scaling ini settings
+	CIniData* iniData = CIniData::NewL(KConfigFileName);
+    CleanupStack::PushL(iniData);
+    
+    _LIT(KSectionSurfaceScaling, "SurfaceScaling");
+    _LIT(KKeyAllScalable, "AllScalable"); 
+    
+    TPtrC scalable;
+	if(!iniData->FindVar(KSectionSurfaceScaling,KKeyAllScalable,scalable))
+        {
+		ERR_PRINTF3(_L("   Cannot retrieve section:%S key:%S"), &KSectionSurfaceScaling, &KKeyAllScalable);
+		User::Leave(KErrNotSupported);
+        }
+	iAllScalable = (scalable.FindF( _L("true"))==KErrNotFound)? EFalse : ETrue;
+	INFO_PRINTF1(_L("  ************************************************************************"));
+	INFO_PRINTF1(_L("  ****   The test will be run in following configuration: "));
+	INFO_PRINTF2(_L("  ****   All window surfaces scalable: %S"), &scalable);
+	INFO_PRINTF1(_L("  ************************************************************************"));
+	CleanupStack::PopAndDestroy(iniData);
+
+    //Initiate a window server session and create a window group
+    OpenWsSessionL(KDefaultWindowGroupId);
+
+    //Create a Screen Device
+    const TInt screen0 = 0;
+    iScreenDevice = new(ELeave) CWsScreenDevice(iWsSession);
+    User::LeaveIfError(iScreenDevice->Construct(screen0));
+    
+    // get full screen size
+    TPixelsAndRotation sizeAndRotation;
+    iScreenDevice->GetDefaultScreenSizeAndRotation(sizeAndRotation);
+    iScreenSize = sizeAndRotation.iPixelSize;
+    		
+	//Create the image comparison tool from the screen device as required by most tests 		
+    iImageComparison = CTGraphicsScreenComparison::NewL(*iScreenDevice);
+
+    return verdict;
+    }
+
+TVerdict CEglTest_SurfaceScalingBase::doTestStepPostambleL()
+    {
+	INFO_PRINTF1(_L("doTestStepPostambleL() - Cleaning up"));
+	
+	// cleanup egltest framework stuff
+	CleanAll();
+
+	// cleanup member variables
+	delete iImageComparison;
+	iImageComparison = NULL;
+	delete iScreenDevice;
+	iScreenDevice = NULL;
+	
+	// close window and wserver session
+    CloseWindow();
+    CloseWsSession();
+
+    return CEglTestStep::doTestStepPostambleL();
+    }
+
+void CEglTest_SurfaceScalingBase::CreateAndActivateWindowL(const TSize& aWindowSize)
+    {
+    ConstructWindowL(iWindow, aWindowSize);
+    }
+
+void CEglTest_SurfaceScalingBase::CloseWindow()
+    {
+	iWindow.Close();
+    }
+
+//check if border color matches with expected values
+void CEglTest_SurfaceScalingBase::CheckBorderColorL(EGLint aExpectedRedChannelColor, EGLint aExpectedBlueChannelColor, EGLint aExpectedGreenChannelColor)
+    {
+    EGLint value = 0xffff; //set color channel to some arbitrary number 
+    ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, &value));
+    ASSERT_EQUALS(value, aExpectedRedChannelColor);
+
+    value = 0xffff; //set color channel to some arbitrary number
+    ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, &value));
+    ASSERT_EQUALS(value, aExpectedGreenChannelColor);
+
+    value = 0xffff; //set color channel to some arbitrary number
+    ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, &value));
+    ASSERT_EQUALS(value, aExpectedBlueChannelColor);
+    }
+
+//check if scaling attributes match with expected values
+void CEglTest_SurfaceScalingBase::CheckScalingAttributesL(EGLint aExpectedSurfaceWidth, EGLint aExpectedSurfaceHeight, EGLint aExpectedExtentWidth, EGLint aExpectedExtentHeight, EGLint aExpectedOffsetX, EGLint aExpectedOffsetY)
+    {
+    EGLint value = 0xffff; //set initial value to some arbitrary number 
+    ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_WIDTH, &value));
+    ASSERT_EQUALS(value, aExpectedSurfaceWidth);
+    
+    value = 0xffff; //set initial value to some arbitrary number 
+    ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_HEIGHT, &value));
+    ASSERT_EQUALS(value, aExpectedSurfaceHeight);
+    
+    value = 0xffff; //set initial value to some arbitrary number 
+    ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_WIDTH_NOK, &value));
+    ASSERT_EQUALS(value, aExpectedExtentWidth);
+
+    value = 0xffff; //set initial value to some arbitrary number 
+    ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_HEIGHT_NOK, &value));
+    ASSERT_EQUALS(value, aExpectedExtentHeight);
+   
+    value = 0xffff; //set initial value to some arbitrary number 
+    ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_X_NOK, &value));
+    ASSERT_EQUALS(value, aExpectedOffsetX);
+   
+    value = 0xffff; //set initial value to some arbitrary number 
+    ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_Y_NOK, &value));
+    ASSERT_EQUALS(value, aExpectedOffsetY);
+    }
+
+/*
+ Simple create bitmap function to initialise a rectangular bitmap in four simple colours plus borders
+     ---------------------------
+    ¦         borderTop         ¦
+    ¦     -----------------     ¦
+    ¦ b. ¦        ¦        ¦ b. ¦
+    ¦    ¦    1   ¦   2    ¦    ¦
+    ¦ L  ¦        ¦        ¦ R  ¦
+    ¦ e  ¦--------¦--------¦ i  ¦
+    ¦ f  ¦        ¦        ¦ g  ¦
+    ¦ t  ¦    3   ¦   4    ¦ h  ¦
+    ¦    ¦        ¦        ¦ t  ¦
+    ¦     -----------------     ¦
+    ¦       borderBottom        ¦
+     --------------------------- 
+*/
+CFbsBitmap* CEglTest_SurfaceScalingBase::CreateBitmapLC(const TSize& aSize, TInt aBorderTop, TInt aBorderBottom, TInt aBorderLeft, TInt aBorderRight, const TRgb& aBorderColor)
+    {
+    // create the bitmap to the requested size (DisplayMode set to default value)
+    CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
+    CleanupStack::PushL(bitmap);
+    User::LeaveIfError(bitmap->Create(aSize,KTestSourceDisplayMode));
+    TEST(bitmap->SizeInPixels().iHeight == aSize.iHeight);
+    TEST(bitmap->SizeInPixels().iWidth == aSize.iWidth);
+
+    //Create a device and context for the purpose of generating the bitmap which will be the
+    //master reference used in the test
+    CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmap);
+    CleanupStack::PushL(bitmapDevice);
+    CFbsBitGc* bitmapGc = CFbsBitGc::NewL();
+    CleanupStack::PushL(bitmapGc);
+    bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
+    bitmapGc->Activate(bitmapDevice);
+
+    // First off, set the whole bitmap to the border colour
+    bitmapGc->SetBrushColor(aBorderColor);
+    bitmapGc->SetPenColor(aBorderColor);
+    bitmapGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
+    bitmapGc->DrawRect(aSize);
+    
+    // Set each individual quadrant to a different arbitrary colour
+    const TInt height = aSize.iHeight;
+    const TInt width  = aSize.iWidth;
+    const TInt quadrantHeight = (height - aBorderTop - aBorderBottom) / 2;
+    const TInt quadrantWidth = (width - aBorderLeft - aBorderRight) / 2;
+
+    // quadrant 1 - Colour KRgbMagenta
+    TRect rect = TRect(TPoint(aBorderLeft, aBorderTop), TSize(quadrantWidth, quadrantHeight));
+    bitmapGc->SetBrushColor(KRgbMagenta);
+    bitmapGc->SetPenColor(KRgbMagenta);
+    bitmapGc->DrawRect(rect);
+
+    // quadrant 2 - Colour KRgbCyan
+    rect = TRect(TPoint(aBorderLeft+quadrantWidth, aBorderTop), TSize(quadrantWidth, quadrantHeight));
+    bitmapGc->SetBrushColor(KRgbCyan);
+    bitmapGc->SetPenColor(KRgbCyan);
+    bitmapGc->DrawRect(rect);
+
+    // quadrant 3 - Colour KRgbYellow
+    rect = TRect(TPoint(aBorderLeft, aBorderTop+quadrantHeight), TSize(quadrantWidth, quadrantHeight));
+    bitmapGc->SetBrushColor(KRgbYellow);
+    bitmapGc->SetPenColor(KRgbYellow);
+    bitmapGc->DrawRect(rect);
+
+    // quadrant 4 - Colour KRgbDarkGreen
+    rect = TRect(TPoint(aBorderLeft+quadrantWidth, aBorderTop+quadrantHeight), TSize(quadrantWidth, quadrantHeight));
+    bitmapGc->SetBrushColor(KRgbDarkGreen);
+    bitmapGc->SetPenColor(KRgbDarkGreen);
+    bitmapGc->DrawRect(rect);
+
+    //clean-up
+    CleanupStack::PopAndDestroy(2, bitmapDevice);
+    return bitmap;
+    }
+
+void CEglTest_SurfaceScalingBase::WritePixelsToSurfaceL(const CFbsBitmap& aBitmap)
+	{
+    // Mind the fact that CFbsBitmap and VGImages use different coordinates origin
+    const TSize bitmapSize = aBitmap.SizeInPixels();
+    TUint8* address = reinterpret_cast<TUint8*>(aBitmap.DataAddress());
+    const TInt stride = aBitmap.DataStride();
+    address += (bitmapSize.iHeight - 1) * stride;
+    
+    // copy pixel data to the drawing surface
+    vgWritePixels(address, -stride, KDefaultSurfaceFormat,0,0, bitmapSize.iWidth, bitmapSize.iHeight);
+    ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
+    
+    // force all outstanding requests on the current context to complete
+    vgFinish();
+    iWsSession.Finish();
+	}
+
+/**
+@SYMTestCaseID GRAPHICS-EGL-0651
+
+@SYMTestPriority 1
+
+@SYMPREQ 2676
+
+@SYMREQ 417-56592
+
+@SYMTestCaseDesc
+Choose a suitable extent to test that specified border colours are correct.
+
+@SYMTestActions
+For a number of different situations, do the following:
+1. Create a window of known size
+2. Create a fixed size surface, filled in with a predefined bitmap
+3. Draw the surface onto the window for a set extent and border colour
+4. Compare window content and border against a reference bitmap containing expected values. 
+
+@SYMTestExpectedResults
+The window content matches the independently created reference bitmap in each situation
+*/
+TVerdict CEglTest_SurfaceScaling_Positive::doTestStepL()
+    {
+    SetTestStepID(_L("GRAPHICS-EGL-0651"));
+    SetTestStepName(_L("GRAPHICS-EGL-0651"));
+    INFO_PRINTF1(_L("CEglTest_SurfaceScaling_Positive::doTestStepL started...."));
+
+    // Create display object
+    GetDisplayL();
+    CreateEglSessionL();    // initialise EGL Session so we can make use of its helper objects
+    iEglSess->InitializeL();
+    
+    //  NOTE: Borders depend on what you set as extent, offset, window and surface
+    //        Care should be taken when choosing size values, better to use even numbers
+	//		  (CreateBitmap splits rectangle in four, so we don't want a pixel mismatch there) 
+    for (TInt index=1; index<=17; index++)
+    	{
+		// Set some default values which are used in most cases
+		iWindowWidth = iWindowHeight = 200;
+		iBorderColor = TRgb(0,0,0);
+	    iBorderTop = iBorderBottom = iBorderLeft = iBorderRight = 0;
+
+	    switch(index)
+        {
+		case 1:
+			// surface scaled to same window size with no border
+		    iSurfaceWidth = 100; iSurfaceHeight = 50;
+		    iExtentWidth = 200; iExtentHeight = 200;
+		    iOffsetX = 0; iOffsetY = 0;
+			break;
+		case 2:
+			// surface scaled to half the window size with border top 
+		    iSurfaceWidth = 100; iSurfaceHeight = 50;
+		    iExtentWidth = 200; iExtentHeight = 100;
+		    iOffsetX = 0; iOffsetY = 100;
+		    iBorderColor = TRgb(0,0,0);         // arbitrary border colour
+		    iBorderTop = 100;
+			break;
+		case 3:
+			// surface scaled to half the window size with border bottom
+		    iSurfaceWidth = 100; iSurfaceHeight = 50;
+		    iExtentWidth = 200; iExtentHeight = 100;
+		    iOffsetX = 0; iOffsetY = 0;
+		    iBorderColor = TRgb(128,0,255);     // arbitrary border colour
+		    iBorderBottom = 100;
+			break;
+		case 4:
+			// surface scaled to half the window size with border top and bottom
+		    iSurfaceWidth = 100; iSurfaceHeight = 50;
+		    iExtentWidth = 200; iExtentHeight = 100;
+		    iOffsetX = 0; iOffsetY = 50;
+		    iBorderColor = TRgb(128,0,0);         // arbitrary border colour
+		    iBorderTop = 50; iBorderBottom = 50;
+			break;
+		case 5:
+			// surface scaled to half the window size with border left
+		    iSurfaceWidth = 100; iSurfaceHeight = 50;
+		    iExtentWidth = 100; iExtentHeight = 200;
+		    iOffsetX = 100; iOffsetY = 0;
+		    iBorderColor = TRgb(96,96,96);         // arbitrary border colour
+		    iBorderLeft = 100;
+			break;
+		case 6:
+			// surface scaled to half the window size with border right
+		    iSurfaceWidth = 100; iSurfaceHeight = 50;
+		    iExtentWidth = 100; iExtentHeight = 200;
+		    iOffsetX = 0; iOffsetY = 0;
+		    iBorderColor = TRgb(192,192,192);       // arbitrary border colour
+		    iBorderRight = 100;
+			break;
+		case 7:
+			// surface scaled to half the window size with border left and right
+		    iSurfaceWidth = 100; iSurfaceHeight = 50;
+		    iExtentWidth = 100; iExtentHeight = 200;
+		    iOffsetX = 50; iOffsetY = 0;
+		    iBorderColor = TRgb(0,0,0);				// arbitrary border colour
+		    iBorderLeft = 50; iBorderRight = 50;
+			break;
+		case 8:
+			// surface scaled in different proportions in width and height, with borders 
+		    iSurfaceWidth = 100; iSurfaceHeight = 50;
+		    iExtentWidth = 190; iExtentHeight = 10;
+		    iOffsetX = 5; iOffsetY = 95;
+		    iBorderColor = TRgb(240,240,240);       // arbitrary border colour
+		    iBorderTop = 95; iBorderBottom = 95; iBorderLeft = 5; iBorderRight = 5;
+			break;
+		case 9:
+			// surface scaled to double the window height size, surface cropped with no borders
+		    iSurfaceWidth = 100; iSurfaceHeight = 50;
+		    iExtentWidth = 400; iExtentHeight = 200;
+		    iOffsetX = 0; iOffsetY = 0;
+			break;
+		case 10:
+			// surface scaled to double the window width and height size, surface cropped with no borders
+		    iSurfaceWidth = 100; iSurfaceHeight = 50;
+		    iExtentWidth = 400; iExtentHeight = 400;
+		    iOffsetX = 0; iOffsetY = 0;
+			break;
+		case 11:
+			// surface scaled to double the window width and height size, surface cropped with borders top and left
+		    iSurfaceWidth = 100; iSurfaceHeight = 50;
+		    iExtentWidth = 400; iExtentHeight = 400;
+		    iOffsetX = 100; iOffsetY = 100;
+		    iBorderColor = TRgb(255,128,255);      // arbitrary border colour
+		    iBorderTop = 100; iBorderLeft = 100;
+			break;
+		case 12:
+			// QnHD to full screen size
+			iWindowWidth = iScreenSize.iWidth; iWindowHeight = iScreenSize.iHeight;
+		    iSurfaceWidth = 320; iSurfaceHeight = 180;
+		    iExtentWidth = iWindowWidth; iExtentHeight = iWindowHeight;
+		    iOffsetX = 0; iOffsetY = 0;
+			break;
+		case 13:
+			// QVGA to full screen size
+			iWindowWidth = iScreenSize.iWidth; iWindowHeight = iScreenSize.iHeight;
+		    iSurfaceWidth = 320; iSurfaceHeight = 240;
+		    iExtentWidth = iWindowWidth; iExtentHeight = iWindowHeight;
+		    iOffsetX = 0; iOffsetY = 0;
+			break;
+		case 14:
+			// HVGA to full screen size
+			iWindowWidth = iScreenSize.iWidth; iWindowHeight = iScreenSize.iHeight;
+		    iSurfaceWidth = 480; iSurfaceHeight = 320;
+		    iExtentWidth = iWindowWidth; iExtentHeight = iWindowHeight;
+		    iOffsetX = 0; iOffsetY = 0;
+			break;
+		case 15:
+			// 480x270 to full screen size
+			iWindowWidth = iScreenSize.iWidth; iWindowHeight = iScreenSize.iHeight;
+		    iSurfaceWidth = 480; iSurfaceHeight = 270;
+		    iExtentWidth = iWindowWidth; iExtentHeight = iWindowHeight;
+		    iOffsetX = 0; iOffsetY = 0;
+			break;
+		case 16:
+			// VGA to full screen size
+			iWindowWidth = iScreenSize.iWidth; iWindowHeight = iScreenSize.iHeight;
+		    iSurfaceWidth = 640; iSurfaceHeight = 480;
+		    iExtentWidth = iWindowWidth; iExtentHeight = iWindowHeight;
+		    iOffsetX = 0; iOffsetY = 0;
+			break;
+		case 17:
+			// WVGA to full screen size
+			iWindowWidth = iScreenSize.iWidth; iWindowHeight = iScreenSize.iHeight;
+		    iSurfaceWidth = 768; iSurfaceHeight = 480;
+		    iExtentWidth = iWindowWidth; iExtentHeight = iWindowHeight;
+		    iOffsetX = 0; iOffsetY = 0;
+			break;
+		default:
+		    ERR_PRINTF2(_L("Inconsistency in test code, case does not exist: %d."), index);
+		    User::Leave(KErrNotSupported);
+		    break;
+        }
+
+		// perform the testing
+	    doTestPartialStepL();
+    	}
+
+    // clean-up
+    CleanAll();
+
+    INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_Positive::doTestStepL completed!"));
+    RecordTestResultL();
+    CloseTMSGraphicsStep();
+    return TestStepResult();
+    }
+
+TVerdict CEglTest_SurfaceScaling_Positive::doTestPartialStepL()
+    {
+    INFO_PRINTF5(_L("doTestPartialStepL started with (%d,%d) fixed surface scaled to (%d,%d) extent...."), iSurfaceWidth, iSurfaceHeight, iExtentWidth, iExtentHeight);
+
+    // Establish the connection to the window server and create
+    // a WindowGroup and a Window object
+    CreateAndActivateWindowL(TSize(iWindowWidth, iWindowHeight));
+
+    // Choose EGL config
+    EGLConfig matchingConfigs[1];
+    EGLint numConfigs = 0;
+
+    ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
+    TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported
+
+    EGLint attrib_list[] = {
+              EGL_FIXED_WIDTH_NOK, iSurfaceWidth,
+              EGL_FIXED_HEIGHT_NOK, iSurfaceHeight,
+              EGL_TARGET_EXTENT_OFFSET_X_NOK, iOffsetX,
+              EGL_TARGET_EXTENT_OFFSET_Y_NOK, iOffsetY,
+              EGL_TARGET_EXTENT_WIDTH_NOK, iExtentWidth,
+              EGL_TARGET_EXTENT_HEIGHT_NOK, iExtentHeight,
+              EGL_BORDER_COLOR_RED_NOK, iBorderColor.Red(),
+              EGL_BORDER_COLOR_GREEN_NOK, iBorderColor.Green(),
+              EGL_BORDER_COLOR_BLUE_NOK, iBorderColor.Blue(),
+              EGL_NONE};
+    
+    // Create the window surface and the egl context and make them current
+    iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);    
+
+    // Create the test bitmap that will be used in the scaled surface 
+    //  NOTE: This bitmap generally does not have borders, 
+    CFbsBitmap* testBitmap = CreateBitmapLC(TSize(iSurfaceWidth, iSurfaceHeight),0,0,0,0,TRgb(0,0,0));
+    
+    // Copy test bitmap to drawing surface
+    WritePixelsToSurfaceL(*testBitmap);
+
+    //call eglSwapBuffers
+    ASSERT_EGL_TRUE(eglSwapBuffers(iDisplay, iEglSess->Surface()));
+    //Wait for the draw operation to complete
+    eglWaitClient();
+
+    // Create the reference bitmap that should be expected after the scaling 
+    //  NOTE: This bitmap may have borders
+    //        Size could exceed that of the window, so check both extent and window
+    const TInt refWidth = iExtentWidth>iWindowWidth ? iExtentWidth : iWindowWidth;
+    const TInt refHeight = iExtentHeight>iWindowHeight ? iExtentHeight : iWindowHeight;
+    CFbsBitmap* refBitmap = CreateBitmapLC(TSize(refWidth, refHeight), iBorderTop, iBorderBottom, iBorderLeft, iBorderRight, iBorderColor);
+
+    // compare window contents with expected bitmap
+    TInt comparison = iImageComparison->CompareScreenImageL(TSize(iWindowWidth, iWindowHeight), TPoint(0,0), TPoint(0,0), *refBitmap, TestStepName());
+    TEST(comparison==KErrNone);
+    INFO_PRINTF3(_L("CompareScreenImageL returns %d (expected is %d)"), comparison, KErrNone);
+
+    /// Cleanup
+    CleanupStack::PopAndDestroy(2, testBitmap); // refBitmap, testBitmap
+    iEglSess->CleanupSurfaceAndContextL();
+    CloseWindow();
+    
+    INFO_PRINTF1(_L("....doTestPartialStepL completed!"));
+    return TestStepResult();
+    }
+
+/**
+@SYMTestCaseID GRAPHICS-EGL-0661
+
+@SYMTestPriority 1
+
+@SYMPREQ 2676
+
+@SYMREQ 417-56592
+
+@SYMTestCaseDesc
+Resize native window to verify target extent remains fixed.
+
+@SYMTestActions
+1. Create a window of known size
+2. Create a fixed size surface, filled in with a predefined bitmap
+3. Draw the surface onto the window for a set extent and border colour
+4. Repeat step 3 but increasing native window size by (1,1) pixels.
+5. Compare window content and border against a reference bitmap containing expected values. 
+
+@SYMTestExpectedResults
+The window content matches the independently created reference bitmap in each situation
+*/
+TVerdict CEglTest_SurfaceScaling_WindowResize::doTestStepL()
+    {
+    SetTestStepID(_L("GRAPHICS-EGL-0661"));
+    SetTestStepName(_L("GRAPHICS-EGL-0661"));
+    INFO_PRINTF1(_L("CEglTest_SurfaceScaling_WindowResize::doTestStepL started...."));
+
+    // set the initial value of a square window
+    const TInt KWindowSize = 100;
+    
+    // surface with size and extent that matches the window size and no offset
+    iWindowWidth = iWindowHeight = KWindowSize;
+    iSurfaceWidth = iSurfaceHeight = KWindowSize;
+    iExtentWidth = iExtentHeight = KWindowSize;
+    iOffsetX = 0; iOffsetY = 0;
+    iBorderColor = TRgb(0x99,0xcc,0xff);	// set some arbitrary colour
+    iBorderTop = 0; iBorderBottom = 0; iBorderLeft = 0; iBorderRight = 0;
+
+    // Establish the connection to the window server and create
+    // a WindowGroup and a Window object
+    CreateAndActivateWindowL(TSize(iWindowWidth, iWindowHeight));
+
+    // Create display object
+    GetDisplayL();
+    CreateEglSessionL();    // initialise EGL Session so we can make use of its helper objects
+    iEglSess->InitializeL();
+
+    // Choose EGL config
+    EGLConfig matchingConfigs[1];
+    EGLint numConfigs = 0;
+
+    ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
+    TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported
+
+    EGLint attrib_list[] = {
+              EGL_FIXED_WIDTH_NOK, iSurfaceWidth,
+              EGL_FIXED_HEIGHT_NOK, iSurfaceHeight,
+              EGL_TARGET_EXTENT_OFFSET_X_NOK, iOffsetX,
+              EGL_TARGET_EXTENT_OFFSET_Y_NOK, iOffsetY,
+              EGL_TARGET_EXTENT_WIDTH_NOK, iExtentWidth,
+              EGL_TARGET_EXTENT_HEIGHT_NOK, iExtentHeight,
+              EGL_BORDER_COLOR_RED_NOK, iBorderColor.Red(),
+              EGL_BORDER_COLOR_GREEN_NOK, iBorderColor.Green(),
+              EGL_BORDER_COLOR_BLUE_NOK, iBorderColor.Blue(),
+              EGL_NONE};
+    
+    // Create the window surface and the egl context and make them current
+    iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);    
+    
+    // Create the test bitmap that will be used in the scaled surface 
+    //  NOTE: This bitmap generally does not have borders, 
+    CFbsBitmap* testBitmap = CreateBitmapLC(TSize(iSurfaceWidth, iSurfaceHeight),0,0,0,0,TRgb(0,0,0));
+    
+    // Copy test bitmap to drawing surface
+    WritePixelsToSurfaceL(*testBitmap);
+
+    // Start doing iterations by increasing native window size.
+    INFO_PRINTF1(_L("Start increasing native window size by (1,1)..."));
+    iWindowWidth=1;
+    iWindowHeight=1;
+    while(iWindowWidth<=(KWindowSize*2) && iWindowHeight<=(KWindowSize*2))
+    	{
+		// Note that borders will appear while window size is bigger than extent
+		//  - iSurfaceWidth/iSurfaceHeight - unmodified
+		//  - iExtentWidth/iExtentHeight - unmodified
+		//  - iOffsetX/iOffsetY - unmodified 
+		// Set up expected values for the border
+		iBorderTop = 0; iBorderLeft = 0; 
+		iBorderBottom = iExtentHeight<iWindowHeight ? iWindowHeight-iExtentHeight : 0; 
+		iBorderRight = iExtentWidth<iWindowWidth ? iWindowWidth-iExtentWidth : 0; 
+
+		// resize window to new given size
+	    iWindow.Invalidate();
+		iWindow.BeginRedraw();
+		iWindow.SetSize(TSize(iWindowWidth, iWindowHeight));
+		iWindow.EndRedraw();
+
+		// re-populate buffers with the unmodified fixed size surface content
+	    WritePixelsToSurfaceL(*testBitmap);
+		
+		// perform the testing
+		doTestPartialStepL();
+		++iWindowWidth;
+		++iWindowHeight;
+    	}
+
+    /// Cleanup
+    CleanupStack::PopAndDestroy(testBitmap);
+    iEglSess->CleanupSurfaceAndContextL();
+    CleanAll();
+    CloseWindow();
+    
+    INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_WindowResize::doTestStepL completed!"));
+    RecordTestResultL();
+    CloseTMSGraphicsStep();
+    return TestStepResult();
+    }
+
+TVerdict CEglTest_SurfaceScaling_WindowResize::doTestPartialStepL()
+    {
+    INFO_PRINTF3(_L("doTestPartialStepL started for native window size of (%d, %d)...."), iWindowWidth, iWindowHeight);
+
+	// resize may be effective only after swapbuffers 
+	ASSERT_EGL_TRUE(eglSwapBuffers(iDisplay, iEglSess->Surface()));
+	ASSERT_EGL_TRUE(eglWaitClient());
+	
+	//check all expected values
+    CheckScalingAttributesL(iSurfaceWidth, iSurfaceHeight, iExtentWidth, iExtentHeight, iOffsetX, iOffsetY); 
+    CheckBorderColorL(iBorderColor.Red(), iBorderColor.Blue(), iBorderColor.Green()); 
+
+    // Create the reference bitmap that should be expected after the window resize 
+    //  NOTE: This bitmap may have borders
+    //        Size could exceed that of the window, so check both extent and window
+    const TInt refWidth = iExtentWidth>iWindowWidth ? iExtentWidth : iWindowWidth;
+    const TInt refHeight = iExtentHeight>iWindowHeight ? iExtentHeight : iWindowHeight;
+    CFbsBitmap* refBitmap = CreateBitmapLC(TSize(refWidth, refHeight), iBorderTop, iBorderBottom, iBorderLeft, iBorderRight, iBorderColor);
+    
+    // compare window contents with expected bitmap
+    TInt comparison = iImageComparison->CompareScreenImageL(TSize(iWindowWidth, iWindowHeight), TPoint(0,0), TPoint(0,0), *refBitmap, TestStepName());
+    TEST(comparison==KErrNone);
+    INFO_PRINTF3(_L("CompareScreenImageL returns %d (expected is %d)"), comparison, KErrNone);
+
+    /// Cleanup
+    CleanupStack::PopAndDestroy(refBitmap);
+
+    return TestStepResult();
+    }
+
+/**
+@SYMTestCaseID GRAPHICS-EGL-0668
+
+@SYMTestPriority 1
+
+@SYMPREQ 2676
+
+@SYMREQ 417-56592
+
+@SYMTestCaseDesc
+Create a fixed size surface and vary the extent position for a range of values.
+
+@SYMTestActions
+1. Create a window of known size
+2. Create a fixed size surface, filled in with a predefined bitmap
+3. Draw the surface onto the window for a set extent and border colour
+4. Repeat step 3 but increasing target extent offset by (1,1) pixels.
+5. Compare window content and border against a reference bitmap containing expected values. 
+
+@SYMTestExpectedResults
+The window content matches the independently created reference bitmap in each situation
+*/
+TVerdict CEglTest_SurfaceScaling_ExtentPositionChange::doTestStepL()
+    {
+    SetTestStepID(_L("GRAPHICS-EGL-0668"));
+    SetTestStepName(_L("GRAPHICS-EGL-0668"));
+    INFO_PRINTF1(_L("CEglTest_SurfaceScaling_ExtentPositionChange::doTestStepL started...."));
+
+    // surface with size and extent that matches the window size and no offset
+    iWindowWidth = iWindowHeight = 100;
+    iSurfaceWidth = iExtentWidth = iWindowWidth;
+    iSurfaceHeight = iExtentHeight = iWindowHeight;
+    iOffsetX = 0; iOffsetY = 0;
+    iBorderColor = TRgb(0x11,0x22,0x33);	// set some arbitrary colour
+    iBorderTop = 0; iBorderBottom = 0; iBorderLeft = 0; iBorderRight = 0;
+
+    // Establish the connection to the window server and create
+    // a WindowGroup and a Window object
+    CreateAndActivateWindowL(TSize(iWindowWidth, iWindowHeight));
+
+    // Create display object
+    GetDisplayL();
+    CreateEglSessionL();    // initialise EGL Session so we can make use of its helper objects
+    iEglSess->InitializeL();
+
+    // Choose EGL config
+    EGLConfig matchingConfigs[1];
+    EGLint numConfigs = 0;
+
+    ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
+    TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported
+
+    EGLint attrib_list[] = {
+              EGL_FIXED_WIDTH_NOK, iSurfaceWidth,
+              EGL_FIXED_HEIGHT_NOK, iSurfaceHeight,
+              EGL_TARGET_EXTENT_OFFSET_X_NOK, iOffsetX,
+              EGL_TARGET_EXTENT_OFFSET_Y_NOK, iOffsetY,
+              EGL_TARGET_EXTENT_WIDTH_NOK, iExtentWidth,
+              EGL_TARGET_EXTENT_HEIGHT_NOK, iExtentHeight,
+              EGL_BORDER_COLOR_RED_NOK, iBorderColor.Red(),
+              EGL_BORDER_COLOR_GREEN_NOK, iBorderColor.Green(),
+              EGL_BORDER_COLOR_BLUE_NOK, iBorderColor.Blue(),
+              EGL_NONE};
+    
+    // Create the window surface and the egl context and make them current
+    iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);    
+    
+    // Create the test bitmap that will be used in the scaled surface 
+    //  NOTE: This bitmap generally does not have borders, 
+    CFbsBitmap* testBitmap = CreateBitmapLC(TSize(iSurfaceWidth, iSurfaceHeight),0,0,0,0,TRgb(0,0,0));
+    
+    // Copy test bitmap to drawing surface
+    WritePixelsToSurfaceL(*testBitmap);
+
+	// This test is a bit different. Since the extent remains the same, and we only change
+    //  the offset, we create an oversized reference bitmap and compare the screen with a
+    //  region contained within the reference bitmap 
+    // Size is three times the extent so that it has extent size borders all around
+    const TInt refWidth = 3*iExtentWidth;
+    const TInt refHeight = 3*iExtentHeight;
+    iBorderTop=iBorderBottom=iBorderLeft=iBorderRight=iExtentWidth;	
+    CFbsBitmap* refBitmap = CreateBitmapLC(TSize(refWidth, refHeight), iBorderTop, iBorderBottom, iBorderLeft, iBorderRight, iBorderColor);
+
+    // Start doing iterations by increasing target extent offset
+    INFO_PRINTF1(_L("Start increasing target extent offset size by (1,1)..."));
+    for (iOffsetX=-iExtentWidth,iOffsetY=-iExtentHeight; iOffsetX<=iExtentWidth&&iOffsetY<=iExtentHeight; ++iOffsetX,++iOffsetY)
+    	{
+		// Note that borders will appear other than when offset is (0,0)
+		//  - iSurfaceWidth/iSurfaceHeight - unmodified
+		//  - iExtentWidth/iExtentHeight - unmodified
+	
+	    // set new offset values
+	    ASSERT_EGL_TRUE(iPfnEglSetSurfaceScalingNOK(iDisplay, iEglSess->Surface(), iOffsetX, iOffsetY, iExtentWidth, iExtentHeight));
+
+		// re-populate buffers with the unmodified fixed size surface content
+	    WritePixelsToSurfaceL(*testBitmap);
+
+		// perform the testing
+		doTestPartialStepL(*refBitmap);
+    	}
+    
+    /// Cleanup
+    CleanupStack::PopAndDestroy(2, testBitmap); //testBitmap, refBitmap
+    iEglSess->CleanupSurfaceAndContextL();
+    CleanAll();
+    CloseWindow();
+    
+    INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_ExtentPositionChange::doTestStepL completed!"));
+    RecordTestResultL();
+    CloseTMSGraphicsStep();
+    return TestStepResult();
+    }
+
+TVerdict CEglTest_SurfaceScaling_ExtentPositionChange::doTestPartialStepL(const CFbsBitmap& aRefBitmap)
+    {
+    INFO_PRINTF3(_L("doTestPartialStepL started for offset of (%d, %d)...."), iOffsetX, iOffsetY);
+
+    // offset change may be effective only after swapbuffers 
+	ASSERT_EGL_TRUE(eglSwapBuffers(iDisplay, iEglSess->Surface()));
+	ASSERT_EGL_TRUE(eglWaitClient());
+	// Finish() to ensure all native window operations related to the surface complete before image comparision.
+	iWsSession.Finish();
+	
+	//check all expected values
+    CheckScalingAttributesL(iSurfaceWidth, iSurfaceHeight, iExtentWidth, iExtentHeight, iOffsetX, iOffsetY); 
+    CheckBorderColorL(iBorderColor.Red(), iBorderColor.Blue(), iBorderColor.Green()); 
+
+    // Prepare the offset of the reference bitmap to know what sub-region should be compared
+    const TInt refWidth = 3*iExtentWidth;
+    const TInt refHeight = 3*iExtentHeight;
+    TPoint bitmapOffset(refWidth-iExtentWidth-iRefBitmapOffset, refHeight-iExtentHeight-iRefBitmapOffset);
+    iRefBitmapOffset++;		// increase offset for next iteration
+    
+    // Comparision takes into account specific region within the reference bitmap
+    TInt comparison = iImageComparison->CompareScreenImageL(TSize(iWindowWidth, iWindowHeight), TPoint(0,0), bitmapOffset, aRefBitmap, TestStepName());
+    TEST(comparison==KErrNone);
+    INFO_PRINTF3(_L("CompareScreenImageL returns %d (expected is %d)"), comparison, KErrNone);
+
+    return TestStepResult();
+    }
+
+/**
+@SYMTestCaseID GRAPHICS-EGL-0669
+
+@SYMTestPriority 1
+
+@SYMPREQ 2676
+
+@SYMREQ 417-56592
+
+@SYMTestCaseDesc
+Create a fixed size surface and vary the extent size for a range of values
+
+@SYMTestActions
+1. Create a window of known size
+2. Create a fixed size surface, filled in with a predefined bitmap
+3. Draw the surface onto the window for a set extent and border colour
+4. Repeat step 3 but increasing target extent size by (2,2) pixels.
+5. Compare window content and border against a reference bitmap containing expected values. 
+
+@SYMTestExpectedResults
+The window content matches the independently created reference bitmap in each situation
+*/
+TVerdict CEglTest_SurfaceScaling_ExtentSizeChange::doTestStepL()
+    {
+    SetTestStepID(_L("GRAPHICS-EGL-0669"));
+    SetTestStepName(_L("GRAPHICS-EGL-0669"));
+    INFO_PRINTF1(_L("CEglTest_SurfaceScaling_ExtentSizeChange::doTestStepL started...."));
+
+    // set the initial value of a square window
+    const TInt KWindowSize = 100;
+    
+    // surface with size and extent that matches the window size and no offset
+    iWindowWidth = iWindowHeight = KWindowSize;
+    iSurfaceWidth = iSurfaceHeight = KWindowSize;
+    iExtentWidth = iExtentHeight = KWindowSize; 	
+    iOffsetX = 0; iOffsetY = 0;
+    iBorderColor = TRgb(0x80,0x40,0xF0);	// set some arbitrary colour
+    iBorderTop = 0; iBorderBottom = 0; iBorderLeft = 0; iBorderRight = 0;
+
+    // Establish the connection to the window server and create
+    // a WindowGroup and a Window object
+    CreateAndActivateWindowL(TSize(iWindowWidth, iWindowHeight));
+
+    // Create display object
+    GetDisplayL();
+    CreateEglSessionL();    // initialise EGL Session so we can make use of its helper objects
+    iEglSess->InitializeL();
+
+    // Choose EGL config
+    EGLConfig matchingConfigs[1];
+    EGLint numConfigs = 0;
+
+    ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
+    TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported
+
+    EGLint attrib_list[] = {
+              EGL_FIXED_WIDTH_NOK, iSurfaceWidth,
+              EGL_FIXED_HEIGHT_NOK, iSurfaceHeight,
+              EGL_TARGET_EXTENT_OFFSET_X_NOK, iOffsetX,
+              EGL_TARGET_EXTENT_OFFSET_Y_NOK, iOffsetY,
+              EGL_TARGET_EXTENT_WIDTH_NOK, iExtentWidth,
+              EGL_TARGET_EXTENT_HEIGHT_NOK, iExtentHeight,
+              EGL_BORDER_COLOR_RED_NOK, iBorderColor.Red(),
+              EGL_BORDER_COLOR_GREEN_NOK, iBorderColor.Green(),
+              EGL_BORDER_COLOR_BLUE_NOK, iBorderColor.Blue(),
+              EGL_NONE};
+    
+    // Create the window surface and the egl context and make them current
+    iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);    
+    
+    // Create the test bitmap that will be used in the scaled surface 
+    //  NOTE: This bitmap generally does not have borders, 
+    CFbsBitmap* testBitmap = CreateBitmapLC(TSize(iSurfaceWidth, iSurfaceHeight),0,0,0,0,TRgb(0,0,0));
+    
+    // Copy test bitmap to drawing surface
+    WritePixelsToSurfaceL(*testBitmap);
+
+    // Start doing iterations by increasing target extent size 
+    //  We do increments of (2,2) because the reference bitmap is simetrically split into 4 areas, so size
+    //  of this reference bitmap should be an even number of pixels
+    INFO_PRINTF1(_L("Start increasing target extent size by (2,2)..."));
+    iExtentWidth=2;
+    iExtentHeight=2;
+	while(iExtentWidth <= (KWindowSize*2) && iExtentHeight <= (KWindowSize*2))
+    	{
+		// Note that borders will appear while extent is smaller than window
+		//  - iSurfaceWidth/iSurfaceHeight - unmodified
+		//  - iOffsetX/iOffsetY - unmodified 
+		// Set up expected values for the border
+		iBorderTop = 0; iBorderLeft = 0; 
+		iBorderBottom = iExtentHeight<iWindowHeight ? iWindowHeight-iExtentHeight : 0; 
+		iBorderRight = iExtentWidth<iWindowWidth ? iWindowWidth-iExtentWidth : 0; 
+
+	    // set new target extent values
+	    ASSERT_EGL_TRUE(iPfnEglSetSurfaceScalingNOK(iDisplay, iEglSess->Surface(), iOffsetX, iOffsetY, iExtentWidth, iExtentHeight));
+
+		// re-populate buffers with the unmodified fixed size surface content
+	    WritePixelsToSurfaceL(*testBitmap);
+		
+		// perform the testing
+		doTestPartialStepL();
+		iExtentWidth+=2;
+		iExtentHeight+=2;
+		}
+
+    /// Cleanup
+    CleanupStack::PopAndDestroy(testBitmap);
+    iEglSess->CleanupSurfaceAndContextL();
+    CleanAll();
+    CloseWindow();
+    
+    INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_ExtentSizeChange::doTestStepL completed!"));
+    RecordTestResultL();
+    CloseTMSGraphicsStep();
+    return TestStepResult();
+    }
+
+TVerdict CEglTest_SurfaceScaling_ExtentSizeChange::doTestPartialStepL()
+    {
+    INFO_PRINTF3(_L("doTestPartialStepL started for extent size of (%d, %d)...."), iExtentWidth, iExtentHeight);
+
+    // extent change may be effective only after swapbuffers 
+	ASSERT_EGL_TRUE(eglSwapBuffers(iDisplay, iEglSess->Surface()));
+	ASSERT_EGL_TRUE(eglWaitClient());
+	// Finish() to ensure all native window operations related to the surface complete before image comparision.
+	iWsSession.Finish();
+	
+	//check all expected values
+    CheckScalingAttributesL(iSurfaceWidth, iSurfaceHeight, iExtentWidth, iExtentHeight, iOffsetX, iOffsetY); 
+    CheckBorderColorL(iBorderColor.Red(), iBorderColor.Blue(), iBorderColor.Green()); 
+
+    // Create the reference bitmap that should be expected after the window resize 
+    //  NOTE: This bitmap may have borders
+    //        Size could exceed that of the window, so check both extent and window
+    const TInt refWidth = iExtentWidth>iWindowWidth ? iExtentWidth : iWindowWidth;
+    const TInt refHeight = iExtentHeight>iWindowHeight ? iExtentHeight : iWindowHeight;
+    CFbsBitmap* refBitmap = CreateBitmapLC(TSize(refWidth, refHeight), iBorderTop, iBorderBottom, iBorderLeft, iBorderRight, iBorderColor);
+    
+    // compare window contents with expected bitmap
+    TInt comparison = iImageComparison->CompareScreenImageL(TSize(iWindowWidth, iWindowHeight), TPoint(0,0), TPoint(0,0), *refBitmap, TestStepName());
+    TEST(comparison==KErrNone);
+    INFO_PRINTF3(_L("CompareScreenImageL returns %d (expected is %d)"), comparison, KErrNone);
+
+    /// Cleanup
+    CleanupStack::PopAndDestroy(refBitmap);
+
+    return TestStepResult();
+    }
+
+/**
+@SYMTestCaseID GRAPHICS-EGL-0670
+
+@SYMTestPriority 1
+
+@SYMPREQ 2676
+
+@SYMREQ 417-56592
+
+@SYMTestCaseDesc
+Check that updating surface scaling attributes is visible only after calling eglSwapBuffers
+
+@SYMTestActions
+1. Create a window of known size
+2. Create a fixed size surface, filled in with a predefined bitmap
+3. Draw the surface onto the window for a set extent and border colour
+4. Repeat step 3 but increasing target extent size and changing border colours
+5. Compare window content and border against a reference bitmap containing expected values
+  5a. Before calling eglSwapBuffers
+  5b. After callnig eglSwapBuffers  
+
+@SYMTestExpectedResults
+5a. The window content matches the independently created reference with old values
+5b. The window content matches the independently created reference with new values
+*/
+TVerdict CEglTest_SurfaceScaling_SwapBuffers::doTestStepL()
+    {
+    SetTestStepID(_L("GRAPHICS-EGL-0670"));
+    SetTestStepName(_L("GRAPHICS-EGL-0670"));
+    INFO_PRINTF1(_L("CEglTest_SurfaceScaling_SwapBuffers::doTestStepL started...."));
+
+    // set the initial value of a square window
+    const TInt KWindowSize = 200;
+    
+    // surface with size that matches the window size and no offset and extent a quarter 
+    // of that originally positioned in the middle (so borders should be seen)
+    iWindowWidth = iWindowHeight = KWindowSize;
+    iSurfaceWidth = iSurfaceHeight = KWindowSize;
+    iExtentWidth = iExtentHeight = KWindowSize/4; 	
+    iOffsetX = (iWindowWidth-iExtentWidth)/2; iOffsetY = (iWindowHeight-iExtentHeight)/2;	// to center the surface at the middle of the window
+    iBorderColor = TRgb(0xFF,0xFF,0x00);	// set some arbitrary colour with blue channel to 0x00
+	iBorderTop = iBorderBottom = iExtentHeight<iWindowHeight ? (iWindowHeight-iExtentHeight)/2 : 0; 
+	iBorderLeft = iBorderRight = iExtentWidth<iWindowWidth ? (iWindowWidth-iExtentWidth)/2 : 0; 
+
+    // Establish the connection to the window server and create
+    // a WindowGroup and a Window object
+    CreateAndActivateWindowL(TSize(iWindowWidth, iWindowHeight));
+
+    // Create display object
+    GetDisplayL();
+    CreateEglSessionL();    // initialise EGL Session so we can make use of its helper objects
+    iEglSess->InitializeL();
+
+    // Choose EGL config
+    EGLConfig matchingConfigs[1];
+    EGLint numConfigs = 0;
+
+    ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
+    TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported
+
+    EGLint attrib_list[] = {
+              EGL_FIXED_WIDTH_NOK, iSurfaceWidth,
+              EGL_FIXED_HEIGHT_NOK, iSurfaceHeight,
+              EGL_TARGET_EXTENT_OFFSET_X_NOK, iOffsetX,
+              EGL_TARGET_EXTENT_OFFSET_Y_NOK, iOffsetY,
+              EGL_TARGET_EXTENT_WIDTH_NOK, iExtentWidth,
+              EGL_TARGET_EXTENT_HEIGHT_NOK, iExtentHeight,
+              EGL_BORDER_COLOR_RED_NOK, iBorderColor.Red(),
+              EGL_BORDER_COLOR_GREEN_NOK, iBorderColor.Green(),
+              EGL_BORDER_COLOR_BLUE_NOK, iBorderColor.Blue(),
+              EGL_NONE};
+    
+    // Create the window surface and the egl context and make them current
+    iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);    
+    
+    // Create the test bitmap that will be used in the scaled surface 
+    //  NOTE: This bitmap generally does not have borders, 
+    CFbsBitmap* testBitmap = CreateBitmapLC(TSize(iSurfaceWidth, iSurfaceHeight),0,0,0,0,TRgb(0,0,0));
+    
+    // Copy test bitmap to drawing surface
+    WritePixelsToSurfaceL(*testBitmap);
+
+    // we need to update the window content for the first frame comparison inside the loop further down 
+	ASSERT_EGL_TRUE(eglSwapBuffers(iDisplay, iEglSess->Surface()));
+	ASSERT_EGL_TRUE(eglWaitClient());
+
+	// Start doing iterations changing border colours and increasing target extent size 
+    //  We do increments of (2,2) because the reference bitmap is simetrically split into 4 areas, so size
+    //  of this reference bitmap should be an even number of pixels
+    INFO_PRINTF1(_L("Start changing border colours and increasing target extent size by (2,2)..."));
+    for (;;)
+    	{
+		// re-populate buffers with the unmodified fixed size surface content
+		WritePixelsToSurfaceL(*testBitmap);
+
+		// perform the testing
+		doTestPartialStepL();
+		
+		// break the loop when necessary
+		if (iBorderColor.Blue()>=255)
+			break;
+		}
+
+    /// Cleanup
+    CleanupStack::PopAndDestroy(testBitmap);
+    iEglSess->CleanupSurfaceAndContextL();
+    CleanAll();
+    CloseWindow();
+    
+    INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_SwapBuffers::doTestStepL completed!"));
+    RecordTestResultL();
+    CloseTMSGraphicsStep();
+    return TestStepResult();
+    }
+
+TVerdict CEglTest_SurfaceScaling_SwapBuffers::doTestPartialStepL()
+    {
+    INFO_PRINTF4(_L("doTestPartialStepL started for border colour (%d,%d,%d)...."), iBorderColor.Red(), iBorderColor.Green(), iBorderColor.Blue());
+
+	// Note that borders will appear while extent is smaller than window
+	//  - iSurfaceWidth/iSurfaceHeight - unmodified
+	//  - iExtentWidth/iExtentHeight - modified 
+	//  - iOffsetX/iOffsetY - modified
+	
+    // Set up new value for border blue channel, storing old ones
+	TRgb oldBorderColor(iBorderColor);
+	TInt newColorBlue = oldBorderColor.Blue() + 5;
+	TESTL(newColorBlue>=0 && newColorBlue<=255);
+	iBorderColor.SetBlue(newColorBlue);
+	
+    // Set up new values for extent/offset, storing old ones
+	TInt oldExtentWidth = iExtentWidth;
+	TInt oldExtentHeight = iExtentHeight;
+	iExtentWidth+=2;
+	iExtentHeight+=2;
+	iOffsetX = (iWindowWidth-iExtentWidth)/2; 
+	iOffsetY = (iWindowHeight-iExtentHeight)/2;
+	
+	// Set up expected values for the border, storing old ones
+	TInt oldBorderTop = iBorderTop;
+	TInt oldBorderBottom = iBorderBottom;
+	TInt oldBorderLeft = iBorderLeft;
+	TInt oldBorderRight = iBorderRight;
+	iBorderTop = iBorderBottom = iExtentHeight<iWindowHeight ? (iWindowHeight-iExtentHeight)/2 : 0; 
+	iBorderLeft = iBorderRight = iExtentWidth<iWindowWidth ? (iWindowWidth-iExtentWidth)/2 : 0; 
+
+    // set new extent/offset values
+    ASSERT_EGL_TRUE(iPfnEglSetSurfaceScalingNOK(iDisplay, iEglSess->Surface(), iOffsetX, iOffsetY, iExtentWidth, iExtentHeight));
+    // set new border colour values
+    ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, iBorderColor.Blue()));
+    
+    // Check that values have been updated as expected
+    CheckScalingAttributesL(iSurfaceWidth, iSurfaceHeight, iExtentWidth, iExtentHeight, iOffsetX, iOffsetY); 
+    CheckBorderColorL(iBorderColor.Red(), iBorderColor.Blue(), iBorderColor.Green()); 
+
+    // Check that the screen has NOT BEEN UPDATED just yet
+
+    // Create the reference bitmap that should be expected before the extent/border changes 
+    TInt refWidth = oldExtentWidth>iWindowWidth ? oldExtentWidth : iWindowWidth;
+    TInt refHeight = oldExtentHeight>iWindowHeight ? oldExtentHeight : iWindowHeight;
+    CFbsBitmap* oldRefBitmap = CreateBitmapLC(TSize(refWidth, refHeight), oldBorderTop, oldBorderBottom, oldBorderLeft, oldBorderRight, oldBorderColor);
+
+    // compare screen with old reference bitmap
+    TInt comparison = iImageComparison->CompareScreenImageL(TSize(iWindowWidth, iWindowHeight), TPoint(0,0), TPoint(0,0), *oldRefBitmap, TestStepName());
+    TEST(comparison==KErrNone);
+    INFO_PRINTF3(_L("CompareScreenImageL before eglSwapBuffers returns %d (expected is %d)"), comparison, KErrNone);
+
+    // extent/offset changes MUST be effective only after swapbuffers 
+	ASSERT_EGL_TRUE(eglSwapBuffers(iDisplay, iEglSess->Surface()));
+	ASSERT_EGL_TRUE(eglWaitClient());
+	// Finish() to ensure all native window operations related to the surface complete before image comparision.
+	iWsSession.Finish();
+	
+	//check values still are as expected
+    CheckScalingAttributesL(iSurfaceWidth, iSurfaceHeight, iExtentWidth, iExtentHeight, iOffsetX, iOffsetY); 
+    CheckBorderColorL(iBorderColor.Red(), iBorderColor.Blue(), iBorderColor.Green()); 
+
+    // Create the reference bitmap that should be expected after the extent/border changes 
+    refWidth = iExtentWidth>iWindowWidth ? iExtentWidth : iWindowWidth;
+    refHeight = iExtentHeight>iWindowHeight ? iExtentHeight : iWindowHeight;
+    CFbsBitmap* newRefBitmap = CreateBitmapLC(TSize(refWidth, refHeight), iBorderTop, iBorderBottom, iBorderLeft, iBorderRight, iBorderColor);
+
+    // compare screen with new reference bitmap
+    comparison = iImageComparison->CompareScreenImageL(TSize(iWindowWidth, iWindowHeight), TPoint(0,0), TPoint(0,0), *newRefBitmap, TestStepName());
+    TEST(comparison==KErrNone);
+    INFO_PRINTF3(_L("CompareScreenImageL after eglSwapBuffers returns %d (expected is %d)"), comparison, KErrNone);
+
+    /// Cleanup
+    CleanupStack::PopAndDestroy(2, oldRefBitmap); // oldRefBitmap, newRefBitmap
+
+    return TestStepResult();
+    }
+
+/**
+@SYMTestCaseID GRAPHICS-EGL-0652
+
+@SYMTestPriority 1
+
+@SYMPREQ 2676
+
+@SYMREQ 417-56592
+
+@SYMTestCaseDesc
+Check that all configs that support surface scaling also support window surfaces.
+
+@SYMTestActions
+1. Query number of configs
+2. Iterate through all configs and check if surface scaling is supported
+3. If surface scaling is supported, chech that it supports window surfaces and 
+	attempt to create a fixed size window surface
+4. If surface scaling is not supported, check eglGetConfigAttrib return value and 
+	attempt to create a fixed size window surface
+
+@SYMTestExpectedResults
+3. All configs that support surface scaling support window surfaces and window surface creation succeeds.
+4. If surface scaling is not supported, eglGetConfigAttrib sets value to EGL_FALSE and window surface creation fails.
+*/
+TVerdict CEglTest_SurfaceScaling_WindowSurface_Check::doTestStepL()
+    {
+    INFO_PRINTF1(_L("CEglTest_SurfaceScaling_WindowSurface_Check::doTestStepL"));
+    SetTestStepName(_L("GRAPHICS-EGL-0652"));
+    SetTestStepID(_L("GRAPHICS-EGL-0652"));
+
+    // Establish the connection to the window server and create
+    // a WindowGroup and a Window object
+    CreateAndActivateWindowL(TSize(100, 100));
+
+    // Create display object
+    GetDisplayL();
+    CreateEglSessionL();    // initialise EGL Session so we can make use of its helper objects
+    iEglSess->InitializeL();
+
+    EGLConfig matchingConfigs[KMaxEglConfigs];
+    EGLint numConfigs = 0;
+
+    EGLint attrib_list[] = {
+					EGL_FIXED_WIDTH_NOK, 50,
+					EGL_FIXED_HEIGHT_NOK, 50,
+					EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+					EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+					EGL_TARGET_EXTENT_WIDTH_NOK, 100,
+					EGL_TARGET_EXTENT_HEIGHT_NOK, 100,
+					EGL_NONE};
+
+    // Query total number of configs
+    ASSERT_EGL_TRUE(eglGetConfigs(iDisplay, NULL, KMaxTInt, &numConfigs));
+    TESTL(numConfigs >= 1 && numConfigs <= KMaxEglConfigs);
+    INFO_PRINTF2(_L("Found %d configs in total"), numConfigs);
+
+    // Get all configs
+    ASSERT_EGL_TRUE(eglGetConfigs(iDisplay, matchingConfigs, KMaxEglConfigs, &numConfigs));
+
+    // Check that if surface scaling is supported in the config, then window surfaces are supported too
+    for(TInt i=0; i<numConfigs; i++)
+        {
+		// query scaling support
+		EGLint scalingSupport = -32; // arbitraty value which is neither EGL_TRUE nor EGL_FALSE
+		ASSERT_EGL_TRUE(eglGetConfigAttrib(iDisplay, matchingConfigs[i], EGL_SURFACE_SCALING_NOK, &scalingSupport));
+		
+		// query window surface support
+		EGLint surfaceType=-1;
+		ASSERT_EGL_TRUE(eglGetConfigAttrib(iDisplay, matchingConfigs[i], EGL_SURFACE_TYPE, &surfaceType));
+		
+		// check that if surface scaling is supported, it also supports window surfaces
+		if (scalingSupport==EGL_TRUE)
+			{
+			INFO_PRINTF2(_L("Config %d supports surface scaling. Checking window surface support..."), i);
+			TEST((surfaceType&EGL_WINDOW_BIT) == EGL_WINDOW_BIT);
+			}
+		else
+			{
+			// check value was updated accordingly
+			INFO_PRINTF2(_L("Config %d does NOT support surface scaling."), i);
+			TEST(scalingSupport==EGL_FALSE);
+			}
+
+		// check if config supports window surface, fixed window surface creation follows scaling support 
+		if ((surfaceType&EGL_WINDOW_BIT) == EGL_WINDOW_BIT)
+			{
+			EGLSurface windowSurface = eglCreateWindowSurface(iDisplay, matchingConfigs[i], &iWindow, attrib_list);
+			if (scalingSupport==EGL_TRUE)
+				{
+				INFO_PRINTF1(_L("Checking window surface creation succeeds..."));
+				TEST_EGL_ERROR(windowSurface =! EGL_NO_SURFACE, EGL_SUCCESS);
+				}
+			else
+				{
+				INFO_PRINTF1(_L("Checking window surface creation fails..."));
+				TEST_EGL_ERROR(windowSurface == EGL_NO_SURFACE, EGL_BAD_MATCH);
+				}
+			}
+        }
+
+    // clean-up
+    CleanAll();
+    CloseWindow();
+    
+    INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_WindowSurface_Check::doTestStepL completed!"));
+    RecordTestResultL();
+    CloseTMSGraphicsStep();
+    return TestStepResult();
+    }
+
+/**
+@SYMTestCaseID GRAPHICS-EGL-0653
+
+@SYMTestPriority 1
+
+@SYMPREQ 2676
+
+@SYMREQ 417-56592
+
+@SYMTestCaseDesc
+Negative test. This test is to check the return value and error code of eglCreateWindowSurface 
+when creating a fixed size window surface with invalid combination of Surface Scaling attributes 
+and illegal values for each attribute.
+
+@SYMTestActions
+1. Create a fixed size Window Surface with invalid combination of Surface Scaling attributes.
+    - Only specify 5 out of 6 of the following attributes, when specified, should be valid.
+    EGL_EXTENT_WIDTH_NOK, EGL_EXTENT_HEIGHT_NOK, EGL_TARGET_EXTENT_WIDTH_NOK, 
+    EGL_TARGET_EXTENT_HEIGHT_NOK, EGL_TARGET_EXTENT_OFFSET_X_NOK, EGL_TARGET_EXTENT_OFFSET_Y_NOK
+2. Create a fixed size Window Surface with illegal values for each attribute.
+    [attribute]                         [illegal value]
+    EGL_FIXED_WIDTH_NOK                 less than or equal to zero
+    EGL_FIXED_HEIGHT_NOK                less than or equal to zero
+    EGL_TARGET_EXTENT_WIDTH_NOK         less than or equal to zero
+    EGL_TARGET_EXTENT_HEIGHT_NOK        less than or equal to zero
+
+@SYMTestExpectedResults
+1. EGL_NO_SURFACE is returned with error set to EGL_BAD_ATTRIBUTE
+2. EGL_NO_SURFACE is returned with error set to EGL_BAD_ATTRIBUTE
+*/
+TVerdict CEglTest_SurfaceScaling_Negative_CreateWindowSurface::doTestStepL()
+    {
+    INFO_PRINTF1(_L("CEglTest_SurfaceScaling_Negative_CreateWindowSurface::doTestStepL"));
+    SetTestStepName(_L("GRAPHICS-EGL-0653"));
+    SetTestStepID(_L("GRAPHICS-EGL-0653"));
+
+    // Establish the connection to the window server and create
+    // a WindowGroup and a Window object
+    CreateAndActivateWindowL(TSize(100, 100));
+
+    // Create display object
+    GetDisplayL();
+    CreateEglSessionL();
+    iEglSess->InitializeL();
+    
+    // Choose EGL config
+    EGLConfig matchingConfigs[1];
+    EGLint numConfigs = 0;
+    
+    ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
+    TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported
+    
+    // Make the fixed size surface half width and height of the window
+    TInt surfaceWidth = iWindow.Size().iWidth / 2;
+    TInt surfaceHeight = iWindow.Size().iHeight / 2;
+    
+    TInt invalidCombinationAttrNum = 6;
+    EGLint invalid_combination_attrib_list[][11] = {
+            {
+                EGL_FIXED_HEIGHT_NOK, surfaceHeight,
+                EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+                EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+                EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
+                EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
+                EGL_NONE},
+            {
+                EGL_FIXED_WIDTH_NOK, surfaceWidth,
+                EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+                EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+                EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
+                EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
+                EGL_NONE},
+            {
+                EGL_FIXED_WIDTH_NOK, surfaceWidth,
+                EGL_FIXED_HEIGHT_NOK, surfaceHeight,
+                EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+                EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
+                EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
+                EGL_NONE},
+            {
+                EGL_FIXED_WIDTH_NOK, surfaceWidth,
+                EGL_FIXED_HEIGHT_NOK, surfaceHeight,
+                EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+                EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
+                EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
+                EGL_NONE},
+            {
+                EGL_FIXED_WIDTH_NOK, surfaceWidth,  
+                EGL_FIXED_HEIGHT_NOK, surfaceHeight,
+                EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+                EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+                EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
+                EGL_NONE},
+            {
+                EGL_FIXED_WIDTH_NOK, surfaceWidth,  
+                EGL_FIXED_HEIGHT_NOK, surfaceHeight,
+                EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+                EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+                EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
+                EGL_NONE}
+            };
+    
+    TInt illegalValAttrNum = 14;
+    EGLint illegal_value_attrib_list[][19] = {
+                {
+                    EGL_FIXED_WIDTH_NOK, -1,
+                    EGL_FIXED_HEIGHT_NOK, surfaceHeight,
+                    EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+                    EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+                    EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
+                    EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
+                    EGL_BORDER_COLOR_RED_NOK, 0xfc,
+                    EGL_BORDER_COLOR_GREEN_NOK, 0xfd,
+                    EGL_BORDER_COLOR_BLUE_NOK, 0xfe,
+                    EGL_NONE},
+                {
+                    EGL_FIXED_WIDTH_NOK, 0,
+                    EGL_FIXED_HEIGHT_NOK, surfaceHeight,
+                    EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+                    EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+                    EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
+                    EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
+                    EGL_BORDER_COLOR_RED_NOK, 0xfc,
+                    EGL_BORDER_COLOR_GREEN_NOK, 0xfd,
+                    EGL_BORDER_COLOR_BLUE_NOK, 0xfe,
+                    EGL_NONE},
+                {
+                    EGL_FIXED_WIDTH_NOK, surfaceWidth,
+                    EGL_FIXED_HEIGHT_NOK, -1,
+                    EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+                    EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+                    EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
+                    EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
+                    EGL_BORDER_COLOR_RED_NOK, 0xfc,
+                    EGL_BORDER_COLOR_GREEN_NOK, 0xfd,
+                    EGL_BORDER_COLOR_BLUE_NOK, 0xfe,
+                    EGL_NONE},
+                {
+                    EGL_FIXED_WIDTH_NOK, surfaceWidth,
+                    EGL_FIXED_HEIGHT_NOK, 0,
+                    EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+                    EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+                    EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
+                    EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
+                    EGL_BORDER_COLOR_RED_NOK, 0xfc,
+                    EGL_BORDER_COLOR_GREEN_NOK, 0xfd,
+                    EGL_BORDER_COLOR_BLUE_NOK, 0xfe,
+                    EGL_NONE},
+                {
+                    EGL_FIXED_WIDTH_NOK, surfaceWidth,  
+                    EGL_FIXED_HEIGHT_NOK, surfaceHeight,
+                    EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+                    EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+                    EGL_TARGET_EXTENT_WIDTH_NOK, -1,
+                    EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
+                    EGL_BORDER_COLOR_RED_NOK, 0xfc,
+                    EGL_BORDER_COLOR_GREEN_NOK, 0xfd,
+                    EGL_BORDER_COLOR_BLUE_NOK, 0xfe,
+                    EGL_NONE},
+                {
+                    EGL_FIXED_WIDTH_NOK, surfaceWidth,  
+                    EGL_FIXED_HEIGHT_NOK, surfaceHeight,
+                    EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+                    EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+                    EGL_TARGET_EXTENT_WIDTH_NOK, 0,
+                    EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
+                    EGL_BORDER_COLOR_RED_NOK, 0xfc,
+                    EGL_BORDER_COLOR_GREEN_NOK, 0xfd,
+                    EGL_BORDER_COLOR_BLUE_NOK, 0xfe,
+                    EGL_NONE},
+                {
+                    EGL_FIXED_WIDTH_NOK, surfaceWidth,  
+                    EGL_FIXED_HEIGHT_NOK, surfaceHeight,
+                    EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+                    EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+                    EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
+                    EGL_TARGET_EXTENT_HEIGHT_NOK, -1,
+                    EGL_BORDER_COLOR_RED_NOK, 0xfc,
+                    EGL_BORDER_COLOR_GREEN_NOK, 0xfd,
+                    EGL_BORDER_COLOR_BLUE_NOK, 0xfe,
+                    EGL_NONE},
+                {
+                    EGL_FIXED_WIDTH_NOK, surfaceWidth,  
+                    EGL_FIXED_HEIGHT_NOK, surfaceHeight,
+                    EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+                    EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+                    EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
+                    EGL_TARGET_EXTENT_HEIGHT_NOK, 0,
+                    EGL_BORDER_COLOR_RED_NOK, 0xfc,
+                    EGL_BORDER_COLOR_GREEN_NOK, 0xfd,
+                    EGL_BORDER_COLOR_BLUE_NOK, 0xfe,
+                    EGL_NONE},
+                {
+                    EGL_FIXED_WIDTH_NOK, surfaceWidth,  
+                    EGL_FIXED_HEIGHT_NOK, surfaceHeight,
+                    EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+                    EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+                    EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
+                    EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
+                    EGL_BORDER_COLOR_RED_NOK, -1,
+                    EGL_BORDER_COLOR_GREEN_NOK, 0,
+                    EGL_BORDER_COLOR_BLUE_NOK, 0,
+                    EGL_NONE},
+                {
+                    EGL_FIXED_WIDTH_NOK, surfaceWidth,  
+                    EGL_FIXED_HEIGHT_NOK, surfaceHeight,
+                    EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+                    EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+                    EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
+                    EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
+                    EGL_BORDER_COLOR_RED_NOK, 0,
+                    EGL_BORDER_COLOR_GREEN_NOK, -1,
+                    EGL_BORDER_COLOR_BLUE_NOK, 0,
+                    EGL_NONE},
+                {
+                    EGL_FIXED_WIDTH_NOK, surfaceWidth,  
+                    EGL_FIXED_HEIGHT_NOK, surfaceHeight,
+                    EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+                    EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+                    EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
+                    EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
+                    EGL_BORDER_COLOR_RED_NOK, 0,
+                    EGL_BORDER_COLOR_GREEN_NOK, 0,
+                    EGL_BORDER_COLOR_BLUE_NOK, -1,
+                    EGL_NONE},
+                {
+                    EGL_FIXED_WIDTH_NOK, surfaceWidth,  
+                    EGL_FIXED_HEIGHT_NOK, surfaceHeight,
+                    EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+                    EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+                    EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
+                    EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
+                    EGL_BORDER_COLOR_RED_NOK, 256,
+                    EGL_BORDER_COLOR_GREEN_NOK, 0,
+                    EGL_BORDER_COLOR_BLUE_NOK, 0,
+                    EGL_NONE},
+                {
+                    EGL_FIXED_WIDTH_NOK, surfaceWidth,  
+                    EGL_FIXED_HEIGHT_NOK, surfaceHeight,
+                    EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+                    EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+                    EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
+                    EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
+                    EGL_BORDER_COLOR_RED_NOK, 0,
+                    EGL_BORDER_COLOR_GREEN_NOK, 256,
+                    EGL_BORDER_COLOR_BLUE_NOK, 0,
+                    EGL_NONE},
+                {
+                    EGL_FIXED_WIDTH_NOK, surfaceWidth,  
+                    EGL_FIXED_HEIGHT_NOK, surfaceHeight,
+                    EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+                    EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+                    EGL_TARGET_EXTENT_WIDTH_NOK, iWindow.Size().iWidth,
+                    EGL_TARGET_EXTENT_HEIGHT_NOK, iWindow.Size().iHeight,
+                    EGL_BORDER_COLOR_RED_NOK, 0,
+                    EGL_BORDER_COLOR_GREEN_NOK, 0,
+                    EGL_BORDER_COLOR_BLUE_NOK, 256,
+                    EGL_NONE}
+                };
+
+    INFO_PRINTF1(_L("Calling eglCreateWindowSurface with invalid combination of Surface Scaling attributes... - only five out of six compulsary attributes specified"));
+    for(TInt i = 0;i < invalidCombinationAttrNum;i++)
+        {
+        EGLSurface surface = eglCreateWindowSurface(iDisplay, matchingConfigs[0], &iWindow, invalid_combination_attrib_list[i]);    
+        TEST_EGL_ERROR(surface == EGL_NO_SURFACE, EGL_BAD_ATTRIBUTE);
+        }
+    
+    INFO_PRINTF1(_L("Calling eglCreateWindowSurface with illegal values for each attribute..."));
+    for(TInt i = 0;i < illegalValAttrNum;i++)
+        {
+        EGLSurface surface = eglCreateWindowSurface(iDisplay, matchingConfigs[0], &iWindow, illegal_value_attrib_list[i]);    
+        TEST_EGL_ERROR(surface == EGL_NO_SURFACE, EGL_BAD_ATTRIBUTE);
+        }
+
+    // clean-up
+    CloseWindow();
+    CleanAll();
+
+    INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_Negative_CreateWindowSurface::doTestStepL completed!"));
+    RecordTestResultL();
+    CloseTMSGraphicsStep();
+    return TestStepResult();
+    }
+
+/**
+@SYMTestCaseID GRAPHICS-EGL-0654
+
+@SYMTestPriority 1
+
+@SYMPREQ 2676
+
+@SYMREQ 417-56592
+
+@SYMTestCaseDesc
+Negative test. This test is to check the return value and error code when creating
+a fixed size non window surface.
+
+@SYMTestActions
+1. Attempt to create a pixmap with scaling attributes specified
+2. Attempt to create a pbuffer surface with scaling attributes specified
+3. Attempt to create a window surface with scaling attributes specified but 
+   config doesn't support surface scaling
+
+@SYMTestExpectedResults
+1. EGL_NO_SURFACE is returned with error set to EGL_BAD_ATTRIBUTE
+2. EGL_NO_SURFACE is returned with error set to EGL_BAD_ATTRIBUTE
+3. EGL_NO_SURFACE is returned with error set to EGL_BAD_MATCH
+*/
+TVerdict CEglTest_SurfaceScaling_Negative_FixedSize_NonWindowSurface::doTestStepL()
+    {
+    INFO_PRINTF1(_L("CEglTest_SurfaceScaling_Negative_FixedSize_NonWindowSurface::doTestStepL"));
+    SetTestStepName(_L("GRAPHICS-EGL-0654"));
+    SetTestStepID(_L("GRAPHICS-EGL-0654"));
+
+    // Establish the connection to the window server and create
+    // a WindowGroup and a Window object
+    CreateAndActivateWindowL(TSize(100, 100));
+
+    // Create bitmap
+    User::LeaveIfError(RFbsSession::Connect());
+    CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
+    CleanupStack::PushL(bitmap);
+    User::LeaveIfError(bitmap->Create(TSize(20, 20), EColor16MU));
+    
+    // Create display object
+    GetDisplayL();
+    CreateEglSessionL();
+    iEglSess->InitializeL();
+    
+    EGLConfig config;
+    EGLSurface surface = EGL_NO_SURFACE;
+    EGLint numConfigs = 0;
+    
+    // Use OpenVG to draw
+    ASSERT_EGL_TRUE(eglBindAPI(EGL_OPENVG_API));
+    
+    const EGLint KFixedSize_surface_attrib_list[] = {
+                EGL_FIXED_WIDTH_NOK, 100,
+                EGL_FIXED_HEIGHT_NOK, 100,
+                EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+                EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+                EGL_TARGET_EXTENT_WIDTH_NOK, 150,
+                EGL_TARGET_EXTENT_HEIGHT_NOK, 150,
+                EGL_NONE};
+           
+    // If all window surfaces in EGL are scalable, first case must be skipped. Others still valid
+    TInt index = iAllScalable ? 1 : 0;
+    for(; index < 3; index++)
+        {
+        switch(index)
+            {
+		case 0:
+			INFO_PRINTF1(_L("Calling eglCreateWindowSurface with surface scaling attribute specified in a config that does not support scaling..."));
+			ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribs_NoScaling], &config, 1, &numConfigs));
+			TEST(numConfigs==1);
+			surface = eglCreateWindowSurface(iDisplay, config, &iWindow, KFixedSize_surface_attrib_list);    
+			TEST_EGL_ERROR(surface == EGL_NO_SURFACE, EGL_BAD_MATCH);
+			break;
+        case 1:
+			INFO_PRINTF1(_L("Calling eglCreatePixmapSurface with surface scaling attribute specified..."));
+		    ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPixmapAttribsColor16MU], &config, 1, &numConfigs));
+		    TEST(numConfigs==1);
+			surface = eglCreatePixmapSurface(iDisplay, config, (NativePixmapType)bitmap, KFixedSize_surface_attrib_list);
+			TEST_EGL_ERROR(surface == EGL_NO_SURFACE, EGL_BAD_ATTRIBUTE);
+            break;
+        case 2:
+            INFO_PRINTF1(_L("Calling eglCreatePbufferSurface with surface scaling attribute specified..."));
+            ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPBufferAttribsColor64K], &config, 1, &numConfigs));
+            TEST(numConfigs==1);
+            surface = eglCreatePbufferSurface(iDisplay, config, KFixedSize_surface_attrib_list);    
+            TEST_EGL_ERROR(surface == EGL_NO_SURFACE, EGL_BAD_ATTRIBUTE);
+            break;
+			}
+        }
+   
+    // cleanup
+    CleanupStack::PopAndDestroy(bitmap);
+    CloseWindow();
+    CleanAll();
+    RFbsSession::Disconnect();
+
+    INFO_PRINTF1(_L("....CEglTest_SurfaceScaling_Negative_FixedSize_NonWindowSurface::doTestStepL completed!"));
+    RecordTestResultL();
+    CloseTMSGraphicsStep();
+    return TestStepResult();
+    }
+
+/**
+@SYMTestCaseID GRAPHICS-EGL-0655
+
+@SYMTestPriority 1
+
+@SYMPREQ 2676
+
+@SYMREQ 417-56592
+
+@SYMTestCaseDesc
+Exercising border color set by default.
+
+@SYMTestActions
+1. Create a fixed size EGL Window Surface without border color specified.
+2. Create a fixed size EGL Window Surface with border color specified for one channel.
+3. Create a fixed size EGL Window Surface with border color specified for two channels.
+ 
+@SYMTestExpectedResults
+Retrieved border color matches to the value it has been set at surface creation, 
+if during the surface creation border color has not been specified it is set to black (0x0).   
+*/
+TVerdict CEglTest_SurfaceScalingDefaultBorderColor::doTestStepL()
+    {
+    SetTestStepName(_L("GRAPHICS-EGL-0655"));
+    SetTestStepID(_L("GRAPHICS-EGL-0655"));
+    INFO_PRINTF1(_L("CEglTest_SurfaceScalingDefaultBorderColor::doTestStepL"));
+
+    // Establish the connection to the window server and create
+    // a WindowGroup and a Window object
+    CreateAndActivateWindowL(TSize(100,100));
+    const TInt KWindowWidth = iWindow.Size().iWidth;
+    const TInt KWindowHeight = iWindow.Size().iHeight;
+    
+    // Create display object
+    GetDisplayL();
+    CreateEglSessionL();    // initialise EGL Session so we can make use of its helper objects
+    iEglSess->InitializeL();
+    
+    // Choose EGL config
+    EGLConfig matchingConfigs[1];
+    EGLint numConfigs = 0;
+    
+    ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
+    TESTL (numConfigs == 1); // Abort the test if the EGL config is not supported
+    
+    // Make the fixed size surface half width and height of the window
+    const TInt KSurfaceWidth = KWindowWidth/2;
+    const TInt KSurfaceHeight = KWindowHeight/2;
+    
+    EGLint attrib_list1[] = {
+              EGL_FIXED_WIDTH_NOK, KSurfaceWidth,
+              EGL_FIXED_HEIGHT_NOK, KSurfaceHeight,
+              EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+              EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+              EGL_TARGET_EXTENT_WIDTH_NOK, KWindowWidth,
+              EGL_TARGET_EXTENT_HEIGHT_NOK, KWindowHeight,
+              EGL_NONE};
+
+    EGLint attrib_list2[] = {
+              EGL_FIXED_WIDTH_NOK, KSurfaceWidth,
+              EGL_FIXED_HEIGHT_NOK, KSurfaceHeight,
+              EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+              EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+              EGL_TARGET_EXTENT_WIDTH_NOK, KWindowWidth,
+              EGL_TARGET_EXTENT_HEIGHT_NOK, KWindowHeight,
+              EGL_BORDER_COLOR_RED_NOK, 0xf0,
+              EGL_NONE};
+
+    EGLint attrib_list3[] = {
+              EGL_FIXED_WIDTH_NOK, KSurfaceWidth,
+              EGL_FIXED_HEIGHT_NOK, KSurfaceHeight,
+              EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+              EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+              EGL_TARGET_EXTENT_WIDTH_NOK, KWindowWidth,
+              EGL_TARGET_EXTENT_HEIGHT_NOK, KWindowHeight,
+              EGL_BORDER_COLOR_BLUE_NOK, 0xf8,
+              EGL_BORDER_COLOR_GREEN_NOK, 0xfc,
+              EGL_NONE};
+    
+    for(TInt index = 0; index < 3; index++)
+        {
+        EGLint* attrib_list = NULL;
+        EGLint expectedRedChannelColor = 0; 
+        EGLint expectedGreenChannelColor = 0; 
+        EGLint expectedBlueChannelColor = 0; 
+
+        switch(index)
+            {
+        case 0:
+            attrib_list = attrib_list1;
+            break;
+        case 1:
+            expectedRedChannelColor = 0xf0;
+            attrib_list = attrib_list2;
+            break;
+        case 2:
+            expectedBlueChannelColor = 0xf8;
+            expectedGreenChannelColor = 0xfc;
+            attrib_list = attrib_list3;
+            break;
+            }
+        // Create the window surface and the egl context and make them current
+        iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);    
+        
+        // Check expected border colours 
+        CheckBorderColorL(expectedRedChannelColor, expectedBlueChannelColor, expectedGreenChannelColor);
+    
+        // Cleanup
+        iEglSess->CleanupSurfaceAndContextL();
+        }
+    
+    CleanAll();
+    CloseWindow();
+    
+    INFO_PRINTF1(_L("....CEglTest_SurfaceScalingDefaultBorderColor::doTestStepL completed!"));
+    RecordTestResultL();
+    CloseTMSGraphicsStep();
+    return TestStepResult();
+    }
+
+
+/**
+@SYMTestCaseID GRAPHICS-EGL-0656
+
+@SYMTestPriority 1
+
+@SYMPREQ 2676
+
+@SYMREQ 417-56592
+
+@SYMTestCaseDesc
+Modifying an existing fixed size surface border color. 
+
+@SYMTestActions
+1. Create a fixed size EGL Window Surface with border color specified.
+2. Modify border color with the new values.
+ 
+@SYMTestExpectedResults
+New color will take place only after setting new values.   
+*/
+
+TVerdict CEglTest_SurfaceScalingModifyingBorderColor::doTestStepL()
+    {
+	SetTestStepName(_L("GRAPHICS-EGL-0656"));
+	SetTestStepID(_L("GRAPHICS-EGL-0656"));
+	INFO_PRINTF1(_L("CEglTest_SurfaceScalingModifyingBorderColor::doTestStepL"));
+
+    // Establish the connection to the window server and create
+    // a WindowGroup and a Window object
+    CreateAndActivateWindowL(TSize(100,100));
+
+    // Create display object
+    GetDisplayL();
+    CreateEglSessionL();    // initialise EGL Session so we can make use of its helper objects
+    iEglSess->InitializeL();
+
+    // Choose EGL config
+    EGLConfig matchingConfigs[1];
+    EGLint numConfigs = 0;
+    
+    ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
+    TESTL (numConfigs == 1); // Abort the test if the EGL config is not supported
+    
+    // Make the fixed size surface half width and height of the window
+    const TInt KWindowWidth = iWindow.Size().iWidth;
+    const TInt KWindowHeight = iWindow.Size().iHeight;
+    const TInt KSurfaceWidth = KWindowWidth/2;
+    const TInt KSurfaceHeight = KWindowHeight/2;
+    const TInt KExtentWidth = KSurfaceWidth;
+    const TInt KExtentHeight = KSurfaceHeight;
+    const EGLint KRedChannelColor = 0x20; 
+    const EGLint KGreenChannelColor = 0x40; 
+    const EGLint KBlueChannelColor = 0x60; 
+
+    EGLint attrib_list[] = {
+              EGL_FIXED_WIDTH_NOK, KSurfaceWidth,
+              EGL_FIXED_HEIGHT_NOK, KSurfaceHeight,
+              EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+              EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+              EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth,
+              EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight,
+              EGL_BORDER_COLOR_RED_NOK, KRedChannelColor,
+              EGL_BORDER_COLOR_BLUE_NOK, KBlueChannelColor,
+              EGL_BORDER_COLOR_GREEN_NOK, KGreenChannelColor,
+              EGL_NONE};
+
+    // Create the window surface and the egl context and make them current
+    iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);    
+
+    CheckBorderColorL(KRedChannelColor, KBlueChannelColor, KGreenChannelColor);
+    
+    //modify existing attributes
+    const EGLint KOffsetColor = 100; 
+    ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, KRedChannelColor + KOffsetColor));
+    ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, KBlueChannelColor + KOffsetColor));
+    ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, KGreenChannelColor + KOffsetColor));
+
+    //check that border color has been modified now
+    CheckBorderColorL(KRedChannelColor+KOffsetColor, KBlueChannelColor+KOffsetColor, KGreenChannelColor+KOffsetColor);
+    
+    // Cleanup
+    iEglSess->CleanupSurfaceAndContextL();
+    CleanAll();
+    CloseWindow();
+    
+	INFO_PRINTF1(_L("....CEglTest_SurfaceScalingModifyingBorderColor::doTestStepL completed!"));
+
+    RecordTestResultL();
+    CloseTMSGraphicsStep();
+    return TestStepResult();
+    }
+
+/**
+@SYMTestCaseID 	GRAPHICS-EGL-0657
+
+@SYMTestPriority 1
+
+@SYMPREQ 2676
+
+@SYMREQ 417-56592
+
+@SYMTestCaseDesc
+Negative testing. Modifying an existing non-fixed size surface border color. 
+
+@SYMTestActions
+1. Create a non-fixed size EGL Window Surface.
+2. Try to set border color after surface creation.
+3. Repeat steps 1-2 for pixmap and pbuffer surface
+
+@SYMTestExpectedResults
+Setting border color has no effect.   
+*/
+TVerdict CEglTest_SurfaceScalingModifyingBorderColorNonFixed::doTestStepL()
+    {
+	SetTestStepName(_L("GRAPHICS-EGL-0657"));
+	SetTestStepID(_L("GRAPHICS-EGL-0657"));
+	INFO_PRINTF1(_L("CEglTest_SurfaceScalingModifyingBorderColorNonFixed::doTestStepL"));
+
+    // Establish the connection to the window server and create
+    // a WindowGroup and a Window object
+    CreateAndActivateWindowL(TSize(100,100));
+
+    const TInt KWindowWidth = iWindow.Size().iWidth;
+    const TInt KWindowHeight = iWindow.Size().iHeight;
+    const TInt KSurfaceWidth = KWindowWidth;
+    const TInt KSurfaceHeight = KWindowHeight;
+
+    // Create display object
+    GetDisplayL();
+    CreateEglSessionL();    // initialise EGL Session so we can make use of its helper objects
+    iEglSess->InitializeL();
+
+    // Choose EGL config
+    EGLConfig matchingConfigs[1];
+    EGLint numConfigs = 0;
+    
+    // If all window surfaces in EGL are scalable, first case must be skipped. Others still valid
+    TInt index = iAllScalable ? 1 : 0;
+    for(; index < 3; index++)
+        {
+        switch(index)
+            {
+        case 0:
+            // Create the non-fixed size window surface and the egl context and make them current
+            INFO_PRINTF1(_L("Create the non-fixed size window surface and the egl context and make them current..."));
+            ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribs_NoScaling], matchingConfigs, 1, &numConfigs));
+            TESTL(numConfigs == 1);
+            iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow);    
+            break;
+        case 1:
+            // Create the pbuffer surface and the egl context and make them current
+            INFO_PRINTF1(_L("Create the pbuffer surface and the egl context and make them current..."));
+            ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPBufferAttribsColor16MU], matchingConfigs, 1, &numConfigs));
+            TESTL(numConfigs == 1);
+            iEglSess->CreatePbufferSurfaceAndMakeCurrentL(matchingConfigs[0], TSize(KSurfaceWidth, KSurfaceHeight));
+            break;
+        case 2:
+            // Create the pixmap surface and the egl context and make them current
+            INFO_PRINTF1(_L("Create the pixmap surface and the egl context and make them current..."));
+            ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPixmapAttribsColor16MU], matchingConfigs, 1, &numConfigs));
+            TESTL(numConfigs == 1);
+            iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(TSize(KSurfaceWidth, KSurfaceHeight), EColor16MU);
+            break;
+            }
+
+		// Set border color values to a non fixed size window (nothing should happen)
+		const EGLint KRedChannelColor = 0x20; 
+		const EGLint KGreenChannelColor = 0x40; 
+		const EGLint KBlueChannelColor = 0x60; 
+		ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, KRedChannelColor));
+		ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, KBlueChannelColor));
+		ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, KGreenChannelColor));
+
+		// Check all attributes (this is a non-fixed size window) 
+		// Note that we cannot use CheckBorderColorL because values are not updated
+		EGLint redChannelColor = -1; 
+		EGLint greenChannelColor = -2; 
+		EGLint blueChannelColor = -3; 
+		ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, &redChannelColor));
+		ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, &blueChannelColor));
+		ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, &greenChannelColor));
+		TEST(redChannelColor == -1);
+		TEST(greenChannelColor == -2);
+		TEST(blueChannelColor == -3);
+
+		// Set invalid border color values to a non fixed size window (nothing should happen)
+		INFO_PRINTF1(_L("Attempt to set invalid border color values to a non fixed size window..."));
+		ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, KRedChannelColor+256));
+		ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, KBlueChannelColor+256));
+		ASSERT_EGL_TRUE(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, KGreenChannelColor+256));
+		
+		// Check all attributes (this is a non-fixed size window) 
+		// Note that we cannot use CheckBorderColorL because values are not updated
+		ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, &redChannelColor));
+		ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, &blueChannelColor));
+		ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, &greenChannelColor));
+		TEST(redChannelColor == -1);
+		TEST(greenChannelColor == -2);
+		TEST(blueChannelColor == -3);
+    
+	   	// destroy surface and context
+	    iEglSess->CleanupSurfaceAndContextL();
+        }
+    
+    // Cleanup
+    CleanAll();
+    CloseWindow();
+    
+	INFO_PRINTF1(_L("....CEglTest_SurfaceScalingModifyingBorderColorNonFixed::doTestStepL completed!"));
+
+    RecordTestResultL();
+    CloseTMSGraphicsStep();
+    return TestStepResult();
+    }
+
+/**
+@SYMTestCaseID GRAPHICS-EGL-0658
+
+@SYMTestPriority 1
+
+@SYMPREQ 2676
+
+@SYMREQ 417-56592
+
+@SYMTestCaseDesc
+Negative testing. Attempt to modify an existing fixed size surface border color with invalid values. 
+
+@SYMTestActions
+1. Create a fixed size EGL Window Surface with border color specified.
+2. Try to modify border color with the negative values.
+3. Try to modify border color with the positive values greater than 255.
+ 
+@SYMTestExpectedResults
+Attempt to modify the border color with the new values will fail with error code EGL_BAD_ATTRIBUTE.   
+*/
+TVerdict CEglTest_SurfaceScalingModifyingInvalidBorderColor::doTestStepL()
+    {
+    SetTestStepName(_L("GRAPHICS-EGL-0658"));
+    SetTestStepID(_L("GRAPHICS-EGL-0658"));
+    INFO_PRINTF1(_L("CEglTest_SurfaceScalingModifyingInvalidBorderColor::doTestStepL"));
+
+    // Establish the connection to the window server and create
+    // a WindowGroup and a Window object
+    CreateAndActivateWindowL(TSize(100,100));
+    const TInt KWindowWidth = iWindow.Size().iWidth;
+    const TInt KWindowHeight = iWindow.Size().iHeight;
+
+    // Create display object
+    GetDisplayL();
+    CreateEglSessionL();    // initialise EGL Session so we can make use of its helper objects
+    iEglSess->InitializeL();
+
+    // Choose EGL config
+    EGLConfig matchingConfigs[1];
+    EGLint numConfigs = 0;
+    
+    ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
+    TESTL (numConfigs == 1); // Abort the test if the EGL config is not supported
+    
+    // Make the fixed size surface half width and height of the window
+    const TInt KSurfaceWidth = KWindowWidth/2;
+    const TInt KSurfaceHeight = KWindowHeight/2;
+    const EGLint KRedChannelColor = 0x20; 
+    const EGLint KGreenChannelColor = 0x40; 
+    const EGLint KBlueChannelColor = 0x60; 
+
+    EGLint attrib_list[] = {
+              EGL_FIXED_WIDTH_NOK, KSurfaceWidth,
+              EGL_FIXED_HEIGHT_NOK, KSurfaceHeight,
+              EGL_TARGET_EXTENT_OFFSET_X_NOK, 0,
+              EGL_TARGET_EXTENT_OFFSET_Y_NOK, 0,
+              EGL_TARGET_EXTENT_WIDTH_NOK, KWindowWidth,
+              EGL_TARGET_EXTENT_HEIGHT_NOK, KWindowHeight,
+              EGL_BORDER_COLOR_RED_NOK, KRedChannelColor,
+              EGL_BORDER_COLOR_BLUE_NOK, KBlueChannelColor,
+              EGL_BORDER_COLOR_GREEN_NOK, KGreenChannelColor,
+              EGL_NONE};
+
+
+    // Create the window surface and the egl context and make them current
+    iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);    
+
+    // check initial values match
+    CheckBorderColorL(KRedChannelColor, KBlueChannelColor, KGreenChannelColor);
+    
+    //modify existing attributes with negative value
+	INFO_PRINTF1(_L("Attempt to set negative border color values..."));
+    TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, -KRedChannelColor) == EGL_FALSE);
+    ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
+    TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, -KBlueChannelColor) == EGL_FALSE);
+    ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
+    TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, -KGreenChannelColor) == EGL_FALSE);
+    ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
+
+    //check that border color has not been modified
+    CheckBorderColorL(KRedChannelColor, KBlueChannelColor, KGreenChannelColor);
+    
+    //modify existing attributes with very big positive value
+	INFO_PRINTF1(_L("Attempt to set border color values that are too big..."));
+    TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, KRedChannelColor + 256) == EGL_FALSE);
+    ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
+    TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, KBlueChannelColor + 256) == EGL_FALSE);
+    ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
+    TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, KGreenChannelColor + 256) == EGL_FALSE);
+    ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
+
+    //check that border color has not been modified
+    CheckBorderColorL(KRedChannelColor, KBlueChannelColor, KGreenChannelColor);
+
+    /// Cleanup
+    iEglSess->CleanupSurfaceAndContextL();
+    CleanAll();
+    CloseWindow();
+    
+    INFO_PRINTF1(_L("....CEglTest_SurfaceScalingModifyingInvalidBorderColor::doTestStepL completed!"));
+    RecordTestResultL();
+    CloseTMSGraphicsStep();
+    return TestStepResult();
+    }
+
+/**
+@SYMTestCaseID GRAPHICS-EGL-0659
+
+@SYMTestPriority 1
+
+@SYMPREQ 2676
+
+@SYMREQ 417-56592
+
+@SYMTestCaseDesc
+Negative testing. Attempt to modify an extent with eglSurfaceAttrib() after surface has been created. 
+
+@SYMTestActions
+1. Create a fixed size EGL Window Surface.
+2. Try to modify a surface extent parameters with arbitrary values via eglSurfaceAttrib().
+
+@SYMTestExpectedResults
+Attempt to modify the extent will fail with error code EGL_BAD_ATTRIBUTE.   
+*/
+TVerdict CEglTest_SurfaceScalingModifyingExtent::doTestStepL()
+    {
+    SetTestStepName(_L("GRAPHICS-EGL-0659"));
+    SetTestStepID(_L("GRAPHICS-EGL-0659"));
+    INFO_PRINTF1(_L("CEglTest_SurfaceScalingModifyingExtent::doTestStepL"));
+
+     // Establish the connection to the window server and create
+    // a WindowGroup and a Window object
+    CreateAndActivateWindowL(TSize(100,100));
+
+    // Create display object
+    GetDisplayL();
+    CreateEglSessionL();    // initialise EGL Session so we can make use of its helper objects
+    iEglSess->InitializeL();
+
+    INFO_PRINTF1(_L("Attempt to modify surface extent for fixed size surfaces..."));
+    // Choose EGL config
+    EGLConfig matchingConfigs[1];
+    EGLint numConfigs = 0;
+    ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
+	TESTL (numConfigs == 1); // Abort the test if the EGL config is not supported
+
+    const TInt KWindowWidth = iWindow.Size().iWidth;
+    const TInt KWindowHeight = iWindow.Size().iHeight;
+    const TInt KSurfaceWidth = KWindowWidth/2;
+	const TInt KSurfaceHeight = KWindowHeight/2;
+	const TInt KExtentWidth = KWindowWidth;
+	const TInt KExtentHeight = KWindowHeight;
+    const TInt KOffsetX = 10;
+	const TInt KOffsetY = 20;
+            
+    EGLint attrib_list[] = {
+                  EGL_FIXED_WIDTH_NOK, KSurfaceWidth,
+                  EGL_FIXED_HEIGHT_NOK, KSurfaceHeight,
+                  EGL_TARGET_EXTENT_OFFSET_X_NOK, KOffsetX,
+                  EGL_TARGET_EXTENT_OFFSET_Y_NOK, KOffsetY,
+                  EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth,
+                  EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight,
+                  EGL_NONE};
+    
+	// Create the window surface and the egl context and make them current
+	iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);    
+
+	// Invalid update - modify existing attributes with any value
+	TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_FIXED_WIDTH_NOK, KSurfaceWidth/2) == EGL_FALSE);
+	ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
+	TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_FIXED_HEIGHT_NOK, KSurfaceHeight/2) == EGL_FALSE);
+	ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
+	TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth/2) == EGL_FALSE);
+	ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
+	TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight/2) == EGL_FALSE);
+	ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
+	TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_X_NOK, KOffsetX/2) == EGL_FALSE);
+	ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
+	TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_Y_NOK, KOffsetY/2) == EGL_FALSE);
+	ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
+
+    // check that attributes have not been modified
+    CheckScalingAttributesL(KSurfaceWidth, KSurfaceHeight, KExtentWidth, KExtentHeight, KOffsetX, KOffsetY);
+
+	/// Cleanup
+    iEglSess->CleanupSurfaceAndContextL();
+    CleanAll();
+    CloseWindow();
+
+    INFO_PRINTF1(_L("....CEglTest_SurfaceScalingModifyingExtent::doTestStepL completed!"));
+    RecordTestResultL();
+    CloseTMSGraphicsStep();
+    return TestStepResult();
+    }
+
+/**
+@SYMTestCaseID GRAPHICS-EGL-0671
+
+@SYMTestPriority 1
+
+@SYMPREQ 2676
+
+@SYMREQ 417-56592
+
+@SYMTestCaseDesc
+Negative testing. Attempt to modify an extent with eglSurfaceAttrib() after surface has been created. 
+
+@SYMTestActions
+1. Create a non fixed size EGL Window Surface.
+2. Try to modify a surface extent parameters with arbitrary values via eglSurfaceAttrib().
+3. Repeat steps 2-3 for pixmap and pbuffer surface
+
+@SYMTestExpectedResults
+Attempt to modify the extent will fail with error code EGL_BAD_ATTRIBUTE.   
+*/
+TVerdict CEglTest_SurfaceScalingModifyingExtentNonFixed::doTestStepL()
+    {
+    SetTestStepName(_L("GRAPHICS-EGL-0671"));
+    SetTestStepID(_L("GRAPHICS-EGL-0671"));
+    INFO_PRINTF1(_L("CEglTest_SurfaceScalingModifyingExtentNonFixed::doTestStepL"));
+
+    // Establish the connection to the window server and create
+    // a WindowGroup and a Window object
+    CreateAndActivateWindowL(TSize(100,100));
+
+    const TInt KWindowWidth = iWindow.Size().iWidth;
+    const TInt KWindowHeight = iWindow.Size().iHeight;
+    const TInt KSurfaceWidth = KWindowWidth;
+    const TInt KSurfaceHeight = KWindowHeight;
+	const TInt KExtentWidth = KWindowWidth;
+	const TInt KExtentHeight = KWindowHeight;
+    const TInt KOffsetX = 11;
+	const TInt KOffsetY = 22;
+
+    // Create display object
+    GetDisplayL();
+    CreateEglSessionL();    // initialise EGL Session so we can make use of its helper objects
+    iEglSess->InitializeL();
+     
+    // Choose EGL config
+    EGLConfig matchingConfigs[1];
+    EGLint numConfigs = 0;
+    
+    // If all window surfaces in EGL are scalable, first case must be skipped. Others still valid
+    TInt index = iAllScalable ? 1 : 0;
+    for(; index < 3; index++)
+        {
+        switch(index)
+            {
+        case 0:
+            // Create the non-fixed size window surface and the egl context and make them current
+            INFO_PRINTF1(_L("Create the non-fixed size window surface and the egl context and make them current..."));
+            ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribs_NoScaling], matchingConfigs, 1, &numConfigs));
+            TESTL(numConfigs == 1);
+            iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow);    
+            break;
+        case 1:
+            // Create the pbuffer surface and the egl context and make them current
+            INFO_PRINTF1(_L("Create the pbuffer surface and the egl context and make them current..."));
+            ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPBufferAttribsColor16MU], matchingConfigs, 1, &numConfigs));
+            TESTL(numConfigs == 1);
+            iEglSess->CreatePbufferSurfaceAndMakeCurrentL(matchingConfigs[0], TSize(KSurfaceWidth, KSurfaceHeight));
+            break;
+        case 2:
+            // Create the pixmap surface and the egl context and make them current
+            INFO_PRINTF1(_L("Create the pixmap surface and the egl context and make them current..."));
+            ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPixmapAttribsColor16MU], matchingConfigs, 1, &numConfigs));
+            TESTL(numConfigs == 1);
+            iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(TSize(KSurfaceWidth, KSurfaceHeight), EColor16MU);
+            break;
+            }
+
+		// Invalid update - modify existing attributes with any value
+		TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_FIXED_WIDTH_NOK, KSurfaceWidth/2) == EGL_FALSE);
+		ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
+		TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_FIXED_HEIGHT_NOK, KSurfaceHeight/2) == EGL_FALSE);
+		ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
+		TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth/2) == EGL_FALSE);
+		ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
+		TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight/2) == EGL_FALSE);
+		ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
+		TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_X_NOK, KOffsetX/2) == EGL_FALSE);
+		ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
+		TEST(eglSurfaceAttrib(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_Y_NOK, KOffsetY/2) == EGL_FALSE);
+		ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
+
+	   	// destroy surface and context
+	    iEglSess->CleanupSurfaceAndContextL();
+        }
+    
+	/// Cleanup
+    CleanAll();
+    CloseWindow();
+
+    INFO_PRINTF1(_L("....CEglTest_SurfaceScalingModifyingExtentNonFixed::doTestStepL completed!"));
+    RecordTestResultL();
+    CloseTMSGraphicsStep();
+    return TestStepResult();
+    }
+
+/**
+@SYMTestCaseID GRAPHICS-EGL-0660
+
+@SYMTestPriority 1
+
+@SYMPREQ 2676
+
+@SYMREQ 417-56592
+
+@SYMTestCaseDesc
+Query surface attrubutes related to scaling. 
+
+@SYMTestActions
+1. Create a non-fixed size EGL Window Surface.
+2. Query surface attributes.
+
+@SYMTestExpectedResults
+2. Query surface attributes succeeds and all atributes matches to the expected values.
+*/
+TVerdict CEglTest_SurfaceScalingQuerySurface::doTestStepL()
+    {
+    SetTestStepName(_L("GRAPHICS-EGL-0660"));
+    SetTestStepID(_L("GRAPHICS-EGL-0660"));
+    INFO_PRINTF1(_L("CEglTest_SurfaceScalingQuerySurface::doTestStepL"));
+
+    // Establish the connection to the window server and create
+    // a WindowGroup and a Window object
+    CreateAndActivateWindowL(TSize(100,100));
+
+    // Create display object
+    GetDisplayL();
+    CreateEglSessionL();    // initialise EGL Session so we can make use of its helper objects
+    iEglSess->InitializeL();
+
+    // Choose EGL config
+    EGLConfig matchingConfigs[1];
+    EGLint numConfigs = 0;
+    ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
+    TESTL (numConfigs == 1); // Abort the test if the EGL config is not supported
+
+    const TInt KWindowWidth = iWindow.Size().iWidth;
+    const TInt KWindowHeight = iWindow.Size().iHeight;
+    const TInt KSurfaceWidth = KWindowWidth/2;
+    const TInt KSurfaceHeight = KWindowHeight/2;
+    const TInt KExtentWidth = KWindowWidth;
+    const TInt KExtentHeight = KWindowHeight;
+    const EGLint KXOffset = 10;
+    const EGLint KYOffset = 20;
+    const EGLint KBorderColorRed = 0xa0;
+    const EGLint KBorderColorBlue = 0xf0;
+    const EGLint KBorderColorGreen = 0xfc;
+
+    EGLint attrib_list[] = {
+                  EGL_FIXED_WIDTH_NOK, KSurfaceWidth,
+                  EGL_FIXED_HEIGHT_NOK, KSurfaceHeight,
+                  EGL_TARGET_EXTENT_OFFSET_X_NOK, KXOffset,
+                  EGL_TARGET_EXTENT_OFFSET_Y_NOK, KYOffset,
+                  EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth,
+                  EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight,
+                  EGL_BORDER_COLOR_BLUE_NOK, KBorderColorBlue,
+                  EGL_BORDER_COLOR_GREEN_NOK, KBorderColorGreen,
+                  EGL_BORDER_COLOR_RED_NOK, KBorderColorRed,
+                  EGL_NONE};
+
+	// Create the window surface and the egl context and make them current
+    iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);    
+
+    INFO_PRINTF1(_L("Query surface attributes and border colour back and check expected values..."));
+    CheckBorderColorL(KBorderColorRed, KBorderColorBlue, KBorderColorGreen);
+    CheckScalingAttributesL(KSurfaceWidth, KSurfaceHeight, KExtentWidth, KExtentHeight, KXOffset, KYOffset);
+   
+    INFO_PRINTF1(_L("Check EGL_FIXED_WIDTH_NOK and EGL_FIXED_HEIGHT_NOK cannot be queried..."));
+    EGLint surfaceFixedWidth = -1;
+    EGLint surfaceFixedHeight = -2;
+    TEST(EGL_FALSE == eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_FIXED_WIDTH_NOK, &surfaceFixedWidth));
+    ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
+    TEST(EGL_FALSE == eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_FIXED_HEIGHT_NOK, &surfaceFixedHeight));
+    ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
+	TEST(surfaceFixedWidth == -1);
+	TEST(surfaceFixedHeight == -2);
+    
+	// clean-up
+	iEglSess->CleanupSurfaceAndContextL();
+    CloseWindow();
+    CleanAll();
+    
+    INFO_PRINTF1(_L("....CEglTest_SurfaceScalingQuerySurface::doTestStepL completed!"));
+    RecordTestResultL();
+    CloseTMSGraphicsStep();
+    return TestStepResult();
+    }
+    
+/**
+@SYMTestCaseID GRAPHICS-EGL-0662
+
+@SYMTestPriority 1
+
+@SYMPREQ 2676
+
+@SYMREQ 417-56592
+
+@SYMTestCaseDesc
+Negative testing. Query surface attributes which are not supported by this API. 
+
+@SYMTestActions
+1. Create a non-fixed size EGL window surface.
+2. Query surface attributes.
+3. Repeat step 2 for EGL window surface, pixmap and pbuffer surface
+
+@SYMTestExpectedResults
+Query surface attributes will fail with error code EGL_BAD_ATTRIBUTE.   
+*/
+TVerdict CEglTest_SurfaceScalingQuerySurfaceNonFixed::doTestStepL()
+    {
+    SetTestStepName(_L("GRAPHICS-EGL-0662"));
+    SetTestStepID(_L("GRAPHICS-EGL-0662"));
+    INFO_PRINTF1(_L("CEglTest_SurfaceScalingQuerySurfaceNonFixed::doTestStepL"));
+
+    // Establish the connection to the window server and create
+    // a WindowGroup and a Window object
+    CreateAndActivateWindowL(TSize(100,100));
+
+    const TInt KWindowWidth = iWindow.Size().iWidth;
+    const TInt KWindowHeight = iWindow.Size().iHeight;
+    const TInt KSurfaceWidth = KWindowWidth;
+    const TInt KSurfaceHeight = KWindowHeight;
+
+    // Create display object
+    GetDisplayL();
+    CreateEglSessionL();    // initialise EGL Session so we can make use of its helper objects
+    iEglSess->InitializeL();
+     
+    // Choose EGL config
+    EGLConfig matchingConfigs[1];
+    EGLint numConfigs = 0;
+    
+    // If all window surfaces in EGL are scalable, first case must be skipped. Others still valid
+    TInt index = iAllScalable ? 1 : 0;
+    for(; index < 3; index++)
+        {
+        switch(index)
+            {
+        case 0:
+            // Create the non-fixed size window surface and the egl context and make them current
+            INFO_PRINTF1(_L("Create the non-fixed size window surface and the egl context and make them current..."));
+            ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribs_NoScaling], matchingConfigs, 1, &numConfigs));
+            TESTL(numConfigs == 1);
+            iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow);    
+            break;
+        case 1:
+            // Create the pbuffer surface and the egl context and make them current
+            INFO_PRINTF1(_L("Create the pbuffer surface and the egl context and make them current..."));
+            ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPBufferAttribsColor16MU], matchingConfigs, 1, &numConfigs));
+            TESTL(numConfigs == 1);
+            iEglSess->CreatePbufferSurfaceAndMakeCurrentL(matchingConfigs[0], TSize(KSurfaceWidth, KSurfaceHeight));
+            break;
+        case 2:
+            // Create the pixmap surface and the egl context and make them current
+            INFO_PRINTF1(_L("Create the pixmap surface and the egl context and make them current..."));
+            ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPixmapAttribsColor16MU], matchingConfigs, 1, &numConfigs));
+            TESTL(numConfigs == 1);
+            iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(TSize(KSurfaceWidth, KSurfaceHeight), EColor16MU);
+            break;
+            }
+
+        INFO_PRINTF1(_L("Check EGL_FIXED_WIDTH_NOK and EGL_FIXED_HEIGHT_NOK cannot be queried..."));
+        EGLint surfaceFixedWidth = -1;
+        EGLint surfaceFixedHeight = -2;
+        TEST(EGL_FALSE == eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_FIXED_WIDTH_NOK, &surfaceFixedWidth));
+        ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
+        TEST(EGL_FALSE == eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_FIXED_HEIGHT_NOK, &surfaceFixedHeight));
+        ASSERT_EGL_ERROR(EGL_BAD_ATTRIBUTE);
+        TEST(surfaceFixedWidth == -1);
+        TEST(surfaceFixedHeight == -2);
+    
+        INFO_PRINTF1(_L("Check surface size is as we would expect..."));
+        EGLint surfaceWidth = 0;
+    	EGLint surfaceHeight = 0;
+    	ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_WIDTH, &surfaceWidth));
+    	ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_HEIGHT, &surfaceHeight));
+    	TEST(surfaceWidth == KWindowWidth);		// non-fixed size surface
+    	TEST(surfaceHeight == KWindowHeight);	// non-fixed size surface
+
+    	INFO_PRINTF1(_L("Check scaling attributes cannot be queried..."));
+    	EGLint extentOffsetX = -1;
+    	EGLint extentOffsetY = -2;
+    	EGLint extentWidth = -3;
+    	EGLint extentHeight = -4;
+    	EGLint borderColorBlue = -5;
+    	EGLint borderColorRed = -6;
+    	EGLint borderColorGreen = -7;
+    	ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_X_NOK, &extentOffsetX));
+    	ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_Y_NOK, &extentOffsetY));
+    	ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_WIDTH_NOK, &extentWidth));
+    	ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_HEIGHT_NOK, &extentHeight));
+    	ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_BLUE_NOK, &borderColorBlue));
+    	ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_GREEN_NOK, &borderColorGreen));
+    	ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_BORDER_COLOR_RED_NOK, &borderColorRed));
+    	TEST(extentOffsetX == -1);
+    	TEST(extentOffsetY == -2);
+    	TEST(extentWidth == -3);
+    	TEST(extentHeight == -4);
+    	TEST(borderColorBlue == -5);
+    	TEST(borderColorRed == -6);
+    	TEST(borderColorGreen == -7);
+
+    	// destroy surface and context
+        iEglSess->CleanupSurfaceAndContextL();
+        }
+
+    // clean-up
+    CloseWindow();
+    CleanAll();
+
+    INFO_PRINTF1(_L("....CEglTest_SurfaceScalingQuerySurfaceNonFixed::doTestStepL completed!"));
+    RecordTestResultL();
+    CloseTMSGraphicsStep();
+    return TestStepResult();
+    }
+
+/**
+@SYMTestCaseID GRAPHICS-EGL-0663
+
+@SYMTestPriority 1
+
+@SYMPREQ 2676
+
+@SYMREQ 417-56592
+
+@SYMTestCaseDesc
+Negative testing. Query surface scaling capability with invalid parameters. 
+
+@SYMTestActions
+1. Query surface scaling capability for the different configs.
+2. Query surface scaling capability with invalid display.
+3. Query surface scaling capability with negative surface width.
+4. Query surface scaling capability with negative surface height.
+5. Query surface scaling capability with negative target width.
+6. Query surface scaling capability with negative target height.
+7. Query surface scaling capability with zero surface width.
+8. Query surface scaling capability with zero surface height.
+9. Query surface scaling capability with zero target width.
+10. Query surface scaling capability with zero target height.
+
+@SYMTestExpectedResults
+1. Query surface capability will fail with error code EGL_BAD_MATCH if config doesn't support scaling and succeed otherwise.   
+2. Query surface capability will fail with error code EGL_BAD_DISPLAY.   
+3. Query surface capability will fail with error code EGL_BAD_PARAMETER.   
+4. Query surface capability will fail with error code EGL_BAD_PARAMETER.   
+5. Query surface capability will fail with error code EGL_BAD_PARAMETER.   
+6. Query surface capability will fail with error code EGL_BAD_PARAMETER.   
+7. Query surface capability will fail with error code EGL_BAD_PARAMETER.   
+8. Query surface capability will fail with error code EGL_BAD_PARAMETER.   
+9. Query surface capability will fail with error code EGL_BAD_PARAMETER.   
+10. Query surface capability will fail with error code EGL_BAD_PARAMETER.   
+*/
+TVerdict CEglTest_SurfaceScalingCapability::doTestStepL()
+    {
+    SetTestStepName(_L("GRAPHICS-EGL-0663"));
+    SetTestStepID(_L("GRAPHICS-EGL-0663"));
+    INFO_PRINTF1(_L("CEglTest_SurfaceScalingCapability::doTestStepL"));
+
+    // Create display object
+    GetDisplayL();
+    CreateEglSessionL();
+    iEglSess->InitializeL();
+
+    // Choose EGL config
+    EGLConfig matchingConfigs[KMaxEglConfigs];
+    EGLint numConfigs = 0;
+    
+    CreateAndActivateWindowL(TSize(100,100));
+    
+    const TInt KWindowWidth = iWindow.Size().iWidth;
+    const TInt KWindowHeight = iWindow.Size().iHeight;
+    const TInt KSurfaceWidth = KWindowWidth/2;
+    const TInt KSurfaceHeight = KWindowHeight/2;
+    const EGLDisplay KInvalidDisplay = iDisplay - 100;
+    EGLint capability = -1; //arbitrary number beyond the existing range 
+    EGLConfig config = -1;
+    
+    INFO_PRINTF1(_L("Calling eglGetConfigs to get configs..."));
+    ASSERT_EGL_TRUE(eglGetConfigs(iDisplay, matchingConfigs, KMaxEglConfigs, &numConfigs));
+    for(TInt index = 0; index < numConfigs; index++)
+        {
+        EGLint value = EGL_FALSE;
+        ASSERT_EGL_TRUE(eglGetConfigAttrib(iDisplay, matchingConfigs[index], EGL_SURFACE_SCALING_NOK, &value));
+        if(value == EGL_FALSE)
+            {
+            TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, matchingConfigs[index], KSurfaceWidth, KSurfaceHeight, KWindowWidth, KWindowHeight, &capability) == EGL_FALSE);
+            TEST(capability == -1); //make sure that value has not been modified
+            ASSERT_EGL_ERROR(EGL_BAD_MATCH);
+            }
+        else  
+            {
+            if(config == -1) 
+                {//memorize the first config that supports scaling
+                config = matchingConfigs[index];
+                }
+            ASSERT_EGL_TRUE(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, matchingConfigs[index], KSurfaceWidth, KSurfaceHeight, KWindowWidth, KWindowHeight, &capability));
+            TEST((capability == EGL_SUPPORTED_NOK) || (capability == EGL_SLOW_NOK));
+            capability = -1; 
+            }
+        }
+    capability = -1; 
+    TEST(config != -1); // make sure that at least one config supports scaling 
+    
+    //invalid display
+    TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(KInvalidDisplay, config, KSurfaceWidth, KSurfaceHeight, KWindowWidth, KWindowHeight, &capability) == EGL_FALSE);
+    TEST(capability == -1); //make sure that value has not been modified
+    ASSERT_EGL_ERROR(EGL_BAD_DISPLAY);
+
+    //negative width
+    TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, -KSurfaceWidth, KSurfaceHeight, KWindowWidth, KWindowHeight, &capability) == EGL_FALSE);
+    TEST(capability == -1); //make sure that value has not been modified
+    ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
+    TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, KSurfaceWidth, KSurfaceHeight, -KWindowWidth, KWindowHeight, &capability) == EGL_FALSE);
+    TEST(capability == -1); //make sure that value has not been modified
+    ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
+    //negative height
+    TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, KSurfaceWidth, -KSurfaceHeight, KWindowWidth, KWindowHeight, &capability) == EGL_FALSE);
+    TEST(capability == -1); //make sure that value has not been modified
+    ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
+    TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, KSurfaceWidth, KSurfaceHeight, KWindowWidth, -KWindowHeight, &capability) == EGL_FALSE);
+    TEST(capability == -1); //make sure that value has not been modified
+    ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
+    
+    //zero width
+    TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, -0, KSurfaceHeight, KWindowWidth, KWindowHeight, &capability) == EGL_FALSE);
+    TEST(capability == -1); //make sure that value has not been modified
+    ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
+    TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, KSurfaceWidth, KSurfaceHeight, -0, KWindowHeight, &capability) == EGL_FALSE);
+    TEST(capability == -1); //make sure that value has not been modified
+    ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
+    //zero height
+    TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, KSurfaceWidth, -0, KWindowWidth, KWindowHeight, &capability) == EGL_FALSE);
+    TEST(capability == -1); //make sure that value has not been modified
+    ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
+    TEST(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, config, KSurfaceWidth, KSurfaceHeight, KWindowWidth, -0, &capability) == EGL_FALSE);
+    TEST(capability == -1); //make sure that value has not been modified
+    ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
+   
+    // Cleanup
+    CloseWindow();
+    CleanAll();
+    
+    INFO_PRINTF1(_L("....CEglTest_SurfaceScalingCapability::doTestStepL completed!"));
+    RecordTestResultL();
+    CloseTMSGraphicsStep();
+    return TestStepResult();
+    }
+
+/**
+@SYMTestCaseID GRAPHICS-EGL-0664
+
+@SYMTestPriority 1
+
+@SYMPREQ 2676
+
+@SYMREQ 417-56592
+
+@SYMTestCaseDesc
+Call eglSetSurfaceScalingNOK with fixed size surface and a target extent that can be set. 
+
+@SYMTestActions
+Retrieve all available EGL configs and for those that support surface scaling 
+1. Create a window surface with surface scaling attributes and make it current
+2. Query these attributes and check they correspond with what is expected
+3. Query if surface supports scaling to a different extent
+4. Set the new extent and new offset to the surface
+5. Query these attributes
+
+@SYMTestExpectedResults
+5. Surface scaling attributes have been updated    
+*/
+TVerdict CEglTest_SurfaceScalingSet::doTestStepL()
+    {
+    SetTestStepName(_L("GRAPHICS-EGL-0664"));
+    SetTestStepID(_L("GRAPHICS-EGL-0664"));
+    INFO_PRINTF1(_L("CEglTest_SurfaceScalingSet::doTestStepL"));
+
+    // Establish the connection to the window server and create
+    // a WindowGroup and a Window object
+    CreateAndActivateWindowL(TSize(100, 100));
+
+    const TInt KWindowWidth = iWindow.Size().iWidth;
+    const TInt KWindowHeight = iWindow.Size().iHeight;
+    const TInt KSurfaceWidth = KWindowWidth/2;
+    const TInt KSurfaceHeight = KWindowHeight/2;
+    const TInt KExtentWidth = KWindowWidth;
+    const TInt KExtentHeight = KWindowHeight;
+    const EGLint KOffsetX = 3;
+    const EGLint KOffsetY = 7;
+
+    EGLint attrib_list[] = {
+                  EGL_FIXED_WIDTH_NOK, KSurfaceWidth,
+                  EGL_FIXED_HEIGHT_NOK, KSurfaceHeight,
+                  EGL_TARGET_EXTENT_OFFSET_X_NOK, KOffsetX,
+                  EGL_TARGET_EXTENT_OFFSET_Y_NOK, KOffsetY,
+                  EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth,
+                  EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight,
+                  EGL_NONE};
+
+    // Create display object
+    GetDisplayL();
+    CreateEglSessionL();
+    iEglSess->InitializeL();
+
+    // Choose EGL config
+    EGLConfig matchingConfigs[KMaxEglConfigs];
+    EGLint numConfigs = 0;
+
+    // Query total number of configs
+    ASSERT_EGL_TRUE(eglGetConfigs(iDisplay, NULL, KMaxTInt, &numConfigs));
+    TESTL(numConfigs >= 1 && numConfigs <= KMaxEglConfigs);
+    INFO_PRINTF2(_L("Found %d configs"), numConfigs);
+
+    // Get the configs
+    ASSERT_EGL_TRUE(eglGetConfigs(iDisplay, matchingConfigs, KMaxEglConfigs, &numConfigs));
+
+    // Check if surface scaling is supported in the config, if so, create surface
+    for(TInt i=0; i<numConfigs; i++)
+        {
+		EGLint value = -32; // arbitraty value which is neither EGL_TRUE nor EGL_FALSE
+		ASSERT_EGL_TRUE(eglGetConfigAttrib(iDisplay, matchingConfigs[i], EGL_SURFACE_SCALING_NOK, &value));
+		if (value==EGL_TRUE)
+			{
+			INFO_PRINTF2(_L("Config %d supports surface scaling. Create a window surface..."), i);
+
+		    // Create the window surface and the egl context and make them current
+			EGLint renderableType = 0;
+			ASSERT_EGL_TRUE(eglGetConfigAttrib(iDisplay, matchingConfigs[i],  EGL_RENDERABLE_TYPE, &renderableType));
+			if (renderableType&EGL_OPENVG_BIT)
+				{
+				iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[i], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);
+				}
+			else if (renderableType&EGL_OPENGL_ES_BIT)
+				{
+				iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[i], iWindow, EFalse, EGL_OPENGL_ES_API, 1, attrib_list);
+				}
+			else
+				{
+				WARN_PRINTF2(_L("Config %d does not support either OPENVG or OPENGL_ES. Skip!"), i);
+				continue;
+				}
+
+		    // Check values are as expected
+	        CheckScalingAttributesL(KSurfaceWidth, KSurfaceHeight, KExtentWidth, KExtentHeight, KOffsetX, KOffsetY);
+
+	        // modify target extent atttributes
+	        // 1 - first check that this new extent is supported, should do as we're reducing it
+	        EGLint capability = -1; 	//arbitrary number beyond the existing range 
+	        EGLint newExtentWidth = KExtentWidth / 2;
+	    	EGLint newExtentHeight = KExtentHeight / 2;
+	        EGLint newOffsetX = KOffsetX * 2;
+	    	EGLint newOffsetY = KOffsetY * 2;
+	        ASSERT_EGL_TRUE(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, matchingConfigs[i], KSurfaceWidth, KSurfaceHeight, newExtentWidth, newExtentHeight, &capability));
+            TEST((capability == EGL_SUPPORTED_NOK) || (capability == EGL_SLOW_NOK));
+			// 2 - set new extent
+	        ASSERT_EGL_TRUE(iPfnEglSetSurfaceScalingNOK(iDisplay, iEglSess->Surface(), newOffsetX, newOffsetY, newExtentWidth, newExtentHeight));
+
+	        // Check attributes have changed
+	        CheckScalingAttributesL(KSurfaceWidth, KSurfaceHeight, newExtentWidth, newExtentHeight, newOffsetX, newOffsetY);
+
+			// Cleanup
+	        iEglSess->CleanupSurfaceAndContextL();
+			}
+        }
+    
+    // Cleanup
+    CloseWindow();
+    CleanAll();
+    
+    INFO_PRINTF1(_L("....CEglTest_SurfaceScalingSet::doTestStepL completed!"));
+    RecordTestResultL();
+    CloseTMSGraphicsStep();
+    return TestStepResult();
+	}
+
+/**
+@SYMTestCaseID GRAPHICS-EGL-0665
+
+@SYMTestPriority 1
+
+@SYMPREQ 2676
+
+@SYMREQ 417-56592
+
+@SYMTestCaseDesc
+Negative testing. Call eglSetSurfaceScalingNOK with invalid parameters 
+
+@SYMTestActions
+1. Set surface scaling with invalid display.
+2. Set surface scaling with negative target width.
+3. Set surface scaling with negative target height.
+3. Set surface scaling with zero target width.
+3. Set surface scaling with zero target height.
+@SYMTestExpectedResults
+1. Set surface scaling will fail with error code EGL_BAD_DISPLAY.   
+2. Set surface scaling will fail with error code EGL_BAD_PARAMETER.   
+3. Set surface scaling will fail with error code EGL_BAD_PARAMETER.   
+4. Set surface scaling will fail with error code EGL_BAD_PARAMETER.   
+5. Set surface scaling will fail with error code EGL_BAD_PARAMETER.   
+*/
+TVerdict CEglTest_SurfaceScalingSetInvalidAttributes::doTestStepL()
+    {
+    SetTestStepName(_L("GRAPHICS-EGL-0665"));
+    SetTestStepID(_L("GRAPHICS-EGL-0665"));
+    INFO_PRINTF1(_L("CEglTest_SurfaceScalingSetInvalidAttributes::doTestStepL"));
+
+    // Establish the connection to the window server and create
+    // a WindowGroup and a Window object
+    CreateAndActivateWindowL(TSize(100, 100));
+
+    // Create display object
+    GetDisplayL();
+    CreateEglSessionL();    // initialise EGL Session so we can make use of its helper objects
+    iEglSess->InitializeL();
+
+    // Choose EGL config
+    EGLConfig matchingConfigs[1];
+    EGLint numConfigs = 0;
+    ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
+    TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported
+
+    const TInt KWindowWidth = iWindow.Size().iWidth;
+    const TInt KWindowHeight = iWindow.Size().iHeight;
+    const TInt KSurfaceWidth = KWindowWidth/2;
+    const TInt KSurfaceHeight = KWindowHeight/2;
+    const TInt KExtentWidth = KWindowWidth;
+    const TInt KExtentHeight = KWindowHeight;
+    const EGLint KOffsetX = 11;
+    const EGLint KOffsetY = 13;
+    EGLint attrib_list[] = {
+                  EGL_FIXED_WIDTH_NOK, KSurfaceWidth,
+                  EGL_FIXED_HEIGHT_NOK, KSurfaceHeight,
+                  EGL_TARGET_EXTENT_OFFSET_X_NOK, KOffsetX,
+                  EGL_TARGET_EXTENT_OFFSET_Y_NOK, KOffsetY,
+                  EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth,
+                  EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight,
+                  EGL_NONE};
+
+    // Create the window surface and the egl context and make them current
+    iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);    
+
+    // Check all attributes
+    CheckScalingAttributesL(KSurfaceWidth, KSurfaceHeight, KExtentWidth, KExtentHeight, KOffsetX, KOffsetY);
+
+    for(TInt index = 0; index < 5; index++)
+        {
+		// new attribute values
+		EGLDisplay newDisplay = iDisplay;
+		EGLint newExtentWidth = KExtentWidth;
+		EGLint newExtentHeight = KExtentHeight;
+		EGLint newOffsetX = KOffsetX;
+		EGLint newOffsetY = KOffsetY;
+		// expected error value
+		EGLint error = EGL_BAD_PARAMETER;
+		
+		switch(index)
+            {
+        case 0:
+            // Invalid display - valid extent
+            newDisplay = newDisplay - 100;
+            error = EGL_BAD_DISPLAY;
+            break;
+        case 1:
+            // Valid display - Negative extent width
+        	newExtentWidth = -newExtentHeight;
+            break;
+        case 2:
+            // Valid display - Negative extent height
+        	newExtentHeight = -newExtentHeight;
+        	break;
+		case 3:
+			// Valid display - zero extent width
+			newExtentWidth = 0;
+			break;
+		case 4:
+			// Valid display - zero extent height
+			newExtentHeight = 0;
+			break;
+			}
+
+		TEST(EGL_FALSE == iPfnEglSetSurfaceScalingNOK(newDisplay, iEglSess->Surface(), newOffsetX, newOffsetY, newExtentWidth, newExtentHeight));
+		ASSERT_EGL_ERROR(error);
+
+		// attributes haven't changed
+	    CheckScalingAttributesL(KSurfaceWidth, KSurfaceHeight, KWindowWidth, KWindowHeight, KOffsetX, KOffsetY);
+        }
+    
+    // Cleanup
+    CleanAll();
+    CloseWindow();
+    
+    INFO_PRINTF1(_L("....CEglTest_SurfaceScalingSetInvalidAttributes::doTestStepL completed!"));
+    RecordTestResultL();
+    CloseTMSGraphicsStep();
+    return TestStepResult();
+    }
+
+/**
+@SYMTestCaseID GRAPHICS-EGL-0666
+
+@SYMTestPriority 1
+
+@SYMPREQ 2676
+
+@SYMREQ 417-56592
+
+@SYMTestCaseDesc
+Negative testing. Query scaling attributes in non-fixed size surfaces 
+
+@SYMTestActions
+1. Create a window surface from a non-fixed size surface
+2. Set surface scaling with valid target extent.
+3. Query scaling attributes
+4. Repeat step 2-3 for EGL window surface, pixmap and pbuffer surface
+
+@SYMTestExpectedResults
+2. Set surface scaling will fail with error code EGL_BAD_MATCH.
+3. Query scaling attributes does not fail, but values not updated
+*/
+TVerdict CEglTest_SurfaceScalingSetNonFixed::doTestStepL()
+    {
+    SetTestStepName(_L("GRAPHICS-EGL-0666"));
+    SetTestStepID(_L("GRAPHICS-EGL-0666"));
+    INFO_PRINTF1(_L("CEglTest_SurfaceScalingSetNonFixed::doTestStepL"));
+
+    // Establish the connection to the window server and create
+    // a WindowGroup and a Window object
+    CreateAndActivateWindowL(TSize(100, 100));
+
+    const TInt KWindowWidth = iWindow.Size().iWidth;
+    const TInt KWindowHeight = iWindow.Size().iHeight;
+    const TInt KSurfaceWidth = KWindowWidth;
+    const TInt KSurfaceHeight = KWindowHeight;
+
+    // Create display object
+    GetDisplayL();
+    CreateEglSessionL();    // initialise EGL Session so we can make use of its helper objects
+    iEglSess->InitializeL();
+
+    // Choose EGL config - Make sure it DOES NOT support surface scaling
+    EGLConfig matchingConfigs[1];
+    EGLint numConfigs = 0;
+    
+    // If all window surfaces in EGL are scalable, first case must be skipped. Others still valid
+    TInt index = iAllScalable ? 1 : 0;
+    for(; index < 3; index++)
+        {
+        switch(index)
+            {
+        case 0:
+            // Create the non-fixed size window surface and the egl context and make them current
+            INFO_PRINTF1(_L("Create the non-fixed size window surface and the egl context and make them current..."));
+            ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribs_NoScaling], matchingConfigs, 1, &numConfigs));
+            TESTL(numConfigs == 1);
+            iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow);    
+            break;
+        case 1:
+            // Create the pbuffer surface and the egl context and make them current
+            INFO_PRINTF1(_L("Create the pbuffer surface and the egl context and make them current..."));
+            ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPBufferAttribsColor16MU], matchingConfigs, 1, &numConfigs));
+            TESTL(numConfigs == 1);
+            iEglSess->CreatePbufferSurfaceAndMakeCurrentL(matchingConfigs[0], TSize(KSurfaceWidth, KSurfaceHeight));
+            break;
+        case 2:
+            // Create the pixmap surface and the egl context and make them current
+            INFO_PRINTF1(_L("Create the pixmap surface and the egl context and make them current..."));
+            ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[EPixmapAttribsColor16MU], matchingConfigs, 1, &numConfigs));
+            TESTL(numConfigs == 1);
+            iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(TSize(KSurfaceWidth, KSurfaceHeight), EColor16MU);
+            break;
+            }
+
+		// Check all attributes (this is a non-fixed size surface)  - 
+		// Note that we cannot use CheckScalingAttributesL because values are not updated
+		EGLint surfaceWidth = 0;
+		EGLint surfaceHeight = 0;
+		EGLint extentWidth = -1;	
+		EGLint extentHeight = -2;
+		EGLint offsetX = -3;
+		EGLint offsetY = -4;
+		ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_WIDTH, &surfaceWidth));
+		ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_HEIGHT, &surfaceHeight));
+		ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_WIDTH_NOK, &extentWidth));
+		ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_HEIGHT_NOK, &extentHeight));
+		ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_X_NOK, &offsetX));
+		ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_Y_NOK, &offsetY));
+		TEST((surfaceWidth == KWindowWidth) && (surfaceHeight == KWindowHeight));
+		// following values should not be modified (non fixed size window)
+		TEST((extentWidth == -1) && (extentHeight == -2));
+		TEST((offsetX == -3) && (offsetY == -4));
+	
+		// new attribute values
+		EGLint newExtentWidth = extentWidth / 2;
+		EGLint newExtentHeight = extentHeight / 2;
+		EGLint newOffsetX = offsetX * 2;
+		EGLint newOffsetY = offsetY * 2;
+	
+		// Valid parameters - But non fixed size surface
+		TEST(iPfnEglSetSurfaceScalingNOK(iDisplay, iEglSess->Surface(), newOffsetX, newOffsetY, newExtentWidth, newExtentHeight) == EGL_FALSE);
+		ASSERT_EGL_ERROR(EGL_BAD_MATCH);
+	
+		// attributes haven't changed
+		// Note that we cannot use CheckScalingAttributesL because values are not updated
+		ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_WIDTH, &surfaceWidth));
+		ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_HEIGHT, &surfaceHeight));
+		ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_WIDTH_NOK, &extentWidth));
+		ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_HEIGHT_NOK, &extentHeight));
+		ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_X_NOK, &offsetX));
+		ASSERT_EGL_TRUE(eglQuerySurface(iDisplay, iEglSess->Surface(), EGL_TARGET_EXTENT_OFFSET_Y_NOK, &offsetY));
+		TEST((surfaceWidth == KWindowWidth) && (surfaceHeight == KWindowHeight));
+		TEST((extentWidth == -1) && (extentHeight == -2));
+		TEST((offsetX == -3) && (offsetY == -4));
+	
+    	// destroy surface and context
+        iEglSess->CleanupSurfaceAndContextL();
+        }
+
+    // Cleanup
+    CleanAll();
+    CloseWindow();
+    
+    INFO_PRINTF1(_L("....CEglTest_SurfaceScalingSetNonFixed::doTestStepL completed!"));
+    RecordTestResultL();
+    CloseTMSGraphicsStep();
+    return TestStepResult();
+    }
+
+/**
+@SYMTestCaseID GRAPHICS-EGL-0667
+
+@SYMTestPriority 1
+
+@SYMPREQ 2676
+
+@SYMREQ 417-56592
+
+@SYMTestCaseDesc
+Negative testing. Calling extensions without initialising EGL
+
+@SYMTestActions
+Without initialising EGL
+1. Call query surface scaling capability
+2. Call set surface scaling
+
+@SYMTestExpectedResults
+1. Query scaling capability will fail with error code EGL_NOT_INITIALIZED.
+2. Set surface scaling will fail with error code EGL_NOT_INITIALIZED.
+*/
+TVerdict CEglTest_SurfaceScalingNotInitialized::doTestStepL()
+    {
+    SetTestStepName(_L("GRAPHICS-EGL-0667"));
+    SetTestStepID(_L("GRAPHICS-EGL-0667"));
+    INFO_PRINTF1(_L("CEglTest_SurfaceScalingNotInitialized::doTestStepL"));
+
+    // a WindowGroup and a Window object
+    CreateAndActivateWindowL(TSize(100, 100));
+
+    // Create display object
+    GetDisplayL();
+    CreateEglSessionL();    // initialise EGL Session so we can make use of its helper objects
+    iEglSess->InitializeL();
+
+    // Choose EGL config
+    EGLConfig matchingConfigs[1];
+    EGLint numConfigs = 0;
+    ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KScalingConfigAttribs[EWindowAttribsColor16MU_Scaling], matchingConfigs, 1, &numConfigs));
+    TESTL(numConfigs == 1); // Abort the test if the EGL config is not supported
+
+    const TInt KWindowWidth = iWindow.Size().iWidth;
+    const TInt KWindowHeight = iWindow.Size().iHeight;
+    const TInt KSurfaceWidth = KWindowWidth/2;
+    const TInt KSurfaceHeight = KWindowHeight/2;
+    const TInt KExtentWidth = KWindowWidth;
+    const TInt KExtentHeight = KWindowHeight;
+    const EGLint KOffsetX = 11;
+    const EGLint KOffsetY = 13;
+    EGLint attrib_list[] = {
+                  EGL_FIXED_WIDTH_NOK, KSurfaceWidth,
+                  EGL_FIXED_HEIGHT_NOK, KSurfaceHeight,
+                  EGL_TARGET_EXTENT_OFFSET_X_NOK, KOffsetX,
+                  EGL_TARGET_EXTENT_OFFSET_Y_NOK, KOffsetY,
+                  EGL_TARGET_EXTENT_WIDTH_NOK, KExtentWidth,
+                  EGL_TARGET_EXTENT_HEIGHT_NOK, KExtentHeight,
+                  EGL_NONE};
+
+    // Create the window surface and the egl context and make them current
+    iEglSess->CreateWindowSurfaceAndMakeCurrentL(matchingConfigs[0], iWindow, EFalse, EGL_OPENVG_API, 1, attrib_list);    
+
+    // First set new offset attributes (fairly simple, so should be supported)
+    INFO_PRINTF1(_L("Set new offset attributes - should succeed..."));
+    EGLint capability = -1; 	//arbitrary number beyond the existing range 
+    ASSERT_EGL_TRUE(iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, matchingConfigs[0], KSurfaceWidth, KSurfaceHeight, KExtentWidth, KExtentHeight, &capability));
+    TEST((capability == EGL_SUPPORTED_NOK) || (capability == EGL_SLOW_NOK));
+    ASSERT_EGL_TRUE(iPfnEglSetSurfaceScalingNOK(iDisplay, iEglSess->Surface(), KOffsetX+1, KOffsetY+1, KExtentWidth, KExtentHeight));
+    
+    // Terminate display and try again
+    INFO_PRINTF1(_L("Terminate display and try again, should fail now..."));
+    eglTerminate(iDisplay);
+
+    capability = -1; 	//arbitrary number beyond the existing range 
+    TEST(EGL_FALSE == iPfnEglQuerySurfaceScalingCapabilityNOK(iDisplay, matchingConfigs[0], KSurfaceWidth, KSurfaceHeight, KExtentWidth, KExtentHeight, &capability));
+    TEST(capability == -1); //make sure that value has not been modified
+    ASSERT_EGL_ERROR(EGL_NOT_INITIALIZED);
+    
+    TEST(EGL_FALSE == iPfnEglSetSurfaceScalingNOK(iDisplay, iEglSess->Surface(), KOffsetX, KOffsetY, KExtentWidth, KExtentHeight));
+    ASSERT_EGL_ERROR(EGL_NOT_INITIALIZED);
+    
+    // Cleanup
+    CleanAll();
+    CloseWindow();
+    
+    INFO_PRINTF1(_L("....CEglTest_SurfaceScalingNotInitialized::doTestStepL completed!"));
+    RecordTestResultL();
+    CloseTMSGraphicsStep();
+    return TestStepResult();
+    }
+
--- a/egl/egltest/src/egltestcommonsession.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/egl/egltest/src/egltestcommonsession.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -779,7 +779,7 @@
 	return ETrue;
 	}
 
-EXPORT_C void CTestEglSession::CreateWindowSurfaceAndMakeCurrentL(EGLConfig aConfig, RWindow& aWindow, TBool aVgAlphaFormatPre, EGLenum aBindAPI, TInt aRenderVersionNumber)
+EXPORT_C void CTestEglSession::CreateWindowSurfaceAndMakeCurrentL(EGLConfig aConfig, RWindow& aWindow, TBool aVgAlphaFormatPre, EGLenum aBindAPI, TInt aRenderVersionNumber, EGLint* aAttribList)
 	{
 	ASSERT_EQUALS(iSurface, EGL_NO_SURFACE);
 	ASSERT_EQUALS(iContext, EGL_NO_CONTEXT);
@@ -787,12 +787,16 @@
 	ASSERT_EGL_TRUE(eglBindAPI(aBindAPI));
 
 	// Create a Window surface from the native image
-	const EGLint* windowAttribs = (aVgAlphaFormatPre && aBindAPI == EGL_OPENVG_API) ? KPixmapAttribsVgAlphaFormatPre : KPixmapAttribsNone;
+	const EGLint* windowAttribs = aAttribList;
+    if(!windowAttribs)
+        {
+        windowAttribs = (aVgAlphaFormatPre && aBindAPI == EGL_OPENVG_API) ? KPixmapAttribsVgAlphaFormatPre : KPixmapAttribsNone;
+        }
 	iSurface = eglCreateWindowSurface(iDisplay, aConfig, &aWindow, windowAttribs);
 	ASSERT_EGL_TRUE(iSurface != EGL_NO_SURFACE);
 
 	// Create a context for drawing to/reading from the pixmap surface and make it current
-	const EGLint KAttribsListCtxNone[] = { EGL_NONE };;
+	const EGLint KAttribsListCtxNone[] = { EGL_NONE };
 	const EGLint KAttribsListCtxGles2[] = { EGL_CONTEXT_CLIENT_VERSION, aRenderVersionNumber, EGL_NONE };
 	const EGLint* attrib_list_ctx = (aBindAPI == EGL_OPENGL_ES_API && aRenderVersionNumber == 2) ? KAttribsListCtxGles2 : KAttribsListCtxNone;
 	iContext = eglCreateContext(iDisplay, aConfig, EGL_NO_CONTEXT, attrib_list_ctx);
@@ -930,7 +934,7 @@
 		}
 
 	// Create a context for drawing to/reading from the pixmap surface and make it current
-	const EGLint KAttribsListCtxNone[] = { EGL_NONE };;
+	const EGLint KAttribsListCtxNone[] = { EGL_NONE };
 	const EGLint KAttribsListCtxGles2[] = { EGL_CONTEXT_CLIENT_VERSION, aRenderVersionNumber, EGL_NONE };
 	const EGLint* attrib_list_ctx = (aBindAPI == EGL_OPENGL_ES_API && aRenderVersionNumber == 2) ? KAttribsListCtxGles2 : KAttribsListCtxNone;
 	iContext = eglCreateContext(iDisplay, aConfig, EGL_NO_CONTEXT, attrib_list_ctx);
@@ -1049,7 +1053,7 @@
 	ASSERT_EGL_TRUE(iSurface != EGL_NO_SURFACE);
 
 	// Create a context for drawing to/reading from the pixmap surface and make it current
-	const EGLint KAttribsListCtxNone[] = { EGL_NONE };;
+	const EGLint KAttribsListCtxNone[] = { EGL_NONE };
 	const EGLint KAttribsListCtxGles2[] = { EGL_CONTEXT_CLIENT_VERSION, aRenderVersionNumber, EGL_NONE };
 	const EGLint* attrib_list_ctx = (aBindAPI == EGL_OPENGL_ES_API && aRenderVersionNumber == 2) ? KAttribsListCtxGles2 : KAttribsListCtxNone;
 	iContext = eglCreateContext(iDisplay, config, EGL_NO_CONTEXT, attrib_list_ctx);
@@ -1080,7 +1084,7 @@
 	ASSERT_EGL_TRUE(iSurface != EGL_NO_SURFACE);
 
 	// Create a context for drawing to/reading from the pixmap surface and make it current
-	const EGLint KAttribsListCtxNone[] = { EGL_NONE };;
+	const EGLint KAttribsListCtxNone[] = { EGL_NONE };
 	const EGLint KAttribsListCtxGles2[] = { EGL_CONTEXT_CLIENT_VERSION, aRenderVersionNumber, EGL_NONE };
 	const EGLint* attrib_list_ctx = (aBindAPI == EGL_OPENGL_ES_API && aRenderVersionNumber == 2) ? KAttribsListCtxGles2 : KAttribsListCtxNone;
 	iContext = eglCreateContext(iDisplay, aConfig, EGL_NO_CONTEXT, attrib_list_ctx);
@@ -1716,7 +1720,7 @@
 			return EFalse;
 			}
 		}
-    if(aExtension & KEGL_NOK__private__signal_sync)
+    if(aExtension & KEGL_NOK__private__signal_sync || extensionName.Compare(KEglNokPrivateSignalSync)==0)
         {
         TBool bFoundExtensionEGL_NOK__private__signal_sync = FindExtensionStringL(EIsEGL,KEglNokPrivateSignalSync);
         if (!bFoundExtensionEGL_NOK__private__signal_sync)
@@ -1725,7 +1729,7 @@
             return EFalse;
             }
         }
-    if(aExtension & KEGL_NOKIA_swap_buffers)
+    if(aExtension & KEGL_NOKIA_swap_buffers || extensionName.Compare(KEglNokiaSwapBuffers)==0)
         {
         TBool bFoundExtensionEGL_NOKIA_swap_buffer = FindExtensionStringL(EIsEGL,KEglNokiaSwapBuffers);
         if (!bFoundExtensionEGL_NOKIA_swap_buffer)
@@ -1735,7 +1739,7 @@
             }
         }
 #ifndef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
-    if(aExtension & KEGL_SYMBIAN_image_preserved)
+    if(aExtension & KEGL_SYMBIAN_image_preserved || extensionName.Compare(KEglSymbianImagePreserved)
         {
         TBool bFoundExtensionEGL_SYMBIAN_image_preserved = FindExtensionStringL(EIsEGL,KEglSymbianImagePreserved);
         if (!bFoundExtensionEGL_SYMBIAN_image_preserved)
@@ -1745,7 +1749,24 @@
             }
         }
 #endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
-
+    if(aExtension & KEGL_NOK_image_endpoint || extensionName.Compare(KEglNokiaImageEndpoint)==0)
+        {
+        TBool bFoundExtensionEGL_NOK_image_endpoint = FindExtensionStringL(EIsEGL,KEglNokiaImageEndpoint);
+        if (!bFoundExtensionEGL_NOK_image_endpoint)
+            {
+            // The extension is not supported
+            return EFalse;
+            }
+        }
+    if(aExtension & KEGL_NOK_surface_scaling || extensionName.Compare(KEglNokiaSurfaceScaling)==0)
+        {
+        TBool bFoundExtensionEGL_NOK_surface_scaling = FindExtensionStringL(EIsEGL,KEglNokiaSurfaceScaling);
+        if (!bFoundExtensionEGL_NOK_surface_scaling)
+            {
+            // The extension is not supported
+            return EFalse;
+            }
+        }
 	return ETrue;
 	}
 
@@ -1840,7 +1861,6 @@
 	TBitmapUtil bmpUtil(bitmap);
 	bmpUtil.Begin(TPoint(0,0));
 	for (TInt colIndex = 0; colIndex < width; ++colIndex)
-
 		{
 		bmpUtil.SetPos(TPoint(colIndex, 0));
 		for (TInt rowIndex =0; rowIndex < height; ++rowIndex)
--- a/egl/egltest/src/eglteststep.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/egl/egltest/src/eglteststep.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2009-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"
@@ -34,6 +34,7 @@
 #include "egltest_oom_sgimage.h"
 #include "egltest_stress_sgimage.h"
 #include "egltest_benchmark_swapbuffers.h"
+#include "egltest_surfacescaling.h"
 
 /*
 Entry point from egltest to create test step
@@ -67,7 +68,7 @@
     else if (aStepName == KDisplay_OOM_ClientHeap_Initialize)                                       testStep = new CEglTest_Display_OOM_ClientHeap_Initialize;
 
 	// SyncObject tests excluding WaitFlush which requires OpenVG and OpenGL ES
-	else if (aStepName == KSyncObject_Positive_GetProcAddress)											testStep = new CEglTest_SyncObject_Positive_GetProcAddress;
+	else if (aStepName == KSyncObject_Positive_GetProcAddress)										testStep = new CEglTest_SyncObject_Positive_GetProcAddress;
 	else if (aStepName == KSyncObject_Positive_CreateDestroy)										testStep = new CEglTest_SyncObject_Positive_CreateDestroy;
 	else if (aStepName == KSyncObject_Positive_WaitSignal)											testStep = new CEglTest_SyncObject_Positive_WaitSignal;
 	else if (aStepName == KSyncObject_Positive_WaitSignal2)											testStep = new CEglTest_SyncObject_Positive_WaitSignal2;
@@ -160,14 +161,39 @@
 	// Benchmark - SwapBuffers
     else if (aStepName == KBenchmark_SwapBuffers)                                                   testStep = new CEglTest_Benchmark_SwapBuffers;
 
-	//OOM
+	//OOM - SgImage
     else if (aStepName == KOOM_CloseVGImageWithTermination)                                         testStep = new CEglTest_OOM_CloseVGImageWithTermination;
     else if (aStepName == KOOM_CloseVGImage)                                                        testStep = new CEglTest_OOM_CloseVGImage;
     else if (aStepName == KOOM_ClosePixmapSurfaceWithTermination)                                   testStep = new CEglTest_OOM_ClosePixmapSurfaceWithTermination;
-    else if (aStepName == KOOM_ClosePixmapSurface)                                                  testStep = new CEglTest_OOM_ClosePixmapSurface;	
+    else if (aStepName == KOOM_ClosePixmapSurface)                                                  testStep = new CEglTest_OOM_ClosePixmapSurface; 
+    else if (aStepName == KOOM_CloseSgImageDifferentProcess)                                        testStep = new CEglTest_OOM_CloseSgImageDifferentProcess; 
+    else if (aStepName == KOOM_CloseSgImageSameThread)                                              testStep = new CEglTest_OOM_CloseSgImageSameThread; 
 
-    //Stress
+    //Stress - SgImage
     else if (aStepName == KStress)                                                                  testStep = new CEglTest_Stress;
 
+    // Surface Scaling
+    else if (aStepName == KSurfaceScaling_Positive)                                                 testStep = new CEglTest_SurfaceScaling_Positive;
+    else if (aStepName == KSurfaceScaling_WindowResize)                                             testStep = new CEglTest_SurfaceScaling_WindowResize;
+    else if (aStepName == KSurfaceScaling_ExtentPositionChange)                                     testStep = new CEglTest_SurfaceScaling_ExtentPositionChange;
+    else if (aStepName == KSurfaceScaling_ExtentSizeChange)                                     	testStep = new CEglTest_SurfaceScaling_ExtentSizeChange;
+    else if (aStepName == KSurfaceScaling_SwapBuffers)                                     			testStep = new CEglTest_SurfaceScaling_SwapBuffers;
+    else if (aStepName == KSurfaceScaling_WindowSurface_Check)                                      testStep = new CEglTest_SurfaceScaling_WindowSurface_Check;
+	else if (aStepName == KSurfaceScaling_Negative_CreateWindowSurface)                             testStep = new CEglTest_SurfaceScaling_Negative_CreateWindowSurface;
+    else if (aStepName == KSurfaceScaling_Negative_FixedSize_NonWindowSurface)                      testStep = new CEglTest_SurfaceScaling_Negative_FixedSize_NonWindowSurface;
+    else if (aStepName == KSurfaceScalingDefaultBorderColor)                                        testStep = new CEglTest_SurfaceScalingDefaultBorderColor;
+    else if (aStepName == KSurfaceScalingModifyingBorderColor)                                      testStep = new CEglTest_SurfaceScalingModifyingBorderColor;
+    else if (aStepName == KSurfaceScalingModifyingBorderColorNonFixed)                          	testStep = new CEglTest_SurfaceScalingModifyingBorderColorNonFixed;
+    else if (aStepName == KSurfaceScalingModifyingInvalidBorderColor)                               testStep = new CEglTest_SurfaceScalingModifyingInvalidBorderColor;
+    else if (aStepName == KSurfaceScalingModifyingExtent)                                           testStep = new CEglTest_SurfaceScalingModifyingExtent;
+    else if (aStepName == KSurfaceScalingModifyingExtentNonFixed)                                   testStep = new CEglTest_SurfaceScalingModifyingExtentNonFixed;
+    else if (aStepName == KSurfaceScalingQuerySurface)                                              testStep = new CEglTest_SurfaceScalingQuerySurface;
+    else if (aStepName == KSurfaceScalingQuerySurfaceNonFixed)                                      testStep = new CEglTest_SurfaceScalingQuerySurfaceNonFixed;
+    else if (aStepName == KSurfaceScalingCapability)                                                testStep = new CEglTest_SurfaceScalingCapability;
+    else if (aStepName == KSurfaceScalingSet)                                                		testStep = new CEglTest_SurfaceScalingSet;
+    else if (aStepName == KSurfaceScalingSetNonFixed)                              					testStep = new CEglTest_SurfaceScalingSetNonFixed;
+    else if (aStepName == KSurfaceScalingSetInvalidAttributes)                                      testStep = new CEglTest_SurfaceScalingSetInvalidAttributes;
+    else if (aStepName == KSurfaceScalingNotInitialized)                                      		testStep = new CEglTest_SurfaceScalingNotInitialized;
+		
 	return testStep;
 	}
--- a/fbs/fontandbitmapserver/bwins/FBSCLI2U.DEF	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/bwins/FBSCLI2U.DEF	Tue Jul 20 13:27:44 2010 +0300
@@ -229,4 +229,19 @@
 	?CreateExtendedBitmap@CFbsBitmap@@QAEHABVTSize@@W4TDisplayMode@@VTUid@@PBXH@Z @ 228 NONAME ; int CFbsBitmap::CreateExtendedBitmap(class TSize const &, enum TDisplayMode, class TUid, void const *, int)
 	?UpdateLinkedTypeface@CFbsTypefaceStore@@QAEHABVCLinkedTypefaceSpecification@@@Z @ 229 NONAME ; int CFbsTypefaceStore::UpdateLinkedTypeface(class CLinkedTypefaceSpecification const &)
 	?GetExtraBuffer@CFbsBitmap@@SAPAVHBufC8@@H@Z @ 230 NONAME ; class HBufC8 * CFbsBitmap::GetExtraBuffer(int)
+	?Rect@RFbsGlyphDataIterator@@QBEABVTRect@@XZ @ 231 NONAME ; class TRect const & RFbsGlyphDataIterator::Rect(void) const
+	?Image@RFbsGlyphDataIterator@@QBEABVRSgImage@@XZ @ 232 NONAME ; class RSgImage const & RFbsGlyphDataIterator::Image(void) const
+	??0RFbsGlyphMetricsArray@@QAE@XZ @ 233 NONAME ; RFbsGlyphMetricsArray::RFbsGlyphMetricsArray(void)
+	?Count@RFbsGlyphMetricsArray@@QBEHXZ @ 234 NONAME ; int RFbsGlyphMetricsArray::Count(void) const
+	?Next@RFbsGlyphDataIterator@@QAEHXZ @ 235 NONAME ; int RFbsGlyphDataIterator::Next(void)
+	?Metrics@RFbsGlyphDataIterator@@QBEABVTOpenFontCharMetrics@@XZ @ 236 NONAME ; class TOpenFontCharMetrics const & RFbsGlyphDataIterator::Metrics(void) const
+	?Close@RFbsGlyphMetricsArray@@QAEXXZ @ 237 NONAME ; void RFbsGlyphMetricsArray::Close(void)
+	??0RFbsGlyphDataIterator@@QAE@XZ @ 238 NONAME ; RFbsGlyphDataIterator::RFbsGlyphDataIterator(void)
+	??ARFbsGlyphMetricsArray@@QBEABVTOpenFontCharMetrics@@H@Z @ 239 NONAME ; class TOpenFontCharMetrics const & RFbsGlyphMetricsArray::operator[](int) const
+	?GlyphCode@RFbsGlyphDataIterator@@QBEIXZ @ 240 NONAME ; unsigned int RFbsGlyphDataIterator::GlyphCode(void) const
+	?Close@RFbsGlyphDataIterator@@QAEXXZ @ 241 NONAME ; void RFbsGlyphDataIterator::Close(void)
+	?Get@RFbsGlyphMetricsArray@@QAEHAAVCFbsFont@@PBIH@Z @ 242 NONAME ; int RFbsGlyphMetricsArray::Get(class CFbsFont &, unsigned int const *, int)
+	?Open@RFbsGlyphDataIterator@@QAEHAAVCFbsFont@@PBIH@Z @ 243 NONAME ; int RFbsGlyphDataIterator::Open(class CFbsFont &, unsigned int const *, int)
+	?GetGlyphCacheMetrics@RFbsSession@@QAEHAAVTGlyphCacheMetrics@@@Z @ 244 NONAME ; int RFbsSession::GetGlyphCacheMetrics(class TGlyphCacheMetrics &)
+	?ConveyOogmMessage@RFbsSession@@QAEHAAVTFbsOogmMessage@@@Z @ 245 NONAME ; int RFbsSession::ConveyOogmMessage(class TFbsOogmMessage &)
 
--- a/fbs/fontandbitmapserver/bwins/fbservu.def	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/bwins/fbservu.def	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,5 @@
 EXPORTS
 	?KFbServSharedHeapMaxSize@@3HB @ 1 NONAME ; int const KFbServSharedHeapMaxSize
 	?KFbServWritableDataPagingMode@@3HB @ 2 NONAME ; int const KFbServWritableDataPagingMode
+	?KFbServGlyphAtlasCacheLimit@@3HB @ 3 NONAME ; int const KFbServGlyphAtlasCacheLimit
 
--- a/fbs/fontandbitmapserver/eabi/FBSCLI2U.DEF	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/eabi/FBSCLI2U.DEF	Tue Jul 20 13:27:44 2010 +0300
@@ -264,4 +264,21 @@
 	_ZNK10CFbsBitmap8DataSizeEv @ 263 NONAME
 	_ZN17CFbsTypefaceStore20UpdateLinkedTypefaceERK28CLinkedTypefaceSpecification @ 264 NONAME
 	_ZN10CFbsBitmap14GetExtraBufferEi @ 265 NONAME
+	_ZN21RFbsGlyphDataIterator4NextEv @ 266 NONAME
+	_ZN21RFbsGlyphDataIterator4OpenER8CFbsFontPKji @ 267 NONAME
+	_ZN21RFbsGlyphDataIterator5CloseEv @ 268 NONAME
+	_ZN21RFbsGlyphDataIteratorC1Ev @ 269 NONAME
+	_ZN21RFbsGlyphDataIteratorC2Ev @ 270 NONAME
+	_ZN21RFbsGlyphMetricsArray3GetER8CFbsFontPKji @ 271 NONAME
+	_ZN21RFbsGlyphMetricsArray5CloseEv @ 272 NONAME
+	_ZN21RFbsGlyphMetricsArrayC1Ev @ 273 NONAME
+	_ZN21RFbsGlyphMetricsArrayC2Ev @ 274 NONAME
+	_ZNK21RFbsGlyphDataIterator4RectEv @ 275 NONAME
+	_ZNK21RFbsGlyphDataIterator5ImageEv @ 276 NONAME
+	_ZNK21RFbsGlyphDataIterator7MetricsEv @ 277 NONAME
+	_ZNK21RFbsGlyphDataIterator9GlyphCodeEv @ 278 NONAME
+	_ZNK21RFbsGlyphMetricsArray5CountEv @ 279 NONAME
+	_ZNK21RFbsGlyphMetricsArrayixEi @ 280 NONAME
+	_ZN11RFbsSession20GetGlyphCacheMetricsER18TGlyphCacheMetrics @ 281 NONAME
+	_ZN11RFbsSession17ConveyOogmMessageER15TFbsOogmMessage @ 282 NONAME
 
--- a/fbs/fontandbitmapserver/eabi/fbservu.def	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/eabi/fbservu.def	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,5 @@
 EXPORTS
 	KFbServSharedHeapMaxSize @ 1 NONAME DATA 4
 	KFbServWritableDataPagingMode @ 2 NONAME DATA 4
+	KFbServGlyphAtlasCacheLimit @ 3 NONAME DATA 4
 
--- a/fbs/fontandbitmapserver/group/FBSCLI.MMP	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/group/FBSCLI.MMP	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-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"
@@ -28,8 +28,9 @@
 SOURCEPATH      ../sfbs
 
 userinclude     ../inc
-userinclude		../../../../textandloc/fontservices/fontstore/src
+userinclude     ../traces
 
+OS_LAYER_SYSTEMINCLUDE
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 source          BITBMP.CPP
@@ -47,6 +48,8 @@
 source          ShiftedFileStore.cpp
 source          BitmapCompr.cpp
 source          patchableconstantscli.cpp
+source          fbsglyphdataiterator.cpp
+source          fbsglyphmetricsarray.cpp
 
 library         euser.lib
 library         efsrv.lib
@@ -57,6 +60,7 @@
 library         palette.lib
 library         lookuptable.lib
 library         hal.lib
+library         sgresource.lib
 #if !defined(WINS)
 library         fbsrasterizer.lib
 #endif
--- a/fbs/fontandbitmapserver/group/FBSERV.MMP	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/group/FBSERV.MMP	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-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"
@@ -35,7 +35,9 @@
 
 userinclude     ../inc
 userinclude     ../sfbs
+userinclude     ../traces
 
+OS_LAYER_SYSTEMINCLUDE
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 OS_LAYER_ESTLIB_SYSTEMINCLUDE
 
@@ -49,7 +51,8 @@
 source          FBSMBMC.CPP
 source          ShiftedFileStore.cpp
 source          HASHMAP.CPP
-source			patchableconstants.cpp
+source		patchableconstants.cpp
+source          glyphatlas.cpp
 
 library         euser.lib
 library         efsrv.lib
@@ -59,6 +62,7 @@
 library         estor.lib
 library         ecom.lib
 library         hal.lib
+library         sgresource.lib
 
 start wins
 baseaddress     0x41500000
--- a/fbs/fontandbitmapserver/group/FbservTest.iby	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/group/FbservTest.iby	Tue Jul 20 13:27:44 2010 +0300
@@ -19,36 +19,44 @@
 #define __FBSERVTEST_IBY__
 
 #include <graphics_testharness.iby>
-#include <internaltestfonts.iby>  
+#include <internaltestfonts.iby>
+#include <egl.iby>
+#include <openvg.iby>
 
 // batch file that runs all automatic fbserv tests
 data=DATAZ_\fbstest\fbstest_run.bat		\fbstest_run.bat
 data=DATAZ_\fbstest\fbstest.bat			\fbstest.bat
 
 //script files
-data=DATAZ_\fbstest\fbstest_T_All.script						\fbstest\fbstest_T_All.script
-data=DATAZ_\fbstest\fbstest_T_Alloc.script						\fbstest\fbstest_T_Alloc.script
+data=DATAZ_\fbstest\fbstest_T_All.script					\fbstest\fbstest_T_All.script
+data=DATAZ_\fbstest\fbstest_T_Alloc.script					\fbstest\fbstest_T_Alloc.script
 data=DATAZ_\fbstest\fbstest_T_Alloc.ini						\fbstest\fbstest_T_Alloc.ini
-data=DATAZ_\fbstest\fbstest_T_Bitmap.script						\fbstest\fbstest_T_Bitmap.script
-data=DATAZ_\fbstest\fbstest_T_Fbs.script						\fbstest\fbstest_T_Fbs.script
+data=DATAZ_\fbstest\fbstest_T_Bitmap.script					\fbstest\fbstest_T_Bitmap.script
+data=DATAZ_\fbstest\fbstest_T_Fbs.script					\fbstest\fbstest_T_Fbs.script
 data=DATAZ_\fbstest\fbstest_T_Compressed.script					\fbstest\fbstest_T_Compressed.script
-data=DATAZ_\fbstest\fbstest_T_Ralc.script						\fbstest\fbstest_T_Ralc.script
-data=DATAZ_\fbstest\fbstest_T_Defect.script						\fbstest\fbstest_T_Defect.script
+data=DATAZ_\fbstest\fbstest_T_Ralc.script					\fbstest\fbstest_T_Ralc.script
+data=DATAZ_\fbstest\fbstest_T_Defect.script					\fbstest\fbstest_T_Defect.script
 data=DATAZ_\fbstest\fbstest_T_StreamIdCache.script				\fbstest\fbstest_T_StreamIdCache.script
-data=DATAZ_\fbstest\fbstest_T_Secure.script						\fbstest\fbstest_T_Secure.script
-data=DATAZ_\fbstest\fbstest_T_File.script						\fbstest\fbstest_T_File.script
-data=DATAZ_\fbstest\fbstest_t_getallbitmapscapability.script	\fbstest\fbstest_t_getallbitmapscapability.script
-data=DATAZ_\fbstest\fbstest_T_Clean.script						\fbstest\fbstest_T_Clean.script
+data=DATAZ_\fbstest\fbstest_T_Secure.script					\fbstest\fbstest_T_Secure.script
+data=DATAZ_\fbstest\fbstest_T_File.script					\fbstest\fbstest_T_File.script
+data=DATAZ_\fbstest\fbstest_t_getallbitmapscapability.script			\fbstest\fbstest_t_getallbitmapscapability.script
+data=DATAZ_\fbstest\fbstest_T_Clean.script					\fbstest\fbstest_T_Clean.script
 data=DATAZ_\fbstest\fbstest_t_fonttable.script					\fbstest\fbstest_t_fonttable.script
 data=DATAZ_\fbstest\fbstest_T_IPCTest.script					\fbstest\fbstest_T_IPCTest.script
-data=DATAZ_\fbstest\ipctest_config.ini							\fbstest\ipctest_config.ini
+data=DATAZ_\fbstest\ipctest_config.ini						\fbstest\ipctest_config.ini
 data=DATAZ_\fbstest\fbstest_t_extendedbitmap.script				\fbstest\fbstest_t_extendedbitmap.script
 data=DATAZ_\fbstest\extendedbitmap_config.ini					\fbstest\extendedbitmap_config.ini
 data=DATAZ_\fbstest\fbstest_T_WDP_pagedata.script				\fbstest\fbstest_T_WDP_pagedata.script
 data=DATAZ_\fbstest\fbstest_T_WDP_unpagedata.script				\fbstest\fbstest_T_WDP_unpagedata.script
-data=DATAZ_\fbstest\fbstest_T_WDP_page_bitmap_data_only.script	\fbstest\fbstest_T_WDP_page_bitmap_data_only.script
-data=DATAZ_\fbstest\fbstest_T_WDP_page_bitmap_data_and_shared_heap_only.script		\fbstest\fbstest_T_WDP_page_bitmap_data_and_shared_heap_only.script
-data=DATAZ_\fbstest\wdptest_config.ini						    \fbstest\wdptest_config.ini
+data=DATAZ_\fbstest\fbstest_T_WDP_page_bitmap_data_only.script			\fbstest\fbstest_T_WDP_page_bitmap_data_only.script
+data=DATAZ_\fbstest\fbstest_t_oogm.script					\fbstest\fbstest_t_oogm.script
+data=DATAZ_\fbstest\fbstest_T_WDP_page_bitmap_data_and_shared_heap_only.script	\fbstest\fbstest_T_WDP_page_bitmap_data_and_shared_heap_only.script
+data=DATAZ_\fbstest\wdptest_config.ini						\fbstest\wdptest_config.ini
+
+REM GPU Glyph caching tests
+data=DATAZ_\fbstest\fbstest_t_glyphdata.script		\fbstest\fbstest_t_glyphdata.script
+data=DATAZ_\fbstest\glyphdata_config.ini					\fbstest\glyphdata_config.ini
+data=DATAZ_\fbstest\fbstest_t_glyphdataoutlineshadow.script		\fbstest\fbstest_t_glyphdataoutlineshadow.script
 
 // Fbserv WDP Alloc stress test
 data=DATAZ_\fbstest\fbstest_T_WDP_Alloc_Stress.script				\fbstest\fbstest_T_WDP_Alloc_Stress.script
--- a/fbs/fontandbitmapserver/group/TFbsServer.mmp	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/group/TFbsServer.mmp	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-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"
@@ -27,14 +27,15 @@
 
 CAPABILITY       All -Tcb -AllFiles
 
-userinclude		../../../graphicstest/graphicstestharness/inc
-userinclude		../tfbs ../sfbs ../inc 
+userinclude		../tfbs 
+userinclude		../sfbs 
+userinclude		../inc 
 userinclude		../trasterizer/src
+userinclude		../traces
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 OS_LAYER_ESTLIB_SYSTEMINCLUDE
 
-SOURCEPATH  .
 SOURCEPATH  ../tfbs
 SOURCE		TFbsServer.cpp
 SOURCE		TALLOC.CPP
@@ -56,12 +57,19 @@
 SOURCE 		textendedbitmappanic.cpp
 SOURCE 		twdp.cpp
 SOURCE		tfonttableandglyph.cpp
+SOURCE  	tfbsglyphdata.cpp
+SOURCE 		tfbsglyphdatapanic.cpp 
+SOURCE 		tfbsglyphdataoutlineshadow.cpp
+SOURCE  	tglyphatlas.cpp
+SOURCE		tfbsoogm.cpp
+SOURCE  	glyphatlastestwrapper.cpp
 
 
 SOURCEPATH		../sfbs
 SOURCE			FbsRalc.cpp
 SOURCE			FBSMBMC.CPP
 SOURCE			ShiftedFileStore.cpp
+SOURCE			glyphatlas.cpp
 
 
 LIBRARY			euser.lib
@@ -78,6 +86,9 @@
 LIBRARY	    	testexecutelogclient.lib
 library			lookuptable.lib
 LIBRARY			hal.lib
+LIBRARY			sgresource.lib
+LIBRARY			libEGL.lib
+LIBRARY			libOpenVG.lib
 
 #if defined(WINS)
 LIBRARY			fontinjector.lib
@@ -87,3 +98,5 @@
 EPOCSTACKSIZE	0xf000
 
 SMPSAFE
+
+
--- a/fbs/fontandbitmapserver/group/bld.inf	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/group/bld.inf	Tue Jul 20 13:27:44 2010 +0300
@@ -34,13 +34,18 @@
 ../inc/fbsrasterizerclearcache.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/fbsrasterizerclearcache.h)
 ../inc/bitmapuid.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/bitmapuid.h)
 ../inc/fbsdefs.h    SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(graphics/fbsdefs.h)
+../sfbs/fbsglyphdataiterator.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/fbsglyphdataiterator.h)
+../sfbs/fbsglyphmetricsarray.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/fbsglyphmetricsarray.h)
+../sfbs/fbsoogmmessage.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/fbsoogmmessage.h)
+../sfbs/fbsoogmmessage.inl SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/fbsoogmmessage.inl)
+
 
 ../bwins/fbsrasterizeru.def /epoc32/include/graphics/def/bwins/fbsrasterizeru.def
 ../eabi/fbsrasterizeru.def /epoc32/include/graphics/def/eabi/fbsrasterizeru.def
 
 ../group/fbserv.iby        	/epoc32/rom/include/fbserv.iby
 ../group/fbsrasterizer_stub.iby	/epoc32/rom/include/fbsrasterizer_stub.iby
-
+../group/fbsoogmplugin.iby	/epoc32/rom/include/fbsoogmplugin.iby
 
 PRJ_MMPFILES
 
@@ -48,6 +53,7 @@
 ../group/FBSERV.MMP
 ../group/fbsrasterizerlib.mmp
 ../group/stubrasterizer.mmp
+//../group/fbsoogmplugin.mmp
 
 PRJ_TESTEXPORTS
 
@@ -84,6 +90,11 @@
 ../tfbs/scripts/fbstest_T_WDP_page_bitmap_data_and_shared_heap_only.script	z:/fbstest/fbstest_t_wdp_page_bitmap_data_and_shared_heap_only.script
 ../tfbs/scripts/extendedbitmap_config.ini						z:/fbstest/extendedbitmap_config.ini
 ../tfbs/scripts/wdptest_config.ini								z:/fbstest/wdptest_config.ini
+../tfbs/scripts/fbstest_t_glyphdata.script						z:/fbstest/fbstest_t_glyphdata.script
+../tfbs/scripts/glyphdata_config.ini						z:/fbstest/glyphdata_config.ini
+../tfbs/scripts/fbstest_t_glyphdataoutlineshadow.script				z:/fbstest/fbstest_t_glyphdataoutlineshadow.script
+../tfbs/scripts/fbstest_t_oogm.script						z:/fbstest/fbstest_t_oogm.script
+
 
 // Fbserv WDP Alloc stress test
 ../tfbs/scripts/fbstest_T_WDP_Alloc_Stress.script			z:/fbstest/fbstest_t_wdp_alloc_stress.script
--- a/fbs/fontandbitmapserver/group/fbserv.iby	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/group/fbserv.iby	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-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"
@@ -47,8 +47,8 @@
 		#define FBSERV_PAGEDDATA_CONFIG unpageddata
 	#endif
 
-	file=ABI_DIR\BUILD_DIR\fbserv_fmm.exe 	\sys\bin\fbserv.exe	FBSERV_PAGEDDATA_CONFIG
-	file=ABI_DIR\BUILD_DIR\fbscli_fmm.dll 	\sys\bin\fbscli.dll
+	file=ABI_DIR\BUILD_DIR\fbserv.exe 	\sys\bin\fbserv.exe	FBSERV_PAGEDDATA_CONFIG
+	file=ABI_DIR\BUILD_DIR\fbscli.dll 	\sys\bin\fbscli.dll
 #else
 	file=ABI_DIR\DEBUG_DIR\fbserv.exe 	sys\bin\fbserv.exe
 	file=ABI_DIR\DEBUG_DIR\fbscli.dll 	sys\bin\fbscli.dll
@@ -58,4 +58,6 @@
 #include <graphics_adaptation.hby>
 #include FBSRASTERIZER_DRV
 
+//#include <fbsoogmplugin.iby>
+
 #endif //__FBSERV_IBY__
--- a/fbs/fontandbitmapserver/group/fbservtest_helium.pkg	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/group/fbservtest_helium.pkg	Tue Jul 20 13:27:44 2010 +0300
@@ -49,4 +49,7 @@
 "\epoc32\data\z\fbstest\ipctest_config.ini"-"c:\fbstest\ipctest_config.ini"
 "\epoc32\data\z\fbstest\fbstest_t_extendedbitmap.script"-"c:\fbstest\fbstest_t_extendedbitmap.script"
 "\epoc32\data\z\fbstest\extendedbitmap_config.ini"-"c:\fbstest\extendedbitmap_config.ini"
+"\epoc32\data\z\fbstest\fbstest_t_glyphdata.script"-"c:\fbstest\fbstest_t_glyphdata.script"
+"\epoc32\data\z\fbstest\glyphdata_config.ini"-"c:\fbstest\glyphdata_config.ini"
+"\epoc32\data\z\fbstest\fbstest_t_glyphdataoutlineshadow.script"-"c:\fbstest\fbstest_t_glyphdataoutlineshadow.script"
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/group/fbsoogmplugin.iby	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 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 __FBSOOGMPLUGIN_IBY__
+#define __FBSOOGMPLUGIN_IBY__
+
+ECOM_PLUGIN(fbsoogmplugin.dll, fbsoogmplugin.rsc)
+
+#endif // __FBSOOGMPLUGIN_IBY__
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/group/fbsoogmplugin.mmp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 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:  This is the .mmp for building font and bitmap server  out-of-graphics-memory Plugin
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+
+TARGET      		fbsoogmplugin.dll
+TARGETTYPE 		PLUGIN
+UID			0x10009d8d 0x2002B638
+
+CAPABILITY  		CAP_ECOM_PLUGIN 
+VENDORID    		0x70000001
+
+// This is a SYSTEMINCLUDE macro containing the middleware
+// layer specific include directories
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE		.
+USERINCLUDE		../inc
+USERINCLUDE		../sfbs 
+USERINCLUDE		../traces
+
+TARGETPATH		 /sys/bin  
+SOURCEPATH		../sfbs
+
+SOURCE			fbsoogmplugin.cpp
+
+START RESOURCE		fbsoogmplugin.rss
+TARGET			fbsoogmplugin.rsc
+END
+
+LIBRARY			ecom.lib
+LIBRARY			euser.lib
+LIBRARY			goommonitor.lib
+LIBRARY			fbscli.lib
+
--- a/fbs/fontandbitmapserver/inc/FBS.H	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/inc/FBS.H	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1995-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"
@@ -40,6 +40,15 @@
 */
 #define SYMBIAN_FBSERV_V2
 
+/**
+Indicates version of FBS that provides the CFbsFont extension 
+interfaces RFbsGlyphDataIterator for using hardware glyphs, and
+RFbsGlyphMetricsArray.
+@publishedAll
+@prototype
+*/
+//#define SYMBIAN_FBSERV_GLYPHDATA
+
 /** 
 Character width and adjustment information. 
 @publishedAll
@@ -61,6 +70,8 @@
 class CFbsRalCache;
 class CFbsSessionHelper;
 class CFbsRasterizer;
+class TGlyphCacheMetrics;
+class TFbsOogmMessage;
 
 /** 
 A session with the font and bitmap server. 
@@ -101,6 +112,9 @@
 	HBufC8* GetDecompressionBuffer(TInt aSize);
 	HBufC8* GetExtraBuffer(TInt aSize);
     TInt ServerSessionHandle() const;
+    IMPORT_C TInt GetGlyphCacheMetrics(TGlyphCacheMetrics& aGlyphCacheMetrics);
+    IMPORT_C TInt ConveyOogmMessage( TFbsOogmMessage& aOogmMessage );
+
 public:
 	/** WARNING: For internal use ONLY.  Compatibility is not guaranteed in future releases.	 
 	Used for testing server side out of memory failures.	
@@ -149,6 +163,8 @@
 class CFbsFont: public CFont
 	{
 	friend class CFbsTypefaceStore;
+	friend class RFbsGlyphDataIterator;
+	friend class RFbsGlyphMetricsArray;
 
 private:
 	// From CFont
@@ -208,7 +224,7 @@
 	RFbsSession* iFbs;
 	CBitmapFont* iAddressPointer;
 	TInt iHandle;
-	TInt iServerHandle;
+    TInt iServerHandle;
 	};
 
 /**
@@ -505,4 +521,22 @@
 	CDitherColor256* iDither;
 	};
 
-#endif
+
+/**
+ A class encapsulating the current state of the glyph cache.
+
+ @publishedAll
+ @released
+*/
+class TGlyphCacheMetrics
+    {
+public:
+    TInt iMaxCacheSizeInBytes;
+    TInt iMaxCacheSizeHigh;
+    TInt iMaxCacheSizeLow;
+    TInt iCacheSizeInBytes;
+    TBool iGpuCacheSizeLimitIsMax;
+    };
+
+#endif // __FBS_H__
+
--- a/fbs/fontandbitmapserver/inc/FbsMessage.H	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/inc/FbsMessage.H	Tue Jul 20 13:27:44 2010 +0300
@@ -74,7 +74,7 @@
 	EFbsMessSetHeapReset, //for memory testing only
 	EFbsMessSetHeapCheck, //for memory testing only
 	EFbsMessHeap, //for memory testing only
-	EFbsMessUnused2, //to put a character in the linked fonts cache
+	EFbsMessUnused2, //Implementation removed
 	EFbsMessBitmapClean, // replace a dirty bitmap with the clean one
 	EFbsMessBitmapLoadFast, // for loading bitmap from mbm or rsc file not opened by the client
 	EFbsMessBitmapNotifyDirty, // notify when any bitmap becomes dirty
@@ -87,6 +87,13 @@
 	EFbsMessReleaseFontTable,
 	EFbsMessGetGlyphOutline,
 	EFbsMessReleaseGlyphOutline,
+	EFbsMessGetGlyphs, // Retrieve rasterised glyphs from glyph atlas and closes last glyph retrieved
+	EFbsMessNoOp, // No-op call; used to ensure that the RSgImage of the last glyph retrieved from glyph atlas has been closed
+	EFbsMessGetGlyphMetrics, // Retrieve metrics of multiple glyph codes in one message
+	EFbsMessAtlasFontCount, // (Debug-only) Retrieve the number of fonts with glyphs in the H/W Glyph cache
+	EFbsMessAtlasGlyphCount, // (Debug-only) Retrieve the number of glyphs (optionally, given a specific font) stored in the H/W Glyph cache
+	EFbsMessOogmNotification, // An action requested by the GOoM framework. Reduce or re-instate graphics memory usage.
+	EFbsMessGetGlyphCacheMetrics, // Retrieve the glyph-cache size, its maximum limit and whether the maximum is the reduced value used in OoGm situations.
 	// If you are adding new messages don't forget to check that the 
 	// security permissions are set correctly (KRanges & KElementsIndex in server.cpp)
 	};
--- a/fbs/fontandbitmapserver/sfbs/FBSCLI.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/sfbs/FBSCLI.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -16,11 +16,20 @@
 #include <fntstore.h>
 #include <bitmap.h>
 #include <openfont.h>
+#include <graphics/fbsoogmmessage.h>
 #include "FbsMessage.H"
 #include "SERVER.H"
 #include "BackGroundCompression.h"
 #include <shapeinfo.h>
 #include <graphics/shaperparams.h>
+#include "glyphatlas.h"
+
+
+/**
+Bitwise mask that sets the MSB to indicate to a font rasterizer
+that a code is a glyphcode and not a character code
+*/
+const TUint32 KTreatAsGlyphCodeFlag = 1UL << 31;
 
 /** Helper function for converting a pointer to an offset from the passed
 heap base. Use OffsetToPointer() to convert the returned offset back to a
@@ -33,11 +42,12 @@
  */
 LOCAL_C TInt PointerToOffset(const TAny* aAny, TInt aHeapBase)
 	{
+	TInt offset = 0;
 	if (aAny && aHeapBase)
 		{
-		return reinterpret_cast<TInt>(aAny) - aHeapBase;
+		offset = reinterpret_cast<TInt>(aAny) - aHeapBase;
 		}
-	return 0;
+	return offset;
 	}
 
 /** Helper function for converting an offset (that was calculated using
@@ -58,9 +68,6 @@
 
 CFbClient::CFbClient(RHeap* aHeap):
 	CSession2(),
-	iConnectionHandle(0),
-	iIx(NULL),
-	iResourceCount(0),
 	iHeap(aHeap)
 #ifdef _DEBUG
 	,iOwnHeapFailNumber(-1),
@@ -71,14 +78,24 @@
 
 CFbClient* CFbClient::NewL(RHeap* aHeap)
 	{
-	CFbClient* c = new(ELeave) CFbClient(aHeap);
-	c->iOpenFontGlyphData = TOpenFontGlyphData::New(aHeap,4 * 1024);
-	if (!c->iOpenFontGlyphData)
+	CFbClient* self = new (ELeave) CFbClient(aHeap);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(); // self;
+	return self;
+	}
+
+/**
+Two-phase constructor.
+@leave KErrNoMemory if TOpenFontGlyphData construction failed.
+*/
+void CFbClient::ConstructL()
+	{
+	iOpenFontGlyphData = TOpenFontGlyphData::New(iHeap, 4 * 1024);
+	if (!iOpenFontGlyphData)
 		{
-		delete c;
 		User::Leave(KErrNoMemory);
 		}
-	return c;
 	}
 
 CFbClient::~CFbClient()
@@ -103,24 +120,32 @@
 		iHeap->Free(iOpenFontGlyphData);
 		}
 	
-	// delete fonts hold by the client
+	// delete fonts held by the client
 	delete iIx;
 	
-	// delete font files hold by the client
+	// delete font files held by the client
 	if (iFontFileIndex)
 		{
 		TInt count = iFontFileIndex->Count();
 		for (TInt index = 0;index < count; index++)
 			{
 			if (font_store)
+				{
 				font_store->RemoveFile(iFontFileIndex->At(0).iUid);
+				}
 			iFontFileIndex->Delete(0);
 			}
 		delete iFontFileIndex;
 		}
 
-	// Close the buffer used to hold the text thats needs shaping.
+	// Close the buffer used to hold the text that needs shaping.
 	iTextToShape.Close();
+
+	for (TInt i = iGlyphImagesInTransit.Count() - 1; i >= 0; --i)
+		{
+		iGlyphImagesInTransit[i].Close();
+		}
+	iGlyphImagesInTransit.Close();
 	}
 
 void CFbClient::Init(TUint aConnectionHandle)
@@ -143,9 +168,13 @@
 	{
 	CFontBitmapServer* server = FontBitmapServer();
 	if (server)
+		{
 		return server->TopLevelStore();
+		}
 	else
+		{
 		return NULL;
+		}
 	}
 
 void CFbClient::CopyFontInfo(CFontObject* aFontObjPtr,TInt aHandle,TFontInfo& aFontInfo)
@@ -158,6 +187,7 @@
 
 void CFbClient::ServiceL(const RMessage2& aMessage)
 	{
+
 #ifdef _DEBUG
 	TBool resetOwnHeap=EFalse;
 	TBool resetSharedHeap=EFalse;
@@ -189,6 +219,14 @@
 		__RHEAP_MARK(iHeap);
 		}		
 #endif		
+	//Call close on RSgImage handles being used to share glyph data with clients.
+	//The glyph images are held open to prevent the GlyphAtlas from closing them
+	//before a client can use them.
+	for (TInt i = iGlyphImagesInTransit.Count() - 1; i >= 0; --i)
+		{
+		iGlyphImagesInTransit[i].Close();
+		iGlyphImagesInTransit.Remove(i);
+		}
 	
 	switch(aMessage.Function())
 		{
@@ -246,6 +284,7 @@
 	case EFbsMessFetchLinkedTypeface:
 	case EFbsMessRegisterLinkedTypeface:
 	case EFbsMessUpdateLinkedTypeface:
+
 #ifdef _DEBUG
 		FontBitmapServer()->ProcMessage(aMessage,iSessionHandle,iRet);
 #else
@@ -277,6 +316,8 @@
 #if (_DEBUG)
 	case EFbsMessSetDuplicateFail:
 #endif
+	case EFbsMessGetGlyphs:
+	case EFbsMessGetGlyphMetrics:
 		ProcFontMessage(aMessage);
 		break;
 // bitmap messages
@@ -305,6 +346,31 @@
 		aMessage.Complete(KErrNone);
 #endif	
 		break;
+// Glyph Atlas messages (debug-only)
+	case EFbsMessAtlasFontCount:
+	case EFbsMessAtlasGlyphCount:
+#ifdef _DEBUG
+		ProcAtlasMessage(aMessage);
+#else
+		aMessage.Complete(KErrNotSupported);
+#endif
+		break;
+    case EFbsMessOogmNotification:
+
+        aMessage.Complete( HandleMesgOogmStatus( aMessage ) );
+        break;
+    case EFbsMessGetGlyphCacheMetrics:
+
+        HandleMesgGlyphCacheMetrics( aMessage );
+        break;
+
+//No-op message
+	case EFbsMessNoOp:
+#ifdef _DEBUG
+		iRet = KErrNone;
+#endif
+		aMessage.Complete(KErrNone);
+		break;
 	default:
 		aMessage.Panic(KFBSERVPanicCategory,KErrArgument);
 		break;
@@ -372,7 +438,9 @@
 	{
 #if _DEBUG
 	if (iFontDuplicateToFail)
+		{
 		return KErrNoMemory; //return with this error since this error is possible
+		}
 #endif
 	CFontObject* fontptr = (CFontObject*) aMessage.Int0();
 	if(!TopLevelStore()->ValidFontHandle((TInt)fontptr))
@@ -380,7 +448,7 @@
 		return KErrUnknown;
 		}
 
-	TPckgBuf<TFontInfo> foninfo;
+	TPckgBuf<TFontInfo> fontinfo;
 	TInt localhandle = 0;
 	TInt ret = fontptr->Open();
 	if (ret != KErrNone)
@@ -393,9 +461,9 @@
 		fontptr->Close();
 		return ret;
 		}
-	CopyFontInfo(fontptr,localhandle,foninfo());
+	CopyFontInfo(fontptr,localhandle,fontinfo());
 	fontptr->iHeightInTwips = ((fontptr->iAddressPointer->HeightInPixels() * fontptr->iFontStore->iKPixelHeightInTwips) + 667) / 1000;
-	ret = aMessage.Write(1, foninfo);
+	ret = aMessage.Write(1, fontinfo);
 	if(ret != KErrNone)
 		{
 		iIx->Remove(localhandle);
@@ -422,14 +490,14 @@
 	TInt pckgMaxHeight;
 	TPckgBuf<TSizeInfo> info;
 
-	const TFbsMessage	fbsMessage = static_cast<TFbsMessage>(aMessage.Function());
+	const TFbsMessage fbsMessage = static_cast<TFbsMessage>(aMessage.Function());
 
 	TInt ret = aMessage.Read(0, pckgFontSpec);
 	TFontSpec& fontSpec = pckgFontSpec();
 	if (ret == KErrNone )
 		{
 		TInt length = fontSpec.iTypeface.iName.Length();
-		if(length < 0 || length > TOpenFontFaceAttribBase::ENameLength)
+		if((length < 0) || (length > TOpenFontFaceAttribBase::ENameLength))
 			{
 			aPanicRequired = ETrue;
 			return KErrArgument;
@@ -644,6 +712,183 @@
 	return EFalse;
 	}
 
+/** Handler for EFbsMessGetGlyphs message.
+Reads a batch of up to KMaxGlyphBatchSize glyph codes, and on success returns
+the corresponding TGlyphImageInfo objects.
+ @param aMessage input parameters
+ @param aPanicRequired flag that is set if a client panic is required
+ @return KErrNone if successful, otherwise any system-wide error code.
+ */
+TInt CFbClient::HandleMesgGetGlyphs(const RMessage2& aMessage, TBool& aPanicRequired)
+	{
+	CFbTop* fbtop = TopLevelStore();
+	// Previously requested glyphs were closed in ServiceL()
+	CGlyphAtlas* glyphAtlas = fbtop->GlyphAtlas();
+	if (!glyphAtlas)
+		{
+		return KErrNotSupported;
+		}
+	CFontObject* fontptr = static_cast<CFontObject*>(iIx->At(aMessage.Int0(), fbtop->FontConUniqueID()));
+	if(!fontptr)
+		{
+		aPanicRequired = ETrue;
+		return KErrBadHandle;
+		}
+
+	TUint glyphCodes[KMaxGlyphBatchSize];
+	TGlyphImageInfo glyphImageInfo[KMaxGlyphBatchSize];
+	TPckg<TUint[KMaxGlyphBatchSize]> glyphBatchPckg(glyphCodes);
+
+	TInt err = aMessage.Read(1, glyphBatchPckg);
+	if (err != KErrNone)
+		{
+		aPanicRequired = ETrue;
+		return err;
+		}
+	TInt glyphCodesCount = glyphBatchPckg.Length() / sizeof(TUint);
+	if (glyphCodesCount > KMaxGlyphBatchSize)
+		{
+		aPanicRequired = ETrue;
+		return KErrOverflow;
+		}
+
+	TInt glyphsProcessed = 0;
+	CBitmapFont* font = fontptr->iAddressPointer;
+	for (; (glyphsProcessed < glyphCodesCount); ++glyphsProcessed)
+		{
+		TUint32 glyphCode = glyphCodes[glyphsProcessed];
+		err = glyphAtlas->GetGlyph(*font, glyphCode, glyphImageInfo[glyphsProcessed]);
+		// Search for glyph in glyph atlas
+		if (KErrNone != err)
+			{
+			const TUint8* bitmapData = NULL;
+			TOpenFontCharMetrics metrics;
+			// search for glyph in font glyph cache and session cache.
+			if (!font->GetCharacterData(iSessionHandle, glyphCode | KTreatAsGlyphCodeFlag, metrics, bitmapData))
+				{
+				// Rasterize the glyph
+				if(!font->Rasterize(iSessionHandle, glyphCode | KTreatAsGlyphCodeFlag, iOpenFontGlyphData))
+					{
+					err = KErrNoMemory;
+					break;
+					}
+				metrics = *(iOpenFontGlyphData->Metrics());
+				bitmapData = iOpenFontGlyphData->BitmapPointer();
+				}
+			CGlyphAtlas::TAddGlyphArgs args(bitmapData, glyphCode, metrics);
+			err = glyphAtlas->AddGlyph(*font, args, glyphImageInfo[glyphsProcessed]);
+			}
+		if ((err == KErrNone) && (glyphImageInfo[glyphsProcessed].iImageId != KSgNullDrawableId))
+			{
+			// To prevent other threads closing the glyph image in the glyph atlas 
+			// before client has had chance to open the drawable id, open a local
+			// handle to the glyph image for the session, which will be closed either
+			// next time a request is made or when EFbsMessCloseGlyphs is handled.
+			RSgImage glyphImage;
+			err = glyphImage.Open(glyphImageInfo[glyphsProcessed].iImageId);
+			if (err == KErrNone)
+				{
+				err = iGlyphImagesInTransit.Append(glyphImage);
+				}
+			}
+		// If an error occurred during this iteration, abort now before the glyphsProcessed
+		// counter is incremented, which would give one too many processed glyphs.
+		if (KErrNone != err)
+			{
+			break;
+			}
+		}
+
+	// Even if there was an error, if at least one glyph was processed successfully
+	// send that back to the client, and reset the error code.
+	if (glyphsProcessed > 0)
+		{
+		TPckg<TGlyphImageInfo[KMaxGlyphBatchSize]> glyphImageInfoPckg(glyphImageInfo);
+		glyphImageInfoPckg.SetLength(glyphsProcessed * sizeof(TGlyphImageInfo));
+		err = aMessage.Write(2, glyphImageInfoPckg);
+		if (err != KErrNone)
+			{
+			aPanicRequired = ETrue;
+			return err;
+			}
+		}
+	else
+		{
+		// No glyphs being returned, so an error code must be returned.
+		__ASSERT_DEBUG(err != KErrNone, User::Panic(KFBSERVPanicCategory, err));
+		}
+	return err;
+	}
+
+/**
+Handler for EFbsMessGetGlyphMetrics message.
+Reads an array of glyph codes, and returns the offset from the heap base for the 
+corresponding metrics object.
+@pre The glyph codes have already been searched client-side in the font glyph
+	cache and the session cache.
+@param aMessage input parameters
+@param aPanicRequired flag that is set if a client panic is required
+@return KErrNone if successful, otherwise any system-wide error code.
+ */
+TInt CFbClient::HandleMesgGetGlyphMetrics(const RMessage2& aMessage, TBool& aPanicRequired)
+	{
+	CFbTop* fbtop = TopLevelStore();
+	CFontObject* fontptr = static_cast<CFontObject*>(iIx->At(aMessage.Int0(), fbtop->FontConUniqueID()));
+	if(!fontptr)
+		{
+		aPanicRequired = ETrue;
+		return KErrBadHandle;
+		}
+	
+	TInt err = KErrNone;
+	TUint glyphCodes[KMaxMetricsBatchSize];
+	TPckg<TUint[KMaxMetricsBatchSize]> glyphBatchPckg(glyphCodes);
+	err = aMessage.Read(1, glyphBatchPckg);
+	if (err != KErrNone)
+		{
+		aPanicRequired = ETrue;
+		return err;
+		}
+	
+	TInt numGlyphCodes = glyphBatchPckg.Length() / sizeof(TUint);	
+	if (numGlyphCodes > KMaxMetricsBatchSize)
+		{
+		aPanicRequired = ETrue;
+		return KErrOverflow;
+		}
+	
+	CBitmapFont* font = fontptr->iAddressPointer;
+	const TInt heapbase = fbtop->HeapBase();
+
+	TInt glyphProcessed;
+	TInt glyphMetricsOffsets[KMaxMetricsBatchSize];
+	for (glyphProcessed = 0; (glyphProcessed < numGlyphCodes) && (err == KErrNone); ++glyphProcessed)
+		{
+		if (font->Rasterize(iSessionHandle, glyphCodes[glyphProcessed] | KTreatAsGlyphCodeFlag, iOpenFontGlyphData))
+			{
+			// Convert all pointers to be passed back to the client to offsets from
+			// the heap base so that they can be recreated client side relative to the
+			// client's heap base
+			glyphMetricsOffsets[glyphProcessed] = PointerToOffset(iOpenFontGlyphData->Metrics(), heapbase);
+			}
+		else
+			{
+			err = KErrNoMemory;
+			}
+		}
+
+	if (err == KErrNone)
+		{
+		TPckg<TInt[KMaxMetricsBatchSize]> glyphMetricsOffsetsPckg(glyphMetricsOffsets);
+		glyphMetricsOffsetsPckg.SetLength(glyphProcessed * sizeof(TInt));
+		err = aMessage.Write(2, glyphMetricsOffsetsPckg);
+		if (err != KErrNone)
+			{
+			aPanicRequired = ETrue;
+			}
+		}	
+	return err;
+	}
 
 /** Handler for EFbsMessFaceAttrib message
  @param aMessage Input and output parameters
@@ -661,21 +906,21 @@
 		}
 	CBitmapFont* bitmapFont = fontptr->iAddressPointer;
 
+	TInt ret = EFalse;
 	TPckgBuf<TOpenFontFaceAttrib> package;
 	if ( (bitmapFont != NULL) && (bitmapFont->GetFaceAttrib(package())) )
 		{
-		TInt ret = aMessage.Write(1,package);
+		ret = aMessage.Write(1,package);
 		if (ret == KErrNone)
 			{
-			return ETrue;
+			ret = ETrue;
 			}
 		else
 			{
 			aPanicRequired = ETrue;
-			return ret;
 			}
 		}
-	return EFalse;
+	return ret;
 	}
 
 
@@ -717,7 +962,6 @@
 	{
 	TInt error = KErrNone;
 	TShapeHeader* shape = 0;
-	TPckgBuf<TShapeMessageParameters> sp;
 	if (aMessage.GetDesLength(2) != sizeof(TShapeMessageParameters))
 		{
 		aPanicRequired = ETrue;
@@ -731,7 +975,6 @@
 		aPanicRequired = ETrue;
 		return KErrArgument;
 		}
-	CBitmapFont* bitmapFont = fontptr->iAddressPointer;
 
 	TInt inputTextLength = aMessage.GetDesLength(1);
 	if (inputTextLength < 0)
@@ -744,7 +987,9 @@
 		{
 		iTextToShape.Zero();
 		if (iTextToShape.MaxLength() < inputTextLength)
+			{
 			error = iTextToShape.ReAlloc(inputTextLength);
+			}
 		}
 	if (error == KErrNone)
 		{
@@ -754,12 +999,14 @@
 			aPanicRequired = ETrue;
 			return error;
 			}
+		TPckgBuf<TShapeMessageParameters> sp;
 		error = aMessage.Read(2, sp);
 		if (error != KErrNone)
 			{
 			aPanicRequired = ETrue;
 			return error;
 			}
+		CBitmapFont* bitmapFont = fontptr->iAddressPointer;
 		TRAP(error, shape = bitmapFont->ShapeTextL(iTextToShape, iSessionHandle, sp()) );
 		if (error == KErrNone)
 			{
@@ -953,9 +1200,70 @@
 	return ret;
 	}
 
+
+/**
+ Called in response to the GoomMonitor framework's call into FbsOogmPlugin.
+ We wish to either free some GPU memory, or reinstate its normal usage.
+
+@param  aMessage The IPC message.
+@return KErrNone If the value contained in the TFbsOogmMessage enumeration member is meaningful and the glyph atlas is present.
+        KErrNotSupported if there is no glyph atlas.
+        KErrUnknown if the value contained in the TFbsOogmMessage enumeration member is not meaningful.
+ */
+TInt CFbClient::HandleMesgOogmStatus( const RMessage2& aMessage )
+    {
+    TInt ret = KErrNone;
+    CGlyphAtlas* glyphAtlas = TopLevelStore()->GlyphAtlas();
+
+    if ( NULL == glyphAtlas )
+        {
+        return KErrNotSupported;
+        }
+
+
+    TPckgBuf<TFbsOogmMessage> oogmMessage;
+    aMessage.Read( 0, oogmMessage );
+
+    switch( oogmMessage().iOogmNotification )
+        {
+    case TFbsOogmMessage::EFbsOogmNoAction:
+        break;
+
+    case TFbsOogmMessage::EFbsOogmLowNotification:
+        {
+        glyphAtlas->ReleaseGpuMemory( oogmMessage().iBytesToFree, oogmMessage().iFlags );
+        }
+         break;
+
+    case TFbsOogmMessage::EFbsOogmOkayNotification:
+        {
+        glyphAtlas->InstateGpuMemory( oogmMessage().iFlags );
+        }
+        break;
+
+    default:
+        ret = KErrUnknown;
+        break;
+        }
+
+    return ret;
+    }
+
+
+void CFbClient::HandleMesgGlyphCacheMetrics( const RMessage2& aMessage )
+    {
+    CGlyphAtlas* glyphAtlas = TopLevelStore()->GlyphAtlas();
+    TPckgBuf<TGlyphCacheMetrics>  metrics;
+
+    glyphAtlas->GetGlyphCacheMetrics( metrics() );
+
+    aMessage.Complete( aMessage.Write(0, metrics) );
+    }
+
+
 void CFbClient::ProcFontMessage(const RMessage2& aMessage)
 	{
-	TInt ret = KErrUnknown;
+	TInt ret = KErrNone;
 	TBool panicRequired = EFalse;
 
 	switch(aMessage.Function())
@@ -1082,9 +1390,20 @@
 			ret = HandleMesgReleaseFontTable(aMessage, panicRequired);
 			break;
 			}
+		case EFbsMessGetGlyphs:
+			{
+			ret = HandleMesgGetGlyphs(aMessage, panicRequired);
+			break;
+			}
+		case EFbsMessGetGlyphMetrics:
+			{
+			ret = HandleMesgGetGlyphMetrics(aMessage, panicRequired);
+			break;
+			}
 
 #ifdef _DEBUG
 		case EFbsMessSetDuplicateFail:
+			{
 			TInt argument =aMessage.Int0();
 			if (argument)
 				{
@@ -1096,7 +1415,10 @@
 				}
 			ret=KErrNone;
 			break;
+			}
 #endif
+		default:
+			ret = KErrUnknown;
 		}
 
 	// either have a result or an error code to panic the client with
@@ -1120,7 +1442,7 @@
 	{
 	CBitmapObject* bmpptr=NULL;
 	TInt localhandle=0;
-	TInt ret=KErrUnknown;
+	TInt ret = KErrNone;
 	switch(aMessage.Function())
 		{
 	case EFbsMessBitmapCreate:
@@ -1283,14 +1605,18 @@
 			}
 		ret = fbtop->GetCleanBitmap(bmpptr);
 		if (ret != KErrNone)
+			{
 			break;
+			}
 		TSize newsize(aMessage.Int1(),aMessage.Int2());
  		const TBool compressedInRam = bmpptr->Address()->IsCompressedInRAM();  //It must be set before the resizing is done.
 		const TDisplayMode dispMode = bmpptr->Address()->DisplayMode();
 		CBitmapObject* newbmpptr = NULL;
 		TRAP(ret, newbmpptr = fbtop->CreateBitmapL(newsize, dispMode, KUidCFbsBitmapCreation, ETrue));
 		if (ret != KErrNone)
+			{
 			break;
+			}
 		ret = newbmpptr->Address()->CopyData(*bmpptr->Address());
 		if (ret != KErrNone)
 			{
@@ -1325,7 +1651,9 @@
 			}
 		bmpptr->SetCleanBitmap(newbmpptr);
 		if (bmpptr->AccessCount() >= 2)
+			{
 			fbtop->NotifyDirtyBitmap(*bmpptr, this);
+			}
 		iIx->Remove(localhandle);
 		TPckgBuf<TBmpHandles> handlebuffer;
 		handlebuffer().iHandle = newlocalhandle;
@@ -1353,7 +1681,9 @@
 		TopLevelStore()->GetCleanBitmap(bmpptr);
 		ret = bmpptr->Open();
 		if (ret != KErrNone)
+			{
 			break;
+			}
 		TPckgBuf<TBmpHandles> handlebuffer;
 		TRAP(ret,localhandle=iIx->AddL(bmpptr));
 		if(ret!=KErrNone)
@@ -1386,13 +1716,17 @@
 			}
 		ret = fbtop->GetCleanBitmap(bmpptr);
 		if (ret != KErrNone)
+			{
 			break;
+			}
 		const TSize size = bmpptr->Address()->SizeInPixels();
 		const TDisplayMode dispMode = bmpptr->Address()->DisplayMode();
 		CBitmapObject* newbmpptr = NULL;
 		TRAP(ret, newbmpptr = fbtop->CreateBitmapL(size, dispMode, KUidCFbsBitmapCreation, ETrue));
 		if (ret != KErrNone)
+			{
 			break;
+			}
 		ret = newbmpptr->Address()->CopyData(*bmpptr->Address());
 		if (ret != KErrNone)
 			{
@@ -1420,7 +1754,9 @@
 			}
 		bmpptr->SetCleanBitmap(newbmpptr);
 		if (bmpptr->AccessCount() >= 2)
+			{
 			fbtop->NotifyDirtyBitmap(*bmpptr, this);
+			}
 		iIx->Remove(localhandle);
 		TPckgBuf<TBmpHandles> handlebuffer;
 		handlebuffer().iHandle = newlocalhandle;
@@ -1451,7 +1787,9 @@
 		if (ret != KErrNone)
 			{
 			if (!async)
+				{
 				ret = KErrNone;
+				}
 			break;
 			}
 		ret = bmpptr->Address()->CheckBackgroundCompressData();
@@ -1459,10 +1797,14 @@
 			{
 			ret = fbtop->BackgroundCompression()->AddToCompressionQueue(bmpptr, scheme, async ? &aMessage : NULL);
 			if (ret == KErrNone && async)
+				{
 				return; // do not complete the client's request - that will be done by the background compression thread
+				}
 			}
 		if (KErrAlreadyExists == ret)
+			{
 			ret = KErrNone;
+			}
 		break;
 		}
 	case EFbsMessBitmapClean:
@@ -1477,10 +1819,14 @@
 			}
 		ret = fbtop->GetCleanBitmap(bmpptr);
 		if (ret != KErrNone)
+			{
 			break;
+			}
 		ret = bmpptr->Open();
 		if (ret != KErrNone)
+			{
 			break;
+			}
 		TInt cleanlocalhandle = 0;
 		TRAP(ret, cleanlocalhandle = iIx->AddL(bmpptr));
 		if (ret != KErrNone)
@@ -1530,17 +1876,19 @@
 			iHelper->iMessage = aMessage;
 			return; // do not complete the client's request yet - that will be done when a bitmap becomes dirty
 			}
-		ret = KErrNone;
 		iHelper->iDirty = EFalse;
 		}
 		break;
 	case EFbsMessBitmapCancelNotifyDirty:
 		{
 		if (iHelper != NULL && !iHelper->iMessage.IsNull())
+			{
 			iHelper->iMessage.Complete(KErrCancel);
-		ret = KErrNone;
+			}
 		}
 		break;
+	default:
+		ret = KErrUnknown;
 		}
 		
 	if(!aMessage.IsNull())
@@ -1616,7 +1964,9 @@
 	if (iHelper)
 		{
 		if (!iHelper->iMessage.IsNull())
+			{
 			iHelper->iMessage.Complete(KErrDisconnected);
+			}
 		iHelper->Deque();
 		delete iHelper;
 		iHelper = NULL;
@@ -1678,7 +2028,58 @@
 			break;
 		case EFbsMessHeap:
 			ret=(TInt)iHeap;
-			break;			
+			break;
+		default:
+			ret = KErrUnknown;
+		}
+	aMessage.Complete(ret);
+	iRet=ret;
+	}
+
+/**
+Processes messages associated with the Glyph Atlas.
+@param aMessage The message used to perform IPC to the client.
+ */
+void CFbClient::ProcAtlasMessage(const RMessage2 &aMessage)
+	{
+	TInt ret = KErrNone;
+	CFbTop* fbtop = TopLevelStore();
+	CGlyphAtlas* glyphAtlas = fbtop->GlyphAtlas();
+	if (!glyphAtlas)
+		{
+		ret = KErrNotSupported;
+		}
+	else
+		{
+		switch(aMessage.Function())
+			{
+			case EFbsMessAtlasFontCount:
+				ret = glyphAtlas->FontCount();
+				break;
+			case EFbsMessAtlasGlyphCount:
+				{
+				TInt fontHandle = aMessage.Int0();
+				if (fontHandle != 0)
+					{
+					if (fbtop->ValidFontHandle(fontHandle))
+						{
+						CFontObject* fontptr = reinterpret_cast<CFontObject*>(fontHandle);
+						ret = glyphAtlas->GlyphCount(static_cast<CBitmapFont&>(*(fontptr->iAddressPointer)));
+						}
+					else
+						{
+						ret = KErrNotFound;
+						}
+					}
+				else
+					{
+					ret = glyphAtlas->GlyphCount();
+					}
+				}
+				break;
+			default:
+				ret = KErrUnknown;
+			}
 		}
 	aMessage.Complete(ret);
 	iRet=ret;
--- a/fbs/fontandbitmapserver/sfbs/FBSFONT.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/sfbs/FBSFONT.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -85,7 +85,9 @@
 EXPORT_C void CFbsFont::Reset()
 	{
 	if (iHandle)
+	    {
 		iFbs->SendCommand(EFbsMessClose,iHandle);
+	    }
 	iHandle = 0;
 	}
 	
@@ -115,7 +117,7 @@
 	if (!aFontHandle)
 		return KErrUnknown;
 	// close any existing handle
-	Reset();
+	Reset();	
 	// ask server to create the duplicate handle
 	TPckgBuf<TFontInfo> tfpckg;
 	TIpcArgs args(aFontHandle,&tfpckg);
@@ -137,7 +139,9 @@
 EXPORT_C TInt CFbsFont::Handle() const
 	{
 	if (!iHandle)
+		{
 		return 0;
+		}
 	return iServerHandle;
 	}
 
@@ -727,6 +731,9 @@
 provide and/or return information to/from the particular extension function,
 defaults to NULL.
 @return Integer return value from extension function, a system wide error code.
+@panic FBSCLI 31, in debug builds only, if iExtra is NULL when it must not be.
+@panic FBSCLI 38, in debug builds only, if a reserved error code is returned 
+	from an extended function.
 @internalTechnology
 @released
 */
--- a/fbs/fontandbitmapserver/sfbs/FBSTOP.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/sfbs/FBSTOP.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1995-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"
@@ -18,7 +18,6 @@
 #include <fntstore.h>
 #include <bitmap.h>
 #include <ecom/ecom.h>
-#include "FbsMessage.H"
 #include <graphics/bitmapuid.h>
 #include "SERVER.H"
 #include "BackGroundCompression.h"
@@ -27,6 +26,8 @@
 #include <graphics/openfontconstants.h>
 #include <graphics/openfontrasterizer.h>
 #include <graphics/gdi/glyphsample.h>
+#include "glyphatlas.h"
+#include "FbsMessage.H"
 
 // Local utility functions
 void ListImplementationsWithRetry(TUid& aInterfaceUid, RImplInfoPtrArray &aImplementationArray, TBool aRomOnly);
@@ -61,6 +62,7 @@
 #endif
 	iFontNameAlias.ResetAndDestroy();
 	iBitmapObjectIndex.Reset();
+	delete iGlyphAtlas;
 	REComSession::FinalClose();
 	}
 
@@ -140,9 +142,15 @@
 	iMBMCache=new (ELeave) CFbTopStreamIdCache(30,30,5);
 
 	LoadOpenFontLibraries();
-	
 	iFontStore->LoadFontsAtStartupL();
 	LoadShaperFactories();
+	TRAP_IGNORE(iGlyphAtlas = CGlyphAtlas::NewL(KFbServGlyphAtlasCacheLimit);)
+#ifdef _DEBUG
+	if (!iGlyphAtlas)
+	    {
+        RDebug::Printf("FBSERV failed to initialize Glyph Atlas");
+	    }
+#endif
 
 	// start a new thread for background compression after all the other objects have been created
 	iBackgroundCompression = CFbsBackgroundCompression::NewL(*this);
@@ -307,8 +315,8 @@
 		{
 		return ret;
 		}
-
-	return CreateFontObjectFromFont(aFontObjPtr, font);
+	
+	return GetFontObjectFromFont(aFontObjPtr, font);
 	}
 	
 /**
@@ -349,9 +357,27 @@
 	return ret;
 	}
 
-TInt CFbTop::CreateFontObjectFromFont(CFontObject*& aFontObjPtr, CFont* aFont)
+TInt CFbTop::GetFontObjectFromFont(CFontObject*& aFontObjPtr, CFont* aFont)
 	{
-	CFontObject* fontObjPtr = new CFontObject(iFontStore);
+	// First, check if a CFontObject exists for this CFont.
+	// If so, increment its reference count and return it.
+	for (TInt ii = iFontCon->Count() - 1; ii >= 0; --ii)
+		{
+		CFontObject* fontObjPtr = reinterpret_cast<CFontObject*>((*iFontCon)[ii]);
+		if (fontObjPtr->iAddressPointer == reinterpret_cast<CBitmapFont*>(aFont))
+			{
+			aFontObjPtr = fontObjPtr;
+			// The CFontObject instance keeps the reference count of the CBitmapFont, 
+			// not the font store. There is only one CFontObject instance
+			// per CBitmapFont, so to keep the reference count at 1 in the fontstore
+			// call ReleaseFont(). 
+			iFontStore->ReleaseFont(aFont);
+			return fontObjPtr->Open();
+			}
+		}
+	
+	// Existing FontObject not found, so create new one.
+	CFontObject* fontObjPtr = new CFontObject(iFontStore, iGlyphAtlas);
 	if (!fontObjPtr)
 		{
 		iFontStore->ReleaseFont(aFont);
@@ -389,7 +415,7 @@
 		{
 		return ret;
 		}
-	return CreateFontObjectFromFont(aFontObjPtr, font);
+	return GetFontObjectFromFont(aFontObjPtr, font);
 	}
 
 
@@ -561,18 +587,6 @@
 	return(EFalse);
 	}
 	
-TBool CFbTop::ValidBitmapFont(TInt aHandle)
-	{
-	TInt limit=iFontCon->Count();
-	for(TInt count=0;count<limit;count++)
-		{
-		CFontObject* fontObjPtr = reinterpret_cast<CFontObject*>((*iFontCon)[count]);
-		if(aHandle==(TInt)(fontObjPtr->iAddressPointer))
-			return(ETrue);
-		}
-	return(EFalse);
-	}
-
 CFontStore* CFbTop::FontStore() const
 	{
 	return(iFontStore);
@@ -724,3 +738,8 @@
 	{
 	return iFontCon->UniqueID();
 	}
+
+CGlyphAtlas* CFbTop::GlyphAtlas() const
+	{
+	return iGlyphAtlas;
+	}
--- a/fbs/fontandbitmapserver/sfbs/SERVER.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/sfbs/SERVER.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -22,7 +22,7 @@
 #include "BitwiseBitmap.inl"
 
 const TInt KFbsPriority = 0;
-
+const TInt KFbsGoomMonitorSid = 0x10207218;
 // Setup security policies
 const TInt KRanges[] = 
 	{
@@ -37,7 +37,10 @@
 	EFbsMessFetchLinkedTypeface,
 	EFbsMessUpdateLinkedTypeface,
 	EFbsMessGetFontTable,
+    EFbsMessOogmNotification,
+    EFbsMessGetGlyphCacheMetrics,
 	};
+
 const TUint KRangeCount = sizeof(KRanges)/sizeof(TInt);
 const TUint8 KElementsIndex[KRangeCount] = 
 	{
@@ -52,14 +55,19 @@
 	2, // ECapabilityReadDeviceData for EFbsMessFetchLinkedTypeface
 	1, // ECapabilityWriteDeviceData for EFbsMessUpdateLinkedTypeface
 	0, // ECapability_None for EFbsMessGetFontTable and beyond
+    4, // SID for EFbsMessOogmNotification.
+    0, // For EFbsMessGetGlyphCacheMetrics and on.
 	};
+
 const CPolicyServer::TPolicyElement KElements[] = 
 	{
 	{_INIT_SECURITY_POLICY_C1(ECapability_None), CPolicyServer::EFailClient},
 	{_INIT_SECURITY_POLICY_C1(ECapabilityWriteDeviceData), CPolicyServer::EFailClient},
 	{_INIT_SECURITY_POLICY_C1(ECapabilityReadDeviceData), CPolicyServer::EFailClient},
-	{_INIT_SECURITY_POLICY_C1(ECapabilityPowerMgmt), CPolicyServer::EFailClient},	
+	{_INIT_SECURITY_POLICY_C1(ECapabilityPowerMgmt), CPolicyServer::EFailClient},
+	{_INIT_SECURITY_POLICY_S0(KFbsGoomMonitorSid), CPolicyServer::EFailClient}
  	};
+
 const CPolicyServer::TPolicy KFbsPolicy =
 	{
 	CPolicyServer::EAlwaysPass, //specifies all connect attempts should pass
@@ -70,9 +78,7 @@
 	};
 
 CFontBitmapServer::CFontBitmapServer():
-	CPolicyServer(KFbsPriority, KFbsPolicy),
-	iConnectionId(0),
-	iTopLevelStore(NULL)
+	CPolicyServer(KFbsPriority, KFbsPolicy)
 	{
 	}
 
@@ -85,25 +91,33 @@
 
 CFontBitmapServer* CFontBitmapServer::NewL()
 	{
-	CFontBitmapServer* fbs=new(ELeave) CFontBitmapServer;
-	CleanupStack::PushL(fbs);
-	fbs->iTopLevelStore=CFbTop::NewL();
+	CFontBitmapServer* self = new(ELeave) CFontBitmapServer;
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(); //self
+	return self;
+	}
+
+/**
+Two-phase constructor.
+*/
+void CFontBitmapServer::ConstructL()
+	{
+	iTopLevelStore=CFbTop::NewL();
 	
 	// If fbserv data paging is configured as unpaged, automatically pin client descriptors 
 	if(!RProcess().DefaultDataPaged())
 		{
-		fbs->SetPinClientDescriptors(ETrue);
+		SetPinClientDescriptors(ETrue);
 		}
-
-	fbs->StartL(KFBSERVGlobalThreadName);
-	CleanupStack::Pop();
-	return(fbs);
+	StartL(KFBSERVGlobalThreadName);
 	}
 
 CFbTop* CFontBitmapServer::TopLevelStore()
 	{
 	return(iTopLevelStore);
 	}
+
 CSession2* CFontBitmapServer::NewSessionL(const TVersion& aVersion,const RMessage2& /*aMessage*/ ) const
 	{
 	TVersion v(KFbsMajorVersionNumber,KFbsMinorVersionNumber,KFbsBuildVersionNumber);
@@ -127,7 +141,7 @@
 	TPckgBuf<TSize> pixelSize;
 	TInt index=aMessage.Int0();
 	TInt limit=iTopLevelStore->FontStore()->NumTypefaces();
-	if(index<0 || index>limit)
+	if(index < 0 || index > limit)
 		{
 		return KErrArgument;
 		}
@@ -195,7 +209,7 @@
 void CFontBitmapServer::ProcMessage(const RMessage2& aMessage, TInt aSession)
 #endif
 	{
-	TInt ret=KErrNone;
+    TInt ret=KErrNone;
 	TBool clientPanicRequired = EFalse;
 #ifdef _DEBUG
 	TInt num=0;
@@ -346,6 +360,7 @@
 #ifdef _DEBUG
 	aRet=ret;
 #endif	
+
 	}
 
 /**
@@ -363,9 +378,9 @@
 void CFontBitmapServer::GetHeapSizesL(const RMessage2& aMessage)
 	{
 	TPckgBuf<THeapSizes> data;
-	TInt defaultHeapSize;
-	TInt smallBmpHeapSize;		
-	TInt bigBmpHeapSize;		
+	TInt defaultHeapSize = 0;
+	TInt smallBmpHeapSize = 0;		
+	TInt bigBmpHeapSize = 0;		
 	
 	User::Heap().AllocSize(defaultHeapSize);
 	bigBmpHeapSize = iTopLevelStore->iLargeBitmapChunk.Size();
@@ -385,18 +400,24 @@
 #endif
 
 
-CFontObject::CFontObject(CFontStore* aFontStore):
+CFontObject::CFontObject(CFontStore* aFontStore, CGlyphAtlas* aGlyphAtlas):
 	CObject(),
-	iAddressPointer(NULL),
-	iFontStore(aFontStore)
+	iFontStore(aFontStore),
+	iGlyphAtlas(aGlyphAtlas)
 	{
 	}
 
 CFontObject::~CFontObject()
 	{
 	if (AccessCount()==1)
+		{
 		Dec();
+		}
 	iFontStore->ReleaseFont(iAddressPointer);
+	if (iGlyphAtlas)
+		{
+		iGlyphAtlas->FontReleased(*iAddressPointer);
+		}
 	}
 
 // CBitmapObject constructor - takes ownership of aBmp
@@ -426,7 +447,9 @@
 		{
 		iHandle = reinterpret_cast<TInt>(this);
 		while (iFbTop->iBitmapObjectIndex.FindInOrder(this, Compare) != KErrNotFound)
+			{
 			++iHandle;
+			}
 		User::LeaveIfError(iFbTop->iBitmapObjectIndex.InsertInOrder(this, Compare));
 		}
 	}
@@ -471,9 +494,13 @@
 			if (index != KErrNotFound)
 				{
 				if (iCleanBitmap)
+					{
 					iFbTop->iBitmapObjectIndex[index] = iCleanBitmap;
+					}
 				else
+					{
 					iFbTop->iBitmapObjectIndex.Remove(index);
+					}
 				}
 			}
 		if (iCleanBitmap != NULL)
@@ -502,7 +529,7 @@
 
 void CBitmapObject::Close()
 	{
-	if (iCleanBitmap != NULL && Owner() != NULL && AccessCount() == 2)
+	if ((iCleanBitmap != NULL) && (Owner() != NULL) && (AccessCount() == 2))
 		{
 		static_cast<CBitmapObject*>(Owner())->iCleanBitmap = iCleanBitmap;
 		iCleanBitmap->SetOwner(Owner());
@@ -525,8 +552,7 @@
 // CSharedBitmapObject constructor - takes ownership of aBmp and aKey
 CSharedBitmapObject::CSharedBitmapObject(CFbTop& aFbTop, CBitwiseBitmap* aBmp, TDesC* aKey):
 	CBitmapObject(aFbTop, aBmp),
-	iKey(aKey),
-	iNext(NULL)
+	iKey(aKey)
 	{
 	__ASSERT_DEBUG(iKey, User::Invariant());	
 	}
--- a/fbs/fontandbitmapserver/sfbs/SERVER.H	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/sfbs/SERVER.H	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1995-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"
@@ -13,33 +13,37 @@
 // Description:
 //
 
-#ifndef __FBSERV_H__
-#define __FBSERV_H__
+#ifndef SERVER_H
+#define SERVER_H
 
 #include <e32base.h>
 #include <f32file.h>
 #include <fbs.h>
+#include <sgresource/sgimage.h>
 #include "UTILS.H"
 #include "FBSMBMC.H"
 #include "FbsMessage.H"
+#include "glyphatlas.h"
 
 class CFbTop;
 class CFbsBackgroundCompression;
 class CFbsBackgroundCompressionQueueElement;
 class TOpenFontGlyphData;
 
+
 NONSHARABLE_CLASS(CFontObject): public CObject
 /**
 @internalComponent
 */
 	{
 public:
-	CFontObject(CFontStore* aFontStore);
+	CFontObject(CFontStore* aFontStore, CGlyphAtlas* aGlyphAtlas);
 	~CFontObject();
 public:
 	CBitmapFont* iAddressPointer;
 	CFontStore* iFontStore;
 	TInt iHeightInTwips;
+	CGlyphAtlas* iGlyphAtlas;
 	};
 
 NONSHARABLE_CLASS(CBitmapObject): public CObject
@@ -113,6 +117,7 @@
 	CFbTop* TopLevelStore();
 
 private:
+	void ConstructL();
 	void GetHeapSizesL(const RMessage2& aMessage);
 	TInt HandleMesgTypefaceSupport(const RMessage2& aMessage, TBool& aClientPanicRequired);
 	TInt HandleMesgFontHeight(const RMessage2& aMessage, TBool aInTwips);
@@ -171,8 +176,10 @@
 	void Disconnect(const RMessage2 &aMessage);
 #ifdef _DEBUG
 	void ProcMemMessage (const RMessage2& aMessage);
+	void ProcAtlasMessage (const RMessage2& aMessage);
 #endif	
 private:
+	void ConstructL();
 	CFbClient(RHeap* aHeap);
 	TInt HandleMesgFontDuplicate(const RMessage2& aMessage, TBool& aPanicRequired);
 	TInt HandleMesgGetNearestFont(const RMessage2& aMessage, TBool& aPanicRequired);
@@ -189,6 +196,10 @@
 	TInt HandleMesgGetGlyphOutline(const RMessage2& aMessage, TBool& aPanicRequired);
 	TInt HandleMesgReleaseGlyphOutline(const RMessage2& aMessage, TBool& aPanicRequired);
 	TInt HandleMesgReleaseFontTable(const RMessage2& aMessage, TBool& aPanicRequired);
+	TInt HandleMesgGetGlyphs(const RMessage2& aMessage, TBool& aPanicRequired);
+	TInt HandleMesgGetGlyphMetrics(const RMessage2& aMessage, TBool& aPanicRequired);
+	TInt HandleMesgOogmStatus(const RMessage2& aMessage);
+	void HandleMesgGlyphCacheMetrics(const RMessage2& aMessage);
 
 protected:
 	TUint iConnectionHandle;
@@ -202,6 +213,7 @@
 
 private:
 	RBuf16 iTextToShape;						// buffer used to hold incoming text that needs shaping
+	RArray<RSgImage> iGlyphImagesInTransit;	// last glyph images retrieved from glyph atlas
 #ifdef _DEBUG	
 	TBool iOwnHeapCheck; //for the process heap - current state
 	TBool iHeapCheck;	//for iHeap - current state
@@ -250,6 +262,7 @@
 
 
 IMPORT_C extern const TInt KFbServSharedHeapMaxSize;
+IMPORT_C extern const TInt KFbServGlyphAtlasCacheLimit;
 
 
 NONSHARABLE_CLASS(CFbTop): public CBase
@@ -271,7 +284,6 @@
 	TInt GetCleanBitmap(CBitmapObject*& aBmpObjPtr);
 	CBitmapObject* FindBitmap(TInt aHandle);
 	TBool ValidFontHandle(TInt aHandle);
-	TBool ValidBitmapFont(TInt aHandle);
 	CFontStore* FontStore() const;
 	RHeap* Heap() const;
 	CChunkPile* Pile() const;
@@ -287,6 +299,7 @@
 	void NotifyDirtyBitmap(CBitmapObject& aBmpObj, CFbClient* aClient);
 	TInt BitmapConUniqueID() const;
 	TInt FontConUniqueID() const;
+	CGlyphAtlas* GlyphAtlas() const;
 private:
 	CFbTop();
 	void ConstructL();
@@ -296,7 +309,7 @@
 	TInt FindFontNameAlias(const TDesC& aAlias);
 	void LoadShaperFactories();
 	void SafeInstallOfShaperFactoryL(TUid aInterfaceImplUid);
-	TInt CreateFontObjectFromFont(CFontObject*& aFontObjPtr, CFont* aFont);
+	TInt GetFontObjectFromFont(CFontObject*& aFontObjPtr, CFont* aFont);
 	TInt GetNearestNonAliasedFont(CFont*& aFont, TFbsMessage aMessage, const TFontSpec&	aFontSpec, TInt	aMaxHeight);
 private:
 	RFs iFilesys;
@@ -318,6 +331,7 @@
 	TBuf<KMaxTypefaceNameLength> iSystemDefaultFontTypefaceName;
 	TDblQue<TFbClientHelper> iClientHelpers;
 	TInt64 iNextAvailableSerialNumber;
+	CGlyphAtlas* iGlyphAtlas;
 	};
 
 inline CBitwiseBitmap* CBitmapObject::Address() const
@@ -360,5 +374,5 @@
 	return iFilesys;
 	}
 
-#endif
+#endif // SERVER_H
 
--- a/fbs/fontandbitmapserver/sfbs/SESSION.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/sfbs/SESSION.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -20,6 +20,7 @@
 #include "FbsRalc.h"
 #include "fbshelper.h"
 #include "FbsMessage.H"
+#include <graphics/fbsoogmmessage.h>
 
 GLDEF_C void Panic(TFbsPanic aPanic)
 	{
@@ -238,6 +239,7 @@
 EXPORT_C TInt RFbsSession::SendCommand(TInt aMessage,TInt aInt0,TInt aInt1,TInt aInt2,TInt aInt3) const
    {
 	__ASSERT_ALWAYS(iConnections>0,Panic(EFbsPanicBadConnection));
+
 	switch(aMessage)
 		{
 	case EFbsMessShutdown:
@@ -247,7 +249,9 @@
 	default:
 		break;
 		}
+
 	TInt ret = SendReceive(aMessage, TIpcArgs(aInt0,aInt1,aInt2,aInt3));
+
 	return(ret);
 	}
 
@@ -486,6 +490,36 @@
 	return iHelper->iServerSessionHandle;
 	}
 
+EXPORT_C TInt RFbsSession::GetGlyphCacheMetrics( TGlyphCacheMetrics& aGlyphCacheMetrics )
+    {
+    TPckgBuf<TGlyphCacheMetrics> metrics;
+    TIpcArgs args( &metrics );
+
+    TInt ret = SendReceive( EFbsMessGetGlyphCacheMetrics, args );
+    aGlyphCacheMetrics = metrics();
+
+    return ret;
+    }
+
+/**
+ Perform the IPC to convey the desired OoGM action to the glyph atlas.
+
+ @return KErrNone if IPC was successful. One of the system-wide error
+         codes, as described for RSessionBase::SendReceive(), if not.
+
+ @note The server-side platform security policy applied to this method is such that it is only useable by the GOoM framework.
+
+ @param aOogmMessage. A reference to the class encapsulating the OoGM action required of the glyph atlas.
+*/
+EXPORT_C TInt RFbsSession::ConveyOogmMessage( TFbsOogmMessage& aOogmMessage )
+    {
+    TPckgBuf<TFbsOogmMessage> oogmMessage;
+    oogmMessage() = aOogmMessage;
+    TIpcArgs args( &oogmMessage );
+
+    return SendReceive( EFbsMessOogmNotification, args );
+    }
+
 /**
 Returns the current sizes of the FBServ default heap, the heap for large bitmaps, 
 and the heap for small bitmaps.
--- a/fbs/fontandbitmapserver/sfbs/UTILS.H	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/sfbs/UTILS.H	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-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"
@@ -20,8 +20,9 @@
 #include <gdi.h>
 #include <fntstore.h>
 #include <bitmap.h>
+#include <sgresource/sgimage.h>
 
-
+class RFbsSession;
 
 /**
 @internalComponent
@@ -43,35 +44,43 @@
 */
 enum TFbsPanic
 	{
-	EFbsPanicNoConnection=1,
-	EFbsPanicBadConnection,
-	EFbsPanicUnknownMessage,
-	EFbsPanicActiveSchedulerError,
-	EFbsPanicStartupFailed,
-	EFbsTypefaceStoreError,
-	EFbsFontCreateFailed,
-	EFbsFontAddressViolation,
-	EFbsBitmapInvalidFormat,
-	EFbsBitmapInvalidMode,
-	EFbsBitmapInvalidCompression,
-	EFbsBitmapDecompressionError,
-	EFbsPanicChunkError,
-	EFbsColor256UtilError,
-	EFbsHardwareBitmapError,
-	EFbsNotSupportedForCompression,
-	EFbsBitmapAlignment,
-	EFbsBitmapInvalidScanLinePtr,
-	EFbsBitmapInvalidMode2,
-	EFbsBitmapInvalidMode3,
-	EFbsBitmapSwappingImpossible,
-	EFbsPanicBadHeapLock,
-	EFbsShaperNotYetCalled,
-	EFbsShaperInvalidArguments,
-	EFbsInvalidCompressionThreshold,
-	EFbsTypefaceIndexOutOfRange,
-	EFbsPanicBitmapDataCopy,
-	EFbsPanicBitmapReadOnly,
-	EFbsPanicInvalidBitmapType
+	EFbsPanicNoConnection = 1,
+	EFbsPanicBadConnection = 2,
+	EFbsPanicUnknownMessage = 3,
+	EFbsPanicActiveSchedulerError = 4,
+	EFbsPanicStartupFailed = 5,
+	EFbsTypefaceStoreError = 6,
+	EFbsFontCreateFailed = 7,
+	EFbsFontAddressViolation = 8,
+	EFbsBitmapInvalidFormat = 9,
+	EFbsBitmapInvalidMode = 10,
+	EFbsBitmapInvalidCompression = 11,
+	EFbsBitmapDecompressionError = 12,
+	EFbsPanicChunkError = 13,
+	EFbsColor256UtilError = 14,
+	EFbsHardwareBitmapError = 15,
+	EFbsNotSupportedForCompression = 16,
+	EFbsBitmapAlignment = 17,
+	EFbsBitmapInvalidScanLinePtr = 18,
+	EFbsBitmapInvalidMode2 = 19,
+	EFbsBitmapInvalidMode3 = 20,
+	EFbsBitmapSwappingImpossible = 21,
+	EFbsPanicBadHeapLock = 22,
+	EFbsShaperNotYetCalled = 23,
+	EFbsShaperInvalidArguments = 24,
+	EFbsInvalidCompressionThreshold = 25,
+	EFbsTypefaceIndexOutOfRange = 26,
+	EFbsPanicBitmapDataCopy = 27,
+	EFbsPanicBitmapReadOnly = 28,
+	EFbsPanicFontNullHandle = 29,
+    EFbsPanicGlyphDataIteratorClosed = 31,
+	EFbsPanicGlyphMetricsArrayOutOfBounds = 32,
+	EFbsPanicGlyphDataIteratorIndexOutOfRange = 33,
+	EFbsPanicInvalidBitmapType = 35,
+	EFbsPanicGlyphAtlasInconsistentState = 36,
+	EFbsPanicGlyphDataIteratorFailedToOpenImage = 37,
+	EFbsPanicGlyphDataIteratorInvalidState = 39,
+	EFbsPanicGlyphMetricsArrayInvalidState = 40,
 	};
 
 class TScanLine
@@ -125,9 +134,9 @@
 @internalComponent
 */
 	{
-	public:
-		TSizeInfo(){}
-		TSizeInfo(TInt aMaxHeight,TSize aDevSize):iMaxHeight(aMaxHeight),iDevSize(aDevSize) {}
+public:
+	TSizeInfo(){}
+	TSizeInfo(TInt aMaxHeight,TSize aDevSize):iMaxHeight(aMaxHeight),iDevSize(aDevSize) {}
 
 	TInt iMaxHeight;
 	TSize iDevSize;
@@ -182,7 +191,8 @@
 	void ShrinkSmallSection(TInt aShrinkBy);
 private:
 	RChunk iChunk;
-	TInt iPageSize, iPageMask;
+	TInt iPageSize;
+	TInt iPageMask;
 	RPointerArray<TUint8> iSmallCells; // last address is not a cell but the top of the small section
 	RArray<TInt> iFreeSmallCellLinks; // index of Nth free small cell is element 0 + element 1 + ... + element N-1
 	TInt iLargeSectionBottom; // boundary between small & large sections
@@ -264,6 +274,74 @@
     TInt iLen;
     };
 
-#endif
+/**
+Maximum number of glyphs to be sent to server/received from client at a time, 
+when retrieval of glyphs is necessary for implementation of RFbsGlyphDataIterator.
+*/
+const TInt KMaxGlyphBatchSize = 8;
+
+/**
+Maximum number of TOpenFontCharMetrics structures to be sent to server/received
+from client at a time, when retrieval of glyph metrics is necessary for
+implementation of RFbsGlyphMetricsArray.
+*/
+const TInt KMaxMetricsBatchSize = 16;
+
+/**
+Used by RFbsGlyphDataIterator for client/server communication of glyph info.
+Contains all the data necessary to retrieve a glyph from server and recreate
+glyph in client process.
+@internalComponent 
+ */
+class TGlyphImageInfo
+    {
+public:
+    inline TGlyphImageInfo() : iImageId(KSgNullDrawableId), iPosX(0), iPosY(0) {}
+public:
+    TSgDrawableId iImageId;
+    TInt16 iPosX;
+    TInt16 iPosY;
+    TOpenFontCharMetrics iMetrics;
+    };
 
+/**
+Used by CGlyphDataIteratorImpl. It is a container to group the 
+metadata and the image data of an individual glyph recevied from the
+server, all together. A collection of these is stored in the font,
+received from the server in batches.
+@internalComponent 
+*/
+struct TGlyphBatchItem
+    {
+    TSglQueLink iLink;
+    RSgImage iImage;
+    TGlyphImageInfo iInfo;
+    };
 
+/**
+Implementor class of RFbsGlyphDataIterator. This class contains all
+state information and contains much of the implementation of the
+behaviour.
+@internalComponent 
+ */
+NONSHARABLE_CLASS(CGlyphDataIteratorImpl) : public CBase
+    {
+public:
+    CGlyphDataIteratorImpl(TInt aFbsFontHandle, const TUint* aGlyphCodes, TInt aCount);
+    ~CGlyphDataIteratorImpl();
+    TInt Initialise();
+    TInt Next();
+    void UpdateGlyphRect();
+    TInt UpdateGlyphBatch(TInt aIndex);
+    
+public:    
+    TSglQue<TGlyphBatchItem> iGlyphBatch;   // Linked-list of the current batch of received glyphs.
+    const TUint* iGlyphDataIterCodes;       // An array of glyph codes
+    TInt  iGlyphDataIterCodeCount;          // The number of glyph codes in the array
+    TInt  iGlyphDataIterCodeIndex;          // The index of the current glyph code in the array
+    TRect iGlyphDataIterRect;               // The current glyph rectangle.
+    TInt  iFbsFontHandle;                   // The Font Handle the iterator was opened with  
+    RFbsSession* iFbs;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/sfbs/fbsglyphdataiterator.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,465 @@
+// Copyright (c) 2009-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 <e32def.h>
+#include <gdi.h>
+#include <graphics/gdi/gdistructs.h>
+#include <graphics/gdi/gdiconsts.h>
+#include <graphics/fbsglyphdataiterator.h>
+#include "FbsMessage.h"
+#include "UTILS.H"
+
+const TInt KFbsGlyphDataIterCodeInvalid = -1;
+
+extern void Panic(TFbsPanic aPanic);
+
+/**
+The default constructor sets the iterator to a closed and empty state. It 
+is the only way of constructing an iterator as instances cannot be copied by 
+assignment or passed by value.
+ */
+EXPORT_C RFbsGlyphDataIterator::RFbsGlyphDataIterator() :
+    iImpl(NULL)
+    {
+    }
+
+/**
+For a given font (aFont), this method retrieves the glyph data for a list of 
+glyph codes (aGlyphCodes), containing a number (aCount) of codes. On success, 
+the iterator is initialised with the data for the first glyph in aGlyphCodes.
+
+The memory allocated to aGlyphCodes must not be freed or altered while the 
+iterator is in use (i.e. until the iterator has been closed). 
+
+Open() may not be called on an already open iterator. In order to re-open an 
+iterator, it must first be closed by a call tor Close().
+
+If a glyph code is passed in that is not a recognised glyph code for the 
+associated font, an empty-box glyph will be returned. This behaviour is 
+consistent with CFbsFont::GetCharacterData().
+
+@pre The iterator is not already open. 
+
+@param aFont The font to provide the glyph code data for.
+@param aGlyphCodes An array of glyph codes that the iterator will 
+	provide data for. This memory allocated for this array must not be 
+	freed before the iterator is closed.
+@param aCount The number of glyph codes in aGlyphCodes.
+
+@return 
+	KErrNone, if the iterator is successfully initialised to retrieve 
+		the glyph data;
+	KErrInUse, if the iterator is already open, in which case the state of
+        the iterator is left unchanged;
+	KErrNoMemory, if the iterator cannot be opened due to insufficient 
+		system memory;
+	KErrNotSupported, if aFont refers to a bitmap font or an outline & shadow
+        font, if the required version of the hardware driver is not available
+        (EGL 1.3 or later is required), or if RSgImages are not supported by
+        the system;
+	KErrArgument, if aCount is negative or zero, or if aGlyphCodes is null.
+ */
+EXPORT_C TInt RFbsGlyphDataIterator::Open(CFbsFont& aFont, const TUint* aGlyphCodes, TInt aCount)
+	{  
+	if (iImpl)
+		{
+		return KErrInUse;
+		}
+	if ((aCount <= 0) || !aGlyphCodes)
+		{
+		return KErrArgument;
+		}
+	if (!aFont.Address()->IsOpenFont())
+        {
+        return KErrNotSupported;
+        }
+    TInt glyphBitmapType = aFont.Address()->GlyphBitmapType();
+    if (!( (glyphBitmapType == EMonochromeGlyphBitmap) || (glyphBitmapType == EAntiAliasedGlyphBitmap) ))
+        {
+        //Only supported bitmap types can be used i.e. EMonochromeGlyphBitmap or EAntiAliasedGlyphBitmap
+        return KErrNotSupported;
+        }
+    // Check that the max width and height of the font are both no more than 2048.
+    // This is the smallest maximum size an RSgImage can be created with.
+    // This limit is arbitrarily set as it should cover nearly all use cases.
+    const TInt KMaxFontSizeInPixels = 2048;
+    TInt maxHeight = aFont.FontMaxHeight();
+    TInt maxWidth = aFont.MaxCharWidthInPixels();
+    if ( (KMaxFontSizeInPixels < maxHeight) || (KMaxFontSizeInPixels < maxWidth) )
+        {
+        return KErrTooBig;
+        }
+    // Construct implementor object that holds the state for the iterator.
+	iImpl = new CGlyphDataIteratorImpl(aFont.iHandle, aGlyphCodes, aCount);
+	if (!iImpl)
+	    {
+	    return KErrNoMemory;
+	    }
+	TInt err = iImpl->Initialise();
+	if (err != KErrNone)
+	    {
+        Close();
+	    }
+	return err;   
+	}
+
+/**
+Moves the iterator to the data for the next glyph code in the array passed 
+into RFbsGlyphDataIterator::Open(). Data for the glyph can then be accessed 
+using the Image(), Rect() and Metrics() methods.
+
+Once Next() has been called, the references returned by Image(), Rect() and 
+Metrics() methods during the previous iteration should be considered invalid 
+and must be discarded. 
+
+Calling Next() repeatedly will iterate through the glyph data for all the glyph
+codes, until it has reached the last glyph code in the array (assuming no errors
+are encountered), at which point KErrNotFound is returned, and the array of glyph
+codes passed to RFbsGlyphDataIterator::Open() can safely be deleted.
+
+If the call was successful, KErrNone is returned. If an error is encountered an
+error code will be returned and the state of the iterator is left unchanged.
+
+@pre The iterator has been opened by a successful call to Open().
+@post The properties of the iterator are of the glyph corresponding
+	to the next code passed in the array to Open().	However, if an error code 
+	was returned, the state of the iterator	is unchanged.
+	
+@return 
+	KErrNone, if the iterator was successfully advanced;
+	KErrNotFound, if the iterator is already at the last element and cannot
+		be advanced any further;
+	KErrNoMemory, if there is insufficient system memory available;
+	KErrNoGraphicsMemory, if there is insufficient graphics memory available.
+	
+@panic FBSCLI 31, if the iterator is not open.
+@panic FBSERV -8, if as a result of this call, communication with the 
+    server is invoked, and the associated CFbsFont has been destroyed.
+ */
+EXPORT_C TInt RFbsGlyphDataIterator::Next()
+    {
+    __ASSERT_ALWAYS(iImpl, Panic(EFbsPanicGlyphDataIteratorClosed));
+    return iImpl->Next();
+    }
+
+/**
+Closes the iterator and releases its internal resources. After calling, all data 
+retrieved by the iterator is no longer safe to use. Once closed, this iterator 
+can be re-opened. Calling Close() on an already closed iterator has no effect.
+
+Once an iterator is closed, the array of glyphs (aGlyphCodes) passed to
+RFbsGlyphDataIterator::Open() can safely be deleted.
+
+@post The iterator is closed.
+ */
+EXPORT_C void RFbsGlyphDataIterator::Close()
+    {
+    delete iImpl;
+    iImpl = NULL;
+    }
+
+/**
+Returns a reference to the RSgImage that contains the glyph for the current 
+iteration. The image representation of the glyph is the same as the image 
+returned by the existing CFbsFont::GetCharacterData() method (i.e. an alpha mask). 
+
+The RSgImage should only be considered a temporary handle for use in this 
+iteration, and should not be used after a call to Next() or Close() has 
+been made.
+
+Note: For glyphs such as space which have no visible representation, Image() 
+will return a null image handle (i.e. RSgImage::IsNull() returns ETrue). This 
+cannot be used for drawing. In this case Rect() will be empty however 
+Metrics() will still be valid. 
+
+@pre The iterator has been initialised by successfully calling Open().
+     
+@return A handle to the image where the glyph for this iteration is stored.
+     
+@panic FBSCLI 31, if the iterator is not open.
+ */
+EXPORT_C const RSgImage& RFbsGlyphDataIterator::Image() const
+    {
+    __ASSERT_ALWAYS(iImpl, Panic(EFbsPanicGlyphDataIteratorClosed));
+    __ASSERT_DEBUG(!iImpl->iGlyphBatch.IsEmpty(), Panic(EFbsPanicGlyphDataIteratorInvalidState));
+    return iImpl->iGlyphBatch.First()->iImage;
+    }
+
+/**
+Returns the area within the RSgImage where the glyph for the current
+iteration is located. The reference returned by Rect() should be considered 
+temporary for use within this iteration and should not be used after a call to 
+Next() or Close() has been made.
+ 
+@pre The iterator has been initialised by successfully calling Open().
+     
+@return A rectangle representing the position and size in pixels, 
+	of the glyph for this iteration on the RSgImage provided by Image().
+     
+@panic FBSCLI 31, if the iterator is not open.
+ */
+EXPORT_C const TRect& RFbsGlyphDataIterator::Rect() const
+    {
+    __ASSERT_ALWAYS(iImpl, Panic(EFbsPanicGlyphDataIteratorClosed));
+    __ASSERT_DEBUG(!iImpl->iGlyphBatch.IsEmpty(), Panic(EFbsPanicGlyphDataIteratorInvalidState));
+    return iImpl->iGlyphDataIterRect;
+    }
+
+/**
+Returns the glyph metrics for the current iteration. The reference returned by 
+Metrics() should be considered temporary for use within this iteration and 
+should not be used after a call to Next() or Close() has been made.
+
+@pre The iterator has been initialised by successfully calling Open().
+ 
+@return The metrics for the glyph at the current iteration.
+
+@panic FBSCLI 31, if the iterator is not open.
+ */
+EXPORT_C const TOpenFontCharMetrics& RFbsGlyphDataIterator::Metrics() const
+    {
+    __ASSERT_ALWAYS(iImpl, Panic(EFbsPanicGlyphDataIteratorClosed));
+    __ASSERT_DEBUG(!iImpl->iGlyphBatch.IsEmpty(), Panic(EFbsPanicGlyphDataIteratorInvalidState));
+    return iImpl->iGlyphBatch.First()->iInfo.iMetrics;
+    }
+
+/**
+Returns the glyph code associated with the data for the current iteration.
+
+@pre The iterator has been initialised by successfully calling Open().
+ 
+@return The glyph code of the glyph at the current iteration.
+
+@panic FBSCLI 31, if the iterator is not open.
+ */
+EXPORT_C TUint RFbsGlyphDataIterator::GlyphCode() const
+    {
+    __ASSERT_ALWAYS(iImpl, Panic(EFbsPanicGlyphDataIteratorClosed));
+    __ASSERT_DEBUG(!iImpl->iGlyphBatch.IsEmpty(), Panic(EFbsPanicGlyphDataIteratorInvalidState));
+    return iImpl->iGlyphDataIterCodes[iImpl->iGlyphDataIterCodeIndex];
+    }
+
+
+/**
+Constructs a CGlyphDataIteratorImpl. 
+@param aFbsFontHandle The handle of the FbsFont that the iterator is working with.
+@param aGlyphCodes The array of glyph codes sent to RFbsGlyphDataIterator::Open()
+@param aCount The number of glyph codes in aGlyphCodes.
+ */
+CGlyphDataIteratorImpl::CGlyphDataIteratorImpl(TInt aFbsFontHandle, const TUint* aGlyphCodes, TInt aCount) :
+    iGlyphBatch(_FOFF(TGlyphBatchItem, iLink)),
+    iGlyphDataIterCodes(aGlyphCodes),
+    iGlyphDataIterCodeCount(aCount),
+    iGlyphDataIterCodeIndex(KFbsGlyphDataIterCodeInvalid),
+    iFbsFontHandle(aFbsFontHandle)
+    {
+    }
+
+/** 
+Destructor. Releases all resources, disconnects from server and frees any
+items in the list of batched items.
+ */
+CGlyphDataIteratorImpl::~CGlyphDataIteratorImpl()
+    {
+    if (iFbs)
+        {
+        if (iGlyphDataIterCodeIndex != KFbsGlyphDataIterCodeInvalid)
+            {
+            //Send the No-Op command to ensure that the "In Transit" RSgImage(s) are closed.
+            iFbs->SendCommand(EFbsMessNoOp);
+            }
+        RFbsSession::Disconnect();
+        iFbs = NULL;
+        }
+    while (!iGlyphBatch.IsEmpty())
+        {
+        TGlyphBatchItem* item = iGlyphBatch.First();
+        item->iImage.Close();
+        iGlyphBatch.Remove(*item);
+        delete item;
+        }
+    iGlyphBatch.Reset();
+    }
+
+/**
+Sets up the CGlyphDataIteratorImpl, populating the first batch of glyphs.
+Should only be called once, immediately after construction.
+ */
+TInt CGlyphDataIteratorImpl::Initialise()
+    {
+    __ASSERT_DEBUG(iFbsFontHandle, Panic(EFbsPanicGlyphDataIteratorInvalidState));    
+    __ASSERT_DEBUG(iGlyphDataIterCodes, Panic(EFbsPanicGlyphDataIteratorInvalidState));
+    __ASSERT_DEBUG(iGlyphDataIterCodeCount, Panic(EFbsPanicGlyphDataIteratorInvalidState));
+    __ASSERT_DEBUG(iGlyphDataIterCodeIndex == KFbsGlyphDataIterCodeInvalid, Panic(EFbsPanicGlyphDataIteratorInvalidState));
+    
+    // If the client already has a session open, this is just a reference counting exercise and should incur no performance impact.
+    TInt err = RFbsSession::Connect();
+    if (err == KErrNone)
+        {
+        iFbs = RFbsSession::GetSession();
+        err = UpdateGlyphBatch(0);
+        }
+    if (err == KErrNone)
+        {
+        iGlyphDataIterCodeIndex = 0;
+        UpdateGlyphRect();
+        }
+    return err;
+    }
+
+/**
+Increments the current iteration if possible, re-sending the request
+for more glyphs if the current batch of glyphs is down to the last
+item.
+@see RFbsGlyphDataIterator::Next()
+ */
+TInt CGlyphDataIteratorImpl::Next()
+    {
+    __ASSERT_DEBUG(!iGlyphBatch.IsEmpty(), Panic(EFbsPanicGlyphDataIteratorInvalidState));
+    if ( (iGlyphDataIterCodeIndex + 1) >= iGlyphDataIterCodeCount) 
+        {
+        return KErrNotFound; 
+        }
+    TInt err = UpdateGlyphBatch(iGlyphDataIterCodeIndex + 1);
+    if (err == KErrNone)
+        {
+        ++iGlyphDataIterCodeIndex;
+        // Close the current image and pop the head of the batch.
+        TGlyphBatchItem* item = iGlyphBatch.First();
+        item->iImage.Close();
+        iGlyphBatch.Remove(*item);
+        delete item;
+        __ASSERT_DEBUG(!iGlyphBatch.IsEmpty(), Panic(EFbsPanicGlyphDataIteratorInvalidState));
+        UpdateGlyphRect();
+        }
+    return err;
+    }
+
+/**
+Checks whether a call to the server is required to get a new batch of glyph 
+info, and processes the response from the server as necessary.
+
+@param aIndex Specifies the index into the glyph array which needs to be in
+the active glyph batch. If it is not there, a request is made to the server
+to get it.
+@return KErrNone if getting at least one glyph succeeded or a call to the
+    server was not necessary, otherwise one of the system wide error codes.
+@panic FBSCLI 31 (debug only), if the iterator is not open
+@panic FBSCLI 33 (debug only), if an unexpected number of glyphs was received
+    as a result of requesting glyphs from the server, or if the current batch
+    of glyphs is empty when there should be at least one item.
+ */
+TInt CGlyphDataIteratorImpl::UpdateGlyphBatch(TInt aIndex)
+    {
+    __ASSERT_DEBUG(Rng(0, aIndex, iGlyphDataIterCodeCount - 1), Panic(EFbsPanicGlyphDataIteratorIndexOutOfRange));
+
+    TInt err = KErrNone;
+    
+    TBool needMoreGlyphs = EFalse;
+    if (iGlyphBatch.IsEmpty())
+        {
+        // Current batch is empty, must request more. Should only get here when the iterator 
+        // is first opened, since one item should always be in the list from then on.
+        __ASSERT_DEBUG(aIndex == 0, Panic(EFbsPanicGlyphDataIteratorInvalidState));
+        needMoreGlyphs = ETrue;
+        }
+    else if (iGlyphBatch.IsLast(iGlyphBatch.First()))
+        {
+        // Only one item in the list. 
+        needMoreGlyphs = ETrue;
+        }
+    
+    if (needMoreGlyphs)
+        {
+        // If the array of batched images is empty OR only one left, means we need to request a new batch.
+        // We make sure there is at least one glyph in the batch so the iterator is always usable even
+        // when a failure to move to the next iteration occurs.
+    
+        TBool glyphAddedToBatch = EFalse;
+        TUint glyphCodes[KMaxGlyphBatchSize];
+        
+        TInt numGlyphsToRequest = Min(iGlyphDataIterCodeCount - aIndex, KMaxGlyphBatchSize);        
+        (void)Mem::Copy(glyphCodes, &(iGlyphDataIterCodes[aIndex]), sizeof(TUint) * numGlyphsToRequest);
+        TPckg<TUint[KMaxGlyphBatchSize]> argGlyphCodes(glyphCodes);
+        
+        TGlyphImageInfo rcvdGlyphInfo[KMaxGlyphBatchSize];
+        TPckg<TGlyphImageInfo[KMaxGlyphBatchSize]> argGlyphInfo(rcvdGlyphInfo);
+        
+        if (numGlyphsToRequest < KMaxGlyphBatchSize)
+            {
+            argGlyphCodes.SetLength(numGlyphsToRequest * sizeof(TUint));
+            argGlyphInfo.SetLength(numGlyphsToRequest * sizeof(TGlyphImageInfo));
+            }
+        
+        err = iFbs->SendCommand(EFbsMessGetGlyphs, TIpcArgs(iFbsFontHandle, &argGlyphCodes, &argGlyphInfo));
+        if (err == KErrNone)
+            {
+            __ASSERT_DEBUG(argGlyphInfo.Length() % sizeof(TGlyphImageInfo) == 0, Panic(EFbsPanicGlyphDataIteratorInvalidState));
+            TInt numRcvdGlyphs = argGlyphInfo.Length() / sizeof(TGlyphImageInfo);
+            __ASSERT_DEBUG(numRcvdGlyphs > 0, Panic(EFbsPanicGlyphDataIteratorInvalidState));
+            __ASSERT_DEBUG(numRcvdGlyphs <= KMaxGlyphBatchSize, Panic(EFbsPanicGlyphDataIteratorInvalidState));
+            
+            // Store the received glyph data, and open the image handles so that the IDs
+            // will not be released by FbServ between now and the client using them.
+            // If a failure occurs while processing one of the recevied glyphs,
+            // abort the rest but keep the ones that succeeded.
+            for (TInt i = 0; (i < numRcvdGlyphs) && (err == KErrNone); ++i)
+                {
+                TGlyphBatchItem* glyphEntry = new TGlyphBatchItem;
+                if (!glyphEntry)
+                    {
+                    err = KErrNoMemory;
+                    }
+                else
+                    {
+                    glyphEntry->iInfo = rcvdGlyphInfo[i];
+                    
+                    RSgImage glyphImage;
+                    if (rcvdGlyphInfo[i].iImageId != KSgNullDrawableId)
+                        {
+                        err = glyphEntry->iImage.Open(rcvdGlyphInfo[i].iImageId);
+                        }
+                    if (err == KErrNone)
+                        {
+                        iGlyphBatch.AddLast(*glyphEntry);
+                        glyphAddedToBatch = ETrue;
+                        }
+                    else
+                        {
+                        delete glyphEntry;
+                        }
+                    }
+                }
+            }
+        if (err != KErrNone && glyphAddedToBatch)
+            {
+            // There was an error adding an item to the batch. Rather than return the
+            // error to the client, ignore it and use what glyphs we successfully batched.
+            err = KErrNone; 
+            }
+        }    
+    return err;
+    }
+
+/**
+Updates the glyph rectangle member based on the current glyph metrics.
+@post The iGlyphDataIterRect member is updated to reflect the position
+    and size of the currently active glyph.
+ */
+void CGlyphDataIteratorImpl::UpdateGlyphRect()
+    {
+    iGlyphDataIterRect.iTl = TPoint(iGlyphBatch.First()->iInfo.iPosX, iGlyphBatch.First()->iInfo.iPosY);
+    iGlyphDataIterRect.SetSize(TSize(iGlyphBatch.First()->iInfo.iMetrics.Width(), iGlyphBatch.First()->iInfo.iMetrics.Height()));
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/sfbs/fbsglyphdataiterator.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,53 @@
+// Copyright (c) 2009-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 FBSGLYPHDATAITERATOR_H
+#define FBSGLYPHDATAITERATOR_H
+
+#include <e32def.h>
+#include <fbs.h>
+#include <sgresource/sgimage.h>
+
+class CGlyphDataIteratorImpl;
+class TOpenFontCharMetrics;
+
+/**
+An iterator class to provide access to glyph image data and metrics, 
+one glyph per iteration.
+@publishedPartner
+@prototype
+*/
+NONSHARABLE_CLASS(RFbsGlyphDataIterator)
+	{
+public:
+	IMPORT_C RFbsGlyphDataIterator();
+	IMPORT_C TInt Open(CFbsFont& aFont, const TUint* aGlyphCodes, TInt aCount);
+	IMPORT_C TInt Next();
+	IMPORT_C void Close();
+	IMPORT_C const RSgImage& Image() const;
+	IMPORT_C const TRect& Rect() const;
+	IMPORT_C const TOpenFontCharMetrics& Metrics() const;
+	IMPORT_C TUint GlyphCode() const;
+	
+private:
+	RFbsGlyphDataIterator(const RFbsGlyphDataIterator&);
+	const RFbsGlyphDataIterator& operator =(const RFbsGlyphDataIterator&);
+	
+private:
+    CGlyphDataIteratorImpl* iImpl;
+	};
+
+#endif /* FBSGLYPHDATAITERATOR_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/sfbs/fbsglyphmetricsarray.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,274 @@
+// Copyright (c) 2009-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 <e32def.h>
+#include <gdi.h>
+#include <graphics/gdi/gdistructs.h>
+#include <graphics/gdi/gdiconsts.h>
+#include <graphics/fbsglyphmetricsarray.h>
+#include "UTILS.H"
+#include "FbsMessage.h"
+
+// 'most significant bit' flag to ensure value is interpreted as a glyph code rather than an ascii code
+const TUint KGlyphCodeFlag = 0x80000000;      
+
+extern void Panic(TFbsPanic aPanic);
+
+/** Helper function for converting an offset (that was calculated using
+PointerToOffset()) back to a pointer relative to the passed heap base.
+@param aOffset The offset to be converted to a pointer.
+@param aHeapBase A pointer to the heap base of the current process.
+@return A pointer relative to the passed heap base.
+*/
+static TAny* OffsetToPointer(const TInt aOffset, TUint8* aHeapBase)
+    {
+    if ( (aOffset != 0) && (aHeapBase != NULL) )
+        {
+        return (TAny*)(aOffset + aHeapBase);
+        }
+    return NULL;
+    }
+
+/**
+Constructs an empty RFbsGlyphMetricsArray instance. This will not allocate any memory.
+ */
+EXPORT_C RFbsGlyphMetricsArray::RFbsGlyphMetricsArray() :
+    iGlyphCodes(NULL)
+    {
+    }
+
+/**
+Allocates the memory for the array if it has not already been allocated, and 
+populates the RFbsGlyphMetricsArray with the metrics information for aCount glyph 
+codes passed in as the array aGlyphCodes, for the font aFont. If the operation 
+is successful, KErrNone is returned and the array is populated with glyph 
+metrics data. Each entry in the array will be in the same order as the 
+corresponding codes in aGlyphCodes.
+
+The memory allocated to aGlyphCodes can be freed after the call to Get().
+
+Get() can be called on an RFbsGlyphMetricsArray multiple times without calling 
+Close(), since the memory for the array is not de-allocated until a call to 
+Close(). Calls to Get() will cause the previous content of the array to be 
+overwritten.
+
+In the event of an error code other than KErrNone, the state of the array
+will remain unchanged.
+ 
+@param aFont A font which to retrieve the glyph metrics for.
+@param aGlyphCodes An array of glyph codes to retrieve the metrics for.
+@param aCount The number of glyph codes in aGlyphCodes.
+
+@return
+	KErrNone, if the array is successfully populated with glyph metrics;
+	KErrNoMemory, if insufficient system memory is available;
+	KErrArgument, if aCount is negative or zero, or if aGlyphCodes is null;
+	KErrNotSupported, if aFont is a bitmap font.
+*/
+EXPORT_C TInt RFbsGlyphMetricsArray::Get(CFbsFont& aFont, const TUint* aGlyphCodes, TInt aCount)
+	{
+    if ((aCount <= 0) || !aGlyphCodes)
+        {
+        return KErrArgument;
+        }
+    if (iMetrics.Reserve(aCount) != KErrNone)
+        {
+        return KErrNoMemory;
+        }
+    if (!aFont.Address()->IsOpenFont())
+        {
+        return KErrNotSupported;
+        }
+    
+    iGlyphCodes = aGlyphCodes;
+    iCount = aCount;
+    TInt err = KErrNone;
+    
+    
+    // If iMetrics array already has a count greater than aCount, remove entries
+    // until count is same as aCount so that we can reuse the existing entries.
+    TInt numEntriesToRemove = iMetrics.Count() - aCount;
+    while (0 < numEntriesToRemove)
+        {
+        --numEntriesToRemove;
+        iMetrics.Remove(aCount + numEntriesToRemove);
+        }
+    const TInt indexToGrowArrayAt = iMetrics.Count();
+    
+    CBitmapFont* font = aFont.Address();
+    TUint ipcGlyphArrayIndex[KMaxMetricsBatchSize];
+    TInt ipcGlyphArrayIndexCount = 0;   
+    const TUint8* dummyBitmap;
+    TOpenFontCharMetrics charDataMetrics;
+            
+    for (TInt i = 0; i < aCount && (err == KErrNone); ++i)
+        {
+        // First check the cache in shared memory - if present it will avoid using IPC.
+        if (font->GetCharacterData(aFont.iFbs->ServerSessionHandle(), aGlyphCodes[i] | KGlyphCodeFlag, charDataMetrics, dummyBitmap))
+            {
+            if (i < indexToGrowArrayAt)
+                {
+                iMetrics[i] = charDataMetrics;
+                }
+            else
+                {
+                // Extending the size of the array, but memory is already reserved.
+                (void) iMetrics.Append(charDataMetrics);    
+                }
+            }            
+        else
+            {
+            // Not found in shared memory - instead add the index to index array, which will
+            // be processed when the array is full or at the end of the loop.
+            ipcGlyphArrayIndex[ipcGlyphArrayIndexCount++] = i;
+            if (ipcGlyphArrayIndexCount == KMaxMetricsBatchSize)
+                {
+                err = SendRecvGlyphMetrics(aFont, ipcGlyphArrayIndex, ipcGlyphArrayIndexCount, &iMetrics);
+                ipcGlyphArrayIndexCount = 0;
+                }
+            else if (i >= indexToGrowArrayAt)
+                {
+                // Add a metrics placeholder to keep the size of the array and the currently
+                // processed glyph in sync. It will later get overwritten when it is received
+                // from the server.
+                (void) iMetrics.Append(charDataMetrics);
+                }
+            }
+        }
+    if ((err == KErrNone) && (ipcGlyphArrayIndexCount != 0))
+        {
+        err = SendRecvGlyphMetrics(aFont, ipcGlyphArrayIndex, ipcGlyphArrayIndexCount, &iMetrics);
+        }
+    
+    __ASSERT_DEBUG((err != KErrNone) || (aCount == iMetrics.Count()), Panic(EFbsPanicGlyphMetricsArrayInvalidState));  
+    
+    return err;    
+	}
+/**
+Helper function for Get(). 
+Given a list of indices into a glyph code array, the corresponding glyph
+codes are made into a single list sent to the server, and the received glyph
+metrics are set in the array of metrics at the corresponding indices.
+
+@param aFont The font to receive the glyph metrics of.
+@param aArrayIndices An array of indices into the glyphcode array which
+    will be sent for requesting of metrics to the server.
+@param aArrayIndicesCount The number of glyphs in aGlyphArrayIndices.
+@param aMetrics The array which will store the resulting metrics objects upon
+    completion.
+@return KErrNone if successful, otherwise one of the system-wide error codes. 
+
+@panic FBSCLI 39 in debug builds only, if the parameters to this method are
+    invalid, or if the output array is of the wrong size when appending to it.
+ */
+TInt RFbsGlyphMetricsArray::SendRecvGlyphMetrics(CFbsFont& aFont, TUint* aArrayIndices, TInt aArrayIndicesCount, RArray<TOpenFontCharMetrics>* aMetrics) const
+    {
+    __ASSERT_DEBUG(aArrayIndicesCount > 0, Panic(EFbsPanicGlyphDataIteratorInvalidState)); 
+    __ASSERT_DEBUG(aArrayIndicesCount <= KMaxMetricsBatchSize, Panic(EFbsPanicGlyphDataIteratorInvalidState)); 
+    __ASSERT_DEBUG(aArrayIndices, Panic(EFbsPanicGlyphDataIteratorInvalidState));
+    TInt err = KErrNone;
+    
+    TUint glyphCodes[KMaxMetricsBatchSize];
+    for (TInt i = 0; i < aArrayIndicesCount; ++i)
+        {
+        glyphCodes[i] = iGlyphCodes[aArrayIndices[i]];
+        }
+    
+    TInt rcvdGlyphMetricsOffsets[KMaxMetricsBatchSize];
+    TPckg<TUint[KMaxMetricsBatchSize]> argGlyphCodes(glyphCodes);
+    TPckg<TInt[KMaxMetricsBatchSize]> argGlyphMetricsOffsets(rcvdGlyphMetricsOffsets);
+    if (aArrayIndicesCount < KMaxMetricsBatchSize)
+        {
+        argGlyphCodes.SetLength(aArrayIndicesCount * sizeof(TUint));
+        argGlyphMetricsOffsets.SetLength(aArrayIndicesCount * sizeof(TInt));
+        }   
+    err = aFont.iFbs->SendCommand(EFbsMessGetGlyphMetrics, TIpcArgs(aFont.iHandle, &argGlyphCodes, &argGlyphMetricsOffsets));
+    
+    if (err == KErrNone)
+        {
+        TInt numRcvdMetrics = argGlyphMetricsOffsets.Length() / sizeof(TInt);
+        __ASSERT_DEBUG(argGlyphMetricsOffsets.Length() % sizeof(TInt) == 0, Panic(EFbsPanicGlyphMetricsArrayInvalidState));
+        __ASSERT_DEBUG(numRcvdMetrics == aArrayIndicesCount, Panic(EFbsPanicGlyphMetricsArrayInvalidState));
+        
+        if (numRcvdMetrics == aArrayIndicesCount)
+            {
+            TInt arrayCount = aMetrics->Count();
+            TUint8* heapBase = aFont.iFbs->HeapBase();
+            for (TInt rcvdMetricsItem = 0; rcvdMetricsItem < numRcvdMetrics; ++rcvdMetricsItem)
+                {
+                TInt arrayIndex = aArrayIndices[rcvdMetricsItem];
+                // The array should never need to grow more than one item. If the difference is larger, 
+                // it means the glyph and the metrics are not in sync.
+                __ASSERT_DEBUG(arrayIndex <= arrayCount, Panic(EFbsPanicGlyphMetricsArrayInvalidState));
+                
+                TInt metricsOffset = rcvdGlyphMetricsOffsets[rcvdMetricsItem];              
+                const TOpenFontCharMetrics* metrics = (const TOpenFontCharMetrics*)(OffsetToPointer(metricsOffset, heapBase));
+                
+                if (arrayIndex < arrayCount)
+                    {
+                    // Copy metrics into existing element
+                    (*aMetrics)[arrayIndex] = *metrics;
+                    }
+                else if (arrayIndex == arrayCount)
+                    {
+                    // Memory should already be reserved by GetGlyphMetricsArray()
+                    (void) aMetrics->Append(*metrics);    
+                    ++arrayCount;
+                    }
+                }
+            }
+        else
+            {
+            // did not receive the same number of glyphs as was asked.
+            err = KErrGeneral;
+            }
+        }
+    return err;
+    }
+
+/**
+Closes the array, and releases the memory for the array. Calling Close() on an 
+already closed RFbsGlyphMetricsArray has no effect. 
+
+In the typical case where the array is a member of a class, Close() should only 
+be called in the destructor of that class.
+ */
+EXPORT_C void RFbsGlyphMetricsArray::Close()
+	{
+	iMetrics.Close();
+	}
+
+/**
+Retrieves the glyph metrics for the glyph which was at position aIndex in the 
+array passed to Get().
+
+@param aIndex The index of the entry in the array to access.
+@return The metrics for the glyph at the requested index.
+@panic FBSCLI 32, if aIndex is out of bounds.
+ */
+EXPORT_C const TOpenFontCharMetrics& RFbsGlyphMetricsArray::operator[](TInt aIndex) const
+	{
+	__ASSERT_ALWAYS(aIndex >= 0 && aIndex < iMetrics.Count(), Panic(EFbsPanicGlyphMetricsArrayOutOfBounds));
+	return (iMetrics)[aIndex];
+	}
+
+/**
+@return The number of glyph metrics held in the array.
+ */
+EXPORT_C TInt RFbsGlyphMetricsArray::Count() const
+	{
+	return iMetrics.Count();
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/sfbs/fbsglyphmetricsarray.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,47 @@
+// Copyright (c) 2009-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 FBSGLYPHMETRICSARRAY_H
+#define FBSGLYPHMETRICSARRAY_H
+
+#include <e32def.h>
+#include <openfont.h>
+#include <fbs.h>
+
+/**
+@publishedPartner
+@prototype
+*/
+NONSHARABLE_CLASS(RFbsGlyphMetricsArray)
+	{
+public:
+	IMPORT_C RFbsGlyphMetricsArray();
+	IMPORT_C TInt Get(CFbsFont& aFont, const TUint* aGlyphCodes, TInt aCount);
+	IMPORT_C void Close();
+	IMPORT_C TInt Count() const;
+	IMPORT_C const TOpenFontCharMetrics& operator[](TInt aIndex) const;
+	
+private:
+	RFbsGlyphMetricsArray(const RFbsGlyphMetricsArray&);
+	const RFbsGlyphMetricsArray& operator =(const RFbsGlyphMetricsArray&);
+	TInt SendRecvGlyphMetrics(CFbsFont& aFont, TUint* aArrayIndices, TInt aArrayIndicesCount, RArray<TOpenFontCharMetrics>* aMetrics) const;    
+	
+private:
+	RArray<TOpenFontCharMetrics> iMetrics;
+	const TUint* iGlyphCodes;
+	TInt iCount;
+	};
+
+#endif /* FBSGLYPHMETRICSARRAY_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/sfbs/fbsoogmmessage.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,45 @@
+// Copyright (c) 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:
+//
+// Message class defining the action desired in response to a notification from
+// FBserv's Out-of-Graphics-Memory plug-in.
+//
+#ifndef FBSOOGMMESSAGE_H
+#define FBSOOGMMESSAGE_H
+
+
+class TFbsOogmMessage
+    {
+public:
+
+    enum TOogmAction
+        {
+        EFbsOogmNoAction = 0,
+        EFbsOogmLowNotification,
+        EFbsOogmOkayNotification
+        };
+
+public:
+    inline TFbsOogmMessage();
+    inline TFbsOogmMessage( TOogmAction aOogmAction, TInt aBytesToFree, TInt aFlags );
+
+public:
+    TOogmAction iOogmNotification;
+    TInt iBytesToFree;
+    TInt iFlags;
+    };
+
+
+#include <graphics/fbsoogmmessage.inl>
+#endif // FBSOOGMMESSAGE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/sfbs/fbsoogmmessage.inl	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,33 @@
+// Copyright (c) 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 FBSOOGMMESSAGE_INL
+#define FBSOOGMMESSAGE_INL
+
+const TInt KFbsOogmBytesToFreeNone = 0;
+const TInt KFbsOogmFlagsClear = 0;
+
+
+inline TFbsOogmMessage::TFbsOogmMessage()
+: iOogmNotification( EFbsOogmNoAction ), iBytesToFree( KFbsOogmBytesToFreeNone ), iFlags( KFbsOogmFlagsClear )
+    {
+    }
+
+
+inline TFbsOogmMessage::TFbsOogmMessage( TOogmAction aOogmAction, TInt aBytesToFree, TInt aFlags )
+: iOogmNotification( aOogmAction ), iBytesToFree( aBytesToFree), iFlags( aFlags )
+    {
+    }
+
+#endif // FBSOOGMMESSAGE_INL
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/sfbs/fbsoogmplugin.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,162 @@
+/*
+* Copyright (c) 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:  Graphics-Out-Of-Memory plugin for Font and Bitmap server.
+*
+*/
+
+#include <ecom/ecom.h>
+#include <ecom/implementationproxy.h>
+#include <graphics/fbsoogmmessage.h>
+#include <w32std.h>
+#include <FBS.H>
+
+#include "fbsoogmplugin.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "fbsoogmpluginTraces.h"
+#endif
+
+
+/**
+ Called by the GOoM monitor framework in the case of low GPU memory.
+
+ Note: In the case of failure, this framework method will do so silently.
+
+ @param aBytesToFree The amount of GPU memory to be freed.
+ */
+void CFbsOogmMonitorPlugin::FreeRam( TInt aBytesToFree, TInt aFlags )
+    {
+    OstTrace0( TRACE_NORMAL, CFBSOOGMMONITORPLUGIN_FREERAM, "> " );
+
+    if ( (NULL == RFbsSession::GetSession()) )
+         {
+         if ( KErrNone != RFbsSession::Connect() )
+             {
+             OstTrace0( TRACE_NORMAL, DUP2_CFBSOOGMMONITORPLUGIN_FREERAM, "< No FbsSession" );
+
+             return;
+             }
+
+         }
+
+    TFbsOogmMessage oogmMessage( TFbsOogmMessage::EFbsOogmLowNotification, aBytesToFree, aFlags );
+    (void)RFbsSession::GetSession()->ConveyOogmMessage( oogmMessage );
+
+    OstTrace0( TRACE_NORMAL, DUP1_CFBSOOGMMONITORPLUGIN_FREERAM, "< " );
+    }
+
+
+
+/**
+ Called by the GOoM monitor framework in the case of normal GPU memory-usage being permissible.
+
+ Note: In the case of failure, this framework method will do so silently.
+ */
+void CFbsOogmMonitorPlugin::MemoryGood( TInt aFlags )
+    {
+    OstTrace0( TRACE_NORMAL, CFBSOOGMMONITORPLUGIN_MEMORYGOOD, ">" );
+
+    if ( (NULL == RFbsSession::GetSession()) )
+         {
+        if ( KErrNone != RFbsSession::Connect() )
+            {
+            OstTrace0( TRACE_NORMAL, DUP2_CFBSOOGMMONITORPLUGIN_MEMORYGOOD, "< No FbsSession" );
+
+            return;
+            }
+
+         }
+
+    const TInt KOogmDummyIntegerArgument = 0;
+    TFbsOogmMessage oogmMessage( TFbsOogmMessage::EFbsOogmOkayNotification, KOogmDummyIntegerArgument, aFlags );
+    (void)RFbsSession::GetSession()->ConveyOogmMessage( oogmMessage );
+
+	OstTrace0( TRACE_NORMAL, DUP1_CFBSOOGMMONITORPLUGIN_MEMORYGOOD, "<" );
+    }
+
+
+
+/**
+
+ */
+CFbsOogmMonitorPlugin::CFbsOogmMonitorPlugin()
+    {
+    }
+
+
+
+/**
+
+ */
+CFbsOogmMonitorPlugin::~CFbsOogmMonitorPlugin()
+    {
+    RFbsSession::Disconnect();
+    }
+
+
+
+/**
+
+ */
+void CFbsOogmMonitorPlugin::ConstructL()
+    {
+    CGOomMonitorPluginBase::ConstructL();
+    }
+
+
+
+/**
+
+ */
+TAny* CreatePlugin()
+    {
+    CFbsOogmMonitorPlugin* self = new CFbsOogmMonitorPlugin;
+    if ( self )
+        {
+        TRAPD( err, self->ConstructL() );
+        if ( err != KErrNone )
+            {
+            delete self;
+            self = NULL;
+            }
+        }
+
+    return self;
+    }
+
+
+
+/**
+
+ */
+const TImplementationProxy ImplementationTable[] =
+    {
+    { {0x2002B638}, ::CreatePlugin }
+    };
+
+
+
+/**
+
+ */
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+    {
+    OstTrace0( TRACE_NORMAL, _IMPLEMENTATIONGROUPPROXY, "> ::ImplementationGroupProxy" );
+    
+    aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ) ;
+    return ImplementationTable;
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/sfbs/fbsoogmplugin.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 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:  Graphics-Out-Of-Memory plugin for Font and Bitmap server.
+*
+*/
+
+#ifndef FBSOOGMPLUGIN_H
+#define FBSOOGMPLUGIN_H
+
+#include <goommonitorplugin.h>
+
+class CFbsOogmMonitorPlugin : public CGOomMonitorPlugin
+    {
+public:
+    CFbsOogmMonitorPlugin();
+    ~CFbsOogmMonitorPlugin();
+    void ConstructL();
+
+public:
+    void FreeRam( TInt aBytesToFree, TInt aFlags );
+    void MemoryGood( TInt aFlags );
+    };
+
+#endif /* FBSOOGMPLUGIN_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/sfbs/fbsoogmplugin.rss	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* ============================================================================
+*  Name        : FbsOogmPlugin.rss
+*  Part of     : FbSrv OOGM Plugin
+*  Interface   :  
+*  Description : ECOM Resource file for Font and bitmap server OOGM Framework Plugin
+*
+*  Copyright © 2010 Nokia.  All rights reserved.
+*  This material, including documentation and any related computer
+*  programs, is protected by copyright controlled by Nokia.  All
+*  rights are reserved.  Copying, including reproducing, storing,
+*  adapting or translating, any or all of this material requires the
+*  prior written consent of Nokia.  This material also contains
+*  confidential information which may not be disclosed to others
+*  without the prior written consent of Nokia.
+* ============================================================================
+* Template version: 4.0
+*/
+
+#include <ecom/registryinfov2.rh>
+#include <goommonitorplugin.hrh>
+
+
+
+
+// ---------------------------------------------------------------------------
+// Registration info for ECOM framework.
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2; 
+    dll_uid = 0x2002B638;
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KGOomPluginInterfaceUidValue;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x2002B638;
+                    version_no = 1;
+                    display_name = "FbsOogmPlugin";
+                    opaque_data = "";
+					default_data = "FbsOogmPlugin";
+                    }
+                };       
+            }
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/sfbs/glyphatlas.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,1060 @@
+// Copyright (c) 2009-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 "glyphatlas.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "glyphatlasTraces.h"
+#endif
+
+
+extern void Panic(TFbsPanic aPanic);
+
+static TInt16 Load16(const TUint8* aPtr);
+static void DecodeBinaryData(const TSize& aGlyphSize, const TUint8* aEncodedData, TUint8* aByteData);
+static void DecodeBinaryDataExLarge(const TSize& aGlyphSize, const TUint8* aEncodedData, TUint8* aByteData);
+static void Convert1BppTo8Bpp(TUint32 aSrcData, TUint8*& aDestDataPtr, const TUint8* aDestDataPtrLimit);
+static void CopyCharLine(TUint8*& aByteDataPtr, TInt aWidthInBytes, const TUint8* aSrcData, TInt aBitShift, TInt16 aRepeatCount);
+
+// === CGlyphAtlas Functions ===
+
+/**
+Glyph Atlas constructor.
+@param aMaxCacheSizeInBytes The maximum amount of specialised graphics memory 
+	that the glyph atlas should use. If this value is KGlyphAtlasNoCacheLimit,
+	then there is no limit and the atlas will use as much memory as is available
+	in the system.
+*/
+CGlyphAtlas::CGlyphAtlas(TInt aMaxCacheSizeInBytes)
+	:iLruPageList(_FOFF(CGlyphAtlasPage, iLink)),
+	 iFontEntryArray(32, _FOFF(TFontEntryMap, iFont)),
+	 iMaxCacheSizeInBytes(aMaxCacheSizeInBytes),
+	 iMaxCacheSizeHigh(aMaxCacheSizeInBytes),
+	 iGpuCacheSizeLimitIsMax(ETrue)
+	{
+    iMaxCacheSizeLow = ( KGlyphAtlasNoCacheLimit == aMaxCacheSizeInBytes )
+                     ? KGlyphAtlasLowMemCacheLimitDefault
+                     : ( aMaxCacheSizeInBytes / KGlyphAtlasLowMemCacheLimitDivisor );
+	}
+
+/**
+Glyph Atlas destructor.
+Frees all the RSgImage handles, frees all the allocated system memory, and
+closes the Graphics Resource driver. 
+*/
+CGlyphAtlas::~CGlyphAtlas()
+	{
+	// cycle through all the font entries and destroy them
+	for (TInt ii = iFontEntryArray.Count()-1; ii >= 0; --ii)
+		{
+		DeleteFontEntry(iFontEntryArray[ii].iEntry);
+		}
+	iFontEntryArray.Close();
+	__ASSERT_DEBUG(iLruPageList.IsEmpty(), Panic(EFbsPanicGlyphAtlasInconsistentState));
+	
+	// there shouldn't be any remaining pages, but if there are, destroy them.
+	while (!iLruPageList.IsEmpty())
+		{
+		delete iLruPageList.First();
+		}
+	iSgDriver.Close();
+	}
+
+/**
+Factory constructor method. Creates a new glyph atlas.
+
+@param aMaxCacheSizeInBytes The size in bytes, to use as the upper limit
+	for the size of memory used by the glyph images in the atlas. If this
+	value is KGlyphAtlasNoCacheLimit, then there is no limit and the atlas
+	will use as much memory as is available in the system.
+
+@return A pointer to the newly-constructed atlas
+
+@leave KErrNoMemory if there was insufficient memory to create the atlas, 
+	or a system wide error code if its RSgDriver failed to open.
+*/
+CGlyphAtlas* CGlyphAtlas::NewL(TInt aMaxCacheSizeInBytes)
+	{
+	CGlyphAtlas* self = new (ELeave) CGlyphAtlas(aMaxCacheSizeInBytes);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(); // self;
+	return self;
+	}
+
+/**
+Two-phase constructor.
+@leave A system wide error code if RSgDriver failed to open.
+*/
+void CGlyphAtlas::ConstructL()
+	{
+	User::LeaveIfError(iSgDriver.Open());
+	}
+
+/**
+Retrieves a glyph from the atlas.
+If the glyph is found, the glyph data passed in is populated.
+
+@param[in] aFont The font the glyph belongs to.
+@param[in] aGlyphCode The glyph code for the glyph being requested.
+@param[out] aGlyphImageInfo The glyph image information if this function is successful.
+@return KErrNone if the glyph is found, KErrNotFound if not. 
+*/
+TInt CGlyphAtlas::GetGlyph(const CBitmapFont& aFont, TUint aGlyphCode, TGlyphImageInfo& aGlyphImageInfo)
+	{
+    OstTraceExt2( TRACE_NORMAL, CGLYPHATLAS_GETGLYPH, "> f=%x; gc=%04x",(TUint)&aFont, aGlyphCode);
+    
+	CGlyphAtlasFontEntry* fontEntry = FindFontEntry(aFont);
+	if (!fontEntry)
+		{
+        OstTrace0( TRACE_NORMAL, CGLYPHATLAS_GETGLYPH_END2, "< KErrNotFound");
+		return KErrNotFound;
+		}
+	TInt err = fontEntry->GetGlyph(aGlyphCode, aGlyphImageInfo);
+	
+	OstTraceExt5( TRACE_NORMAL, CGLYPHATLAS_GETGLYPH_END1, "< id=%08x%08x; w=%u; h=%u; err=%d", 
+	        (TUint)I64HIGH(aGlyphImageInfo.iImageId.iId), (TUint)I64LOW(aGlyphImageInfo.iImageId.iId),
+	        (TUint)aGlyphImageInfo.iMetrics.Width(), (TUint)aGlyphImageInfo.iMetrics.Height(), (TInt)err);
+	
+	return err;
+	}
+
+/**
+Adds a glyph to the atlas from a bitmap glyph and retrieves the glyph data.
+If there is insufficient memory to create a RSgImage, then the least recently 
+used pages (and all the glyphs contained within) are removed until there is 
+enough memory to continue.
+
+@param[in] aFont The font the glyph belongs to.
+@param[in] aArgs The information needed to create a glyph.
+@param[out] aGlyphImageInfo Upon return contains all the glyph image information needed to use the 
+		glyph in another process.
+@return KErrNone if the glyph was successfully added or other system-wide error.
+*/
+TInt CGlyphAtlas::AddGlyph(const CBitmapFont& aFont, const TAddGlyphArgs& aArgs, TGlyphImageInfo& aGlyphImageInfo)
+	{
+	OstTraceDefExt5( OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, CGLYPHATLAS_ADDGLYPH, "> f=%x; bp=%08x; gc=%04x; w=%u; h=%u", 
+	        (TUint)&aFont, (TUint)aArgs.iBitmapPointer, aArgs.iGlyphCode, 
+	        aArgs.iMetrics->Width(), aArgs.iMetrics->Height());
+	
+    // Find font entry and create if none found
+	CGlyphAtlasFontEntry* fontEntry = FindFontEntry(aFont);
+	TBool isNewFont = EFalse;
+	if (!fontEntry)
+		{
+		// Create a new font.
+		fontEntry = CreateFontEntry(aFont);
+		if (!fontEntry)
+			{
+            OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, CGLYPHATLAS_ADDGLYPH_END2, "< KErrNoMemory");
+			return KErrNoMemory;
+			}
+		isNewFont = ETrue;
+		}
+	TInt glyphSizeInBytes = 0;
+	TInt err = fontEntry->AddGlyph(aArgs, aGlyphImageInfo, glyphSizeInBytes);
+	if (KErrNone != err)
+		{
+		if (isNewFont)
+			{
+			DeleteFontEntry(fontEntry);
+			}
+		OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, CGLYPHATLAS_ADDGLYPH_END3, "< err=%d", err);
+		return err;
+		}
+	iCacheSizeInBytes += glyphSizeInBytes;
+
+	// If there is a cache limit and it is now exceeded, remove the least
+	// recently used pages until the cache size is within the upper limit. Do 
+	// not remove the page relating to the glyph which is being added, which is 
+	// now at the head of the LRU array.
+	if (iMaxCacheSizeInBytes != KGlyphAtlasNoCacheLimit)
+		{
+		TBool morePagesToDelete = ETrue;
+		while ((iCacheSizeInBytes > iMaxCacheSizeInBytes) && morePagesToDelete)
+			{
+			morePagesToDelete = DeleteLeastRecentlyUsedPage(EFalse);
+			}
+		}
+	
+	OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, CGLYPHATLAS_ADDGLYPH_END1, "< id=%08x%08x", 
+	            I64HIGH(aGlyphImageInfo.iImageId.iId), I64LOW(aGlyphImageInfo.iImageId.iId));
+    
+	return KErrNone;
+	}
+
+/**
+Releases all glyphs associated with a particular font when it has been
+released by the font system.
+
+@param aFont The font which is released.
+ */
+void CGlyphAtlas::FontReleased(const CBitmapFont& aFont)
+	{
+	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, CGLYPHATLAS_FONTRELEASED, "> f=%x", (TUint)&aFont);
+	
+    TInt index = iFontEntryArray.FindInUnsignedKeyOrder(TFontEntryMap(&aFont, NULL));
+	if (KErrNotFound == index)
+		{
+        OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, CGLYPHATLAS_FONTRELEASED_END2, "< KErrNotFound");
+		return;
+		}
+	CGlyphAtlasFontEntry* fontEntry = iFontEntryArray[index].iEntry;
+	iCacheSizeInBytes -= fontEntry->SizeInBytes();
+	delete fontEntry;
+	iFontEntryArray.Remove(index);
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, CGLYPHATLAS_FONTRELEASED_END3, "< KErrNone");
+	}
+
+/**
+Searches the array of font entries to find the entry for the given font.
+If the font entry is found, the entry is returned. If not a NULL pointer is 
+returned.
+
+@param aFont The font to match an entry with.
+@return The font entry if a match is found, NULL if not. 
+*/
+CGlyphAtlasFontEntry* CGlyphAtlas::FindFontEntry(const CBitmapFont& aFont) const
+	{
+	TFontEntryMap entryToMatch(&aFont, NULL);
+	TInt index = iFontEntryArray.FindInUnsignedKeyOrder(entryToMatch);
+	if (KErrNotFound == index)
+		{
+		return NULL;
+		}
+	return iFontEntryArray[index].iEntry;
+	}
+
+/**
+Deletes the given font entry.
+The mapping from the font to the font entry is removed.
+
+@param aFontEntry The entry to delete.
+*/
+void CGlyphAtlas::DeleteFontEntry(CGlyphAtlasFontEntry* aFontEntry)
+	{
+    __ASSERT_DEBUG(aFontEntry, Panic(EFbsPanicGlyphAtlasInconsistentState));
+    TInt index = iFontEntryArray.FindInUnsignedKeyOrder(TFontEntryMap(&aFontEntry->Font(), NULL));
+    __ASSERT_DEBUG(KErrNotFound != index, Panic(EFbsPanicGlyphAtlasInconsistentState));
+    if (KErrNotFound != index)
+        {
+        iFontEntryArray.Remove(index);
+        }
+    iCacheSizeInBytes -= aFontEntry->SizeInBytes();
+    delete aFontEntry;
+	}
+
+/**
+Moves the given page to the front (the position of the most recently used page) 
+of the usage order list.
+
+@param aPage The most recently used page.
+*/
+void CGlyphAtlas::MovePageToFront(CGlyphAtlasPage& aPage)
+	{
+	aPage.MoveToFirstInQueue(iLruPageList);
+	}
+
+/**
+Creates a font entry from the given font and adds a mapping from the font 
+to the font entry.
+If successful, the font entry is returned.
+If either the creation of the font entry or the adding the mapping fails, then 
+a NULL pointer is returned.
+
+@param aFont The font used to create a font entry from.
+@return A new font entry if successful, NULL if not.
+*/
+CGlyphAtlasFontEntry* CGlyphAtlas::CreateFontEntry(const CBitmapFont& aFont)
+	{
+	CGlyphAtlasFontEntry* fontEntry = new CGlyphAtlasFontEntry(aFont, *this);
+	if (!fontEntry)
+		{
+		return NULL;
+		}
+	// Add font entry to font entry array
+	TFontEntryMap fontEntryMap(&aFont, fontEntry);
+	TInt err = iFontEntryArray.InsertInUnsignedKeyOrder(fontEntryMap);
+	__ASSERT_DEBUG(KErrAlreadyExists != err, Panic(EFbsPanicGlyphAtlasInconsistentState));
+	if (KErrNone != err)
+		{
+		delete fontEntry;
+		fontEntry = NULL;
+		}
+	return fontEntry;
+	}
+
+/**
+Deletes the least recently used page and removes it from the list of pages
+held by the atlas.
+
+@param aAllowMruPageDeletion ETrue if the most recently used page can be deleted, 
+	EFalse otherwise.
+@return ETrue, if there are pages remaining in the atlas after the deletion, EFalse
+	otherwise. If there is only one page in the atlas and aAllowMruPageDeletion is EFalse,
+	EFalse is returned. 
+*/
+TBool CGlyphAtlas::DeleteLeastRecentlyUsedPage(TBool aAllowMruPageDeletion)
+	{
+    OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, CGLYPHATLAS_DELETELEASTRECENTLYUSEDPAGE, "> mru=%d", aAllowMruPageDeletion );
+    
+	CGlyphAtlasPage* lruPage = NULL;
+	if (!iLruPageList.IsEmpty())
+		{
+		lruPage = iLruPageList.Last();
+		if (!aAllowMruPageDeletion && (lruPage == iLruPageList.First()))
+			{
+			lruPage = NULL;
+			}
+		}
+	TBool canDeleteMorePages = EFalse;
+	if (lruPage)
+		{
+		iCacheSizeInBytes -= lruPage->SizeInBytes();
+		CGlyphAtlasFontEntry& fontEntry = lruPage->FontEntry();
+		fontEntry.DeletePage(lruPage);
+		lruPage = NULL;
+		if (fontEntry.IsEmpty())
+			{
+			DeleteFontEntry(&fontEntry);
+			}
+		canDeleteMorePages = !iLruPageList.IsEmpty();
+		}
+	OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, CGLYPHATLAS_DELETELEASTRECENTLYUSEDPAGE_END, "< more=%u; size=%u", (TUint)canDeleteMorePages, iCacheSizeInBytes);
+	return canDeleteMorePages;
+	}
+
+/**
+Utility function that calculates the number of unique fonts associated with the atlas.
+@return Number of fonts in the atlas.
+ */
+TInt CGlyphAtlas::FontCount() const
+	{
+	return iFontEntryArray.Count();
+	}
+
+/**
+Utility function that calculates the number of glyphs across all fonts stored in
+the atlas.
+@return Number of glyphs in the atlas.
+ */
+TInt CGlyphAtlas::GlyphCount() const
+	{
+	TInt glyphCount = 0;
+	for (TInt ii = iFontEntryArray.Count() - 1; ii >= 0; --ii)
+		{
+		glyphCount += iFontEntryArray[ii].iEntry->GlyphCount();
+		}
+	return glyphCount;
+	}
+
+/**
+Utility function that calculates the number of glyphs for a given font in the atlas.
+@param The font to return the number of glyphs for.
+@return Number of glyphs in the atlas.
+ */
+TInt CGlyphAtlas::GlyphCount(const CBitmapFont& aFont) const
+	{
+	CGlyphAtlasFontEntry* fontEntry = FindFontEntry(aFont);
+	return (fontEntry) ? fontEntry->GlyphCount() : 0;
+	}
+
+void CGlyphAtlas::GetGlyphCacheMetrics( TGlyphCacheMetrics& aGlyphCacheMetrics )
+    {
+    aGlyphCacheMetrics.iMaxCacheSizeInBytes = iMaxCacheSizeInBytes;
+    aGlyphCacheMetrics.iMaxCacheSizeHigh = iMaxCacheSizeHigh;
+    aGlyphCacheMetrics.iMaxCacheSizeLow = iMaxCacheSizeLow;
+    aGlyphCacheMetrics.iCacheSizeInBytes = iCacheSizeInBytes;
+    aGlyphCacheMetrics.iGpuCacheSizeLimitIsMax = iGpuCacheSizeLimitIsMax;
+    }
+
+/**
+ Function to release the GPU cache. Called in response to the GoomMonitor's
+ requirement to reduce GPU memory use.
+
+ @param aBytes. The amount of memory the GOoM framework would like us to relinquish.
+ @param aFlags. The flags conveyed from the GOoM monitor framework.
+*/
+void CGlyphAtlas::ReleaseGpuMemory( TInt /*aBytes*/, TInt /*aFlags*/ )
+    {
+    OstTraceDefExt2( OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, CGLYPHATLAS_RELEASEGPUMEMORY, "> max=%d; size=%d", iMaxCacheSizeInBytes, iCacheSizeInBytes);
+
+    if ( iCacheSizeInBytes > 0 )
+        {
+        while( DeleteLeastRecentlyUsedPage(ETrue) )
+            {
+            // Do nothing
+            }
+        }
+
+    // If appropriate, reduce the cache-size limit.
+    if ( GpuCacheSizeLimitIsMax() )
+        {
+        SwitchGpuCacheSizeLimit();
+        }
+
+    OstTraceDefExt2( OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, CGLYPHATLAS_RELEASEGPUMEMORY_EXIT, "< max=%d; size=%d", iMaxCacheSizeInBytes, iCacheSizeInBytes);
+    }
+
+/**
+ Function to establish GPU memory use. Called in response to the GoomMonitor's
+ notification that GPU memory may once more be utilised in the usual manner.
+
+ @param aFlags. The flags conveyed from the GOoM monitor framework.
+ */
+void CGlyphAtlas::InstateGpuMemory( TInt /*aFlags*/ )
+    {
+    OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, CGLYPHATLAS_INSTATEGPUMEMORY, "> max=%d", iMaxCacheSizeInBytes );
+
+    // If appropriate, reinstate the full cache-size limit.
+    if ( !GpuCacheSizeLimitIsMax() )
+        {
+        SwitchGpuCacheSizeLimit();
+        }
+
+    OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, CGLYPHATLAS_INSTATEGPUMEMORY_EXIT, "< max=%d", iMaxCacheSizeInBytes );
+    }
+
+/**
+ Utility function to toggle between full and reduced GPU cache-size limits.
+
+ Use in conjunction with TBool GpuCacheSizeLimitIsMax()
+ */
+void CGlyphAtlas::SwitchGpuCacheSizeLimit()
+    {
+    if ( GpuCacheSizeLimitIsMax() )
+        {
+        // The short-circuit operator obviates tautological conditionals.
+        while ( (iCacheSizeInBytes >= iMaxCacheSizeLow) && DeleteLeastRecentlyUsedPage(ETrue) )
+            {
+            // Do Nothing...
+            }
+
+        iMaxCacheSizeInBytes = iMaxCacheSizeLow;
+        iGpuCacheSizeLimitIsMax = EFalse;
+        }
+    else
+        {
+        iMaxCacheSizeInBytes = iMaxCacheSizeHigh;
+        iGpuCacheSizeLimitIsMax = ETrue;
+        }
+    }
+
+
+/**
+ Utility function to report whether the GPU cache-size limit is set to the maximum permissible
+ level, or to its reduced level.
+
+ @return ETrue if the cache-size is set to the maximum permissible limit.
+         EFalse if it is set to the reduced limit.
+ */
+TBool CGlyphAtlas::GpuCacheSizeLimitIsMax() const
+    {
+    return iGpuCacheSizeLimitIsMax;
+    }
+
+// === CGlyphAtlasFontEntry Functions ===
+/**
+Font entry constructor.
+
+@param aFont The font to which this font entry should be associated.
+@param aGlyphAtlas The glyph atlas to which this font entry belongs.
+*/
+CGlyphAtlasFontEntry::CGlyphAtlasFontEntry(const CBitmapFont& aFont, CGlyphAtlas& aGlyphAtlas)
+	:iFont(aFont),
+	 iPageArray(32, _FOFF(TPageMap, iGlyphCode)),
+	 iAtlas(aGlyphAtlas)
+	{
+	}
+
+/**
+Font entry destructor.
+Destroys the pages owned by the font entry.
+*/
+CGlyphAtlasFontEntry::~CGlyphAtlasFontEntry()
+	{
+	// cycle through all the font entries and destroy them
+	for (TInt ii = iPageArray.Count()-1; ii >= 0; --ii)
+		{
+		DeletePage(iPageArray[ii].iPage);
+		}
+	__ASSERT_DEBUG(iSizeInBytes == 0, Panic(EFbsPanicGlyphAtlasInconsistentState));
+	iPageArray.Close();
+	}
+
+/**
+Deletes the given page.
+The page mapping is removed and the page is deleted.
+
+@param aPage The page to delete.
+*/
+void CGlyphAtlasFontEntry::DeletePage(CGlyphAtlasPage* aPage)
+	{
+    __ASSERT_DEBUG(aPage, Panic(EFbsPanicGlyphAtlasInconsistentState));
+    __ASSERT_DEBUG(iPageArray.Count() > 0, Panic(EFbsPanicGlyphAtlasInconsistentState));
+		
+    TInt numGlyphsInPage = aPage->GlyphCount();
+
+    for (TInt ii = 0; ii < numGlyphsInPage; ++ii)
+        {
+        TInt index = iPageArray.FindInUnsignedKeyOrder(TPageMap(aPage->GlyphCodeAt(ii), NULL));
+
+        __ASSERT_DEBUG(KErrNotFound != index, Panic(EFbsPanicGlyphAtlasInconsistentState));
+
+        if (KErrNotFound != index)
+            {
+            iPageArray.Remove(index);
+            iPageArray.GranularCompress();
+            }
+        }
+    iSizeInBytes -= aPage->SizeInBytes();
+    delete aPage;
+
+	}
+
+/**
+Adds a glyph to the font from a bitmap glyph and gets the glyph image info back.
+
+@param[in] aArgs The information needed to create a glyph.
+@param[out] aGlyphImageInfo Upon return contains all the glyph image information needed to use the 
+		glyph in another process.
+@param[out] aSizeInBytes Upon return contains the size of the added glyph's image data in bytes.
+@return KErrNone if the glyph was successfully added or other system-wide error.
+*/
+TInt CGlyphAtlasFontEntry::AddGlyph(const CGlyphAtlas::TAddGlyphArgs& aArgs, TGlyphImageInfo& aGlyphImageInfo, TInt& aSizeInBytes)
+	{
+    CGlyphAtlasPage* newPage = new CGlyphAtlasPage(*this);
+	if (!newPage)
+		{
+		return KErrNoMemory;
+		}
+	
+	TInt err = newPage->AddGlyph(aArgs, aGlyphImageInfo, aSizeInBytes);
+	if (KErrNone != err)
+		{
+		delete newPage;
+		return err;
+		}
+
+	err = iPageArray.InsertInUnsignedKeyOrder(TPageMap(aArgs.iGlyphCode, newPage));
+	__ASSERT_DEBUG(KErrAlreadyExists != err, Panic(EFbsPanicGlyphAtlasInconsistentState));
+	if (KErrNone != err)
+		{
+		delete newPage;
+		return err;
+		}
+	iSizeInBytes += aSizeInBytes;
+	iAtlas.MovePageToFront(*newPage);
+	return err;
+	}
+
+/**
+Searches the array of pages to find the page containing the given glyph.
+If the page is found, the glyph image info is populated and the page is moved 
+to the front of the Glyph Atlas' LRU page array.
+
+@param[in] aGlyphCode The glyph code for the glyph being requested.
+@param[out] aGlyphImageInfo Upon return contains all the glyph image information needed to use the 
+		glyph in another process.
+@return KErrNone if the glyph was found, KErrNotFound if not. 
+*/
+TInt CGlyphAtlasFontEntry::GetGlyph(TUint aGlyphCode, TGlyphImageInfo& aGlyphImageInfo)
+	{
+	TInt index = iPageArray.FindInUnsignedKeyOrder(TPageMap(aGlyphCode, NULL));
+	if (KErrNotFound == index)
+		{
+		return KErrNotFound;
+		}
+	CGlyphAtlasPage* page = iPageArray[index].iPage;
+	page->GetGlyph(aGlyphCode, aGlyphImageInfo);
+	iAtlas.MovePageToFront(*page);
+	return KErrNone;
+	}
+
+/**
+Gets the font associated with the font entry.
+
+@return The font associated with this entry. 
+*/
+const CBitmapFont& CGlyphAtlasFontEntry::Font() const
+	{
+	return iFont;
+	}
+
+/**
+Gets the amount of memory allocated for all the image data for this font.
+
+@return The size of the font's image data in bytes.
+*/
+TInt CGlyphAtlasFontEntry::SizeInBytes() const
+	{
+	return iSizeInBytes;
+	}
+
+/**
+Tests whether the font entry has any pages.
+
+@return ETrue if the font entry does not contain any pages, EFalse if it does..
+*/
+TBool CGlyphAtlasFontEntry::IsEmpty() const
+	{
+	if (iPageArray.Count() == 0)
+		{
+		__ASSERT_DEBUG(iSizeInBytes == 0, Panic(EFbsPanicGlyphAtlasInconsistentState));
+		return ETrue;
+		}
+	return EFalse;
+	}
+
+/**
+Gets the glyph atlas the font entry belongs to.
+
+@return The font entry's glyph atlas.
+*/
+CGlyphAtlas& CGlyphAtlasFontEntry::GlyphAtlas() const
+	{
+	return iAtlas;
+	}
+
+/** 
+@return The number of glyphs this font entry has.
+ */
+TInt CGlyphAtlasFontEntry::GlyphCount() const
+	{
+	TInt glyphCount = 0;
+	for (TInt ii = iPageArray.Count() - 1; ii >= 0; --ii)
+		{
+		glyphCount += iPageArray[ii].iPage->GlyphCount();
+		}
+	return glyphCount;
+	}
+
+
+// === CGlyphAtlasPage Functions ===
+
+/**
+Page constructor.
+
+@param aFontEntry The font entry to which the page is associated.
+*/
+CGlyphAtlasPage::CGlyphAtlasPage(CGlyphAtlasFontEntry& aFontEntry)
+	:iFontEntry(aFontEntry)
+	{
+	}
+
+/**
+Page destructor.
+Releases the RSgImage handles held by the page.
+Removes the page from the Glyph Atlas' LRU page array. 
+*/
+CGlyphAtlasPage::~CGlyphAtlasPage()
+	{
+	iLink.Deque();
+	iGlyphImage.Close();
+	}
+
+/**
+Adds a glyph to the page from a bitmap glyph and gets the glyph image info back.
+An RSgImage handle is acquired for the glyph. 
+If there is not enough specialised graphics memory to create a RSgImage, then the
+least recently used pages are deleted until there there is either enough memory 
+for the creation to be successful or if there are no more pages to delete (in 
+which case an appropriate out of memory error message is returned). 
+
+@param[in] aArgs The information needed to create a glyph.
+@param[out] aGlyphImageInfo Upon return contains all the glyph image information needed to use the 
+		glyph in another process.
+@param[out] aSizeInBytes Upon return contains the size of the added glyph's image data in bytes.
+@return KErrNone if the glyph was successfully added; 
+	KErrNoMemory if there is not enough system memory available;
+	KErrNoGraphicsMemory if there is not enough specialised graphics memory available.
+*/
+TInt CGlyphAtlasPage::AddGlyph(const CGlyphAtlas::TAddGlyphArgs& aArgs, TGlyphImageInfo& aGlyphImageInfo, TInt& aSizeInBytes)
+	{
+	const TSize glyphSize(aArgs.iMetrics->Width(), aArgs.iMetrics->Height());
+	// If glyph has zero size (e.g. space), set glyph data and return 
+	if (glyphSize.iWidth == 0 || glyphSize.iHeight == 0)
+		{
+		iPosX = 0;
+		iPosY = 0;
+		iMetrics = *aArgs.iMetrics;
+		iGlyphCode = aArgs.iGlyphCode;
+		iSizeInBytes = 0;
+		iNumGlyphs++;
+		aGlyphImageInfo.iImageId = KSgNullDrawableId;
+		aGlyphImageInfo.iPosX = iPosX;
+		aGlyphImageInfo.iPosY = iPosY;
+		aGlyphImageInfo.iMetrics = iMetrics;
+		return KErrNone;
+		}
+	TUint8* buf = NULL;
+	TSgImageInfo info;
+	info.iSizeInPixels = glyphSize;
+	info.iUsage = ESgUsageBitOpenVgImage;
+	info.iPixelFormat = EUidPixelFormatA_8;
+	TInt dataStride = 0;
+	const TInt KDataArraySize = 256;
+	TUint8 byteDataArray[KDataArraySize];
+	TUint8* tempBuf = NULL;
+	TUint8* byteDataBuf = NULL;
+	TGlyphBitmapType glyphBitmapType = iFontEntry.Font().GlyphBitmapType(); 
+
+	switch (glyphBitmapType)
+		{
+		case EMonochromeGlyphBitmap:
+			// Decompress to 8bpp buffer
+			dataStride = glyphSize.iWidth;
+			byteDataBuf = byteDataArray;
+			// If data too big to fit in byteDataArray, allocate memory on the heap
+			if (glyphSize.iHeight * glyphSize.iWidth > KDataArraySize)
+				{
+				tempBuf = (TUint8*) User::AllocZ(dataStride * glyphSize.iHeight);
+				if (!tempBuf)
+					{
+					return KErrNoMemory;
+					}
+				byteDataBuf = tempBuf;
+				}
+			else
+				{
+				// fill array with zeros.
+				Mem::FillZ(&byteDataArray, KDataArraySize);
+				}
+			
+			if (glyphSize.iWidth >32)
+				{
+				DecodeBinaryDataExLarge(glyphSize, aArgs.iBitmapPointer, byteDataBuf);
+				}
+			else
+				{
+				DecodeBinaryData(glyphSize, aArgs.iBitmapPointer, byteDataBuf);
+				}
+			buf = byteDataBuf;
+			break;
+		case EAntiAliasedGlyphBitmap:
+			buf = const_cast<TUint8*>(aArgs.iBitmapPointer);
+			dataStride = glyphSize.iWidth;
+			break;
+		default:
+			return KErrNotSupported;
+		}
+
+	TInt err = iGlyphImage.Create(info, buf, dataStride);
+
+	// If RSgImage creation fails due to out of memory, delete the least
+	// recently used pages to free up memory until either creation succeeds or 
+	// there are no more pages to remove.
+	TBool morePagesToDelete = ETrue;
+	while ((KErrNoGraphicsMemory == err || KErrNoMemory == err) && morePagesToDelete)
+		{
+		// Delete least used page.  Can delete all pages if necessary as this  
+		// page has not been added to the LRU array yet.
+		morePagesToDelete = iFontEntry.GlyphAtlas().DeleteLeastRecentlyUsedPage(ETrue);
+		err = iGlyphImage.Create(info, buf, dataStride);
+		}
+
+	User::Free(tempBuf);
+	
+	if (KErrNone != err)
+		{
+		return err;
+		}
+	aSizeInBytes = glyphSize.iHeight * glyphSize.iWidth;
+	iGlyphCode = aArgs.iGlyphCode;
+	iPosX = 0;
+	iPosY = 0;
+	iMetrics = *aArgs.iMetrics;
+	// As the image is stored as one byte per pixel, the size in bytes is 
+	// just the number of pixels.
+	// TODO: Replace estimating size with call to SgImage/SgDriver to get accurate size.
+	iSizeInBytes += aSizeInBytes;
+	iNumGlyphs++;
+	aGlyphImageInfo.iPosX = iPosX;
+	aGlyphImageInfo.iPosY = iPosY;
+	aGlyphImageInfo.iImageId = iGlyphImage.Id();
+	aGlyphImageInfo.iMetrics = iMetrics;
+	return err;
+	}
+
+/**
+Retrieves the glyph image information for the given glyph code necessary to be 
+able to use the glyph in another process.
+
+@param aGlyphCode The glyph code for the glyph being requested
+@param aGlyphImageInfo Upon return contains all the glyph image information needed to use the 
+		glyph in another process if the glyph is contained in the page.
+*/
+void CGlyphAtlasPage::GetGlyph(TUint aGlyphCode, TGlyphImageInfo& aGlyphImageInfo) const
+	{
+	__ASSERT_DEBUG(iGlyphCode == aGlyphCode, Panic(EFbsPanicGlyphAtlasInconsistentState));
+	aGlyphImageInfo.iMetrics = iMetrics;
+	aGlyphImageInfo.iPosX = iPosX;
+	aGlyphImageInfo.iPosY = iPosY;
+	aGlyphImageInfo.iImageId = iGlyphImage.Id();
+	}
+
+/**
+Gets the amount of memory allocated for the image data for this page.
+
+@return The size of the page's image data in bytes.
+*/
+TInt CGlyphAtlasPage::SizeInBytes() const
+	{
+	return iSizeInBytes;
+	}
+
+/**
+Gets the glyph code at the given index associated with the page.
+
+@param aIndex The index of the glyph code within the page.
+@return The glyph code at the given index.
+*/
+TUint CGlyphAtlasPage::GlyphCodeAt(TInt aIndex) const
+	{
+	__ASSERT_DEBUG(0 == aIndex, Panic(EFbsPanicGlyphAtlasInconsistentState));
+	return iGlyphCode;
+	}
+
+/**
+Gets the number of glyphs stored in the page.
+
+@return The number of glyphs in the page.
+*/
+TInt CGlyphAtlasPage::GlyphCount() const
+	{
+	return iNumGlyphs;
+	}
+
+/**
+Gets the font entry which owns the page.
+
+@return The font entry which owns the page. 
+*/
+CGlyphAtlasFontEntry& CGlyphAtlasPage::FontEntry() const
+	{
+	return iFontEntry;
+	}
+
+
+void CGlyphAtlasPage::MoveToFirstInQueue(TDblQue<CGlyphAtlasPage>& aList)
+	{
+	if(!aList.IsFirst(this))
+		{
+		iLink.Deque();
+		aList.AddFirst(*this);
+		}
+	}
+
+// === Static Utility Functions ===
+
+/**
+Combines 2 8-bit unsigned integers into a 16-bit integer.
+@param aPtr A pointer to a source buffer of 2 8-bit unsigned integers.
+@return The two 8-bit integers combined into a 16-bit integer.
+*/
+static TInt16 Load16(const TUint8* aPtr)
+	{
+	return TInt16(aPtr[0]+(aPtr[1]<<8)); 
+	}
+
+/**
+Decodes binary data for monochrome glyph bitmap.
+
+@param aGlyphSize size of glyph in pixels.
+@param aEncodedData Pointer to an encoded source buffer.
+@param aByteData Pointer to a destination buffer (8 bits per pixel).
+*/
+void DecodeBinaryData(const TSize& aGlyphSize, const TUint8* aEncodedData, TUint8* aByteData)
+	{
+	const TInt dataHeight = aGlyphSize.iHeight;
+	const TInt dataWidth = aGlyphSize.iWidth;
+	TUint32 binaryData = 0;
+	
+	// The data is encoded as follows:
+	// 1 bit for a multiple lines flag (1=yes)
+	// 4 bits for a repeat count which represents:
+	// -if the multiple line flag is 0 the number of lines whose data is repeated
+	// -if the flag is 1, the number of lines which differ from line to line.
+	// n bits representing the data at 1 bit per pixel, where:
+	// -if the multiple line flag is 0, n is the width of the glyph.
+	// -if the flag is 1, n is width of glyph multiplied by the repeat count for this block of data.
+	// This information presented in continuous packed blocks of:
+	// [data][reps][multiLineFlag]
+	TInt bitIndex = 0;
+	TInt16 repeatCount = 0;
+	TUint8* byteDataPtr = aByteData;
+	TUint8* byteDataPtrLimit = NULL;
+	for (TInt charLine = 0; charLine < dataHeight; charLine += repeatCount) // for lines in the character...
+		{
+		// Get first 5 bits of block
+		repeatCount = Load16(aEncodedData + (bitIndex >> 3));
+		repeatCount >>= bitIndex & 7;
+		// strip out multiple line flag (1st bit)
+		TInt multiLineFlag = repeatCount & 1;
+		// Get repeat count (last 4 bits)
+		repeatCount >>= 1;
+		repeatCount &= 0xf;
+		// move bit index to point to first bit of image data
+		bitIndex += 5;
+		// end pointer of destination buffer for this block of data to fill 
+		byteDataPtrLimit = aByteData + dataWidth * (charLine + repeatCount);
+		if (multiLineFlag)
+			{
+			while (byteDataPtr < byteDataPtrLimit)
+				{
+				// Pointer to beginning of data in source buffer for current scanline
+				TInt charDataOffsetPtr = TInt(aEncodedData) + (bitIndex >> 3);
+				// Pointer to beginning of current word.
+				TUint32* charDataWord = (TUint32*)(charDataOffsetPtr &~ 3);
+				// Number of bits to shift in current word to get to beginning of scanline
+				TInt bitShift = bitIndex & 7;
+				bitShift += (charDataOffsetPtr & 3) << 3;
+				// Copy scanline data into temporary buffer
+				binaryData = (*charDataWord++) >> bitShift;
+				// If data crosses a word boundary, get the rest of the data from next word.
+				if (bitShift)
+					{
+					binaryData |= (*charDataWord << (32-bitShift));
+					}
+				Convert1BppTo8Bpp(binaryData, byteDataPtr, byteDataPtr + dataWidth);
+				// Move bit index to beginning of next block
+				bitIndex += dataWidth;
+				}
+			}
+		else
+			{
+			TInt charDataOffsetPtr = TInt(aEncodedData) + (bitIndex >> 3);
+			TUint32* charDataWord = (TUint32*)(charDataOffsetPtr &~ 3);
+			TInt bitShift = bitIndex & 7;
+			bitShift += (charDataOffsetPtr & 3) << 3;
+			binaryData = (*charDataWord++) >> bitShift;
+			if (bitShift)
+				{
+				binaryData |= (*charDataWord << (32-bitShift));
+				}
+			TUint8* startByteDataPtr = byteDataPtr;
+			Convert1BppTo8Bpp(binaryData, byteDataPtr, byteDataPtr + dataWidth);
+			
+			while (byteDataPtr < byteDataPtrLimit)
+				{
+				Mem::Copy(byteDataPtr, startByteDataPtr, dataWidth);
+				byteDataPtr += dataWidth;
+				}
+			bitIndex += dataWidth;
+			}
+		}
+	}
+
+/**
+Converts binary data in 1 bit per pixel format to 8 bits per pixel format, where
+0 is converted to 0x00 and 1 is converted to 0xFF.
+
+@param aSrcData Pointer to a 1bpp source buffer.
+@param aDestDataPtr Pointer to a 8bpp destination buffer.
+@param aDestDataPtrLimit Pointer to the end position in destination buffer to convert to.
+*/
+void Convert1BppTo8Bpp(TUint32 aSrcData, TUint8*& aDestDataPtr, const TUint8* aDestDataPtrLimit)
+	{
+	for (; aDestDataPtr < aDestDataPtrLimit; ++aDestDataPtr, aSrcData >>= 1)
+		{
+		if (aSrcData&1)
+			{
+			*aDestDataPtr = 0xFF;
+			}
+		}
+	}
+
+/**
+Decodes binary data for extra large monochrome glyph bitmap.
+
+@param aGlyphSize Size of glyph in pixels.
+@param aEncodedData Pointer to an encoded source buffer.
+@param aByteData Pointer to a destination buffer (8 bits per pixel).
+*/
+void DecodeBinaryDataExLarge(const TSize& aGlyphSize, const TUint8* aEncodedData, TUint8* aByteData)
+	{
+	const TInt dataWidth = aGlyphSize.iWidth;
+	const TInt dataHeight = aGlyphSize.iHeight;
+	TInt bitIndex = 0;
+	TInt16 repeatCount = 0;
+
+	for (TInt charLine = 0; charLine < dataHeight; charLine += repeatCount) // for lines in the character...
+		{
+		repeatCount = Load16(aEncodedData + (bitIndex >> 3));
+		repeatCount >>= bitIndex & 7;
+		const TInt multiLineFlag = repeatCount & 1;
+		repeatCount >>= 1;
+		repeatCount &= 0xf;
+		bitIndex += 5;
+		if (multiLineFlag)
+			{
+			for (TInt currentline = 0; currentline < repeatCount; currentline++)
+				{
+				CopyCharLine(aByteData, dataWidth, aEncodedData + (bitIndex >> 3), bitIndex & 7, 1);
+				bitIndex += dataWidth;
+				}
+			}
+		else
+			{
+			CopyCharLine(aByteData, dataWidth, aEncodedData + (bitIndex >> 3), bitIndex & 7, repeatCount);
+			bitIndex += dataWidth;
+			}
+		}
+	}
+
+/**
+Copies glyph image data line(s)(1 bit per pixel) to an 8 bit per pixel
+destination buffer.
+
+@param aByteDataPtr Pointer to a destination buffer (8bpp).
+@param aWidthInBytes Stride of the image.
+@param aSrcData Pointer to a source buffer (1bpp).
+@param aBitShift Number of bits the source data pointer will be shifted. 
+@param aRepeatCount Number of lines to copy.
+*/
+void CopyCharLine(TUint8*& aByteDataPtr, TInt aWidthInBytes, const TUint8* aSrcData, TInt aBitShift, TInt16 aRepeatCount)
+	{
+	aBitShift &= 7;
+	TUint8* ptrLimit = aByteDataPtr + aWidthInBytes;
+	TUint32* dataWord = (TUint32*)(TInt(aSrcData) &~ 3);
+	aBitShift += (TInt(aSrcData) - TInt(dataWord)) << 3;
+
+	TUint8* startByteDataPtr = aByteDataPtr;
+	TUint32 binaryData = 0;
+	while (aByteDataPtr < ptrLimit)
+		{
+		binaryData = *dataWord++;
+		binaryData >>= aBitShift;
+		if (aBitShift)
+			{
+			binaryData |= (*dataWord << (32-aBitShift));
+			}
+		TUint8* wordLimit = aByteDataPtr + 32;
+		if (wordLimit > ptrLimit)
+			{
+			wordLimit = ptrLimit;
+			}
+		Convert1BppTo8Bpp(binaryData, aByteDataPtr, wordLimit);
+		}
+
+	while (aRepeatCount > 1)
+		{
+		Mem::Copy(aByteDataPtr, startByteDataPtr, aWidthInBytes);
+		aByteDataPtr += aWidthInBytes;
+		--aRepeatCount;
+		}
+	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/sfbs/glyphatlas.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,185 @@
+// Copyright (c) 2009-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:
+// Font & Bitmap Server Glyph Atlas
+//
+
+#ifndef GLYPHATLAS_H
+#define GLYPHATLAS_H
+
+#include <e32base.h>
+#include <sgresource/sgimage.h>
+#include <fbs.h>
+#include "UTILS.H"
+
+class CGlyphAtlasFontEntry;
+class CGlyphAtlasPage;
+class TGlyphCacheMetrics;
+
+/**
+The Glyph Atlas manages the storing and retrieval of glyphs stored in GPU 
+memory as RSgImages.
+
+CGlyphAtlas is the main class which processes requests to add and retrieve
+glyphs. Only one instance of this class will exist throughout the lifetime of 
+the Font and Bitmap Server.
+@internalComponent
+*/
+NONSHARABLE_CLASS(CGlyphAtlas) : public CBase
+	{
+friend class CGlyphAtlasTestWrapper;
+public:
+	/**
+	Structure used to pass information required to create a new glyph so that it can 
+	be added to the glyph atlas.
+	@internalComponent 
+	*/
+	class TAddGlyphArgs
+		{
+	public:
+		inline TAddGlyphArgs(const TUint8* aBitmapPointer, TUint aGlyphCode, const TOpenFontCharMetrics& aMetrics)
+			: iBitmapPointer(aBitmapPointer), iGlyphCode(aGlyphCode), iMetrics(&aMetrics) {}
+	public:
+		const TUint8* iBitmapPointer;	/**< The address of the bitmap glyph. No ownership.*/
+		TUint iGlyphCode;	/**< The glyph code for the glyph being added. No ownership.*/
+		const TOpenFontCharMetrics* iMetrics;	/**< The metrics for the glyph being added. No ownership.*/
+		};
+
+public:
+	~CGlyphAtlas();
+	static CGlyphAtlas* NewL(TInt aMaxCacheSizeInBytes);
+	TInt GetGlyph(const CBitmapFont& aFont, TUint aGlyphCode, TGlyphImageInfo& aGlyphImageInfo);
+	TInt AddGlyph(const CBitmapFont& aFont, const TAddGlyphArgs& aArgs, TGlyphImageInfo& aGlyphImageInfo);
+	void FontReleased(const CBitmapFont& aFont);
+	void MovePageToFront(CGlyphAtlasPage& aPage);
+	TBool DeleteLeastRecentlyUsedPage(TBool aAllowMruPageDeletion);
+	TInt FontCount() const;
+	TInt GlyphCount() const;
+	TInt GlyphCount(const CBitmapFont& aFont) const;
+	void GlyphCacheMetrics(TInt& aSizeInBytes, TInt& aMaxSizeInBytes, TBool& aGpuCacheSizeLimitIsMax);
+	void ReleaseGpuMemory( TInt /*aBytes*/, TInt /*aFlags*/ );
+	void InstateGpuMemory( TInt /*aFlags*/ );
+	void GetGlyphCacheMetrics( TGlyphCacheMetrics& aGlyphCacheMetrics );
+
+private:
+	CGlyphAtlas(TInt aMaxCacheSizeInBytes);
+	void ConstructL();
+	CGlyphAtlasFontEntry* CreateFontEntry(const CBitmapFont& aFont);
+	CGlyphAtlasFontEntry* FindFontEntry(const CBitmapFont& aFont) const;
+	void DeleteFontEntry(CGlyphAtlasFontEntry* aFontEntry);
+    void SwitchGpuCacheSizeLimit();
+    TBool GpuCacheSizeLimitIsMax() const;
+
+private:
+	class TFontEntryMap
+		{
+	public:
+		inline TFontEntryMap(const CBitmapFont* aFont, CGlyphAtlasFontEntry* aEntry)
+				: iFont(aFont),iEntry(aEntry) {}
+	public:			
+		const CBitmapFont* iFont;
+		CGlyphAtlasFontEntry* iEntry;
+		};
+private:
+	RSgDriver iSgDriver;
+	TDblQue<CGlyphAtlasPage> iLruPageList; /**< Least-recently used ordered queue (most-recently used at head).*/
+	RArray<TFontEntryMap> iFontEntryArray; /**< Array of font entries maintained in unsigned ordered by font pointer.*/
+	TUint iMaxCacheSizeInBytes;	/**< Maximum specialised graphics memory the cache should use. If zero, there is no limit.*/
+	TInt iMaxCacheSizeHigh;                /**< The high cach-size threshold.*/
+	TInt iMaxCacheSizeLow;                 /**< The low cach-size threshold.*/
+	TUint iCacheSizeInBytes; 	/**< Actual amount of specialised graphics memory used by the entire atlas.*/
+	TBool iGpuCacheSizeLimitIsMax;         /**< Is the cache-size limit set to it's maximum value? */
+	};
+
+
+/**
+Each font entry manages the storing and retrieval of glyphs belonging to a font.
+@internalComponent
+*/
+NONSHARABLE_CLASS(CGlyphAtlasFontEntry): public CBase
+	{
+public:
+	CGlyphAtlasFontEntry(const CBitmapFont& aFont, CGlyphAtlas& aGlyphAtlas);
+	~CGlyphAtlasFontEntry();
+	const CBitmapFont& Font() const;
+	void DeletePage(CGlyphAtlasPage* aPage);
+	TInt GetGlyph(TUint aGlyphCode, TGlyphImageInfo& aGlyphImageInfo);
+	TInt AddGlyph(const CGlyphAtlas::TAddGlyphArgs& aArgs, TGlyphImageInfo& aGlyphImageInfo, TInt& aSizeInBytes);
+	TInt SizeInBytes() const;
+	TBool IsEmpty() const;
+	CGlyphAtlas& GlyphAtlas() const;
+	TInt GlyphCount() const;
+
+private:
+	// Class that handles association between glyph code and page the 
+	// image that glyph code resides on. Used in pointer arrays.
+	class TPageMap
+		{
+	public:
+		inline TPageMap(TUint aGlyphCode, CGlyphAtlasPage* aPage)
+				: iGlyphCode(aGlyphCode),iPage(aPage) {}
+	public:			
+		TUint iGlyphCode;
+		CGlyphAtlasPage* iPage;
+		};
+private:
+	const CBitmapFont& iFont;	/**< The font which the stored glyph belongs to.*/
+	RArray<TPageMap> iPageArray;	/**< Array of pages maintained in unsigned ordered by glyph code.*/
+	CGlyphAtlas& iAtlas;		/**< The glyph atlas the font entry belongs to.*/
+	TInt iSizeInBytes;			/**< The amount of specialised graphics memory used by all owned pages.*/
+	};
+
+
+/**
+Each page in the glyph atlas stores one glyph in one RSgImage.
+@internalComponent
+*/
+NONSHARABLE_CLASS(CGlyphAtlasPage): public CBase
+	{
+friend CGlyphAtlas::CGlyphAtlas(TInt);
+public:
+	CGlyphAtlasPage(CGlyphAtlasFontEntry& aFontEntry);
+	~CGlyphAtlasPage();
+	TInt AddGlyph(const CGlyphAtlas::TAddGlyphArgs& aArgs, TGlyphImageInfo& aGlyphImageInfo, TInt& aSizeInBytes);
+	void GetGlyph(TUint aGlyphCode, TGlyphImageInfo& aGlyphImageInfo) const;
+	TUint GlyphCodeAt(TInt aIndex) const;
+	TInt GlyphCount() const;
+	CGlyphAtlasFontEntry& FontEntry() const;
+	TInt SizeInBytes() const;
+	void MoveToFirstInQueue(TDblQue<CGlyphAtlasPage>& aList);
+
+private:
+	TDblQueLink iLink;
+	// Data for the stored glyph
+	CGlyphAtlasFontEntry& iFontEntry;	/**< The font entry asssociated with the page.*/
+	RSgImage iGlyphImage;		/**< The image which contains the stored glyph.*/
+	TInt16 iPosX;				/**< The x-coord of the position of the stored glyph within the image.*/
+	TInt16 iPosY;				/**< The y-coord of the position of the stored glyph within the image.*/
+	TOpenFontCharMetrics iMetrics;	/**< The character metrics for the stored glyph.*/
+	TUint iGlyphCode;			/**< The glyph code for the stored glyph.*/
+	TInt iSizeInBytes;			/**< The amount of specialised graphics memory used by this page.*/
+	TInt iNumGlyphs;			/**< The number of glyphs contained in the page.*/
+	};
+
+
+// If no limit to the size of the glyph atlas cache is desired, this
+// constant must be passed to CGlyphCache::NewL()
+// In this case the cache lower maximum limit, deployed in response to GooM,
+// will be set to KGlyphAtlasLowMemCacheLimitDefault
+const TInt KGlyphAtlasNoCacheLimit = 0;
+const TInt KGlyphAtlasLowMemCacheLimitDivisor = 2;
+const TInt KGlyphAtlasLowMemCacheLimitDefault = 0x40000;
+
+
+#endif // GLYPHATLAS_H
+
--- a/fbs/fontandbitmapserver/sfbs/patchableconstants.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/sfbs/patchableconstants.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-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"
@@ -54,6 +54,19 @@
 */
 EXPORT_C extern const TInt KFbServWritableDataPagingMode = 0x00;
 
+/**
+@SYMPatchable
+@publishedPartner
+@prototype
+
+This constant determines the maximum size of the GPU memory that the font and 
+bitmap server's glyph atlas can use.
+The glyph atlas will store glyphs in this memory.  When the glyph atlas reaches 
+this limit, old glyphs will be evicted from the cache to make space for new glyphs.
+@note	Default value: 0.5 MB (0x00080000).
+*/
+EXPORT_C extern const TInt KFbServGlyphAtlasCacheLimit = 0x00080000;
+
 // Header files declaring these constants are included to confirm that the definition matches.
 // They are included at the end because otherwise the ARM compiler refuses to initialise the values.
 #if (__ARMCC_VERSION >= 310000)
--- a/fbs/fontandbitmapserver/tfbs/TALLOC.H	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/TALLOC.H	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -17,7 +17,7 @@
 #define __TALLOC_H__
 
 #include <fbs.h>
-#include "TGraphicsHarness.h"
+#include "test/TGraphicsHarness.h"
 
 class CTAlloc : public CTGraphicsBase
 	{
--- a/fbs/fontandbitmapserver/tfbs/TBitmap.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/TBitmap.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-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"
@@ -20,8 +20,8 @@
 
 #include <gdi.h>
 #include "TFBS.H"
-#include "TGraphicsHarness.h"
-#include "../sfbs/fbsbitmapasyncstreamer.h"
+#include "test/TGraphicsHarness.h"
+#include "fbsbitmapasyncstreamer.h"
 
 
 //The main test class. Add your test methods here.
--- a/fbs/fontandbitmapserver/tfbs/TCLEAN.H	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/TCLEAN.H	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1996-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"
@@ -17,7 +17,7 @@
 #define __TCLEAN_H__
 
 #include <fbs.h>
-#include "TGraphicsHarness.h"
+#include "test/TGraphicsHarness.h"
 
 enum TTestType
 	{
--- a/fbs/fontandbitmapserver/tfbs/TFBS.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/TFBS.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1995-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"
@@ -84,7 +84,7 @@
 void CTFbs::ConstructL()
 	{
 	ExpandCleanupStackL();
-	
+	User::LeaveIfError(Logger().ShareAuto());
 	TestConstruction();
 	AllocScanLineBuf();
 	
@@ -187,7 +187,7 @@
 		TestSingletonServer();
 		break;
 	case 21:
-		((CTFbsStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0620"));
+		((CTFbsStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0623"));
 		TestFontSessionCacheLookupL();
 		break;
 	case 22:
@@ -649,7 +649,7 @@
 	CheckResourceCount();
 	TEST(fbsalt->ResourceCount()==iResourceCount);
 	font3->Reset();
-	User::Free(font3);
+	delete font3;
 	iResourceCount--;
 	CheckResourceCount();
 	TEST(fbsalt->ResourceCount()==iResourceCount);
@@ -2133,7 +2133,7 @@
 	}
 
 /**
-@SYMTestCaseID      GRAPHICS-FBSERV-0620
+@SYMTestCaseID      GRAPHICS-FBSERV-0623
 @SYMTestPriority    High
 @SYMTestStatus      Implemented
 @SYMDEF             DEF140138
@@ -2145,6 +2145,8 @@
 	are the same, thereby avoiding any unneccessary IPC calls.
 
 @SYMTestActions
+	Try to open a global semaphore called "FBSSessionCacheSemaphore" (this is a temporary measure to
+		ensure successful propagation of ou1cimx1#250526).
 	Create a large font which consumes a lot of memory.
 	Create a CFbsBitGc and a CFbsBitmap target.
 	Use the CFbsBitGc to render some text, thereby filling the font glyph cache. 
@@ -2156,6 +2158,7 @@
 		returned from CBitmapFont::GetCharacterData().
 
 @SYMTestExpectedResults
+	No global semaphore called "FBSSessionCacheSemaphore" should exist.
 	When using KNullHandle, CharacterNeedsToBeRasterized() with the first character, is expected to pass
 		proving that the font cache is working as expected when glyphs can fit into it.
 	When using KNullHandle, CharacterNeedsToBeRasterized() with the last character, it expected to fail, 
@@ -2172,6 +2175,11 @@
 	{
 	INFO_PRINTF1(_L("Test Font Session-cache Lookup"));
 
+	// Make sure the global semaphore is gone for good
+	_LIT(KSessionCacheSemaphoreName, "FBSSessionCacheSemaphore");
+	RSemaphore sem;
+	TEST(sem.OpenGlobal(KSessionCacheSemaphoreName) == KErrNotFound);
+
 	User::LeaveIfError(RFbsSession::Connect());    
 	RFbsSession* fbsSession = RFbsSession::GetSession();
 	CFbsTypefaceStore* ts = CFbsTypefaceStore::NewL(NULL);
@@ -2273,170 +2281,96 @@
 	TEST(KErrNone == iFbs->SendCommand(EFbsMessSetTwipsHeight, fontHandle, 49));
 	// In a second thread, send a IPC command to set the font's height with the 
 	// bitmap's handle.  Should panic with FBServ -6.
-	TFbsTestThreadInfo threadInfo = {EFbsSecondThreadInvalidHandleInIpcCall};
- 	TExitCategoryName exitCategoryName(KFbsPanicCategory);
 	_LIT(KTestName, "TestInvalidHandlesInIpcCall");
- 	CreateSecondThreadAndCheckPanicL(threadInfo, -6, exitCategoryName, KTestName);
+ 	CreateSecondThreadAndCheckPanicL(SecondThreadPanicInvalidHandleInIpcCallL, KErrArgument, KFbsPanicCategory, KTestName);
 
 	iTs->ReleaseFont(font);
 	delete bmp;
 	}
 
 /**
-Creates a second thread and do some panic tests in it.
-@param aTestInfo The information for the tests
-@param aPanicCode The expected panic code
-@param aExitCategory The expected panic category
-@param aThreadName The name of the new thread
-@leave Gets system wide error code
+Second thread function for test GRAPHICS-FBSERV-0650. It should panic with FBSERV -6 if the test is successful.
+ */
+void CTFbs::SecondThreadPanicInvalidHandleInIpcCallL()
+	{
+	User::LeaveIfError(RFbsSession::Connect());
+	RFbsSession* fbs = RFbsSession::GetSession();
+	CFbsBitmapEx* bmp = new(ELeave) CFbsBitmapEx();
+	CleanupStack::PushL(bmp);
+	User::LeaveIfError(bmp->Create(TSize(1,1), EGray2));
+	CFbsTypefaceStore* ts = CFbsTypefaceStore::NewL(NULL);
+	CleanupStack::PushL(ts);
+	CFbsFont* font=NULL;
+	User::LeaveIfError(ts->GetNearestFontToDesignHeightInPixels((CFont*&)font, TFontSpec(KTypefaceName, 15)));
+	TInt bitmapHandle = bmp->BitmapHandle();
+
+	// Send a IPC command to set twips height of font with a bitmap handle
+	(void)fbs->SendCommand(EFbsMessSetTwipsHeight, bitmapHandle, 49);
+
+	ts->ReleaseFont(font);
+	CleanupStack::PopAndDestroy(2);
+	RFbsSession::Disconnect();
+	}
+
+
+struct TFbsTestDelegator
+	{
+	CTFbs* iTestBase;
+	void (CTFbs::*iMethodPtr)();
+	};
+
+/**
+Creates a second thread and checks that it panics.
+@param aMethodL The leaving method of CTFbs that the second thread is going to execute.
+@param aPanicCode The expected panic code.
+@param aPanicCategory The expected panic category.
+@param aThreadName The name of the new thread.
 */
-void CTFbs::CreateSecondThreadAndCheckPanicL(TFbsTestThreadInfo& aTestInfo, TInt aPanicCode, TExitCategoryName aExitCategory, const TDesC &aThreadName)
+void CTFbs::CreateSecondThreadAndCheckPanicL(void (CTFbs::*aMethodL)(), TInt aPanicCode, const TDesC& aPanicCategory, const TDesC& aThreadName)
 	{
 	RThread secondThread;
-	User::LeaveIfError(secondThread.Create(aThreadName, SecondThreadStart, KDefaultStackSize, 0x1000, 0x1000, &aTestInfo));
+	TFbsTestDelegator delegator;
+	delegator.iTestBase = this;
+	delegator.iMethodPtr = aMethodL;
+	User::LeaveIfError(secondThread.Create(aThreadName, MethodDelegatorThreadFunction, KDefaultStackSize, 0x1000, 0x1000, &delegator));
 	// Launch second thread
 	TRequestStatus statusSecondThread;
 	secondThread.Logon(statusSecondThread);
-	secondThread.SetPriority(EPriorityLess);
-	secondThread.Resume();	
-	
+	secondThread.Resume();
+	// Wait until second thread is finished
 	User::WaitForRequest(statusSecondThread);
-	
-	if(EExitPanic != secondThread.ExitType())
+	// Check results
+	if (EExitPanic != secondThread.ExitType())
 		{
-		ERR_PRINTF3(_L("Expected exit type: %d, Actual exit type: %d"), EExitPanic, secondThread.ExitType());
+		ERR_PRINTF2(_L("Expected exit type: EExitPanic, actual exit type: %d"), secondThread.ExitType());
 		TEST(EFalse);
 		}
-	
-	if(aPanicCode != secondThread.ExitReason())
+	if (aPanicCode != secondThread.ExitReason())
 		{
-		ERR_PRINTF3(_L("Expected panic code: %d, Actual panic code: %d"), aPanicCode, secondThread.ExitReason());
+		ERR_PRINTF3(_L("Expected exit reason: %d, actual exit reason: %d"), aPanicCode, secondThread.ExitReason());
         TEST(EFalse);
 		}
-	
 	TExitCategoryName secondThreadExitCategory = secondThread.ExitCategory();
-	if(aExitCategory != secondThreadExitCategory)
+	if (aPanicCategory != secondThreadExitCategory)
 		{
-		ERR_PRINTF3(_L("Expected panic category: %S, Actual panic category: %S"), &aExitCategory, &secondThreadExitCategory);
+		ERR_PRINTF3(_L("Expected exit category: %S, actual exit category: %S"), &aPanicCategory, &secondThreadExitCategory);
         TEST(EFalse);
 		}
-	
-	//Close the handle
+	// Dispose of the remains of the second thread
 	secondThread.Close();
 	}
 
-/**
-Second thread entry function.
-*/
-TInt CTFbs::SecondThreadStart(TAny* aTestInfo)
+TInt CTFbs::MethodDelegatorThreadFunction(TAny* aDelegator)
 	{
-	
-	__UHEAP_MARK;
-    TInt procHandles1  =0;
-    TInt threadHandles1=0;
-    RThread().HandleCount(procHandles1, threadHandles1);
 	CTrapCleanup* cleanupStack = CTrapCleanup::New();
-	
 	if (!cleanupStack)
 	    {
-	    __UHEAP_MARKEND;
 	    return KErrNoMemory;
 	    }
-	
-	TInt result = KErrNone;
-	TRAP(result, SecondThreadMainL(static_cast<TFbsTestThreadInfo*>(aTestInfo)));
-	
+	TFbsTestDelegator* delegator = static_cast<TFbsTestDelegator*>(aDelegator);
+	TRAPD(err, (delegator->iTestBase->*delegator->iMethodPtr)());
 	delete cleanupStack;
-
-    TInt procHandles2  =0;
-    TInt threadHandles2=0;
-    RThread().HandleCount(procHandles2,threadHandles2);
-    if (threadHandles1 != threadHandles2)
-        {
-        result = KErrGeneral;  // Thread-owned handles not closed
-        }
-	__UHEAP_MARKEND;
-
-	return result;
-	}
-
-/**
-Run the test contained within the TFbsTestThreadInfo object. A new thread is
-created for each test and only one of the cases in the switch statements
-below will be used.
-
-@param aTestInfo The parameters for the test
-@return One of the system wide error codes or an enumeration of passed tests.
- */
-TInt CTFbs::SecondThreadMainL(TFbsTestThreadInfo* aTestInfo)
-    {
-    TInt result = 0;
-    TFbsMultiThreadTestCase testcase = aTestInfo->iTestCase;
-
-    //test cases without the need of an initialised driver
-    switch (testcase)
-    	{
-    case EFbsSecondThreadInvalidHandleInIpcCall:
-    	result = SecondThreadPanicInvalidHandleInIpcCall();
-        break;
-    	}
-    return result;
-    }
-
-/**
-Implementation of SecondThread test EFbsSecondThreadInvalidHandleInIpcCall
-
-@panic FBSERV -6 If the test is successful
-
-@return One of the system wide error codes.
- */
-TInt CTFbs::SecondThreadPanicInvalidHandleInIpcCall()
-	{
-	TInt result = RFbsSession::Connect();
-	if (KErrNone != result)
-		{
-		return result;
-		}
-	RFbsSession* fbs = RFbsSession::GetSession();
-	CFbsBitmapEx* bmp = new CFbsBitmapEx();
-	if (!bmp)
-		{
-		return KErrGeneral;
-		}
-	result = bmp->Create(TSize(1,1),EGray2);
-	if(KErrNone != result)
-		{
-		delete bmp;
-		return KErrGeneral;
-		}
-
-	CFbsTypefaceStore* ts = NULL;
-	ts = (CFbsTypefaceStore*)CFbsTypefaceStore::NewL(NULL);
-	if (!ts)
-		{
-		delete bmp;
-		return KErrGeneral;
-		}
-
-	CFbsFontEx* font=NULL;
-	result = ts->GetNearestFontToDesignHeightInPixels((CFont*&)font, TFontSpec(KTypefaceName, 15));
-	if (!font)
-		{
-		delete bmp;
-		delete ts;
-		return KErrGeneral;
-		}
-
-	TInt fontHandle = font->FontHandle();
-	TInt bitmapHandle = bmp->BitmapHandle();
-
-	// Send a IPC command to set twips height of font with a bitmap handle
-	result = fbs->SendCommand(EFbsMessSetTwipsHeight, bitmapHandle, 49);
-
-	ts->ReleaseFont(font);
-	delete bmp;
-	delete ts;
-	return result;
+	return err;
 	}
 
 /**
--- a/fbs/fontandbitmapserver/tfbs/TFBSDefect.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/TFBSDefect.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-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"
@@ -17,7 +17,7 @@
 #define __TFBSDEFECT_H__
 
 #include <fbs.h>
-#include "TGraphicsHarness.h"
+#include "test/TGraphicsHarness.h"
 
 class CTFbsDefect : public CTGraphicsBase
 	{
--- a/fbs/fontandbitmapserver/tfbs/TFbsServer.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/TFbsServer.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -38,8 +38,12 @@
 #include "textendedbitmappanic.h"
 #include "twdp.h"
 #include "tfonttableandglyph.h"
+#include "tfbsglyphdata.h"
+#include "tfbsglyphdatapanic.h"
+#include "tfbsglyphdataoutlineshadow.h"
+#include "tglyphatlas.h"
+#include "tfbsoogm.h"
 
- 
 /* Path to the script
 
 z:\GraphicsTest\fbstest.script
@@ -196,9 +200,29 @@
 		testStep = new CTWDPStep();
 		}
    	else if(aStepName == KTFontTableAndGlyphStep)
-        	{
-        	testStep = new CTFontAndGlyphStep();
-        	}
-	
+        {
+        testStep = new CTFontAndGlyphStep();
+        }
+	else if(aStepName == KTFbsGlyphDataStep)
+		{
+		testStep = new CTFbsGlyphDataStep();
+		}
+    else if(aStepName == KTFbsGlyphDataPanicStep)
+        {
+        testStep = new CTFbsGlyphDataPanicStep();
+        }
+    else if(aStepName == KTFbsGlyphDataOutlineAndShadowStep)
+        {
+        testStep = new CTFbsGlyphDataOutlineAndShadowStep();
+        }
+    else if(aStepName == KTGlyphAtlasStep)
+    	{
+		testStep = new CTGlyphAtlasStep();
+    	}
+    else if(aStepName == KTFbsOogmStep)
+        {
+        testStep = new CTFbsOogmStep();
+        }
+
 	return testStep;
 	}
--- a/fbs/fontandbitmapserver/tfbs/TGetAllBitmapsCapability.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/TGetAllBitmapsCapability.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-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,7 +16,7 @@
 #ifndef __TGETALLBITMAPSCAPABILITY_H__
 #define __TGETALLBITMAPSCAPABILITY_H__
 
-#include "TGraphicsHarness.h"
+#include "test/TGraphicsHarness.h"
 
 // The main test class. Add your test methods here.
 class CTGetAllBitmapsCapability : public CTGraphicsBase
--- a/fbs/fontandbitmapserver/tfbs/TRalc.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/TRalc.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1997-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"
@@ -17,7 +17,7 @@
 #define __TRALC_H__
 
 #include <fbs.h>
-#include "TGraphicsHarness.h"
+#include "test/TGraphicsHarness.h"
 
 class CTRalc : public CTGraphicsBase
 	{
--- a/fbs/fontandbitmapserver/tfbs/TSecureFBS.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/TSecureFBS.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-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"
@@ -17,7 +17,7 @@
 #define __TSECUREFBS_H__
 
 #include <fbs.h>
-#include "TGraphicsHarness.h"
+#include "test/TGraphicsHarness.h"
 
 class CTFbsSecure : public CTGraphicsBase
 	{
--- a/fbs/fontandbitmapserver/tfbs/TStreamIdCache.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/TStreamIdCache.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-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"
@@ -17,7 +17,7 @@
 #define __TSTREAMIDCACHE_H__
 
 #include <fbs.h>
-#include "TGraphicsHarness.h"
+#include "test/TGraphicsHarness.h"
 
 class CTStreamIdCache : public CTGraphicsBase
 	{
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/tfbs/glyphatlastestwrapper.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,167 @@
+// Copyright (c) 2009-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:
+//
+
+/**
+ @file
+ @internalComponent - Internal Symbian test code
+*/
+
+#include "glyphatlastestwrapper.h"
+
+/**
+Panic function required for glyphatlas.cpp to compile in the test project.
+*/
+GLDEF_C void Panic(TFbsPanic aPanic)
+	{
+	_LIT(KFBSERVClientPanicCategory,"FBSCLI");
+	User::Panic(KFBSERVClientPanicCategory,aPanic);
+	}
+
+
+/**
+Glyph Atlas test wrapper constructor.
+*/
+CGlyphAtlasTestWrapper::CGlyphAtlasTestWrapper()
+	{
+	}
+
+/**
+Two-phase constructor.
+@leave A system wide error code if RSgDriver failed to open.
+*/
+void CGlyphAtlasTestWrapper::ConstructL(TInt aMaxCacheSizeInBytes)
+	{
+	iAtlas = CGlyphAtlas::NewL(aMaxCacheSizeInBytes);
+	}
+
+/**
+Factory constructor method. Creates a new glyph atlas test wrapper.
+
+@param aMaxCacheSizeInBytes The size in bytes, to use as the upper limit
+	for the size of memory used by the glyph images in the atlas. If this
+	value is KGlyphAtlasNoCacheLimit, then there is no limit and the atlas
+	will use as much memory as is available in the system.
+
+@return A pointer to the newly-constructed atlas test wrapper
+
+@leave KErrNoMemory if there was insufficient memory to create the atlas, 
+	or a system wide error code if its RSgDriver failed to open.
+*/
+CGlyphAtlasTestWrapper* CGlyphAtlasTestWrapper::NewL(TInt aMaxCacheSizeInBytes)
+    {
+    CGlyphAtlasTestWrapper* self = CGlyphAtlasTestWrapper::NewLC( aMaxCacheSizeInBytes );
+    CleanupStack::Pop(); // self;
+
+    return self;
+    }
+
+CGlyphAtlasTestWrapper* CGlyphAtlasTestWrapper::NewLC(TInt aMaxCacheSizeInBytes)
+    {
+    CGlyphAtlasTestWrapper* self = new (ELeave) CGlyphAtlasTestWrapper();
+    CleanupStack::PushL(self);
+    self->ConstructL(aMaxCacheSizeInBytes);
+
+    return self;
+    }
+
+TInt CGlyphAtlasTestWrapper::GetGlyph(const CBitmapFont& aFont, TUint aGlyphCode, TGlyphImageInfo& aGlyphImageInfo)
+	{
+	return iAtlas->GetGlyph(aFont, aGlyphCode, aGlyphImageInfo);
+	}
+
+TInt CGlyphAtlasTestWrapper::AddGlyph(const CBitmapFont& aFont, const CGlyphAtlas::TAddGlyphArgs& aArgs, TGlyphImageInfo& aGlyphImageInfo)
+	{
+	return iAtlas->AddGlyph(aFont, aArgs, aGlyphImageInfo);
+	}
+
+void CGlyphAtlasTestWrapper::FontReleased(const CBitmapFont& aFont)
+	{
+	iAtlas->FontReleased(aFont);
+	}
+
+/**
+Returns the current size of the glyph image memory used by the atlas in bytes.
+*/
+TInt CGlyphAtlasTestWrapper::SizeInBytes() const
+	{
+	return iAtlas->iCacheSizeInBytes;
+	}
+
+/**
+Tests whether the least recently used page contains the given glyph.
+@param aGlyphCode The glyph code to match.
+@return ETrue if the lru page contains the given glyph, EFalse if not.
+*/
+TBool CGlyphAtlasTestWrapper::LruPageContainsGlyph(TUint aGlyphCode) const
+	{
+	CGlyphAtlasPage* page = iAtlas->iLruPageList.Last();
+	TInt numGlyphsInPage = page->GlyphCount();
+	TBool glyphFound = EFalse;
+	for (TInt ii = 0; ii < numGlyphsInPage && !glyphFound; ++ii)
+		{
+		glyphFound = (aGlyphCode == page->GlyphCodeAt(ii));
+		}
+	return glyphFound;
+	}
+
+/**
+Returns the number of glyphs associated to the given font in the atlas.
+*/
+TInt CGlyphAtlasTestWrapper::GlyphCountByFont(const CBitmapFont* aFont)
+	{
+	TInt glyphCount = 0;
+	TDblQueIter<CGlyphAtlasPage> iter(iAtlas->iLruPageList);
+	CGlyphAtlasPage* page;
+	while((page=iter++) != NULL)
+		{
+		if (&page->FontEntry().Font() == aFont)
+			{
+			glyphCount += page->GlyphCount();
+			}
+		}
+	return glyphCount;
+	}
+
+/**
+Returns the number of glyphs in the atlas.
+*/
+TInt CGlyphAtlasTestWrapper::GlyphCount()
+	{
+	TInt glyphCount = 0;
+	TDblQueIter<CGlyphAtlasPage> iter(iAtlas->iLruPageList);
+	CGlyphAtlasPage* page;
+	while((page=iter++) != NULL)
+		{
+		glyphCount += page->GlyphCount();
+		}
+	return glyphCount;
+	}
+
+/**
+Returns the number of fonts in the atlas.
+*/
+TInt CGlyphAtlasTestWrapper::FontCount() const
+	{
+	return iAtlas->iFontEntryArray.Count();
+	}
+
+/**
+Glyph Atlas test wrapper destructor.
+*/
+CGlyphAtlasTestWrapper::~CGlyphAtlasTestWrapper()
+	{
+	delete iAtlas;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/tfbs/glyphatlastestwrapper.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,48 @@
+// Copyright (c) 2009-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 GLYPHATLASTESTWRAPPER_H
+#define GLYPHATLASTESTWRAPPER_H
+
+#include "glyphatlas.h"
+
+
+/**
+Class to provide access to glyph atlas metrics for test purposes
+*/
+NONSHARABLE_CLASS(CGlyphAtlasTestWrapper)
+    {
+public:
+	~CGlyphAtlasTestWrapper();
+	static CGlyphAtlasTestWrapper* NewL(TInt aMaxCacheSizeInBytes);
+	static CGlyphAtlasTestWrapper* NewLC(TInt aMaxCacheSizeInBytes);
+	TInt GetGlyph(const CBitmapFont& aFont, TUint aGlyphCode, TGlyphImageInfo& aGlyphImageInfo);
+	TInt AddGlyph(const CBitmapFont& aFont, const CGlyphAtlas::TAddGlyphArgs& aArgs, TGlyphImageInfo& aGlyphImageInfo);
+	void FontReleased(const CBitmapFont& aFont);
+	
+	// Utility functions providing access to internals of glyph atlas
+	TInt SizeInBytes() const;
+	TInt GlyphCountByFont(const CBitmapFont* aFont);
+	TInt GlyphCount();
+	TInt FontCount() const;
+	TBool LruPageContainsGlyph(TUint aGlyphCode) const;
+private:
+	CGlyphAtlasTestWrapper();
+	void ConstructL(TInt aMaxCacheSizeInBytes);
+private:
+	CGlyphAtlas* iAtlas;
+    };
+
+#endif /* GLYPHATLASTESTWRAPPER_H */
--- a/fbs/fontandbitmapserver/tfbs/scripts/fbstest_T_IPCTest.script	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/scripts/fbstest_T_IPCTest.script	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// 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"
@@ -46,7 +46,10 @@
 RUN_TEST_STEP !PanicCode=-6 100 TFbsServer TIPCTest z:\fbstest\ipctest_config.ini ShapeDelete
 RUN_TEST_STEP !PanicCode=-6 100 TFbsServer TIPCTest z:\fbstest\ipctest_config.ini SetTwipsHeight
 RUN_TEST_STEP !PanicCode=-6 100 TFbsServer TIPCTest z:\fbstest\ipctest_config.ini GetTwipsHeight
+RUN_TEST_STEP !PanicCode=-8 100 TFbsServer TIPCTest z:\fbstest\ipctest_config.ini GetGlyphs
+RUN_TEST_STEP !PanicCode=-8 100 TFbsServer TIPCTest z:\fbstest\ipctest_config.ini GetGlyphMetrics
 RUN_TEST_STEP !PanicCode=-6 100 TFbsServer TIPCTest z:\fbstest\ipctest_config.ini GetFontTableWrongMsg
 RUN_TEST_STEP !PanicCode=-6 100 TFbsServer TIPCTest z:\fbstest\ipctest_config.ini ReleaseFontTableWrongMsg
 RUN_TEST_STEP !PanicCode=-38 100 TFbsServer TIPCTest z:\fbstest\ipctest_config.ini GetGlyphOutlineWrongMsg
 RUN_TEST_STEP !PanicCode=-38 100 TFbsServer TIPCTest z:\fbstest\ipctest_config.ini ReleaseGlyphOutlineWrongMsg
+
--- a/fbs/fontandbitmapserver/tfbs/scripts/fbstest_run.bat	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/scripts/fbstest_run.bat	Tue Jul 20 13:27:44 2010 +0300
@@ -26,6 +26,9 @@
 testexecute.exe  z:\fbstest\fbstest_t_ipctest.script
 testexecute.exe  z:\fbstest\fbstest_t_extendedbitmap.script
 testexecute.exe  z:\fbstest\fbstest_t_fonttable.script
+testexecute.exe  z:\fbstest\fbstest_t_glyphdata.script		
+testexecute.exe  z:\fbstest\fbstest_t_glyphdataoutlineshadow.script	
+testexecute.exe  z:\fbstest\fbstest_t_oogm.script
 
 @echo off
 md e:\logs
--- a/fbs/fontandbitmapserver/tfbs/scripts/fbstest_t_fonttable.script	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/scripts/fbstest_t_fonttable.script	Tue Jul 20 13:27:44 2010 +0300
@@ -16,10 +16,10 @@
 PRINT Run TFontTableAndGlyphOutline Fbserv test 
 
 RUN_UTILS MakeReadWrite C:\DejaVuSans.ttf
-RUN_UTILS CopyFile z:\RESOURCE\FONTS\DejaVuSans.ttf C:\DejaVuSans.ttf
+RUN_UTILS CopyFile z:\RESOURCE\FONTS\DejaVuSansCondensed.ttf C:\DejaVuSans.ttf
 RUN_UTILS MakeReadWrite C:\DejaVuSans.TTF 
 RUN_UTILS MakeReadWrite C:\DejaVuSerif.ttf
-RUN_UTILS CopyFile z:\RESOURCE\FONTS\DejaVuSerif.ttf C:\DejaVuSerif.ttf
+RUN_UTILS CopyFile z:\RESOURCE\FONTS\DejaVuSerifCondensed.ttf C:\DejaVuSerif.ttf
 RUN_UTILS MakeReadWrite C:\DejaVuSerif.ttf
 
 // Set test server to have no Capabilitities
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/tfbs/scripts/fbstest_t_glyphdata.script	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,32 @@
+// Copyright (c) 2009-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:
+//
+
+PRINT Run TGlyphAtlas & TFbsGlyphData Fbserv tests 
+//
+LOAD_SUITE TFbsServer
+RUN_TEST_STEP 100 TFbsServer TGlyphAtlas
+RUN_TEST_STEP 800 TFbsServer TFbsGlyphData
+RUN_PANIC_STEP_RESULT 31 FBSCLI 100 TFbsServer TFbsGlyphDataPanic z:\fbstest\glyphdata_config.ini NotInitializedNext
+RUN_PANIC_STEP_RESULT 31 FBSCLI 100 TFbsServer TFbsGlyphDataPanic z:\fbstest\glyphdata_config.ini NotInitializedImage
+RUN_PANIC_STEP_RESULT 31 FBSCLI 100 TFbsServer TFbsGlyphDataPanic z:\fbstest\glyphdata_config.ini NotInitializedMetrics
+RUN_PANIC_STEP_RESULT 31 FBSCLI 100 TFbsServer TFbsGlyphDataPanic z:\fbstest\glyphdata_config.ini NotInitializedGlyphCode
+RUN_PANIC_STEP_RESULT 31 FBSCLI 100 TFbsServer TFbsGlyphDataPanic z:\fbstest\glyphdata_config.ini ClosedNext
+RUN_PANIC_STEP_RESULT 31 FBSCLI 100 TFbsServer TFbsGlyphDataPanic z:\fbstest\glyphdata_config.ini ClosedImage
+RUN_PANIC_STEP_RESULT 31 FBSCLI 100 TFbsServer TFbsGlyphDataPanic z:\fbstest\glyphdata_config.ini ClosedMetrics
+RUN_PANIC_STEP_RESULT 31 FBSCLI 100 TFbsServer TFbsGlyphDataPanic z:\fbstest\glyphdata_config.ini ClosedGlyphCode
+RUN_PANIC_STEP_RESULT -8 FBSERV 100 TFbsServer TFbsGlyphDataPanic z:\fbstest\glyphdata_config.ini DiscardUsedFont
+RUN_PANIC_STEP_RESULT 32 FBSCLI 100 TFbsServer TFbsGlyphDataPanic z:\fbstest\glyphdata_config.ini IndexNegative
+RUN_PANIC_STEP_RESULT 32 FBSCLI 100 TFbsServer TFbsGlyphDataPanic z:\fbstest\glyphdata_config.ini IndexTooHigh
+RUN_PANIC_STEP_RESULT 31 FBSCLI 100 TFbsServer TFbsGlyphDataPanic z:\fbstest\glyphdata_config.ini IteratorOpenFailed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/tfbs/scripts/fbstest_t_glyphdataoutlineshadow.script	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,20 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+PRINT Run TFbsGlyphData Fbserv test 
+//
+LOAD_SUITE TFbsServer
+//the following test must be run with a rasterizer which supports outline and shadow
+RUN_TEST_STEP 300 TFbsServer TFbsGlyphDataOutlineAndShadow
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/tfbs/scripts/fbstest_t_oogm.script	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,19 @@
+// Copyright (c) 2009-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:
+//
+
+PRINT Run TFbsOogm Fbserv tests 
+//
+LOAD_SUITE TFbsServer
+RUN_TEST_STEP 100 TFbsServer TFbsOogm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/tfbs/scripts/glyphdata_config.ini	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,36 @@
+[NotInitializedNext]
+CaseNumber = 1
+
+[NotInitializedImage]
+CaseNumber = 2
+
+[NotInitializedMetrics]
+CaseNumber = 3
+
+[NotInitializedGlyphCode]
+CaseNumber = 4
+
+[ClosedNext]
+CaseNumber = 5
+
+[ClosedImage]
+CaseNumber = 6
+
+[ClosedMetrics]
+CaseNumber = 7
+
+[ClosedGlyphCode]
+CaseNumber = 8
+
+[DiscardUsedFont]
+CaseNumber = 9
+
+[IndexNegative]
+CaseNumber = 10
+
+[IndexTooHigh]
+CaseNumber = 11
+
+[IteratorOpenFailed]
+CaseNumber = 12
+
--- a/fbs/fontandbitmapserver/tfbs/scripts/ipctest_config.ini	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/scripts/ipctest_config.ini	Tue Jul 20 13:27:44 2010 +0300
@@ -67,14 +67,21 @@
 [GetTwipsHeight]
 CaseNumber = 23
 
-[GetFontTableWrongMsg]
+[GetGlyphs]
 CaseNumber = 24
 
-[ReleaseFontTableWrongMsg]
+[GetGlyphMetrics]
 CaseNumber = 25
 
-[GetGlyphOutlineWrongMsg]
+[GetFontTableWrongMsg]
 CaseNumber = 26
 
+[ReleaseFontTableWrongMsg]
+CaseNumber = 27
+
+[GetGlyphOutlineWrongMsg]
+CaseNumber = 28
+
 [ReleaseGlyphOutlineWrongMsg]
-CaseNumber = 27
+CaseNumber = 29
+
--- a/fbs/fontandbitmapserver/tfbs/tcompressed.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/tcompressed.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+// 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 "Eclipse Public License v1.0"
@@ -18,7 +18,7 @@
 
 #include <fbs.h>
 #include "TFBS.H"
-#include "TGraphicsHarness.h"
+#include "test/TGraphicsHarness.h"
 
 class CTCompressed : public CTGraphicsBase
 	{
--- a/fbs/fontandbitmapserver/tfbs/textendedbitmapcommon.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/textendedbitmapcommon.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// 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"
@@ -16,7 +16,7 @@
 #ifndef TEXTENDEDBITMAPCOMMON_H
 #define TEXTENDEDBITMAPCOMMON_H
 
-#include "TGraphicsHarness.h"
+#include "test/TGraphicsHarness.h"
 
 // Uid for use when testing an extended bitmap that does not need to be
 // drawn using the example rasterizer.
--- a/fbs/fontandbitmapserver/tfbs/tfbsbase.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/tfbsbase.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// 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"
@@ -16,7 +16,7 @@
 #ifndef TFBSBASE_H
 #define TFBSBASE_H
 
-#include "TGraphicsHarness.h"
+#include "test/TGraphicsHarness.h"
 #include <f32file.h>
 
 #define INFO_PRINTF9(p1, p2, p3, p4, p5, p6, p7, p8, p9) \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/tfbs/tfbsglyphdata.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,3229 @@
+// Copyright (c) 2009-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:
+//
+
+/**
+ @file
+ @internalComponent - Internal Symbian test code
+*/
+
+#include <EGL/egl.h>
+#include <VG/openvg.h>
+#include <graphics/fbsglyphmetricsarray.h> 
+#include <graphics/fbsglyphdataiterator.h>
+#include <sgresource/sgimage.h>
+#include <sgresource/sgdriver_test.h>
+#include <sgresource/sgdriver_profiling.h>
+#include "FbsMessage.h"
+#include "tfbsglyphdata.h"
+
+_LIT(KTypefaceName, "DejaVu Sans Condensed");
+//_LIT(KMonoTypefaceName, "DejaVu Sans Mono");
+const TInt KNumGlyphCodesLatin = 96;
+const TUint KDejaVuInvalidGlyphCode = 0;
+
+// Currently only used in debug. When TestMultithreadStressAtlas() test is enabled, #ifdef to be removed. 
+#ifdef _DEBUG
+const TInt KTestThreadMinHeapSize = 0x20000;
+const TInt KTestThreadMaxHeapSize = 0x20000;
+#endif
+
+// 'most significant bit' flag to ensure value is interpreted as a glyph code rather than an ascii code
+const TUint KGlyphCodeFlag = 0x80000000;      
+
+
+// Please note the following macros which enable helper functions, and are declared in the header.
+// SAVEGLYPHSTOMBMDURINGCOMPARISON and
+// SAVEGLYPHSTOMBMDEBUGFUNCTION
+
+/*
+Lookup table to convert from ascii code to
+glyph code for the Deja Vu family of fonts.
+ */
+const TUint DejaVuASCIIToGlyphCode[] = 
+	{
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 3, 4, 5, 6, 7, 8, 9, 10,
+	11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+	21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+	31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+	41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+	51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
+	61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
+	71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
+	81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
+	91, 92, 93, 94, 95, 96, 97, 98,
+	};
+
+// Utility function declations - utilities used by the tests
+static TFontSpec GenerateDejaVuFontSpec(TInt aSeed);
+static void CopyCharLine(TUint32*& aBinaryDataPtr,TInt aBufferWords,const TUint8* aData,TInt aBitShift,TInt aCharWidth, TInt16 aRepeatCount);
+static void DecodeBinaryData(const TSize& aDataSize, const TUint8* aData, TInt aStride,	TUint32* aBinaryData);
+static TInt CreateSgImageFromCharacterData(const TUint8* aData, const TSize& aSize, TGlyphBitmapType aType, RSgImage& aImage);
+static TInt CreateSgImageFromCharacterData(const TUint8* aData, const TSize& aSize, TGlyphBitmapType aType, RSgImage& aImage, TUint8* aBuffer1, TUint8* aBuffer2);
+// Following functions commented out because the tests which use these functions 
+// are currently commented out due to Broadcom defect 
+// ESLM-85LDV7 - TB10.1 Closing of RSgImage with duplicate handle used in same thread does not release GPU RAM
+//static TInt FillGraphicsMemoryWithImages(const TSize& aSize, RArray<RSgImage>& aImages);
+//static TInt NearlyFillGraphicsMemoryWithImages(const TSize& aSize, RArray<RSgImage>& aImages);
+
+#if defined (SAVEGLYPHSTOMBMDEBUGFUNCTION) || defined (SAVEGLYPHSTOMBMDURINGCOMPARISON)
+/**
+Static utility function. Converts an A8 RSgImage into a CFbsBitmap.
+To do this, the RSgImage is converted to an EGLImage, then to a VGImage,
+where the image memory is read into a CFbsBitmap.
+
+@param aEGL The EGL helper object that will read the SgImage into a memory buffer.
+@param aSgImage The RSgImage to convert.
+@param aRect A rectangular region of the RSgImage to convert.
+@param aBitmap On success, holds a pointer to a CFbsBitmap which contains the image
+	data of the RSgImage.
+@return One of the system-wide error codes.
+*/
+static TInt CreateBitmapFromSgImage(CEGLHelper* aEGL, const RSgImage& aSgImage, const TRect& aRect, CFbsBitmap*& aBitmap)
+	{
+	TInt err = KErrNone;
+	const TSize bufferSize = aRect.Size();
+	const TInt dataStride = bufferSize.iWidth;
+
+	TUint8* imageBuffer = reinterpret_cast<TUint8*>(User::AllocZ(bufferSize.iHeight * dataStride));
+	if (!imageBuffer)
+		{
+		return KErrNoMemory;
+		}
+	err = aEGL->GetSgImageData(aSgImage, aRect, imageBuffer);
+	if (err != KErrNone)
+		{
+		User::Free(imageBuffer);
+		return err;
+		}
+	aBitmap = new CFbsBitmap();
+	if (!aBitmap)
+		{
+		User::Free(imageBuffer);
+		return KErrNoMemory;
+		}
+
+	err = aBitmap->Create(bufferSize, EGray256);
+	if (KErrNone == err)
+		{
+		TUint8* buf = imageBuffer;
+		aBitmap->BeginDataAccess();
+		TUint8* dataAddress = reinterpret_cast<TUint8*>(aBitmap->DataAddress());
+		const TInt dataStride = aBitmap->DataStride();	
+		for (TInt scanline = 0; scanline < bufferSize.iHeight; scanline++)
+			{
+			Mem::Copy(dataAddress, buf, bufferSize.iWidth);
+			dataAddress += dataStride;
+			buf += bufferSize.iWidth;
+			}
+		aBitmap->EndDataAccess(EFalse);
+		}
+	else
+		{
+		delete aBitmap;
+		aBitmap = NULL;
+		}
+
+	User::Free(imageBuffer);
+	return err;
+	}
+
+/**
+Utility function to aid with debugging.
+Saves a bitmap to file.
+
+@param aBmp Bitmap to save
+@param aMeta Optional. If specified, it is added to the name of the bitmap file.
+@param aRef Flag to show whether bitmap is a reference bitmap (ETrue) or test bitmap (EFalse).
+*/
+static void SaveBmp(CFbsBitmap* aBmp, TPtrC* aMeta, TBool aRef)
+	{
+	if (!aBmp)
+		{
+		return;
+		}
+	
+	TBuf<256> testFileName;
+	if (aRef)
+		{
+		testFileName.Append(_L("Ref"));
+		}
+	else
+		{
+		testFileName.Append(_L("Test"));
+		}
+	if (aMeta)
+		{
+		testFileName.Append(*aMeta);
+		}
+
+	TFileName mbmFile;
+	TBuf<20> testPathName;
+	#ifdef __WINS__
+		testPathName.Append(_L("c:\\%S.mbm"));
+	#else
+		testPathName.Append(_L("e:\\%S.mbm"));
+	#endif
+	mbmFile.Format(testPathName, &testFileName);
+
+	// As this is for debugging purposes only, doesn't matter reporting whether
+	// saving succeeded or not.
+	aBmp->Save(mbmFile);
+	}
+#endif // SAVEGLYPHSTOMBMDEBUGFUNCTION OR SAVEGLYPHSTOMBMDURINGCOMPARISON
+
+
+#ifdef SAVEGLYPHSTOMBMDEBUGFUNCTION
+void CTFbsGlyphData::SaveRSgImagesAsMbms(CEGLHelper* aEGL, const RSgImage& aImageA, const TRect& aRectA, const RSgImage& aImageB, const TRect& aRectB )
+	{
+	static TInt countToAppend = 0;
+
+	CFbsBitmap* bitmap = NULL;
+	if (KErrNone == CreateBitmapFromSgImage(aEGL, aImageA, aRectA, bitmap))
+		{
+		TBuf<KMaxFileName> buf( _L("String") );
+		buf.AppendNum( countToAppend );
+		TPtrC nameAppend( buf );
+
+		SaveBmp(bitmap, &nameAppend, EFalse);
+		}
+	delete bitmap;  
+	bitmap = NULL;
+
+	if (KErrNone == CreateBitmapFromSgImage(aEGL, aImageB, aRectB, bitmap))
+		{
+		TBuf<KMaxFileName> buf( _L("String") );
+		buf.AppendNum( countToAppend );
+		TPtrC nameAppend( buf );
+
+		SaveBmp(bitmap, &nameAppend, ETrue);
+		}
+	delete bitmap;
+	bitmap = NULL;
+
+	countToAppend++;
+	}
+
+/**
+Static debug utility method that outputs the glyph images of the given glyph
+codes for the given font to a file.
+ */
+static void DumpFontGlyphs(CEGLHelper* aEGL, CFont* aFont, TInt aCodesCount)
+	{
+	TFontSpec fontSpec = aFont->FontSpecInTwips();
+	TOpenFontCharMetrics charMetrics;
+	TSize bitmapSize;
+	const TUint8* bitmapData = NULL;
+	
+	for (TInt glyphCode = 0; glyphCode < aCodesCount; glyphCode++)
+		{
+		CFont::TCharacterDataAvailability availability = aFont->GetCharacterData(glyphCode | KGlyphCodeFlag, charMetrics, bitmapData, bitmapSize);
+		if (availability == CFont::EAllCharacterData)
+			{
+			RSgImage characterDataImage;
+			TInt err = CreateSgImageFromCharacterData(bitmapData, bitmapSize, fontSpec.iFontStyle.BitmapType(), characterDataImage);
+			if (err == KErrNone)
+				{
+				CFbsBitmap* bitmap = NULL;
+				err = CreateBitmapFromSgImage(aEGL, characterDataImage, TRect(TPoint(0, 0), bitmapSize), bitmap);
+				if (err == KErrNone)
+					{
+					TBuf<256> bitmapName;
+					bitmapName.AppendFormat(_L("%S-%i"), &(fontSpec.iTypeface.Name()), glyphCode);
+					TPtrC bitmapNamePtr(bitmapName);
+					SaveBmp(bitmap, &bitmapNamePtr, EFalse);
+					delete bitmap;
+					}
+				}
+			characterDataImage.Close();
+			}
+		}
+	}
+#endif // SAVEGLYPHSTOMBMDEBUGFUNCTION
+
+
+/**
+Utility to return a fontspec such that the font created from it will
+not match any other font generated by a different seed. The font
+will be useable by RFbsGlyphDataIterator and RFbsGlyphMetricsArray.
+It will always return a font based on the DejaVu fontspec, this is 
+so that the glyphcodes in DejaVuASCIIToGlyphCode are guaranteed to
+work.
+
+@param aSeed Specifies a variant of the fontspec to create. Passing the
+	same seed will cause the same TFontSpec to be returned.
+@return The generated fontspec. 
+ */
+static TFontSpec GenerateDejaVuFontSpec(TInt aSeed)
+	{
+	const TInt KFontHeightStep = 4;
+	const TInt KFontInitialHeight = 8;
+	
+	const TInt KNumFontTypefaces = 3;
+	const TInt KNumFontBitmapTypes = 2;
+	const TInt KNumFontStyles = 4;
+	
+	TInt fontBitmapTypeVariant = aSeed % KNumFontBitmapTypes;
+	TInt fontStyleVariant = (aSeed / KNumFontBitmapTypes) % KNumFontStyles;
+	TInt fontTypefaceVariant = (aSeed / ( KNumFontStyles * KNumFontBitmapTypes)) % KNumFontTypefaces;
+	TInt fontHeightVariant = aSeed / (KNumFontStyles * KNumFontTypefaces * KNumFontBitmapTypes);
+	
+	TFontSpec fontSpec;	
+	fontSpec.iHeight = KFontInitialHeight + (fontHeightVariant * KFontHeightStep);
+	// Set the typeface name
+	// Set the style.
+	switch (fontStyleVariant)
+		{
+		case 1: // italic
+			fontSpec.iFontStyle.SetPosture(EPostureItalic);
+			fontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightNormal);
+			break;
+		case 2: // bold
+			fontSpec.iFontStyle.SetPosture(EPostureUpright);
+			fontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
+			break;
+		case 3: // bold italic
+			fontSpec.iFontStyle.SetPosture(EPostureItalic);
+			fontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
+			break;
+		default: // normal 
+			fontSpec.iFontStyle.SetPosture(EPostureUpright);
+			fontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightNormal);
+			break;
+		}
+	switch (fontTypefaceVariant)
+		{
+		case 1:
+			fontSpec.iTypeface.SetName(_L("DejaVu Sans Mono"));
+			break;
+		case 2:
+			fontSpec.iTypeface.SetName(_L("DejaVu Serif Condensed"));
+			break;
+		case 3:
+			fontSpec.iTypeface.SetName(_L("DejaVu Sans Condensed"));
+			break;
+		}
+	switch(fontBitmapTypeVariant)
+		{
+		case 1:
+			fontSpec.iFontStyle.SetBitmapType(EMonochromeGlyphBitmap);
+			break;
+		default:
+			fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
+			break;
+		}
+
+	return fontSpec;
+	}
+
+
+/**
+ * 
+ EGL helper class to retrieve image data from an SgImage into a memory buffer.
+ */
+CEGLHelper::CEGLHelper() :
+	iDisplay(EGL_NO_DISPLAY),
+	iContext(EGL_NO_CONTEXT),
+	iSurface(EGL_NO_SURFACE)
+	{
+	}
+CEGLHelper::~CEGLHelper()
+	{
+	iMutex.Close();
+	eglMakeCurrent(iDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+	eglDestroyContext(iDisplay, iContext);
+	eglDestroySurface(iDisplay, iSurface);
+	eglTerminate(iDisplay);
+	eglReleaseThread();
+	iSgDriver.Close();
+	}
+
+/**
+Factory method to create CEGLHelper.
+@return A pointer to an instance of CEGLHelper.
+ */
+CEGLHelper* CEGLHelper::NewL()
+	{
+	CEGLHelper* self = new CEGLHelper();
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(1); // self
+	return self;
+	}
+
+/**
+Opens handle to the process-wide synchronisation semaphore,
+loads EGL and VG extension function pointers,
+sets up EGL resources so that EGLImages can be constructed. 
+ */
+void CEGLHelper::ConstructL()
+	{
+	_LIT(KEGLMutex, "TFbsGlyphDataEGLMutex");
+	User::LeaveIfError(iMutex.CreateGlobal(KEGLMutex, EOwnerProcess));
+	User::LeaveIfError(iSgDriver.Open());
+
+	iDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+	if (iDisplay == EGL_NO_DISPLAY)
+		{
+		User::Leave(KErrNotSupported);
+		}
+	if (EGL_TRUE != eglInitialize(iDisplay, NULL, NULL))
+		{
+		User::Leave(KErrNotSupported);
+		}
+	eglBindAPI(EGL_OPENVG_API);
+
+	// Load the necessary EGL extensions...
+	eglCreateImageKHR = reinterpret_cast<PFNEGLCREATEIMAGEKHRPROC>(eglGetProcAddress("eglCreateImageKHR"));
+	eglDestroyImageKHR = reinterpret_cast<PFNEGLDESTROYIMAGEKHRPROC>(eglGetProcAddress("eglDestroyImageKHR"));
+	vgCreateImageTargetKHR = reinterpret_cast<TvgCreateEGLImageTargetKHRTypefPtr>(eglGetProcAddress("vgCreateEGLImageTargetKHR"));
+	if (!eglCreateImageKHR || !eglDestroyImageKHR || !vgCreateImageTargetKHR)
+		{
+		User::Leave(KErrExtensionNotSupported);
+		}
+
+	// In order to create VGImages from EGLImages, a context must be current.
+	// Therefore create an EGLContext and EGLSurface to make current, using
+	// a dummy RSgImage.
+
+	RSgImage dummySurface;
+	TSgImageInfo dummySurfaceInfo(TSize(1, 1), ESgPixelFormatRGB_565, ESgUsageBitOpenVgSurface);
+	User::LeaveIfError(dummySurface.Create(dummySurfaceInfo, NULL, 0));
+	CleanupClosePushL(dummySurface);
+
+	EGLint configAttribs[] = 
+		{
+		EGL_MATCH_NATIVE_PIXMAP, (EGLint)&dummySurface,
+		EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
+		EGL_NONE
+		};
+
+	EGLint configId = 0;
+	EGLint numConfigs = 0;
+	if (EGL_FALSE == eglChooseConfig(iDisplay, configAttribs, &configId, 1, &numConfigs) || numConfigs == 0)
+		{
+		User::Leave(KErrGeneral);
+		}
+	iContext = eglCreateContext(iDisplay, configId, EGL_NO_CONTEXT, NULL);
+	if (iContext == EGL_NO_CONTEXT)
+		{
+		User::Leave(KErrGeneral);
+		}
+	iSurface = eglCreatePixmapSurface(iDisplay, configId, &dummySurface, NULL);
+	if (iSurface == EGL_NO_SURFACE)
+		{
+		User::Leave(KErrGeneral);
+		}
+	CleanupStack::PopAndDestroy(1); // dummySurface
+	}
+
+/**
+Retrieves the data from an A8 RSgImage into a buffer.
+To do this, the RSgImage is converted to an EGLImage, then to a VGImage,
+where the image memory is read into the given buffer.
+The function can be called from multiple threads and synchronisation
+with EGL is controlled via a mutex.
+
+@param aSgImage The RSgImage to convert.
+@param aRect A rectangular region of the RSgImage to convert.
+@param aBuf On success, contains the image data of the RSgImage.
+@return One of the system-wide error codes.
+ */
+TInt CEGLHelper::GetSgImageData(const RSgImage& aSgImage, const TRect& aRect, TUint8*& aBuf)
+	{
+	const TSize bufferSize = aRect.Size();
+	const TInt dataStride = bufferSize.iWidth;
+
+	if (bufferSize == TSize(0,0))
+		{
+		return KErrNone;
+		}
+	iMutex.Wait();
+
+	TInt err = KErrNone;
+	EGLImageKHR eglImage;
+	if (EGL_FALSE == eglBindAPI(EGL_OPENVG_API))
+		{
+		err = KErrGeneral;
+		}
+	else if (EGL_FALSE == eglMakeCurrent(iDisplay, iSurface, iSurface, iContext))
+		{
+		err = KErrGeneral;
+		}
+	else
+		{
+		// Create EGLImages from the RSgImage.
+		EGLint imageAttribs[] =
+			{
+			EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, 
+			EGL_NONE
+			};
+		eglImage = eglCreateImageKHR(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, reinterpret_cast<EGLClientBuffer>(&aSgImage), imageAttribs);
+		if (eglImage == EGL_NO_IMAGE_KHR)
+			{
+			err = KErrArgument;
+			}
+		}
+	if (err == KErrNone)
+		{
+		// Create VGImages from the EGLImage.
+		VGImage vgImage = vgCreateImageTargetKHR(eglImage);
+		eglDestroyImageKHR(iDisplay, eglImage);
+		if (vgImage == VG_INVALID_HANDLE)
+			{
+			err = KErrArgument;
+			}
+		else
+			{
+			// Get the image data in 8bpp format
+			vgGetImageSubData(vgImage, aBuf, dataStride, VG_A_8, aRect.iTl.iX, aRect.iTl.iY, bufferSize.iWidth, bufferSize.iHeight);
+			vgDestroyImage(vgImage);
+			}
+		}
+	eglReleaseThread();
+	iMutex.Signal();
+	return err;
+	}
+
+CTFbsGlyphData::CTFbsGlyphData(CTestStep* aStep):
+	CTGraphicsBase(aStep)
+	{
+	}
+
+void CTFbsGlyphData::ConstructL()
+	{
+	User::LeaveIfError(Logger().ShareAuto());
+	User::LeaveIfError(RFbsSession::Connect());
+	iFbs = RFbsSession::GetSession();
+	iTs = (CFbsTypefaceStore*)CFbsTypefaceStore::NewL(NULL);
+	User::LeaveIfError(iTs->GetNearestFontToDesignHeightInPixels((CFont*&)iFont, TFontSpec(KTypefaceName, 15)));
+	User::LeaveIfError(iTs->GetNearestFontToDesignHeightInPixels((CFont*&)iFont2, TFontSpec(KTypefaceName, 8)));
+	
+	iGlyphCodesLatin = new(ELeave) TUint[KNumGlyphCodesLatin];
+	for (TInt ii = 0; ii < KNumGlyphCodesLatin; ++ii)
+		{
+		TUint asciiCode = ii+0x20; // ASCII characters from 0020 to 007F
+		iGlyphCodesLatin[ii] = DejaVuASCIIToGlyphCode[asciiCode];
+		}
+	
+	User::LeaveIfError(iSgDriver.Open());
+	iEGL = CEGLHelper::NewL();
+	
+	// Creating a CFbsBitmap will force the RFbsSession to allocate a scanline buffer
+	// now rather than in the middle of a test, thus avoiding heap check failure. 
+	CFbsBitmap* dummyBitmap = new (ELeave) CFbsBitmap;
+	CleanupStack::PushL(dummyBitmap);
+	User::LeaveIfError(dummyBitmap->Create(TSize(512, 1), EGray256));
+	CleanupStack::PopAndDestroy(dummyBitmap);
+
+	INFO_PRINTF1(_L("FBSERV Glyph Data Testing"));
+	}
+
+
+
+
+CTFbsGlyphData::~CTFbsGlyphData()
+	{
+	delete iEGL;
+	iSgDriver.Close();
+	if (iTs)
+		{
+		iTs->ReleaseFont(iFont);
+		iTs->ReleaseFont(iFont2);
+		}
+	delete iTs;
+	delete[] iGlyphCodesLatin;
+	User::Free(iTempBuf1);
+	User::Free(iTempBuf2);
+	RFbsSession::Disconnect();
+	}
+
+void CTFbsGlyphData::RunTestCaseL(TInt aCurTestCase)
+	{
+	((CTFbsGlyphDataStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
+	
+	TRAPD(leave, 
+
+	switch(aCurTestCase)
+		{
+	case 1:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0624"));
+		TestConsistencyWithGetCharacterData();
+		break;
+	case 2:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0625"));
+		TestInvalidGlyphCode();
+		break;
+	case 3:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0626"));
+		TestGlyphMetricsArrayParameters();
+		break;
+	case 4:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0627"));
+		TestGlyphMetricsArrayReuse();
+		break;
+	case 5:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0628"));
+		TestGlyphDataIteratorClose();
+		break;
+	case 6:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0629"));
+		TestGlyphDataIteratorSequence();
+		break;	
+	case 7:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0632"));
+		TestGlyphDataIteratorMultipleUsesOnMultipleFonts();
+		break;
+	case 8:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0633"));
+		TestGlyphDataIteratorImageValidity();
+		break;
+	case 9:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0634"));
+		TestGlyphDataIteratorOpenInvalidCode();
+		break;
+	case 10:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0636"));
+		TestGlyphDataIteratorOpenTwice();
+		break;
+	case 11:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0637"));
+		TestGlyphDataIteratorOpenTwiceWithDifferentFonts();
+		break;
+	case 12:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0638"));
+		TestGlyphDataIteratorOpenTooBigFont();
+		break;
+	case 13:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0640"));
+		TestGlyphDataIteratorOpenWithWrongArgument();
+		break;
+	case 14:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0641"));
+		TestGlyphDataIteratorImageMemoryLeak();
+		break;
+	case 15:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0662"));
+		TestGlyphDataIteratorNoGraphicsMemory();
+		break;
+	case 16: 
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0659"));
+		TestGlyphDataIteratorLargeFontStress();
+		break;
+	case 17: 
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0660"));
+		TestGlyphDataIteratorManyFontsStressL();
+		break;
+	case 18:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0666"));
+		TestGlyphDataIteratorNextIsAtomic();
+		break;
+	case 19:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0665"));
+		TestGlyphDataIteratorSameGlyphCodes();
+		break;
+	case 20:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0668"));
+		TestGlyphDataIteratorManyArraySizes();
+		break;
+	case 21:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0669"));
+		TestBitmapFontSupport();
+		break;
+	case 22:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0671"));
+		TestMultithreadShareSingleFont();
+		break;
+	case 23:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0672"));
+		TestMultithreadStressAtlas();
+		break;
+    case 24:
+        ((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0673"));
+        TestGlyphMetricsArrayHeapOOML();
+        break;
+    case 25:
+        ((CTFbsGlyphDataStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0674"));
+        TestGlyphDataIteratorHeapOOML();
+        break;
+	default:
+		((CTFbsGlyphDataStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
+		((CTFbsGlyphDataStep*)iStep)->CloseTMSGraphicsStep();
+		TestComplete();
+		break;
+		}
+	
+	); // TRAPD
+
+	if (leave != KErrNone)
+		{
+		ERR_PRINTF2(_L("Leave %d occurred during test"), leave);
+		iStep->SetTestStepResult(EFail);
+		}
+
+	((CTFbsGlyphDataStep*)iStep)->RecordTestResultL();
+	}
+
+
+/**
+@SYMTestCaseID		GRAPHICS-FBSERV-0624
+@SYMTestPriority	High
+@SYMTestType		UT
+@SYMTestStatus		Implemented
+@SYMPREQ			PREQ2678
+
+@SYMTestCaseDesc
+	Shows that RFbsGlyphMetricsArray::Get() and CFont::GetCharacterData() all 
+	provide the same metrics for the same set of glyph codes when using a CFbsFont.
+	Shows that RFbsGlyphDataIterator::Metrics() and CFont::GetCharacterData()
+	provide the same metrics for the same set of glyph codes.
+
+@SYMTestActions
+	i. Call RFbsGlyphMetricsArray::Get() for a set of glyph codes with 1 glyph code per call.
+	ii. Call RFbsGlyphMetricsArray::Get() for a set of glyph codes all in 1 call.
+	iii. Call RFbsGlyphDataIterator::Open() for a set of glyph codes.
+	iv. Call CFont::GetCharacterData() for the same set of glyph codes.
+	v. Compare the metrics for each glyph code from all calls.
+
+@SYMTestExpectedResults
+	For each glyph code, metrics received from RFbsGlyphMetricsArray::Get() and
+	CFont::GetCharacterData() and RFbsGlyphDataIterator are all the same.
+*/
+void CTFbsGlyphData::TestConsistencyWithGetCharacterData()
+	{
+	INFO_PRINTF1(_L("Test RFbsGlyphMetricsArray::Get() with GetCharacterData()"));
+	
+	__UHEAP_MARK;
+
+	RFbsGlyphDataIterator iter;
+	RFbsGlyphMetricsArray glyphMetricsArray;
+	RFbsGlyphMetricsArray glyphMetricsArraySingle;
+	
+	TInt numMismatches = 0;
+	TOpenFontCharMetrics charMetrics;
+	TSize bitmapSize;
+	const TUint8* bitmapData = NULL;
+	
+	// Retrieve list of metrics for all glyph codes in one call
+	TInt err = glyphMetricsArray.Get(*iFont, iGlyphCodesLatin, KNumGlyphCodesLatin);
+	TESTNOERROR(err);
+	if (err == KErrNone)
+		{
+		TEST(KNumGlyphCodesLatin == glyphMetricsArray.Count());
+		
+		TInt index = 0;
+		TInt iterErr = iter.Open(*iFont, iGlyphCodesLatin, KNumGlyphCodesLatin);
+		TESTNOERROR(iterErr);
+		for (; iterErr == KErrNone; iterErr = iter.Next(), index++)
+			{
+			iFont->GetCharacterData(iGlyphCodesLatin[index] | KGlyphCodeFlag, charMetrics, bitmapData, bitmapSize);
+			
+			// Retrieve the metrics for each glyph code, one at a time
+			TESTNOERROR(err = glyphMetricsArraySingle.Get(*iFont, &iGlyphCodesLatin[index], 1));
+			if (KErrNone == err)
+				{
+				// Compare GetCharacterData() metrics with single RFbsGlyphMetricsArray.
+				TUint32 comparison1 = CompareMetrics(charMetrics, glyphMetricsArraySingle[0]); 
+				// Compare GetCharacterData() metrics with large RFbsGlyphMetricsArray.
+				TUint32 comparison2 = CompareMetrics(charMetrics, glyphMetricsArray[index]);
+				// Compare GetCharacterData() metrics with RFbsGlyphDataIterator.
+				TUint32 comparison3 = CompareMetrics(charMetrics, iter.Metrics());
+				if (comparison1 != 0 || comparison2 != 0 || comparison3 != 0)
+					{
+					ERR_PRINTF5(_L("Glyphcode %i : Metrics mismatch: %d/%d/%d"), iGlyphCodesLatin[index], comparison1, comparison2, comparison3);
+					++numMismatches;
+					}
+				}
+			}
+			iter.Close();
+			glyphMetricsArray.Close();
+			glyphMetricsArraySingle.Close();
+			TESTE(iterErr == KErrNotFound, iterErr);
+			TEST(numMismatches == 0);
+			TEST(index == KNumGlyphCodesLatin);
+		}		
+	
+	__UHEAP_MARKEND;
+	}
+
+/**
+@return A series of success/fail booleans as a bitmask. A return value of zero
+	indicates all tests passed, a result of 1 indicates the first test case failed, 
+	a return of 3 indicates the first and second test failed, and so on.
+*/
+TUint32 CTFbsGlyphData::CompareMetrics(const TOpenFontCharMetrics& aMetrics1, const TOpenFontCharMetrics& aMetrics2)
+	{
+	TUint32 result = 0;
+	result |= (aMetrics1.Width() == aMetrics2.Width()) ? 0 : (1 << 0);
+	result |= (aMetrics1.Height() == aMetrics2.Height()) ? 0 : (1 << 1);
+	result |= (aMetrics1.HorizBearingX() == aMetrics2.HorizBearingX()) ? 0 : (1 << 2);
+	result |= (aMetrics1.HorizBearingY() == aMetrics2.HorizBearingY()) ? 0 : (1 << 3);
+	result |= (aMetrics1.HorizAdvance() == aMetrics2.HorizAdvance()) ? 0 : (1 << 4);
+	result |= (aMetrics1.VertBearingX() == aMetrics2.VertBearingX()) ? 0 : (1 << 5);
+	result |= (aMetrics1.VertBearingY() == aMetrics2.VertBearingY()) ? 0 : (1 << 6);
+	result |= (aMetrics1.VertAdvance() == aMetrics2.VertAdvance()) ? 0 : (1 << 7);
+	TRect rect1;
+	aMetrics1.GetHorizBounds(rect1);
+	TRect rect2;
+	aMetrics2.GetHorizBounds(rect2);
+	result |= (rect1 == rect2) ? 0 : (1 << 8);
+	aMetrics1.GetVertBounds(rect1);
+	aMetrics2.GetVertBounds(rect2);
+	result |= (rect1 == rect2) ? 0 : (1 << 9);
+	return result;
+	}
+
+
+/**
+@SYMTestCaseID		GRAPHICS-FBSERV-0625
+@SYMTestPriority	High
+@SYMTestType		UT
+@SYMTestStatus		Implemented
+@SYMPREQ			PREQ2678
+
+@SYMTestCaseDesc
+	Shows that RFbsGlyphMetricsArray::Get(), and CFont::GetCharacterData() show the same 
+	behaviour when asked for metrics for an invalid glyph code when using a	CFbsFont. 
+	An invalid glyph code is one for which there is no character equivalent, such as 
+	0.
+
+@SYMTestActions
+	i. Call CFont::GetCharacterData() for an invalid glyph code.
+	ii. Call RFbsGlyphMetricsArray::Get() for the same invalid glyph code, and either 
+		compare the metrics if i. was successful, or check an error code was returned
+	
+@SYMTestExpectedResults
+	If GetCharacterData() is successful, the metrics received from
+	RFbsGlyphMetricsArray::Get() and CFont::GetCharacterData()	are the same, otherwise
+	RFbsGlyphMetricsArray::Get() should return an error code.
+*/
+
+void CTFbsGlyphData::TestInvalidGlyphCode()
+	{
+	INFO_PRINTF1(_L("Test behaviour of RFbsGlyphMetricsArray::Get() with invalid glyph code is consistent with GetCharacterData"));
+	
+	__UHEAP_MARK;
+	TInt arrayErr = KErrNone;
+	RFbsGlyphMetricsArray glyphMetricsArray;
+	TOpenFontCharMetrics charMetrics;
+	TSize bitmapSize;
+	const TUint8* bitmapData = NULL;
+	
+	CFont::TCharacterDataAvailability availability = iFont->GetCharacterData(KDejaVuInvalidGlyphCode | KGlyphCodeFlag, charMetrics, bitmapData, bitmapSize);
+	if (availability == CFont::ENoCharacterData)
+		{
+		// Some rasterizers fail to return any data for KDejaVuInvalidGlyphCode, therefore
+		// rather than compare metrics, make sure RFbsGlyphDataIterator returns an error code.
+		WARN_PRINTF1(_L("Rasterizer failed to return data for invalid glyph code; not comparing glyph metrics"));
+		arrayErr = glyphMetricsArray.Get(*iFont, &KDejaVuInvalidGlyphCode, 1);
+		TESTE(arrayErr != KErrNone, arrayErr);
+		}
+	else
+		{
+		TESTNOERROR(arrayErr = glyphMetricsArray.Get(*iFont, &KDejaVuInvalidGlyphCode, 1));
+		if (KErrNone == arrayErr)
+			{
+			iFont->GetCharacterData(KDejaVuInvalidGlyphCode | KGlyphCodeFlag, charMetrics, bitmapData, bitmapSize);
+			TUint comparisonResult = CompareMetrics(charMetrics, glyphMetricsArray[0]);
+			TESTNOERROR( comparisonResult );
+			}
+		}
+	glyphMetricsArray.Close();
+
+	__UHEAP_MARKEND;
+	}
+
+/**
+@SYMTestCaseID		GRAPHICS-FBSERV-0626
+@SYMTestPriority	High
+@SYMTestType		UT
+@SYMTestStatus		Implemented
+@SYMPREQ			PREQ2678
+
+@SYMTestCaseDesc
+	Shows that RFbsGlyphMetricsArray::Get() returns with the correct error code when passed
+	various combinations of parameters, and preserves the state of the array.
+
+@SYMTestActions
+	Populate the array with a single metrics entry.
+	Call RFbsGlyphMetricsArray::Get with the following parameter combinations:
+		1. A negative count
+		2. A positive count and null glyph code array pointer
+		3. A zero count and non-null glyph code array pointer
+		4. A zero count and null glyph code array pointer
+
+@SYMTestExpectedResults
+	The following return codes are expected for each call:
+		1. KErrArgument
+		2. KErrArgument
+		3. KErrArgument
+		4. KErrArgument	
+	For each case the glyph metrics array remains unchanged.
+*/
+void CTFbsGlyphData::TestGlyphMetricsArrayParameters()
+	{
+	INFO_PRINTF1(_L("Test the return values of GetGlyphMetrics with different parameters"));
+	__UHEAP_MARK;
+	TInt arrayErr = KErrNone;
+	TOpenFontCharMetrics dummyMetrics;
+	
+	RFbsGlyphMetricsArray glyphMetricsArray;
+	arrayErr = glyphMetricsArray.Get(*iFont, iGlyphCodesLatin, 1);
+	TESTNOERROR(arrayErr);
+	TEST(1 == glyphMetricsArray.Count());
+	
+	// 1. Negative Count
+	arrayErr = glyphMetricsArray.Get(*iFont, iGlyphCodesLatin, -1);
+	TESTE(KErrArgument == arrayErr, arrayErr);
+	TEST(1 == glyphMetricsArray.Count());
+	
+	// 2. Positive Count and NULL Array Pointer
+	arrayErr = glyphMetricsArray.Get(*iFont, NULL, 1);
+	TESTE(KErrArgument == arrayErr, arrayErr);
+	TEST(1 == glyphMetricsArray.Count());
+
+	// 3. Zero Count & Valid Array Pointer
+	arrayErr = glyphMetricsArray.Get(*iFont, iGlyphCodesLatin, 0);
+	TESTE(KErrArgument == arrayErr, arrayErr);
+
+	// 4. Zero Count & NULL Array Pointer
+	arrayErr = glyphMetricsArray.Get(*iFont, NULL, 0);
+	TESTE(KErrArgument == arrayErr, arrayErr);
+
+	glyphMetricsArray.Close();
+	__UHEAP_MARKEND;
+	}
+
+/**
+@SYMTestCaseID		GRAPHICS-FBSERV-0627
+@SYMTestPriority	High
+@SYMTestType		UT
+@SYMTestStatus		Implemented
+@SYMPREQ			PREQ2678
+
+@SYMTestCaseDesc
+	Shows that reusing an RFbsGlyphMetricsArray works correctly.
+	In particular when the array is reused and filled with fewer entries
+	and when the array is reused and filled with more entries than previously.
+	It also shows that when re-using an array that has been populated, memory 
+	is not de-allocated if the new array of glyphs is smaller.
+
+@SYMTestActions
+	i. Call RFbsGlyphMetricsArray::Get() for a set of 10 glyph codes.
+	ii. Check that the RFbsGlyphMetricsArray has 10 entries.
+	iii. Find the size of the heap-cell allocated to the array.
+	iii. Call RFbsGlyphMetricsArray::Get() for a set of 5 glyph codes.
+	iv. Check that the RFbsGlyphMetricsArray has 5 entries.
+	v. Call RFbsGlyphMetricsArray::Get() for a set of 20 glyph codes.
+	vi. Check that the RFbsGlyphMetricsArray has 20 entries.
+	vii. Call RFbsGlyphMetricsArray::Get() for a set of 0 glyph codes.
+	viii. Check that the RFbsGlyphMetricsArray has 0 entries.
+	ix. Call RFbsGlyphMetricsArray::Get() for 1 glyph code.
+	x. Check that the RFbsGlyphMetricsArray has 1 entries.
+	xi. Close the RFbsGlyphMetricsArray.
+	xii. Check that the RFbsGlyphMetricsArray has 0 entries.
+	During the test check that the size of the heap cell allocated to the array
+	does not shrink.
+
+@SYMTestExpectedResults
+	After each call to RFbsGlyphMetricsArray::Get(), the array has the expected number of entries.
+*/
+void CTFbsGlyphData::TestGlyphMetricsArrayReuse()
+	{
+	INFO_PRINTF1(_L("Test reuse of array with RFbsGlyphMetricsArray"));
+	__UHEAP_MARK;
+	
+	RFbsGlyphMetricsArray glyphMetricsArray;
+
+	// Retrieve list of metrics for 10 glyph codes
+	TESTNOERROR(glyphMetricsArray.Get(*iFont, iGlyphCodesLatin, 10));
+	TEST(10 == glyphMetricsArray.Count());
+	
+	// Find the size of the heap cell allocated for the array.
+	TInt arrayHeapCellSize = User::Heap().AllocLen(&glyphMetricsArray[0]);
+	
+	// Retrieve list of metrics for 5 glyph codes.
+	// To ensure that different metrics are returned, use different glyph codes
+	TESTNOERROR(glyphMetricsArray.Get(*iFont, &iGlyphCodesLatin[10], 5));
+	TEST(5 == glyphMetricsArray.Count());
+	// Check that memory has not been de-allocated for a smaller array.
+	TEST(User::Heap().AllocLen(&glyphMetricsArray[0]) == arrayHeapCellSize);
+
+	// Retrieve list of metrics for 20 glyph codes.
+	// To ensure that different metrics are returned, use different glyph codes
+	TESTNOERROR(glyphMetricsArray.Get(*iFont, &iGlyphCodesLatin[15], 20));
+	TEST(20 == glyphMetricsArray.Count());
+	arrayHeapCellSize = User::Heap().AllocLen(&glyphMetricsArray[0]);
+		
+	// Retrieve list of metrics for 0 glyph codes.
+	TEST(KErrArgument == glyphMetricsArray.Get(*iFont, &iGlyphCodesLatin[35], 0));
+	// We can't check whether memory has been de-allocated as glyphMetricsArray[0]
+	// is null, therefore dereferencing it causes a panic.
+
+	// Retrieve list of metrics for 1 glyph code.
+	// To ensure that different metrics are returned, use different glyph code
+	TESTNOERROR(glyphMetricsArray.Get(*iFont, &iGlyphCodesLatin[35], 1));
+	TEST(1 == glyphMetricsArray.Count());
+	TEST(User::Heap().AllocLen(&glyphMetricsArray[0]) == arrayHeapCellSize);
+	
+	// Test that after closing a non-empty array, the array has 0 size.
+	glyphMetricsArray.Close();
+	TEST(0 == glyphMetricsArray.Count());
+	
+	__UHEAP_MARKEND;
+	}
+
+/**
+@SYMTestCaseID		GRAPHICS-FBSERV-0628
+@SYMTestPriority	High
+@SYMTestType		UT
+@SYMTestStatus		Implemented
+@SYMPREQ			PREQ2678
+
+@SYMTestCaseDesc
+	Validates the behaviour of RFbsGlyphDataIterator::Close() in the following use cases:
+		1. When called on an iterator instance which has not been opened, has no effect.
+		2. When called on an open iterator closes the iterator 
+
+@SYMTestActions
+	Use case 1:
+		i. Create an RFbsGlyphDataIterator instance but do not open.
+		ii. Call RFbsGlyphDataIterator::Close().
+		
+	Use case 2:
+		i. Create an RFbsGlyphDataIterator instance and call RFbsGlyphDataIterator::Open().
+		ii. Call RFbsGlyphDataIterator::Next() to prove the iterator is open.
+		iii. Call RFbsGlyphDataIterator::Close().
+		iv. Check that RFbsGlyphDataIterator::IsOpen() returns false.
+	
+@SYMTestExpectedResults
+	Each call to RFbsGlyphDataIterator::IsOpen() returns the expected value.
+*/
+void CTFbsGlyphData::TestGlyphDataIteratorClose()
+	{
+	INFO_PRINTF1(_L("Test closing an RFbsGlyphDataIterator"));
+	__UHEAP_MARK;
+
+	// Use case 1
+	RFbsGlyphDataIterator iter1;
+	iter1.Close();
+
+	// Use case 2
+	RFbsGlyphDataIterator iter2;
+	TESTNOERROR(iter2.Open(*iFont, iGlyphCodesLatin, 1));
+	TInt iterErr = iter2.Next();
+	TESTE(KErrNotFound == iterErr, iterErr);
+	iter2.Close();
+	
+	__UHEAP_MARKEND;
+	}
+
+/**
+@SYMTestCaseID		GRAPHICS-FBSERV-0629
+@SYMTestPriority	High
+@SYMTestType		UT
+@SYMTestStatus		Implemented
+@SYMPREQ			PREQ2678
+
+@SYMTestCaseDesc
+	Show that the sequence of iterations when calling RFbsGlyphDataIterator::Next()
+	matches the order of the array of glyph codes.
+
+@SYMTestActions
+	i. Create an RFbsGlyphDataIterator instance and call RFbsGlyphDataIterator::Open()
+		with an array of different glyph codes.
+	ii. Iterate through all the glyph data.
+		For each iteration check that the glyph code returned from 
+		RFbsGlyphDataIterator::GlyphCode() matches the corresponding glyph code
+		passed into Open().
+
+@SYMTestExpectedResults
+	Each comparison of glyph code should match.
+*/
+void CTFbsGlyphData::TestGlyphDataIteratorSequence()
+	{
+	INFO_PRINTF1(_L("Test the iterator sequence of RFbsGlyphDataIterator"));
+	__UHEAP_MARK;
+	
+	TBool matches = ETrue;
+	TInt index = 0;
+
+	RFbsGlyphDataIterator iter;
+	TInt iterErr = iter.Open(*iFont, iGlyphCodesLatin, KNumGlyphCodesLatin);
+	TESTNOERROR(iterErr);
+	for (; index < KNumGlyphCodesLatin && matches && (iterErr == KErrNone); iterErr = iter.Next(), index++)
+		{
+		if (iter.GlyphCode() != iGlyphCodesLatin[index])
+			{
+			ERR_PRINTF4(_L("Failed at iteration %d: wanted %d, got %d"), index, iGlyphCodesLatin[index], iter.GlyphCode());
+			matches = EFalse;
+			}
+		}
+	iter.Close();
+	TESTE(iterErr == KErrNotFound, iterErr);
+	TEST(matches);
+	TEST(index == KNumGlyphCodesLatin);
+	iter.Close();
+
+	__UHEAP_MARKEND;
+	}
+
+/**
+@SYMTestCaseID		GRAPHICS-FBSERV-0632
+@SYMTestPriority	High
+@SYMTestType		UT
+@SYMTestStatus		Implemented
+@SYMPREQ			PREQ2678
+
+@SYMTestCaseDesc
+	Ensure it is possible to reuse a closed iterator on another CFbsFont.
+	
+@SYMTestActions
+	i. Open an RFbsGlyphDataIterator with sample data.
+	ii. Iterate through until the end of the iterator has been reached by calling 
+		Next() on the final element.
+	iii. Re-open the same RFbsGlyphDataIterator with sample data on a different CFbsFont.
+	iv. Iterate through a second time until the end has been reached by calling Next()
+		on the final element.
+	v. Close the iterator.
+	vi. During both iterations the bitmap data returned and metrics are compared with
+		the equivalent from GetCharacterData().
+
+@SYMTestExpectedResults
+	The iterator should be opened successfully for both fonts and the data returned
+	should match the data from GetCharacterData().
+*/
+void CTFbsGlyphData::TestGlyphDataIteratorMultipleUsesOnMultipleFonts()
+	{
+	INFO_PRINTF1(_L("Reuse a closed iterator on a second CFbsFont"));
+	__UHEAP_MARK;
+	
+	const TUint8* bitmapData;
+	TSize bitmapSize;
+	TOpenFontCharMetrics charMetrics;
+	RFbsGlyphDataIterator iter;
+	
+	// Array of fonts to iterate through.
+	CFbsFont* font[2] = {iFont, iFont2};
+	
+	for (TInt fontId = 0; fontId < 2; fontId++)
+		{
+		// On the first iteration, open and use a font until all glyphs have been iterated through.
+		// On second iteration, use the same iterator on a different font and repeat.
+        CFbsFont* currentFont = font[fontId];
+
+		//Open the iterator on the first font and compare the returned bitmaps against GetCharacterData
+		TInt iterErr = iter.Open(*currentFont, iGlyphCodesLatin, KNumGlyphCodesLatin);
+		TESTNOERROR(iterErr);
+		TFontSpec fontSpec = currentFont->FontSpecInTwips();
+		
+		TInt index = 0;
+		for (; (iterErr == KErrNone) && (index < KNumGlyphCodesLatin); iterErr = iter.Next(), ++index)
+			{
+			currentFont->GetCharacterData(iGlyphCodesLatin[index] | KGlyphCodeFlag, charMetrics, bitmapData, bitmapSize);
+			
+			TESTNOERROR(CompareMetrics(charMetrics, iter.Metrics()));
+			if (bitmapSize == TSize(0, 0))
+				{
+				TEST(bitmapSize == iter.Rect().Size());
+				}
+			else
+				{
+				// Compare images.
+				TBool match = EFalse;
+				RSgImage characterDataImage;
+				TInt err = CreateSgImageFromCharacterData(bitmapData, bitmapSize, fontSpec.iFontStyle.BitmapType(), characterDataImage);
+				if (err == KErrNone)
+					{
+					err = CompareSgImages(iEGL, iter.Image(), iter.Rect(), characterDataImage, TRect(bitmapSize), match);
+					}
+				characterDataImage.Close();
+				if (err != KErrNone)
+					{
+					TESTNOERROR(err);
+					break;
+					}
+				TEST(match);
+				}		
+			}
+		iter.Close();
+		TESTE(iterErr == KErrNotFound, iterErr);
+		TEST(index == KNumGlyphCodesLatin);
+		}
+	
+	__UHEAP_MARKEND;
+	}
+
+/**
+@SYMTestCaseID		GRAPHICS-FBSERV-0633
+@SYMTestPriority	High
+@SYMTestType		UT
+@SYMTestStatus		Implemented
+@SYMPREQ			PREQ2678
+
+@SYMTestCaseDesc
+	Check that for various Latin fonts, the images of the glyphs stored on the 
+	RSgImage matches those provided by GetCharacterData().
+
+@SYMTestActions
+	Create a selection of fonts, using various typefaces, sizes and bitmap types.
+	For each font:
+	i. Open the RFbsGlyphDataIterator and iterate each glyph.
+	ii. For each glyph, call GetCharacterData() with the expected glyph code.
+	iii. Convert the character data to an RSgImage.
+	iv. Perform a comparison between the character RSgImage and the iterator 
+		image. 
+	v. After all iterations, close the iterator and check all expected glyphs
+		were iterated through.
+
+@SYMTestExpectedResults
+	All glyph images should match.
+*/
+void CTFbsGlyphData::TestGlyphDataIteratorImageValidity()
+	{
+	INFO_PRINTF1(_L("Test the glyph images of the iterator match GetCharacterData()"));
+	__UHEAP_MARK;
+	
+	const TInt KNumFonts = 20;
+	
+	// Create a new typeface store for this test so that heap checking will not
+	// be affected by cached CFbsFonts.
+	CFbsTypefaceStore* typefaceStore = NULL;
+	TRAPD(err, typefaceStore = CFbsTypefaceStore::NewL(NULL));
+	if (err != KErrNone)
+		{
+		ERR_PRINTF1(_L("Failed to construct typeface store. Test aborted."));
+		__UHEAP_RESET;
+		iStep->SetTestStepResult(EFail);
+		return;
+		}
+	
+	for (TInt font = 0; font < KNumFonts; ++font)
+		{
+		// Use either a pre-created bitmap-font TFontSpec, or generate a Deja-vu one.
+		TFontSpec fontSpec = GenerateDejaVuFontSpec(font);
+		CFbsFont* latinFont = NULL;
+		TESTNOERROR(typefaceStore->GetNearestFontToDesignHeightInPixels((CFont*&)latinFont, fontSpec));	
+		
+		fontSpec = latinFont->FontSpecInTwips();
+		InfoPrintFontSpec(*latinFont);
+				
+		RFbsGlyphDataIterator iter;
+		TInt iterErr = iter.Open(*latinFont, iGlyphCodesLatin, KNumGlyphCodesLatin);
+		TESTNOERROR(iterErr);
+
+		err = KErrNone;
+		TInt index = 0;
+		TInt numMismatches = 0;
+		// For each iteration, get the character data of the expected glyph.
+		// Create RSgImage from character data, and compare iter image with constructed image.
+		for (; (iterErr == KErrNone) && (err == KErrNone) && (index < KNumGlyphCodesLatin); (iterErr = iter.Next()), ++index)
+			{
+			TBool glyphMatches = ETrue;
+			const RSgImage& iteratorImage = iter.Image();
+
+			const TUint8* bitmapData = NULL;
+			TSize bitmapSize;
+			TOpenFontCharMetrics metrics;
+			TInt characterDataAvailability = latinFont->GetCharacterData(iGlyphCodesLatin[index] | KGlyphCodeFlag, metrics, bitmapData, bitmapSize);
+			if (bitmapSize == TSize(0, 0))
+				{
+				glyphMatches = (bitmapSize == iter.Rect().Size());
+				}
+			else
+				{
+				RSgImage characterDataImage;
+				TESTNOERROR(CreateSgImageFromCharacterData(bitmapData, bitmapSize, fontSpec.iFontStyle.BitmapType(), characterDataImage));
+				err = CompareSgImages(iEGL, iteratorImage, iter.Rect(), characterDataImage, TRect(bitmapSize), glyphMatches);
+				characterDataImage.Close();
+				}
+			if (err == KErrNone && !glyphMatches)
+				{
+				ERR_PRINTF2(_L("Glyphcode %i : Image mismatch"), iGlyphCodesLatin[index]);
+				++numMismatches;
+				}
+			}
+		iter.Close();
+		TESTNOERROR(err);
+		TESTE(iterErr == KErrNotFound, iterErr);
+		TEST(index == KNumGlyphCodesLatin);	
+		TEST(numMismatches == 0);
+		typefaceStore->ReleaseFont(latinFont);
+		}
+	delete typefaceStore;
+	__UHEAP_MARKEND;
+	}
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0634
+@SYMTestPriority    High
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	To ensure that if the glyph image iterator has a current invalid 
+	character code, the SgImage returned by the iterator will match 
+	to the image obtained from the GetCharacterData() function
+@SYMTestActions
+	i. Retrieve bitmap data and metrics by using GetCharacterData().
+	ii. Open a glyph data iterator passing an invalid character code.
+	iii. If i. was unsuccessful, check that opening the iterator returned
+		an error code and skip to ix.
+	iv. Create SgImage from bitmap data.
+	v. Get SgImage from the glyph data iterator.
+	vi. Compare SgImages obtained on iv and v steps.
+	vii. Get font metrics from the glyph data iterator.
+	viii. Compare metrics obtained on i and vii steps.
+	vii. Close the iterator.
+
+@SYMTestExpectedResults
+	If the request to get the character data failed, the return value of 
+	RFbsGlyphDataIterator::Open() must not be KErrNone.
+	Otherwise, images obtained from the iterator and GetCharacterData() should
+	match.
+*/
+void CTFbsGlyphData::TestGlyphDataIteratorOpenInvalidCode()
+	{
+	INFO_PRINTF1(_L("Ensure that the image returned by the iterator will \
+match to the image obtained from GetCharacterData() if character code is invalid"));
+	__UHEAP_MARK;
+
+	const TUint8* bitmapData = NULL;
+	TSize bitmapSize;
+	TOpenFontCharMetrics metrics;
+	const TFontSpec fontSpec = iFont->FontSpecInTwips();
+	CFont::TCharacterDataAvailability availability = iFont->GetCharacterData(KDejaVuInvalidGlyphCode | KGlyphCodeFlag, metrics, bitmapData, bitmapSize);
+
+	RFbsGlyphDataIterator iter;
+	TInt err = iter.Open(*iFont, &KDejaVuInvalidGlyphCode, 1);
+	if (availability == CFont::ENoCharacterData)
+		{
+		// Some rasterizers fail to return any data for KDejaVuInvalidGlyphCode, therefore
+		// rather than compare image contents, make sure RFbsGlyphDataIterator returns an error code.
+		WARN_PRINTF1(_L("Rasterizer failed to return data for invalid glyph code; not comparing image contents"));
+		TESTE(err != KErrNone, err);
+		}
+	else
+		{
+		TESTNOERROR(err);
+		if (err == KErrNone)
+			{
+			TBool glyphMatches = EFalse;
+			if (bitmapSize == TSize(0, 0))
+				{
+				glyphMatches = (bitmapSize == iter.Rect().Size());
+				}
+			else
+				{
+				RSgImage characterDataImage;
+				TESTNOERROR(CreateSgImageFromCharacterData(bitmapData, bitmapSize, fontSpec.iFontStyle.BitmapType(), characterDataImage));
+				TESTNOERROR(CompareSgImages(iEGL, iter.Image(), iter.Rect(), characterDataImage, TRect(bitmapSize), glyphMatches));
+				characterDataImage.Close();
+				}
+			TESTNOERROR(CompareMetrics(metrics, iter.Metrics()));
+			TEST(glyphMatches);
+			}
+		}
+	iter.Close();
+
+	__UHEAP_MARKEND;
+	}
+
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0636
+@SYMTestPriority    High
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	To ensure that opening the glyph data iterator which has already been opened with the same font
+	has no effect on the state of the iterator.
+@SYMTestActions
+	i. Open glyph data iterator on 2 glyph codes.
+	ii. Try to open the glyph data iterator again on the same font.
+	iii. Call RFbsGlyphDataIterator::Next() on the iterator and check error code, making the last
+		glyph code the current iteration.
+	iv. Call RFbsGlyphDataIterator::Next() again.
+@SYMTestExpectedResults
+	The second attempt to open the glyph data iterator will result an error with code KErrInUse.
+	The last two calls to RFbsGlyphDataIterator::Next() should return KErrNone and KErrNotFound
+	respectively, showing the iterator was not modified when the call to Open() failed.
+*/
+void CTFbsGlyphData::TestGlyphDataIteratorOpenTwice()
+	{
+	INFO_PRINTF1(_L("Ensure that opening the glyph data iterator which has already been opened with the same font has no effect"));
+	__UHEAP_MARK;
+
+	RFbsGlyphDataIterator iter;
+	TInt iterErr = iter.Open(*iFont, iGlyphCodesLatin, 2);
+	TESTNOERROR(iterErr);
+	
+	iterErr = iter.Open(*iFont, iGlyphCodesLatin, KNumGlyphCodesLatin);
+	TESTE(iterErr == KErrInUse, iterErr);
+	iterErr = iter.Next();
+	TESTNOERROR(iterErr);
+	iterErr = iter.Next();
+	TESTE(iterErr == KErrNotFound, iterErr);
+	iter.Close();
+
+	__UHEAP_MARKEND;
+	}
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0637
+@SYMTestPriority    High
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	To ensure that opening the glyph data iterator which has already been opened with different font
+	has no effect on the state of the iterator.
+@SYMTestActions
+	i. Open glyph data iterator on an 2 glyph codes
+	ii. Try to open the glyph data iterator again with a different font.
+	iii. Call RFbsGlyphDataIterator::Next() on the iterator and check error code, making the last
+		glyph code the current iteration.
+	iv. Call RFbsGlyphDataIterator::Next() again.
+@SYMTestExpectedResults
+	The second attempt to open the glyph data iterator will result an error with code KErrInUse.
+	The Next() call after this should return KErrNone, signifying the iterator is still open.
+	The last Next() call should return KErrNotFound, signifying the iterator has iterated 
+	through the two original glyph codes.
+*/
+void CTFbsGlyphData::TestGlyphDataIteratorOpenTwiceWithDifferentFonts()
+	{
+	INFO_PRINTF1(_L("Ensure that opening the glyph data iterator which has already been opened with different font has no effect"));
+	__UHEAP_MARK;
+
+	RFbsGlyphDataIterator iter;
+	TInt iterErr = iter.Open(*iFont, iGlyphCodesLatin, 2);
+	TESTNOERROR(iterErr);
+
+	iterErr = iter.Open(*iFont2, iGlyphCodesLatin, 2);
+	TESTE(iterErr == KErrInUse, iterErr);
+	iterErr = iter.Next();
+	TESTNOERROR(iterErr);
+	iterErr = iter.Next();
+	TESTE(iterErr == KErrNotFound, iterErr);
+	iter.Close();
+
+	__UHEAP_MARKEND;
+	}
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0638
+@SYMTestPriority    High
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	To ensure that opening of glyph data iterator with the font greater than 
+	2048 by 2048 will not be supported 
+@SYMTestActions
+	i. Create font with the height greater than 2048
+	ii. Try to open the glyph data iterator with the font created on previous step
+	iii Release the font
+@SYMTestExpectedResults
+	Must fail with error code KErrTooBig
+*/
+void CTFbsGlyphData::TestGlyphDataIteratorOpenTooBigFont()
+	{
+	INFO_PRINTF1(_L("To ensure that opening of glyph data iterator with the font greater than 2048X2048 will not be supported"));
+	__UHEAP_MARK;
+
+	CFbsFont* bigFont;
+	const TInt maxHeight = 2048;
+	const TInt maxHeightLimit = maxHeight + 20; //max size after we stop trying to create the font
+	// the loop below will guarantee that if the font with the size greater than 2048 is available it will be created
+	for(TInt height = maxHeight + 1; height < maxHeightLimit; height++)
+		{
+		TESTNOERROR(iTs->GetNearestFontToDesignHeightInPixels((CFont*&)bigFont, TFontSpec(KTypefaceName, height)));
+		TInt realHeight = bigFont->FontMaxHeight();
+		if(realHeight > maxHeight)
+			{
+			break;
+			}
+		iTs->ReleaseFont(bigFont);
+		bigFont = NULL;
+		}
+
+	if (bigFont)
+		{
+		RFbsGlyphDataIterator iter;
+		TInt iterErr = iter.Open(*bigFont, iGlyphCodesLatin, KNumGlyphCodesLatin);
+		TESTE(iterErr == KErrTooBig, iterErr);
+		iTs->ReleaseFont(bigFont); 
+		}
+	else
+		{
+		//It is legitimate to fail to create the font, as there are no requirements for the rasterizer here to support such big font. 
+		//In this case we will skip the test.
+		WARN_PRINTF1(_L("Failed to create font with height greater than 2048"));
+		}
+
+	__UHEAP_MARKEND;
+	}
+
+
+
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0640
+@SYMTestPriority    High
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	To ensure that the glyph data iterator processes wrong arguments correctly
+@SYMTestActions
+	i. Try to open the glyph data iterator with the negative count passed in
+	ii. Try to open the glyph data iterator with the positive count and NULL 
+	glyph code array pointer passed in
+	iii. Try to open the glyph data iterator with a valid glyph code array and 
+	count equal to zero
+@SYMTestExpectedResults
+	At all steps the returned value is set to KErrArgument.
+*/
+void CTFbsGlyphData::TestGlyphDataIteratorOpenWithWrongArgument()
+	{
+	INFO_PRINTF1(_L("To ensure that the glyph data iterator processes wrong arguments correctly"));
+	__UHEAP_MARK;
+
+	RFbsGlyphDataIterator iter;
+	TInt iterErr = iter.Open(*iFont, iGlyphCodesLatin, -1);
+	TESTE(iterErr == KErrArgument, iterErr);
+	
+	iterErr = iter.Open(*iFont, NULL, 1);
+	TESTE(iterErr == KErrArgument, iterErr);
+	
+	iterErr = iter.Open(*iFont, iGlyphCodesLatin, 0);
+	TESTE(iterErr == KErrArgument, iterErr);
+	
+	__UHEAP_MARKEND;
+	}
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0641
+@SYMTestPriority    High
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	To ensure that all allocated RSgImages were released after the
+	glyph data iterator has been opened and closed multiple times.
+
+@SYMTestActions
+	i. Retrieve MSgDriver_Test interface from the SgDriver
+	ii. Mark alloc start and obtain resorce count from the interface
+	iii. Iterate through glyph data by calling RFbsGlyphDataIterator::Next() 
+	iv. Retrieve SgImage from the glyph data iterator instance
+	v. Repeate steps iii and iv multiple times
+	vi. Release font
+	vii.  Mark alloc end and obtain resorce count from the interface
+
+@SYMTestExpectedResults
+	Resorce count at the end matches resorce count at the beginning. 
+*/
+void CTFbsGlyphData::TestGlyphDataIteratorImageMemoryLeak()
+	{
+	__UHEAP_MARK;
+	
+	MSgDriver_Test* sgDriverTestInterface = NULL; 
+	TInt err = iSgDriver.GetInterface(sgDriverTestInterface);
+	if(err != KErrNone)
+		{
+		__UHEAP_MARKEND;
+		WARN_PRINTF2(_L("Failed to obtain MSgDriver_Test interface with error code: %d, the test will be skipped"), err);
+		return;
+		}
+
+	TEST(sgDriverTestInterface != NULL);
+	sgDriverTestInterface->AllocMarkStart();
+
+	MSgDriver_Profiling* sgDriverProfilInterface = NULL;
+	err = iSgDriver.GetInterface(sgDriverProfilInterface);
+	if(err != KErrNone)
+		{
+		sgDriverTestInterface->AllocMarkEnd(0);
+		__UHEAP_MARKEND;
+		WARN_PRINTF2(_L("Failed to obtain MSgDriver_Profiling interface with error code: %d, the test will be skipped"), err);
+		return;
+		}
+	const TInt resCount = sgDriverProfilInterface->LocalResourceCount();
+
+	CFbsFont* font = NULL;
+	err = iTs->GetNearestFontToDesignHeightInPixels((CFont*&)font, TFontSpec(KTypefaceName, 15));
+	TESTNOERROR(err);
+	if(err != KErrNone)
+		{
+		__UHEAP_MARKEND;
+		return;
+		}
+
+	for (TInt ii = 0; ii < 10; ii++)
+		{
+		TInt index = 0;
+		RFbsGlyphDataIterator iter;
+		TInt iterErr = iter.Open(*font, iGlyphCodesLatin, KNumGlyphCodesLatin);
+		TESTNOERROR(iterErr);
+		for (; (iterErr == KErrNone) && (index < KNumGlyphCodesLatin); iterErr = iter.Next(), ++index)
+			{
+			const RSgImage& image = iter.Image();
+			}
+		iter.Close();
+		TEST(index == KNumGlyphCodesLatin);
+		TESTE(iterErr == KErrNotFound, iterErr);
+		}
+	iTs->ReleaseFont(font);
+	const TInt resCountEnd = sgDriverProfilInterface->LocalResourceCount();
+	TEST(resCountEnd == resCount);
+	sgDriverTestInterface->AllocMarkEnd(0);
+
+	__UHEAP_MARKEND;
+	}
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0659
+@SYMTestPriority    Med
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	Uses the RFbsGlyphDataIterator to render a large amount of unique glyphs, at a very large 
+	size, to ensure that if graphics memory runs out while the iterator is in use, eviction 
+	takes place and does not corrupt the glyph images in any way.
+
+@SYMTestActions
+	i. Create a large CFbsFont from the typeface store (size 100+)
+	ii. Simulate a low graphics-memory situation by creating enough RSgImages to fill the memory,
+		releasing one image in order to allow some small amount for the test.
+	iii. Open a RFbsGlyphDataIterator on the font, using a large array of unique glyph codes.
+	iv. Iterate through the glyphs, comparing each returned SgImage against the system-memory
+		representation of the glyph as returned by CFont::GetCharacterData().
+	v. Check for errors and mismatches, and release all images created by ii.
+	
+@SYMTestExpectedResults
+	At each iteration, each glyph should match in size and contents. 
+*/
+void CTFbsGlyphData::TestGlyphDataIteratorLargeFontStress()
+	{
+	INFO_PRINTF1(_L("Stress test using a RFbsGlyphDataIterator with a large font"));
+#ifdef __WINS__
+	// Cannot run test on emulator reliably - this is because on emulator
+	// system-memory is used for RSgImages, so using up RSgImage memory may 
+	// cause heap-allocation failures unrelated to the area being tested. 
+	// This test is specifically testing the behaviour when running out of
+	// RSgImage-based memory (i.e. graphics memory), but on emulator this 
+	// will cause a failed allocation anywhere.
+	INFO_PRINTF1(_L("Skipping test on emulator..."));
+#else
+	WARN_PRINTF1(_L("---Stress test TO BE REVISITED due to Broadcom defect ESLM-85LDV7 - TB10.1 Closing of RSgImage with duplicate handle used in same thread does not release GPU RAM"));
+	TEST(EFalse);
+/*	__UHEAP_MARK;
+
+	const TInt KFontSize = 128;
+
+	CFbsFont* font;
+	TInt err = iTs->GetNearestFontToDesignHeightInPixels((CFont*&)font, TFontSpec(KMonoTypefaceName, KFontSize));
+	TESTNOERROR(err);
+	// Output the actual fontspec used in the test.
+	InfoPrintFontSpec(*font);
+	
+	// Create 2 buffers for use in comparing SgImages so that we don't run out 
+	// of system memory through allocating memory in the test
+	TInt maxFontWidth = font->MaxCharWidthInPixels();
+	TInt maxFontHeight = font->HeightInPixels();
+	iTempBuf1 = (TUint8*) User::AllocZ(maxFontWidth * maxFontHeight);
+	iTempBuf2 = (TUint8*) User::AllocZ(maxFontWidth * maxFontHeight);
+
+	// In order for the image comparisons to have enough memory to perform, keep 
+	// one large RSgImage which is created before the rest of the graphics memory 
+	// is filled.  This image can then be closed before doing the image comparison 
+	// and recreated after the image comparison to ensure that the graphics 
+	// memory is full.  Without this image, the image comparison could fail with 
+	// out of memory and the test would fail. 
+	RSgImage tempImage;
+	TESTNOERROR(tempImage.Create(TSgImageInfo(TSize(1000, 1000), ESgPixelFormatA_8, ESgUsageBitOpenVgImage)));
+
+	TFontSpec actualFontSpec;
+	actualFontSpec = font->FontSpecInTwips();
+	
+	// Create RSgImages from character data independently from using iterator.
+	// These will be used for comparing with RSgImages retrieved from iterator.
+	RArray <RSgImage> sgImageFromCharDataArray;
+	TInt index = 0;
+	for(; (index < KNumGlyphCodesLatin) && (err == KErrNone); ++index)
+		{
+		RSgImage characterDataSgImage;
+		TInt err = KErrNone;
+		const TUint8* bitmapData = NULL;
+		TSize bitmapSize;
+		TOpenFontCharMetrics metrics;
+		font->GetCharacterData(iGlyphCodesLatin[index] | KGlyphCodeFlag, metrics, bitmapData, bitmapSize);
+
+		if (bitmapSize != TSize(0, 0))
+			{
+			err = CreateSgImageFromCharacterData(bitmapData, bitmapSize, actualFontSpec.iFontStyle.BitmapType(), characterDataSgImage, iTempBuf1, iTempBuf2);
+			}
+		if (KErrNone == err)
+			{
+			err = sgImageFromCharDataArray.Append(characterDataSgImage);
+			}
+		}
+	TESTNOERROR(err);
+	TEST(index == KNumGlyphCodesLatin);
+
+	// Simulate low OOGM situation by creating many RSgImages until out of memory.
+	RArray <RSgImage> sgImageArray;
+	if (err == KErrNone)
+		{
+		TESTNOERROR(NearlyFillGraphicsMemoryWithImages(TSize(256, 256), sgImageArray));
+		}
+	
+	// Open Iterator on long string of data...
+	RFbsGlyphDataIterator iter;
+	TInt iterErr = KErrNone;
+	if (err == KErrNone)
+		{
+		iterErr = iter.Open(*font, iGlyphCodesLatin, KNumGlyphCodesLatin);
+		TESTNOERROR(iterErr);
+		}
+
+	// For each glyph, compare it to the system-memory version from GetCharacterData().
+	TInt numMismatches = 0;
+	for(index = 0; (iterErr == KErrNone) && (index < sgImageFromCharDataArray.Count()) && (err == KErrNone); iterErr = iter.Next(), ++index)
+		{
+		const TUint8* bitmapData = NULL;
+		TSize bitmapSize;
+		TOpenFontCharMetrics metrics;
+		font->GetCharacterData(iter.GlyphCode() | KGlyphCodeFlag, metrics, bitmapData, bitmapSize);
+
+		if (iter.Rect().Size() == TSize(0, 0))
+			{
+			numMismatches += (bitmapSize != TSize(0, 0)) ? 1 : 0;
+			}
+		else
+			{
+			// Free up memory so that the image compariso succeeds
+			// Release all the images used to simulate OOGM.
+			for (TInt i = sgImageArray.Count() - 1; i >= 0; --i)
+				{
+				sgImageArray[i].Close();
+				sgImageArray.Remove(i);
+				}
+			
+			TBool match = ETrue;
+			err = CompareSgImages(iEGL, sgImageFromCharDataArray[index], TRect(bitmapSize), iTempBuf1, iter.Image(), iter.Rect(), iTempBuf2, match);
+			if (err == KErrNone && !match)
+				{
+				++numMismatches;
+				}
+			TInt result = FillGraphicsMemoryWithImages(TSize(256, 256), sgImageArray);
+			TESTE(result == KErrNoMemory || result == KErrNoGraphicsMemory, result);
+			}
+		}
+	iter.Close();
+
+	// Release all images created from character data.
+	for (TInt i = sgImageFromCharDataArray.Count()-1; i >= 0; --i)
+		{
+		sgImageFromCharDataArray[i].Close();
+		}
+	sgImageFromCharDataArray.Close();
+
+	// Release all the images used to simulate OOGM.
+	for (TInt i = sgImageArray.Count() - 1; i >= 0; --i)
+		{
+		sgImageArray[i].Close();
+		}
+	sgImageArray.Close();
+	tempImage.Close();
+	iTs->ReleaseFont(font);
+	User::Free(iTempBuf1);
+	User::Free(iTempBuf2);
+	iTempBuf1 = NULL;
+	iTempBuf2 = NULL;
+
+	// Log any errors only after memory is freed - this ensures there is enough
+	// memory for the logger.
+	TESTNOERROR(err);
+	TESTE(iterErr == KErrNotFound, iterErr);
+	TEST(index == KNumGlyphCodesLatin);
+	TEST(numMismatches == 0);
+
+	__UHEAP_MARKEND;*/
+#endif
+	}
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0660
+@SYMTestPriority    Med
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	Opens an RFbsGlyphDataIterator on many different fonts of different sizes and typefaces
+	and uses many fonts, in order to test that the iterator can cope with being used on many
+	fonts with many glyphs.
+
+@SYMTestActions
+	i. Perform test of 100 iterations, where:
+		1. A new Latin font is created every iteration in order to force the Typeface Store
+			to create a brand-new server-side font at each iteration. 
+		2. For this font, open an RFbsGlyphDataIterator and cycle through all Latin glyphs.
+		3. For each glyph, compare against the glyph image returned by CFont::GetCharacterData().
+		4. Keep a record of the number of mismatches, and carry on to next font.
+	ii. Perform i. again, but using the existing fonts.
+	iii. Check that there are no mismatches, all glyphs and fonts were successfully checked, 
+		and no error codes returned during the test.
+	iv. Clean up all resources.
+	
+@SYMTestExpectedResults
+	The glyphs provided by the iterator should match that returned by GetCharacterData()
+	for every font and every iteration. 
+*/
+void CTFbsGlyphData::TestGlyphDataIteratorManyFontsStressL()
+	{
+	INFO_PRINTF1(_L("Stress test using a RFbsGlyphDataIterator with hundreds of fonts"));
+	WARN_PRINTF1(_L("---Stress test TO BE REVISITED due to Broadcom defect ESLM-85LDV7 - TB10.1 Closing of RSgImage with duplicate handle used in same thread does not release GPU RAM"));
+	TEST(EFalse);
+	/*__UHEAP_MARK;
+
+	const TInt KNumFonts = 100;
+	const TInt KNumRepeatsPerFont = 2;
+	TInt err = KErrNone;
+	TInt numGlyphMismatches = 0;
+
+	CFbsFont** font = new (ELeave) CFbsFont*[KNumFonts];
+	Mem::FillZ(font, sizeof(CFbsFont*) * KNumFonts);
+
+	// Do the whole thing KNumRepeatsPerFont times. The second+ repeats will 
+	// re-use the fonts created in the first repeat, to ensure that fonts that 
+	// may have been evicted are able to be re-used with the iterator.
+	for (TInt rep = 0; (rep < KNumRepeatsPerFont) && (err == KErrNone); ++rep)
+		{
+		// Iterate through all the font variants:
+		// Iterate all font styles, for all latin typefaces, at increasing sizes.
+		TInt i = 0;
+		for (; (i < KNumFonts) && (err == KErrNone); ++i)
+			{
+			// Only create this font if this font isn't already valid (i.e. when this is the 
+			// first rep) otherwise re-use it.
+			if (!font[i])
+				{
+				TFontSpec requestedFontSpec = GenerateDejaVuFontSpec(i);
+				err = iTs->GetNearestFontToDesignHeightInPixels((CFont*&)font[i], requestedFontSpec);
+				}
+			if (err == KErrNone)
+				{
+				RFbsGlyphDataIterator iter;
+				TInt iterErr = iter.Open(*(font[i]), iGlyphCodesLatin, KNumGlyphCodesLatin);
+				if (iterErr != KErrNone)
+					{
+					ERR_PRINTF2(_L("Failed to open RFbsGlyphDataIterator [err=%d]"), iterErr);
+					InfoPrintFontSpec(*(font[i]));
+					iStep->SetTestStepResult(EFail);
+					}
+				else
+					{
+					TInt index = 0;
+					for(; (iterErr == KErrNone) && (index < KNumGlyphCodesLatin) && (err == KErrNone) ; iterErr = iter.Next(), index++)
+						{
+						const TUint8* bitmapData = NULL;
+						TSize bitmapSize;
+						TOpenFontCharMetrics metrics;
+						font[i]->GetCharacterData(iter.GlyphCode() | KGlyphCodeFlag, metrics, bitmapData, bitmapSize);
+						if (iter.Rect().Size() == TSize(0, 0))
+							{
+							numGlyphMismatches += (bitmapSize != TSize(0, 0)) ? 1 : 0;
+							}
+						else
+							{
+							TBool match = EFalse;
+							const TFontSpec fontSpec = font[i]->FontSpecInTwips();							
+							// Compare to system-memory version of glyph
+							RSgImage characterDataImage;
+							err = CreateSgImageFromCharacterData(bitmapData, bitmapSize, fontSpec.iFontStyle.BitmapType(), characterDataImage);
+							if (err == KErrNone) 
+								{
+								err = CompareSgImages(iEGL, iter.Image(), iter.Rect(), characterDataImage, TRect(bitmapSize), match);
+								}
+							if (err == KErrNone && !match)
+								{
+								++numGlyphMismatches;
+								}
+							characterDataImage.Close();
+							}					
+						}
+					iter.Close();
+					TESTE(iterErr == KErrNotFound, iterErr);
+					TEST(index == KNumGlyphCodesLatin);					
+					}
+				}
+			}
+		// Check all the fonts were iterated through.
+		TEST(i == KNumFonts);
+		}
+	TESTNOERROR(err);
+	TEST(numGlyphMismatches == 0);
+
+	// Cleanup
+	for (TInt ii = 0; ii < KNumFonts; ii++)
+		{
+		iTs->ReleaseFont(font[ii]);
+		}
+	delete [] font;
+	__UHEAP_MARKEND;*/
+	}
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0662
+@SYMTestPriority    Low
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	Uses a RFbsGlyphDataIterator when there is no graphics memory available in the system.
+	It shows that when under low graphics memory, Next() returns the correct error code
+	as per the API (either KErrNoMemory or KErrNoGraphicsMemory, depending on the implementation 
+	of Graphics Resource being used).
+
+@SYMTestActions
+	i. Create a CFbsFont from the typeface store.
+	ii. Simulate a low graphics-memory situation by creating enough RSgImages to fill the memory,
+	iii. Open a RFbsGlyphDataIterator on the font.
+	iv. Attempt to use the iterator, calling Next(), checking the returned code.
+	v. Close the iterator and release all graphics memory from ii.
+
+@SYMTestExpectedResults
+	Next() should return either KErrNoMemory or KErrNoGraphicsMemory depending on the implmentation
+	of Graphics Resource used. It should return the same error as is returned when filling
+	the graphics memory reaches the limit.
+*/
+void CTFbsGlyphData::TestGlyphDataIteratorNoGraphicsMemory()
+	{
+	INFO_PRINTF1(_L("Test that when there is no GPU memory available, Next() returns correct error"));
+	WARN_PRINTF1(_L("---Stress test TO BE REVISITED due to Broadcom defect ESLM-85LDV7 - TB10.1 Closing of RSgImage with duplicate handle used in same thread does not release GPU RAM"));
+	TEST(EFalse);
+	/*__UHEAP_MARK;
+	
+	const TInt KFontSize = 128;
+	CFbsFont* font = NULL;
+	RFbsGlyphDataIterator iter;
+	
+	TInt err = iTs->GetNearestFontToDesignHeightInPixels((CFont*&)font, TFontSpec(KMonoTypefaceName, KFontSize));
+	TESTNOERROR(err);
+	
+	// Simulate low OOGM situation by creating many RSgImages until out of memory.
+	if (err == KErrNone)
+		{
+		InfoPrintFontSpec(*font);
+		RArray <RSgImage> sgImageArray;
+		TInt iterErr = KErrNone;
+		TInt gfxMemErr = FillGraphicsMemoryWithImages(TSize(KFontSize, KFontSize), sgImageArray);
+		TESTE(gfxMemErr == KErrNoMemory || gfxMemErr == KErrNoGraphicsMemory, gfxMemErr);
+		if (gfxMemErr == KErrNoMemory || gfxMemErr == KErrNoGraphicsMemory)
+			{
+			// Next() could either fail with KErrNoMemory or KErrNoGraphicsMemory, but should
+			// be the same error code as the last attempted creation of an SgImage, done in 
+			// FillGraphicsMemoryWithImages() so compare against that code.
+			iterErr = iter.Open(*font, iGlyphCodesLatin, KNumGlyphCodesLatin);
+			for (; iterErr == KErrNone; iterErr = iter.Next())
+				{
+				// no operation
+				}
+			iter.Close();
+			}
+	
+		// Release all the images used to simulate OOGM.
+		for (TInt i = sgImageArray.Count() - 1; i >= 0; --i)
+			{
+			sgImageArray[i].Close();
+			}
+		sgImageArray.Close();
+		
+		// Log any errors only after memory is freed - this ensures there is enough
+		// memory for the logger.
+		TESTE(iterErr == gfxMemErr, iterErr);
+		}
+
+	iTs->ReleaseFont(font);
+	
+	__UHEAP_MARKEND;*/
+	}
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0666
+@SYMTestPriority    Low
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	Uses a RFbsGlyphDataIterator after Next() returns an error, in order to show that 
+	an error does not invalidate the state of the iterator and it is still usable. 
+
+@SYMTestActions
+	i. Open the RFbsGlyphDataIterator on 1 glyph code.
+	ii. Store the data of the iterator and call Next() to reach the end of the iterator
+	iii. Access the glyph data repeatedly and check that the iterator members
+		 still match those in ii.
+
+@SYMTestExpectedResults
+	The calls to Next() should cause KErrNotFound since it is past the final glyph.
+	The iterator data should match at all times since the iterator is never moved.
+*/
+void CTFbsGlyphData::TestGlyphDataIteratorNextIsAtomic()
+	{
+	INFO_PRINTF1(_L("To ensure that Next() is atomic, if it returns an error it is still useable"));
+	__UHEAP_MARK;
+
+	RFbsGlyphDataIterator iter;
+	TInt iterErr = iter.Open(*iFont, iGlyphCodesLatin, 1);
+	TESTNOERROR(iterErr);
+	
+	TSgDrawableId id = iter.Image().Id();
+	TOpenFontCharMetrics metrics = iter.Metrics();
+	TUint glyphCode = iter.GlyphCode();
+	TRect rect = iter.Rect();
+	
+	for (TInt i = 0; i < 2; i++)
+		{
+		iterErr = iter.Next();
+		TESTE(iterErr == KErrNotFound, iterErr);
+		
+		TEST(id == iter.Image().Id());
+		TEST(glyphCode == iter.GlyphCode());
+		TEST(rect == iter.Rect());
+		TEST(CompareMetrics(metrics, iter.Metrics()) == 0);
+		}
+	iter.Close();
+		
+	__UHEAP_MARKEND;
+	}
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0665
+@SYMTestPriority    High
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	Glyph Atlas white-box test.
+	To ensure that the same RSgImage is used for repeated requests for the 
+	same glyph in the same call to RFbsGlyphDataIterator:Open().
+@SYMTestActions
+	i Open the glyph data iterator with a list of glyph codes which are all the same
+	ii Retrieve the drawable id of each iteration 
+	iii Check that the same drawable id is retrieved in each iteration  
+@SYMTestExpectedResults
+	Each iteration returns the same drawable id. 
+*/
+void CTFbsGlyphData::TestGlyphDataIteratorSameGlyphCodes()
+	{
+	INFO_PRINTF1(_L("White box test - Ensure that the same RSgImage is used for repeated requests for the same glyph in the same call to Open()"));
+	__UHEAP_MARK;
+
+	const TUint KSameRepeatedGlyphCode = DejaVuASCIIToGlyphCode[0x004B]; // 'K'
+	const TInt KNumGlyphs = 10;
+	TUint* sameRepeatedGlyphCodes = new TUint[KNumGlyphs];
+	for (TInt ii = 0; ii < KNumGlyphs; ++ii)
+		{
+		sameRepeatedGlyphCodes[ii] = KSameRepeatedGlyphCode;
+		}
+	RFbsGlyphDataIterator iter;
+	TInt err = iter.Open(*iFont, sameRepeatedGlyphCodes, KNumGlyphs);
+	
+	TESTNOERROR(err);
+	if (KErrNone == err)
+		{
+		// get the drawable id of the first glyph and check that the id is valid
+		TSgDrawableId referenceId = iter.Image().Id();
+		RSgImage image;
+		TESTNOERROR(image.Open(referenceId));
+		image.Close();
+		TESTNOERROR(iter.Next());
+
+		for (;KErrNone == err; err = iter.Next())
+			{
+			TEST(referenceId == iter.Image().Id());
+			}
+		TESTE(KErrNotFound == err, err);
+		}
+
+	iter.Close();
+	delete[] sameRepeatedGlyphCodes;
+
+	__UHEAP_MARKEND;
+	}
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0668
+@SYMTestPriority    High
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	To ensure that the iterator can successfully be opened on an array
+	of glyph codes of various array sizes. 
+@SYMTestActions
+	Perform many iterations of opening an array and cycling through the glyphs,
+	increasing the size of the array after each iteration. Some simple sanity-checking
+	of the glyphs is performed.
+@SYMTestExpectedResults
+	KErrNone should be returned at all times. 
+*/
+void CTFbsGlyphData::TestGlyphDataIteratorManyArraySizes()
+	{
+	INFO_PRINTF1(_L("Ensure that the RFbsGlyphDataIterator successfully opens glyph code arrays of many sizes"));
+	__UHEAP_MARK;
+	
+	RFbsGlyphMetricsArray glyphMetricsArray;
+	
+	TESTNOERROR(glyphMetricsArray.Get(*iFont, iGlyphCodesLatin, KNumGlyphCodesLatin));
+	TInt iterErr = KErrNone;
+	
+	for (TInt arraySize = 1; (arraySize < KNumGlyphCodesLatin) && (iterErr == KErrNone); ++arraySize)
+		{
+		RFbsGlyphDataIterator iter;
+		TInt iterErr = iter.Open(*iFont, iGlyphCodesLatin, arraySize);
+		TESTNOERROR(iterErr);
+		
+		for (TInt index = 0; iterErr == KErrNone; iterErr = iter.Next(), ++index)
+			{
+			// sanity checking...
+			if (iter.GlyphCode() != iGlyphCodesLatin[index])
+				{
+				ERR_PRINTF4(_L("Test failed at array size %d - Wanted glyphcode %d, got %d"), arraySize, iGlyphCodesLatin[index], iter.GlyphCode());
+				iStep->SetTestStepResult(EFail);
+				}
+			if (CompareMetrics(iter.Metrics(), glyphMetricsArray[index]) != 0)
+				{
+				ERR_PRINTF3(_L("Test failed at array size %d, metrics check failed at glyphcode %d"), arraySize, iGlyphCodesLatin[index]);
+				iStep->SetTestStepResult(EFail);
+				}			
+			}
+		iter.Close();
+		}
+
+	glyphMetricsArray.Close();
+	TESTNOERROR(iterErr);
+
+	__UHEAP_MARKEND;
+	}
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0669
+@SYMTestPriority    Low
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	Negative test case to show that RFbsGlyphDataIterator and RFbsGlyphMetricsArray
+	do not support bitmap fonts.
+@SYMTestActions
+	i. Load a bitmap font.
+	ii. Attempt to open an RFbsGlyphDataIterator and RFbsGlyphMetricsArray with the font.
+@SYMTestExpectedResults
+	KErrNotSupported should be returned in both instances. 
+*/
+ void CTFbsGlyphData::TestBitmapFontSupport()
+	{
+	INFO_PRINTF1(_L("Test bitmap font not supported"));
+	__UHEAP_MARK;
+	
+	CFbsFont* bitmapFont = NULL;
+	TInt err = iTs->GetNearestFontToDesignHeightInPixels((CFont*&)bitmapFont, TFontSpec(_L("Digital"), 14));
+	TESTNOERROR(err);
+	TEST(!bitmapFont->IsOpenFont());
+	
+	RFbsGlyphDataIterator iter;
+	err = iter.Open(*bitmapFont, iGlyphCodesLatin, KNumGlyphCodesLatin);
+	TEST(err == KErrNotSupported);
+	iter.Close();
+	
+	RFbsGlyphMetricsArray array;
+	err = array.Get(*bitmapFont, iGlyphCodesLatin, KNumGlyphCodesLatin);
+	TEST(err == KErrNotSupported);
+	array.Close();
+	
+	iTs->ReleaseFont(bitmapFont);
+	__UHEAP_MARKEND;
+	}
+ 
+/**
+@SYMTestCaseID		GRAPHICS-FBSERV-0671
+@SYMTestPriority	High
+@SYMTestType		UT
+@SYMTestStatus		Implemented
+@SYMPREQ			PREQ2678
+
+@SYMTestCaseDesc
+	Shows that different threads (and therefore RFbsSessions) using fonts with the same
+	TFontSpec share the same glyphs	in the atlas and do not create duplicate entries
+	in the Glyph Atlas, and that releasing a font clears all associated glyphs in the
+	atlas.
+
+@SYMTestActions
+	i. Create a handle to a test font in the current process.
+	ii. Spawn a test thread and wait for it to complete. Within the thread :
+		1. Create a font with the same fontspec as the parent process.
+		2. Use the RFbsGlyphDataIterator API to force rasterization into the glyph atlas.
+		3. Release the iterator.
+	iii. Check there were no leaves from the thread.
+	iv. Repeat ii. and iii. several times. Before using RFbsGlyphDataIterator,
+		the thread checks that the glyphs are still in the atlas from the first thread.
+	v. Check that the number of fonts in the atlas has increased by one only.
+	vi. Check that the number of glyphs in the atlas has increased by the size of the 
+		glyph code array.
+	vii. Release the font in the parent process, thereby releasing the font and glyphs
+		in the glyph atlas, and check that the state of the atlas is the same as before
+		the test is run.
+
+@SYMTestExpectedResults
+	All threads should return no errors or leaves or panics.
+	After all threads have finished:
+		The glyph count should have increased by the size of the glyph code array used
+		in the RFbsGlyphDataIterator, showing that	glyphs are only being added to the atlas
+		once. The number of fonts in the atlas should have increased by one, showing
+		that only the single underlying font object is being added to the atlas, despite
+		different RFbsSessions and CFbsFont instances used.
+	After the test font is released in the main process:
+		The glyph count and font count return to the pre-test value, showing that when
+		the last handle to a TFontSpec is released, the atlas frees its associated data.
+*/
+void CTFbsGlyphData::TestMultithreadShareSingleFont()
+	{
+	INFO_PRINTF1(_L("Test glyphs shared between RFbsSessions/threads/processes"));
+#ifndef _DEBUG
+	// Test relies on debug-only FBS messages EFbsMessAtlasGlyphCount and EFbsMessAtlasFontCount
+	INFO_PRINTF1(_L("Skipping test in release mode"));
+#else	
+	__UHEAP_MARK;
+
+	_LIT(KThreadName, "GlyphDataTestThread");
+	const TInt KNumTestThreads = 5;
+	const TFontSpec KTestFontSpec(KTypefaceName, 50);	
+	const TInt atlasFontCountStart = iFbs->SendCommand(EFbsMessAtlasFontCount);
+	const TInt atlasGlyphCountStart = iFbs->SendCommand(EFbsMessAtlasGlyphCount);
+
+	CFbsFont* testFont;
+	TInt err = iTs->GetNearestFontToDesignHeightInPixels( (CFont*&)testFont, KTestFontSpec);
+	if (err != KErrNone)
+		{
+		ERR_PRINTF2(_L("Could not load font, err = %d"), err);
+		iStep->SetTestStepResult(EFail);
+		return;
+		}
+	
+	// Check there are no glyphs belonging to the test font before the test starts.
+	TInt atlasFontGlyphCount = iFbs->SendCommand(EFbsMessAtlasGlyphCount, testFont->Handle());
+	TEST(atlasFontGlyphCount == 0);
+
+	TGlyphDataMultithreadParams params = {KTestFontSpec, iGlyphCodesLatin, KNumGlyphCodesLatin, NULL};
+
+	// Run the test threads sequentially, and check its exit status.
+	RThread testThread;
+	TInt numThreadsPassed = 0;
+	for (TInt i = 0; i < KNumTestThreads; i++)
+		{
+		TBool threadPassed = ETrue;
+		TGlyphDataThreadInfo info = {EGlyphDataMultiSessionTestShareGlyphs, params, i, iStep};
+		err = testThread.Create(KThreadName, CTFbsGlyphData::ThreadFunction, KDefaultStackSize, KTestThreadMinHeapSize, KTestThreadMaxHeapSize, &info);
+		TESTNOERROR(err);
+
+		TRequestStatus statusThread;
+		testThread.Logon(statusThread);
+		testThread.Resume();
+		
+		User::WaitForRequest(statusThread);
+		TInt threadResult = testThread.ExitReason();
+		if (threadResult != KErrNone)
+			{
+			ERR_PRINTF3(_L("Thread %i: Terminated with reason %d"), i, threadResult);
+			threadPassed = EFalse; 
+			}
+		TExitCategoryName exitCategory = testThread.ExitCategory();
+		if (exitCategory.Compare(_L("Kill")) != 0)
+			{
+			ERR_PRINTF3(_L("Thread %i: Terminated with reason category '%S'"), i, &exitCategory);
+			threadPassed = EFalse;
+			}
+		testThread.Close();
+		numThreadsPassed += (threadPassed) ? 1 : 0;
+		}
+	TEST(numThreadsPassed == KNumTestThreads);
+
+	// Check that the atlas still contains the glyphs and the font created by the threads
+	// after they have died, since the font is still open in this process.
+	atlasFontGlyphCount = iFbs->SendCommand(EFbsMessAtlasGlyphCount, testFont->Handle());
+	TEST(atlasFontGlyphCount == params.iGlyphCodesCount);
+	TInt atlasFontCount = iFbs->SendCommand(EFbsMessAtlasFontCount);
+	TEST(atlasFontCount == (atlasFontCountStart + 1));
+
+	iTs->ReleaseFont(testFont);
+	testFont = NULL;
+
+	// Check the atlas state is now the same as it was before the test started,
+	// now that the last remaining handle to the font used in the threads is released.
+	TInt atlasGlyphCountEnd = iFbs->SendCommand(EFbsMessAtlasGlyphCount);
+	TEST(atlasGlyphCountStart == atlasGlyphCountEnd);
+	TInt atlasFontCountEnd = iFbs->SendCommand(EFbsMessAtlasFontCount);
+	TEST(atlasFontCountStart == atlasFontCountEnd);
+	__UHEAP_MARKEND;
+#endif
+	}
+
+/**
+Worker thread for TestMultithreadShareSingleFont().
+The thread uses RFbsGlyphDataIterator on a CFbsFont of the given TFontSpec.
+Once complete the atlas is queried for the number of associated glyphs.
+ */
+void CTFbsGlyphData::ThreadShareGlyphsL(TInt aThreadNum, TGlyphDataMultithreadParams& aParam, CTestStep* aStep)
+	{
+	User::LeaveIfError(RFbsSession::Connect());
+	CFbsTypefaceStore* ts = CFbsTypefaceStore::NewL(NULL);
+	CleanupStack::PushL(ts);
+	RFbsSession* fbs = RFbsSession::GetSession();
+
+	CFbsFont* font;
+	TInt err = ts->GetNearestFontToDesignHeightInPixels((CFont*&)font, aParam.iFontSpec);
+	User::LeaveIfError(err);
+
+	if (aThreadNum > 0)
+		{
+		// If this is not the first thread, it means the first thread has already executed and 
+		// populated the glyph atlas with the glyphs. The font created by this thread 
+		// should already have its glyphs in the atlas.
+		TInt fontGlyphCount = fbs->SendCommand(EFbsMessAtlasGlyphCount, font->Handle());
+		if (fontGlyphCount != aParam.iGlyphCodesCount)
+			{
+			aStep->ERR_PRINTF4(_L("Thread %d: Only %d glyphs in atlas before first iteration, expected %d"), aThreadNum, fontGlyphCount, aParam.iGlyphCodesCount);
+			aStep->SetTestStepResult(EFail);
+			}
+		}
+
+	RFbsGlyphDataIterator iter;
+	for (err = iter.Open(*font, aParam.iGlyphCodes, aParam.iGlyphCodesCount); err == KErrNone; err = iter.Next())
+		{
+		// no-op
+		}
+	iter.Close();
+
+	// Check that the glyphs of this font have been added to the atlas
+	TInt fontGlyphCount = fbs->SendCommand(EFbsMessAtlasGlyphCount, font->Handle());
+	if (fontGlyphCount != aParam.iGlyphCodesCount)
+		{
+		aStep->ERR_PRINTF5(_L("Thread %d: Only %d glyphs in atlas after last iteration, expected %d (err=%d)"), aThreadNum, fontGlyphCount, aParam.iGlyphCodesCount, err);
+		aStep->SetTestStepResult(EFail);
+		}
+	if (err != KErrNotFound)
+		{
+		aStep->ERR_PRINTF3(_L("Thread %d: Error during test = %d"), aThreadNum, err);
+		aStep->SetTestStepResult(EFail);
+		}
+
+	ts->ReleaseFont(font);
+	CleanupStack::PopAndDestroy(1); // ts
+	RFbsSession::Disconnect();
+	}
+
+
+/**
+@SYMTestCaseID		GRAPHICS-FBSERV-0672
+@SYMTestPriority	Medium
+@SYMTestType		UT
+@SYMTestStatus		Implemented
+@SYMPREQ			PREQ2678
+
+@SYMTestCaseDesc
+	Tests that with many concurrent sessions connected to Fbserv, the atlas successfully
+	returns the correct glyph images even if the atlas becomes full and has to evict glyphs.
+
+@SYMTestActions
+	i. Create 25 threads, each a unique session with Fbserv.
+	ii. Launch the threads simultaneously. In each thread:
+		1. Create a FBS typeface store and create a font which is unique in the process.
+		2. Use RFbsGlyphDataIterator to iterate through the latin glyph codes.
+		3. Check the image is correct for each glyph against the image returned by 
+			CFont::GetCharacterData().
+		4. Close the iterator.
+		5. Release the font and close the typeface store. 
+	iii. Once all threads have finished, check the exit status of each thread
+
+@SYMTestExpectedResults
+	Every glyph for every thread should match the image returned by GetCharacterData()
+	All threads should exit normally with no Leave code.
+*/
+_LIT(KTestMultithreadStressFinishSemaphore, "TestMultithreadStressAtlasFinish");
+
+void CTFbsGlyphData::TestMultithreadStressAtlas()
+	{
+	INFO_PRINTF1(_L("Stress test glyph atlas with multiple RFbsSessions"));
+	WARN_PRINTF1(_L("---Stress test TO BE REVISITED due to Broadcom defect ESLM-85NEFT - TB10.1 eglCreateImageKHR hangs during multithreading"));
+	TEST(EFalse);
+	/*__UHEAP_MARK;
+
+	TInt err = KErrNone;
+	const TInt KNumTestThreads = 25;
+	_LIT(KThreadNameFormat, "GlyphDataTestThread%i");
+
+	// Create a semaphore that is signalled by each test thread when it has finished.
+	RSemaphore threadFinishSemaphore;
+	err = threadFinishSemaphore.CreateGlobal(KTestMultithreadStressFinishSemaphore, 0, EOwnerThread);
+	TESTNOERROR(err);
+
+	// Prepare the testdata for the threads
+	// Each thread will have a TFontSpec which will cause unique CFbsFonts
+	// to be created in the server, and therefore the atlas.
+	RThread testThread[KNumTestThreads];
+	TGlyphDataThreadInfo testInfo[KNumTestThreads];	
+	for (TInt i = 0; i < KNumTestThreads; ++i)
+		{
+		testInfo[i].iStep = iStep;
+		testInfo[i].iTest = EGlyphDataMultiSessionTestStressAtlas;
+		testInfo[i].iParams.iFontSpec = GenerateDejaVuFontSpec(i);
+		testInfo[i].iParams.iGlyphCodes = iGlyphCodesLatin;
+		testInfo[i].iParams.iGlyphCodesCount = KNumGlyphCodesLatin;
+		testInfo[i].iParams.iEGL = iEGL;
+		testInfo[i].iThreadNum = i;	
+		TBuf<128> threadName;
+		threadName.AppendFormat(KThreadNameFormat, i);
+		err = testThread[i].Create(threadName, CTFbsGlyphData::ThreadFunction, KDefaultStackSize, KTestThreadMinHeapSize, KTestThreadMaxHeapSize, &testInfo[i]);
+		TESTNOERROR(err);
+		}
+
+	// All threads are created, start them simultaneously.
+	for (TInt i = 0; i < KNumTestThreads; ++i)
+		{
+		testThread[i].Resume();
+		}
+	// Wait for all threads to finish.
+	for (TInt i = 0; i < KNumTestThreads; ++i)
+		{
+		threadFinishSemaphore.Wait();
+		}
+	// Allow some time for remaining threads to finish tidy-up.
+	User::After(100000);
+	threadFinishSemaphore.Close();
+
+	TInt numThreadsPassed = 0;
+	for (TInt i = 0; i < KNumTestThreads; ++i)
+		{
+		TBool threadPassed = ETrue;
+		TInt threadResult = testThread[i].ExitReason();
+		if (threadResult != KErrNone)
+			{
+			ERR_PRINTF3(_L("Thread %i: Terminated with reason %d"), i, threadResult);
+			threadPassed = EFalse; 
+			}
+		TExitCategoryName exitCategory = testThread[i].ExitCategory();
+		if (exitCategory.Compare(_L("Kill")) != 0)
+			{
+			ERR_PRINTF3(_L("Thread %i: Terminated with reason category '%S'"), i, &exitCategory);
+			threadPassed = EFalse;
+			}
+		testThread[i].Close();
+		numThreadsPassed += (threadPassed) ? 1 : 0;
+		}
+	TEST(numThreadsPassed == KNumTestThreads);
+
+	__UHEAP_MARKEND;*/
+	}
+/**
+Worker thread for TestMultithreadStressAtlas().
+The thread uses RFbsGlyphDataIterator on a CFbsFont of the given TFontSpec.
+For each glyph, the image returned by the iterator is compared to the image 
+returned from CFont::GetCharacterData().
+Once complete, the semaphore is signalled to tell the parent process it has
+finished.
+ */
+void CleanupFinishSemaphore(TAny* aItem)
+    {
+    RSemaphore* semaphore = reinterpret_cast<RSemaphore*>(aItem);
+    semaphore->Signal();
+    semaphore->Close();
+    }
+void CTFbsGlyphData::ThreadStressAtlasL(TInt aThreadNum, TGlyphDataMultithreadParams& aParam, CTestStep* aStep)
+	{
+	TOpenFontCharMetrics charMetrics;
+	const TUint8* bitmapData;
+	TSize bitmapSize;
+	RSgImage charDataImage;
+
+	RSemaphore threadFinishSemaphore;
+	User::LeaveIfError(threadFinishSemaphore.OpenGlobal(KTestMultithreadStressFinishSemaphore));
+	CleanupStack::PushL(TCleanupItem(CleanupFinishSemaphore, &threadFinishSemaphore));
+
+	User::LeaveIfError(RFbsSession::Connect());
+	CFbsTypefaceStore* ts = CFbsTypefaceStore::NewL(NULL);
+	CleanupStack::PushL(ts);
+	
+	CFbsFont* font;
+	User::LeaveIfError(ts->GetNearestFontToDesignHeightInPixels((CFont*&)font, aParam.iFontSpec));
+
+	TInt numGlyphMatches = 0;
+	TInt index = 0;
+	TInt err = KErrNone;
+	RFbsGlyphDataIterator iter;
+	for (err = iter.Open(*font, aParam.iGlyphCodes, aParam.iGlyphCodesCount); err == KErrNone; err = iter.Next(), ++index)
+		{
+		TBool glyphMatch = EFalse;
+		font->GetCharacterData(aParam.iGlyphCodes[index] | KGlyphCodeFlag, charMetrics, bitmapData, bitmapSize);
+		if (bitmapSize == TSize(0, 0))
+			{
+			glyphMatch = (bitmapSize == iter.Rect().Size());
+			}
+		else
+			{
+			err = CreateSgImageFromCharacterData(bitmapData, bitmapSize, font->FontSpecInTwips().iFontStyle.BitmapType(), charDataImage);
+			if (err == KErrNone)
+				{
+				err = CompareSgImages(aParam.iEGL, iter.Image(), iter.Rect(), charDataImage, TRect(bitmapSize), glyphMatch);
+				}
+			charDataImage.Close();
+			}
+		if (err != KErrNone)
+			{
+			break;
+			}
+		numGlyphMatches += (glyphMatch) ? 1 : 0;
+		}
+	iter.Close();
+	
+	if (index != aParam.iGlyphCodesCount)
+		{
+		aStep->ERR_PRINTF5(_L("Thread %d: Iterator terminated early - %d out of %d glyphs (err=%d)"), aThreadNum, index, aParam.iGlyphCodesCount, err);
+		aStep->SetTestStepResult(EFail);
+		}
+	if (index != numGlyphMatches)
+		{
+		aStep->ERR_PRINTF4(_L("Thread %d: Matched %d out of %d glyphs"), aThreadNum, numGlyphMatches, aParam.iGlyphCodesCount);
+		aStep->SetTestStepResult(EFail);
+		}
+
+	ts->ReleaseFont(font);
+	CleanupStack::PopAndDestroy(2); // ts, threadFinishSemaphore
+	RFbsSession::Disconnect();
+	}
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0673
+@SYMTestPriority    Medium
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+    Tests the robustness of using RFbsGlyphMetricsArray when the client heap and the
+    FbServ private heap experience failures allocating memory, causing no panics 
+    or leaves.
+
+@SYMTestActions
+    i. Set the default heap failure for the next heap allocation.
+    ii. Create a new CFbsFont using a TFontSpec not already in the glyph atlas.
+    iii. Call RFbsGlyphMetricsArray::Get(), and close the array.
+    iv. Release the font so that nothing is left in the cache as a result of
+        attempting to use it, and reset the heap failure state.
+    v. While iii returns KErrNoMemory, increment the failure count and repeat
+        step ii.
+    vi. Using a separate font so that the test is not affected by the earlier
+        run, repeat ii. to v., but rather than setting the default heap to 
+        fail, the FbServ private heap is set to fail, via IPC messages to Fbs.
+
+@SYMTestExpectedResults
+    If no errors occur, KErrNone should be returned after a certain number of
+    repetitions. Any other error code denotes a problem handling low-memory 
+    situtations.
+*/
+void CTFbsGlyphData::TestGlyphMetricsArrayHeapOOML()
+    {
+    INFO_PRINTF1(_L("Test RFbsGlyphMetricsArray during heap alloc failure"));
+    __UHEAP_MARK;
+
+    // Create a font that wont be in the cache already...
+    TInt rep = 0;
+    TInt err = KErrNoMemory;
+    CFbsFont* font = NULL;
+    
+    while (err == KErrNoMemory)
+        {
+        User::LeaveIfError(iTs->GetNearestFontInPixels((CFont*&)font, GenerateDejaVuFontSpec(10)));
+        __UHEAP_FAILNEXT(rep);
+        RFbsGlyphMetricsArray array;
+        err = array.Get(*font, iGlyphCodesLatin, KNumGlyphCodesLatin);
+        array.Close();
+        __UHEAP_RESET;
+        iTs->ReleaseFont(font);
+        font = NULL;
+        ++rep;
+        }
+
+	TESTE(err == KErrNone, err);
+    if (err == KErrNone)
+        {
+        INFO_PRINTF2(_L("Client Heap OOM : Test passed after rep %d"), rep);
+        }
+    else
+        {
+        ERR_PRINTF3(_L("Client Heap OOM : Test failed with err=%d, after rep %d"), err, rep);
+        }
+
+    // Now test when the server-side FbServ heap fails...
+    rep = 0;
+    err = KErrNoMemory;
+    
+    while (err == KErrNoMemory)
+        {
+        User::LeaveIfError(iTs->GetNearestFontInPixels((CFont*&)font, GenerateDejaVuFontSpec(11)));
+        iFbs->SendCommand(EFbsMessSetHeapFail, RFbsSession::EHeapFailTypeServerMemory, rep);
+        RFbsGlyphMetricsArray array;
+        err = array.Get(*font, iGlyphCodesLatin, KNumGlyphCodesLatin);
+        array.Close();
+        iFbs->SendCommand(EFbsMessSetHeapReset, RFbsSession::EHeapFailTypeServerMemory);
+        iTs->ReleaseFont(font);
+        font = NULL;
+        ++rep;
+        }
+
+	TESTE(err == KErrNone, err);
+    if (err == KErrNone)
+        {
+        INFO_PRINTF2(_L("FBServ Heap OOM : Test passed after rep %d"), rep);
+        }
+    else
+        {
+        ERR_PRINTF3(_L("FBServ Heap OOM : Test failed with err=%d, after rep %d"), err, rep);      
+        }
+    __UHEAP_MARKEND;
+    }
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0674
+@SYMTestPriority    Medium
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+    Tests the robustness of using RFbsGlyphDataIterator when the client heap and the
+    FbServ private heap experience failures allocating memory, causing no panics 
+    or leaves.
+
+@SYMTestActions
+    i. Set the default heap failure for the next heap allocation.
+    ii. Create a new CFbsFont using a TFontSpec not already in the glyph atlas.
+    iii. Call RFbsGlyphDataIterator::Open(), and close the array.
+    iv. Release the font so that nothing is left in the cache as a result of
+        attempting to use it, and reset the heap failure state.
+    v. While iii returns KErrNoMemory, increment the failure count and repeat
+        step ii.
+    vi. Using a separate font so that the test is not affected by the earlier
+        run, repeat ii. to v., but rather than setting the default heap to 
+        fail, the FbServ private heap is set to fail, via IPC messages to Fbs.
+
+@SYMTestExpectedResults
+    If no errors occur, KErrNone should be returned after a certain number of
+    repetitions. Any other error code denotes a problem handling low-memory 
+    situtations.
+*/
+void CTFbsGlyphData::TestGlyphDataIteratorHeapOOML()
+    {
+    INFO_PRINTF1(_L("Test RFbsGlyphDataIterator during heap alloc failure"));    
+    __UHEAP_MARK;
+
+    // Create a font that wont be in the cache already...
+    TInt rep = 0;
+    TInt err = KErrNoMemory;
+    CFbsFont* font = NULL;
+    
+    while (err == KErrNoMemory)
+        {
+        User::LeaveIfError(iTs->GetNearestFontInPixels((CFont*&)font, GenerateDejaVuFontSpec(10)));
+        __UHEAP_FAILNEXT(rep);
+        RFbsGlyphDataIterator iter;
+        err = iter.Open(*font, iGlyphCodesLatin, KNumGlyphCodesLatin);
+        if (err == KErrNone)
+            {
+            while (err == KErrNone) 
+               {
+               err = iter.Next();
+               }
+            err = (err == KErrNotFound) ? KErrNone : err;
+            }
+        iter.Close();
+        __UHEAP_RESET;
+        iTs->ReleaseFont(font);
+        font = NULL;
+        ++rep;
+        }
+
+	TESTE(err == KErrNone, err);
+    if (err == KErrNone)
+        {
+        INFO_PRINTF2(_L("Client Heap OOM : Test passed after rep %d"), rep);
+        }
+    else
+        {
+        ERR_PRINTF3(_L("Client Heap OOM : Test failed with err=%d, after rep %d"), err, rep);
+        }
+
+    // Now test when the server-side FbServ heap fails...
+    rep = 0;
+    err = KErrNoMemory;
+    
+    while (err == KErrNoMemory)
+        {
+        User::LeaveIfError(iTs->GetNearestFontInPixels((CFont*&)font, GenerateDejaVuFontSpec(11)));
+        iFbs->SendCommand(EFbsMessSetHeapFail, RFbsSession::EHeapFailTypeServerMemory, rep);
+        RFbsGlyphDataIterator iter;
+        err = iter.Open(*font, iGlyphCodesLatin, KNumGlyphCodesLatin);
+        if (err == KErrNone)
+            {
+            while (err == KErrNone) 
+               {
+               err = iter.Next();
+               }
+            err = (err == KErrNotFound) ? KErrNone : err;
+            }
+        iter.Close();
+        iFbs->SendCommand(EFbsMessSetHeapReset, RFbsSession::EHeapFailTypeServerMemory);
+        iTs->ReleaseFont(font);
+        font = NULL;
+        ++rep;
+        }
+
+	TESTE(err == KErrNone, err);
+    if (err == KErrNone)
+        {
+        INFO_PRINTF2(_L("FBServ Heap OOM : Test passed after rep %d"), rep);
+        }
+    else
+        {
+        ERR_PRINTF3(_L("FBServ Heap OOM : Test failed with err=%d, after rep %d"), err, rep);
+        }
+    __UHEAP_MARKEND;
+    }
+
+/**
+Utility function. Prints out a description of the font's fontspec to the log.
+ */
+void CTFbsGlyphData::InfoPrintFontSpec(const CFont& aFont)
+	{
+	_LIT(KMonochromeBitmap, "Mono");
+	_LIT(KAntiAliasedBitmap, "AA");
+	_LIT(KStyleItalic, "Italic");
+	_LIT(KStyleBold, "Bold");
+	_LIT(KStyleNormal, "Normal");
+	_LIT(KUnknown, "Unknown");
+	TBufC<9> bitmapType;
+	TBuf<12> fontStyle;
+	TFontSpec fontSpec = aFont.FontSpecInTwips();
+	switch(fontSpec.iFontStyle.BitmapType())
+		{
+		case EMonochromeGlyphBitmap:
+			bitmapType = KMonochromeBitmap;
+			break;
+		case EAntiAliasedGlyphBitmap:
+			bitmapType = KAntiAliasedBitmap;
+			break;
+		default:
+			bitmapType = KUnknown;
+		}
+
+	if (fontSpec.iFontStyle.StrokeWeight() == EStrokeWeightBold)
+		{
+		fontStyle.Append(KStyleBold);
+		}
+	if (fontSpec.iFontStyle.Posture() == EPostureItalic)
+		{
+		fontStyle.Append(KStyleItalic);
+		}
+	if (fontStyle.Length() == 0)
+		{
+		fontStyle = KStyleNormal;
+		}
+
+	INFO_PRINTF5(_L("Font: name=%S size=%dtw type=%S style=%S"), &(fontSpec.iTypeface.iName), fontSpec.iHeight, &bitmapType, &fontStyle);
+	}
+
+
+/**
+Static utility function. Performs a per-pixel comparison of two open RSgImages.
+To do this requires access to the binary data of the images, only accessable
+via EGL and Khronos APIs. This function will bind the RSgImages to VGImages 
+and uses OpenVG to retrieve the image data in 8bpp.
+@param aEGL An EGL Helper to read the SgImages into system memory.
+@param aImageA The first image to compare.
+@param aRectA A rectangular portion in pixels of the first image to compare.
+@param aImageB The second image to compare.
+@param aRectB A rectangular portion in pixels fo the second image to compare.
+@param aMatch A boolean value, which on return tells the caller whether the two
+	images were deemed to match.
+@return KErrNone, if the comparison took place, otherwise one of the system-wide
+	error codes.
+*/
+TInt CTFbsGlyphData::CompareSgImages(CEGLHelper* aEGL, const RSgImage& aImageA, const TRect& aRectA, const RSgImage& aImageB, const TRect& aRectB, TBool& aMatch)
+	{
+	return CTFbsGlyphData::CompareSgImages(aEGL, aImageA, aRectA, NULL, aImageB, aRectB, NULL, aMatch);
+	}
+
+/**
+Static utility function. Performs a per-pixel comparison of two open RSgImages.
+To do this requires access to the binary data of the images, only accessable
+via EGL and Khronos APIs. This function will bind the RSgImages to VGImages 
+and uses OpenVG to retrieve the image data in 8bpp.
+This version allows pre-created memory to be used in the comparison, to avoid
+allocation failure in low memory testing.
+@param aEGL An EGL Helper to read the SgImages into system memory buffers.
+@param aImageA The first image to compare.
+@param aRectA A rectangular portion in pixels of the first image to compare.
+@param aBufferA If non-NULL, specifies a memory buffer to read the data of
+	aImageA into, otherwise a buffer is dynamically allocated.
+@param aImageB The second image to compare.
+@param aRectB A rectangular portion in pixels fo the second image to compare.
+@param aBufferB If non-NULL, specifies a memory buffer to read the data of
+	aImageB into, otherwise a buffer is dynamically allocated.
+@param aMatch A boolean value, which on return tells the caller whether the two
+	images were deemed to match.
+@return KErrNone, if the comparison took place, otherwise one of the system-wide
+	error codes.
+*/
+TInt CTFbsGlyphData::CompareSgImages(CEGLHelper* aEGL, const RSgImage& aImageA, const TRect& aRectA, TUint8* aBufferA, const RSgImage& aImageB, const TRect& aRectB, TUint8* aBufferB, TBool& aMatch)
+	{
+	// By default, assume they do not match.
+	aMatch = EFalse;
+	
+#ifdef SAVEGLYPHSTOMBMDURINGCOMPARISON
+	
+	static TInt countToAppend = 0;
+	
+	CFbsBitmap* bitmap = NULL;
+	if (KErrNone == CreateBitmapFromSgImage(aEGL, aImageA, aRectA, bitmap))
+		{
+		TBuf<KMaxFileName> buf;
+		buf.AppendNum( countToAppend );
+		TPtrC nameAppend( buf );
+		
+		SaveBmp(bitmap, &nameAppend, EFalse);
+		}
+	delete bitmap;	
+	if (KErrNone == CreateBitmapFromSgImage(aEGL, aImageB, aRectB, bitmap))
+		{
+		TBuf<KMaxFileName> buf;
+		buf.AppendNum( countToAppend );
+		TPtrC nameAppend( buf );
+	
+		SaveBmp(bitmap, &nameAppend, ETrue);
+		}
+	delete bitmap;
+	
+	countToAppend++;
+	
+#endif // SAVEGLYPHSTOMBMDURINGCOMPARISON
+	
+	TSgImageInfo imageInfoA;
+	TSgImageInfo imageInfoB;
+	if (aImageA.GetInfo(imageInfoA) != KErrNone ||
+		aImageB.GetInfo(imageInfoB) != KErrNone)
+		{
+		return KErrBadHandle;
+		}
+		
+	// Check the sizes of the images match, and the rects reside on the images.
+	if (aRectA.Size() != aRectB.Size() ||
+		!TRect(imageInfoA.iSizeInPixels).Intersects(aRectA) ||
+		!TRect(imageInfoB.iSizeInPixels).Intersects(aRectB))
+		{
+		return KErrNone;		
+		}
+	const TSize KBufferSize = aRectA.Size();
+	const TInt KDataStride = KBufferSize.iWidth;
+
+	TBool freeTempBufA = EFalse;
+	TBool freeTempBufB = EFalse;
+	if (!aBufferA)
+		{
+		aBufferA = (TUint8*) User::AllocZ(KDataStride * KBufferSize.iHeight);
+		freeTempBufA = ETrue;
+		}
+	if (!aBufferA)
+		{
+		return KErrNoMemory;
+		}
+	TInt err = aEGL->GetSgImageData(aImageA, aRectA, aBufferA);
+	if (err != KErrNone)
+		{
+		if (freeTempBufA)
+			{
+			User::Free(aBufferA);
+			aBufferA = NULL;
+			}
+		return err;
+		}
+	if (!aBufferB)
+		{
+		aBufferB = (TUint8*) User::AllocZ(KDataStride * KBufferSize.iHeight);
+		freeTempBufB = ETrue;
+		}
+	if (!aBufferB)
+		{
+		if (freeTempBufA)
+			{
+			User::Free(aBufferA);
+			aBufferA = NULL;
+			}
+		return KErrNoMemory;
+		}
+	err = aEGL->GetSgImageData(aImageB, aRectB, aBufferB);
+	if (err != KErrNone)
+		{
+		if (freeTempBufA)
+			{
+			User::Free(aBufferA);
+			aBufferA = NULL;
+			}
+		if (freeTempBufB)
+			{
+			User::Free(aBufferB);
+			aBufferB = NULL;
+			}
+		return err;
+		}	
+
+	// Perform a per-pixel comparison, scanline by scanline.
+	// The loop will break as soon as a mismatch is detected.
+	aMatch = ETrue;
+	for (TInt scanline = 0; (scanline < KBufferSize.iHeight) && aMatch; ++scanline)
+		{
+		TUint8* scanlineImageA = aBufferA + (scanline * KDataStride);
+		TUint8* scanlineImageB = aBufferB + (scanline * KDataStride);
+		aMatch = (Mem::Compare(scanlineImageA, KBufferSize.iWidth, scanlineImageB, KBufferSize.iWidth) == 0);
+		}
+
+	if (freeTempBufA)
+		{
+		User::Free(aBufferA);
+		aBufferA = NULL;
+		}
+	if (freeTempBufB)
+		{
+		User::Free(aBufferB);
+		aBufferB = NULL;
+		}
+	
+	return KErrNone;
+	}
+
+/**
+Second thread entry function for multi-threaded tests.
+*/
+TInt CTFbsGlyphData::ThreadFunction(TAny* aParam)
+	{
+	__UHEAP_MARK;
+	CTrapCleanup* cleanupStack = CTrapCleanup::New();
+	if (!cleanupStack)
+		{
+		return KErrNoMemory;
+		}
+
+	TGlyphDataThreadInfo* info = static_cast<TGlyphDataThreadInfo*>(aParam);
+	TRAPD(result,
+	switch(info->iTest)
+		{
+		case EGlyphDataMultiSessionTestShareGlyphs:
+			CTFbsGlyphData::ThreadShareGlyphsL(info->iThreadNum, info->iParams, info->iStep);
+			break;
+		case EGlyphDataMultiSessionTestStressAtlas:
+			CTFbsGlyphData::ThreadStressAtlasL(info->iThreadNum, info->iParams, info->iStep);
+			break;
+		default:
+			User::Leave(KErrArgument);
+		}
+	);
+
+	delete cleanupStack;
+	__UHEAP_MARKEND;
+	return result;
+	}
+
+
+
+/*
+	-----------------------------------------
+	Static utility Methods used by the tests.
+	-----------------------------------------
+*/
+
+
+
+/**
+Utility method that fills the RSgImage memory with RSgImages until either KErrNoMemory
+or KErrNoGraphicsMemory is returned.
+
+@param aSize The size of the image used to fill the graphics memory - a form of granularity
+@param aImages Returns the array of the images used to fill the graphics memory.
+@return KErrNoGraphicsMemory or KErrNoMemory if successful, otherwise one of the system
+	wide error codes.
+ */
+/*static TInt FillGraphicsMemoryWithImages(const TSize& aSize, RArray<RSgImage>& aImages)
+	{
+	TInt err = KErrNone;
+	while (KErrNone == err)
+		{
+		RSgImage sgImage;
+		err = sgImage.Create(TSgImageInfo(aSize, ESgPixelFormatA_8, ESgUsageBitOpenVgImage));
+		if (KErrNone == err)
+			{
+			err = aImages.Append(sgImage);
+			}
+		}
+	return err;
+	}*/
+
+/**
+Utility method that fills the RSgImage memory with RSgImages until either KErrNoMemory
+or KErrNoGraphicsMemory is returned and then closes one RSgImage to free up some memory.
+
+@param aSize The size of the image used to fill the graphics memory - a form of granularity
+@param aImages Returns the array of the images used to fill the graphics memory.
+@return KErrNone if successful, otherwise one of the system	wide error codes.
+ */
+/*static TInt NearlyFillGraphicsMemoryWithImages(const TSize& aSize, RArray<RSgImage>& aImages)
+	{
+	TInt err = FillGraphicsMemoryWithImages(aSize, aImages);
+	if (err == KErrNoMemory || err == KErrNoGraphicsMemory)
+		{
+		if (aImages.Count() > 0)
+			{
+			// Remove an image to free up some memory.
+			TInt lastIndex = aImages.Count() - 1;
+			aImages[lastIndex].Close();
+			aImages.Remove(lastIndex);
+			}
+		err = KErrNone;
+		}
+	return err;
+	}*/
+
+/**
+Static utility function. Creates an 8bpp RSgImage from 1bpp or 8bpp character
+data, with VGImage usage flag set.
+@param aData The character image data. Either in 8bpp or 1bpp RLE format.
+@param aSize The size of the character image in pixels.
+@param aType The type of glyph - Monochrome or Antialiased. 
+@param aSgImage A closed image which will be populated with 8bpp image data.
+*/
+static TInt CreateSgImageFromCharacterData(const TUint8* aData, const TSize& aSize, TGlyphBitmapType aType, RSgImage& aImage)
+	{
+	return CreateSgImageFromCharacterData(aData, aSize, aType, aImage, NULL, NULL);
+	}
+
+/**
+Static utility function. Creates an 8bpp RSgImage from 1bpp or 8bpp character
+data, with VGImage usage flag set. 
+This overload allows the memory for the buffers to be pre-created to avoid
+memory allocation failure during low-memory testing.
+@param aData The character image data. Either in 8bpp or 1bpp RLE format.
+@param aSize The size of the character image in pixels.
+@param aType The type of glyph - Monochrome or Antialiased. 
+@param aSgImage A closed image which will be populated with 8bpp image data.
+@param aBuffer1 If non-NULL, used as a memory buffer for reading the decoded 
+	image data into for monochrome images.
+@param aBuffer2 If non-NULL, used as a memory buffer for the decoded image
+	data for monochrome images.
+*/
+static TInt CreateSgImageFromCharacterData(const TUint8* aData, const TSize& aSize, TGlyphBitmapType aType, RSgImage& aImage, TUint8* aBuffer1, TUint8* aBuffer2)
+	{
+	TInt err = KErrNone;	
+	if (aSize == TSize(0, 0))
+		{
+		return KErrArgument;
+		}
+	TUint8* dataBuf = NULL;
+	TInt dataStride = 0;
+	TBool freeDataBuf = EFalse;
+	if (aType == EAntiAliasedGlyphBitmap)
+		{
+		dataBuf = const_cast<TUint8*>(aData);
+		dataStride = aSize.iWidth;
+		}
+	else if (aType == EMonochromeGlyphBitmap)
+		{
+		TUint8* binaryData = NULL;
+		TUint8* tempBuf = NULL;
+		TInt binaryDataStride = ((aSize.iWidth + 31) / 32) << 2;
+		TInt binaryDataSize = binaryDataStride * aSize.iHeight;
+		if (aBuffer1 && User::AllocLen(aBuffer1) >= binaryDataSize)
+			{
+			binaryData = aBuffer1;
+			}
+		else
+			{
+			tempBuf = (TUint8*) User::AllocZ(binaryDataSize);
+			if (!tempBuf)
+				{
+				return KErrNoMemory;
+				}
+			binaryData = tempBuf;
+			}
+		// Unpack the run length encoded data into 1bpp
+		DecodeBinaryData(aSize, aData, binaryDataStride, reinterpret_cast<TUint32*&>(binaryData));
+		dataStride = aSize.iWidth;
+		TInt byteDataSize = dataStride * aSize.iHeight;
+		TUint8* byteData = NULL;
+		// If aByteBuf supplied, use that instead of allocating a new buffer here.
+		if (aBuffer2 && User::AllocLen(aBuffer2) >= byteDataSize)
+			{
+			byteData = aBuffer2;
+			}
+		else
+			{
+			byteData = (TUint8*) User::AllocZ(byteDataSize);
+			if (!byteData)
+				{
+				User::Free(tempBuf);
+				return KErrNoMemory;
+				}
+			freeDataBuf = ETrue;
+			}
+		dataBuf = byteData;
+		for (TInt scanline = 0; scanline < aSize.iHeight; ++scanline)
+			{
+			TUint8* srcByte = binaryData;
+			for (TInt pixel = 0; pixel < aSize.iWidth; pixel++)
+				{
+				*(byteData+pixel) = ((*srcByte & (1 << (pixel % 8))) == 0) ? 0 : 0xFF;
+				if (((pixel + 1) % 8) == 0) srcByte++;
+				}
+			byteData += dataStride;
+			binaryData += binaryDataStride;
+			}
+		User::Free(tempBuf);
+		}
+	else
+		{
+		return KErrArgument;
+		}
+
+	// Create RSgImage from CFbsBitmap.
+	TSgImageInfo sgImageInfo(aSize, ESgPixelFormatA_8, ESgUsageBitOpenVgImage);
+	err = aImage.Create(sgImageInfo, dataBuf, dataStride);
+	if (freeDataBuf)
+		{
+		User::Free(dataBuf);
+		}
+	return err;
+	}
+
+
+/**
+Static utility function, Copies image data line(s) to a destination.
+@param aBinaryDataPtr pointer to a destination buffer.
+@param aBufferWords Stride of the image.
+@param aData Pointer to a source buffer.
+@param aBitShift Number of bits, binary data will be shifted. 
+@param aCharWidth Width of the image.
+@param aRepeatCount Number of lines to copy.
+*/
+static void CopyCharLine(TUint32*& aBinaryDataPtr,TInt aBufferWords,const TUint8* aData,TInt aBitShift,TInt aCharWidth, TInt16 aRepeatCount)
+	{
+	aBitShift&=7;
+	TInt wordstocopy=(aCharWidth+31)>>5;
+	if(wordstocopy>aBufferWords) wordstocopy=aBufferWords;
+	TUint32* ptrlimit=aBinaryDataPtr+wordstocopy;
+	TUint32* dataword=(TUint32*)(TInt(aData)&~3);
+	aBitShift+=(TInt(aData)-TInt(dataword))<<3;
+	
+	TUint32* startBinaryDataPtr = aBinaryDataPtr;
+	while(aBinaryDataPtr<ptrlimit)
+		{
+		*aBinaryDataPtr=*dataword++;
+		*aBinaryDataPtr>>=aBitShift;
+		if(aBitShift) *aBinaryDataPtr|=(*dataword<<(32-aBitShift));
+		aBinaryDataPtr++;
+		}
+	
+	TUint32* curStartBinaryDataPtr = aBinaryDataPtr;
+	TInt byteToCopy = wordstocopy << 2;
+	while(aRepeatCount > 1)
+		{
+		Mem::Copy(curStartBinaryDataPtr, startBinaryDataPtr, byteToCopy);
+		curStartBinaryDataPtr += wordstocopy;
+		
+		aRepeatCount--;
+		}
+	aBinaryDataPtr = curStartBinaryDataPtr;
+	}
+
+/**
+Static utility function. Decodes a monochrome glyph whose data is run length encoded, 
+into a 1bpp bitmap.
+@param aDataSize Image size in pixels.
+@param aData Pointer to a source buffer.
+@param aStride Image data stride.
+@param aBinaryData Pointer to a destination buffer. This buffer must be allocated 
+	by the caller.
+*/
+static void DecodeBinaryData(const TSize& aDataSize, const TUint8* aData, TInt aStride,
+											TUint32* aBinaryData)
+	{
+	const TInt datalength = aDataSize.iWidth;
+	const TInt dataheight = aDataSize.iHeight;
+	TInt bitindex=0;
+	TInt16 repeatcount=0;
+	TUint32* slbuffer=aBinaryData;
+	const TInt slwords=aStride;
+
+	for(TInt charline=0;charline<dataheight;charline+=repeatcount) // for lines in the character...
+		{
+		repeatcount=CFbsBitGc::Load16(aData+(bitindex>>3));
+		repeatcount>>=bitindex&7;
+		const TInt multilineflag=repeatcount&1;
+		repeatcount>>=1;
+		repeatcount&=0xf;
+		bitindex+=5;
+		if(multilineflag)
+			{
+			for(TInt currentline=0;currentline<repeatcount;currentline++)
+				{
+				CopyCharLine(slbuffer,slwords,aData+(bitindex>>3),bitindex&7,datalength, 1);
+				bitindex+=datalength;
+				}
+			}
+		else
+			{
+			CopyCharLine(slbuffer,slwords,aData+(bitindex>>3),bitindex&7,datalength, repeatcount);
+			bitindex+=datalength;
+			}
+		}
+	}
+//--------------
+__CONSTRUCT_STEP__(FbsGlyphData)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/tfbs/tfbsglyphdata.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,199 @@
+// Copyright (c) 2009-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 TFBSGLYPHDATA_H
+#define TFBSGLYPHDATA_H
+
+#include <EGL/eglext.h>
+#include <VG/openvg.h>
+#include <sgresource/sgresource.h>
+#include "test/TGraphicsHarness.h"
+class RSgImage;
+class CEGLHelper;
+
+//#define SAVEGLYPHSTOMBMDURINGCOMPARISON // Enable saving of glyphs in the CompareSgImages()function
+//#define SAVEGLYPHSTOMBMDEBUGFUNCTION //  Enable compilation of the member function SaveRSgImagesAsMbms(). Occasionally useful.
+
+typedef EGLBoolean (*TvgCreateEGLImageTargetKHRTypefPtr) (VGeglImageKHR image);
+
+/**
+Multi-thread test enum.
+ */
+enum EGlyphDataMultithreadTest
+	{
+	EGlyphDataMultiSessionTestShareGlyphs,
+	EGlyphDataMultiSessionTestStressAtlas
+	};
+
+/**
+Struct passed to multi-thread test functions.
+ */
+struct TGlyphDataMultithreadParams
+	{
+	TFontSpec iFontSpec;
+	TUint* iGlyphCodes;
+	TInt iGlyphCodesCount;
+	CEGLHelper* iEGL;
+	};
+
+/**
+Struct used to define the mutlithreaded test to run when launching a new thread.
+ */
+struct TGlyphDataThreadInfo
+	{
+	EGlyphDataMultithreadTest iTest;
+	TGlyphDataMultithreadParams iParams;
+	TInt iThreadNum;
+	CTestStep* iStep;
+	};
+
+
+/**
+ *
+ * Class to provide a dummy font for test purposes
+ * See CTFbsGlyphData::TestGlyphDataIteratorNotSupportedFontL()
+ */
+class CTestFont : public CFont
+	{
+public:
+	TUid DoTypeUid() const {return TUid::Uid(12345);}
+	TInt DoHeightInPixels() const {return 12;}
+	TInt DoAscentInPixels() const {return 10;}
+	TInt DoCharWidthInPixels(TChar /*aChar*/) const  {return 0;}
+	TInt DoTextWidthInPixels(const TDesC& /*aText*/) const {return 0;}
+	TInt DoBaselineOffsetInPixels() const {return 0;}
+	TInt DoTextCount(const TDesC& /*aText*/,TInt /*aWidthInPixels*/) const {return 0;}
+	TInt DoTextCount(const TDesC& /*aText*/,TInt /*aWidthInPixels*/,TInt& /*aExcessWidthInPixels*/) const {return 0;}
+	TInt DoMaxCharWidthInPixels() const  {return 0;}
+	TInt DoMaxNormalCharWidthInPixels() const  {return 0;}
+	TFontSpec DoFontSpecInTwips() const  {return TFontSpec();}
+	};
+
+/**
+Created by each process/thread that needs to do RSgImage image comparison.
+The class can be shared in a process between threads and handles synchronisation
+with EGL itself.
+ */
+class CEGLHelper : public CBase
+	{
+public:
+	~CEGLHelper();
+	static CEGLHelper* NewL();
+		
+	TInt GetSgImageData(const RSgImage& aSgImage, const TRect& aRect, TUint8*& aBuf);
+	
+private:
+	CEGLHelper();
+	void ConstructL();
+
+private:
+	RMutex iMutex;
+	RSgDriver iSgDriver;
+	EGLDisplay iDisplay;
+	EGLContext iContext;
+	EGLSurface iSurface;
+	// Function pointer for creation and destruction of EGLImages, and the creation
+	// of VGImages from EGLImages.
+	TvgCreateEGLImageTargetKHRTypefPtr vgCreateImageTargetKHR;
+	PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
+	PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
+	};
+
+/**
+Test class for the glyph data extensions RFbsGlyphDataIterator and 
+RFbsGlyphMetricsArray. Positive and negative tests
+*/
+class CTFbsGlyphData : public CTGraphicsBase
+	{
+public:
+	CTFbsGlyphData(CTestStep* aStep);
+	~CTFbsGlyphData();
+protected:
+//from 	CTGraphicsBase
+	virtual void RunTestCaseL(TInt aCurTestCase);
+	void ConstructL();
+	
+private:
+	// Test Cases
+	void TestConsistencyWithGetCharacterData();
+	void TestInvalidGlyphCode();
+	void TestGlyphMetricsArrayParameters();
+	void TestGlyphMetricsArrayReuse();
+	void TestGlyphDataIteratorClose();
+	void TestGlyphDataIteratorSequence();
+	void TestGlyphDataIteratorMultipleUsesOnMultipleFonts();
+	void TestGlyphDataIteratorImageValidity();
+	void TestGlyphDataIteratorOpenInvalidCode();
+	void TestGlyphDataIteratorOpenTwice();
+	void TestGlyphDataIteratorOpenTwiceWithDifferentFonts();
+	void TestGlyphDataIteratorOpenTooBigFont();
+	void TestGlyphDataIteratorOpenWithWrongArgument();
+	void TestGlyphDataIteratorImageMemoryLeak();
+	void TestGlyphDataIteratorLargeFontStress();
+	void TestGlyphDataIteratorManyFontsStressL();
+	void TestGlyphDataIteratorNoGraphicsMemory();
+	void TestGlyphDataIteratorNextIsAtomic();
+	void TestGlyphDataIteratorManyArraySizes();
+	void TestBitmapFontSupport();
+	// White-Box Test Cases
+	void TestGlyphDataIteratorSameGlyphCodes();
+	void TestMultithreadShareSingleFont();
+	void TestMultithreadStressAtlas();
+	// Out-of-system-memory tests
+	void TestGlyphMetricsArrayHeapOOML();
+	void TestGlyphDataIteratorHeapOOML();
+	// Multithread funtions
+	static void ThreadShareGlyphsL(TInt aThreadNum, TGlyphDataMultithreadParams& aParam, CTestStep* aStep);
+	static void ThreadStressAtlasL(TInt aThreadNum, TGlyphDataMultithreadParams& aParam, CTestStep* aStep);	
+
+	// Utility functions for the test cases.
+	static TInt ThreadFunction(TAny* aParam); 
+	TInt GetImageDataFromSgImage(const RSgImage& aSgImage, const TRect& aRect, TUint8*& aBuf);
+	TUint32 CompareMetrics(const TOpenFontCharMetrics& aMetrics1, const TOpenFontCharMetrics& aMetrics2);
+	static TInt CompareSgImages(CEGLHelper* aEGL, const RSgImage& aImageA, const TRect& aRectA, const RSgImage& aImageB, const TRect& aRectB, TBool& aMatch);
+	static TInt CompareSgImages(CEGLHelper* aEGL, const RSgImage& aImageA, const TRect& aRectA, TUint8* aBufferA, const RSgImage& aImageB, const TRect& aRectB, TUint8* aBufferB, TBool& aMatch);
+#ifdef SAVEGLYPHSTOMBMDEBUGFUNCTION
+	void SaveRSgImagesAsMbms( CEGLHelper* aEGL, const RSgImage& aImageA, const TRect& aRectA, const RSgImage& aImageB, const TRect& aRectB );
+#endif // SAVEGLYPHSTOMBMDEBUGFUNCTION
+	void InfoPrintFontSpec(const CFont& aFont);
+	void SetupEglL();
+	
+private:
+	RFbsSession* iFbs;
+	CFbsTypefaceStore* iTs;
+	TUint* iGlyphCodesLatin;
+	
+	CFbsFont* iFont;
+	CFbsFont* iFont2;
+
+	TUint8* iTempBuf1;
+	TUint8* iTempBuf2;
+	RSgDriver iSgDriver;
+	CEGLHelper* iEGL;
+	};
+
+
+class CTFbsGlyphDataStep : public CTGraphicsStep
+	{
+public:
+	CTFbsGlyphDataStep();
+protected:	
+	//from CTGraphicsStep
+	virtual CTGraphicsBase* CreateTestL();
+	};
+
+_LIT(KTFbsGlyphDataStep,"TFbsGlyphData");
+
+#endif /* TFBSGLYPHDATA_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/tfbs/tfbsglyphdataoutlineshadow.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,93 @@
+// Copyright (c) 2009-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:
+//
+
+/**
+ @file
+ @internalComponent - Internal Symbian test code
+*/
+
+#include <graphics/fbsglyphdataiterator.h>
+#include <sgresource/sgimage.h>
+
+#include "tfbsglyphdataoutlineshadow.h"
+
+_LIT(KTypefaceName, "DejaVu Sans Condensed");
+
+//Note: This test must be run with a rasterizer which supports EFourColourBlendGlyphBitmap (e.g. iType)
+//otherwise the test will fail.
+CTFbsGlyphDataOutlineAndShadow::CTFbsGlyphDataOutlineAndShadow(CTestStep* aStep) :
+    CTGraphicsBase(aStep)
+    {
+    }
+
+CTFbsGlyphDataOutlineAndShadow::~CTFbsGlyphDataOutlineAndShadow()
+    {
+    if (iTs)
+       {
+       iTs->ReleaseFont(iFont);
+       delete iTs;
+       }
+    }
+
+void CTFbsGlyphDataOutlineAndShadow::ConstructL()
+    {
+    iTs = (CFbsTypefaceStore*)CFbsTypefaceStore::NewL(NULL);
+    TFontSpec fontSpec;
+    fontSpec.iTypeface.iName = KTypefaceName;
+    fontSpec.iHeight = 15;
+    fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
+    fontSpec.iFontStyle.SetEffects(FontEffect::EDropShadow, EDropShadowOn);
+    fontSpec.iFontStyle.SetEffects(FontEffect::EOutline, EOutlineOn);
+    User::LeaveIfError(iTs->GetNearestFontToDesignHeightInPixels((CFont*&)iFont, fontSpec));
+    //now check if the font is what we requested
+    if(iFont->FontSpecInTwips().iFontStyle.BitmapType()!=EFourColourBlendGlyphBitmap)
+        {
+        WARN_PRINTF1(_L("Monotype font is not installed, run iType\\binaries\\ityperast.cmd to install it"));
+        User::Leave(KErrNotSupported);
+        }
+    }
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0646
+@SYMTestPriority    High
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+    To ensure that glyph iterator doesn't support outline-and-shadow font
+@SYMTestActions
+    i. Call RFbsGlyphDataIterator::Open() with an outline-and-shadow font.
+
+@SYMTestExpectedResults
+    RFbsGlyphDataIterator::Open() returns KErrNotSupported.
+*/
+void CTFbsGlyphDataOutlineAndShadow::RunTestCaseL(TInt /*aCurTestCase*/)
+    {
+    INFO_PRINTF1(_L("Ensure that glyph iterator doesn't support outline-and-shadow font"));
+    ((CTFbsGlyphDataOutlineAndShadowStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0646"));
+    RFbsGlyphDataIterator iter;
+    const TUint glyphCode = 50;
+    TInt err = iter.Open(*iFont, &glyphCode, 1);
+    TESTE(err == KErrNotSupported, err);
+    iter.Close();
+
+    ((CTFbsGlyphDataOutlineAndShadowStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);//_L("GRAPHICS-FBSERV-0645"));
+    ((CTFbsGlyphDataOutlineAndShadowStep*)iStep)->CloseTMSGraphicsStep();
+    TestComplete();     
+    ((CTFbsGlyphDataOutlineAndShadowStep*)iStep)->RecordTestResultL();
+    }
+
+__CONSTRUCT_STEP__(FbsGlyphDataOutlineAndShadow)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/tfbs/tfbsglyphdataoutlineshadow.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,69 @@
+// Copyright (c) 2009-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 TFBSGLYPHDATAOUTLINESHADOW_H
+#define TFBSGLYPHDATAOUTLINESHADOW_H
+
+#include "test/TGraphicsHarness.h"
+
+
+/** 
+Enumeration for the attributes to be set in fontspec and gc.
+See CTFbsGlyphDataOutlineAndShadow::ConstructL()
+*/
+enum TFontEffectsFlags
+    {
+    EDropShadowOn = 0x1,
+    EOutlineOn = 0x2,
+    };
+
+/**
+Test class which checks that glyph data extensions 
+RFbsGlyphDataIterator processes and returns correct error if outline-and-shadow
+font is supplied. 
+
+This test must be run with a rasterizer which supports EFourColourBlendGlyphBitmap (e.g. iType)
+otherwise the test will fail.
+
+Negative test
+*/
+class CTFbsGlyphDataOutlineAndShadow : public CTGraphicsBase
+    {
+public:
+    CTFbsGlyphDataOutlineAndShadow(CTestStep* aStep);
+    ~CTFbsGlyphDataOutlineAndShadow();
+protected:
+//from  CTGraphicsBase
+    virtual void RunTestCaseL(TInt aCurTestCase);
+    void ConstructL();
+    
+private:
+    CFbsTypefaceStore* iTs;
+    CFbsFont* iFont;
+   };
+
+class CTFbsGlyphDataOutlineAndShadowStep : public CTGraphicsStep
+    {
+public:
+    CTFbsGlyphDataOutlineAndShadowStep();
+protected:  
+    //from CTGraphicsStep
+    virtual CTGraphicsBase* CreateTestL();
+    };
+
+_LIT(KTFbsGlyphDataOutlineAndShadowStep,"TFbsGlyphDataOutlineAndShadow");
+
+
+#endif /* TFBSGLYPHDATAOUTLINESHADOW_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/tfbs/tfbsglyphdatapanic.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,487 @@
+// Copyright (c) 2009-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:
+//
+
+/**
+ @file
+ @internalComponent - Internal Symbian test code
+*/
+
+#include <graphics/fbsglyphmetricsarray.h> 
+#include <graphics/fbsglyphdataiterator.h>
+#include "tfbsglyphdatapanic.h"
+
+_LIT(KTypefaceName, "DejaVu Sans Condensed");
+const TInt KNumGlyphCodes = 96;
+
+/*
+Lookup table to convert from ascii code to
+glyph code for the Deja Vu family of fonts.
+ */
+const TUint DejaVuASCIIToGlyphCode[] = 
+    {
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 3, 4, 5, 6, 7, 8, 9, 10, 
+    11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 
+    21, 22, 23, 24, 25, 26, 27, 28, 29, 30,     
+    31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+    41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+    51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 
+    61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
+    71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
+    81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
+    91, 92, 93, 94, 95, 96, 97, 98, 
+    };
+
+CTFbsGlyphDataPanic::CTFbsGlyphDataPanic(CTestStep* aStep):
+    CTGraphicsBase(aStep)
+    {
+    }
+
+CTFbsGlyphDataPanic::~CTFbsGlyphDataPanic()
+    {
+    iSgDriver.Close();
+    if (iTs)
+         {
+         iTs->ReleaseFont(iFont);
+         delete iTs;
+         }
+    }
+
+void CTFbsGlyphDataPanic::ConstructL()
+    {
+    User::LeaveIfNull(iFbs = RFbsSession::GetSession());
+    User::LeaveIfNull(iTs = (CFbsTypefaceStore*)CFbsTypefaceStore::NewL(NULL));
+    User::LeaveIfError(iTs->GetNearestFontToDesignHeightInPixels((CFont*&)iFont, TFontSpec(KTypefaceName, 15)));
+    User::LeaveIfError(iSgDriver.Open());
+    
+    //initialize the array with ASCII characters from 0020 to 007F
+    iGlyphCodes = new(ELeave) TUint[KNumGlyphCodes];
+    for (TInt i = 0; i < KNumGlyphCodes; ++i)
+        {
+        TUint asciiCode = i+0x20; 
+        iGlyphCodes[i] = DejaVuASCIIToGlyphCode[asciiCode];
+        }
+    }
+
+void CTFbsGlyphDataPanic::RunTestCaseL(TInt /*aCurTestCase*/)
+    {
+    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
+    TInt testCase = -1;
+    _LIT(KCaseNumber, "CaseNumber");
+    TEST(iStep->GetIntFromConfig(iStep->ConfigSection(), KCaseNumber, testCase));
+    
+    switch(testCase)
+        {
+    case 1:
+        TestGlyphDataIteratorNotInitializedNext();
+        break;
+    case 2:
+        TestGlyphDataIteratorNotInitializedImage();
+        break;
+    case 3:
+        TestGlyphDataIteratorNotInitializedMetrics();
+        break;
+    case 4:
+        TestGlyphDataIteratorNotInitializedGlyphCode();
+        break;
+    case 5:
+        TestGlyphDataIteratorClosedNext();
+        break;
+    case 6:
+        TestGlyphDataIteratorClosedImage();
+        break;
+    case 7:
+        TestGlyphDataIteratorClosedMetrics();
+        break;
+    case 8:
+        TestGlyphDataIteratorClosedGlyphCode();
+        break;
+    case 9:
+        TestGlyphDataIteratorDiscardUsedFont();
+        break;
+    case 10:
+        TestGlyphMetricsArrayIndexNegative();
+        break;
+    case 11:
+    	TestGlyphMetricsArrayIndexTooHigh();
+        break;
+    case 12:
+    	TestGlyphDataIteratorOpenFailed();
+    	break;
+    default:
+        break;
+        }
+    TEST(EFalse); // shouldn't reach this point as the test will panic at the end of each test case function
+    
+    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
+    ((CTFbsGlyphDataPanicStep*)iStep)->CloseTMSGraphicsStep();
+    TestComplete();     
+    ((CTFbsGlyphDataPanicStep*)iStep)->RecordTestResultL();
+    }
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0651
+@SYMTestPriority    High
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	To ensure that calling Next() on an unopened iterator will panic.
+
+@SYMTestActions
+	Call Next() on an RFbsGlyphDataIterator instance without opening it.
+
+@SYMTestExpectedResults
+	The call to Next() should panic with GDI 4.
+*/
+void CTFbsGlyphDataPanic::TestGlyphDataIteratorNotInitializedNext()
+    {
+    INFO_PRINTF1(_L("Ensure that Next() operation applied on null iterator will panic"));
+    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0651"));
+    RFbsGlyphDataIterator iter;
+    iter.Next(); //expect to panic here
+    }
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0652
+@SYMTestPriority    High
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	To ensure that Image() function applied on an unopened iterator will panic.
+
+@SYMTestActions
+	Call Image() on an RFbsGlyphDataIterator instance without opening it.
+
+@SYMTestExpectedResults
+	The call to Image() should panic with GDI 4.
+*/
+void CTFbsGlyphDataPanic::TestGlyphDataIteratorNotInitializedImage()
+    {
+    INFO_PRINTF1(_L("Ensure that Image() operation applied on null iterator will panic"));
+    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0652"));
+    RFbsGlyphDataIterator iter;
+    iter.Image(); //expect to panic here
+    }
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0653
+@SYMTestPriority    High
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	To ensure that Metrics() function applied on null iterator will panic.
+
+@SYMTestActions
+	Call Metrics() on an RFbsGlyphDataIterator instance without opening it.
+
+@SYMTestExpectedResults
+	The call to Metrics() should panic with GDI 4.
+*/
+void CTFbsGlyphDataPanic::TestGlyphDataIteratorNotInitializedMetrics()
+    {
+    INFO_PRINTF1(_L("Ensure that Metrics() operation applied on null iterator will panic"));
+    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0653"));
+    RFbsGlyphDataIterator iter;
+    iter.Metrics(); //expect to panic here
+    }
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0654
+@SYMTestPriority    High
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	To ensure that calling GlyphCode() on an unopened iterator will panic.
+
+@SYMTestActions
+	Call GlyphCode() on an RFbsGlyphDataIterator instance without opening it.
+
+@SYMTestExpectedResults
+	The call to GlyphCode() should panic with GDI 4.
+*/
+void CTFbsGlyphDataPanic::TestGlyphDataIteratorNotInitializedGlyphCode()
+    {
+    INFO_PRINTF1(_L("Ensure that GlyphCode() operation applied on null iterator will panic"));
+    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0654"));
+    RFbsGlyphDataIterator iter;
+    iter.GlyphCode(); //expect to panic here
+    }
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0655
+@SYMTestPriority    High
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	To ensure that calling Next() on an iterator which has been closed will panic.
+
+@SYMTestActions
+	i. Open the glyph data iterator with 1 glyph code.
+	ii. Call Next() to attempt to move the iterator past the end of the array of glyph codes.
+	iii. Call Close() and repeat ii.
+
+@SYMTestExpectedResults
+	The call to Next() should fail with KErrNotFound, signifying the iterator is still open.
+	The final call to Next() should panic with GDI 4.
+*/
+void CTFbsGlyphDataPanic::TestGlyphDataIteratorClosedNext()
+    {
+    INFO_PRINTF1(_L("Ensure that Next() operation applied on iterator which has been closed will panic"));
+    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0655"));
+    RFbsGlyphDataIterator iter;
+    TESTNOERROR(iter.Open(*iFont, iGlyphCodes, 1));
+    TInt iterErr = iter.Next();
+    TESTE(iterErr == KErrNotFound, iterErr);
+    iter.Close();
+    iter.Next(); //expect to panic here
+    }
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0656
+@SYMTestPriority    High
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	To ensure that calling Image() on an iterator which has been closed will panic.
+
+@SYMTestActions
+	i. Open the glyph data iterator.
+	ii. Close the glyph data iterator.
+	iii. Call Image() on an RFbsGlyphDataIterator instance which has been closed.
+
+@SYMTestExpectedResults
+	The call to Image() should panic with GDI 4.
+*/
+void CTFbsGlyphDataPanic::TestGlyphDataIteratorClosedImage()
+    {
+    INFO_PRINTF1(_L("Ensure that Image() operation applied on iterator which has been closed will panic"));
+    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0656"));
+    RFbsGlyphDataIterator iter;
+    OpenAndCloseIterator(iter);
+    iter.Image(); //expect to panic here
+    }
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0657
+@SYMTestPriority    High
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	To ensure that calling Metrics() on an iterator which has been closed will panic.
+
+@SYMTestActions
+	i. Open the glyph data iterator.
+	ii. Close the glyph data iterator.
+	iii. Call Metrics() on an RFbsGlyphDataIterator instance which has been closed.
+
+@SYMTestExpectedResults
+	The call to Metrics() should panic with GDI 4.
+*/
+void CTFbsGlyphDataPanic::TestGlyphDataIteratorClosedMetrics()
+    {
+    INFO_PRINTF1(_L("Ensure that Metrics()operation applied on iterator which has been closed will panic"));
+    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0657"));
+    RFbsGlyphDataIterator iter;
+    OpenAndCloseIterator(iter);
+    iter.Metrics(); //expect to panic here
+    }
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0658
+@SYMTestPriority    High
+@SYMTestType        UT
+@SYMTestStatus      In development
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	To ensure that calling GlyphCode() on an iterator which has been closed will panic.
+
+@SYMTestActions
+	i. Open the glyph data iterator.
+	ii. Close the glyph data iterator.
+	iii. Call GlyphCode() on an RFbsGlyphDataIterator instance which has been closed.
+
+@SYMTestExpectedResults
+	The call to GlyphCode() should panic with GDI 4.
+*/
+void CTFbsGlyphDataPanic::TestGlyphDataIteratorClosedGlyphCode()
+    {
+    INFO_PRINTF1(_L("Ensure that GlyphCode() operation applied on iterator which has been closed will panic"));
+    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0658"));
+    RFbsGlyphDataIterator iter;
+    OpenAndCloseIterator(iter);
+    iter.GlyphCode(); //expect to panic here
+    }
+
+// the function opens and then closes an iterator
+void CTFbsGlyphDataPanic::OpenAndCloseIterator(RFbsGlyphDataIterator& aIterator) 
+    {
+    TESTNOERROR(aIterator.Open(*iFont, iGlyphCodes, 1));
+    aIterator.Close();
+    }
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0647
+@SYMTestPriority    High
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	To ensure that attempting to use an invalid Font handle will cause a panic when iterating through an RFbsGlyphDataIterator. 
+
+@SYMTestActions
+	i. Open the glyph data iterator.
+	ii. Release the font associated with the iterator.
+	iii. Attempt to use invalid Font handle by iterating through the iterator.
+
+@SYMTestExpectedResults
+	The call to Next() after the associated Font has been released should cause panic FBSERV -8 when the invalid Font handle is passed to FBServ.
+*/
+void CTFbsGlyphDataPanic::TestGlyphDataIteratorDiscardUsedFont()
+    {
+    INFO_PRINTF1(_L("Ensure that attempting to use an invalid Font handle will cause a panic when iterating through an RFbsGlyphDataIterator"));
+    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0647"));
+    
+    RFbsGlyphDataIterator iter;
+    TESTNOERROR(iter.Open(*iFont, iGlyphCodes, KNumGlyphCodes));
+    iTs->ReleaseFont(iFont);
+    
+    for (TInt i = 0; i < KNumGlyphCodes; i++)
+        {
+        //should panic when attempt is made to use invalid Font handle
+        iter.Next();
+        }
+
+    iter.Close(); //shouldn't reach this line. If for some reason the code doesn't panic test should fail.
+    TEST(EFalse);  
+    }
+    
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0648
+@SYMTestPriority    High
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	To ensure that accessing the glyph metrics entry with negative index will cause a panic.
+
+@SYMTestActions
+	i. Retrieve glyph metrics array.
+	ii. Try to access glyph metrics entry with a negative index.
+
+@SYMTestExpectedResults
+	Should panic with GDI 5.
+*/
+void CTFbsGlyphDataPanic::TestGlyphMetricsArrayIndexNegative()
+    {
+    INFO_PRINTF1(_L("Ensure that accessing the glyph metrics entry with negative index will cause a panic"));
+    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0648"));
+    RFbsGlyphMetricsArray glyphMetricsArray;
+
+    // Retrieve list of metrics
+    TESTNOERROR(glyphMetricsArray.Get(*iFont, iGlyphCodes, 2));
+    TEST(2 == glyphMetricsArray.Count());
+    glyphMetricsArray[-1];
+    }
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0649
+@SYMTestPriority    High
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	To ensure that accessing the glyph metrics entry with an index greater than number
+	of elements in array will cause a panic.
+
+@SYMTestActions
+	i. Retrieve a glyph metrics array with total number of elements equals 2 
+	ii. Try to access glyph metrics entry with index equals 2.
+
+@SYMTestExpectedResults
+	Should panic with GDI 5.
+*/
+void CTFbsGlyphDataPanic::TestGlyphMetricsArrayIndexTooHigh()
+    {
+    INFO_PRINTF1(_L("Ensure that accessing the glyph metrics entry with index greater than number of elemnets in array will cause a panic"));
+    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0649"));
+    RFbsGlyphMetricsArray glyphMetricsArray;
+
+    // Retrieve list of metrics
+    TESTNOERROR(glyphMetricsArray.Get(*iFont, iGlyphCodes, 2));
+    TEST(2 == glyphMetricsArray.Count());
+    glyphMetricsArray[2]; //expect to panic here as index varies 0..1
+    }
+
+/**
+@SYMTestCaseID      GRAPHICS-FBSERV-0667
+@SYMTestPriority    High
+@SYMTestType        UT
+@SYMTestStatus      Implemented
+@SYMPREQ            PREQ2678
+
+@SYMTestCaseDesc
+	To ensure that if RFbsGlyphDataIterator::Open() fails, it is still in the closed state
+	and cannot be used.
+
+@SYMTestActions
+	i. Open an RFbsGlyphDataIterator on a font.  
+	ii. Attempt to open a second RFbsGlyphDataIterator on the same font.
+	ii. Attempt to use the properties of the iterator.
+
+@SYMTestExpectedResults
+	The call to GlyphCode() should panic with FBSCLI 31 since the iterator should be in a closed state.
+*/
+void CTFbsGlyphDataPanic::TestGlyphDataIteratorOpenFailed()
+	{
+    INFO_PRINTF1(_L("Ensure that if RFbsGlyphDataIterator::Open() fails, it is still in the closed state and cannot be used"));
+    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0667"));
+   
+    CFbsFont* bitmapFont = NULL;
+    TInt err = iTs->GetNearestFontToDesignHeightInPixels((CFont*&)bitmapFont, TFontSpec(_L("Digital"), 14));
+    TESTNOERROR(err);
+    TEST(!bitmapFont->IsOpenFont());
+    
+    RFbsGlyphDataIterator iter;
+    err = iter.Open(*bitmapFont, iGlyphCodes, 2);
+    TEST(err == KErrNotSupported);
+        
+    iter.GlyphCode(); // Should panic here as iter should be closed.
+    TEST(EFalse);     //shouldn't reach this line. If for some reason the code doesn't panic test should fail.
+    
+	}
+//--------------
+__CONSTRUCT_STEP__(FbsGlyphDataPanic)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/tfbs/tfbsglyphdatapanic.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,74 @@
+// Copyright (c) 2009-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 TFBSGLYPHDATAPANIC_H
+#define TFBSGLYPHDATAPANIC_H
+
+#include <sgresource/sgresource.h>
+#include "test/TGraphicsHarness.h"
+class RFbsGlyphDataIterator;
+
+/**
+Test class which exercises all panics for the glyph data extensions 
+RFbsGlyphDataIterator and RFbsGlyphMetricsArray. 
+Negative tests
+*/
+class CTFbsGlyphDataPanic : public CTGraphicsBase
+    {
+public:
+    CTFbsGlyphDataPanic(CTestStep* aStep);
+    ~CTFbsGlyphDataPanic();
+protected:
+//from  CTGraphicsBase
+    virtual void RunTestCaseL(TInt aCurTestCase);
+    void ConstructL();
+    
+//test cases
+    void TestGlyphDataIteratorNotInitializedNext();
+    void TestGlyphDataIteratorNotInitializedImage();
+    void TestGlyphDataIteratorNotInitializedMetrics();
+    void TestGlyphDataIteratorNotInitializedGlyphCode();
+    void TestGlyphDataIteratorClosedNext();
+    void TestGlyphDataIteratorClosedImage();
+    void TestGlyphDataIteratorClosedMetrics();
+    void TestGlyphDataIteratorClosedGlyphCode();
+    void TestGlyphDataIteratorDiscardUsedFont();
+    void TestGlyphMetricsArrayIndexNegative();
+    void TestGlyphMetricsArrayIndexTooHigh();
+    void TestGlyphDataIteratorOpenFailed();
+
+    //helper function
+    void OpenAndCloseIterator(RFbsGlyphDataIterator& aIterator); // the function opens and then closes an iterator
+private:
+    RFbsSession* iFbs;
+    CFbsTypefaceStore* iTs;
+    CFbsFont* iFont;
+    RSgDriver iSgDriver;
+    TUint* iGlyphCodes;
+   };
+
+class CTFbsGlyphDataPanicStep : public CTGraphicsStep
+    {
+public:
+    CTFbsGlyphDataPanicStep();
+protected:  
+    //from CTGraphicsStep
+    virtual CTGraphicsBase* CreateTestL();
+    };
+
+_LIT(KTFbsGlyphDataPanicStep,"TFbsGlyphDataPanic");
+
+
+#endif /* TFBSGLYPHDATAPANIC_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/tfbs/tfbsoogm.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,370 @@
+// Copyright (c) 2009-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: Test the operation of the Font and Bitmap Server's GOoM plug-in
+//
+
+
+#include <gdi.h>
+#include "tfbsoogm.h"
+
+
+
+const TInt KTFbsOogmFrameworkPause = 500000; // How long does this need to be in order to be reliable?
+const TInt KTFbsOogmImageSizeX = 2048;
+const TInt KTFbsOogmImageSizeY = 2048;
+
+
+void CTFbsOogm::RunTestCaseL( TInt aCurTestCase )
+    {
+    ( (CTFbsOogmStep*)iStep )->SetTestStepID( KUnknownSYMTestCaseIDName );
+
+    switch( aCurTestCase )
+        {
+    case 1:
+        ( (CTFbsOogmStep*)iStep )->SetTestStepID( _L("GRAPHICS-FBSERV-0675") );
+
+        CacheClearanceAndLimitAdjustments();
+        break;
+
+    default:
+        ( (CTFbsOogmStep*)iStep )->SetTestStepID( KNotATestSYMTestCaseIDName );
+        ( (CTFbsOogmStep*)iStep )->CloseTMSGraphicsStep();
+        TestComplete();
+
+        break;
+        }
+
+    ( (CTFbsOogmStep*)iStep )->RecordTestResultL();
+
+    }
+
+
+
+/**
+ 	@SYMTestCaseID
+	GRAPHICS-FBSERV-0675
+
+	@SYMTestCaseDesc
+	Tests the operation of Font and Bitmap server's  Out-Of-Graphics-Memory plugin.
+	ie Ensure that the hardware glyph cache is cleared in response to a low graphics 
+	memory notification, and that the cache's maximum size limit is reduced.
+
+
+	@SYMTestActions
+	Acquire the glyph cache's usage and other metrics.
+	
+	Populate the glyph-cache.
+
+	Acquire the glyph-cache's usage and other metrics.
+
+	Precipitate an Out-of-Graphics-Memory condition, triggering the GOOM monitor.
+
+	Acquire the glyph cache's usage and other metrics.
+
+	Ensure the glyph-cache has been cleared and its maximum limit reduced.
+
+	Precipitate a MemoryGood() call from the GOoM framework.
+
+	Establish that the cache-size limit has been reinstated.
+
+	@SYMTestExpectedResults
+    The glyph-cache should be cleared in response to OoGM condition and its upper limit reduced.
+
+    The Glyph-cache's upper limit should be reinstated in response to a memory-good notification.
+ */
+void CTFbsOogm::CacheClearanceAndLimitAdjustments()
+    {
+    __UHEAP_MARK;
+
+    RArray <RSgImage> sgImageArray;
+    RSgDriver sgDriver;
+    TInt err = sgDriver.Open();
+
+    if( KErrNone != err )
+        {
+		TEST( KErrNone == err );
+		INFO_PRINTF2( _L("SgDriver Open() returned error %d"), err );
+
+        return;
+        }
+
+    if( (NULL == RFbsSession::GetSession()) )
+         {
+        if( KErrNone != RFbsSession::Connect() )
+            {
+ 			TEST( -1 );
+			INFO_PRINTF1(_L("Failed to connect to FbServ"));
+
+            goto CleanupAndGo;
+            }
+         }
+
+
+	// Establish the initial condition of the glyph-cache.
+    TGlyphCacheMetrics initialGlyphCacheMetrics;
+    err = RFbsSession::GetSession()->GetGlyphCacheMetrics( initialGlyphCacheMetrics );
+    if( KErrNone != err )
+        {
+		TEST( KErrNone == err );
+		INFO_PRINTF2( _L("GetGlyphCacheMetrics() returned error %d"), err );
+
+        goto CleanupAndGo;
+        }
+
+	// Check that initial conditions are as expected.
+    // There was a test here for a cache-size of zero, but this was felt to be a hazardous assumption.
+	TEST( initialGlyphCacheMetrics.iGpuCacheSizeLimitIsMax );
+    INFO_PRINTF4( _L("Initial iMaxCacheSizeInBytes %d iCacheSizeInBytes %d iGpuCacheSizeLimitIsMax %d "),
+                      initialGlyphCacheMetrics.iMaxCacheSizeInBytes,
+                      initialGlyphCacheMetrics.iCacheSizeInBytes,
+                      initialGlyphCacheMetrics.iGpuCacheSizeLimitIsMax );
+
+
+    TRAP( err, UseGpuL() ); // Populate the glyph cache then acquire its usage metrics.
+    if( KErrNone != err )
+        {
+        TEST( KErrNone == err );
+        INFO_PRINTF2( _L("UseGpuL() left with %d"), err );
+
+        goto CleanupAndGo;
+        }
+
+
+    TGlyphCacheMetrics usageGlyphCacheMetrics;
+    err = RFbsSession::GetSession()->GetGlyphCacheMetrics( usageGlyphCacheMetrics );
+    if( KErrNone != err )
+        {
+		TEST( KErrNone == err );
+		INFO_PRINTF2( _L("GetGlyphCacheMetrics() returned %d"), err );
+
+        goto CleanupAndGo;
+        }
+
+    // Check that the glyph cache has been populated
+    TEST( usageGlyphCacheMetrics.iCacheSizeInBytes > initialGlyphCacheMetrics.iCacheSizeInBytes);
+    TEST( usageGlyphCacheMetrics.iGpuCacheSizeLimitIsMax );
+    INFO_PRINTF4( _L("Usage iMaxCacheSizeInBytes %d iCacheSizeInBytes %d iGpuCacheSizeLimitIsMax %d "),
+                       usageGlyphCacheMetrics.iMaxCacheSizeInBytes,
+                       usageGlyphCacheMetrics.iCacheSizeInBytes,
+                       usageGlyphCacheMetrics.iGpuCacheSizeLimitIsMax );
+
+
+
+    // Precipitate the GOoM framework's call into the Plug-in's FreeRam() method.
+    err = FillGraphicsMemoryWithImages( TSize(KTFbsOogmImageSizeX, KTFbsOogmImageSizeY), sgImageArray );
+    if( KErrNoGraphicsMemory != err )
+        {
+		TEST( KErrNoGraphicsMemory == err );
+		INFO_PRINTF2( _L("FillGraphicsMemoryWithImages() returned %d"), err );
+
+        goto CleanupAndGo;
+        }
+
+	// Await the GOOM framework's call into FbServ's OoGM plugin,
+    // then establish the cache's usage and other metrics.
+    User::After( KTFbsOogmFrameworkPause );
+    TGlyphCacheMetrics postOogmGlyphCacheMetrics;
+    err = RFbsSession::GetSession()->GetGlyphCacheMetrics( postOogmGlyphCacheMetrics );
+
+    if( KErrNone != err )
+        {
+		TEST( KErrNone == err );
+		INFO_PRINTF2( _L("GetGlyphCacheMetrics() returned %d"), err );
+
+        goto CleanupAndGo;
+        }
+
+    // The cache should have been cleared and the maximum size limit reduced.
+    TEST( 0 == postOogmGlyphCacheMetrics.iCacheSizeInBytes );
+    TEST( !postOogmGlyphCacheMetrics.iGpuCacheSizeLimitIsMax );
+    INFO_PRINTF4( _L("Post-Oogm iMaxCacheSizeInBytes %d iCacheSizeInBytes %d iGpuCacheSizeLimitIsMax %d "),
+                        postOogmGlyphCacheMetrics.iMaxCacheSizeInBytes,
+                        postOogmGlyphCacheMetrics.iCacheSizeInBytes,
+                        postOogmGlyphCacheMetrics.iGpuCacheSizeLimitIsMax );
+
+
+
+   // Remove the images. This should provoke a GOoM monitor call into the plug-in's MemoryGood().
+    for ( TInt i = sgImageArray.Count()-1; i >= 0; --i )
+        {
+        sgImageArray[i].Close();
+        }
+    sgImageArray.Reset();
+
+    // Await activity from the GOoM monitor
+    User::After( KTFbsOogmFrameworkPause );
+    TGlyphCacheMetrics reinstatedGlyphCacheMetrics;
+    err = RFbsSession::GetSession()->GetGlyphCacheMetrics( reinstatedGlyphCacheMetrics );
+    if( KErrNone != err )
+        {
+        TEST( KErrNone == err );
+        INFO_PRINTF2( _L("GetGlyphCacheMetrics() returned error %d"), err );
+
+        goto CleanupAndGo;
+        }
+
+    // Cache size limit should have been increased
+    TEST( reinstatedGlyphCacheMetrics.iGpuCacheSizeLimitIsMax );
+    INFO_PRINTF4( _L("After Mem Clear iMaxCacheSizeInBytes %d iCacheSizeInBytes %d iGpuCacheSizeLimitIsMax %d "),
+                      reinstatedGlyphCacheMetrics.iMaxCacheSizeInBytes,
+                      reinstatedGlyphCacheMetrics.iCacheSizeInBytes,
+                      reinstatedGlyphCacheMetrics.iGpuCacheSizeLimitIsMax );
+
+
+
+  CleanupAndGo:
+    // Release any images before closing the array.
+    // If the test was successful this should already be empty.
+    for (TInt i = sgImageArray.Count()-1; i >= 0; --i)
+        {
+        sgImageArray[i].Close();
+        }
+
+    // Allow GOoM to make any pending adjustments before proceeding with any further tests.
+    User::After( KTFbsOogmFrameworkPause );
+    sgImageArray.Close();
+    sgDriver.Close();
+
+    __UHEAP_MARKEND;
+    }
+
+
+
+CTFbsOogm::CTFbsOogm( CTestStep* aStep )
+: CTGraphicsBase(aStep)
+    {
+    }
+
+
+
+const TInt KNumGlyphCodesLatin = 96;
+/*
+ Lookup table to convert from ascii code to
+glyph code for the Deja Vu family of fonts.
+ */
+const TUint DejaVuASCIIToGlyphCode[] =
+    {
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 3, 4, 5, 6, 7, 8, 9, 10,
+    11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+    21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+    31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+    41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+    51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
+    61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
+    71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
+    81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
+    91, 92, 93, 94, 95, 96, 97, 98,
+    };
+
+
+
+void CTFbsOogm::ConstructL()
+    {
+    }
+
+
+CTFbsOogm::~CTFbsOogm()
+    {
+    RFbsSession::Disconnect();
+    }
+
+
+
+/**
+ Utility function to fill the GPU memory.
+ */
+TInt CTFbsOogm::FillGraphicsMemoryWithImages( const TSize& aSize, RArray<RSgImage>& aImages )
+    {
+    TInt err = KErrNone;
+
+    // Loop should terminate with KErrNoGraphicsMemory
+    while( KErrNone == err )
+        {
+        RSgImage sgImage;
+        err = sgImage.Create( TSgImageInfo(aSize, ESgPixelFormatA_8, ESgUsageBitOpenVgImage) );
+        if( KErrNone == err )
+            {
+            err = aImages.Append( sgImage );
+            }
+        }
+
+    INFO_PRINTF2( _L("Images created %d"), aImages.Count() );
+    return err;
+    }
+
+
+
+/**
+ Utility function to populate the GPU with typeface glyphs.
+ */
+void CTFbsOogm::UseGpuL()
+    {
+    _LIT( KTKASTypefaceName, "DejaVu Sans Condensed" );
+
+    // Need to open one of these "in the context" of this process in order
+    // to manipulate RSgImages. Even though we are only calling 'Open', 'Next' and 'Close' on
+    // RFbsGlyphDataIterator
+    RSgDriver sgDriver;
+    User::LeaveIfError( sgDriver.Open() );
+
+    // CFbsTypefaceStore seems to need an fbserv session open.
+    if( (NULL == RFbsSession::GetSession()) )
+     {
+     User::LeaveIfError( RFbsSession::Connect() );
+     }
+
+    TUint* glyphCodesLatin = new(ELeave) TUint[ KNumGlyphCodesLatin ];
+
+    for ( TInt ii = 0; ii < KNumGlyphCodesLatin; ++ii )
+        {
+        TUint asciiCode = ii+0x20; // ASCII characters from 0020 to 007F
+        glyphCodesLatin[ii] = DejaVuASCIIToGlyphCode[asciiCode];
+        }
+
+    iTs = ( CFbsTypefaceStore* )CFbsTypefaceStore::NewL( NULL );
+    User::LeaveIfError( iTs->GetNearestFontToDesignHeightInPixels((CFont*&)iFont, TFontSpec(KTKASTypefaceName, 15)) );
+
+    TInt iterErr = KErrNone;
+    TInt iterNextErr = KErrNone;
+
+    for( TInt arraySize = 1; (arraySize < KNumGlyphCodesLatin) && (iterErr == KErrNone); ++arraySize )
+        {
+        RFbsGlyphDataIterator iter;
+        iterErr = iter.Open( *iFont, glyphCodesLatin, arraySize );
+
+        if( KErrNone != iterErr )
+            {
+            continue;
+            }
+
+          for ( TInt index = 0; KErrNone == iterNextErr; iterNextErr = iter.Next(), ++index )
+              {
+              // Iterating through the glyphs should introduce them into the cache
+             if(iter.GlyphCode() != glyphCodesLatin[index])
+                {
+                 INFO_PRINTF4( _L("Wanted glyphcode %d, got %d"), arraySize, glyphCodesLatin[index], iter.GlyphCode() );
+                }
+              }
+
+        iterNextErr = KErrNone;
+        iter.Close();
+        }
+
+    sgDriver.Close();
+    }
+
+
+__CONSTRUCT_STEP__( FbsOogm )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/tfbs/tfbsoogm.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,75 @@
+// Copyright (c) 2009-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 TFBSOOGM_H
+#define TFBSOOGM_H
+#include <EGL/egl.h>
+
+#include <e32cmn.h>
+#include <EGL/eglext.h>
+#include <VG/openvg.h>
+#include <sgresource/sgresource.h>
+#include <sgresource/sgimage.h>
+#include <graphics/fbsglyphdataiterator.h>
+#include "FbsMessage.h"
+
+#include "test/TGraphicsHarness.h"
+
+
+/**
+Test class for the GPU 'Out of Graphics Memory' (OoGM) plug-in
+
+Hardware only as the GoomMonitor framework does not operate under WINSCW
+*/
+class CTFbsOogm : public CTGraphicsBase
+    {
+public:
+    CTFbsOogm( CTestStep* aStep );
+    ~CTFbsOogm();
+protected:
+    //from  CTGraphicsBase
+    virtual void RunTestCaseL( TInt aCurTestCase );
+    void ConstructL();
+
+private:
+    // Test Cases
+    void CacheClearanceAndLimitAdjustments();
+
+private:
+    void UseGpuL();
+    TInt FillGraphicsMemoryWithImages( const TSize& aSize, RArray<RSgImage>& aImages );
+
+private:
+    CFbsFont* iFont;
+    CFbsTypefaceStore* iTs;
+    };
+
+
+
+class CTFbsOogmStep : public CTGraphicsStep
+    {
+public:
+    CTFbsOogmStep();
+
+protected:
+    //from CTGraphicsStep
+    virtual CTGraphicsBase* CreateTestL();
+    };
+
+_LIT( KTFbsOogmStep,"TFbsOogm" );
+
+
+
+#endif // TFBSOOGM_H
--- a/fbs/fontandbitmapserver/tfbs/tfonttableandglyph.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/tfonttableandglyph.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2009-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"
@@ -17,7 +17,7 @@
 #define TFONTTABLEANDGLYPH_H_
 
 #include <gdi.h>
-#include "TGraphicsHarness.h"
+#include "test/TGraphicsHarness.h"
 
 class CTFontAndGlyphStep : public CTGraphicsStep
     {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/tfbs/tglyphatlas.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,284 @@
+// Copyright (c) 2009-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:
+//
+
+/**
+ @file
+ @internalComponent - Internal Symbian test code
+*/
+
+#include "tglyphatlas.h"
+#include "TFBS.H"
+#include "glyphatlastestwrapper.h"
+
+_LIT(KTypefaceName, "DejaVu Sans Condensed");
+_LIT(KMonoTypefaceName, "DejaVu Sans Mono");
+const TInt KNumGlyphCodesLatin = 96;
+
+
+CTGlyphAtlas::CTGlyphAtlas(CTestStep* aStep):
+	CTGraphicsBase(aStep),
+	iFbs(NULL),
+	iTs(NULL),
+	iGlyphCodesLatin(NULL),
+	iFont(NULL)
+	{
+	}
+
+void CTGlyphAtlas::ConstructL()
+	{
+	iFbs = RFbsSession::GetSession();
+	iTs = (CFbsTypefaceStore*)CFbsTypefaceStore::NewL(NULL);
+	User::LeaveIfError(iTs->GetNearestFontToDesignHeightInPixels((CFont*&)iFont, TFontSpec(KTypefaceName, 15)));
+	User::LeaveIfError(iTs->GetNearestFontToDesignHeightInPixels((CFont*&)iFont2, TFontSpec(KMonoTypefaceName, 8)));
+	
+	iGlyphCodesLatin = new(ELeave) TUint[KNumGlyphCodesLatin];
+	for (TInt ii = 0; ii < KNumGlyphCodesLatin; ++ii)
+		{
+		iGlyphCodesLatin[ii] = ii+32; // ASCII characters from 0020 to 007F
+		}
+
+	INFO_PRINTF1(_L("FBSERV Glyph Atlas Testing"));
+	}
+
+CTGlyphAtlas::~CTGlyphAtlas()
+	{
+	if (iTs)
+		{
+		iTs->ReleaseFont(iFont);
+		}
+	delete iTs;
+	delete[] iGlyphCodesLatin;
+	}
+
+void CTGlyphAtlas::RunTestCaseL(TInt aCurTestCase)
+	{
+	((CTGlyphAtlasStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
+	switch(aCurTestCase)
+		{
+	case 1:
+		((CTGlyphAtlasStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0663"));
+		TestFullCache();
+		break;
+	case 2:
+		((CTGlyphAtlasStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0664"));
+		TestFontReleased();
+		break;
+	default:
+		((CTGlyphAtlasStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
+		((CTGlyphAtlasStep*)iStep)->CloseTMSGraphicsStep();
+		TestComplete();		
+		break;
+		}
+	((CTGlyphAtlasStep*)iStep)->RecordTestResultL();
+	}
+
+/**
+@SYMTestCaseID		GRAPHICS-FBSERV-0663
+@SYMTestPriority	High
+@SYMTestType		UT
+@SYMTestStatus		Implemented
+@SYMPREQ			PREQ2678
+
+@SYMTestCaseDesc
+	Shows that when the glyph atlas reaches its memory limit, any new added 
+	glyphs will cause the eviction of the least recently used glyphs.
+	The new glyph will be added successfully.
+
+@SYMTestActions
+	i. Create a glyph atlas with a memory limit of 1000 bytes.
+	ii. Add glyphs to the atlas such that its memory consumption reaches the limit.
+	iii. Add one more glyph.
+	iv. Call CGlyphAtlas::GetGlyph() for the last glyph added.
+	v. Call CGlyphAtlas::GetGlyph() for the least recently used glyphs to check 
+		that it has been evicted.
+	vi. Delete glyph atlas
+
+@SYMTestExpectedResults
+	Each glyph is added successfully.
+	CGlyphAtlas::GetGlyph() returns KErrNone for the last glyph added.
+	CGlyphAtlas::GetGlyph() returns KErrNotFound for the least recently used glyph.
+*/
+void CTGlyphAtlas::TestFullCache()
+	{
+	INFO_PRINTF1(_L("Test full cache eviction"));
+
+	__UHEAP_MARK;
+	// Fill cache up using expected size of glyph using AddGlyph.
+	const TInt KMaxAtlasSizeInBytes = 1000;
+	CGlyphAtlasTestWrapper* atlas = NULL;
+	TRAPD(ret, atlas = CGlyphAtlasTestWrapper::NewL(KMaxAtlasSizeInBytes));
+	TESTNOERROR(ret);
+	if (KErrNone != ret)
+		{
+		return;
+		}
+	TOpenFontCharMetrics charMetrics;
+	TGlyphImageInfo imageInfo;
+	TSize bitmapSize;
+	const TUint8* bitmapData = NULL;
+	TInt glyphIndex = 0;
+	TBool atlasFull = EFalse;
+	CBitmapFont* bmFont = CTFbsFont::FontAddress(iFont);
+	// Fill up atlas by adding glyphs.
+	// Next glyph shold tip the atlas over the memory limit.
+	// Glyphs are added in ascending glyph code order.
+	// Leave at least one glyph so that we can guarantee that we can add one more unique glyph.
+	while (glyphIndex < KNumGlyphCodesLatin-1 && !atlasFull)
+		{
+		iFont->GetCharacterData(iGlyphCodesLatin[glyphIndex], charMetrics, bitmapData, bitmapSize);
+		TInt sizeInBytes = charMetrics.Height() * charMetrics.Width();
+		if (atlas->SizeInBytes() + sizeInBytes <= KMaxAtlasSizeInBytes)
+			{
+			CGlyphAtlas::TAddGlyphArgs args(bitmapData, iGlyphCodesLatin[glyphIndex++], charMetrics);
+			TESTNOERROR(atlas->AddGlyph(*bmFont, args, imageInfo));
+			}
+		else
+			{
+			atlasFull = ETrue;
+			}
+		}
+	TEST(atlasFull);
+
+	// check least recently used page contains the first glyph in glyph codes
+	TUint leastUsedGlyphCode = iGlyphCodesLatin[0];
+	TEST(atlas->LruPageContainsGlyph(leastUsedGlyphCode));
+
+	// To ensure that the test does not pass if a FIFO eviction policy occurs,
+	// get the least recently used glyph so that it is moved internally.
+	TESTNOERROR(atlas->GetGlyph(*bmFont, leastUsedGlyphCode, imageInfo));
+
+	// glyphIndex, bitmapData and charMetrics now current for next glyph which 
+	// will take the atlas over the cache limit.
+	CGlyphAtlas::TAddGlyphArgs args(bitmapData, iGlyphCodesLatin[glyphIndex], charMetrics);
+	TESTNOERROR(atlas->AddGlyph(*bmFont, args, imageInfo));
+
+	// check that searching for most recently added glyph is successful
+	TGlyphImageInfo newInfo;
+	TESTNOERROR(atlas->GetGlyph(*bmFont, iGlyphCodesLatin[glyphIndex], newInfo));
+
+	// check atlas size is still under the limit
+	TEST(atlas->SizeInBytes() <= KMaxAtlasSizeInBytes);
+
+	// check that the pages which were evicted contained the least used glyphs
+	// i.e. searching for these returns KErrNotFound
+	TInt err = KErrNotFound;
+	TInt index = 1;
+	for (; KErrNotFound == err && index <= glyphIndex; ++index)
+		{
+		err = atlas->GetGlyph(*bmFont, iGlyphCodesLatin[index], newInfo);
+		}
+	TESTNOERROR(err);
+	// first found glyph should be greater than glyph at index 1
+	TEST(index-1 > 1);
+	
+	// check that the remaining pages contained the least used glyphs
+	for (; index <= glyphIndex; ++index)
+		{
+		TESTNOERROR(atlas->GetGlyph(*bmFont, iGlyphCodesLatin[index], newInfo));
+		}
+
+	delete atlas;
+	__UHEAP_MARKEND;
+	}
+
+
+/**
+@SYMTestCaseID		GRAPHICS-FBSERV-0664
+@SYMTestPriority	High
+@SYMTestType		UT
+@SYMTestStatus		Implemented
+@SYMPREQ			PREQ2678
+
+@SYMTestCaseDesc
+	Shows that CGlyphAtlas::FontReleased() does actually delete all the glyphs 
+	associated with the released font and leaves glyphs associated with other 
+	fonts untouched.
+
+@SYMTestActions
+	i. Create a glyph atlas with no memory limit.
+	ii. Add glyphs for two different fonts to the atlas.
+	iii. Check all glyphs for both fonts were successfully added.
+	iv. Call CGlyphAtlas::ReleaseFont for one of the fonts.
+	v. Check that there are no glyphs associated with the released font.
+	vi. Call CGlyphAtlas::ReleaseFont for the remaining font.
+	vii Check that there are no glyphs associated with the released font and 
+		that the atlas is empty.
+	viii Delete the glyph atlas.
+	
+@SYMTestExpectedResults
+	After each font is released, there are no glyphs associated with that font 
+	left in the atlas.
+*/
+void CTGlyphAtlas::TestFontReleased()
+	{
+	INFO_PRINTF1(_L("Test behaviour of CGlyphAtlas::FontReleased()"));
+
+	__UHEAP_MARK;
+	CGlyphAtlasTestWrapper* atlas = NULL;
+	TRAPD(ret, atlas = CGlyphAtlasTestWrapper::NewL(KGlyphAtlasNoCacheLimit));
+	TESTNOERROR(ret);
+	if (KErrNone != ret)
+		{
+		return;
+		}
+	TOpenFontCharMetrics charMetrics;
+	TGlyphImageInfo imageInfo;
+	TSize bitmapSize;
+	const TUint8* bitmapData = NULL;
+	CBitmapFont* bmFont = CTFbsFont::FontAddress(iFont);
+	CBitmapFont* bmFont2 = CTFbsFont::FontAddress(iFont2);
+	for (TInt glyphIndex = 0; glyphIndex < KNumGlyphCodesLatin; ++glyphIndex)
+		{
+		iFont->GetCharacterData(iGlyphCodesLatin[glyphIndex], charMetrics, bitmapData, bitmapSize);
+		CGlyphAtlas::TAddGlyphArgs args(bitmapData, iGlyphCodesLatin[glyphIndex], charMetrics);
+		TESTNOERROR(atlas->AddGlyph(*bmFont, args, imageInfo));
+
+		iFont2->GetCharacterData(iGlyphCodesLatin[KNumGlyphCodesLatin-1-glyphIndex], charMetrics, bitmapData, bitmapSize);
+		CGlyphAtlas::TAddGlyphArgs args2(bitmapData, iGlyphCodesLatin[glyphIndex], charMetrics);
+		TESTNOERROR(atlas->AddGlyph(*bmFont2, args2, imageInfo));
+		}
+	// check there are font entries for these 2 fonts
+	TEST(2 == atlas->FontCount());
+
+	// check actual number of glyphs in atlas for each font is as expected
+	TEST(KNumGlyphCodesLatin == atlas->GlyphCountByFont(bmFont));
+	TEST(KNumGlyphCodesLatin == atlas->GlyphCountByFont(bmFont2));
+	TEST(2*KNumGlyphCodesLatin == atlas->GlyphCount());
+
+	// release one font and check number of glyphs in atlas for each font 
+	// is as expected
+	atlas->FontReleased(*bmFont);
+	TEST(1 == atlas->FontCount());
+	TEST(0 == atlas->GlyphCountByFont(bmFont));
+	TEST(KNumGlyphCodesLatin == atlas->GlyphCountByFont(bmFont2));
+	TEST(KNumGlyphCodesLatin == atlas->GlyphCount());
+
+	// release one font and check number of glyphs in atlas for each font 
+	// is as expected
+	atlas->FontReleased(*bmFont2);
+	TEST(0 == atlas->FontCount());
+	TEST(0 == atlas->GlyphCountByFont(bmFont));
+	TEST(0 == atlas->GlyphCountByFont(bmFont2));
+	TEST(0 == atlas->GlyphCount());
+
+	delete atlas;
+
+	__UHEAP_MARKEND;
+	}
+
+
+
+//--------------
+__CONSTRUCT_STEP__(GlyphAtlas)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/tfbs/tglyphatlas.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,60 @@
+// Copyright (c) 2009-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 TGLYPHATLAS_H
+#define TGLYPHATLAS_H
+
+#include "test/TGraphicsHarness.h"
+
+/**
+Test class for the glyph data extensions RFbsGlyphDataIterator and 
+RFbsGlyphMetricsArray. Positive and negative tests
+*/
+class CTGlyphAtlas : public CTGraphicsBase
+	{
+public:
+	CTGlyphAtlas(CTestStep* aStep);
+	~CTGlyphAtlas();
+protected:
+//from 	CTGraphicsBase
+	virtual void RunTestCaseL(TInt aCurTestCase);
+	void ConstructL();
+	
+private:
+	// Test Cases
+	void TestFullCache();
+	void TestFontReleased();
+	
+private:
+	RFbsSession* iFbs;
+	CFbsTypefaceStore* iTs;
+	TUint* iGlyphCodesLatin;
+	CFbsFont* iFont;
+	CFbsFont* iFont2;
+	};
+
+
+class CTGlyphAtlasStep : public CTGraphicsStep
+	{
+public:
+	CTGlyphAtlasStep();
+protected:	
+	//from CTGraphicsStep
+	virtual CTGraphicsBase* CreateTestL();
+	};
+
+_LIT(KTGlyphAtlasStep,"TGlyphAtlas");
+
+#endif /* TGLYPHATLAS_H */
--- a/fbs/fontandbitmapserver/tfbs/tipctest.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/tipctest.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -13,10 +13,10 @@
 // Description:
 //
 
-#include "fbsmessage.h"
 #include "../sfbs/UTILS.H"
 #include "tipctest.h"
 #include "fbsdefs.h"
+#include "fbsmessage.h"
 
 // Invalid parameters to be passed in SendCommand() calls.
 const TInt KInvalidParam1 = 963955448;
@@ -75,59 +75,6 @@
 	
 	}
 
-/**
-	@SYMTestCaseID
-	GRAPHICS-FBSERV-0603
-
-	@SYMTestCaseDesc
-	Tests the sending of commands to a FbsSession 
-	server thru Inter Process Communication. Sends
-	both valid and invalid commands.
-
-	@SYMTestActions
-	Commands sent to the server:
-	1. EFbsMessShutdown
-	2. EFbsMessFontHeightInTwips
-	3. EFbsMessFontHeightInTwips
-	4. EFbsMessFontHeightInPixels
-	5. EFbsMessFontHeightInPixels
-	6. EFbsMessAddFontStoreFile
-	7. EFbsMessAddFontStoreFile
-	8. EFbsMessInstallFontStoreFile
-	9. EFbsMessInstallFontStoreFile
-	10. EFbsMessInstallFontStoreFile
-	11. EFbsMessBitmapCreate
-	12. EFbsMessRasterize
-	13. EFbsMessFaceAttrib
-	14. EFbsMessHasCharacter
-	15. EFbsMessFontNameAlias
-	16. EFbsMessGetNearestFontToDesignHeightInTwips
-	17. EFbsMessGetNearestFontToMaxHeightInTwips
-	18. EFbsMessGetNearestFontToDesignHeightInPixels
-	19. EFbsMessGetNearestFontToMaxHeightInPixels
-	20. EFbsMessShapeText
-	21. EFbsMessShapeDelete
-	22. EFbsMessSetTwipsHeight
-	23. EFbsMessGetTwipsHeight	
-	@SYMTestExpectedResults
-    Test should pass
-
-    @SYMTestCaseID
-    TI18N-GDI-CIT-4086
-
-    @SYMTestCaseDesc
-    Test if FBS can handle invalid messages correctly
-    and panic the client as needed.
-
-    @SYMTestActions
-	24. EFbsMessGetFontTable
-	25. EFbsMessReleaseFontTable
-	26. EFbsMessGetGlyphOutline
-	27.EFbsMessReleaseGlyphOutline
-	
-	@SYMTestExpectedResults
-	Test should pass
-*/
 void CTIPCTest::RunTestCaseL(TInt aCurTestCase)
 	{
 	_LIT(KCaseNumber, "CaseNumber");
@@ -141,172 +88,254 @@
 		
 	switch(aCurTestCase)
 		{
+	/**
+		@SYMTestCaseID
+		GRAPHICS-FBSERV-0603
+
+		@SYMTestCaseDesc
+		Tests the sending of commands to a FbsSession 
+		server thru Inter Process Communication. Sends
+		both valid and invalid commands.
+
+		@SYMTestActions
+		Commands sent to the server:
+		1. EFbsMessShutdown
+		2. EFbsMessFontHeightInTwips
+		3. EFbsMessFontHeightInTwips
+		4. EFbsMessFontHeightInPixels
+		5. EFbsMessFontHeightInPixels
+		6. EFbsMessAddFontStoreFile
+		7. EFbsMessAddFontStoreFile
+		8. EFbsMessInstallFontStoreFile
+		9. EFbsMessInstallFontStoreFile
+		10. EFbsMessInstallFontStoreFile
+		11. EFbsMessBitmapCreate
+		12. EFbsMessRasterize
+		13. EFbsMessFaceAttrib
+		14. EFbsMessHasCharacter
+		15. EFbsMessFontNameAlias
+		16. EFbsMessGetNearestFontToDesignHeightInTwips
+		17. EFbsMessGetNearestFontToMaxHeightInTwips
+		18. EFbsMessGetNearestFontToDesignHeightInPixels
+		19. EFbsMessGetNearestFontToMaxHeightInPixels
+		20. EFbsMessShapeText
+		21. EFbsMessShapeDelete
+		22. EFbsMessSetTwipsHeight
+		23. EFbsMessGetTwipsHeight
+		
+		@SYMTestExpectedResults
+		Test should pass
+	*/
 	case 1:
-		INFO_PRINTF1(_L("Shutdown\r\n"));
+		INFO_PRINTF1(_L("Shutdown"));
 		iFbs->SendCommand(EFbsMessShutdown);
 		TestComplete();
 		break;
 	case 2:
-		INFO_PRINTF1(_L("Height in twips with negative typeface index\r\n"));
+		INFO_PRINTF1(_L("Height in twips with negative typeface index"));
 		iFbs->SendCommand(EFbsMessFontHeightInTwips, -1);	
 		TEST(EFalse); // Previous line should have paniced 
 		TestComplete();
 		break;	
 	case 3:
-		INFO_PRINTF1(_L("Height in twips with invalid size\r\n"));
+		INFO_PRINTF1(_L("Height in twips with invalid size"));
 		iClient.SendInvalidSize(EFbsMessFontHeightInTwips);
 		TEST(EFalse);
 		TestComplete();
 		break;
 	case 4:
-		INFO_PRINTF1(_L("Height in pixels with negative typeface index\r\n"));
+		INFO_PRINTF1(_L("Height in pixels with negative typeface index"));
 		iFbs->SendCommand(EFbsMessFontHeightInPixels, -1);
 		TEST(EFalse);
 		TestComplete();
 		break;
 	case 5:
-		INFO_PRINTF1(_L("Height in pixels with invalid size\r\n"));
+		INFO_PRINTF1(_L("Height in pixels with invalid size"));
 		iClient.SendInvalidSize(EFbsMessFontHeightInPixels);
 		TEST(EFalse);
 		TestComplete();
 		break;
 	case 6:
-		INFO_PRINTF1(_L("Add font store file with negative length\r\n"));
+		INFO_PRINTF1(_L("Add font store file with negative length"));
 		iFbs->SendCommand(EFbsMessAddFontStoreFile, 0, -1);
 		TEST(EFalse);
 		TestComplete();
 		break;
 	case 7:
-		INFO_PRINTF1(_L("Add font store file with huge length\r\n"));
+		INFO_PRINTF1(_L("Add font store file with huge length"));
 		iFbs->SendCommand(EFbsMessAddFontStoreFile, KInvalidParam1, KInvalidParam2, KInvalidParam3, KInvalidParam4);
 		TEST(EFalse);
 		TestComplete();
 		break;
 	case 8:
-		INFO_PRINTF1(_L("Install font store file with negative length\r\n"));
+		INFO_PRINTF1(_L("Install font store file with negative length"));
 		iFbs->SendCommand(EFbsMessInstallFontStoreFile, 0, -1);
 		TEST(EFalse);
 		TestComplete();
 		break;
 	case 9:
-		INFO_PRINTF1(_L("Install font store file with huge length\r\n"));
+		INFO_PRINTF1(_L("Install font store file with huge length"));
 		iFbs->SendCommand(EFbsMessInstallFontStoreFile, KInvalidParam1, KInvalidParam2, KInvalidParam3, KInvalidParam4);
 		TEST(EFalse);
 		TestComplete();
 		break;
 	case 10:
-		INFO_PRINTF1(_L("Remove font store file with active references\r\n"));
+		INFO_PRINTF1(_L("Remove font store file with active references"));
 		iFbs->SendCommand(EFbsMessRemoveFontStoreFile, 11);
 		// With PDEF121246 (INC120690) fix in place, this test will always pass. Without the fix there will be a KERN 4 panic.
 		TEST(ETrue); 
 		TestComplete();
 		break;
 	case 11:
-		INFO_PRINTF1(_L("Bitmap create with invalid display mode\r\n"));
+		INFO_PRINTF1(_L("Bitmap create with invalid display mode"));
 		iClient.SendInvalidDisplayMode(EFbsMessBitmapCreate);
 		TEST(EFalse);
 		TestComplete();
 		break;
 	case 12:
-		INFO_PRINTF1(_L("Rasterize with invalid bitmap handle\r\n"));
+		INFO_PRINTF1(_L("Rasterize with invalid bitmap handle"));
 		iFbs->SendCommand(EFbsMessRasterize, KInvalidParam1, KInvalidParam2, KInvalidParam3, KInvalidParam4);
 		TEST(EFalse);
 		TestComplete();
 		break;
 	case 13:
-		INFO_PRINTF1(_L("Face Attribute with invalid bitmap handle\r\n"));
+		INFO_PRINTF1(_L("Face Attribute with invalid bitmap handle"));
 		iFbs->SendCommand(EFbsMessFaceAttrib, KInvalidParam1, KInvalidParam2, KInvalidParam3, KInvalidParam4);
 		TEST(EFalse);
 		TestComplete();
 		break;
 	case 14:
-		INFO_PRINTF1(_L("Has Character with invalid bitmap handle\r\n"));
+		INFO_PRINTF1(_L("Has Character with invalid bitmap handle"));
 		iFbs->SendCommand(EFbsMessHasCharacter, KInvalidParam1, KInvalidParam2, KInvalidParam3, KInvalidParam4);
 		TEST(EFalse);
 		TestComplete();
 		break;
 	case 15:
-		INFO_PRINTF1(_L("Name Alias with huge alias name length\r\n"));
+		INFO_PRINTF1(_L("Name Alias with huge alias name length"));
 		iFbs->SendCommand(EFbsMessFontNameAlias, KInvalidParam1, KInvalidParam2, KInvalidParam3, KInvalidParam4);
 		TEST(EFalse);
 		TestComplete();
 		break;
 	case 16:
-		INFO_PRINTF1(_L("Get nearest font to design height in twips with invalid typeface name length\r\n"));
+		INFO_PRINTF1(_L("Get nearest font to design height in twips with invalid typeface name length"));
 		iClient.SendInvalidNameLength(EFbsMessGetNearestFontToDesignHeightInTwips);
 		TEST(EFalse);
 		TestComplete();
 		break;
 	case 17:
-		INFO_PRINTF1(_L("Get nearest font to max height in twips with invalid typeface name length\r\n"));
+		INFO_PRINTF1(_L("Get nearest font to max height in twips with invalid typeface name length"));
 		iClient.SendInvalidNameLength(EFbsMessGetNearestFontToMaxHeightInTwips);
 		TEST(EFalse);
 		TestComplete();
 		break;
 	case 18:
-		INFO_PRINTF1(_L("Get nearest font to design height in pixels with invalid typeface name length\r\n"));
+		INFO_PRINTF1(_L("Get nearest font to design height in pixels with invalid typeface name length"));
 		iClient.SendInvalidNameLength(EFbsMessGetNearestFontToDesignHeightInPixels);
 		TEST(EFalse);
 		TestComplete();
 		break;
 	case 19:
-		INFO_PRINTF1(_L("Get nearest font to max height in pixels with invalid typeface name length\r\n"));
+		INFO_PRINTF1(_L("Get nearest font to max height in pixels with invalid typeface name length"));
 		iClient.SendInvalidNameLength(EFbsMessGetNearestFontToMaxHeightInPixels);
 		TEST(EFalse);
 		TestComplete();
 		break;
 	case 20:
-		INFO_PRINTF1(_L("Shape text with invalid bitmap font handle\r\n"));
+		INFO_PRINTF1(_L("Shape text with invalid bitmap font handle"));
 		iFbs->SendCommand(EFbsMessShapeText, KInvalidParam1, KInvalidParam2, KInvalidParam3, KInvalidParam4);
 		TEST(EFalse);
 		TestComplete();
 		break;
 	case 21:
-		INFO_PRINTF1(_L("Shape delete with invalid bitmap font handle\r\n"));
+		INFO_PRINTF1(_L("Shape delete with invalid bitmap font handle"));
 		iFbs->SendCommand(EFbsMessShapeDelete, KInvalidParam1, KInvalidParam2, KInvalidParam3, KInvalidParam4);
 		TEST(EFalse);
 		TestComplete();
 		break;
 	case 22:
-		INFO_PRINTF1(_L("Set twips height with invalid font handle\r\n"));
+		INFO_PRINTF1(_L("Set twips height with invalid font handle"));
 		iFbs->SendCommand(EFbsMessSetTwipsHeight, KInvalidParam1, KInvalidParam2, KInvalidParam3, KInvalidParam4);
 		TEST(EFalse);
 		TestComplete();
 		break;
 	case 23:
-		INFO_PRINTF1(_L("Get twips height with invalid font handle\r\n"));
-		((CTIPCTestStep*)iStep)->SetOverallTestStepID(_L("GRAPHICS-FBSERV-0603"));
-		((CTIPCTestStep*)iStep)->RecordTestResultL();
-		((CTIPCTestStep*)iStep)->CloseTMSGraphicsStep();
+		INFO_PRINTF1(_L("Get twips height with invalid font handle"));
 		iFbs->SendCommand(EFbsMessGetTwipsHeight, KInvalidParam1, KInvalidParam2, KInvalidParam3, KInvalidParam4);
 		TEST(EFalse);
 		TestComplete();
 		break;	
 	case 24:
-		INFO_PRINTF1(_L("Get Font Table with wrong msg\r\n"));
-		iFbs->SendCommand(EFbsMessGetFontTable, KInvalidParam1, KInvalidParam2, KInvalidParam3, KInvalidParam4);   
-		TEST(EFalse); 
+		/**
+			@SYMTestCaseID	GRAPHICS-FBSERV-0630
+
+			@SYMTestCaseDesc
+			Tests that invalid font handle to EFbsMessGetGlyphs causes panic
+
+			@SYMTestExpectedResults
+			Client should panic with FBSERV -8
+		*/
+		INFO_PRINTF1(_L("Get glyphs from glyph atlas with invalid font handle"));
+		iFbs->SendCommand(EFbsMessGetGlyphs, KInvalidParam1, KInvalidParam2, KInvalidParam3, KInvalidParam4);
+		TEST(EFalse);
 		TestComplete();
 		break;
 	case 25:
-		INFO_PRINTF1(_L("Release Font Table with wrong msg\r\n"));
-		iFbs->SendCommand(EFbsMessReleaseFontTable, KInvalidParam1, KInvalidParam2, KInvalidParam3, KInvalidParam4);   
-		TEST(EFalse); 
+		/**
+			@SYMTestCaseID	GRAPHICS-FBSERV-0670
+
+			@SYMTestCaseDesc
+			Tests that invalid font handle to EFbsMessGetGlyphMetrics causes panic
+
+			@SYMTestExpectedResults
+			Client should panic with FBSERV -8
+		*/
+		INFO_PRINTF1(_L("Get glyph metrics with invalid font handle"));
+		iFbs->SendCommand(EFbsMessGetGlyphMetrics, KInvalidParam1, KInvalidParam2, KInvalidParam3, KInvalidParam4);
+		TEST(EFalse);
 		TestComplete();
-		break;    
+		break;
+	/**
+		@SYMTestCaseID
+		TI18N-GDI-CIT-4086
+
+		@SYMTestCaseDesc
+		Test if FBS can handle invalid messages correctly
+		and panic the client as needed.
+
+		@SYMTestActions
+		26. EFbsMessGetFontTable
+		27. EFbsMessReleaseFontTable
+		28. EFbsMessGetGlyphOutline
+		29. EFbsMessReleaseGlyphOutline
+	
+		@SYMTestExpectedResults
+		Test should pass
+	*/
 	case 26:
-		INFO_PRINTF1(_L("Get Glyph outline with wrong msg\r\n"));
-		iFbs->SendCommand(EFbsMessGetGlyphOutline,KInvalidParam1, KInvalidParam2, KInvalidParam3, KInvalidParam4);   
+		INFO_PRINTF1(_L("Get Font Table with wrong msg"));
+		iFbs->SendCommand(EFbsMessGetFontTable, KInvalidParam1, KInvalidParam2, KInvalidParam3, KInvalidParam4);
 		TEST(EFalse); 
 		TestComplete();
 		break;
 	case 27:
-		INFO_PRINTF1(_L("Release Glyph outline with wrong msg\r\n"));
-		iFbs->SendCommand(EFbsMessReleaseGlyphOutline, KInvalidParam1, KInvalidParam2, KInvalidParam3, KInvalidParam4);   
+		INFO_PRINTF1(_L("Release Font Table with wrong msg"));
+		iFbs->SendCommand(EFbsMessReleaseFontTable, KInvalidParam1, KInvalidParam2, KInvalidParam3, KInvalidParam4);
 		TEST(EFalse); 
 		TestComplete();
 		break;
 	case 28:
+		INFO_PRINTF1(_L("Get Glyph outline with wrong msg"));
+		iFbs->SendCommand(EFbsMessGetGlyphOutline,KInvalidParam1, KInvalidParam2, KInvalidParam3, KInvalidParam4);
+		TEST(EFalse); 
+		TestComplete();
+		break;
+	case 29:
+		INFO_PRINTF1(_L("Release Glyph outline with wrong msg"));
+		iFbs->SendCommand(EFbsMessReleaseGlyphOutline, KInvalidParam1, KInvalidParam2, KInvalidParam3, KInvalidParam4);
+		TEST(EFalse); 
+		TestComplete();
+		break;
+	case 30:
 		TestComplete();
 		break;
 		}
--- a/fbs/fontandbitmapserver/tfbs/tipctest.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/tipctest.h	Tue Jul 20 13:27:44 2010 +0300
@@ -17,7 +17,7 @@
 #define __TIPCTest_H__
 
 #include <fbs.h>
-#include "TGraphicsHarness.h"
+#include "test/TGraphicsHarness.h"
 
 class RIPCTestFbservClient : public RSessionBase
 	{
--- a/fbs/fontandbitmapserver/tfbs/trfile.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/trfile.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -20,7 +20,7 @@
 
 #include <fbs.h>
 #include <bitstd.h>
-#include "TGraphicsHarness.h"
+#include "test/TGraphicsHarness.h"
 
 class CTFile : public CTGraphicsBase
 	{
--- a/fbs/fontandbitmapserver/tfbs/twdp.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/fbs/fontandbitmapserver/tfbs/twdp.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// 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"
@@ -17,7 +17,7 @@
 #define __TWDP_H__
 
 #include <fbs.h>
-#include "TGraphicsHarness.h"
+#include "test/TGraphicsHarness.h"
 
 class CTWDP : public CTGraphicsBase
 	{
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/traces/OstTraceDefinitions.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/traces/fixed_id.definitions	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,18 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_NORMAL=0x86
+[TRACE]TRACE_NORMAL[0x86]_CGLYPHATLAS_ADDGLYPH=0x4
+[TRACE]TRACE_NORMAL[0x86]_CGLYPHATLAS_ADDGLYPH_END1=0x7
+[TRACE]TRACE_NORMAL[0x86]_CGLYPHATLAS_ADDGLYPH_END2=0x5
+[TRACE]TRACE_NORMAL[0x86]_CGLYPHATLAS_ADDGLYPH_END3=0x6
+[TRACE]TRACE_NORMAL[0x86]_CGLYPHATLAS_DELETELEASTRECENTLYUSEDPAGE=0xb
+[TRACE]TRACE_NORMAL[0x86]_CGLYPHATLAS_DELETELEASTRECENTLYUSEDPAGE_END=0xc
+[TRACE]TRACE_NORMAL[0x86]_CGLYPHATLAS_FONTRELEASED=0x8
+[TRACE]TRACE_NORMAL[0x86]_CGLYPHATLAS_FONTRELEASED_END2=0x9
+[TRACE]TRACE_NORMAL[0x86]_CGLYPHATLAS_FONTRELEASED_END3=0xa
+[TRACE]TRACE_NORMAL[0x86]_CGLYPHATLAS_GETGLYPH=0x1
+[TRACE]TRACE_NORMAL[0x86]_CGLYPHATLAS_GETGLYPH_END1=0x3
+[TRACE]TRACE_NORMAL[0x86]_CGLYPHATLAS_GETGLYPH_END2=0x2
+[TRACE]TRACE_NORMAL[0x86]_CGLYPHATLAS_INSTATEGPUMEMORY=0x16
+[TRACE]TRACE_NORMAL[0x86]_CGLYPHATLAS_INSTATEGPUMEMORY_EXIT=0x17
+[TRACE]TRACE_NORMAL[0x86]_CGLYPHATLAS_RELEASEGPUMEMORY=0x14
+[TRACE]TRACE_NORMAL[0x86]_CGLYPHATLAS_RELEASEGPUMEMORY_EXIT=0x15
--- a/graphicsaccelaration/vgi/group/libvgi.mmp	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicsaccelaration/vgi/group/libvgi.mmp	Tue Jul 20 13:27:44 2010 +0300
@@ -34,6 +34,8 @@
 
 OPTION_REPLACE ARMCC --cpu 5TE -O3 -Otime
 
+MACRO GRAPHICS_LIBVGI_DLL
+
 SOURCEPATH 		../src
 SOURCE			vgi.cpp
 
--- a/graphicsaccelaration/vgi/inc/vg/vgcontext.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicsaccelaration/vgi/inc/vg/vgcontext.h	Tue Jul 20 13:27:44 2010 +0300
@@ -53,7 +53,11 @@
    VGI_COPY_TRANSPARENT_PIXELS,
 } VGICopyToTargetHint;
 
-#define VGI_API_CALL		__declspec(dllexport)
+#ifdef GRAPHICS_LIBVGI_DLL
+	#define VGI_API_CALL		__declspec(dllexport)
+#else
+	#define VGI_API_CALL		__declspec(dllimport)
+#endif
 
 #ifdef __cplusplus
 extern "C" {
--- a/graphicscomposition/openwfcinterface/group/openwfc.iby	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicscomposition/openwfcinterface/group/openwfc.iby	Tue Jul 20 13:27:44 2010 +0300
@@ -20,5 +20,4 @@
 
 #include OPENWFCLIB_DRV
 
-
 #endif // __OPENWFC_IBY__
--- a/graphicscomposition/openwfsupport/bwins/WFCinteropu.def	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicscomposition/openwfsupport/bwins/WFCinteropu.def	Tue Jul 20 13:27:44 2010 +0300
@@ -22,11 +22,11 @@
 	SymbianStreamSetFlipState @ 21 NONAME
 	SymbianStreamAddExtendedObserver @ 22 NONAME
 	SymbianStreamCheckVisible @ 23 NONAME
-	SymbianStreamProcessAvailableNotifications @ 24 NONAME
-	SymbianStreamProcessDisplayedNotifications @ 25 NONAME
+	reserveEntrypoint25 @ 24 NONAME ABSENT
+	reserveEntrypoint26 @ 25 NONAME ABSENT
 	SymbianStreamProcessNotifications @ 26 NONAME
 	
-	reserveEntrypoint1 @ 27 NONAME ABSENT
+	SymbianStreamGetChunkHandle @ 27 NONAME
 	reserveEntrypoint2 @ 28 NONAME ABSENT
 	reserveEntrypoint3 @ 29 NONAME ABSENT
 	reserveEntrypoint4 @ 30 NONAME ABSENT
@@ -50,9 +50,11 @@
 	reserveEntrypoint22 @ 48 NONAME ABSENT
 	reserveEntrypoint23 @ 49 NONAME ABSENT
 	?GetMainHeap@COpenWfcStreamMap@@QAEPAVRHeap@@XZ @ 50 NONAME ; class RHeap * COpenWfcStreamMap::GetMainHeap(void)
-	?Reserve@COpenWfcStreamMap@@QAEHH@Z @ 51 NONAME ; int COpenWfcStreamMap::Reserve(int)
+	reserveEntrypoint24 @ 51 NONAME ABSENT 
 	?InstanceL@COpenWfcStreamMap@@SAAAV1@XZ @ 52 NONAME ; class COpenWfcStreamMap & COpenWfcStreamMap::InstanceL(void)
 	?XXX_Find@COpenWfcStreamMap@@QAEPAVCSurfaceStream@@ABVTSurfaceId@@@Z @ 53 NONAME ABSENT; class CSurfaceStream * COpenWfcStreamMap::Find(class TSurfaceId const &)
 	?Count@COpenWfcStreamMap@@QAEHXZ @ 54 NONAME ; int COpenWfcStreamMap::Count(void)
 	?XXX_AcquireL@COpenWfcStreamMap@@QAEPAVCSurfaceStream@@ABVTSurfaceId@@@Z @ 55 NONAME ABSENT; class CSurfaceStream * COpenWfcStreamMap::AcquireL(class TSurfaceId const &)
+	?SurfaceManager@COpenWfcStreamMap@@QAEAAVRSurfaceManager@@XZ @ 56 NONAME ; class RSurfaceManager & COpenWfcStreamMap::SurfaceManager(void)
 
+
--- a/graphicscomposition/openwfsupport/eabi/WFCinteropu.def	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicscomposition/openwfsupport/eabi/WFCinteropu.def	Tue Jul 20 13:27:44 2010 +0300
@@ -22,11 +22,11 @@
 	SymbianStreamSetFlipState @ 21 NONAME
 	SymbianStreamAddExtendedObserver @ 22 NONAME
 	SymbianStreamCheckVisible @ 23 NONAME
-	SymbianStreamProcessAvailableNotifications @ 24 NONAME
-	SymbianStreamProcessDisplayedNotifications @ 25 NONAME
+	reserveEntrypoint25 @ 24 NONAME ABSENT
+	reserveEntrypoint26 @ 25 NONAME ABSENT
 	SymbianStreamProcessNotifications @ 26 NONAME
 	
-	reserveEntrypoint1 @ 27 NONAME ABSENT
+	SymbianStreamGetChunkHandle @ 27 NONAME
 	reserveEntrypoint2 @ 28 NONAME ABSENT
 	reserveEntrypoint3 @ 29 NONAME ABSENT
 	reserveEntrypoint4 @ 30 NONAME ABSENT
@@ -50,9 +50,8 @@
 	reserveEntrypoint22 @ 48 NONAME ABSENT
 	reserveEntrypoint23 @ 49 NONAME ABSENT
 	_ZN17COpenWfcStreamMap11GetMainHeapEv @ 50 NONAME
-	_XXX_ZN17COpenWfcStreamMap4FindERK10TSurfaceId @ 51 NONAME ABSENT
-	_ZN17COpenWfcStreamMap5CountEv @ 52 NONAME
-	_ZN17COpenWfcStreamMap7ReserveEi @ 53 NONAME
-	_XXX_ZN17COpenWfcStreamMap8AcquireLERK10TSurfaceId @ 54 NONAME ABSENT 
-	_ZN17COpenWfcStreamMap9InstanceLEv @ 55 NONAME 
+	_ZN17COpenWfcStreamMap5CountEv @ 51 NONAME
+	reserveEntrypoint24 @ 52 NONAME ABSENT
+	_ZN17COpenWfcStreamMap9InstanceLEv @ 53 NONAME
+	_ZN17COpenWfcStreamMap14SurfaceManagerEv @ 54 NONAME
 
--- a/graphicscomposition/openwfsupport/inc/owftestexithelper.inl	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// A copy of shutdown cleanup functions that should be called  
-// to properly support openWF.
-// These methods are implemented and called from Window Server - WServ, CWsTop
-// but this copy can be called by any low-level unit tests that bypass WServ   
-// but need to provide the same clean-up behaviour.
-// @test
-// @internalTechnology
-// 
-// Currently, three things are cleaned up:
-// 1) Singleton API mutex in OpenWF implementation
-// 2) Singleton Find/Acquire mutext in Native Stream implementation
-// 3) EGL thread status 
-//
-// Note that while these cleanups are only required by OWF-C implementations,
-// the methods called should be harmless if called 
-// when some other composition solution is in action.
-#include <e32property.h>
-#include <EGL/egl.h>
-
-// IDs of p&s properties that optionally contain onexit callbacks
-// that may be used to release singletons owned by libraries at shutdown in order to make 
-// the memory leak tests work.
-// By convention, the ID is the same as the UID3 of the libary.
-static TBool gReleaseSingletonsOnExit = EFalse;
-static const TUid KOpenWfcImplCleanupKey = {0x10286FC4};     
-static const TUid KOpenWfcInteropCleanupKey = {0x10286FC5};
-
-
-static void DefineOwfSingletonKey(const TUid& aSingletonKey)
-/**
- * Defines a new property for a singleton key. WServ must only process 
- * singleton keys that it created to prevent a malicious process with the 
- * WriteDeviceData capability causing arbitrary functions to be executed.
- * 
- * @param   aSingeltonKey   The UID of the singleton key to define.
- */
-    {
-    RThread t;      
-    TUid category = { t.SecureId().iId };
-    RProperty prop;
-    
-    // Write access is restricted to THIS process
-    TInt err = prop.Define( category, aSingletonKey.iUid, 
-            RProperty::EByteArray, TSecurityPolicy( t.SecureId() ), 
-            TSecurityPolicy( t.SecureId() ), sizeof( TCallBack ) );
-    
-    if ( err == KErrNone || err == KErrAlreadyExists)
-        {
-        TCallBack cb( NULL, NULL );
-        TPckgC<TCallBack> cbPckg( cb );
-        
-        // Any error should cause the properties to be ignored
-        err = prop.Set( category, aSingletonKey.iUid, cbPckg );    
-        }      
-    //We presume that if property already exists it was previously set by this test code.
-    if ( err != KErrNone )
-        {
-        // A problem occured / the property already existed so for safety
-        // the release code should be skipped.
-        gReleaseSingletonsOnExit = EFalse;
-        }
-    
-    prop.Close();
-    t.Close();
-    }
-#define DefineOwfSingletonKeys DefineOwfSingletonKeys
-/** Call this method before starting the compositor.    
- * 
- */
-static void DefineOwfSingletonKeys()
-    {
-    // Define properties for singleton callbacks. This must only be done ONCE
-    // to ensure the properties can't be hijacked.
-    gReleaseSingletonsOnExit = ETrue;
-    DefineOwfSingletonKey(KOpenWfcInteropCleanupKey);
-    DefineOwfSingletonKey(KOpenWfcImplCleanupKey);
-    }
-
-static void DeleteOwfSingleton( const TUid& aSingletonKey )
-/**
- * Deletes a singleton object that was created on WServ's main heap.
- * 
- * @pre     The ws plugins have not been unloaded.
- * @param   aSingletonKey   The UID of the singleton which correponds to an
- *                          RProperty within WServ's category.                       
- */
-    {   
-    if ( gReleaseSingletonsOnExit )
-        {
-        RThread t;
-        TPckgBuf<TCallBack> cb;
-        RProperty prop; 
-        TInt err = prop.Get(TUid::Uid(t.SecureId().iId), aSingletonKey.iUid, cb);
-        if (err == KErrNone && cb.Length() == sizeof(TCallBack) && 
-                cb().iFunction && cb().iPtr == &User::Heap())
-            {
-            // Callback is only invoked if the heap for the singleton was the 
-            // WServ heap because the WServ memory leak tests only check this
-            // heap.
-            cb().CallBack();
-            }
-        // Errors are ignored because the purpose of this function is to free
-        // singletons in order top make memory leak checks pass.
-        prop.Close();
-        t.Close();
-        }
-    }
-/** Call this method to destroy OWF-C singletons on shut down
- * 
- */
-#define DeleteOwfSingletons DeleteOwfSingletons
-static void DeleteOwfSingletons()
-    {
-    // Free singletons on WServ heap created by libraries. Must be called
-    // BEFORE iPluginManager is deleted otherwise the library code could have
-    // been unloaded.
-    DeleteOwfSingleton(KOpenWfcImplCleanupKey);
-    DeleteOwfSingleton(KOpenWfcInteropCleanupKey);
-    /* Release any use of EGL by this thread. */
-    eglReleaseThread();
-    }
-
--- a/graphicscomposition/openwfsupport/inc/streammap.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicscomposition/openwfsupport/inc/streammap.h	Tue Jul 20 13:27:44 2010 +0300
@@ -38,16 +38,6 @@
 		 */
 		IMPORT_C static COpenWfcStreamMap& InstanceL();
 		/**
-		 * Expands the array to accommodate a specified number of key-value pairs.
-		 * If the hash map already has enough space for the specified number of elements, no
-		 * action is taken. Any elements already in the map are retained.
-		 * 
-		 * @param	aExpand	The number of key-value pairs for which space should be allocated.
-		 * @return	KErrNone if the operation completed aInternalVersion.
-		 * @return	KErrNoMemory if sufficient memory could not be allocated.
-		 */
-		IMPORT_C TInt Reserve(TInt aExpand);
-		/**
 		 * Look up a specified TSurfaceId key in the associative array and return a pointer to the
 		 * corresponding to a native stream. The reference counter of the native stream is incremented by one.
 		 * 
@@ -106,7 +96,7 @@
 		 * 
 		 * @return	A reference to the local SurfaceManager
 		 */
-		RSurfaceManager& SurfaceManager();
+        IMPORT_C RSurfaceManager& SurfaceManager();
 		
         /**
          * Returns a pointer to the main heap
@@ -156,14 +146,6 @@
 			};
 	private:
 		/**
-		 * Copy constructor
-		 */
-		COpenWfcStreamMap(const COpenWfcStreamMap&);
-		/**
-		 * Assignment operator
-		 */
-		COpenWfcStreamMap& operator= (const COpenWfcStreamMap&);
-		/**
 		 * Symbian constructor used with two stage construction pattern
 		 */
 		void ConstructL();
--- a/graphicscomposition/openwfsupport/inc/surfacestream.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicscomposition/openwfsupport/inc/surfacestream.h	Tue Jul 20 13:27:44 2010 +0300
@@ -499,6 +499,8 @@
                            TRequestStatus* aStatusDispXTimes,
                            TRequestStatus* aStatusConsumed);
     
+    TInt GetChunkHandle();
+    
 private:
     /**
      *   Notifies the composer that the content has been updated.
--- a/graphicscomposition/openwfsupport/inc/symbianstream.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicscomposition/openwfsupport/inc/symbianstream.h	Tue Jul 20 13:27:44 2010 +0300
@@ -660,6 +660,8 @@
   **/
   IMPORT_C void  SymbianStreamSetFlipState(SymbianStreamType aStream, SymOwfBool aFlip);
   
+  IMPORT_C TErrCode SymbianStreamGetChunkHandle(SymbianStreamType aStream, TInt* aHandle);
+  
 #	ifdef __cplusplus
 	}
 #	endif
--- a/graphicscomposition/openwfsupport/src/openwfcstream.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicscomposition/openwfsupport/src/openwfcstream.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -364,46 +364,6 @@
         }
     }
 
-EXPORT_C TInt32
-SymbianStreamProcessDisplayedNotifications(SymbianStreamType aStream, 
-                                           khronos_int32_t aEvent, 
-                                           khronos_int32_t aScreenNumber,
-                                           khronos_int32_t aSerialNumber,
-                                           khronos_int32_t* aReturnMask)
-    {
-    CSurfaceStream* stream = CSurfaceStream::FromHandle(aStream);
-    TInt32 event = aEvent & (ESOWF_EventDisplayed | ESOWF_EventDisplayedX);
-    if (stream && event)
-        {
-        stream->ProcessNotifications(aEvent, 
-                                     aScreenNumber, 
-                                     CSurfaceStream::EDefaultOperation, 
-                                     aSerialNumber, 
-                                     aReturnMask);
-        }
-    return event;
-    }
-
-EXPORT_C TInt32
-SymbianStreamProcessAvailableNotifications(SymbianStreamType aStream, 
-                                           khronos_int32_t aEvent, 
-                                           khronos_int32_t aScreenNumber,
-                                           khronos_int32_t aSerialNumber,
-                                           khronos_int32_t* aReturnMask)
-    {
-    CSurfaceStream* stream = CSurfaceStream::FromHandle(aStream);
-    TInt32 event = aEvent & ESOWF_EventAvailable;
-    if (stream && event)
-        {
-        stream->ProcessNotifications(aEvent, 
-                                     aScreenNumber, 
-                                     CSurfaceStream::EDefaultOperation, 
-                                     aSerialNumber, 
-                                     aReturnMask);
-        }
-    return ESOWF_EventAvailable;
-    }
-
 EXPORT_C TErrCode 
 SymbianStreamAddExtendedObserver(SymbianStreamType aStream, 
                                 SymbianStreamCallback aObserver, 
@@ -447,5 +407,17 @@
         stream->SetFlipState(aFlip);
         }
     }
-}	//extern "C" helps fix and verify linkage
 
+EXPORT_C TErrCode
+SymbianStreamGetChunkHandle(SymbianStreamType aStream, TInt* aHandle)
+    {
+    CSurfaceStream* stream = CSurfaceStream::FromHandle(aStream);
+    if (stream && aHandle)
+        {
+        *aHandle = stream->GetChunkHandle();
+        return KErrNone;
+        }
+    return KErrArgument;
+    }
+
+}   //extern "C" helps fix and verify linkage
--- a/graphicscomposition/openwfsupport/src/streammap.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicscomposition/openwfsupport/src/streammap.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -27,20 +27,6 @@
 
 static const TInt KOpenWfcInteropCleanupKey = 0x10286FC5;
 
-TEMPLATE_SPECIALIZATION class RHashTableBase::Defaults<TSurfaceId, RHashTableBase::EDefaultSpecifier_Normal>
-	{
-public:
-	inline static TGeneralHashFunction32 Hash();
-	inline static TGeneralIdentityRelation Id();
-	};
-
-inline TGeneralHashFunction32 RHashTableBase::Defaults<TSurfaceId, RHashTableBase::EDefaultSpecifier_Normal>::Hash()
-	{return (TGeneralHashFunction32)&DefaultHash::Integer;}
-
-inline TGeneralIdentityRelation RHashTableBase::Defaults<TSurfaceId, RHashTableBase::EDefaultSpecifier_Normal>::Id()
-	{return (TGeneralIdentityRelation)&DefaultIdentity::Integer;}
-
-
 COpenWfcStreamMap* COpenWfcStreamMap::pInstance = NULL;
 
 TUint32 COpenWfcStreamMap::HashFunction(const TSurfaceId& aHashKey)
@@ -66,13 +52,6 @@
 	return *pInstance;
 	}
 
-EXPORT_C TInt COpenWfcStreamMap::Reserve(TInt aExpand)
-	{
-	Guard g(iMutex);
-	TInt ret = iMap.Reserve(aExpand);
-	return ret;
-	}
-
 CSurfaceStream* COpenWfcStreamMap::Find(const TSurfaceId& aSurfaceId)
 	{
 	Guard g(iMutex);
@@ -118,7 +97,7 @@
 	return count;
 	}
 
-RSurfaceManager& COpenWfcStreamMap::SurfaceManager()
+EXPORT_C RSurfaceManager& COpenWfcStreamMap::SurfaceManager()
 	{
     WFCI_ASSERT_DEBUG(iSurfaceManager, EOwfPanicInvalidHasMap);
 	return *iSurfaceManager;
@@ -196,7 +175,7 @@
         CSurfaceStream* const* ns = NULL;
         while (nextKey)
             {
-            ns = iter.NextValue();
+            ns = iter.CurrentValue();
             if (ns && *ns)
                 {
                 delete (*ns);
@@ -220,7 +199,7 @@
         CExtensionContainer* const* extensionContainer = NULL;
         while (nextKey)
             {
-            extensionContainer = iter.NextValue();
+            extensionContainer = iter.CurrentValue();
             if (extensionContainer && *extensionContainer)
                 {
                 delete (*extensionContainer);
@@ -231,17 +210,6 @@
 	iRegisteredUpdaters.Close();
 	}
 
-COpenWfcStreamMap::COpenWfcStreamMap(const COpenWfcStreamMap&)
-	{
-	Panic(EOwfPanicInvalidCallStreamMap);
-	}
-
-COpenWfcStreamMap& COpenWfcStreamMap::operator= (const COpenWfcStreamMap&)
-	{
-	Panic(EOwfPanicInvalidCallStreamMap);
-	return *this;
-	}
-
 void COpenWfcStreamMap::ConstructL()
 	{
 	User::LeaveIfError(iMutex.CreateLocal());
--- a/graphicscomposition/openwfsupport/src/surfacestream.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicscomposition/openwfsupport/src/surfacestream.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -670,15 +670,18 @@
              if (iBufferChunk.Handle() == 0)
                  {
                  RChunk threadChunk;
-                 User::LeaveIfError(GetSingletonL().SurfaceManager().MapSurface(iSurfaceId, threadChunk));
-				 CleanupClosePushL(threadChunk);
-
+                 RSurfaceManager sm;
+                 sm.Open();
+                 TInt err = sm.MapSurface(iSurfaceId, threadChunk);
+                 sm.Close();
+                 CleanupClosePushL(threadChunk);
+                 				 			
 				 RChunk duplicateChunk;
 				 duplicateChunk.SetHandle(threadChunk.Handle());
-				 User::LeaveIfError(duplicateChunk.Duplicate(RThread(), EOwnerProcess));
-
+                 User::LeaveIfError(duplicateChunk.Duplicate(RThread(), EOwnerProcess));
+ 
                  iBufferChunk.SetHandle(duplicateChunk.Handle());
-				 CleanupStack::PopAndDestroy(&threadChunk);
+                 CleanupStack::PopAndDestroy(&threadChunk);
                  }
              break;
              }
@@ -1367,10 +1370,10 @@
     serialNumber = param.serialNumber;
     
     
-    // we take, initially in consideration "availble" even if we might not have received a consumed request status
+    // we take, initially in consideration "available" even if we might not have received a consumed request status
     eventsToProcess = 0;
     
-    // we try to figure out which are the vents we have to process and to get hold of their position
+    // we try to figure out which are the events we have to process and to get hold of their position
     // in the observers array, in order to avoid traversing it again
     TInt idx = iCallBacks.Count();
     //we will intend to mark the visited events, as an optimisation
@@ -2134,3 +2137,8 @@
         iNewFlip = EFlippedTargetNormal;
         }
     }
+
+TInt CSurfaceStream::GetChunkHandle()
+    {
+    return iBufferChunk.Handle();
+    }
--- a/graphicscomposition/openwfsupport/test/group/bld.inf	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicscomposition/openwfsupport/test/group/bld.inf	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2009-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"
@@ -36,4 +36,3 @@
 PRJ_TESTEXPORTS
 ../scripts/tstreamoperation.script z:/wfctest/tstreamoperation.script
 ../scripts/tmultidisplay.script	   z:/wfctest/tmultidisplay.script
-../../inc/owftestexithelper.inl			SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(graphics/owftestexithelper.inl)
--- a/graphicscomposition/openwfsupport/test/group/tstreamoperation.mmp	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicscomposition/openwfsupport/test/group/tstreamoperation.mmp	Tue Jul 20 13:27:44 2010 +0300
@@ -33,7 +33,6 @@
 
 STATICLIBRARY	tefunit.lib
 LIBRARY		euser.lib
-LIBRARY		estlib.lib 
 LIBRARY		testexecuteutils.lib
 LIBRARY		testexecutelogclient.lib
 LIBRARY		rfileloggerclient.lib
@@ -41,9 +40,6 @@
 LIBRARY		surfacemanager.lib
 LIBRARY		surfaceupdateclient.lib
 LIBRARY		gdi.lib
-LIBRARY		bitgdi.lib
-LIBRARY		fbscli.lib
-LIBRARY		imageconversion.lib
 LIBRARY		efsrv.lib
 LIBRARY		libEGL.lib
 LIBRARY		hal.lib
--- a/graphicscomposition/openwfsupport/test/scripts/tstreamoperation.script	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicscomposition/openwfsupport/test/scripts/tstreamoperation.script	Tue Jul 20 13:27:44 2010 +0300
@@ -89,3 +89,5 @@
 RUN_TEST_STEP 100 openwfcstreamoptestserver TEFUnit.CTestNativeStream.GRAPHICS_OPENWFC_NATIVESTREAM_0140L
 RUN_TEST_STEP 100 openwfcstreamoptestserver TEFUnit.CTestNativeStream.GRAPHICS_OPENWFC_NATIVESTREAM_0141L
 RUN_TEST_STEP 100 openwfcstreamoptestserver TEFUnit.CTestNativeStream.GRAPHICS_OPENWFC_NATIVESTREAM_0142L
+//RUN_TEST_STEP 100 openwfcstreamoptestserver TEFUnit.CTestNativeStream.GRAPHICS_OPENWFC_NATIVESTREAM_0143L
+RUN_TEST_STEP !PanicCode=1000008 !PanicString=WF-INTEROP 100 openwfcstreamoptestserver TEFUnit.CTestNativeStream.GRAPHICS_OPENWFC_NATIVESTREAM_0144L
--- a/graphicscomposition/openwfsupport/test/tstreamoperation/tnativestream.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicscomposition/openwfsupport/test/tstreamoperation/tnativestream.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2009-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"
@@ -23,9 +23,14 @@
 #include <test/extendtef.h>
 #include <dispchannel.h>
 #include <hal.h>
+#include <test/singletontestexithelper.inl>
 #include "tnativestream.h"
 #include "surfaceutility.h"
-#include "owftestexithelper.inl"
+
+#ifdef EGLSYNCHELPER_INCLUDED
+    #include <EGL/egl.h>
+    #include "eglsynchelper.h"
+#endif
 
 #define BUFFER_READ_HANDLE_BASE  0x100
 #define BUFFER_WRITE_HANDLE_BASE 0x200
@@ -243,6 +248,7 @@
 	}
 
 RSemaphore      gSemaphore;
+RSemaphore      gSemaphore2;
 
 TGlobalNativeStreamVar	gVarInstance={0};
 const TGlobalNativeStreamVar& TGlobalNativeStreamVar::Instance()
@@ -462,6 +468,8 @@
 		ADD_TEST_STEP_PARAM_RANGE(GRAPHICS_OPENWFC_NATIVESTREAM_0140L,1,4);
 		ADD_TEST_STEP_PARAM_RANGE(GRAPHICS_OPENWFC_NATIVESTREAM_0141L,1,4);
 		ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_NATIVESTREAM_0142L);
+        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_NATIVESTREAM_0143L);
+        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_NATIVESTREAM_0144L);
 
 	END_SUITE;	
 	
@@ -541,6 +549,8 @@
 	gVarInstance.SetSurfaceID(*checkId);
     gSemaphore.CreateLocal(1);
     gSemaphore.Wait(); 
+    gSemaphore2.CreateLocal(1);
+    gSemaphore2.Wait(); 
     CleanupStack::PopAndDestroy(); // switch the heap back to current thread's one
 	}
 
@@ -550,6 +560,7 @@
 	
 	CleanupStack::PushL(TCleanupItem(PopHeap, User::SwitchHeap(COpenWfcStreamMap::InstanceL().GetMainHeap())));
 	
+    gSemaphore2.Close();
 	gSemaphore.Close();
 	TSurfaceId id = gVarInstance.SurfaceID();
 	SymbianStreamType ns;
@@ -656,8 +667,11 @@
     const TSurfaceId* getId = NULL;
     err = SymbianStreamGetBufferId(ns,bufferHandle,&bufferIndex,&getId);
     ASSERT_TRUE(err == KErrNone);
+    TInt ChunkHandle = 100;
+    err = SymbianStreamGetChunkHandle(ns, &ChunkHandle);
+    ASSERT_TRUE(err == KErrNone);    
     err = SymbianStreamReleaseReadBuffer(ns,bufferHandle);
-    ASSERT_TRUE(err == KErrNone);
+    ASSERT_TRUE(err == KErrNone);    
 	ASSERT_EQUALS(*getId,surface);
 	CleanupStack::PopAndDestroy(); // switch the heap back to current thread's one
 	
@@ -669,7 +683,7 @@
 	err = SymbianStreamAcquire(&surface2,&ns2);
 	ASSERT_TRUE(err == KErrNone);
 	ASSERT_TRUE(ns2);
-	ASSERT_NOT_EQUALS(ns,ns2);
+	ASSERT_FALSE(SymbianStreamSame(ns, ns2));
 	ASSERT_EQUALS((COpenWfcStreamMap::InstanceL().Count()), count + 2);
 	err = SymbianStreamAcquireReadBuffer(ns2,&bufferHandle);
 	ASSERT_TRUE(err == KErrNone);
@@ -1343,7 +1357,8 @@
 	
 	gSemaphore.Signal(2); // Thread 2 and 3 ready to run
 	
-	gSemaphore.Wait();
+	gSemaphore2.Wait();
+    gSemaphore2.Wait();     // Wait for both threads to signal
 	err = SymbianStreamReleaseWriteBuffer(ns,writeBuffer1);
 	ASSERT_TRUE(err == KErrNone);
 	SymbianStreamRemoveReference(ns);
@@ -1375,7 +1390,7 @@
 	ASSERT_FALSE(writeBuffer1);
 	INFO_PRINTF1(_L("Thread 2 - Write buffer already in use by Thread 1!"));
     
-	gSemaphore.Signal();
+	gSemaphore2.Signal();
 	
 	gSemaphore.Wait();
 	
@@ -1418,6 +1433,8 @@
 	ASSERT_FALSE(writeBuffer1);
 	INFO_PRINTF1(_L("Thread 3 - Write buffer already in use by Thread 1!"));
 
+    gSemaphore2.Signal();
+
     SymbianStreamRemoveReference(ns);
     CleanupStack::PopAndDestroy(); // switch the heap back to current thread's one    
 	}
@@ -4660,7 +4677,10 @@
 
     err = User::LoadLogicalDevice(KDisplayChannelLdd);
     RDisplayChannel testChannel;
-    User::LeaveIfError(testChannel.Open(0));
+    if (err == KErrNone || err == KErrAlreadyExists)
+        {
+        User::LeaveIfError(testChannel.Open(0));
+        }
     
     TSurfaceId testId;
     SymbianStreamType ns;
@@ -4765,3 +4785,78 @@
     testChannel.Close();
     CleanupStack::PopAndDestroy(); // switch the heap back to current thread's one
     }
+
+/*
+@SYMTestCaseID          GFX_OPENWFC_NATIVESTREAM_0143
+@SYMTestCaseDesc        Call eglsync helper functions
+@SYMREQ                 
+@SYMPREQ                
+@SYMTestType            
+@SYMTestPriority        Low
+@SYMTestPurpose         Make calls of eglsync helper functions for coverage results                     
+@SYMTestActions 
+        Make calls of eglsync helper functions 
+@SYMTestExpectedResults
+        Test should pass without errors
+ */
+void CTestNativeStream::GRAPHICS_OPENWFC_NATIVESTREAM_0143L()
+    {
+    // This test is commented out because it won't build for Bullseye.
+#ifdef EGLSYNCHELPER_INCLUDED
+    INFO_PRINTF1(_L("Test of egl sync helper functions"));
+
+    RHeap* mainHeap = COpenWfcStreamMap::InstanceL().GetMainHeap();
+    TRAPD(err, GrowCleanupStackL());
+    ASSERT_TRUE(err == KErrNone);
+    
+    CleanupStack::PushL(TCleanupItem(PopHeap, User::SwitchHeap(mainHeap)));
+
+    EGLDisplay eglDisplay;
+    eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+    ASSERT_FALSE(eglDisplay == EGL_NO_DISPLAY);
+    ASSERT_FALSE(eglDisplay == EGL_BAD_ALLOC);
+    ASSERT_EQUALS(eglGetError(),EGL_SUCCESS);
+    eglInitialize(eglDisplay, NULL, NULL);
+    ASSERT_EQUALS(eglGetError(),EGL_SUCCESS);
+
+    EGLint attrib_list[1] = {EGL_NONE};
+    EGLSyncKHR sync;
+    sync = eglCreateSyncKHR(eglDisplay,EGL_SYNC_REUSABLE_KHR, attrib_list);
+    ASSERT_NOT_EQUALS(sync,EGL_NO_SYNC_KHR);
+    ASSERT_EQUALS(eglGetError(),EGL_SUCCESS);
+
+    eglSignalSyncKHR(eglDisplay, sync, EGL_SIGNALED_KHR);
+    eglGetSyncAttribKHR(eglDisplay, sync, NULL, NULL);
+    eglClientWaitSyncKHR(eglDisplay, sync, 0, 0);
+    
+    EGLBoolean eglSyncError = eglDestroySyncKHR(eglDisplay, sync);
+    sync = EGL_NO_SYNC_KHR;
+    if (eglSyncError != EGL_TRUE)
+        {
+        INFO_PRINTF2(_L("TearDown: eglSyncError line %d"),__LINE__);
+        }
+    CleanupStack::PopAndDestroy(); // switch the heap back to current thread's one
+#endif
+    }
+
+/*
+@SYMTestCaseID          GFX_OPENWFC_NATIVESTREAM_0144
+@SYMTestCaseDesc        Panic test
+@SYMREQ                 
+@SYMPREQ                
+@SYMTestType            
+@SYMTestPriority        Low
+@SYMTestPurpose         Test that will cause a panic.               
+@SYMTestActions 
+        Aquire a symbian stream by passing in a NULL ns
+@SYMTestExpectedResults
+        Test should panic with the expected panic code 1000008
+*/
+void CTestNativeStream::GRAPHICS_OPENWFC_NATIVESTREAM_0144L()
+    {
+    INFO_PRINTF1(_L("Panic test. The expected panic code is 1000008"));
+    
+    SymbianStreamBuffer bufferHandle;
+    // Pass in a NULL ns will cause panic EOwfSymbianStreamBadArgument (1000008)
+    SymbianStreamAcquireReadBuffer(NULL, &bufferHandle);
+    }
--- a/graphicscomposition/openwfsupport/test/tstreamoperation/tnativestream.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicscomposition/openwfsupport/test/tstreamoperation/tnativestream.h	Tue Jul 20 13:27:44 2010 +0300
@@ -197,6 +197,8 @@
 	void GRAPHICS_OPENWFC_NATIVESTREAM_0140L(TInt aNumBuffers);
 	void GRAPHICS_OPENWFC_NATIVESTREAM_0141L(TInt aNumBuffers);
 	void GRAPHICS_OPENWFC_NATIVESTREAM_0142L();
+    void GRAPHICS_OPENWFC_NATIVESTREAM_0143L();
+    void GRAPHICS_OPENWFC_NATIVESTREAM_0144L();
 	
 private:
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicscomposition/openwftest/group/bld.inf	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,41 @@
+// Copyright (c) 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:
+// OpenWFTEST
+//
+/**
+@file
+
+@SYMPurpose OpenWFC Test
+*/
+
+PRJ_PLATFORMS
+
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+openwftest.mmp
+
+PRJ_TESTEXPORTS
+../rom/openwftest.iby				/epoc32/rom/include/openwftest.iby
+
+../scripts/openwftest.script		z:/openwftest/openwftest.script
+
+../scripts/openwftest_automatic_c_save.ini		z:/openwftest/openwftest.ini
+../scripts/openwftest_automatic_e_save.ini		z:/openwftest/openwftest_automatic_e_save.ini
+../scripts/openwftest_automatic_nosave.ini		z:/openwftest/openwftest_automatic_nosave.ini
+../scripts/openwftest_manual.ini				z:/openwftest/openwftest_manual.ini
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicscomposition/openwftest/group/graphics_openwftest.mrp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,8 @@
+component	graphics_openwftest
+
+source	\sf\os\graphics\graphicscomposition\openwftest
+binary	\sf\os\graphics\graphicscomposition\openwftest\group		all
+exports	\sf\os\graphics\graphicscomposition\openwftest\group
+notes_source	\component_defs\release.src
+
+ipr T
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicscomposition/openwftest/group/openwftest.mmp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,55 @@
+// Copyright (c) 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:
+// OpenWFTEST
+//
+
+/**
+ @file
+ @test
+ @internalComponent - Internal Symbian test code
+*/
+TARGET			openwftestserver.exe
+TARGETTYPE		exe
+UID				268435596 268450592  // same as wserv UID
+CAPABILITY      PowerMgmt ReadDeviceData WriteDeviceData ProtServ
+
+
+EPOCALLOWDLLDATA
+
+SOURCEPATH		../src
+SOURCE			openwftestserver.cpp 
+SOURCE			surfaceutility.cpp
+SOURCE			openwftest.cpp
+SOURCE			eglsynchelper.c
+
+USERINCLUDE		. ..\inc 
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+OS_LAYER_ESTLIB_SYSTEMINCLUDE
+
+LIBRARY		euser.lib
+LIBRARY		testexecuteutils.lib
+LIBRARY		testexecutelogclient.lib
+LIBRARY		rfileloggerclient.lib
+LIBRARY		WFCinterop.lib
+LIBRARY		libWFC.lib
+LIBRARY		surfacemanager.lib
+LIBRARY		surfaceupdateclient.lib
+LIBRARY		gdi.lib
+LIBRARY		libEGL.lib
+LIBRARY		estor.lib
+LIBRARY		efsrv.lib
+STATICLIBRARY	tefunit.lib
+
+SMPSAFE
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicscomposition/openwftest/inc/eglsynchelper.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,154 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// eglsynchelper.c
+//
+
+#ifndef __eglsynchelper_h_
+#define __eglsynchelper_h_
+
+#include <EGL/eglext.h>
+#include <EGL/egl.h>
+#include "KHR/khrplatform.h"
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef EGL_EGLEXT_PROTOTYPES
+
+/*
+ * EGLSyncKHR is an opaque handle to an EGL sync object
+ */
+typedef void* EGLSyncKHR;
+
+
+typedef khronos_utime_nanoseconds_t EGLTimeKHR;
+
+/* API functions */
+
+/*-------------------------------------------------------------------*//*!
+ * \brief   Create a sync object for the specified display.
+ * \ingroup api
+ * \param   dpy     Identifier of the display which will own the sync object
+ * \param   type    Type of the sync object. EGL_SYNC_REUSABLE_KHR is only supported
+ * \param   attrib_list Attribute-value list specifying attributes of the sync 
+ * object, terminated by an attribute entry EGL_NONE
+ * \return  Handle for the created sync object if successful, EGL_NO_SYNC_KHR otherwise
+ * \error   EGL_BAD_DISPLAY if <dpy> is not a name of a valid EGLDisplay;
+ * EGL_NOT_INITIALIZED if the display object associated with the <dpy> has not been initialized;
+ * EGL_BAD_ATTRIBUTE if <attrib_list> is neither NULL nor empty (containing only EGL_NONE) or 
+ * if <type> is not a supported type of sync object;
+ * EGL_BAD_ALLOC if the memory allocation related to sync object is not successful
+ * \note    If <type> is EGL_SYNC_REUSABLE_KHR, a reusable sync object is created. 
+ * In this case <attrib_list> must be NULL or empty (containing only EGL_NONE).
+ *  *//*-------------------------------------------------------------------*/
+EGLSyncKHR eglCreateSyncKHR( EGLDisplay dpy,
+                       EGLenum condition,
+                       const EGLint *attrib_list );
+
+/*-------------------------------------------------------------------*//*!
+ * \brief   Destroy a sync object and free memory associated with it
+ * \ingroup api
+ * \param   dpy     Identifier of the display which owns the sync object
+ * \param   sync    Sync object handle. 
+ * \return  EGL_TRUE if deletion was successful and EGL_FALSE otherwise
+ * \error   EGL_BAD_DISPLAY if <dpy> is not a name of a valid EGLDisplay;
+ * EGL_NOT_INITIALIZED if the display object associated with the <dpy> has not been initialized;
+ * EGL_BAD_PARAMETER if <sync> is not a valid sync object for <dpy>
+ * \note    If any eglClientWaitSyncKHR commands are blocking on <sync> when 
+ * eglDestroySyncKHR is called, they will be woken up, as if <sync> were signaled. 
+ * If no errors are generated, <sync> will no longer be the handle of a valid sync object.
+ *//*-------------------------------------------------------------------*/
+EGLBoolean eglDestroySyncKHR( EGLDisplay dpy, EGLSyncKHR sync );
+
+/*-------------------------------------------------------------------*//*!
+ * \brief   Blocks the calling thread until the specified sync object 
+ * is signaled, or until <timeout> nanoseconds have passed.  
+ * \ingroup api
+ * \param   dpy     Identifier of the display which owns the sync object.
+ * \param   sync    Sync object handle. 
+ * \param   flags   If the EGL_FLUSH_COMMANDS_BIT_KHR bit is set in <flags>
+ * and <sync> is unsignaled when the function is called, then the equivalent
+ * of Flush() will be performed for the current API context.   
+ * \param   timeout The thread will be unblocked when <timeout> is expired.
+ * If the <timeout> is to zero, the function just test the current status 
+ * of the sync object. If the <timeout> is set to EGL_FOREVER_KHR, then the 
+ * function does not time out. For all other values, <timeout> is adjusted to 
+ * the closest value which may be substantially longer than one nanosecond. 
+ * \return  EGL_CONDITION_SATISFIED if <sync> was signaled before
+ * the timeout expired, which includes the case when <sync> was already 
+ * signaled when eglClientWaitSyncKHR was called; EGL_TIMEOUT_EXPIRED_KHR if the 
+ * specified timeout period expired before <sync> was signaled; 
+ * EGL_FALSE if an error occurs.
+ * \error   EGL_BAD_DISPLAY if <dpy> is not a name of a valid EGLDisplay;
+ * EGL_NOT_INITIALIZED if the display object associated with the <dpy> has not been initialized;
+ * EGL_BAD_PARAMETER if <sync> is not a valid sync object for <dpy> or 
+ * if <flags> does not equal to 0 or EGL_SYNC_FLUSH_COMMAND_BIT_KHR
+ * Note\    More than one eglClientWaitSyncKHR may be outstanding on the same <sync> at any given time. 
+ * When there are multiple threads blocked on the same <sync> and the sync object is signaled, 
+ * all such threads are released, but the order in which they are released is not defined.
+ * If a sync object is destroyed while an eglClientWaitSyncKHR is blocking on that object, 
+ * eglClientWaitSyncKHR will unblock and return immediately, just as if the sync object 
+ * had been signaled prior to being destroyed.
+ *//*-------------------------------------------------------------------*/
+EGLint eglClientWaitSyncKHR( EGLDisplay dpy,
+                      EGLSyncKHR sync,
+                      EGLint flags,
+                      EGLTimeKHR timeout );
+
+/*-------------------------------------------------------------------*//*!
+ * \brief   Signals or unsignals the reusable sync object.  
+ * \ingroup api
+ * \param   dpy     Identifier of the display which owns the sync object.
+ * \param   sync    Sync object handle. 
+ * \param   mode    Status of the sync object. There are two possible states: 
+ *  EGL_SIGNALED_KHR and EGL_UNSIGNALED_KHR. 
+ * \return  EGL_TRUE if an operation was successful and EGL_FALSE otherwise.
+ * \note    The error code returned from eglSignalSyncImpl() will be generated
+ *//*-------------------------------------------------------------------*/
+EGLBoolean eglSignalSyncKHR( EGLDisplay dpy,
+                  EGLSyncKHR sync,
+                  EGLenum mode );
+
+
+
+/*-------------------------------------------------------------------*//*!
+ * \brief   Query an attribute of the sync object  
+ * \ingroup api
+ * \param   dpy     Identifier of the display which owns the sync object
+ * \param   sync    Sync object handle. 
+ * \param   attribute   An attribute to be retrieved. 
+ * \param   value   Pointer to the value for the requested attribute which will be filled on function return. 
+ * \return  EGL_TRUE if an operation was successful and EGL_FALSE otherwise
+ * \error   EGL_BAD_DISPLAY if <dpy> is not a name of a valid EGLDisplay;
+ * EGL_NOT_INITIALIZED if the display object associated with the <dpy> has not been initialized;
+ * EGL_BAD_PARAMETER if <sync> is not a valid sync object for <dpy> or if <value> is not 
+ * a valid pointer; EGL_BAD_ATTRIBUTE if <attribute>  does not lie within expected range;
+ * EGL_BAD_MATCH if <attribute> is not supported for the type of sync object passed in <sync>
+ *//*-------------------------------------------------------------------*/
+EGLBoolean eglGetSyncAttribKHR( EGLDisplay dpy,
+                     EGLSyncKHR sync,
+                     EGLint attribute,
+                     EGLint *value );
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __eglsynchelper_h_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicscomposition/openwftest/inc/openwftest.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,212 @@
+// Copyright (c) 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 OPENWFTEST_H
+#define OPENWFTEST_H
+
+// INCLUDES
+#include <test/tefunit.h>
+#include <w32std.h>
+#include <graphics/symbianstream.h>
+#include <graphics/surfacemanager.h>
+#include <graphics/streammap.h>
+#include <EGL/egl.h>
+#include <graphics/eglsynchelper.h>
+#include <WF/wfc.h>
+#include "surfaceutility.h"
+
+class CTestExecuteLogger;
+class CSurfaceStream;
+
+/* Color defines for openwf test.*/
+#define KDarkRed		TRgb(127,0,0,255)
+#define KRed			TRgb(255,0,0,255)
+#define KGreen			TRgb(0,255,0,255)
+#define KBlue			TRgb(0,0,255,255)
+#define KCyan			TRgb(0,255,255,255)
+#define KMagenta		TRgb(255,0,255,255)
+#define KYellow			TRgb(255,255,0,255)
+#define KBrown			TRgb(150,75,0,255)
+#define KBlack			TRgb(0,0,0,255)
+#define KBlackAlpha0	TRgb(0,0,0,0)
+#define KWhite			TRgb(255,255,255,255)
+#define KWhiteAlpha0	TRgb(255,255,255,0)
+#define KGray			TRgb(127,127,127,255)
+#define KGrayHalfAlpha	TRgb(127,127,127,127)
+
+#define KMaxImagePathLength 100
+#define KMaxTestNameLength 20
+
+class CActiveNotification : public CActive
+	{
+public:
+	static CActiveNotification* NewL(RSurfaceUpdateSession& aSurfaceUpdateSession,TBool aActivate);
+	~CActiveNotification();
+	void Activate();
+	// From CActive:
+	void RunL();
+	void DoCancel();
+	TInt RunError(TInt aError);
+protected:
+	CActiveNotification();
+	void ConstructL(RSurfaceUpdateSession& aSurfaceUpdateSession);
+private:
+	RSurfaceUpdateSession iSurfaceUpdateSession;
+	};
+
+//Use instead of User::After
+class CActiveWaiter : public CActive
+	{
+public:
+	static CActiveWaiter* NewL();
+	~CActiveWaiter();
+	TInt Wait(TTimeIntervalMicroSeconds32 aDelay);
+	void StartWait(TTimeIntervalMicroSeconds32 aDelay);
+	// From CActive:
+	void RunL();
+	void DoCancel();
+	TInt RunError(TInt aError);
+protected:
+	CActiveWaiter();
+	void ConstructL();
+public:
+	TBool iRun;
+protected:
+	RTimer iTimer;
+	};
+
+/**
+ *  COpenwfTest
+ * 
+ */
+class COpenwfTest : public CTestFixture
+	{
+public:
+	COpenwfTest();
+	~COpenwfTest();
+
+	virtual void SetupL();
+	virtual void TearDownL();
+	static CTestSuite* CreateSuiteL(const TDesC& aName);
+	
+    enum TCacheAttribute
+        {
+	    /** not CPU cached */
+	    ENotCached = 0,
+	    /** CPU cached */
+	    ECached = 1,
+	    /** Not listed */
+	    ECacheNotlisted = 2
+	    };
+
+    enum TContiguousFlag
+        {
+        ENonContiguous = 0,
+        EContiguous = 1,
+        EFlagNotListed = 2
+        };
+    
+    enum TTestMode
+        {
+        EAutomatic = 0,
+        EManual = 1
+        };
+    
+private:
+    TBool AcquireOnScreenStream();
+    void ReleaseOnScreenStream();
+    TBool CheckOnScreenStreamRect(TRect aRect, const TRgb& aExpectedColor, TInt aTolerance);
+    TBool CheckRect(const TSurfaceId& aSurface, TInt aNumOfBuffer, TRect aRect, 
+    		const TRgb& aExpectedColor, TInt aTolerance);
+    TBool CheckOnScreenReferenceImage();
+    TBool SaveImage(const TSurfaceId& aSurfaceId, TInt aNumOfBuffer);
+    TInt WaitL(TTimeIntervalMicroSeconds32 aDelay);	//aDelay in microseconds
+    TBool WaitForNotifications(TTimeIntervalMicroSeconds32 aMaxDelay,TInt aNotificatons);
+    void ReadIniData();
+    void TearDown();
+    void SetupEmptySceneL(TBool aAutonomous = ETrue);
+    
+	// Fastpath positive tests
+	void GRAPHICS_OPENWFC_FASTPATH_0000L();
+	void GRAPHICS_OPENWFC_FASTPATH_0001L();
+	void GRAPHICS_OPENWFC_FASTPATH_0002L();
+	void GRAPHICS_OPENWFC_FASTPATH_0003L();
+    void GRAPHICS_OPENWFC_FASTPATH_0004L();
+    void GRAPHICS_OPENWFC_FASTPATH_0005L();
+    void GRAPHICS_OPENWFC_FASTPATH_0006L();
+    void GRAPHICS_OPENWFC_FASTPATH_0007L();
+	
+	// Fastpath with notification tests
+    void FastpathNotificationsTestL(TBool aAutonomous);
+	void GRAPHICS_OPENWFC_FASTPATH_0010L();
+	void GRAPHICS_OPENWFC_FASTPATH_0011L();
+	void FastpathDispXNotificationsTestL(TBool aAutonomous);
+	void GRAPHICS_OPENWFC_FASTPATH_0012L();
+	void GRAPHICS_OPENWFC_FASTPATH_0013L();
+	
+	// Fastpath negative tests
+	void GRAPHICS_OPENWFC_FASTPATH_0020L();
+	void GRAPHICS_OPENWFC_FASTPATH_0021L();
+	void GRAPHICS_OPENWFC_FASTPATH_0022L();
+	void GRAPHICS_OPENWFC_FASTPATH_0023L();
+	void GRAPHICS_OPENWFC_FASTPATH_0024L();
+	void GRAPHICS_OPENWFC_FASTPATH_0025L();
+	void GRAPHICS_OPENWFC_FASTPATH_0026L();
+    void GRAPHICS_OPENWFC_FASTPATH_0027L();
+			
+private:
+    TInt iFastpathableWidth;
+    TInt iFastpathableHeight;
+    TInt iStride;        
+    TContiguousFlag iContiguous;
+    TUidPixelFormat iFastpathablePixelFormat;
+    TUidPixelFormat iNonFastpathablePixelFormat;
+    TInt iOffsetToFirstBuffer; 
+    TInt iAlignment;           
+    TBool iMappable;
+    TInt iMaxBuffers;              
+    TInt iMinBuffers;
+    TCacheAttribute iCacheAttrib;
+    TInt iOffsetBetweenBuffers;
+    TInt iTestMode;
+    TBool iSaveImage;
+    TTimeIntervalMicroSeconds32 iCompositionPause;	//delay in microseconds
+    TTimeIntervalMicroSeconds32 iManualPause;	//delay for manual checking in microseconds
+    TBool iAllowManualPause;  //some tests may not allow manual pauses
+    TInt iTolerance;
+    WFCint iDeviceId;
+    EGLSyncKHR iSync;
+    WFCDevice iDevice;
+    WFCContext iContext;
+
+    TRect iFullScreenTRect;
+    WFCint iFullScreenRect[4];
+    TRect iCenterTRect;
+    WFCint iCenterRect[4];
+    WFCint iHalfSizeRect[4];
+    
+    CActiveScheduler* iScheduler;
+    EGLDisplay iEGLDisplay;
+    CSurfaceUtility* iUtility;
+    //TPtrC iDir;
+    TPtrC iImageDirectory;
+    TBufC<KMaxTestNameLength> iTestName;
+	TBuf<KMaxImagePathLength> iImageAddress;
+    TInt iImageCounter;
+    SymbianStreamType iOnScreenStream;
+    SymbianStreamBuffer iOnScreenBuffer;
+	};
+
+#endif // OPENWFTEST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicscomposition/openwftest/inc/surfaceutility.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,106 @@
+// Copyright (c) 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:
+//
+
+/**
+ @file
+*/
+
+#ifndef __SURFACE_UTILITY__
+#define __SURFACE_UTILITY__
+
+#include <e32base.h>
+#include <graphics/surface.h>
+#include <graphics/surfacemanager.h>
+#include <graphics/surfaceupdateclient.h>
+#include <graphics/symbianstream.h>
+#include <WF/wfc.h>
+
+//#define ENABLE_TEST_LOGGING
+#if defined(ENABLE_TEST_LOGGING)
+#define LOG(X)	RDebug::Printf X
+#define LOGL(X)	RDebug::Print X
+#else
+#define LOG(X)
+#define LOGL(X)
+#endif
+
+class TRgb;
+class CFbsBitmap;
+
+class CSurfaceUtility : public CBase
+	{
+public:
+    CSurfaceUtility();
+	static CSurfaceUtility* NewL();
+	virtual ~CSurfaceUtility();
+	TSize SurfaceSize(const TSurfaceId& aSurface);
+	TSurfaceId CreateSurfaceL(const TSize& aSize, TUidPixelFormat aPixelFormat, TInt aStride, TBool aContiguous, TInt aBuffers);
+	TInt BytesPerPixelL(TUidPixelFormat aPixelFormat);
+	void FillSurfaceL(TSurfaceId& aSurface, const TRgb& aColor);
+	void FillSurfaceL(TSurfaceId& aSurface, TInt aBuffer, const TRgb& aColor);
+	void DestroySurface(TSurfaceId& aSurface);
+	TBool DestroyAll();
+    TBool CheckRectColor(const TSurfaceId& aSurface, TRect& aRect, TInt aNumOfBuffer, const TRgb& aExpectedColor, TInt aTolerance);
+    TBool SaveResultImageTGAL(const TSurfaceId& aOnscreenSurface, TInt aBufferNumber, TDesC& aDestination);
+    TInt SubmitUpdate(const TSurfaceId& aSurface, TInt aBufferNumber, const TRegion* aRegion = NULL);
+    void NotifyWhenDisplayed(TRequestStatus& aStatusDisplayed, TTimeStamp& aTimeStamp);
+    void NotifyWhenDisplayedXTimes(TInt aCount, TRequestStatus& aStatusDisplayedX);
+    void NotifyWhenAvailable(TRequestStatus& aStatusAvailable);	
+	RSurfaceManager& Manager()	{return iManager;}
+	RSurfaceUpdateSession& Session()	{return iSurfaceUpdateSession;}
+	SymbianStreamType GetOnScreenStream(WFCDevice aDev, WFCContext aContext);
+	TBool CreateImagePath(TDesC& aDir);
+
+private:
+	void ConstructL();
+    TInt GetHeader(const TSurfaceId& aSurface, RSurfaceManager::TInfoBuf& aInfo);
+    TUint8* GetBufferPointerL(const TSurfaceId& aSurface, TInt aNumOfBuffer, RChunk& aChunk);
+    TRgb GetPixelL(RSurfaceManager::TInfoBuf& aInfo, TAny* aPixelData, TPoint aPosition);
+
+private:
+	RSurfaceManager iManager;
+	RSurfaceUpdateSession iSurfaceUpdateSession;
+
+	//This local object wraps the array operations in a heap switch
+	//The reason for providing this wrapper is to allow threads to share the surface manager surface ID list.
+	//In particular, the next test can attempt to release the previous test's surfaces if it paniced. 
+	//Note that the presumption is that the owning thread will be paused, 
+	//so there will be no thread interlock issues with it's heap manager.
+	class RHeapSurfaceArray
+		{
+		public:
+		typedef RArray<TSurfaceId>	Array;
+		RHeapSurfaceArray(RHeapSurfaceArray* aUseExternalArray=NULL);
+
+		//Emulation of RArray entrypoints. Add more stub methods if required...
+		TSurfaceId& operator[](TUint aIndex);
+		void Close();
+		TInt Count() const;
+		inline void Reset();
+		void AppendL(const TSurfaceId &anEntry);
+		TInt Find(const TSurfaceId &anEntry) const;
+		void Remove(TInt anIndex);
+		
+		private:
+		static void PopHeap(void* mainheap);
+		
+		Array iLocalArray;
+		Array* iUseArray;
+		RHeap &iExternalHeapRef;
+		}	iSurfaces;
+	};
+
+#endif // __SURFACE_UTILITY__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicscomposition/openwftest/rom/openwftest.iby	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,30 @@
+// Copyright (c) 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:
+// Includes the required openwftest files.
+
+#if !defined (__OPENWFTEST_IBY__)
+#define __OPENWFTEST_IBY__
+
+// OWF test exe and script
+file=ABI_DIR\DEBUG_DIR\openwftestserver.exe		\sys\bin\openwftestserver.exe
+data=DATAZ_\openwftest\openwftest.script		openwftest\openwftest.script
+
+// if OPENWFTEST_INI is not defined, use the default
+#if !defined (OPENWFTEST_INI)
+#define OPENWFTEST_INI 							openwftest.ini
+#endif //OPENWFTEST_INI
+
+data=DATAZ_\openwftest\OPENWFTEST_INI			openwftest\openwftest.ini
+
+#endif //__OPENWFTEST_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicscomposition/openwftest/scripts/openwftest.script	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,44 @@
+// Copyright (c) 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:
+// Runs every test with the openwftest.ini from the same folder
+
+// important to load in shared data mode
+LOAD_SUITE	openwftestserver -SharedData
+
+//positive fastpath tests
+RUN_TEST_STEP	100	openwftestserver	TEFUnit.COpenwfTest.GRAPHICS_OPENWFC_FASTPATH_0000L openwftest.ini
+RUN_TEST_STEP	100	openwftestserver	TEFUnit.COpenwfTest.GRAPHICS_OPENWFC_FASTPATH_0001L openwftest.ini
+RUN_TEST_STEP	100	openwftestserver	TEFUnit.COpenwfTest.GRAPHICS_OPENWFC_FASTPATH_0002L openwftest.ini
+RUN_TEST_STEP	100	openwftestserver	TEFUnit.COpenwfTest.GRAPHICS_OPENWFC_FASTPATH_0003L openwftest.ini
+RUN_TEST_STEP	100	openwftestserver	TEFUnit.COpenwfTest.GRAPHICS_OPENWFC_FASTPATH_0004L openwftest.ini
+RUN_TEST_STEP	100	openwftestserver	TEFUnit.COpenwfTest.GRAPHICS_OPENWFC_FASTPATH_0005L openwftest.ini
+RUN_TEST_STEP	100	openwftestserver	TEFUnit.COpenwfTest.GRAPHICS_OPENWFC_FASTPATH_0006L openwftest.ini
+RUN_TEST_STEP	100	openwftestserver	TEFUnit.COpenwfTest.GRAPHICS_OPENWFC_FASTPATH_0007L openwftest.ini
+
+//notificiation during fastpath tests
+RUN_TEST_STEP	100	openwftestserver	TEFUnit.COpenwfTest.GRAPHICS_OPENWFC_FASTPATH_0010L openwftest.ini
+RUN_TEST_STEP	100	openwftestserver	TEFUnit.COpenwfTest.GRAPHICS_OPENWFC_FASTPATH_0011L openwftest.ini
+RUN_TEST_STEP	100	openwftestserver	TEFUnit.COpenwfTest.GRAPHICS_OPENWFC_FASTPATH_0012L openwftest.ini
+RUN_TEST_STEP	100	openwftestserver	TEFUnit.COpenwfTest.GRAPHICS_OPENWFC_FASTPATH_0013L openwftest.ini
+
+//negative fastpath tests
+RUN_TEST_STEP	100	openwftestserver	TEFUnit.COpenwfTest.GRAPHICS_OPENWFC_FASTPATH_0020L openwftest.ini
+RUN_TEST_STEP	100	openwftestserver	TEFUnit.COpenwfTest.GRAPHICS_OPENWFC_FASTPATH_0021L openwftest.ini
+RUN_TEST_STEP	100	openwftestserver	TEFUnit.COpenwfTest.GRAPHICS_OPENWFC_FASTPATH_0022L openwftest.ini
+RUN_TEST_STEP	100	openwftestserver	TEFUnit.COpenwfTest.GRAPHICS_OPENWFC_FASTPATH_0023L openwftest.ini
+RUN_TEST_STEP	100	openwftestserver	TEFUnit.COpenwfTest.GRAPHICS_OPENWFC_FASTPATH_0024L openwftest.ini
+RUN_TEST_STEP	100	openwftestserver	TEFUnit.COpenwfTest.GRAPHICS_OPENWFC_FASTPATH_0025L openwftest.ini
+RUN_TEST_STEP	100	openwftestserver	TEFUnit.COpenwfTest.GRAPHICS_OPENWFC_FASTPATH_0026L openwftest.ini
+RUN_TEST_STEP	100	openwftestserver	TEFUnit.COpenwfTest.GRAPHICS_OPENWFC_FASTPATH_0027L openwftest.ini
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicscomposition/openwftest/scripts/openwftest_automatic_c_save.ini	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,48 @@
+// Copyright (c) 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:
+// This automaic mode ini is pre set to run in automatic mode with an adequate composition pause
+// This ini is preset to save images to the C drive
+
+[TestInfo]
+// Note: 0 for automatic mode, 1 for manual interactive mode
+TestMode = 0
+// Note: SaveImage, "true" for saving images, "false" for not saving images. This option ONLY applies when the above mode is automatic.
+SaveImage = true
+// Note: Directory to place saved images
+Dir = c:\openwftest\img\
+// Note: Delay length in microseconds to allow compositions to complete
+CompositionPause = 500000
+// Note: Delay length in microseconds to allow user to compare images in manual interactive mode-max 34000000(34 seconds)
+ManualPause = 3000000
+
+[ImageInfo]
+// Note: ContiguousFlag, "true" for contiguous, "false" for non-contiguous
+ContiguousFlag = true
+
+Tolerance = 0
+
+// FastpathableWidth 
+// FastpathableHeight
+// Stride       
+// FastpathablePixelFormat = 1027549A
+// NonFastpathablePixelFormat = 1027549E
+// OffsetToFirstBuffer = 0
+// Alignment = 0         
+// Mappable = ETrue
+// MaxBuffers = 2             
+// MinBuffers = 1
+// OffsetBetweenBuffers = 0
+// SurfaceHints = 0
+// Note: CacheAttrib, "true" for CPU cached, "false" for not CPU cached
+// CacheAttrib 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicscomposition/openwftest/scripts/openwftest_automatic_e_save.ini	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,48 @@
+// Copyright (c) 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:
+// This automaic mode ini is pre set to run in automatic mode with an adequate composition pause
+// This ini is preset to save images to the C drive
+
+[TestInfo]
+// Note: 0 for automatic mode, 1 for manual interactive mode
+TestMode = 0
+// Note: SaveImage, "true" for saving images, "false" for not saving images. This option ONLY applies when the above mode is automatic.
+SaveImage = true
+// Note: Directory to place saved images
+Dir = e:\openwftest\img\
+// Note: Delay length in microseconds to allow compositions to complete
+CompositionPause = 500000
+// Note: Delay length in microseconds to allow user to compare images in manual interactive mode-max 34000000(34 seconds)
+ManualPause = 3000000
+
+[ImageInfo]
+// Note: ContiguousFlag, "true" for contiguous, "false" for non-contiguous
+ContiguousFlag = true
+
+Tolerance = 0
+
+// FastpathableWidth 
+// FastpathableHeight
+// Stride       
+// FastpathablePixelFormat = 1027549A
+// NonFastpathablePixelFormat = 1027549E
+// OffsetToFirstBuffer = 0
+// Alignment = 0         
+// Mappable = ETrue
+// MaxBuffers = 2             
+// MinBuffers = 1
+// OffsetBetweenBuffers = 0
+// SurfaceHints = 0
+// Note: CacheAttrib, "true" for CPU cached, "false" for not CPU cached
+// CacheAttrib 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicscomposition/openwftest/scripts/openwftest_automatic_nosave.ini	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,48 @@
+// Copyright (c) 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:
+// This automaic mode ini is pre set to run in automatic mode with an adequate composition pause
+// This ini is preset to save images to the C drive
+
+[TestInfo]
+// Note: 0 for automatic mode, 1 for manual interactive mode
+TestMode = 0
+// Note: SaveImage, "true" for saving images, "false" for not saving images. This option ONLY applies when the above mode is automatic.
+SaveImage = false
+// Note: Directory to place saved images
+//Dir = c:\openwftest\img\
+// Note: Delay length in microseconds to allow compositions to complete
+CompositionPause = 500000
+// Note: Delay length in microseconds to allow user to compare images in manual interactive mode-max 34000000(34 seconds)
+ManualPause = 3000000
+
+[ImageInfo]
+// Note: ContiguousFlag, "true" for contiguous, "false" for non-contiguous
+ContiguousFlag = true
+
+Tolerance = 0
+
+// FastpathableWidth 
+// FastpathableHeight
+// Stride       
+// FastpathablePixelFormat = 1027549A
+// NonFastpathablePixelFormat = 1027549E
+// OffsetToFirstBuffer = 0
+// Alignment = 0         
+// Mappable = ETrue
+// MaxBuffers = 2             
+// MinBuffers = 1
+// OffsetBetweenBuffers = 0
+// SurfaceHints = 0
+// Note: CacheAttrib, "true" for CPU cached, "false" for not CPU cached
+// CacheAttrib 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicscomposition/openwftest/scripts/openwftest_manual.ini	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,48 @@
+// Copyright (c) 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:
+// This manual mode ini is pre set to run in manual mode with a 10 second pause for image checks
+// In manual mode it does not save images
+
+[TestInfo]
+// Note: 0 for automatic mode, 1 for manual interactive mode
+TestMode = 1
+// Note: SaveImage, "true" for saving images, "false" for not saving images. This option ONLY applies when the above mode is automatic.
+//SaveImage = false
+// Note: Directory to place saved images
+//Dir = c:\openwftest\img\
+// Note: Delay length in microseconds to allow compositions to complete
+CompositionPause = 500000
+// Note: Delay length in microseconds to allow user to compare images in manual interactive mode-max 34000000(34 seconds)
+ManualPause = 3000000
+
+[ImageInfo]
+// Note: ContiguousFlag, "true" for contiguous, "false" for non-contiguous
+ContiguousFlag = true
+
+Tolerance = 0
+
+// FastpathableWidth 
+// FastpathableHeight
+// Stride       
+// FastpathablePixelFormat = 1027549A
+// NonFastpathablePixelFormat = 1027549E
+// OffsetToFirstBuffer = 0
+// Alignment = 0         
+// Mappable = ETrue
+// MaxBuffers = 2             
+// MinBuffers = 1
+// OffsetBetweenBuffers = 0
+// SurfaceHints = 0
+// Note: CacheAttrib, "true" for CPU cached, "false" for not CPU cached
+// CacheAttrib 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicscomposition/openwftest/src/eglsynchelper.c	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,202 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// eglsynchelper.c
+//
+
+#include "eglsynchelper.h"
+#include "EGL/egltypes.h"
+
+#ifndef EGL_EGLEXT_PROTOTYPES
+
+#define EGLSYNC_TYPE 0xE5
+
+/* sync object data type for POSIX thread implementation*/
+
+typedef struct CondVarSync_* NativeSyncType;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*-------------------------------------------------------------------*//*!
+ * \brief   Create a sync object for the specified display.
+ * \ingroup api
+ * \param   dpy     Identifier of the display which will own the sync object
+ * \param   type    Type of the sync object. EGL_SYNC_REUSABLE_KHR is only supported
+ * \param   attrib_list Attribute-value list specifying attributes of the sync 
+ * object, terminated by an attribute entry EGL_NONE
+ * \return  Handle for the created sync object if successful, EGL_NO_SYNC_KHR otherwise
+ * \error   EGL_BAD_DISPLAY if <dpy> is not a name of a valid EGLDisplay;
+ * EGL_NOT_INITIALIZED if the display object associated with the <dpy> has not been initialized;
+ * EGL_BAD_ATTRIBUTE if <attrib_list> is neither NULL nor empty (containing only EGL_NONE) or 
+ * if <type> is not a supported type of sync object;
+ * EGL_BAD_ALLOC if the memory allocation related to sync object is not successful
+ * \note    If <type> is EGL_SYNC_REUSABLE_KHR, a reusable sync object is created. 
+ * In this case <attrib_list> must be NULL or empty (containing only EGL_NONE).
+ *  *//*-------------------------------------------------------------------*/
+EGLSyncKHR eglCreateSyncKHR( EGLDisplay dpy,
+                       EGLenum condition,
+                       const EGLint *attrib_list )
+{
+    PFNEGLCREATESYNCKHRPROC createPointer = (PFNEGLCREATESYNCKHRPROC) eglGetProcAddress("eglCreateSyncKHR");
+
+	if (createPointer == NULL)
+		{
+		return EGL_NO_SYNC_KHR;
+		}
+	else
+		{
+		return createPointer(dpy, condition, attrib_list);
+		}
+}
+
+
+/*-------------------------------------------------------------------*//*!
+ * \brief   Destroy a sync object and free memory associated with it
+ * \ingroup api
+ * \param   dpy     Identifier of the display which owns the sync object
+ * \param   sync    Sync object handle. 
+ * \return  EGL_TRUE if deletion was successful and EGL_FALSE otherwise
+ * \error   EGL_BAD_DISPLAY if <dpy> is not a name of a valid EGLDisplay;
+ * EGL_NOT_INITIALIZED if the display object associated with the <dpy> has not been initialized;
+ * EGL_BAD_PARAMETER if <sync> is not a valid sync object for <dpy>
+ * \note    If any eglClientWaitSyncKHR commands are blocking on <sync> when 
+ * eglDestroySyncKHR is called, they will be woken up, as if <sync> were signaled. 
+ * If no errors are generated, <sync> will no longer be the handle of a valid sync object.
+ *//*-------------------------------------------------------------------*/
+EGLBoolean eglDestroySyncKHR( EGLDisplay dpy, EGLSyncKHR sync )
+{
+    PFNEGLDESTROYSYNCKHRPROC destroyPointer = (PFNEGLDESTROYSYNCKHRPROC) eglGetProcAddress("eglDestroySyncKHR");
+
+	if (destroyPointer == NULL)
+		{
+		return EGL_FALSE;
+		}
+	else
+		{
+		return destroyPointer(dpy, sync);
+		}
+}
+
+/*-------------------------------------------------------------------*//*!
+ * \brief   Blocks the calling thread until the specified sync object 
+ * is signaled, or until <timeout> nanoseconds have passed.  
+ * \ingroup api
+ * \param   dpy     Identifier of the display which owns the sync object.
+ * \param   sync    Sync object handle. 
+ * \param   flags   If the EGL_FLUSH_COMMANDS_BIT_KHR bit is set in <flags>
+ * and <sync> is unsignaled when the function is called, then the equivalent
+ * of Flush() will be performed for the current API context.   
+ * \param   timeout The thread will be unblocked when <timeout> is expired.
+ * If the <timeout> is to zero, the function just test the current status 
+ * of the sync object. If the <timeout> is set to EGL_FOREVER_KHR, then the 
+ * function does not time out. For all other values, <timeout> is adjusted to 
+ * the closest value which may be substantially longer than one nanosecond. 
+ * \return  EGL_CONDITION_SATISFIED if <sync> was signaled before
+ * the timeout expired, which includes the case when <sync> was already 
+ * signaled when eglClientWaitSyncKHR was called; EGL_TIMEOUT_EXPIRED_KHR if the 
+ * specified timeout period expired before <sync> was signaled; 
+ * EGL_FALSE if an error occurs.
+ * \error   EGL_BAD_DISPLAY if <dpy> is not a name of a valid EGLDisplay;
+ * EGL_NOT_INITIALIZED if the display object associated with the <dpy> has not been initialized;
+ * EGL_BAD_PARAMETER if <sync> is not a valid sync object for <dpy> or 
+ * if <flags> does not equal to 0 or EGL_SYNC_FLUSH_COMMAND_BIT_KHR
+ * Note\    More than one eglClientWaitSyncKHR may be outstanding on the same <sync> at any given time. 
+ * When there are multiple threads blocked on the same <sync> and the sync object is signaled, 
+ * all such threads are released, but the order in which they are released is not defined.
+ * If a sync object is destroyed while an eglClientWaitSyncKHR is blocking on that object, 
+ * eglClientWaitSyncKHR will unblock and return immediately, just as if the sync object 
+ * had been signaled prior to being destroyed.
+ *//*-------------------------------------------------------------------*/
+EGLint eglClientWaitSyncKHR( EGLDisplay dpy,
+                             EGLSyncKHR sync,
+                             EGLint flags,
+                             EGLTimeKHR timeout )
+{
+    PFNEGLCLIENTWAITSYNCKHRPROC clientWaitPointer = (PFNEGLCLIENTWAITSYNCKHRPROC) eglGetProcAddress("eglClientWaitSyncKHR");
+
+	if (clientWaitPointer == NULL)
+		{
+		return EGL_FALSE;
+		}
+	else
+		{
+		return clientWaitPointer(dpy, sync, flags, timeout);
+		}
+}
+
+/*-------------------------------------------------------------------*//*!
+ * \brief   Signals or unsignals the reusable sync object.  
+ * \ingroup api
+ * \param   dpy     Identifier of the display which owns the sync object.
+ * \param   sync    Sync object handle. 
+ * \param   mode    Status of the sync object. There are two possible states: 
+ *  EGL_SIGNALED_KHR and EGL_UNSIGNALED_KHR. 
+ * \return  EGL_TRUE if an operation was successful and EGL_FALSE otherwise.
+ * \note    The error code returned from eglSignalSyncImpl() will be generated
+ *//*-------------------------------------------------------------------*/
+EGLBoolean eglSignalSyncKHR( EGLDisplay dpy,
+                             EGLSyncKHR sync,
+                             EGLenum mode )
+{
+    PFNEGLSIGNALSYNCKHRPROC signalPointer = (PFNEGLSIGNALSYNCKHRPROC) eglGetProcAddress("eglSignalSyncKHR");
+	
+   if (signalPointer == NULL)
+	   {
+	   return EGL_FALSE;
+       }
+   else
+	   {
+	   return signalPointer(dpy, sync, mode);
+	   }
+}
+
+
+/*-------------------------------------------------------------------*//*!
+ * \brief   Query an attribute of the sync object  
+ * \ingroup api
+ * \param   dpy     Identifier of the display which owns the sync object
+ * \param   sync    Sync object handle. 
+ * \param   attribute   An attribute to be retrieved. 
+ * \param   value   Pointer to the value for the requested attribute which will be filled on function return. 
+ * \return  EGL_TRUE if an operation was successful and EGL_FALSE otherwise
+ * \error   EGL_BAD_DISPLAY if <dpy> is not a name of a valid EGLDisplay;
+ * EGL_NOT_INITIALIZED if the display object associated with the <dpy> has not been initialized;
+ * EGL_BAD_PARAMETER if <sync> is not a valid sync object for <dpy> or if <value> is not 
+ * a valid pointer; EGL_BAD_ATTRIBUTE if <attribute>  does not lie within expected range;
+ * EGL_BAD_MATCH if <attribute> is not supported for the type of sync object passed in <sync>
+ *//*-------------------------------------------------------------------*/
+EGLBoolean eglGetSyncAttribKHR( EGLDisplay dpy,
+                                EGLSyncKHR sync,
+                                EGLint attribute,
+                                EGLint *value )
+{
+    PFNEGLGETSYNCATTRIBKHRPROC getAttribPointer = (PFNEGLGETSYNCATTRIBKHRPROC) eglGetProcAddress("eglGetSyncAttribKHR");
+
+	if (getAttribPointer == NULL)
+		{
+		return EGL_FALSE;
+		}
+	else
+		{
+		return getAttribPointer(dpy, sync, attribute, value);
+		}
+}
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicscomposition/openwftest/src/openwftest.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,2763 @@
+// Copyright (c) 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:
+// OpenWF tests
+//
+#include <test/extendtef.h>
+#include <hal.h>
+#include "openwftest.h"
+
+#define KCompositorVersion	0x01023456
+#define KGrowCleanupStack	12
+#define KMaxNotificationDelay   5000000 //5 seconds
+#define KNotificationWarning    100000  //100 ms
+
+_LIT(KTestSectionName, "TestInfo");
+_LIT(KImageSectionName, "ImageInfo");
+_LIT(KContiguousFlag, "ContiguousFlag");
+_LIT(KTolerance, "Tolerance");
+_LIT(KTestMode, "TestMode");
+_LIT(KSaveImage, "SaveImage");
+_LIT(KDir, "Dir");
+_LIT(KDefaultDir, "c:\\openwftest\\img\\");
+_LIT(KCompositionPause, "CompositionPause");
+_LIT(KManualPause, "ManualPause");
+
+//Uncomment this and rebuild if you wish to test if fastpath is enabled using breakpoints
+//#define BREAKPOINT_FASTPATH
+
+/*
+ * COpenwfTest implementation
+ */
+COpenwfTest::COpenwfTest()
+:iFastpathablePixelFormat(EUidPixelFormatXRGB_8888),
+ iNonFastpathablePixelFormat(EUidPixelFormatRGB_565),
+ iMappable(ETrue),
+ iMaxBuffers(2),
+ iMinBuffers(1),
+ iCacheAttrib(ECacheNotlisted),
+ iDeviceId(WFC_INVALID_HANDLE),
+ iSync(EGL_NO_SYNC_KHR),
+ iDevice(WFC_INVALID_HANDLE),
+ iContext(WFC_INVALID_HANDLE)
+	{
+	}
+
+COpenwfTest::~COpenwfTest()
+	{
+    TearDown();
+	}
+
+void COpenwfTest::SetupL()
+    {    
+    iScheduler = new(ELeave) CActiveScheduler;
+    CActiveScheduler::Install(iScheduler);
+
+    ReadIniData();
+    
+    iEGLDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+    ASSERT_FALSE(iEGLDisplay == EGL_NO_DISPLAY);
+    ASSERT_FALSE(iEGLDisplay == EGL_BAD_ALLOC);
+    ASSERT_EQUALS(eglGetError(),EGL_SUCCESS);
+    eglInitialize(iEGLDisplay, NULL, NULL);
+    ASSERT_EQUALS(eglGetError(),EGL_SUCCESS);
+    
+    WFCint filterList[] = { WFC_DEVICE_FILTER_SCREEN_NUMBER, WFC_DEFAULT_SCREEN_NUMBER, WFC_NONE};
+    ASSERT_TRUE(wfcEnumerateDevices(&iDeviceId, 1, filterList) == 1);
+    ASSERT_TRUE(iDeviceId != WFC_INVALID_HANDLE);    
+
+    iDevice = wfcCreateDevice(iDeviceId, NULL);
+    ASSERT_TRUE(iDevice != WFC_INVALID_HANDLE);  
+    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
+    iContext = wfcCreateOnScreenContext(iDevice, WFC_DEFAULT_SCREEN_NUMBER, NULL);
+    ASSERT_TRUE(iContext != WFC_INVALID_HANDLE);  
+    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
+
+    iFastpathableHeight = wfcGetContextAttribi(iDevice, iContext, WFC_CONTEXT_TARGET_HEIGHT);
+    iFastpathableWidth = wfcGetContextAttribi(iDevice, iContext, WFC_CONTEXT_TARGET_WIDTH);
+    iStride = iFastpathableWidth * 4;
+
+    iFullScreenTRect = TRect(0,0,iFastpathableWidth,iFastpathableHeight);
+    iFullScreenRect[0] = 0;
+    iFullScreenRect[1] = 0;
+    iFullScreenRect[2] = iFullScreenTRect.Width();
+    iFullScreenRect[3] = iFullScreenTRect.Height();
+    
+    iCenterTRect = TRect(iFastpathableWidth/4,iFastpathableHeight/4,
+            3*iFastpathableWidth/4,3*iFastpathableHeight/4);
+    iCenterRect[0] = iCenterTRect.iTl.iX;
+    iCenterRect[1] = iCenterTRect.iTl.iY;
+    iCenterRect[2] = iCenterTRect.Width();
+    iCenterRect[3] = iCenterTRect.Height();
+    
+    iHalfSizeRect[0] = 0;
+    iHalfSizeRect[1] = 0;
+    iHalfSizeRect[2] = iFastpathableWidth/2;
+    iHalfSizeRect[3] = iFastpathableHeight/2;
+    
+    iUtility = CSurfaceUtility::NewL();
+
+    if((iTestMode == EAutomatic) || iSaveImage)
+        {
+        // Need to initialise the on screen stream before composition
+        // to ensure the content is available later 
+        iUtility->GetOnScreenStream(iDevice, iContext);
+        }
+    if (iSaveImage)
+        {   // Create a directory to save images
+        iUtility->CreateImagePath(iImageDirectory);                
+        }
+    iAllowManualPause = ETrue; //tests can stop it (eg dispXtimes tests) 
+    
+    EGLint attrib_list[1] = {EGL_NONE};
+    iSync = eglCreateSyncKHR(iEGLDisplay,EGL_SYNC_REUSABLE_KHR, attrib_list);
+    ASSERT_NOT_EQUALS(iSync,EGL_NO_SYNC_KHR);
+    ASSERT_EQUALS(eglGetError(),EGL_SUCCESS);
+    }
+
+/**
+ * test Suite furniture 
+ **/
+void COpenwfTest::TearDownL()
+    {
+    // Nothing leaves in this function, 
+    // but TearDownL() is needed for the CTestFixture (TEF) interface
+    TearDown();
+    }
+
+void COpenwfTest::TearDown()
+    {
+    WFCErrorCode wfcError;
+    if (iDevice != WFC_INVALID_HANDLE)
+        {
+        wfcError = wfcGetError(iDevice);
+        if (wfcError != WFC_ERROR_NONE)
+            {
+            INFO_PRINTF2(_L("TearDown: There was a failure in the test. error=%d"),wfcError);
+            }
+        }
+    if (iOnScreenStream != WFC_INVALID_HANDLE)
+        {
+        (void)SymbianStreamReleaseReadBuffer(iOnScreenStream, iOnScreenBuffer); //ignore the error
+        iOnScreenStream = WFC_INVALID_HANDLE;
+        }
+    delete iUtility;
+    iUtility = NULL;
+    if (iContext != WFC_INVALID_HANDLE)
+        {
+        wfcDestroyContext(iDevice, iContext);
+        iContext = WFC_INVALID_HANDLE;
+        WFCErrorCode wfcError = wfcGetError(iDevice);
+        if (wfcError != WFC_ERROR_NONE)
+            {
+            INFO_PRINTF2(_L("TearDown: wfcDestroyContext error=%d"),wfcError);
+            }
+        }
+    if (iDevice != WFC_INVALID_HANDLE)
+        {
+        WFCErrorCode deviceError = wfcDestroyDevice(iDevice);
+        iDevice = WFC_INVALID_HANDLE;
+        if (deviceError != WFC_ERROR_NONE)
+            {
+            INFO_PRINTF2(_L("TearDown: wfcDestroyDevice error=%d"),deviceError);
+            }
+        }
+    if (iSync != EGL_NO_SYNC_KHR)
+        {
+        EGLBoolean eglSyncError = eglDestroySyncKHR(iEGLDisplay, iSync);
+        iSync = EGL_NO_SYNC_KHR;
+        if (eglSyncError != EGL_TRUE)
+            {
+            INFO_PRINTF2(_L("TearDown: eglSyncError line %d"),__LINE__);
+            }
+        }
+    if (iEGLDisplay != EGL_NO_DISPLAY)
+        {
+        EGLBoolean eglTerminateError = eglTerminate(iEGLDisplay);
+        iEGLDisplay = EGL_NO_DISPLAY;
+        if (eglTerminateError != EGL_TRUE)
+            {
+            INFO_PRINTF2(_L("TearDown: eglTerminateError line %d"),__LINE__);
+            }
+        }
+    delete iScheduler;
+    iScheduler = NULL;
+    }
+
+/**
+ * To be called at the beginning of tests
+ * aActivate default is ON
+ */
+void COpenwfTest::SetupEmptySceneL(TBool aActivate)
+    {
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    wfcSetContextAttribi(iDevice, iContext, WFC_CONTEXT_ROTATION, WFC_ROTATION_0);
+    wfcSetContextAttribi(iDevice, iContext, WFC_CONTEXT_BG_COLOR, 0xFFFFFFFF);
+    if (aActivate)
+        {
+        LOG(("OpenWFTest: Running in autonomous composition mode"));
+        wfcActivate(iDevice,iContext);
+        }
+    else
+        {
+        LOG(("OpenWFTest: Running in non autonomous composition mode"));
+        wfcDeactivate(iDevice,iContext);
+        }
+    LOG(("OpenWFTest: Expecting COMPOSITION after next commit"));
+    wfcCommit(iDevice, iContext, WFC_TRUE);   // Compose the scene
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
+    LOG(("OpenWFTest: Fastpath - setting up scene - fastpath now off"));
+    }
+
+void COpenwfTest::ReadIniData()
+    {
+	//test mode
+    TBool returnValue = iConfig.GetInt(KTestSectionName, KTestMode, iTestMode);
+    ASSERT_TRUE(returnValue);
+    
+    //save images
+	iSaveImage=EFalse;
+    if (iTestMode == EAutomatic)
+        {
+        returnValue = iConfig.GetBool(KTestSectionName, KSaveImage, iSaveImage);
+        }
+    
+    // Get path for the images to be saved to
+    TPtrC dir;
+    returnValue = iConfig.GetString(KTestSectionName, KDir, dir);
+    if (returnValue)
+        {
+		iImageDirectory.Set(dir);
+        }
+    else
+        {
+		iImageDirectory.Set(KDefaultDir);
+        }
+    
+    // Composition pause in microseconds
+    TInt compositionPause;
+    returnValue = iConfig.GetInt(KTestSectionName, KCompositionPause, compositionPause);
+    ASSERT_TRUE(returnValue);
+    iCompositionPause = compositionPause;
+    
+    // Manual pause in microseconds
+    iManualPause = 0;
+    if (iTestMode != EAutomatic)
+        {
+		TInt manualPause;
+		returnValue = iConfig.GetInt(KTestSectionName, KManualPause, manualPause);
+		ASSERT_TRUE(returnValue);
+		iManualPause = manualPause;
+        }
+    
+    // Force contiguous
+    TBool contiguousFlag;
+    returnValue = iConfig.GetBool(KImageSectionName, KContiguousFlag, contiguousFlag);
+    if (returnValue && contiguousFlag)
+        {
+        iContiguous = EContiguous;
+        }
+    
+    // Test tolerance
+    TInt tolerance;
+    returnValue = iConfig.GetInt(KImageSectionName, KTolerance, tolerance);
+    if (returnValue)
+        {
+        iTolerance = tolerance;
+        }
+    }
+
+/**
+ * Acquires the on screen stream and buffer number
+ * NOTE: this function should be paired with a ReleaseOnScreenStream call
+ * Returns ETrue on success
+ */
+TBool COpenwfTest::AcquireOnScreenStream()
+	{
+	TInt error = KErrNone;
+	ASSERT_TRUE(iOnScreenStream == WFC_INVALID_HANDLE);
+    if(iTestMode == EAutomatic)
+    	{	//need to get the on screen stream
+		iOnScreenStream = iUtility->GetOnScreenStream(iDevice, iContext);
+		if(iOnScreenStream == WFC_INVALID_HANDLE)
+			{
+			INFO_PRINTF1(_L("Failed getting on screen stream"));
+			LOG(("OpenWFTest: *** Failed getting on screen stream"));
+			return EFalse;
+			}
+		error = SymbianStreamAcquireReadBuffer(iOnScreenStream, &iOnScreenBuffer);
+		if (error != KErrNone)
+			{
+			LOG(("OpenWFTest: *** Unable to acquire read buffer. error = %d",error));
+			INFO_PRINTF2(_L("Unable to acquire read buffer. error = %d"),error);
+			}
+		return (error == KErrNone);
+    	}
+	else
+		{
+		INFO_PRINTF1(_L("No need to get the on screen stream, probably manual checking mode"));
+		LOG(("OpenWFTest: *** No need to get the on screen stream, probably manual checking mode"));
+		return ETrue;
+		}
+	}
+
+/**
+ * Releases the on screen stream
+ */
+void COpenwfTest::ReleaseOnScreenStream()
+	{
+	if (iOnScreenStream != WFC_INVALID_HANDLE)
+		{
+		(void)SymbianStreamReleaseReadBuffer(iOnScreenStream, iOnScreenBuffer);	//ignore the error
+		iOnScreenStream = WFC_INVALID_HANDLE;
+		}
+	if(iTestMode != EAutomatic && iAllowManualPause)
+		{
+		INFO_PRINTF1(_L("Performing manual wait"));
+		LOG(("OpenWFTest: *** Performing manual wait"));
+		TRAP_IGNORE(WaitL(iManualPause));
+		}
+	if(iTestMode != EAutomatic && !iAllowManualPause)
+	    {
+        INFO_PRINTF1(_L("Test not allowing a manual wait"));
+        LOG(("OpenWFTest: *** Test not allowing a manual wait"));
+	    }
+	}
+
+/**
+ * Checks the rect of the on screen stream
+ * Returns ETrue on success
+ */
+TBool COpenwfTest::CheckOnScreenStreamRect(TRect aRect, const TRgb& aExpectedColor, TInt aTolerance)
+	{
+    if(iTestMode == EAutomatic)
+    	{
+		if (iOnScreenStream == WFC_INVALID_HANDLE)
+			{
+			LOG(("OpenWFTest: *** We don't have access to the on screen stream"));
+			INFO_PRINTF1(_L("We don't have access to the on screen stream"));
+			return EFalse;
+			}
+		const TSurfaceId* surfaceId = NULL;
+		long bufferIndex;
+		TInt error = SymbianStreamGetBufferId(iOnScreenStream,iOnScreenBuffer,&bufferIndex,&surfaceId);
+		if (error == KErrNone)
+			{
+			return CheckRect(*surfaceId,bufferIndex,aRect,aExpectedColor,aTolerance);
+			}
+		else
+			{
+			LOG(("OpenWFTest: *** Unable to get stream buffer id. error = %d",error));
+			INFO_PRINTF2(_L("Unable to get stream buffer id. error = %d"),error);
+			return EFalse;
+			}
+    	}
+    else
+    	{	//print out what we're hoping to see for manual testing
+		LOG(("OpenWFTest: For rect %d %d %d %d",aRect.iTl.iX,aRect.iTl.iY,aRect.iBr.iX,aRect.iBr.iY));
+		LOG(("OpenWFTest: The expected color is r=%d g=%d b=%d",aExpectedColor.Red(),aExpectedColor.Green(),
+				aExpectedColor.Blue()));
+		INFO_PRINTF5(_L("For rect %d %d %d %d"),aRect.iTl.iX,aRect.iTl.iY,aRect.iBr.iX,aRect.iBr.iY);
+		INFO_PRINTF4(_L("The expected color is r=%d g=%d b=%d"),aExpectedColor.Red(),aExpectedColor.Green(),
+				aExpectedColor.Blue());
+		return ETrue;
+    	}
+	}
+
+/**
+ * checks the color within the given rectangle of the given surface
+ * returns ETrue on success
+ */
+TBool COpenwfTest::CheckRect(const TSurfaceId& aSurface, TInt aBuffer,  TRect aRect,
+		const TRgb& aExpectedColor, TInt aTolerance)
+	{
+	INFO_PRINTF1(_L("Starting pixel checking"));
+	LOG(("OpenWFTest: *** Starting pixel checking"));
+	// Check pixel data
+	
+	TBool success = iUtility->CheckRectColor(aSurface, aRect, aBuffer, aExpectedColor, aTolerance);
+	if (success)
+		{
+		INFO_PRINTF1(_L("Finished pixel checking - pass"));
+		LOG(("OpenWFTest: *** Finished pixel checking - pass"));
+		}
+	else
+		{
+		INFO_PRINTF1(_L("Finished pixel checking - fail"));
+		LOG(("OpenWFTest: *** Finished pixel checking - fail"));
+		}
+    return success;
+	}
+
+/**
+ * If in automatic mode it will save a TGA image of the on screen stream.
+ * It will also print the name of the reference image.
+ * Returns ETrue on success
+ */
+TBool COpenwfTest::CheckOnScreenReferenceImage()
+	{
+	TInt error = KErrNone;
+	//Create image file name
+	_LIT(KSeparator, "_");
+	_LIT(KTGAImgFormat, ".tga");
+	iImageAddress.Zero();
+	iImageAddress.Append(iTestName);
+	iImageAddress.Append(KSeparator);
+	iImageAddress.AppendNum(iImageCounter);
+	iImageAddress.Append(KTGAImgFormat);
+    
+	LOGL((_L("Reference Image:%S"),&iImageAddress));
+	INFO_PRINTF2(_L("Reference Image:%S"),&iImageAddress);
+	//Add file path
+	iImageAddress.Insert(0,iImageDirectory);
+	iImageCounter++;
+	
+    if(iTestMode == EAutomatic && iSaveImage)
+    	{
+		if (iOnScreenStream == WFC_INVALID_HANDLE)
+			{
+			LOG(("OpenWFTest: *** We don't have access to the on screen stream",error));
+			INFO_PRINTF1(_L("We don't have access to the on screen stream"));
+			return EFalse;
+			}
+		const TSurfaceId* surfaceId = NULL;
+		long bufferIndex;
+		error = SymbianStreamGetBufferId(iOnScreenStream,iOnScreenBuffer,&bufferIndex,&surfaceId);
+		if (error == KErrNone)
+			{
+			return SaveImage(*surfaceId,bufferIndex);
+			}
+		else
+			{
+			LOG(("OpenWFTest: *** Unable to get stream buffer id. error = %d",error));
+			INFO_PRINTF2(_L("Unable to get stream buffer id. error = %d"),error);
+			return EFalse;
+			}
+    	}
+    return ETrue;
+	}
+
+/**
+ *  helper function for saving images to files
+ *  returns ETrue on success
+ */
+TBool COpenwfTest::SaveImage(const TSurfaceId& aSurface, TInt aNumOfBuffer)
+    {
+	if(iTestMode == EAutomatic && iSaveImage)
+		{
+		INFO_PRINTF1(_L("Start to save image"));
+		LOG(("OpenWFTest: *** Start to save image"));
+		TBool success = EFalse;
+		TRAPD(error, success = iUtility->SaveResultImageTGAL(aSurface, aNumOfBuffer, iImageAddress));
+		if(error != KErrNone || !success)
+			{
+			INFO_PRINTF1(_L("Failed saving image"));
+			LOG(("OpenWFTest: *** Failed saving image"));
+			return EFalse;
+			}
+		INFO_PRINTF1(_L("Saved image"));
+		LOG(("OpenWFTest: *** Saved image"));
+		}
+    return ETrue;
+    }
+
+/**
+ * Basic wait function call. Return amount of other active objects that stopped the scheduler
+*/
+TInt COpenwfTest::WaitL(TTimeIntervalMicroSeconds32 aDelay)	//aDelay in microseconds
+	{
+	CActiveWaiter* waiter = NULL;
+	waiter = CActiveWaiter::NewL();
+    TInt counter = waiter->Wait(aDelay);
+	delete waiter;
+	return counter;
+	}
+
+/**
+ * aMaxDelay    The maximum time we are willing to wait in microseconds
+ * aNotifications   The amount of notifications we expect to complete, must be >0
+ * Returns ETrue on success
+*/
+TBool COpenwfTest::WaitForNotifications(TTimeIntervalMicroSeconds32 aMaxDelay,TInt aNotificatons)
+    {
+    if (aNotificatons == 0)
+        {   //use WaitL if no notifications are expected
+        return EFalse;
+        }
+    TTime before;
+    TTime after;
+    before.UniversalTime();
+    TTimeIntervalMicroSeconds diff;
+    TInt counter = aNotificatons;
+    CActiveWaiter* waiter = NULL;
+    TRAP_IGNORE(waiter = CActiveWaiter::NewL());
+    if (!waiter)
+        {
+        INFO_PRINTF1(_L("Failed creating CActiveWaiter"));
+        LOG(("OpenWFTest: *** Failed creating CActiveWaiter"));
+        return EFalse;
+        }
+    waiter->StartWait(aMaxDelay);
+    CActiveScheduler::Start();
+    while(!waiter->iRun)
+        {
+        after.UniversalTime();
+        diff = after.MicroSecondsFrom(before);
+        if (diff > KNotificationWarning)
+            {
+            INFO_PRINTF2(_L("note: Notification took a long time to complete: %ld microseconds"),diff.Int64());
+            LOG(("OpenWFTest: *** note: Notification took a long time to complete: %ld microseconds",diff.Int64()));
+            }
+        counter--;
+        if (counter == 0)
+            {   //all expected notifications were completed
+            delete waiter;
+            return ETrue;
+            }
+        CActiveScheduler::Start();
+        }
+    INFO_PRINTF2(_L("Not all notifications completed, counter=%d"),counter);
+    LOG(("OpenWFTest: *** Not all notifications completed, counter=%d",counter));
+    delete waiter;
+    //the notifications didn't complete in time
+    return EFalse;
+    }
+
+// Create a suite of all the tests
+CTestSuite* COpenwfTest::CreateSuiteL(const TDesC& aName)
+	{
+	SUB_SUITE_OPT(COpenwfTest,NULL);
+		//positive fastpath tests
+		ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0000L);
+		ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0001L);
+		ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0002L);
+		ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0003L);
+        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0004L);
+        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0005L);
+        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0006L);
+        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0007L);
+        //fastpath with notification tests
+        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0010L);
+        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0011L);
+        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0012L);
+        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0013L);
+        //negative fastpath tests
+        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0020L);
+        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0021L);
+        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0022L);
+        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0023L);
+        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0024L);
+        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0025L);
+        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0026L);
+        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0027L);
+		
+	END_SUITE;
+	}
+
+void TefUnitFailLeaveL()
+	{
+	User::Leave(KErrTEFUnitFail);
+	}
+
+CActiveNotification* CActiveNotification::NewL(RSurfaceUpdateSession& aSurfaceUpdateSession,TBool aActivate)
+	{
+	CActiveNotification* self = new (ELeave) CActiveNotification;
+	CleanupStack::PushL(self);
+	self->ConstructL(aSurfaceUpdateSession);
+	CleanupStack::Pop(self);
+	if (aActivate)
+		{
+		self->SetActive();
+		}
+	return self;
+	}
+
+void CActiveNotification::ConstructL(RSurfaceUpdateSession& aSurfaceUpdateSession)
+	{
+	CActiveScheduler::Add(this);
+	iSurfaceUpdateSession = aSurfaceUpdateSession;
+	}
+	
+CActiveNotification::CActiveNotification() : CActive(EPriorityNormal)
+	{}
+
+CActiveNotification::~CActiveNotification()
+	{
+	Cancel();
+	}
+
+void CActiveNotification::DoCancel()
+	{  //we need to cancel all notifications - this will impact other notifications in this sus session!
+    iSurfaceUpdateSession.CancelAllUpdateNotifications();
+	}
+
+void CActiveNotification::RunL()
+	{
+	CActiveScheduler::Stop();
+	}
+	
+TInt CActiveNotification::RunError(TInt aError)
+	{
+	return aError; // exists so a break point can be placed on it.
+	}
+
+void CActiveNotification::Activate()
+	{
+	SetActive();
+	}
+
+CActiveWaiter* CActiveWaiter::NewL()
+    {
+	CActiveWaiter* self = new (ELeave) CActiveWaiter;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+    
+void CActiveWaiter::ConstructL()
+    {
+    User::LeaveIfError(iTimer.CreateLocal());
+    CActiveScheduler::Add(this);
+    }
+    
+CActiveWaiter::CActiveWaiter() : CActive(CActive::EPriorityStandard)
+    {}
+
+CActiveWaiter::~CActiveWaiter()
+    {
+    Cancel();
+    iTimer.Close();
+    }
+
+void CActiveWaiter::DoCancel()
+    {
+    iTimer.Cancel();
+    }
+
+void CActiveWaiter::RunL()
+    {
+	iRun = ETrue;
+    CActiveScheduler::Stop();
+    }
+    
+TInt CActiveWaiter::RunError(TInt aError)
+    {
+    return aError; // exists so a break point can be placed on it.
+    }
+
+/**
+ * Waits the set amount of time. Returns the amount of times the active scheduler 
+ * was stopped (not including its own active scheduler stop)
+ */
+TInt CActiveWaiter::Wait(TTimeIntervalMicroSeconds32 aDelay)   //microseconds
+    {
+	TInt counter = 0;
+    SetActive();
+    iTimer.After(iStatus, aDelay);
+    iRun = EFalse;
+    CActiveScheduler::Start();
+    while (!iRun)
+    	{//may be another object that stops the scheduler running in these tests.
+		counter++;
+		CActiveScheduler::Start();
+    	}
+    return counter;
+    }
+
+/**
+ * Starts an AO with the given delay. Remember the RunL will stop the active scheduler.
+ */
+void CActiveWaiter::StartWait(TTimeIntervalMicroSeconds32 aDelay)   //microseconds
+    {
+    SetActive();
+    iTimer.After(iStatus, aDelay);
+    }
+
+/*
+@SYMTestCaseID          GRAPHICS-OPENWFC-FASTPATH-0000
+@SYMTestCaseDesc        Positive testing - Fastpath one-element scene
+@SYMREQ                 
+@SYMPREQ                PREQ417-54885
+@SYMTestType            Unit Test
+@SYMTestPriority        High
+@SYMTestPurpose         Check a scene meeting fastpath criteria can be fastpathed
+@SYMTestActions         
+    All compositions are autonomous:
+    Compose an empty scene
+    Create a scene containing a screen sized element with no scaling, no alpha, no mask, no rotation
+    Compose the scene
+@SYMTestExpectedResults
+    The final scene should be fastpathed    
+*/
+void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0000L()
+	{
+    iTestName = _L("FASTPATH_0000");
+    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
+    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
+    SetupEmptySceneL();
+    
+    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
+                                                iFastpathablePixelFormat,
+                                                iStride, iContiguous, iMaxBuffers);
+    ASSERT_FALSE(surface.IsNull());
+
+    WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
+    TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
+    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
+    
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
+    
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
+    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
+    wfcCommit(iDevice, iContext, WFC_TRUE);
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    LOG(("OpenWFTest: Fastpath - Now ON"));
+    
+    iUtility->FillSurfaceL(surface, 0, KGreen);
+    err = iUtility->SubmitUpdate(surface, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WaitL(iCompositionPause);
+    
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
+    ReleaseOnScreenStream();
+
+    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
+    wfcDestroySource(iDevice, fpSource);
+	}
+
+/*
+@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0001
+@SYMTestCaseDesc		Positive testing - Fastpath one-element scene  
+@SYMREQ					
+@SYMPREQ						PREQ417-54885
+@SYMTestType				Unit Test
+@SYMTestPriority		High	
+@SYMTestPurpose			Check a scene including a full screen element with global alpha at opaque level 
+										can be fastpathed
+@SYMTestActions			
+	All compositions are autonomous:
+	Compose an empty scene
+	Create a scene containing a screen sized element with 2 buffers
+	Enable WFC_TRANPARENCY_GLOBAL_ALPHA 
+	Set WFC_ELEMENT_GLOBAL_ALPHA to be 255 (opaque)
+	Compose the scene
+@SYMTestExpectedResults
+	The final scene should be fastpathed
+*/
+void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0001L()
+	{
+    iTestName = _L("FASTPATH_0001");
+    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
+    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
+    SetupEmptySceneL();
+    
+    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
+                                                iFastpathablePixelFormat,
+                                                iStride, iContiguous, iMaxBuffers);
+    ASSERT_FALSE(surface.IsNull());
+
+    WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
+    TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
+    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
+    
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
+    //set element global alpha
+    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA);
+    wfcSetElementAttribf(iDevice, fpElement, WFC_ELEMENT_GLOBAL_ALPHA, 1.0f);
+    
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
+    LOG(("OpenWFTest: Expecting FASTPATH after next commit - using element alpha"));
+    wfcCommit(iDevice, iContext, WFC_TRUE);
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    LOG(("OpenWFTest: Fastpath - now ON - using element alpha"));
+    
+    iUtility->FillSurfaceL(surface, 0, KGreen);
+    err = iUtility->SubmitUpdate(surface, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WaitL(iCompositionPause);	
+ 
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
+    ReleaseOnScreenStream();
+
+    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
+    wfcDestroySource(iDevice, fpSource);  
+	}
+
+/*
+@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0002
+@SYMTestCaseDesc		Positive testing - Fastpath one-element scene  
+@SYMREQ					
+@SYMPREQ						PREQ417-54885
+@SYMTestType				Unit Test
+@SYMTestPriority		High
+@SYMTestPurpose			Check a scene including a full screen element with source alpha flagged but an 
+										opaque data format can be fastpathed
+@SYMTestActions			
+	All compositions are autonomous:
+	Compose an empty scene
+	Create a scene containing a screen sized element 
+	Enable WFC_TRANSPARENCY_SOURCE, but the source format has no alpha value 
+	Compose the scene
+@SYMTestExpectedResults
+	The final scene should be fastpathed
+*/	
+void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0002L()
+	{
+    iTestName = _L("FASTPATH_0002");
+    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
+    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
+    SetupEmptySceneL();
+    
+    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
+												EUidPixelFormatXRGB_8888,
+                                                iStride, iContiguous, iMaxBuffers);
+    ASSERT_FALSE(surface.IsNull());
+
+    WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
+    TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
+    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
+    //set pixel alpha on XRGB element
+    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, WFC_TRANSPARENCY_SOURCE);
+    
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
+    LOG(("OpenWFTest: Expecting FASTPATH after next commit - using pixel alpha"));
+    wfcCommit(iDevice, iContext, WFC_TRUE);
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    LOG(("OpenWFTest: Fastpath - now ON - using pixel alpha"));
+    
+    iUtility->FillSurfaceL(surface, 0, KGreen);
+    err = iUtility->SubmitUpdate(surface, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WaitL(iCompositionPause);
+ 
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
+    ReleaseOnScreenStream();
+
+    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
+    wfcDestroySource(iDevice, fpSource);  
+	}
+
+/*
+@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0003
+@SYMTestCaseDesc		Positive testing - Fastpath scene with a double buffered element
+@SYMREQ					
+@SYMPREQ						PREQ417-54885
+@SYMTestType				Unit Test
+@SYMTestPriority		High
+@SYMTestPurpose			Check if a scene is fastpathed using the second buffer
+@SYMTestActions			
+	All compositions are autonomous:
+	Compose an empty scene
+	A) Create a scene containing an element with 2 buffers
+	Set the element screen size
+	Set destination and source rectangle to screen size
+	Compose the scene
+	B) Send an update to buffer 1 with change of colour
+	Wait for notification
+@SYMTestExpectedResults
+	The scene should be fastpathed for A and B
+	Screen colour should change after B
+*/
+void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0003L()
+	{
+    iTestName = _L("FASTPATH_0003");
+    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
+    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
+    SetupEmptySceneL();
+    
+    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
+                                                iFastpathablePixelFormat,
+                                                iStride, iContiguous, iMaxBuffers);
+    ASSERT_FALSE(surface.IsNull());
+
+    WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
+    TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
+    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
+    
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
+    
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
+    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
+    wfcCommit(iDevice, iContext, WFC_TRUE);
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    LOG(("OpenWFTest: Fastpath - now ON"));
+    
+    iUtility->FillSurfaceL(surface, 0, KGreen);
+    err = iUtility->SubmitUpdate(surface, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WaitL(iCompositionPause);	
+ 
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
+    ReleaseOnScreenStream();
+    
+    //Fill surface is blue
+    iUtility->FillSurfaceL(surface, 1, KBlue);
+	//Do content update for surface buff1
+    CActiveNotification* buff1disp = CActiveNotification::NewL(iUtility->Session(),ETrue);
+    CleanupStack::PushL(buff1disp);
+    TTimeStamp buff1time;
+    iUtility->NotifyWhenDisplayed(buff1disp->iStatus,buff1time);
+    
+    LOG(("OpenWFTest: Fastpath - staying ON..."));
+    err = iUtility->SubmitUpdate(surface, 1, NULL);
+	ASSERT_EQUALS(err,KErrNone);
+    ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,1));	//1 AO should have completed
+    
+    //create ref image/check on screen content
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KBlue,iTolerance));
+    ReleaseOnScreenStream();
+
+    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
+    wfcDestroySource(iDevice, fpSource);
+    CleanupStack::PopAndDestroy(buff1disp);
+	}
+
+/*
+@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0004
+@SYMTestCaseDesc		Positive testing - Fastpath two-element scene 
+@SYMREQ					
+@SYMPREQ						PREQ417-54885
+@SYMTestType				Unit Test
+@SYMTestPriority		Medium
+@SYMTestPurpose			Check a scene including a full screen opaque element as the top layer can be 
+										fastpathed
+@SYMTestActions			
+	All compositions are autonomous:
+	Compose an empty scene
+	A) Create a scene containing a screen sized element with WFC_TRANSPARENCY_NONE enabled
+	Compose the scene
+  B) Create a small rectangle behind the first element
+	Compose the scene
+*/
+void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0004L()
+	{
+    iTestName = _L("FASTPATH_0004");
+    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
+    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
+    SetupEmptySceneL();
+	
+	TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
+												iFastpathablePixelFormat,
+												iStride, iContiguous, iMaxBuffers);
+	ASSERT_FALSE(surface.IsNull());
+
+	WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
+	TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
+	ASSERT_EQUALS(err,KErrNone);
+	WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
+	wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);	
+	wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
+	wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
+	
+    TSurfaceId surfaceB = iUtility->CreateSurfaceL(TSize(iFastpathableWidth/2,iFastpathableHeight/2),
+                                                iFastpathablePixelFormat,
+                                                iStride, iContiguous, iMaxBuffers);
+    ASSERT_FALSE(surfaceB.IsNull());
+    WFCSource sourceB = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceB), NULL);
+    err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WFCElement elementB = wfcCreateElement(iDevice, iContext, NULL);
+    wfcSetElementAttribi(iDevice, elementB, WFC_ELEMENT_SOURCE, sourceB);
+    wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iHalfSizeRect);
+    wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iCenterRect);
+	
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+	wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
+    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
+	wfcCommit(iDevice, iContext, WFC_TRUE);
+	wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+	ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+	LOG(("OpenWFTest: Fastpath - now ON"));
+	
+	iUtility->FillSurfaceL(surface, 0, KGreen);
+	err = iUtility->SubmitUpdate(surface, 0, NULL);
+	ASSERT_EQUALS(err,KErrNone);
+	WaitL(iCompositionPause);
+ 
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
+    ReleaseOnScreenStream();
+	
+    LOG(("OpenWFTest: Fastpath - staying ON..."));
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+	wfcInsertElement(iDevice, elementB, WFC_INVALID_HANDLE);
+    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
+	wfcCommit(iDevice, iContext, WFC_TRUE);
+	wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+	ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+	
+	iUtility->FillSurfaceL(surfaceB, 0, KBlue);
+	err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
+	ASSERT_EQUALS(err,KErrNone);
+	WaitL(iCompositionPause);
+ 
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
+    ReleaseOnScreenStream();
+
+    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
+	wfcDestroySource(iDevice, fpSource);
+	wfcDestroySource(iDevice, sourceB);  
+	}
+
+/*
+@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0005
+@SYMTestCaseDesc		Positive testing - Fastpath two-element scene 
+@SYMREQ					
+@SYMPREQ						PREQ417-54885
+@SYMTestType				Unit Test
+@SYMTestPriority		Medium	
+@SYMTestPurpose			Check a scene including a full screen element with global alpha as the top layer 
+										can be fastpathed
+@SYMTestActions			
+	All compositions are autonomous:
+	Compose an empty scene
+	A) Create a scene containing a screen sized element 
+	Enable WFC_TRANPARENCY_GLOBAL_ALPHA and set WFC_ELEMENT_GLOBAL_ALPHA to be 255 (opaque)
+	Compose the scene
+	B) Create a smaller element behind the first element
+	Compose the scene
+@SYMTestExpectedResults
+	Both compositions should trigger fastpathing.
+*/
+void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0005L()
+	{
+    iTestName = _L("FASTPATH_0005");
+    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
+    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
+    SetupEmptySceneL();
+	
+	TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
+												iFastpathablePixelFormat,
+												iStride, iContiguous, iMaxBuffers);
+	ASSERT_FALSE(surface.IsNull());
+
+	WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
+	TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
+	ASSERT_EQUALS(err,KErrNone);
+	WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
+	wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);	
+	wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
+	wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
+//set element global alpha
+	wfcSetElementAttribf(iDevice, fpElement, WFC_ELEMENT_GLOBAL_ALPHA, 1.0f);
+	wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA);
+	
+    TSurfaceId surfaceB = iUtility->CreateSurfaceL(TSize(iFastpathableWidth/2,iFastpathableHeight/2),
+                                                iFastpathablePixelFormat,
+                                                iStride, iContiguous, iMaxBuffers);
+    ASSERT_FALSE(surfaceB.IsNull());
+    WFCSource sourceB = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceB), NULL);
+    err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WFCElement elementB = wfcCreateElement(iDevice, iContext, NULL);
+    wfcSetElementAttribi(iDevice, elementB, WFC_ELEMENT_SOURCE, sourceB);
+    wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iHalfSizeRect);
+    wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iCenterRect);
+	
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+	wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
+    LOG(("OpenWFTest: Expecting FASTPATH after next commit - using element global alpha"));
+	wfcCommit(iDevice, iContext, WFC_TRUE);
+	wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+	ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+	LOG(("OpenWFTest: Fastpath - now ON... - using element global alpha"));
+	
+	iUtility->FillSurfaceL(surface, 0, KGreen);
+	ASSERT_EQUALS(iUtility->SubmitUpdate(surface, 0, NULL),KErrNone);
+	WaitL(iCompositionPause);
+ 
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
+    ReleaseOnScreenStream();
+	
+
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+	wfcInsertElement(iDevice, elementB, WFC_INVALID_HANDLE);
+    LOG(("OpenWFTest: Expecting FASTPATH after next commit - using element global alpha"));
+	wfcCommit(iDevice, iContext, WFC_TRUE);
+	wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+	ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+	
+	iUtility->FillSurfaceL(surfaceB, 0, KBlue);
+	err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
+	ASSERT_EQUALS(err,KErrNone);
+	WaitL(iCompositionPause);	
+ 
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
+    ReleaseOnScreenStream();
+
+    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
+	wfcDestroySource(iDevice, fpSource);
+	wfcDestroySource(iDevice, sourceB);  
+	}
+
+/*
+@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0006
+@SYMTestCaseDesc		Positive testing - Fastpath two-element scene 
+@SYMREQ					
+@SYMPREQ						PREQ417-54885
+@SYMTestType				Unit Test
+@SYMTestPriority		Low
+@SYMTestPurpose			Check a scene including a full screen opaque element behind a transparent element 
+										can be fastpathed
+@SYMTestActions			
+	All compositions are autonomous:
+	Compose an empty scene
+	A) Create a scene containing an element of any size 
+	Enable WFC_TRANPARENCY_GLOBAL_ALPHA and set WFC_ELEMENT_GLOBAL_ALPHA to 0 (transparent)
+	Compose the scene
+	B) Create another screen sized opaque element behind the frist 
+	Compose the scene
+@SYMTestExpectedResults
+	The final scene should fastpath for B), not for A)	
+	(The current implementation does not support this fastpath behaviour. This test can be ignored at 
+	the moment.)
+*/
+void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0006L()
+	{
+    iTestName = _L("FASTPATH_0006");
+    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
+    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
+    SetupEmptySceneL();
+	
+	TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth/2,iFastpathableHeight/2),
+												iFastpathablePixelFormat,
+												iStride, iContiguous, iMaxBuffers);
+	ASSERT_FALSE(surface.IsNull());
+
+	WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
+	TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
+	ASSERT_EQUALS(err,KErrNone);
+	WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
+	wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);	
+	wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iHalfSizeRect);
+	wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iCenterRect);
+	//set element global alpha fully transparent
+	wfcSetElementAttribf(iDevice, fpElement, WFC_ELEMENT_GLOBAL_ALPHA, 0.0f);
+	wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA);
+	
+    TSurfaceId surfaceB = iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
+													iFastpathablePixelFormat,
+													iStride, iContiguous, iMaxBuffers);
+    ASSERT_FALSE(surfaceB.IsNull());
+    WFCSource sourceB = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceB), NULL);
+    err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WFCElement elementB = wfcCreateElement(iDevice, iContext, NULL);
+    wfcSetElementAttribi(iDevice, elementB, WFC_ELEMENT_SOURCE, sourceB);
+    wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
+    wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
+	
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+	wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
+    LOG(("OpenWFTest: Expecting COMPOSITION after next commit -single fully transparent element using global alpha"));
+	wfcCommit(iDevice, iContext, WFC_TRUE);
+	wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+	ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+	LOG(("OpenWFTest: Fastpath - now ON - single fully transparent element using global alpha"));
+	
+	iUtility->FillSurfaceL(surface, 0, KGreen);
+	err = iUtility->SubmitUpdate(surface, 0, NULL);
+	ASSERT_EQUALS(err,KErrNone);
+	WaitL(iCompositionPause);	
+ 
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+	wfcInsertElement(iDevice, elementB, WFC_INVALID_HANDLE);
+    LOG(("OpenWFTest: Expecting FASTPATH after next commit -fullscreen opaque element behind fully transparent element"));
+	wfcCommit(iDevice, iContext, WFC_TRUE);
+	wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+	ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+	LOG(("OpenWFTest: Fastpath - now ON - fullscreen opaque element behind transparent element"));
+	
+	iUtility->FillSurfaceL(surfaceB, 0, KBlue);
+	err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
+	ASSERT_EQUALS(err,KErrNone);
+	WaitL(iCompositionPause);	
+ 
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KBlue,iTolerance));
+    ReleaseOnScreenStream();
+
+    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
+	wfcDestroySource(iDevice, fpSource);
+	wfcDestroySource(iDevice, sourceB);  
+	}
+
+/*
+@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0007
+@SYMTestCaseDesc		Positive testing - Fastpath one-element scene  
+@SYMREQ					
+@SYMPREQ						PREQ417-54885
+@SYMTestType				Unit Test
+@SYMTestPriority		High
+@SYMTestPurpose			Check a scene including destination rectangle changes can trigger fastpath on and off
+@SYMTestActions			
+	All compositions are autonomous:
+	Compose an empty scene
+	Create a scene containing a screen sized element 
+	Compose scene
+	Set the destination rectangle smaller than screen size
+	Compose the scene
+	Set the destination rectangle back to screen size
+	Compose the scene
+@SYMTestExpectedResults
+	The scenes with the element of full screen destination rectangle should be fastpathed	
+	The scene with the element of smaller destination rectangle should not be fastpathed
+*/
+void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0007L()
+	{
+    iTestName = _L("FASTPATH_0007");
+    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
+    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
+    SetupEmptySceneL();
+	
+	TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
+												iFastpathablePixelFormat,
+												iStride, iContiguous, iMaxBuffers);
+	ASSERT_FALSE(surface.IsNull());
+
+	WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
+	TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
+	ASSERT_EQUALS(err,KErrNone);
+	WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
+	wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);	
+	wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
+	//NOT full screen destination
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iCenterRect);
+	
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+	wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
+    LOG(("OpenWFTest: Expecting COMPOSITION after next commit"));
+	wfcCommit(iDevice, iContext, WFC_TRUE);
+	wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+	ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+	LOG(("OpenWFTest: Fastpath - still OFF"));
+	
+	iUtility->FillSurfaceL(surface, 0, KGreen);
+	err = iUtility->SubmitUpdate(surface, 0, NULL);
+	ASSERT_EQUALS(err,KErrNone);
+	WaitL(iCompositionPause);	
+ 
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+    ASSERT_TRUE(CheckOnScreenStreamRect(iCenterTRect,KGreen,iTolerance));
+    ReleaseOnScreenStream();
+	
+	//NOW set full screen
+	wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
+	
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
+	wfcCommit(iDevice, iContext, WFC_TRUE);
+	wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+	ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+	WaitL(iCompositionPause);
+ 
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
+    ReleaseOnScreenStream();
+
+    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
+	wfcDestroySource(iDevice, fpSource);  
+	}
+
+//NOTIFICATION TESTS
+void COpenwfTest::FastpathNotificationsTestL(TBool aAutonomous)
+	{
+    SetupEmptySceneL(aAutonomous);
+
+    //Create 3 elements A+C fastpathable, B centered
+    TSurfaceId surfaceA = iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
+                                                iFastpathablePixelFormat,
+                                                iStride, iContiguous, iMaxBuffers);
+    ASSERT_FALSE(surfaceA.IsNull());
+    WFCSource sourceA = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceA), NULL);
+    TInt err = iUtility->SubmitUpdate(surfaceA, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WFCElement elementA = wfcCreateElement(iDevice, iContext, NULL);
+    wfcSetElementAttribi(iDevice, elementA, WFC_ELEMENT_SOURCE, sourceA);
+    wfcSetElementAttribiv(iDevice, elementA, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
+    wfcSetElementAttribiv(iDevice, elementA, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
+    
+    TSurfaceId surfaceB = iUtility->CreateSurfaceL(TSize(iFastpathableWidth/2,iFastpathableHeight/2),
+                                                iFastpathablePixelFormat,
+                                                iStride, iContiguous, iMaxBuffers);
+    ASSERT_FALSE(surfaceB.IsNull());
+    WFCSource sourceB = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceB), NULL);
+    err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WFCElement elementB = wfcCreateElement(iDevice, iContext, NULL);
+    wfcSetElementAttribi(iDevice, elementB, WFC_ELEMENT_SOURCE, sourceB);
+    wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iHalfSizeRect);
+    wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iCenterRect);
+    
+    TSurfaceId surfaceC = iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
+                                                iFastpathablePixelFormat,
+                                                iStride, iContiguous, iMaxBuffers);
+    ASSERT_FALSE(surfaceC.IsNull());
+    WFCSource sourceC = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceC), NULL);
+    err = iUtility->SubmitUpdate(surfaceC, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WFCElement elementC = wfcCreateElement(iDevice, iContext, NULL);
+    wfcSetElementAttribi(iDevice, elementC, WFC_ELEMENT_SOURCE, sourceC);
+    wfcSetElementAttribiv(iDevice, elementC, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
+    wfcSetElementAttribiv(iDevice, elementC, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
+
+    //**********STARTING ACTUAL TEST!**********
+    //**********SURFACE A FASTPATHABLE**********
+	//Add A to scene
+    wfcInsertElement(iDevice, elementA, WFC_INVALID_HANDLE);
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
+    wfcCommit(iDevice, iContext, WFC_TRUE);
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    LOG(("OpenWFTest: Fastpath - now ON"));
+	//Set A buffer0 red
+    iUtility->FillSurfaceL(surfaceA, 0, KRed);
+	//Do content update Abuff0 idisp iavail
+    CActiveNotification* surfAbuff0disp = CActiveNotification::NewL(iUtility->Session(),ETrue);
+    CleanupStack::PushL(surfAbuff0disp);
+    TTimeStamp surfAbuff0time;
+    CActiveNotification* surfAbuff0avail = CActiveNotification::NewL(iUtility->Session(),ETrue);
+    CleanupStack::PushL(surfAbuff0avail);
+    //iUtility->NotifyWhenDisplayed(surfAbuff0disp,surfAbuff0time);
+    iUtility->NotifyWhenDisplayed(surfAbuff0disp->iStatus,surfAbuff0time);
+    iUtility->NotifyWhenAvailable(surfAbuff0avail->iStatus); 
+    err = iUtility->SubmitUpdate(surfaceA, 0, NULL);
+	ASSERT_EQUALS(err,KErrNone);
+	
+    if(!aAutonomous)
+    	{
+        WaitL(iCompositionPause);
+		//Check A buff0 iDisp doesnt complete
+		ASSERT_EQUALS(surfAbuff0disp->iStatus.Int(),KRequestPending);
+		//Check A buff0 iAvail doesnt complete
+		ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending);
+		wfcCompose(iDevice, iContext, WFC_TRUE);
+	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    	}
+    ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,1));
+	
+	//Check A buff0 iDisp completes
+    ASSERT_EQUALS(surfAbuff0disp->iStatus.Int(),KErrNone);
+	//Check A buff0 iAvail doesnt complete
+    ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending);
+    
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KRed,iTolerance));
+    ReleaseOnScreenStream();
+
+	//Set A buffer1 Yellow
+    iUtility->FillSurfaceL(surfaceA, 1, KYellow);
+	
+	//Check A buff0 iavail doesnt complete
+    ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending);
+    
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KRed,iTolerance));
+	ReleaseOnScreenStream();
+	
+	//Do content update Abuff1 idisp iavail
+    CActiveNotification* surfAbuff1disp = CActiveNotification::NewL(iUtility->Session(),ETrue);
+    CleanupStack::PushL(surfAbuff1disp);
+    TTimeStamp surfAbuff1time;
+    CActiveNotification* surfAbuff1avail = CActiveNotification::NewL(iUtility->Session(),ETrue);
+    CleanupStack::PushL(surfAbuff1avail);
+    iUtility->NotifyWhenDisplayed(surfAbuff1disp->iStatus,surfAbuff1time);
+    iUtility->NotifyWhenAvailable(surfAbuff1avail->iStatus); 
+    err = iUtility->SubmitUpdate(surfaceA, 1, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    
+    if(!aAutonomous)
+    	{
+        WaitL(iCompositionPause);
+		//Check A buff1 iDisp doesnt complete
+		ASSERT_EQUALS(surfAbuff1disp->iStatus.Int(),KRequestPending);
+		//Check A buff1 iAvail doesnt complete
+		ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
+		//Check A buff0 iAvail doesnt complete
+	    ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending);
+		wfcCompose(iDevice, iContext, WFC_TRUE);
+	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    	}
+    ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,2));
+	
+	//Check A buff1 idisp completes
+    ASSERT_EQUALS(surfAbuff1disp->iStatus.Int(),KErrNone);
+	//Check A buff0 iAvail completes
+    ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KErrNone);
+	//Check A buff1 iAvail doesnt complete
+    ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
+    
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KYellow,iTolerance));
+	ReleaseOnScreenStream();
+	
+	//**********SURFACE B NOT VISIBLE**********
+	//Add surfaceB to scene behind surfaceA
+    wfcInsertElement(iDevice, elementB, WFC_INVALID_HANDLE);
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
+	wfcCommit(iDevice, iContext, WFC_TRUE);
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    LOG(("OpenWFTest: Fastpath - still ON"));
+	//Set B buffer0 green
+    iUtility->FillSurfaceL(surfaceB, 0, KGreen);
+	//Do content update idisp iavail
+    CActiveNotification* surfBbuff0disp = CActiveNotification::NewL(iUtility->Session(),ETrue);
+    CleanupStack::PushL(surfBbuff0disp);
+    TTimeStamp surfBbuff0time;
+    CActiveNotification* surfBbuff0avail = CActiveNotification::NewL(iUtility->Session(),ETrue);
+    CleanupStack::PushL(surfBbuff0avail);
+    iUtility->NotifyWhenDisplayed(surfBbuff0disp->iStatus,surfBbuff0time);
+    iUtility->NotifyWhenAvailable(surfBbuff0avail->iStatus); 
+    err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
+	ASSERT_EQUALS(err,KErrNone);
+	
+    if(!aAutonomous)
+    	{
+        WaitL(iCompositionPause);
+		//Check B buff0 iAvail doesnt complete
+		ASSERT_EQUALS(surfBbuff0avail->iStatus.Int(),KRequestPending);
+		//Check B buff0 iDisp doesnt complete
+		ASSERT_EQUALS(surfBbuff0disp->iStatus.Int(),KRequestPending);
+		//Check A buff1 iAvail doesnt complete
+		ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
+		wfcCompose(iDevice, iContext, WFC_TRUE);
+	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    	}
+    ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,1));
+    
+	//Check B buff0 idisp completes - could be no error or not visible
+    ASSERT_TRUE((surfBbuff0disp->iStatus.Int()==KErrNotVisible)||(surfBbuff0disp->iStatus.Int()==KErrNone));
+	//Check B buff0 iavail doesnt complete
+    ASSERT_EQUALS(surfBbuff0avail->iStatus.Int(),KRequestPending);
+	//Check A buff1 iavail doesnt complete
+    ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
+	
+	//Set B buffer1 blue
+	iUtility->FillSurfaceL(surfaceB, 1, KBlue);
+	//Do content update idisp iavail
+    CActiveNotification* surfBbuff1disp = CActiveNotification::NewL(iUtility->Session(),ETrue);
+    CleanupStack::PushL(surfBbuff1disp);
+    TTimeStamp surfBbuff1time;
+    CActiveNotification* surfBbuff1avail = CActiveNotification::NewL(iUtility->Session(),ETrue);
+    CleanupStack::PushL(surfBbuff1avail);
+    iUtility->NotifyWhenDisplayed(surfBbuff1disp->iStatus,surfBbuff1time);
+    iUtility->NotifyWhenAvailable(surfBbuff1avail->iStatus); 
+    err = iUtility->SubmitUpdate(surfaceB, 1, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    
+    if(!aAutonomous)
+    	{
+        WaitL(iCompositionPause);
+		//Check B buff1 iAvail doesnt complete
+		ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending);
+		//Check B buff1 iDisp doesnt complete
+		ASSERT_EQUALS(surfBbuff1disp->iStatus.Int(),KRequestPending);
+		//Check B buff0 iAvail doesnt complete
+		ASSERT_EQUALS(surfBbuff0avail->iStatus.Int(),KRequestPending);
+		//Check A buff1 iAvail doesnt complete
+		ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
+		wfcCompose(iDevice, iContext, WFC_TRUE);
+	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    	}
+    ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,2));
+    
+    //Check B buff1 idisp completes - could be no error or not visible
+    ASSERT_TRUE((surfBbuff1disp->iStatus.Int()==KErrNotVisible)||(surfBbuff1disp->iStatus.Int()==KErrNone));
+	//Check B buff1 iavail doesnt complete
+    ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending);
+	//Check B buff0 iavail completes - could be no error or not visible
+    ASSERT_TRUE((surfBbuff0avail->iStatus.Int()==KErrNotVisible)||(surfBbuff0avail->iStatus.Int()==KErrNone));
+	//Check A buff1 iavail doesnt complete
+    ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
+    
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KYellow,iTolerance));
+	ReleaseOnScreenStream();
+	
+	//**********SURFACE C ALSO FASTPATHABLE**********
+	//Add C to scene in front of surfaceA
+    wfcInsertElement(iDevice, elementC, elementA);
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
+	wfcCommit(iDevice, iContext, WFC_TRUE);
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    LOG(("OpenWFTest: Fastpath - still ON"));
+	//Set C to brown
+    iUtility->FillSurfaceL(surfaceC, 0, KBrown);
+	//Do content update Cbuff0 idisp iavail
+    CActiveNotification* surfCbuff0disp = CActiveNotification::NewL(iUtility->Session(),ETrue);
+    CleanupStack::PushL(surfCbuff0disp);
+    TTimeStamp surfCbuff0time;
+    CActiveNotification* surfCbuff0avail = CActiveNotification::NewL(iUtility->Session(),ETrue);
+    CleanupStack::PushL(surfCbuff0avail);
+    iUtility->NotifyWhenDisplayed(surfCbuff0disp->iStatus,surfCbuff0time);
+    iUtility->NotifyWhenAvailable(surfCbuff0avail->iStatus); 
+    err = iUtility->SubmitUpdate(surfaceC, 0, NULL);
+	ASSERT_EQUALS(err,KErrNone);
+	
+    if(!aAutonomous)
+    	{
+        WaitL(iCompositionPause);
+		//Check C buff0 iAvail doesnt complete
+		ASSERT_EQUALS(surfCbuff0avail->iStatus.Int(),KRequestPending);
+		//Check C buff0 iDisp doesnt complete
+		ASSERT_EQUALS(surfCbuff0disp->iStatus.Int(),KRequestPending);
+		//Check B buff1 iAvail doesnt complete
+		ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending);
+		//Check A buff1 iAvail doesnt complete
+		ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
+		wfcCompose(iDevice, iContext, WFC_TRUE);
+	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    	}
+    ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,1));
+    
+	//Check C buff0 idisp completes
+    ASSERT_EQUALS(surfCbuff0disp->iStatus.Int(),KErrNone);
+	//Check C buff0 iavail does not complete
+    ASSERT_EQUALS(surfCbuff0avail->iStatus.Int(),KRequestPending);
+	//Check B buff1 iavail doesnt complete
+    ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending);
+	//Check A buff1 iavail doesnt complete
+    ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
+    
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KBrown,iTolerance));
+	ReleaseOnScreenStream();
+	
+	//Set C buffer1 grey
+    iUtility->FillSurfaceL(surfaceC, 1, KGray);
+	//Do content update Cbuff1 idisp iavail
+    CActiveNotification* surfCbuff1disp = CActiveNotification::NewL(iUtility->Session(),ETrue);
+    CleanupStack::PushL(surfCbuff1disp);
+    TTimeStamp surfCbuff1time;
+    CActiveNotification* surfCbuff1avail = CActiveNotification::NewL(iUtility->Session(),ETrue);
+    CleanupStack::PushL(surfCbuff1avail);
+    iUtility->NotifyWhenDisplayed(surfCbuff1disp->iStatus,surfCbuff1time);
+    iUtility->NotifyWhenAvailable(surfCbuff1avail->iStatus); 
+    err = iUtility->SubmitUpdate(surfaceC, 1, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    
+    if(!aAutonomous)
+    	{
+        WaitL(iCompositionPause);
+		//Check C buff1 iAvail doesnt complete
+		ASSERT_EQUALS(surfCbuff1avail->iStatus.Int(),KRequestPending);
+		//Check C buff1 iDisp doesnt complete
+		ASSERT_EQUALS(surfCbuff1disp->iStatus.Int(),KRequestPending);
+		//Check C buff0 iAvail doesnt complete
+		ASSERT_EQUALS(surfCbuff0avail->iStatus.Int(),KRequestPending);
+		//Check B buff1 iAvail doesnt complete
+		ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending);
+		//Check A buff1 iAvail doesnt complete
+		ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
+		wfcCompose(iDevice, iContext, WFC_TRUE);
+	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    	}
+    ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,2));
+    
+	//Check C buff1 idisp completes
+    ASSERT_EQUALS(surfCbuff1disp->iStatus.Int(),KErrNone);
+	//Check C buff1 iavail does not complete
+    ASSERT_EQUALS(surfCbuff1avail->iStatus.Int(),KRequestPending);
+	//Check C buff0 iavail completes
+    ASSERT_EQUALS(surfCbuff0avail->iStatus.Int(),KErrNone);
+	//Check B buff1 iavail doesnt complete
+    ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending);
+	//Check A buff1 iavail doesnt complete
+    ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
+    
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGray,iTolerance));
+	ReleaseOnScreenStream();
+	
+    //**********SURFACE A BACK TO FRONT**********
+	//Move A to the front
+    wfcInsertElement(iDevice, elementA, elementC);
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
+	wfcCommit(iDevice, iContext, WFC_TRUE);
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    LOG(("OpenWFTest: Fastpath - still ON"));
+	//Set A buffer0 magenta
+    iUtility->FillSurfaceL(surfaceA, 0, KMagenta);
+	//Do content update Abuff0 idisp iavail
+    surfAbuff0disp->Activate();
+    surfAbuff0avail->Activate();
+    iUtility->NotifyWhenDisplayed(surfAbuff0disp->iStatus,surfAbuff0time);
+    iUtility->NotifyWhenAvailable(surfAbuff0avail->iStatus); 
+    err = iUtility->SubmitUpdate(surfaceA, 0, NULL);
+	ASSERT_EQUALS(err,KErrNone);
+	
+    if(!aAutonomous)
+    	{
+        WaitL(iCompositionPause);
+		//Check A buff0 iAvail doesnt complete
+		ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending);
+		//Check A buff0 iDisp doesnt complete
+		ASSERT_EQUALS(surfAbuff0disp->iStatus.Int(),KRequestPending);
+		//Check C buff1 iAvail doesnt complete
+		ASSERT_EQUALS(surfCbuff1avail->iStatus.Int(),KRequestPending);
+		//Check B buff1 iAvail doesnt complete
+		ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending);
+		//Check A buff1 iAvail doesnt complete
+		ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
+		wfcCompose(iDevice, iContext, WFC_TRUE);
+	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    	}
+    ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,2));
+    
+	//Check A buff0 idisp completes
+    ASSERT_EQUALS(surfAbuff0disp->iStatus.Int(),KErrNone);
+	//Check A buff0 iavail does not complete
+    ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending);
+	//Check A buff1 iavail does complete
+    ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KErrNone);
+	//Check C buff1 iavail does not complete
+    ASSERT_EQUALS(surfCbuff1avail->iStatus.Int(),KRequestPending);
+	//Check B buff1 iavail doesnt complete
+    ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending);
+    
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KMagenta,iTolerance));
+	ReleaseOnScreenStream();
+    
+    //**********SURFACE B TO FRONT - STOPS FASTPATH HAPPENING**********
+    //Move B to the front
+	wfcInsertElement(iDevice, elementB, elementA);
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    LOG(("OpenWFTest: Expecting COMPOSITION after next commit"));
+	wfcCommit(iDevice, iContext, WFC_TRUE);
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    LOG(("OpenWFTest: Fastpath - now OFF..."));
+	//Set B buffer0 dark red
+	iUtility->FillSurfaceL(surfaceB, 0, KDarkRed);
+	//Do content update Abuff0 idisp iavail
+	surfBbuff0disp->Activate();
+	surfBbuff0avail->Activate();
+	iUtility->NotifyWhenDisplayed(surfBbuff0disp->iStatus,surfBbuff0time);
+	iUtility->NotifyWhenAvailable(surfBbuff0avail->iStatus); 
+	err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
+	ASSERT_EQUALS(err,KErrNone);
+	
+    if(!aAutonomous)
+    	{
+        WaitL(iCompositionPause);
+		//Check B buff0 iAvail doesnt complete
+		ASSERT_EQUALS(surfBbuff0avail->iStatus.Int(),KRequestPending);
+		//Check B buff0 iDisp doesnt complete
+		ASSERT_EQUALS(surfBbuff0disp->iStatus.Int(),KRequestPending);
+		//Check A buff0 iAvail doesnt complete
+		ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending);
+		//Check C buff1 iAvail doesnt complete
+		ASSERT_EQUALS(surfCbuff1avail->iStatus.Int(),KRequestPending);
+		//Check B buff1 iAvail doesnt complete
+		ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending);
+		wfcCompose(iDevice, iContext, WFC_TRUE);
+	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    	}
+    ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,2));
+	
+	//Check B buff0 iAvail doesnt complete
+	ASSERT_EQUALS(surfBbuff0avail->iStatus.Int(),KRequestPending);
+	//Check B buff0 iDisp completes
+	ASSERT_EQUALS(surfBbuff0disp->iStatus.Int(),KErrNone);
+	//Check A buff0 iAvail doesnt complete
+	ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending);
+	//Check C buff1 iAvail doesnt complete
+	ASSERT_EQUALS(surfCbuff1avail->iStatus.Int(),KRequestPending);
+	//Check B buff1 iAvail completes
+	ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KErrNone);
+	
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+	//Check dark red center of screen
+	ASSERT_TRUE(CheckOnScreenStreamRect(iCenterTRect,KDarkRed,iTolerance));
+	//Check magenta around the borders
+	ASSERT_TRUE(CheckOnScreenStreamRect(TRect(0,0,iCenterTRect.iTl.iX,iCenterTRect.iTl.iY),KMagenta,iTolerance));
+	ASSERT_TRUE(CheckOnScreenStreamRect(TRect(iCenterTRect.iBr.iX+1,iCenterTRect.iBr.iY+1,
+			iFastpathableWidth,iFastpathableHeight),KMagenta,iTolerance));
+	ReleaseOnScreenStream();
+	
+	ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
+    
+    wfcDestroySource(iDevice, sourceA);
+    wfcDestroySource(iDevice, sourceB);
+    wfcDestroySource(iDevice, sourceC);
+    
+	CleanupStack::PopAndDestroy(12,surfAbuff0disp);
+	}
+/*
+@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0010
+@SYMTestCaseDesc		Positive testing - Fastpath with notification checking for autonomous composition
+@SYMREQ					
+@SYMPREQ						PREQ417-54885
+@SYMTestType				Integration Test
+@SYMTestPriority		High
+@SYMTestPurpose			Check fastpath does not cause any problem to notifications
+@SYMTestActions			
+	Autonomous composition
+	All elements created are double buffered and opaque:
+	Compose an empty scene
+	
+	A) Create a scene containing a screen sized element A
+	Fill buffer 0 of element A with red colour 
+	Submit the scene
+	Do content update of buffer 0 for available (iAvailable) and display time (iDisplayed)
+	Compose the scene, iDisplayed for buffer 0 should complete
+	
+	Fill buffer 1 of element A with yellow colour
+	Do content update of buffer 1 
+	Compose the scene, iDisplayed for buffer 1 should complete
+	Wait for iAvailable of buffer 0 to complete	
+	(iAvailable of buffer 1 will not complete until further content update)	
+	
+	B) Add a new element B of smaller non fastpathable size behind element A
+	Fill buffer 0 of element B with green colour
+	Submit the scene
+	Do content update of buffer 0 of element B 
+	Compose the scene, iDisplayed for buffer 0 of element B should not complete
+	iAvailable for buffer 1 of element A should not complete
+		
+	Fill buffer 1 of element B with blue colour
+	Do content update of buffer 1 of element B 
+	Wait for iDisplay to complete (possibly with KErrNotVisible)
+	Wait for iAvailable for buffer 0 of element B to complete (possibly with KErrNotVisible)
+	
+	C) Add a new screen size element C in front of A and B
+	Fill buffer 0 of element C to be brown
+	Do content update of buffer 0 of element C 
+	Compose the scene, iDisplayed of buffer 0 of element C should complete
+	iAvailable of buffer 1 of element B should not complete
+	
+	Fill buffer 1 of element C with grey colour
+	Do content update of buffer 1 of element C 
+	Compose the scene, iDisplayed of buffer 1 of element C should complete
+	Wait for iAvailable of buffer 0 of element C to complete
+		
+	D) Move element A to the front
+	Fill buffer 0 of element A with magenta colour
+	Do content update of buffer 0 of element A 
+	Compose the scene, iDisplayed for buffer 0 of element A should complete
+	Wait for iAvailable of buffer 1 of element A to complete
+	iAvailable of buffer 1 of element C should not complete
+	
+	E) Move element B to the front *NOW NOT FASTPATHING*
+	Fill buffer 0 of element B with dark red colour
+	Do content update of buffer 0 of element B
+	Compose the scene, iDisplayed for buffer 0 of element B should complete
+	Wait for iAvailable of buffer 1 of element B to complete
+	iAvailable of buffer 1 of element C should not complete
+	iAvailable of buffer 0 of element A should not complete
+		
+@SYMTestExpectedResults
+	All composition should trigger fastpath 
+	Request status checks iAvailable and iDisplayed should be set to KErrNone every time.	
+	Screen colour should change in the sequence of red, yellow, brown, grey, magenta
+*/
+void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0010L()
+	{
+    iTestName = _L("FASTPATH_0010");
+    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
+    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
+    FastpathNotificationsTestL(ETrue);
+	}
+
+/*
+@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0011
+@SYMTestCaseDesc		Positive testing - Fastpath with notification checking for non-autonomous composition
+@SYMREQ					
+@SYMPREQ						PREQ417-54885
+@SYMTestType				Integration Test
+@SYMTestPriority		High
+@SYMTestPurpose			Check fastpath does not cause any problem to notifications
+@SYMTestActions			
+	A repeat of GRAPHICS-OPENWFC-FASTPATH-0010 but with non autonomous composition
+	
+	Where possible TRequestStatuses are additionally checked after submit updates and before
+	explicit wfcCompose calls are made.
+	
+@SYMTestExpectedResults
+	Just commit should not trigger any changes to the scene or notifications to complete
+	Just content updates should not trigger any changes to the scene or notifications to complete
+	Only after Commit, Content update and Force compose should things happen.
+	Request status checks iAvailable and iDisplayed should be completed.
+	Screen colour should change in the sequence of red, yellow, green, blue, brown and grey
+*/
+void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0011L()
+	{
+    iTestName = _L("FASTPATH_0011");
+    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
+    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
+    FastpathNotificationsTestL(EFalse);
+	}
+
+//NOTIFICATION TESTS
+void COpenwfTest::FastpathDispXNotificationsTestL(TBool aAutonomous)
+	{
+    SetupEmptySceneL(aAutonomous);
+    if (aAutonomous)
+        {   //if we have manual pauses the test will complete early
+        iAllowManualPause = EFalse;
+        }
+	
+	//Create 2 fastpathable elements
+    TSurfaceId surfaceA = iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
+                                                iFastpathablePixelFormat,
+                                                iStride, iContiguous, iMaxBuffers);
+
+    ASSERT_FALSE(surfaceA.IsNull());
+    WFCSource sourceA = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceA), NULL);
+    TInt err = iUtility->SubmitUpdate(surfaceA, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WFCElement elementA = wfcCreateElement(iDevice, iContext, NULL);
+    wfcSetElementAttribi(iDevice, elementA, WFC_ELEMENT_SOURCE, sourceA);
+    wfcSetElementAttribiv(iDevice, elementA, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
+    wfcSetElementAttribiv(iDevice, elementA, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
+    
+    TSurfaceId surfaceB = iUtility->CreateSurfaceL(TSize(iFastpathableWidth/2,iFastpathableHeight/2),
+                                                iFastpathablePixelFormat,
+                                                iStride, iContiguous, iMaxBuffers);
+    ASSERT_FALSE(surfaceB.IsNull());
+    WFCSource sourceB = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceB), NULL);
+    err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WFCElement elementB = wfcCreateElement(iDevice, iContext, NULL);
+    wfcSetElementAttribi(iDevice, elementB, WFC_ELEMENT_SOURCE, sourceB);
+    wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iHalfSizeRect);
+    wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iCenterRect);
+	
+	//**********STARTING ACTUAL TEST!**********
+	//Add A to scene
+	wfcInsertElement(iDevice, elementA, WFC_INVALID_HANDLE);
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
+	wfcCommit(iDevice, iContext, WFC_TRUE);
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    LOG(("OpenWFTest: Fastpath - now ON"));
+	//Set A buffer0 red
+	iUtility->FillSurfaceL(surfaceA, 0, KRed);
+	err = iUtility->SubmitUpdate(surfaceA, 0, NULL);
+	ASSERT_EQUALS(err,KErrNone);
+    if(!aAutonomous)
+    	{
+		wfcCompose(iDevice, iContext, WFC_TRUE);
+	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    	}
+    WaitL(iCompositionPause);
+    
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KRed,iTolerance));
+	ReleaseOnScreenStream();
+	
+	//Add surfaceB to scene infront of surfaceA
+	wfcInsertElement(iDevice, elementB, elementA);
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    LOG(("OpenWFTest: Expecting COMPOSITION after next commit"));
+	wfcCommit(iDevice, iContext, WFC_TRUE);
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    LOG(("OpenWFTest: Fastpath - now OFF"));
+	//Set B buffer0 green
+	iUtility->FillSurfaceL(surfaceB, 0, KBlue);
+	err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
+	ASSERT_EQUALS(err,KErrNone);
+    if(!aAutonomous)
+    	{
+		wfcCompose(iDevice, iContext, WFC_TRUE);
+	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    	}
+    WaitL(iCompositionPause);
+    
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+	//Check blue center of screen
+    ASSERT_TRUE(CheckOnScreenStreamRect(iCenterTRect,KBlue,iTolerance));
+	//Check red around the borders
+	ASSERT_TRUE(CheckOnScreenStreamRect(TRect(0,0,iCenterTRect.iTl.iX,iCenterTRect.iTl.iY),KRed,iTolerance));
+	ASSERT_TRUE(CheckOnScreenStreamRect(TRect(iCenterTRect.iBr.iX+1,iCenterTRect.iBr.iY+1,
+			iFastpathableWidth,iFastpathableHeight),KRed,iTolerance));
+	ReleaseOnScreenStream();
+	
+	//Set A buffer1 yellow
+	iUtility->FillSurfaceL(surfaceA, 1, KYellow);
+	//Set B buffer1 KGreen
+	iUtility->FillSurfaceL(surfaceB, 1, KGreen);
+	
+	//Do content updated surfaceA dispXtimes 10
+	CActiveNotification* surfAbuff1dispX = CActiveNotification::NewL(iUtility->Session(),ETrue);
+	CleanupStack::PushL(surfAbuff1dispX);
+	iUtility->NotifyWhenDisplayedXTimes(10,surfAbuff1dispX->iStatus);
+	err = iUtility->SubmitUpdate(surfaceA, 1, NULL);
+	//Do content updated surfaceB dispXtimes 5
+	CActiveNotification* surfBbuff1dispX = CActiveNotification::NewL(iUtility->Session(),ETrue);
+	CleanupStack::PushL(surfBbuff1dispX);
+	iUtility->NotifyWhenDisplayedXTimes(5,surfBbuff1dispX->iStatus);
+	err = iUtility->SubmitUpdate(surfaceB, 1, NULL);
+	
+    if(!aAutonomous)
+    	{
+		for(TInt i=0;i<4;i++)
+			{
+			wfcCompose(iDevice, iContext, WFC_TRUE);
+		    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+		    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+		    WaitL(iCompositionPause);
+			//Check A has not completed yet
+			ASSERT_EQUALS(surfAbuff1dispX->iStatus.Int(),KRequestPending);
+			//Check B has not completed yet
+			ASSERT_EQUALS(surfBbuff1dispX->iStatus.Int(),KRequestPending);
+			}
+		wfcCompose(iDevice, iContext, WFC_TRUE);
+	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    	}
+	//surfBbuff1dispX should complete, and its RunL will stop the scheduler
+    CActiveScheduler::Start();
+	//Check B has completed
+    ASSERT_EQUALS(surfBbuff1dispX->iStatus.Int(),KErrNone);
+	//Check A has not completed yet
+	ASSERT_EQUALS(surfAbuff1dispX->iStatus.Int(),KRequestPending);
+	
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+	//Check green center of screen
+    ASSERT_TRUE(CheckOnScreenStreamRect(iCenterTRect,KGreen,iTolerance));
+	//Check yellow around the borders
+	ASSERT_TRUE(CheckOnScreenStreamRect(TRect(0,0,iCenterTRect.iTl.iX,iCenterTRect.iTl.iY),KYellow,iTolerance));
+	ASSERT_TRUE(CheckOnScreenStreamRect(TRect(iCenterTRect.iBr.iX+1,iCenterTRect.iBr.iY+1,
+			iFastpathableWidth,iFastpathableHeight),KYellow,iTolerance));
+	ReleaseOnScreenStream();
+	
+    //check it hasn't completed unexpectedly early while using on screen stream
+    ASSERT_EQUALS(surfAbuff1dispX->iStatus.Int(),KRequestPending);
+    
+	//Remove surfaceB from the scene
+	wfcRemoveElement(iDevice, elementB);
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
+	wfcCommit(iDevice, iContext, WFC_TRUE);
+    if(!aAutonomous)
+    	{
+		for(TInt i=0;i<4;i++)
+			{
+			wfcCompose(iDevice, iContext, WFC_TRUE);
+		    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+		    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+		    LOG(("OpenWFTest: Fastpath - now ON"));
+		    WaitL(iCompositionPause);
+			//Check A has not completed yet
+			ASSERT_EQUALS(surfAbuff1dispX->iStatus.Int(),KRequestPending);
+			}
+		wfcCompose(iDevice, iContext, WFC_TRUE);
+    	}
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+
+	//surfAbuff1dispX should complete, and its RunL will stop the scheduler
+    CActiveScheduler::Start();
+    ASSERT_EQUALS(surfAbuff1dispX->iStatus.Int(),KErrNone);
+
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KYellow,iTolerance));
+	ReleaseOnScreenStream();
+	
+	ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
+	//Shutdown
+    wfcDestroySource(iDevice, sourceA);
+    wfcDestroySource(iDevice, sourceB);
+    
+	CleanupStack::PopAndDestroy(2,surfAbuff1dispX);
+	}
+
+/*
+@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0012
+@SYMTestCaseDesc		Positive testing - Fastpath with notification checking DisplayXTime
+@SYMREQ					
+@SYMPREQ						PREQ417-54885
+@SYMTestType				Integration Test
+@SYMTestPriority		High
+@SYMTestPurpose			Check fastpath does not cause any problem to notifications
+@SYMTestActions			
+	All compositions are autonomous:
+	Compose an empty scene
+	A) Create a scene containing a screen sized opaque element A
+	Commit the scene
+	Make a content update for available (iAvailable) and display time (aDisplayed)
+	Wait for the request status objects to complete
+	
+	B) Add a small element B in front of A
+	Compose the scene
+	Content update for both A and B, set display 10 times to A, set display 5 times to B 
+	Wait for the 5 times
+	
+	C) Remove element B
+	Commit the scene
+	Compose the scene
+	Wait for the 10 times
+@SYMTestExpectedResults
+	Composition should fastpath in sections A and C
+	Elements A's 10 times should not complete before element B's 5 times
+*/
+void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0012L()
+	{
+    iTestName = _L("FASTPATH_0012");
+    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
+    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
+	FastpathDispXNotificationsTestL(ETrue);
+	}
+
+/*
+@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0013
+@SYMTestCaseDesc		Positive testing - Fastpath with notification checking DisplayXTime
+@SYMREQ					
+@SYMPREQ						PREQ417-54885
+@SYMTestType				Integration Test
+@SYMTestPriority		High
+@SYMTestPurpose			Check fastpath does not cause any problem to notifications
+@SYMTestActions			
+	Repeats GRAPHICS-OPENWFC-FASTPATH-0013 in non autonomous mode.
+	This allows gives the added benefit of accurate counting of wfcCompose calls, checking the displayXtimes
+	notifications only complete after the correct number of composes.
+@SYMTestExpectedResults
+	Composition should fastpath in sections A and C
+	Both should complete after their expect amount of compose calls with no errors
+*/
+void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0013L()
+	{
+    iTestName = _L("FASTPATH_0013");
+    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
+    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
+    FastpathDispXNotificationsTestL(EFalse);
+	}
+
+/*
+ *	NEGATIVE TESTING
+ * */
+/*
+@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0020
+@SYMTestCaseDesc		Negative testing - Fastpath one-element scene
+@SYMREQ					
+@SYMPREQ						PREQ417-54885
+@SYMTestType				Unit Test
+@SYMTestPriority		High
+@SYMTestPurpose			Check a scene including a full screen element with source alpha cannot be fastpathed
+@SYMTestActions			
+	All compositions are autonomous:
+	Create a scene containing a screen sized element 
+	Enable WFC_TRANSPARENCY_SOURCE  
+	Set the value of WFC_ELEMENT_SOURCE between 0 and 255 (non-inclusive).
+	Compose the scene
+@SYMTestExpectedResults
+	The scene cannot be fastpathed.
+*/
+void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0020L()
+	{
+    iTestName = _L("FASTPATH_0020");
+    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
+    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
+    SetupEmptySceneL();
+    
+    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
+												EUidPixelFormatARGB_8888,
+                                                iStride, iContiguous, iMaxBuffers);
+    ASSERT_FALSE(surface.IsNull());
+
+    WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
+    TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
+    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
+    
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
+    //set per pixel alpha
+    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, WFC_TRANSPARENCY_SOURCE);
+    
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
+    LOG(("OpenWFTest: Expecting COMPOSITION after next commit - using source alpha"));
+    wfcCommit(iDevice, iContext, WFC_TRUE);
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    
+    for (TInt i=0;i<=256;i+=64)
+    	{
+		i=(i==256)?255:i;
+		iUtility->FillSurfaceL(surface, 0, TRgb(0,255,0,i));
+		err = iUtility->SubmitUpdate(surface, 0, NULL);
+		ASSERT_EQUALS(err,KErrNone);
+		WaitL(iCompositionPause);
+    	}
+    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
+    wfcDestroySource(iDevice, fpSource);  
+	}
+
+/*
+@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0021
+@SYMTestCaseDesc		Negative testing - Fastpath one-element scene
+@SYMREQ					
+@SYMPREQ						PREQ417-54885
+@SYMTestType				Unit Test
+@SYMTestPriority		High	
+@SYMTestPurpose			Check a scene including a full screen element with global alpha cannot be fastpathed
+@SYMTestActions			
+	All compositions are autonomous:
+	Create a scene containing a screen sized element 
+	Enable WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA
+	Set the value of WFC_ELEMENT_GLOBAL_ALPHA between 0 and 255 (non-inclusive)
+	Compose the scene
+@SYMTestExpectedResults
+	The scene cannot be fastpathed.
+*/
+void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0021L()
+	{
+    iTestName = _L("FASTPATH_0021");
+    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
+    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
+    SetupEmptySceneL();
+    
+    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
+												EUidPixelFormatXRGB_8888,
+                                                iStride, iContiguous, iMaxBuffers);
+    ASSERT_FALSE(surface.IsNull());
+
+    WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
+    TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
+    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
+    
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
+    //set element global alpha
+	wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA);
+	wfcSetElementAttribf(iDevice, fpElement, WFC_ELEMENT_GLOBAL_ALPHA, 0.0f);
+	
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
+	iUtility->FillSurfaceL(surface, 0, KGreen);
+	err = iUtility->SubmitUpdate(surface, 0, NULL);
+    LOG(("OpenWFTest: Expecting COMPOSITION after next commit - using element global alpha not fully opaque"));
+    wfcCommit(iDevice, iContext, WFC_TRUE);
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    
+    for (TInt i=0;i<=256;i+=64)
+    	{
+		i=(i==256)?255:i;
+		wfcSetElementAttribf(iDevice, fpElement, WFC_ELEMENT_GLOBAL_ALPHA, (TReal32)i/255);
+		if(i == 255)
+			{
+#ifdef BREAKPOINT_FASTPATH
+			__BREAKPOINT();
+#endif
+			}
+        if(i == 255)
+            {
+            LOG(("OpenWFTest: Expecting FASTPATH after next commit - using element global alpha fully opaque"));
+            }
+        else
+            {
+            LOG(("OpenWFTest: Expecting COMPOSITION after next commit - using element global alpha not fully opaque"));
+            }
+	    wfcCommit(iDevice, iContext, WFC_TRUE);
+	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+		WaitL(iCompositionPause);
+    	}
+    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
+    wfcDestroySource(iDevice, fpSource);  
+	}
+
+/*
+@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0022
+@SYMTestCaseDesc		Negative testing - Fastpath one-element scene
+@SYMREQ					
+@SYMPREQ						PREQ417-54885
+@SYMTestType				Unit Test
+@SYMTestPriority		High	
+@SYMTestPurpose			Check a scene with RGB 565 format cannot be fastpathed
+@SYMTestActions			
+	Create a scene containing a screen sized element with an unsupported source format, such as 565
+	Compose the scene
+@SYMTestExpectedResults
+	The scene cannot be fastpathed.	
+*/
+void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0022L()
+	{
+    iTestName = _L("FASTPATH_0022");
+    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
+    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
+    SetupEmptySceneL();
+    
+    //NON fastpathable pixel format
+    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
+												iNonFastpathablePixelFormat,
+                                                iStride, iContiguous, iMaxBuffers);
+    ASSERT_FALSE(surface.IsNull());
+
+    WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
+    TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
+    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
+    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
+    
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    LOG(("OpenWFTest: Expecting COMPOSITION after next commit - using non fastpathable pixel format"));
+    wfcCommit(iDevice, iContext, WFC_TRUE);
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    
+    iUtility->FillSurfaceL(surface, 0, KGreen);
+    err = iUtility->SubmitUpdate(surface, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WaitL(iCompositionPause);
+    
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
+	ReleaseOnScreenStream();
+
+	ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
+    wfcDestroySource(iDevice, fpSource);  
+	}
+
+/*
+@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0023
+@SYMTestCaseDesc		Negative testing - Fastpath one-element scene
+@SYMREQ					
+@SYMPREQ						PREQ417-54885
+@SYMTestType				Unit Test
+@SYMTestPriority		High
+@SYMTestPurpose			Check a scene with mask settings cannot be fastpathed
+@SYMTestActions			
+	All compositions are autonomous:
+	Create a scene containing a screen sized element A
+	Enable WFC_TRANSPARENCY_MASK
+	Set a value to WFC_ELEMENT_MASK
+	Create a mask element, set the size to be the same as element A's desitnation rectangle 
+	Compose the scene
+@SYMTestExpectedResults
+	The scene cannot be fastpathed.
+*/
+void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0023L()
+	{
+    iTestName = _L("FASTPATH_0023");
+    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
+    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
+    SetupEmptySceneL();
+
+    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
+												iFastpathablePixelFormat,
+                                                iStride, iContiguous, iMaxBuffers);
+    ASSERT_FALSE(surface.IsNull());
+
+    WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
+    TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
+    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
+    
+    TSurfaceId surfaceMask = iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
+                                                iFastpathablePixelFormat,
+                                                iStride, iContiguous, iMaxBuffers);
+    ASSERT_FALSE(surfaceMask.IsNull());
+    WFCMask mask = wfcCreateMaskFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceMask), NULL);
+    err = iUtility->SubmitUpdate(surfaceMask, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    
+    //set the mask to fpElement
+    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, WFC_TRANSPARENCY_MASK);
+    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_MASK, mask);
+    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
+    
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
+    LOG(("OpenWFTest: Expecting COMPOSITION after next commit - using a mask"));
+    wfcCommit(iDevice, iContext, WFC_TRUE);
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    LOG(("OpenWFTest:Fastpath - still off - using a mask"));
+    
+    iUtility->FillSurfaceL(surface, 0, KGreen);
+    err = iUtility->SubmitUpdate(surface, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    iUtility->FillSurfaceL(surfaceMask, 0, KBlack);
+    err = iUtility->SubmitUpdate(surfaceMask, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WaitL(iCompositionPause);	
+ 
+    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
+    wfcDestroySource(iDevice, fpSource);
+	}
+
+/*
+@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0024
+@SYMTestCaseDesc		Negative testing - Fastpath one-element scene
+@SYMREQ					
+@SYMPREQ						PREQ417-54885
+@SYMTestType				Unit Test
+@SYMTestPriority		High
+@SYMTestPurpose			Check a scene with alpha and mask settings cannot be fastpathed
+@SYMTestActions			
+	All compositions are autonomous:
+	Create a scene containing a screen sized element A
+	Enable WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA
+	Set the value of WFC_ELEMENT_GLOBAL_ALPHA to be 255 
+	Enable WFC_TRANSPARENCY_MASK
+	Set a value to WFC_ELEMENT_MASK 	
+	Create a mask element, set it the same size of element A's destination rectangle
+	Compose the scene
+@SYMTestExpectedResults
+	The scene cannot be fastpathed.
+*/
+void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0024L()
+	{
+    iTestName = _L("FASTPATH_0024");
+    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
+    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
+    SetupEmptySceneL();
+
+    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
+												iFastpathablePixelFormat,
+                                                iStride, iContiguous, iMaxBuffers);
+    ASSERT_FALSE(surface.IsNull());
+
+    WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
+    TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
+    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
+    
+    TSurfaceId surfaceMask = iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
+                                                iFastpathablePixelFormat,
+                                                iStride, iContiguous, iMaxBuffers);
+    ASSERT_FALSE(surfaceMask.IsNull());
+    WFCMask mask = wfcCreateMaskFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceMask), NULL);
+    err = iUtility->SubmitUpdate(surfaceMask, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    
+    //set the mask and global alpha for use with fpElement
+    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_MASK, mask);
+    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, 
+    		WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA|WFC_TRANSPARENCY_MASK);
+    //set global alpha to fully opaque
+    wfcSetElementAttribf(iDevice, fpElement, WFC_ELEMENT_GLOBAL_ALPHA, 1.0f);
+    
+    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    LOG(("OpenWFTest: Expecting COMPOSITION after next commit - using a mask and global alpha"));
+    wfcCommit(iDevice, iContext, WFC_TRUE);
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    LOG(("OpenWFTest: Fastpath - still off - using a mask and global alpha"));
+    
+    iUtility->FillSurfaceL(surface, 0, KGreen);
+    err = iUtility->SubmitUpdate(surface, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    iUtility->FillSurfaceL(surfaceMask, 0, KBlack);
+    err = iUtility->SubmitUpdate(surfaceMask, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WaitL(iCompositionPause);	
+ 
+    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
+    wfcDestroySource(iDevice, fpSource);
+	}
+
+/*
+@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0025
+@SYMTestCaseDesc		Negative testing - Fastpath a scene with scaling element
+@SYMREQ					
+@SYMPREQ						PREQ417-54885
+@SYMTestType				Unit Test
+@SYMTestPriority		High	
+@SYMTestPurpose			Check a scene with scaling cannot be fastpathed
+@SYMTestActions			
+	All compositions are autonomous:
+	Create an element containing source size smaller than full screen destination size
+	Add to scene and compose
+@SYMTestExpectedResults
+	The scene cannot be fastpathed.
+*/
+void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0025L()
+	{
+    iTestName = _L("FASTPATH_0025");
+    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
+    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
+    SetupEmptySceneL();
+	
+	//create half screen size surface
+	TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth/2,iFastpathableHeight/2),
+												iFastpathablePixelFormat,
+												iStride, iContiguous, iMaxBuffers);
+	ASSERT_FALSE(surface.IsNull());
+
+	WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
+	TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
+	ASSERT_EQUALS(err,KErrNone);
+	WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
+	wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
+	
+	//note the source is only half the size of the screen
+	wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iHalfSizeRect);
+	//set destination to fullscreen, causing it to stretch
+	wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
+    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    LOG(("OpenWFTest: Expecting COMPOSITION after next commit - using a mask and global alpha"));
+	wfcCommit(iDevice, iContext, WFC_TRUE);
+	wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+	ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+	LOG(("OpenWFTest: Fastpath - still off... - source not equal to destination"));
+	
+	iUtility->FillSurfaceL(surface, 0, KGreen);
+	err = iUtility->SubmitUpdate(surface, 0, NULL);
+	ASSERT_EQUALS(err,KErrNone);
+	WaitL(iCompositionPause);
+	
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
+	ReleaseOnScreenStream();
+
+	ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
+	wfcDestroySource(iDevice, fpSource);  
+	}
+
+/*
+@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0026
+@SYMTestCaseDesc		Negative testing - Fastpath a scene with rotation
+@SYMREQ					
+@SYMPREQ						PREQ417-54885
+@SYMTestType				Unit Test
+@SYMTestPriority		High	
+@SYMTestPurpose			Check a scene with rotation cannot be fastpathed
+@SYMTestActions			
+	All compositions are autonomous:
+	Create a scene containing a screen size element 
+	Compose the scene
+	Rotate the element with 90, 180 and 270 degrees
+	Compose the scene
+@SYMTestExpectedResults
+	The scene can be fastpathed only for the first scene commited composition.
+*/
+void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0026L()
+	{
+    iTestName = _L("FASTPATH_0026");
+    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
+    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
+    SetupEmptySceneL();
+    
+    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
+                                                iFastpathablePixelFormat,
+                                                iStride, iContiguous, iMaxBuffers);
+    ASSERT_FALSE(surface.IsNull());
+
+    WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
+    TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
+    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
+    
+    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
+    wfcCommit(iDevice, iContext, WFC_TRUE);
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    LOG(("OpenWFTest: Fastpath - now ON"));
+    
+    iUtility->FillSurfaceL(surface, 0, KGreen);
+    err = iUtility->SubmitUpdate(surface, 0, NULL);
+    ASSERT_EQUALS(err,KErrNone);
+    WaitL(iCompositionPause);	
+ 
+    //Set 90 degree rotation
+    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE_ROTATION, WFC_ROTATION_90);
+    
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    iUtility->FillSurfaceL(surface, 0, KBlue);
+    LOG(("OpenWFTest: Expecting COMPOSITION after next commit"));
+    wfcCommit(iDevice, iContext, WFC_TRUE);
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    LOG(("OpenWFTest: Fastpath - now OFF"));
+    WaitL(iCompositionPause);
+    
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KBlue,iTolerance));
+	ReleaseOnScreenStream();
+
+	
+    //Set 180 degree rotation
+    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE_ROTATION, WFC_ROTATION_180);
+    
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    iUtility->FillSurfaceL(surface, 0, KMagenta);
+    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
+    wfcCommit(iDevice, iContext, WFC_TRUE);
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    LOG(("OpenWFTest: Fastpath - now OFF"));
+    WaitL(iCompositionPause);
+    
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KMagenta,iTolerance));
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+    ReleaseOnScreenStream();
+
+    //Set 270 degree rotation
+    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE_ROTATION, WFC_ROTATION_270);
+    
+#ifdef BREAKPOINT_FASTPATH
+    __BREAKPOINT();
+#endif
+    iUtility->FillSurfaceL(surface, 0, KBrown);
+    LOG(("OpenWFTest: Expecting COMPOSITION after next commit"));
+    wfcCommit(iDevice, iContext, WFC_TRUE);
+    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
+    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
+    LOG(("OpenWFTest: Fastpath - now OFF"));
+    WaitL(iCompositionPause);
+    
+    ASSERT_TRUE(AcquireOnScreenStream());
+    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KBrown,iTolerance));
+    ASSERT_TRUE(CheckOnScreenReferenceImage());
+    ReleaseOnScreenStream();
+
+    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
+    wfcDestroySource(iDevice, fpSource);  
+	}
+
+/*
+@SYMTestCaseID          GRAPHICS-OPENWFC-FASTPATH-0027
+@SYMTestCaseDesc        Negative testing - Pass in bad parameter values 
+@SYMREQ                 
+@SYMPREQ                PREQ417-54885
+@SYMTestType            Unit Test
+@SYMTestPriority        High    
+@SYMTestPurpose         Check invalid parameter values passed in OWF APIs
+@SYMTestActions 
+    Use invalid values to call OWF APIs
+@SYMTestExpectedResults
+    Test should pass without panic.
+*/
+void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0027L()
+    {
+    iTestName = _L("FASTPATH_0027");
+    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
+    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
+    
+    WFCint deviceId;
+    WFCint filterList[] = { WFC_DEVICE_FILTER_SCREEN_NUMBER, WFC_DEFAULT_SCREEN_NUMBER, WFC_NONE};
+    ASSERT_TRUE(wfcEnumerateDevices(&deviceId, 1, filterList) == 1);
+
+    WFCint attribList = 1;
+    WFCDevice device = wfcCreateDevice(deviceId, &attribList);
+    WFCContext onScreenContext = wfcCreateOnScreenContext(NULL, WFC_DEFAULT_SCREEN_NUMBER, NULL);
+    WFCContext offScreenContext = wfcCreateOffScreenContext(NULL, WFC_DEFAULT_SCREEN_NUMBER, NULL);
+
+    WFCfloat value = 1.0;
+    wfcGetContextAttribi(NULL, iContext, WFC_CONTEXT_TARGET_HEIGHT);
+    wfcSetContextAttribi(NULL, iContext, WFC_CONTEXT_ROTATION, WFC_ROTATION_0);
+    wfcGetContextAttribfv(NULL, iContext, WFC_CONTEXT_ROTATION, NULL, &value);
+    wfcSetContextAttribfv(NULL, iContext, WFC_CONTEXT_ROTATION, NULL, &value);
+    
+    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
+                                                iFastpathablePixelFormat,
+                                                iStride, iContiguous, iMaxBuffers);
+    ASSERT_FALSE(surface.IsNull());
+
+    WFCSource fpSource = wfcCreateSourceFromStream(NULL, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
+    wfcCreateMaskFromStream(NULL, iContext, reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
+    WFCElement fpElement = wfcCreateElement(NULL, iContext, NULL);
+    wfcSetElementAttribi(NULL, fpElement, WFC_ELEMENT_SOURCE, fpSource);
+    wfcSetElementAttribf(NULL, fpElement, WFC_ELEMENT_SOURCE, NULL);
+    wfcSetElementAttribiv(NULL, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL);
+    wfcSetElementAttribfv(NULL, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL);
+    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL);
+    wfcSetElementAttribfv(iDevice, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL);
+    
+    wfcGetElementAttribi(NULL, fpElement, WFC_ELEMENT_SOURCE);
+    wfcGetElementAttribf(NULL, fpElement, WFC_ELEMENT_SOURCE);
+    wfcGetElementAttribiv(NULL, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL);
+    wfcGetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL);
+    wfcGetElementAttribfv(NULL, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL);
+    wfcGetElementAttribfv(iDevice, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL);
+    
+    wfcInsertElement(NULL, fpElement, NULL);
+    wfcGetElementAbove(NULL, fpElement);
+    wfcGetElementBelow(NULL, fpElement);
+        
+    WFCDeviceAttrib devAttrib = WFC_DEVICE_ID;
+    wfcGetDeviceAttribi(NULL, devAttrib);
+
+    wfcActivate(NULL, iContext);
+    wfcActivate(iDevice, NULL);
+    wfcDeactivate(NULL, iContext);
+    wfcDeactivate(iDevice, NULL);
+    wfcCompose(NULL, iContext, WFC_TRUE);
+    wfcCompose(iDevice, NULL, WFC_TRUE);
+    wfcCommit(NULL, iContext, WFC_TRUE);
+    wfcCommit(iDevice, NULL, WFC_TRUE);
+    wfcFence(NULL, iContext, iEGLDisplay, iSync);
+    wfcFence(iDevice, NULL, iEGLDisplay, iSync);
+
+    WFCMask mask = WFC_INVALID_HANDLE;
+    wfcDestroyMask(NULL, mask);
+    wfcRemoveElement(NULL, fpElement);
+    wfcDestroyElement(NULL, fpElement);
+    wfcDestroySource(NULL, fpSource);  
+    wfcDestroyContext(NULL, onScreenContext);
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicscomposition/openwftest/src/openwftestserver.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,59 @@
+// Copyright (c) 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:
+//
+
+/**
+ @file
+*/
+
+#include <test/ctefunitserver.h>
+#include "openwftest.h"
+
+_LIT( KServerName, "openwftestserver" );
+
+GLDEF_C const TTestName ServerName()
+/**
+ * ServerName
+ *
+ * @return - The TEF server name
+ */
+    {
+    TTestName serverName(KServerName);
+    return serverName;
+    }
+
+GLDEF_C CTestSuite* CreateTestSuiteL()
+/**
+ * Create the overall test suite.
+ *
+ * @return - The top level suite
+ */
+    {
+    START_SUITE;
+
+    ADD_TEST_SUITE( COpenwfTest );
+
+    END_SUITE;
+    }
+
+GLDEF_C CTestStep* CreateTEFTestStep(const TDesC& , CTEFUnitServer& /* aServer */)
+/**
+ * Create individual test steps, outside the suite.
+ */
+    {
+    // Initialise test step object to NULL if no TEF step is found
+    CTestStep* testStep = NULL;
+
+    return testStep;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicscomposition/openwftest/src/surfaceutility.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,669 @@
+// Copyright (c) 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:
+//
+
+/**
+ @file
+*/
+
+#include <e32std.h>
+#include <imageconversion.h>
+#include <stdlib.h>
+#include <s32file.h> 
+#include "surfaceutility.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WFC_API_CALL WFCNativeStreamType WFC_APIENTRY
+extwfcGetOnScreenStream(WFCDevice dev, WFCContext context) WFC_APIEXIT;
+
+#ifdef __cplusplus
+}
+#endif
+
+CSurfaceUtility::CSurfaceUtility()
+: iSurfaces(NULL)
+	{
+	}
+	
+CSurfaceUtility* CSurfaceUtility::NewL()
+	{
+	CSurfaceUtility* utility = new (ELeave)CSurfaceUtility();
+	CleanupStack::PushL(utility);
+	utility->ConstructL();
+	CleanupStack::Pop(utility);
+	return utility;
+	}
+	
+void CSurfaceUtility::ConstructL()
+	{
+	TInt r = iManager.Open();
+	if (r != KErrNone)
+		{
+		LOG(("Surface manager failed to open: %d", r));
+		User::Leave(r);
+		}
+	
+	r = iSurfaceUpdateSession.Connect();
+	if (r != KErrNone)
+		{
+		LOG(("Failed to connect to update server: %d", r));
+		User::Leave(r);
+		}	
+	}
+
+CSurfaceUtility::~CSurfaceUtility()
+	{
+	DestroyAll();
+
+	iSurfaces.Close();
+
+	iManager.Close();
+
+	iSurfaceUpdateSession.Close();	
+	}
+
+TBool CSurfaceUtility::DestroyAll()
+	{
+	TInt err = 	KErrNone;
+	TInt jj = iSurfaces.Count() - 1;
+	if (jj<0)
+		return EFalse;
+	for (; jj >= 0; jj--)
+		{
+		err = iManager.CloseSurface(iSurfaces[jj]);
+		if (err!=KErrNone)
+			{
+			LOG(("Error closing surface: 0x%X\n", err));
+			}
+		TInt offset;
+		err = iManager.GetBufferOffset(iSurfaces[jj],0,offset);
+		if (err==KErrNone)
+		    {
+            LOG(("Error: closed surface still accessible: index %i surface %08X %08X %08X %08X\n", jj, iSurfaces[jj]));
+		    }
+		}
+	iSurfaces.Reset();
+	return ETrue;
+	}
+
+/***************************************
+ * The aim of the THeapSurfaceArray is to locally switch in the specified heap for any array operation
+ ***************************************/
+
+CSurfaceUtility::RHeapSurfaceArray::RHeapSurfaceArray(RHeapSurfaceArray* aUseExternalArray)
+	:	iUseArray(aUseExternalArray?aUseExternalArray->iUseArray:&this->iLocalArray),
+	iExternalHeapRef(aUseExternalArray?aUseExternalArray->iExternalHeapRef:User::Heap())
+	{
+	
+	}
+/************************************
+ * The following methods have been used by the surfaceutility... some require the heap wrapping, and some don't
+ * Three strategies are needed for 7 methods...
+ * Some methods only read the existing objects, so don't need a heap swap at all
+ * Leaving methods have to use PopAndDestroy strategy to restore the heap on leaving or success
+ * Non-leaving methods must not call PushL, so directly make SwitchHeap calls!
+ ************************************/
+
+// PopAndDestroy method to restore the heap
+/*static*/ void	CSurfaceUtility::RHeapSurfaceArray::PopHeap(void* aHeapPtr)
+	{
+	RHeap* heapPtr=(RHeap*)aHeapPtr;
+	User::SwitchHeap(heapPtr);
+	}
+
+TSurfaceId& CSurfaceUtility::RHeapSurfaceArray::operator[](TUint aIndex)
+	{
+	return iUseArray->operator[](aIndex);
+	}
+
+// Close only closes the local array, while Reset resets the active array (may be external)
+void CSurfaceUtility::RHeapSurfaceArray::Close()
+	{
+	iLocalArray.Close();
+	}
+
+TInt CSurfaceUtility::RHeapSurfaceArray::Count() const
+	{
+	return iUseArray->Count();
+	}
+
+// Close only closes the local array, while Reset resets the active array (may be external)
+inline void CSurfaceUtility::RHeapSurfaceArray::Reset()
+	{
+	iUseArray->Reset();
+	}
+
+void CSurfaceUtility::RHeapSurfaceArray::AppendL(const TSurfaceId &anEntry)
+	{
+	iUseArray->AppendL(anEntry);
+	}
+
+TInt CSurfaceUtility::RHeapSurfaceArray::Find(const TSurfaceId &anEntry) const
+	{
+	return iUseArray->Find(anEntry);
+	}
+
+void CSurfaceUtility::RHeapSurfaceArray::Remove(TInt anIndex)
+	{
+	iUseArray->Remove(anIndex);
+	}
+
+/**
+Cleanup stack helper object, holding references to both utility and surface, so
+that the standard Close() semantics can be used.
+*/
+class TSurfaceCleanup
+	{
+public:
+	TSurfaceCleanup(CSurfaceUtility& aUtility, TSurfaceId& aSurface)
+		: iUtility(aUtility), iSurface(aSurface)
+		{}
+	void Close()
+		{
+		// Removes the surface from the list of surfaces to clean up, and closes
+		// the surface reference.
+		iUtility.DestroySurface(iSurface);
+		}
+private:
+	CSurfaceUtility& iUtility;
+	TSurfaceId& iSurface;
+	};
+
+/**
+Get the size of a surface.
+
+@param aSurface The surface to get the size for.
+@return The size in pixels, or empty on failure.
+*/
+TSize CSurfaceUtility::SurfaceSize(const TSurfaceId& aSurface)
+	{
+	RSurfaceManager::TInfoBuf infoBuf;
+	RSurfaceManager::TSurfaceInfoV01& info = infoBuf();
+
+	if (iManager.SurfaceInfo(aSurface, infoBuf) == KErrNone)
+		{
+		return info.iSize;
+		}
+
+	return TSize();
+	}
+
+/**
+Create a surface using the surface manager.
+
+Stores the ID for tear down, as well as returning it.
+
+@param aSize Dimensions of the surface.
+@param aPixelFormat	UID of the pixel format.
+@param aStride	Stride value for the surface (usually bytes per pixel * width)
+@param aContiguous  Contiguous flag for creating surfaces
+@param aBuffers Number of buffers in the surface
+@leave May leave due to lack of memory.
+@return New surface's ID.
+*/
+TSurfaceId CSurfaceUtility::CreateSurfaceL(const TSize& aSize, TUidPixelFormat aPixelFormat, TInt aStride, TBool aContiguous, TInt aBuffers)
+	{
+	RSurfaceManager::TSurfaceCreationAttributesBuf bf;
+	RSurfaceManager::TSurfaceCreationAttributes& b = bf();
+	if (aStride<aSize.iWidth*BytesPerPixelL(aPixelFormat))
+	    {
+	    User::Leave(KErrOverflow);
+	    }
+	b.iSize.iWidth = aSize.iWidth;
+	b.iSize.iHeight = aSize.iHeight;
+	b.iBuffers = aBuffers;				// number of buffers in the surface
+	b.iPixelFormat = aPixelFormat;
+	b.iStride = aStride;		// Number of bytes between start of one line and start of next
+	b.iOffsetToFirstBuffer = 0;	// way of reserving space before the surface pixel data
+	b.iAlignment = 4;			// alignment, 1,2,4,8 byte aligned
+	b.iContiguous = aContiguous;
+	b.iMappable = ETrue;
+
+	TSurfaceId surface = TSurfaceId::CreateNullId();
+
+	User::LeaveIfError(iManager.CreateSurface(bf, surface));
+	iSurfaces.AppendL(surface);
+	return surface;
+	}
+
+/**
+A helper function that returns the bytes per pixel for a given pixel format uid
+
+@param aPixelFormat Pixel format UID to convert
+@return The bytes per pixel
+*/
+TInt CSurfaceUtility::BytesPerPixelL(TUidPixelFormat aPixelFormat)
+	{
+	TInt bytesPerPixel = 0;
+	switch (aPixelFormat)
+		{
+		case EUidPixelFormatXRGB_8888:
+		case EUidPixelFormatARGB_8888:
+		case EUidPixelFormatARGB_8888_PRE:
+			{
+			bytesPerPixel = 4;
+			break;
+			}
+		case EUidPixelFormatXRGB_4444:
+		case EUidPixelFormatARGB_4444:
+		case EUidPixelFormatRGB_565:
+			{
+			bytesPerPixel = 2;
+			break;
+			}
+		default:
+			{
+			User::Leave(KErrNotSupported);
+			break;
+			}
+		}
+	return bytesPerPixel;
+	}
+
+/**
+Fill buffer 0 of the given surface with a color.
+
+@param aSurface	The surface to be filled.
+@param aColor	The color to fill it with.
+*/
+void CSurfaceUtility::FillSurfaceL(TSurfaceId& aSurface, const TRgb& aColor)
+	{
+    FillSurfaceL(aSurface, 0, aColor);
+	}
+
+/**
+Fill a specified buffer number of the given surface with a color.
+
+@param aSurface	The surface to be filled.
+@param aBuffer 	The buffer to fill.
+@param aColor	The color to fill it with.
+*/
+void CSurfaceUtility::FillSurfaceL(TSurfaceId& aSurface, TInt aBuffer, const TRgb& aColor)
+	{
+	RSurfaceManager::TInfoBuf infoBuf;
+	RSurfaceManager::TSurfaceInfoV01& info = infoBuf();
+
+	User::LeaveIfError(iManager.SurfaceInfo(aSurface, infoBuf));
+	TUint32 color = 0;
+	TBool use16 = EFalse;
+	TInt numBuffers = info.iBuffers;
+	if (aBuffer < 0 || aBuffer >= numBuffers)
+		{
+		User::Leave(KErrArgument);
+		}
+
+	if (info.iSize.iHeight<0 || info.iSize.iWidth<0 || info.iStride<0)
+		{
+		User::Leave(KErrCorrupt);
+		}
+	if (info.iSize.iHeight==0 || info.iSize.iWidth==0 || info.iStride==0)
+		{
+		User::Leave(KErrNotReady);
+		}
+
+	switch (info.iPixelFormat)
+		{
+		case EUidPixelFormatXRGB_8888:
+			{
+			color = aColor.Color16MU();
+			break;
+			}
+		case EUidPixelFormatARGB_8888:
+			{
+			color = aColor.Color16MA();
+			break;
+			}
+		case EUidPixelFormatARGB_8888_PRE:
+			{
+			color = aColor.Color16MAP();
+			break;
+			}
+		case EUidPixelFormatXRGB_4444:
+		case EUidPixelFormatARGB_4444:
+			{
+			color = aColor.Color4K();
+			use16 = ETrue;
+			break;
+			}
+		case EUidPixelFormatRGB_565:
+			{
+			color = aColor.Color64K();
+			use16 = ETrue;
+			break;
+			}
+		default:
+			{
+			User::Leave(KErrNotSupported);
+			break;
+			}
+		}
+
+	RChunk chunk;
+	User::LeaveIfError(iManager.MapSurface(aSurface, chunk));
+	CleanupClosePushL(chunk);
+
+	TInt offsetToBuffer;
+	User::LeaveIfError(iManager.GetBufferOffset(aSurface, aBuffer, offsetToBuffer));
+	TUint8* surfacePtr = chunk.Base() + offsetToBuffer;
+	TUint8* linePtr = surfacePtr;
+
+	if (use16)
+		{
+		if ( info.iSize.iWidth*2>info.iStride)
+			{
+			User::Leave(KErrOverflow);
+			}
+		TUint16* ptr = reinterpret_cast<TUint16*>(surfacePtr);
+
+		// Fill first line
+		for (TInt xx = 0; xx < info.iSize.iWidth; xx++)
+			{
+			ptr[xx] = (TUint16)color;
+			}
+		}
+	else
+		{
+		if ( info.iSize.iWidth*4>info.iStride)
+			{
+			User::Leave(KErrOverflow);
+			}
+		TUint32* ptr = reinterpret_cast<TUint32*>(surfacePtr);
+
+		// Fill first line
+		for (TInt xx = 0; xx < info.iSize.iWidth; xx++)
+			{
+			ptr[xx] = color;
+			}
+		}
+
+	// Now copy that to the other lines
+	for (TInt yy = 1; yy < info.iSize.iHeight; yy++)
+		{
+		linePtr += info.iStride;
+		Mem::Copy(linePtr, surfacePtr, info.iSize.iWidth * BytesPerPixelL(info.iPixelFormat));
+		}
+	
+	CleanupStack::PopAndDestroy(/* chunk */);
+	}
+
+/**
+Destroy a surface.
+
+As well as destroying the surface, it is removed from the set held for
+destruction during tear down.
+
+@param aSurface	The surface to be destroyed.
+*/
+void CSurfaceUtility::DestroySurface(TSurfaceId& aSurface)
+	{
+	TInt index = iSurfaces.Find(aSurface);
+	
+	if (index != KErrNotFound)
+		{
+		iSurfaces.Remove(index);
+		}
+
+	TInt err = iManager.CloseSurface(aSurface);
+	if (err!=KErrNone)
+		LOG(("Error closing surfaces: 0x%X\n", err));
+	}
+
+/**
+Get surface header information
+
+@param aSurface A surface to get the header info from.
+@param aInfo Returned package info of the surface header.
+
+@return KErrNone if successful, KErrArgument if the surface ID does not refer to a surface,
+KErrAccessDenied if the surface is not open in the current process, otherwise a system wide
+error code.
+ */
+TInt CSurfaceUtility::GetHeader(const TSurfaceId& aSurface, RSurfaceManager::TInfoBuf& aInfo) 
+    {
+    return iManager.SurfaceInfo(aSurface, aInfo);
+    }
+
+/**
+Get buffer pointer to a surface
+
+@param aSurface Surface of the buffer pointer.
+@param aNumOfBuffer A number of buffer.
+@param aChunk A chunk of memory.
+
+@return A buffer pointer of the surface.
+ */
+TUint8* CSurfaceUtility::GetBufferPointerL(const TSurfaceId& aSurface, TInt aNumOfBuffer, RChunk& aChunk) 
+    {
+    TInt offsetToBuffer;
+    User::LeaveIfError(iManager.MapSurface(aSurface, aChunk));
+    User::LeaveIfError(iManager.GetBufferOffset(aSurface, aNumOfBuffer, offsetToBuffer));
+    TUint8* surfacePtr = aChunk.Base() + offsetToBuffer;
+    return surfacePtr;
+    }
+
+/**
+Get pixel color at a position.
+
+@param aInfo Package info of a surface.
+@param aPixelData Surface buffer pointer.
+@param aPosition Position of the pixel.
+
+@return Color of the pixel position.
+*/
+TRgb CSurfaceUtility::GetPixelL(RSurfaceManager::TInfoBuf& aInfo, TAny* aPixelData, TPoint aPosition) 
+    {
+    RSurfaceManager::TSurfaceInfoV01& info = aInfo();
+    TInt stride = info.iStride;
+    TUidPixelFormat pixelFormat = info.iPixelFormat;
+    TInt bytesPerPixel = BytesPerPixelL(pixelFormat);
+    TInt pixelStride = stride / bytesPerPixel;
+    TUint pixel = aPosition.iY * pixelStride + aPosition.iX;
+    TUint* pixels = reinterpret_cast< TUint* >( aPixelData );
+    TRgb colour;
+    colour.SetInternal(pixels[ pixel ]);
+    return colour;
+    }
+
+/**
+Check pixel color within a rectangle is as expected.
+It checks every color channel of every pixel within the rectangle.
+
+@param aSurface The surface to be checked.
+@param aRect The rectangle for pixel checking.
+@param aNumOfBuffer Number of buffer.
+@param aExpectedColor The expected color.
+@param aTolerance A tolerance value.
+
+@return EFalse if a color channel of a pixel is outside the tolerance range. 
+        ETrue if all pixel colors are within the tolerance range.
+*/
+TBool CSurfaceUtility::CheckRectColor(const TSurfaceId& aSurface, TRect& aRect, TInt aNumOfBuffer, const TRgb& aExpectedColor, TInt aTolerance) 
+    {
+    RSurfaceManager::TInfoBuf infoBuf;
+    RSurfaceManager::TSurfaceInfoV01& info = infoBuf();
+    TInt error = GetHeader(aSurface, infoBuf);
+    if (error != KErrNone)
+    	{
+		RDebug::Printf("Line %d GetHeader failed",__LINE__);
+		return EFalse;
+    	}
+
+    RChunk chunk;
+    TUint8* surfacePtr = NULL;
+    TRAP_IGNORE(surfacePtr = GetBufferPointerL(aSurface, aNumOfBuffer, chunk));
+    if (!surfacePtr)
+    	{
+		RDebug::Printf("Line %d GetBufferPointerL failed",__LINE__);
+		return EFalse;
+    	}
+    
+    TRgb color;
+    // Check every colour channel of every pixel is within the tolerance
+    for (TInt ii = aRect.iTl.iX; ii < aRect.iBr.iX; ++ii)
+        {
+        for (TInt jj = aRect.iTl.iY; jj < aRect.iBr.iY; ++jj)
+            {
+            color = GetPixelL(infoBuf, surfacePtr, TPoint(ii, jj));      
+            TBool checkR = (color.Red() <= (aExpectedColor.Red() + aTolerance) && color.Red() >= (aExpectedColor.Red() - aTolerance));
+            TBool checkG = (color.Green() <= (aExpectedColor.Green() + aTolerance) && color.Green() >= (aExpectedColor.Green() - aTolerance));
+            TBool checkB = (color.Blue() <= (aExpectedColor.Blue() + aTolerance) && color.Blue() >= (aExpectedColor.Blue() - aTolerance));
+            if (!checkR || !checkG || !checkB)
+                {
+                RDebug::Printf("At x=%d y=%d CheckRectColor has failed:",ii,jj);
+                RDebug::Printf("Expected Red %d - Actual Red %d",aExpectedColor.Red(),color.Red());
+                RDebug::Printf("Expected Green %d - Actual Green %d",aExpectedColor.Green(),color.Green());
+                RDebug::Printf("Expected Blue %d - Actual Blue %d",aExpectedColor.Blue(),color.Blue());
+                return EFalse;            
+                }               
+            }
+        }
+    return ETrue;
+    }
+
+/**
+Save on screen image to a .tga file
+
+@param aSurface A surface to be saved
+@param aBufferNumber The surface's buffer number
+@param aDestination The path and name of the tga to save eg c:\\test\\img\\image1.tga
+@return ETrue on successful calls
+        Fails if GetBufferPointerL returns NULL pointer
+ */
+TBool CSurfaceUtility::SaveResultImageTGAL(const TSurfaceId& aSurface, TInt aBufferNumber, TDesC& aDestination)
+    {
+    RSurfaceManager::TInfoBuf infoBuf;
+    RSurfaceManager::TSurfaceInfoV01& info = infoBuf();
+    User::LeaveIfError(GetHeader(aSurface, infoBuf));
+    TInt stride = info.iStride;
+    TSize surfaceSize = info.iSize;
+    TUidPixelFormat pixelFormat = info.iPixelFormat;
+    TInt bytesPerPixel = BytesPerPixelL(pixelFormat);
+    TInt widthInBytes = surfaceSize.iWidth * bytesPerPixel;
+    
+    RFs fs;
+    User::LeaveIfError(fs.Connect());
+    CleanupClosePushL(fs); 
+        
+    // Create image file
+    RFileWriteStream fstream;
+    User::LeaveIfError(fstream.Replace(fs, aDestination, EFileShareAny|EFileWrite));
+    CleanupClosePushL(fstream); 
+    
+    // Write header
+    fstream.WriteUint8L(0);                 // ID Length
+    fstream.WriteUint8L(0);                 // Color map type
+    fstream.WriteUint8L(2);                 // Image type - Uncompressed, True-color Image
+    fstream.WriteUint32L(0);                // Color map specification 5 bytes
+    fstream.WriteUint8L(0);                 // Color map specification
+    fstream.WriteUint32L(0);                // Image specification - origin of image
+    fstream.WriteUint16L(static_cast<TUint16>(surfaceSize.iWidth));      // Image specification - Image width
+    fstream.WriteUint16L(static_cast<TUint16>(surfaceSize.iHeight));     // Image specification - Image height
+    fstream.WriteUint8L(32);                // Image specification - Pixel Depth (bits per pixel)
+    fstream.WriteUint8L(1 << 5);            // Image specification - Image Descriptor, Screen destination of first pixel is top left 
+
+    RChunk chunk;
+    TUint8* surfacePtr = GetBufferPointerL(aSurface, aBufferNumber, chunk);
+    if(surfacePtr == NULL)
+        {
+        CleanupStack::PopAndDestroy(2); 
+        return EFalse;
+        }
+    
+    // Write image line by line
+    for(TInt ii = 0; ii < surfaceSize.iHeight; ++ii)
+        {
+        fstream.WriteL(surfacePtr, widthInBytes); 
+        surfacePtr += stride;
+        }
+
+    fstream.CommitL();
+    chunk.Close();
+    CleanupStack::PopAndDestroy(2); 
+    
+    return ETrue;
+    }
+
+/**
+Create directory for images to be saved
+
+@param aDir Directory for images to be saved
+@return ETrue on success
+ */
+TBool CSurfaceUtility::CreateImagePath(TDesC& aDir)
+    {
+    RFs fs;
+    TInt err = fs.Connect();
+    if (err == KErrNone)
+        {
+        err = fs.MkDirAll(aDir);
+        if (err == KErrAlreadyExists)
+            {
+            err = KErrNone;
+            }
+        fs.Close();
+        }
+    return (err == KErrNone);
+    }
+    
+/**
+Submit an update to a surface to the update server.
+
+@param aSurface	The surface which has been updated.
+@param aRegion	The area of the surface affected, or NULL for all of it.
+*/
+TInt CSurfaceUtility::SubmitUpdate(const TSurfaceId& aSurface,TInt aBufferNumber, const TRegion* aRegion)
+	{
+	if (!iSurfaceUpdateSession.Handle())
+	    {
+	    iSurfaceUpdateSession.Connect();
+	    }
+    if (!iSurfaceUpdateSession.Handle())
+        {
+        LOG(("Error - SUS client not started!"));
+        return KErrNotReady;
+        }
+    else
+        {
+        TInt err =iSurfaceUpdateSession.SubmitUpdate(KAllScreens, aSurface, aBufferNumber, aRegion); 
+        if (err!=KErrNone)
+            LOG(("Error submitting update: 0x%X\n", err));
+        return err;
+        }
+	}
+
+void CSurfaceUtility::NotifyWhenDisplayed(TRequestStatus& aStatusDisplayed, TTimeStamp& aTimeStamp)
+    {
+    iSurfaceUpdateSession.NotifyWhenDisplayed(aStatusDisplayed, aTimeStamp);
+    }
+
+void CSurfaceUtility::NotifyWhenDisplayedXTimes(TInt aCount, TRequestStatus& aStatusDisplayedX)
+    {
+    iSurfaceUpdateSession.NotifyWhenDisplayedXTimes(aCount, aStatusDisplayedX);
+    }
+
+void CSurfaceUtility::NotifyWhenAvailable(TRequestStatus& aStatusAvailable)
+    {
+    iSurfaceUpdateSession.NotifyWhenAvailable(aStatusAvailable);
+    }
+
+SymbianStreamType CSurfaceUtility::GetOnScreenStream(WFCDevice aDev, WFCContext aContext)
+    {
+    return reinterpret_cast<SymbianStreamType>(wfcGetOnScreenStream(aDev, aContext));
+    }
+
+
+
--- a/graphicsdeviceinterface/bitgdi/sbit/FONTBMP.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicsdeviceinterface/bitgdi/sbit/FONTBMP.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -65,7 +65,9 @@
 EXPORT_C void CFbsBitGcFont::Reset()
 	{
 	if (!iCopy)
+		{
 		CFbsFont::Reset();
+		}
 	else
 		{
 		iAddressPointer = NULL;
--- a/graphicsdeviceinterface/bitgdi/sbit/MAIN.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicsdeviceinterface/bitgdi/sbit/MAIN.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -23,7 +23,6 @@
 #include <shapeinfo.h>
 #include "bitgcextradata.h"
 
-
 #define KDefaultShadowColor KRgbGray
 
 //CFbsBitGc streams - version numbers.
--- a/graphicsdeviceinterface/bitgdi/tbit/TDefect2.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicsdeviceinterface/bitgdi/tbit/TDefect2.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2003-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"
@@ -2125,13 +2125,18 @@
 	DeleteGraphicsContext();
 	DeleteScreenDevice();
 	TRAPD(err, iScrDev = CFbsScreenDevice::NewL(aScreenNo, aDisplayMode));
-	if(err == KErrNotSupported)
+	if ( !iScrDev )
 		{
+		TESTE( err == KErrNotSupported, err );
 		return err;
 		}
 	TEST(err == KErrNone);
 	TEST(iScrDev->ScreenNo() == aScreenNo);
 	err = iScrDev->CreateContext((CGraphicsContext*&)iGc);
+	if ( !iGc )
+		{
+		return err;
+		}
 	TEST(err == KErrNone);
 	iGc->SetUserDisplayMode(aDisplayMode);
 	iScrDev->ChangeScreenDevice(NULL);
--- a/graphicsdeviceinterface/gdi/bwins/GDI2U.def	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicsdeviceinterface/gdi/bwins/GDI2U.def	Tue Jul 20 13:27:44 2010 +0300
@@ -301,20 +301,23 @@
 	??0RGlyphOutlineIterator@@QAE@XZ @ 300 NONAME ; RGlyphOutlineIterator::RGlyphOutlineIterator(void)
 	?Open@RGlyphOutlineIterator@@QAEHAAVCFont@@PBIHH@Z @ 301 NONAME ; int RGlyphOutlineIterator::Open(class CFont &, unsigned int const *, int, int)
 	??0RFontTable@@QAE@XZ @ 302 NONAME ; RFontTable::RFontTable(void)
-	?Image@RGlyphDataIterator@@QBEABVRSgImage@@XZ @ 303 NONAME ABSENT ; class RSgImage const & RGlyphDataIterator::Image(void) const
-	??0RGlyphMetricsArray@@QAE@XZ @ 304 NONAME ABSENT ; RGlyphMetricsArray::RGlyphMetricsArray(void)
-	?Count@RGlyphMetricsArray@@QBEHXZ @ 305 NONAME ABSENT ; int RGlyphMetricsArray::Count(void) const
-	?Metrics@RGlyphDataIterator@@QBEABVTOpenFontCharMetrics@@XZ @ 306 NONAME ABSENT ; class TOpenFontCharMetrics const & RGlyphDataIterator::Metrics(void) const
-	??0RGlyphDataIterator@@QAE@XZ @ 307 NONAME ABSENT ; RGlyphDataIterator::RGlyphDataIterator(void)
-	??ARGlyphMetricsArray@@QBEABVTOpenFontCharMetrics@@H@Z @ 308 NONAME ABSENT ; class TOpenFontCharMetrics const & RGlyphMetricsArray::operator[](int) const
-	?GlyphCode@RGlyphDataIterator@@QBEIXZ @ 309 NONAME ABSENT ; unsigned int RGlyphDataIterator::GlyphCode(void) const
-	?Rect@RGlyphDataIterator@@QBEABVTRect@@XZ @ 310 NONAME ABSENT ; class TRect const & RGlyphDataIterator::Rect(void) const
-	?Next@RGlyphDataIterator@@QAEHXZ @ 311 NONAME ABSENT ; int RGlyphDataIterator::Next(void)
-	?Close@RGlyphMetricsArray@@QAEXXZ @ 312 NONAME ABSENT ; void RGlyphMetricsArray::Close(void)
-	?Get@RGlyphMetricsArray@@QAEHAAVCFont@@PBIH@Z @ 313 NONAME ABSENT ; int RGlyphMetricsArray::Get(class CFont &, unsigned int const *, int)
-	?Close@RGlyphDataIterator@@QAEXXZ @ 314 NONAME ABSENT ; void RGlyphDataIterator::Close(void)
-	?Open@RGlyphDataIterator@@QAEHAAVCFont@@PBIH@Z @ 315 NONAME ABSENT ; int RGlyphDataIterator::Open(class CFont &, unsigned int const *, int)
+	?Image@RGlyphDataIterator@@QBEABVRSgImage@@XZ @ 303 NONAME ABSENT
+	??0RGlyphMetricsArray@@QAE@XZ @ 304 NONAME ABSENT
+	?Count@RGlyphMetricsArray@@QBEHXZ @ 305 NONAME ABSENT
+	?Metrics@RGlyphDataIterator@@QBEABVTOpenFontCharMetrics@@XZ @ 306 NONAME ABSENT
+	??0RGlyphDataIterator@@QAE@XZ @ 307 NONAME ABSENT
+	??ARGlyphMetricsArray@@QBEABVTOpenFontCharMetrics@@H@Z @ 308 NONAME ABSENT
+	?GlyphCode@RGlyphDataIterator@@QBEIXZ @ 309 NONAME ABSENT
+	?Rect@RGlyphDataIterator@@QBEABVTRect@@XZ @ 310 NONAME ABSENT
+	?Next@RGlyphDataIterator@@QAEHXZ @ 311 NONAME ABSENT
+	?Close@RGlyphMetricsArray@@QAEXXZ @ 312 NONAME ABSENT
+	?Get@RGlyphMetricsArray@@QAEHAAVCFont@@PBIH@Z @ 313 NONAME ABSENT
+	?Close@RGlyphDataIterator@@QAEXXZ @ 314 NONAME ABSENT
+	?Open@RGlyphDataIterator@@QAEHAAVCFont@@PBIH@Z @ 315 NONAME ABSENT
 	?SetName@TTypeface@@QAEXABVTDesC16@@@Z @ 316 NONAME ; void TTypeface::SetName(class TDesC16 const &)
 	?Name@TTypeface@@QBEABVTDesC16@@XZ @ 317 NONAME ; class TDesC16 const & TTypeface::Name(void) const
-	
+	?At@RHexTreeBase@@IBEPAXI@Z @ 318 NONAME ; void * RHexTreeBase::At(unsigned int) const
+	??0RHexTreeBase@@IAE@PAVRHeap@@@Z @ 319 NONAME ; RHexTreeBase::RHexTreeBase(class RHeap *)
+	?SetAt@RHexTreeBase@@IAEHIPAX@Z @ 320 NONAME ; int RHexTreeBase::SetAt(unsigned int, void *)
+	?ResetAndDestroy@RHexTreeBase@@QAEXXZ @ 321 NONAME ; void RHexTreeBase::ResetAndDestroy(void)
 
--- a/graphicsdeviceinterface/gdi/inc/GDI.H	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicsdeviceinterface/gdi/inc/GDI.H	Tue Jul 20 13:27:44 2010 +0300
@@ -141,9 +141,9 @@
 	EGdiPanic_OutOfText				= 2,
 	/** Internal failure. */
 	EGdiPanic_Invariant				= 3,
-	/** Reserved panic codes. Not to be used. */
-	EGdiPanic_Reserved1				= 4,
-	EGdiPanic_Reserved2				= 5,
+	/** Unused panic codes. Can be reused if needed. */
+	EGdiPanic_Unused1				= 4,
+	EGdiPanic_Unused2				= 5,
 	/** Setting a typeface name that is too long */
 	EGdiPanic_TypefaceNameOverflow	= 6,
 	};
--- a/graphicsdeviceinterface/gdi/inc/gdiconsts.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicsdeviceinterface/gdi/inc/gdiconsts.h	Tue Jul 20 13:27:44 2010 +0300
@@ -38,5 +38,4 @@
 const TUid KUidIsFbsBitmapGc = {0x10285BBE};
 
 
-
 #endif /* GDICONSTS_H */
--- a/graphicsdeviceinterface/gdi/inc/gdiplatapi.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicsdeviceinterface/gdi/inc/gdiplatapi.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
--- a/graphicsdeviceinterface/screendriver/sbit/Cdsb.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicsdeviceinterface/screendriver/sbit/Cdsb.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -348,9 +348,9 @@
 		case 24:
 		case 32:
 			iBitmapInfo.iPixelShift = 5;
-			iBitmapInfo.iDisplayMode = EColor16MAP;
+			iBitmapInfo.iDisplayMode = EColor16MA;
 #ifdef SYMBIAN_GRAPHICS_GCE
-			iPixelFormat = EUidPixelFormatARGB_8888_PRE;
+			iPixelFormat = EUidPixelFormatARGB_8888;
 			iBytesPerPixel = 4;
 #endif
 			break;
--- a/graphicsdeviceinterface/screendriver/sgeneric/scdraw.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicsdeviceinterface/screendriver/sgeneric/scdraw.h	Tue Jul 20 13:27:44 2010 +0300
@@ -63,7 +63,6 @@
 	void Update();
 	void Update(TRequestStatus& aStatus);
 
-	void Update(const TRegion& aRegion);
 	void UpdateRegion(const TRect& aRect);
 	void ResetUpdateRegion();
 	void NotifyWhenAvailable(TRequestStatus& aStatus);
--- a/graphicsdeviceinterface/screendriver/sgeneric/scdraw.inl	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicsdeviceinterface/screendriver/sgeneric/scdraw.inl	Tue Jul 20 13:27:44 2010 +0300
@@ -98,13 +98,30 @@
 
 template <class T> void CGenericScreenDevice<T>::Update(const TRegion& aRegion)
 	{
-	iHelper.Update(aRegion);
+    if(!aRegion.IsEmpty() && !aRegion.CheckError())
+        {
+        if (aRegion.Count()>KMaxUpdateRegionRectangles)
+            {
+            UpdateRegion(aRegion.BoundingRect());
+            }
+        else
+            {
+            TInt rcCnt = aRegion.Count();
+            for (TInt ii=0; ii < rcCnt; ++ii)
+                {  
+                UpdateRegion(aRegion[ii]);  //Applies deorientate (offset, scale, rotate)
+                }
+            }
+        }
+    Update();
 	}
 
 template <class T> void CGenericScreenDevice<T>::UpdateRegion(const TRect& aRect)
-	{
-	iHelper.UpdateRegion(aRect);
-	}
+    {
+    const TRect rect = CDrawXxxBppBitmap::DeOrientate(aRect);//rect - physical coordinates
+    
+    iHelper.UpdateRegion(rect);
+    }
 
 template <class T> TInt CGenericScreenDevice<T>::GetInterface(TInt aInterfaceId, TAny*& aInterface)
 	{
--- a/graphicsdeviceinterface/screendriver/sgeneric/scnew.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicsdeviceinterface/screendriver/sgeneric/scnew.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -276,7 +276,7 @@
 */
 EXPORT_C TDisplayMode CFbsDrawDevice::DisplayMode16M()
 	{
-	return EColor16MAP;
+	return EColor16MA;
 	}
 
 
@@ -372,24 +372,6 @@
 		}
 	}
 
-/**
-Implementation of corresponding function in CDrawDevice, utilizing a tracked
-update region. Adds the given region to the update region and updates the
-screen.
-@param aRegion	Additional region to be updated.
-*/
-void CScreenDeviceHelper::Update(const TRegion& aRegion)
-	{
-	if(!aRegion.IsEmpty() && !aRegion.CheckError())
-		{
-		TInt rcCnt = aRegion.Count();
-		for (TInt ii=0; ii < rcCnt; ++ii)
-			{
-			UpdateRegion(aRegion[ii]);
-			}
-		}
-	Update();
-	}
 
 /**
 Implementation of corresponding function in CDrawDevice, utilizing a tracked
--- a/graphicshwdrivers/surfacemgr/inc/surface_hints.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicshwdrivers/surfacemgr/inc/surface_hints.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-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"
@@ -47,6 +47,12 @@
 */
 const TInt KSurfaceProtection = 0x3;
 
+/** Hint about the surface’s characteristics or properties,
+   For example if a surface can be persisted by the effects engine.
+   @see TSurfaceCharacteristics for possible values.
+*/
+const TInt KSurfaceCharacteristics = 0x4;
+
 
 /** Values used for the KSurfaceContent key */
 enum TSurfaceContent
@@ -120,6 +126,17 @@
     };
 
 
+/** Values used for the KSurfaceCharacteristics key. The values are bitmasks and can be combined.
+*/
+enum TSurfaceCharacteristics
+    {
+    /**
+    * Surface cannot be persisted once it has been closed by the creator
+    */
+    ENotPersistable = 1,
+    };
+
+
 class TSurfaceUpdate
     {
     /** Constructor.
@@ -185,7 +202,7 @@
     return ( iValue & 0x80000000 ) ? ETrue : EFalse;
     }
 
-}; //namespace surfaceHints
+} //namespace surfaceHints
 
 #endif //__SURFACE_HINTS_H__
 
--- a/graphicshwdrivers/surfacemgr/test/src/tsurfacemanager.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicshwdrivers/surfacemgr/test/src/tsurfacemanager.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-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"
@@ -21,6 +21,7 @@
  @internalComponent - Internal Symbian test code
 */
 
+
 #include "tsurfacemanager.h"
 #include <e32base.h>
 #include <e32cons.h>
@@ -29,6 +30,9 @@
 #include <e32cmn.h>	  
 #include <hal.h>
 #include <e32def_private.h>
+#include <graphics/surface_hints.h>
+
+using namespace surfaceHints;
 
 const TInt KCountLimit = 10000;
 
@@ -3188,36 +3192,32 @@
 	
 	//Add HintPair1
 	RSurfaceManager::THintPair hintPair1;
-	hintPair1.iKey.iUid = 0x123257;
-	hintPair1.iValue = 300;
-	hintPair1.iMutable = ETrue;
+	hintPair1.Set(TUid::Uid(KSurfaceContent), EStillImage, ETrue);
 	TEST(KErrNone == iSurfaceManager.AddSurfaceHint(surfaceId, hintPair1));
 	
 	RSurfaceManager::THintPair hintPairCheck1;
-	hintPairCheck1.iKey.iUid = 0x123257;
+	hintPairCheck1.iKey.iUid = KSurfaceContent;
 	CheckHintPair(surfaceId, hintPairCheck1, hintPair1);
 	
 	//Add HintPair2
 	RSurfaceManager::THintPair hintPair2;
-	hintPair2.iKey.iUid = 0x123267;
-	hintPair2.iValue = 100;
+	hintPair2.iKey.iUid = KSurfaceProtection;
+	hintPair2.iValue = EAllowAnalog | EAllowDigital;
 	hintPair2.iMutable = EFalse;
 	TEST(KErrNone == iSurfaceManager.AddSurfaceHint(surfaceId, hintPair2));
 		
 	RSurfaceManager::THintPair hintPairCheck2;
-	hintPairCheck2.iKey.iUid = 0x123267;
+	hintPairCheck2.iKey.iUid = KSurfaceProtection;
 	CheckHintPair(surfaceId, hintPairCheck2, hintPair2);
 	CheckHintPair(surfaceId, hintPairCheck1, hintPair1);
 
 	//Add HintPair3
 	RSurfaceManager::THintPair hintPair3;
-	hintPair3.iKey.iUid = 0x123324;
-	hintPair3.iValue = 500;
-	hintPair3.iMutable = ETrue;
+	hintPair3.Set(TUid::Uid(KSurfaceCharacteristics), ENotPersistable, EFalse);
 	TEST(KErrNone == iSurfaceManager.AddSurfaceHint(surfaceId, hintPair3));
 	
 	RSurfaceManager::THintPair hintPairCheck3;
-	hintPairCheck3.iKey.iUid = 0x123324;
+	hintPairCheck3.iKey.iUid = KSurfaceCharacteristics;
 	CheckHintPair(surfaceId, hintPairCheck3, hintPair3);
 	CheckHintPair(surfaceId, hintPairCheck2, hintPair2);
 	CheckHintPair(surfaceId, hintPairCheck1, hintPair1);
@@ -4439,3 +4439,4 @@
     if(!aCondition)
         User::Leave(TEST_ERROR_CODE);   // leave with standard error code
     }
+
--- a/graphicstest/graphicstestharness/automation/graphicssystemgui.sysdef.xml	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/graphicstestharness/automation/graphicssystemgui.sysdef.xml	Tue Jul 20 13:27:44 2010 +0300
@@ -146,6 +146,12 @@
 					<component name="OpenWF Composition Engine">
 						<unit bldFile="sf\os\graphics\graphicscomposition\openwfcompositionengine\group" mrp="sf\os\graphics\graphicscomposition\openwfcompositionengine\group\graphics_openwfcompositionengine.mrp"/>
 					</component>
+					<component name="OpenWF Composition Display Driver Adaptation for Display Channel">
+						<unit bldFile="sf\os\graphics\graphicscomposition\openwfc_ri_displaychannel\group" mrp="sf\os\graphics\graphicscomposition\openwfc_ri_displaychannel\group\graphics_openwfc_ri_displaychannel.mrp"/>
+					</component>            		
+					<component name="OpenWF Tests">
+						<unit bldFile="sf\os\graphics\graphicscomposition\openwftest\group" mrp="sf\os\graphics\graphicscomposition\openwftest\group\graphics_openwftest.mrp"/>
+					</component>            		
 				</collection>
 				<collection name="Graphics Device Interface">
 					<component name="BitGDI">
@@ -266,5 +272,12 @@
 				</collection>
 			</block>
 		</layer>
+		<layer name="Additional Tools">
+			<collection name="ONB Tools">
+				<component name="Thindump" class="test">
+					<unit bldFile="thindump\group" />
+				</component>
+			</collection>
+		</layer>
 	</systemModel>
 </SystemDefinition>
--- a/graphicstest/graphicstestharness/automation/h4/roms.txt	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/graphicstestharness/automation/h4/roms.txt	Tue Jul 20 13:27:44 2010 +0300
@@ -1,32 +1,32 @@
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_test.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics0a_armv5_dpdef','Graphics Test ROM (0a) DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_00a.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby outlineshadow.iby FntStoreRebootTests.iby','-D__MMC -DGRAPHICS_MISTRAL_ROM  -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DGRAPHICS_EXCLUDE_FREETYPE','h4hrp_graphics0b_armv5_dpdef','Graphics Test ROM (0b) - Outline Shadow DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_00b.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_test.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DFBSRASTERIZER_DRV="^<"fbsrasterizer_test.iby"^>"','h4hrp_graphics0c_armv5_dpdef','Graphics Test ROM (0c) - Example Rasterizer Included DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_00c.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_test1.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics1_armv5_dpdef','Graphics Test ROM (1) DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_01.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_test1.iby fbsrasterizertests.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DFBSRASTERIZER_DRV="^<"fbsrasterizer_test.iby"^>"','h4hrp_graphics1a_armv5_dpdef','Graphics Test ROM (1a) - FbsRasterizer DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_01a.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_test2.iby internaltestfonts.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics2_armv5_dpdef','Graphics Test ROM (2) DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_02.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby openvgtest.iby',' -D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics3_armv5_dpdef','Graphics Test ROM (3) - OpenVG DP Default','\epoc32\data\z\graphics\wsini_integ.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_03.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby supplieropenvgtest.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics3a_armv5_dpdef','Graphics Test ROM (3a) - OpenVG tests requiring USB/Memory Card support DP Default','\epoc32\data\z\graphics\wsini_integ.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_03a.txt' ,'')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec wserv.oby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics4_armv5_dpdef','Graphics Test ROM (4) - WServ DP Default','\epoc32\data\z\system\data\ws_test.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_04.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec wserv.oby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics4ct_armv5_dpdef','Graphics Test ROM (4ct) - WServ Change Tracking DP Default','\epoc32\data\z\system\data\ws_test_changetracking.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_04ct.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby te_uibench.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DFBSRASTERIZER_DRV="^<"fbsrasterizer_test.iby"^>"','h4hrp_graphics5a_armv5_dpdef','Graphics Test ROM (5a) - UIBench DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_05a.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby internaltestfonts.iby te_outlineshadow.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DGRAPHICS_EXCLUDE_FREETYPE','h4hrp_graphics5b_armv5_dpdef','Graphics Test ROM (5b) - UIBench - Outline Shadow DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_05b.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby te_uibench_s60.iby egl.iby opengles.iby openvg.iby internaltestfonts.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DFBSRASTERIZER_DRV="^<"fbsrasterizer_test.iby"^>"','h4hrp_uibench_s60_armv5_dpdef','Graphics Test ROM UIBench S60 DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_uibench_s60.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_test2.iby wservtest.iby csc_plugin.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics7_armv5_dpdef','Graphics Test ROM (7) DP Default','\epoc32\data\z\graphics\wsini_integ_color64k.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_07.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec t_wservinteg.iby opengles.iby graphics_testharness.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics8_armv5_dpdef','Graphics Test ROM (8) - WServ Integ DP Default','\epoc32\data\z\graphics\wsini_integ.ini,\epoc32\data\z\system\data\wsini.ini;\epoc32\data\z\system\data\testexecute_modified.ini,\epoc32\data\z\system\data\testexecute.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_08.txt','')
-RomAndAutoRom('armv5','h4hrp pagedrom textshell platsec surfacemanagertest.iby wservtest.iby gce_tests.iby tdisplaychannel.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE','h4hrp_graphics9_armv5_dpdef','Graphics Test ROM (9) - Hybrid GCE DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_09.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_test2.iby wservtest.iby csc_plugin.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics12_armv5_dpdef','Graphics Test ROM (12) DP Default','\epoc32\data\z\graphics\wsini_integ_color16ma.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_12.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby t_wservgenericplugin.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics13_armv5_dpdef','Graphics Test ROM (13) - Generic Plugin DP Default','\epoc32\data\z\wstest\genericplugin\wsini_nga.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_13.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby twservstresstest.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE','h4hrp_graphics15_armv5_dpdef','Graphics Test ROM (15) - Stress DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_15.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby t_extendedbitmaprenderstage.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE','h4hrp_graphics16_armv5_dpdef','Graphics Test ROM (16) - Extended Bitmap Render Stage DP Default','\epoc32\data\z\wstest\textendedbitmap\wsini.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_16.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby t_ratelimiter.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE','h4hrp_graphics17_armv5_dpdef','Graphics Test ROM (17) - Rate Limiter DP Default','\epoc32\data\z\wstest\ratelimiter\wsini.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_17.txt','')
-RomAndAutoRom('armv5','h4hrp pagedrom minigui platsec graphics_testharness.iby csc_plugin.iby tcsc.iby openvgtest.iby surfaceupdatetest_integ.iby t_gcenotification.iby graphics_test2.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE','h4hrp_graphics18_armv5_dpdef','Graphics Test ROM (18) - Composited Screen Capture DP Default','\epoc32\data\z\wstest\wsini_csc_nga_qvga.ini,\epoc32\data\z\wsini_minigui.ini;\epoc32\data\z\graphicstest\testexecute_minigui.ini,\epoc32\data\z\system\data\testexecute.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_18.txt','')
-RomAndAutoRom('armv5','h4hrp pagedrom minigui platsec graphics_testharness.iby csc_plugin.iby tcsc.iby egltesthybrid.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE','h4hrp_graphicseglhybrid_armv5_dpdef','Graphics Test ROM (eglhybrid) - EGL Hybrid Graphics Implementation DP Default','\epoc32\data\z\wstest\wsini_csc_nga_qvga.ini,\epoc32\data\z\wsini_minigui.ini;\epoc32\data\z\graphicstest\testexecute_minigui.ini,\epoc32\data\z\system\data\testexecute.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_eglhybrid.txt','')
-RomAndAutoRom('armv5','h4hrp pagedrom minigui platsec graphics_testharness.iby csc_plugin.iby tcsc.iby egltestref.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_USE_EGL_REF','h4hrp_graphicseglref_armv5_dpdef','Graphics Test ROM (eglref) - EGL Reference Graphics Implementation DP Default','\epoc32\data\z\wstest\wsini_csc_nga_qvga.ini,\epoc32\data\z\wsini_minigui.ini;\epoc32\data\z\graphicstest\testexecute_minigui.ini,\epoc32\data\z\system\data\testexecute.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_eglref.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby talf.iby','-D__MMC -DUSE_SDIO_SD_MMC -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE','h4hrp_graphics23_armv5_dpdef','Graphics Test ROM (23) - ALF/ChangeTracking DP Default','\epoc32\data\z\talf\wsini.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_23.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby t_eventchecker.iby t_bitgdirenderstage.iby wserv.oby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DRVT','h4hrp_graphics24_armv5_dpdef','Graphics Test ROM (24) - BitGDI Renderstage DP Default','\epoc32\data\z\wstest\tbitgdirenderstage\arm\wsini.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_24.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec wserv.oby graphics_testharness.iby talf.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics25_armv5_dpdef','Graphics Test ROM (25) - ALF/ChangeTracking per screen DP Default','\epoc32\data\z\talf\wsini_ct_per_screen.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_25.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby tlayercompositiontest.iby csc_plugin.iby tcsc.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics29a_armv5_dpdef','Graphics Test ROM (29a) - Layer Composition DP Default','\epoc32\data\z\tlayercomposition\wsini.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_29a.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby tlayercompositiontest.iby csc_plugin.iby tcsc.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics29b_armv5_dpdef','Graphics Test ROM (29b) - Layer Composition, No Autoclear DP Default','\epoc32\data\z\tlayercomposition\wsini_noautoclear.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_29b.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec appfwk_test.iby','-D__MMC -DUSE_SDIO_SD_MMC -DUSE_24UBPP_DISPLAY_VARIANT_TV -D_DEBUG','h4hrp_uiframeworks_armv5_dpdef','UI Frameworks DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_uif.txt','')
-RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby sgresourcetest.iby opengles.iby','-D__MMC -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphicsresource_armv5_dpdef','Graphics Test ROM (GRI) - Graphics Resource DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_gri.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_test.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics0a_armv5_dpdef','Graphics Test ROM (0a) DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_00a.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby outlineshadow.iby FntStoreRebootTests.iby','-D__MMC -DGRAPHICS_MISTRAL_ROM -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DGRAPHICS_EXCLUDE_FREETYPE','h4hrp_graphics0b_armv5_dpdef','Graphics Test ROM (0b) - Outline Shadow DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_00b.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_test.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DFBSRASTERIZER_DRV="^<"fbsrasterizer_test.iby"^>"','h4hrp_graphics0c_armv5_dpdef','Graphics Test ROM (0c) - Example Rasterizer Included DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_00c.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_test1.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics1_armv5_dpdef','Graphics Test ROM (1) DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_01.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_test1.iby fbsrasterizertests.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DFBSRASTERIZER_DRV="^<"fbsrasterizer_test.iby"^>"','h4hrp_graphics1a_armv5_dpdef','Graphics Test ROM (1a) - FbsRasterizer DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_01a.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_test2.iby internaltestfonts.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics2_armv5_dpdef','Graphics Test ROM (2) DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_02.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby openvgtest.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics3_armv5_dpdef','Graphics Test ROM (3) - OpenVG DP Default','\epoc32\data\z\graphics\wsini_integ.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_03.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby supplieropenvgtest.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics3a_armv5_dpdef','Graphics Test ROM (3a) - OpenVG tests requiring USB/Memory Card support DP Default','\epoc32\data\z\graphics\wsini_integ.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_03a.txt' ,'')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec wserv.oby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics4_armv5_dpdef','Graphics Test ROM (4) - WServ DP Default','\epoc32\data\z\system\data\ws_test.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_04.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec wserv.oby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics4ct_armv5_dpdef','Graphics Test ROM (4ct) - WServ Change Tracking DP Default','\epoc32\data\z\system\data\ws_test_changetracking.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_04ct.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby te_uibench.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DFBSRASTERIZER_DRV="^<"fbsrasterizer_test.iby"^>"','h4hrp_graphics5a_armv5_dpdef','Graphics Test ROM (5a) - UIBench DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_05a.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby internaltestfonts.iby te_outlineshadow.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DGRAPHICS_EXCLUDE_FREETYPE','h4hrp_graphics5b_armv5_dpdef','Graphics Test ROM (5b) - UIBench - Outline Shadow DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_05b.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby te_uibench_s60.iby egl.iby opengles.iby openvg.iby internaltestfonts.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DFBSRASTERIZER_DRV="^<"fbsrasterizer_test.iby"^>"','h4hrp_uibench_s60_armv5_dpdef','Graphics Test ROM UIBench S60 DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_uibench_s60.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_test2.iby wservtest.iby csc_plugin.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics7_armv5_dpdef','Graphics Test ROM (7) DP Default','\epoc32\data\z\graphics\wsini_integ_color64k.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_07.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec t_wservinteg.iby opengles.iby graphics_testharness.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics8_armv5_dpdef','Graphics Test ROM (8) - WServ Integ DP Default','\epoc32\data\z\graphics\wsini_integ.ini,\epoc32\data\z\system\data\wsini.ini;\epoc32\data\z\system\data\testexecute_modified.ini,\epoc32\data\z\system\data\testexecute.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_08.txt','')
+RomAndAutoRom('armv5','h4hrp pagedrom textshell platsec surfacemanagertest.iby wservtest.iby gce_tests.iby tdisplaychannel.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE','h4hrp_graphics9_armv5_dpdef','Graphics Test ROM (9) - Hybrid GCE DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_09.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_test2.iby wservtest.iby csc_plugin.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics12_armv5_dpdef','Graphics Test ROM (12) DP Default','\epoc32\data\z\graphics\wsini_integ_color16ma.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_12.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby t_wservgenericplugin.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics13_armv5_dpdef','Graphics Test ROM (13) - Generic Plugin DP Default','\epoc32\data\z\wstest\genericplugin\wsini_nga.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_13.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby twservstresstest.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE','h4hrp_graphics15_armv5_dpdef','Graphics Test ROM (15) - Stress DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_15.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby t_extendedbitmaprenderstage.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE','h4hrp_graphics16_armv5_dpdef','Graphics Test ROM (16) - Extended Bitmap Render Stage DP Default','\epoc32\data\z\wstest\textendedbitmap\wsini.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_16.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby t_ratelimiter.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE','h4hrp_graphics17_armv5_dpdef','Graphics Test ROM (17) - Rate Limiter DP Default','\epoc32\data\z\wstest\ratelimiter\wsini.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_17.txt','')
+RomAndAutoRom('armv5','h4hrp pagedrom minigui platsec graphics_testharness.iby csc_plugin.iby tcsc.iby openvgtest.iby surfaceupdatetest_integ.iby t_gcenotification.iby graphics_test2.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE','h4hrp_graphics18_armv5_dpdef','Graphics Test ROM (18) - Composited Screen Capture DP Default','\epoc32\data\z\wstest\wsini_csc_nga_qvga.ini,\epoc32\data\z\wsini_minigui.ini;\epoc32\data\z\graphicstest\testexecute_minigui.ini,\epoc32\data\z\system\data\testexecute.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_18.txt','')
+RomAndAutoRom('armv5','h4hrp pagedrom minigui platsec graphics_testharness.iby csc_plugin.iby tcsc.iby egltesthybrid.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE','h4hrp_graphicseglhybrid_armv5_dpdef','Graphics Test ROM (eglhybrid) - EGL Hybrid Graphics Implementation DP Default','\epoc32\data\z\wstest\wsini_csc_nga_qvga.ini,\epoc32\data\z\wsini_minigui.ini;\epoc32\data\z\graphicstest\testexecute_minigui.ini,\epoc32\data\z\system\data\testexecute.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_eglhybrid.txt','')
+RomAndAutoRom('armv5','h4hrp pagedrom minigui platsec graphics_testharness.iby csc_plugin.iby tcsc.iby egltestref.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_USE_EGL_REF','h4hrp_graphicseglref_armv5_dpdef','Graphics Test ROM (eglref) - EGL Reference Graphics Implementation DP Default','\epoc32\data\z\wstest\wsini_csc_nga_qvga.ini,\epoc32\data\z\wsini_minigui.ini;\epoc32\data\z\graphicstest\testexecute_minigui.ini,\epoc32\data\z\system\data\testexecute.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_eglref.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby talf.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE','h4hrp_graphics23_armv5_dpdef','Graphics Test ROM (23) - ALF/ChangeTracking DP Default','\epoc32\data\z\talf\wsini.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_23.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby t_eventchecker.iby t_bitgdirenderstage.iby wserv.oby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DRVT','h4hrp_graphics24_armv5_dpdef','Graphics Test ROM (24) - BitGDI Renderstage DP Default','\epoc32\data\z\wstest\tbitgdirenderstage\arm\wsini.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_24.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec wserv.oby graphics_testharness.iby talf.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics25_armv5_dpdef','Graphics Test ROM (25) - ALF/ChangeTracking per screen DP Default','\epoc32\data\z\talf\wsini_ct_per_screen.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_25.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby tlayercompositiontest.iby csc_plugin.iby tcsc.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics29a_armv5_dpdef','Graphics Test ROM (29a) - Layer Composition DP Default','\epoc32\data\z\tlayercomposition\wsini.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_29a.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby tlayercompositiontest.iby csc_plugin.iby tcsc.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics29b_armv5_dpdef','Graphics Test ROM (29b) - Layer Composition, No Autoclear DP Default','\epoc32\data\z\tlayercomposition\wsini_noautoclear.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_29b.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec appfwk_test.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -D_DEBUG','h4hrp_uiframeworks_armv5_dpdef','UI Frameworks DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_uif.txt','')
+RomAndAutoRom('armv5','h4hrp minigui pagedrom platsec graphics_testharness.iby sgresourcetest.iby opengles.iby','-D__MMC -D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphicsresource_armv5_dpdef','Graphics Test ROM (GRI) - Graphics Resource DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_gri.txt','')
 Rom('armv5', 'h4hrp minigui', '-nosymbols -D__MMC -DUSE_SDIO_SD_MMC', 'h4hrp_minigui', 'MiniGUI ROM', '' )
--- a/graphicstest/graphicstestharness/automation/h4/tests_00b.txt	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/graphicstestharness/automation/h4/tests_00b.txt	Tue Jul 20 13:27:44 2010 +0300
@@ -20,4 +20,6 @@
 TESTEXECUTE, \logs\testexecute\fntstoretest_T_LinkedFontUpdateStage2.htm,	, z:\fntstoretest\fntstoretest_T_LinkedFontUpdateStage2.script, 600
 
 # PREQ1543 bitgdi
-TESTEXECUTE, \logs\testexecute\bitgdiTest_T_outlineandshadowfonts.htm,		, z:\bitgdiTest\bitgdiTest_T_outlineandshadowfonts.script,	2000
\ No newline at end of file
+TESTEXECUTE, \logs\testexecute\bitgdiTest_T_outlineandshadowfonts.htm,		, z:\bitgdiTest\bitgdiTest_T_outlineandshadowfonts.script,	2000
+
+TESTEXECUTE, \logs\testexecute\fbstest_t_glyphdataoutlineshadow.htm,		, z:\fbstest\fbstest_t_glyphdataoutlineshadow.script,	600
--- a/graphicstest/graphicstestharness/automation/h4/tests_01.txt	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/graphicstestharness/automation/h4/tests_01.txt	Tue Jul 20 13:27:44 2010 +0300
@@ -32,6 +32,9 @@
 TESTEXECUTE, \logs\testexecute\fbstest_T_StreamIdCache.htm,				, z:\fbstest\fbstest_T_StreamIdCache.script, 800
 TESTEXECUTE, \logs\testexecute\fbstest_t_extendedbitmap.htm,			, z:\fbstest\fbstest_t_extendedbitmap.script, 1200
 TESTEXECUTE, \logs\testexecute\fbstest_t_fonttable.htm,			        , z:\fbstest\fbstest_t_fonttable.script, 800
+TESTEXECUTE, \logs\testexecute\fbstest_t_glyphdata.htm,					, z:\fbstest\fbstest_t_glyphdata.script, 800
+TESTEXECUTE, \logs\testexecute\fbstest_t_glyphdataoutlineshadow.htm,		, z:\fbstest\fbstest_t_glyphdataoutlineshadow.script, 800, ,z\ityperast_config.cmd install, z\ityperast_config.cmd uninstall
+
 
 # See also tests_95_hw00.txt
 # See also tests_95_hw02.txt
--- a/graphicstest/graphicstestharness/automation/h4/tests_01a.txt	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/graphicstestharness/automation/h4/tests_01a.txt	Tue Jul 20 13:27:44 2010 +0300
@@ -32,6 +32,8 @@
 TESTEXECUTE, \logs\testexecute\fbstest_T_StreamIdCache.htm,				, z:\fbstest\fbstest_T_StreamIdCache.script, 800
 TESTEXECUTE, \logs\testexecute\fbstest_t_extendedbitmap.htm,			, z:\fbstest\fbstest_t_extendedbitmap.script, 1200
 TESTEXECUTE, \logs\testexecute\fbstest_t_fonttable.htm,			        , z:\fbstest\fbstest_t_fonttable.script, 800
+TESTEXECUTE, \logs\testexecute\fbstest_t_glyphdata.htm,					, z:\fbstest\fbstest_t_glyphdata.script, 800
+TESTEXECUTE, \logs\testexecute\fbstest_t_glyphdataoutlineshadow.htm,		, z:\fbstest\fbstest_t_glyphdataoutlineshadow.script, 800, ,z\ityperast_config.cmd install, z\ityperast_config.cmd uninstall
 
 # See also tests_95_hw00.txt
 # See also tests_95_hw02.txt
--- a/graphicstest/graphicstestharness/automation/h4/tests_eglhybrid.txt	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/graphicstestharness/automation/h4/tests_eglhybrid.txt	Tue Jul 20 13:27:44 2010 +0300
@@ -45,4 +45,5 @@
 TESTEXECUTE, \logs\testexecute\egltest_t_vgimagetosurfaces.htm,                 , z:\egltest\egltest_t_vgimagetosurfaces.script, 600
 TESTEXECUTE, \logs\testexecute\egltest_t_benchmark_sgimage.htm,                 , z:\egltest\egltest_t_benchmark_sgimage.script, 600
 TESTEXECUTE, \logs\testexecute\egltest_t_oom_sgimage.htm,                       , z:\egltest\egltest_t_oom_sgimage.script, 600
-TESTEXECUTE, \logs\testexecute\egltest_t_stress_sgimage.htm,                    , z:\egltest\egltest_t_stress_sgimage.script, 1800
\ No newline at end of file
+TESTEXECUTE, \logs\testexecute\egltest_t_stress_sgimage.htm,                    , z:\egltest\egltest_t_stress_sgimage.script, 1800
+TESTEXECUTE, \logs\testexecute\egltest_t_surfacescaling.htm,                    , z:\egltest\egltest_t_surfacescaling.script, 600
\ No newline at end of file
--- a/graphicstest/graphicstestharness/automation/h6/tests_00b.txt	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/graphicstestharness/automation/h6/tests_00b.txt	Tue Jul 20 13:27:44 2010 +0300
@@ -21,3 +21,5 @@
 
 # PREQ1543 bitgdi
 TESTEXECUTE, \logs\testexecute\bitgdiTest_T_outlineandshadowfonts.htm,		, z:\bitgdiTest\bitgdiTest_T_outlineandshadowfonts.script,	2000
+
+TESTEXECUTE, \logs\testexecute\fbstest_t_glyphdataoutlineshadow.htm,		, z:\fbstest\fbstest_t_glyphdataoutlineshadow.script,	600
--- a/graphicstest/graphicstestharness/automation/h6/tests_01.txt	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/graphicstestharness/automation/h6/tests_01.txt	Tue Jul 20 13:27:44 2010 +0300
@@ -33,6 +33,8 @@
 TESTEXECUTE, \logs\testexecute\fbstest_T_StreamIdCache.htm,				, z:\fbstest\fbstest_T_StreamIdCache.script, 800
 TESTEXECUTE, \logs\testexecute\fbstest_t_extendedbitmap.htm,			, z:\fbstest\fbstest_t_extendedbitmap.script, 1200
 TESTEXECUTE, \logs\testexecute\fbstest_t_fonttable.htm,			        , z:\fbstest\fbstest_t_fonttable.script, 800
+TESTEXECUTE, \logs\testexecute\fbstest_t_glyphdata.htm,					, z:\fbstest\fbstest_t_glyphdata.script, 800
+TESTEXECUTE, \logs\testexecute\fbstest_t_glyphdataoutlineshadow.htm,		, z:\fbstest\fbstest_t_glyphdataoutlineshadow.script, 800, ,z\ityperast_config.cmd install, z\ityperast_config.cmd uninstall
 
 # See also tests_95_hw00.txt
 # See also tests_95_hw02.txt
--- a/graphicstest/graphicstestharness/automation/h6/tests_01a.txt	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/graphicstestharness/automation/h6/tests_01a.txt	Tue Jul 20 13:27:44 2010 +0300
@@ -33,6 +33,8 @@
 TESTEXECUTE, \logs\testexecute\fbstest_T_StreamIdCache.htm,				, z:\fbstest\fbstest_T_StreamIdCache.script, 800
 TESTEXECUTE, \logs\testexecute\fbstest_t_extendedbitmap.htm,			, z:\fbstest\fbstest_t_extendedbitmap.script, 1200
 TESTEXECUTE, \logs\testexecute\fbstest_t_fonttable.htm,			        , z:\fbstest\fbstest_t_fonttable.script, 800
+TESTEXECUTE, \logs\testexecute\fbstest_t_glyphdata.htm,					, z:\fbstest\fbstest_t_glyphdata.script, 800
+TESTEXECUTE, \logs\testexecute\fbstest_t_glyphdataoutlineshadow.htm,		, z:\fbstest\fbstest_t_glyphdataoutlineshadow.script, 800, ,z\ityperast_config.cmd install, z\ityperast_config.cmd uninstall
 
 # See also tests_95_hw00.txt
 # See also tests_95_hw02.txt
--- a/graphicstest/graphicstestharness/automation/h6/tests_eglhybrid.txt	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/graphicstestharness/automation/h6/tests_eglhybrid.txt	Tue Jul 20 13:27:44 2010 +0300
@@ -46,3 +46,4 @@
 TESTEXECUTE, \logs\testexecute\egltest_t_benchmark_sgimage.htm,                 , z:\egltest\egltest_t_benchmark_sgimage.script, 600
 TESTEXECUTE, \logs\testexecute\egltest_t_oom_sgimage.htm,                       , z:\egltest\egltest_t_oom_sgimage.script, 600
 TESTEXECUTE, \logs\testexecute\egltest_t_stress_sgimage.htm,                    , z:\egltest\egltest_t_stress_sgimage.script, 1200
+TESTEXECUTE, \logs\testexecute\egltest_t_surfacescaling.htm,                    , z:\egltest\egltest_t_surfacescaling.script, 600
--- a/graphicstest/graphicstestharness/automation/ne1/tests_01.txt	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/graphicstestharness/automation/ne1/tests_01.txt	Tue Jul 20 13:27:44 2010 +0300
@@ -32,6 +32,8 @@
 TESTEXECUTE, \logs\testexecute\fbstest_T_StreamIdCache.htm,				, z:\fbstest\fbstest_T_StreamIdCache.script, 800
 TESTEXECUTE, \logs\testexecute\fbstest_t_extendedbitmap.htm,			, z:\fbstest\fbstest_t_extendedbitmap.script, 1200
 TESTEXECUTE, \logs\testexecute\fbstest_t_fonttable.htm,			        , z:\fbstest\fbstest_t_fonttable.script, 800
+TESTEXECUTE, \logs\testexecute\fbstest_t_glyphdata.htm,					, z:\fbstest\fbstest_t_glyphdata.script, 800
+TESTEXECUTE, \logs\testexecute\fbstest_t_glyphdataoutlineshadow.htm,		, z:\fbstest\fbstest_t_glyphdataoutlineshadow.script, 800, ,z\ityperast_config.cmd install, z\ityperast_config.cmd uninstall
 
 # See also tests_95_hw00.txt
 # See also tests_95_hw02.txt
--- a/graphicstest/graphicstestharness/automation/ne1/tests_01a.txt	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/graphicstestharness/automation/ne1/tests_01a.txt	Tue Jul 20 13:27:44 2010 +0300
@@ -32,6 +32,8 @@
 TESTEXECUTE, \logs\testexecute\fbstest_T_StreamIdCache.htm,				, z:\fbstest\fbstest_T_StreamIdCache.script, 800
 TESTEXECUTE, \logs\testexecute\fbstest_t_extendedbitmap.htm,			, z:\fbstest\fbstest_t_extendedbitmap.script, 1200
 TESTEXECUTE, \logs\testexecute\fbstest_t_fonttable.htm,			        , z:\fbstest\fbstest_t_fonttable.script, 800
+TESTEXECUTE, \logs\testexecute\fbstest_t_glyphdata.htm,					, z:\fbstest\fbstest_t_glyphdata.script, 800
+TESTEXECUTE, \logs\testexecute\fbstest_t_glyphdataoutlineshadow.htm,		, z:\fbstest\fbstest_t_glyphdataoutlineshadow.script, 800, ,z\ityperast_config.cmd install, z\ityperast_config.cmd uninstall
 
 # See also tests_95_hw00.txt
 # See also tests_95_hw02.txt
--- a/graphicstest/graphicstestharness/automation/ne1/tests_eglhybrid.txt	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/graphicstestharness/automation/ne1/tests_eglhybrid.txt	Tue Jul 20 13:27:44 2010 +0300
@@ -44,6 +44,7 @@
 
 TESTEXECUTE, \logs\testexecute\egltest_t_oom_sgimage.htm,                       , z:\egltest\egltest_t_oom_sgimage.script, 600
 TESTEXECUTE, \logs\testexecute\egltest_t_stress_sgimage.htm,                    , z:\egltest\egltest_t_stress_sgimage.script, 1200
+TESTEXECUTE, \logs\testexecute\egltest_t_surfacescaling.htm,                    , z:\egltest\egltest_t_surfacescaling.script, 600
 
 # EGL - tests which intermittently freeze and abort with timeout.
 TESTEXECUTE, \logs\testexecute\egltest_t_unittest.htm,                          , z:\egltest\egltest_t_unittest.script, 600
--- a/graphicstest/graphicstestharness/automation/winscw/tests.txt	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/graphicstestharness/automation/winscw/tests.txt	Tue Jul 20 13:27:44 2010 +0300
@@ -155,6 +155,8 @@
 TESTEXECUTE, C:\logs\testexecute\fbstest_T_Secure.htm,					, z:\fbstest\fbstest_T_Secure.script, 600
 TESTEXECUTE, C:\logs\testexecute\fbstest_T_StreamIdCache.htm,			, z:\fbstest\fbstest_T_StreamIdCache.script, 600
 TESTEXECUTE, C:\logs\testexecute\fbstest_T_FontTable.htm,			, z:\fbstest\fbstest_T_FontTable.script, 600
+TESTEXECUTE, C:\logs\testexecute\fbstest_t_glyphdata.htm,			, z:\fbstest\fbstest_t_glyphdata.script, 600, ,z\ityperast_config.cmd install, z\ityperast_config.cmd uninstall
+TESTEXECUTE, C:\logs\testexecute\fbstest_t_glyphdataoutlineshadow.htm,		, z:\fbstest\fbstest_t_glyphdataoutlineshadow.script, 600, ,z\ityperast_config.cmd install, z\ityperast_config.cmd uninstall
 
 # without extended bitmap example rasterizer
 TESTEXECUTE, C:\logs\testexecute\fbstest_t_extendedbitmap.htm,			, z:\fbstest\fbstest_t_extendedbitmap.script,		1200
@@ -267,6 +269,7 @@
 TESTEXECUTE, C:\logs\testexecute\egltest_t_benchmark_sgimage.htm,        	, z:\egltest\egltest_t_benchmark_sgimage.script, 			300, , z\graphics\t_graphics_config_inifiles.bat install, z\graphics\t_graphics_config_inifiles.bat uninstall
 TESTEXECUTE, C:\logs\testexecute\egltest_t_oom_sgimage.htm,                 	, z:\egltest\egltest_t_oom_sgimage.script, 				600, , z\graphics\t_graphics_config_inifiles.bat install, z\graphics\t_graphics_config_inifiles.bat uninstall
 TESTEXECUTE, C:\logs\testexecute\egltest_t_stress_sgimage.htm,			, z:\egltest\egltest_t_stress_sgimage.script, 				600, , z\graphics\t_graphics_config_inifiles.bat install, z\graphics\t_graphics_config_inifiles.bat uninstall
+TESTEXECUTE, C:\logs\testexecute\egltest_t_surfacescaling.htm,			, z:\egltest\egltest_t_surfacescaling.script, 			  600, , z\graphicstest\minigui.cmd z\graphics\t_graphics_config_inifiles.bat install csc_nga, z\graphicstest\unminigui.cmd z\graphicstest\retain_files.cmd logs\testexecute\screencomparison screencomparison z\graphics\t_graphics_config_inifiles.bat uninstall
 
 # GCE
 TESTEXECUTE, C:\logs\testexecute\functionaltest_mandatory.htm,	, z:\gcetest\functionaltest_mandatory.script,  600, , z\gcetest\gcetest_setup_emu.bat install dabs, z\gcetest\gcetest_setup_emu.bat uninstall dabs
@@ -496,7 +499,14 @@
 # UIBENCH S60
 TESTEXECUTE, C:\logs\testexecute\te_uibench_s60_techview_emulator.htm,	, c:\uibench_s60\te_uibench_s60_techview_emulator.script, 900
 
+# OpenWF Fastpath (REQ417.54885)
+TESTEXECUTE, C:\logs\testexecute\openwftest.htm,				, z:\openwftest\openwftest.script, 600, , z\gcetest\gcetest_setup_emu.bat install dabs, z\graphicstest\retain_files.cmd openwftest\img openwftest\img z\gcetest\gcetest_setup_emu.bat uninstall dabs 
+TESTEXECUTE, C:\logs\testexecute\t_screeninterface_emulator.htm,				, z:\wfctest\t_screeninterface_emulator.script, 600
+
+# GCE tests using OpenWF instead of GCE
+TESTEXECUTE, C:\logs\testexecute\owf_functionaltest_mandatory.htm,	, z:\gcetest\owf_functionaltest_mandatory.script, 600, , z\gcetest\gcetest_setup_emu.bat install dabs_owf, z\gcetest\gcetest_setup_emu.bat uninstall dabs
+
 # OpenWF Conformance Tests run under testexecute
 TESTEXECUTE, C:\logs\testexecute\ct_api.htm,	, z:\wfctest\ct_api.script,  600, , z\gcetest\gcetest_setup_emu.bat install dabs, z\gcetest\gcetest_setup_emu.bat uninstall dabs
 TESTEXECUTE, C:\logs\testexecute\ct_offscreen.htm,	, z:\wfctest\ct_offscreen.script,  600, , z\gcetest\gcetest_setup_emu.bat install dabs, z\graphicstest\retain_files.cmd results ct\results z\gcetest\gcetest_setup_emu.bat uninstall dabs
-TESTEXECUTE, C:\logs\testexecute\ct_onscreen.htm,	, z:\wfctest\ct_onscreen.script,  600, , z\gcetest\gcetest_setup_emu.bat install dabs, z\graphicstest\retain_files.cmd results ct\results z\gcetest\gcetest_setup_emu.bat uninstall dabs
\ No newline at end of file
+TESTEXECUTE, C:\logs\testexecute\ct_onscreen.htm,	, z:\wfctest\ct_onscreen.script,  600, , z\gcetest\gcetest_setup_emu.bat install dabs, z\graphicstest\retain_files.cmd results ct\results z\gcetest\gcetest_setup_emu.bat uninstall dabs
--- a/graphicstest/graphicstestharness/bwins/tprofileru.def	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/graphicstestharness/bwins/tprofileru.def	Tue Jul 20 13:27:44 2010 +0300
@@ -23,4 +23,4 @@
 	?SetStoreResultInTimingOrder@CTProfiler@@QAEXH@Z @ 22 NONAME ; void CTProfiler::SetStoreResultInTimingOrder(int)
 	?ShowResultArrayInTimingOrder@CTProfiler@@QAEXXZ @ 23 NONAME ; void CTProfiler::ShowResultArrayInTimingOrder(void)
 	?SqlInsert@CTProfiler@@QAEXPBVTDesC16@@00J@Z @ 24 NONAME ; void CTProfiler::SqlInsert(class TDesC16 const *, class TDesC16 const *, class TDesC16 const *, long)
-
+	?ResultsAnalysisGlyphRate@CTProfiler@@QAEXABVTDesC16@@HHHHH@Z @ 25 NONAME ; void CTProfiler::ResultsAnalysisGlyphRate(class TDesC16 const &, int, int, int, int, int)
--- a/graphicstest/graphicstestharness/eabi/tprofileru.def	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/graphicstestharness/eabi/tprofileru.def	Tue Jul 20 13:27:44 2010 +0300
@@ -27,4 +27,4 @@
 	_ZN10CTProfiler27SetStoreResultInTimingOrderEi @ 26 NONAME
 	_ZN10CTProfiler28ShowResultArrayInTimingOrderEv @ 27 NONAME
 	_ZN10CTProfiler9SqlInsertEPK7TDesC16S2_S2_l @ 28 NONAME
-
+	_ZN10CTProfiler24ResultsAnalysisGlyphRateERK7TDesC16iiiii @ 29 NONAME
--- a/graphicstest/graphicstestharness/group/bld.inf	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/graphicstestharness/group/bld.inf	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -39,11 +39,15 @@
 ../rom/graphics_imagecomparison.iby	/epoc32/rom/include/graphics_imagecomparison.iby  
 ../rom/graphics_tprofiler.iby  		/epoc32/rom/include/graphics_tprofiler.iby
 ../rom/graphics_simload.iby  		/epoc32/rom/include/graphics_simload.iby
+../rom/minigui_chassis_bats.oby  		/epoc32/rom/include/minigui_chassis_bats.oby
+../rom/minigui_naviengine_smp.oby  		/epoc32/rom/include/minigui_naviengine_smp.oby
 
 // WSINI
 ../rom/graphics_sirocco_wsini.hby  		/epoc32/rom/include/graphics_sirocco_wsini.hby
 ../rom/graphics_sirocco_wsini.iby  		/epoc32/rom/include/graphics_sirocco_wsini.iby
+../rom/graphics_sirocco_ne_wsini.iby  	/epoc32/rom/include/graphics_sirocco_ne_wsini.iby
 ../wsini/wsini_vasco.ini		/epoc32/data/test_wsini/wsini_vasco.ini
+../wsini/wsini_naviengine.ini		/epoc32/data/test_wsini/wsini_naviengine.ini
 
 // ONB batch files
 ../batch/retain_files.cmd z:\graphicstest\retain_files.cmd
@@ -63,6 +67,7 @@
 ../inc/graphicsimagecomparison.h OS_LAYER_PLATFORM_EXPORT_PATH(test/graphicsimagecomparison.h)
 ../inc/tprofiler.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(test/tprofiler.h)
 ../inc/t_simload.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(test/t_simload.h)
+../inc/singletontestexithelper.inl OS_LAYER_PLATFORM_EXPORT_PATH(test/singletontestexithelper.inl)
 
 //Data files for reboot test harness
 ../rom/graphics_rebootharnesslog.htm /epoc32/data/Z/reboot/dummylog.htm
--- a/graphicstest/graphicstestharness/inc/TGraphicsHarness.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/graphicstestharness/inc/TGraphicsHarness.h	Tue Jul 20 13:27:44 2010 +0300
@@ -122,7 +122,17 @@
 CTGraphicsBase* CT##a##Step::CreateTestL() \
 	{ \
 	return new (ELeave) CT##a (this); \
-	} 
+	}
+
+// Macros to automatically test error condition and report when test fails.
+// Essentially same as TESTE(a,b) MACRO that CTestStep uses, except error to
+// check is also error that is reported.
+#define TESTNOERROR(a) \
+	{\
+	TInt b = a;\
+	TBool c = (b == KErrNone);\
+	testBooleanTrueWithErrorCode((c), (b), (TText8*)__FILE__, __LINE__);\
+	}
 	
 inline void CTGraphicsBase::testBooleanTrue(TBool aCondition, const TText8* aFile, TInt aLine) 
 	{
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicstest/graphicstestharness/inc/singletontestexithelper.inl	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,136 @@
+// Copyright (c) 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:
+// Test shutdown cleanup functions that should be called to destroy singletons
+// before the heap is destroyed, in particular when using TEF steps.
+// These methods are implemented and called from Window Server - WServ, CWsTop
+// but this copy can be called by any low-level unit tests that bypass WServ   
+// but need to provide the same clean-up behaviour.
+// @test
+// @internalTechnology
+// 
+// Currently, three things are cleaned up:
+// 1) Singleton API mutex in OpenWF implementation
+// 2) Singleton Find/Acquire mutext in Native Stream implementation
+// 3) EGL thread status 
+//
+// Note that while these cleanups are only required by OWF-C implementations,
+// the methods called should be harmless if called 
+// when some other composition solution is in action.
+
+#include <e32property.h>
+#include <EGL/egl.h>
+
+// IDs of p&s properties that optionally contain onexit callbacks
+// that may be used to release singletons owned by libraries at shutdown in order to make 
+// the memory leak tests work.
+// By convention, the ID is the same as the UID3 of the libary.
+static TBool gReleaseSingletonsOnExit = EFalse;
+static const TUid KOpenWfcImplCleanupKey = {0x10286FC4};     
+static const TUid KOpenWfcInteropCleanupKey = {0x10286FC5};
+
+
+static void DefineOwfSingletonKey(const TUid& aSingletonKey)
+/**
+ * Defines a new property for a singleton key. WServ must only process 
+ * singleton keys that it created to prevent a malicious process with the 
+ * WriteDeviceData capability causing arbitrary functions to be executed.
+ * 
+ * @param   aSingeltonKey   The UID of the singleton key to define.
+ */
+    {
+    RThread t;      
+    TUid category = { t.SecureId().iId };
+    RProperty prop;
+    
+    // Write access is restricted to THIS process
+    TInt err = prop.Define( category, aSingletonKey.iUid, 
+            RProperty::EByteArray, TSecurityPolicy( t.SecureId() ), 
+            TSecurityPolicy( t.SecureId() ), sizeof( TCallBack ) );
+    
+    if ( err == KErrNone || err == KErrAlreadyExists)
+        {
+        TCallBack cb( NULL, NULL );
+        TPckgC<TCallBack> cbPckg( cb );
+        
+        // Any error should cause the properties to be ignored
+        err = prop.Set( category, aSingletonKey.iUid, cbPckg );    
+        }      
+    //We presume that if property already exists it was previously set by this test code.
+    if ( err != KErrNone )
+        {
+        // A problem occured / the property already existed so for safety
+        // the release code should be skipped.
+        gReleaseSingletonsOnExit = EFalse;
+        }
+    
+    prop.Close();
+    t.Close();
+    }
+#define DefineOwfSingletonKeys DefineOwfSingletonKeys
+/** Call this method before starting the compositor.    
+ * 
+ */
+static void DefineOwfSingletonKeys()
+    {
+    // Define properties for singleton callbacks. This must only be done ONCE
+    // to ensure the properties can't be hijacked.
+    gReleaseSingletonsOnExit = ETrue;
+    DefineOwfSingletonKey(KOpenWfcInteropCleanupKey);
+    DefineOwfSingletonKey(KOpenWfcImplCleanupKey);
+    }
+
+static void DeleteOwfSingleton( const TUid& aSingletonKey )
+/**
+ * Deletes a singleton object that was created on WServ's main heap.
+ * 
+ * @pre     The ws plugins have not been unloaded.
+ * @param   aSingletonKey   The UID of the singleton which correponds to an
+ *                          RProperty within WServ's category.                       
+ */
+    {   
+    if ( gReleaseSingletonsOnExit )
+        {
+        RThread t;
+        TPckgBuf<TCallBack> cb;
+        RProperty prop; 
+        TInt err = prop.Get(TUid::Uid(t.SecureId().iId), aSingletonKey.iUid, cb);
+        if (err == KErrNone && cb.Length() == sizeof(TCallBack) && 
+                cb().iFunction && cb().iPtr == &User::Heap())
+            {
+            // Callback is only invoked if the heap for the singleton was the 
+            // WServ heap because the WServ memory leak tests only check this
+            // heap.
+            cb().CallBack();
+            }
+        // Errors are ignored because the purpose of this function is to free
+        // singletons in order top make memory leak checks pass.
+        prop.Close();
+        t.Close();
+        }
+    }
+/** Call this method to destroy OWF-C singletons on shut down
+ * 
+ */
+#define DeleteOwfSingletons DeleteOwfSingletons
+static void DeleteOwfSingletons()
+    {
+    // Free singletons on WServ heap created by libraries. Must be called
+    // BEFORE iPluginManager is deleted otherwise the library code could have
+    // been unloaded.
+    DeleteOwfSingleton(KOpenWfcImplCleanupKey);
+    DeleteOwfSingleton(KOpenWfcInteropCleanupKey);
+    /* Release any use of EGL by this thread. */
+    eglReleaseThread();
+    }
+
--- a/graphicstest/graphicstestharness/inc/tprofiler.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/graphicstestharness/inc/tprofiler.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// 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"
@@ -69,7 +69,7 @@
 	IMPORT_C void ShowResultArrayInTimingOrder();
 	IMPORT_C void SetStoreResultInTimingOrder(TBool aStoreResultInTimingOrder);
 	IMPORT_C void SqlInsert(const TDesC* aTestName, const TDesC* aTestAttribute, const TDesC* aTestUnit, TInt32 aTestResultValue);
-
+	IMPORT_C void ResultsAnalysisGlyphRate(const TDesC & aTestName, TInt aRotation, TInt aSrcScreenMode, TInt aDstScreenMode, TInt aIters, TInt aNumPixels);
 
 private:
     CTProfiler(CTestStep& aTestStep);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicstest/graphicstestharness/rom/graphics_sirocco_ne_wsini.iby	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,37 @@
+// Copyright (c) 2006-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: Config for wsini.ini on NAVIENGINE
+//
+
+#ifndef __GRAPHICS_SIROCCO_NE_WSINI_IBY__
+#define __GRAPHICS_SIROCCO_NE_WSINI_IBY__
+
+#include <graphics_sirocco_wsini.hby>
+
+#if WSERV_TEST_WSINI == WSERV_TEST_WSINI_ALF
+	data=DATAZ_\talf\wsini_naviengine_alf.ini \system\data\wsini.ini
+#elif WSERV_TEST_WSINI == WSERV_TEST_WSINI_BITGDIRENDERSTAGE
+	data=DATAZ_\wstest\tbitgdirenderstage\arm\wsini_bitgdirenderstage_naviengine.ini \system\data\wsini.ini
+#elif WSERV_TEST_WSINI == WSERV_TEST_WSINI_CSC
+	data=DATAZ_\wstest\wsini_csc_nga_naviengine.ini \system\data\wsini.ini
+#elif WSERV_TEST_WSINI == WSERV_TEST_WSINI_GENERICPLUGIN
+	data=DATAZ_\wstest\genericplugin\wsini_naviengine_genericplugin.ini \system\data\wsini.ini
+#elif WSERV_TEST_WSINI == WSERV_TEST_WSINI_LAYERCOMPOSITION
+	data=DATAZ_\tlayercomposition\wsini_naviengine_layercomposition.ini \system\data\wsini.ini
+#elif WSERV_TEST_WSINI == WSERV_TEST_WSINI_RATELIMITER
+	data=DATAZ_\wstest\ratelimiter\wsini_naviengine_ratelimiter.ini \system\data\wsini.ini
+#else
+	data=EPOCROOT##epoc32\data\test_wsini\wsini_naviengine.ini \system\data\wsini.ini
+#endif
+
+#endif	// __GRAPHICS_SIROCCO_NE_WSINI_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicstest/graphicstestharness/rom/minigui_chassis_bats.oby	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,187 @@
+#ifndef __MINIGUI_OBY__
+#define __MINIGUI_OBY__
+
+// Copyright (c) 2007-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:
+// This OBY File is used to build Mini-Gui ROM Images.
+// 
+// Use the following buildrom command line, or similar:
+//	buildrom -orombld.img -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -D_INTERNAL_MMC -DUSE_DATA_PAGING h4hrp minigui pagedrom platsec
+// Note there is no need to specify -D_NAND2 
+
+define OBEYFILE minigui
+define ROMDATE	##TODAY##
+
+// We used to define _NAND2 on the commandline to buildrom.  However, it
+// does not make rombuild create a rofs image.  Instead it needs to be
+// specified in the oby file itself.
+//#define _NAND2
+
+// Undefine things in global System Include that stops the NCP rom from working.
+#undef USE_CUSTOM_MMC_PARTITION
+#undef SYMBIAN_EXCLUDE_SCDV
+#undef SYMBIAN_GRAPHICS_USE_GCE 
+#undef SYMBIAN_GRAPHICS_ADAPTATION
+#undef SGA_SW_NO_GRAPHICSRESOURCE 
+#undef SYMBIAN_EXCLUDE_KEYMAP  
+
+
+
+#define NO_METROTRK_APP // don't want metrotrk application
+#define HAS_ETHERNET	// include etherDrv, ether802, DHCP
+#define SYMBIAN_EXCLUDE_FAX
+#undef __IPSEC
+#define SYMBIAN_EXCLUDE_OBEX
+
+#ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
+#define _SSMSTARTUPMODE 8	//for ssma boot up.
+#else
+#define _STARTUPMODE8		// for sysstart.iby
+#endif
+
+// Various workarounds to avoid dependencies on UIKON
+
+#define __TLS_IBY__			// exclude TLS
+#define __TLSPROVIDER_IBY__		// exclude TLSPROVIDER 
+#define __OBEXPROTOCOL_IBY__	// exclude obex.dll etc
+#define __WLANEAPMETHODS_IBY__	// exclude eap_tls.msy & friends
+// 
+
+#ifndef SYMBIAN_BASE_USE_GCE
+#define SYMBIAN_BASE_USE_GCE
+#endif
+#ifndef SYMBIAN_GRAPHICS_USE_GCE
+#define SYMBIAN_GRAPHICS_USE_GCE
+#endif
+#include <header.iby>				/* ROM header definitions */
+#include <base.iby>					/* The lowest-level of the operating system */
+
+#include <graphics_adaptation.hby>
+
+#ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT
+
+#include <ssma.iby>			/*System State Management Architecture*/
+#include <ssplugins.iby>		/*System State Management Plugins*/
+
+//Include SSM optional components to enable teams to build a plain textshell rom (on the lines of DEF128306), 
+//following removal of h4_textshell_rom.oby.
+#include <amastart.iby>
+
+#include <shma.iby>
+#include <ssrefplugins.iby>
+#else
+#include <sysstart.iby>
+#include <sysstartconfig.iby>
+#endif // SYMBIAN_SYSTEM_STATE_MANAGEMENT
+
+#include <debug.iby>
+
+#include <eshell.iby>
+
+#include <centralrepository.iby>
+	file=ABI_DIR\BUILD_DIR\abclient.dll			sys\bin\abclient.dll
+
+#include <crypto.iby>
+
+#include <c32.iby>
+#include <ecuart.iby>
+#include <irda.iby>
+#include <stdlib.iby>
+#include <gdi.iby>
+#include <fntstore.iby>
+#include <fbserv.iby>
+#include <bitgdi.iby>
+#include <iculayoutengine.iby>
+#include <freetype.iby>
+#include <directgdi.iby>
+#include <wserv.iby>
+#include <econs_wserv.iby>
+//data=DATAZ_\wsini_minigui.ini	\system\data\wsini.ini
+
+#include <printers.iby>
+
+
+
+#include <traces.iby>
+
+#include <inetprotutil.iby>		/* needed for mmfcontrollerframework.dll */
+#include <sysagent.iby>
+#include <network.iby>	
+#include <dial.iby>		// needed by commsdat
+#include <etel.iby>
+#include <smsstack.iby>
+#include <etelmm.iby>
+#include <etelpckt.iby>
+#include <mmtsy.iby>
+#include <etelsat.iby>
+#include <sysawatcher.iby>
+#include <bafl.iby>
+#include <ecom.iby>
+#include <store.iby>
+#include <dbms.iby>
+#include <pwrcli.iby>
+#include <xml.iby>
+#include <ups.iby>
+#include <securitycommonutils.iby>
+
+/* Feature Management run-time */
+#ifdef SYMBIAN_FEATURE_MANAGER
+
+// Include both old and new components when Feature Manager enabled
+#include <featmgr.iby>
+#include <featreg.iby>
+
+#else 
+
+// Include only the original Feature Registry otherwise
+#include <featreg.iby>
+#ifndef ROM_FEATURE_MANAGEMENT
+/* Provide a default configuration file for the feature registry */ 
+data=EPOCROOT##epoc32\data\config\featreg_default.cfg    private\102744CA\featreg.cfg
+#endif
+#endif
+
+// The following section are all indirect dependencies arising from TEF testexecute depending
+// on apparc
+#include <mmcommon.iby>
+#include <ezlib.iby>
+file=ABI_DIR\BUILD_DIR\Http.dll                 System\Libs\Http.dll
+file=ABI_DIR\BUILD_DIR\httputils.dll			System\Libs\httputils.dll
+#include <asnpkcs.iby>
+#include <filetokens.iby>
+#include <imageconversion.iby>
+#include <ocsp.iby>
+#include <certman.iby>
+#include <swi.iby>
+#include <bluetooth.iby>
+#include <openenv.iby>
+#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+#include <scr.iby>
+#include <sts.iby>
+#include <sif.iby>
+#endif
+#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+#include <scr.iby>
+#include <sts.iby>
+#include <sif.iby>
+#endif
+#include <caf.iby>
+#include <apparc.iby>		/* Application architecture DLLs */
+#include <emime.iby>		/* Mime recognition */
+// This is the end of the indirect dependencies arising from TEF testexecute
+// depending on apparc
+
+#include <testexecute.iby>		// TEF
+
+#endif /* __MINIGUI_OBY__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicstest/graphicstestharness/rom/minigui_naviengine_smp.oby	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,21 @@
+// Copyright (c) 2007-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:
+// This OBY File is used to build Minigui NaviEngine SMP ROM Images.
+// 
+//
+
+#define SMP
+#include <naviengine.oby>
+#include <minigui_chassis_bats.oby>
+#include <platsec.oby>
--- a/graphicstest/graphicstestharness/src/tprofiler.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/graphicstestharness/src/tprofiler.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -555,3 +555,27 @@
     {
     iStoreResultInTimingOrder = aStoreResultInTimingOrder;
     }
+
+/**
+Reports analysis results for glyph rates
+
+@param aTestName is the name of the test case
+@param aRotation is the screen rotation being used in the test
+@param aSrcScreenMode is the source screen mode being used, 
+i.e. for bitmap display conversion the source and destinations bitmaps maybe different
+@param aDstScreenMode is the destination screen mode (usually the display screen mode)
+@param aIters is the number of iterations used in the test
+@param aNumGlyphs is the number of glyphs used per iteration
+*/
+
+EXPORT_C void CTProfiler::ResultsAnalysisGlyphRate(const TDesC & aTestName, TInt aRotation, TInt aSrcScreenMode, TInt aDstScreenMode, TInt aIters, TInt aNumGlyphsPerIteration)
+    {
+    PROFILER_TEST(iResultsInitalised);
+
+    TReal time = (iResults.Count() > 0) ? (TReal)iResults[0] / 1000000 : 0;
+    TInt32 glyphRate = aNumGlyphsPerIteration*aIters/time;
+    PROFILER_INFO_PRINTF7(_L("TID:   %S  Rot:    %i  SrcMode:    %i  DestMode:   %i  Iters: %i   TrimmedMean:    %i  glyphs/second"), &aTestName, aRotation, aSrcScreenMode, aDstScreenMode, aIters, glyphRate);
+    PROFILER_INFO_PRINTF3(_L("Max:   %i  Min:    %i  "), TimeMax(), TimeMin());
+    iResultsInitalised = EFalse;
+  }
+
Binary file graphicstest/graphicstestharness/wsini/wsini_naviengine.ini has changed
--- a/graphicstest/uibench/group/bld.inf	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/uibench/group/bld.inf	Tue Jul 20 13:27:44 2010 +0300
@@ -29,6 +29,7 @@
 
 ../scripts/te_uibench_gce.script		z:/uibench/te_uibench_gce.script
 ../scripts/te_uibench_gce.ini			z:/uibench/te_uibench_gce.ini
+
 ../scripts/mysql.pm						z:/uibench/mysql.pm
 ../scripts/uploadsqlfromtestrun.pl		z:/uibench/uploadsqlfromtestrun.pl
 ../scripts/te_uibench_legacy.bat		z:/uibench/te_uibench_legacy.bat
--- a/graphicstest/uibench/group/te_uibench.iby	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/uibench/group/te_uibench.iby	Tue Jul 20 13:27:44 2010 +0300
@@ -19,6 +19,11 @@
 #include <internaltestfonts.iby>
 #include <testexecute.iby>
 #include <graphics_tprofiler.iby>
+
+REM egl and openvg needed for tfbsglyphdata tests
+#include <egl.iby>
+#include <openvg.iby>
+
 #ifndef SMP
 // MCL profiler is not built for SMP
 #include <profiler.iby>
@@ -26,7 +31,6 @@
 #ifdef SYMBIAN_GRAPHICS_USE_GCE
 #include <directgdi.iby>
 #include <directgdiadapter.iby>
-#include <t_halattprovider.iby>
 #endif
 
 file=ABI_DIR\DEBUG_DIR\te_uibench.exe	System\bin\te_uibench.exe
@@ -41,7 +45,6 @@
 #endif
 data=DATAZ_\uibench\te_uibench.ini	uibench\te_uibench.ini
 
-
 data=DATAZ_\uibench\te_uibench_gdi.ini	uibench\te_uibench_gdi.ini
 data=DATAZ_\uibench\te_uibench_gdi.script uibench\te_uibench_gdi.script
 
--- a/graphicstest/uibench/group/te_uibench.mmp	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/uibench/group/te_uibench.mmp	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -42,6 +42,8 @@
 SOURCE  ttranslucent.cpp
 SOURCE	tspriteperf.cpp
 SOURCE	textendedbitmap.cpp
+SOURCE  tfbsglyphdata.cpp
+SOURCE	trenderorientation.cpp
 
 USERINCLUDE   ../src
 USERINCLUDE   ../../../fbs/fontandbitmapserver/inc
@@ -66,6 +68,11 @@
 LIBRARY		estor.lib
 LIBRARY	    	tgraphicsharness.lib
 LIBRARY	    	tprofiler.lib
+#ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
+LIBRARY		sgresource.lib
+LIBRARY		libEGL.lib
+LIBRARY		libOpenVG.lib
+#endif
 
 START BITMAP	16x16icon.mbm
 TARGETPATH		/system/data/
--- a/graphicstest/uibench/group/te_uibench_gce.mmp	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/uibench/group/te_uibench_gce.mmp	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -31,9 +31,9 @@
 SOURCE	tsimpledrawing_directgdi.cpp
 SOURCE	teventhandlingperf.cpp
 SOURCE  tflipframerate.cpp
+SOURCE	trenderorientation.cpp
 
 USERINCLUDE   ../src
-USERINCLUDE   ../../../fbs/fontandbitmapserver/inc
 
 //system includes
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicstest/uibench/group/te_uibench_helium.pkg	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,38 @@
+; Copyright (c) 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: 
+;
+;File: bitgdi.pkg;
+;
+;*Languages
+&EN
+;
+;*Standard SIS file header. This section specifies the package name,
+;application UID, and version/build numbers. Add the package TYPE here if needed.
+#{"UIBench"},(0x101FB3E8),1,0,1;
+;
+
+;*Unique (Non-Localized) Vendor name
+;This is used in combination with signing to prevent the unauthroized
+;upgrade of a a package by someone other than the rightful vendor.
+:"Nokia"
+
+;*Localized Vendor Name
+;This specifies the localized vendor name(s) corresponding to language(s).
+%{"Nokia Test EN"}
+
+;*Files To Copy...<src> <destination>
+
+"\epoc32\data\z\uibench\te_uibench.script"-"c:\uibench\te_uibench.script"
+"\epoc32\data\z\uibench\te_uibenchoutlineshadow.script"-"c:\uibench\te_uibenchoutlineshadow.script"
+
--- a/graphicstest/uibench/s60/group/te_uibench_s60.mmp	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/uibench/s60/group/te_uibench_s60.mmp	Tue Jul 20 13:27:44 2010 +0300
@@ -121,7 +121,7 @@
 LIBRARY     libGLESv1_CM.lib
 LIBRARY	    libopenvgu.lib
 LIBRARY	    libopenvg.lib
-LIBRARY     egltesthybrid.lib
+// this shouldn't be needed LIBRARY     egltesthybrid.lib
 LIBRARY     surfacemanager.lib
 LIBRARY     tgraphicsharness.lib
 LIBRARY     tprofiler.lib
Binary file graphicstest/uibench/scripts/te_uibench.ini has changed
--- a/graphicstest/uibench/scripts/te_uibench.script	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/uibench/scripts/te_uibench.script	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -21,12 +21,12 @@
 
 RUN_UTILS MkDir c:\uibench_sanity\
 RUN_UTILS MakeReadWrite c:\uibench_sanity\
-RUN_UTILS MkDir e:\uibench_sanity\
-RUN_UTILS MakeReadWrite e:\uibench_sanity\
+RUN_UTILS MkDir f:\uibench_sanity\
+RUN_UTILS MakeReadWrite f:\uibench_sanity\
 RUN_UTILS MkDir c:\Profiles\
 RUN_UTILS MakeReadWrite c:\Profiles\
-RUN_UTILS MkDir e:\Profiles\
-RUN_UTILS MakeReadWrite e:\Profiles\
+RUN_UTILS MkDir f:\Profiles\
+RUN_UTILS MakeReadWrite f:\Profiles\
 
 RUN_TEST_STEP 4000 te_uibench tscaleddrawbitmap	z:\uibench\te_uibench.ini
 RUN_TEST_STEP 100 te_uibench tfbsbitmaphandleperf z:\uibench\te_uibench.ini
@@ -41,11 +41,12 @@
 RUN_TEST_STEP 1000 te_uibench tsimpledrawing z:\uibench\te_uibench.ini
 RUN_TEST_STEP 200 te_uibench TRedrawing z:\uibench\te_uibench.ini
 RUN_TEST_STEP 1000 te_uibench tnonredrawdrawing z:\uibench\te_uibench.ini
-RUN_TEST_STEP 20000 te_uibench tfadeperf z:\uibench\te_uibench.ini
-RUN_TEST_STEP 10000 te_uibench tredrawstoreperf z:\uibench\te_uibench.ini
+//RUN_TEST_STEP 20000 te_uibench tfadeperf z:\uibench\te_uibench.ini - disabled due to massive run time & timeout
+//RUN_TEST_STEP 10000 te_uibench tredrawstoreperf z:\uibench\te_uibench.ini - disabled due to massive run time & timeout
 RUN_TEST_STEP 1000 te_uibench ttranslucent z:\uibench\te_uibench.ini
 RUN_TEST_STEP 200 te_uibench tspriteperf z:\uibench\te_uibench.ini
 RUN_TEST_STEP 1000 te_uibench textendedbitmap z:\uibench\te_uibench.ini
+RUN_TEST_STEP 2000 te_uibench tfbsglyphdata z:\uibench\te_uibench.ini
 
 // Performance tests Script  for Hindi text rendering
 RUN_SCRIPT z:\uibench\te_uibench_gdi.script
Binary file graphicstest/uibench/scripts/te_uibench_gce.ini has changed
--- a/graphicstest/uibench/scripts/te_uibench_gce.script	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/uibench/scripts/te_uibench_gce.script	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -22,12 +22,12 @@
 
 RUN_UTILS MkDir c:\Profiles\
 RUN_UTILS MakeReadWrite c:\Profiles\
-RUN_UTILS MkDir e:\Profiles\
-RUN_UTILS MakeReadWrite e:\Profiles\
+RUN_UTILS MkDir f:\Profiles\
+RUN_UTILS MakeReadWrite f:\Profiles\
 RUN_UTILS MkDir c:\uibench_sanity\
 RUN_UTILS MakeReadWrite c:\uibench_sanity\
-RUN_UTILS MkDir e:\uibench_sanity\
-RUN_UTILS MakeReadWrite e:\uibench_sanity\
+RUN_UTILS MkDir f:\uibench_sanity\
+RUN_UTILS MakeReadWrite f:\uibench_sanity\
 
 RUN_TEST_STEP 4000 te_uibench tscaleddrawbitmap	z:\uibench\te_uibench.ini
 RUN_TEST_STEP 100 te_uibench tfbsbitmaphandleperf z:\uibench\te_uibench.ini
@@ -42,11 +42,12 @@
 RUN_TEST_STEP 1000 te_uibench tsimpledrawing z:\uibench\te_uibench.ini
 RUN_TEST_STEP 100 te_uibench TRedrawing z:\uibench\te_uibench.ini
 RUN_TEST_STEP 1000 te_uibench tnonredrawdrawing z:\uibench\te_uibench.ini
-RUN_TEST_STEP 20000 te_uibench tfadeperf z:\uibench\te_uibench.ini
-RUN_TEST_STEP 10000 te_uibench tredrawstoreperf z:\uibench\te_uibench.ini
+//RUN_TEST_STEP 20000 te_uibench tfadeperf z:\uibench\te_uibench.ini - disabled due to massive run time & timeout
+//RUN_TEST_STEP 10000 te_uibench tredrawstoreperf z:\uibench\te_uibench.ini - disabled due to massive run time & timeout
 RUN_TEST_STEP 1000 te_uibench ttranslucent z:\uibench\te_uibench.ini
 RUN_TEST_STEP 200 te_uibench tspriteperf z:\uibench\te_uibench.ini
 RUN_TEST_STEP 1000 te_uibench textendedbitmap z:\uibench\te_uibench.ini
+RUN_TEST_STEP 2000 te_uibench tfbsglyphdata z:\uibench\te_uibench.ini
 
 // Performance tests Script  for Hindi text rendering
 RUN_SCRIPT z:\uibench\te_uibench_gdi.script
@@ -61,7 +62,8 @@
 RUN_TEST_STEP !Heap=0x400000 4000 te_uibench_gce tbitbltperf_directgdi z:\uibench\te_uibench_gce.ini
 RUN_TEST_STEP 1000 te_uibench_gce TDirectGdiPerfTest z:\uibench\te_uibench_gce.ini
 RUN_TEST_STEP 4000 te_uibench_gce tsimpledrawing_directgdi z:\uibench\te_uibench_gce.ini
-RUN_TEST_STEP 1000 te_uibench_gce teventhandlingperf z:\uibench\te_uibench_gce.ini
+//RUN_TEST_STEP 1000 te_uibench_gce teventhandlingperf z:\uibench\te_uibench_gce.ini - disabled due to timeout - expects manual input
 RUN_TEST_STEP 20000 te_uibench_gce tflipframerate z:\uibench\te_uibench_gce.ini
+RUN_TEST_STEP 4000 te_uibench_gce trenderoriention z:\uibench\te_uibench_gce.ini
 
 PRINT Complete_te_uibench_gce_Tests
--- a/graphicstest/uibench/src/te_graphicsperformanceSuiteDefs.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/uibench/src/te_graphicsperformanceSuiteDefs.h	Tue Jul 20 13:27:44 2010 +0300
@@ -54,6 +54,17 @@
 	testBooleanTrueWithErrorCodeL((c), (b), (TText8*)__FILE__, __LINE__);\
 	}
 
+// Redefine TEST/TESTE as TEST1/TESTE1 so that all errors are logged, not
+// just the first error.
+#ifdef TEST
+#undef TEST
+#define TEST(a) TEST1(a, ETrue)
+#endif // TEST
+
+#ifdef TESTE
+#undef TESTE
+#define TESTE(a, b) TESTE1(a, b, ETrue)
+#endif // TESTE
 
 #ifdef _USE_PROFILER
 	#define __PROFILERMEMBERS RProcess iProcess; TInt iPErr; RFs iFSession; TBuf<256> iProfLog; TBuf<256> iProfLoE; CFileMan* iFileMan; 
--- a/graphicstest/uibench/src/te_graphicsperformanceSuiteServer.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/uibench/src/te_graphicsperformanceSuiteServer.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -40,6 +40,7 @@
 #include "ttranslucent.h"
 #include "tspriteperf.h"
 #include "textendedbitmap.h"
+#include "tfbsglyphdata.h"
 
 /**
 Same code for Secure and non-secure variants
@@ -158,5 +159,7 @@
 		testStep = new CTSpritePerf();
 	else if(aStepName == KTExtendedBitmap)
 		testStep = new CTExtendedBitmap();
+	else if(aStepName == KTFbsGlyphData)
+		testStep = new CTFbsGlyphData();
 	return testStep;
 	}
--- a/graphicstest/uibench/src/tfbsfonthandleperf.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/uibench/src/tfbsfonthandleperf.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -268,7 +268,7 @@
 TVerdict CTFbsFontHandlePerf::doTestStepPreambleL()
 	{
 	CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL();
-	SetScreenModeL(EColor16MU);
+	SetScreenModeL(EColor16MAP);
 	iDevice = &iScreenDevice->BitmapDevice();
 	return TestStepResult();
 	}
@@ -310,7 +310,7 @@
 		}
 	else
 		{
-		TEST(ret == KErrNone);
+		TEST((ret == KErrNone) || (ret == KErrAlreadyExists));
 
 		_LIT(KLinkedTypefaceHindi,"HindiLinked");
 		typefaceSpec = CLinkedTypefaceSpecification::NewLC(KLinkedTypefaceHindi);
@@ -327,14 +327,15 @@
 		ts = CFbsTypefaceStore::NewL(iDevice);
 		CleanupStack::PushL(ts);
 		ret = ts->RegisterLinkedTypeface(*typefaceSpec);
-		TEST(ret == KErrNone);
+		TEST((ret == KErrNone) || (ret == KErrAlreadyExists));
 		CleanupStack::PopAndDestroy(2, typefaceSpec);
 		
 		//register a linked typeface with four fonts.
         _LIT(KFourLinked,"FourBitmapLinked");
         _LIT(KLinkedTypeFace1, "DejaVu Sans Condensed");
         _LIT(KLinkedTypeFace2, "Devanagari OT Eval");
-        _LIT(KLinkedTypeFace3, "TBKomachiG-R");
+        //_LIT(KLinkedTypeFace3, "TBKomachiG-R"); // This font is not included in uibench roms.
+		_LIT(KLinkedTypeFace3, "DejaVu Sans Mono");
         _LIT(KLinkedTypeFace4, "DejaVu Serif Condensed");
 
 		typefaceSpec = CLinkedTypefaceSpecification::NewLC(KFourLinked);
@@ -343,7 +344,7 @@
 		typefaceSpec->AddLinkedTypefaceGroupL(*group1);
 		CleanupStack::Pop(group1);
 		
-		const TInt KGroup2Id = 4;	
+		const TInt KGroup2Id = 3;	
 		CLinkedTypefaceGroup* group2 = CLinkedTypefaceGroup::NewLC(KGroup2Id);
 		typefaceSpec->AddLinkedTypefaceGroupL(*group2);
 		CleanupStack::Pop(group2);
@@ -373,7 +374,7 @@
 		ts = CFbsTypefaceStore::NewL(iDevice);
 		CleanupStack::PushL(ts);
 		ret = ts->RegisterLinkedTypeface(*typefaceSpec);
-		TEST(ret == KErrNone);
+		TEST((ret == KErrNone) || (ret == KErrAlreadyExists));
 		CleanupStack::PopAndDestroy(2, typefaceSpec);
 		
 		_LIT(KOneLinked,"OneLinked");
@@ -391,9 +392,7 @@
 		ts = CFbsTypefaceStore::NewL(iDevice);
 		CleanupStack::PushL(ts);
 		TRAP(ret, typefaceSpec->RegisterLinkedTypefaceL(*ts));
-		TEST(ret == KErrNone);
-		
-		TEST(typefaceSpec->RemoveTypeface(3) == KErrNone);
+		TEST((ret == KErrNone) || (ret == KErrAlreadyExists));
 		
 		TRAP(ret, typefaceSpec->UpdateLinkedTypefaceL(*ts));
 		
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicstest/uibench/src/tfbsglyphdata.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,1003 @@
+// Copyright (c) 2009-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:
+//
+
+/**
+ @file
+ @test
+ @internalComponent - Internal Symbian test code 
+*/
+
+#include <graphics/fbsglyphdataiterator.h>
+#include <graphics/fbsglyphmetricsarray.h>
+#ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
+#include <sgresource/sgimage.h>
+#include <egl/egl.h>
+#include <vg/openvg.h>
+typedef EGLBoolean (*TvgCreateEGLImageTargetKHRTypefPtr) (VGeglImageKHR image);
+#endif
+#include "tfbsglyphdata.h"
+
+// When defined Hindi language tests are not run. 
+#define UIBENCH_NO_HINDI
+
+// Size of EGLSurface used for rendering to, in pixels.
+const TSize KEglTargetSize(512, 512);
+
+CTFbsGlyphData::CTFbsGlyphData()
+	{
+	SetTestStepName(KTFbsGlyphData);
+	}
+
+CTFbsGlyphData::~CTFbsGlyphData()
+	{
+	}
+
+TVerdict CTFbsGlyphData::doTestStepPreambleL()
+    {
+#ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
+    User::LeaveIfError(iFbs.Connect());
+	User::LeaveIfError(iSgDriver.Open());
+#endif
+    return CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL();
+    }
+
+TVerdict CTFbsGlyphData::doTestStepPostambleL()
+    {
+#ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
+    iSgDriver.Close();
+    iFbs.Disconnect();
+#endif
+    return CTe_graphicsperformanceSuiteStepBase::doTestStepPostambleL();
+    }
+
+TVerdict CTFbsGlyphData::doTestStepL()
+	{
+#ifndef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
+    INFO_PRINTF1(_L("CTFbsGlyphData can only be run with SgImage 'Lite'"));
+    return TestStepResult();
+#else
+	SetTestStepID(_L("GRAPHICS-UI-BENCH-0178"));
+	GlyphMetricsArrayL(ETestLanguageLatin, ETrue, 1000);
+	RecordTestResultL();
+
+	SetTestStepID(_L("GRAPHICS-UI-BENCH-0179"));
+	GlyphMetricsArrayL(ETestLanguageLatin, EFalse, 50000);
+	RecordTestResultL();
+	
+#ifndef UIBENCH_NO_HINDI
+    // Tests 180 and 181 require a CMap table in order to convert CharacterCodes to GlyphCodes.
+	SetTestStepID(_L("GRAPHICS-UI-BENCH-0180"));
+	GlyphMetricsArrayL(ETestLanguageHindi, ETrue, 25);
+	RecordTestResultL();
+	
+	SetTestStepID(_L("GRAPHICS-UI-BENCH-0181"));
+	GlyphMetricsArrayL(ETestLanguageHindi, EFalse, 50000);
+	RecordTestResultL();
+#endif
+	
+	SetTestStepID(_L("GRAPHICS-UI-BENCH-0182"));
+	GlyphMetricsQuerySingleGlyphL();
+	RecordTestResultL();
+	
+	SetTestStepID(_L("GRAPHICS-UI-BENCH-0183"));
+	GlyphDataIteratorOpenL(ETestLanguageLatin, ETrue, 50);
+	RecordTestResultL();
+
+	SetTestStepID(_L("GRAPHICS-UI-BENCH-0184"));
+	GlyphDataIteratorOpenL(ETestLanguageLatin, EFalse, 500);
+	RecordTestResultL();
+	
+#ifndef UIBENCH_NO_HINDI
+    // Tests 185 and 186 require a CMap table in order to convert CharacterCodes to GlyphCodes.
+	SetTestStepID(_L("GRAPHICS-UI-BENCH-0185"));
+	GlyphDataIteratorOpenL(ETestLanguageHindi, ETrue, 10);
+	RecordTestResultL();
+	
+	SetTestStepID(_L("GRAPHICS-UI-BENCH-0186"));
+	GlyphDataIteratorOpenL(ETestLanguageHindi, EFalse, 5000);
+	RecordTestResultL();
+#endif	
+	
+	SetTestStepID(_L("GRAPHICS-UI-BENCH-0187"));
+	GlyphDataIteratorOpenSingleFontL();
+	RecordTestResultL();
+	
+	SetTestStepID(_L("GRAPHICS-UI-BENCH-0188"));
+	GlyphMetricsQueryUnrasterizedL();
+	RecordTestResultL();
+	
+	SetTestStepID(_L("GRAPHICS-UI-BENCH-0189"));
+	GlyphMetricsQueryPreRasterizedL();
+	RecordTestResultL();
+	
+	SetTestStepID(_L("GRAPHICS-UI-BENCH-0190"));
+	GlyphRenderingL();
+	RecordTestResultL();
+
+	return TestStepResult();
+#endif
+    }
+
+#ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
+/**
+@SYMTestCaseID GRAPHICS-UI-BENCH-0178...0181
+
+@SYMTestType UT
+
+@SYMPREQ PREQ2678
+
+@SYMTestCaseDesc 
+Measures the performance of calling RFbsGlyphMetricsArray::Get() with different sample data.
+The sample data can be a single word, or a very long array of glyphs, in latin or non-latin
+alphabets. At each repetition a different font is used, cycled over nine fonts, to reduce the
+effect of having cached glyphs.
+
+@SYMTestActions
+i. Create some sample fonts to cycle through. 
+ii. Load sample data from config file, specified by aSampleDataKey.
+iii. Create RFbsGlyphMetricsArray, open on sample data.
+iv. For each repetition, call RFbsGlyphMetricsArray::Get(), adjusting font at each repetition.
+v. Measure time from from first to last repetition.
+
+@param aLanguage The language this test will use.
+@param aLongData If ETrue, tells the test to use the long sample data string for the test, EFalse
+	will make the test use the short string data.
+@param aReps The number of times to repeat the test.
+*/
+void CTFbsGlyphData::GlyphMetricsArrayL(TTestLanguage aLanguage, TBool aLongData, TInt aReps)
+	{
+	TBuf<128> KTestName;
+	TPtrC KTestVariant = ConfigKeyNameL(aLanguage, aLongData);
+	KTestName.Format(_L("GlyphMetricsArray %S"), &KTestVariant);
+	
+	// Create some test fonts using the font factory.
+	CTFontFactory* fontFactory = CTFontFactory::NewLC();
+	fontFactory->CreateFontsL(aLanguage, 9);
+
+	// Load the sample string data from the config file.
+	TInt numGlyphCodes = 0;
+	TUint* glyphCodes;
+	LoadConfigSampleDataL(aLanguage, aLongData, glyphCodes, numGlyphCodes);
+
+	// Run the test.
+	TInt err = KErrNone;
+	RFbsGlyphMetricsArray array;
+	CleanupClosePushL(array);
+	iProfiler->InitResults();
+	for (TInt rep = aReps; (rep != 0) && (err == KErrNone); --rep)
+		{
+		err = array.Get(*(fontFactory->NextFont()), glyphCodes, numGlyphCodes);
+		}
+	iProfiler->MarkResultSetL();
+	TESTE(err == KErrNone, err);
+	iProfiler->ResultsAnalysisGlyphRate(KTestName, 0, 0, 0, aReps, numGlyphCodes);
+	
+	CleanupStack::PopAndDestroy(2); // array, fontFactory
+	delete [] glyphCodes;
+	}
+
+/**
+@SYMTestCaseID GRAPHICS-UI-BENCH-0182
+
+@SYMTestType UT
+
+@SYMPREQ PREQ2678
+
+@SYMTestCaseDesc 
+Measures the performance of calling RFbsGlyphDataIterator::Get() with a single glyph,
+versus CFont::GetCharacterData(). Using a single glyph code is a very common use case.
+The glyph and the font is changed at each iteration.
+
+@SYMTestActions
+i. Create some sample fonts to cycle through. 
+ii. Create RFbsGlyphMetricsArray.
+iii. For each repetition, call RFbsGlyphMetricsArray::Get(), adjusting the glyph at 
+	each iteration.
+iv. Measure time from from first to last iteration.
+v. Repeat steps iii. and iv. with CFont::GetCharacterData().
+*/
+void CTFbsGlyphData::GlyphMetricsQuerySingleGlyphL()
+	{
+	_LIT(KTestName, "GlyphMetricsQuerySingleGlyph");
+	const TInt KNumIterations = 50000;
+	TInt err = KErrNone;
+	TBuf<128> KTestNameVariant;
+
+	// Create some test fonts using the font factory.
+	CTFontFactory* fontFactory = CTFontFactory::NewLC();
+	
+	// Run the test for RFbsGlyphMetricsArray, with a different character 
+	// and font for each iteration.
+	KTestNameVariant.Format(_L("%S RFbsGlyphMetricsArray"), &KTestName);
+	fontFactory->CreateFontsL(ETestLanguageLatin, 9);
+	RFbsGlyphMetricsArray array;
+	CleanupClosePushL(array);
+	iProfiler->InitResults();
+	for (TInt rep = KNumIterations; rep != 0 && (err == KErrNone); --rep)
+		{
+		const TUint KGlyphCode = 32 + (rep % 96);
+		err = array.Get(*(fontFactory->NextFont()), &KGlyphCode, 1);
+		}
+	iProfiler->MarkResultSetL();
+	TESTE(err == KErrNone, err);
+	CleanupStack::PopAndDestroy(1); // array
+	iProfiler->ResultsAnalysisGlyphRate(KTestNameVariant, 0, 0, 0, KNumIterations, 1);
+	fontFactory->ReleaseFonts();
+	
+	// Run the test for GetCharacterData(), with a different character
+	// and font for each iteration.
+	KTestNameVariant.Format(_L("%S GetCharacterData"), &KTestName);
+	fontFactory->CreateFontsL(ETestLanguageLatin, 9);
+	TOpenFontCharMetrics metrics;
+	const TUint8* bitmapData = NULL;
+	TSize bitmapSize;
+	iProfiler->InitResults();
+	for (TInt rep = KNumIterations; rep != 0; --rep)
+		{
+		const TUint KGlyphCode = 32 + (rep % 96);
+		fontFactory->NextFont()->GetCharacterData(KGlyphCode, metrics, bitmapData, bitmapSize);
+		}
+	iProfiler->MarkResultSetL();
+	iProfiler->ResultsAnalysisGlyphRate(KTestNameVariant, 0, 0, 0, KNumIterations, 1);
+	
+	CleanupStack::PopAndDestroy(1); // fontFactory
+	}
+
+/**
+@SYMTestCaseID GRAPHICS-UI-BENCH-0183...0186
+
+@SYMTestType UT
+
+@SYMPREQ PREQ2678
+
+@SYMTestCaseDesc 
+Measures the performance of calling RFbsGlyphDataIterator::Open() with different 
+sample data, and iterating through the data with RFbsGlyphDataIterator::Next(). 
+The sample data can be a single word, or a very long array of glyphs,
+in various languages. At each repetition a different font is used, cycled
+over nine fonts.
+
+@SYMTestActions
+i. Create some sample fonts to cycle through. 
+ii. Create RFbsGlyphDataIterator.
+iii. For each repetition, call RFbsGlyphDataIterator::Open(), adjusting the glyph at each 
+	iteration. The font is changed at each repetition.
+iv. Measure time from from first to last repetition.
+
+@param aLanguage The language this test will use.
+@param aLongData If ETrue, tells the test to use the long sample data string for the test, EFalse
+	will make the test use the short string data.
+@param aReps The number of times to repeat the test.
+ */
+void CTFbsGlyphData::GlyphDataIteratorOpenL(TTestLanguage aLanguage, TBool aLongData, TInt aReps)
+	{
+	TBuf<128> KTestName;
+	TPtrC KTestVariant = ConfigKeyNameL(aLanguage, aLongData);
+	KTestName.Format(_L("GlyphDataIteratorOpen %S"), &KTestVariant);
+	
+	// Create some test fonts using the font factory.
+	CTFontFactory* fontFactory = CTFontFactory::NewLC();
+	fontFactory->CreateFontsL(aLanguage, 9);
+	
+	// Load the sample string data from the config file.
+	TInt numGlyphCodes = 0;
+	TUint* glyphCodes;
+	LoadConfigSampleDataL(aLanguage, aLongData, glyphCodes, numGlyphCodes);
+
+	// Run the test.
+	TInt err = KErrNotFound;
+	RFbsGlyphDataIterator iter;
+	CleanupClosePushL(iter);
+	iProfiler->InitResults();
+	for (TInt rep = aReps; (rep != 0) && (err == KErrNotFound); --rep)
+		{
+		err = iter.Open(*(fontFactory->NextFont()), glyphCodes, numGlyphCodes);
+		for (; err == KErrNone; err = iter.Next())
+			{
+			// no operation
+			}
+		iter.Close();
+		}
+	iProfiler->MarkResultSetL();
+	TESTE(err == KErrNotFound, err);
+
+	CleanupStack::PopAndDestroy(2); // iter, fontFactory
+	iProfiler->ResultsAnalysisGlyphRate(KTestName, 0, 0, 0, aReps, numGlyphCodes);
+	delete [] glyphCodes;
+	}
+
+/**
+@SYMTestCaseID GRAPHICS-UI-BENCH-0187
+
+@SYMTestType UT
+
+@SYMPREQ PREQ2678
+
+@SYMTestCaseDesc 
+Measures the performance of calling RFbsGlyphDataIterator::Open() with different 
+lengthed arrays but the same font. The sample data is a long array of characters.
+
+@SYMTestActions
+i. Create a single test font 
+ii. Create RFbsGlyphDataIterator.
+iii. Pass an array to RFbsGlyphDataIterator::Open(), starting with a single glyph.
+	For each iteration, increase the length of the array by one until the entire
+	string has been opened.
+iv. Measure the time to perform all the iterations.
+
+@param aSampleDataKey The string key to lookup under the GlyphArraySampleText section of the 
+	config file where the sample data is read.
+@param aReps The number of times to repeat the test.
+ */
+void CTFbsGlyphData::GlyphDataIteratorOpenSingleFontL()
+	{
+	_LIT(KTestName, "GlyphDataIteratorOpenSingleFont");
+	// A cap on the max number of iterations to complete.
+	const TInt KMaxNumIterations = 200;
+#ifndef UIBENCH_NO_HINDI
+    const TTestLanguage KTestLanguage = ETestLanguageHindi;
+#else
+    const TTestLanguage KTestLanguage = ETestLanguageLatin;
+#endif
+	
+	// Create some test fonts using the font factory.
+	CTFontFactory* fontFactory = CTFontFactory::NewLC();
+	fontFactory->CreateFontsL(KTestLanguage, 1);
+	CFbsFont* font = fontFactory->NextFont();
+	
+	// Load the sample string data from the config file.
+	TInt numGlyphCodes = 0;
+	TUint* glyphCodes;
+	LoadConfigSampleDataL(KTestLanguage, ETrue, glyphCodes, numGlyphCodes); 
+	
+	const TInt KNumRepetitions = Min<TInt>(numGlyphCodes - 1, KMaxNumIterations);
+	RFbsGlyphDataIterator iter;
+	CleanupClosePushL(iter);
+	TInt iterErr = KErrNone;
+	TInt glyphCount = 0;
+	iProfiler->InitResults();
+	for (glyphCount = 1; (glyphCount < KNumRepetitions); ++glyphCount)
+		{
+		iterErr = iter.Open(*font, glyphCodes, glyphCount);
+		for (; iterErr == KErrNone; iterErr = iter.Next())
+			{
+			// no operation
+			}
+		iter.Close();
+		}
+	iProfiler->MarkResultSetL();
+	TEST(glyphCount == KNumRepetitions);
+	TESTE(iterErr == KErrNotFound, iterErr);
+	
+	const TInt KAvgNumCharsPerIteration = KNumRepetitions/2;
+	iProfiler->ResultsAnalysisGlyphRate(KTestName, 0, 0, 0, KNumRepetitions, KAvgNumCharsPerIteration);
+	
+	CleanupStack::PopAndDestroy(2); // iter, fontFactory
+	delete [] glyphCodes;
+	}
+/**
+@SYMTestCaseID GRAPHICS-UI-BENCH-0188
+
+@SYMTestType UT
+
+@SYMPREQ PREQ2678
+
+@SYMTestCaseDesc 
+Measures the performance of querying the TOpenFontCharMetrics using the different
+available APIs. RFbsGlyphMetricsArray, RFbsGlyphDataIterator, and CFont::GetCharacterData()
+are compared against each other, using the same fonts, and same sample data.
+This test uses glyphs that have not been rasterized before, therefore for certain
+APIs this will mean rasterizing the glyphs.
+
+@SYMTestActions
+i. Load sample text data from config file.
+ii. For each of RFbsGlyphMetricsArray, RFbsGlyphDataIterator, and CFont::GetCharacterData():
+	1. Create 50 new fonts.
+	2. Run the test, calling the necessary API once per font/loop.
+	3. For GetCharacterData() and RFbsGlyphDataIterator(), cycle through each glyph
+		to ensure all metrics have been retrieved. This is not necessary for 
+		RFbsGlyphMetricsArray.
+	4. Measure time between first and last font/loop.
+	5. Destroy test fonts so that next test has to re-rasterize the glyphs.	
+
+@SYMTestExpectedResults
+Since this test uses non-rasterized fonts, RFbsGlyphMetricsArray should be faster than
+GetCharacterData() and RFbsGlyphDataIterator, which both rasterize the glyphs in order to 
+get their metrics information.
+ */
+void CTFbsGlyphData::GlyphMetricsQueryUnrasterizedL()
+	{
+	_LIT(KTestName, "GlyphMetricsQueryUnrasterized");
+	TBuf<128> KTestNameVariant;
+	const TInt KNumFonts = 50;
+	const TTestLanguage KTestLanguage = ETestLanguageLatin;
+	
+	// Load the sample string data from the config file. Both the iterator and the
+	// array will use this same sample data.
+	TInt numGlyphCodes = 0;
+	TUint* glyphCodes;
+	LoadConfigSampleDataL(KTestLanguage, ETrue, glyphCodes, numGlyphCodes); 
+	
+	// Create some test fonts using the font factory.
+	CTFontFactory* fontFactory = CTFontFactory::NewLC();
+	
+	// First do the test for the iterator. To ensure fair comparison with
+	// RFbsGlyphMetricsArray, cycle through each iteration to ensure the metrics
+	// for each glyph is found.
+	KTestNameVariant.Format(_L("%S RFbsGlyphDataIterator"), &KTestName);
+	fontFactory->CreateFontsL(KTestLanguage, KNumFonts);
+	RFbsGlyphDataIterator iter;
+	CleanupClosePushL(iter);
+	TInt iterErr = KErrNone;
+	TInt rep = 0;
+	iProfiler->InitResults();
+	for (rep = KNumFonts; (rep != 0); --rep)
+		{
+		iterErr = iter.Open(*(fontFactory->NextFont()), glyphCodes, numGlyphCodes);
+		for (; iterErr == KErrNone; iterErr = iter.Next())
+			{
+			// no operation
+			}
+		iter.Close();
+		}
+	iProfiler->MarkResultSetL();
+	TEST(rep == 0);
+	TESTE(iterErr == KErrNotFound, iterErr);
+	CleanupStack::PopAndDestroy(1); // iter		
+	iProfiler->ResultsAnalysisGlyphRate(KTestNameVariant, 0, 0, 0, KNumFonts, numGlyphCodes);
+	
+	// Second, do the test for the array. This should be faster.
+	// Destroy the fonts and re-create them so that they have to be re-rasterized
+	// for a fair comparison.
+	TInt arrayErr = KErrNone;
+	KTestNameVariant.Format(_L("%S RFbsGlyphMetricsArray"), &KTestName);
+	fontFactory->ReleaseFonts();
+	fontFactory->CreateFontsL(KTestLanguage, KNumFonts);
+	RFbsGlyphMetricsArray array;
+	CleanupClosePushL(array);
+	iProfiler->InitResults();	
+	for (TInt rep = KNumFonts; (rep != 0) && (arrayErr == KErrNone); --rep)
+		{
+		arrayErr = array.Get(*(fontFactory->NextFont()), glyphCodes, numGlyphCodes);
+		}
+	iProfiler->MarkResultSetL();
+	CleanupStack::PopAndDestroy(1); // array
+	TEST(rep == 0);
+	TESTE(arrayErr == KErrNone, arrayErr);
+	iProfiler->ResultsAnalysisGlyphRate(KTestNameVariant, 0, 0, 0, KNumFonts, numGlyphCodes);
+	
+	// Third, do the test using GetCharacterData() to get the metrics.
+	// Destroy the fonts and re-create them so that they have to be re-rasterized
+	// for a fair comparison.
+	KTestNameVariant.Format(_L("%S GetCharacterData"), &KTestName);
+	fontFactory->ReleaseFonts();
+	fontFactory->CreateFontsL(KTestLanguage, KNumFonts);	
+	iProfiler->InitResults();
+	const TUint8* bitmapData = NULL;
+	TSize bitmapSize;
+	TOpenFontCharMetrics metrics;	
+	for (TInt rep = KNumFonts; (rep != 0); --rep)
+		{
+		CFbsFont* font = fontFactory->NextFont(); 
+		for (TInt glyphIndex = 0; glyphIndex < numGlyphCodes; glyphIndex++)
+			{
+			font->GetCharacterData(glyphCodes[glyphIndex], metrics, bitmapData, bitmapSize);
+			}
+		}
+	iProfiler->MarkResultSetL();
+	iProfiler->ResultsAnalysisGlyphRate(KTestNameVariant, 0, 0, 0, KNumFonts, numGlyphCodes);
+	
+	CleanupStack::PopAndDestroy(1); // fontFactory
+	delete [] glyphCodes;
+	}
+
+/**
+@SYMTestCaseID GRAPHICS-UI-BENCH-0189
+
+@SYMTestType UT
+
+@SYMPREQ PREQ2678
+
+@SYMTestCaseDesc 
+Measures the performance of querying the TOpenFontCharMetrics using the different
+available APIs. RFbsGlyphMetricsArray, RFbsGlyphDataIterator, and CFont::GetCharacterData()
+are compared against each other, using the same fonts, and same sample data.
+This test uses glyphs that have already been rasterized, thereby possibly reducing the 
+extra overhead this has.
+
+@SYMTestActions
+i. Load sample text data from config file.
+ii. Create test font.
+iii. Pre-rasterize glyphs using RFbsGlyphDataIterator. This will rasterize the glyphs 
+	and cause them to be cached for use by all the APIs tested here.
+iv. For each of RFbsGlyphMetricsArray, RFbsGlyphDataIterator, and CFont::GetCharacterData():
+	1. Begin the loop, calling the necessary API once per font/loop.
+	2. For each glyph, request the glyph metrics.
+	3. Measure time between first and last font/loop.
+v. Destroy test font.
+
+@SYMTestExpectedResults
+All results should be improved over GlyphMetricsQueryUnrasterized (GRAPHICS-UI-BENCH-0187).
+since no rasterizing should take place during these tests.
+ */
+void CTFbsGlyphData::GlyphMetricsQueryPreRasterizedL()
+	{
+	_LIT(KTestName, "GlyphMetricsQueryPreRasterized");
+	TBuf<128> KTestNameVariant;
+	const TInt KNumIterations = 500;
+	const TTestLanguage KTestLanguage = ETestLanguageLatin;
+		
+	TInt numGlyphCodes = 0;
+	TUint* glyphCodes;
+	LoadConfigSampleDataL(KTestLanguage, ETrue, glyphCodes, numGlyphCodes); 
+	
+	// Create a test font using the font factory.
+	CTFontFactory* fontFactory = CTFontFactory::NewLC();
+	fontFactory->CreateFontsL(ETestLanguageLatin, 1);	
+	CFbsFont* font = fontFactory->NextFont();
+	
+	TInt iterErr = KErrNone;
+	TInt rep = 0;
+	// Rasterize the glyphs first.
+	RFbsGlyphDataIterator iter;
+	CleanupClosePushL(iter);
+	for (rep = KNumIterations; (rep != 0) ; --rep)
+		{
+		iterErr = iter.Open(*font, glyphCodes, numGlyphCodes);
+		for (; iterErr == KErrNone; iterErr = iter.Next())
+			{
+			// no operation
+			}
+		iter.Close();
+		}
+	TEST(rep == 0);
+	TESTE(iterErr == KErrNotFound, iterErr);
+	
+	TOpenFontCharMetrics metrics;
+		
+	// First do the test for the iterator. To ensure fair comparison with
+	// RFbsGlyphMetricsArray, cycle through each iteration to ensure the metrics
+	// for each glyph is found.
+	iterErr = KErrNone;
+	KTestNameVariant.Format(_L("%S RFbsGlyphDataIterator"), &KTestName);
+	iProfiler->InitResults();
+	for (TInt rep = KNumIterations; (rep != 0); --rep)
+		{
+		for (iterErr = iter.Open(*font, glyphCodes, numGlyphCodes); iterErr == KErrNone; iterErr = iter.Next())
+			{
+			metrics = iter.Metrics();
+			}
+		iter.Close();
+		}
+	iProfiler->MarkResultSetL();
+	TESTE(iterErr == KErrNotFound, iterErr);
+	CleanupStack::PopAndDestroy(1); // iter
+	iProfiler->ResultsAnalysisGlyphRate(KTestNameVariant, 0, 0, 0, KNumIterations, numGlyphCodes);
+	
+	
+	// Second, do the test for the array. This should be faster.
+	TInt arrayErr = KErrNone;
+	KTestNameVariant.Format(_L("%S RFbsGlyphMetricsArray"), &KTestName);
+	RFbsGlyphMetricsArray array;
+	CleanupClosePushL(array);
+	iProfiler->InitResults();
+	for (TInt rep = KNumIterations; (rep != 0) && (arrayErr == KErrNone); --rep)
+		{
+		arrayErr = array.Get(*font, glyphCodes, numGlyphCodes);
+		for (TInt i = 0; i < numGlyphCodes; ++i)
+			{
+			metrics = array[i];
+			}
+		}
+	iProfiler->MarkResultSetL();
+	TESTE(arrayErr == KErrNone, arrayErr);
+	CleanupStack::PopAndDestroy(1); // array
+	iProfiler->ResultsAnalysisGlyphRate(KTestNameVariant, 0, 0, 0, KNumIterations, numGlyphCodes);
+	
+	
+	// Third, do the test using GetCharacterData() to get the metrics.
+	KTestNameVariant.Format(_L("%S GetCharacterData"), &KTestName);
+	const TUint8* bitmapData;
+	TSize bitmapSize;
+
+	iProfiler->InitResults();
+	for (TInt rep = KNumIterations; (rep != 0); --rep)
+		{
+		for (TInt glyphIndex = 0; glyphIndex < numGlyphCodes; glyphIndex++)
+			{
+			font->GetCharacterData(glyphCodes[glyphIndex], metrics, bitmapData, bitmapSize);
+			}
+		}
+	iProfiler->MarkResultSetL();
+	iProfiler->ResultsAnalysisGlyphRate(KTestNameVariant, 0, 0, 0, KNumIterations, numGlyphCodes);
+	
+	CleanupStack::PopAndDestroy(1); // fontFactory
+	delete [] glyphCodes;
+	}
+
+/**
+@SYMTestCaseID GRAPHICS-UI-BENCH-0190
+
+@SYMTestType UT
+
+@SYMPREQ PREQ2678
+
+@SYMTestCaseDesc 
+Measures the end-to-end performance of using Khronos APIs to render glyphs using the
+RFbsGlyphDataIterator API. Positioning is very basic and is not reflective of a production-
+quality text-rendering algorithm, but serves as a useful benchmark of the overall
+text-rendering performance using this API.
+
+@SYMTestActions
+i. Create a sample font to use. 
+ii. Create a RSgImage to be used as a target for Khronos API rendering.
+iii. Set-up EGL and OpenVG.
+iv. Construct RFbsGlyphDataIterator, and open on sample data. At each iteration:
+	1. Create an EGLImage from the RSgImage.
+	2. Create a VGImage from the EGLImage.
+	3. Render the VGImage using vgDrawImage().
+	4. Destroy VGImage.
+	5. Destroy EGLImage.
+	6. Advance the current rendering position for the next glyph, ensuring that every glyph
+	will be within the bounds of the target surface.
+v. Measure time from from first to last iteration.
+*/
+void CTFbsGlyphData::GlyphRenderingL()
+	{
+	_LIT(KTestName, "GlyphRendering");
+	const TInt KNumIterations = 500;
+#ifndef UIBENCH_NO_HINDI
+    const TTestLanguage KTestLanguage = ETestLanguageHindi;
+#else
+    const TTestLanguage KTestLanguage = ETestLanguageLatin;
+#endif
+	
+	// Create some test fonts using the font factory.
+	CTFontFactory* fontFactory = CTFontFactory::NewLC();
+	fontFactory->CreateFontsL(KTestLanguage, 1, 20);
+	CFbsFont* font = fontFactory->NextFont();
+	const TInt KFontHeightInPixels = font->HeightInPixels();
+
+	// Create RSgImage to be used as OpenVG Pixmap Surface
+
+	RSgImage target;
+	TInt err = target.Create(TSgImageInfo(KEglTargetSize, ESgPixelFormatARGB_8888_PRE, ESgUsageBitOpenVgSurface));
+	TESTL(err == KErrNone);
+	CleanupClosePushL(target);
+	
+	// Initialize EGL/OpenVG for rendering.
+	EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+	if (display == EGL_NO_DISPLAY)
+		{
+		ERR_PRINTF2(_L("Failed to get EGLDisplay. [eglError=%X]"), eglGetError());
+		User::Leave(KErrGeneral);
+		}
+	TESTL(display != EGL_NO_DISPLAY);
+	if (EGL_FALSE == eglInitialize(display, NULL, NULL))
+		{
+		ERR_PRINTF2(_L("Failed to initialize EGLDisplay. [eglError=%X]"), eglGetError());
+		User::Leave(KErrGeneral);
+		}
+	eglBindAPI(EGL_OPENVG_API);
+	
+	EGLint imageAttribs[] =
+	    {
+	    EGL_IMAGE_PRESERVED_SYMBIAN, EGL_TRUE, 
+	    EGL_NONE
+	    };
+	EGLint configAttribs[] = 
+		{
+		EGL_MATCH_NATIVE_PIXMAP, (EGLint)&target,
+		EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
+		EGL_SURFACE_TYPE, EGL_PIXMAP_BIT | EGL_VG_ALPHA_FORMAT_PRE_BIT, 
+		EGL_NONE
+		};
+	
+	const EGLint KPixmapAttribsVgAlphaFormatPre[] = 
+	    {
+	    EGL_VG_ALPHA_FORMAT, EGL_VG_ALPHA_FORMAT_PRE,
+	    EGL_NONE
+	    };
+		
+	EGLint configId = 0;
+	EGLint numConfigs = 0;
+	if (EGL_FALSE == eglChooseConfig(display, configAttribs, &configId, 1, &numConfigs) || numConfigs == 0)
+		{
+		ERR_PRINTF3(_L("Failed to find suitable EGLConfig. [eglError=%X, configs=%d]"), eglGetError(), numConfigs);
+		User::Leave(KErrGeneral);
+		}
+	EGLContext context = eglCreateContext(display, configId, EGL_NO_CONTEXT, NULL);
+	if (context == EGL_NO_CONTEXT)
+		{
+		ERR_PRINTF2(_L("Failed to create EGLContext. [eglError=%X]"), eglGetError());
+		User::Leave(KErrGeneral);
+		}
+	EGLSurface surface = eglCreatePixmapSurface(display, configId, &target, KPixmapAttribsVgAlphaFormatPre);
+	if (EGL_FALSE == eglMakeCurrent(display, surface, surface, context))
+		{
+		ERR_PRINTF2(_L("Failed to create make surface and context current. [eglError=%X]"), eglGetError());
+		eglDestroyContext(display, context);
+		User::Leave(KErrGeneral);
+		}
+	
+	// Load the necessary EGL extensions...
+	TvgCreateEGLImageTargetKHRTypefPtr vgCreateImageTargetKHR;
+	PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
+	PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
+	eglCreateImageKHR = reinterpret_cast<PFNEGLCREATEIMAGEKHRPROC>(eglGetProcAddress("eglCreateImageKHR"));
+	eglDestroyImageKHR = reinterpret_cast<PFNEGLDESTROYIMAGEKHRPROC>(eglGetProcAddress("eglDestroyImageKHR"));
+	vgCreateImageTargetKHR = reinterpret_cast<TvgCreateEGLImageTargetKHRTypefPtr>(eglGetProcAddress("vgCreateEGLImageTargetKHR"));
+	if (!eglCreateImageKHR || !eglDestroyImageKHR || !vgCreateImageTargetKHR)
+		{
+		ERR_PRINTF1(_L("Failed to get EGL Image extension functions."));
+		User::Leave(KErrNotSupported);
+		}
+	// Now we have an OpenVG window to render to!
+	
+	TInt numGlyphCodes = 0;
+	TUint* glyphCodes;
+	LoadConfigSampleDataL(KTestLanguage, EFalse, glyphCodes, numGlyphCodes); 
+
+	// Set up an identity matrix compatible with the Symbian co-ordinate system.
+	vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
+	vgScale(1.f, -1.f);
+	vgTranslate(0, -KFontHeightInPixels);	
+	VGfloat vgIdentityMatrix[16];
+	vgGetMatrix(vgIdentityMatrix);
+	
+	RFbsGlyphDataIterator iter;
+	CleanupClosePushL(iter);
+		
+	// Render some glyphs.
+	TInt iterErr = KErrNone;
+	TInt rep = 0;
+	vgClear(0, 0, KEglTargetSize.iWidth, KEglTargetSize.iHeight);
+	TPoint glyphOrigin(0, 0);
+	iProfiler->InitResults();
+	for (rep = 0; rep < KNumIterations; rep++)
+		{
+		iterErr = iter.Open(*font, glyphCodes, numGlyphCodes);
+		for (;iterErr == KErrNone; iterErr = iter.Next())
+			{
+			const TOpenFontCharMetrics& metrics = iter.Metrics();
+			const RSgImage& glyphSgImage = iter.Image();
+			EGLImageKHR eglImage = eglCreateImageKHR(display, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, 
+					reinterpret_cast<EGLClientBuffer>(&glyphSgImage), imageAttribs);
+			VGImage vgImage = vgCreateImageTargetKHR(eglImage);
+			
+			// wrapped text placement.			
+			TInt horizAdvance = metrics.HorizAdvance();
+			if (glyphOrigin.iX + horizAdvance >= KEglTargetSize.iWidth)
+				{
+				vgLoadMatrix(vgIdentityMatrix);
+				glyphOrigin.iX = 0;
+				glyphOrigin.iY -= KFontHeightInPixels;
+				if (glyphOrigin.iY - KFontHeightInPixels < -KEglTargetSize.iHeight)
+					{
+					glyphOrigin.iY = 0;
+					}
+				vgTranslate(glyphOrigin.iX, glyphOrigin.iY);
+				}
+			
+			vgDrawImage(vgImage);
+			vgDestroyImage(vgImage);
+			eglDestroyImageKHR(display, eglImage);
+				
+			// Move to next glyph position.
+			glyphOrigin.iX += horizAdvance;
+			vgTranslate(horizAdvance, 0);
+			}
+		iter.Close();
+		eglSwapBuffers(display, surface);
+		}
+	iProfiler->MarkResultSetL();
+	iProfiler->ResultsAnalysisGlyphRate(KTestName, 0, 0, 0, KNumIterations, numGlyphCodes);
+	TEST(rep == KNumIterations);
+	TESTE(iterErr == KErrNotFound, iterErr);	
+	WriteTargetOutput(KTestName());
+	
+	eglDestroySurface(display, surface);
+	eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+	eglTerminate(display);
+	eglReleaseThread();
+	
+	CleanupStack::PopAndDestroy(3); // iter, target, fontFactory
+	delete [] glyphCodes;
+	}
+#endif
+
+/**
+Captures the EGL Surface (it is assumed to be an OpenVG surface) to a 256-grey CFbsBitmap,
+used when sanity-checking bitmaps are enabled. 
+*/
+CFbsBitmap* CTFbsGlyphData::GetTargetAsBitmapL()
+	{
+#ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
+	// For debugging purposes only.
+	// Capture the final state of the EGL Pixmap surface as an mbm.
+	TSize KTargetSize;
+	const TSize KBufferSize = KEglTargetSize;
+	const TInt KDataStride = KEglTargetSize.iWidth;
+	
+	TUint8* imageBuffer = reinterpret_cast<TUint8*>(User::AllocZ(KBufferSize.iHeight * KDataStride));
+	CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();
+	CleanupStack::PushL(bitmap);
+	User::LeaveIfError(bitmap->Create(KBufferSize, EGray256));
+	vgReadPixels(imageBuffer, KDataStride, VG_A_8, 0, 0, KBufferSize.iWidth, KBufferSize.iHeight);
+	TUint8* buf = imageBuffer;
+	bitmap->BeginDataAccess();
+	TUint8* dataAddress = reinterpret_cast<TUint8*>(bitmap->DataAddress());
+	const TInt dataStride = bitmap->DataStride();	
+	for (TInt scanline = 0; scanline < KBufferSize.iHeight; scanline++)
+		{
+		Mem::Copy(dataAddress, buf, KBufferSize.iWidth);
+		dataAddress += dataStride;
+		buf += KBufferSize.iWidth;
+		}
+	bitmap->EndDataAccess(EFalse);
+	User::Free(imageBuffer);
+	CleanupStack::Pop(1); // bitmap
+	return bitmap;
+#else
+	return NULL;
+#endif
+	}
+
+/**
+Utility method. Loads sample glyph code data from the config ini file
+into a TUint array.
+@param aKey The key string to look for when loading the sample data from the config file
+@param aGlyphCodes On success, holds an array of glyph codes, to be freed by the caller.
+@param aNumGlyphCodes On success, holds the count of the glyph code array.
+@leave KErrNotFound if the test data cannot be found or is empty in the config file.
+ */
+void CTFbsGlyphData::LoadConfigSampleDataL(TTestLanguage aLanguage, TBool aLongData, TUint*& aGlyphCodes, TInt& aNumGlyphCodes)
+	{
+	// The name of the section in the config file to look-up the sample data
+	_LIT(KConfigFileSampleData, "GlyphDataSampleText");
+	
+	TBuf<32> keyName = ConfigKeyNameL(aLanguage, aLongData);
+	
+	// Load the sample string data from the config file.
+	TPtrC sampleText;
+	TESTL(GetStringFromConfig(KConfigFileSampleData, keyName, sampleText));
+	aNumGlyphCodes = sampleText.Length();
+	if (aNumGlyphCodes <= 0)
+		{
+		User::Leave(KErrNotFound);
+		}
+	aGlyphCodes = new(ELeave) TUint[aNumGlyphCodes];
+	for (TInt code = 0; code < aNumGlyphCodes; ++code)
+		{
+		aGlyphCodes[code] = sampleText[code]; 
+		}
+	}
+
+/**
+Creates the name of the key to look for in the config file for the test
+with the specified parameters.
+@param aLanguage The language the test will use.
+@param aLongData Whether to use long or short sample data.
+@return A descriptor value of the language.
+@leave KErrNotSupported if aLanguage is not recognised.
+ */
+TBufC<32> CTFbsGlyphData::ConfigKeyNameL(TTestLanguage aLanguage, TBool aLongData)
+	{
+	if (aLanguage < 0 || aLanguage > 1)
+		{
+		User::Leave(KErrNotSupported);
+		}
+	TBuf<32> langName[2];
+	langName[ETestLanguageLatin].Append(_L("Latin"));
+	langName[ETestLanguageHindi].Append(_L("Hindi"));	
+	langName[aLanguage].Append((aLongData) ? _L("Long") : _L("Short"));
+	return langName[aLanguage];
+	}
+
+/**
+Font factory.
+Utiltiy class for providing fonts for the performance tests.
+*/
+
+CTFontFactory::CTFontFactory()
+	{
+	}
+
+CTFontFactory::~CTFontFactory()
+	{
+	ReleaseFonts();
+	delete iTs;
+	}
+
+/**
+@return A new Font Factory ready to create fonts.
+*/
+CTFontFactory* CTFontFactory::NewLC()
+	{
+	CTFontFactory* fontFactory = new (ELeave) CTFontFactory();
+	CleanupStack::PushL(fontFactory);
+	fontFactory->iTs = static_cast<CFbsTypefaceStore*>(CFbsTypefaceStore::NewL(NULL));
+	return fontFactory;
+	}
+
+/**
+Creates a number of fonts for use by tests. All the fonts are created up-front so 
+that NextFont() can be called as a very lightweight call, so it can be used inside
+tests with minimal impact.
+Once fonts are created, the factory must not be destroyed until the fonts it created
+are finished with.
+@param aLanaugeMask Which language needs to be supported by the returned fonts.
+@param aNumFonts The number of fonts to create
+@param aStartSizeInPixels The lower bound font height of the fonts that are created. All
+	fonts will be at least as big as this value.
+*/
+void CTFontFactory::CreateFontsL(TTestLanguage aLanguageMask, TInt aNumFonts, TInt aStartSizeInPixels)
+	{
+	ReleaseFonts();
+	
+	RArray <TPtrC> typefaceNames;
+	CleanupClosePushL(typefaceNames);
+	switch(aLanguageMask)
+		{
+		case ETestLanguageHindi:	
+			User::LeaveIfError(typefaceNames.Reserve(1));
+			typefaceNames.Append(_L("Devanagari OT Eval"));
+			break;
+		case ETestLanguageLatin:
+			User::LeaveIfError(typefaceNames.Reserve(3));
+			typefaceNames.Append(_L("DejaVu Sans Condensed"));
+			typefaceNames.Append(_L("DejaVu Serif"));
+			typefaceNames.Append(_L("DejaVu Sans Mono"));
+			break;
+		default:
+			User::Leave(KErrNotSupported);
+		}
+	const TInt KNumTypefaces = typefaceNames.Count();
+		
+	iFont = new CFbsFont*[aNumFonts];
+	for (TInt count = 0; count < aNumFonts; ++count)
+		{
+		// After every KNumTypefaces font, increase size by 5.
+		TInt size = aStartSizeInPixels + (5 *(count / KNumTypefaces));
+		TPtrC typefaceName = typefaceNames[count % KNumTypefaces];
+		TFontSpec fontSpec(typefaceName, size);
+		User::LeaveIfError(iTs->GetNearestFontToDesignHeightInPixels((CFont*&)iFont[count], fontSpec));
+		++iNumFonts;
+		}
+	iCurFont = -1;
+	CleanupStack::PopAndDestroy(1); // typefaceNames
+	}
+/**
+Releases all created fonts and frees associated memory.
+*/
+void CTFontFactory::ReleaseFonts()
+	{
+	for (TInt font = 0; font < iNumFonts; ++font)
+		{
+		iTs->ReleaseFont(iFont[font]);
+		}
+	delete [] iFont;
+	iFont = NULL;
+	iNumFonts = 0;
+	}
+
+/**
+@return The next font to be used. If it reaches the last font, the next font will
+	cycle back around to the first font.
+*/
+CFbsFont* CTFontFactory::NextFont()
+	{
+	return iFont[++iCurFont%iNumFonts];
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicstest/uibench/src/tfbsglyphdata.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,98 @@
+// Copyright (c) 2009-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:
+//
+
+/**
+ @file
+ @test
+ @internalComponent - Internal Symbian test code 
+*/
+
+#ifndef TFBSGLYPHDATA_H
+#define TFBSGLYPHDATA_H
+
+#include <fbs.h>
+#include <sgresource/sgresource.h>
+#include "te_graphicsperformanceSuiteStepBase.h"
+
+/**
+Enumeration of languages that are supported for testing in this framework.
+ */
+enum TTestLanguage
+	{
+	ETestLanguageLatin,
+	ETestLanguageHindi
+	};
+
+/**
+Test case to test the performance of RFbsGlyphDataIterator and RFbsGlyphMetricsArray.
+*/
+class CTFbsGlyphData : public CTe_graphicsperformanceSuiteStepBase
+    {
+public:
+	CTFbsGlyphData();
+	~CTFbsGlyphData();
+	
+	// From CTe_graphicsperformanceSuiteStepBase
+	virtual TVerdict doTestStepPreambleL();
+	virtual TVerdict doTestStepPostambleL();
+	virtual TVerdict doTestStepL();
+	virtual CFbsBitmap* GetTargetAsBitmapL();
+    
+private:
+	// Tests
+	void GlyphMetricsArrayL(TTestLanguage aLanguage, TBool aLongData, TInt aReps);
+	void GlyphMetricsQuerySingleGlyphL();
+	void GlyphDataIteratorOpenL(TTestLanguage aLanguage, TBool aLongData, TInt aReps);
+	void GlyphDataIteratorOpenSingleFontL();
+	void GlyphMetricsQueryUnrasterizedL();
+	void GlyphMetricsQueryPreRasterizedL();
+	void GlyphRenderingL();
+	
+	// Utility methods
+	void LoadConfigSampleDataL(TTestLanguage aLanguage, TBool aLongData, TUint*& aGlyphCodes, TInt& aNumGlyphCodes);
+	static TBufC<32> ConfigKeyNameL(TTestLanguage aLanguage, TBool aLongData);
+	
+private:
+	RFbsSession iFbs;
+	RSgDriver iSgDriver;
+    };
+
+_LIT(KTFbsGlyphData,"tfbsglyphdata");
+
+/**
+Utility class. Provides the tests with a number of different fonts to use.
+Manages their creation and destruction.
+ */
+class CTFontFactory : public CBase
+	{
+public:
+	static CTFontFactory* NewLC();
+	~CTFontFactory();
+	
+	void CreateFontsL(TTestLanguage aLanguageMask, TInt aNumFonts, TInt aStartSizeInPixels = 5);
+	TInt NumFonts() const;
+	CFbsFont* NextFont();
+	void ReleaseFonts();
+private:
+	CTFontFactory();
+private:
+	CFbsFont** iFont;
+	TInt iNumFonts;
+	TInt iCurFont;
+	CFbsTypefaceStore* iTs;
+	};
+
+
+#endif /* TFBSGLYPHDATA_H */
--- a/graphicstest/uibench/src/tgcesuiteserver.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicstest/uibench/src/tgcesuiteserver.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// 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"
@@ -26,6 +26,7 @@
 #include "tdirectgdiperf.h"
 #include "teventhandlingperf.h"
 #include "tflipframerate.h"
+#include "trenderorientation.h"
 
 /**
 Same code for Secure and non-secure variants
@@ -102,6 +103,7 @@
 CTestStep* CGceSuiteServer::CreateTestStep(const TDesC& aStepName)
 	{
 	CTestStep* testStep = NULL;
+	
 	if(aStepName == KTGraphicsResource)
 		testStep = new CTGraphicsResource();
 	else if(aStepName == KTBitBltPerfDirectGdi)
@@ -113,6 +115,9 @@
 	else if(aStepName == KEventHandlingPerfName)
 		testStep = new CTEventHandlingPerf();
 	else if(aStepName == KTFlipFramerate)
-	    testStep = new CTFlipFramerate;
+	    testStep = new CTFlipFramerate();
+	else if(aStepName == KTRenderOrientation)
+	    testStep = new CTRenderOrientation;
+	
 	return testStep;
 	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicstest/uibench/src/trenderorientation.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,269 @@
+// Copyright (c) 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:
+//
+
+/**
+ @file
+ @test
+ @internalComponent - Internal Nokia test code 
+*/
+
+#include <w32std.h>
+
+#include <wspublishandsubscribedata.h>
+#include "trenderorientation.h"
+
+const TInt KPublishTimeout  = 1000000;  // 1 second in microseconds
+const TInt KNumIterations   = 20;
+
+// Values for the device orientation that we receive via P&S from the Theme Server
+// Must match those in renderorientationtracker.h, and, obviously, those used by the real theme server 
+const TUid  KThemeOrientationCategory   = {0x20022E82}; // == KHbPsHardwareCoarseOrientationCategoryUid 
+const TUint KThemeOrientationKey        = 0x4F726965; // == KHbPsHardwareCoarseOrientationKey 
+
+void CWindowStuff::ConstructL()
+    {
+    User::LeaveIfError(iWs.Connect());
+    iWs.SetAutoFlush(ETrue);
+    
+    iWindowGroup = RWindowGroup(iWs);
+    User::LeaveIfError(iWindowGroup.Construct(reinterpret_cast<TUint32>(&iWindowGroup)));
+    
+    iChildWindow = RWindow(iWs);
+    User::LeaveIfError(iChildWindow.Construct(iWindowGroup, reinterpret_cast<TUint32>(&iChildWindow)));
+    }
+
+CWindowStuff::~CWindowStuff()
+    {
+    Destroy();
+    }
+
+void CWindowStuff::Destroy()
+    {
+    iChildWindow.Close();
+    iWindowGroup.Close();
+    iWs.Close();    
+    }
+
+CTRenderOrientation::CTRenderOrientation()
+    {
+    // check that these two enums are aligned
+    __ASSERT_COMPILE(EDisplayOrientationAuto == ENumWindowThings);
+    
+    SetTestStepName(KTRenderOrientation);
+    }
+
+CTRenderOrientation::~CTRenderOrientation()
+    {
+    }
+
+TRenderOrientation CTRenderOrientation::GetRenderOrientationL()
+    {    
+    return GetOrientationL(iWsRenderOrientationProperty);    
+    }
+
+TRenderOrientation CTRenderOrientation::GetThemeOrientationL()
+    {    
+    return GetOrientationL(iThemeOrientationProperty);    
+    }
+
+TRenderOrientation CTRenderOrientation::GetOrientationL(RProperty& aProperty)
+    {
+    TInt orientation=EDisplayOrientationNormal;
+    User::LeaveIfError(aProperty.Get(orientation));
+    
+    TESTL(orientation >= EDisplayOrientationNormal);
+    TESTL(orientation < EDisplayOrientationAuto);    
+    
+    return static_cast<TRenderOrientation>(orientation);    
+    }
+
+void CTRenderOrientation::TestOrientationChangeL(const TDesC& aStepName, TTestPhase aTestPhase)
+    {
+    SetTestStepID(aStepName);
+    
+    if(EThemeOrientationChange == aTestPhase)
+        {               
+        TESTL(EDisplayOrientationNormal == GetThemeOrientationL());
+        iWindowStuff[EFirstWindowThing].Session().IndicateAppOrientation(EDisplayOrientationAuto);        
+        }
+    
+    TInt renderOrientation = GetRenderOrientationL();
+    
+    // For consistancy, check that we are starting from the same orientation
+    TESTL(EDisplayOrientationNormal == renderOrientation);    
+    
+    // Set-up the timer
+    iProfiler->InitResults();
+    iTimingsTaken = 0;    
+    
+    // repeat numerous times to get a decent average
+    for(TInt iterations=0; iterations < KNumIterations; ++iterations)
+        {
+        renderOrientation = GetRenderOrientationL();
+        // For consistancy, check that we are starting from the same orientation
+        TESTL(EDisplayOrientationNormal == renderOrientation);           
+        
+        // loop through the orientations, ending up changing back to normal
+        for(++renderOrientation; renderOrientation <= EDisplayOrientationAuto; ++renderOrientation)
+            {
+            // % can be slow, do it outside of the timing
+            TRenderOrientation testOrientation = static_cast<TRenderOrientation>(renderOrientation%EDisplayOrientationAuto);
+            
+            iWsRenderOrientationProperty.Subscribe(iRenderOrientationStatus);            
+            // start the timeout timer
+            iTimeoutTimer.After(iTimeoutStatus, KPublishTimeout);
+            // start the results timer
+            iProfiler->StartTimer();
+            
+            switch(aTestPhase)
+                {
+                case EIndicatedOrientationChange:
+                    // Do the indicated orientation Change
+                    iWindowStuff[EFirstWindowThing].Session().IndicateAppOrientation(testOrientation);
+                    break;
+                    
+                case EWindowOrdinalChange:
+                    // move the relevant window group to the front
+                    // N.B. this will go wrong if the number of orientations and windows are not equal
+                    iWindowStuff[testOrientation].WindowGroup().SetOrdinalPosition(0);
+                    break;
+                    
+                case EThemeOrientationChange:
+                    // Needs the focus window to be in auto mode
+                    iThemeOrientationProperty.Set(testOrientation);
+                    break;
+                    
+                default:
+                    TESTL(EFalse);
+                }
+        
+            // Wait for the update to have been published ( or time out while waiting )
+            User::WaitForRequest(iRenderOrientationStatus, iTimeoutStatus);
+            
+            iProfiler->MarkResultSetL();
+            ++iTimingsTaken;
+            
+            if(KErrNone != iRenderOrientationStatus.Int())
+                {
+                // timed out
+                iWsRenderOrientationProperty.Cancel();                
+                TESTL(EFalse);
+                }
+            else
+                {
+                // Check that it is actually the expected orientation
+                TESTL(GetRenderOrientationL() == testOrientation);
+                }
+
+            if(KRequestPending == iTimeoutStatus.Int())
+                {
+                // as expected, so cancel the timeout timer
+                iTimeoutTimer.Cancel();
+                }
+            else
+                {
+                // timed out
+                TESTL(EFalse);
+                }
+            }
+        }    
+    
+    // wrap it up    
+    iProfiler->ResultsAnalysis(KTRenderOrientation,KErrNotFound,ENone,ENone,iTimingsTaken);
+    }
+
+TVerdict CTRenderOrientation::doTestStepL()
+    {     
+    INFO_PRINTF1(_L("Testing: Indicated Orientation Change"));
+    TestOrientationChangeL(_L("GRAPHICS-UI-BENCH-0xxx1"), EIndicatedOrientationChange);
+    
+    INFO_PRINTF1(_L("Testing: Window Ordinal Position Change"));
+    TestOrientationChangeL(_L("GRAPHICS-UI-BENCH-0xxx2"), EWindowOrdinalChange);
+    
+    INFO_PRINTF1(_L("Testing: Theme Orientation Change"));
+    TestOrientationChangeL(_L("GRAPHICS-UI-BENCH-0xxx3"), EThemeOrientationChange);
+    
+    return TestStepResult();    
+    }
+
+_LIT(KThemeServerPropertyDefine, "twsthemeserverpropertydefine.exe");
+_LIT(KThemeServerPropertyDefineCmdDefine, "define");
+_LIT(KThemeServerPropertyDefineCmdDelete, "delete");   
+   
+void CTRenderOrientation::ThemeServerProperty(const TDesC& aCmd)
+    {
+    /* This Process called with the argument KThemeServerPropertyDefineCmdDelete, deletes 
+       the theme server RProperty. This is because an RProperty can only be defined and 
+       deleted from within a process with the same UID3 as the RProperty catogory you are 
+       trying to define/delete.*/
+    RProcess themeServerPropertyDefine;
+    TInt err = themeServerPropertyDefine.Create(KThemeServerPropertyDefine, aCmd);
+    if (KErrNone != err)
+        {
+        _LIT(KLog, "themeServerPropertyDefine.Create() failed with error: %d");
+        INFO_PRINTF2(KLog, err);
+        TEST(EFalse);        
+        }
+    
+    //wait for themeServerPropertyDefine process to terminate
+    TRequestStatus themeServerPropertyDefineLogonStatus;
+    themeServerPropertyDefine.Logon(themeServerPropertyDefineLogonStatus);
+    themeServerPropertyDefine.Resume();
+    User::WaitForRequest(themeServerPropertyDefineLogonStatus);
+    if (themeServerPropertyDefineLogonStatus != KErrNone)
+        {
+        _LIT(KLog, "themeServerPropertyDefine.Logon() failed with error: %d");
+        INFO_PRINTF2(KLog, themeServerPropertyDefineLogonStatus);
+        TEST(EFalse);        
+        }
+    themeServerPropertyDefine.Close();    
+    }
+
+TVerdict CTRenderOrientation::doTestStepPreambleL()
+    {
+    // Create in reverse order so that windowThing 0 is at the front
+    for(TInt windowThing = ENumWindowThings - 1; windowThing >= 0 ; --windowThing)
+        {
+        iWindowStuff[windowThing].ConstructL();
+        TRenderOrientation orientation = static_cast<TRenderOrientation>(windowThing%EDisplayOrientationAuto);
+        iWindowStuff[windowThing].Session().IndicateAppOrientation(orientation);
+        iWindowStuff[windowThing].WindowGroup().SetOrdinalPosition(0);
+        }
+    
+    User::LeaveIfError(iWsRenderOrientationProperty.Attach(KRenderOrientationCategory, KRenderOrientationKey));
+    
+    ThemeServerProperty(KThemeServerPropertyDefineCmdDefine);
+    User::LeaveIfError(iThemeOrientationProperty.Attach(KThemeOrientationCategory, KThemeOrientationKey));
+    
+    User::LeaveIfError(iTimeoutTimer.CreateLocal());
+    
+    return CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL();
+    }
+
+TVerdict CTRenderOrientation::doTestStepPostambleL()
+    {
+    iTimeoutTimer.Close();
+    
+    iThemeOrientationProperty.Close();
+    ThemeServerProperty(KThemeServerPropertyDefineCmdDelete);    
+    iWsRenderOrientationProperty.Close();
+    
+    for(TInt windowThing = 0; windowThing < ENumWindowThings; ++windowThing)
+        {
+        iWindowStuff[windowThing].Destroy();
+        }
+    
+    return CTe_graphicsperformanceSuiteStepBase::doTestStepPostambleL();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicstest/uibench/src/trenderorientation.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,99 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @test
+ @internalComponent - Internal Symbian test code 
+*/
+
+#ifndef TRENDERORIENTATION_H
+#define TRENDERORIENTATION_H
+
+#include <e32property.h>
+#include "te_graphicsperformanceSuiteStepBase.h"
+
+class CWindowStuff : public CBase
+    {
+public:
+    ~CWindowStuff();
+    void ConstructL();
+    void Destroy();
+
+    inline RWsSession&     Session()
+        {return iWs;};
+    inline RWindowGroup&   WindowGroup()
+        {return iWindowGroup;};
+
+private:
+    RWsSession      iWs;
+    RWindowGroup    iWindowGroup;
+    RWindow         iChildWindow;    
+    };
+
+class CTRenderOrientation : public CTe_graphicsperformanceSuiteStepBase
+    {
+public:
+    CTRenderOrientation();
+    ~CTRenderOrientation();
+
+    // From CTestStep
+    virtual TVerdict doTestStepPreambleL();
+    virtual TVerdict doTestStepPostambleL();
+    
+    virtual TVerdict doTestStepL();
+
+private:
+    enum TWindowThing
+        {
+        // One per orientation
+        EFirstWindowThing,
+        ESecondWindowThing,
+        EThirdWindowThing,
+        EFourthWindowThing,
+        
+        ENumWindowThings
+        };
+    
+    enum TTestPhase
+        {
+        EIndicatedOrientationChange,
+        EWindowOrdinalChange,
+        EThemeOrientationChange,
+        
+        ENumTestPhases
+        };    
+    
+    void TestOrientationChangeL(const TDesC& aStepName, TTestPhase aTestPhase);
+    
+    TRenderOrientation  GetRenderOrientationL();
+    TRenderOrientation  GetThemeOrientationL();
+    TRenderOrientation  GetOrientationL(RProperty& aProperty);
+    void                ThemeServerProperty(const TDesC& aCmd);
+    
+private:    
+    CWindowStuff    iWindowStuff[ENumWindowThings];
+    RProperty       iWsRenderOrientationProperty;
+    RProperty       iThemeOrientationProperty;
+    
+    RTimer          iTimeoutTimer;
+    TRequestStatus  iTimeoutStatus;
+    TRequestStatus  iRenderOrientationStatus;
+    TInt            iTimingsTaken;
+    };
+
+_LIT(KTRenderOrientation,"trenderorientation");
+
+#endif /* TRENDERORIENTATION_H */
--- a/graphicsutils/commongraphicsheaders/rom/graphics_adaptation.hby	Tue Jun 22 15:21:29 2010 +0300
+++ b/graphicsutils/commongraphicsheaders/rom/graphics_adaptation.hby	Tue Jul 20 13:27:44 2010 +0300
@@ -128,10 +128,8 @@
 	#	define FBSRASTERIZER_DRV <fbsrasterizer_stub.iby>
 	#endif
 	
-	#ifdef SYMBIAN_GRAPHICS_USE_OPENWF_MIGRATION
-	#   ifndef OPENWFCLIB_DRV
-	#       define OPENWFCLIB_DRV <openwfc_ref.iby>
-	#   endif
+	#ifndef OPENWFCLIB_DRV
+	#	define OPENWFCLIB_DRV <openwfc_ref.iby>
 	#endif
 	
 #elif SYMBIAN_GRAPHICS_ADAPTATION == SGA_MBX
@@ -215,10 +213,8 @@
 	#	define SGRESOURCE_DRV <sgresource_sw.iby>
 	#endif
 	
-	#ifdef SYMBIAN_GRAPHICS_USE_OPENWF_MIGRATION
-	#   ifndef OPENWFCLIB_DRV
-	#       define OPENWFCLIB_DRV <openwfc_ref.iby>
-	#   endif
+	#ifndef OPENWFCLIB_DRV
+	# define OPENWFCLIB_DRV <openwfc_ref.iby>
 	#endif
 	
 #else
@@ -236,6 +232,7 @@
 REM "SURFACEUPDATE DRV"    : SURFACEUPDATE_DRV
 REM "DIRECTGDI DRV"        : DIRECTGDI_DRV 
 REM "FBSRASTERIZER DRV"    : FBSRASTERIZER_DRV 
-REM "SRGREOURCE DRV"       : SGRESOURCE_DRV 
+REM "SRGRESOURCE DRV"      : SGRESOURCE_DRV 
+REM "OPENWFCLIB DRV"       : OPENWFCLIB_DRV 
 
 #endif  // __GRAPHICS_ADAPTATION_HBY__
--- a/m3g/m3gcore11/src/m3g_loader.c	Tue Jun 22 15:21:29 2010 +0300
+++ b/m3g/m3gcore11/src/m3g_loader.c	Tue Jul 20 13:27:44 2010 +0300
@@ -781,9 +781,9 @@
             isCompatible = M3G_FALSE;
             break;
         case M3G_CLASS_MESH:
-            isCompatible = (classID == M3G_CLASS_MESH)
-                || (classID == M3G_CLASS_MORPHING_MESH)
-                || (classID == M3G_CLASS_SKINNED_MESH);
+            isCompatible = (objClassID == M3G_CLASS_MESH)
+                || (objClassID == M3G_CLASS_MORPHING_MESH)
+                || (objClassID == M3G_CLASS_SKINNED_MESH);
             break;
         default:
             isCompatible = (classID == objClassID);
--- a/m3g/m3gcore11/src/m3g_sprite.c	Tue Jun 22 15:21:29 2010 +0300
+++ b/m3g/m3gcore11/src/m3g_sprite.c	Tue Jul 20 13:27:44 2010 +0300
@@ -280,7 +280,9 @@
     }
 #ifndef M3G_USE_NGL_API
     /* Store w after projection */
-    eyeSpace->w = ot.w;
+    if (eyeSpace != NULL) {
+        eyeSpace->w = ot.w;
+    }
 #endif
     m3gScaleVec4(&ot, m3gRcp(ot.w));
     m3gScaleVec4(&x, m3gRcp(x.w));
--- a/m3g/m3gcore11/src/m3g_vertexarray.c	Tue Jun 22 15:21:29 2010 +0300
+++ b/m3g/m3gcore11/src/m3g_vertexarray.c	Tue Jul 20 13:27:44 2010 +0300
@@ -643,18 +643,12 @@
 
         switch (type) {
         case M3G_BYTE:
-        case M3G_UBYTE:
             /* always padded to 4 bytes */
             array->stride = 4;
             break;
         case M3G_SHORT:
-        case M3G_USHORT:
             array->stride = size * sizeof(M3Gshort);
             break;
-        default:
-            m3gFree(m3g, array);
-            m3gRaiseError(m3g, M3G_INVALID_ENUM);
-            return NULL;
         }
 
         /* Alloc and initialize all values to zero */
--- a/m3g/m3gcore11/src/m3g_vertexbuffer.c	Tue Jun 22 15:21:29 2010 +0300
+++ b/m3g/m3gcore11/src/m3g_vertexbuffer.c	Tue Jul 20 13:27:44 2010 +0300
@@ -350,8 +350,7 @@
     if (newArray != NULL) {
     	if (buffer->arrayCount == 0 || (buffer->arrayCount == 1
                                         && change == 0)) {
-    		buffer->vertexCount =
-                (newArray != NULL ? m3gGetArrayVertexCount(newArray) : 0);
+    		buffer->vertexCount = m3gGetArrayVertexCount(newArray);
     	}
     	else if (m3gGetArrayVertexCount(newArray) != buffer->vertexCount) {
             m3gRaiseError(M3G_INTERFACE(buffer), M3G_INVALID_VALUE);
--- a/printingservices/printerdriversupport/inc/prnpath.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-// Copyright (c) 1997-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 PRNPATH_H
-#define PRNPATH_H
-
-/**
-@file 
-@internalTechnology
-@released 
-*/
-
-/* This file is copied from middleware to remove dependency on middleware */
-
-_LIT( KDefaultPrinterDriverPath, "\\resource\\printers\\" );
-
-
-#endif // PRNPATH_H
--- a/printingservices/printerdriversupport/tps/T_PDR.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/printingservices/printerdriversupport/tps/T_PDR.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -373,10 +373,8 @@
 	RFs fs;
 	ret=fs.Connect();
 	TEST(ret==KErrNone);
-#if defined(__X86GCC__)
 	_LIT(KPath,"C:\\system\\data\\");
 	fs.MkDirAll(KPath);
-#endif	//__X86GCC__
 	ret=file.Replace(fs,_L("C:\\system\\data\\WIDTHS.TMP"),EFileStream|EFileWrite);
 	if (ret!=KErrNone)
 		{
--- a/printingservices/printerdriversupport/tps/T_PDRLST.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/printingservices/printerdriversupport/tps/T_PDRLST.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -14,7 +14,7 @@
 //
 
 #include "T_PDRLST.H"
-#include "prnpath.h"
+
 
 class CTPdrLst : public CTGraphicsBase
 	{
--- a/printingservices/printerdriversupport/tps/T_PDRMEM.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/printingservices/printerdriversupport/tps/T_PDRMEM.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -14,7 +14,6 @@
 //
 
 #include "T_PDRMEM.H"
-#include "prnpath.h"
 
 _LIT( KDriveName, "z:" );
 _LIT( KEpsonFileName, "epson.pdr" );
--- a/windowing/windowserver/SERVER/openwfc/panics.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/SERVER/openwfc/panics.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2003-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"
@@ -162,6 +162,10 @@
 	EWsPanicInvalidRotation = 127,			//Invalid rotation used
 	EWsPanicInvalidPointerOffset = 128,      //The pointer offset value in wsini.ini is invalid.
 	EWsPanicArrayInsertFailed = 129,	//Array insert failed.           
+	EWsPanicAccessBeyondCommandBuf = 130,	//Access beyond wserv command buffer
+	EWsPanicKeyEventRouterBadResult = 131,		// Invalid result code from key event routing plug-in
+	EWsPanicKeyEventRouterBadWindowGroup = 132,	// Invalid destination window group from key event routing plug-in
+	EWsPanicKeyEventRouterLeave = 133,			// Invalid leave from Key event routing plug-in
 	};
 
 void Panic(TWservPanic aPanic);
--- a/windowing/windowserver/SERVER/w32cmd.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/SERVER/w32cmd.h	Tue Jul 20 13:27:44 2010 +0300
@@ -266,6 +266,7 @@
 	EWsClOpUnregisterAllTFXEffect,
 	EWsClOpOverrideEffectBuf,
 	EWsClOpOverrideEffectIPC,
+	EWsClOpIndicateAppOrientation,
 	EWsClOpLastEnumValue //Keep this at the end - used by test code
 	};
 	
@@ -1059,6 +1060,7 @@
 	const TWsClCmdRegisterEffect* RegisterEffect;
 	const TWsClCmdUnRegisterEffect* UnRegisterEffect; 
 	const TWsClCmdOverrideEffect* OverrideEffect;
+	const TRenderOrientation* Orientation;
 	};
 
 // Window command structures
@@ -2132,6 +2134,7 @@
 	// Under WINS character code is passed in as HIWORD of the scan code,
 	// and will need to be removed in some situations
 	#define __REMOVE_WINS_CHARCODE &0x0000FFFF
+	#define __WINS_CHARCODE(c)	((c) & 0xFFFF0000)
 #else
 	#define __REMOVE_WINS_CHARCODE
 #endif
--- a/windowing/windowserver/bwins/WS322U.DEF	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/bwins/WS322U.DEF	Tue Jul 20 13:27:44 2010 +0300
@@ -585,5 +585,5 @@
 	?OverrideEffects@RWsSession@@QAEXHHABV?$TBuf@$0BAA@@@00V?$TBitFlagsT@K@@@Z @ 584 NONAME ; void RWsSession::OverrideEffects(int, int, class TBuf<256> const &, class TBuf<256> const &, class TBuf<256> const &, class TBitFlagsT<unsigned long>)
 	?UnregisterEffect@RWsSession@@QAEXHHI@Z @ 585 NONAME ; void RWsSession::UnregisterEffect(int, int, unsigned int)
 	?UnregisterAllEffects@RWsSession@@QAEXXZ @ 586 NONAME ; void RWsSession::UnregisterAllEffects(void)
+	?IndicateAppOrientation@RWsSession@@QAEXW4TRenderOrientation@@@Z @ 587 NONAME ; void RWsSession::IndicateAppOrientation(enum TRenderOrientation)
 
-
--- a/windowing/windowserver/bwins/ws32switchu.def	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/bwins/ws32switchu.def	Tue Jul 20 13:27:44 2010 +0300
@@ -427,8 +427,8 @@
 	call_vector_426 @ 426 NONAME ; void RBlankWindow::SetColor(void)
 	call_vector_427 @ 427 NONAME ; int RWsSession::SetClientCursorMode(enum TPointerCursorMode)
 	call_vector_428 @ 428 NONAME ; class TRect RDrawableWindow::GetDrawRect(void) const
-	call_vector_429 @ 429 NONAME 
-	call_vector_430 @ 430 NONAME 
+	call_vector_429 @ 429 NONAME
+	call_vector_430 @ 430 NONAME
 	call_vector_431 @ 431 NONAME ; void CWindowGc::Reserved_CWindowGc_3(void)
 	call_vector_432 @ 432 NONAME ; void CWindowGc::Reserved_CWindowGc_4(void)
 	call_vector_433 @ 433 NONAME ; void CWindowGc::Reserved_CWindowGc_5(void)
@@ -512,20 +512,20 @@
 	call_vector_511 @ 511 NONAME ; int RWsSession::DebugInfo(int, int) const
 	call_vector_512 @ 512 NONAME ; unsigned long RWindowTreeNode::ClientHandle(void) const
 	call_vector_513 @ 513 NONAME ; int RWindowBase::SetBackgroundSurface(class TSurfaceId const &)
-	call_vector_514 @ 514 NONAME 
+	call_vector_514 @ 514 NONAME
 	call_vector_515 @ 515 NONAME ; class TRgb RWindowBase::KeyColor(void) const
-	call_vector_516 @ 516 NONAME 
-	call_vector_517 @ 517 NONAME 
-	call_vector_518 @ 518 NONAME 
-	call_vector_519 @ 519 NONAME 
-	call_vector_520 @ 520 NONAME 
+	call_vector_516 @ 516 NONAME
+	call_vector_517 @ 517 NONAME
+	call_vector_518 @ 518 NONAME
+	call_vector_519 @ 519 NONAME
+	call_vector_520 @ 520 NONAME
 	call_vector_521 @ 521 NONAME ; int RWindowBase::GetBackgroundSurface(class TSurfaceConfiguration &) const
-	call_vector_522 @ 522 NONAME 
+	call_vector_522 @ 522 NONAME
 	call_vector_523 @ 523 NONAME ; int RWsSession::PreferredSurfaceConfigurationSize(void) const
 	call_vector_524 @ 524 NONAME ; int RWsSession::RegisterSurface(int, class TSurfaceId const &)
-	call_vector_525 @ 525 NONAME 
+	call_vector_525 @ 525 NONAME
 	call_vector_526 @ 526 NONAME ; void RWindowBase::RemoveBackgroundSurface(int)
-	call_vector_527 @ 527 NONAME 
+	call_vector_527 @ 527 NONAME
 	call_vector_528 @ 528 NONAME ; int RWindowBase::SetBackgroundSurface(class TSurfaceConfiguration const &, int)
 	call_vector_529 @ 529 NONAME ; void RWsSession::UnregisterSurface(int, class TSurfaceId const &)
 	call_vector_530 @ 530 NONAME ; void RWindow::ClearRedrawStore(void)
@@ -585,4 +585,5 @@
 	call_vector_584 @ 584 NONAME ; void RWsSession::OverrideEffects(int, int, class TBuf<256> const &, class TBuf<256> const &, class TBuf<256> const &, class TBitFlagsT<unsigned long>)
 	call_vector_585 @ 585 NONAME ; void RWsSession::UnregisterEffect(int, int, unsigned int)
 	call_vector_586 @ 586 NONAME ; void RWsSession::UnregisterAllEffects(void)
+	call_vector_587 @ 587 NONAME ; void RWsSession::IndicateAppOrientation(enum TRenderOrientation)
 
--- a/windowing/windowserver/debuglog/DECODER.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/debuglog/DECODER.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -834,7 +834,13 @@
 		_LIT(LogGetExitHighPressureThreshold,"EWsClOpGetExitHighPressureThreshold()");
 		aText.AppendFormat(LogGetExitHighPressureThreshold);		
 		}
-		break;	
+		break;
+	case EWsClOpIndicateAppOrientation:
+	    {
+        _LIT(LogIndicateAppOrientation,"EWsClOpIndicateAppOrientation(%d)");
+        aText.AppendFormat(LogIndicateAppOrientation, *pData.Orientation);       	    
+	    }
+	    break;
 	case EWsClOpLastEnumValue:
 		{		
 		_LIT(LogLastEnumValue,"EWsClOpLastEnumValue enum");
--- a/windowing/windowserver/eabi/WS322U.DEF	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/eabi/WS322U.DEF	Tue Jul 20 13:27:44 2010 +0300
@@ -659,5 +659,5 @@
 	_ZN10RWsSession16UnregisterEffectEiij @ 658 NONAME
 	_ZN10RWsSession20UnregisterAllEffectsEv @ 659 NONAME
 	_ZN11RWindowBase15OverrideEffectsEiRK4TBufILi256EES3_S3_10TBitFlagsTImE @ 660 NONAME
+	_ZN10RWsSession22IndicateAppOrientationE18TRenderOrientation @ 661 NONAME
 
-
--- a/windowing/windowserver/group/openwfc/WServ_nga.MMP	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/group/openwfc/WServ_nga.MMP	Tue Jul 20 13:27:44 2010 +0300
@@ -74,6 +74,7 @@
 SOURCE            drawresource.cpp
 SOURCE            devicemap.cpp
 SOURCE            wsdisplaychangeao.cpp
+SOURCE            renderorientationtracker.cpp
 
 SOURCEPATH        ../../nga/SERVER/openwfc
 
--- a/windowing/windowserver/group/openwfc/bld.inf	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/group/openwfc/bld.inf	Tue Jul 20 13:27:44 2010 +0300
@@ -38,10 +38,10 @@
 ../../inc/textcursor.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(textcursor.h)
 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
 #ifdef SYMBIAN_OLD_EXPORT_LOCATION
-../../inc/Graphics/windowserverconstants.h /epoc32/include/graphics/windowserverconstants.h
+../../inc/graphics/windowserverconstants.h /epoc32/include/graphics/windowserverconstants.h
 #endif
 #endif
-../../inc/Graphics/pointereventdata.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/pointereventdata.h)
+../../inc/graphics/pointereventdata.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/pointereventdata.h)
 ../../inc/W32ADLL.H SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(w32adll.h)
 ../../inc/W32CLICK.H SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(w32click.h)
 ../../inc/W32STDGRAPHIC.H SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(w32stdgraphic.h)
@@ -59,26 +59,27 @@
 ../../eabi/wsclicku.def  /epoc32/include/def/eabi/wsclicku.def
 
 //Graphic Drawer exports for partners
-../../inc/Graphics/WSGRAPHICDRAWER.H SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsgraphicdrawer.h)
-../../inc/Graphics/openwfc/WSGRAPHICDRAWERINTERFACE.H SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsgraphicdrawerinterface.h)
-../../inc/Graphics/WSGRAPHICMSGBUF.H SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsgraphicmsgbuf.h)
-../../inc/Graphics/W32STDGRAPHICTEST.H SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/w32stdgraphictest.h)
+../../inc/graphics/WSGRAPHICDRAWER.H SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsgraphicdrawer.h)
+../../inc/graphics/openwfc/WSGRAPHICDRAWERINTERFACE.H SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsgraphicdrawerinterface.h)
+../../inc/graphics/WSGRAPHICMSGBUF.H SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsgraphicmsgbuf.h)
+../../inc/graphics/W32STDGRAPHICTEST.H SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/w32stdgraphictest.h)
 
 //Plugin exports for partners
-../../inc/Graphics/WSPLUGIN.H SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsplugin.h)
-../../inc/Graphics/WsRenderStage.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsrenderstage.h)
-../../inc/Graphics/WsRenderStageFactory.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsrenderstagefactory.h)
-../../inc/Graphics/wscursor.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wscursor.h)
-../../inc/Graphics/wsgraphicscontext.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsgraphicscontext.h)
-../../inc/Graphics/wsscreendevice.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsscreendevice.h)
-../../inc/Graphics/wsuibuffer.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsuibuffer.h)
-../../inc/Graphics/wsdrawablesourceprovider.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsdrawablesourceprovider.h)
-../../inc/Graphics/wsdisplaycontrol.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsdisplaycontrol.h)
-../../inc/Graphics/openwfc/wsdisplaymapping.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsdisplaymapping.h)
-../../inc/Graphics/wsdisplaypolicy.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsdisplaypolicy.h)
-../../inc/Graphics/openwfc/wselement.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wselement.h)
-../../inc/Graphics/openwfc/wsscene.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsscene.h)
-../../inc/Graphics/wscontentreadyforcomposition.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wscontentreadyforcomposition.h)
+../../inc/graphics/WSPLUGIN.H SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsplugin.h)
+../../inc/graphics/WsRenderStage.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsrenderstage.h)
+../../inc/graphics/WsRenderStageFactory.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsrenderstagefactory.h)
+../../inc/graphics/wscursor.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wscursor.h)
+../../inc/graphics/wsgraphicscontext.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsgraphicscontext.h)
+../../inc/graphics/wsscreendevice.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsscreendevice.h)
+../../inc/graphics/wsuibuffer.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsuibuffer.h)
+../../inc/graphics/wsdrawablesourceprovider.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsdrawablesourceprovider.h)
+../../inc/graphics/wsdisplaycontrol.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsdisplaycontrol.h)
+../../inc/graphics/openwfc/wsdisplaymapping.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsdisplaymapping.h)
+../../inc/graphics/wsdisplaypolicy.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsdisplaypolicy.h)
+../../inc/graphics/openwfc/wselement.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wselement.h)
+../../inc/graphics/openwfc/wsscene.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsscene.h)
+../../inc/graphics/wskeyrouter.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wskeyrouter.h)
+../../inc/graphics/wscontentreadyforcomposition.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wscontentreadyforcomposition.h)
 
 //RemoteGc exports for partners
 ../../inc/RemoteGc.h		SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/remotegc.h)
@@ -86,21 +87,21 @@
 ../../inc/RemoteGcUtils.h	SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/remotegcutils.h)
 
 //Test Screen Capture
-../../inc/Graphics/testscreencapture.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/testscreencapture.h)
-../../inc/Graphics/wsscreendeviceutils.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsscreendeviceutils.h)
-../../inc/Graphics/wstestscreencapture.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wstestscreencapture.h)
+../../inc/graphics/testscreencapture.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/testscreencapture.h)
+../../inc/graphics/wsscreendeviceutils.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsscreendeviceutils.h)
+../../inc/graphics/wstestscreencapture.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wstestscreencapture.h)
 
-../../inc/Graphics/wsdrawresource.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsdrawresource.h)
+../../inc/graphics/wsdrawresource.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/wsdrawresource.h)
 
 #ifdef SYMBIAN_BUILD_GCE
 //Surface support
-../../inc/Graphics/surfaceconfiguration.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/surfaceconfiguration.h)
-../../inc/Graphics/openwfc/surfaceconfiguration.inl SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/surfaceconfiguration.inl)
+../../inc/graphics/surfaceconfiguration.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/surfaceconfiguration.h)
+../../inc/graphics/openwfc/surfaceconfiguration.inl SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/surfaceconfiguration.inl)
 //Display Control
-../../inc/Graphics/displaycontrol.h	SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/displaycontrol.h)
+../../inc/graphics/displaycontrol.h	SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/displaycontrol.h)
 
 //Display Mapping
-../../inc/Graphics/displaymapping.h	SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/displaymapping.h)
+../../inc/graphics/displaymapping.h	SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/displaymapping.h)
 
 
 #endif // SYMBIAN_BUILD_GCE
@@ -201,6 +202,7 @@
 #ifdef SYMBIAN_BUILD_GCE
 ../../group/AUTODLL_nga.MMP support
 ../../test/TAutoServer/openwfc/TAutoServer_nga.mmp
+../../test/TAutoServer/tevent_captureapp.mmp
 #endif
 
 #ifdef WINS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/group/twsthemeserverpropertydefine.mmp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,33 @@
+// Copyright (c) 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:
+// This .exe is to define an RProperty for simulating the Theme Server.
+// It needs to have the same UID3 as the theme server.
+//
+
+TARGET			twsthemeserverpropertydefine.exe
+CAPABILITY 		WriteDeviceData ReadDeviceData
+TARGETTYPE		EXE
+//The UID3 value should be the same as the actual Theme Server UID3
+UID		0x00000000 0x20022E82 
+VENDORID 0x70000001
+
+SOURCEPATH		../test/tauto
+SOURCE			themeserverpropertydefine.cpp
+
+USERINCLUDE		../inc ../test/tauto
+OS_LAYER_SYSTEMINCLUDE
+
+LIBRARY			euser.lib ws32.lib bafl.lib
+
+SMPSAFE
\ No newline at end of file
Binary file windowing/windowserver/group/wservu_multiscreen.ini has changed
Binary file windowing/windowserver/group/wservu_multiscreen_changetracking.ini has changed
--- a/windowing/windowserver/inc/Graphics/W32STDGRAPHICTEST.H	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Test CWsGraphic plugins
-// 
-//
-
-#ifndef __W32STDGRAPHICTEST_H__
-#define __W32STDGRAPHICTEST_H__
-
-#include <w32std.h>
-
-class TWsGraphicFrameRate: public TWsGraphicMsgFixedBase
-/** data attached to a CWindowGc::DrawWsGraphic to encourage the artwork to display
-	an approximate framerate as it animates, if available
-	@publishedPartner
-	@released
-*/	{
-public:
-	enum
-		{
-		ETypeId = 0x10281AAF
-		};
-	IMPORT_C TWsGraphicFrameRate();
-	};
-
-NONSHARABLE_CLASS(CWsGraphicTestFrameRate): public CWsGraphic
-/** Client representation of a test anim that displays its frame-rate
-
-@publishedPartner
-@released
-*/
-	{
-public:
-	IMPORT_C static CWsGraphicTestFrameRate* NewL();
-	IMPORT_C static CWsGraphicTestFrameRate* NewL(TUid aUid);
-	IMPORT_C static CWsGraphicTestFrameRate* NewL(const TWsGraphicId& aReplace);
-	IMPORT_C ~CWsGraphicTestFrameRate();
-public: // protected virtuals from CWsGraphic promoted to public
-	using CWsGraphic::ShareGlobally;
-	using CWsGraphic::UnShareGlobally;
-	using CWsGraphic::Share;
-	using CWsGraphic::UnShare;
-private:
-	CWsGraphicTestFrameRate();
-	void HandleMessage(const TDesC8& aData);
-	void OnReplace();
-};
-
-#endif //__W32STDGRAPHICTEST_H__
--- a/windowing/windowserver/inc/Graphics/WSGRAPHICDRAWER.H	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,218 +0,0 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Server-side base-classes for graphic drawer plugins
-// 
-//
-
-#ifndef __WSGRAPHICDRAWER_H__
-#define __WSGRAPHICDRAWER_H__
-
-#include <e32base.h>
-#include <e32std.h>
-
-#include <graphics/wsgraphicdrawerinterface.h>
-
-class CFbsBitGc;
-class TSurfaceId;
-
-NONSHARABLE_STRUCT(TGraphicDrawerId)
-/** Represents a graphic drawer on the window-server side
-A much-abridged version of TWsGraphicId, with trivial constructor
-@publishedPartner
-@released
-*/	{
-	TInt iId;
-	TBool iIsUid;
-	IMPORT_C TInt Compare(const TGraphicDrawerId& aOther) const;
-	IMPORT_C static TInt Compare(const TGraphicDrawerId& aFirst,const TGraphicDrawerId& aSecond);
-	};
-
-/** Wserv event representation to plugin side
-
-@publishedPartner
-@released
-*/
-NONSHARABLE_STRUCT(TWservCrEvent)
-	{
-public:
-	/** Type of wserv events which plugin can listen to. It is a mask that can be combined
-	when subscribing to notification. */
-	enum
-		{
-		EScreenSizeModeChanged		= 0x00000001,
-		EWindowVisibilityChanged 	= 0x00000002,
-		EDsaDrawingBegin			= 0x00000004,
-		EDsaDrawingEnd				= 0x00000008,
-		EScreenSizeModeAboutToChange= 0x00000010,
-		EScreenUpdated				= 0x00000020,
-		EScreenDrawing				= 0x00000040,
-		EWindowGroupChanged			= 0x00000080,
-		EScreenOrientationChanged	= 0x00000100,
-		EDeviceOrientationChanged	= 0x00000200,
-		EWindowClosing              = 0x00000400,
-		ESurfaceUnreferenced		= 0x00000800,
-		};
-public:
-	IMPORT_C TWservCrEvent(TUint32 aType);
-	IMPORT_C TWservCrEvent(TUint32 aType, TUint32 aInfo);
-	IMPORT_C TWservCrEvent(TUint32 aType, TUint32 aInfo, TAny* aData);
-	IMPORT_C TWservCrEvent(TUint32 aType, TUint32 aInfo, TAny* aData, MWsWindow* aWindow);
-
-	/** Returns wserv event type */
-	IMPORT_C TUint32 Type() const;
-	/** Returns current wserv screen size mode as the result of event EScreenSizeModeChanged.
-	Screen mode is 0,1,2,...
-	*/
-	IMPORT_C TInt SizeMode() const;
-	/** Returns visibile region as the result of event EWindowVisibilityChanged, this region represents
-	full or some part of window which is changing visibility. NULL if window is becoming not visible
-	completely.
-	*/
-	IMPORT_C const RRegion* VisibleRegion() const;
-	/** Returns screen number where a DSA, screen updated or window group changed event occurs
-	*/
-	IMPORT_C TInt ScreenNumber() const;
-	/** Returns the drawing region which is referred to by an EScreenDrawing
-	*/
-	IMPORT_C const TRegion* DrawingRegion() const;
-	/** Returns the new window group identifier where a window group changed event occurs
-	*/
-	IMPORT_C TInt WindowGroupIdentifier() const;
-	/** Returns the new window server display oriention
-	*/
-	IMPORT_C CFbsBitGc::TGraphicsOrientation Orientation() const;
-	/** Returns whether or not a window was already visible before a visibility event occurred
-	*/
-	IMPORT_C TBool WasVisible() const;
-	/** Returns the window this event is for.  This may be null.
-	@prototype
-	*/
-	IMPORT_C MWsWindow* Window() const;	
-	/** Returns the released surface ID
-	*/
-	IMPORT_C const TSurfaceId* SurfaceId() const;
-
-private:
-	TWservCrEvent() {}
-	
-private:
-	TUint32 iType;
-	TUint32 iInfo;
-	TAny* iData;
-	MWsWindow* iWindow;
-	TInt iReserved[7];
-	};
-
-/** Event notification callback. Need to be implemented to allow CWsGraphicDrawer to listen to
-wserv events.
-
-@publishedPartner
-@released
-*/
-class MWsEventHandler
-	{
-public:
-	/** Plugin event handler, will be called once for each event.
-	*/
-	virtual void DoHandleEvent(const TWservCrEvent& aEvent) = 0;
-	};
-
-/**
-Implementing this interface will give a callback notification wheater a
-graphic message which was sent has either failed or succeded.
-@publishedPartner
-@prototype
-*/
-class MWsGraphicMessageCallback : public MWsObjectProvider
- 	{
-public:
- 	DECLARE_WS_TYPE_ID(KWsGraphicMessageCallbackInterfaceId)
-
-public:
- 	/**
- 	Called with unique ID of the message, aError will be set to KErrNone if message delivery is
- 	successful, otherwise one of the system-wide error code.
- 	*/
- 	virtual void HandleMessageDelivery(TInt aMessageId, TInt aError) = 0;
- 	};
-
-/**
-Implementing this interface will give you the possibility to send synchron messages with a returnvalue to the client.
-@publishedPartner
-@prototype
-*/
-class MWsGraphicHandleSynchronMessage: public MWsObjectProvider
- 	{
-public:
- 	DECLARE_WS_TYPE_ID(KWsGraphicHandleSynchronMessageId)
-
-public:
- 	/**
-	Synchron handlemessage method.
-	*/
-	virtual TInt HandleSynchronMessage(const TDesC8& aData) = 0;
-	};
-
-
-class CWsGraphicDrawer: public CBase, public MWsObjectProvider
-/** A window-server-side peer to a CWsGraphic
-@publishedPartner
-@released
-*/	{
-public:
-	/** This function should be overriden by all derived classes.  The first call the implementation of this function
-		should make is to BaseConstructL().
-		@param aEnv the environment this drawer exists in
-		@param aId the ID of this drawer
-		@param aOwner the client session that owns this drawer
-		@param aData arbitrary data for constructing this instance, sent from the client.
-	*/
-	virtual void ConstructL(MWsGraphicDrawerEnvironment& aEnv,const TGraphicDrawerId& aId,MWsClient& aOwner,const TDesC8& aData) = 0;
-	IMPORT_C ~CWsGraphicDrawer();
-	IMPORT_C const TGraphicDrawerId& Id() const;
-	IMPORT_C const MWsClient& Owner() const;
-	IMPORT_C TBool IsSharedWith(TSecureId aClientId) const;
-	IMPORT_C TInt ShareGlobally();
-	IMPORT_C TInt UnShareGlobally();
-	IMPORT_C TInt Share(TSecureId aClientId);
-	IMPORT_C TInt UnShare(TSecureId aClientId);
-	IMPORT_C void Draw(MWsGc& aGc,const TRect& aRect,const TDesC8& aData) const;
-	IMPORT_C TBool Contains(const TArray<TGraphicDrawerId>& aIds) const;
-	virtual void HandleMessage(const TDesC8& aData) = 0;
-	IMPORT_C void HandleEvent(const TWservCrEvent& aEvent);
-	IMPORT_C void SetEventHandler(MWsEventHandler* aHandler);
-	IMPORT_C TBool HasEventHandler() const;
-protected:
-	IMPORT_C CWsGraphicDrawer();
-	IMPORT_C void BaseConstructL(MWsGraphicDrawerEnvironment& aEnv,const TGraphicDrawerId& aId,MWsClient& aOwner);
-	IMPORT_C MWsGraphicDrawerEnvironment& Env();
-	IMPORT_C const MWsGraphicDrawerEnvironment& Env() const;
-	IMPORT_C TInt SendMessage(const TDesC8& aData);
-	IMPORT_C TInt SendMessage(CWsMessageData& aData);
-	IMPORT_C void Invalidate();
-private:
-	IMPORT_C virtual TBool HasAsChild(const TArray<TGraphicDrawerId>& aIds) const;
-	virtual void DoDraw(MWsGc& aGc,const TRect& aRect,const TDesC8& aData) const = 0;
-private:
-	class CPimpl;
-	friend class CPimpl;
-	CPimpl* iPimpl;
-	TInt iWsGraphicDrawerSpare[3];
-private:
-	friend class WsGraphicDrawer;
-	TUid iDtor_ID_Key;
-	};
-
-
-#endif //#ifndef __WSGRAPHICDRAWER_H__
--- a/windowing/windowserver/inc/Graphics/WSGRAPHICMSGBUF.H	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef __WSGRAPHICMSGBUF_H__
-#define __WSGRAPHICMSGBUF_H__
-
-#include <e32std.h>
-
-class TWsGraphicMsgBufParser
-/** Utility class for parsing incoming data associated with individual draw commands
-@see CWindowGc::DrawWsGraphic
-@see RWsGraphicMsgBuf
-@publishedPartner
-@released
-*/	{
-public:
-	IMPORT_C TWsGraphicMsgBufParser(const TDesC8& aData);
-	IMPORT_C TInt Verify() const;
-	IMPORT_C TInt Count() const;
-	IMPORT_C TUid Uid(TInt aIndex) const;
-	IMPORT_C TPtrC8 Data(TInt aIndex) const;
-	IMPORT_C TInt Find(TUid aUid,TInt aStartingFrom = 0) const;
-	IMPORT_C TBool LoadFixed(TUid aUid,TAny* aMsg,TInt aMsgSize,TInt aStartingFrom = 0) const;
-protected:
-	TInt IntAt(TInt aOfs) const;
-protected:
-	const TDesC8& iData;
-	};
-
-class TWsGraphicMsgAnimation
-/** Utility class for parsing incoming TWsGraphicAnimation messages
-@see CWindowGc::DrawWsGraphic
-@see RWsGraphicMsgBuf
-@publishedPartner
-@released
-*/	{
-public:
-	IMPORT_C TWsGraphicMsgAnimation();
-	IMPORT_C TInt Load(const TWsGraphicMsgBufParser& aData);
-	IMPORT_C TInt Load(const TWsGraphicMsgBufParser& aData,TInt aIndex);
-	IMPORT_C TTimeIntervalMicroSeconds AnimationTime(const TTime& aNow,const TTimeIntervalMicroSeconds& aAnimationLength) const;
-	IMPORT_C TBool IsPlaying(const TTime& aNow,const TTimeIntervalMicroSeconds& aAnimationLength) const;
-private:
-	enum
-		{
-		// animation state in lowest nibble
-		EStopped	= 0x00,
-		EPlaying	= 0x01,
-		EStopping	= 0x02,
-		EPaused		= 0x03,
-		EStateMask	= 0x0F,
-		// other flags above
-		ELoop		= 0x10
-		};
-	TUint iFlags;
-	TTime iPlay;
-	TTime iPauseOrStopping;
-	};
-
-#endif //__WSGRAPHICMSGBUF_H__
--- a/windowing/windowserver/inc/Graphics/WSPLUGIN.H	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Server-side base-classes for graphic drawer plugins
-// 
-//
-
-#ifndef __WSPLUGIN_H__
-#define __WSPLUGIN_H__
-
-#include <e32base.h>
-#include <e32std.h>
-
-#include <graphics/wsgraphicdrawerinterface.h>
-
-/**
-Window Server interface to the Window Server plugin API.
-
-@publishedPartner
-@prototype
-*/
-class CWsPlugin : public CBase, public MWsObjectProvider
-	{
-private:
-	class CPimpl;
-	friend class CPimpl;
-
-public:
-	/**
-	This function should be overriden by all derived classes.  The first
-	call the implementation of this function should make is to BaseConstructL().
-	@param aEnv 	the environment this drawer exists in
-	@param aData 	arbitrary data for constructing this instance, sent from
-					the client.
-	*/
-	virtual void ConstructL(MWsGraphicDrawerEnvironment& aEnv,const TDesC8& aData) = 0;
-	IMPORT_C ~CWsPlugin();
-	IMPORT_C virtual const TDesC & PluginName() const;
-
-	static TInt DtorIDKeyOffset() { return _FOFF(CWsPlugin,iDtor_ID_Key); }
-	
-protected:
-	IMPORT_C CWsPlugin();
-	IMPORT_C void BaseConstructL(MWsGraphicDrawerEnvironment& aEnv);
-	IMPORT_C MWsGraphicDrawerEnvironment& Env();
-	IMPORT_C const MWsGraphicDrawerEnvironment& Env() const;
-
-private:
-	CWsPlugin(const CWsPlugin &); // no implementation
-	CWsPlugin & operator=(const CWsPlugin &); // no implementation
-	
-private:
-	TUid iDtor_ID_Key;
-	CPimpl* iPimpl;
-	};
-
-
-#endif //#ifndef __WSPLUGIN_H__
--- a/windowing/windowserver/inc/Graphics/WsRenderStage.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Interface for window server render stages.
-// 
-//
-
-#ifndef __WSRENDERSTAGE_H__
-#define __WSRENDERSTAGE_H__
-
-#include <e32base.h>
-#include <graphics/wsgraphicdrawerinterface.h>
-
-class CFbsBitGc;
-
-/**
-This API declares the window server interface to the Render Stage Pipeline.
-@publishedPartner
-@prototype
-*/
-class CWsRenderStage : public CBase, public MWsObjectProvider
-	{
-private:
-	class CPimpl;
-	
-public: // pure virtuals
-#ifdef SYMBIAN_GRAPHICS_GCE
-	/**
-	Signal to the render stage to perform intitialisation prior to a batch
-	of draw ops
-	@param	aRegion	The dirty region for which drawing will be issued.
-					The caller guarantees that same dirty region applies
-					across a matched set of Begin and End calls.  The
-					render stage may pass a different dirty region to
-					child render stages, but it must guarantee the same
-					dirty region applies across a matched set of Begin and
-					End calls.
-	*/
-	virtual void Begin(const TRegion* aRegion) = 0;
-	
-	/**
-	Completes a pass of this render stage.
-	@param aFinished If not NULL, then this is signalled when the next
-					(down stream) render stage is ready to receive further
-					updates.
-	@note 			It is valid to call MWsAnimationScheduler::Animate() again,
-					before aFinished has been signalled, but the render stage
-					pipeline may not be ready to receive updates at that time.
-	*/
-	virtual void End(TRequestStatus* aFinished) = 0;
-#else //SYMBIAN_GRAPHICS_GCE
-	/**
-	Returns the GC to use for drawing in this render stage:
-	*/
-	virtual CFbsBitGc * Begin() = 0;
-	
-	/**
-	Completes a pass of this render stage:
-	*/
-	virtual void End() = 0;
-#endif //SYMBIAN_GRAPHICS_GCE
-
-public:
-	/** Destructor */
-	IMPORT_C virtual ~CWsRenderStage();
-	
-	/**
-	Returns the next render stage in the pipeline:
-	*/
-	IMPORT_C virtual CWsRenderStage * Next();
-
-	/**
-	Sets the next render stage in the pipeline:
-	*/
-	IMPORT_C virtual void SetNext(CWsRenderStage * aNext);
-	
-	/**
-	Returns extended functionality.
-	@param	aTypeId	interface extension type specifier
-	@return an interface implementation, if the interface ID is implemented by
-			the render stage, otherwise passes the call on to the next render
-			stage in the pipeline.  The last render stage returns NULL if no 
-			render stage in the pipeline implements the specified extension.
-	*/
-	IMPORT_C virtual TAny * ResolveObjectInterface(TUint aTypeId);
-
-protected:	
-	/** Constructor */
-	IMPORT_C CWsRenderStage();
-	
-	/**
-	Second phase construction.  Must be called from derived class construction sequence.
-	*/
-	IMPORT_C void BaseConstructL();
-	
-private:
-	CWsRenderStage(const CWsRenderStage &); // no implementation
-	CWsRenderStage & operator=(const CWsRenderStage &); // no implementation
-
-private:
-	CPimpl * iPimpl;
-	};
-
-#endif //__WSRENDERSTAGE_H__
--- a/windowing/windowserver/inc/Graphics/WsRenderStageFactory.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Interface for creating render stages for the window server
-// 
-//
-
-#ifndef __WSRENDERSTAGEFACTORY_H__
-#define __WSRENDERSTAGEFACTORY_H__
-
-#include <graphics/wsgraphicdrawerinterface.h>
-
-class CWsRenderStage;
-
-/**
-Window server interface to allow creation of a render stage pipeline.
-
-@publishedPartner
-@prototype
-*/
-class MWsRenderStageFactory : public MWsObjectProvider
-	{
-public:
- 	DECLARE_WS_TYPE_ID(KMWsRenderStageFactory)
- 	
-public:
-#ifdef SYMBIAN_GRAPHICS_GCE
-	/**
-	Create a render stage which has no further render stages below it.
-	*/
-	virtual CWsRenderStage* CreateFinalRenderStageL(MWsScreen* aScreen, MWsScreenRedraw* aScreenRedraw, TInt aScreenNumber) = 0;
-	
-	/**
-	Create a render stage which has a render stage below it.
-	*/
-	virtual CWsRenderStage* CreateRenderStageL(MWsScreen* aScreen, MWsScreenRedraw* aScreenRedraw, CWsRenderStage* aNextStage) = 0;
-#else //SYMBIAN_GRAPHICS_GCE
-	/**
-	*/
-	virtual CWsRenderStage * CreateStageL(MWsScreen * aScreen, MWsScreenRedraw * aScreenRedraw) = 0;
-#endif //SYMBIAN_GRAPHICS_GCE
-	};
-	
-#endif //__WSRENDERSTAGEFACTORY_H__
--- a/windowing/windowserver/inc/Graphics/displaycontrol.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef DISPCTRL_CLIENT_H_
-#define DISPCTRL_CLIENT_H_
-
-#include <graphics/displaycontrolbase.h>
-
-/**
- * Window Server client interface for display control.
- * 
- * All functions in MDisplayControlBase will automatically flush the client-server
- * session buffer as part of their behavior.
- * 
- * Setting the display configuration successfully shall cause the screen mode
- * index to change to one of the last two entries (dependent on rotation) and that
- * mode's size information shall be updated as necessary.
- * 
- * @publishedPartner
- * @prototype
- */
-class MDisplayControl : public MDisplayControlBase
-	{
-public:
-	enum	
-		{
-		KUidDisplayControl =  0x10286499, 	  //To    0x1028649A
-		ETypeId=	 KUidDisplayControl 
-		};
-public:
-	/** 
-	 * Returns whether changes in the display will trigger an EEventDisplayChanged 
-	 * event to be issued.
-	 *
-	 * Events will be triggered configuration changes that have taken place on 
-	 * the display, when a display has been connected / disconnected (if it can be 
-	 * detected), and when the available resolutions change.
-	 *
-	 * This function always causes a flush of the window server buffer.
-	 *	
-	 * @return ETrue if display change events are enabled, EFalse otherwise
-	 */
-	virtual TBool DisplayChangeEventsEnabled() const =0;
-	/** 
-	 * Determines whether changes in the display will trigger an EEventDisplayChanged 
-	 * event to be issued.
-	 * 
-	 * @see DisplayChangeEventsEnabled
-	 * 
-	 * @param aEnable ETrue to enable display change events, EFalse to disable them
-	 */	
-	virtual void EnableDisplayChangeEvents(TBool aEnable) =0;
-	};
-
-
-#endif /*DISPCTRL_CLIENT_H_*/
--- a/windowing/windowserver/inc/Graphics/displaymapping.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @publishedPartner
- @prototype
-*/
-
-#ifndef DISPMAP_CLIENT_H_
-#define DISPMAP_CLIENT_H_
-#include <w32std.h>
-
-/** Defines the coordinate space UID values for use with
-	MDisplayMappingBase::MapCoordinates().
-*/
-enum TCoordinateSpace
-		{
-	/**
-		Application coordinate space, possibly offset but not scaled
-		relative to full-screen space.
-	 */
-	EApplicationSpace = 0x1028656F,
-	/**
-		User interface coordinate space, possibly scaled but not offset
-		relative to composition space.
-	*/
-	EFullScreenSpace = 0x10286570,
-	/**
-		Composition coordinate space, used by composition back-end in
-		compositing the display contents.
-	*/
-	ECompositionSpace = 0x10286571,
-	/**
-		Coordinate space for the DSA buffer. May be offset but not scaled
-		relative to both application and full-screen spaces. Identical to
-		full-screen space if the DSA buffer is used for UI rendering.
-	*/
-	EDirectScreenAccessSpace = 0x1028656E
-	};
-
-/** Provides facilities to map coordinates between various coordinate
-	spaces.
-
-*/
-class MDisplayMappingBase
-	{
-public:
-	enum	
-		{
-		KUidDisplayMappingBase =  0x1028656D, 	  
-		ETypeId=	 KUidDisplayMappingBase 
-		};
-public:
-	/** Maps the source rectangle from a source coordinate space to a
-		target coordinate space. Since there may be scaling involved, the
-		target rectangle may be larger or smaller than the source one, or
-		even become empty.
-
-		Two rectangles that abut each other before mapping, when mapped
-		using the same source and target space UIDs, shall also abut each
-		other after mapping.
-
-		@param aSourceSpace source space
-		@param aSource source rectangle
-		@param aTargetSpace target space
-		@param aTarget target rectangle to be filled in
-		@return KErrNone if successful or KErrNotSupported if invalid TCoordinateSpace
-	*/
-	virtual TInt MapCoordinates(TCoordinateSpace aSourceSpace, const TRect& aSource, TCoordinateSpace aTargetSpace, TRect& aTarget) const =0;
-	};
-
-/** Provides the Window Server client coordinate space mapping
-	functions.
-
-*/
-class MDisplayMapping : public MDisplayMappingBase
-	{
-public:
-	enum	
-		{
-		KUidDisplayMapping =  0x1028656B, 	  
-		ETypeId=	 KUidDisplayMapping 
-		};
-public:
-	/** Retrieves the largest window extent that is visible at the current
-		display resolution. This may be larger than the size reported by
-		SizeInPixels(), and have a negative top-left position, for example.
-
-		@see MDisplayControl
-		@see CWsScreenDevice::SizeInPixels
-
-	 	@param aExtent extent to be filled in
-	*/
-	virtual void GetMaximumWindowExtent(TRect& aExtent) const =0;
-	/** Returns the maximum useful size for a surface to be shown on the
-		display at the current resolution, in both pixels and twips.
-
-		This may be larger than both the screen device SizeInPixels() and
-		the size of the maximum window extent, if the user interface is
-		being scaled by the display. In general, the value will be the
-		native display resolution.
-
-		@see MDisplayControl
-		@see CWsScreenDevice::SizeInPixels
-		
-		@param aPixels pixels to be filled in
-		@param aTwips twips to be filled in
-	*/
-	virtual void GetMaximumSurfaceSize(TSize& aPixels, TSize& aTwips) const =0;
-	/** Retrieves the extent of a window relative to the top-left corner of
-		the display.
-
-		This will differ from the window's AbsPosition() if the current
-		screen size mode is offset from the corner of the display, or if
-		the user interface is being scaled on the display.
-
-		@param aWindow window in question
-		@param aExtent extent to be filled in
-	*/
-	virtual void GetDisplayExtentOfWindow(const RWindowBase& aWindow, TRect& aExtent) const =0;
-	};
-
-
-
-#endif 	/*DISPMAP_CLIENT_H_*/
--- a/windowing/windowserver/inc/Graphics/openwfc/WSGRAPHICDRAWERINTERFACE.H	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1413 +0,0 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// WSGRAPHICDRAWERINTEFACE.H
-// Server-side base-classes for graphic drawer plugins
-// 
-//
-
-#ifndef __WSGRAPHICDRAWERINTEFACE_H__
-#define __WSGRAPHICDRAWERINTEFACE_H__
-
-#include <e32base.h>
-#include <w32std.h>
-#include <gdi.h>
-#include <bitstd.h>
-
-class CWsGraphicDrawer;
-struct TGraphicDrawerId;
-class MWsEventHandler;
-class CWsGraphicMessageQueue;
-class CWsClient;
-class CWsWindow;
-
-#if !defined(SYMBIAN_GRAPHICS_GCE)
-	class MWsFlickerFreeBufferObserver;
-#endif
-
-class MWsScreenRedrawObserver;
-class MWsMemoryRelease;
-class MEventHandler;
-class MWsElement;
-class MWsGraphicsContext;
-
-/** 
-@publishedPartner
-@released
-*/
-enum TWinType
-	{
-	EWinTypeClient,
-	EWinTypeRoot,
-	EWinTypeGroup,
-	};
-
-/** Declares an object type, ETypeId, for a class, in order to allow the WSERV object
-provider mechanism to locate and provide objects from the class.
-@publishedPartner
-@released
-@see MWsObjectProvider */
-#define DECLARE_WS_TYPE_ID(id) enum { EWsObjectInterfaceId = id };
-
-class MWsObjectProvider
-/** A class for dynamic extension of object instances
-	WSERV classes which wish to allow dynamic extension show derive those
-	extensions from MWsObjectProvider and use the DECLARE_WS_TYPE_ID macro
-	Similiar in principle and operation to CONE's MObjectProvider
-	@publishedPartner
-	@released
-	@see MObjectProvider
-*/	{
-public:
-	template<class T>
-	T* ObjectInterface()
-	/** Gets an object of the type defined by the template parameter.
-
-	@return A pointer to an object of the type required, or NULL if none can be
-	found. */
-		{ return (T*)ResolveObjectInterface(T::EWsObjectInterfaceId); }
-	/** Gets an object of the type defined by the template parameter.
-	@return A pointer to a const object of the type required, or NULL if none can be
-	found. */
-	template<class T>
-	const T* ObjectInterface() const
-		{ return (T*)const_cast<MWsObjectProvider*>(this)->ResolveObjectInterface(T::EWsObjectInterfaceId); }
-	/** Resolve an instance of an interface
-	should be overriden by implementations when they have custom interfaces to provide. */
-	IMPORT_C virtual TAny* ResolveObjectInterface(TUint aTypeId);
-	};
-
-class MWsScreen: public MWsObjectProvider
-/** A destination for a drawing occasion of a CWsGraphicDrawer
-	Used by animation schedulers to update screens
-	@publishedPartner
-	@released
-*/	{
-public:
-	using MWsObjectProvider::ResolveObjectInterface;
-	
-private:
-	friend class MWsAnimationScheduler;
-#if !defined(SYMBIAN_GRAPHICS_GCE)
-	/** Called by the MWsAnimationScheduler when scheduled animation is to be serviced
-		
-		WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.
-
-		@released */
-	virtual void OnAnimation() = 0;
-#else
-	/** Called by the MWsAnimationScheduler when a scheduled animation is to be serviced.
-		@param aFinished If not NULL then this is signalled when the animation has 
-		been processed and further animations may be submitted. An animation may be
-		submitted prior to signalling, but the render stage pipeline may not be ready
-		to process it. 
-		
-		WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.
-
-		@released */
-	virtual void OnAnimation(TRequestStatus* aFinished) = 0;
-#endif
-	/** Called by the MWsAnimationScheduler when the screen needs to be redrawn in its entirity
-		
-		WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.
-
-		@released */
-	virtual void Redraw() = 0;
-	/** Called by MWsAnimationScheduler when the any parts of the screen that potentially contain
-		commands to draw graphics in the list of IDs passed need to be redrawn
-		@param aInvalid the list of IDs that are invalid
-		@return whether the screen did any redrawing
-		
-		WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.
-
-		@released */
-	virtual TBool RedrawInvalid(const TArray<TGraphicDrawerId>& aInvalid) = 0;
-	};
-
-class MWsAnimationScheduler: public MWsObjectProvider
-/** A system mechanism for customising the animation timer to a particular hardware variant or to a
-	particular external compositor e.g. an out-of-scene transition engine.
-	The default animation scheduler in WSERV does not understand device-dependant parameters e.g.
-	screen refresh rates
-	@publishedPartner
-	@released
-	to be adapted when WSERV migrates to surfaces
-*/	{
-public:
-	/** Called to schedule an animation event for a screen to occur not before some point
-	A screen may be scheduled to animate several times without actually receiving an animation event from the scheduler
-	If the scheduler cannot honour the request e.g. device constraints, it ignores the request.
-	@param aScreen the screen to recieve the event
-	@param aWhen the point in time the event need not occur before
-	*/
-	virtual void ScheduleAnimation(MWsScreen& aScreen,const TTime& aWhen) = 0;
-	/** Called if a screen determines that it no longer needs to schedule any animation
-	@param aScreen the screen not needing to receive any animation events
-	*/
-	virtual void UnscheduleAnimation(MWsScreen& aScreen) = 0;
-	/** Called to schedule the redrawing of all screens containing this graphic.
-	The redrawing of affected screens can be deferred by the scheduler.
-	@param aId the ID of the graphic to be redrawn.  The graphic itself need not exist
-		(e.g. it has just been deleted, hence the need to redraw all potentially affected screens). */
-	virtual void Invalidate(const TGraphicDrawerId& aId) = 0;
-	/** Called when the Window Server receives a TRawEvent::EInactive  event, to signal power-saving */
-	virtual void OnInactive() = 0;
-	/** Called when the Window Server receives a TRawEvent::EActive event, to signal screen back on */
-	virtual void OnActive() = 0;
-
-	/** Called to schedule a redraw for a screen which is out of date
-	A screen may be scheduled to redraw several times without actually receiving aredraw event from the scheduler
-	If this request is ignored then the screen will be draw incorrectly untill a such a request is not ignored.
-	@param aScreen the screen to recieve the event
-	@param aWhen the point in time the event need not occur before
-	*/
-	virtual void ScheduleRedraw(MWsScreen& aScreen,const TTime& aWhen) = 0;
-	/** Called to force a previously scheduled redraw for a screen to happen synchronously
-	Used when we are about to loose our ability to perform the redraw correctly.
-	@param aScreen the screen to recieve the event
-	*/
-	virtual void DoRedrawNow(MWsScreen& aScreen) = 0;
-
-protected:
-	IMPORT_C void Animate(MWsScreen& aScreen);
-	IMPORT_C void Animate(MWsScreen& aScreen, TRequestStatus* aFinished);
-	IMPORT_C void Redraw(MWsScreen& aScreen);
-	IMPORT_C TBool RedrawInvalid(MWsScreen& aScreen,const TArray<TGraphicDrawerId>& aInvalid);
-	};
-
-/**
-@publishedPartner
-@prototype
-*/
-class CWsMessageData : public CBase, public MWsObjectProvider
-	{
-public:
-	virtual TPtrC8 Data() const = 0;
-	virtual void Release() = 0;
-	IMPORT_C TInt ClientHandle() const;
-	IMPORT_C TInt Id() const;
-	IMPORT_C const CWsGraphicDrawer* Drawer();
-	IMPORT_C void SetClientHandle(TInt aClientHandle);
-	IMPORT_C void SetId( TInt aId);
-	IMPORT_C void SetDrawer(const CWsGraphicDrawer* aDrawer);
-private:
-	friend class CWsGraphicMessageQueue;
-	friend class CWsClient;
-	CWsMessageData* iNext;
-	const CWsGraphicDrawer* iDrawer;
-	TInt iId;
-	TInt iClientHandle;
-	TInt iMWsMessageDataSpare[3];
-	};
-
-class MWsClient: public MWsObjectProvider
-/*** Represents a client session
-	@publishedPartner 
-	@released  */
-	{
-public:
-	/** Determines if this client has the specified capability */
-	virtual TBool HasCapability(TCapability aCapability) const = 0;
-	/** Retrieves the Secure ID of the client's process */
-	virtual TSecureId SecureId() const = 0;
-	/** Retrieves the Vendor ID of the client's process */
-	virtual TVendorId VendorId() const = 0;
-private:
-	friend class CWsGraphicDrawer;
-	virtual TInt SendMessage(const CWsGraphicDrawer* aOnBehalfOf,const TDesC8& aData) = 0;
-	virtual TInt SendMessage(const CWsGraphicDrawer* aOnBehalfOf,CWsMessageData& aData) = 0;
-	};
-
-class MWsGraphicDrawerEnvironment: public MWsObjectProvider
-/** The environment for a graphic drawer
-@publishedPartner
-@released
-*/	{
-public:
-	/** Locate a graphic by ID
-	@return the graphic with that ID, else NULL if no such graphic exists */
-	virtual const CWsGraphicDrawer* ResolveGraphic(const TGraphicDrawerId& aId) const = 0;
-	/** The number of screens the device has; this is constant for a device */
-	virtual TInt ScreenCount() const = 0;
-	/** Get a particular screen by ordinal
-	@return the screen, or NULL if aIndex is out of bounds */
-	virtual MWsScreen* Screen(TInt aIndex) = 0;
-	/** Get a particular screen by ordinal
-	@return the screen, or NULL if aIndex is out of bounds */
-	virtual const MWsScreen* Screen(TInt aIndex) const = 0;
-	/** Set the animation scheduler; this can only be done once by custom code
-	@return success of overriding the default scheduler */
-	virtual TBool SetCustomAnimationScheduler(MWsAnimationScheduler* aScheduler) = 0;
-	/** Query whether a custom animation scheduler has been set
-	@return ETrue if the custom animation scheduler has been set */
-	virtual TBool HasCustomAnimationScheduler() const = 0;
-	/** Clears a custom animation scheduler
-	@return success if the custom scheduler was set, and hence removed */
-	virtual TBool ClearCustomAnimationScheduler(MWsAnimationScheduler* aCurrentScheduler) = 0;
-protected:
-	friend class CWsGraphicDrawer;
-	/** Schedules all potentially affected parts of the screen to repaint
-	This is called automatically whenever a graphic is added, replaced or removed.
-	However, if a graphic which changes representation during runtime must call this
-	explicitly.
-	Note: this is not a suitable method for animating a graphic.  For animation,
-	use MWsGc::Invalidate when the graphic is being drawn to schedule the next
-	animation frame instead.
-	@param aId the ID of the artwork; the artwork may not exist */
-	virtual void Invalidate(const TGraphicDrawerId& aId) = 0;
-public:
-	/** Register to be notified when some events occur.
-	@return KErrNone if successful */
-	virtual TInt RegisterEventHandler(CWsGraphicDrawer* aDrawer, MWsEventHandler* aHandler, TUint32 aEventMask) = 0;
-	/** Unregister from events notification
-	@return KErrNone if successful */
-	virtual TInt UnregisterEventHandler(CWsGraphicDrawer* aDrawer) = 0;
-	/** Register to be notified when some events occur.
-	@return KErrNone if successful
-	@prototype */
-	virtual TInt RegisterWsEventHandler(MWsEventHandler* aHandler, TUint32 aEventMask) = 0;
-	/** Unregister from events notification
-	@return KErrNone if successful 
-	@prototype */
-	virtual TInt UnregisterWsEventHandler(MWsEventHandler* aHandler) = 0;
-	/** Logs a message to the wserv logger, if one is loaded
-	@param aPriority The priority of the message - low priority is 1, high is 9
-	@param aFmt The string to log.  This may contain a single %d, %x or equivalent
-	@param aParam An integer parameter corresponding to a %d, if present
-	@prototype */
-	virtual void Log(TInt aPriority,const TDesC &aFmt,TInt aParam=0) = 0;
-	/** Registers an interface for releasing memory in low memory situations.
-	The release function may be called as a result of any Alloc or ReAlloc attempts in the window server
-	process.
-	@param aMemoryRelease a callback interface
-	@return KErrNone or a system wide error code
-	@prototype */
-	virtual TInt RegisterMemoryRelease(MWsMemoryRelease * aMemoryRelease) = 0;
-	/** Removes a registration set by RegisterMemoryRelease
-	@param aMemoryRelease the registered release object to remove
-	@prototype */
-	virtual void UnregisterMemoryRelease(MWsMemoryRelease * aMemoryRelease) = 0;
-	};
-
-class MWsGc: public MWsObjectProvider
-/** A destination for a drawing occasion of a CWsGraphicDrawer
-	Used to register invalidation schedules for animation
-	@publishedPartner
-	@released
-*/	{
-public:
-	/** The Client requesting this drawing occasion
-		@return the client
-		@publishedPartner 
-		@released  */
-	virtual MWsClient& Client() = 0;
-	/** The screen that is currently being drawn to
-		@return the screen
-		@publishedPartner 
-		@released  */
-	virtual MWsScreen& Screen() = 0;
-#if !defined(SYMBIAN_GRAPHICS_GCE)
-	/** The origin of the GC relative to the screen's origin
-		@return the origin
-		@publishedPartner
-		@released  */
-	virtual TPoint GcOrigin() const = 0;
-	/** The clipping region currently being used
-		@return the clipping region
-		@publishedPartner
-		@released */
-	virtual const TRegion& ClippingRegion() = 0;
-	/** The BITGDI graphics context to draw to
-		@publishedPartner
-		@released */
-	virtual CFbsBitGc& BitGc() = 0;
-	/** Saves the state of the GC to an internal buffer.  Several GC states can be saved in a FILO.
-		Do not restore a GC (using PopBitGcSettings()) that wasn't properly saved!
-		@return KErrNone if successful, else one of the system-wide error codes. */
-	virtual TInt PushBitGcSettings() = 0;
-	/** Restores the last GC state that was saved. */
-	virtual void PopBitGcSettings() = 0;
-#endif	
-	/** The time for the current redraw
-		@publishedPartner 
-		@released */
-	virtual const TTime& Now() const = 0;
-	/** Schedule an animation of a rectangle in the future.
-	    Scheduled animation doesn't work in low memory conditions or
-	    if aRect values fall outside the window area of this animation.
-		@param aRect the rectangle to animate, in the GC's coordinates
-		@param aFromNow the time in microseconds from Now() that the rectangle will be invalid
-		@publishedPartner 
-		@released */
-	virtual void ScheduleAnimation(const TRect& aRect,const TTimeIntervalMicroSeconds& aFromNow) = 0;
-	/** Schedule an animation of a rectangle in the future
-		@param aRect the rectangle to animate, in the GC's coordinates
-		@param aFromNow the time in microseconds from Now() that the rectangle will be invalid
-		@param aFreq microseconds between frames that this rectangle will probably be invalid in the future (0 means no such hint is known)
-		@param aStop the duration in microseconds from Now() that the aFreq hint will be valid for (0 means indefinitely)
-		@publishedPartner 
-		@released */
-	virtual void ScheduleAnimation(const TRect& aRect,const TTimeIntervalMicroSeconds& aFromNow,const TTimeIntervalMicroSeconds& aFreq,const TTimeIntervalMicroSeconds& aStop) = 0;
-	/** Sets the origin of gc
-		@param aOrigin The new origin of the gc
-		@publishedPartner 
-		@prototype	*/
-	virtual void SetGcOrigin(const TPoint& aOrigin) = 0;
-	};
-
-/** Interface Extension
-*/
-enum
-	{
-	KMWsScreenConfigInterfaceId = 1,
-#if !defined(SYMBIAN_GRAPHICS_GCE)
-	KMWsBackBufferInterfaceId = 2,
-	KMWsFrontBufferInterfaceId = 3,
-#endif
-	KMWsGraphicDrawerMessageAlloc = 4,
-	KMWsGraphicMessageAlloc = 5,
-	KWsGraphicHandleSynchronMessageId = 6,
-	KWsGraphicMessageCallbackInterfaceId = 7,
-	KWsActiveSchedulerDebug = 8,
-#if !defined(SYMBIAN_GRAPHICS_GCE)
-	KWsFlickerFreeBufferObserver = 9,
-#endif
-	KMWsWindow = 10,
-	KWsScreenRedraw = 11,
-	KWsScreenRedrawObserver = 12,
-	KCWsRenderStage = 13,
-	KMWsRenderStageFactory = 14,
-	KMWsMemoryRelease = 15,
-#if !defined(SYMBIAN_GRAPHICS_GCE)	
-	KMWsGcClipRect = 16,
-#endif	
-	KMWsFader = 17,
-	KMWsPluginManager = 18,
-	KMWsIniFile = 19,
-	KMWsRawEventServer = 20,
-	KMWsPlaceSurfaceId = 21,
-#if defined(SYMBIAN_GRAPHICS_GCE)
-	KMWsTextCursor = 22,				// CWsRenderStage Object Extension will yield an MWsTextCursor
-#endif
-	KMWsGraphicsContext = 23,			// CWsRenderStage Object Extension will yield an MWsGraphicsContext
-	KMWsCompositionContext = 24,		// CWsRenderStage Object Extension will yield an MWsCompositionContext
-										// 		MWsCompositionContext::CreateLayer will yield a MWsLayer
-	KMWsEventHandler = 25,				// CWsRenderStage Object Extension will yield an MWsEventHandler
-	KMWsScreenDevice = 26,				// CWsRenderStage Object Extension will yield an MWsScreenDevice
-	KMWsPalette = 27,					// CWsRenderStage Object Extension will optionally yield an MWsPalette
-#if defined(SYMBIAN_GRAPHICS_GCE)
-	KMWsUiBufferInterfaceId = 28,		// CWsRenderStage Object Extension will optionally yield an MWsUiBuffer
-#endif
-	KMWsDebugBar = 29,					// CWsRenderStage Object Extension will optionally yield an MWsDebugBar
-	KMWsDrawableSourceProvider = 30,	// CWsRenderStage Object Extension will optionally yield an MWsDrawableSourceProvider
-	KMWsScreenConfigListInterfaceId = 31,	//MWsScreen can return this list interface
-	KMWsWindowTreeObserver = 32,        // CWsRenderStage Object Extension will optionally yield an MWsWindowTreeObserver
-	KMWsDrawAnnotationObserver = 33, 	// CWsRenderStage Object Extension will optionally yield an MWsDrawAnnotationObserver
-	KMWsWindowVisibilityNotifier = 34, 	// CWsRenderStage Object Extension will optionally yield an MWsWindowVisibilityNotifier
-	KMWsWindowTree = 35,				// Object Extension to be used by render stages for recovery of MWsWindowTree
-	KMWsScene = 36,                     // CWsRenderStage Object Extension will yield an MWsScene
-	                                    //      MWsScene::CreateSceneElement will yield a MWsElement
-	KMWsContentReadyForComposition = 37,// CWsRenderStage Object Extension will optionally yield an MWsContentReadyForComposition
-	};
-
-class TSurfaceConfiguration;
-
-
-/** Extension to GC to allow surface placement.
-
-@publishedPartner
-@prototype
-@deprecated
-
-NOTE: This interface is deprecated. Do not use!
-*/
-class MWsSurfacePlacement: public MWsObjectProvider
-	{
-	public:
-	DECLARE_WS_TYPE_ID(KMWsPlaceSurfaceId)
-	virtual TInt	PlaceSurface(const TSurfaceConfiguration& aConfig)=0;
-	};
-
-/** Current screen mode configuration.Values return from this interface shall not be cached as they
-can change at anytime when wserv changes its screen mode. Plugin can listen to event EScreenSizeModeChanged
-to be notified when it happens.
-
-@publishedPartner
-@released
-*/
-class MWsScreenConfig: public MWsObjectProvider
-	{
-public:
-	DECLARE_WS_TYPE_ID(KMWsScreenConfigInterfaceId)
-
-	/** Get screen display mode */
-	virtual TDisplayMode DisplayMode() const = 0;
-	/** Get physical screen size in pixels */
-	virtual TSize SizeInPixels() const = 0;
-	/** Get screen size in pixels for current screen size mode as defined in wsini */
-	virtual TSize ScreenModeSizeInPixels() const = 0;
-	/** Get frame buffer line pitch */
-	virtual TInt Stride() const = 0;
-	/** Get screen orientation */
-	virtual CFbsBitGc::TGraphicsOrientation Orientation() const = 0;
-	/** Get screen size mode */
-	virtual TInt SizeMode() const = 0;
-	/** Get screen scaling factor */
-	virtual TSize ScalingFactor() const = 0;
-	/** Get screen origin */
-	virtual TPoint Origin() const = 0;
-	/** Get screen scaled origin */
-	virtual TPoint ScaledOrigin() const = 0;
-	};
-
-/**	Available list of screen modes as specified during start-up.
- * 	This interface can generally be enquired from the MWsScreen instance.
- * 	Can be read by render stage to configure its Display Configuration policy.
- * 	
- * 	Note that mode list is not contiguous, so methods may leave if missing index is requested.
- **/
-class MWsScreenConfigList: public MWsObjectProvider
-	{
-public:
-	DECLARE_WS_TYPE_ID(KMWsScreenConfigListInterfaceId)
-
-	enum	TModeFlags
-		{
-		EDynamic=			0x00000001,		//"-1,-1"
-		EHighRes=			0x00000002,		//High-res policy mode
-		EDisconnected=		0x00000004,		//Mode to use when disconnected
-		EHalDefault=		0x00000008,
-		ETwipsSpecified=	0x00000010,
-		EClientDefinedDigitiserArea=	0x00000020,	
-		};
-	
-	/** Get  list of valid display modes - may be sparse **/
-	virtual TInt	GetScreenSizeModeList(RArray<TInt>&aList) const =0;
-	/** Get screen display mode */
-	virtual TDisplayMode DisplayModeL(TInt aIndex) const = 0;
-	/** Get screen size in pixels for current screen size mode as defined in wsini */
-	virtual TSize ScreenModeSizeInPixelsL(TInt aIndex) const = 0;
-	/** Get screen size in twips for current screen size mode as defined in wsini */
-	virtual TSize ScreenModeSizeInTwipsL(TInt aIndex) const = 0;
-	/** Get screen orientation */
-	virtual CFbsBitGc::TGraphicsOrientation OrientationL(TInt aIndex) const = 0;
-	/** Get screen orientation */
-	virtual TInt AvailableOrientationsL(TInt aIndex) const = 0;
-	/** Get screen scaling factor - note this is expected to stay at 1:1 */
-	virtual TSize ScalingFactorL(TInt aIndex) const = 0;
-	/** Get screen origin */
-	virtual TPoint OriginL(TInt aIndex) const = 0;
-	/** Get screen scaled origin - note this is expected to stay at 1:1  */
-	virtual TPoint ScaledOriginL(TInt aIndex) const = 0;
-	/** Get the modeflags for specified mode  */
-	virtual TInt ModeFlagsL(TInt aIndex) const = 0;
-	
-	};
-	
-class MWsWindowTree : public MWsObjectProvider
-	{
-public:	
-	DECLARE_WS_TYPE_ID(KMWsWindowTree)
-	virtual void SendTree() const = 0;
-	};
- 
-#if !defined(SYMBIAN_GRAPHICS_GCE)
-/** Wserv flickerfree buffer access
-
-@publishedPartner
-@released
-*/
-class MWsBackBuffer: public MWsObjectProvider
-	{
-public:
-	DECLARE_WS_TYPE_ID(KMWsBackBufferInterfaceId)
-	/** Get wserv flickerfree buffer bitmap
-	*/
-	virtual CFbsBitmap* GetBitmap() = 0;
-	/** Get default wserv flickerfree buffer drawing context. This will always return the original
-	context not the current context (e.g. not the redirecting context when it is redirected).
-	*/
-	virtual CFbsBitGc* GetBitGc() = 0;
-	/** Set wserv flickerfree buffer drawing context to redirect its drawing output. Drawing context must
-	have been activated on a device prior calling this function.
-	@param aBitGc The context where flickerfree buffer drawing output is redirected to. If it is NULL
-	the redirection will be cancelled and default drawing context will be restored.
-	@return KErrNone if successful, otherwise one of system-wide error codes.
-	*/
-	virtual TInt SetBitGc(CFbsBitGc* aBitGc) = 0;
-	/** Redirects drawing to another back buffer. Target back buffer must provide bitmap and drawing context
-	which has been activated on a bitmap device.
-	@param aTarget Target back buffer where drawing is redirected to. If it is NULL
-	the redirection will be terminated.
-	@return KErrNone if successful, otherwise one of system-wide error codes.
-	@prototype
-	*/
-	virtual TInt RedirectTo(MWsBackBuffer* aTarget) = 0;
-	
-	/** Sets the back buffers observer.  The observer will be called just before and just after each
-	complete sequence of drawing to the back buffer.
-	@param aObserver The observer handling the callbacks
-	@prototype
-	*/
-	virtual void SetObserver(MWsFlickerFreeBufferObserver* aObserver) = 0;
-	
-	/** This returns the observer set by SetObserver.
-	@return The observer set by SetObserver, or NULL
-	@prototype
-	*/
-	virtual MWsFlickerFreeBufferObserver* Observer() = 0;
-
-	/** Get current wserv flickerfree buffer drawing context. This will return the redirected context 
-	when it is set.
-	@return The graphics context to use to draw to the flicker buffer directly.
-	@prototype
-	*/
-	virtual CFbsBitGc* GetBitGcCurrent() = 0;
-	};
-
-/** Wserv screen buffer access
-
-@publishedPartner
-@released
-*/
-class MWsFrontBuffer: public MWsObjectProvider
-	{
-public:
-	DECLARE_WS_TYPE_ID(KMWsFrontBufferInterfaceId)
-	/** Get pointer to framebuffer
-	*/
-	virtual const TAny* GetBits() = 0;
-	/** Get default wserv screen drawing context. This will always return the original
-	context not the current context (e.g. not the redirecting context when it is redirected).
-	*/
-	virtual CFbsBitGc* GetBitGc() = 0;
-	/** Set wserv screen drawing context to redirect its drawing output. Drawing context must
-	have been activated on a device prior calling this function.
-	@param aBitGc The context where screen drawing output is redirected to. If it is NULL
-	the redirection will be cancelled and default drawing context will be restored.
-	@return KErrNone if successful, otherwise one of system-wide error codes.
-	*/
-	virtual TInt SetBitGc(CFbsBitGc* aBitGc) = 0;
-	/** Set wserv screen drawing context to redirect its drawing output and perform fullscreen 
-	redraw if necessary. Drawing context must have been activated on a device prior calling this 
-	function.
-	@param aBitGc The context where screen drawing output is redirected to. If it is NULL
-	the redirection will be cancelled and default drawing context will be restored.
-	@param aInvalidateScreen Flag to tell wserv to perform fullscreen redraw or not
-	@return KErrNone if successful, otherwise one of system-wide error codes.
-	@prototype
-	*/
-	virtual TInt SetBitGc(CFbsBitGc* aBitGc, TBool aInvalidateScreen) = 0;	
-	
-	/** Get current wserv screen drawing context. This will return the redirected context 
-	when it is set.
-	@prototype
-	*/
-	virtual CFbsBitGc* GetBitGcCurrent() = 0;
-	};
-#endif // !SYMBIAN_GRAPHICS_GCE
-
-/** Optional Memory Allocator for incoming messages
-	To be implemented by CRPs which want to control large incoming messages themselves
-
-@publishedPartner
-@released
-*/
-class MWsGraphicDrawerMessageAlloc: public MWsObjectProvider
-	{
-public:
-	DECLARE_WS_TYPE_ID(KMWsGraphicDrawerMessageAlloc)
-	virtual TAny* Alloc(TInt aSize) = 0;
-	virtual void Free(TAny* aCell) = 0;
-	};
-
-/** Optional Memory Allocator for incoming messages
-	To be implemented by CWsGraphics which want to control large incoming messages themselves
-
-@publishedPartner
-@released
-*/
-class MWsGraphicMessageAlloc: public MWsObjectProvider
-	{
-public:
-	DECLARE_WS_TYPE_ID(KMWsGraphicMessageAlloc)
-	NONSHARABLE_CLASS(MBuffer): public MWsObjectProvider
-		{
-	public:
-		virtual TPtr8 Buffer() = 0;
-		virtual void Release() = 0;
-		};
-	virtual MBuffer* Alloc(TInt aSize) = 0;
-	};
-
-/** For debug purposes only
-
-@publishedPartner
-@prototype
-*/	
-class MWsActiveSchedulerDebug: public MWsObjectProvider
-	{
-public:
-	DECLARE_WS_TYPE_ID(KWsActiveSchedulerDebug)
-	virtual TInt64 Requests() const = 0;
-	virtual TInt64 Errors() const = 0;
-	virtual TInt64 Draws() const = 0;
-	virtual TInt64 Total() const = 0;
-	virtual TInt64 Preparing() const = 0;
-	virtual TInt64 Drawing() const = 0;
-	virtual TInt64 Idle() const = 0;
-	};
-
-#if !defined(SYMBIAN_GRAPHICS_GCE)
-/** This forms part of the MWsBackBuffer interface
-
-@publishedPartner
-@prototype
-*/
-class MWsFlickerFreeBufferObserver: public MWsObjectProvider 
-	{
-public:	
-	DECLARE_WS_TYPE_ID(KWsFlickerFreeBufferObserver)
-	/** Function that gets called before the flicker buffer is updated
-	@param aBuffer The back buffer that is about to be updated
-	@param aRegion The region of the back buffer that is about to be updated
-	*/
-	virtual void BeforeUpdate(MWsBackBuffer& aBuffer,const TRegion& aRegion) = 0;
-	/** Function that gets called after the flicker buffer has been updated
-	@param aBuffer The back buffer that has been updated
-	@param aRegion The region of the the back buffer that has been updated
-	*/
-	virtual void AfterUpdate(MWsBackBuffer& aBuffer,const TRegion& aRegion) = 0;
-	};
-#endif // !SYMBIAN_GRAPHICS_GCE
-
-/** An interface through which a window can be examined
-This returns non const copies instead of const references, and the
-functions themselves are non const.
-
-@publishedPartner
-@prototype
-*/
-class MWsWindow : public MWsObjectProvider
-	{
-public:	
-	DECLARE_WS_TYPE_ID(KMWsWindow)
-public:
-	/** Gets the origin of the window.
-	@return TPoint containing the origin of the window.
-	*/
-	virtual TPoint Origin() const = 0;
-	/** Gets the windows rect in absolute co-ordinates.
-	@return TRect
-	*/
-	virtual TRect AbsRect() const = 0;
-	/** Gets the size of the window
-	@return TSize containing the size of the window
-	*/
-	virtual TSize Size() const = 0;
-	/** Get the window's handle
-	@return TUint32 containing the window's handle.
-	*/
-	virtual TUint32 Handle() const = 0;
-	/** Invalidate an area of the window.
-	@param aRect TRect containing the area to invalidate.
-	*/
-	virtual void Invalidate(const TRect * aRect = 0) = 0;
-	/** Get the MWsScreen for this window.
-	@return A pointer to the MWsScreen that this window is on.
-	*/
-	virtual MWsScreen * WsScreen() const = 0;
-	/** Finds a child of this window by specifiying its handle.
-	@param aHandle A handle to the window to find.
-	@return an MWsWindow pointer to the found window
-	*/
-	virtual MWsWindow * FindChildByHandle(TUint32 aHandle) = 0;
-	/**
-	Returns the ordinal priority of the node. 
-	*/
-	virtual TInt OrdinalPriority() const = 0;
-	/** Get the window's basic area before any clipping is done.
-	For windows with rounded corners, the window area is different from AbsRect.
-	@return a reference to the window area 
-	*/	
-	virtual const TRegion& WindowArea() const = 0;
-	};
-
-/** 
-An interface providing information about a window group.
-@publishedPartner
-@prototype
-*/
-class MWsWindowGroup
-	{
-public:
-	virtual TInt Identifier() const = 0;
-	virtual TPtrC Name() const = 0;
-	virtual TBool IsFocusable() const = 0;
-	virtual TInt OrdinalPriority() const = 0;
-	virtual const MWsClient * Client() const = 0;
-	};
-
-/**
-An interface through which a sprite can be examined. 
-@publishedPartner
-@prototype
-*/
-class MWsSprite 
-	{
-public:
-	enum TSpriteType
-		{
-		EWindowSprite,
-		EFloatingSprite,
-		ECustomTextCursorSprite,
-		EPointerCursorSprite
-		};
-public:
-	virtual TRect Rect() const = 0;
-	virtual TSpriteType SpriteType() const = 0;
-	};
-
-/**
-An interface through which a standard text cursor can be examined. 
-@publishedPartner
-@prototype
-*/
-class MWsStandardTextCursor
-	{
-public:
-	/**
-	Cursor type.
-	@return The cursor type; either TTextCursor::ETypeRectangle or TTextCursor::ETypeHollowRectangle.
-	*/
-	virtual TInt Type() const = 0;
-	/**
-	Draw rectangle.
-	@return Draw rectangle of the cursor in <b>window</b> co-ordinates.
-	*/
-	virtual TRect Rect() const = 0;
-	/**
-	Clipping rectangle in <b>window</b> co-ordinates.
-	@return If a clipping rect has been set, the cursor must be drawn clipped to the returned rectangle.
-	@see MWsWindowTreeObserver::ECursorClipRectSet
-	*/
-	virtual TRect ClipRect() const = 0;
-	/**
-	Cursor flags.
-	For possible values, see TTextCursor::EFlags.
-	Note, only flags included by the mask TTextCursor::EUserFlags are provided.
-	@see TTextCursor::EFlags
-	*/
-    virtual TUint Flags() const = 0;
-	/**
-	Cursor color.
-	@return The cursor color.
-	*/
-	virtual TRgb Color() const = 0;
-	/**
-	Flash time interval.
-	@return If TTextCursor::EFlagNoFlash is set, zero; otherwise the time interval between cursor flash on/off.
-	@see MWsStandardTextCursor::Flags()
-	*/
-	virtual TTimeIntervalMicroSeconds32 FlashInterval() const = 0;
-	};
-
-
-/** An interface providing information about a window tree node.
-@publishedPartner
-@prototype
-*/
-class MWsWindowTreeNode
-	{
-public:
-	
-	enum TType
-		{
-		EWinTreeNodeClient = EWinTypeClient,	//0
-		EWinTreeNodeRoot = EWinTypeRoot,		//1
-		EWinTreeNodeGroup = EWinTypeGroup,		//2 
-		EWinTreeNodeAnim = 16,					//3-15 reserved for expansion of TWinType
-		EWinTreeNodeSprite,
-		EWinTreeNodeStandardTextCursor,
-		};
-	
-	/** 
-	 @return The Node Type for this MWsWindowTreeNode. 	 */
-	virtual TType NodeType() const = 0;
-	/**
-	 @return A pointer to a MWsWindow interface only when this 
-	 MWsWindowTreeNode represents a client window 
-	 (i.e. node type EWinTreeNodeClient), NULL otherwise. */
-	virtual const MWsWindow* Window() const = 0;
-	/**
-	 @return A pointer to a MWsSprite interface only when this 
-	 MWsWindowTreeNode represents a sprite, NULL otherwise. */
-	virtual const MWsSprite* Sprite() const = 0;
-	/**
-	 @return A pointer to a MWsStandardTextCursor interface only when this 
-	 MWsWindowTreeNode represents a standard text cursor, NULL otherwise. */
-	virtual const MWsStandardTextCursor* StandardTextCursor() const = 0;
-	/** 
-	 @return The MWsWindowGroup this MWsWindowTreeNode belongs to, or "this"
-	 MWsWindowTreeNode object if the NodeType is EWinTreeNodeGroup. Will  
-	 return NULL if this MWsWindowTreeNode is of type EWinTreeNodeRoot. */
-	virtual const MWsWindowGroup* WindowGroup() const = 0;
-	/**
-	 @return The parent MWsWindowTreeNode. NULL if current node is of type
-	 EWinTreeNodeRoot. The parent of a floating sprite is the root window. */
-	virtual const MWsWindowTreeNode* ParentNode() const = 0;
-	};
-
-/** 
-An interface optionally provided by render stages, to observe changes in 
-window tree structure, or changes to tree nodes.
-
-@publishedPartner
-@prototype
-*/
-class MWsWindowTreeObserver : public MWsObjectProvider
-	{
-public:	
-	DECLARE_WS_TYPE_ID(KMWsWindowTreeObserver)
-	
-public:
-	/**
-	 This enum encapsulates the set of boolean attribute changes that can be observed
-	 using the MWsWindowTreeObserver interface. 
-	 @see FlagChanged */
-	enum TFlags
-		{
-		/** For a window to be drawn, it needs to be activated and visible and have visible parents.
-	 	Making a window invisible, implies that its children should be invisible as well.
-	 	The default value for a window is true. */
-		EVisible = 1,
-		/** Non-fading windows should not be drawn faded regardless of their fade-count.
-		The default value is false. */
-		ENonFading,
-		/** Windows with this attribute enabled uses alpha channel to control its transparency.
-		The default value is false. */
-		EAlphaChannelTransparencyEnabled,
-		/** True if a clipping rect should be applied when drawing a standard text cursor, false otherwise.
-		The default value is false. */
-		ECursorClipRectSet
-		};
-	/**
-	 This enum encapsulates the set of non-boolean attribute changes that can be observed
-	 using the MWsWindowTreeObserver interface. 
-	 @see AttributeChanged */
-	enum TAttributes
-		{
-		/** Cursor type.
-		@see MWsStandardTextCursor::Type()*/
-		ECursorType = 1,
-		/** Cursor clip rect.
-		@see MWsStandardTextCursor::ClipRect()*/
-		ECursorClipRect,
-		/** Cursor flags.
-		@see MWsStandardTextCursor::Flags()*/
-		ECursorFlags,
-		/** Cursor color.
-		@see MWsStandardTextCursor::Color()*/
-		ECursorColor,
-		/** Window shape.
-		@see MWsWindow::WindowArea()*/
-		EWindowShape,
-		/** Window group name
-		@see MWsWindowGroup::Name()*/
-		EWindowGroupName
-		};
-	/** 
-	 Callback to notify that a MWsWindowTreeNode has just been created. 
-	 Nodes are always added as the left-most sibling as this means they are
-	 added in front of exisitng nodes.
-	 @param aWindowTreeNode Use to query attributes of the node that has been 
-	 						created. Note that attributes such as e.g. the extent
-	 						is not yet set by the client when this notification arrives.
-	 @param aParent The parent node which aWindowTreeNode has been attached to. 
-	 				Special cases: aParent will be set to NULL for root windows, 
-	 				and set to the root window for floating sprites. */
-	virtual void NodeCreated(const MWsWindowTreeNode& aWindowTreeNode, const MWsWindowTreeNode* aParent) = 0;
-	/** 
-	 Callback to notify that a node in the window tree is about to be destroyed. 
-	 @param aWindowTreeNode Use to query attributes of node that's about to be destroyed. */
-	virtual void NodeReleased(const MWsWindowTreeNode& aWindowTreeNode) = 0;
-	/**
-	 Callback to notify that a node in the window tree has been activated. This 
-	 event is only generated for windows which has a visual appearance 
-	 (i.e. root windows and group windows are not activated). Before a node 
-	 can be drawn it needs to be activated and visible and have a non-zero size.
-	 @param aWindowTreeNode Use to query attributes of node that has been activated. */
-	virtual void NodeActivated(const MWsWindowTreeNode& aWindowTreeNode) = 0;
-	/**
-	 Callback to notify that a node's extent has changed. It is guaranteed that there
-	 will be at least one NodeExtentChanged notification between the NodeCreated and 
-	 NodeActivated notifications.
-	 Note that when a window has child-windows, those are always moving along with their
-	 parent but no NodeExtentChanged notifications will be generated for the child-windows.
-	 @param aWindowTreeNode Use to query attributes of the node that has been changed.
-	 @param aRect The new rectangle. */
-	virtual void NodeExtentChanged(const MWsWindowTreeNode& aWindowTreeNode, const TRect& aRect) = 0;
-	/**
-	 Callback to notify that the ordinal position of a window has changed.
-	 @param aWindowTreeNode Use to query attributes of the node that has been changed.. 
-	 @param aNewPos The new position of this node among its siblings. */
-	virtual void SiblingOrderChanged(const MWsWindowTreeNode& aWindowTreeNode, TInt aNewPos) = 0;
-	/**
-	 Callback to notify that a node has had one of its boolean attributes changed.
-	 @param aWindowTreeNode Use to query attributes of the node that has been changed.
-	 @param aFlag The attribute that has changed.
-	 @param aNewValue The new value for the attribute. */
-	virtual void FlagChanged(const MWsWindowTreeNode& aWindowTreeNode, TFlags aFlag, TBool aNewValue) = 0;
-	/**
-	 Callback to notify that a node has had one of its non-boolean attributes changed.
-	 @param aWindowTreeNode Use to identify the affected node and query the new value of the changed attribute.
-	 @param aAttribute The attribute that has changed. */
-	virtual void AttributeChanged(const MWsWindowTreeNode& aWindowTreeNode, TAttributes aAttribute) = 0;
-	/**
-	 Callback to notify that a window's fade count has been changed.
-	 @param aWindowTreeNode Use to query attributes of the node that has been changed.
-	 @param aFadeCount Zero means the window is not faded, an integer > 0 means 
-	 					faded if absolute fading is used, or the number of times 
-	 					SetFaded has been called if using counting fade. */
-	virtual void FadeCountChanged(const MWsWindowTreeNode& aWindowTreeNode, TInt aFadeCount) = 0;
-	/**
-	 Callback to notify that the user defined transparent region of a window has changed. 
-	 This information is for optimisation purpose only, the rendering engine don't need 
-	 to do a full back-to-front rendering behind the opaque region. 
-	 @param aWindowTreeNode  Use to query attributes of the node that has been changed.
-	 @param aNewTransparentRegion   The transparent region defined by the user. Coordinates 
-	 								are relative the window's origin.
-	 @param aNewOpaqueRegion 	The inverse of aNewTransparentRegion.  Coordinates are 
-	 							relative the window's origin. */	
-	virtual void TransparentRegionChanged(const MWsWindowTreeNode& aWindowTreeNode, const TRegion& aNewTransparentRegion, const TRegion* aNewOpaqueRegion) = 0;
-	/**
-	 Callback to notify that a element has been added to this window.
-	 The render stages implementing this interface know when elements are added or removed through MWsElement interface.
-	 The purpose of the ElementAdded API is only to enable render stages to make an association between the element and the window.
-	 @param aWindowTreeNode Use to query attributes of the node that has been changed.
-	 @param aElement Use to query attributes of the new element. */
-	virtual void ElementAdded(const MWsWindowTreeNode& aWindowTreeNode, const MWsElement& aElement) = 0;
-	/**
-	 Callback to notify that a window has been moved to another window group.
-	 @param aWindowTreeNode Use to query attributes of the node that has been moved.
-	 @param aNewWindowGroupNode The window group aWindowTreeNode has been moved to. 
-	 @see RWindowBase::MoveToGroup */
-	virtual void MovedToWindowGroup(const MWsWindowTreeNode& aWindowTreeNode, const MWsWindowTreeNode& aNewWindowGroupNode) = 0;
-	/**
-	 Callback to notify that a window group chain has been formed or extended.
-	 @param aParent The window group node to which a child has been attached.
-	 @param aChild The window group node that has been attached to aParent. */
-	virtual void WindowGroupChained(const MWsWindowTreeNode& aParent, const MWsWindowTreeNode& aChild) = 0;
-	/**
-	 Callback to notify that a window group chain has been broken. 
-	 Special case: Deleting a window group that is part of a chain will break all chaining 
-	 after the deleted window group and a notification for each node being dequed will be sent.
-	 @param aWindowGroupNode The window group chain is broken directly after this window group. */
-	virtual void WindowGroupChainBrokenAfter(const MWsWindowTreeNode& aWindowGroupNode) = 0;
-	/**
-	 Callback to notify that all nodes below aWindowTreeNode should be drawn faded,
-	 unless they have the ENonFading flag set. 
-	 This API is primarily used in conjunction with application frameworks that uses 
-	 absolute fading rather than counting fade.
-	 @param aWindowTreeNode Typically a root window, for which all children should have their
-	 					fade state set to aFaded.
-	 @param aFaded The new fade state to apply. ETrue means faded, EFalse not faded. */
-	virtual void FadeAllChildren(const MWsWindowTreeNode& aWindowTreeNode, TBool aFaded) = 0;
-	};
-
-/** 
-An interface optionally provided by render stages, to observe which node in 
-the window tree structure that is being rendered.
-
-Text cursors and sprites (floating or non) are annotated by the same APIs.
-
-@publishedPartner
-@prototype
-*/
-class MWsDrawAnnotationObserver : public MWsObjectProvider
-	{
-public:	
-	DECLARE_WS_TYPE_ID(KMWsDrawAnnotationObserver)
-	virtual void WindowRedrawStart(const MWsWindowTreeNode& aWindowTreeNode, const TRegion& aRegion) = 0;
-	virtual void WindowRedrawEnd(const MWsWindowTreeNode& aWindowTreeNode) = 0;
-	virtual void WindowAnimRedrawStart(const MWsWindowTreeNode& aWindowTreeNode, const TRegion& aRegion) = 0;
-	virtual void WindowAnimRedrawEnd(const MWsWindowTreeNode& aWindowTreeNode) = 0;
-	virtual void SpriteRedrawStart(const MWsWindowTreeNode& aWindowTreeNode, const TRegion& aRegion) = 0;
-	virtual void SpriteRedrawEnd(const MWsWindowTreeNode& aWindowTreeNode) = 0;
-	virtual void SpriteFlash(const MWsWindowTreeNode& aWindowTreeNode, TBool aFlashOn) = 0;
-	virtual void SegmentRedrawStart(const TRegion& aRegion) = 0;
-	virtual void SegmentRedrawEnd() = 0;
-	};
-
-/** 
-Implemented by a WSERV screen to respond to window visibility change notifications sent
-by a render stage implementing MWsWindowVisibilityNotifier.
-
-Immediately after WSERV sucessfully obtains a pointer to MWsWindowVisibilityNotifier, 
-WSERV will call MWsWindowVisibilityNotifier::RegisterWindowVisibilityObserver()
-to provide a means for the render stage to notify WSERV, when window visibility changes.
-
-@see MWsWindowVisibilityNotifier
-
-@publishedPartner
-@prototype
-*/
-class MWsWindowVisibilityObserver
-	{
-public:
-	/** 
-	Called by the render stage to indicate a window's visible region has changed.
-	After this method has been called, it does not need to be called again until
-	after WSERV calls SendVisibilityChanges.
-	@see MWsWindowVisibilityNotifier::SendVisibilityChanges
-	*/
-	virtual void VisibilityChanged() = 0;
-
-	/**
-	Called by the render stage to update a window's visible region.
-	@param aWindow The window whose visible region has changed.
-	@param aVisibleRegion Region of the window not obscured by a fully opaque window. Part of this region could potentially still
-	be obscured by opaque parts of translucent windows on top of aWindow.
-	*/
-	virtual void SetWindowVisibility(const MWsWindow& aWindow, const TRegion& aVisibleRegion) = 0;
-	};
-
-/** 
-This interface may be implemented by a render stage wishing to take over responsibility
-from WSERV, for updating a window's visible region.
-For example, if a render stage introduces non-WSERV visuals which overlap WSERV windows, WSERV may
-need to receive updated window visibility information.
-
-Immediately after sucessfully obtaining this interface, WSERV will call RegisterWindowVisibilityObserver
-to provide a means for the render stage to notify WSERV when window visibility changes.
-
-@see MWsWindowVisibilityObserver
-
-@publishedPartner
-@prototype
-*/
-class MWsWindowVisibilityNotifier : public MWsObjectProvider
-	{
-public:	
-	DECLARE_WS_TYPE_ID(KMWsWindowVisibilityNotifier)
-
-	/** 
-	Register to be notified when window visibility changes.
-	@param aWindowVisibilityObserver Observer to be notified.
-	*/
-	virtual void RegisterWindowVisibilityObserver(MWsWindowVisibilityObserver* aWindowVisibilityObserver) = 0;
-
-	/** 
-	Register to be notified when visibility of a specific window changes.
-	After registering a window, the render stage must immediately provide the
-	current visible region by calling VisibilityChanged() and later, in response
-	to SendVisibilityChanges, call SetWindowVisibility.
-	RegisterWindow and UnregisterWindow are symmetrical operations. For each
-	call to RegisterWindow, there will follow exactly one call to UnregisterWindow.
-	@param aWindow Window for which WSERV needs accurate visibility information.
-	@see MWsWindowVisibilityObserver
-	*/
-	virtual void RegisterWindow(const MWsWindow& aWindow) = 0;
-
-	/** 
-	Stops visibility notifications being sent for the specified window.
-	RegisterWindow and UnregisterWindow are symmetrical operations. For each
-	call to RegisterWindow, there will follow exactly one call to UnregisterWindow.
-	@param aWindow Window for which visibility notifications are no longer required.
-	*/
-	virtual void UnregisterWindow(const MWsWindow& aWindow) = 0;
-
-	/** 
-	Asks the render stage to call SetWindowVisibility for each window whose
-	visible region has changed.
-	All visible region changes must be sent before this method returns.
-	@see MWsWindowVisibilityObserver
-	*/
-	virtual void SendVisibilityChanges() = 0;
-	};
-
-/** This is an extension of the MWsScreen interface for handling the
-animation aspects of the redraw sequence.
-
-@publishedPartner
-@prototype
-*/
-class MWsScreenRedraw: public MWsObjectProvider
-	{
-public:
-	DECLARE_WS_TYPE_ID(KWsScreenRedraw)
-	/**Sets the screen redraw observer. 
-	@param aObserver
-	*/
-	virtual void SetObserver(MWsScreenRedrawObserver* aObserver) = 0;
-	/** Checks if there is a redraw in progress or scheduled to take place.
-	@return Returns ETrue if there is an update pending.
-	*/	
-	virtual TBool IsUpdatePending() = 0;
-	/** Gets the current time according to the animation scheduler
-	@return The current time as a TTime reference.
-	*/
-	virtual const TTime& Now() const = 0;
-	/** Schedule a render of the screen without requesting any area of it
-	to be redrawn.  Effectively, request a rerun of the render stages.
-	@param aFromNow The time from now, in microseconds, to perform the render.
-	*/
-	virtual void ScheduleRender(const TTimeIntervalMicroSeconds& aFromNow) = 0;
-	/** Gets the the animation region for this screen redraw.
-	@return the Region being redrawn during the animation
-	*/
-	virtual const TRegion * AnimationRegion() const = 0;
-	/** Updates the screen device to reflect any animation changes
-	*/
-	virtual void UpdateDevice() = 0;
-	};
-	
-/** This is part of the MWsScreenRedraw interface
-
-@publishedPartner
-@prototype
-*/
-class MWsScreenRedrawObserver: public MWsObjectProvider
-	{
-public:
-	DECLARE_WS_TYPE_ID(KWsScreenRedrawObserver)
-	/** Callback function that gets called after the completion of every redraw sequence.
-	@see MWsScreenRedraw::SetObserver
-	@publishedPartner
-	@prototype
-	*/
-	virtual void ScreenUpdated(TInt aScreenNumber) = 0;
-	};
-
-/** This is part of the MGraphicDrawerInterface
-
-@publishedPartner
-@prototype
-*/
-class MWsMemoryRelease : public MWsObjectProvider
-	{
-public:
-	DECLARE_WS_TYPE_ID(KMWsMemoryRelease)
-	enum TMemoryReleaseLevel
-		{
-		ELow,
-		EMedium,
-		EHigh
-		};
-	/** This function is called on registered memory release objects whenever there
-	is insufficient memory available to honour an Alloc or ReAlloc in the window server
-	process.  It may be called up to three times, once for each level defined in TLevel.
-	The meaning of each level is open to interpretation by individual implementations.
-	@see MGraphicDrawerEnvironment::RegisterMemoryRelease
-	@param aLevel 
-	@return ETrue to indicate that memory was freed, EFalse otherwise.
-	@publishedPartner
-	@prototype
-	*/
-	virtual TBool ReleaseMemory(TMemoryReleaseLevel aLevel) = 0;
-	};
-
-#if !defined(SYMBIAN_GRAPHICS_GCE)
-/** This is an extension of the MWsGc.  This interface is not used in
-non-NGA configurations.  It has been removed from NGA configurations.
-
-@see MWsGc
-@publishedPartner
-@prototype
-*/
-class MWsGcClipRect : public MWsObjectProvider
-	{
-public:
-	DECLARE_WS_TYPE_ID(KMWsGcClipRect)
-	/** Sets a master clipping rectangle on the GC.  This will combine with any clipping rectangles
-	specified by the client.
-	@param aRect
-	*/
-	virtual void SetClipRect(TRect aRect) = 0;
-	/** Resets the master clipping rectangle specified in SetMasterClipRect
-	*/
-	virtual void ResetClipRect() = 0;
-	/** Returns the combined clipping rectangle.
-	@param aRect this is set to the clipping rectangle
-	@param aSet this is true if there is a clipping rectangle in effect
-	*/
-	virtual void GetClipRect(TRect & aRect, TBool & aSet) = 0;
-	};
-#endif
-
-/** DebugBarDrawer interface
-     
-@publishedPartner
-@prototype
-*/
-class MWsDebugBar : public MWsObjectProvider
-	{
-public:
-	DECLARE_WS_TYPE_ID(KMWsDebugBar)
-	
-public:
-	/**
-	 * Prints a debug information bar overlaid at the top the screen.
-	 * 
-	 * @param aDebugText An array of text lines.
-	 */
-	virtual void DrawDebugBar(const TArray<TPtrC>& aDebugText)=0;
-	};
-
-/** This is an extension of MWsGc and provides plugin fading capabilities for wserv.
-    Default implementation of the plugin uses bitgdi fade. 
-    
-@see MWsGc
-@publishedPartner
-@prototype
-*/
-class MWsFader : public MWsObjectProvider
-	{
-public:
-	DECLARE_WS_TYPE_ID(KMWsFader)
-	
-public:
-	/** Sets any parameters for the fade.
-	@param aData Descriptor containing the fade parameters
-	*/
-	virtual void SetFadingParameters(const TDesC8& aData)=0;
-#if !defined(SYMBIAN_GRAPHICS_GCE)
-	/** Perform a fade of the specified region
-	@param aBitGc CFbsBitGc to perform the fading with.
-	@param aRegion TRegion containing the region that the fading is to be performed on.
-	*/
-	virtual void FadeArea(CFbsBitGc* aBitGc,const TRegion * aRegion)=0;
-#else
-	/** Perform a fade of the specified region
-	@param aRegion TRegion containing the region that the fading is to be performed on.
-	*/
-	virtual void FadeArea(const TRegion& aRegion)=0;
-#endif
-	};
-
-/** Plugin Manager Interface
-@publishedPartner
-@prototype
-*/	
-class MWsPluginManager : public MWsObjectProvider
-	{
-public:
-	DECLARE_WS_TYPE_ID(KMWsPluginManager)
-	
-	/** Resolve an instance of an interface
-	@param aTypeId
-	*/
-	virtual TAny* ResolvePluginInterface(TUint aTypeId) = 0;
-	};
-	
-/** An Interface to allow CRP's and CWsPlugins to access the wserv ini file
-@publishedPartner
-@prototype
-*/
-class MWsIniFile : public MWsObjectProvider
-	{
-public:
-	DECLARE_WS_TYPE_ID(KMWsIniFile)
-	
-	/** Find the value of the specified variable if present in the window server ini file.
-	@param aVarName TDesC containing the name of the variable to find.
-	@param aResult TPtrC that gets set to the value of the ini variable.
-	@return ETrue if ini file variable found
-	*/
-	virtual TBool FindVar(const TDesC &aVarName, TPtrC &aResult) = 0;
-
-	/** Find the value of the specified variable if present in the window server ini file.
-	@param aVarName TDesC containing the name of the variable to find
-	@param aResult TInt that gets set to the value of the ini variable
-	@return ETrue if ini file variable found
-	*/
-	virtual TBool FindVar(const TDesC &aVarName, TInt &aResult) = 0;
-
-	/** Find if the variable is present in the ini file
-	@param aVarName TDesC containing the name of the variable to find
-	@return ETrue if ini file variable found
-	*/
-	virtual TBool FindVar(const TDesC &aVarName) = 0;
-
-	/** Find if the variable is present in the [SCREENx] section
-	@param aScreen TInt containing the screen number
-	@param aVarName TDesC containing the name of the variable to find
-	@return ETrue if ini file variable found
-	*/
-	virtual TBool FindVar( TInt aScreen, const TDesC &aVarName) = 0;
-
-	/** Find the value of the specified variable if present in the [SCREENx] section of the ini file
-	@param aScreen TInt containing the screen number
-	@param aVarName TDesC containing the name of the variable to find
-	@param aResult TInt that gets set to the value of the ini variable
-	@return ETrue if ini file variable found
-	*/
-	virtual TBool FindVar( TInt aScreen, const TDesC &aVarName, TInt &aResult) = 0;
-
-	/** Find the value of the specified variable if present in the [SCREENx] section of the ini file
-	@param aScreen TInt containing the screen number
-	@param aVarName TDesC containing the name of the variable to find
-	@param aResult TPtrC that gets set to the value of the ini variable.
-	@return ETrue if ini file variable found
-	*/
-	virtual TBool FindVar( TInt aScreen, const TDesC& aVarName, TPtrC &aResult) = 0;
-
-	/** Find if the specified variable is present in the named section of the ini file
-	@param aSection TDesC containing the name of the section 
-	@param aVarName TDesC containing the name of the variable to find
-	@return ETrue if ini file variable found
-	*/
-	virtual TBool FindVar(const TDesC& aSection, const TDesC &aVarName) = 0;
-	
-	/** Find the value of the specified variable in the named section of the ini file.
-	@param aSection TDesC containing the name of the section 
-	@param aVarName TDesC containing the name of the variable to find
-	@param aResult TInt that gets set to the value of the ini variable
-	@return ETrue if ini file variable found
-	*/
-	virtual TBool FindVar(const TDesC& aSection, const TDesC &aVarName, TInt &aResult) = 0;
-
-	/** Find the value of the specified variable in the named section of the ini file.
-	@param aSection TDesC containing the name of the section 
-	@param aVarName TDesC containing the name of the variable to find
-	@param aResult TPtrC that gets set to the value of the ini variable.
-	@return ETrue if ini file variable found
-	*/
-	virtual TBool FindVar(const TDesC& aSection, const TDesC& aVarName, TPtrC &aResult) = 0;
-	};
-
-/** An interface that allows CRP's and CWsPlugin derived objects to handle events like anim dll's
-@publishedPartner
-@prototype
-*/
-class MWsRawEventServer : public MWsObjectProvider
-	{
-public:
-	DECLARE_WS_TYPE_ID(KMWsRawEventServer)
-
-	/** Register to be notified when some kernel events occur.
-	@return KErrNone if successful
-	@prototype */
-	virtual TInt RegisterRawEventHandler(MEventHandler* aHandler) = 0;
-	/** Unregister from events notification
-	@prototype */
-	virtual void UnregisterRawEventHandler(MEventHandler* aHandler) = 0;
-	/** Creates a new raw event
-	@prototype */
-	virtual void PostRawEvent(const TRawEvent & aEvent) = 0;
-	/** Creates a new key event
-	@prototype */
-	virtual void PostKeyEvent(const TKeyEvent & aEvent) = 0;
-	};
-
-#endif //#ifndef __WSGRAPHICDRAWERINTEFACE_H__
--- a/windowing/windowserver/inc/Graphics/openwfc/surfaceconfiguration.inl	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,432 +0,0 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Sets all members to default values. Initializes the size field to match the object size.
-// 
-//
-/**
-@file
-@publishedpartner 
-@released
-*/
-
-inline TSurfaceConfiguration::TSurfaceConfiguration()
-	{}
-
-/**
-Copy constructor. This constructor will read the size field of the source and target 
-objects and only copy the minimum set of fields indicated. Any remaining fields in the target 
-object will be set to default values. 
-
-@param aSurfaceConfiguration Config to copy
-*/
-inline TSurfaceConfiguration::TSurfaceConfiguration(const TSurfaceConfiguration& aSurfaceConfiguration):
-	TSurfaceConfiguration2(0)
-	{
-	TInt tempSize = aSurfaceConfiguration.Size();
-	if (tempSize > sizeof(*this))
-		{
-		tempSize = sizeof(*this);
-		}
-	Mem::Copy(this, &aSurfaceConfiguration, tempSize);
-	iSize = tempSize;
-	}
-
-/**
-This constructor will take any value, but it is designed to be used with
-a value returned by RWsSession::PreferredSurfaceConfigurationSize, 
-and initializes the members to represent an object compatible with that.
-
-If the aPreferredMaxSize is larger than the actual size of TSurfaceConfiguration, indicating 
-that the server supports a newer version of the interface than the caller is aware of, then 
-the actual size is used.
-
-If the aPreferredMaxSize is smaller than the actual size of TSurfaceConfiguration, indicating 
-that the server supports an earlier version of the interface, then this value is used. It must 
-match the Size() member of one of the defined hierarchy of TSurfaceConfiguration classes.
-
-@param aPreferredMaxSize User defined max size
-@see RWsSession::PreferredSurfaceConfigurationSize
-*/
-inline TSurfaceConfiguration::TSurfaceConfiguration(TInt aPreferredMaxSize):
-	TSurfaceConfiguration2(sizeof(*this))
-	{
-	if (sizeof(*this) > aPreferredMaxSize)
-		{
-		iSize = aPreferredMaxSize;
-		}
-	}
-
-/** Default constructor for configuration 1
-*/
-inline TSurfaceConfiguration1::TSurfaceConfiguration1():TSurfaceConfigurationSize(sizeof(*this))
-		,iExtent(TRect::EUninitialized), iViewport(TRect::EUninitialized)
-	{}
-
-/**
-Constructor for configuration 1 passing through a size already calculated
-
-@param aSize Size of the class already calculated and being passed up through the classes
-*/
-inline TSurfaceConfiguration1::TSurfaceConfiguration1(TInt aSize):TSurfaceConfigurationSize(aSize)
-		,iExtent(TRect::EUninitialized), iViewport(TRect::EUninitialized)
-	{}
-
-/**
-The method sets the surface ID to be set as the background surface. 
-
-The default initial value held in this class for surface ID is the null surface ID.
-
-Note that SetBackgroundSurface() will not accept a null surface ID, so this parameter must always be set.
-
-@param aSurfaceId Surface ID to set
-@return KErrNone on success or a system-wide error code
-	- KErrNotSupported if not supported.
-@post The Surface Id values are updated in the object of this class if supported. The 
-SetBackgroundSurface API must be called passing object of this class as parameter to 
-get the desired effect.
-*/
-inline TInt TSurfaceConfiguration1::SetSurfaceId (const TSurfaceId& aSurfaceId)
-	{
-	if (MemberAccessible(iSurfaceId))
-		{
-		iSurfaceId = aSurfaceId;
-		return KErrNone;
-		}	
-	return KErrNotSupported;
-	}
-
-/**
-The method gets the surface ID stored in the object of this class.
-
-@param aSurfaceId User surface id to be set
-@post The aSurface parameter is filled in.
-@post If the instance of TSurfaceConfiguration is too small, the null surface ID will be set.
-*/
-inline void TSurfaceConfiguration1::GetSurfaceId (TSurfaceId& aSurfaceId) const
-	{
-	if (MemberAccessible(iSurfaceId))
-		{
-		aSurfaceId = iSurfaceId;
-		}
-	else
-		{
-		aSurfaceId.CreateNullId();
-		}
-	}
-
-/**
-The method sets the area of the surface that should be mapped to the specified window area. 
-The viewport is in surface coordinates.
-
-In SetBackgroundSurface(), if not set or if the set viewport is empty, the size of the whole surface 
-is used as the viewport. If the surface is changed then the viewport will track the size of 
-the surface. 
-
-Setting any ordinate of the viewport outside the surface size is not required specified behavior for 
-this interface. The call will not fail if any ordinates are out of range, and the internal NGA Composition 
-handling of this case will produce a representative image. This current behavior is that the NGA Composition 
-will clamp any out-of-range ordinate to the size of the surface.
-
-@param aViewport A rectangle of the area, in relative coordinates to the surface
-@return KErrNone on success or a system-wide error code
-	- KErrNotSupported if not supported.
-@post The viewport values are updated in the object of this class. This does not imply that the 
-viewport is set for the surface. The SetBackgroundSurface API must be called passing an object of 
-this class as parameter to get the desired effect.
-*/
-inline TInt TSurfaceConfiguration1::SetViewport (const TRect& aViewport)
-	{
-	if (MemberAccessible(iViewport))
-		{
-		iViewport = aViewport;
-		return KErrNone;
-		}
-	return KErrNotSupported;
-	}
-
-/**
-This method gets the viewport stored in the object of this class. The viewport is in surface 
-coordinates.
-
-If viewport was not set or an empty viewport was set, the value returned is an empty viewport. This 
-is an indication that the viewport used by the server is equal to the size of the surface. The 
-actual size of the surface is not returned.
-
-@param aViewport User viewport to be set.
-@post The aViewport rectangle is filled in.
-@post If the instance of TSurfaceConfiguration is too small, the empty viewport rectangle will be returned.
-*/
-inline void TSurfaceConfiguration1::GetViewport (TRect& aViewport) const
-	{
-	if (MemberAccessible(iViewport))
-		{
-		aViewport = iViewport;
-		}
-	else
-		{
-		aViewport = TRect();
-		}
-	}
-
-/**
-This method sets the relative orientation of viewport to window extent. The default value is 
-EGraphicsOrientationNormal.
-
-The rotation effect is applied to the input viewport area, around the centre-point of the viewport.
-
-@param aOrientation User orientation to be set
-@return KErrNone on success or a system-wide error code
-	- KErrNotSupported if not supported.
-	- KErrArgument if aOrientation is out of range
-@post The orientation is updated in the object of this class. This does not imply that the orientation 
-is set for the surface content. The SetBackgroundSurface API must be called passing an object of 
-this class as parameter to get the desired effect.
-*/
-inline TInt TSurfaceConfiguration1::SetOrientation (CFbsBitGc::TGraphicsOrientation aOrientation)
-	{
-	if (MemberAccessible(iOrientation))
-		{
-		__ASSERT_COMPILE(CFbsBitGc::EGraphicsOrientationNormal==0 && 
-						CFbsBitGc::EGraphicsOrientationRotated270 == 3);
-		if(aOrientation < CFbsBitGc::EGraphicsOrientationNormal || 
-				aOrientation > CFbsBitGc::EGraphicsOrientationRotated270)
-			{
-			return KErrArgument;
-			}
-		iOrientation = aOrientation;
-		return KErrNone;
-		}
-	return KErrNotSupported;
-	}
-
-/**
-The method gets the surface orientation angle stored in the object of this class. It is the 
-relative orientation of viewport to window extent. If orientation was not set, the value returned 
-will be EGraphicsOrientationNormal.
-
-@return orientation in this object
-@post If the instance of TSurfaceConfiguration is too small, the default EGraphicsOrientationNormal 
-setting will be returned.
-*/
-inline CFbsBitGc::TGraphicsOrientation TSurfaceConfiguration1::Orientation() const
-	{
-	if (MemberAccessible(iOrientation))
-		{
-		return iOrientation;
-		}
-	else
-		{
-		return CFbsBitGc::EGraphicsOrientationNormal;
-		}
-	}
-
-/**
-This method sets the area of the window where the surface content is to be placed. The extent is 
-in window coordinates.
-
-If not set or if the set extent is empty, the size of the entire window is used as the default extent. 
-The default extent changes according to the change in the window size. The empty extent is an indication 
-to the server that the extent should fill the entire window without the client tracking the change in 
-the window size.
-
-In SetBackgroundSurface() it is legal to set the extent larger than the window, or the window may 
-become smaller than the extent. In these cases the output will be transformed on the basis of this 
-larger extent, but then clipped to the window outline.
-
-@param aExtent Area on the window where the surface contents specified by viewport
-should be mapped
-@return KErrNone on success or a system-wide error code
-	- KErrNotSupported if not supported.
-@post The extent values are updated in the object of this class. This does not imply that the 
-extent is set for the surface. The SetBackgroundSurface API must be called passing an object of 
-this class as parameter to get the desired effect.
-*/
-inline TInt TSurfaceConfiguration1::SetExtent(const TRect& aExtent)
-	{
-	if (MemberAccessible(iExtent))
-		{
-		iExtent = aExtent;
-		return KErrNone;
-		}
-	return KErrNotSupported;
-	}
-
-/**
-The method gets the extent stored in the object of this class. The extent is in window coordinates.
-
-If extent was not set or an empty extent was set, the value returned will be an empty extent. This 
-is an indication that the extent used by the server is equal to the size of the window. The actual 
-size of the window is not returned.
-
-@param aExtent User extent to be set
-@post The aExtent parameter is filled in
-@post If the instance of TSurfaceConfiguration is too small, the empty extent rectangle will be returned.
-*/
-inline void TSurfaceConfiguration1::GetExtent(TRect& aExtent) const
-	{
-	if (MemberAccessible(iExtent))
-		{
-		aExtent = iExtent;
-		}
-	else
-		{
-		aExtent = TRect();
-		}
-	}
-
-/**
-This method identifies which attributes are available to use.
-
-Generally, any version of the server will accept any version of TSurfaceConfiguration, ignoring 
-newer version attributes it does not recognize and substituting defaults for attributes not present 
-in older version.
-
-However, by using this method in conjunction with GetBackgroundSurface() the intelligent client can 
-identify which blocks of attributes are actually present and supported after a call to 
-GetBackgroundSurface, avoiding preparing complex attributes, or reducing user-interface control 
-gadgets.
-
-@return ETrue if all these attributes are available to use; otherwise EFalse
-*/
-inline TBool TSurfaceConfiguration1::SupportsAllMembers()
-	{
-	if (Size() >= sizeof(*this))
-		{
-		return ETrue;
-		}
-	else
-		{
-		return EFalse;
-		}
-	}
-
-/**
-Constructs the TSurfaceConfigurationSize class, enters the size field and blanks everything else
-
-@param aSize The size to set for the configuration
-@return ETrue If all these attributes are available to use; otherwise EFalse
-*/
-inline TSurfaceConfigurationSize::TSurfaceConfigurationSize(TInt aSize)
-	{
-	Mem::FillZ(this,aSize);
-	iSize = aSize;
-	}
-
-/**
-Reads the size field. The size is set automatically in the constructor, or by the 
-GetBackgroundSurface method to indicate the sender’s supported structure size, and imply a 
-compatible version identifier. The size reported after GetBackgroundSurface will match 
-the expected size of one of the hierarchy of TSurfaceConfiguration classes documented in the 
-header, and will never exceed the constructed size.
-
-@return ETrue if all these attributes are available to use; otherwise EFalse
-*/
-inline TInt TSurfaceConfigurationSize::Size() const
-	{
-	return iSize;
-	}
-
-inline TBool TSurfaceConfigurationSize::operator == (const TSurfaceConfigurationSize& aRhs)const
-	{
-	return aRhs.Size()==Size();	//If the two objects are not the same version then we can't compare them!
-	}
-inline TBool TSurfaceConfiguration1::operator == (const TSurfaceConfiguration1& aRhs)const
-	{
-	if (!TSurfaceConfigurationSize::operator ==(aRhs))
-		return EFalse;	//Check for earlier version compatability
-	if (Size()<sizeof(*this))
-		return ETrue;	//If the objects are smaller than this then the check is complete
-	return 	(iSurfaceId==aRhs.iSurfaceId)
-		&&	(iOrientation==aRhs.iOrientation)
-		&&	(iExtent==aRhs.iExtent)
-		&&	(iViewport==aRhs.iViewport)
-		;
-	}
-
-/** Default constructor for configuration 2
-*/
-inline TSurfaceConfiguration2::TSurfaceConfiguration2():TSurfaceConfiguration1(sizeof(*this))
-        ,iFlip(EFalse)
-    {}
-
-/**
-Constructor for configuration 2 passing through a size already calculated
-
-@param aSize Size of the class already calculated and being passed up through the classes
-*/
-inline TSurfaceConfiguration2::TSurfaceConfiguration2(TInt aSize):TSurfaceConfiguration1(aSize)
-        ,iFlip(EFalse)
-    {}
-
-/**
-This method sets the flip attribute to the surface. The default value is 
-EFalse.
-
-@param aFlip When ETrue enalbes flip in the x-axis
-@post The flip attribute is updated in the object of this class. This does not imply that the flip 
-is set for the surface content. The SetBackgroundSurface API must be called passing an object of 
-this class as parameter to get the desired effect.
-@return KErrNone on success 
-    - KErrNotSupported if flip is not supported. 
-*/
-inline TInt TSurfaceConfiguration2::SetFlip(TBool aFlip)
-    {
-    if (MemberAccessible(iFlip))
-        {
-        iFlip = aFlip;
-        return KErrNone;
-        }
-     return KErrNotSupported;
-    }
-
-/**
-The method gets the flip attribute of the surface stored in the object of this class. If the flip was not set, the value returned 
-will be EFalse.
-
-@return ETrue if flip is enabled
-@post If the instance of TSurfaceConfiguration is too small, the default EFalse 
-setting will be returned.
-*/
-inline TBool TSurfaceConfiguration2::Flip() const
-    {
-    if (MemberAccessible(iFlip))
-        {
-        return iFlip;
-        }
-    else
-        {
-        return EFalse;
-        }
-    }
-
-inline TBool TSurfaceConfiguration2::SupportsAllMembers()
-    {
-    if (Size() >= sizeof(*this))
-        {
-        return ETrue;
-        }
-    else
-        {
-        return EFalse;
-        }
-    }
-
-inline TBool TSurfaceConfiguration2::operator == (const TSurfaceConfiguration2& aRhs)const
-    {
-    if (!TSurfaceConfiguration1::operator ==(aRhs))
-        return EFalse;  //Check for earlier version compatability
-    if (Size()<sizeof(*this))
-        return ETrue;   //If the objects are smaller than this then the check is complete
-    return  iFlip==aRhs.iFlip;
-    }
--- a/windowing/windowserver/inc/Graphics/openwfc/wsdisplaymapping.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Interface for Render Stage Display Mapping
-// 
-//
-/**
-@file
-@publishedpartner 
-@released
-*/
-
-#ifndef WSDISPLAYMAPPING_H_
-#define WSDISPLAYMAPPING_H_
-
-#include <graphics/displaymapping.h>
-
-class MWsDisplayMapping: public MWsObjectProvider,public MDisplayMappingBase
-	{
-public:
-	enum	
-		{
-		KUidWsDisplayMapping =  0x1028656C, 	 
-		ETypeId=				KUidWsDisplayMapping,
-		EWsObjectInterfaceId=	KUidWsDisplayMapping
-		};
-	enum	TOffsetFlags
-		{
-		KOffsetAll=	0xffffffff,
-		KOffGc=		0x00000001,
-		KOffMap=	0x00000002,
-		KOffElement=0x00000004,
-		};
-public:
-	virtual void SetSizeModeExtent(TRect& aExtent, TBitFlags32 aContext)=0;
-	};
-
-#endif /*WSDISPLAYMAPPING_H_*/
--- a/windowing/windowserver/inc/Graphics/openwfc/wselement.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,498 +0,0 @@
-// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Interface for Scene Elements
-// 
-//
-
-/**
- @publishedPartner
- @prototype
-*/
-
-#ifndef WSELEMENT_H
-#define WSELEMENT_H
-
-#include <w32std.h>
-#include <graphics/wsgraphicdrawerinterface.h>
-#include <graphics/surface.h>
-
-/**
- * @brief Window Server Scene Element Interface Definition
- *
- * This interface allows Image Sources to be associated with meta-data
- * to define how the Image Source must be presented within a Scene.
- *
- * For a conceptual overview of Scenes, refer to the @c MWsScene Interface.
- *
- * The following aspects of Image Source presentation may be controlled:
- * @li Source rectangular region
- * @li Destination rectangular region
- * @li Rotation and flipping
- * @li Opacity
- * @li Relative z-order (ordinal position)
- * @li Tags to descriminate the UI from other Elements
- *
- * All co-ordinates are pixels offsets from (0,0) representing the
- * top level of the Image Source or Destination Target (the screen
- * or an off-screen buffer representing the screen), moving rightwards
- * and downwards in x and y co-ordinates respectively.
- *
- * Elements can be marked with flags.  There are two different consumers
- * of flags: Target Renderers and Render Stage Plug-ins.
- * 
- * Target Renderers are sub-systems which actually do composition and
- * rendering on a particular display device or off-screen buffer.
- * The EElementTransparencySource flag tells the Target Renderer that 
- * alpha blending must use the alpha channel in the Surface connected to
- * the Element.
- * 
- * On the other hand, Render Stage Plug-ins need flags to implement
- * specific policies such as "UI always on top".  To facilitate this,
- * Elements have a EElementIsIndirectlyRenderedUserInterface or a
- * EElementIsDirectlyRenderedUserInterface optionally set.  This
- * flag allows Render Stage Plug-ins to keep the relative z-order
- * of Elements aligned to this policy.
- * 
- * To allow compatible updates to be made to flags, all Render Stage
- * Plug-ins must preserve the flags in Elements which they do not operate
- * upon.  Target Renderers may ignore the flags in Elements which they
- * do not operate on.
- *
- * <h2>Intial State</h2>
- * 
- * The initial state for an Element is:
- * @li Fully opaque
- * @li No rotation, nor flipped
- * @li Not part of the Committed Scene
- * @li No connected Surface
- * @li All flags reset
- * @li Local error value set as KErrNone
- * @li Source Rectangle and Destination Rectangle is (0,0,0,0)
- * @il Destination Clipping Rectangle is (0,0,0,0)
- * 
- * When an Image Source is connected, the initial state becomes:
- * @li Source Rectangle is the extent of the Image Source
- * @li Destination Rectangle is set at origin (0,0), whose sized equals the
- *     Image Source size truncated the the target screen size.
- * @li Destination Clipping Rectangle is (0,0,0,0) to represent the entire
- *     area of the target screen.
- * 
- * <h2>Special Rectangle Values</h2>
- * 
- * Sometimes it is desirable to reset a Source, Destination, or Clipping
- * Rectangle so that the actual value used matches the corresponding Source
- * Image or Target Screen size.  In such cases rectangle (0,0,0,0) is used to
- * represent this.
- * 
- * <h2>Extending this interface</h2>
- * 
- * This interface can be extended in two different ways
- * @li Creating optional extension interfaces with 
- *       MWsElement::MWsObjectProvider::ResolveObjectInterface()
- * @li Defining new TElementFlags flag settings; Render Stage Plug-ins
- *       preserve the value of these across the Render Stage Pipeline.
- *
- * <h2>Committed Elements versus Pending Elements</h2>
- * 
- * This interface allows Elements to be modified in terms of their
- * own flag settings, and rotation, as well as their relative position
- * with other Elements.  Queries return the pending values for such
- * Elements.  Any modifications are marked Pending, and affect the Scene
- * according to the rules described by "Rendering" in @c MWsScene.
- * 
- * <h2>Order in which transformations are applied</h2>
- * 
- * A number of different transformations may be specified for an Element.
- * The order in which these are applied to arrive at the view seen in
- * the target is:
- * -# SetSourceRectangle              (Cropping)
- * -# SetSourceFlipping               (Flipping)
- * -# SetSourceRotation               (Rotation)
- * -# SetDestinationRectangle         (Scaling and Positioning)
- * -# SetDestinationClippingRectangle (Scaling and Positioning)
- * -# SetGlobalAlpha                  (Blending)
- */
-class MWsElement : public MWsObjectProvider
-    {
-public:
-    
-    /**
-     * @brief Flags used by Target Renderers.
-     */
-    enum TElementTargetRendererFlags
-        {
-        /**
-         * Target renderer must treat the Element as Opaque.
-         */
-        EElementTransparencyNone                 = 0,
-        /**
-         * Target renderer must use the Global Alpha Transparency value
-         * from the Element
-         */
-        EElementTransparencyGlobalAlpha          = (1 << 0),
-        /**
-         * Target renderer must use the Alpha Transparency Channel from
-         * the Element
-         */
-        EElementTransparencySource               = (1 << 1),
-        /**
-         * Reserved flag value; this must not be set.
-         */
-        EElementTargetRendererReserved           = (1 << 2)
-        };
-    
-    /**
-     * @brief Flags used by Render Stages.
-     */
-    enum TElementRenderStageFlags
-        {
-        /**
-         * No flag value set for Render Stage Plug-in
-         */
-        EElementRenderStageNone                   = 0,
-        /**
-         * Indirectly Rendered User Interface, i.e. rendering via 
-         * MWsGraphicsContext calls originating from client CWindowGc
-         * commands
-         */
-        EElementIsIndirectlyRenderedUserInterface = (1 << 0),
-        /**
-         * Directly Render User Interface, i.e. rendering where Window
-         * Server does not see the graphics commands, as is the case for
-         * Direct Screen Access clients.
-         */
-        EElementIsDirectlyRenderedUserInterface   = (1 << 1),
-        /**
-         * Reserved values for future Render Stage Plug-in usage
-         */
-        EElementRenderStageReserved               = (1 << 2)
-        };
-    
-    /**
-     * Amount of rotation of pixel data to apply to the Image Source
-     * to obtain the Target Image
-     */
-    enum TElementRotation
-        {
-        EElementAntiClockwise0   = 0, /** No rotation */
-        EElementAntiClockwise90  = 1, /** 90 Degrees Anti-clockwise in target */
-        EElementAntiClockwise180 = 2, /** 180 Degrees Anti-clockwise in target */
-        EElementAntiClockwise270 = 3  /** 270 Degrees Anti-clockwise in target */
-        };
-    
-public:
-    /**
-     * @brief Set which portion of the image source is used.
-     *
-     * Set which rectangular portion of the connected image source
-     * will be used when displaying this Element.
-     *
-     * @param aSrc  The source rectangle of pixels from the connected Image Source.
-     *              This rectangle must not include any pixels outside the Image
-     *              Source.  (0,0,0,0) means the entire size of the Image Source.
-     * @pre     An Image Source must have been connected; @see ConnectSurface()
-     * @return  One of the system-wide error codes.  
-     *          KErrGeneral, if there is no image source connected.
-     *          KErrArgument, if the source rectangle includes pixels not in the 
-     *          connected image source, or has negative width or height.  
-     *          KErrNone, if successful.
-     */
-    virtual TInt SetSourceRectangle(const TRect& aSrc) = 0;
-    
-    /**
-     * @brief Get the portion of the Image Source being used.
-     *
-     * Get the portion of the connected Image Source being used.  The default
-     * value is the entire extent of the connected Image Source.
-     *
-     * @param aSrc  The source rectangle is updated with the current rectangular
-     *              region being used within the Image Source.
-     * @pre     An Image Source must have been connected; @see ConnectSurface()
-     * @return  One of the system-wide error codes.  
-     *          KErrGeneral, if no Image Source has been connected.  
-     *          KErrNone, if successful.
-     */
-    virtual TInt GetSourceRectangle(TRect& aSrc) = 0;
-    
-    /**
-     * @brief Set the target area where the Image Source should appear.
-     * 
-     * Set the target area in the target screen (or off-screen buffer)
-     * where the Image Source should appear.  Scaling may result if
-     * the source and destination rectangles differ.  A platform specific
-     * algorithm will be used to interpolate the scaled image.
-     * 
-     * @param aDest  The destination rectangle in the target.
-     * @pre     An Image Source must have been connected; @see ConnectSurface()
-     * @return  One of the system-wide error codes.  
-     *          KErrGeneral, if there is no image source connected. 
-     *          KErrArgument, if the destination rectangle has negative width or 
-     *          height.  
-     *          KErrNone, if successful.
-     */
-    virtual TInt SetDestinationRectangle(const TRect& aDest) = 0;
-    
-    /**
-     * @brief Get the target area where the Image Source would appear.
-     * 
-     * Get the target area where the Image Source would appear.  The default
-     * value is at (0,0) sized to the Image Source clipped to the size
-     * of the target.
-     * 
-     * @param aDest  The destination rectangle is updated with the current
-     *               region used in the target screen. 
-     * @pre     An Image Source must have been connected; @see ConnectSurface()
-     * @return  One of the system-wide error codes.  
-     *          KErrGeneral, if no Image Source has been connected.  
-     *          KErrNone, if successful.
-     */
-    virtual TInt GetDestinationRectangle(TRect& aDest) const = 0;
-    
-    /**
-     * @brief Clip the target area where the Image Source would appear.
-     * 
-     * Set clipping area where the Image Source would appear.  The default
-     * value is the area of the target screen.
-     * 
-     * @param aDestClipRect  The clipping rectangle in the target.  (0,0,0,0)
-     *                       means the entire size of the Target Screen.
-     * @return  One of the system-wide error codes.  
-     *          KErrGeneral, if no Image Source has been connected. 
-     *          KErrArgument, if the rectangle has negative width or height  
-     *          KErrNone, if successful.
-     */
-    virtual TInt SetDestinationClippingRect(const TRect& aDestClipRect) = 0;
-    
-    /**
-     * @brief Get the clipping area in the target.
-     * 
-     * Get the clipping area which limits where in the target screen the
-     * element may appear.
-     * 
-     * @param aDestClipRect  The clipping rectangle is updated with the current
-     *                       clipping area used in the target screen.
-     * @return  One of the system-wide error codes.  KErrGeneral means no Image
-     *          Source has been connected.  KErrNone is returned upon success.      
-     */
-    virtual TInt GetDestinationClippingRect(TRect& aDestClipRect) const = 0;
-    
-    /**
-     * @brief Set the rotation that should appear in the target for the
-     * Image Source.
-     * 
-     * Set the rotation which describes how the connected Image Source
-     * should be rotated to appear in the target.
-     * 
-     * @param aElementRotation  The amount of rotation in the target.
-     * @pre     An Image Source must have been connected; @see ConnectSurface()
-     * @return  One of the system-wide error codes.  
-     *          KErrGeneral, if no Image Source has been connected.  
-     *          KErrArgument, if an out of bounds rotation value has been 
-     *          supplied.  
-     *          KErrNone, if successful.
-     */
-    virtual TInt SetSourceRotation(const TElementRotation aElementRotation) = 0;
-    
-    /**
-     * @brief Get the pending rotation setting as it would appear in the target.
-     * 
-     * Get the pending rotation setting for the connected Image Source.
-     * By default, the rotation is EElementAntiClockwise0 and this is returned
-     * if there is no connected Image Source.
-     * 
-     * @return  The pending rotation setting.
-     */
-    virtual TElementRotation SourceRotation() const = 0 ;
-    
-    /**
-     * @brief Set flipping about the image horizontal centerline.
-     * 
-     * Set the pending flipping setting for the connected Image Source.
-     * When flipped, the Image Source appears in the target as inverted
-     * about its horizontal centerline.  This effect can be combined
-     * with rotation effects.
-     * By default, the Image Source is not flipped.
-     * 
-     * @param aFlip  If ETrue, the connected Image is flipped, else
-     *               it is not flipped.
-     * @pre     An Image Source must have been connected; @see ConnectSurface()
-     * @return  One of the system-wide error codes.  
-     *          KErrGeneral, if no Image Source has been connceted.  
-     *          KErrNotSupported, if the platform does not support the feature.  
-     *          KErrNone, if successful.
-     */
-    virtual TInt SetSourceFlipping(const TBool aFlip) = 0;
-    
-    /**
-     * @brief Get the pending flipping setting.
-     * 
-     * Get the pending flipping setting for the connected Image Source.
-     * By default, the image is not flipped.
-     * 
-     * @return  The pending flipping setting.  If no Image is connected, return
-     *          EFalse.
-     */
-    virtual TBool SourceFlipping() const = 0 ;
-    
-    /**
-     * @brief Set Target Renderer Flags associated with this Element
-     * 
-     * Set the Target Renderer flags to be associated with this Element.
-     * 
-     * @note    Flags which are not recognised by an implementation must
-     *          be kept to allow the interface to be extended in a 
-     *          compatible manner.
-     * @param aTargetRendererFlags  Flags to set for Target Renderer;
-     *                              @see TElementTargetRendererFlags
-     * @return  One of the system-wide error codes.  
-     *          KErrNotSupported, if the platform does not support the given 
-     *          flags.  
-     *          KErrArgument, if incompatible flag settings have been made.  
-     *          KErrNone, if successful.
-     */
-    virtual TInt SetTargetRendererFlags(const TUint32& aTargetRendererFlags) = 0;
-    
-    /**
-     * @brief Set Render Stage Flags associated with this Element
-     * 
-     * Set the Render Stage flags to be associated with this Element.
-     * 
-     * @note    Flags which are not recognised by an implementation must
-     *          be kept to allow the interface to be extended in a 
-     *          compatible manner.
-     * @param aRenderStageFlags  Flags to set for Render Stage Plug-ins;
-     *                           @see TElementRenderStageFlags
-     * @return  One of the system-wide error codes.  
-     *          KErrNotSupported, if the platform does not support the given 
-     *          flags.  
-     *          KErrArgument, if incompatible flag settings have been requested.  
-     *          KErrNone, if successful.
-     */
-    virtual TInt SetRenderStageFlags(const TUint32& aRenderStageFlags) = 0;
-    
-    /**
-     * @brief Get Target Renderer Flags associated with this Element
-     * 
-     * Get the Target Renderer flags associated with this Element.
-     *   
-     * @note    Flags which are not recognised by an implementation must
-     *          be kept to allow the interface to be extended in a 
-     *          compatible manner.
-     * @param aTargetRendererFlags  Variable to receive TElementTargetRendererFlags
-     */
-    virtual void GetTargetRendererFlags(TUint32& aTargetRendererFlags) const = 0;
-
-    /**
-      * @brief Get Render Stage Flags associated with this Element
-      * 
-      * Get the Render Stage flags associated with this Element.
-      *   
-      * @note    Flags which are not recognised by an implementation must
-      *          be kept to allow the interface to be extended in a 
-      *          compatible manner.
-      * @param aRenderStageFlags  Variable to receive TElementRenderStageFlags
-      */
-     virtual void GetRenderStageFlags(TUint32& aRenderStageFlags) const = 0;   
-     
-    /**
-     * @brief Get the Element above this Element.
-     * 
-     * Get the Element which is above this Element in the Pending Scene.
-     * If the Element is the top-most element, NULL is returned.  If the
-     * Element is not in the Scene, NULL is returned.
-     * 
-     * @return Element above, or NULL.
-     */
-    virtual MWsElement *ElementAbove() = 0;
-    
-    /**
-     * @brief Get the Element below this Element.
-     * 
-     * Get the Element which is below this Element in the Pending Scene.
-     * If the Element is the bottom-most element, NULL is returned.  If the
-     * Element is not in the Scene, NULL is returned.
-     * 
-     * @return Element below, or NULL.
-     */
-    virtual MWsElement *ElementBelow() = 0;
-    
-    /**
-     * @brief Connect or re-Connect a Surface to this Element.
-     * 
-     * Connect the given Surface to this Element, or re-Connect a new
-     * Surface to this Element which already has a connected Surface.
-     * The Element does not need to be in the Scene when this call is made.
-     * 
-     * @note    The Source Rectangle of the Element is updated to correspond
-     *          to match the Source Rectangle of the Surface.  Thus any
-     *          prior Source Rectangle setting will be overwritten.
-     * 
-     * @param aSurface  Surface to connect to.  If this is the Null
-     *                  Surface, then the Source Rectangle of the
-     *                  Element is set to (0,0,0,0).
-     * @return  One of the system-wide error codes.  
-     *          KErrArgument, if supplied Surface cannot be connected.  For 
-     *          example the Element has a flag indicating it has an Alpha 
-     *          Channel but the Surface does not.  
-     *          KErrNone, if successful.
-     */
-    virtual TInt ConnectSurface(const TSurfaceId& aSurface) = 0;
-    
-    /**
-     * @brief Get the Surface connected to this Element
-     * 
-     * @return  The Surface Identifier of the Connected Surface.  This
-     *          identifier may represent the Null Surface Id if there
-     *          was no Surface connected in the Pending Scene for this
-     *          Element.
-     */
-    virtual const TSurfaceId& ConnectedSurface() const = 0;
-    
-    /**
-     * @brief Set the Global Alpha Transparency value
-     * 
-     * Sets the Global Alpha Transparency value for this Element.  Elements
-     * are by default fully opaque, represented by opacity 255.  On platforms
-     * that support it, the Alpha Transparency value can be reduced down
-     * to 0 representing fully transparent.  The purpose of this is to
-     * allow the fading in and fading out of Elements into the Scene.
-     * 
-     * @param aAlpha  The Alpha Transparency value desired.  Values
-     *                are clamped to be within the range [0, 255] where 0
-     *                represents fully transparent, and 255 represents
-     *                fully opaque.
-     * @note    This setting has no effect unless the flag
-     *          Target Renderer flag EElementTransparencyGlobalAlpha
-     *          is set; @see SetTargetRendererFlags()
-     * @note    Out of range values are clamped silently, and do not cause
-     *          error conditions.
-     * @return  One of the system-wide error codes.  
-     *          KErrNotSupported, if the supplied value, once clamped, is not 
-     *          supported on the platform.
-     *          KErrNone, if successful.
-     */
-    virtual TInt SetGlobalAlpha(const TInt aAlpha) = 0;
-    
-    /**
-     * @brief Get the Global Alpha Transparency value
-     * 
-     * Gets the Global Alpha Transparency value for this Element.  Elements
-     * are by default fully opaque, represented by opacity 255.
-     * 
-     * @param aAlpha  Variable which receives the Global Alpha Transparency
-     *                value.
-     */
-    virtual void GlobalAlpha(TInt& aAlpha) const = 0;
-    };
-#endif // WSELEMENT_H
--- a/windowing/windowserver/inc/Graphics/openwfc/wsscene.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,385 +0,0 @@
-// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Interface for Window Server Scene
-//
-//
-
-/**
- @publishedPartner
- @prototype
-*/
-
-#ifndef WSSCENE_H
-#define WSSCENE_H
-
-#include <babitflags.h>
-#include <w32std.h>
-#include <graphics/wsgraphicdrawerinterface.h>
-
-class MWsElement;
-
-/**
- * @brief Window Server Scene Interface Definition.
- * 
- * MWsScene is a CWsRenderStage interface extension.  An understanding
- * of the Render Stage Plug-in architecture, and the CWsRenderStage API
- * is required in order to use and understand this interface.
- * 
- * A MWsScene manages a collection of MWsElements that define
- * what is shown to a User on a particular target display, or off-screen
- * buffer.
- * 
- * A MWsScene constitute of MWsElements.  Each MWsElement represents
- * a rectangular region of the screen.  MWsElements have meta-data which
- * describe the region, such as the image orientation, extent, and
- * alpha-blending characteristics.  MWsElements also have surface-data,
- * which provides the pixel data to be shown in the given area of the
- * screen.  
- * 
- * The purpose of an MWsScene is to manage the relative ordinal positions
- * of scene elements.  Typically elements representing the camera view-
- * finder, or video frames, is placed at the bottom, and the user interface
- * element is placed above.  Semi-transparency is often used to blend
- * such elements into a visually appealing scene, and transparent holes
- * in the user interface element allow elements below to poke through.
- * 
- * The goal of this interface is to allow suitable platforms to implement
- * this API using composition hardware.  This is to reduce power and
- * CPU load, so a long movie might be played, for example.
- * 
- * A secondary goal of this interface is to enable transition effects
- * to be efficiently implemented.  This is because MWsScenes can be
- * chained together in a Render Stage pipeline.  Element meta-data
- * can be manipulated by transition effects render stages before actual
- * rendering.
- * 
- * <h1>Examples of Elements</h1>
- * @li Camera view-finder
- * @li Video frame
- * @li User interface
- * 
- * There can be two types of user interface element: directly rendered
- * and indirectly rendered.  
- * 
- * Indirect rendering is the normal case.  Here the client provides
- * CWindowGc commands, which Window Server passes as MWsGraphicsContext
- * API calls to the Render Stage.
- * 
- * Direct rendering is where Window Server does not see the graphics
- * commands, as is the case for Direct Screen Access clients.
- * 
- * <h1>Use Cases</h1>
- * 
- * <h2>Instantiation</h2>
- * 
- * During system-startup Window Server needs to obtain an instance of
- * the MWsScene interface in order to place MWsElements in the scene
- * for rendering.
- * 
- * MWsScene is a CWsRenderStage interface extension, accessed by
- * @code
- * CWsRenderStage::ResolveObjectInterface(KMWsScene);
- * @endcode
- * 
- * The initial values are:
- * @li No rotation is applied
- * @li No Elements are in the Scene
- * @li Scene is connected to same display as its CWsRenderStage
- * 
- * Note Elements may be added/inserted/removed subject to implementation-
- * defined constraints; the connected display is immutable.
- * 
- * <h2>Rendering</h2>
- * 
- * When the Scene changes, Window Server needs to communicate the changes
- * and then render the new Scene.  This can happen when a video player
- * application is launched, whereby a new User Interface control is placed
- * on the screen, and a new Element representing the Video Surface is added.
- * 
- * The Window Server must use the CWsRenderStage interface to provide
- * updates to the Scene.
- * @code
- * CWsRenderStage::Begin(regionOfScreenWithVideoPlayer);
- * drawing ops sent to MWsGraphicsContext for UI
- * drawing ops to setup a transparent hole for video surface to poke
- * through
- * .
- * .
- * 
- * sceneElement = CreateSceneElementL();
- * sceneElement->ConnectSurface(videoSurfaceAlreadySetup);
- * InsertSceneElement(sceneElement, NULL);
- * CWsRenderStage::End(asyncCallbackNotification);
- * @endcode
- * 
- * When Scene updates, such as in the example above, are done there is
- * a concept of the "Committed Scene".  All Scene updates are considered
- * to be "Pending" until a CWsRenderStage::End() has been called.  Then
- * the pending changes are applied atomically.  Either the previously
- * Committed Scene is re-instated or all the Pending changes are accepted
- * to form the newly Committed Scene.  This depends on platform-specific
- * limitations, and system-wide resource availability.
- * 
- * <h2>Orientation Changes to Elements</h2>
- * 
- * Suppose we have an MWsElement representing people as seen through a video
- * camera view finder in landscape orientation, with the handset also in
- * landscape orientation.  The handset is rotated into portrait mode.
- * 
- * We desire the view finder to be rotated in the opposite
- * sense to the rest of the User Interface.  This is to allow people
- * previously vertical in the view finder to remain vertical.
- * 
- * For this use case, a MWsElement::SetSourceRotation() must be called.
- * 
- * The changes are visible after the next @c CWsRenderStage::End() call.
- * 
- * <h2>Orientation Changes to Scenes</h2>
- * 
- * Suppose the entire Scene comprises a single User Interface element.
- * The handset is then rotated from landscape to portrait mode.
- * The whole scene must be rotated to compensate.  Here 
- * MWsScene::SetSceneRotation() must be called.
- * 
- * The changes are visible after the next @c CWsRenderStage::End() call.
- * 
- * <h2>Leveraging external APIs for Transition Effects</h2>
- *
- * Suppose we want to manipulate the Scene to achieve a transition
- * effect.  The Scene as presented by Window Server comprises one
- * UI Element, and one External Surface Element.  We have an external
- * APIs, such as OpenGL or OpenWF, available to deliver a transition effect
- * into a different External Surface.
- * 
- * This task is accomplished by using the output Surface of OpenGL as
- * the connected Image Source for the one Element which comprises the Scene
- * presented on the Screen.
- * The Elements inserted into the Scene by Window Server are instead given
- * to OpenGL as textures.  When the Screen needs to be rendered, OpenGL
- * is first used to render to its output Surface, and this is taken
- * as-is for the Scene Element that appears on the Screen.
- * 
- * A combination of Rendering APIs may be employed if they are available
- * to the Transition Effects Render Stage -- to combine the power of
- * OpenVG, OpenGL, and OpenWF, as an example.
- *
- * <h2>Managing the life-cycle of Surfaces from Window Server</h2>
- *
- * Suppose we want to maintain the life-cycle of a given Surface outside
- * that needed by the Scene.  For example, suppose we have a video player
- * application whose picture is frozen to a particular frame.  Then the
- * application switches to some other view, no longer showing the video
- * frame.  Finally, the application switches back to the original video
- * frame so that the video clip can be resumed.
- *
- * In such a scenario, we would want the contents of the Surface to
- * remain constant event though at one point the Surface is not part
- * of the Scene.  This is so that the user does not see anything
- * inconsistent appear with the video frame between switching from and
- * to the video frame.
- *
- * Another scenario where the Surface needs to have a life-cycle beyond
- * that of the Scene is when there is a large start-up cost to populating
- * the Surface with initial data.  For example, a computer game application
- * might take some seconds to construct the textures for an initial game
- * position.  The game would want to construct the Surface, and populate
- * its contents before supplying the Surface as a Background Surface for
- * a given window.  This is so that the user does not see the game building
- * up the Surface contents during game start-up.
- *
- * To facilitate the above use case, a call to RegisterSurface and a 
- * corresponding call to UnregisterSurface must be made.  Note, Window
- * Server should provide an UnregisterSurface call if the client program
- * dies or exits abruptly before it could call UnregisterSurface.
- */
-class MWsScene : public MWsObjectProvider
-    {
-public:
-    DECLARE_WS_TYPE_ID(KMWsScene)
-    
-public:
-    
-    /**
-     * Amount of rotation of pixel data in the target display or
-     * target surface for the entire scene.
-     */
-    enum TSceneRotation
-        {
-        ESceneAntiClockwise0 = 0,   /** No rotation */
-        ESceneAntiClockwise90 = 1,  /** 90 Degrees Anti-clockwise in target */
-        ESceneAntiClockwise180 = 2, /** 180 Degrees Anti-clockwise in target */
-        ESceneAntiClockwise270 = 3  /** 270 Degrees Anti-clockwise in target */
-        };
-       
-    /**
-     * @brief   Update the rotation setting for the entire scene.
-     * @param aSceneRotation  The new rotation setting
-     * @note    The changes are visible after the next @c CWsRenderStage::End()
-     *          or @c ScreenSnapshot() call.
-     * @return  One of the system-wide error codes.  KErrArgument means
-     *          aSceneRotation is out-of-range, KErrNotSupported means the
-     *          setting is not supported.  KErrNone is returned upon success.
-     */
-    virtual TInt SetSceneRotation(const TSceneRotation aSceneRotation) = 0;
-    
-    /**
-     * @brief   Obtain the current rotation setting for the entire scene
-     * @return  The currently committed scene rotation setting.
-     */
-    virtual TSceneRotation SceneRotation() const = 0;
-    
-    /**
-     * @brief Create a Scene Element for this scene.
-     * 
-     * Create a new Scene Element for use in the Scene.  The Scene Element
-     * is immediately available to the caller, but is not in the Scene.
-     * It must be inserted into the Scene, at which time is is considered
-     * a Pending Scene change.  Once @c CWsRenderStage::End() has been called
-     * the Element is rendered in the target and becomes part of the Committed
-     * Scene.
-     * 
-     * @return  The Scene Element
-     * @leave   KErrNoMemory There are insufficient memory resources
-     */
-    virtual MWsElement* CreateSceneElementL() = 0;
-    
-    /**
-     * @brief Destroy Scene Element
-     * 
-     * Remove the specified element from the scene, and then destroy
-     * resources associated with it.
-     * 
-     * @note  The update is seen after the next @c CWsRenderStage::End()
-     *        call.
-     * @param aElement  The element to destroy.  If NULL, the scene is
-     *                  unmodified.
-     */
-    virtual void DestroySceneElement(MWsElement* aElement) = 0;
-    
-    /**
-     * @brief Insert or Re-insert the Scene Element into the Scene
-     * 
-     * Insert the Scene Element into the Scene above the aSubordinateElement,
-     * or re-insert the existing Element but into a new position in the Scene.
-     * 
-     * @note    The same element cannot be in the scene at more than one
-     *          z-order position.
-     * @pre     The element must have previously been created @c 
-     *          CreateSceneElementL()
-     * @return  One of the system-wide error codes.  KErrArgument means
-     *          aElement or aSubordinateElement is not a valid element for this
-     *          Scene.  KErrNone is returned upon success.
-     * @param aInsertElement        The element to add; cannot be NULL
-     * @param aSubordinateElement   The element which will be below 
-     *                              aInsertElement when the scene is committed,
-     *                              or NULL to place at it the bottom of
-     *                              the scene.
-     */
-    virtual TInt InsertSceneElement(MWsElement* aInsertElement,
-                                    MWsElement* aSubordinateElement) = 0;
-    
-    /**
-     * @brief Remove an Element from the Scene
-     * 
-     * Remove the specified Element from the Scene, without destroying
-     * it.  
-     * 
-     * @note   The update is seen after the next @c CWsRenderStage::End()
-     *         call. 
-     * @param aRemoveElement  The element to be removed from the scene.
-     *                        If NULL, no action is taken.
-     * @pre     The supplied element, if non-NULL, must be in the Scene;
-     *          see @c InsertSceneElement()
-     * @post    The removed element is no longer in the Scene, but is still
-     *          valid object; it may receive further method calls.
-     * @return  One of the system-wide error codes.  KErrArgument means
-     *          aRemoveElement was not in this Scene.  KErrNone is returned
-     *          upon success.             
-     */
-    virtual TInt RemoveSceneElement(MWsElement* aRemoveElement) = 0;
-    
-    /**
-     * @brief Compose pending Scene into an off-screen target
-     *
-     * Compose the pending Scene into an off-screen target.  This
-     * method is an asynchronous call, and signals the optionally provided
-     * TRequestStatus, either immediately from some error cases, or later
-     * when the supplied off-screen target has been populated.
-     * 
-     * However, the pending scene changes for the target screen are not
-     * committed by this function call.
-     * 
-     * The TRequestStatus status value is updated by this function to one of
-     * the system-wide error codes.  KErrArgument is set if the supplied surface
-     * or TRequestStatus is in error.  KErrNoMemory is set for memory or other
-     * resource failures.  KErrInUse is set if the surface is in use or
-     * otherwise inaccessible.  KErrNotSupported is set if the supplied surface
-     * is incompatible with the screen.
-     *
-     * @param aOffScreenTarget  Surface to be updated with pending
-     *                          Scene
-     * @param aCompleted        When non-NULL, is used to signal the
-     *                          client when completed
-     * @post    Either the supplied surface is updated with new contents
-     *          and the aCompleted status is set to KErrNone, or an error value
-     *          is set in the aCompleted status.
-     * @post    Its guaranteed that the supplied surface is not accessed
-     *          by MWsScene after aCompleted has been signaled.
-     */
-    virtual void ComposePendingScene(TSurfaceId& aOffScreenTarget,
-                                        TRequestStatus* aCompleted) = 0;
-    
-    /**
-     * @brief Register the Window Server use of a Surface
-     *
-     * Register the Window Server use of a Surface for this Scene.
-     * The Scene abstraction already manages its use of Surfaces without
-     * this method call.  The purpose of this method is to allow Window
-     * Server, on behalf of its clients, to mark the given Surface as
-     * being used by such clients.  This allows the Surface to maintain
-     * a lifecycle beyond that which would normally be needed by the
-     * Scene, and allows early indication of incompatibility between
-     * the Surface and the Scene.
-     *
-     * @param aSurface  Surface to be marked as in use by the caller
-     * @post    Either the supplied surface accepted as potentially useable
-     *          by this Scene, or the local error value is set.
-     * @return  One of the system-wide error codes.  KErrNotSupported means the
-     *          Surface is incompatible with this Scene.  KErrNoMemory means
-     *          there was a memory problem.  KErrArgument means the supplied
-     *          Surface is not valid.  KErrServerBusy means the Surface is
-     *          currently used by another Scene.  KErrNone is returned upon
-     *          success.
-     */
-    virtual TInt RegisterSurface(const TSurfaceId& aSurface) = 0;
-    
-    /**
-     * @brief Unregister the Window Server use of a Surface
-     *
-     * Unregister the Window Server use of a Surface with this Scene.
-     * The Scene abstraction already manages its use of Surfaces without
-     * this method call.  The purpose of the method is to allow Window
-     * Server, on behalf of its clients, to mark the given Surface as
-     * no longer in use by such clients.  This ends the lifecycle of
-     * the Surface from the point of view of such clients.
-     *
-     * @param aSurface  Surface to be marked as no longer in use by the
-     *                  caller
-     * @return  One of the system-wide error codes.  KErrBadHandle means the 
-     *          supplied Surface is not known.  KErrNone is returned upon 
-     *          success.
-     */
-    virtual TInt UnregisterSurface(const TSurfaceId& aSurface) = 0;
-    };
-#endif // WSSCENE_H
--- a/windowing/windowserver/inc/Graphics/pointereventdata.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Data passed to a Key Click Plug-in using the function CClickMaker::OtherEvent when the 
-// aType value is EEventPointer.
-//
-
-#ifndef POINTEREVENTDATA_H
-#define POINTEREVENTDATA_H
-
-/**
-Passed to a Key Click Plug-in using the function CClickMaker::OtherEvent when the 
-aType value is EEventPointer.
-This includes information about the window the pointer event will be sent to.
-This is the normally the window being clicked on by the user, but pointer capturing 
-and grabbing may affect this.
-
-@publishedPartner
-@released 
-*/
-class TPointerEventData
-	{
-public:
-	enum TSource
-		/**
-		A list of locations that WSERV receives events from
-		*/
-		{
-		/** The source is not specified. */
-		EUnspecified,
-		/** The event came from the kernel. */
-		EKernel,
-		/** The event came from a client API. */
-		EClient,
-		/** The event came from an Anim DLL. */
-		EAnimDLL,
-		};
-public:
-	/**
-	The version number of the data passed with EEventPointer, current always 0.
-	*/
-	TInt iVersion;
-	/**
-	The screen position of pointer event.
-	*/
-	TPoint iCurrentPos;
-	/**
-	The full pointer event data previously passed to the CClickMaker::PointerEvent function,
-	except that the iParentPosition will be the actual parent position, when previously passed
-	to the plug-in this value was the screen position.
-	*/
-	TAdvancedPointerEvent iPointerEvent;
-	/**
-	The client handle of the window or zero if the window is not a client window.
-	*/
-	TUint32 iClientHandle;
-	/**
-	The current top left of the window on the screen.
-	*/
-	TPoint iWindowOrigin;
-	/**
-	The Window Group Identifier of the window group that is a parent (or grand parent etc.)
-	of the window the event is sent to or zero if the window is not a client window.
-	*/
-	TInt iWindowGroupId;
-	/**
-	The source that WSERV recieves the event from,
-	currently set to EUnspecified as this is for future expansion.
-	*/
-	TSource iSource;
-	};
-
-#endif // POINTEREVENTDATA_H
--- a/windowing/windowserver/inc/Graphics/surfaceconfiguration.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef SURFACECONFIGURATION_H
-#define SURFACECONFIGURATION_H
-
-#include <e32base.h>
-#include <graphics/surface.h>
-#include <bitstd.h>
-
-/** 
-The base class for the surface configuration containing the size of the surface configuration.  
-Provides a Size function to help identify which attributes are available.
-
-@publishedPartner
-@prototype
-*/
-class TSurfaceConfigurationSize
-{
-public:
-	inline TInt Size() const;
-protected:
-	inline TSurfaceConfigurationSize(TInt aSize);
-	template <class Member> TBool MemberAccessible (const Member& aMember) const
-		{
-		return iSize>=sizeof(Member)+TInt(&aMember)-TInt(this);
-		}
-	inline TBool operator == (const TSurfaceConfigurationSize& aRhs)const;
-private:	
-	inline TSurfaceConfigurationSize();
-	inline TSurfaceConfigurationSize(const TSurfaceConfigurationSize& /*aSurfaceConfigurationSize*/);
-	inline TSurfaceConfigurationSize operator = (const TSurfaceConfigurationSize& /*aRhs*/)const;
-protected:
-	TInt iSize;
-};
-
-/** 
-The first set of surface configuration attributes containing the surface id, viewport, extent
-and orientation of the surface, along with a SupportsAllMembers function to help identify which 
-attributes are available.
-
-@publishedPartner
-@prototype
-*/
-class TSurfaceConfiguration1: public TSurfaceConfigurationSize
-{
-public:
-	inline TSurfaceConfiguration1();
-	inline TInt SetSurfaceId (const TSurfaceId& aSurfaceId);
-	inline void GetSurfaceId (TSurfaceId& aSurfaceId) const;
-	inline TInt SetViewport (const TRect& aViewport);
-	inline void GetViewport (TRect& aViewport) const;
-	inline TInt SetOrientation (CFbsBitGc::TGraphicsOrientation aOrientation);
-	inline CFbsBitGc::TGraphicsOrientation Orientation() const;
-	inline TInt SetExtent(const TRect& aExtent);
-	inline void GetExtent(TRect& aExtent) const;
-	inline TBool SupportsAllMembers();
-protected:
-	inline TSurfaceConfiguration1(TInt aSize);
-	inline TBool operator == (const TSurfaceConfiguration1& aRhs)const;
-private:
-	inline TSurfaceConfiguration1(const TSurfaceConfiguration1& /*aSurfaceConfiguration1*/);
-	inline TSurfaceConfiguration1 operator = (const TSurfaceConfiguration1& /*aRhs*/)const;
-private:
-	TSurfaceId iSurfaceId;
-	CFbsBitGc::TGraphicsOrientation iOrientation;
-	TRect iExtent;
-	TRect iViewport;
-};
-
-/** 
-The second set of surface configuration attributes containing the flip attribute of the surface, along with a SupportsAllMembers function to help identify which 
-attributes are available.
-
-@publishedPartner
-@prototype
-*/
-class TSurfaceConfiguration2: public TSurfaceConfiguration1
-{
-public:
-    inline TSurfaceConfiguration2();
-    inline TInt SetFlip(TBool aFlip);
-    inline TBool Flip()const;
-    inline TBool SupportsAllMembers();
-protected:
-    inline TSurfaceConfiguration2(TInt aSize);
-    inline TBool operator == (const TSurfaceConfiguration2& aRhs)const;
-private:
-    inline TSurfaceConfiguration2(const TSurfaceConfiguration2& /*aSurfaceConfiguration2*/);
-    inline TSurfaceConfiguration2 operator = (const TSurfaceConfiguration2& /*aRhs*/)const;
-    //iFlip is a x-axis flip
-    TBool iFlip;
-};
-
-/** 
-TSurfaceConfiguration is provided as a chain of derived classes representing the growing 
-history of the class.
-
-@publishedPartner
-@prototype
-*/
-class TSurfaceConfiguration: public TSurfaceConfiguration2
-{
-	typedef	TSurfaceConfiguration2	TBiggestConfiguration;
-public:
-	inline TSurfaceConfiguration();
-	inline TSurfaceConfiguration(const TSurfaceConfiguration& aSurfaceConfiguration);
-	inline TSurfaceConfiguration(TInt aPreferredMaxSize);
-	inline TBool operator == (const TSurfaceConfiguration& aRhs)const
-		{
-		return TSurfaceConfiguration2::operator==(aRhs);
-		}
-private:
-	inline TSurfaceConfiguration operator = (const TSurfaceConfiguration& /*aRhs*/);
-};
-#include <graphics/surfaceconfiguration.inl>
-#endif // SURFACECONFIGURATION_H
--- a/windowing/windowserver/inc/Graphics/testscreencapture.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef TESTSCREENCAPTURE_H_
-#define TESTSCREENCAPTURE_H_
-
-struct TWsScsComposeScreenCommand
-	{
-	struct TrivialPoint
-		{
-		/**
-		The x co-ordinate.
-		*/
-		TInt iX;
-		/**
-		The y co-ordinate.
-		*/
-		TInt iY;
-		};
-	struct TrivialRect
-		{
-		/**
-		The x and y co-ordinates of the top left hand corner of the rectangle.
-		*/
-		TrivialPoint iTl;
-		
-		/**
-		The x and y co-ordinates of the bottom right hand corner of the rectangle.
-		*/
-		TrivialPoint iBr;
-		};
-	inline TWsScsComposeScreenCommand(TUint aCommand, const TInt aHandle);
-	inline TWsScsComposeScreenCommand(TUint aCommand, const TRect iAttributes);
-	inline void ConvertTrivialRect(TRect& aRect);
-	
-	TUint iCommand;
-	union Parameters
-	{
-	TInt iBitmapHandle;
-	TrivialRect iExtent;
-	} iParameter;
-	};
-
-/**
- * Window Server client interface for screen capture.
- * 
- * All functions in MTestScreenCapture will automatically flush the client-server
- * session buffer as part of their behavior.
- * 
- * @publishedPartner
- * @prototype
- */
-
-class MTestScreenCapture
-{
-public:
-	enum TWsTestScreenCaptureOpcodes
-		{
-		EWsScsInvalid = 0x00000000,
-		EWsScsScreenCompose = 0x00000001,
-		EWsScsTranslateExtent = 0x00000002,
-		};
-	
-	enum	
-		{
-		KUidTestScreenCaptureIf =  0x10286504,
-		ETypeId =	 KUidTestScreenCaptureIf 
-		};
-public:
-	/** Retrieves the composited screen content. 
-	    A new composition is initiated and the result is copied in 
-	    the bitmap created by user.
-	    The only bitmap mode supported is EColor16MU.
-
-	    This function always causes a flush of the window server buffer.
-	    
- 		@param aBitmap retturns the composited screen content.
- 		@param aTarget target rectangle to be filled in
-		@return KErrNone if successful
-		        KErrArgument if the size does not match the composition area size or
-		        the display mode is not supported
-	*/
-	virtual TInt ComposeScreen(const CFbsBitmap& aBitmap) const = 0;
-	/** Maps the source rectangle from application coordinate space to a
-		target coordinate space. Since there may be scaling involved, the
-		target rectangle may be larger or smaller than the source one, or
-		even become empty.
-
-	    This function always causes a flush of the window server buffer.
-	    
-		@param aSource source rectangle
-		@param aTarget target rectangle to be filled in
-		@return KErrNone if successful, otherwise one of the system-wide error codes
-		*/
-	virtual TInt TranslateExtent(const TRect& aSource, TRect& aTarget) const = 0;
-
-	/** Retrieves the size of the composition area in pixels.
-
-	    This function always causes a flush of the window server buffer.
-
-		@param aSize returns the composition area size
-		@return KErrNone if successful, otherwise one of the system-wide error codes
-		*/
-	virtual TInt GetCompositedSize(TSize& aSize) const = 0;
-};
-
-inline TWsScsComposeScreenCommand::TWsScsComposeScreenCommand(TUint aCommand, const TInt aHandle): 
-	iCommand(aCommand)
-	{ iParameter.iBitmapHandle = aHandle; }
-
-inline TWsScsComposeScreenCommand::TWsScsComposeScreenCommand(TUint aCommand, const TRect iAttributes): 
-	iCommand(aCommand)
-	{ 
-	iParameter.iExtent.iTl.iX = iAttributes.iTl.iX; 
-	iParameter.iExtent.iTl.iY = iAttributes.iTl.iY; 
-	iParameter.iExtent.iBr.iX = iAttributes.iBr.iX; 
-	iParameter.iExtent.iBr.iY = iAttributes.iBr.iY; 
-	}
-inline void TWsScsComposeScreenCommand::ConvertTrivialRect(TRect& aRect)
-	{
-	aRect.iTl.iX = iParameter.iExtent.iTl.iX;
-	aRect.iTl.iY = iParameter.iExtent.iTl.iY;
-	aRect.iBr.iX = iParameter.iExtent.iBr.iX;
-	aRect.iBr.iY = iParameter.iExtent.iBr.iY;
-	}
-
-#endif /*TESTSCREENCAPTURE_H_*/
--- a/windowing/windowserver/inc/Graphics/windowserverconstants.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Window server internal constants
-// 
-//
-
-#ifndef WINDOWSERVERCONSTANTS_H
-#define WINDOWSERVERCONSTANTS_H
-
-#include <textcursor.h>
-
-/**
-@internalAll
-*/
-_LIT(KWSERVServerName,"!Windowserver");
-
-/**
-Declaration of constant TUids for APIExtension to use as identifiers.
-@internalComponent
-@prototype
-*/
-const TUid KApiExtensionInterfaceUid = {0x102864E8};
-
-/** Flags and masks for TTextCursor internal use only
-	@internalComponent */
-enum TTextCursorPrivateFlags
-	{
-	ETextCursorUserFlags		= 0x0000FFFF,
-	ETextCursorFlagClipped		= 0x00010000,
-	ETextCursorPrivateFlags		= 0xFFFF0000
-	};
-
-#endif // WINDOWSERVERCONSTANTS_H
--- a/windowing/windowserver/inc/Graphics/wscontentreadyforcomposition.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-// Copyright (c) 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:
-// 
-//
-
-/**
- @file
- @publishedPartner
- @released
-*/
-
-#ifndef __WSCONTENTREADYFORCOMPOSITION_H__
-#define __WSCONTENTREADYFORCOMPOSITION_H__
-
-
-#include <e32std.h>
-#include <graphics/surface.h>
-#include <graphics/wsgraphicdrawerinterface.h>
-
-
-/**
-MWsContentReadyForComposition is an interface used to wrap the underlying
-compositor extension, MContentReadyForComposition, into the window server.
-See contentreadyforcomposition.h for deatils of the API.
-*/
-class MWsContentReadyForComposition : public MWsObjectProvider
-    {
-public:
-    DECLARE_WS_TYPE_ID(KMWsContentReadyForComposition)
-
-public:
-    virtual void NotifyContentReady(const TSurfaceId& aSurface, TUint64 aContentUpdate, TRequestStatus& aNotifyReady) = 0;
-    virtual void NotifyContentReadyCancel(const TSurfaceId& aSurface) = 0;
-    };
-
-
-#endif //__WSCONTENTREADYFORCOMPOSITION_H__
--- a/windowing/windowserver/inc/Graphics/wscursor.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Interface for Render Stage Text Cursors
-// 
-//
-
-/**
- @publishedPartner
- @prototype
-*/
-
-#ifndef WSCURSOR_H
-#define WSCURSOR_H
-
-#include <w32std.h>
-#include <graphics/wsgraphicdrawerinterface.h>
-
-/** Wserv access to render stage Text Cursor implementation.
-
-This interface allows delegation of Text Cursor drawing to the Render
-Stage.  It must not to be confused with Custom Text Cursor drawing;
-@see RWsSession::SetCustomTextCursor
-
-Historically, Text cursors have often been implemented using XOR
-drawing, because it is a cheap way to deliver a high-contrast cursor
-in certain system architectures where Operating System access to
-Graphics Device Memory is possible.
-
-XOR drawing can be problematic for some Render Stages.  This is because
-the XOR operation requires a read back followed by a write.  This would
-stall a graphics accelerator hardware implementation.
-
-In a render stage setting, the Text Cursor may not be the top-most
-window as a transition effect can slide a semi-transparent window over
-the top of the Text Cursor window.  This means the cursor cannot be XOR
-drawn last after all other windows; the read-back cost cannot be hidden
-at the end of drawing each frame.
-
-The Display Render Stage, responsible for interacting with hardware,
-can offer XOR drawing in some cases, for example Software Bit GDI,
-and not in others, for example OpenVG back-end hardware.
-
-This interface allows a render stage to implement Text Cursors
-appropriately given the Display Render Stage which is present.
-
-This interface uses the supplied Text Cursor Color as a hint only.
-TextCursor colors are better regarded as constrast level indicators
-where KRgbWhite means a high contrast text cursor, and KRgbBlack
-means an invisible text cursor.
-
-Suggested strategies:
-<ol>
-<li>
-XOR drawing is available.  Just XOR draw the cursor each time in
-the supplied color.  This corresponds to legacy non-Render Stage
-behaviour.
-</li>
-<li>
-No XOR drawing is available.  Draw a black box (solid or hollow
-as appropriate).  Ensure that the UI Toolkit which provides the
-platform's default text entry control has a compatible theme so
-that black is an appropriate high-contrast color.
-</li>
-</ol>
-
-@publishedPartner
-@prototype
-*/
-class MWsTextCursor : public MWsObjectProvider
-	{
-public:
-
-	struct TTextCursorInfo
-		{
-		const TRect& iCursorRect;	/** Rectangular area of the cursor in <b>window</b> co-ordinates */
-		const TRegion& iRegion; 	/** Clipping region */
-		TInt iTextCursorType; 		/** Cursor type; either TTextCursor::ETypeRectangle or TTextCursor::ETypeHollowRectangle */
-		MWsWindow* iWindow; 		/** Window owning the cursor */
-		TRgb iTextCursorColor;		/** Text Cursor Color used as a hint */
-
-		TTextCursorInfo(const TRect& aCursorRect, const TRegion& aRegion,
-				TInt aTextCursorType, MWsWindow* aWindow, TRgb aTextCursorColor)
-		: iCursorRect(aCursorRect),
-		iRegion(aRegion),
-		iTextCursorType(aTextCursorType),
-		iWindow(aWindow),
-		iTextCursorColor(aTextCursorColor)
-			{
-			}
-		};
-public:
-	DECLARE_WS_TYPE_ID(KMWsTextCursor)
-
-public:
-	/** Draw the Text Cursor in its Flash ON state
-	 * 
-	 * Draw the text cursor with the supplied attributes.  Note, the Flash OFF
-	 * state does not result in a call to this function; instead a window
-	 * redraw is done for the area where the cursor would reside.
-	 * 
-	 * @pre     The supplied Text Cursor type is either TextCursor::ETypeRectangle or
-	 * 			TTextCursor::ETypeHollowRectangle
-	 * 
-	 * @param	aTextCursorInfo  Data structure to describe the attributes of the Text
-	 * 			Cursor to Draw
-	 */
-	virtual void DrawTextCursor(const TTextCursorInfo& aTextCursorInfo) = 0;
-	};
-
-#endif // WSCURSOR_H
--- a/windowing/windowserver/inc/Graphics/wsdisplaycontrol.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Interface for Render Stage Display Resolution
-// 
-//
-
-#ifndef WSDISPLAYCONTROL_H_
-#define WSDISPLAYCONTROL_H_
-
-/**
-@file
-@publishedpartner 
-@released
-*/
-
-#include <graphics/displaycontrolbase.h>
-#include <graphics/wsgraphicdrawerinterface.h>
-
-class MWsDisplayControl: public MWsObjectProvider,public MDisplayControlBase
-	{
-public:
-	enum	
-		{
-		KUidWsDisplayControl =  0x10286497, 	  //To    0x1028649A
-		ETypeId=				KUidWsDisplayControl,
-		EWsObjectInterfaceId=	KUidWsDisplayControl
-		};
-public:
-	/**
-	 * Asynchronous request to complete aStatus when a change of display is detected.
-	 * 
-	 * The request is completed when the connectedness of the display changes, or when
-	 * the set of available resolutions changes.
-	 * 
-	 * @param aStatus Asynchronous request status.
-	 */
-	virtual void NotifyOnDisplayChange(TRequestStatus& aStatus)=0;
-	/**
-	 * Cancels a pending request to notify on display change.
-	 * 
-	 * If there is a pending notification request, the status value will be set to 
-	 * KErrCancelled and it will be completed. If there is no pending request for 
-	 * notification, the call will simply return.
-	 */
-	virtual void NotifyOnDisplayChangeCancel()=0;
-	/**
-	 * Asynchronous request to complete aStatus when a configuration change occurs.
-	 * 
-	 * The request is completed when a new configuration has been set, either 
-	 * explicitly or by a render stage. Earlier render stages and the Window Server 
-	 * can use this to update their state.
-	 * 
-	 * @param aStatus Asynchronous request status.
-	 */
-	virtual void NotifyOnConfigChange(TRequestStatus& aStatus)=0;
-	/**
-	 * Cancels a pending request to notify on configuration change.
-	 * 
-	 * If there is a pending notification request, the status value will be set to 
-	 * KErrCancelled and it will be completed. If there is no pending request for 
-	 * notification, the call will simply return.
-	 */
-	virtual void NotifyOnConfigChangeCancel()=0;
-	};
-
-#endif /*WSDISPLAYCONTROL_H_*/
--- a/windowing/windowserver/inc/Graphics/wsdisplaypolicy.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Interface for Render Stage Display Policy
-// 
-//
-
-#ifndef WSDISPLAYPOLICY_H_
-#define WSDISPLAYPOLICY_H_
-
-/**
-@file
-@publishedpartner 
-@released
-*/
-
-#include <graphics/displayconfiguration.h>
-#include <graphics/wsgraphicdrawerinterface.h>
-
-class MWsDisplayPolicy: public MWsObjectProvider
-	{
-public:
-	enum	
-		{
-		KUidWsDisplayPolicy	 =  0x102869FA, 	 
-		ETypeId=				KUidWsDisplayPolicy,
-		EWsObjectInterfaceId=	KUidWsDisplayPolicy
-		};
-	
-	enum TDisplayStatus
-		{
-		EDetach = 0,
-		EAttach,
-		EConnecting,
-		};
-public:
-	/**
-	 * Notification from the Window Server that the application size mode list has been updated.
-	 */
-	virtual void NewAppModesAvailable()=0;
-	/**
-	 * Determine the display configuration and application rendering extent to use for a given screen size mode.
-	 * 
-	 * The Window Server uses this function when a request to change to a new screen size mode or new display 
-	 * configuration is made by a client. The display configuration passed in may be partially filled, and the 
-	 * combination of the defined entries in it and the requested screen size mode values shall be used to define 
-	 * the rest of the configuration and new application extent to be used.
-	 * 
-	 * Only undefined entries in the configuration may be set by this function. Entries already defined must retain 
-	 * the same values. If the combination of defined entries and size mode values is not acceptable to the implementer, 
-	 * the function shall return KErrArgument.
-	 * 
-	 * If the function returns KErrNone, the Window Server shall set the returned display configuration, notify render 
-	 * stages of the new application extent and change to use the screen size mode. If either this function returns 
-	 * EFalse or the call to set the display configuration fails for any reason (such as KErrNoMemory, for example), 
-	 * then no further changes are made.
-	 * 
-	 * @see MWsScreenConfigList
-	 * @see MWsDisplayMapping
-	 * 
-	 * @param aScreenSizeMode The requested screen size mode. If static, the size in pixels, size in twips, and 
-	 * the rotation must be respected. If dynamic, only the rotation must be respected.
-	 * @param aConfig The requested display configuration on input, the required configuration on return. Only 
-	 * undefined entries may be set.
-	 * @param aExtent The screen size mode offset and size on input, the required application offset and size on return. 
-	 * If the screen driver buffer is used as the UI surface, this must be left unchanged.
-	 * @return KErrNone if no error, otherwise a system wide error code
-	 */
-	virtual TInt GetSizeModeConfiguration(TInt aScreenSizeMode, TDisplayConfiguration& aConfig, TRect& aSizeModePosition) const =0;
-	virtual TInt SuitableAppMode(TDisplayStatus aSituation)=0;
-	/**
-	 * Sets the application mode resumed to after a display is connected again after a disconnect.
-	 * 
-	 * @param aMode The application mode.
-	 */
-	virtual void SetLastAppMode(TInt aMode)=0;
-	};
-
-#endif /*WSDISPLAYPOLICY_H_*/
--- a/windowing/windowserver/inc/Graphics/wsdrawablesourceprovider.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @publishedPartner
- @prototype
-*/
-
-#ifndef __WSDRAWABLESOURCEPROVIDER_H__
-#define __WSDRAWABLESOURCEPROVIDER_H__
-
-#include <graphics/sgresource.h>
-#include <graphics/wsgraphicdrawerinterface.h>
-
-/**
-Window server evokes this interface from rendering stage plugin every time client 
-requests resource drawing operations.
-
-@publishedPartner
-@prototype
- */
-class MWsDrawableSourceProvider : public MWsObjectProvider
-	{
-public:
-	DECLARE_WS_TYPE_ID(KMWsDrawableSourceProvider)
-public:
-	/**
-	 Create a source object for future drawing of the drawable resource with the specified ID.
-	 @param aDrawableId The ID of the drawable resource.
-	 @param aSource On output, a pointer to the new source object associated with the drawable resource,
-	                which must be passed in calls to DrawResource() and CloseDrawableSource().
-	      	        After the call to CloseDrawableSource() the source object is destroyed and this pointer becomes invalid.
-	      	        The type of the source object is defined by the implementation of MWsDrawableSourceProvider.
-	 @post If successful, a new source object is created and the associated drawable resource is ready to use.
-	 @return KErrNone if successful, otherwise one of the system-wide error codes.
-	 */
-	virtual TInt CreateDrawableSource(const TSgDrawableId& aDrawableId, TAny*& aSource) = 0;
-
-	/**
-	 Destroy a source object associated with a drawable resource.
-	 @param aSource A pointer to a source object created by a previous call to CreateDrawableSource().
-	 @post Drawing of the associated drawable resource is no longer possible.
-	 @return KErrNone if successful, otherwise one of the system-wide error codes.
-	 */
-	virtual void CloseDrawableSource(TAny* aSource) = 0;
-
-	/**
-	 Draw a graphics resource.
-	 @param aSource A pointer to the source object associated with the drawable resource.
-	 @param aPos Destination position for the top-left corner of the drawable resource.
-	 @param	aRotation Rotation to be applied to the drawable resource before it is drawn.
-	 @pre A source object must have been created for the drawable resource by a previous call to CreateDrawableSource().
-	 */
-	virtual void DrawResource(const TAny* aSource, const TPoint& aPos, CWindowGc::TGraphicsRotation aRotation = CWindowGc::EGraphicsRotationNone) = 0;
-
-	/**
-	 Draw a graphics resource.
-	 @param aSource A pointer to the source object associated with the drawable resource.
-	 @param aRect Destination rectangle. The drawable resource could be scaled if its size doesn't match the destination rectangle.
-	 @param	aRotation Rotation to be applied to the drawable resource before it is drawn.
-	 @pre A source object must have been created for the drawable resource by a previous call to CreateDrawableSource().
-	 */
-	virtual void DrawResource(const TAny* aSource, const TRect& aRect, CWindowGc::TGraphicsRotation aRotation = CWindowGc::EGraphicsRotationNone) = 0;
-
-	/**
-	 Draw a graphics resource.
-	 @param aSource A pointer to the source object associated with the drawable resource.
-	 @param aRectDest Destination rectangle. The drawable resource could be scaled if its size doesn't match the destination rectangle.
-	 @param aRectSrc A rectangle defining the piece of the drawable resource to be drawn, in the co-ordinate system of the drawable resource.
-	 @param	aRotation Rotation to be applied to the drawable resource before it is drawn.
-	 @pre A source object must have been created for the drawable resource by a previous call to CreateDrawableSource().
-	 */
-	virtual void DrawResource(const TAny* aSource, const TRect& aRectDest, const TRect& aRectSrc, CWindowGc::TGraphicsRotation aRotation = CWindowGc::EGraphicsRotationNone) = 0;
-
-	/**
-	 Draw a graphics resource.
-	 @param aSource A pointer to the source object associated with the drawable resource.
-	 @param aRect Destination rectangle. The drawable resource could be scaled if its size doesn't match the destination rectangle.
-	 @param	aParam Parameters specifying how to draw the drawable resource.
-	 @pre A source object must have been created for the drawable resource by a previous call to CreateDrawableSource().
-	 */
-	virtual void DrawResource(const TAny* aSource, const TRect& aRect, const TDesC8& aParam) = 0;
-	};
-
-#endif //__WSDRAWABLESOURCEPROVIDER_H__
--- a/windowing/windowserver/inc/Graphics/wsdrawresource.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @publishedPartner
- @prototype
-*/
-
-#ifndef __WSDRAWRESOURCE_H__
-#define __WSDRAWRESOURCE_H__
-
-#include <w32std.h>
-#include <graphics/sgresource.h>
-
-class RWsDrawableSource;
-
-/**
-The UID for MWsDrawResource.
-@see MWsDrawResource
-@see CWindowGc::Interface
-@publishedPartner
-@prototype
-*/
-static const TUid KMWsDrawResourceInterfaceUid = { 0x102864E9 };
-
-/**
-An extension interface for CWindowGc and CRemoteGc to draw RWsDrawableSources.
-
-Usage:
-@code
-MWsDrawResource* gcDrawResource = static_cast<MWsDrawResource*>(gc->Interface(KMWsDrawResourceInterfaceUid));
-if(gcDrawResource)
-	{
-	gcDrawResource->DrawResource(TPoint(5,5), drawableSource);
-	}
-@endcode
-@see RWsDrawableSource
-@see CWindowGc::Interface
-@publishedPartner
-@prototype
-*/
-class MWsDrawResource
-	{
-public:
-	/**
-	Draws an image based resource which may be generated using non-native rendering API such as OpenGL ES 
-	or OpenVG. The resource will be drawn at the specified position in its original size with orientation 
-	according to the specified rotation parameter. The current clipping region applies. 
-
-	@see RWsDrawableSource
-
-	@param	aPos		The position of the top-left corner on a window.
-	@param	aSource		The resource to be drawn.
-	@param	aRotation	The rotation to be applied to the resource before it is drawn. The default value is CWindowGc::EGraphicsRotationNone.
-
-	@pre	Drawing context has been activated on a window. The drawable source has been created.
-	@post	Request to draw resource has been accepted. There is no guarantee that the request has been completed 
-			when this method returns.
-	*/
-	virtual void DrawResource(const TPoint& aPos, const RWsDrawableSource& aSource, CWindowGc::TGraphicsRotation aRotation=CWindowGc::EGraphicsRotationNone) = 0;
-
-	/**
-	Draws an image based resource. The resource will be rendered to the given destination rectangle on 
-	the window in its original dimensions with orientation according to the specified rotation parameter. 
-	Drawing will be clipped to the given destination rectangle. The current clipping region applies. The resource can be
-	drawn rotated using the CWindowGc::TGraphicsRotation enum which defines possible rotation values in 
-	clockwise degrees.
-
-	@see RWsDrawableSource
-
-	@param	aDestRect	Destination rectangle to which the resource will be rendered.
-	@param	aSource		The resource to be drawn.
-	@param	aRotation	The rotation to be applied to the resource before it is drawn. The default value is CWindowGc::EGraphicsRotationNone.
-
-	@pre	Drawing context has been activated on a window. The drawable source has been created.
-	@post	Request to draw resource has been accepted. There is no guarantee that the request has been completed 
-			when this method returns.
-	*/
-	virtual void DrawResource(const TRect& aDestRect, const RWsDrawableSource& aSource, CWindowGc::TGraphicsRotation aRotation=CWindowGc::EGraphicsRotationNone) = 0;
-
-	/**
-	Draws an image based resource. The resource is rendered into the given destination rectangle on a window.
-	Scaling (stretching or compression) applies if the destination rectangle is different from the
-	source rectangle. The resource orientation is set based on the specified rotation parameter
-	before scaling and drawing operations are performed.
-
-	@see RWsDrawableSource
-
-	@param	aDestRect	The destination rectangle to which the resource will be rendered on a window.
-	@param	aSource		The resource to draw.
-	@param	aSrcRect	The source rectangle specifying the area/sub-area of the resource to be rendered.
-	@param	aRotation	Rotation to be applied to the resource before it is drawn. The default value is CWindowGc::EGraphicsRotationNone.
-
-	@pre	Drawing context has been activated on a window. The drawable source has been created.
-	@post	Request to draw an image based resource has been accepted. There is no guarantee that the
-			request has been completed when this method returns.
-	*/
-	virtual void DrawResource(const TRect& aDestRect, const RWsDrawableSource& aSource, const TRect& aSrcRect, CWindowGc::TGraphicsRotation aRotation=CWindowGc::EGraphicsRotationNone) = 0;
-
-	/**
-	Draws a non-image based resource. The resource will be rendered into the given destination rectangle on a window.
-	The current clipping region applies. The adaptation is free to interpret the parameter aParam and may define
-	its own rules on how to handle the rendering of a non-image based resource.
-
-	@see RWsDrawableSource
-
-	@param	aDestRect	The destination rectangle to which the resource will be rendered on a window.
-	@param	aSource		The resource.
-	@param	aParam		Parameters specifying how to draw the resource. 
-
-	@pre	Drawing context has been activated on a window. The drawable source has been created.
-	@post	Request to draw a non-image based resource has been accepted. 
-			There is no guarantee that the request has been completed when this method returns.
-	*/
-	virtual void DrawResource(const TRect& aDestRect, const RWsDrawableSource& aSource, const TDesC8& aParam) = 0;
-	};
-
-
-/**
-The intention of this class is to enable drawing of drawables (RSgDrawable and RSgImage)
-using CWindowGc and CRemoteGc.
-
-You have to use the extension interface MWsDrawResource in order to use this class with
-CWindowGc and CRemoteGc.
-
-@publishedPartner
-@prototype
-@see RSgDrawable
-@see RSgImage
-@see MWsDrawResource
-*/
-class RWsDrawableSource : public MWsClientClass
-	{
-public:
-	IMPORT_C RWsDrawableSource();
-	IMPORT_C RWsDrawableSource(RWsSession& aWs);
-	IMPORT_C TInt Create(const RSgDrawable& aDrawable);
-	IMPORT_C TInt Create(const RSgDrawable& aDrawable, TInt aScreenNumber);
-	IMPORT_C const TSgDrawableId& DrawableId() const;
-	IMPORT_C TInt ScreenNumber() const;
-	IMPORT_C void Close();
-private:
-	TSgDrawableId iDrawableId;
-	TInt iScreenNumber;
-	TInt iReserved; // reserved for use by Symbian
-	};
-
-#endif //__WSDRAWRESOURCE_H__
-
--- a/windowing/windowserver/inc/Graphics/wsgraphicdrawerinternal.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-// Copyright (c) 1994-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 GRAPHICDRAWER_INTERNAL_H
-#define GRAPHICDRAWER_INTERNAL_H
-
-class MWsAnimationScheduler: public MWsObjectProvider
-/** A system mechanism for customising the animation timer to a particular hardware variant or to a
-	particular external compositor e.g. an out-of-scene transition engine.
-	The default animation scheduler in WSERV does not understand device-dependant parameters e.g.
-	screen refresh rates
-	@internalComponent
-	@released
-*/	{
-public:
-	/** Called to schedule an animation event for a screen to occur not before some point
-	A screen may be scheduled to animate several times without actually receiving an animation event from the scheduler
-	If the scheduler cannot honour the request e.g. device constraints, it ignores the request.
-	@param aScreen the screen to recieve the event
-	@param aWhen the point in time the event need not occur before
-	*/
-	virtual void ScheduleAnimation(MWsScreen& aScreen,const TTime& aWhen) = 0;
-	/** Called if a screen determines that it no longer needs to schedule any animation
-	@param aScreen the screen not needing to receive any animation events
-	*/
-	virtual void UnscheduleAnimation(MWsScreen& aScreen) = 0;
-	/** Called to schedule the redrawing of all screens containing this graphic.
-	The redrawing of affected screens can be deferred by the scheduler.
-	@param aId the ID of the graphic to be redrawn.  The graphic itself need not exist
-		(e.g. it has just been deleted, hence the need to redraw all potentially affected screens). */
-	virtual void Invalidate(const TGraphicDrawerId& aId) = 0;
-	/** Called when the Window Server receives a TRawEvent::EInactive  event, to signal power-saving */
-	virtual void OnInactive() = 0;
-	/** Called when the Window Server receives a TRawEvent::EActive event, to signal screen back on */
-	virtual void OnActive() = 0;
-
-	/** Called to schedule a redraw for a screen which is out of date
-	A screen may be scheduled to redraw several times without actually receiving aredraw event from the scheduler
-	If this request is ignored then the screen will be draw incorrectly untill a such a request is not ignored.
-	@param aScreen the screen to recieve the event
-	@param aWhen the point in time the event need not occur before
-	*/
-	virtual void ScheduleRedraw(MWsScreen& aScreen,const TTime& aWhen) = 0;
-	/** Called to force a previously scheduled redraw for a screen to happen immediately.
-	Used when we are about to loose our ability to perform the redraw correctly.
-	@param aScreen the screen to recieve the event
-	*/
-	virtual void DoRedrawNow(MWsScreen& aScreen) = 0;
-	
-	/** Interface to be implemented by callers of the asynchronous overload of 
-	DoRedrawNow, which takes a reference to this interface as argument to be able 
-	to give a callback once the screen update has been completed.
-	*/
-	class MScreenUpdateObserver 
-		{
-	public:
-		/** Callback when an asynchronous DoRedrawNow has been completed. */
-		virtual void ScreenUpdateComplete(TInt aResult) = 0;
-		};
-	
-	/** Called to force a previously scheduled redraw for a screen to happen immediately. 
-	@param aScreen the screen to recieve the event
-	@param aObserver reference which will receive a notification when the screen has been updated
-	*/
-	virtual void DoRedrawNow(MWsScreen& aScreen, MScreenUpdateObserver& aObserver) = 0;
-	
-	/** Callback to use if aObserver gets deleted before screen update takes place. */
-	virtual void ClearScreenUpdateObserver(const MScreenUpdateObserver& aObserver) = 0;
-
-protected:
-	IMPORT_C void Animate(MWsScreen& aScreen);
-	IMPORT_C void Animate(MWsScreen& aScreen, TRequestStatus* aFinished);
-	IMPORT_C void Redraw(MWsScreen& aScreen);
-	IMPORT_C TBool RedrawInvalid(MWsScreen& aScreen,const TArray<TGraphicDrawerId>& aInvalid);
-	};
-	
-#endif
\ No newline at end of file
--- a/windowing/windowserver/inc/Graphics/wsgraphicscontext.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,297 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Interface for Render Stage Abstract Graphics Context
-// 
-//
-
-/**
- @publishedPartner
- @prototype
-*/
-
-#ifndef __WSGRAPHICSCONTEXT_H__
-#define __WSGRAPHICSCONTEXT_H__
-
-#include <w32std.h>
-#include <graphics/wsgraphicdrawerinterface.h>
-
-/** Render Stage abstract graphics context.
-
-This interface is provided by Render Stages.  It abstracts the graphics context
-of the pixel target.  The intention is to allow Render Stages to intercept
-draw operations so that they can be batched (to reduce flickering), modified
-(to provide transition effects), or re-directed (to alternate back-end
-architectures).
-
-@publishedPartner
-@prototype
-*/
-class MWsGraphicsContext : public MWsObjectProvider
-	{
-public:
-	DECLARE_WS_TYPE_ID(KMWsGraphicsContext)
-	/** Text alignment.
-	@publishedPartner
-	@prototype
-	*/
-	enum TTextAlign
-		{
-		/** Text is left-aligned. */
-		ELeft,
-		/** Text is centred. */
-		ECenter,
-		/** Text is right-aligned. */
-		ERight
-		};
-
-	/** 
-	Brush styles. 
-	@publishedPartner
-	@prototype
-	*/
-	enum TBrushStyle
-		{
-		/** The brush fill has no effect (default). */
-		ENullBrush,
-		/** The brush fills with a solid single colour, determined by 
-		SetBrushColor() and the drawing mode. */
-		ESolidBrush,
-		/** The brush fills with a selected bitmap pattern, set by 
-		UseBrushPattern(). */
-		EPatternedBrush,
-		/** The brush fills with vertical hatching  lines going from top to 
-		bottom. */
-		EVerticalHatchBrush,
-		/** The brush fills with diagonal hatching lines going from bottom 
-		left to top right. */
-		EForwardDiagonalHatchBrush,
-		/** The brush fills with horizontal hatching lines going from left 
-		to right. */
-		EHorizontalHatchBrush,
-		/** The brush fills with rearward diagonal hatching lines going from top 
-		left to bottom right. */
-		ERearwardDiagonalHatchBrush,
-		/** The brush fills with horizontal and vertical hatching  lines going 
-		from left to right plus lines going from top to bottom  giving the 
-		effect of a grid of small squares */
-		ESquareCrossHatchBrush,
-		/** The brush fills with forward diagonal and rearward diagonal hatching 
-		lines going from bottom left to top right plus lines going from top left 
-		to bottom right giving the effect of a grid of small diamonds. */
-		EDiamondCrossHatchBrush
-		};
-
-	/** 
-	Drawing modes. The drawing modes define the way that the pen and brush colors are
-	drawn, EDrawModePEN means do alpha blending if appropriate, EDrawModeWriteAlpha means 
-	don't do alpha blending.
-
-	@see SetDrawMode()
-	@publishedPartner
-	@prototype
-	*/
-	enum TDrawMode
-		{		
-		/** Uses both pen and brush colour as they are. */
-		EDrawModePEN=32,		
-		/** Writes alpha information in the source directly into the destination, rather than blending. */
-		EDrawModeWriteAlpha=64
-		};
-
-	/** 
-	Pen styles. The screen pattern unit in each definition below describes the 
-	pattern drawn by the line 1 represents a pixel drawn, 0 represents a 
-	pixel that is not affected. 
-	@publishedPartner
-	@prototype
-	*/
-	enum TPenStyle
-		{
-		/** The pen does not draw. Screen pattern unit = 00... */
-		ENullPen,
-		/** A solid line (default). Screen pattern unit = 11... */
-		ESolidPen,
-		/** A dotted line. Screen pattern unit = 1000... */
-		EDottedPen,
-		/** A dashed line. Screen pattern unit = 111000... */
-		EDashedPen,
-		/** A line of alternating dashes and dots. Screen pattern unit = 
-		1111001100... */
-		EDotDashPen,
-		/** A line of alternating single dashes and pairs of dots. Screen 
-		pattern unit = 11110011001100... */
-		EDotDotDashPen
-		};
-
-	/** 
-	Rules used to fill self-intersecting polygons. 
-
-	The filling of a polygon proceeds as follows: for a given point in the 
-	polygon, then:
-
-	if the rule is TFillRule::EAlternate (default) and it has an odd winding 
-	number, then fill the surrounding area.
-
-	if the rule is TFillRule::EWinding and it has a winding number greater than 
-	zero, then fill the surrounding area. 
-	@publishedPartner
-	@prototype
-	*/
-	enum TFillRule
-		{
-		/** Only fill areas with odd winding numbers. */
-		EAlternate,
-		/** Fill areas with winding numbers greater than zero. */
-		EWinding
-		};
-
-	/**
-	Font underline flags. 
-	@publishedPartner
-	@prototype
-	*/
-	enum TFontUnderline
-		{
-		/** Font is not underlined. */
-		EUnderlineOff,
-		/** Font is underlined. */
-		EUnderlineOn
-		};
-
-	/**
-	Font strike-through flags. 
-	@publishedPartner
-	@prototype
-	*/
-	enum TFontStrikethrough
-		{
-		/** Font is not struck-through. */
-		EStrikethroughOff,
-		/** Font is struck-through. */
-		EStrikethroughOn
-		};
-
-	/**
-	Parameters used in drawing text within supplied context.
-	It is used by MWsGraphicsContext::DrawText() and MWsGraphicsContext::DrawTextVertical() family of API's
-	to draw text from iStart to iEnd withing the supplied text descriptor.
-	
-	@publishedPartner
-	@prototype
-	*/
-	class TTextParameters
-		{
-	public:
-		TTextParameters():
-			iStart(0),
-			iEnd(KMaxTInt),
-			iFlags(0)
-				{
-				}
-		TInt iStart;
-		TInt iEnd;
-		TUint16 iFlags;
-		/* Reserved for future use */
-		TAny* iReserved1;
-		TAny* iReserved2;
-		TAny* iReserved3;
-		TAny* iReserved4;
-		};
-	
-public:
-	// The following are equivalent to CFbsBitGc functionality which maps 
-	// to client’s CWindowGc requests
-	virtual void BitBlt(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap) = 0;
-	virtual void BitBlt(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap,	const TRect& aSourceRect) = 0;
-	virtual void BitBltMasked(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect, const CFbsBitmap& aMaskBitmap, TBool aInvertMask) = 0;
-	virtual void BitBltMasked(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect, const CFbsBitmap& aMaskBitmap, const TPoint& aMaskPos) = 0;
-	virtual void ResetClippingRegion() = 0;
-	virtual void Clear() = 0;
-	virtual void Clear(const TRect& aRect) = 0;
-	virtual void ResetBrushPattern() = 0;
-	virtual void ResetFont() = 0;
-	virtual void DrawArc(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd) = 0;
-	virtual void DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd) = 0;
-	virtual void DrawBitmap(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap) = 0;
-	virtual void DrawBitmap(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect) = 0;
-	virtual void DrawBitmapMasked(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap,const TRect& aSourceRect, const CFbsBitmap& aMaskBitmap, TBool aInvertMask) = 0;
-	virtual void DrawRoundRect(const TRect& aRect, const TSize& aEllipse) = 0;
-	virtual void DrawPolyLine(const TArray<TPoint>& aPointList) = 0; 
-	virtual void DrawPolyLineNoEndPoint(const TArray<TPoint>& aPointList) = 0;  
-	virtual void DrawPolygon(const TArray<TPoint>& aPointList, TFillRule aFillRule=EAlternate) = 0;
-	virtual void DrawEllipse(const TRect& aRect) = 0;
-	virtual void DrawLine(const TPoint& aStart, const TPoint& aEnd) = 0;
-	virtual void DrawLineTo(const TPoint& aPoint) = 0;
-	virtual void DrawLineBy(const TPoint& aVector) = 0;
-	virtual void DrawRect(const TRect& aRect) = 0;
-	virtual void DrawText(const TDesC& aText,const TTextParameters* aParam) = 0;
-	virtual void DrawText(const TDesC& aText,const TTextParameters* aParam,const TPoint& aPosition) = 0;
-	virtual void DrawText(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect) = 0;
-	virtual void DrawText(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipFillRect,TInt aBaselineOffset,TTextAlign aHrz=ELeft,TInt aMargin=0) = 0;
-	virtual void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,TBool aUp) = 0;
-	virtual void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TPoint& aPosition,TBool aUp) = 0;
-	virtual void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect,TBool aUp) = 0;
-	virtual void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0) = 0;
-	virtual void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect,TInt aBaselineOffset,TInt aTextWidth,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0) = 0;
-	virtual void MoveTo(const TPoint& aPoint) = 0;
-	virtual void MoveBy(const TPoint& aVector) = 0;
-	virtual void Plot(const TPoint& aPoint) = 0;
-	virtual void Reset() = 0;
-	virtual void SetBrushColor(const TRgb& aColor) = 0;
-	virtual void SetBrushOrigin(const TPoint& aOrigin) = 0;
-	virtual void SetBrushStyle(TBrushStyle aBrushStyle) = 0;
-	virtual void SetClippingRegion(const TRegion& aRegion) = 0;
-	virtual void SetDrawMode(TDrawMode aDrawMode) = 0;
-	virtual void SetOrigin(const TPoint& aPoint = TPoint(0, 0)) = 0;
-	virtual void SetPenColor(const TRgb& aColor) = 0;
-	virtual void SetPenStyle(TPenStyle aPenStyle) = 0;
-	virtual void SetPenSize(const TSize& aSize) = 0;
-	virtual void SetTextShadowColor(const TRgb& aColor) = 0;
-	virtual void SetCharJustification(TInt aExcessWidth, TInt aNumChars) = 0;
-	virtual void SetWordJustification(TInt aExcessWidth, TInt aNumGaps) = 0;
-	virtual void SetUnderlineStyle(TFontUnderline aUnderlineStyle) = 0;
-	virtual void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle) = 0;
-	virtual void SetBrushPattern(const CFbsBitmap& aBitmap) = 0;
-	virtual void SetBrushPattern(TInt aFbsBitmapHandle) = 0;
-	virtual void SetFont(const CFont* aFont) = 0;
-	
-	// CFbsBitGc functionality used by Wserv for its internal operations
-	virtual void CopyRect(const TPoint& aOffset, const TRect& aRect) = 0;
-	virtual void UpdateJustification(const TDesC& aText,const TTextParameters* aParam) = 0;
-	virtual void UpdateJustificationVertical(const TDesC& aText,const TTextParameters* aParam,TBool aUp) = 0;
-	virtual void SetFontNoDuplicate(const CFont* aFont) = 0;
-	virtual TBool HasBrushPattern() const = 0;
-	virtual TBool HasFont() const = 0;
-	virtual TRgb BrushColor() const = 0;
-	virtual TRgb PenColor() const = 0;
-	virtual TRgb TextShadowColor() const = 0;
-	
-	// Return current error status of MWsGraphicsContext
-	virtual TInt GetError() = 0;
-	
-	/** The origin of the GC relative to the screen's origin
-		@return the origin */
-	virtual TPoint Origin() const = 0;
-	/** The clipping region currently being used
-		@return the clipping region */
-	virtual const TRegion& ClippingRegion() = 0;
-	/** Saves the state of the GC to an internal buffer.  Several GC states can be saved in a FILO.
-		Do not restore a GC (using Pop()) that wasn't properly saved!
-		@return KErrNone if successful, else one of the system-wide error codes. */
-	virtual TInt Push() = 0;
-	/** Restores the last GC state that was saved. */
-	virtual void Pop() = 0;
-	};
-
-#endif	//__WSGRAPHICSCONTEXT_H__
--- a/windowing/windowserver/inc/Graphics/wsscreendevice.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Interface for Render Stage Screen Abstraction
-// 
-//
-
-/**
- @publishedPartner
- @prototype
-*/
-
-#ifndef WSSCREENDEVICE_H
-#define WSSCREENDEVICE_H
-
-#include <w32std.h>
-#include <graphics/wsgraphicdrawerinterface.h>
-
-/** Render Stage Palette support.
-
-This interface is intended to be optionally provided by a Render Stage
-when the pixel target can provide a Colour Palette.  Not all pixel targets have
-this feature, for example OpenVG only targets.
-@publishedPartner
-@prototype
-*/
-class MWsPalette : public MWsObjectProvider
-	{
-public:
-	DECLARE_WS_TYPE_ID(KMWsPalette)
-	virtual void PaletteAttributes(TBool& aModifiable,TInt& aNumEntries) const = 0;
-	virtual TInt GetPalette(CPalette*& aPalette) const = 0;
-	virtual TInt SetCustomPalette(const CPalette* aPalette) = 0;
-	};
-
-
-/** Render Stage Screen Device abstraction.
-
-Render Stages provide this interface as an abstraction of the target screen.
-The screen may not be pixel based, in which case read back of pixel data may
-not be a reflection of what appears on the screen.  The screen might also only
-be partially readable, for example external video surfaces may be blanked out
-when a read back is done.  The intention of the CopyScreenToBitmap methods is
-to provide a means to obtain a snapshot of the entire screen for architectures
-where a composition of the screen can be done once followed by a read back
-of the entire screen, as opposed to servicing a sequence of GetScanLine calls
-which may be prohibitively expensive.
-
-@publishedPartner
-@prototype
-*/
-class MWsScreenDevice : public MWsObjectProvider
-	{
-public:
-	DECLARE_WS_TYPE_ID(KMWsScreenDevice)
-
-	virtual TInt ScreenNumber() const = 0;
-	virtual TDisplayMode DisplayMode() const = 0;
-	virtual TSize SizeInPixels() const = 0;
-	virtual TSize SizeInTwips() const = 0;
-	virtual TRect PointerRect() const = 0;
-	virtual void GetPixel(TRgb& aColor,const TPoint& aPixel) const = 0;
-	virtual void GetScanLine(TDes8& aScanLine,const TPoint& aStartPixel,TInt aPixelLength, TDisplayMode aDispMode) const = 0;
-	virtual TBool RectCompare(const TRect& aRect1, const TRect& aRect2) const = 0;
-	virtual void CopyScreenToBitmapL(CFbsBitmap* aBitmap, const TRect& aRect) const = 0;
-	virtual void ClearDisplay(TRgb aBackColor)=0;
-	};
-
-#endif // WSSCREENDEVICE_H
--- a/windowing/windowserver/inc/Graphics/wsscreendeviceutils.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// wsscreencapture.h
-// Interface for Render Stage Screen Capture Utils to be used by the render stage
-// 
-//
-
-#ifndef WSTESTSCREENDEVICEUTILS_H_
-#define WSTESTSCREENDEVICEUTILS_H_
-
-/**
-@file
-@publishedpartner 
-@released
-*/
-
-#include <graphics/wsgraphicdrawerinterface.h>
-
-class MWsScreenDeviceUtils : public MWsObjectProvider
-	{
-public:
-	enum	
-		{
-		KMWsScreenCaptureUtils =  0x10286505,	// registered GUID
-		ETypeId=				KMWsScreenCaptureUtils,
-		EWsObjectInterfaceId=	KMWsScreenCaptureUtils
-		};
-	virtual void PanicCurrentClient(TInt aPanic) = 0;
-	virtual void SetReply(TInt aReply) = 0;
-	virtual void RedrawNowIfPending() = 0;
-	virtual void ReplyBuf(const TAny* aSource, TInt aLength) = 0;
-	};
-
-#endif /*WSTESTSCREENDEVICEUTILS_H_*/
-
-
--- a/windowing/windowserver/inc/Graphics/wstestscreencapture.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Interface for Render Stage Screen Capture Render Stage
-// 
-//
-
-#ifndef WSTESTSCREENCAPTURE_H_
-#define WSTESTSCREENCAPTURE_H_
-
-/**
-@file
-@publishedpartner 
-@released
-*/
-
-#include <graphics/wsgraphicdrawerinterface.h>
-#include <graphics/wsscreendeviceutils.h>
-
-class CScreen;
-class TWsSdComposeScreenCommand;
-class MWsTestScreenCapture : public MWsObjectProvider
-	{
-public:
-	enum	
-		{
-		KMWsScreenCapture =  0x10286503,	// registered GUID
-		ETypeId=				KMWsScreenCapture,
-		EWsObjectInterfaceId=	KMWsScreenCapture
-		};
-	virtual TInt TestScreenCaptureL(const TAny* aMessage, MWsScreenDeviceUtils& aUtils) =0;
-	};
-
-#endif /*WSTESTSCREENCAPTURE_H_*/
-
-
--- a/windowing/windowserver/inc/Graphics/wsuibuffer.h	Tue Jun 22 15:21:29 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef __WSUIBUFFER_H__
-#define __WSUIBUFFER_H__
-
-#include <pixelformats.h>
-#include <graphics/wsgraphicdrawerinterface.h>
-
-/**
-@file
-@publishedPartner
-@prototype 
-*/
-
-/**
-This class provides direct access to the memory of the UI buffer.
-
-This interface is to be used by CRPs that don't want to go through MWsGraphicsContext
-to handle their rendering, but want direct memory access.
-@publishedPartner
-@prototype
-*/
-class MWsUiBuffer: public MWsObjectProvider
-    {
-public:
-    DECLARE_WS_TYPE_ID(KMWsUiBufferInterfaceId)
-
-    /**
-    Finishes pending rendering to the buffer and temporarily makes the pixel 
-    data of the buffer image accessible for reading and writing by the CPU.
-    
-    When finished with the pixel data, the caller must end the mapping by
-    calling @c Unmap().
-
-    This method should only be called from the context of 
-    @c CWsGraphicDrawer::Draw().
-    @param aDataAddress On return, the base address of the pixel data in the
-    address space of the calling process
-    @param aDataStride On return, the number of bytes between rows of the
-    pixel data
-    @return KErrNone if successful, otherwise one of the standard Symbian
-    error codes
-    @see Unmap()
-    @publishedPartner
-    @prototype
-    */
-    virtual TInt MapReadWrite(TAny*& aDataAddress, TInt& aDataStride) = 0;
-    
-    /**
-    Finishes pending rendering to the buffer and temporarily makes the pixel 
-    data of the buffer image accessible for writing by the CPU.
-    
-    When finished with the pixel data, the caller must end the mapping by
-    calling @c Unmap().
-
-    This method should only be called from the context of 
-    @c CWsGraphicDrawer::Draw().
-    @param aDataAddress On return, the base address of the pixel data in the
-    address space of the calling process
-    @param aDataStride On return, the number of bytes between rows of the
-    pixel data
-    @return KErrNone if successful, otherwise one of the standard Symbian
-    error codes
-    @see Unmap()
-    @publishedPartner
-    @prototype
-    */
-    virtual TInt MapWriteOnly(TAny*& aDataAddress, TInt& aDataStride) = 0;
-        
-    /**
-    Makes the pixel data of an image no longer accessible to the CPU.
-
-    Before calling this method the buffer must be mapped for CPU access by
-    a previous call to @c MapReadWrite() or @c MapWriteOnly().
-
-    This method should only be called from the context of 
-    @c CWsGraphicDrawer::Draw().
-    @return KErrNone if successful, otherwise one of the standard Symbian
-    error codes
-    @see MapReadWrite()
-    @see MapWriteOnly()
-    @publishedPartner
-    @prototype
-    */
-    virtual TInt Unmap() = 0;
-
-    /**
-    Gets the pixel format of the buffer.
-    @return The pixel format of the buffer
-    @publishedPartner
-    @prototype
-    */
-    virtual TUidPixelFormat PixelFormat() const = 0;
-
-    /** 
-    Gets the current size of the buffer.
-
-    The actual size of the whole buffer might be larger than the returned
-    value depending on the current screen mode. However, it is the size
-    returned by this method that should be used when accessing the pixel data.
-    @return The current size of the buffer
-    @publishedPartner
-    @prototype
-    */
-    virtual TSize SizeInPixels() const = 0;
-    };
-
-#endif //__WSUiBUFFER_H__
--- a/windowing/windowserver/inc/W32STD.H	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/inc/W32STD.H	Tue Jul 20 13:27:44 2010 +0300
@@ -33,6 +33,7 @@
 #include <advancedpointerevent.h>
 #include <sizemode.h>
 #include <babitflags.h>
+#include <wspublishandsubscribedata.h>
 
 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
 #include <graphics/windowserverconstants.h>
@@ -1380,6 +1381,7 @@
 		line. */
 		ECustomTextCursorAlignBottom
 		};
+	
 //
 public:
 	IMPORT_C RWsSession();
@@ -1538,6 +1540,9 @@
 	IMPORT_C void UnregisterAllEffects();
 	IMPORT_C void OverrideEffects(TInt aAction, TInt aPurpose, const TFileName& aResourceDir, const TFileName& aFilenameOutgoing, const TFileName& aFilenameIncoming, TBitFlags aFlags=0);
 	
+//Application tells the window server the orientation of rendering it intends to use
+	IMPORT_C void IndicateAppOrientation(TRenderOrientation aOrientation);
+	
 // functions not exported, used by CWsGraphic
 	void GraphicMessageReady(TRequestStatus *aStat);
 	void GetGraphicMessage(TDes8& aData) const;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/W32STDGRAPHICTEST.H	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,60 @@
+// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Test CWsGraphic plugins
+// 
+//
+
+#ifndef __W32STDGRAPHICTEST_H__
+#define __W32STDGRAPHICTEST_H__
+
+#include <w32std.h>
+
+class TWsGraphicFrameRate: public TWsGraphicMsgFixedBase
+/** data attached to a CWindowGc::DrawWsGraphic to encourage the artwork to display
+	an approximate framerate as it animates, if available
+	@publishedPartner
+	@released
+*/	{
+public:
+	enum
+		{
+		ETypeId = 0x10281AAF
+		};
+	IMPORT_C TWsGraphicFrameRate();
+	};
+
+NONSHARABLE_CLASS(CWsGraphicTestFrameRate): public CWsGraphic
+/** Client representation of a test anim that displays its frame-rate
+
+@publishedPartner
+@released
+*/
+	{
+public:
+	IMPORT_C static CWsGraphicTestFrameRate* NewL();
+	IMPORT_C static CWsGraphicTestFrameRate* NewL(TUid aUid);
+	IMPORT_C static CWsGraphicTestFrameRate* NewL(const TWsGraphicId& aReplace);
+	IMPORT_C ~CWsGraphicTestFrameRate();
+public: // protected virtuals from CWsGraphic promoted to public
+	using CWsGraphic::ShareGlobally;
+	using CWsGraphic::UnShareGlobally;
+	using CWsGraphic::Share;
+	using CWsGraphic::UnShare;
+private:
+	CWsGraphicTestFrameRate();
+	void HandleMessage(const TDesC8& aData);
+	void OnReplace();
+};
+
+#endif //__W32STDGRAPHICTEST_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/WSGRAPHICDRAWER.H	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,218 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Server-side base-classes for graphic drawer plugins
+// 
+//
+
+#ifndef __WSGRAPHICDRAWER_H__
+#define __WSGRAPHICDRAWER_H__
+
+#include <e32base.h>
+#include <e32std.h>
+
+#include <graphics/wsgraphicdrawerinterface.h>
+
+class CFbsBitGc;
+class TSurfaceId;
+
+NONSHARABLE_STRUCT(TGraphicDrawerId)
+/** Represents a graphic drawer on the window-server side
+A much-abridged version of TWsGraphicId, with trivial constructor
+@publishedPartner
+@released
+*/	{
+	TInt iId;
+	TBool iIsUid;
+	IMPORT_C TInt Compare(const TGraphicDrawerId& aOther) const;
+	IMPORT_C static TInt Compare(const TGraphicDrawerId& aFirst,const TGraphicDrawerId& aSecond);
+	};
+
+/** Wserv event representation to plugin side
+
+@publishedPartner
+@released
+*/
+NONSHARABLE_STRUCT(TWservCrEvent)
+	{
+public:
+	/** Type of wserv events which plugin can listen to. It is a mask that can be combined
+	when subscribing to notification. */
+	enum
+		{
+		EScreenSizeModeChanged		= 0x00000001,
+		EWindowVisibilityChanged 	= 0x00000002,
+		EDsaDrawingBegin			= 0x00000004,
+		EDsaDrawingEnd				= 0x00000008,
+		EScreenSizeModeAboutToChange= 0x00000010,
+		EScreenUpdated				= 0x00000020,
+		EScreenDrawing				= 0x00000040,
+		EWindowGroupChanged			= 0x00000080,
+		EScreenOrientationChanged	= 0x00000100,
+		EDeviceOrientationChanged	= 0x00000200,
+		EWindowClosing              = 0x00000400,
+		ESurfaceUnreferenced		= 0x00000800,
+		};
+public:
+	IMPORT_C TWservCrEvent(TUint32 aType);
+	IMPORT_C TWservCrEvent(TUint32 aType, TUint32 aInfo);
+	IMPORT_C TWservCrEvent(TUint32 aType, TUint32 aInfo, TAny* aData);
+	IMPORT_C TWservCrEvent(TUint32 aType, TUint32 aInfo, TAny* aData, MWsWindow* aWindow);
+
+	/** Returns wserv event type */
+	IMPORT_C TUint32 Type() const;
+	/** Returns current wserv screen size mode as the result of event EScreenSizeModeChanged.
+	Screen mode is 0,1,2,...
+	*/
+	IMPORT_C TInt SizeMode() const;
+	/** Returns visibile region as the result of event EWindowVisibilityChanged, this region represents
+	full or some part of window which is changing visibility. NULL if window is becoming not visible
+	completely.
+	*/
+	IMPORT_C const RRegion* VisibleRegion() const;
+	/** Returns screen number where a DSA, screen updated or window group changed event occurs
+	*/
+	IMPORT_C TInt ScreenNumber() const;
+	/** Returns the drawing region which is referred to by an EScreenDrawing
+	*/
+	IMPORT_C const TRegion* DrawingRegion() const;
+	/** Returns the new window group identifier where a window group changed event occurs
+	*/
+	IMPORT_C TInt WindowGroupIdentifier() const;
+	/** Returns the new window server display oriention
+	*/
+	IMPORT_C CFbsBitGc::TGraphicsOrientation Orientation() const;
+	/** Returns whether or not a window was already visible before a visibility event occurred
+	*/
+	IMPORT_C TBool WasVisible() const;
+	/** Returns the window this event is for.  This may be null.
+	@prototype
+	*/
+	IMPORT_C MWsWindow* Window() const;	
+	/** Returns the released surface ID
+	*/
+	IMPORT_C const TSurfaceId* SurfaceId() const;
+
+private:
+	TWservCrEvent() {}
+	
+private:
+	TUint32 iType;
+	TUint32 iInfo;
+	TAny* iData;
+	MWsWindow* iWindow;
+	TInt iReserved[7];
+	};
+
+/** Event notification callback. Need to be implemented to allow CWsGraphicDrawer to listen to
+wserv events.
+
+@publishedPartner
+@released
+*/
+class MWsEventHandler
+	{
+public:
+	/** Plugin event handler, will be called once for each event.
+	*/
+	virtual void DoHandleEvent(const TWservCrEvent& aEvent) = 0;
+	};
+
+/**
+Implementing this interface will give a callback notification wheater a
+graphic message which was sent has either failed or succeded.
+@publishedPartner
+@prototype
+*/
+class MWsGraphicMessageCallback : public MWsObjectProvider
+ 	{
+public:
+ 	DECLARE_WS_TYPE_ID(KWsGraphicMessageCallbackInterfaceId)
+
+public:
+ 	/**
+ 	Called with unique ID of the message, aError will be set to KErrNone if message delivery is
+ 	successful, otherwise one of the system-wide error code.
+ 	*/
+ 	virtual void HandleMessageDelivery(TInt aMessageId, TInt aError) = 0;
+ 	};
+
+/**
+Implementing this interface will give you the possibility to send synchron messages with a returnvalue to the client.
+@publishedPartner
+@prototype
+*/
+class MWsGraphicHandleSynchronMessage: public MWsObjectProvider
+ 	{
+public:
+ 	DECLARE_WS_TYPE_ID(KWsGraphicHandleSynchronMessageId)
+
+public:
+ 	/**
+	Synchron handlemessage method.
+	*/
+	virtual TInt HandleSynchronMessage(const TDesC8& aData) = 0;
+	};
+
+
+class CWsGraphicDrawer: public CBase, public MWsObjectProvider
+/** A window-server-side peer to a CWsGraphic
+@publishedPartner
+@released
+*/	{
+public:
+	/** This function should be overriden by all derived classes.  The first call the implementation of this function
+		should make is to BaseConstructL().
+		@param aEnv the environment this drawer exists in
+		@param aId the ID of this drawer
+		@param aOwner the client session that owns this drawer
+		@param aData arbitrary data for constructing this instance, sent from the client.
+	*/
+	virtual void ConstructL(MWsGraphicDrawerEnvironment& aEnv,const TGraphicDrawerId& aId,MWsClient& aOwner,const TDesC8& aData) = 0;
+	IMPORT_C ~CWsGraphicDrawer();
+	IMPORT_C const TGraphicDrawerId& Id() const;
+	IMPORT_C const MWsClient& Owner() const;
+	IMPORT_C TBool IsSharedWith(TSecureId aClientId) const;
+	IMPORT_C TInt ShareGlobally();
+	IMPORT_C TInt UnShareGlobally();
+	IMPORT_C TInt Share(TSecureId aClientId);
+	IMPORT_C TInt UnShare(TSecureId aClientId);
+	IMPORT_C void Draw(MWsGc& aGc,const TRect& aRect,const TDesC8& aData) const;
+	IMPORT_C TBool Contains(const TArray<TGraphicDrawerId>& aIds) const;
+	virtual void HandleMessage(const TDesC8& aData) = 0;
+	IMPORT_C void HandleEvent(const TWservCrEvent& aEvent);
+	IMPORT_C void SetEventHandler(MWsEventHandler* aHandler);
+	IMPORT_C TBool HasEventHandler() const;
+protected:
+	IMPORT_C CWsGraphicDrawer();
+	IMPORT_C void BaseConstructL(MWsGraphicDrawerEnvironment& aEnv,const TGraphicDrawerId& aId,MWsClient& aOwner);
+	IMPORT_C MWsGraphicDrawerEnvironment& Env();
+	IMPORT_C const MWsGraphicDrawerEnvironment& Env() const;
+	IMPORT_C TInt SendMessage(const TDesC8& aData);
+	IMPORT_C TInt SendMessage(CWsMessageData& aData);
+	IMPORT_C void Invalidate();
+private:
+	IMPORT_C virtual TBool HasAsChild(const TArray<TGraphicDrawerId>& aIds) const;
+	virtual void DoDraw(MWsGc& aGc,const TRect& aRect,const TDesC8& aData) const = 0;
+private:
+	class CPimpl;
+	friend class CPimpl;
+	CPimpl* iPimpl;
+	TInt iWsGraphicDrawerSpare[3];
+private:
+	friend class WsGraphicDrawer;
+	TUid iDtor_ID_Key;
+	};
+
+
+#endif //#ifndef __WSGRAPHICDRAWER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/WSGRAPHICMSGBUF.H	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,72 @@
+// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef __WSGRAPHICMSGBUF_H__
+#define __WSGRAPHICMSGBUF_H__
+
+#include <e32std.h>
+
+class TWsGraphicMsgBufParser
+/** Utility class for parsing incoming data associated with individual draw commands
+@see CWindowGc::DrawWsGraphic
+@see RWsGraphicMsgBuf
+@publishedPartner
+@released
+*/	{
+public:
+	IMPORT_C TWsGraphicMsgBufParser(const TDesC8& aData);
+	IMPORT_C TInt Verify() const;
+	IMPORT_C TInt Count() const;
+	IMPORT_C TUid Uid(TInt aIndex) const;
+	IMPORT_C TPtrC8 Data(TInt aIndex) const;
+	IMPORT_C TInt Find(TUid aUid,TInt aStartingFrom = 0) const;
+	IMPORT_C TBool LoadFixed(TUid aUid,TAny* aMsg,TInt aMsgSize,TInt aStartingFrom = 0) const;
+protected:
+	TInt IntAt(TInt aOfs) const;
+protected:
+	const TDesC8& iData;
+	};
+
+class TWsGraphicMsgAnimation
+/** Utility class for parsing incoming TWsGraphicAnimation messages
+@see CWindowGc::DrawWsGraphic
+@see RWsGraphicMsgBuf
+@publishedPartner
+@released
+*/	{
+public:
+	IMPORT_C TWsGraphicMsgAnimation();
+	IMPORT_C TInt Load(const TWsGraphicMsgBufParser& aData);
+	IMPORT_C TInt Load(const TWsGraphicMsgBufParser& aData,TInt aIndex);
+	IMPORT_C TTimeIntervalMicroSeconds AnimationTime(const TTime& aNow,const TTimeIntervalMicroSeconds& aAnimationLength) const;
+	IMPORT_C TBool IsPlaying(const TTime& aNow,const TTimeIntervalMicroSeconds& aAnimationLength) const;
+private:
+	enum
+		{
+		// animation state in lowest nibble
+		EStopped	= 0x00,
+		EPlaying	= 0x01,
+		EStopping	= 0x02,
+		EPaused		= 0x03,
+		EStateMask	= 0x0F,
+		// other flags above
+		ELoop		= 0x10
+		};
+	TUint iFlags;
+	TTime iPlay;
+	TTime iPauseOrStopping;
+	};
+
+#endif //__WSGRAPHICMSGBUF_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/WSPLUGIN.H	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,68 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Server-side base-classes for graphic drawer plugins
+// 
+//
+
+#ifndef __WSPLUGIN_H__
+#define __WSPLUGIN_H__
+
+#include <e32base.h>
+#include <e32std.h>
+
+#include <graphics/wsgraphicdrawerinterface.h>
+
+/**
+Window Server interface to the Window Server plugin API.
+
+@publishedPartner
+@prototype
+*/
+class CWsPlugin : public CBase, public MWsObjectProvider
+	{
+private:
+	class CPimpl;
+	friend class CPimpl;
+
+public:
+	/**
+	This function should be overriden by all derived classes.  The first
+	call the implementation of this function should make is to BaseConstructL().
+	@param aEnv 	the environment this drawer exists in
+	@param aData 	arbitrary data for constructing this instance, sent from
+					the client.
+	*/
+	virtual void ConstructL(MWsGraphicDrawerEnvironment& aEnv,const TDesC8& aData) = 0;
+	IMPORT_C ~CWsPlugin();
+	IMPORT_C virtual const TDesC & PluginName() const;
+
+	static TInt DtorIDKeyOffset() { return _FOFF(CWsPlugin,iDtor_ID_Key); }
+	
+protected:
+	IMPORT_C CWsPlugin();
+	IMPORT_C void BaseConstructL(MWsGraphicDrawerEnvironment& aEnv);
+	IMPORT_C MWsGraphicDrawerEnvironment& Env();
+	IMPORT_C const MWsGraphicDrawerEnvironment& Env() const;
+
+private:
+	CWsPlugin(const CWsPlugin &); // no implementation
+	CWsPlugin & operator=(const CWsPlugin &); // no implementation
+	
+private:
+	TUid iDtor_ID_Key;
+	CPimpl* iPimpl;
+	};
+
+
+#endif //#ifndef __WSPLUGIN_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/WsRenderStage.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,114 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Interface for window server render stages.
+// 
+//
+
+#ifndef __WSRENDERSTAGE_H__
+#define __WSRENDERSTAGE_H__
+
+#include <e32base.h>
+#include <graphics/wsgraphicdrawerinterface.h>
+
+class CFbsBitGc;
+
+/**
+This API declares the window server interface to the Render Stage Pipeline.
+@publishedPartner
+@prototype
+*/
+class CWsRenderStage : public CBase, public MWsObjectProvider
+	{
+private:
+	class CPimpl;
+	
+public: // pure virtuals
+#ifdef SYMBIAN_GRAPHICS_GCE
+	/**
+	Signal to the render stage to perform intitialisation prior to a batch
+	of draw ops
+	@param	aRegion	The dirty region for which drawing will be issued.
+					The caller guarantees that same dirty region applies
+					across a matched set of Begin and End calls.  The
+					render stage may pass a different dirty region to
+					child render stages, but it must guarantee the same
+					dirty region applies across a matched set of Begin and
+					End calls.
+	*/
+	virtual void Begin(const TRegion* aRegion) = 0;
+	
+	/**
+	Completes a pass of this render stage.
+	@param aFinished If not NULL, then this is signalled when the next
+					(down stream) render stage is ready to receive further
+					updates.
+	@note 			It is valid to call MWsAnimationScheduler::Animate() again,
+					before aFinished has been signalled, but the render stage
+					pipeline may not be ready to receive updates at that time.
+	*/
+	virtual void End(TRequestStatus* aFinished) = 0;
+#else //SYMBIAN_GRAPHICS_GCE
+	/**
+	Returns the GC to use for drawing in this render stage:
+	*/
+	virtual CFbsBitGc * Begin() = 0;
+	
+	/**
+	Completes a pass of this render stage:
+	*/
+	virtual void End() = 0;
+#endif //SYMBIAN_GRAPHICS_GCE
+
+public:
+	/** Destructor */
+	IMPORT_C virtual ~CWsRenderStage();
+	
+	/**
+	Returns the next render stage in the pipeline:
+	*/
+	IMPORT_C virtual CWsRenderStage * Next();
+
+	/**
+	Sets the next render stage in the pipeline:
+	*/
+	IMPORT_C virtual void SetNext(CWsRenderStage * aNext);
+	
+	/**
+	Returns extended functionality.
+	@param	aTypeId	interface extension type specifier
+	@return an interface implementation, if the interface ID is implemented by
+			the render stage, otherwise passes the call on to the next render
+			stage in the pipeline.  The last render stage returns NULL if no 
+			render stage in the pipeline implements the specified extension.
+	*/
+	IMPORT_C virtual TAny * ResolveObjectInterface(TUint aTypeId);
+
+protected:	
+	/** Constructor */
+	IMPORT_C CWsRenderStage();
+	
+	/**
+	Second phase construction.  Must be called from derived class construction sequence.
+	*/
+	IMPORT_C void BaseConstructL();
+	
+private:
+	CWsRenderStage(const CWsRenderStage &); // no implementation
+	CWsRenderStage & operator=(const CWsRenderStage &); // no implementation
+
+private:
+	CPimpl * iPimpl;
+	};
+
+#endif //__WSRENDERSTAGE_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/WsRenderStageFactory.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,54 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Interface for creating render stages for the window server
+// 
+//
+
+#ifndef __WSRENDERSTAGEFACTORY_H__
+#define __WSRENDERSTAGEFACTORY_H__
+
+#include <graphics/wsgraphicdrawerinterface.h>
+
+class CWsRenderStage;
+
+/**
+Window server interface to allow creation of a render stage pipeline.
+
+@publishedPartner
+@prototype
+*/
+class MWsRenderStageFactory : public MWsObjectProvider
+	{
+public:
+ 	DECLARE_WS_TYPE_ID(KMWsRenderStageFactory)
+ 	
+public:
+#ifdef SYMBIAN_GRAPHICS_GCE
+	/**
+	Create a render stage which has no further render stages below it.
+	*/
+	virtual CWsRenderStage* CreateFinalRenderStageL(MWsScreen* aScreen, MWsScreenRedraw* aScreenRedraw, TInt aScreenNumber) = 0;
+	
+	/**
+	Create a render stage which has a render stage below it.
+	*/
+	virtual CWsRenderStage* CreateRenderStageL(MWsScreen* aScreen, MWsScreenRedraw* aScreenRedraw, CWsRenderStage* aNextStage) = 0;
+#else //SYMBIAN_GRAPHICS_GCE
+	/**
+	*/
+	virtual CWsRenderStage * CreateStageL(MWsScreen * aScreen, MWsScreenRedraw * aScreenRedraw) = 0;
+#endif //SYMBIAN_GRAPHICS_GCE
+	};
+	
+#endif //__WSRENDERSTAGEFACTORY_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/displaycontrol.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,68 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef DISPCTRL_CLIENT_H_
+#define DISPCTRL_CLIENT_H_
+
+#include <graphics/displaycontrolbase.h>
+
+/**
+ * Window Server client interface for display control.
+ * 
+ * All functions in MDisplayControlBase will automatically flush the client-server
+ * session buffer as part of their behavior.
+ * 
+ * Setting the display configuration successfully shall cause the screen mode
+ * index to change to one of the last two entries (dependent on rotation) and that
+ * mode's size information shall be updated as necessary.
+ * 
+ * @publishedPartner
+ * @prototype
+ */
+class MDisplayControl : public MDisplayControlBase
+	{
+public:
+	enum	
+		{
+		KUidDisplayControl =  0x10286499, 	  //To    0x1028649A
+		ETypeId=	 KUidDisplayControl 
+		};
+public:
+	/** 
+	 * Returns whether changes in the display will trigger an EEventDisplayChanged 
+	 * event to be issued.
+	 *
+	 * Events will be triggered configuration changes that have taken place on 
+	 * the display, when a display has been connected / disconnected (if it can be 
+	 * detected), and when the available resolutions change.
+	 *
+	 * This function always causes a flush of the window server buffer.
+	 *	
+	 * @return ETrue if display change events are enabled, EFalse otherwise
+	 */
+	virtual TBool DisplayChangeEventsEnabled() const =0;
+	/** 
+	 * Determines whether changes in the display will trigger an EEventDisplayChanged 
+	 * event to be issued.
+	 * 
+	 * @see DisplayChangeEventsEnabled
+	 * 
+	 * @param aEnable ETrue to enable display change events, EFalse to disable them
+	 */	
+	virtual void EnableDisplayChangeEvents(TBool aEnable) =0;
+	};
+
+
+#endif /*DISPCTRL_CLIENT_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/displaymapping.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,138 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @publishedPartner
+ @prototype
+*/
+
+#ifndef DISPMAP_CLIENT_H_
+#define DISPMAP_CLIENT_H_
+#include <w32std.h>
+
+/** Defines the coordinate space UID values for use with
+	MDisplayMappingBase::MapCoordinates().
+*/
+enum TCoordinateSpace
+		{
+	/**
+		Application coordinate space, possibly offset but not scaled
+		relative to full-screen space.
+	 */
+	EApplicationSpace = 0x1028656F,
+	/**
+		User interface coordinate space, possibly scaled but not offset
+		relative to composition space.
+	*/
+	EFullScreenSpace = 0x10286570,
+	/**
+		Composition coordinate space, used by composition back-end in
+		compositing the display contents.
+	*/
+	ECompositionSpace = 0x10286571,
+	/**
+		Coordinate space for the DSA buffer. May be offset but not scaled
+		relative to both application and full-screen spaces. Identical to
+		full-screen space if the DSA buffer is used for UI rendering.
+	*/
+	EDirectScreenAccessSpace = 0x1028656E
+	};
+
+/** Provides facilities to map coordinates between various coordinate
+	spaces.
+
+*/
+class MDisplayMappingBase
+	{
+public:
+	enum	
+		{
+		KUidDisplayMappingBase =  0x1028656D, 	  
+		ETypeId=	 KUidDisplayMappingBase 
+		};
+public:
+	/** Maps the source rectangle from a source coordinate space to a
+		target coordinate space. Since there may be scaling involved, the
+		target rectangle may be larger or smaller than the source one, or
+		even become empty.
+
+		Two rectangles that abut each other before mapping, when mapped
+		using the same source and target space UIDs, shall also abut each
+		other after mapping.
+
+		@param aSourceSpace source space
+		@param aSource source rectangle
+		@param aTargetSpace target space
+		@param aTarget target rectangle to be filled in
+		@return KErrNone if successful or KErrNotSupported if invalid TCoordinateSpace
+	*/
+	virtual TInt MapCoordinates(TCoordinateSpace aSourceSpace, const TRect& aSource, TCoordinateSpace aTargetSpace, TRect& aTarget) const =0;
+	};
+
+/** Provides the Window Server client coordinate space mapping
+	functions.
+
+*/
+class MDisplayMapping : public MDisplayMappingBase
+	{
+public:
+	enum	
+		{
+		KUidDisplayMapping =  0x1028656B, 	  
+		ETypeId=	 KUidDisplayMapping 
+		};
+public:
+	/** Retrieves the largest window extent that is visible at the current
+		display resolution. This may be larger than the size reported by
+		SizeInPixels(), and have a negative top-left position, for example.
+
+		@see MDisplayControl
+		@see CWsScreenDevice::SizeInPixels
+
+	 	@param aExtent extent to be filled in
+	*/
+	virtual void GetMaximumWindowExtent(TRect& aExtent) const =0;
+	/** Returns the maximum useful size for a surface to be shown on the
+		display at the current resolution, in both pixels and twips.
+
+		This may be larger than both the screen device SizeInPixels() and
+		the size of the maximum window extent, if the user interface is
+		being scaled by the display. In general, the value will be the
+		native display resolution.
+
+		@see MDisplayControl
+		@see CWsScreenDevice::SizeInPixels
+		
+		@param aPixels pixels to be filled in
+		@param aTwips twips to be filled in
+	*/
+	virtual void GetMaximumSurfaceSize(TSize& aPixels, TSize& aTwips) const =0;
+	/** Retrieves the extent of a window relative to the top-left corner of
+		the display.
+
+		This will differ from the window's AbsPosition() if the current
+		screen size mode is offset from the corner of the display, or if
+		the user interface is being scaled on the display.
+
+		@param aWindow window in question
+		@param aExtent extent to be filled in
+	*/
+	virtual void GetDisplayExtentOfWindow(const RWindowBase& aWindow, TRect& aExtent) const =0;
+	};
+
+
+
+#endif 	/*DISPMAP_CLIENT_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/openwfc/WSGRAPHICDRAWERINTERFACE.H	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,1367 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// WSGRAPHICDRAWERINTEFACE.H
+// Server-side base-classes for graphic drawer plugins
+// 
+//
+
+#ifndef __WSGRAPHICDRAWERINTEFACE_H__
+#define __WSGRAPHICDRAWERINTEFACE_H__
+
+#include <e32base.h>
+#include <w32std.h>
+#include <gdi.h>
+#include <bitstd.h>
+
+class CWsGraphicDrawer;
+struct TGraphicDrawerId;
+class MWsEventHandler;
+class CWsGraphicMessageQueue;
+class CWsClient;
+class CWsWindow;
+
+#if !defined(SYMBIAN_GRAPHICS_GCE)
+	class MWsFlickerFreeBufferObserver;
+#endif
+
+class MWsScreenRedrawObserver;
+class MWsMemoryRelease;
+class MEventHandler;
+class MWsElement;
+class MWsGraphicsContext;
+class MWsAnimationScheduler;
+
+/** 
+@publishedPartner
+@released
+*/
+enum TWinType
+	{
+	EWinTypeClient,
+	EWinTypeRoot,
+	EWinTypeGroup,
+	};
+
+/** Declares an object type, ETypeId, for a class, in order to allow the WSERV object
+provider mechanism to locate and provide objects from the class.
+@publishedPartner
+@released
+@see MWsObjectProvider */
+#define DECLARE_WS_TYPE_ID(id) enum { EWsObjectInterfaceId = id };
+
+class MWsObjectProvider
+/** A class for dynamic extension of object instances
+	WSERV classes which wish to allow dynamic extension show derive those
+	extensions from MWsObjectProvider and use the DECLARE_WS_TYPE_ID macro
+	Similiar in principle and operation to CONE's MObjectProvider
+	@publishedPartner
+	@released
+	@see MObjectProvider
+*/	{
+public:
+	template<class T>
+	T* ObjectInterface()
+	/** Gets an object of the type defined by the template parameter.
+
+	@return A pointer to an object of the type required, or NULL if none can be
+	found. */
+		{ return (T*)ResolveObjectInterface(T::EWsObjectInterfaceId); }
+	/** Gets an object of the type defined by the template parameter.
+	@return A pointer to a const object of the type required, or NULL if none can be
+	found. */
+	template<class T>
+	const T* ObjectInterface() const
+		{ return (T*)const_cast<MWsObjectProvider*>(this)->ResolveObjectInterface(T::EWsObjectInterfaceId); }
+	/** Resolve an instance of an interface
+	should be overriden by implementations when they have custom interfaces to provide. */
+	IMPORT_C virtual TAny* ResolveObjectInterface(TUint aTypeId);
+	};
+
+class MWsScreen: public MWsObjectProvider
+/** A destination for a drawing occasion of a CWsGraphicDrawer
+	Used by animation schedulers to update screens
+	@publishedPartner
+	@released
+*/	{
+public:
+	using MWsObjectProvider::ResolveObjectInterface;
+	
+private:
+	friend class MWsAnimationScheduler;
+#if !defined(SYMBIAN_GRAPHICS_GCE)
+	/** Called by the MWsAnimationScheduler when scheduled animation is to be serviced
+		
+		WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.
+
+		@released */
+	virtual void OnAnimation() = 0;
+#else
+	/** Called by the MWsAnimationScheduler when a scheduled animation is to be serviced.
+		@param aFinished If not NULL then this is signalled when the animation has 
+		been processed and further animations may be submitted. An animation may be
+		submitted prior to signalling, but the render stage pipeline may not be ready
+		to process it. 
+		
+		WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.
+
+		@released */
+	virtual void OnAnimation(TRequestStatus* aFinished) = 0;
+#endif
+	/** Called by the MWsAnimationScheduler when the screen needs to be redrawn in its entirity
+		
+		WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.
+
+		@released */
+	virtual void Redraw() = 0;
+	/** Called by MWsAnimationScheduler when the any parts of the screen that potentially contain
+		commands to draw graphics in the list of IDs passed need to be redrawn
+		@param aInvalid the list of IDs that are invalid
+		@return whether the screen did any redrawing
+		
+		WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.
+
+		@released */
+	virtual TBool RedrawInvalid(const TArray<TGraphicDrawerId>& aInvalid) = 0;
+	};
+
+/**
+@publishedPartner
+@prototype
+*/
+class CWsMessageData : public CBase, public MWsObjectProvider
+	{
+public:
+	virtual TPtrC8 Data() const = 0;
+	virtual void Release() = 0;
+	IMPORT_C TInt ClientHandle() const;
+	IMPORT_C TInt Id() const;
+	IMPORT_C const CWsGraphicDrawer* Drawer();
+	IMPORT_C void SetClientHandle(TInt aClientHandle);
+	IMPORT_C void SetId( TInt aId);
+	IMPORT_C void SetDrawer(const CWsGraphicDrawer* aDrawer);
+private:
+	friend class CWsGraphicMessageQueue;
+	friend class CWsClient;
+	CWsMessageData* iNext;
+	const CWsGraphicDrawer* iDrawer;
+	TInt iId;
+	TInt iClientHandle;
+	TInt iMWsMessageDataSpare[3];
+	};
+
+class MWsClient: public MWsObjectProvider
+/*** Represents a client session
+	@publishedPartner 
+	@released  */
+	{
+public:
+	/** Determines if this client has the specified capability */
+	virtual TBool HasCapability(TCapability aCapability) const = 0;
+	/** Retrieves the Secure ID of the client's process */
+	virtual TSecureId SecureId() const = 0;
+	/** Retrieves the Vendor ID of the client's process */
+	virtual TVendorId VendorId() const = 0;
+private:
+	friend class CWsGraphicDrawer;
+	virtual TInt SendMessage(const CWsGraphicDrawer* aOnBehalfOf,const TDesC8& aData) = 0;
+	virtual TInt SendMessage(const CWsGraphicDrawer* aOnBehalfOf,CWsMessageData& aData) = 0;
+	};
+
+class MWsGraphicDrawerEnvironment: public MWsObjectProvider
+/** The environment for a graphic drawer
+@publishedPartner
+@released
+*/	{
+public:
+	/** Locate a graphic by ID
+	@return the graphic with that ID, else NULL if no such graphic exists */
+	virtual const CWsGraphicDrawer* ResolveGraphic(const TGraphicDrawerId& aId) const = 0;
+	/** The number of screens the device has; this is constant for a device */
+	virtual TInt ScreenCount() const = 0;
+	/** Get a particular screen by ordinal
+	@return the screen, or NULL if aIndex is out of bounds */
+	virtual MWsScreen* Screen(TInt aIndex) = 0;
+	/** Get a particular screen by ordinal
+	@return the screen, or NULL if aIndex is out of bounds */
+	virtual const MWsScreen* Screen(TInt aIndex) const = 0;
+	/**  Not supported
+	@return success of overriding the default scheduler */
+	virtual TBool SetCustomAnimationScheduler(MWsAnimationScheduler* aScheduler) = 0;
+	/** Query whether a custom animation scheduler has been set
+	@return ETrue if the custom animation scheduler has been set */
+	virtual TBool HasCustomAnimationScheduler() const = 0;
+	/** Clears a custom animation scheduler
+	@return success if the custom scheduler was set, and hence removed */
+	virtual TBool ClearCustomAnimationScheduler(MWsAnimationScheduler* aCurrentScheduler) = 0;
+protected:
+	friend class CWsGraphicDrawer;
+	/** Schedules all potentially affected parts of the screen to repaint
+	This is called automatically whenever a graphic is added, replaced or removed.
+	However, if a graphic which changes representation during runtime must call this
+	explicitly.
+	Note: this is not a suitable method for animating a graphic.  For animation,
+	use MWsGc::Invalidate when the graphic is being drawn to schedule the next
+	animation frame instead.
+	@param aId the ID of the artwork; the artwork may not exist */
+	virtual void Invalidate(const TGraphicDrawerId& aId) = 0;
+public:
+	/** Register to be notified when some events occur.
+	@return KErrNone if successful */
+	virtual TInt RegisterEventHandler(CWsGraphicDrawer* aDrawer, MWsEventHandler* aHandler, TUint32 aEventMask) = 0;
+	/** Unregister from events notification
+	@return KErrNone if successful */
+	virtual TInt UnregisterEventHandler(CWsGraphicDrawer* aDrawer) = 0;
+	/** Register to be notified when some events occur.
+	@return KErrNone if successful
+	@prototype */
+	virtual TInt RegisterWsEventHandler(MWsEventHandler* aHandler, TUint32 aEventMask) = 0;
+	/** Unregister from events notification
+	@return KErrNone if successful 
+	@prototype */
+	virtual TInt UnregisterWsEventHandler(MWsEventHandler* aHandler) = 0;
+	/** Logs a message to the wserv logger, if one is loaded
+	@param aPriority The priority of the message - low priority is 1, high is 9
+	@param aFmt The string to log.  This may contain a single %d, %x or equivalent
+	@param aParam An integer parameter corresponding to a %d, if present
+	@prototype */
+	virtual void Log(TInt aPriority,const TDesC &aFmt,TInt aParam=0) = 0;
+	/** Registers an interface for releasing memory in low memory situations.
+	The release function may be called as a result of any Alloc or ReAlloc attempts in the window server
+	process.
+	@param aMemoryRelease a callback interface
+	@return KErrNone or a system wide error code
+	@prototype */
+	virtual TInt RegisterMemoryRelease(MWsMemoryRelease * aMemoryRelease) = 0;
+	/** Removes a registration set by RegisterMemoryRelease
+	@param aMemoryRelease the registered release object to remove
+	@prototype */
+	virtual void UnregisterMemoryRelease(MWsMemoryRelease * aMemoryRelease) = 0;
+	};
+
+class MWsGc: public MWsObjectProvider
+/** A destination for a drawing occasion of a CWsGraphicDrawer
+	Used to register invalidation schedules for animation
+	@publishedPartner
+	@released
+*/	{
+public:
+	/** The Client requesting this drawing occasion
+		@return the client
+		@publishedPartner 
+		@released  */
+	virtual MWsClient& Client() = 0;
+	/** The screen that is currently being drawn to
+		@return the screen
+		@publishedPartner 
+		@released  */
+	virtual MWsScreen& Screen() = 0;
+#if !defined(SYMBIAN_GRAPHICS_GCE)
+	/** The origin of the GC relative to the screen's origin
+		@return the origin
+		@publishedPartner
+		@released  */
+	virtual TPoint GcOrigin() const = 0;
+	/** The clipping region currently being used
+		@return the clipping region
+		@publishedPartner
+		@released */
+	virtual const TRegion& ClippingRegion() = 0;
+	/** The BITGDI graphics context to draw to
+		@publishedPartner
+		@released */
+	virtual CFbsBitGc& BitGc() = 0;
+	/** Saves the state of the GC to an internal buffer.  Several GC states can be saved in a FILO.
+		Do not restore a GC (using PopBitGcSettings()) that wasn't properly saved!
+		@return KErrNone if successful, else one of the system-wide error codes. */
+	virtual TInt PushBitGcSettings() = 0;
+	/** Restores the last GC state that was saved. */
+	virtual void PopBitGcSettings() = 0;
+#endif	
+	/** The time for the current redraw
+		@publishedPartner 
+		@released */
+	virtual const TTime& Now() const = 0;
+	/** Schedule an animation of a rectangle in the future.
+	    Scheduled animation doesn't work in low memory conditions or
+	    if aRect values fall outside the window area of this animation.
+		@param aRect the rectangle to animate, in the GC's coordinates
+		@param aFromNow the time in microseconds from Now() that the rectangle will be invalid
+		@publishedPartner 
+		@released */
+	virtual void ScheduleAnimation(const TRect& aRect,const TTimeIntervalMicroSeconds& aFromNow) = 0;
+	/** Schedule an animation of a rectangle in the future
+		@param aRect the rectangle to animate, in the GC's coordinates
+		@param aFromNow the time in microseconds from Now() that the rectangle will be invalid
+		@param aFreq microseconds between frames that this rectangle will probably be invalid in the future (0 means no such hint is known)
+		@param aStop the duration in microseconds from Now() that the aFreq hint will be valid for (0 means indefinitely)
+		@publishedPartner 
+		@released */
+	virtual void ScheduleAnimation(const TRect& aRect,const TTimeIntervalMicroSeconds& aFromNow,const TTimeIntervalMicroSeconds& aFreq,const TTimeIntervalMicroSeconds& aStop) = 0;
+	/** Sets the origin of gc
+		@param aOrigin The new origin of the gc
+		@publishedPartner 
+		@prototype	*/
+	virtual void SetGcOrigin(const TPoint& aOrigin) = 0;
+	};
+
+/** Interface Extension
+*/
+enum
+	{
+	KMWsScreenConfigInterfaceId = 1,
+#if !defined(SYMBIAN_GRAPHICS_GCE)
+	KMWsBackBufferInterfaceId = 2,
+	KMWsFrontBufferInterfaceId = 3,
+#endif
+	KMWsGraphicDrawerMessageAlloc = 4,
+	KMWsGraphicMessageAlloc = 5,
+	KWsGraphicHandleSynchronMessageId = 6,
+	KWsGraphicMessageCallbackInterfaceId = 7,
+	KWsActiveSchedulerDebug = 8,
+#if !defined(SYMBIAN_GRAPHICS_GCE)
+	KWsFlickerFreeBufferObserver = 9,
+#endif
+	KMWsWindow = 10,
+	KWsScreenRedraw = 11,
+	KWsScreenRedrawObserver = 12,
+	KCWsRenderStage = 13,
+	KMWsRenderStageFactory = 14,
+	KMWsMemoryRelease = 15,
+#if !defined(SYMBIAN_GRAPHICS_GCE)	
+	KMWsGcClipRect = 16,
+#endif	
+	KMWsFader = 17,
+	KMWsPluginManager = 18,
+	KMWsIniFile = 19,
+	KMWsRawEventServer = 20,
+	KMWsPlaceSurfaceId = 21,
+#if defined(SYMBIAN_GRAPHICS_GCE)
+	KMWsTextCursor = 22,				// CWsRenderStage Object Extension will yield an MWsTextCursor
+#endif
+	KMWsGraphicsContext = 23,			// CWsRenderStage Object Extension will yield an MWsGraphicsContext
+	KMWsCompositionContext = 24,		// CWsRenderStage Object Extension will yield an MWsCompositionContext
+										// 		MWsCompositionContext::CreateLayer will yield a MWsLayer
+	KMWsEventHandler = 25,				// CWsRenderStage Object Extension will yield an MWsEventHandler
+	KMWsScreenDevice = 26,				// CWsRenderStage Object Extension will yield an MWsScreenDevice
+	KMWsPalette = 27,					// CWsRenderStage Object Extension will optionally yield an MWsPalette
+#if defined(SYMBIAN_GRAPHICS_GCE)
+	KMWsUiBufferInterfaceId = 28,		// CWsRenderStage Object Extension will optionally yield an MWsUiBuffer
+#endif
+	KMWsDebugBar = 29,					// CWsRenderStage Object Extension will optionally yield an MWsDebugBar
+	KMWsDrawableSourceProvider = 30,	// CWsRenderStage Object Extension will optionally yield an MWsDrawableSourceProvider
+	KMWsScreenConfigListInterfaceId = 31,	//MWsScreen can return this list interface
+	KMWsWindowTreeObserver = 32,        // CWsRenderStage Object Extension will optionally yield an MWsWindowTreeObserver
+	KMWsDrawAnnotationObserver = 33, 	// CWsRenderStage Object Extension will optionally yield an MWsDrawAnnotationObserver
+	KMWsWindowVisibilityNotifier = 34, 	// CWsRenderStage Object Extension will optionally yield an MWsWindowVisibilityNotifier
+	KMWsWindowTree = 35,				// Object Extension to be used by render stages for recovery of MWsWindowTree
+	KMWsScene = 36,                     // CWsRenderStage Object Extension will yield an MWsScene
+	                                    //      MWsScene::CreateSceneElement will yield a MWsElement
+	KMWsContentReadyForComposition = 37,// CWsRenderStage Object Extension will optionally yield an MWsContentReadyForComposition
+	};
+
+class TSurfaceConfiguration;
+
+
+/** Extension to GC to allow surface placement.
+
+@publishedPartner
+@prototype
+@deprecated
+
+NOTE: This interface is deprecated. Do not use!
+*/
+class MWsSurfacePlacement: public MWsObjectProvider
+	{
+	public:
+	DECLARE_WS_TYPE_ID(KMWsPlaceSurfaceId)
+	virtual TInt	PlaceSurface(const TSurfaceConfiguration& aConfig)=0;
+	};
+
+/** Current screen mode configuration.Values return from this interface shall not be cached as they
+can change at anytime when wserv changes its screen mode. Plugin can listen to event EScreenSizeModeChanged
+to be notified when it happens.
+
+@publishedPartner
+@released
+*/
+class MWsScreenConfig: public MWsObjectProvider
+	{
+public:
+	DECLARE_WS_TYPE_ID(KMWsScreenConfigInterfaceId)
+
+	/** Get screen display mode */
+	virtual TDisplayMode DisplayMode() const = 0;
+	/** Get physical screen size in pixels */
+	virtual TSize SizeInPixels() const = 0;
+	/** Get screen size in pixels for current screen size mode as defined in wsini */
+	virtual TSize ScreenModeSizeInPixels() const = 0;
+	/** Get frame buffer line pitch */
+	virtual TInt Stride() const = 0;
+	/** Get screen orientation */
+	virtual CFbsBitGc::TGraphicsOrientation Orientation() const = 0;
+	/** Get screen size mode */
+	virtual TInt SizeMode() const = 0;
+	/** Get screen scaling factor */
+	virtual TSize ScalingFactor() const = 0;
+	/** Get screen origin */
+	virtual TPoint Origin() const = 0;
+	/** Get screen scaled origin */
+	virtual TPoint ScaledOrigin() const = 0;
+	};
+
+/**	Available list of screen modes as specified during start-up.
+ * 	This interface can generally be enquired from the MWsScreen instance.
+ * 	Can be read by render stage to configure its Display Configuration policy.
+ * 	
+ * 	Note that mode list is not contiguous, so methods may leave if missing index is requested.
+ **/
+class MWsScreenConfigList: public MWsObjectProvider
+	{
+public:
+	DECLARE_WS_TYPE_ID(KMWsScreenConfigListInterfaceId)
+
+	enum	TModeFlags
+		{
+		EDynamic=			0x00000001,		//"-1,-1"
+		EHighRes=			0x00000002,		//High-res policy mode
+		EDisconnected=		0x00000004,		//Mode to use when disconnected
+		EHalDefault=		0x00000008,
+		ETwipsSpecified=	0x00000010,
+		EClientDefinedDigitiserArea=	0x00000020,	
+		};
+	
+	/** Get  list of valid display modes - may be sparse **/
+	virtual TInt	GetScreenSizeModeList(RArray<TInt>&aList) const =0;
+	/** Get screen display mode */
+	virtual TDisplayMode DisplayModeL(TInt aIndex) const = 0;
+	/** Get screen size in pixels for current screen size mode as defined in wsini */
+	virtual TSize ScreenModeSizeInPixelsL(TInt aIndex) const = 0;
+	/** Get screen size in twips for current screen size mode as defined in wsini */
+	virtual TSize ScreenModeSizeInTwipsL(TInt aIndex) const = 0;
+	/** Get screen orientation */
+	virtual CFbsBitGc::TGraphicsOrientation OrientationL(TInt aIndex) const = 0;
+	/** Get screen orientation */
+	virtual TInt AvailableOrientationsL(TInt aIndex) const = 0;
+	/** Get screen scaling factor - note this is expected to stay at 1:1 */
+	virtual TSize ScalingFactorL(TInt aIndex) const = 0;
+	/** Get screen origin */
+	virtual TPoint OriginL(TInt aIndex) const = 0;
+	/** Get screen scaled origin - note this is expected to stay at 1:1  */
+	virtual TPoint ScaledOriginL(TInt aIndex) const = 0;
+	/** Get the modeflags for specified mode  */
+	virtual TInt ModeFlagsL(TInt aIndex) const = 0;
+	
+	};
+	
+class MWsWindowTree : public MWsObjectProvider
+	{
+public:	
+	DECLARE_WS_TYPE_ID(KMWsWindowTree)
+	virtual void SendTree() const = 0;
+	};
+ 
+#if !defined(SYMBIAN_GRAPHICS_GCE)
+/** Wserv flickerfree buffer access
+
+@publishedPartner
+@released
+*/
+class MWsBackBuffer: public MWsObjectProvider
+	{
+public:
+	DECLARE_WS_TYPE_ID(KMWsBackBufferInterfaceId)
+	/** Get wserv flickerfree buffer bitmap
+	*/
+	virtual CFbsBitmap* GetBitmap() = 0;
+	/** Get default wserv flickerfree buffer drawing context. This will always return the original
+	context not the current context (e.g. not the redirecting context when it is redirected).
+	*/
+	virtual CFbsBitGc* GetBitGc() = 0;
+	/** Set wserv flickerfree buffer drawing context to redirect its drawing output. Drawing context must
+	have been activated on a device prior calling this function.
+	@param aBitGc The context where flickerfree buffer drawing output is redirected to. If it is NULL
+	the redirection will be cancelled and default drawing context will be restored.
+	@return KErrNone if successful, otherwise one of system-wide error codes.
+	*/
+	virtual TInt SetBitGc(CFbsBitGc* aBitGc) = 0;
+	/** Redirects drawing to another back buffer. Target back buffer must provide bitmap and drawing context
+	which has been activated on a bitmap device.
+	@param aTarget Target back buffer where drawing is redirected to. If it is NULL
+	the redirection will be terminated.
+	@return KErrNone if successful, otherwise one of system-wide error codes.
+	@prototype
+	*/
+	virtual TInt RedirectTo(MWsBackBuffer* aTarget) = 0;
+	
+	/** Sets the back buffers observer.  The observer will be called just before and just after each
+	complete sequence of drawing to the back buffer.
+	@param aObserver The observer handling the callbacks
+	@prototype
+	*/
+	virtual void SetObserver(MWsFlickerFreeBufferObserver* aObserver) = 0;
+	
+	/** This returns the observer set by SetObserver.
+	@return The observer set by SetObserver, or NULL
+	@prototype
+	*/
+	virtual MWsFlickerFreeBufferObserver* Observer() = 0;
+
+	/** Get current wserv flickerfree buffer drawing context. This will return the redirected context 
+	when it is set.
+	@return The graphics context to use to draw to the flicker buffer directly.
+	@prototype
+	*/
+	virtual CFbsBitGc* GetBitGcCurrent() = 0;
+	};
+
+/** Wserv screen buffer access
+
+@publishedPartner
+@released
+*/
+class MWsFrontBuffer: public MWsObjectProvider
+	{
+public:
+	DECLARE_WS_TYPE_ID(KMWsFrontBufferInterfaceId)
+	/** Get pointer to framebuffer
+	*/
+	virtual const TAny* GetBits() = 0;
+	/** Get default wserv screen drawing context. This will always return the original
+	context not the current context (e.g. not the redirecting context when it is redirected).
+	*/
+	virtual CFbsBitGc* GetBitGc() = 0;
+	/** Set wserv screen drawing context to redirect its drawing output. Drawing context must
+	have been activated on a device prior calling this function.
+	@param aBitGc The context where screen drawing output is redirected to. If it is NULL
+	the redirection will be cancelled and default drawing context will be restored.
+	@return KErrNone if successful, otherwise one of system-wide error codes.
+	*/
+	virtual TInt SetBitGc(CFbsBitGc* aBitGc) = 0;
+	/** Set wserv screen drawing context to redirect its drawing output and perform fullscreen 
+	redraw if necessary. Drawing context must have been activated on a device prior calling this 
+	function.
+	@param aBitGc The context where screen drawing output is redirected to. If it is NULL
+	the redirection will be cancelled and default drawing context will be restored.
+	@param aInvalidateScreen Flag to tell wserv to perform fullscreen redraw or not
+	@return KErrNone if successful, otherwise one of system-wide error codes.
+	@prototype
+	*/
+	virtual TInt SetBitGc(CFbsBitGc* aBitGc, TBool aInvalidateScreen) = 0;	
+	
+	/** Get current wserv screen drawing context. This will return the redirected context 
+	when it is set.
+	@prototype
+	*/
+	virtual CFbsBitGc* GetBitGcCurrent() = 0;
+	};
+#endif // !SYMBIAN_GRAPHICS_GCE
+
+/** Optional Memory Allocator for incoming messages
+	To be implemented by CRPs which want to control large incoming messages themselves
+
+@publishedPartner
+@released
+*/
+class MWsGraphicDrawerMessageAlloc: public MWsObjectProvider
+	{
+public:
+	DECLARE_WS_TYPE_ID(KMWsGraphicDrawerMessageAlloc)
+	virtual TAny* Alloc(TInt aSize) = 0;
+	virtual void Free(TAny* aCell) = 0;
+	};
+
+/** Optional Memory Allocator for incoming messages
+	To be implemented by CWsGraphics which want to control large incoming messages themselves
+
+@publishedPartner
+@released
+*/
+class MWsGraphicMessageAlloc: public MWsObjectProvider
+	{
+public:
+	DECLARE_WS_TYPE_ID(KMWsGraphicMessageAlloc)
+	NONSHARABLE_CLASS(MBuffer): public MWsObjectProvider
+		{
+	public:
+		virtual TPtr8 Buffer() = 0;
+		virtual void Release() = 0;
+		};
+	virtual MBuffer* Alloc(TInt aSize) = 0;
+	};
+
+/** For debug purposes only
+
+@publishedPartner
+@prototype
+*/	
+class MWsActiveSchedulerDebug: public MWsObjectProvider
+	{
+public:
+	DECLARE_WS_TYPE_ID(KWsActiveSchedulerDebug)
+	virtual TInt64 Requests() const = 0;
+	virtual TInt64 Errors() const = 0;
+	virtual TInt64 Draws() const = 0;
+	virtual TInt64 Total() const = 0;
+	virtual TInt64 Preparing() const = 0;
+	virtual TInt64 Drawing() const = 0;
+	virtual TInt64 Idle() const = 0;
+	};
+
+#if !defined(SYMBIAN_GRAPHICS_GCE)
+/** This forms part of the MWsBackBuffer interface
+
+@publishedPartner
+@prototype
+*/
+class MWsFlickerFreeBufferObserver: public MWsObjectProvider 
+	{
+public:	
+	DECLARE_WS_TYPE_ID(KWsFlickerFreeBufferObserver)
+	/** Function that gets called before the flicker buffer is updated
+	@param aBuffer The back buffer that is about to be updated
+	@param aRegion The region of the back buffer that is about to be updated
+	*/
+	virtual void BeforeUpdate(MWsBackBuffer& aBuffer,const TRegion& aRegion) = 0;
+	/** Function that gets called after the flicker buffer has been updated
+	@param aBuffer The back buffer that has been updated
+	@param aRegion The region of the the back buffer that has been updated
+	*/
+	virtual void AfterUpdate(MWsBackBuffer& aBuffer,const TRegion& aRegion) = 0;
+	};
+#endif // !SYMBIAN_GRAPHICS_GCE
+
+/** An interface through which a window can be examined
+This returns non const copies instead of const references, and the
+functions themselves are non const.
+
+@publishedPartner
+@prototype
+*/
+class MWsWindow : public MWsObjectProvider
+	{
+public:	
+	DECLARE_WS_TYPE_ID(KMWsWindow)
+public:
+	/** Gets the origin of the window.
+	@return TPoint containing the origin of the window.
+	*/
+	virtual TPoint Origin() const = 0;
+	/** Gets the windows rect in absolute co-ordinates.
+	@return TRect
+	*/
+	virtual TRect AbsRect() const = 0;
+	/** Gets the size of the window
+	@return TSize containing the size of the window
+	*/
+	virtual TSize Size() const = 0;
+	/** Get the window's handle
+	@return TUint32 containing the window's handle.
+	*/
+	virtual TUint32 Handle() const = 0;
+	/** Invalidate an area of the window.
+	@param aRect TRect containing the area to invalidate.
+	*/
+	virtual void Invalidate(const TRect * aRect = 0) = 0;
+	/** Get the MWsScreen for this window.
+	@return A pointer to the MWsScreen that this window is on.
+	*/
+	virtual MWsScreen * WsScreen() const = 0;
+	/** Finds a child of this window by specifiying its handle.
+	@param aHandle A handle to the window to find.
+	@return an MWsWindow pointer to the found window
+	*/
+	virtual MWsWindow * FindChildByHandle(TUint32 aHandle) = 0;
+	/**
+	Returns the ordinal priority of the node. 
+	*/
+	virtual TInt OrdinalPriority() const = 0;
+	/** Get the window's basic area before any clipping is done.
+	For windows with rounded corners, the window area is different from AbsRect.
+	@return a reference to the window area 
+	*/	
+	virtual const TRegion& WindowArea() const = 0;
+	};
+
+/** 
+An interface providing information about a window group.
+@publishedPartner
+@prototype
+*/
+class MWsWindowGroup
+	{
+public:
+	virtual TInt Identifier() const = 0;
+	virtual TPtrC Name() const = 0;
+	virtual TBool IsFocusable() const = 0;
+	virtual TInt OrdinalPriority() const = 0;
+	virtual const MWsClient * Client() const = 0;
+	};
+
+/**
+An interface through which a sprite can be examined. 
+@publishedPartner
+@prototype
+*/
+class MWsSprite 
+	{
+public:
+	enum TSpriteType
+		{
+		EWindowSprite,
+		EFloatingSprite,
+		ECustomTextCursorSprite,
+		EPointerCursorSprite
+		};
+public:
+	virtual TRect Rect() const = 0;
+	virtual TSpriteType SpriteType() const = 0;
+	};
+
+/**
+An interface through which a standard text cursor can be examined. 
+@publishedPartner
+@prototype
+*/
+class MWsStandardTextCursor
+	{
+public:
+	/**
+	Cursor type.
+	@return The cursor type; either TTextCursor::ETypeRectangle or TTextCursor::ETypeHollowRectangle.
+	*/
+	virtual TInt Type() const = 0;
+	/**
+	Draw rectangle.
+	@return Draw rectangle of the cursor in <b>window</b> co-ordinates.
+	*/
+	virtual TRect Rect() const = 0;
+	/**
+	Clipping rectangle in <b>window</b> co-ordinates.
+	@return If a clipping rect has been set, the cursor must be drawn clipped to the returned rectangle.
+	@see MWsWindowTreeObserver::ECursorClipRectSet
+	*/
+	virtual TRect ClipRect() const = 0;
+	/**
+	Cursor flags.
+	For possible values, see TTextCursor::EFlags.
+	Note, only flags included by the mask TTextCursor::EUserFlags are provided.
+	@see TTextCursor::EFlags
+	*/
+    virtual TUint Flags() const = 0;
+	/**
+	Cursor color.
+	@return The cursor color.
+	*/
+	virtual TRgb Color() const = 0;
+	/**
+	Flash time interval.
+	@return If TTextCursor::EFlagNoFlash is set, zero; otherwise the time interval between cursor flash on/off.
+	@see MWsStandardTextCursor::Flags()
+	*/
+	virtual TTimeIntervalMicroSeconds32 FlashInterval() const = 0;
+	};
+
+
+/** An interface providing information about a window tree node.
+@publishedPartner
+@prototype
+*/
+class MWsWindowTreeNode
+	{
+public:
+	
+	enum TType
+		{
+		EWinTreeNodeClient = EWinTypeClient,	//0
+		EWinTreeNodeRoot = EWinTypeRoot,		//1
+		EWinTreeNodeGroup = EWinTypeGroup,		//2 
+		EWinTreeNodeAnim = 16,					//3-15 reserved for expansion of TWinType
+		EWinTreeNodeSprite,
+		EWinTreeNodeStandardTextCursor,
+		};
+	
+	/** 
+	 @return The Node Type for this MWsWindowTreeNode. 	 */
+	virtual TType NodeType() const = 0;
+	/**
+	 @return A pointer to a MWsWindow interface only when this 
+	 MWsWindowTreeNode represents a client window 
+	 (i.e. node type EWinTreeNodeClient), NULL otherwise. */
+	virtual const MWsWindow* Window() const = 0;
+	/**
+	 @return A pointer to a MWsSprite interface only when this 
+	 MWsWindowTreeNode represents a sprite, NULL otherwise. */
+	virtual const MWsSprite* Sprite() const = 0;
+	/**
+	 @return A pointer to a MWsStandardTextCursor interface only when this 
+	 MWsWindowTreeNode represents a standard text cursor, NULL otherwise. */
+	virtual const MWsStandardTextCursor* StandardTextCursor() const = 0;
+	/** 
+	 @return The MWsWindowGroup this MWsWindowTreeNode belongs to, or "this"
+	 MWsWindowTreeNode object if the NodeType is EWinTreeNodeGroup. Will  
+	 return NULL if this MWsWindowTreeNode is of type EWinTreeNodeRoot. */
+	virtual const MWsWindowGroup* WindowGroup() const = 0;
+	/**
+	 @return The parent MWsWindowTreeNode. NULL if current node is of type
+	 EWinTreeNodeRoot. The parent of a floating sprite is the root window. */
+	virtual const MWsWindowTreeNode* ParentNode() const = 0;
+	};
+
+/** 
+An interface optionally provided by render stages, to observe changes in 
+window tree structure, or changes to tree nodes.
+
+@publishedPartner
+@prototype
+*/
+class MWsWindowTreeObserver : public MWsObjectProvider
+	{
+public:	
+	DECLARE_WS_TYPE_ID(KMWsWindowTreeObserver)
+	
+public:
+	/**
+	 This enum encapsulates the set of boolean attribute changes that can be observed
+	 using the MWsWindowTreeObserver interface. 
+	 @see FlagChanged */
+	enum TFlags
+		{
+		/** For a window to be drawn, it needs to be activated and visible and have visible parents.
+	 	Making a window invisible, implies that its children should be invisible as well.
+	 	The default value for a window is true. */
+		EVisible = 1,
+		/** Non-fading windows should not be drawn faded regardless of their fade-count.
+		The default value is false. */
+		ENonFading,
+		/** Windows with this attribute enabled uses alpha channel to control its transparency.
+		The default value is false. */
+		EAlphaChannelTransparencyEnabled,
+		/** True if a clipping rect should be applied when drawing a standard text cursor, false otherwise.
+		The default value is false. */
+		ECursorClipRectSet,
+		/** Implicitly defaults to true. Will remain true as long as the application's primary screendevice 
+		is in the same orientation as the device. This information is only given for top-windows, 
+		i.e. children of group-windows, and only when wsini.ini is configured with SIZE_MODE > 0. */
+		EScreenDeviceValid
+		};
+	/**
+	 This enum encapsulates the set of non-boolean attribute changes that can be observed
+	 using the MWsWindowTreeObserver interface. 
+	 @see AttributeChanged */
+	enum TAttributes
+		{
+		/** Cursor type.
+		@see MWsStandardTextCursor::Type()*/
+		ECursorType = 1,
+		/** Cursor clip rect.
+		@see MWsStandardTextCursor::ClipRect()*/
+		ECursorClipRect,
+		/** Cursor flags.
+		@see MWsStandardTextCursor::Flags()*/
+		ECursorFlags,
+		/** Cursor color.
+		@see MWsStandardTextCursor::Color()*/
+		ECursorColor,
+		/** Window shape.
+		@see MWsWindow::WindowArea()*/
+		EWindowShape,
+		/** Window group name
+		@see MWsWindowGroup::Name()*/
+		EWindowGroupName
+		};
+	/** 
+	 Callback to notify that a MWsWindowTreeNode has just been created. 
+	 Nodes are always added as the left-most sibling as this means they are
+	 added in front of exisitng nodes.
+	 @param aWindowTreeNode Use to query attributes of the node that has been 
+	 						created. Note that attributes such as e.g. the extent
+	 						is not yet set by the client when this notification arrives.
+	 @param aParent The parent node which aWindowTreeNode has been attached to. 
+	 				Special cases: aParent will be set to NULL for root windows, 
+	 				and set to the root window for floating sprites. */
+	virtual void NodeCreated(const MWsWindowTreeNode& aWindowTreeNode, const MWsWindowTreeNode* aParent) = 0;
+	/** 
+	 Callback to notify that a node in the window tree is about to be destroyed. 
+	 @param aWindowTreeNode Use to query attributes of node that's about to be destroyed. */
+	virtual void NodeReleased(const MWsWindowTreeNode& aWindowTreeNode) = 0;
+	/**
+	 Callback to notify that a node in the window tree has been activated. This 
+	 event is only generated for windows which has a visual appearance 
+	 (i.e. root windows and group windows are not activated). Before a node 
+	 can be drawn it needs to be activated and visible and have a non-zero size.
+	 @param aWindowTreeNode Use to query attributes of node that has been activated. */
+	virtual void NodeActivated(const MWsWindowTreeNode& aWindowTreeNode) = 0;
+	/**
+	 Callback to notify that a node's extent has changed. It is guaranteed that there
+	 will be at least one NodeExtentChanged notification between the NodeCreated and 
+	 NodeActivated notifications.
+	 Note that when a window has child-windows, those are always moving along with their
+	 parent but no NodeExtentChanged notifications will be generated for the child-windows.
+	 @param aWindowTreeNode Use to query attributes of the node that has been changed.
+	 @param aRect The new rectangle. */
+	virtual void NodeExtentChanged(const MWsWindowTreeNode& aWindowTreeNode, const TRect& aRect) = 0;
+	/**
+	 Callback to notify that the ordinal position of a window has changed.
+	 @param aWindowTreeNode Use to query attributes of the node that has been changed.. 
+	 @param aNewPos The new position of this node among its siblings. */
+	virtual void SiblingOrderChanged(const MWsWindowTreeNode& aWindowTreeNode, TInt aNewPos) = 0;
+	/**
+	 Callback to notify that a node has had one of its boolean attributes changed.
+	 @param aWindowTreeNode Use to query attributes of the node that has been changed.
+	 @param aFlag The attribute that has changed.
+	 @param aNewValue The new value for the attribute. */
+	virtual void FlagChanged(const MWsWindowTreeNode& aWindowTreeNode, TFlags aFlag, TBool aNewValue) = 0;
+	/**
+	 Callback to notify that a node has had one of its non-boolean attributes changed.
+	 @param aWindowTreeNode Use to identify the affected node and query the new value of the changed attribute.
+	 @param aAttribute The attribute that has changed. */
+	virtual void AttributeChanged(const MWsWindowTreeNode& aWindowTreeNode, TAttributes aAttribute) = 0;
+	/**
+	 Callback to notify that a window's fade count has been changed.
+	 @param aWindowTreeNode Use to query attributes of the node that has been changed.
+	 @param aFadeCount Zero means the window is not faded, an integer > 0 means 
+	 					faded if absolute fading is used, or the number of times 
+	 					SetFaded has been called if using counting fade. */
+	virtual void FadeCountChanged(const MWsWindowTreeNode& aWindowTreeNode, TInt aFadeCount) = 0;
+	/**
+	 Callback to notify that the user defined transparent region of a window has changed. 
+	 This information is for optimisation purpose only, the rendering engine don't need 
+	 to do a full back-to-front rendering behind the opaque region. 
+	 @param aWindowTreeNode  Use to query attributes of the node that has been changed.
+	 @param aNewTransparentRegion   The transparent region defined by the user. Coordinates 
+	 								are relative the window's origin.
+	 @param aNewOpaqueRegion 	The inverse of aNewTransparentRegion.  Coordinates are 
+	 							relative the window's origin. */	
+	virtual void TransparentRegionChanged(const MWsWindowTreeNode& aWindowTreeNode, const TRegion& aNewTransparentRegion, const TRegion* aNewOpaqueRegion) = 0;
+	/**
+	 Callback to notify that a element has been added to this window.
+	 The render stages implementing this interface know when elements are added or removed through MWsElement interface.
+	 The purpose of the ElementAdded API is only to enable render stages to make an association between the element and the window.
+	 @param aWindowTreeNode Use to query attributes of the node that has been changed.
+	 @param aElement Use to query attributes of the new element. */
+	virtual void ElementAdded(const MWsWindowTreeNode& aWindowTreeNode, const MWsElement& aElement) = 0;
+	/**
+	 Callback to notify that a window has been moved to another window group.
+	 @param aWindowTreeNode Use to query attributes of the node that has been moved.
+	 @param aNewWindowGroupNode The window group aWindowTreeNode has been moved to. 
+	 @see RWindowBase::MoveToGroup */
+	virtual void MovedToWindowGroup(const MWsWindowTreeNode& aWindowTreeNode, const MWsWindowTreeNode& aNewWindowGroupNode) = 0;
+	/**
+	 Callback to notify that a window group chain has been formed or extended.
+	 @param aParent The window group node to which a child has been attached.
+	 @param aChild The window group node that has been attached to aParent. */
+	virtual void WindowGroupChained(const MWsWindowTreeNode& aParent, const MWsWindowTreeNode& aChild) = 0;
+	/**
+	 Callback to notify that a window group chain has been broken. 
+	 Special case: Deleting a window group that is part of a chain will break all chaining 
+	 after the deleted window group and a notification for each node being dequed will be sent.
+	 @param aWindowGroupNode The window group chain is broken directly after this window group. */
+	virtual void WindowGroupChainBrokenAfter(const MWsWindowTreeNode& aWindowGroupNode) = 0;
+	/**
+	 Callback to notify that all nodes below aWindowTreeNode should be drawn faded,
+	 unless they have the ENonFading flag set. 
+	 This API is primarily used in conjunction with application frameworks that uses 
+	 absolute fading rather than counting fade.
+	 @param aWindowTreeNode Typically a root window, for which all children should have their
+	 					fade state set to aFaded.
+	 @param aFaded The new fade state to apply. ETrue means faded, EFalse not faded. */
+	virtual void FadeAllChildren(const MWsWindowTreeNode& aWindowTreeNode, TBool aFaded) = 0;
+	};
+
+/** 
+An interface optionally provided by render stages, to observe which node in 
+the window tree structure that is being rendered.
+
+Text cursors and sprites (floating or non) are annotated by the same APIs.
+
+@publishedPartner
+@prototype
+*/
+class MWsDrawAnnotationObserver : public MWsObjectProvider
+	{
+public:	
+	DECLARE_WS_TYPE_ID(KMWsDrawAnnotationObserver)
+	virtual void WindowRedrawStart(const MWsWindowTreeNode& aWindowTreeNode, const TRegion& aRegion) = 0;
+	virtual void WindowRedrawEnd(const MWsWindowTreeNode& aWindowTreeNode) = 0;
+	virtual void WindowAnimRedrawStart(const MWsWindowTreeNode& aWindowTreeNode, const TRegion& aRegion) = 0;
+	virtual void WindowAnimRedrawEnd(const MWsWindowTreeNode& aWindowTreeNode) = 0;
+	virtual void SpriteRedrawStart(const MWsWindowTreeNode& aWindowTreeNode, const TRegion& aRegion) = 0;
+	virtual void SpriteRedrawEnd(const MWsWindowTreeNode& aWindowTreeNode) = 0;
+	virtual void SpriteFlash(const MWsWindowTreeNode& aWindowTreeNode, TBool aFlashOn) = 0;
+	virtual void SegmentRedrawStart(const TRegion& aRegion) = 0;
+	virtual void SegmentRedrawEnd() = 0;
+	};
+
+/** 
+Implemented by a WSERV screen to respond to window visibility change notifications sent
+by a render stage implementing MWsWindowVisibilityNotifier.
+
+Immediately after WSERV sucessfully obtains a pointer to MWsWindowVisibilityNotifier, 
+WSERV will call MWsWindowVisibilityNotifier::RegisterWindowVisibilityObserver()
+to provide a means for the render stage to notify WSERV, when window visibility changes.
+
+@see MWsWindowVisibilityNotifier
+
+@publishedPartner
+@prototype
+*/
+class MWsWindowVisibilityObserver
+	{
+public:
+	/** 
+	Called by the render stage to indicate a window's visible region has changed.
+	After this method has been called, it does not need to be called again until
+	after WSERV calls SendVisibilityChanges.
+	@see MWsWindowVisibilityNotifier::SendVisibilityChanges
+	*/
+	virtual void VisibilityChanged() = 0;
+
+	/**
+	Called by the render stage to update a window's visible region.
+	@param aWindow The window whose visible region has changed.
+	@param aVisibleRegion Region of the window not obscured by a fully opaque window. Part of this region could potentially still
+	be obscured by opaque parts of translucent windows on top of aWindow.
+	*/
+	virtual void SetWindowVisibility(const MWsWindow& aWindow, const TRegion& aVisibleRegion) = 0;
+	};
+
+/** 
+This interface may be implemented by a render stage wishing to take over responsibility
+from WSERV, for updating a window's visible region.
+For example, if a render stage introduces non-WSERV visuals which overlap WSERV windows, WSERV may
+need to receive updated window visibility information.
+
+Immediately after sucessfully obtaining this interface, WSERV will call RegisterWindowVisibilityObserver
+to provide a means for the render stage to notify WSERV when window visibility changes.
+
+@see MWsWindowVisibilityObserver
+
+@publishedPartner
+@prototype
+*/
+class MWsWindowVisibilityNotifier : public MWsObjectProvider
+	{
+public:	
+	DECLARE_WS_TYPE_ID(KMWsWindowVisibilityNotifier)
+
+	/** 
+	Register to be notified when window visibility changes.
+	@param aWindowVisibilityObserver Observer to be notified.
+	*/
+	virtual void RegisterWindowVisibilityObserver(MWsWindowVisibilityObserver* aWindowVisibilityObserver) = 0;
+
+	/** 
+	Register to be notified when visibility of a specific window changes.
+	After registering a window, the render stage must immediately provide the
+	current visible region by calling VisibilityChanged() and later, in response
+	to SendVisibilityChanges, call SetWindowVisibility.
+	RegisterWindow and UnregisterWindow are symmetrical operations. For each
+	call to RegisterWindow, there will follow exactly one call to UnregisterWindow.
+	@param aWindow Window for which WSERV needs accurate visibility information.
+	@see MWsWindowVisibilityObserver
+	*/
+	virtual void RegisterWindow(const MWsWindow& aWindow) = 0;
+
+	/** 
+	Stops visibility notifications being sent for the specified window.
+	RegisterWindow and UnregisterWindow are symmetrical operations. For each
+	call to RegisterWindow, there will follow exactly one call to UnregisterWindow.
+	@param aWindow Window for which visibility notifications are no longer required.
+	*/
+	virtual void UnregisterWindow(const MWsWindow& aWindow) = 0;
+
+	/** 
+	Asks the render stage to call SetWindowVisibility for each window whose
+	visible region has changed.
+	All visible region changes must be sent before this method returns.
+	@see MWsWindowVisibilityObserver
+	*/
+	virtual void SendVisibilityChanges() = 0;
+	};
+
+/** This is an extension of the MWsScreen interface for handling the
+animation aspects of the redraw sequence.
+
+@publishedPartner
+@prototype
+*/
+class MWsScreenRedraw: public MWsObjectProvider
+	{
+public:
+	DECLARE_WS_TYPE_ID(KWsScreenRedraw)
+	/**Sets the screen redraw observer. 
+	@param aObserver
+	*/
+	virtual void SetObserver(MWsScreenRedrawObserver* aObserver) = 0;
+	/** Checks if there is a redraw in progress or scheduled to take place.
+	@return Returns ETrue if there is an update pending.
+	*/	
+	virtual TBool IsUpdatePending() = 0;
+	/** Gets the current time according to the animation scheduler
+	@return The current time as a TTime reference.
+	*/
+	virtual const TTime& Now() const = 0;
+	/** Schedule a render of the screen without requesting any area of it
+	to be redrawn.  Effectively, request a rerun of the render stages.
+	@param aFromNow The time from now, in microseconds, to perform the render.
+	*/
+	virtual void ScheduleRender(const TTimeIntervalMicroSeconds& aFromNow) = 0;
+	/** Gets the the animation region for this screen redraw.
+	@return the Region being redrawn during the animation
+	*/
+	virtual const TRegion * AnimationRegion() const = 0;
+	/** Updates the screen device to reflect any animation changes
+	*/
+	virtual void UpdateDevice() = 0;
+	};
+	
+/** This is part of the MWsScreenRedraw interface
+
+@publishedPartner
+@prototype
+*/
+class MWsScreenRedrawObserver: public MWsObjectProvider
+	{
+public:
+	DECLARE_WS_TYPE_ID(KWsScreenRedrawObserver)
+	/** Callback function that gets called after the completion of every redraw sequence.
+	@see MWsScreenRedraw::SetObserver
+	@publishedPartner
+	@prototype
+	*/
+	virtual void ScreenUpdated(TInt aScreenNumber) = 0;
+	};
+
+/** This is part of the MGraphicDrawerInterface
+
+@publishedPartner
+@prototype
+*/
+class MWsMemoryRelease : public MWsObjectProvider
+	{
+public:
+	DECLARE_WS_TYPE_ID(KMWsMemoryRelease)
+	enum TMemoryReleaseLevel
+		{
+		ELow,
+		EMedium,
+		EHigh
+		};
+	/** This function is called on registered memory release objects whenever there
+	is insufficient memory available to honour an Alloc or ReAlloc in the window server
+	process.  It may be called up to three times, once for each level defined in TLevel.
+	The meaning of each level is open to interpretation by individual implementations.
+	@see MGraphicDrawerEnvironment::RegisterMemoryRelease
+	@param aLevel 
+	@return ETrue to indicate that memory was freed, EFalse otherwise.
+	@publishedPartner
+	@prototype
+	*/
+	virtual TBool ReleaseMemory(TMemoryReleaseLevel aLevel) = 0;
+	};
+
+#if !defined(SYMBIAN_GRAPHICS_GCE)
+/** This is an extension of the MWsGc.  This interface is not used in
+non-NGA configurations.  It has been removed from NGA configurations.
+
+@see MWsGc
+@publishedPartner
+@prototype
+*/
+class MWsGcClipRect : public MWsObjectProvider
+	{
+public:
+	DECLARE_WS_TYPE_ID(KMWsGcClipRect)
+	/** Sets a master clipping rectangle on the GC.  This will combine with any clipping rectangles
+	specified by the client.
+	@param aRect
+	*/
+	virtual void SetClipRect(TRect aRect) = 0;
+	/** Resets the master clipping rectangle specified in SetMasterClipRect
+	*/
+	virtual void ResetClipRect() = 0;
+	/** Returns the combined clipping rectangle.
+	@param aRect this is set to the clipping rectangle
+	@param aSet this is true if there is a clipping rectangle in effect
+	*/
+	virtual void GetClipRect(TRect & aRect, TBool & aSet) = 0;
+	};
+#endif
+
+/** DebugBarDrawer interface
+     
+@publishedPartner
+@prototype
+*/
+class MWsDebugBar : public MWsObjectProvider
+	{
+public:
+	DECLARE_WS_TYPE_ID(KMWsDebugBar)
+	
+public:
+	/**
+	 * Prints a debug information bar overlaid at the top the screen.
+	 * 
+	 * @param aDebugText An array of text lines.
+	 */
+	virtual void DrawDebugBar(const TArray<TPtrC>& aDebugText)=0;
+	};
+
+/** This is an extension of MWsGc and provides plugin fading capabilities for wserv.
+    Default implementation of the plugin uses bitgdi fade. 
+    
+@see MWsGc
+@publishedPartner
+@prototype
+*/
+class MWsFader : public MWsObjectProvider
+	{
+public:
+	DECLARE_WS_TYPE_ID(KMWsFader)
+	
+public:
+	/** Sets any parameters for the fade.
+	@param aData Descriptor containing the fade parameters
+	*/
+	virtual void SetFadingParameters(const TDesC8& aData)=0;
+#if !defined(SYMBIAN_GRAPHICS_GCE)
+	/** Perform a fade of the specified region
+	@param aBitGc CFbsBitGc to perform the fading with.
+	@param aRegion TRegion containing the region that the fading is to be performed on.
+	*/
+	virtual void FadeArea(CFbsBitGc* aBitGc,const TRegion * aRegion)=0;
+#else
+	/** Perform a fade of the specified region
+	@param aRegion TRegion containing the region that the fading is to be performed on.
+	*/
+	virtual void FadeArea(const TRegion& aRegion)=0;
+#endif
+	};
+
+/** Plugin Manager Interface
+@publishedPartner
+@prototype
+*/	
+class MWsPluginManager : public MWsObjectProvider
+	{
+public:
+	DECLARE_WS_TYPE_ID(KMWsPluginManager)
+	
+	/** Resolve an instance of an interface
+	@param aTypeId
+	*/
+	virtual TAny* ResolvePluginInterface(TUint aTypeId) = 0;
+	};
+	
+/** An Interface to allow CRP's and CWsPlugins to access the wserv ini file
+@publishedPartner
+@prototype
+*/
+class MWsIniFile : public MWsObjectProvider
+	{
+public:
+	DECLARE_WS_TYPE_ID(KMWsIniFile)
+	
+	/** Find the value of the specified variable if present in the window server ini file.
+	@param aVarName TDesC containing the name of the variable to find.
+	@param aResult TPtrC that gets set to the value of the ini variable.
+	@return ETrue if ini file variable found
+	*/
+	virtual TBool FindVar(const TDesC &aVarName, TPtrC &aResult) = 0;
+
+	/** Find the value of the specified variable if present in the window server ini file.
+	@param aVarName TDesC containing the name of the variable to find
+	@param aResult TInt that gets set to the value of the ini variable
+	@return ETrue if ini file variable found
+	*/
+	virtual TBool FindVar(const TDesC &aVarName, TInt &aResult) = 0;
+
+	/** Find if the variable is present in the ini file
+	@param aVarName TDesC containing the name of the variable to find
+	@return ETrue if ini file variable found
+	*/
+	virtual TBool FindVar(const TDesC &aVarName) = 0;
+
+	/** Find if the variable is present in the [SCREENx] section
+	@param aScreen TInt containing the screen number
+	@param aVarName TDesC containing the name of the variable to find
+	@return ETrue if ini file variable found
+	*/
+	virtual TBool FindVar( TInt aScreen, const TDesC &aVarName) = 0;
+
+	/** Find the value of the specified variable if present in the [SCREENx] section of the ini file
+	@param aScreen TInt containing the screen number
+	@param aVarName TDesC containing the name of the variable to find
+	@param aResult TInt that gets set to the value of the ini variable
+	@return ETrue if ini file variable found
+	*/
+	virtual TBool FindVar( TInt aScreen, const TDesC &aVarName, TInt &aResult) = 0;
+
+	/** Find the value of the specified variable if present in the [SCREENx] section of the ini file
+	@param aScreen TInt containing the screen number
+	@param aVarName TDesC containing the name of the variable to find
+	@param aResult TPtrC that gets set to the value of the ini variable.
+	@return ETrue if ini file variable found
+	*/
+	virtual TBool FindVar( TInt aScreen, const TDesC& aVarName, TPtrC &aResult) = 0;
+
+	/** Find if the specified variable is present in the named section of the ini file
+	@param aSection TDesC containing the name of the section 
+	@param aVarName TDesC containing the name of the variable to find
+	@return ETrue if ini file variable found
+	*/
+	virtual TBool FindVar(const TDesC& aSection, const TDesC &aVarName) = 0;
+	
+	/** Find the value of the specified variable in the named section of the ini file.
+	@param aSection TDesC containing the name of the section 
+	@param aVarName TDesC containing the name of the variable to find
+	@param aResult TInt that gets set to the value of the ini variable
+	@return ETrue if ini file variable found
+	*/
+	virtual TBool FindVar(const TDesC& aSection, const TDesC &aVarName, TInt &aResult) = 0;
+
+	/** Find the value of the specified variable in the named section of the ini file.
+	@param aSection TDesC containing the name of the section 
+	@param aVarName TDesC containing the name of the variable to find
+	@param aResult TPtrC that gets set to the value of the ini variable.
+	@return ETrue if ini file variable found
+	*/
+	virtual TBool FindVar(const TDesC& aSection, const TDesC& aVarName, TPtrC &aResult) = 0;
+	};
+
+/** An interface that allows CRP's and CWsPlugin derived objects to handle events like anim dll's
+@publishedPartner
+@prototype
+*/
+class MWsRawEventServer : public MWsObjectProvider
+	{
+public:
+	DECLARE_WS_TYPE_ID(KMWsRawEventServer)
+
+	/** Register to be notified when some kernel events occur.
+	@return KErrNone if successful
+	@prototype */
+	virtual TInt RegisterRawEventHandler(MEventHandler* aHandler) = 0;
+	/** Unregister from events notification
+	@prototype */
+	virtual void UnregisterRawEventHandler(MEventHandler* aHandler) = 0;
+	/** Creates a new raw event
+	@prototype */
+	virtual void PostRawEvent(const TRawEvent & aEvent) = 0;
+	/** Creates a new key event
+	@prototype */
+	virtual void PostKeyEvent(const TKeyEvent & aEvent) = 0;
+	};
+
+#endif //#ifndef __WSGRAPHICDRAWERINTEFACE_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/openwfc/surfaceconfiguration.inl	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,432 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Sets all members to default values. Initializes the size field to match the object size.
+// 
+//
+/**
+@file
+@publishedpartner 
+@released
+*/
+
+inline TSurfaceConfiguration::TSurfaceConfiguration()
+	{}
+
+/**
+Copy constructor. This constructor will read the size field of the source and target 
+objects and only copy the minimum set of fields indicated. Any remaining fields in the target 
+object will be set to default values. 
+
+@param aSurfaceConfiguration Config to copy
+*/
+inline TSurfaceConfiguration::TSurfaceConfiguration(const TSurfaceConfiguration& aSurfaceConfiguration):
+	TSurfaceConfiguration2(0)
+	{
+	TInt tempSize = aSurfaceConfiguration.Size();
+	if (tempSize > sizeof(*this))
+		{
+		tempSize = sizeof(*this);
+		}
+	Mem::Copy(this, &aSurfaceConfiguration, tempSize);
+	iSize = tempSize;
+	}
+
+/**
+This constructor will take any value, but it is designed to be used with
+a value returned by RWsSession::PreferredSurfaceConfigurationSize, 
+and initializes the members to represent an object compatible with that.
+
+If the aPreferredMaxSize is larger than the actual size of TSurfaceConfiguration, indicating 
+that the server supports a newer version of the interface than the caller is aware of, then 
+the actual size is used.
+
+If the aPreferredMaxSize is smaller than the actual size of TSurfaceConfiguration, indicating 
+that the server supports an earlier version of the interface, then this value is used. It must 
+match the Size() member of one of the defined hierarchy of TSurfaceConfiguration classes.
+
+@param aPreferredMaxSize User defined max size
+@see RWsSession::PreferredSurfaceConfigurationSize
+*/
+inline TSurfaceConfiguration::TSurfaceConfiguration(TInt aPreferredMaxSize):
+	TSurfaceConfiguration2(sizeof(*this))
+	{
+	if (sizeof(*this) > aPreferredMaxSize)
+		{
+		iSize = aPreferredMaxSize;
+		}
+	}
+
+/** Default constructor for configuration 1
+*/
+inline TSurfaceConfiguration1::TSurfaceConfiguration1():TSurfaceConfigurationSize(sizeof(*this))
+		,iExtent(TRect::EUninitialized), iViewport(TRect::EUninitialized)
+	{}
+
+/**
+Constructor for configuration 1 passing through a size already calculated
+
+@param aSize Size of the class already calculated and being passed up through the classes
+*/
+inline TSurfaceConfiguration1::TSurfaceConfiguration1(TInt aSize):TSurfaceConfigurationSize(aSize)
+		,iExtent(TRect::EUninitialized), iViewport(TRect::EUninitialized)
+	{}
+
+/**
+The method sets the surface ID to be set as the background surface. 
+
+The default initial value held in this class for surface ID is the null surface ID.
+
+Note that SetBackgroundSurface() will not accept a null surface ID, so this parameter must always be set.
+
+@param aSurfaceId Surface ID to set
+@return KErrNone on success or a system-wide error code
+	- KErrNotSupported if not supported.
+@post The Surface Id values are updated in the object of this class if supported. The 
+SetBackgroundSurface API must be called passing object of this class as parameter to 
+get the desired effect.
+*/
+inline TInt TSurfaceConfiguration1::SetSurfaceId (const TSurfaceId& aSurfaceId)
+	{
+	if (MemberAccessible(iSurfaceId))
+		{
+		iSurfaceId = aSurfaceId;
+		return KErrNone;
+		}	
+	return KErrNotSupported;
+	}
+
+/**
+The method gets the surface ID stored in the object of this class.
+
+@param aSurfaceId User surface id to be set
+@post The aSurface parameter is filled in.
+@post If the instance of TSurfaceConfiguration is too small, the null surface ID will be set.
+*/
+inline void TSurfaceConfiguration1::GetSurfaceId (TSurfaceId& aSurfaceId) const
+	{
+	if (MemberAccessible(iSurfaceId))
+		{
+		aSurfaceId = iSurfaceId;
+		}
+	else
+		{
+		aSurfaceId.CreateNullId();
+		}
+	}
+
+/**
+The method sets the area of the surface that should be mapped to the specified window area. 
+The viewport is in surface coordinates.
+
+In SetBackgroundSurface(), if not set or if the set viewport is empty, the size of the whole surface 
+is used as the viewport. If the surface is changed then the viewport will track the size of 
+the surface. 
+
+Setting any ordinate of the viewport outside the surface size is not required specified behavior for 
+this interface. The call will not fail if any ordinates are out of range, and the internal NGA Composition 
+handling of this case will produce a representative image. This current behavior is that the NGA Composition 
+will clamp any out-of-range ordinate to the size of the surface.
+
+@param aViewport A rectangle of the area, in relative coordinates to the surface
+@return KErrNone on success or a system-wide error code
+	- KErrNotSupported if not supported.
+@post The viewport values are updated in the object of this class. This does not imply that the 
+viewport is set for the surface. The SetBackgroundSurface API must be called passing an object of 
+this class as parameter to get the desired effect.
+*/
+inline TInt TSurfaceConfiguration1::SetViewport (const TRect& aViewport)
+	{
+	if (MemberAccessible(iViewport))
+		{
+		iViewport = aViewport;
+		return KErrNone;
+		}
+	return KErrNotSupported;
+	}
+
+/**
+This method gets the viewport stored in the object of this class. The viewport is in surface 
+coordinates.
+
+If viewport was not set or an empty viewport was set, the value returned is an empty viewport. This 
+is an indication that the viewport used by the server is equal to the size of the surface. The 
+actual size of the surface is not returned.
+
+@param aViewport User viewport to be set.
+@post The aViewport rectangle is filled in.
+@post If the instance of TSurfaceConfiguration is too small, the empty viewport rectangle will be returned.
+*/
+inline void TSurfaceConfiguration1::GetViewport (TRect& aViewport) const
+	{
+	if (MemberAccessible(iViewport))
+		{
+		aViewport = iViewport;
+		}
+	else
+		{
+		aViewport = TRect();
+		}
+	}
+
+/**
+This method sets the relative orientation of viewport to window extent. The default value is 
+EGraphicsOrientationNormal.
+
+The rotation effect is applied to the input viewport area, around the centre-point of the viewport.
+
+@param aOrientation User orientation to be set
+@return KErrNone on success or a system-wide error code
+	- KErrNotSupported if not supported.
+	- KErrArgument if aOrientation is out of range
+@post The orientation is updated in the object of this class. This does not imply that the orientation 
+is set for the surface content. The SetBackgroundSurface API must be called passing an object of 
+this class as parameter to get the desired effect.
+*/
+inline TInt TSurfaceConfiguration1::SetOrientation (CFbsBitGc::TGraphicsOrientation aOrientation)
+	{
+	if (MemberAccessible(iOrientation))
+		{
+		__ASSERT_COMPILE(CFbsBitGc::EGraphicsOrientationNormal==0 && 
+						CFbsBitGc::EGraphicsOrientationRotated270 == 3);
+		if(aOrientation < CFbsBitGc::EGraphicsOrientationNormal || 
+				aOrientation > CFbsBitGc::EGraphicsOrientationRotated270)
+			{
+			return KErrArgument;
+			}
+		iOrientation = aOrientation;
+		return KErrNone;
+		}
+	return KErrNotSupported;
+	}
+
+/**
+The method gets the surface orientation angle stored in the object of this class. It is the 
+relative orientation of viewport to window extent. If orientation was not set, the value returned 
+will be EGraphicsOrientationNormal.
+
+@return orientation in this object
+@post If the instance of TSurfaceConfiguration is too small, the default EGraphicsOrientationNormal 
+setting will be returned.
+*/
+inline CFbsBitGc::TGraphicsOrientation TSurfaceConfiguration1::Orientation() const
+	{
+	if (MemberAccessible(iOrientation))
+		{
+		return iOrientation;
+		}
+	else
+		{
+		return CFbsBitGc::EGraphicsOrientationNormal;
+		}
+	}
+
+/**
+This method sets the area of the window where the surface content is to be placed. The extent is 
+in window coordinates.
+
+If not set or if the set extent is empty, the size of the entire window is used as the default extent. 
+The default extent changes according to the change in the window size. The empty extent is an indication 
+to the server that the extent should fill the entire window without the client tracking the change in 
+the window size.
+
+In SetBackgroundSurface() it is legal to set the extent larger than the window, or the window may 
+become smaller than the extent. In these cases the output will be transformed on the basis of this 
+larger extent, but then clipped to the window outline.
+
+@param aExtent Area on the window where the surface contents specified by viewport
+should be mapped
+@return KErrNone on success or a system-wide error code
+	- KErrNotSupported if not supported.
+@post The extent values are updated in the object of this class. This does not imply that the 
+extent is set for the surface. The SetBackgroundSurface API must be called passing an object of 
+this class as parameter to get the desired effect.
+*/
+inline TInt TSurfaceConfiguration1::SetExtent(const TRect& aExtent)
+	{
+	if (MemberAccessible(iExtent))
+		{
+		iExtent = aExtent;
+		return KErrNone;
+		}
+	return KErrNotSupported;
+	}
+
+/**
+The method gets the extent stored in the object of this class. The extent is in window coordinates.
+
+If extent was not set or an empty extent was set, the value returned will be an empty extent. This 
+is an indication that the extent used by the server is equal to the size of the window. The actual 
+size of the window is not returned.
+
+@param aExtent User extent to be set
+@post The aExtent parameter is filled in
+@post If the instance of TSurfaceConfiguration is too small, the empty extent rectangle will be returned.
+*/
+inline void TSurfaceConfiguration1::GetExtent(TRect& aExtent) const
+	{
+	if (MemberAccessible(iExtent))
+		{
+		aExtent = iExtent;
+		}
+	else
+		{
+		aExtent = TRect();
+		}
+	}
+
+/**
+This method identifies which attributes are available to use.
+
+Generally, any version of the server will accept any version of TSurfaceConfiguration, ignoring 
+newer version attributes it does not recognize and substituting defaults for attributes not present 
+in older version.
+
+However, by using this method in conjunction with GetBackgroundSurface() the intelligent client can 
+identify which blocks of attributes are actually present and supported after a call to 
+GetBackgroundSurface, avoiding preparing complex attributes, or reducing user-interface control 
+gadgets.
+
+@return ETrue if all these attributes are available to use; otherwise EFalse
+*/
+inline TBool TSurfaceConfiguration1::SupportsAllMembers()
+	{
+	if (Size() >= sizeof(*this))
+		{
+		return ETrue;
+		}
+	else
+		{
+		return EFalse;
+		}
+	}
+
+/**
+Constructs the TSurfaceConfigurationSize class, enters the size field and blanks everything else
+
+@param aSize The size to set for the configuration
+@return ETrue If all these attributes are available to use; otherwise EFalse
+*/
+inline TSurfaceConfigurationSize::TSurfaceConfigurationSize(TInt aSize)
+	{
+	Mem::FillZ(this,aSize);
+	iSize = aSize;
+	}
+
+/**
+Reads the size field. The size is set automatically in the constructor, or by the 
+GetBackgroundSurface method to indicate the sender’s supported structure size, and imply a 
+compatible version identifier. The size reported after GetBackgroundSurface will match 
+the expected size of one of the hierarchy of TSurfaceConfiguration classes documented in the 
+header, and will never exceed the constructed size.
+
+@return ETrue if all these attributes are available to use; otherwise EFalse
+*/
+inline TInt TSurfaceConfigurationSize::Size() const
+	{
+	return iSize;
+	}
+
+inline TBool TSurfaceConfigurationSize::operator == (const TSurfaceConfigurationSize& aRhs)const
+	{
+	return aRhs.Size()==Size();	//If the two objects are not the same version then we can't compare them!
+	}
+inline TBool TSurfaceConfiguration1::operator == (const TSurfaceConfiguration1& aRhs)const
+	{
+	if (!TSurfaceConfigurationSize::operator ==(aRhs))
+		return EFalse;	//Check for earlier version compatability
+	if (Size()<sizeof(*this))
+		return ETrue;	//If the objects are smaller than this then the check is complete
+	return 	(iSurfaceId==aRhs.iSurfaceId)
+		&&	(iOrientation==aRhs.iOrientation)
+		&&	(iExtent==aRhs.iExtent)
+		&&	(iViewport==aRhs.iViewport)
+		;
+	}
+
+/** Default constructor for configuration 2
+*/
+inline TSurfaceConfiguration2::TSurfaceConfiguration2():TSurfaceConfiguration1(sizeof(*this))
+        ,iFlip(EFalse)
+    {}
+
+/**
+Constructor for configuration 2 passing through a size already calculated
+
+@param aSize Size of the class already calculated and being passed up through the classes
+*/
+inline TSurfaceConfiguration2::TSurfaceConfiguration2(TInt aSize):TSurfaceConfiguration1(aSize)
+        ,iFlip(EFalse)
+    {}
+
+/**
+This method sets the flip attribute to the surface. The default value is 
+EFalse.
+
+@param aFlip When ETrue enalbes flip in the x-axis
+@post The flip attribute is updated in the object of this class. This does not imply that the flip 
+is set for the surface content. The SetBackgroundSurface API must be called passing an object of 
+this class as parameter to get the desired effect.
+@return KErrNone on success 
+    - KErrNotSupported if flip is not supported. 
+*/
+inline TInt TSurfaceConfiguration2::SetFlip(TBool aFlip)
+    {
+    if (MemberAccessible(iFlip))
+        {
+        iFlip = aFlip;
+        return KErrNone;
+        }
+     return KErrNotSupported;
+    }
+
+/**
+The method gets the flip attribute of the surface stored in the object of this class. If the flip was not set, the value returned 
+will be EFalse.
+
+@return ETrue if flip is enabled
+@post If the instance of TSurfaceConfiguration is too small, the default EFalse 
+setting will be returned.
+*/
+inline TBool TSurfaceConfiguration2::Flip() const
+    {
+    if (MemberAccessible(iFlip))
+        {
+        return iFlip;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+inline TBool TSurfaceConfiguration2::SupportsAllMembers()
+    {
+    if (Size() >= sizeof(*this))
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+inline TBool TSurfaceConfiguration2::operator == (const TSurfaceConfiguration2& aRhs)const
+    {
+    if (!TSurfaceConfiguration1::operator ==(aRhs))
+        return EFalse;  //Check for earlier version compatability
+    if (Size()<sizeof(*this))
+        return ETrue;   //If the objects are smaller than this then the check is complete
+    return  iFlip==aRhs.iFlip;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/openwfc/wsdisplaymapping.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,48 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Interface for Render Stage Display Mapping
+// 
+//
+/**
+@file
+@publishedpartner 
+@released
+*/
+
+#ifndef WSDISPLAYMAPPING_H_
+#define WSDISPLAYMAPPING_H_
+
+#include <graphics/displaymapping.h>
+
+class MWsDisplayMapping: public MWsObjectProvider,public MDisplayMappingBase
+	{
+public:
+	enum	
+		{
+		KUidWsDisplayMapping =  0x1028656C, 	 
+		ETypeId=				KUidWsDisplayMapping,
+		EWsObjectInterfaceId=	KUidWsDisplayMapping
+		};
+	enum	TOffsetFlags
+		{
+		KOffsetAll=	0xffffffff,
+		KOffGc=		0x00000001,
+		KOffMap=	0x00000002,
+		KOffElement=0x00000004,
+		};
+public:
+	virtual void SetSizeModeExtent(TRect& aExtent, TBitFlags32 aContext)=0;
+	};
+
+#endif /*WSDISPLAYMAPPING_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/openwfc/wselement.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,498 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Interface for Scene Elements
+// 
+//
+
+/**
+ @publishedPartner
+ @prototype
+*/
+
+#ifndef WSELEMENT_H
+#define WSELEMENT_H
+
+#include <w32std.h>
+#include <graphics/wsgraphicdrawerinterface.h>
+#include <graphics/surface.h>
+
+/**
+ * @brief Window Server Scene Element Interface Definition
+ *
+ * This interface allows Image Sources to be associated with meta-data
+ * to define how the Image Source must be presented within a Scene.
+ *
+ * For a conceptual overview of Scenes, refer to the @c MWsScene Interface.
+ *
+ * The following aspects of Image Source presentation may be controlled:
+ * @li Source rectangular region
+ * @li Destination rectangular region
+ * @li Rotation and flipping
+ * @li Opacity
+ * @li Relative z-order (ordinal position)
+ * @li Tags to descriminate the UI from other Elements
+ *
+ * All co-ordinates are pixels offsets from (0,0) representing the
+ * top level of the Image Source or Destination Target (the screen
+ * or an off-screen buffer representing the screen), moving rightwards
+ * and downwards in x and y co-ordinates respectively.
+ *
+ * Elements can be marked with flags.  There are two different consumers
+ * of flags: Target Renderers and Render Stage Plug-ins.
+ * 
+ * Target Renderers are sub-systems which actually do composition and
+ * rendering on a particular display device or off-screen buffer.
+ * The EElementTransparencySource flag tells the Target Renderer that 
+ * alpha blending must use the alpha channel in the Surface connected to
+ * the Element.
+ * 
+ * On the other hand, Render Stage Plug-ins need flags to implement
+ * specific policies such as "UI always on top".  To facilitate this,
+ * Elements have a EElementIsIndirectlyRenderedUserInterface or a
+ * EElementIsDirectlyRenderedUserInterface optionally set.  This
+ * flag allows Render Stage Plug-ins to keep the relative z-order
+ * of Elements aligned to this policy.
+ * 
+ * To allow compatible updates to be made to flags, all Render Stage
+ * Plug-ins must preserve the flags in Elements which they do not operate
+ * upon.  Target Renderers may ignore the flags in Elements which they
+ * do not operate on.
+ *
+ * <h2>Intial State</h2>
+ * 
+ * The initial state for an Element is:
+ * @li Fully opaque
+ * @li No rotation, nor flipped
+ * @li Not part of the Committed Scene
+ * @li No connected Surface
+ * @li All flags reset
+ * @li Local error value set as KErrNone
+ * @li Source Rectangle and Destination Rectangle is (0,0,0,0)
+ * @il Destination Clipping Rectangle is (0,0,0,0)
+ * 
+ * When an Image Source is connected, the initial state becomes:
+ * @li Source Rectangle is the extent of the Image Source
+ * @li Destination Rectangle is set at origin (0,0), whose sized equals the
+ *     Image Source size truncated the the target screen size.
+ * @li Destination Clipping Rectangle is (0,0,0,0) to represent the entire
+ *     area of the target screen.
+ * 
+ * <h2>Special Rectangle Values</h2>
+ * 
+ * Sometimes it is desirable to reset a Source, Destination, or Clipping
+ * Rectangle so that the actual value used matches the corresponding Source
+ * Image or Target Screen size.  In such cases rectangle (0,0,0,0) is used to
+ * represent this.
+ * 
+ * <h2>Extending this interface</h2>
+ * 
+ * This interface can be extended in two different ways
+ * @li Creating optional extension interfaces with 
+ *       MWsElement::MWsObjectProvider::ResolveObjectInterface()
+ * @li Defining new TElementFlags flag settings; Render Stage Plug-ins
+ *       preserve the value of these across the Render Stage Pipeline.
+ *
+ * <h2>Committed Elements versus Pending Elements</h2>
+ * 
+ * This interface allows Elements to be modified in terms of their
+ * own flag settings, and rotation, as well as their relative position
+ * with other Elements.  Queries return the pending values for such
+ * Elements.  Any modifications are marked Pending, and affect the Scene
+ * according to the rules described by "Rendering" in @c MWsScene.
+ * 
+ * <h2>Order in which transformations are applied</h2>
+ * 
+ * A number of different transformations may be specified for an Element.
+ * The order in which these are applied to arrive at the view seen in
+ * the target is:
+ * -# SetSourceRectangle              (Cropping)
+ * -# SetSourceFlipping               (Flipping)
+ * -# SetSourceRotation               (Rotation)
+ * -# SetDestinationRectangle         (Scaling and Positioning)
+ * -# SetDestinationClippingRectangle (Scaling and Positioning)
+ * -# SetGlobalAlpha                  (Blending)
+ */
+class MWsElement : public MWsObjectProvider
+    {
+public:
+    
+    /**
+     * @brief Flags used by Target Renderers.
+     */
+    enum TElementTargetRendererFlags
+        {
+        /**
+         * Target renderer must treat the Element as Opaque.
+         */
+        EElementTransparencyNone                 = 0,
+        /**
+         * Target renderer must use the Global Alpha Transparency value
+         * from the Element
+         */
+        EElementTransparencyGlobalAlpha          = (1 << 0),
+        /**
+         * Target renderer must use the Alpha Transparency Channel from
+         * the Element
+         */
+        EElementTransparencySource               = (1 << 1),
+        /**
+         * Reserved flag value; this must not be set.
+         */
+        EElementTargetRendererReserved           = (1 << 2)
+        };
+    
+    /**
+     * @brief Flags used by Render Stages.
+     */
+    enum TElementRenderStageFlags
+        {
+        /**
+         * No flag value set for Render Stage Plug-in
+         */
+        EElementRenderStageNone                   = 0,
+        /**
+         * Indirectly Rendered User Interface, i.e. rendering via 
+         * MWsGraphicsContext calls originating from client CWindowGc
+         * commands
+         */
+        EElementIsIndirectlyRenderedUserInterface = (1 << 0),
+        /**
+         * Directly Render User Interface, i.e. rendering where Window
+         * Server does not see the graphics commands, as is the case for
+         * Direct Screen Access clients.
+         */
+        EElementIsDirectlyRenderedUserInterface   = (1 << 1),
+        /**
+         * Reserved values for future Render Stage Plug-in usage
+         */
+        EElementRenderStageReserved               = (1 << 2)
+        };
+    
+    /**
+     * Amount of rotation of pixel data to apply to the Image Source
+     * to obtain the Target Image
+     */
+    enum TElementRotation
+        {
+        EElementAntiClockwise0   = 0, /** No rotation */
+        EElementAntiClockwise90  = 1, /** 90 Degrees Anti-clockwise in target */
+        EElementAntiClockwise180 = 2, /** 180 Degrees Anti-clockwise in target */
+        EElementAntiClockwise270 = 3  /** 270 Degrees Anti-clockwise in target */
+        };
+    
+public:
+    /**
+     * @brief Set which portion of the image source is used.
+     *
+     * Set which rectangular portion of the connected image source
+     * will be used when displaying this Element.
+     *
+     * @param aSrc  The source rectangle of pixels from the connected Image Source.
+     *              This rectangle must not include any pixels outside the Image
+     *              Source.  (0,0,0,0) means the entire size of the Image Source.
+     * @pre     An Image Source must have been connected; @see ConnectSurface()
+     * @return  One of the system-wide error codes.  
+     *          KErrGeneral, if there is no image source connected.
+     *          KErrArgument, if the source rectangle includes pixels not in the 
+     *          connected image source, or has negative width or height.  
+     *          KErrNone, if successful.
+     */
+    virtual TInt SetSourceRectangle(const TRect& aSrc) = 0;
+    
+    /**
+     * @brief Get the portion of the Image Source being used.
+     *
+     * Get the portion of the connected Image Source being used.  The default
+     * value is the entire extent of the connected Image Source.
+     *
+     * @param aSrc  The source rectangle is updated with the current rectangular
+     *              region being used within the Image Source.
+     * @pre     An Image Source must have been connected; @see ConnectSurface()
+     * @return  One of the system-wide error codes.  
+     *          KErrGeneral, if no Image Source has been connected.  
+     *          KErrNone, if successful.
+     */
+    virtual TInt GetSourceRectangle(TRect& aSrc) = 0;
+    
+    /**
+     * @brief Set the target area where the Image Source should appear.
+     * 
+     * Set the target area in the target screen (or off-screen buffer)
+     * where the Image Source should appear.  Scaling may result if
+     * the source and destination rectangles differ.  A platform specific
+     * algorithm will be used to interpolate the scaled image.
+     * 
+     * @param aDest  The destination rectangle in the target.
+     * @pre     An Image Source must have been connected; @see ConnectSurface()
+     * @return  One of the system-wide error codes.  
+     *          KErrGeneral, if there is no image source connected. 
+     *          KErrArgument, if the destination rectangle has negative width or 
+     *          height.  
+     *          KErrNone, if successful.
+     */
+    virtual TInt SetDestinationRectangle(const TRect& aDest) = 0;
+    
+    /**
+     * @brief Get the target area where the Image Source would appear.
+     * 
+     * Get the target area where the Image Source would appear.  The default
+     * value is at (0,0) sized to the Image Source clipped to the size
+     * of the target.
+     * 
+     * @param aDest  The destination rectangle is updated with the current
+     *               region used in the target screen. 
+     * @pre     An Image Source must have been connected; @see ConnectSurface()
+     * @return  One of the system-wide error codes.  
+     *          KErrGeneral, if no Image Source has been connected.  
+     *          KErrNone, if successful.
+     */
+    virtual TInt GetDestinationRectangle(TRect& aDest) const = 0;
+    
+    /**
+     * @brief Clip the target area where the Image Source would appear.
+     * 
+     * Set clipping area where the Image Source would appear.  The default
+     * value is the area of the target screen.
+     * 
+     * @param aDestClipRect  The clipping rectangle in the target.  (0,0,0,0)
+     *                       means the entire size of the Target Screen.
+     * @return  One of the system-wide error codes.  
+     *          KErrGeneral, if no Image Source has been connected. 
+     *          KErrArgument, if the rectangle has negative width or height  
+     *          KErrNone, if successful.
+     */
+    virtual TInt SetDestinationClippingRect(const TRect& aDestClipRect) = 0;
+    
+    /**
+     * @brief Get the clipping area in the target.
+     * 
+     * Get the clipping area which limits where in the target screen the
+     * element may appear.
+     * 
+     * @param aDestClipRect  The clipping rectangle is updated with the current
+     *                       clipping area used in the target screen.
+     * @return  One of the system-wide error codes.  KErrGeneral means no Image
+     *          Source has been connected.  KErrNone is returned upon success.      
+     */
+    virtual TInt GetDestinationClippingRect(TRect& aDestClipRect) const = 0;
+    
+    /**
+     * @brief Set the rotation that should appear in the target for the
+     * Image Source.
+     * 
+     * Set the rotation which describes how the connected Image Source
+     * should be rotated to appear in the target.
+     * 
+     * @param aElementRotation  The amount of rotation in the target.
+     * @pre     An Image Source must have been connected; @see ConnectSurface()
+     * @return  One of the system-wide error codes.  
+     *          KErrGeneral, if no Image Source has been connected.  
+     *          KErrArgument, if an out of bounds rotation value has been 
+     *          supplied.  
+     *          KErrNone, if successful.
+     */
+    virtual TInt SetSourceRotation(const TElementRotation aElementRotation) = 0;
+    
+    /**
+     * @brief Get the pending rotation setting as it would appear in the target.
+     * 
+     * Get the pending rotation setting for the connected Image Source.
+     * By default, the rotation is EElementAntiClockwise0 and this is returned
+     * if there is no connected Image Source.
+     * 
+     * @return  The pending rotation setting.
+     */
+    virtual TElementRotation SourceRotation() const = 0 ;
+    
+    /**
+     * @brief Set flipping about the image horizontal centerline.
+     * 
+     * Set the pending flipping setting for the connected Image Source.
+     * When flipped, the Image Source appears in the target as inverted
+     * about its horizontal centerline.  This effect can be combined
+     * with rotation effects.
+     * By default, the Image Source is not flipped.
+     * 
+     * @param aFlip  If ETrue, the connected Image is flipped, else
+     *               it is not flipped.
+     * @pre     An Image Source must have been connected; @see ConnectSurface()
+     * @return  One of the system-wide error codes.  
+     *          KErrGeneral, if no Image Source has been connceted.  
+     *          KErrNotSupported, if the platform does not support the feature.  
+     *          KErrNone, if successful.
+     */
+    virtual TInt SetSourceFlipping(const TBool aFlip) = 0;
+    
+    /**
+     * @brief Get the pending flipping setting.
+     * 
+     * Get the pending flipping setting for the connected Image Source.
+     * By default, the image is not flipped.
+     * 
+     * @return  The pending flipping setting.  If no Image is connected, return
+     *          EFalse.
+     */
+    virtual TBool SourceFlipping() const = 0 ;
+    
+    /**
+     * @brief Set Target Renderer Flags associated with this Element
+     * 
+     * Set the Target Renderer flags to be associated with this Element.
+     * 
+     * @note    Flags which are not recognised by an implementation must
+     *          be kept to allow the interface to be extended in a 
+     *          compatible manner.
+     * @param aTargetRendererFlags  Flags to set for Target Renderer;
+     *                              @see TElementTargetRendererFlags
+     * @return  One of the system-wide error codes.  
+     *          KErrNotSupported, if the platform does not support the given 
+     *          flags.  
+     *          KErrArgument, if incompatible flag settings have been made.  
+     *          KErrNone, if successful.
+     */
+    virtual TInt SetTargetRendererFlags(const TUint32& aTargetRendererFlags) = 0;
+    
+    /**
+     * @brief Set Render Stage Flags associated with this Element
+     * 
+     * Set the Render Stage flags to be associated with this Element.
+     * 
+     * @note    Flags which are not recognised by an implementation must
+     *          be kept to allow the interface to be extended in a 
+     *          compatible manner.
+     * @param aRenderStageFlags  Flags to set for Render Stage Plug-ins;
+     *                           @see TElementRenderStageFlags
+     * @return  One of the system-wide error codes.  
+     *          KErrNotSupported, if the platform does not support the given 
+     *          flags.  
+     *          KErrArgument, if incompatible flag settings have been requested.  
+     *          KErrNone, if successful.
+     */
+    virtual TInt SetRenderStageFlags(const TUint32& aRenderStageFlags) = 0;
+    
+    /**
+     * @brief Get Target Renderer Flags associated with this Element
+     * 
+     * Get the Target Renderer flags associated with this Element.
+     *   
+     * @note    Flags which are not recognised by an implementation must
+     *          be kept to allow the interface to be extended in a 
+     *          compatible manner.
+     * @param aTargetRendererFlags  Variable to receive TElementTargetRendererFlags
+     */
+    virtual void GetTargetRendererFlags(TUint32& aTargetRendererFlags) const = 0;
+
+    /**
+      * @brief Get Render Stage Flags associated with this Element
+      * 
+      * Get the Render Stage flags associated with this Element.
+      *   
+      * @note    Flags which are not recognised by an implementation must
+      *          be kept to allow the interface to be extended in a 
+      *          compatible manner.
+      * @param aRenderStageFlags  Variable to receive TElementRenderStageFlags
+      */
+     virtual void GetRenderStageFlags(TUint32& aRenderStageFlags) const = 0;   
+     
+    /**
+     * @brief Get the Element above this Element.
+     * 
+     * Get the Element which is above this Element in the Pending Scene.
+     * If the Element is the top-most element, NULL is returned.  If the
+     * Element is not in the Scene, NULL is returned.
+     * 
+     * @return Element above, or NULL.
+     */
+    virtual MWsElement *ElementAbove() = 0;
+    
+    /**
+     * @brief Get the Element below this Element.
+     * 
+     * Get the Element which is below this Element in the Pending Scene.
+     * If the Element is the bottom-most element, NULL is returned.  If the
+     * Element is not in the Scene, NULL is returned.
+     * 
+     * @return Element below, or NULL.
+     */
+    virtual MWsElement *ElementBelow() = 0;
+    
+    /**
+     * @brief Connect or re-Connect a Surface to this Element.
+     * 
+     * Connect the given Surface to this Element, or re-Connect a new
+     * Surface to this Element which already has a connected Surface.
+     * The Element does not need to be in the Scene when this call is made.
+     * 
+     * @note    The Source Rectangle of the Element is updated to correspond
+     *          to match the Source Rectangle of the Surface.  Thus any
+     *          prior Source Rectangle setting will be overwritten.
+     * 
+     * @param aSurface  Surface to connect to.  If this is the Null
+     *                  Surface, then the Source Rectangle of the
+     *                  Element is set to (0,0,0,0).
+     * @return  One of the system-wide error codes.  
+     *          KErrArgument, if supplied Surface cannot be connected.  For 
+     *          example the Element has a flag indicating it has an Alpha 
+     *          Channel but the Surface does not.  
+     *          KErrNone, if successful.
+     */
+    virtual TInt ConnectSurface(const TSurfaceId& aSurface) = 0;
+    
+    /**
+     * @brief Get the Surface connected to this Element
+     * 
+     * @return  The Surface Identifier of the Connected Surface.  This
+     *          identifier may represent the Null Surface Id if there
+     *          was no Surface connected in the Pending Scene for this
+     *          Element.
+     */
+    virtual const TSurfaceId& ConnectedSurface() const = 0;
+    
+    /**
+     * @brief Set the Global Alpha Transparency value
+     * 
+     * Sets the Global Alpha Transparency value for this Element.  Elements
+     * are by default fully opaque, represented by opacity 255.  On platforms
+     * that support it, the Alpha Transparency value can be reduced down
+     * to 0 representing fully transparent.  The purpose of this is to
+     * allow the fading in and fading out of Elements into the Scene.
+     * 
+     * @param aAlpha  The Alpha Transparency value desired.  Values
+     *                are clamped to be within the range [0, 255] where 0
+     *                represents fully transparent, and 255 represents
+     *                fully opaque.
+     * @note    This setting has no effect unless the flag
+     *          Target Renderer flag EElementTransparencyGlobalAlpha
+     *          is set; @see SetTargetRendererFlags()
+     * @note    Out of range values are clamped silently, and do not cause
+     *          error conditions.
+     * @return  One of the system-wide error codes.  
+     *          KErrNotSupported, if the supplied value, once clamped, is not 
+     *          supported on the platform.
+     *          KErrNone, if successful.
+     */
+    virtual TInt SetGlobalAlpha(const TInt aAlpha) = 0;
+    
+    /**
+     * @brief Get the Global Alpha Transparency value
+     * 
+     * Gets the Global Alpha Transparency value for this Element.  Elements
+     * are by default fully opaque, represented by opacity 255.
+     * 
+     * @param aAlpha  Variable which receives the Global Alpha Transparency
+     *                value.
+     */
+    virtual void GlobalAlpha(TInt& aAlpha) const = 0;
+    };
+#endif // WSELEMENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/openwfc/wsscene.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,385 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Interface for Window Server Scene
+//
+//
+
+/**
+ @publishedPartner
+ @prototype
+*/
+
+#ifndef WSSCENE_H
+#define WSSCENE_H
+
+#include <babitflags.h>
+#include <w32std.h>
+#include <graphics/wsgraphicdrawerinterface.h>
+
+class MWsElement;
+
+/**
+ * @brief Window Server Scene Interface Definition.
+ * 
+ * MWsScene is a CWsRenderStage interface extension.  An understanding
+ * of the Render Stage Plug-in architecture, and the CWsRenderStage API
+ * is required in order to use and understand this interface.
+ * 
+ * A MWsScene manages a collection of MWsElements that define
+ * what is shown to a User on a particular target display, or off-screen
+ * buffer.
+ * 
+ * A MWsScene constitute of MWsElements.  Each MWsElement represents
+ * a rectangular region of the screen.  MWsElements have meta-data which
+ * describe the region, such as the image orientation, extent, and
+ * alpha-blending characteristics.  MWsElements also have surface-data,
+ * which provides the pixel data to be shown in the given area of the
+ * screen.  
+ * 
+ * The purpose of an MWsScene is to manage the relative ordinal positions
+ * of scene elements.  Typically elements representing the camera view-
+ * finder, or video frames, is placed at the bottom, and the user interface
+ * element is placed above.  Semi-transparency is often used to blend
+ * such elements into a visually appealing scene, and transparent holes
+ * in the user interface element allow elements below to poke through.
+ * 
+ * The goal of this interface is to allow suitable platforms to implement
+ * this API using composition hardware.  This is to reduce power and
+ * CPU load, so a long movie might be played, for example.
+ * 
+ * A secondary goal of this interface is to enable transition effects
+ * to be efficiently implemented.  This is because MWsScenes can be
+ * chained together in a Render Stage pipeline.  Element meta-data
+ * can be manipulated by transition effects render stages before actual
+ * rendering.
+ * 
+ * <h1>Examples of Elements</h1>
+ * @li Camera view-finder
+ * @li Video frame
+ * @li User interface
+ * 
+ * There can be two types of user interface element: directly rendered
+ * and indirectly rendered.  
+ * 
+ * Indirect rendering is the normal case.  Here the client provides
+ * CWindowGc commands, which Window Server passes as MWsGraphicsContext
+ * API calls to the Render Stage.
+ * 
+ * Direct rendering is where Window Server does not see the graphics
+ * commands, as is the case for Direct Screen Access clients.
+ * 
+ * <h1>Use Cases</h1>
+ * 
+ * <h2>Instantiation</h2>
+ * 
+ * During system-startup Window Server needs to obtain an instance of
+ * the MWsScene interface in order to place MWsElements in the scene
+ * for rendering.
+ * 
+ * MWsScene is a CWsRenderStage interface extension, accessed by
+ * @code
+ * CWsRenderStage::ResolveObjectInterface(KMWsScene);
+ * @endcode
+ * 
+ * The initial values are:
+ * @li No rotation is applied
+ * @li No Elements are in the Scene
+ * @li Scene is connected to same display as its CWsRenderStage
+ * 
+ * Note Elements may be added/inserted/removed subject to implementation-
+ * defined constraints; the connected display is immutable.
+ * 
+ * <h2>Rendering</h2>
+ * 
+ * When the Scene changes, Window Server needs to communicate the changes
+ * and then render the new Scene.  This can happen when a video player
+ * application is launched, whereby a new User Interface control is placed
+ * on the screen, and a new Element representing the Video Surface is added.
+ * 
+ * The Window Server must use the CWsRenderStage interface to provide
+ * updates to the Scene.
+ * @code
+ * CWsRenderStage::Begin(regionOfScreenWithVideoPlayer);
+ * drawing ops sent to MWsGraphicsContext for UI
+ * drawing ops to setup a transparent hole for video surface to poke
+ * through
+ * .
+ * .
+ * 
+ * sceneElement = CreateSceneElementL();
+ * sceneElement->ConnectSurface(videoSurfaceAlreadySetup);
+ * InsertSceneElement(sceneElement, NULL);
+ * CWsRenderStage::End(asyncCallbackNotification);
+ * @endcode
+ * 
+ * When Scene updates, such as in the example above, are done there is
+ * a concept of the "Committed Scene".  All Scene updates are considered
+ * to be "Pending" until a CWsRenderStage::End() has been called.  Then
+ * the pending changes are applied atomically.  Either the previously
+ * Committed Scene is re-instated or all the Pending changes are accepted
+ * to form the newly Committed Scene.  This depends on platform-specific
+ * limitations, and system-wide resource availability.
+ * 
+ * <h2>Orientation Changes to Elements</h2>
+ * 
+ * Suppose we have an MWsElement representing people as seen through a video
+ * camera view finder in landscape orientation, with the handset also in
+ * landscape orientation.  The handset is rotated into portrait mode.
+ * 
+ * We desire the view finder to be rotated in the opposite
+ * sense to the rest of the User Interface.  This is to allow people
+ * previously vertical in the view finder to remain vertical.
+ * 
+ * For this use case, a MWsElement::SetSourceRotation() must be called.
+ * 
+ * The changes are visible after the next @c CWsRenderStage::End() call.
+ * 
+ * <h2>Orientation Changes to Scenes</h2>
+ * 
+ * Suppose the entire Scene comprises a single User Interface element.
+ * The handset is then rotated from landscape to portrait mode.
+ * The whole scene must be rotated to compensate.  Here 
+ * MWsScene::SetSceneRotation() must be called.
+ * 
+ * The changes are visible after the next @c CWsRenderStage::End() call.
+ * 
+ * <h2>Leveraging external APIs for Transition Effects</h2>
+ *
+ * Suppose we want to manipulate the Scene to achieve a transition
+ * effect.  The Scene as presented by Window Server comprises one
+ * UI Element, and one External Surface Element.  We have an external
+ * APIs, such as OpenGL or OpenWF, available to deliver a transition effect
+ * into a different External Surface.
+ * 
+ * This task is accomplished by using the output Surface of OpenGL as
+ * the connected Image Source for the one Element which comprises the Scene
+ * presented on the Screen.
+ * The Elements inserted into the Scene by Window Server are instead given
+ * to OpenGL as textures.  When the Screen needs to be rendered, OpenGL
+ * is first used to render to its output Surface, and this is taken
+ * as-is for the Scene Element that appears on the Screen.
+ * 
+ * A combination of Rendering APIs may be employed if they are available
+ * to the Transition Effects Render Stage -- to combine the power of
+ * OpenVG, OpenGL, and OpenWF, as an example.
+ *
+ * <h2>Managing the life-cycle of Surfaces from Window Server</h2>
+ *
+ * Suppose we want to maintain the life-cycle of a given Surface outside
+ * that needed by the Scene.  For example, suppose we have a video player
+ * application whose picture is frozen to a particular frame.  Then the
+ * application switches to some other view, no longer showing the video
+ * frame.  Finally, the application switches back to the original video
+ * frame so that the video clip can be resumed.
+ *
+ * In such a scenario, we would want the contents of the Surface to
+ * remain constant event though at one point the Surface is not part
+ * of the Scene.  This is so that the user does not see anything
+ * inconsistent appear with the video frame between switching from and
+ * to the video frame.
+ *
+ * Another scenario where the Surface needs to have a life-cycle beyond
+ * that of the Scene is when there is a large start-up cost to populating
+ * the Surface with initial data.  For example, a computer game application
+ * might take some seconds to construct the textures for an initial game
+ * position.  The game would want to construct the Surface, and populate
+ * its contents before supplying the Surface as a Background Surface for
+ * a given window.  This is so that the user does not see the game building
+ * up the Surface contents during game start-up.
+ *
+ * To facilitate the above use case, a call to RegisterSurface and a 
+ * corresponding call to UnregisterSurface must be made.  Note, Window
+ * Server should provide an UnregisterSurface call if the client program
+ * dies or exits abruptly before it could call UnregisterSurface.
+ */
+class MWsScene : public MWsObjectProvider
+    {
+public:
+    DECLARE_WS_TYPE_ID(KMWsScene)
+    
+public:
+    
+    /**
+     * Amount of rotation of pixel data in the target display or
+     * target surface for the entire scene.
+     */
+    enum TSceneRotation
+        {
+        ESceneAntiClockwise0 = 0,   /** No rotation */
+        ESceneAntiClockwise90 = 1,  /** 90 Degrees Anti-clockwise in target */
+        ESceneAntiClockwise180 = 2, /** 180 Degrees Anti-clockwise in target */
+        ESceneAntiClockwise270 = 3  /** 270 Degrees Anti-clockwise in target */
+        };
+       
+    /**
+     * @brief   Update the rotation setting for the entire scene.
+     * @param aSceneRotation  The new rotation setting
+     * @note    The changes are visible after the next @c CWsRenderStage::End()
+     *          or @c ScreenSnapshot() call.
+     * @return  One of the system-wide error codes.  KErrArgument means
+     *          aSceneRotation is out-of-range, KErrNotSupported means the
+     *          setting is not supported.  KErrNone is returned upon success.
+     */
+    virtual TInt SetSceneRotation(const TSceneRotation aSceneRotation) = 0;
+    
+    /**
+     * @brief   Obtain the current rotation setting for the entire scene
+     * @return  The currently committed scene rotation setting.
+     */
+    virtual TSceneRotation SceneRotation() const = 0;
+    
+    /**
+     * @brief Create a Scene Element for this scene.
+     * 
+     * Create a new Scene Element for use in the Scene.  The Scene Element
+     * is immediately available to the caller, but is not in the Scene.
+     * It must be inserted into the Scene, at which time is is considered
+     * a Pending Scene change.  Once @c CWsRenderStage::End() has been called
+     * the Element is rendered in the target and becomes part of the Committed
+     * Scene.
+     * 
+     * @return  The Scene Element
+     * @leave   KErrNoMemory There are insufficient memory resources
+     */
+    virtual MWsElement* CreateSceneElementL() = 0;
+    
+    /**
+     * @brief Destroy Scene Element
+     * 
+     * Remove the specified element from the scene, and then destroy
+     * resources associated with it.
+     * 
+     * @note  The update is seen after the next @c CWsRenderStage::End()
+     *        call.
+     * @param aElement  The element to destroy.  If NULL, the scene is
+     *                  unmodified.
+     */
+    virtual void DestroySceneElement(MWsElement* aElement) = 0;
+    
+    /**
+     * @brief Insert or Re-insert the Scene Element into the Scene
+     * 
+     * Insert the Scene Element into the Scene above the aSubordinateElement,
+     * or re-insert the existing Element but into a new position in the Scene.
+     * 
+     * @note    The same element cannot be in the scene at more than one
+     *          z-order position.
+     * @pre     The element must have previously been created @c 
+     *          CreateSceneElementL()
+     * @return  One of the system-wide error codes.  KErrArgument means
+     *          aElement or aSubordinateElement is not a valid element for this
+     *          Scene.  KErrNone is returned upon success.
+     * @param aInsertElement        The element to add; cannot be NULL
+     * @param aSubordinateElement   The element which will be below 
+     *                              aInsertElement when the scene is committed,
+     *                              or NULL to place at it the bottom of
+     *                              the scene.
+     */
+    virtual TInt InsertSceneElement(MWsElement* aInsertElement,
+                                    MWsElement* aSubordinateElement) = 0;
+    
+    /**
+     * @brief Remove an Element from the Scene
+     * 
+     * Remove the specified Element from the Scene, without destroying
+     * it.  
+     * 
+     * @note   The update is seen after the next @c CWsRenderStage::End()
+     *         call. 
+     * @param aRemoveElement  The element to be removed from the scene.
+     *                        If NULL, no action is taken.
+     * @pre     The supplied element, if non-NULL, must be in the Scene;
+     *          see @c InsertSceneElement()
+     * @post    The removed element is no longer in the Scene, but is still
+     *          valid object; it may receive further method calls.
+     * @return  One of the system-wide error codes.  KErrArgument means
+     *          aRemoveElement was not in this Scene.  KErrNone is returned
+     *          upon success.             
+     */
+    virtual TInt RemoveSceneElement(MWsElement* aRemoveElement) = 0;
+    
+    /**
+     * @brief Compose pending Scene into an off-screen target
+     *
+     * Compose the pending Scene into an off-screen target.  This
+     * method is an asynchronous call, and signals the optionally provided
+     * TRequestStatus, either immediately from some error cases, or later
+     * when the supplied off-screen target has been populated.
+     * 
+     * However, the pending scene changes for the target screen are not
+     * committed by this function call.
+     * 
+     * The TRequestStatus status value is updated by this function to one of
+     * the system-wide error codes.  KErrArgument is set if the supplied surface
+     * or TRequestStatus is in error.  KErrNoMemory is set for memory or other
+     * resource failures.  KErrInUse is set if the surface is in use or
+     * otherwise inaccessible.  KErrNotSupported is set if the supplied surface
+     * is incompatible with the screen.
+     *
+     * @param aOffScreenTarget  Surface to be updated with pending
+     *                          Scene
+     * @param aCompleted        When non-NULL, is used to signal the
+     *                          client when completed
+     * @post    Either the supplied surface is updated with new contents
+     *          and the aCompleted status is set to KErrNone, or an error value
+     *          is set in the aCompleted status.
+     * @post    Its guaranteed that the supplied surface is not accessed
+     *          by MWsScene after aCompleted has been signaled.
+     */
+    virtual void ComposePendingScene(TSurfaceId& aOffScreenTarget,
+                                        TRequestStatus* aCompleted) = 0;
+    
+    /**
+     * @brief Register the Window Server use of a Surface
+     *
+     * Register the Window Server use of a Surface for this Scene.
+     * The Scene abstraction already manages its use of Surfaces without
+     * this method call.  The purpose of this method is to allow Window
+     * Server, on behalf of its clients, to mark the given Surface as
+     * being used by such clients.  This allows the Surface to maintain
+     * a lifecycle beyond that which would normally be needed by the
+     * Scene, and allows early indication of incompatibility between
+     * the Surface and the Scene.
+     *
+     * @param aSurface  Surface to be marked as in use by the caller
+     * @post    Either the supplied surface accepted as potentially useable
+     *          by this Scene, or the local error value is set.
+     * @return  One of the system-wide error codes.  KErrNotSupported means the
+     *          Surface is incompatible with this Scene.  KErrNoMemory means
+     *          there was a memory problem.  KErrArgument means the supplied
+     *          Surface is not valid.  KErrServerBusy means the Surface is
+     *          currently used by another Scene.  KErrNone is returned upon
+     *          success.
+     */
+    virtual TInt RegisterSurface(const TSurfaceId& aSurface) = 0;
+    
+    /**
+     * @brief Unregister the Window Server use of a Surface
+     *
+     * Unregister the Window Server use of a Surface with this Scene.
+     * The Scene abstraction already manages its use of Surfaces without
+     * this method call.  The purpose of the method is to allow Window
+     * Server, on behalf of its clients, to mark the given Surface as
+     * no longer in use by such clients.  This ends the lifecycle of
+     * the Surface from the point of view of such clients.
+     *
+     * @param aSurface  Surface to be marked as no longer in use by the
+     *                  caller
+     * @return  One of the system-wide error codes.  KErrBadHandle means the 
+     *          supplied Surface is not known.  KErrNone is returned upon 
+     *          success.
+     */
+    virtual TInt UnregisterSurface(const TSurfaceId& aSurface) = 0;
+    };
+#endif // WSSCENE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/pointereventdata.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,83 @@
+// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Data passed to a Key Click Plug-in using the function CClickMaker::OtherEvent when the 
+// aType value is EEventPointer.
+//
+
+#ifndef POINTEREVENTDATA_H
+#define POINTEREVENTDATA_H
+
+/**
+Passed to a Key Click Plug-in using the function CClickMaker::OtherEvent when the 
+aType value is EEventPointer.
+This includes information about the window the pointer event will be sent to.
+This is the normally the window being clicked on by the user, but pointer capturing 
+and grabbing may affect this.
+
+@publishedPartner
+@released 
+*/
+class TPointerEventData
+	{
+public:
+	enum TSource
+		/**
+		A list of locations that WSERV receives events from
+		*/
+		{
+		/** The source is not specified. */
+		EUnspecified,
+		/** The event came from the kernel. */
+		EKernel,
+		/** The event came from a client API. */
+		EClient,
+		/** The event came from an Anim DLL. */
+		EAnimDLL,
+		};
+public:
+	/**
+	The version number of the data passed with EEventPointer, current always 0.
+	*/
+	TInt iVersion;
+	/**
+	The screen position of pointer event.
+	*/
+	TPoint iCurrentPos;
+	/**
+	The full pointer event data previously passed to the CClickMaker::PointerEvent function,
+	except that the iParentPosition will be the actual parent position, when previously passed
+	to the plug-in this value was the screen position.
+	*/
+	TAdvancedPointerEvent iPointerEvent;
+	/**
+	The client handle of the window or zero if the window is not a client window.
+	*/
+	TUint32 iClientHandle;
+	/**
+	The current top left of the window on the screen.
+	*/
+	TPoint iWindowOrigin;
+	/**
+	The Window Group Identifier of the window group that is a parent (or grand parent etc.)
+	of the window the event is sent to or zero if the window is not a client window.
+	*/
+	TInt iWindowGroupId;
+	/**
+	The source that WSERV recieves the event from,
+	currently set to EUnspecified as this is for future expansion.
+	*/
+	TSource iSource;
+	};
+
+#endif // POINTEREVENTDATA_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/surfaceconfiguration.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,129 @@
+// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef SURFACECONFIGURATION_H
+#define SURFACECONFIGURATION_H
+
+#include <e32base.h>
+#include <graphics/surface.h>
+#include <bitstd.h>
+
+/** 
+The base class for the surface configuration containing the size of the surface configuration.  
+Provides a Size function to help identify which attributes are available.
+
+@publishedPartner
+@prototype
+*/
+class TSurfaceConfigurationSize
+{
+public:
+	inline TInt Size() const;
+protected:
+	inline TSurfaceConfigurationSize(TInt aSize);
+	template <class Member> TBool MemberAccessible (const Member& aMember) const
+		{
+		return iSize>=sizeof(Member)+TInt(&aMember)-TInt(this);
+		}
+	inline TBool operator == (const TSurfaceConfigurationSize& aRhs)const;
+private:	
+	inline TSurfaceConfigurationSize();
+	inline TSurfaceConfigurationSize(const TSurfaceConfigurationSize& /*aSurfaceConfigurationSize*/);
+	inline TSurfaceConfigurationSize operator = (const TSurfaceConfigurationSize& /*aRhs*/)const;
+protected:
+	TInt iSize;
+};
+
+/** 
+The first set of surface configuration attributes containing the surface id, viewport, extent
+and orientation of the surface, along with a SupportsAllMembers function to help identify which 
+attributes are available.
+
+@publishedPartner
+@prototype
+*/
+class TSurfaceConfiguration1: public TSurfaceConfigurationSize
+{
+public:
+	inline TSurfaceConfiguration1();
+	inline TInt SetSurfaceId (const TSurfaceId& aSurfaceId);
+	inline void GetSurfaceId (TSurfaceId& aSurfaceId) const;
+	inline TInt SetViewport (const TRect& aViewport);
+	inline void GetViewport (TRect& aViewport) const;
+	inline TInt SetOrientation (CFbsBitGc::TGraphicsOrientation aOrientation);
+	inline CFbsBitGc::TGraphicsOrientation Orientation() const;
+	inline TInt SetExtent(const TRect& aExtent);
+	inline void GetExtent(TRect& aExtent) const;
+	inline TBool SupportsAllMembers();
+protected:
+	inline TSurfaceConfiguration1(TInt aSize);
+	inline TBool operator == (const TSurfaceConfiguration1& aRhs)const;
+private:
+	inline TSurfaceConfiguration1(const TSurfaceConfiguration1& /*aSurfaceConfiguration1*/);
+	inline TSurfaceConfiguration1 operator = (const TSurfaceConfiguration1& /*aRhs*/)const;
+private:
+	TSurfaceId iSurfaceId;
+	CFbsBitGc::TGraphicsOrientation iOrientation;
+	TRect iExtent;
+	TRect iViewport;
+};
+
+/** 
+The second set of surface configuration attributes containing the flip attribute of the surface, along with a SupportsAllMembers function to help identify which 
+attributes are available.
+
+@publishedPartner
+@prototype
+*/
+class TSurfaceConfiguration2: public TSurfaceConfiguration1
+{
+public:
+    inline TSurfaceConfiguration2();
+    inline TInt SetFlip(TBool aFlip);
+    inline TBool Flip()const;
+    inline TBool SupportsAllMembers();
+protected:
+    inline TSurfaceConfiguration2(TInt aSize);
+    inline TBool operator == (const TSurfaceConfiguration2& aRhs)const;
+private:
+    inline TSurfaceConfiguration2(const TSurfaceConfiguration2& /*aSurfaceConfiguration2*/);
+    inline TSurfaceConfiguration2 operator = (const TSurfaceConfiguration2& /*aRhs*/)const;
+    //iFlip is a x-axis flip
+    TBool iFlip;
+};
+
+/** 
+TSurfaceConfiguration is provided as a chain of derived classes representing the growing 
+history of the class.
+
+@publishedPartner
+@prototype
+*/
+class TSurfaceConfiguration: public TSurfaceConfiguration2
+{
+	typedef	TSurfaceConfiguration2	TBiggestConfiguration;
+public:
+	inline TSurfaceConfiguration();
+	inline TSurfaceConfiguration(const TSurfaceConfiguration& aSurfaceConfiguration);
+	inline TSurfaceConfiguration(TInt aPreferredMaxSize);
+	inline TBool operator == (const TSurfaceConfiguration& aRhs)const
+		{
+		return TSurfaceConfiguration2::operator==(aRhs);
+		}
+private:
+	inline TSurfaceConfiguration operator = (const TSurfaceConfiguration& /*aRhs*/);
+};
+#include <graphics/surfaceconfiguration.inl>
+#endif // SURFACECONFIGURATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/testscreencapture.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,139 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef TESTSCREENCAPTURE_H_
+#define TESTSCREENCAPTURE_H_
+
+struct TWsScsComposeScreenCommand
+	{
+	struct TrivialPoint
+		{
+		/**
+		The x co-ordinate.
+		*/
+		TInt iX;
+		/**
+		The y co-ordinate.
+		*/
+		TInt iY;
+		};
+	struct TrivialRect
+		{
+		/**
+		The x and y co-ordinates of the top left hand corner of the rectangle.
+		*/
+		TrivialPoint iTl;
+		
+		/**
+		The x and y co-ordinates of the bottom right hand corner of the rectangle.
+		*/
+		TrivialPoint iBr;
+		};
+	inline TWsScsComposeScreenCommand(TUint aCommand, const TInt aHandle);
+	inline TWsScsComposeScreenCommand(TUint aCommand, const TRect iAttributes);
+	inline void ConvertTrivialRect(TRect& aRect);
+	
+	TUint iCommand;
+	union Parameters
+	{
+	TInt iBitmapHandle;
+	TrivialRect iExtent;
+	} iParameter;
+	};
+
+/**
+ * Window Server client interface for screen capture.
+ * 
+ * All functions in MTestScreenCapture will automatically flush the client-server
+ * session buffer as part of their behavior.
+ * 
+ * @publishedPartner
+ * @prototype
+ */
+
+class MTestScreenCapture
+{
+public:
+	enum TWsTestScreenCaptureOpcodes
+		{
+		EWsScsInvalid = 0x00000000,
+		EWsScsScreenCompose = 0x00000001,
+		EWsScsTranslateExtent = 0x00000002,
+		};
+	
+	enum	
+		{
+		KUidTestScreenCaptureIf =  0x10286504,
+		ETypeId =	 KUidTestScreenCaptureIf 
+		};
+public:
+	/** Retrieves the composited screen content. 
+	    A new composition is initiated and the result is copied in 
+	    the bitmap created by user.
+	    The only bitmap mode supported is EColor16MU.
+
+	    This function always causes a flush of the window server buffer.
+	    
+ 		@param aBitmap retturns the composited screen content.
+ 		@param aTarget target rectangle to be filled in
+		@return KErrNone if successful
+		        KErrArgument if the size does not match the composition area size or
+		        the display mode is not supported
+	*/
+	virtual TInt ComposeScreen(const CFbsBitmap& aBitmap) const = 0;
+	/** Maps the source rectangle from application coordinate space to a
+		target coordinate space. Since there may be scaling involved, the
+		target rectangle may be larger or smaller than the source one, or
+		even become empty.
+
+	    This function always causes a flush of the window server buffer.
+	    
+		@param aSource source rectangle
+		@param aTarget target rectangle to be filled in
+		@return KErrNone if successful, otherwise one of the system-wide error codes
+		*/
+	virtual TInt TranslateExtent(const TRect& aSource, TRect& aTarget) const = 0;
+
+	/** Retrieves the size of the composition area in pixels.
+
+	    This function always causes a flush of the window server buffer.
+
+		@param aSize returns the composition area size
+		@return KErrNone if successful, otherwise one of the system-wide error codes
+		*/
+	virtual TInt GetCompositedSize(TSize& aSize) const = 0;
+};
+
+inline TWsScsComposeScreenCommand::TWsScsComposeScreenCommand(TUint aCommand, const TInt aHandle): 
+	iCommand(aCommand)
+	{ iParameter.iBitmapHandle = aHandle; }
+
+inline TWsScsComposeScreenCommand::TWsScsComposeScreenCommand(TUint aCommand, const TRect iAttributes): 
+	iCommand(aCommand)
+	{ 
+	iParameter.iExtent.iTl.iX = iAttributes.iTl.iX; 
+	iParameter.iExtent.iTl.iY = iAttributes.iTl.iY; 
+	iParameter.iExtent.iBr.iX = iAttributes.iBr.iX; 
+	iParameter.iExtent.iBr.iY = iAttributes.iBr.iY; 
+	}
+inline void TWsScsComposeScreenCommand::ConvertTrivialRect(TRect& aRect)
+	{
+	aRect.iTl.iX = iParameter.iExtent.iTl.iX;
+	aRect.iTl.iY = iParameter.iExtent.iTl.iY;
+	aRect.iBr.iX = iParameter.iExtent.iBr.iX;
+	aRect.iBr.iY = iParameter.iExtent.iBr.iY;
+	}
+
+#endif /*TESTSCREENCAPTURE_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/windowserverconstants.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,44 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Window server internal constants
+// 
+//
+
+#ifndef WINDOWSERVERCONSTANTS_H
+#define WINDOWSERVERCONSTANTS_H
+
+#include <textcursor.h>
+
+/**
+@internalAll
+*/
+_LIT(KWSERVServerName,"!Windowserver");
+
+/**
+Declaration of constant TUids for APIExtension to use as identifiers.
+@internalComponent
+@prototype
+*/
+const TUid KApiExtensionInterfaceUid = {0x102864E8};
+
+/** Flags and masks for TTextCursor internal use only
+	@internalComponent */
+enum TTextCursorPrivateFlags
+	{
+	ETextCursorUserFlags		= 0x0000FFFF,
+	ETextCursorFlagClipped		= 0x00010000,
+	ETextCursorPrivateFlags		= 0xFFFF0000
+	};
+
+#endif // WINDOWSERVERCONSTANTS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/wscontentreadyforcomposition.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,48 @@
+// Copyright (c) 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:
+// 
+//
+
+/**
+ @file
+ @publishedPartner
+ @released
+*/
+
+#ifndef __WSCONTENTREADYFORCOMPOSITION_H__
+#define __WSCONTENTREADYFORCOMPOSITION_H__
+
+
+#include <e32std.h>
+#include <graphics/surface.h>
+#include <graphics/wsgraphicdrawerinterface.h>
+
+
+/**
+MWsContentReadyForComposition is an interface used to wrap the underlying
+compositor extension, MContentReadyForComposition, into the window server.
+See contentreadyforcomposition.h for deatils of the API.
+*/
+class MWsContentReadyForComposition : public MWsObjectProvider
+    {
+public:
+    DECLARE_WS_TYPE_ID(KMWsContentReadyForComposition)
+
+public:
+    virtual void NotifyContentReady(const TSurfaceId& aSurface, TUint64 aContentUpdate, TRequestStatus& aNotifyReady) = 0;
+    virtual void NotifyContentReadyCancel(const TSurfaceId& aSurface) = 0;
+    };
+
+
+#endif //__WSCONTENTREADYFORCOMPOSITION_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/wscursor.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,121 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Interface for Render Stage Text Cursors
+// 
+//
+
+/**
+ @publishedPartner
+ @prototype
+*/
+
+#ifndef WSCURSOR_H
+#define WSCURSOR_H
+
+#include <w32std.h>
+#include <graphics/wsgraphicdrawerinterface.h>
+
+/** Wserv access to render stage Text Cursor implementation.
+
+This interface allows delegation of Text Cursor drawing to the Render
+Stage.  It must not to be confused with Custom Text Cursor drawing;
+@see RWsSession::SetCustomTextCursor
+
+Historically, Text cursors have often been implemented using XOR
+drawing, because it is a cheap way to deliver a high-contrast cursor
+in certain system architectures where Operating System access to
+Graphics Device Memory is possible.
+
+XOR drawing can be problematic for some Render Stages.  This is because
+the XOR operation requires a read back followed by a write.  This would
+stall a graphics accelerator hardware implementation.
+
+In a render stage setting, the Text Cursor may not be the top-most
+window as a transition effect can slide a semi-transparent window over
+the top of the Text Cursor window.  This means the cursor cannot be XOR
+drawn last after all other windows; the read-back cost cannot be hidden
+at the end of drawing each frame.
+
+The Display Render Stage, responsible for interacting with hardware,
+can offer XOR drawing in some cases, for example Software Bit GDI,
+and not in others, for example OpenVG back-end hardware.
+
+This interface allows a render stage to implement Text Cursors
+appropriately given the Display Render Stage which is present.
+
+This interface uses the supplied Text Cursor Color as a hint only.
+TextCursor colors are better regarded as constrast level indicators
+where KRgbWhite means a high contrast text cursor, and KRgbBlack
+means an invisible text cursor.
+
+Suggested strategies:
+<ol>
+<li>
+XOR drawing is available.  Just XOR draw the cursor each time in
+the supplied color.  This corresponds to legacy non-Render Stage
+behaviour.
+</li>
+<li>
+No XOR drawing is available.  Draw a black box (solid or hollow
+as appropriate).  Ensure that the UI Toolkit which provides the
+platform's default text entry control has a compatible theme so
+that black is an appropriate high-contrast color.
+</li>
+</ol>
+
+@publishedPartner
+@prototype
+*/
+class MWsTextCursor : public MWsObjectProvider
+	{
+public:
+
+	struct TTextCursorInfo
+		{
+		const TRect& iCursorRect;	/** Rectangular area of the cursor in <b>window</b> co-ordinates */
+		const TRegion& iRegion; 	/** Clipping region */
+		TInt iTextCursorType; 		/** Cursor type; either TTextCursor::ETypeRectangle or TTextCursor::ETypeHollowRectangle */
+		MWsWindow* iWindow; 		/** Window owning the cursor */
+		TRgb iTextCursorColor;		/** Text Cursor Color used as a hint */
+
+		TTextCursorInfo(const TRect& aCursorRect, const TRegion& aRegion,
+				TInt aTextCursorType, MWsWindow* aWindow, TRgb aTextCursorColor)
+		: iCursorRect(aCursorRect),
+		iRegion(aRegion),
+		iTextCursorType(aTextCursorType),
+		iWindow(aWindow),
+		iTextCursorColor(aTextCursorColor)
+			{
+			}
+		};
+public:
+	DECLARE_WS_TYPE_ID(KMWsTextCursor)
+
+public:
+	/** Draw the Text Cursor in its Flash ON state
+	 * 
+	 * Draw the text cursor with the supplied attributes.  Note, the Flash OFF
+	 * state does not result in a call to this function; instead a window
+	 * redraw is done for the area where the cursor would reside.
+	 * 
+	 * @pre     The supplied Text Cursor type is either TextCursor::ETypeRectangle or
+	 * 			TTextCursor::ETypeHollowRectangle
+	 * 
+	 * @param	aTextCursorInfo  Data structure to describe the attributes of the Text
+	 * 			Cursor to Draw
+	 */
+	virtual void DrawTextCursor(const TTextCursorInfo& aTextCursorInfo) = 0;
+	};
+
+#endif // WSCURSOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/wsdisplaycontrol.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,77 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Interface for Render Stage Display Resolution
+// 
+//
+
+#ifndef WSDISPLAYCONTROL_H_
+#define WSDISPLAYCONTROL_H_
+
+/**
+@file
+@publishedpartner 
+@released
+*/
+
+#include <graphics/displaycontrolbase.h>
+#include <graphics/wsgraphicdrawerinterface.h>
+
+class MWsDisplayControl: public MWsObjectProvider,public MDisplayControlBase
+	{
+public:
+	enum	
+		{
+		KUidWsDisplayControl =  0x10286497, 	  //To    0x1028649A
+		ETypeId=				KUidWsDisplayControl,
+		EWsObjectInterfaceId=	KUidWsDisplayControl
+		};
+public:
+	/**
+	 * Asynchronous request to complete aStatus when a change of display is detected.
+	 * 
+	 * The request is completed when the connectedness of the display changes, or when
+	 * the set of available resolutions changes.
+	 * 
+	 * @param aStatus Asynchronous request status.
+	 */
+	virtual void NotifyOnDisplayChange(TRequestStatus& aStatus)=0;
+	/**
+	 * Cancels a pending request to notify on display change.
+	 * 
+	 * If there is a pending notification request, the status value will be set to 
+	 * KErrCancelled and it will be completed. If there is no pending request for 
+	 * notification, the call will simply return.
+	 */
+	virtual void NotifyOnDisplayChangeCancel()=0;
+	/**
+	 * Asynchronous request to complete aStatus when a configuration change occurs.
+	 * 
+	 * The request is completed when a new configuration has been set, either 
+	 * explicitly or by a render stage. Earlier render stages and the Window Server 
+	 * can use this to update their state.
+	 * 
+	 * @param aStatus Asynchronous request status.
+	 */
+	virtual void NotifyOnConfigChange(TRequestStatus& aStatus)=0;
+	/**
+	 * Cancels a pending request to notify on configuration change.
+	 * 
+	 * If there is a pending notification request, the status value will be set to 
+	 * KErrCancelled and it will be completed. If there is no pending request for 
+	 * notification, the call will simply return.
+	 */
+	virtual void NotifyOnConfigChangeCancel()=0;
+	};
+
+#endif /*WSDISPLAYCONTROL_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/wsdisplaypolicy.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,89 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Interface for Render Stage Display Policy
+// 
+//
+
+#ifndef WSDISPLAYPOLICY_H_
+#define WSDISPLAYPOLICY_H_
+
+/**
+@file
+@publishedpartner 
+@released
+*/
+
+#include <graphics/displayconfiguration.h>
+#include <graphics/wsgraphicdrawerinterface.h>
+
+class MWsDisplayPolicy: public MWsObjectProvider
+	{
+public:
+	enum	
+		{
+		KUidWsDisplayPolicy	 =  0x102869FA, 	 
+		ETypeId=				KUidWsDisplayPolicy,
+		EWsObjectInterfaceId=	KUidWsDisplayPolicy
+		};
+	
+	enum TDisplayStatus
+		{
+		EDetach = 0,
+		EAttach,
+		EConnecting,
+		};
+public:
+	/**
+	 * Notification from the Window Server that the application size mode list has been updated.
+	 */
+	virtual void NewAppModesAvailable()=0;
+	/**
+	 * Determine the display configuration and application rendering extent to use for a given screen size mode.
+	 * 
+	 * The Window Server uses this function when a request to change to a new screen size mode or new display 
+	 * configuration is made by a client. The display configuration passed in may be partially filled, and the 
+	 * combination of the defined entries in it and the requested screen size mode values shall be used to define 
+	 * the rest of the configuration and new application extent to be used.
+	 * 
+	 * Only undefined entries in the configuration may be set by this function. Entries already defined must retain 
+	 * the same values. If the combination of defined entries and size mode values is not acceptable to the implementer, 
+	 * the function shall return KErrArgument.
+	 * 
+	 * If the function returns KErrNone, the Window Server shall set the returned display configuration, notify render 
+	 * stages of the new application extent and change to use the screen size mode. If either this function returns 
+	 * EFalse or the call to set the display configuration fails for any reason (such as KErrNoMemory, for example), 
+	 * then no further changes are made.
+	 * 
+	 * @see MWsScreenConfigList
+	 * @see MWsDisplayMapping
+	 * 
+	 * @param aScreenSizeMode The requested screen size mode. If static, the size in pixels, size in twips, and 
+	 * the rotation must be respected. If dynamic, only the rotation must be respected.
+	 * @param aConfig The requested display configuration on input, the required configuration on return. Only 
+	 * undefined entries may be set.
+	 * @param aExtent The screen size mode offset and size on input, the required application offset and size on return. 
+	 * If the screen driver buffer is used as the UI surface, this must be left unchanged.
+	 * @return KErrNone if no error, otherwise a system wide error code
+	 */
+	virtual TInt GetSizeModeConfiguration(TInt aScreenSizeMode, TDisplayConfiguration& aConfig, TRect& aSizeModePosition) const =0;
+	virtual TInt SuitableAppMode(TDisplayStatus aSituation)=0;
+	/**
+	 * Sets the application mode resumed to after a display is connected again after a disconnect.
+	 * 
+	 * @param aMode The application mode.
+	 */
+	virtual void SetLastAppMode(TInt aMode)=0;
+	};
+
+#endif /*WSDISPLAYPOLICY_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/wsdrawablesourceprovider.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,97 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @publishedPartner
+ @prototype
+*/
+
+#ifndef __WSDRAWABLESOURCEPROVIDER_H__
+#define __WSDRAWABLESOURCEPROVIDER_H__
+
+#include <graphics/sgresource.h>
+#include <graphics/wsgraphicdrawerinterface.h>
+
+/**
+Window server evokes this interface from rendering stage plugin every time client 
+requests resource drawing operations.
+
+@publishedPartner
+@prototype
+ */
+class MWsDrawableSourceProvider : public MWsObjectProvider
+	{
+public:
+	DECLARE_WS_TYPE_ID(KMWsDrawableSourceProvider)
+public:
+	/**
+	 Create a source object for future drawing of the drawable resource with the specified ID.
+	 @param aDrawableId The ID of the drawable resource.
+	 @param aSource On output, a pointer to the new source object associated with the drawable resource,
+	                which must be passed in calls to DrawResource() and CloseDrawableSource().
+	      	        After the call to CloseDrawableSource() the source object is destroyed and this pointer becomes invalid.
+	      	        The type of the source object is defined by the implementation of MWsDrawableSourceProvider.
+	 @post If successful, a new source object is created and the associated drawable resource is ready to use.
+	 @return KErrNone if successful, otherwise one of the system-wide error codes.
+	 */
+	virtual TInt CreateDrawableSource(const TSgDrawableId& aDrawableId, TAny*& aSource) = 0;
+
+	/**
+	 Destroy a source object associated with a drawable resource.
+	 @param aSource A pointer to a source object created by a previous call to CreateDrawableSource().
+	 @post Drawing of the associated drawable resource is no longer possible.
+	 @return KErrNone if successful, otherwise one of the system-wide error codes.
+	 */
+	virtual void CloseDrawableSource(TAny* aSource) = 0;
+
+	/**
+	 Draw a graphics resource.
+	 @param aSource A pointer to the source object associated with the drawable resource.
+	 @param aPos Destination position for the top-left corner of the drawable resource.
+	 @param	aRotation Rotation to be applied to the drawable resource before it is drawn.
+	 @pre A source object must have been created for the drawable resource by a previous call to CreateDrawableSource().
+	 */
+	virtual void DrawResource(const TAny* aSource, const TPoint& aPos, CWindowGc::TGraphicsRotation aRotation = CWindowGc::EGraphicsRotationNone) = 0;
+
+	/**
+	 Draw a graphics resource.
+	 @param aSource A pointer to the source object associated with the drawable resource.
+	 @param aRect Destination rectangle. The drawable resource could be scaled if its size doesn't match the destination rectangle.
+	 @param	aRotation Rotation to be applied to the drawable resource before it is drawn.
+	 @pre A source object must have been created for the drawable resource by a previous call to CreateDrawableSource().
+	 */
+	virtual void DrawResource(const TAny* aSource, const TRect& aRect, CWindowGc::TGraphicsRotation aRotation = CWindowGc::EGraphicsRotationNone) = 0;
+
+	/**
+	 Draw a graphics resource.
+	 @param aSource A pointer to the source object associated with the drawable resource.
+	 @param aRectDest Destination rectangle. The drawable resource could be scaled if its size doesn't match the destination rectangle.
+	 @param aRectSrc A rectangle defining the piece of the drawable resource to be drawn, in the co-ordinate system of the drawable resource.
+	 @param	aRotation Rotation to be applied to the drawable resource before it is drawn.
+	 @pre A source object must have been created for the drawable resource by a previous call to CreateDrawableSource().
+	 */
+	virtual void DrawResource(const TAny* aSource, const TRect& aRectDest, const TRect& aRectSrc, CWindowGc::TGraphicsRotation aRotation = CWindowGc::EGraphicsRotationNone) = 0;
+
+	/**
+	 Draw a graphics resource.
+	 @param aSource A pointer to the source object associated with the drawable resource.
+	 @param aRect Destination rectangle. The drawable resource could be scaled if its size doesn't match the destination rectangle.
+	 @param	aParam Parameters specifying how to draw the drawable resource.
+	 @pre A source object must have been created for the drawable resource by a previous call to CreateDrawableSource().
+	 */
+	virtual void DrawResource(const TAny* aSource, const TRect& aRect, const TDesC8& aParam) = 0;
+	};
+
+#endif //__WSDRAWABLESOURCEPROVIDER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/wsdrawresource.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,161 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @publishedPartner
+ @prototype
+*/
+
+#ifndef __WSDRAWRESOURCE_H__
+#define __WSDRAWRESOURCE_H__
+
+#include <w32std.h>
+#include <graphics/sgresource.h>
+
+class RWsDrawableSource;
+
+/**
+The UID for MWsDrawResource.
+@see MWsDrawResource
+@see CWindowGc::Interface
+@publishedPartner
+@prototype
+*/
+static const TUid KMWsDrawResourceInterfaceUid = { 0x102864E9 };
+
+/**
+An extension interface for CWindowGc and CRemoteGc to draw RWsDrawableSources.
+
+Usage:
+@code
+MWsDrawResource* gcDrawResource = static_cast<MWsDrawResource*>(gc->Interface(KMWsDrawResourceInterfaceUid));
+if(gcDrawResource)
+	{
+	gcDrawResource->DrawResource(TPoint(5,5), drawableSource);
+	}
+@endcode
+@see RWsDrawableSource
+@see CWindowGc::Interface
+@publishedPartner
+@prototype
+*/
+class MWsDrawResource
+	{
+public:
+	/**
+	Draws an image based resource which may be generated using non-native rendering API such as OpenGL ES 
+	or OpenVG. The resource will be drawn at the specified position in its original size with orientation 
+	according to the specified rotation parameter. The current clipping region applies. 
+
+	@see RWsDrawableSource
+
+	@param	aPos		The position of the top-left corner on a window.
+	@param	aSource		The resource to be drawn.
+	@param	aRotation	The rotation to be applied to the resource before it is drawn. The default value is CWindowGc::EGraphicsRotationNone.
+
+	@pre	Drawing context has been activated on a window. The drawable source has been created.
+	@post	Request to draw resource has been accepted. There is no guarantee that the request has been completed 
+			when this method returns.
+	*/
+	virtual void DrawResource(const TPoint& aPos, const RWsDrawableSource& aSource, CWindowGc::TGraphicsRotation aRotation=CWindowGc::EGraphicsRotationNone) = 0;
+
+	/**
+	Draws an image based resource. The resource will be rendered to the given destination rectangle on 
+	the window in its original dimensions with orientation according to the specified rotation parameter. 
+	Drawing will be clipped to the given destination rectangle. The current clipping region applies. The resource can be
+	drawn rotated using the CWindowGc::TGraphicsRotation enum which defines possible rotation values in 
+	clockwise degrees.
+
+	@see RWsDrawableSource
+
+	@param	aDestRect	Destination rectangle to which the resource will be rendered.
+	@param	aSource		The resource to be drawn.
+	@param	aRotation	The rotation to be applied to the resource before it is drawn. The default value is CWindowGc::EGraphicsRotationNone.
+
+	@pre	Drawing context has been activated on a window. The drawable source has been created.
+	@post	Request to draw resource has been accepted. There is no guarantee that the request has been completed 
+			when this method returns.
+	*/
+	virtual void DrawResource(const TRect& aDestRect, const RWsDrawableSource& aSource, CWindowGc::TGraphicsRotation aRotation=CWindowGc::EGraphicsRotationNone) = 0;
+
+	/**
+	Draws an image based resource. The resource is rendered into the given destination rectangle on a window.
+	Scaling (stretching or compression) applies if the destination rectangle is different from the
+	source rectangle. The resource orientation is set based on the specified rotation parameter
+	before scaling and drawing operations are performed.
+
+	@see RWsDrawableSource
+
+	@param	aDestRect	The destination rectangle to which the resource will be rendered on a window.
+	@param	aSource		The resource to draw.
+	@param	aSrcRect	The source rectangle specifying the area/sub-area of the resource to be rendered.
+	@param	aRotation	Rotation to be applied to the resource before it is drawn. The default value is CWindowGc::EGraphicsRotationNone.
+
+	@pre	Drawing context has been activated on a window. The drawable source has been created.
+	@post	Request to draw an image based resource has been accepted. There is no guarantee that the
+			request has been completed when this method returns.
+	*/
+	virtual void DrawResource(const TRect& aDestRect, const RWsDrawableSource& aSource, const TRect& aSrcRect, CWindowGc::TGraphicsRotation aRotation=CWindowGc::EGraphicsRotationNone) = 0;
+
+	/**
+	Draws a non-image based resource. The resource will be rendered into the given destination rectangle on a window.
+	The current clipping region applies. The adaptation is free to interpret the parameter aParam and may define
+	its own rules on how to handle the rendering of a non-image based resource.
+
+	@see RWsDrawableSource
+
+	@param	aDestRect	The destination rectangle to which the resource will be rendered on a window.
+	@param	aSource		The resource.
+	@param	aParam		Parameters specifying how to draw the resource. 
+
+	@pre	Drawing context has been activated on a window. The drawable source has been created.
+	@post	Request to draw a non-image based resource has been accepted. 
+			There is no guarantee that the request has been completed when this method returns.
+	*/
+	virtual void DrawResource(const TRect& aDestRect, const RWsDrawableSource& aSource, const TDesC8& aParam) = 0;
+	};
+
+
+/**
+The intention of this class is to enable drawing of drawables (RSgDrawable and RSgImage)
+using CWindowGc and CRemoteGc.
+
+You have to use the extension interface MWsDrawResource in order to use this class with
+CWindowGc and CRemoteGc.
+
+@publishedPartner
+@prototype
+@see RSgDrawable
+@see RSgImage
+@see MWsDrawResource
+*/
+class RWsDrawableSource : public MWsClientClass
+	{
+public:
+	IMPORT_C RWsDrawableSource();
+	IMPORT_C RWsDrawableSource(RWsSession& aWs);
+	IMPORT_C TInt Create(const RSgDrawable& aDrawable);
+	IMPORT_C TInt Create(const RSgDrawable& aDrawable, TInt aScreenNumber);
+	IMPORT_C const TSgDrawableId& DrawableId() const;
+	IMPORT_C TInt ScreenNumber() const;
+	IMPORT_C void Close();
+private:
+	TSgDrawableId iDrawableId;
+	TInt iScreenNumber;
+	TInt iReserved; // reserved for use by Symbian
+	};
+
+#endif //__WSDRAWRESOURCE_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/wsgraphicdrawerinternal.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,89 @@
+// Copyright (c) 1994-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 GRAPHICDRAWER_INTERNAL_H
+#define GRAPHICDRAWER_INTERNAL_H
+
+class MWsAnimationScheduler: public MWsObjectProvider
+/** A system mechanism for customising the animation timer to a particular hardware variant or to a
+	particular external compositor e.g. an out-of-scene transition engine.
+	The default animation scheduler in WSERV does not understand device-dependant parameters e.g.
+	screen refresh rates
+	@internalComponent
+	@released
+*/	{
+public:
+	/** Called to schedule an animation event for a screen to occur not before some point
+	A screen may be scheduled to animate several times without actually receiving an animation event from the scheduler
+	If the scheduler cannot honour the request e.g. device constraints, it ignores the request.
+	@param aScreen the screen to recieve the event
+	@param aWhen the point in time the event need not occur before
+	*/
+	virtual void ScheduleAnimation(MWsScreen& aScreen,const TTime& aWhen) = 0;
+	/** Called if a screen determines that it no longer needs to schedule any animation
+	@param aScreen the screen not needing to receive any animation events
+	*/
+	virtual void UnscheduleAnimation(MWsScreen& aScreen) = 0;
+	/** Called to schedule the redrawing of all screens containing this graphic.
+	The redrawing of affected screens can be deferred by the scheduler.
+	@param aId the ID of the graphic to be redrawn.  The graphic itself need not exist
+		(e.g. it has just been deleted, hence the need to redraw all potentially affected screens). */
+	virtual void Invalidate(const TGraphicDrawerId& aId) = 0;
+	/** Called when the Window Server receives a TRawEvent::EInactive  event, to signal power-saving */
+	virtual void OnInactive() = 0;
+	/** Called when the Window Server receives a TRawEvent::EActive event, to signal screen back on */
+	virtual void OnActive() = 0;
+
+	/** Called to schedule a redraw for a screen which is out of date
+	A screen may be scheduled to redraw several times without actually receiving aredraw event from the scheduler
+	If this request is ignored then the screen will be draw incorrectly untill a such a request is not ignored.
+	@param aScreen the screen to recieve the event
+	@param aWhen the point in time the event need not occur before
+	*/
+	virtual void ScheduleRedraw(MWsScreen& aScreen,const TTime& aWhen) = 0;
+	/** Called to force a previously scheduled redraw for a screen to happen immediately.
+	Used when we are about to loose our ability to perform the redraw correctly.
+	@param aScreen the screen to recieve the event
+	*/
+	virtual void DoRedrawNow(MWsScreen& aScreen) = 0;
+	
+	/** Interface to be implemented by callers of the asynchronous overload of 
+	DoRedrawNow, which takes a reference to this interface as argument to be able 
+	to give a callback once the screen update has been completed.
+	*/
+	class MScreenUpdateObserver 
+		{
+	public:
+		/** Callback when an asynchronous DoRedrawNow has been completed. */
+		virtual void ScreenUpdateComplete(TInt aResult) = 0;
+		};
+	
+	/** Called to force a previously scheduled redraw for a screen to happen immediately. 
+	@param aScreen the screen to recieve the event
+	@param aObserver reference which will receive a notification when the screen has been updated
+	*/
+	virtual void DoRedrawNow(MWsScreen& aScreen, MScreenUpdateObserver& aObserver) = 0;
+	
+	/** Callback to use if aObserver gets deleted before screen update takes place. */
+	virtual void ClearScreenUpdateObserver(const MScreenUpdateObserver& aObserver) = 0;
+
+protected:
+	IMPORT_C void Animate(MWsScreen& aScreen);
+	IMPORT_C void Animate(MWsScreen& aScreen, TRequestStatus* aFinished);
+	IMPORT_C void Redraw(MWsScreen& aScreen);
+	IMPORT_C TBool RedrawInvalid(MWsScreen& aScreen,const TArray<TGraphicDrawerId>& aInvalid);
+	};
+	
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/wsgraphicscontext.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,297 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Interface for Render Stage Abstract Graphics Context
+// 
+//
+
+/**
+ @publishedPartner
+ @prototype
+*/
+
+#ifndef __WSGRAPHICSCONTEXT_H__
+#define __WSGRAPHICSCONTEXT_H__
+
+#include <w32std.h>
+#include <graphics/wsgraphicdrawerinterface.h>
+
+/** Render Stage abstract graphics context.
+
+This interface is provided by Render Stages.  It abstracts the graphics context
+of the pixel target.  The intention is to allow Render Stages to intercept
+draw operations so that they can be batched (to reduce flickering), modified
+(to provide transition effects), or re-directed (to alternate back-end
+architectures).
+
+@publishedPartner
+@prototype
+*/
+class MWsGraphicsContext : public MWsObjectProvider
+	{
+public:
+	DECLARE_WS_TYPE_ID(KMWsGraphicsContext)
+	/** Text alignment.
+	@publishedPartner
+	@prototype
+	*/
+	enum TTextAlign
+		{
+		/** Text is left-aligned. */
+		ELeft,
+		/** Text is centred. */
+		ECenter,
+		/** Text is right-aligned. */
+		ERight
+		};
+
+	/** 
+	Brush styles. 
+	@publishedPartner
+	@prototype
+	*/
+	enum TBrushStyle
+		{
+		/** The brush fill has no effect (default). */
+		ENullBrush,
+		/** The brush fills with a solid single colour, determined by 
+		SetBrushColor() and the drawing mode. */
+		ESolidBrush,
+		/** The brush fills with a selected bitmap pattern, set by 
+		UseBrushPattern(). */
+		EPatternedBrush,
+		/** The brush fills with vertical hatching  lines going from top to 
+		bottom. */
+		EVerticalHatchBrush,
+		/** The brush fills with diagonal hatching lines going from bottom 
+		left to top right. */
+		EForwardDiagonalHatchBrush,
+		/** The brush fills with horizontal hatching lines going from left 
+		to right. */
+		EHorizontalHatchBrush,
+		/** The brush fills with rearward diagonal hatching lines going from top 
+		left to bottom right. */
+		ERearwardDiagonalHatchBrush,
+		/** The brush fills with horizontal and vertical hatching  lines going 
+		from left to right plus lines going from top to bottom  giving the 
+		effect of a grid of small squares */
+		ESquareCrossHatchBrush,
+		/** The brush fills with forward diagonal and rearward diagonal hatching 
+		lines going from bottom left to top right plus lines going from top left 
+		to bottom right giving the effect of a grid of small diamonds. */
+		EDiamondCrossHatchBrush
+		};
+
+	/** 
+	Drawing modes. The drawing modes define the way that the pen and brush colors are
+	drawn, EDrawModePEN means do alpha blending if appropriate, EDrawModeWriteAlpha means 
+	don't do alpha blending.
+
+	@see SetDrawMode()
+	@publishedPartner
+	@prototype
+	*/
+	enum TDrawMode
+		{		
+		/** Uses both pen and brush colour as they are. */
+		EDrawModePEN=32,		
+		/** Writes alpha information in the source directly into the destination, rather than blending. */
+		EDrawModeWriteAlpha=64
+		};
+
+	/** 
+	Pen styles. The screen pattern unit in each definition below describes the 
+	pattern drawn by the line 1 represents a pixel drawn, 0 represents a 
+	pixel that is not affected. 
+	@publishedPartner
+	@prototype
+	*/
+	enum TPenStyle
+		{
+		/** The pen does not draw. Screen pattern unit = 00... */
+		ENullPen,
+		/** A solid line (default). Screen pattern unit = 11... */
+		ESolidPen,
+		/** A dotted line. Screen pattern unit = 1000... */
+		EDottedPen,
+		/** A dashed line. Screen pattern unit = 111000... */
+		EDashedPen,
+		/** A line of alternating dashes and dots. Screen pattern unit = 
+		1111001100... */
+		EDotDashPen,
+		/** A line of alternating single dashes and pairs of dots. Screen 
+		pattern unit = 11110011001100... */
+		EDotDotDashPen
+		};
+
+	/** 
+	Rules used to fill self-intersecting polygons. 
+
+	The filling of a polygon proceeds as follows: for a given point in the 
+	polygon, then:
+
+	if the rule is TFillRule::EAlternate (default) and it has an odd winding 
+	number, then fill the surrounding area.
+
+	if the rule is TFillRule::EWinding and it has a winding number greater than 
+	zero, then fill the surrounding area. 
+	@publishedPartner
+	@prototype
+	*/
+	enum TFillRule
+		{
+		/** Only fill areas with odd winding numbers. */
+		EAlternate,
+		/** Fill areas with winding numbers greater than zero. */
+		EWinding
+		};
+
+	/**
+	Font underline flags. 
+	@publishedPartner
+	@prototype
+	*/
+	enum TFontUnderline
+		{
+		/** Font is not underlined. */
+		EUnderlineOff,
+		/** Font is underlined. */
+		EUnderlineOn
+		};
+
+	/**
+	Font strike-through flags. 
+	@publishedPartner
+	@prototype
+	*/
+	enum TFontStrikethrough
+		{
+		/** Font is not struck-through. */
+		EStrikethroughOff,
+		/** Font is struck-through. */
+		EStrikethroughOn
+		};
+
+	/**
+	Parameters used in drawing text within supplied context.
+	It is used by MWsGraphicsContext::DrawText() and MWsGraphicsContext::DrawTextVertical() family of API's
+	to draw text from iStart to iEnd withing the supplied text descriptor.
+	
+	@publishedPartner
+	@prototype
+	*/
+	class TTextParameters
+		{
+	public:
+		TTextParameters():
+			iStart(0),
+			iEnd(KMaxTInt),
+			iFlags(0)
+				{
+				}
+		TInt iStart;
+		TInt iEnd;
+		TUint16 iFlags;
+		/* Reserved for future use */
+		TAny* iReserved1;
+		TAny* iReserved2;
+		TAny* iReserved3;
+		TAny* iReserved4;
+		};
+	
+public:
+	// The following are equivalent to CFbsBitGc functionality which maps 
+	// to client’s CWindowGc requests
+	virtual void BitBlt(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap) = 0;
+	virtual void BitBlt(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap,	const TRect& aSourceRect) = 0;
+	virtual void BitBltMasked(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect, const CFbsBitmap& aMaskBitmap, TBool aInvertMask) = 0;
+	virtual void BitBltMasked(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect, const CFbsBitmap& aMaskBitmap, const TPoint& aMaskPos) = 0;
+	virtual void ResetClippingRegion() = 0;
+	virtual void Clear() = 0;
+	virtual void Clear(const TRect& aRect) = 0;
+	virtual void ResetBrushPattern() = 0;
+	virtual void ResetFont() = 0;
+	virtual void DrawArc(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd) = 0;
+	virtual void DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd) = 0;
+	virtual void DrawBitmap(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap) = 0;
+	virtual void DrawBitmap(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect) = 0;
+	virtual void DrawBitmapMasked(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap,const TRect& aSourceRect, const CFbsBitmap& aMaskBitmap, TBool aInvertMask) = 0;
+	virtual void DrawRoundRect(const TRect& aRect, const TSize& aEllipse) = 0;
+	virtual void DrawPolyLine(const TArray<TPoint>& aPointList) = 0; 
+	virtual void DrawPolyLineNoEndPoint(const TArray<TPoint>& aPointList) = 0;  
+	virtual void DrawPolygon(const TArray<TPoint>& aPointList, TFillRule aFillRule=EAlternate) = 0;
+	virtual void DrawEllipse(const TRect& aRect) = 0;
+	virtual void DrawLine(const TPoint& aStart, const TPoint& aEnd) = 0;
+	virtual void DrawLineTo(const TPoint& aPoint) = 0;
+	virtual void DrawLineBy(const TPoint& aVector) = 0;
+	virtual void DrawRect(const TRect& aRect) = 0;
+	virtual void DrawText(const TDesC& aText,const TTextParameters* aParam) = 0;
+	virtual void DrawText(const TDesC& aText,const TTextParameters* aParam,const TPoint& aPosition) = 0;
+	virtual void DrawText(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect) = 0;
+	virtual void DrawText(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipFillRect,TInt aBaselineOffset,TTextAlign aHrz=ELeft,TInt aMargin=0) = 0;
+	virtual void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,TBool aUp) = 0;
+	virtual void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TPoint& aPosition,TBool aUp) = 0;
+	virtual void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect,TBool aUp) = 0;
+	virtual void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0) = 0;
+	virtual void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect,TInt aBaselineOffset,TInt aTextWidth,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0) = 0;
+	virtual void MoveTo(const TPoint& aPoint) = 0;
+	virtual void MoveBy(const TPoint& aVector) = 0;
+	virtual void Plot(const TPoint& aPoint) = 0;
+	virtual void Reset() = 0;
+	virtual void SetBrushColor(const TRgb& aColor) = 0;
+	virtual void SetBrushOrigin(const TPoint& aOrigin) = 0;
+	virtual void SetBrushStyle(TBrushStyle aBrushStyle) = 0;
+	virtual void SetClippingRegion(const TRegion& aRegion) = 0;
+	virtual void SetDrawMode(TDrawMode aDrawMode) = 0;
+	virtual void SetOrigin(const TPoint& aPoint = TPoint(0, 0)) = 0;
+	virtual void SetPenColor(const TRgb& aColor) = 0;
+	virtual void SetPenStyle(TPenStyle aPenStyle) = 0;
+	virtual void SetPenSize(const TSize& aSize) = 0;
+	virtual void SetTextShadowColor(const TRgb& aColor) = 0;
+	virtual void SetCharJustification(TInt aExcessWidth, TInt aNumChars) = 0;
+	virtual void SetWordJustification(TInt aExcessWidth, TInt aNumGaps) = 0;
+	virtual void SetUnderlineStyle(TFontUnderline aUnderlineStyle) = 0;
+	virtual void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle) = 0;
+	virtual void SetBrushPattern(const CFbsBitmap& aBitmap) = 0;
+	virtual void SetBrushPattern(TInt aFbsBitmapHandle) = 0;
+	virtual void SetFont(const CFont* aFont) = 0;
+	
+	// CFbsBitGc functionality used by Wserv for its internal operations
+	virtual void CopyRect(const TPoint& aOffset, const TRect& aRect) = 0;
+	virtual void UpdateJustification(const TDesC& aText,const TTextParameters* aParam) = 0;
+	virtual void UpdateJustificationVertical(const TDesC& aText,const TTextParameters* aParam,TBool aUp) = 0;
+	virtual void SetFontNoDuplicate(const CFont* aFont) = 0;
+	virtual TBool HasBrushPattern() const = 0;
+	virtual TBool HasFont() const = 0;
+	virtual TRgb BrushColor() const = 0;
+	virtual TRgb PenColor() const = 0;
+	virtual TRgb TextShadowColor() const = 0;
+	
+	// Return current error status of MWsGraphicsContext
+	virtual TInt GetError() = 0;
+	
+	/** The origin of the GC relative to the screen's origin
+		@return the origin */
+	virtual TPoint Origin() const = 0;
+	/** The clipping region currently being used
+		@return the clipping region */
+	virtual const TRegion& ClippingRegion() = 0;
+	/** Saves the state of the GC to an internal buffer.  Several GC states can be saved in a FILO.
+		Do not restore a GC (using Pop()) that wasn't properly saved!
+		@return KErrNone if successful, else one of the system-wide error codes. */
+	virtual TInt Push() = 0;
+	/** Restores the last GC state that was saved. */
+	virtual void Pop() = 0;
+	};
+
+#endif	//__WSGRAPHICSCONTEXT_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/wskeyrouter.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,216 @@
+// Copyright (c) 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:
+// Key Event Routing Plug-in API
+
+/**
+@file
+@publishedPartner
+@prototype
+*/
+
+#ifndef WSKEYROUTER_H
+#define WSKEYROUTER_H
+
+#include <e32base.h>
+#include <w32std.h>
+
+/**
+Interface Uid
+*/
+const TUid KKeyRouterPluginUid = { 0x102872e1 };
+
+/**
+Key Capture Type
+*/
+enum TKeyCaptureType
+	{
+	ECaptureTypeKey = 0,
+	ECaptureTypeLongKey = 1,
+	ECaptureTypeKeyUpDown = 2
+	};
+
+/**
+Key Capture Request
+*/
+struct TKeyCaptureRequest
+	{
+	/** Capture type */
+	TKeyCaptureType	iType;
+
+	/** Keycode or scancode to be captured */
+	TUint			iInputCode;
+
+	/** Output keycode or scancode. When iInputCode is captured, RouteKey()
+		places iOutputCode in TKeyEventRouterOutput.iKeyEvent */
+	TUint			iOutputCode;
+
+	/** Bitmask of modifier keys of interest. Key events are captured only
+		when the modifier keys specified by iModifierMask are in the states
+		specified by iModifiers */
+	TUint			iModifierMask;
+
+	/** Bitmask of modifier key states */
+	TUint			iModifiers;
+
+	/** Opaque handle for this request */
+	TAny*			iHandle;
+
+	/** Opaque handle to window group through which request was made */
+	TAny*			iWindowGroup;
+
+	/** Identifier of the window group through which request was made */
+	TInt			iWindowGroupId;
+
+	/** UID of application that made the capture request */
+	TUid			iAppUid;
+
+	/** Capture priority for this request. If more than one window group has
+		requested capture for the same key event, the one with the highest
+		priority will capture it (unless overridden by application specific
+		rules). */
+	TInt			iPriority;
+
+	/** Reserved for future use */
+	TInt			iReserved[2];
+	};
+
+/**
+Input parameters for RouteKey()
+*/
+struct TKeyEventRouterInput
+	{
+	inline TKeyEventRouterInput(TKeyCaptureType aType, const TKeyEvent& aKeyEvent, TAny* aFocusWindowGroup, TUid aFocusAppUid);
+
+	/** Capture type */
+	TKeyCaptureType		iType;
+
+	/** Input key event */
+	TKeyEvent			iKeyEvent;
+
+	/** Opaque handle to current focussed window group */
+	TAny*				iFocusWindowGroup;
+
+	/** UID of client application with current focussed window group */
+	TUid				iFocusAppUid;
+
+	/** Reserved for future use */
+	TInt				iReserved[2];
+	};
+
+/**
+Result codes for RouteKey()
+*/
+enum TKeyEventRouterResult
+	{
+	/** Key routed, no capture */
+	ERouted = 0,
+
+	/** Key captured and routed */
+	ECaptured = 1,
+
+	/** Key consumed, do not deliver event */
+	EConsumed = 2
+	};
+
+/**
+Output parameters for RouteKey()
+*/
+struct TKeyEventRouterOutput
+	{
+	/** Result code */
+	TKeyEventRouterResult	iResult;
+
+	/** Output key event as translated by plug-in. Key code may be set by
+		RWindowGroup::CaptureLongKey() via TKeyCaptureRequest.iOutputCode **/
+	TKeyEvent				iKeyEvent;
+
+	/** Opaque handle to destination window group or NULL if captured by WServ
+		(hotkey). Plug-in must set this to either the window group from the
+		matching capture request or to TKeyEventRouterInput.iFocusWindowGroup */
+	TAny*					iWindowGroup;
+
+	/** Opaque handle from matching capture request or NULL if none */
+	TAny*					iCaptureHandle;
+
+	/** Reserved for future use */
+	TInt					iReserved[2];
+	};
+
+/**
+Key Event Router Interface
+
+This class is implemented by a plug-in DLL in order to perform customised
+routing of window server key events.
+
+The Key Event Routing plug-in is a polymorphic DLL that implements the
+CKeyEventRouter interface. Its UID1 and UID2 must be KDynamicLibraryUid and
+KKeyRouterPluginUid respectively. UID3 identifies a particular implementation
+of the plug-in. The first and only exported function should create and return
+an object of the CKeyEventRouter sub-class.
+*/
+class CKeyEventRouter : public CBase
+	{
+public:
+	/**
+	Create and return an instance of CKeyEventRouter
+
+	@return	Pointer to new router instance
+	*/
+	IMPORT_C static CKeyEventRouter* NewL();
+
+	/**
+	Add a new key capture request
+
+	@param	aRequest	Capture request details
+	*/
+	virtual void AddCaptureKeyL(const TKeyCaptureRequest& aRequest) = 0;
+	   
+	/**
+	Update an existing key capture request
+
+	@param	aRequest	Updated capture request details
+	*/
+	virtual void UpdateCaptureKeyL(const TKeyCaptureRequest& aRequest) = 0;
+
+	/**
+	Cancel a key capture request
+
+	@param	aType		Capture type
+	@param	aHandle		Opaque handle of request to be cancelled
+	*/
+	virtual void CancelCaptureKey(TKeyCaptureType aType, TAny* aHandle) = 0;
+
+	/**
+	Route the key event described by aInput and return its destination
+	in iOutput.
+
+	@param	aInput		Input data with key event to be routed
+	@param	aOutput		Output key event and routing results
+	*/
+	virtual void RouteKey(const TKeyEventRouterInput& aInput,
+						  TKeyEventRouterOutput& aOutput) = 0;
+
+	/**
+	Reserved for future use
+	*/
+private:
+	virtual void Reserved1() {};
+	virtual void Reserved2() {};
+	};
+
+inline TKeyEventRouterInput::TKeyEventRouterInput(TKeyCaptureType aType, const TKeyEvent& aKeyEvent, TAny* aFocusWindowGroup, TUid aFocusAppUid) : iType(aType), iKeyEvent(aKeyEvent), iFocusWindowGroup(aFocusWindowGroup), iFocusAppUid(aFocusAppUid)
+	{
+	}
+
+#endif // WSKEYROUTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/wsscreendevice.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,79 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Interface for Render Stage Screen Abstraction
+// 
+//
+
+/**
+ @publishedPartner
+ @prototype
+*/
+
+#ifndef WSSCREENDEVICE_H
+#define WSSCREENDEVICE_H
+
+#include <w32std.h>
+#include <graphics/wsgraphicdrawerinterface.h>
+
+/** Render Stage Palette support.
+
+This interface is intended to be optionally provided by a Render Stage
+when the pixel target can provide a Colour Palette.  Not all pixel targets have
+this feature, for example OpenVG only targets.
+@publishedPartner
+@prototype
+*/
+class MWsPalette : public MWsObjectProvider
+	{
+public:
+	DECLARE_WS_TYPE_ID(KMWsPalette)
+	virtual void PaletteAttributes(TBool& aModifiable,TInt& aNumEntries) const = 0;
+	virtual TInt GetPalette(CPalette*& aPalette) const = 0;
+	virtual TInt SetCustomPalette(const CPalette* aPalette) = 0;
+	};
+
+
+/** Render Stage Screen Device abstraction.
+
+Render Stages provide this interface as an abstraction of the target screen.
+The screen may not be pixel based, in which case read back of pixel data may
+not be a reflection of what appears on the screen.  The screen might also only
+be partially readable, for example external video surfaces may be blanked out
+when a read back is done.  The intention of the CopyScreenToBitmap methods is
+to provide a means to obtain a snapshot of the entire screen for architectures
+where a composition of the screen can be done once followed by a read back
+of the entire screen, as opposed to servicing a sequence of GetScanLine calls
+which may be prohibitively expensive.
+
+@publishedPartner
+@prototype
+*/
+class MWsScreenDevice : public MWsObjectProvider
+	{
+public:
+	DECLARE_WS_TYPE_ID(KMWsScreenDevice)
+
+	virtual TInt ScreenNumber() const = 0;
+	virtual TDisplayMode DisplayMode() const = 0;
+	virtual TSize SizeInPixels() const = 0;
+	virtual TSize SizeInTwips() const = 0;
+	virtual TRect PointerRect() const = 0;
+	virtual void GetPixel(TRgb& aColor,const TPoint& aPixel) const = 0;
+	virtual void GetScanLine(TDes8& aScanLine,const TPoint& aStartPixel,TInt aPixelLength, TDisplayMode aDispMode) const = 0;
+	virtual TBool RectCompare(const TRect& aRect1, const TRect& aRect2) const = 0;
+	virtual void CopyScreenToBitmapL(CFbsBitmap* aBitmap, const TRect& aRect) const = 0;
+	virtual void ClearDisplay(TRgb aBackColor)=0;
+	};
+
+#endif // WSSCREENDEVICE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/wsscreendeviceutils.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,47 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// wsscreencapture.h
+// Interface for Render Stage Screen Capture Utils to be used by the render stage
+// 
+//
+
+#ifndef WSTESTSCREENDEVICEUTILS_H_
+#define WSTESTSCREENDEVICEUTILS_H_
+
+/**
+@file
+@publishedpartner 
+@released
+*/
+
+#include <graphics/wsgraphicdrawerinterface.h>
+
+class MWsScreenDeviceUtils : public MWsObjectProvider
+	{
+public:
+	enum	
+		{
+		KMWsScreenCaptureUtils =  0x10286505,	// registered GUID
+		ETypeId=				KMWsScreenCaptureUtils,
+		EWsObjectInterfaceId=	KMWsScreenCaptureUtils
+		};
+	virtual void PanicCurrentClient(TInt aPanic) = 0;
+	virtual void SetReply(TInt aReply) = 0;
+	virtual void RedrawNowIfPending() = 0;
+	virtual void ReplyBuf(const TAny* aSource, TInt aLength) = 0;
+	};
+
+#endif /*WSTESTSCREENDEVICEUTILS_H_*/
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/wstestscreencapture.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,46 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Interface for Render Stage Screen Capture Render Stage
+// 
+//
+
+#ifndef WSTESTSCREENCAPTURE_H_
+#define WSTESTSCREENCAPTURE_H_
+
+/**
+@file
+@publishedpartner 
+@released
+*/
+
+#include <graphics/wsgraphicdrawerinterface.h>
+#include <graphics/wsscreendeviceutils.h>
+
+class CScreen;
+class TWsSdComposeScreenCommand;
+class MWsTestScreenCapture : public MWsObjectProvider
+	{
+public:
+	enum	
+		{
+		KMWsScreenCapture =  0x10286503,	// registered GUID
+		ETypeId=				KMWsScreenCapture,
+		EWsObjectInterfaceId=	KMWsScreenCapture
+		};
+	virtual TInt TestScreenCaptureL(const TAny* aMessage, MWsScreenDeviceUtils& aUtils) =0;
+	};
+
+#endif /*WSTESTSCREENCAPTURE_H_*/
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/graphics/wsuibuffer.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,121 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef __WSUIBUFFER_H__
+#define __WSUIBUFFER_H__
+
+#include <pixelformats.h>
+#include <graphics/wsgraphicdrawerinterface.h>
+
+/**
+@file
+@publishedPartner
+@prototype 
+*/
+
+/**
+This class provides direct access to the memory of the UI buffer.
+
+This interface is to be used by CRPs that don't want to go through MWsGraphicsContext
+to handle their rendering, but want direct memory access.
+@publishedPartner
+@prototype
+*/
+class MWsUiBuffer: public MWsObjectProvider
+    {
+public:
+    DECLARE_WS_TYPE_ID(KMWsUiBufferInterfaceId)
+
+    /**
+    Finishes pending rendering to the buffer and temporarily makes the pixel 
+    data of the buffer image accessible for reading and writing by the CPU.
+    
+    When finished with the pixel data, the caller must end the mapping by
+    calling @c Unmap().
+
+    This method should only be called from the context of 
+    @c CWsGraphicDrawer::Draw().
+    @param aDataAddress On return, the base address of the pixel data in the
+    address space of the calling process
+    @param aDataStride On return, the number of bytes between rows of the
+    pixel data
+    @return KErrNone if successful, otherwise one of the standard Symbian
+    error codes
+    @see Unmap()
+    @publishedPartner
+    @prototype
+    */
+    virtual TInt MapReadWrite(TAny*& aDataAddress, TInt& aDataStride) = 0;
+    
+    /**
+    Finishes pending rendering to the buffer and temporarily makes the pixel 
+    data of the buffer image accessible for writing by the CPU.
+    
+    When finished with the pixel data, the caller must end the mapping by
+    calling @c Unmap().
+
+    This method should only be called from the context of 
+    @c CWsGraphicDrawer::Draw().
+    @param aDataAddress On return, the base address of the pixel data in the
+    address space of the calling process
+    @param aDataStride On return, the number of bytes between rows of the
+    pixel data
+    @return KErrNone if successful, otherwise one of the standard Symbian
+    error codes
+    @see Unmap()
+    @publishedPartner
+    @prototype
+    */
+    virtual TInt MapWriteOnly(TAny*& aDataAddress, TInt& aDataStride) = 0;
+        
+    /**
+    Makes the pixel data of an image no longer accessible to the CPU.
+
+    Before calling this method the buffer must be mapped for CPU access by
+    a previous call to @c MapReadWrite() or @c MapWriteOnly().
+
+    This method should only be called from the context of 
+    @c CWsGraphicDrawer::Draw().
+    @return KErrNone if successful, otherwise one of the standard Symbian
+    error codes
+    @see MapReadWrite()
+    @see MapWriteOnly()
+    @publishedPartner
+    @prototype
+    */
+    virtual TInt Unmap() = 0;
+
+    /**
+    Gets the pixel format of the buffer.
+    @return The pixel format of the buffer
+    @publishedPartner
+    @prototype
+    */
+    virtual TUidPixelFormat PixelFormat() const = 0;
+
+    /** 
+    Gets the current size of the buffer.
+
+    The actual size of the whole buffer might be larger than the returned
+    value depending on the current screen mode. However, it is the size
+    returned by this method that should be used when accessing the pixel data.
+    @return The current size of the buffer
+    @publishedPartner
+    @prototype
+    */
+    virtual TSize SizeInPixels() const = 0;
+    };
+
+#endif //__WSUiBUFFER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/wspublishandsubscribedata.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,47 @@
+// Copyright (c) 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:
+// Standard window server header file
+// 
+//
+#ifndef WSPUBLISHANDSUBSCRIBEDATA_H
+#define WSPUBLISHANDSUBSCRIBEDATA_H
+
+#include <e32cmn.h>
+
+// Values for the render orientation P&S value that we publish
+// Used when the property is defined, attached to, and deleted
+const TUid  KRenderOrientationCategory  = {268450592};  // WServ UID3
+const TUint KRenderOrientationKey       = 0x102872E5;
+
+/** The orientation of rendering the application intends to use.
+
+@see RWsSession::IndicateAppOrientation(TOrientation aOrientation)*/
+enum TRenderOrientation
+    {
+    /** Fixed default orientation */
+    EDisplayOrientationNormal,
+    /** 90° clockwise */
+    EDisplayOrientation90CW,
+    /** 180° */
+    EDisplayOrientation180,
+    /** 270° clockwise */
+    EDisplayOrientation270CW,
+    /** The orientation is from the P&S Key */
+    EDisplayOrientationAuto,
+    /** use the orientation specified by the next top level window(s) that does not have ignore flag set. 
+    E.g. system dialog on top of foreground app. */
+    EDisplayOrientationIgnore
+    };
+
+#endif // WSPUBLISHANDSUBSCRIBEDATA_H
--- a/windowing/windowserver/nga/CLIENT/RWINDOW.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/CLIENT/RWINDOW.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -1363,7 +1363,7 @@
 events from all detected pointers to this window.
 
 This method must be called before the window is activated by calling RWindowBase::Activate().
-Otherwise this will be ignored (release build), or panic (debug build). 
+Otherwise the client is panicked with the code EWservPanicUnableToEnableAdvPointer.
 
 If this method is not called for the window, it is assumed that the window is not
 able to receive events from multiple pointers, and thus only events from a single
@@ -2798,6 +2798,7 @@
 description above. 
 @param aPriority A priority value - if more than one window group has requested 
 capture for the same key event, the one with the highest priority will capture it.
+The value must be greater than KMinTInt.
 @return A handle identifying the capture key, or one of the system-wide error 
 codes (if <0). KErrPermissionDenied indicates that the requested key cannot be 
 captured by this window group, because it has been protected by another window group. 
@@ -2866,6 +2867,7 @@
 aModifierMask need to be set and which need to be unset. 
 @param aPriority A priority value - if more than one window group has requested 
 capture for the same key event, the one with the highest priority will capture it.
+The value must be greater than KMinTInt.
 @return A handle identifying the capture key, or one of the system-wide error 
 codes (if < 0). KErrPermissionDenied indicates that the requested key cannot be captured by this 
 window group, because it has been protected by another window group. For more information, see 
@@ -2937,6 +2939,7 @@
 not set. Modifier key states are defined in TEventModifier. 
 @param aPriority If more than one window group has requested capture for the 
 same long key event, the one with the highest priority will capture the event.
+The value must be greater than KMinTInt.
 @param aFlags Configures the long key capture behaviour. See the TLongCaptureFlags 
 enum.
 @return Identifying value for the long key capture. For use with the CancelCaptureLongKey() 
@@ -2972,6 +2975,7 @@
 not set. Modifier key states are defined in TEventModifier. 
 @param aPriority If more than one window group has requested capture for the 
 same long key event, the one with the highest priority will capture the event.
+The value must be greater than KMinTInt.
 @param aFlags Configures the long key capture behaviour. See the TLongCaptureFlags 
 enum.
 @return Identifying value for the long key capture. For use with the CancelCaptureLongKey() 
--- a/windowing/windowserver/nga/CLIENT/RWS.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/CLIENT/RWS.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -22,6 +22,7 @@
 #include "CLIENT.H"
 #include "graphics/windowserverconstants.h"
 #include "rtfxeffect.h"
+#include <wspublishandsubscribedata.h>
 
 const TInt KMaxWSERVMessagesSlot=-1;
 
@@ -2585,3 +2586,15 @@
 	RTFXEffect tfxEffect(iWsHandle, iBuffer);
 	tfxEffect.OverrideTFXEffect(RTFXEffect::ETFXSession, aAction, aPurpose, aResourceDir, aFilenameOutgoing, aFilenameIncoming, aFlags);
 	}
+
+EXPORT_C void RWsSession::IndicateAppOrientation(TRenderOrientation aOrientation)
+/**
+Application informs window server the orientation of rendering it intends to use
+
+@param aOrientation The orientation the application intends to use
+
+@publishedPartner
+*/
+	{
+	return(WriteInt(aOrientation,EWsClOpIndicateAppOrientation));
+	}
--- a/windowing/windowserver/nga/CLIENT/WSGRAPHIC.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/CLIENT/WSGRAPHIC.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -20,7 +20,7 @@
 #include "w32comm.h"
 #include "CLIENT.H"
 #include <s32mem.h>
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
 
 NONSHARABLE_STRUCT(CWsGraphic::CPimpl): public CBase, public MWsClientClass
 /** @internalComponent @released */
--- a/windowing/windowserver/nga/SERVER/CAPKEY.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/CAPKEY.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1995-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"
@@ -24,9 +24,6 @@
 _LIT(KWsProtectedKey, "PROTECTEDKEY");
 _LIT(KWsProtectedWindowName, "PROTECTEDKEYWINDOWNAME");
 
-TPriQue<CWsCaptureKeyUpsAndDowns> CWsCaptureKeyUpsAndDowns::iCaptureKeysUpsAndDowns(_FOFF(CWsCaptureKeyUpsAndDowns,iLink));
-TPriQue<CWsCaptureLongKey> CWsCaptureLongKey::iCaptureLongKeys(_FOFF(CWsCaptureLongKey,iLink));
-
 
 /*CWsCaptureKey*/
 
@@ -35,20 +32,38 @@
 
 CWsCaptureKey::~CWsCaptureKey()
 	{
-	TWindowServerEvent::CancelCaptureKey((TUint32)this);
+	TWindowServerEvent::CancelCaptureKey(ECaptureTypeKey, this);
 	}
 
-void CWsCaptureKey::CmdToParams(const TWsWinCmdCaptureKey &aCaptureKey, TCaptureKey &aParams)
+/**
+Convert a window server key capture command to a capture request for the
+key routing plug-in.
+
+@param	aCaptureKey		Input capture command
+@param	aRequest		Output capture request
+*/
+void CWsCaptureKey::CmdToRequest(const TWsWinCmdCaptureKey &aCaptureKey, TKeyCaptureRequest &aRequest)
 	{
-	aParams.iModifiers.iMask=aCaptureKey.modifierMask;
-	aParams.iModifiers.iValue=aCaptureKey.modifiers;
-	aParams.iKeyCodePattern.iKeyCode=(TInt16)aCaptureKey.key;
-	aParams.iKeyCodePattern.iPattern=EMatchKey;
-	aParams.iKeyCodePattern.iFiller=STATIC_CAST(TUint8,aCaptureKey.priority);
-	aParams.iApp=(TUint32)iWindowGroup;
-	aParams.iHandle=(TUint32)this;
+	aRequest.iType = ECaptureTypeKey;
+	aRequest.iModifierMask = aCaptureKey.modifierMask;
+	aRequest.iModifiers = aCaptureKey.modifiers;
+	aRequest.iInputCode = aCaptureKey.key;
+	aRequest.iOutputCode = aCaptureKey.key;
+	aRequest.iPriority = aCaptureKey.priority;
+	aRequest.iWindowGroup = iWindowGroup;
+	aRequest.iWindowGroupId = iWindowGroup ? iWindowGroup->Identifier() : 0;
+	aRequest.iAppUid = iWsOwner ? TUid::Uid(iWsOwner->SecureId().iId) : KNullUid;
+	aRequest.iHandle = this;
 	}
 
+/**
+Check for protected key in a capture command
+
+@param	aWindowGroup	Window Group of capture request
+@param	aCaptureKey		Key capture command
+
+@leave KErrPermissionDenied		Capture key is protected
+*/
 void CheckProtectedKeyL(CWsWindowGroup* aWindowGroup,const TWsWinCmdCaptureKey &aCaptureKey)
 	{
 	//The key specified in the WSINI file with the keyword: PROTECTEDKEY can only be captured 
@@ -56,7 +71,7 @@
 	TInt protectedKey;
 	if(WsIniFile->FindVar(KWsProtectedKey,protectedKey))
 		{
-		if (aCaptureKey.key == (TUint)protectedKey)
+		if (aCaptureKey.key == static_cast<TUint>(protectedKey))
 			{
 			if (aWindowGroup->GroupName()==NULL)
 				{
@@ -73,20 +88,36 @@
 		}
 	}
 
+/**
+Construct a capture object for normal key events and make a capture request
+to the key routing plug-in.
+
+@param	aCaptureKey		Key capture command from RWindowGroup::CaptureKey(),
+						RWsSession::SetHotKey() or default hot key settings.
+*/
 void CWsCaptureKey::ConstructL(const TWsWinCmdCaptureKey &aCaptureKey)
 	{
 	CheckProtectedKeyL(iWindowGroup, aCaptureKey);
 	NewObjL();
-	TCaptureKey params;
-	CmdToParams(aCaptureKey, params);
-	TWindowServerEvent::AddCaptureKeyL(params);
+
+	TKeyCaptureRequest request;
+	CmdToRequest(aCaptureKey, request);
+	TWindowServerEvent::AddCaptureKeyL(request);
 	}
 
+/**
+Make a capture request update for normal key events to the key routing plug-in.
+
+@param	aCaptureKey		Key capture command from CWsHotKey::SetL()
+
+Note: this function is used only to disable hot key capture requests or to
+reset them to their defaults.
+*/
 void CWsCaptureKey::SetL(const TWsWinCmdCaptureKey &aCaptureKey)
 	{
-	TCaptureKey params;
-	CmdToParams(aCaptureKey, params);
-	TWindowServerEvent::SetCaptureKey((TUint32)this, params);
+	TKeyCaptureRequest request;
+	CmdToRequest(aCaptureKey, request);
+	TWindowServerEvent::UpdateCaptureKeyL(request);
 	}
 
 void CWsCaptureKey::CommandL(TInt , const TAny *)
@@ -101,37 +132,39 @@
 
 CWsCaptureKeyUpsAndDowns::~CWsCaptureKeyUpsAndDowns()
 	{
-	iLink.Deque();
+	TWindowServerEvent::CancelCaptureKey(ECaptureTypeKeyUpDown, this);
 	}
 
+/**
+Construct a capture object for up/down key events and make a capture request
+to the key routing plug-in.
+
+@param	aCaptureKey		Key capture command from
+						RWindowGroup::CaptureKeyUpAndDowns().
+*/
 void CWsCaptureKeyUpsAndDowns::ConstructL(const TWsWinCmdCaptureKey &aCaptureKey)
 	{
 	CheckProtectedKeyL(iWindowGroup, aCaptureKey);
 	NewObjL();
-	iModifierMask=aCaptureKey.modifierMask;
-	iModifierValue=aCaptureKey.modifiers;
-	iScanCode=aCaptureKey.key;
-	iLink.iPriority=aCaptureKey.priority + 1;
-	iCaptureKeysUpsAndDowns.Add(*this);
-	--iLink.iPriority;
+
+	TKeyCaptureRequest request;
+	request.iType = ECaptureTypeKeyUpDown;
+	request.iInputCode = aCaptureKey.key;
+	request.iOutputCode = aCaptureKey.key;
+	request.iModifiers = aCaptureKey.modifiers;
+	request.iModifierMask = aCaptureKey.modifierMask;
+	request.iPriority = aCaptureKey.priority;
+	request.iWindowGroup = iWindowGroup;
+	request.iWindowGroupId = iWindowGroup ? iWindowGroup->Identifier() : 0;
+	request.iAppUid = iWsOwner ? TUid::Uid(iWsOwner->SecureId().iId) : KNullUid;
+	request.iHandle = this;
+	TWindowServerEvent::AddCaptureKeyL(request);
 	}
 
 void CWsCaptureKeyUpsAndDowns::CommandL(TInt , const TAny *)
 	{
 	}
 
-CWsWindowGroup *CWsCaptureKeyUpsAndDowns::CheckForCapture(TUint aScanCode, TUint aModifiers)
-	{
-	TDblQueIter<CWsCaptureKeyUpsAndDowns> iter(iCaptureKeysUpsAndDowns);
-	CWsCaptureKeyUpsAndDowns* cap;
-	while ((cap=iter++)!=NULL)
-		{
-		if (cap->iScanCode==aScanCode && (aModifiers&cap->iModifierMask)==cap->iModifierValue)
-			return(cap->iWindowGroup);
-		}
-	return NULL;
-	}
-
 
 /*CWsCaptureLongKey*/
 
@@ -141,35 +174,40 @@
 
 CWsCaptureLongKey::~CWsCaptureLongKey()
 	{
-	iLink.Deque();
+	TWindowServerEvent::CancelCaptureKey(ECaptureTypeLongKey, this);
 	}
 
+/**
+Construct a capture object for long key events and make a capture request
+to the key routing plug-in.
+
+@param	aCaptureKey		Key capture command from RWindowGroup::CaptureLongKey()
+*/
 void CWsCaptureLongKey::ConstructL(const TWsWinCmdCaptureLongKey &aCaptureKey)
 	{
 	NewObjL();
-	iData=aCaptureKey;
-	if (iData.delay.Int()<0)
+	iFlags = aCaptureKey.flags;
+	iDelay = aCaptureKey.delay;
+	if (iDelay.Int() < 0)
 		{
 		TTimeIntervalMicroSeconds32 time;
-		CKeyboardRepeat::GetRepeatTime(iData.delay,time);
+		CKeyboardRepeat::GetRepeatTime(iDelay, time);
 		}
-	iLink.iPriority=iData.priority + 1;
-	iCaptureLongKeys.Add(*this);
-	--iLink.iPriority;
+
+	TKeyCaptureRequest request;
+	request.iType = ECaptureTypeLongKey;
+	request.iInputCode = aCaptureKey.inputKey;
+	request.iOutputCode = aCaptureKey.outputKey;
+	request.iModifiers = aCaptureKey.modifiers;
+	request.iModifierMask = aCaptureKey.modifierMask;
+	request.iPriority = aCaptureKey.priority;
+	request.iWindowGroup = iWindowGroup;
+	request.iWindowGroupId = iWindowGroup ? iWindowGroup->Identifier() : 0;
+	request.iAppUid = iWsOwner ? TUid::Uid(iWsOwner->SecureId().iId) : KNullUid;
+	request.iHandle = this;
+	TWindowServerEvent::AddCaptureKeyL(request);
 	}
 
 void CWsCaptureLongKey::CommandL(TInt , const TAny *)
 	{
 	}
-
-CWsCaptureLongKey* CWsCaptureLongKey::CheckForCapture(TUint aKeyCode, TInt aModifiers)
-	{
-	TDblQueIter<CWsCaptureLongKey> iter(iCaptureLongKeys);
-	CWsCaptureLongKey* longCapture;
-	while ((longCapture=iter++)!=NULL)
-		{
-		if (aKeyCode==longCapture->iData.inputKey && (aModifiers&longCapture->iData.modifierMask)==longCapture->iData.modifiers)
-			return longCapture;
-		}
-	return NULL;
-	}
--- a/windowing/windowserver/nga/SERVER/EVENT.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/EVENT.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1994-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"
@@ -18,6 +18,7 @@
 #include "EVENT.H"
 
 #include "W32STD.H"
+#include <e32uid.h>
 #include <hal.h>
 #include <w32adll.h>
 #include "W32CLICK.H"
@@ -32,12 +33,16 @@
 #include "pointer.h"
 #include "debugbar.h"
 #include "advancedpointereventhelper.h"
+#include "graphics/wsgraphicdrawerinternal.h"
 
 GLREF_D CDebugLogBase *wsDebugLog;
 
 GLREF_C void StateDump();
 GLREF_C void HeapDump();
 
+_LIT(KDefaultKeyRouterPluginName, "keyrouter.dll");
+_LIT(KWSERVIniFileVarKeyRouterPlugin, "KEYROUTERPLUGIN");
+
 #define IMPOSSIBLE 0xFFFFFFFF
 
 const TWsWinCmdCaptureKey ImpossibleKeyPress=
@@ -160,6 +165,8 @@
 TEventRequestQueue TWindowServerEvent::iScreenDeviceChangedQueue;
 TTime TWindowServerEvent::iPrevOomMessageTime;
 CCaptureKeys *TWindowServerEvent::iCaptureKeys;
+CKeyEventRouter* TWindowServerEvent::iKeyEventRouter;
+RLibrary TWindowServerEvent::iKeyEventRouterLibrary;
 CWsHotKey *TWindowServerEvent::iHotKeys;
 TInt TWindowServerEvent::iModifierState;
 CRawEventReceiver *TWindowServerEvent::iEventReceiver;
@@ -172,12 +179,12 @@
 TInt TWindowServerEvent::iEventHandlerCount=0;
 TRepeatKey CKeyboardRepeat::iCurrentRepeat;
 TRepeatKey CKeyboardRepeat::iAlternateRepeat;
+TRepeatKey CKeyboardRepeat::iLongRepeat;
 TInt CKeyboardRepeat::iRepeatRollover=1;
 CKeyboardRepeat::TRepeatType CKeyboardRepeat::iRepeating=ERepeatNone;
 CKeyboardRepeat *CKeyboardRepeat::iThis=NULL;
 TTimeIntervalMicroSeconds32 CKeyboardRepeat::iInitialTime;
 TTimeIntervalMicroSeconds32 CKeyboardRepeat::iTime;
-CWsWindowGroup *CKeyboardRepeat::iFocus=NULL;
 TBool CKeyboardRepeat::iAlternateRepeatExists=EFalse;
 CWsCaptureLongKey* CKeyboardRepeat::iLongCapture=NULL;
 
@@ -198,6 +205,8 @@
 	{
 	DeleteHotKeys();
 	delete iCaptureKeys;
+	delete iKeyEventRouter;
+	iKeyEventRouterLibrary.Close();
 	CKeyboardRepeat::Destroy();
 	delete iKeyTranslator;
 	delete iEventReceiver;
@@ -231,8 +240,57 @@
 		iKeyTranslator->ChangeKeyData(keyDataDllName);
 		}
 
+	// CCaptureKeys is no longer used but a dummy object is required for
+	// calls to CKeyTranslator::TranslateKey() until capture functionality
+	// has been removed from ektran.dll.
 	iCaptureKeys=new(ELeave) CCaptureKeys;
 	iCaptureKeys->Construct();
+
+	// Load the key event routing plug-in. The DLL name may be overridden
+	// by setting the keyword KEYROUTERPLUGIN in wsini.ini.
+	TPtrC pluginName(KDefaultKeyRouterPluginName);
+	WsIniFile->FindVar(KWSERVIniFileVarKeyRouterPlugin, pluginName);
+	const TUidType uidType(KDynamicLibraryUid, KKeyRouterPluginUid);
+	TInt err = iKeyEventRouterLibrary.Load(pluginName, uidType);
+
+	if (wsDebugLog)
+		{
+		TLogMessageText buf;
+
+		if (err == KErrNone)
+			{
+			_LIT(KLogLoadOk, "Loaded plugin '%S' UID3 0x%x");
+			const TFileName& pluginPathname = iKeyEventRouterLibrary.FileName();
+			const TUid uid3 = iKeyEventRouterLibrary.Type()[2];
+			buf.Format(KLogLoadOk, &pluginPathname, uid3.iUid);
+			}
+		else
+			{
+			_LIT(KLogLoadError, "Failed to load plugin '%S' (error %d)");
+			buf.Format(KLogLoadError, &pluginName, err);
+			}
+
+		wsDebugLog->MiscMessage(CDebugLogBase::ELogImportant, buf);
+		}
+
+	if (err != KErrNone)
+		{
+#ifdef _DEBUG
+		_LIT(KLoadError, "WServ: failed to load plugin '%S' (error %d)");
+		RDebug::Print(KLoadError, &pluginName, err);
+#endif
+		User::Leave(err);
+		}
+
+	// Create the key event router
+	typedef CKeyEventRouter* (*TCreateFunc)();
+	TCreateFunc newL = reinterpret_cast<TCreateFunc>(iKeyEventRouterLibrary.Lookup(1));
+	if (newL == NULL)
+		{
+		User::Leave(KErrNotFound);
+		}
+	iKeyEventRouter = (*newL)();
+
 	for (TInt index=0;index<TWindowServerEvent::ENumHotKeys;index++)
 		ConstructDefaultHotKeyL(index,DefaultHotKeys[index]);
 	CKeyboardRepeat::NewL();
@@ -312,6 +370,7 @@
 	captureKey.modifiers=aHotKey.modifiers;
 	captureKey.modifierMask=aHotKey.modifierMask;
 	captureKey.key=aHotKey.keycode;
+	captureKey.priority = 0;
 	hotKey->ConstructLD(captureKey);
 //
 	LinkHotKey(hotKey);
@@ -622,6 +681,21 @@
 	TWsEvent event;
 	event.SetType(EEventDisplayChanged);
 	event.SetTimeNow();
+	
+    // fill in the handle otherwise CONE will discard the notification
+    CWsObjectIx* clientObjList = aWsClient->ObjectIndex();
+    const TWsObject* ptr=clientObjList->FirstObject();
+    const TWsObject* end=ptr+clientObjList->Length();
+    while(++ptr<end)    // first one should always have a NULL object
+        {
+        const CWsObject* obj=ptr->iObject;
+        if (obj && obj->Type()==WS_HANDLE_GROUP_WINDOW)
+            {
+            event.SetHandle(ptr->iHandle);
+            break;
+            }
+        }	
+	
 	TWsDisplayChangedEvent* dispEvent = event.DisplayChanged();
 	dispEvent->iDisplayNumber = aDisplayNumber;
 	dispEvent->iConfigurationChangeId = aConfigurationChangeId;
@@ -641,23 +715,68 @@
 	aWin->EventQueue()->QueueEvent(aEvent, aPriority);
 	}
 
-void TWindowServerEvent::QueueKeyPress(const TKeyData& aKey, TInt aScanCode, CWsWindowGroup* aRepeatFocus, TBool aCheckRepeat,TInt aRepeats)
+/**
+Process a key press event.
+
+This function is called for every input key event and uses the Key Event
+Routing plug-in to check for short and long key capture and determine the
+destination window group for the queued event(s).
+Window server hotkeys are also processed.
+Note that the key repeat timer is started here but the key repeat events
+generated by the timer go directly to QueueKeyPress().
+
+@param	aKeyEvent		Input key event
+@param	aCheckRepeat	Check for key repeat and long key capture
+@param	aRepeats		Repeat count
+*/
+void TWindowServerEvent::ProcessKeyPress(const TKeyEvent& aKeyEvent, TBool aCheckRepeat, TInt aRepeats)
  	{
-	CWsWindowGroup* focusWin=CWsTop::FocusWindowGroup();
-	TWsEvent event;
-	TKeyEvent& keyEvent=*event.Key();
-	keyEvent.iCode=aKey.iKeyCode;
-	keyEvent.iScanCode=aScanCode;
-	keyEvent.iModifiers=aKey.iModifiers;
-	keyEvent.iRepeats=aRepeats;
-	if (!aRepeatFocus && CClick::IsHandler())
-		CClick::KeyEvent(EEventKey,keyEvent);
-	CWsCaptureLongKey* longCapture=NULL;
-	if (aCheckRepeat)
-		longCapture=CWsCaptureLongKey::CheckForCapture(aKey.iKeyCode, aKey.iModifiers);
-	if (aKey.iIsCaptureKey)
+	CWsWindowGroup* focusWin = CWsTop::FocusWindowGroup();
+	TUid focusAppUid = focusWin ? TUid::Uid(focusWin->Client()->SecureId().iId) : KNullUid;
+
+	// Route the key event and check for short key capture.
+	// Note that the Key Routing plugin may translate or block key events.
+	TKeyEventRouterInput input(ECaptureTypeKey, aKeyEvent, focusWin, focusAppUid);
+	TKeyEventRouterOutput output;
+
+#ifdef _DEBUG
+	// RouteKey() must not fail. Check for leaves in case the plug-in
+	// is badly behaved.
+	TRAPD(err, iKeyEventRouter->RouteKey(input, output));
+	WS_ASSERT_DEBUG(err == KErrNone, EWsPanicKeyEventRouterLeave);
+#else
+	iKeyEventRouter->RouteKey(input, output);
+#endif
+
+	WS_ASSERT_DEBUG(output.iResult == ERouted || output.iResult == ECaptured || output.iResult == EConsumed, EWsPanicKeyEventRouterBadResult);
+
+	if (output.iResult == EConsumed)
 		{
-		if (aKey.iApp==NULL)	// Captured by Wserv itself
+		focusWin = NULL;
+		}
+	else
+		{
+		focusWin = static_cast<CWsWindowGroup*>(output.iWindowGroup);
+		}
+	WS_ASSERT_DEBUG((focusWin == NULL || focusWin->Type() == WS_HANDLE_GROUP_WINDOW) && (output.iResult != ERouted || focusWin == CWsTop::FocusWindowGroup()), EWsPanicKeyEventRouterBadWindowGroup);
+
+	// Ensure that short event is not marked with EModifierLongKey
+	output.iKeyEvent.iModifiers &= ~EModifierLongKey;
+
+	// Generate key click unless the event is consumed. This is consistent
+	// with the behaviour when CKeyTranslator::TranslateKey() yields no
+	// translation for a particular scan code. (Click events for key up/down
+	// will still be generated by QueueKeyUpDown()). Note however that a long
+	// key press may still be captured even if the short event is consumed.
+	if (CClick::IsHandler() && output.iResult != EConsumed)
+		{
+		output.iKeyEvent.iRepeats = aRepeats;
+		CClick::KeyEvent(EEventKey, output.iKeyEvent);
+		}
+
+	if (output.iResult == ECaptured)
+		{
+		if (output.iWindowGroup == NULL)	// Captured by Wserv itself
 			{
 			_LIT(KWSERVDebugLogCapturedKey,"WSERV Captured Key");
 			CScreen* focusScreen=CWsTop::CurrentFocusScreen();
@@ -668,7 +787,7 @@
 			CWsHotKey *hotKey=iHotKeys;
 			while(hotKey)
 				{
-				if (hotKey->KeyHandle()==aKey.iHandle)
+				if (hotKey->KeyHandle() == reinterpret_cast<TInt>(output.iCaptureHandle))
 					{
 					switch(hotKey->HotKeyType())
 						{
@@ -753,22 +872,85 @@
 			WS_PANIC_ALWAYS(EWsPanicUnknownCaptureKey);
 			return;
 			}
-		focusWin=((CWsWindowGroup *)aKey.iApp);
+
 		_LIT(KWSERVDebugLogKeyCapturedByApp,"Key captured by app %d");
 		if (wsDebugLog)
 			wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything,KWSERVDebugLogKeyCapturedByApp,focusWin->Identifier());
 		if (CWsPassword::PasswordModeActive() && focusWin!=CWsPassword::PasswordWindow()->WinGroup())
 			return;
 		}
-	if (aRepeatFocus && aRepeatFocus!=focusWin)
-		CKeyboardRepeat::CancelRepeat(NULL);		// Repeat is going to different window so cancel it and don't deliver this key
-	else if (focusWin!=NULL && focusWin->CheckForPriorityKey(aKey,aScanCode)==EFalse)
+
+	CWsCaptureLongKey* longCapture = NULL;
+	TKeyEventRouterOutput longOutput;
+	if (aCheckRepeat)
 		{
-		if (longCapture || (aCheckRepeat && !aRepeatFocus && aKey.iModifiers&EModifierAutorepeatable))
+		// Check for long key capture.
+		// Note that a long key event can only result from capture, there is
+		// no default detection or routing of long events.
+		input.iType = ECaptureTypeLongKey;
+#ifdef _DEBUG
+		TRAPD(err, iKeyEventRouter->RouteKey(input, longOutput));
+		WS_ASSERT_DEBUG(err == KErrNone, EWsPanicKeyEventRouterLeave);
+#else
+		iKeyEventRouter->RouteKey(input, longOutput);
+#endif
+
+		if (longOutput.iResult == ECaptured)
+			{
+			longCapture = static_cast<CWsCaptureLongKey*>(longOutput.iCaptureHandle);
+
+			// Mark long key events with EModifierLongKey so that applications
+			// can easily distinguish short and long events.
+			longOutput.iKeyEvent.iModifiers |= EModifierLongKey;
+
+			// Start timer to detect long key press
+			CKeyboardRepeat::StartRepeat(aKeyEvent.iScanCode, output, &longOutput);
+			}
+		else if (output.iResult != EConsumed && output.iKeyEvent.iModifiers & EModifierAutorepeatable)
 			{
-			if (CKeyboardRepeat::StartRepeat(aKey,aScanCode,focusWin,longCapture))
-				return;
+			// Start timer for key repeat
+			CKeyboardRepeat::StartRepeat(aKeyEvent.iScanCode, output, NULL);
 			}
+		}
+
+	// Queue the short event
+	if (!longCapture || longCapture->iFlags & ELongCaptureShortEventImmediately)
+		{
+		QueueKeyPress(output, EFalse, aRepeats);
+		}
+	}
+
+/**
+Queue a key press event.
+
+This function is called for each key event produced by ProcessKeyPress(),
+for every key repeat and long key event generated by the timer and also for
+delayed short key events from KeyUp().
+
+@param	aOutput			Output key event from routing plug-in
+@param	aIsRepeat		Event is due to key repeat
+@param	aRepeats		Repeat count
+*/
+void TWindowServerEvent::QueueKeyPress(const TKeyEventRouterOutput& aOutput, TBool aIsRepeat, TInt aRepeats)
+ 	{
+	if (aOutput.iResult == EConsumed)
+		{
+		// Don't deliver this key
+		return;
+		}
+
+	TWsEvent event;
+	TKeyEvent& keyEvent = *event.Key();
+	keyEvent = aOutput.iKeyEvent;
+	keyEvent.iRepeats = aRepeats;
+
+	CWsWindowGroup* focusWin = static_cast<CWsWindowGroup*>(aOutput.iWindowGroup);
+	WS_ASSERT_DEBUG(focusWin == NULL || focusWin->Type() == WS_HANDLE_GROUP_WINDOW, EWsPanicKeyEventRouterBadWindowGroup);
+
+	if (aIsRepeat && aOutput.iResult != ECaptured && focusWin != CWsTop::FocusWindowGroup())
+		CKeyboardRepeat::CancelRepeat(NULL);		// Repeat is going to different window so cancel it and don't deliver this key
+	else if (focusWin != NULL && focusWin->CheckForPriorityKey(keyEvent) == EFalse)
+		{
 		event.SetType(EEventKey);
 		event.SetHandle(focusWin->ClientHandle());
 		if (aRepeats!=0)
@@ -776,18 +958,15 @@
 			CEventQueue* queue=focusWin->EventQueue();
 			queue->Wait();
 			const TWsEvent* prev=queue->PeekLastEvent();
-			if (prev!=NULL && prev->Type()==EEventKey && prev->Key()->iRepeats>0)
+			if (prev != NULL && prev->Type() == EEventKey && prev->Key()->iRepeats > 0 && prev->Key()->iCode == keyEvent.iCode)
 				{
-				event= *prev;
-				event.Key()->iRepeats+=aRepeats;
-				queue->UpdateLastEvent(event);
+				prev->Key()->iRepeats += aRepeats;
 				queue->Signal();
 				if (CClick::IsHandler())
-					CClick::KeyEvent(EEventKeyRepeat,*event.Key());
+					CClick::KeyEvent(EEventKeyRepeat, *prev->Key());
 				return;
 				}
 			queue->Signal();
-			event.Key()->iRepeats=aRepeats;
 			if (CClick::IsHandler())
 				CClick::KeyEvent(EEventKeyRepeat,keyEvent);
 			}
@@ -795,24 +974,69 @@
 		}
 	}
 
+/**
+Queue a key up/down event.
+
+@param	aRawEvent		Raw event
+*/
 void TWindowServerEvent::QueueKeyUpDown(const TRawEvent &aRawEvent)
  	{
-	CWsWindowGroup *focusWin=CWsCaptureKeyUpsAndDowns::CheckForCapture(aRawEvent.ScanCode() __REMOVE_WINS_CHARCODE, iModifierState);
-	if (!focusWin)	// If not captured
-		focusWin=CWsTop::FocusWindowGroup();
-	TWsEvent event;
-	TEventCode type=aRawEvent.Type()==TRawEvent::EKeyUp ? EEventKeyUp : EEventKeyDown;
-	event.Key()->iCode=0;
+	TEventCode type = aRawEvent.Type() == TRawEvent::EKeyUp ? EEventKeyUp : EEventKeyDown;
+
+	// Check for key up/down capture
+	TKeyEvent keyEvent;
+	keyEvent.iScanCode = aRawEvent.ScanCode() __REMOVE_WINS_CHARCODE;
+#if defined(__WINS__)
+	keyEvent.iCode = __WINS_CHARCODE(aRawEvent.ScanCode());
+#else
+	keyEvent.iCode = 0;
+#endif
+	keyEvent.iModifiers = iModifierState;
+	keyEvent.iRepeats = 0;
+
+	CWsWindowGroup* focusWin = CWsTop::FocusWindowGroup();
+	TUid focusAppUid = focusWin ? TUid::Uid(focusWin->Client()->SecureId().iId) : KNullUid;
+
+	TKeyEventRouterInput input(ECaptureTypeKeyUpDown, keyEvent, focusWin, focusAppUid);
+	TKeyEventRouterOutput output;
+#ifdef _DEBUG
+	TRAPD(err, iKeyEventRouter->RouteKey(input, output));
+	WS_ASSERT_DEBUG(err == KErrNone, EWsPanicKeyEventRouterLeave);
+#else
+	iKeyEventRouter->RouteKey(input, output);
+#endif
+
+	if (output.iResult == EConsumed)
+		{
+		// Don't deliver this key. A key click is still generated for the
+		// input event.
+		if (CClick::IsHandler())
+			{
+			CClick::KeyEvent(type, keyEvent);
+			}
+		return;
+		}
+	WS_ASSERT_DEBUG(output.iResult == ERouted || output.iResult == ECaptured, EWsPanicKeyEventRouterBadResult);
+
+	focusWin = static_cast<CWsWindowGroup*>(output.iWindowGroup);
+	WS_ASSERT_DEBUG((focusWin == NULL || focusWin->Type() == WS_HANDLE_GROUP_WINDOW) && (output.iResult != ERouted || focusWin == CWsTop::FocusWindowGroup()), EWsPanicKeyEventRouterBadWindowGroup);
 #if defined(__WINS__)
 	if (focusWin && !focusWin->WsOwner()->RemoveKeyCode())
-		event.Key()->iScanCode=aRawEvent.ScanCode();
-	else
+		{
+		// Restore WINS character code
+		output.iKeyEvent.iScanCode |= output.iKeyEvent.iCode;
+		}
+	output.iKeyEvent.iCode = 0;
 #endif
-	event.Key()->iScanCode=aRawEvent.ScanCode() __REMOVE_WINS_CHARCODE;
-	event.Key()->iModifiers=iModifierState;
-	event.Key()->iRepeats=0;
+
+	output.iKeyEvent.iRepeats = 0;
 	if (CClick::IsHandler())
-		CClick::KeyEvent(type,*event.Key());
+		{
+		CClick::KeyEvent(type, output.iKeyEvent);
+		}
+
+	TWsEvent event;
+	*event.Key() = output.iKeyEvent;
 	if (focusWin!=NULL)
 		{
 		event.SetType(type);
@@ -921,6 +1145,11 @@
 		}
 	}
 
+/*
+Process a raw event
+
+@param	aRawEvent	Raw event
+*/
 void TWindowServerEvent::ProcessRawEvent(const TRawEvent& aRawEvent)
 //
 // Event has completed.
@@ -1020,23 +1249,35 @@
 		case TRawEvent::EKeyDown:
 			{
 			_LIT(KWSERVDebugLogKeyDownArrival,"Key down arrives %d");
-			if(CDebugBar* dbg = CWsTop::Screen()->DebugBar())
+			CScreen* screen = CWsTop::Screen();
+			WS_ASSERT_ALWAYS(screen, EWsPanicNoScreen);
+			if(CDebugBar* dbg = screen->DebugBar())
 				dbg->OnKeyEvent();
 			if (wsDebugLog)
 				wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything,KWSERVDebugLogKeyDownArrival,aRawEvent.ScanCode());
 			CKeyboardRepeat::KeyDown();
 			TKeyData keyData;
+			// Note iCaptureKeys is needed as dummy arg only. Key capture is
+			// now handled in ProcessKeyPress().
 			TBool translated=iKeyTranslator->TranslateKey(aRawEvent.ScanCode(), EFalse,*iCaptureKeys,keyData);
 			ProcessModifierChanges();
 			QueueKeyUpDown(aRawEvent);
 			if (translated)
-				QueueKeyPress(keyData,aRawEvent.ScanCode() __REMOVE_WINS_CHARCODE,NULL,ETrue,0);
+				{
+				TKeyEvent keyEvent;
+				keyEvent.iScanCode = aRawEvent.ScanCode() __REMOVE_WINS_CHARCODE;
+				keyEvent.iCode = keyData.iKeyCode;
+				keyEvent.iModifiers = keyData.iModifiers;
+				ProcessKeyPress(keyEvent, ETrue, 0);
+				}
 			}
 			break;
 		case TRawEvent::EKeyUp:
 			{
 			_LIT(KWSERVDebugLogKeyUpArrival,"Key up arrives %d");
-			if(CDebugBar* dbg = CWsTop::Screen()->DebugBar())
+			CScreen* screen = CWsTop::Screen();
+			WS_ASSERT_ALWAYS(screen, EWsPanicNoScreen);
+			if(CDebugBar* dbg = screen->DebugBar())
 				dbg->OnKeyEvent();
 			if (wsDebugLog)
 				wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything,KWSERVDebugLogKeyUpArrival,aRawEvent.ScanCode());
@@ -1048,7 +1289,11 @@
 			if (translated)
 				{
 				CKeyboardRepeat::CancelRepeat(NULL);
-				QueueKeyPress(keyData,aRawEvent.ScanCode() __REMOVE_WINS_CHARCODE,NULL,EFalse,0);
+				TKeyEvent keyEvent;
+				keyEvent.iScanCode = aRawEvent.ScanCode() __REMOVE_WINS_CHARCODE;
+				keyEvent.iCode = keyData.iKeyCode;
+				keyEvent.iModifiers = keyData.iModifiers;
+				ProcessKeyPress(keyEvent, EFalse, 0);
 				}
 			}
 			break;
@@ -1079,14 +1324,11 @@
  			_LIT(KWSERVDebugLogRepeatingKeyArrival,"Repeating key arrives %d");
  			if (wsDebugLog)
  				wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything,KWSERVDebugLogRepeatingKeyArrival,aRawEvent.ScanCode());
- 			TKeyData keyData;
- 			keyData.iModifiers=iKeyTranslator->GetModifierState();
-			keyData.iApp=0;
-			keyData.iHandle=0;
-			keyData.iIsCaptureKey=EFalse;
-			keyData.iKeyCode=aRawEvent.ScanCode(); 
-			iCaptureKeys->ProcessCaptureKeys(keyData);
-			QueueKeyPress(keyData, aRawEvent.ScanCode() __REMOVE_WINS_CHARCODE,NULL,EFalse,aRawEvent.Repeats());
+			TKeyEvent keyEvent;
+			keyEvent.iScanCode = aRawEvent.ScanCode() __REMOVE_WINS_CHARCODE;
+			keyEvent.iCode = aRawEvent.ScanCode();
+ 			keyEvent.iModifiers = iKeyTranslator->GetModifierState();
+			ProcessKeyPress(keyEvent, EFalse, aRawEvent.Repeats());
  			}
  			break;
 		default:
@@ -1096,33 +1338,26 @@
 
 void TWindowServerEvent::ProcessKeyEvent(const TKeyEvent &aKeyEvent,TInt aRepeats)
 	{
-	TKeyData keyData;
-	keyData.iModifiers=aKeyEvent.iModifiers;
-	keyData.iApp=0;
-	keyData.iHandle=0;
-	keyData.iIsCaptureKey=EFalse;
-	keyData.iKeyCode=aKeyEvent.iCode;
 	if (CKeyboardRepeat::IsAreadyActive())
 		{
 		CKeyboardRepeat::CancelRepeat(NULL);
 		}
-	iCaptureKeys->ProcessCaptureKeys(keyData);
-	QueueKeyPress(keyData,aKeyEvent.iScanCode,NULL,aRepeats==0,aRepeats);
+	ProcessKeyPress(aKeyEvent, aRepeats == 0, aRepeats);
 	}
 
-void TWindowServerEvent::AddCaptureKeyL(const TCaptureKey &aCaptureKey)
+void TWindowServerEvent::AddCaptureKeyL(const TKeyCaptureRequest& aRequest)
 	{
-	iCaptureKeys->AddCaptureKeyL(aCaptureKey,aCaptureKey.iKeyCodePattern.iFiller);
+	iKeyEventRouter->AddCaptureKeyL(aRequest);
 	}
 
-void TWindowServerEvent::SetCaptureKey(TUint32 aHandle, const TCaptureKey &aCaptureKey)
+void TWindowServerEvent::UpdateCaptureKeyL(const TKeyCaptureRequest& aRequest)
 	{
-	iCaptureKeys->SetCaptureKey(aHandle, aCaptureKey,aCaptureKey.iKeyCodePattern.iFiller);
+	iKeyEventRouter->UpdateCaptureKeyL(aRequest);
 	}
 
-void TWindowServerEvent::CancelCaptureKey(TUint32 aHandle)
+void TWindowServerEvent::CancelCaptureKey(TKeyCaptureType aType, TAny* aHandle)
 	{
-	iCaptureKeys->CancelCaptureKey(aHandle);
+	iKeyEventRouter->CancelCaptureKey(aType, aHandle);
 	}
 
 TInt TWindowServerEvent::GetModifierState()
@@ -1463,21 +1698,27 @@
 	iTime=aTime;
 	}
 
+/**
+Process timer events.
+
+Called when the key repeat timer expires, this function generates the
+appropriate long key or repeated key event. If the timer was started for
+normal key repeat or if the long key event was captured with the automatic
+repeat option specified then the timer is restarted.
+*/
 void CKeyboardRepeat::RunL()
 	{
 	User::ResetInactivityTime();
-	//WS_ASSERT_DEBUG(iRepeating!=ERepeatNone, EWsPanicTemp);
+	WS_ASSERT_DEBUG(iRepeating != ERepeatNone, EWsPanicKeyRepeat);
 	TBool timer=ETrue;
 	if (iRepeating>=ERepeatLong)
 		{
 		// Defensive programming - iLongCapture should never be NULL if iRepeating >= ERepeatLong
+		WS_ASSERT_DEBUG(iLongCapture != NULL, EWsPanicKeyRepeat);
 		if (iLongCapture)
 			{
-			iCurrentRepeat.iKey.iApp=REINTERPRET_CAST(TUint32,iLongCapture->iWindowGroup);
-			iCurrentRepeat.iKey.iHandle=0;
-			iCurrentRepeat.iKey.iIsCaptureKey=ETrue;
-			iCurrentRepeat.iKey.iKeyCode=iLongCapture->iData.outputKey;
-			timer=iLongCapture->iData.flags&ELongCaptureRepeatEvents;
+			iCurrentRepeat = iLongRepeat;
+			timer = iLongCapture->iFlags & ELongCaptureRepeatEvents;
 			iRepeating=ERepeatLongRepeated;
 			}
 		else
@@ -1491,53 +1732,67 @@
 		After(iTime);
 	else
 		iRepeating=ERepeatNone;
-	TWindowServerEvent::QueueKeyPress(iCurrentRepeat.iKey,iCurrentRepeat.iScanCode,iFocus,EFalse,1);
+
+	TWindowServerEvent::QueueKeyPress(iCurrentRepeat.iOutput, ETrue, 1);
 	}
 
-TBool CKeyboardRepeat::StartRepeat(const TKeyData &aKey, TInt aScanCode, CWsWindowGroup *aRepeatFocus, CWsCaptureLongKey* aLongCapture)
+/**
+Start key repeat and long key press timer
+
+@param	aInputScanCode	Original scan code (before routing)
+@param	aShortEvent		Short key event (routing plug-in output)
+@param	aLongEvent		Pointer to long key event (routing plug-in output)
+						or NULL if none.
+
+Note: When aLongEvent != NULL, iCurrentRepeat reflects the short key event
+until the timer has expired. This is necessary to allow a delayed short key
+event to be delivered by KeyUp(). CancelRepeat() must therefore examine
+iCurrentRepeat or iLongRepeat according to the repeat type in iRepeat.
+*/
+void CKeyboardRepeat::StartRepeat(TInt aInputScanCode, const TKeyEventRouterOutput& aShortEvent, const TKeyEventRouterOutput* aLongEvent)
 	{
 	TTimeIntervalMicroSeconds32 time;
-	TBool ret=EFalse;
-	iCurrentRepeat.iScanCode=aScanCode;
-	iCurrentRepeat.iKey=aKey;
+	iCurrentRepeat.iInputScanCode = aInputScanCode;
+	iCurrentRepeat.iOutput = aShortEvent;
 
-	if (aLongCapture)
+	if (aLongEvent)
 		{
-		iLongCapture=aLongCapture;
-		iRepeating=ERepeatLong;
-		time=aLongCapture->iData.delay;
-		ret=!(aLongCapture->iData.flags&ELongCaptureShortEventImmediately);
-		//need window group from long capture key or even better delete it altogether.
-		iFocus=aLongCapture->WindowGroup();
+		iRepeating = ERepeatLong;
+		iLongRepeat.iInputScanCode = aInputScanCode;
+		iLongRepeat.iOutput = *aLongEvent;
+		iLongCapture = static_cast<CWsCaptureLongKey*>(aLongEvent->iCaptureHandle);
+		time = iLongCapture->iDelay;
 		}
 	else
 		{
-		iFocus=aRepeatFocus;
+		iLongCapture = NULL;
 		iRepeating=ERepeatNormal;
 		time=iInitialTime;
 		}
 	iThis->After(time);
-	return ret;
 	}
 
+/**
+Cancel key repeat processing
+*/
 void CKeyboardRepeat::doCancelRepeat()
 	{
 	iRepeating=ERepeatNone;
 	iThis->Cancel();
 	}
 
+/**
+Cancel any key repeat associated with the specified window group
+
+@param	aRepeatFocus	Destination window group or NULL for all
+*/
 void CKeyboardRepeat::CancelRepeat(CWsWindowGroup *aRepeatFocus)
 	{
-	if (aRepeatFocus==NULL || aRepeatFocus==iFocus)
+	if (iRepeating != ERepeatNone)
 		{
-		if (iRepeating)
-			doCancelRepeat();
-		iAlternateRepeatExists=EFalse;
-		}
-	else if (iRepeating >= ERepeatLong)
-		{
-		// Defensive programming - iLongCapture should never be NULL if iRepeating >= ERepeatLong
-		if (iLongCapture && iLongCapture->iWindowGroup == aRepeatFocus)
+		if (aRepeatFocus == NULL ||
+			(iRepeating == ERepeatNormal) && (aRepeatFocus == iCurrentRepeat.iOutput.iWindowGroup) ||
+			(iRepeating >= ERepeatLong) && (aRepeatFocus == iLongRepeat.iOutput.iWindowGroup))
 			{
 			doCancelRepeat();
 			iAlternateRepeatExists=EFalse;
@@ -1545,36 +1800,38 @@
 		}
 	}
 
-void CKeyboardRepeat::CancelRepeat(CWsWindowGroup *aRepeatFocus,TUint aScanCode,TBool aLongCaptureFlag,TUint aModifiers)
+/**
+Cancel any key repeat associated with the specified capture handle
+
+@param	aCaptureHandle		Handle to capture request
+@param	aLongCaptureFlag	ETrue for long key capture, EFalse for normal key
+*/
+void CKeyboardRepeat::CancelRepeat(const TAny* aCaptureHandle, TBool aLongCaptureFlag)
 	{
 	if (aLongCaptureFlag)
 		{
-		// long capture key is cancelled
-		if (iRepeating >= ERepeatLong && iCurrentRepeat.iScanCode==aScanCode)			
-				{
-				// Defensive programming - iLongCapture should never be NULL if iRepeating >= ERepeatLong
-				if (iLongCapture && aRepeatFocus == iLongCapture->iWindowGroup &&
-					(aModifiers & iLongCapture->iData.modifierMask) == iLongCapture->iData.modifiers)
-					{
-					doCancelRepeat();
-					iAlternateRepeatExists=EFalse;
-					}
-				}
+		// Cancel repeat for long capture key
+		if (iRepeating >= ERepeatLong && aCaptureHandle == iLongRepeat.iOutput.iCaptureHandle)
+			{
+			doCancelRepeat();
+			iAlternateRepeatExists=EFalse;
+			}
 		}
 	else
 		{
-		// normal capture key is cancelled
-		if (aRepeatFocus==iFocus)
+		// Cancel repeat for normal capture key
+		if (iRepeating == ERepeatNormal && aCaptureHandle == iCurrentRepeat.iOutput.iCaptureHandle)
 			{
-			if (iRepeating>=ERepeatNormal && iCurrentRepeat.iScanCode==aScanCode)
-				{
-				doCancelRepeat();
-				}
+			doCancelRepeat();
 			iAlternateRepeatExists=EFalse;
 			}
 		}
 	}
 	
+/**
+Process a key down event during key repeat.
+The current repeat data is saved for possible restoration after rollover.
+*/
 void CKeyboardRepeat::KeyDown()
 	{
 	if (iRepeating!=ERepeatNone)
@@ -1588,18 +1845,26 @@
 		}
 	}
 
+/**
+Process a key up event during key repeat.
+Send delayed short key event if necessary for long key event processing.
+Switch to alternate repeat if rollover key was released.
+
+@param	aScanCode	Scan code
+*/
 void CKeyboardRepeat::KeyUp(TInt aScanCode)
 	{
-	if (iAlternateRepeatExists && iAlternateRepeat.iScanCode==aScanCode)
+	if (iAlternateRepeatExists && iAlternateRepeat.iInputScanCode == aScanCode)
 		iAlternateRepeatExists=EFalse;
-	if (iRepeating!=ERepeatNone && iCurrentRepeat.iScanCode==aScanCode)
+	if (iRepeating != ERepeatNone && iCurrentRepeat.iInputScanCode == aScanCode)
 		{
 		if (iRepeating==ERepeatLong)
 			{
 			// Defensive programming - iLongCapture should never be NULL if iRepeating >= ERepeatLong			
-			if (iLongCapture && !(iLongCapture->iData.flags&ELongCaptureShortEventImmediately))
+			WS_ASSERT_DEBUG(iLongCapture != NULL, EWsPanicKeyRepeat);
+			if (iLongCapture && !(iLongCapture->iFlags & ELongCaptureShortEventImmediately))
 				{
-				TWindowServerEvent::QueueKeyPress(iCurrentRepeat.iKey,iCurrentRepeat.iScanCode,NULL,EFalse,0);	
+				TWindowServerEvent::QueueKeyPress(iCurrentRepeat.iOutput, EFalse, 0);
 				}
 			}			
 		if (iAlternateRepeatExists)
--- a/windowing/windowserver/nga/SERVER/EVENT.H	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/EVENT.H	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 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"
@@ -27,7 +27,8 @@
 #include "w32cmd.h"
 #include "EVQUEUE.H"
 #include <w32adll.h>
-#include "Graphics/WSGRAPHICDRAWER.H"
+#include "graphics/WSGRAPHICDRAWER.H"
+#include <graphics/wskeyrouter.h>
 
 class CWsClient;
 class CWsWindowBase;
@@ -78,8 +79,8 @@
 class TRepeatKey
 	{
 public:
-	TKeyData iKey;
-	TInt iScanCode;
+	TKeyEventRouterOutput iOutput;
+	TInt iInputScanCode;
 	};
 
 class CKeyboardRepeat : public CTimer
@@ -90,9 +91,9 @@
 	static void Destroy();
 	static void KeyDown();
 	static void KeyUp(TInt aScanCode);
-	static TBool StartRepeat(const TKeyData &aKey, TInt aScanCode, CWsWindowGroup *aRepeatFocus, CWsCaptureLongKey* longCapture);
+	static void StartRepeat(TInt aInputScanCode, const TKeyEventRouterOutput& aShortEvent, const TKeyEventRouterOutput* aLongEvent);
 	static void CancelRepeat(CWsWindowGroup *aRepeatFocus);
-	static void CancelRepeat(CWsWindowGroup *aRepeatFocus,TUint aScanCode,TBool aLongCaptureFlag,TUint aModifiers=0);
+	static void CancelRepeat(const TAny* aCaptureHandle, TBool aLongCaptureFlag);
 	static void SetRepeatTime(const TTimeIntervalMicroSeconds32 &aInitialTime, const TTimeIntervalMicroSeconds32 &aTime);
 	static void GetRepeatTime(TTimeIntervalMicroSeconds32 &aInitialTime, TTimeIntervalMicroSeconds32 &aTime);
 	static inline TBool IsAreadyActive();
@@ -108,13 +109,13 @@
 	static void doCancelRepeat();
 	void RunL();
 private:
-	static CWsWindowGroup *iFocus;
 	static CKeyboardRepeat *iThis; // Needed as CTimer derived parts can't be static
 	static TTimeIntervalMicroSeconds32 iInitialTime;
 	static TTimeIntervalMicroSeconds32 iTime;
+	static TRepeatType iRepeating;
 	static TRepeatKey iCurrentRepeat;
-	static TRepeatType iRepeating;
 	static TRepeatKey iAlternateRepeat;
+	static TRepeatKey iLongRepeat;
 	static TBool iAlternateRepeatExists;
 	static CWsCaptureLongKey* iLongCapture;
 	static TInt iRepeatRollover;
@@ -174,9 +175,9 @@
 	static CWsHotKey* ClearHotKeysL(TInt aHotKey);
 	static void ResetDefaultHotKeyL(TInt aHotKey);
 	static void SetHotKeyL(const TWsClCmdSetHotKey &aHotKey);
-	static void AddCaptureKeyL(const TCaptureKey &aCaptureKey);
-	static void SetCaptureKey(TUint32 aHandle, const TCaptureKey &aCaptureKey);
-	static void CancelCaptureKey(TUint32 aHandle);
+	static void AddCaptureKeyL(const TKeyCaptureRequest& aRequest);
+	static void UpdateCaptureKeyL(const TKeyCaptureRequest& aRequest);
+	static void CancelCaptureKey(TKeyCaptureType aType, TAny* aHandle);
 	static void ClientDestroyed(CWsClient *aClient);
 	static inline void AddToSwitchOnEventListL(const CWsWindowBase &aWindow, TEventControl aCircumstances);
 	static inline void RemoveFromSwitchOnEventList(const CWsWindowBase &aWindow);
@@ -207,7 +208,8 @@
 	static void SendScreenDeviceChangedEvent(const CWsWindowBase *aWindow);
 	static TBool ProcessErrorMessages(TWsErrorMessage::TErrorCategory aCategory, TInt aError);
 	static void NotifyOom();
-	static void QueueKeyPress(const TKeyData& aKey, TInt aScanCode, CWsWindowGroup* aRepeatFocus, TBool aCheckRepeat,TInt aRepeats);
+	static void ProcessKeyPress(const TKeyEvent& aKeyEvent, TBool aCheckRepeat,TInt aRepeats);
+	static void QueueKeyPress(const TKeyEventRouterOutput& aOutput, TBool aIsRepeat, TInt aRepeats);
 	static void AddEventHandler(MEventHandler *aEventHandler, TBool aAdvancedPointersEnabled);
 	static void RemoveEventHandler(const MEventHandler *aEventHandler);
 	static void PotentialEventHandlerL(TInt aNum);
@@ -250,6 +252,8 @@
 	static TEventRequestQueue iScreenDeviceChangedQueue;
 	static TTime iPrevOomMessageTime;
 	static CCaptureKeys *iCaptureKeys;
+	static CKeyEventRouter *iKeyEventRouter;
+	static RLibrary iKeyEventRouterLibrary;
 	static CWsHotKey *iHotKeys;
 	static TInt iModifierState;
 	static CRawEventReceiver *iEventReceiver;
--- a/windowing/windowserver/nga/SERVER/EVQUEUE.H	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/EVQUEUE.H	Tue Jul 20 13:27:44 2010 +0300
@@ -20,7 +20,7 @@
 
 #include <e32std.h>
 #include <e32base.h>
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
 #include "W32STD.H"
 
 class CWsClient;
--- a/windowing/windowserver/nga/SERVER/PRIKEY.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/PRIKEY.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1996-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"
@@ -23,7 +23,7 @@
 	__DECLARE_NAME(_S("CPriorityKey"));
 	}
 
-void CPriorityKey::PriorityKey(TInt aHandle, const TKeyData &aKey, TInt aScanCode)
+void CPriorityKey::PriorityKey(TInt aHandle, const TKeyEvent &aKeyEvent)
 //
 // Called when a priority key is pressed
 //
@@ -31,8 +31,7 @@
 	if (!iEventMsg.IsNull())
 		{
 		iPriorityKeyHandle=aHandle;
-		iPriorityKey=aKey;
-		iScanCode=aScanCode;
+		iPriorityKey = aKeyEvent;
 		SignalEvent();
 		}
 	}
@@ -43,11 +42,8 @@
 //
 	{
 	TWsPriorityKeyEvent event;
-	TKeyEvent *key=event.Key();
-	key->iScanCode=iScanCode;
-	key->iCode=iPriorityKey.iKeyCode;
-	key->iModifiers=iPriorityKey.iModifiers;
-	key->iRepeats=0;
+	*event.Key() = iPriorityKey;
+	event.Key()->iRepeats = 0;
 	event.SetHandle(iPriorityKeyHandle);
 	CEventBase::GetData(&event,sizeof(event));
 	iPriorityKeyHandle=0;
@@ -65,7 +61,7 @@
 	return(iKeyCode==aKeycode && iModifierMask==aModifierMask && iModifiers==aModifiers);
 	}
 
-TInt TPriorityKey::KeyMatches(const TKeyData &aKey)
+TInt TPriorityKey::KeyMatches(const TKeyEvent &aKeyEvent)
 	{
-	return(iKeyCode==aKey.iKeyCode && (iModifierMask&aKey.iModifiers)==iModifiers);
+	return(iKeyCode == aKeyEvent.iCode && (iModifierMask & aKeyEvent.iModifiers) == iModifiers);
 	}
--- a/windowing/windowserver/nga/SERVER/PRIKEY.H	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/PRIKEY.H	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 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"
@@ -37,7 +37,7 @@
 public:
 	TPriorityKey(TUint aKeycode,TUint aModifierMask,TUint aModifiers,TPriorityKey *aPriorityKeys);
 	TInt Equals(TUint aKeycode,TUint aModifierMask,TUint aModifiers);
-	TInt KeyMatches(const TKeyData &aKey);
+	TInt KeyMatches(const TKeyEvent &aKeyEvent);
 public:
 	TPriorityKey *iNext;
 private:
@@ -50,12 +50,11 @@
 	{
 public:
 	CPriorityKey(CWsClient *aOwner);
-	void PriorityKey(TInt aHandle, const TKeyData &aKey, TInt aScanCode);
+	void PriorityKey(TInt aHandle, const TKeyEvent &aKeyEvent);
 	void GetData();
 private:
 	TInt iPriorityKeyHandle;
-	TKeyData iPriorityKey;
-	TInt iScanCode;
+	TKeyEvent iPriorityKey;
 	};
 
 #endif
--- a/windowing/windowserver/nga/SERVER/openwfc/CLIENT.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/openwfc/CLIENT.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -1286,6 +1286,9 @@
 		case EWsClOpCreateDrawableSource:
 			CreateDrawableSourceL(*pData.CreateDrawableSource);
 			break;
+		case EWsClOpIndicateAppOrientation:
+			IndicateAppOrientation(*pData.Orientation);
+			break;
 		default:
 			PPanic(EWservPanicOpcode);
 			break;
@@ -2138,6 +2141,17 @@
 	drawableSource->ConstructL(aDrawableSourceData);
 	CleanupStack::Pop();
 	}
+	
+void CWsClient::IndicateAppOrientation(TRenderOrientation aOrientation)
+	{
+	iIndicatedAppOrientation = aOrientation;
+	CWsTop::CheckRenderOrientation();
+	}
+
+TInt CWsClient::GetIndicatedAppOrientation()
+	{
+	return iIndicatedAppOrientation;
+	}
 
 //
 // class CWsCliObj
--- a/windowing/windowserver/nga/SERVER/openwfc/CLIENT.H	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/openwfc/CLIENT.H	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 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"
@@ -18,7 +18,7 @@
 #ifndef __CLIENT_H__
 #define __CLIENT_H__
 
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
 #include "WSGRAPHICDRAWERARRAY.H"
 
 #include <e32std.h>
@@ -146,7 +146,7 @@
 	inline void PurgePointerEvents();
 
 	// Key events
-	inline void PriorityKeyPressed(TInt aHandle, const TKeyData &aKey, TInt aScanCode);
+	inline void PriorityKeyPressed(TInt aHandle, const TKeyEvent &aKeyEvent);
 
 	// Notification of misc events
 	void AddNotificationL(TInt aKey, const RMessage2& aClientMsg);
@@ -168,6 +168,9 @@
 	TBool RetryEvent(TEventCode aEventCode);
 
     inline void WgMsgQueueOverflow();// Set flag  window group message queue is overflow and has pending messages
+    
+    //Get orientation value that app indicated
+    TInt GetIndicatedAppOrientation();
 
 private: // from MWsClient
 	TInt SendMessage(const CWsGraphicDrawer* aOnBehalfOf, const TDesC8& aData);
@@ -255,6 +258,10 @@
 	
 	// Misc
 	void SetComputeMode(RWsSession::TComputeMode aComputeMode);
+	
+	//Set orientation that application indicated
+	void IndicateAppOrientation(TRenderOrientation aOrientation);
+	
 public:
 	static TWsCmdHeaderBase iCurrentCommand;
 private:
@@ -293,6 +300,7 @@
 	RMessage2 iClientMessage;
 	RHandleBase* iResponseHandle;
 	TInt iMessageIdSeq;
+	TInt iIndicatedAppOrientation;
 
 	//Members for procerssing command buffer
 	static CWsClient* iCurrentClient;	// Client who's buffer is currently being processed
@@ -363,8 +371,8 @@
 inline void CWsClient::HandleClientRequestForPriorityKeyData()
 	{iPriorityKeyEvent->GetData();}
 
-inline void CWsClient::PriorityKeyPressed(TInt aHandle, const TKeyData &aKey, TInt aScanCode)
-	{iPriorityKeyEvent->PriorityKey(aHandle,aKey,aScanCode);}
+inline void CWsClient::PriorityKeyPressed(TInt aHandle, const TKeyEvent &aKeyEvent)
+	{iPriorityKeyEvent->PriorityKey(aHandle, aKeyEvent);}
 
 inline TInt CWsClient::ObjectHandle(const CWsObject* aThis) const
 	{return(iObjectIndex->At(aThis));}
--- a/windowing/windowserver/nga/SERVER/openwfc/GROUPWIN.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/openwfc/GROUPWIN.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1995-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"
@@ -515,9 +515,8 @@
 					CWsObject *destroyObj = iWsOwner->HandleToObj(*pData.UInt, WS_HANDLE_CAPTURE_KEY);
 					if (destroyObj)
 						{
-						//Cancel any repeat that is underway for this key
-						const TWsWinCmdCaptureKey& capKey(*pData.CaptureKey);
-						CKeyboardRepeat::CancelRepeat(this,capKey.key,EFalse,capKey.modifierMask);
+						// Cancel any repeat that is underway for this capture
+						CKeyboardRepeat::CancelRepeat(destroyObj, EFalse);
 						delete destroyObj;
 						}
 					else
@@ -535,9 +534,6 @@
 					CWsObject *destroyObj = iWsOwner->HandleToObj(*pData.UInt, WS_HANDLE_CAPTURE_KEY_UPDOWNS);
 					if (destroyObj)
 						{
-						//Cancel any repeat that is underway for this key
-						const TWsWinCmdCaptureKey& capKey(*pData.CaptureKey);
-						CKeyboardRepeat::CancelRepeat(this,capKey.key,EFalse,capKey.modifierMask);
 						delete destroyObj;
 						}
 					else
@@ -555,9 +551,8 @@
 					CWsObject *destroyObj = iWsOwner->HandleToObj(*pData.UInt, WS_HANDLE_CAPTURE_LONG_KEY);
 					if (destroyObj)
 						{
-						//Cancel any repeat that is underway for this key
-						const TWsWinCmdCaptureLongKey& capKey(*pData.CaptureLongKey);
-						CKeyboardRepeat::CancelRepeat(this,capKey.inputKey,ETrue,capKey.modifierMask);
+						// Cancel any repeat that is underway for this capture
+						CKeyboardRepeat::CancelRepeat(destroyObj, ETrue);
 						delete destroyObj;
 						} 
 					else
@@ -906,6 +901,12 @@
 TBool CWsWindowGroup::SetOrdinalPosition(TInt aPos,CWsWindowGroup* aClosingWindow)
 	{
 	TBool ret=ETrue;
+	
+	// Remember if the window group tree is actually changed or not, so that we know whether to 
+	// check the render orientation after the re-ordering is done ( see CWsTop::CheckRenderOrientation()
+	// call at end of this method
+	TBool changed = CheckOrdinalPositionChange(aPos);	
+	
 	if (!iQueue)
 		ret=DoSetOrdinalPosition1(aPos,aClosingWindow);
 	else
@@ -962,6 +963,11 @@
 #endif
 		}
 
+	// If the ordinal positions have changed, check to see if there is a new render orientation
+	// and publish it if so
+	if(changed)
+	    CWsTop::CheckRenderOrientation();
+	
 	return ret;
 	}
 
@@ -1348,13 +1354,13 @@
 		}
 	}
 
-TBool CWsWindowGroup::CheckForPriorityKey(const TKeyData &aKey, TInt aScanCode)
+TBool CWsWindowGroup::CheckForPriorityKey(const TKeyEvent &aKeyEvent)
 	{
 	for(TPriorityKey *pk=iPriorityKeys;pk;pk=pk->iNext)
 		{
-		if (pk->KeyMatches(aKey))
+		if (pk->KeyMatches(aKeyEvent))
 			{	
-			WsOwner()->PriorityKeyPressed(ClientHandle(),aKey, aScanCode);
+			WsOwner()->PriorityKeyPressed(ClientHandle(), aKeyEvent);
 			return(ETrue);
 			}
 		}
--- a/windowing/windowserver/nga/SERVER/openwfc/ScreenRedraw.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/openwfc/ScreenRedraw.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -26,9 +26,9 @@
 #include "wstop.h"
 #include "WsMemMgr.h"
 #include "renderstagemanager.h"
-#include "Graphics/WsRenderStageFactory.h"
-#include "Graphics/WsRenderStage.h"
-#include "Graphics/wsgraphicscontext.h"
+#include "graphics/WsRenderStageFactory.h"
+#include "graphics/WsRenderStage.h"
+#include "graphics/wsgraphicscontext.h"
 #include "EVENT.H"
 
 #ifdef USE_DEBUG_FRAME_CAPTURE
--- a/windowing/windowserver/nga/SERVER/openwfc/ScreenRedraw.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/openwfc/ScreenRedraw.h	Tue Jul 20 13:27:44 2010 +0300
@@ -23,7 +23,8 @@
 #include <gdi.h>
 #include "wstypes.h"
 #include "tcursor.h"
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include "graphics/wsgraphicdrawerinternal.h"
 
 class CScreen;
 class CWsRenderStage;
--- a/windowing/windowserver/nga/SERVER/openwfc/WINDOW.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/openwfc/WINDOW.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -674,6 +674,11 @@
 		aWindowTreeObserver.FlagChanged(*this, MWsWindowTreeObserver::ENonFading, ETrue); 
 		}
 	
+	if(IsTopClientWindow() && (iFlags&EFlagScreenDeviceInvalid) )
+		{
+		aWindowTreeObserver.FlagChanged(*this, MWsWindowTreeObserver::EScreenDeviceValid, EFalse);
+		}
+	
 	if(iAnimList)
 		iAnimList->SendState(aWindowTreeObserver);
 	
--- a/windowing/windowserver/nga/SERVER/openwfc/WSTOP.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/openwfc/WSTOP.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -32,7 +32,7 @@
 #include "pointer.h"
 #include "WSGRAPHICDRAWERFACTORY.H"
 #include "redrawmsgwindow.h"
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
 #include "WsMemMgr.h"
 #include "backedupwindow.h"
 #include "wsfont.h"
@@ -46,6 +46,7 @@
 #include "registeredsurfacemap.h"
 #include "windowelementset.h"
 #include "wspluginmanager.h"
+#include "renderorientationtracker.h"
 
 // IDs of p&s properties that optionally contain callbacks that may be used
 // to release singletons owned by libraries at shutdown in order to make 
@@ -209,6 +210,7 @@
 TInt CWsTop::iCheckHeapResult=KErrNotReady;
 TBool CWsTop::iDoHeapCheckAndRestart=EFalse;
 #define RFbsSession_SendCommand_ShutDownMessage 1	// A FBS message that is not published yet and probably never will be.
+CWsRenderOrienationTracker* CWsTop::iRenderOrientationTracker=NULL;
 
 static void DefineSingletonKey(const TUid& aSingletonKey)
 /**
@@ -281,6 +283,8 @@
 void CWsTop::DeleteStaticsL()
 	{
 	iShuttingDown=ETrue;
+	delete iRenderOrientationTracker;	
+	
 	CClick::DeleteStatics();
 	TWsPointer::Stop();
 	CWsClient::DeleteStatics();
@@ -553,6 +557,8 @@
 		StartShell();
 		}
 	UserSvr::WsRegisterSwitchOnScreenHandling(ETrue);
+	
+	iRenderOrientationTracker = CWsRenderOrienationTracker::NewL();	
 	}
 
 
@@ -958,6 +964,18 @@
 	return EFalse;
 	}
 
+/**
+Checks to see if the render orientation has changed, and publishes any new orientaion
+via publish and subscribe
+
+@see KRenderOrientationCategory
+@see KRenderOrientationKey 
+*/
+void CWsTop::CheckRenderOrientation()
+    {
+    iRenderOrientationTracker->CheckRenderOrientation();
+    }
+
 typedef TInt (*ShellEntryPoint)(TAny *);
 
 #if defined(__WINS__)
--- a/windowing/windowserver/nga/SERVER/openwfc/cliwin.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/openwfc/cliwin.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -1426,6 +1426,13 @@
 			iFlags&=~EFlagScreenDeviceInvalid;
 		else
 			iFlags|=EFlagScreenDeviceInvalid;
+		
+		MWsWindowTreeObserver* windowTreeObserver = iScreen->WindowTreeObserver();
+		if (windowTreeObserver)
+			{
+			windowTreeObserver->FlagChanged(*this, MWsWindowTreeObserver::EScreenDeviceValid, aState);
+			}
+		
 		return ETrue;
 		}
 	return EFalse;
--- a/windowing/windowserver/nga/SERVER/openwfc/gc.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/openwfc/gc.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -23,7 +23,7 @@
 #include "ScrDev.H"
 #include "wstop.h"
 #include "panics.h"
-#include "Graphics/WSGRAPHICDRAWER.H"
+#include "graphics/WSGRAPHICDRAWER.H"
 #include "wsfont.h"
 
 class TPlacedAttributes;
--- a/windowing/windowserver/nga/SERVER/openwfc/playbackgc.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/openwfc/playbackgc.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -25,8 +25,8 @@
 #include "windowgroup.h"
 #include "wsfont.h"
 #include "wstop.h"
-#include "Graphics/WSGRAPHICDRAWER.H"
-#include "Graphics/surfaceconfiguration.h"
+#include "graphics/WSGRAPHICDRAWER.H"
+#include "graphics/surfaceconfiguration.h"
 #include "windowelementset.h"
 
 #include <graphics/wsgraphicscontext.h>
--- a/windowing/windowserver/nga/SERVER/openwfc/redrawmsgwindow.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/openwfc/redrawmsgwindow.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -30,7 +30,7 @@
 #include "rootwin.h"
 #include "EVENT.H"
 #include "wsfont.h"
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
 #include <graphics/surface.h>
 #include "windowelementset.h"
 
--- a/windowing/windowserver/nga/SERVER/openwfc/screen.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/openwfc/screen.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-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"
@@ -28,7 +28,7 @@
 #include "W32STD.H"
 #include "w32cmd.h"
 #include "wstypes.h"
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
 #include "panics.h"
 
 #include "wsdisplaychangeao.h"
@@ -249,6 +249,7 @@
 	void ClearDsaSurface(const TRect& area, const TRgb& color);
 	void PositionUiElements(const TRect& aExtent,	const TRect& aViewport);
 	TInt SetConfiguration(const TDisplayConfiguration& aConfig);
+	TInt UpdateConfiguration(const TDisplayConfiguration& aConfig);
 	void UpdateDynamicScreenModes();
 	void RecalculateModeTwips(const TDisplayConfiguration* aConfig = NULL);
 	inline void IncreaseDisplaySpinner();
--- a/windowing/windowserver/nga/SERVER/openwfc/server.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/openwfc/server.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 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"
@@ -27,7 +27,9 @@
 #include "OBJECT.H"
 #include "CLIENT.H"
 #include "ScrDev.H"
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include <graphics/wskeyrouter.h>
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include "graphics/wsgraphicdrawerinternal.h"
 #include "WSGRAPHICDRAWERARRAY.H"
 #include "panics.h"
 
@@ -150,7 +152,7 @@
 	inline CWsWindowGroup *WindowGroup();
 	inline const CWsWindowGroup *WindowGroup() const;
 private:
-	void CmdToParams(const TWsWinCmdCaptureKey &aCaptureKey, TCaptureKey &aParams);
+	void CmdToRequest(const TWsWinCmdCaptureKey &aCaptureKey, TKeyCaptureRequest &aParams);
 private:
 	CWsWindowGroup *iWindowGroup;
 	};
@@ -181,21 +183,16 @@
 	~CWsCaptureKeyUpsAndDowns();
 	void ConstructL(const TWsWinCmdCaptureKey &aCaptureKey);
 	void CommandL(TInt aOpcode, const TAny *aCmdData);
-	static CWsWindowGroup *CheckForCapture(TUint aScanCode, TUint aModifiers);
 	inline CWsWindowGroup *WindowGroup();
 	inline const CWsWindowGroup *WindowGroup() const;
 private:
-	TUint iModifierValue;
-	TUint iModifierMask;
-	TUint iScanCode;
-	static TPriQue<CWsCaptureKeyUpsAndDowns> iCaptureKeysUpsAndDowns;
-	TPriQueLink iLink;
 	CWsWindowGroup *iWindowGroup;
 	};
 
 class CWsCaptureLongKey : public CWsObject
 	{
 	friend class CKeyboardRepeat;
+	friend class TWindowServerEvent;
 public:
 	CWsCaptureLongKey(CWsWindowGroup *owner);
 	~CWsCaptureLongKey();
@@ -203,13 +200,10 @@
 	void CommandL(TInt aOpcode, const TAny *aCmdData);
 	inline CWsWindowGroup *WindowGroup();
 	inline const CWsWindowGroup *WindowGroup() const;
-	static CWsCaptureLongKey* CheckForCapture(TUint aKeyCode, TInt aModifiers);
-public:
-	static TPriQue<CWsCaptureLongKey> iCaptureLongKeys;
 private:
-	TPriQueLink iLink;
+	TTimeIntervalMicroSeconds32 iDelay;
+	TUint iFlags;
 	CWsWindowGroup *iWindowGroup;
-	TWsWinCmdCaptureLongKey iData;
 	};
 
 //--------------------------------
@@ -340,6 +334,7 @@
 	void StartL();
 	TInt SessionCount();
 	MWsAnimationScheduler* AnimationScheduler();
+	void PrepareShutdown();
 	TBool ReleaseMemory();
 	void DestroySessionsForShutdown();
 	void SetPinClientDescriptors(TBool aPin);
--- a/windowing/windowserver/nga/SERVER/openwfc/wspluginmanager.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/openwfc/wspluginmanager.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -14,7 +14,7 @@
 //
 
 #include "wspluginmanager.h"
-#include "Graphics/WSPLUGIN.H"
+#include "graphics/WSPLUGIN.H"
 #include "inifile.h"
 
 GLREF_D CDebugLogBase* wsDebugLog;
--- a/windowing/windowserver/nga/SERVER/openwfc/wspluginmanager.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/openwfc/wspluginmanager.h	Tue Jul 20 13:27:44 2010 +0300
@@ -17,8 +17,8 @@
 #define __WSPLUGINMANAGER_H__
 
 #include <e32base.h>
-#include "Graphics/WSPLUGIN.H"
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include "graphics/WSPLUGIN.H"
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
 
 /**
 The window server has a single plugin manager object, which maintains the set
--- a/windowing/windowserver/nga/SERVER/openwfc/wstop.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/openwfc/wstop.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2003-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"
@@ -56,6 +56,7 @@
 #endif
 	};
 
+class CWsRenderOrienationTracker;
 class CWsTop
 	{
 	enum {EShellBootModeReboot=0,EShellBootModeNoReboot=1,EShellBootModeExit=2};
@@ -122,6 +123,7 @@
 	static TBool MultiFocusPolicy();
 	
 	static inline CWsPluginManager *PluginManager();
+	static void CheckRenderOrientation();
 	
 private:
 	static void InitLogging();
@@ -152,6 +154,7 @@
 	static TInt iCheckHeapResult;
 	static TBool iDoHeapCheckAndRestart;
 	static CWsPluginManager *iPluginManager;
+    static CWsRenderOrienationTracker* iRenderOrientationTracker;	
 	};
 	
 NONSHARABLE_CLASS(CWsActiveScheduler): public CActiveScheduler, public MWsActiveSchedulerDebug
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/nga/SERVER/renderorientationtracker.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,570 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This material, including documentation and any related
+// computer programs, is protected by copyright controlled by
+// Nokia. All rights are reserved. Copying, including
+// reproducing, storing, adapting or translating, any
+// or all of this material requires the prior written consent of
+// Nokia. This material also contains confidential
+// information which may not be disclosed to others without the
+// prior written consent of Nokia.
+//
+// Description:
+// Render Orientation Tracking and Publication
+// 
+
+#include <hal.h>
+#include <e32std.h>
+#include "renderorientationtracker.h"
+#include "rootwin.h"
+#include "windowgroup.h"
+#include "wstop.h"
+#include "..\debuglog\DEBUGLOG.H"
+
+extern CDebugLogBase* wsDebugLog;
+
+/** Convert a TRenderOrientation value into a TDigitiserOrientation.
+Note: The algorithm used makes use of the ordering of the values of the respective enums, 
+thus this is checked for (at compile time) at the start of the function.
+@param aWservOrientation A value from the TRenderOrientation enums.
+@return The equivalent value from the TDigitiserOrientation enums.
+*/
+inline HALData::TDigitiserOrientation WservToDigitiser(TRenderOrientation aWservOrientation)
+	{
+	__ASSERT_COMPILE(EDisplayOrientationNormal+1 == EDisplayOrientation90CW);
+	__ASSERT_COMPILE(EDisplayOrientationNormal+2 == EDisplayOrientation180);
+	__ASSERT_COMPILE(EDisplayOrientationNormal+3 == EDisplayOrientation270CW);
+	__ASSERT_COMPILE(HALData::EDigitiserOrientation_000+1 == HALData::EDigitiserOrientation_090);
+	__ASSERT_COMPILE(HALData::EDigitiserOrientation_000+2 == HALData::EDigitiserOrientation_180);
+	__ASSERT_COMPILE(HALData::EDigitiserOrientation_000+3 == HALData::EDigitiserOrientation_270);
+	HALData::TDigitiserOrientation ret=static_cast<HALData::TDigitiserOrientation>
+			(HALData::EDigitiserOrientation_000 + (aWservOrientation - EDisplayOrientationNormal));
+	return ret;
+	}
+
+// Todo remove/undefine this for release
+#define TECHVIEW_TESTMODE
+
+CWsRenderOrienationTracker* CWsRenderOrienationTracker::NewL()
+    {
+    CWsRenderOrienationTracker* self = new(ELeave)CWsRenderOrienationTracker();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+CWsRenderOrienationTracker::CWsRenderOrienationTracker()
+    : CActive(CActive::EPriorityStandard),
+      iRenderOrientationTrackingType(EDisplayOrientationNormal),
+      iPublishedRenderOrientation(EDisplayOrientationNormal)
+    {
+    CActiveScheduler::Add(this);    
+    }
+
+void CWsRenderOrienationTracker::ConstructL()
+    {    
+    const TSecurityPolicy   KRenderOrientationReadSecurityPolicy(ECapability_None);
+    const TSecurityPolicy   KRenderOrientationWriteSecurityPolicy(ECapabilityWriteDeviceData);
+    
+    // Define P&S Property to publish to
+    TInt error = RProperty::Define( KRenderOrientationCategory,
+                                    KRenderOrientationKey,
+                                    RProperty::EInt,
+                                    KRenderOrientationReadSecurityPolicy,
+                                    KRenderOrientationWriteSecurityPolicy);
+
+    // Attach the publisher for real-time publishing
+    if(KErrNone == error)
+        error = iRenderOrientationPublisher.Attach( KRenderOrientationCategory,
+                                                    KRenderOrientationKey);
+
+    // Publish the initial value
+    if(KErrNone == error)    
+        error = DoPublishOrientation(EDisplayOrientationNormal);
+    
+    //Set the initial value to HAL
+    if(KErrNone == error)
+        SetHALOrientation(EDisplayOrientationNormal);
+    
+    if (wsDebugLog && KErrNone!=error)
+        {
+        _LIT(logText,"Orientation Tracker: failed to initialise with error %d");
+        wsDebugLog->MiscMessage(CDebugLogBase::ELogImportant,logText,error);
+        }    
+    User::LeaveIfError(error);
+    }
+
+CWsRenderOrienationTracker::~CWsRenderOrienationTracker()
+    {
+    Cancel();
+    iRenderOrientationPublisher.Delete(KRenderOrientationCategory, KRenderOrientationKey);
+    iRenderOrientationPublisher.Close();
+    }
+
+/**
+If the orientation of the given window group is useable updates aOrientationTrackingType with the orientation
+
+@param Input: the window group to check
+@param Output: the window group's orientation if usable ( otherwise unchanged )
+@return KErrNone if the orienation is usable, KErrNotFound if the orientation is not useable, KErrNotSupported if the orientation is unknown
+*/
+TInt CWsRenderOrienationTracker::CheckWindowGroupOrientation(const CWsWindowGroup& aWinGroup, TRenderOrientationTrackingType& aOrientationTrackingType)
+    {
+    TInt error = KErrNone;
+    TRenderOrientationTrackingType tempOrientationTrackingType = static_cast<TRenderOrientationTrackingType>(aWinGroup.WsOwner()->GetIndicatedAppOrientation());
+    switch(tempOrientationTrackingType)
+        {
+        case EDisplayOrientationNormal:
+        case EDisplayOrientation90CW:                
+        case EDisplayOrientation180:
+        case EDisplayOrientation270CW:            
+        case EDisplayOrientationAuto:
+            aOrientationTrackingType = tempOrientationTrackingType;
+            break;
+
+        case EDisplayOrientationIgnore:
+            error = KErrNotFound;
+            if (wsDebugLog)
+                {
+                _LIT(logText,"Orientation Tracker: winGroup %08x orientation is set to be ignored");
+                wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything,logText,reinterpret_cast<TInt>(&aWinGroup));
+                }            
+            break;
+
+        default:
+            error = KErrNotSupported;
+            if (wsDebugLog)
+                {
+                _LIT(logText,"Orientation Tracker: winGroup %08x has undefined orientation, Error %d");                
+                TBuf<LogTBufSize> buf;
+                buf.Format(logText, &aWinGroup, error);                
+                wsDebugLog->MiscMessage(CDebugLogBase::ELogIntermediate,buf);
+                }                          
+            break;             
+        }
+    
+    return error;
+    }
+
+/**
+Checks that the given group window is appropriate for dictating the render orientation
+
+@param Input:  The group window to check
+@return ETrue is the group window is usable, else EFalse  
+*/
+TBool CWsRenderOrienationTracker::UseableGroupWindow(const CWsWindowGroup& aWinGroup) const
+    {
+#ifdef TECHVIEW_TESTMODE
+    // for some reason IsFocusable seems to return 0 and 2, not 0 and 1
+    return NULL!=aWinGroup.Child() &&
+            (aWinGroup.IsFocusable() ? ETrue : EFalse);
+#else    
+    return (NULL!=aWinGroup.Child());     
+#endif
+    }
+
+/**
+Finds the topmost usable windowgroup which has a usable orientation, and outputs that orientation
+
+@param Output: The current render orientation
+@return KErrNone if successful, KErrNotFound if the focus window group is not usable, KErrNotSupported if an invalid orientation is found
+*/
+TInt CWsRenderOrienationTracker::GetFocusWindowOrientation(TRenderOrientationTrackingType& aOrientationTrackingType)
+    {
+    TInt error = KErrNone;
+    CWsWindowGroup* focusWinGroup = CWsTop::FocusWindowGroup();    
+    if(!focusWinGroup)
+        {
+        if(wsDebugLog)
+            {
+            _LIT(logText,"Orientation Tracker: focusWinGroup not found");
+            wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything,logText);
+            }
+        error = KErrNotFound;
+        }
+    else
+        {
+        error = CheckWindowGroupOrientation(*focusWinGroup, aOrientationTrackingType);
+        }
+    return error;
+    }
+
+/**
+Finds the topmost usable windowgroup which has a usable orientation, and outputs that orientation
+
+@param Output: The current render orientation
+@return KErrNone if successful, KErrNotSupported if an invalid orientation is found
+*/
+TInt CWsRenderOrienationTracker::FindOrientationFromWindowTree(TRenderOrientationTrackingType& aOrientationTrackingType)
+    {
+    TInt error = KErrNone;
+    TRenderOrientationTrackingType tempOrientationTrackingType = iRenderOrientationTrackingType;
+    CWsRootWindow* rootWin = CWsTop::CurrentFocusScreen()->RootWindow();
+    TBool finished = EFalse;
+    for(CWsWindowGroup* winGroup = rootWin->Child(); !finished && NULL != winGroup; winGroup = winGroup->NextSibling())
+        {
+        if (wsDebugLog)
+            {
+            _LIT(logText,"Orientation Tracker: winGroup %08x has priority %d, Orientation %d, Focusable %d, Child %08x");
+            TBuf<LogTBufSize> buf;
+            buf.Format(logText, winGroup, winGroup->OrdinalPriority(), winGroup->WsOwner()->GetIndicatedAppOrientation(),
+                    winGroup->IsFocusable()?ETrue:EFalse, winGroup->Child());                                
+            wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything,buf);
+            }               
+        // winGroup is a higher priority ordinal, so see if it has an orientation that can be used
+        // although we're only interested in window groups with child windows otherwise nothing is visible anyway        
+        if(UseableGroupWindow(*winGroup))
+            {
+            error = CheckWindowGroupOrientation(*winGroup, tempOrientationTrackingType);
+            switch(error)
+                {
+                case KErrNone:
+                    {
+                    // List is in order, so just find the first one
+                    if (wsDebugLog)
+                        {
+                        _LIT(logText,"Orientation Tracker: Found winGroup %08x with Orientation %d");
+                        TBuf<LogTBufSize> buf;
+                        buf.Format(logText, winGroup, winGroup->WsOwner()->GetIndicatedAppOrientation());                    
+                        wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything,buf);
+                        }
+                    finished = ETrue;
+                    break;
+                    }
+
+                case KErrNotFound:
+                    // so keep searching
+                    break;                    
+                    
+                case KErrNotSupported:
+                default:
+                    finished = ETrue;
+                    break;
+                    
+                }
+            
+            }
+        }
+    // Safe even in error code as won't have been changed by CheckWindowGroupOrientation
+    aOrientationTrackingType = tempOrientationTrackingType;
+    
+    return error;
+    }
+
+/**
+First checks to see if the focus window group has a usable orientation, if so that is output.
+Otherwise, finds the topmost usable windowgroup which has a usable orientation, and outputs that
+
+@param Output: The current render orientation
+@return KErrNone if successful, KErrNotSupported if an invalid orientation is found 
+ */
+TInt CWsRenderOrienationTracker::GetIndicatedOrientation(TRenderOrientationTrackingType& aOrientationTrackingType)
+    {
+    // First check the focus window group
+    TInt error = GetFocusWindowOrientation(aOrientationTrackingType);
+
+    // Don't look for another window if the focus window is usable
+    // or if an error has occured, then don't change current orientation
+    switch(error)
+        {
+        case KErrNone:
+            {
+            if(wsDebugLog)
+                {
+                _LIT(logText,"Orientation Tracker: Using focus window %08x for orientation");
+                wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything,logText,reinterpret_cast<TInt>(CWsTop::FocusWindowGroup()));
+                }
+            break;
+            }
+        
+        case KErrNotFound:
+            {
+            // Can't use focus window group, so find the topmost windowgroup with a valid orientation
+            error = FindOrientationFromWindowTree(aOrientationTrackingType);
+            break;
+            }
+            
+        default:
+            // Unrecoverable error, abort and leave published orientation unchanged
+            break;
+        }
+    
+    return error;
+    }
+
+/**
+Checks to see if the render orientation has changed, and publishes any new orientaion
+via publish and subscribe
+
+@see KRenderOrientationCategory
+@see KRenderOrientationKey 
+*/
+void CWsRenderOrienationTracker::CheckRenderOrientation()
+    {
+    TRenderOrientationTrackingType newOrientationTrackingType = iRenderOrientationTrackingType;    
+    TInt error = GetIndicatedOrientation(newOrientationTrackingType);
+
+    // if the tracking type has changed...
+    if(KErrNone == error && iRenderOrientationTrackingType != newOrientationTrackingType)
+        {
+        if(EDisplayOrientationAuto == iRenderOrientationTrackingType)
+            {
+            // change from auto type, so we need to cancel request for updates from the theme server        
+            Cancel();
+            }    
+        iRenderOrientationTrackingType = newOrientationTrackingType;
+        if(EDisplayOrientationAuto == iRenderOrientationTrackingType)
+            {
+            // Change to auto type, so we need to request updates from the theme server            
+            // Attach to the Theme server to get orientation change updates
+            error = iThemeOrientationProperty.Attach( KThemeOrientationCategory, KThemeOrientationKey );
+            if (wsDebugLog)
+                {
+                if(KErrNone == error)
+                    {
+                    // Information Log
+                    _LIT(logText,"Orientation Tracker: Attached to theme orientation property");
+                    wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything,logText);
+                    }
+                else
+                    {
+                    // Error Log
+                    _LIT(logText,"Orientation Tracker: Error %d attaching to theme orientation property");
+                    wsDebugLog->MiscMessage(CDebugLogBase::ELogIntermediate,logText, error);                
+                    }
+                }              
+            
+            RequestDeviceOrientationNotification();
+            }
+        // See if the  has changed, and publish if it has        
+        error = DoOrientationTracking();
+        }
+
+    if (wsDebugLog && KErrNone != error)
+        {
+        _LIT(logText,"Orientation Tracker: Error %d Checking Render Orientation");
+        wsDebugLog->MiscMessage(CDebugLogBase::ELogImportant,logText, error);
+        }  
+    }
+
+/**
+Requests notification of change of the theme server orientation
+
+@Pre iThemeOrientationProperty has had Attach called on it
+*/
+void CWsRenderOrienationTracker::RequestDeviceOrientationNotification()
+    {
+    if(!IsActive())
+        {
+        if (wsDebugLog)
+            {
+            _LIT(logText,"Orientation Tracker: Subscribing to theme orientation property");
+            wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything,logText);
+            }          
+        // Request for Theme Server Orientation P&S  
+        iThemeOrientationProperty.Subscribe(iStatus);        
+        SetActive();
+        }
+    }
+
+/**
+Cancels and closes (detaches) from the theme orientation publish and subscribe
+*/
+void CWsRenderOrienationTracker::CancelDeviceOrientationNotification()
+    {
+    // Cancel Request for Theme Server Orientation P&S  
+    iThemeOrientationProperty.Cancel();
+    iThemeOrientationProperty.Close();
+    
+    if (wsDebugLog)
+        {
+        _LIT(logText,"Orientation Tracker: Cancelled/closed theme orientation property");
+        wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything,logText);
+        }      
+    }
+
+/**
+Called when the theme servers orientation has changed.
+Re-requests unless cancelled
+*/
+void CWsRenderOrienationTracker::RunL()
+    {
+    TInt error = iStatus.Int();
+    if(KErrNone == error)
+        {
+        // Re-request
+        RequestDeviceOrientationNotification();
+    
+        TInt error = DoOrientationTracking();
+        if (wsDebugLog && KErrNone != error)
+            {
+            _LIT(logText,"Orientation Tracker: Error %d processing theme orientation property");
+            wsDebugLog->MiscMessage(CDebugLogBase::ELogImportant,logText, error);
+            }         
+        }
+    else if (wsDebugLog && KErrCancel != error)
+        {
+        _LIT(logText,"Orientation Tracker: Error %d from theme orientation property, not resubscribed");
+        wsDebugLog->MiscMessage(CDebugLogBase::ELogImportant,logText, error);     
+        }
+    }
+
+/**
+Cancels the request for notification for changes to theme orientation
+*/
+void CWsRenderOrienationTracker::DoCancel()
+    {
+    CancelDeviceOrientationNotification();
+    }
+
+/**
+Gets the orientation published from theme server
+
+@param Output: the theme server orientation
+@return KErrNone if successful, KErrNotSupported if the theme server returns an unknown orientation, else any of the system wide error codes 
+*/
+TInt CWsRenderOrienationTracker::GetThemeOrientation(TRenderOrientation& aThemeOrientation)
+    { 
+    TInt themeOrientation=EDisplayOrientationNormal;
+    TInt error = iThemeOrientationProperty.Get(themeOrientation);
+    if(wsDebugLog && KErrNone != error)
+        {
+        _LIT(logText,"Orientation Tracker: Error %d getting theme orientation property");
+        wsDebugLog->MiscMessage(CDebugLogBase::ELogIntermediate,logText, error);     
+        }
+    
+    if(KErrNone == error)
+        {
+        // Translate the received orientation    
+        switch(themeOrientation)
+            {           
+            case EDisplayOrientationNormal:
+            case EDisplayOrientation90CW:
+            case EDisplayOrientation180:
+            case EDisplayOrientation270CW:
+                // only update if orientation is supported
+                aThemeOrientation = static_cast<TRenderOrientation>(themeOrientation);
+                break;
+            
+            default:
+                error = KErrNotSupported;
+                if (wsDebugLog)
+                    {
+                    _LIT(logText,"Orientation Tracker: Unsupported orientation %d from theme orientation property, Error %d");
+                    TBuf<LogTBufSize> buf;
+                    buf.Format(logText, themeOrientation, error);
+                    wsDebugLog->MiscMessage(CDebugLogBase::ELogIntermediate,buf);     
+                    }                
+                break;
+            }
+        }
+    return error;  
+    }
+
+/**
+Processes the indicated orientation into an actual orientation
+
+@return KErrNone for success, KErrNotSupported if the orientation is unknown, else any of the system wide error codes
+*/
+TInt CWsRenderOrienationTracker::DoOrientationTracking()
+    {
+    TInt error = KErrNone;
+    TRenderOrientation newDeviceOrientation;
+    switch(iRenderOrientationTrackingType)
+        {
+        case EDisplayOrientationNormal:
+        case EDisplayOrientation90CW:                
+        case EDisplayOrientation180:
+        case EDisplayOrientation270CW:            
+            newDeviceOrientation = iRenderOrientationTrackingType;
+            break;
+            
+        case EDisplayOrientationAuto:
+            error = GetThemeOrientation(newDeviceOrientation);
+            break;
+                      
+        default:
+            error = KErrNotSupported;
+            if (wsDebugLog)
+                {
+                _LIT(logText,"Orientation Tracker: Unsupported orientation tracking type %d, error %d");
+                TBuf<LogTBufSize> buf;
+                buf.Format(logText, iRenderOrientationTrackingType, error);
+                wsDebugLog->MiscMessage(CDebugLogBase::ELogIntermediate,buf);     
+                }              
+            break;            
+        }    
+
+    if(KErrNone == error)
+        {
+        error = PublishOrientation(newDeviceOrientation);
+        }
+    
+    return error;
+    }
+
+/**
+Publishes the given value
+
+@param The render orientation to publish
+@return KErrNone for success, else any of the system wide erro codes
+*/
+TInt CWsRenderOrienationTracker::DoPublishOrientation(const TRenderOrientation aRenderOrientation)
+    {
+    TInt error = iRenderOrientationPublisher.Set(aRenderOrientation);
+         
+    // if it's published OK, then remember the newly published value
+    if(KErrNone == error)
+        {
+        iPublishedRenderOrientation = aRenderOrientation;
+        if(wsDebugLog)
+            {
+            _LIT(logText,"Orientation Tracker: Published render orientation %d");
+            wsDebugLog->MiscMessage(CDebugLogBase::ELogEverything, logText, aRenderOrientation);
+            }
+        }
+    else if(wsDebugLog)
+        {
+        _LIT(logText,"Orientation Tracker: Error %d setting render orientation property");
+        wsDebugLog->MiscMessage(CDebugLogBase::ELogIntermediate, logText, error);                   
+        }
+    return error;
+    }
+
+void CWsRenderOrienationTracker::SetHALOrientation(const TRenderOrientation aRenderOrientation)
+    {
+    // If the render orientation is EDisplayOrientationAuto then don't update HAL
+    // The application and HAL should always have the same state for the orientation.
+    if(EDisplayOrientationAuto != aRenderOrientation)
+        {
+        TInt error = HAL::Set(CWsTop::CurrentFocusScreen()->ScreenNumber(), HALData::EDigitiserOrientation, WservToDigitiser(iPublishedRenderOrientation));
+        //Just log the error if there is one.
+        if(wsDebugLog && error != KErrNone)
+            {
+            _LIT(logText,"Orientation Tracker: Error %d setting digitiser orientation");
+            wsDebugLog->MiscMessage(CDebugLogBase::ELogIntermediate, logText, error);           
+            } 
+        }
+    }
+
+/**
+If the current orientation differs from the previously published value then publishes the current value
+
+@param The render orientation to check and publish
+@return KErrNone for success, else any of the system wide erro codes
+*/
+TInt CWsRenderOrienationTracker::PublishOrientation(const TRenderOrientation aRenderOrientation)
+    {
+    TInt error = KErrNone;
+  
+    if(aRenderOrientation != iPublishedRenderOrientation)
+        {
+        // If the device Orientation has changed, publish it
+        error = DoPublishOrientation(aRenderOrientation);
+        if(KErrNone == error)
+            SetHALOrientation(aRenderOrientation);
+        }
+    return error;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/nga/SERVER/renderorientationtracker.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,71 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This material, including documentation and any related
+// computer programs, is protected by copyright controlled by
+// Nokia. All rights are reserved. Copying, including
+// reproducing, storing, adapting or translating, any
+// or all of this material requires the prior written consent of
+// Nokia. This material also contains confidential
+// information which may not be disclosed to others without the
+// prior written consent of Nokia.
+//
+// Description:
+// Render Orientation Tracking and Publication
+// 
+
+#ifndef renderorientationtracker_h
+#define renderorientationtracker_h
+
+#include <e32std.h>
+#include <e32base.h>
+#include <e32property.h>
+#include <w32std.h>
+#include <wspublishandsubscribedata.h>
+
+// Values for the device orientation that we receive via P&S from the Theme Server
+// Todo FIX THIS Category UID!!!
+const TUid  KThemeOrientationCategory   = {0x20022E82}; // == KHbPsHardwareCoarseOrientationCategoryUid 
+const TUint KThemeOrientationKey        = 0x4F726965; // == KHbPsHardwareCoarseOrientationKey 
+
+typedef TRenderOrientation TRenderOrientationTrackingType; 
+
+class CWsWindowGroup;
+
+class CWsRenderOrienationTracker : public CActive
+    {
+public:  
+    static CWsRenderOrienationTracker* NewL();
+    ~CWsRenderOrienationTracker();
+
+    void CheckRenderOrientation();
+
+private:   
+    CWsRenderOrienationTracker();
+    void ConstructL();
+    
+    void RequestDeviceOrientationNotification();
+    void CancelDeviceOrientationNotification();
+    
+    // CActive
+    void RunL();
+    void DoCancel();
+    
+    TInt DoOrientationTracking();
+    TInt GetThemeOrientation(TRenderOrientation& aThemeOrientation);
+    TInt PublishOrientation(const TRenderOrientation aRenderOrientation);
+    TInt DoPublishOrientation(const TRenderOrientation aRenderOrientation);
+    TInt GetIndicatedOrientation(TRenderOrientationTrackingType& aOrientationTrackingType);
+    TInt CheckWindowGroupOrientation(const CWsWindowGroup& aWinGroup, TRenderOrientationTrackingType& aOrientationTrackingType);
+    TBool UseableGroupWindow(const CWsWindowGroup& aWinGroup) const;
+    TInt GetFocusWindowOrientation(TRenderOrientationTrackingType& aOrientationTrackingType);
+    TInt FindOrientationFromWindowTree(TRenderOrientationTrackingType& aOrientationTrackingType);    
+    void SetHALOrientation(const TRenderOrientation aRenderOrientation);
+    
+private:    
+    TRenderOrientationTrackingType  iRenderOrientationTrackingType;    
+    TRenderOrientation              iPublishedRenderOrientation;
+    RProperty                       iThemeOrientationProperty;
+    RProperty                       iRenderOrientationPublisher;
+    };
+
+#endif
--- a/windowing/windowserver/nga/SERVER/renderstagemanager.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/renderstagemanager.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -21,7 +21,7 @@
 #include "renderstagemanager.h"
 #include "wspluginmanager.h"
 
-#include "Graphics/WsRenderStageFactory.h"
+#include "graphics/WsRenderStageFactory.h"
 
 //  Constants
 
--- a/windowing/windowserver/nga/SERVER/scrdev.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/scrdev.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -33,7 +33,7 @@
 #include <graphics/wsdisplaycontrol.h>
 #include "wsdisplaychangeao.h"
 #include <graphics/wstestscreencapture.h>
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
 
 const TInt KEikSrvsSid=0x10003a4a;
 
--- a/windowing/windowserver/nga/SERVER/windowgroup.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/windowgroup.h	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-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"
@@ -82,7 +82,7 @@
 	void AddPriorityKeyL(TUint aKeycode, TUint aModifierMask, TUint aModifiers);
 	void RemovePriorityKey(TUint aKeycode, TUint aModifierMask, TUint aModifiers);
 	void RemoveAllPriorityKeys();
-	TBool CheckForPriorityKey(const TKeyData &aKey, TInt aScanCode);
+	TBool CheckForPriorityKey(const TKeyEvent &aKeyEvent);
 	inline CWsPointerCursor *GroupPointerCursor() const;
 	static CWsWindowGroup *WindowGroupFromIdentifier(TInt aIdentifier);
 	static CWsWindowGroup *WindowGroupFromIdentifierL(TInt aIdentifier);
@@ -110,7 +110,7 @@
 	void SetScreenDevice(DWsScreenDevice *aDevice);
 	static void SetEventQueueTestState(TBool aEventQueState);
 	TBool HasVisibleTranslucentChild();
-	void  ReleasePendedMessage();
+	void  ReleasePendedMessage();	
 private:
 	void SwitchToOwningWindow(CWsWindowGroup *aClosingWindow);
 	void MoveChainedWindows(TDblQueIter<CWsWindowGroup>& aIter,TBool aForward,TInt aPos,CWsWindowGroup* aClosingWindow);
--- a/windowing/windowserver/nga/SERVER/wsdisplaychangeao.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/wsdisplaychangeao.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// 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"
@@ -243,6 +243,27 @@
 	Cancel();
 	}
 
+void CWsConfigChangeNotifier::UpdateLastSetConfiguration(TDisplayConfiguration& aNewConfig)
+    {
+    TSize resolution(0,0);
+    if (aNewConfig.GetResolution(resolution))
+        {
+        iLastSetConfig.SetResolution(resolution);
+        }
+    
+    TSize resolutionTwips(0,0);
+    if (aNewConfig.GetResolutionTwips(resolutionTwips))
+        {
+        iLastSetConfig.SetResolutionTwips(resolutionTwips);   
+        }
+    
+    TDisplayConfiguration1::TRotation rotation;
+    if (aNewConfig.GetRotation(rotation))
+        {
+        iLastSetConfig.SetRotation(rotation);
+        }
+    }
+
 void CWsConfigChangeNotifier::RunL()
 	{
 	if(iStatus == KErrNone)
@@ -259,6 +280,29 @@
 			iRetry->CancelRetry();
 			
 			iOwner->IncreaseConfigSpinner();
+			
+			//if the config change comes from a render stage then ensure screen device size 
+			//is also updated
+			TSize currentRes;
+			currentConfig.GetResolution(currentRes);
+			TBool disconnected = (currentRes.iHeight == 0 || currentRes.iWidth == 0) ? ETrue : EFalse;
+            
+			//if the config change is due to CScreen::SetConfiguration() being called then we
+			//don't want to update it again. Only update if the configs are different and the
+			//display is connected...
+			TDisplayConfiguration lastSetConfig(iLastSetConfig);
+			if (!((currentConfig == lastSetConfig) || (disconnected)))
+			    {
+                TDisplayConfiguration1::TRotation rotation;
+                if (lastSetConfig.GetRotation(rotation))
+                    {
+                    //use the latest rotation value to ensure we don't get any
+                    //inconsistencies with the layer extents
+                    currentConfig.SetRotation(rotation);
+                    }
+                iOwner->UpdateConfiguration(currentConfig);
+			    }		
+			
 			//put config change event on queue
 			RPointerArray<CWsClient> clientArray;
 			CleanupClosePushL(clientArray);
@@ -282,6 +326,7 @@
 				iRetry->Retry(KRetryInitialDelay);
 				}
 			}
+		iNextLevelInterface->GetConfiguration(iLastSetConfig);
 		}
 	else if(iStatus != KErrCancel && iStatus != KErrNotSupported)
 		{
--- a/windowing/windowserver/nga/graphicdrawer/graphicdrawer.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/graphicdrawer/graphicdrawer.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -17,8 +17,8 @@
 //
 
 #include "../SERVER/w32cmd.h"
-#include "Graphics/WSGRAPHICDRAWER.H"
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include "graphics/WSGRAPHICDRAWER.H"
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
 #include <s32mem.h>
 #include "panics.h"
 
--- a/windowing/windowserver/nga/graphicdrawer/graphicdrawerarray.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/graphicdrawer/graphicdrawerarray.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -14,8 +14,8 @@
 //
 
 #include "WSGRAPHICDRAWERARRAY.H"
-#include "Graphics/WSGRAPHICDRAWER.H"
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include "graphics/WSGRAPHICDRAWER.H"
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
 #include "panics.h"
 
 // CWsGraphicDrawerArray::XRollBackBase \\\\\\\\\\\\\\\\\\\\\\\\
--- a/windowing/windowserver/nga/graphicdrawer/graphicdrawerenvironment.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/graphicdrawer/graphicdrawerenvironment.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -13,8 +13,9 @@
 // Description:
 //
 
-#include "Graphics/WSGRAPHICDRAWER.H"
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include "graphics/WSGRAPHICDRAWER.H"
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include "graphics/wsgraphicdrawerinternal.h"
 
 // TGraphicDrawerId \\\\\\\\\\\\\\\\\\\\\\\\
 
--- a/windowing/windowserver/nga/graphicdrawer/graphicdrawerfactory.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/graphicdrawer/graphicdrawerfactory.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -16,8 +16,8 @@
 //
 
 #include "WSGRAPHICDRAWERFACTORY.H"
-#include "Graphics/WSGRAPHICDRAWER.H"
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include "graphics/WSGRAPHICDRAWER.H"
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
 #include "panics.h"
 #include <bitstd.h>
 
--- a/windowing/windowserver/nga/graphicdrawer/graphicmsgbuf.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/graphicdrawer/graphicmsgbuf.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -13,7 +13,7 @@
 // Description:
 //
 
-#include "Graphics/WSGRAPHICMSGBUF.H"
+#include "graphics/WSGRAPHICMSGBUF.H"
 #include "W32STDGRAPHIC.H"
 
 //so sue us; fixing a very nasty-to-track-down unsigned/signed conversion defect in code below
--- a/windowing/windowserver/nga/graphicdrawer/wsplugin.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/graphicdrawer/wsplugin.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -17,7 +17,7 @@
 // 
 //
 
-#include "Graphics/WSPLUGIN.H"
+#include "graphics/WSPLUGIN.H"
 #include <s32mem.h>
 
 _LIT(KPluginName, "unnamed");
--- a/windowing/windowserver/nga/graphicdrawer/wsrenderstage.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/graphicdrawer/wsrenderstage.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -15,7 +15,7 @@
 // 
 //
 
-#include "Graphics/WsRenderStage.h"
+#include "graphics/WsRenderStage.h"
 
 // CWsRenderStage::CPimpl \\\\\\\\\\\\\\\\\\\\\\\\
 
--- a/windowing/windowserver/nga/remotegc/CommandBuffer.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/remotegc/CommandBuffer.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -13,7 +13,7 @@
 // Description:
 //
 
-#include "Graphics/WSGRAPHICMSGBUF.H"
+#include "graphics/WSGRAPHICMSGBUF.H"
 #include "DrawSection.h"
 #include "CommandBuffer.h"
 #include "BitmapCache.h"
--- a/windowing/windowserver/nga/remotegc/DrawSection.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nga/remotegc/DrawSection.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -13,7 +13,7 @@
 // Description:
 //
 
-#include "Graphics/WSGRAPHICMSGBUF.H"
+#include "graphics/WSGRAPHICMSGBUF.H"
 #include "DrawSection.h"
 
 const TInt KBufferSize = 1000;
--- a/windowing/windowserver/nonnga/CLIENT/RWS.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nonnga/CLIENT/RWS.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -22,6 +22,7 @@
 #include "CLIENT.H"
 #include "wstraces.h"
 #include "graphics/windowserverconstants.h"
+#include <wspublishandsubscribedata.h>
 
 const TInt KMaxWSERVMessagesSlot=-1;
 
@@ -2422,3 +2423,10 @@
 	{
 	ASSERT(0);
 	}
+
+EXPORT_C void RWsSession::IndicateAppOrientation(TRenderOrientation aOrientation)
+	/** Dummy implementation in order to preserve compatibility with WSERV NGA.
+	@internalComponent */
+	{
+	ASSERT(0);
+	}
--- a/windowing/windowserver/nonnga/SERVER/WSTOP.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/nonnga/SERVER/WSTOP.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -18,6 +18,7 @@
 #include "wstop.h"
 
 #include <hal.h>
+#include <graphics/fbsdefs.h>
 #include "ANIM.H"
 #include "gc.h"
 #include "playbackgc.h"
--- a/windowing/windowserver/stdgraphic/BITMAPANIMATIONGRAPHICDRAWER.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/stdgraphic/BITMAPANIMATIONGRAPHICDRAWER.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -15,8 +15,8 @@
 
 #include "stdgraphicdrawer.h"
 #include "wsgraphicdrawercontext.h"
-#include "Graphics/WSGRAPHICMSGBUF.H"
-#include "Graphics/W32STDGRAPHICTEST.H"
+#include "graphics/WSGRAPHICMSGBUF.H"
+#include "graphics/W32STDGRAPHICTEST.H"
 #include <s32mem.h>
 #include <fbs.h>
 #include "W32STDGRAPHIC.H"
--- a/windowing/windowserver/stdgraphic/stdgraphicdrawer.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/stdgraphic/stdgraphicdrawer.h	Tue Jul 20 13:27:44 2010 +0300
@@ -16,8 +16,8 @@
 #ifndef __STDGRAPHICDRAWER_H__
 #define __STDGRAPHICDRAWER_H__
 
-#include "Graphics/WSGRAPHICDRAWER.H"
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include "graphics/WSGRAPHICDRAWER.H"
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
 #include <icl/imagedata.h>
 #include "stdgraphictestdrawer.h"
 
--- a/windowing/windowserver/stdgraphic/stdgraphictest.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/stdgraphic/stdgraphictest.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -13,7 +13,7 @@
 // Description:
 //
 
-#include "Graphics/W32STDGRAPHICTEST.H"
+#include "graphics/W32STDGRAPHICTEST.H"
 
 EXPORT_C TWsGraphicFrameRate::TWsGraphicFrameRate():
 	TWsGraphicMsgFixedBase(TUid::Uid(ETypeId),sizeof(*this))
--- a/windowing/windowserver/stdgraphic/stdgraphictestdrawer.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/stdgraphic/stdgraphictestdrawer.h	Tue Jul 20 13:27:44 2010 +0300
@@ -19,8 +19,8 @@
 #define __STDGRAPHICDRAWERTEST_H__
 
 #include <e32std.h>
-#include "Graphics/WSGRAPHICDRAWER.H"
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include "graphics/WSGRAPHICDRAWER.H"
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
 
 class MWsGraphicDrawerContext;
 
--- a/windowing/windowserver/test/TAutoServer/TAutoServer.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/TAutoServer/TAutoServer.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -72,6 +72,7 @@
 #include "TMULSCREENS.h"
 #include "TBUFFERSECURITY.H"
 #include "TFLICKERFREE.H"
+#include "tdevicerotation.h"
 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
 #include "TFADINGBITMAP.H"
 #endif
@@ -86,6 +87,7 @@
 #include "tdrawresource.h"
 #include "twindowsizecache.h"
 
+
 /* Path to the script
 z:\GraphicsTest\gditest.script
 */
@@ -309,6 +311,8 @@
   		testStep = new CTBufferSecurityStep();
    	else if(aStepName == KTFlickerFreeStep)
   		testStep = new CTFlickerFreeStep();
+    else if(aStepName == KTDeviceRotationStep)
+     testStep = new CTDeviceRotationStep();
 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
 	else if(aStepName == KTFadingBitmapStep)
   		testStep = new CTFadingBitmapStep();
--- a/windowing/windowserver/test/TAutoServer/openwfc/TAutoServer_nga.mmp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/TAutoServer/openwfc/TAutoServer_nga.mmp	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-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"
@@ -24,22 +24,19 @@
 MACRO TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
 MACRO SYMBIAN_GRAPHICS_GCE
 
-USERINCLUDE		../../../../../graphicstest/graphicstestharness/inc ../../../inc ../../../tauto ../../../tauto/openwfc
-USERINCLUDE		../../../tredir ../../../tlisten ../../../tframerate ../../../tcontaindrawer ../../t_gdcoverage ../../../tbufferdrawer
-USERINCLUDE		../../../tlib ../../
+USERINCLUDE		../../../../../graphicstest/graphicstestharness/inc ../../../inc ../../tauto ../../tauto/openwfc
+USERINCLUDE		../../tredir ../../tlisten ../../tframerate ../../tcontaindrawer ../../t_gdcoverage ../../tbufferdrawer
+USERINCLUDE		../../tlib ../../
 
-APP_LAYER_SYSTEMINCLUDE_SYMBIAN
-MW_LAYER_SYSTEMINCLUDE_SYMBIAN
-OS_LAYER_SYSTEMINCLUDE_SYMBIAN
-OS_LAYER_LIBC_SYSTEMINCLUDE 
-
+OS_LAYER_SYSTEMINCLUDE
+OS_LAYER_LIBC_SYSTEMINCLUDE
 
 SOURCEPATH    ../
 SOURCE        TAutoServer.cpp
 SOURCEPATH    ../../
 SOURCE        PARSEINIDATA.CPP
 
-SOURCEPATH    ../../../tauto
+SOURCEPATH    ../../tauto
 SOURCE        AUTO.CPP
 SOURCE        TAUTODLL.CPP
 SOURCE        TEvent.CPP
@@ -102,6 +99,7 @@
 SOURCE	      tmultiptrevent.cpp
 SOURCE	      tdrawresource.cpp
 SOURCE	      twindowsizecache.cpp
+SOURCE        tdevicerotation.cpp
 
 //Required to test CommamdBuffer::Play using MWsGraphicsContext in tgc
 SOURCE        directgdigcwrapper.cpp
--- a/windowing/windowserver/test/TAutoServer/openwfc/TAutoServer_nonnga.mmp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/TAutoServer/openwfc/TAutoServer_nonnga.mmp	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-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"
@@ -23,12 +23,11 @@
 
 MACRO TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
 
-USERINCLUDE		../../../../../graphicstest/graphicstestharness/inc ../../../inc ../../../tauto ../../../tauto/openwfc
-USERINCLUDE		../../../tredir ../../../tlisten ../../../tframerate ../../../tcontaindrawer ../../t_gdcoverage
-USERINCLUDE		../../../tlib ../../
+USERINCLUDE		../../../../../graphicstest/graphicstestharness/inc ../../../inc ../../tauto ../../tauto/openwfc
+USERINCLUDE		../../tredir ../../tlisten ../../tframerate ../../tcontaindrawer ../../t_gdcoverage
+USERINCLUDE		../../tlib ../../
 
-MW_LAYER_SYSTEMINCLUDE_SYMBIAN
-OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+OS_LAYER_SYSTEMINCLUDE
 OS_LAYER_LIBC_SYSTEMINCLUDE
 
 SOURCEPATH    ../
@@ -36,7 +35,7 @@
 SOURCEPATH    ../../
 SOURCE        PARSEINIDATA.CPP
 
-SOURCEPATH    ../../../tauto
+SOURCEPATH    ../../tauto
 SOURCE        AUTO.CPP
 SOURCE        TAUTODLL.CPP
 SOURCE        TEvent.CPP
@@ -96,6 +95,7 @@
 SOURCE        THeartBeat.CPP
 SOURCE        tgc.cpp
 SOURCE	      TGRAPHICSDRAWER.CPP
+SOURCE        tdevicerotation.cpp
 
 LIBRARY	        bitgdi.lib	efsrv.lib	euser.lib	fbscli.lib
 LIBRARY	        gdi.lib		hal.lib		tlib.lib	ws32.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/test/TAutoServer/tevent_captureapp.mmp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,29 @@
+// Copyright (c) 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:
+// Helper application for TEvent test case GRAPHICS-WSERV-417-61800-0004
+//
+
+TARGET		tevent_captureapp.exe
+TARGETTYPE	exe
+UID			0x00000000 0x102872e4
+VENDORID	0x70000001
+CAPABILITY	SwEvent
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SOURCEPATH	../tauto
+SOURCE		tevent_captureapp.cpp
+
+LIBRARY		euser.lib
+LIBRARY		ws32.lib
--- a/windowing/windowserver/test/scripts/wstest_config.cmd	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/scripts/wstest_config.cmd	Tue Jul 20 13:27:44 2010 +0300
@@ -1,22 +1,22 @@
 @echo off
-rem Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+rem Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 rem All rights reserved.
 rem This component and the accompanying materials are made available
 rem under the terms of "Eclipse Public License v1.0"
 rem which accompanies this distribution, and is available
 rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
-rem 
+rem
 rem Initial Contributors:
 rem Nokia Corporation - initial contribution.
-rem 
+rem
 rem Contributors:
-rem 
+rem
 rem Description:
 rem @internalComponent - Internal Symbian
 rem 
 rem
 set nonnga=false
-if not defined EPOC_INI set EPOC_INI=\epoc32\data\epoc.ini
+if not defined EPOC_INI set EPOC_INI=%EPOCROOT%epoc32\data\epoc.ini
 if /i "%2"=="nonnga" set nonnga=true
 if /i "%3"=="nonnga" set nonnga=true
 if "%nonnga%"=="true" echo Configuring for Non-NGA
@@ -33,7 +33,7 @@
 	call :doinstall %EMULATOR_DATA_DIR% multiscreen %2 %3
 )
 
-echo If EPOC.INI isn't already backuped then backup EPOC.INI to EPOC.INI.bak
+rem If EPOC.INI isn't already backed up then backup EPOC.INI to EPOC.INI.bak
 if not exist %EPOC_INI%.bak copy /y %EPOC_INI% %EPOC_INI%.bak
 
 echo Editing EPOC.INI to use multiscreen.
@@ -46,7 +46,7 @@
 
 
 :doinstall
-rem If WSINI.INI(s) aren't already backuped then backup WSINI.INI(s)
+rem If WSINI.INI(s) aren't already backed up then backup WSINI.INI(s)
 if not exist %1\z\system\data\wsini.bak   if exist %1\z\system\data\wsini.ini   copy /y %1\z\system\data\wsini.ini   %1\z\system\data\wsini.bak >nul
 if not exist %1\z\resource\data\wsini.bak if exist %1\z\resource\data\wsini.ini copy /y %1\z\resource\data\wsini.ini %1\z\resource\data\wsini.bak >nul
 
@@ -84,7 +84,7 @@
 	call :doinstall_changetracking %EMULATOR_DATA_DIR% multiscreen %2 %3
 )
 
-echo If EPOC.INI isn't already backuped then backup EPOC.INI to EPOC.INI.bak
+rem If EPOC.INI isn't already backed up then backup EPOC.INI to EPOC.INI.bak
 if not exist %EPOC_INI%.bak copy /y %EPOC_INI% %EPOC_INI%.bak >nul
 
 echo Editing EPOC.INI to use multiscreen.
@@ -128,9 +128,9 @@
 	call :douninstall %EMULATOR_DATA_DIR%
 )
 
-echo If EPOC.INI was already backuped then restore EPOC.INI from EPOC.INI.bak
+rem If EPOC.INI was already backed up then restore EPOC.INI from EPOC.INI.bak
 if exist %EPOC_INI%.bak (
-	echo Restore EPOC.INI from backup
+	echo Restoring EPOC.INI from backup
 	copy /y %EPOC_INI%.bak %EPOC_INI% >nul
 	del /f /q %EPOC_INI%.bak >nul
 )
@@ -139,7 +139,7 @@
 
 :douninstall
 
-rem If WSINI.INI(s) were already backuped then restore WSINI.INI
+rem If WSINI.INI(s) were already backed up then restore WSINI.INI
 if exist %1\z\system\data\wsini.bak (
 copy /y %1\z\system\data\wsini.bak   %1\z\system\data\wsini.ini >nul
 del  /f /q %1\z\system\data\wsini.bak >nul
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/test/scripts/wstest_t_devicerotation_s0_nga.script	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,31 @@
+// Copyright (c) 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: 
+//
+
+PRINT Run WServ NGA device rotation tests on screen 0
+
+LOAD_SUITE tautoserver_nga
+
+//
+// Uncommenting the TMemLeakCheckEnable test will set Wserv into a mode where
+// between each test it effectively shuts itself down, checks for memory leaks,
+// then restarts. This is especially useful when the final TMemLeakCheckOneShot
+// test indicates a memory leak somewhere in the tests.
+// RUN_TEST_STEP 100 tautoserver_nga TMemLeakCheckEnable
+//
+
+RUN_TEST_STEP 100 tautoserver_nga TDeviceRotation
+
+// Run at the end and it will trigger a Wserv memory leak check
+RUN_TEST_STEP 100 tautoserver_nga TMemLeakCheckOneShot
--- a/windowing/windowserver/test/t_gdcoverage/gdcoverage.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/t_gdcoverage/gdcoverage.h	Tue Jul 20 13:27:44 2010 +0300
@@ -24,8 +24,8 @@
 #ifndef __WSGRAPHICDRAWER_COVERAGE_H__
 #define __WSGRAPHICDRAWER_COVERAGE_H__
 
-#include "Graphics/WSGRAPHICDRAWER.H"
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include "graphics/WSGRAPHICDRAWER.H"
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
 
 #include "gdcovcommon.h"
 
Binary file windowing/windowserver/test/t_genericplugin/data/ini/wsini_naviengine_genericplugin.ini has changed
--- a/windowing/windowserver/test/t_genericplugin/group/bld.inf	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/t_genericplugin/group/bld.inf	Tue Jul 20 13:27:44 2010 +0300
@@ -33,6 +33,10 @@
 
 ../data/ini/wsini_nga.ini					z:/wstest/genericplugin/wsini_nga.ini
 
+../data/ini/wsini_vasco_genericplugin.ini					z:/wstest/genericplugin/wsini_vasco_genericplugin.ini
+
+../data/ini/wsini_naviengine_genericplugin.ini					z:/wstest/genericplugin/wsini_naviengine_genericplugin.ini
+
 ../data/ini/wsini_nga_onescreen.ini			z:/wstest/genericplugin/wsini_nga_onescreen.ini
 
 ../data/ini/wsini_nonnga.ini					z:/wstest/genericplugin/wsini_nonnga.ini
--- a/windowing/windowserver/test/t_genericplugin/src/t_testrenderstage.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/t_genericplugin/src/t_testrenderstage.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -20,7 +20,7 @@
 */
 
 #include "t_testrenderstage.h"
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
 #include "graphics/wsgraphicscontext.h"
 #include "t_logfile.h"
 #include <fbs.h>
Binary file windowing/windowserver/test/t_ratelimiter/data/wsini_naviengine_ratelimiter.ini has changed
--- a/windowing/windowserver/test/t_ratelimiter/group/bld.inf	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/t_ratelimiter/group/bld.inf	Tue Jul 20 13:27:44 2010 +0300
@@ -26,7 +26,11 @@
 ../data/epoc.ini					z:/wstest/ratelimiter/epoc.ini
 ../data/epoc_singlescreen.ini				z:/wstest/ratelimiter/epoc_singlescreen.ini
 
+
 ../data/wsini.ini					z:/wstest/ratelimiter/wsini.ini
+../data/wsini_vasco_ratelimiter.ini					z:/wstest/ratelimiter/wsini_vasco_ratelimiter.ini
+../data/wsini_naviengine_ratelimiter.ini					z:/wstest/ratelimiter/wsini_naviengine_ratelimiter.ini
+
 ../data/wsini_changetracking.ini			z:/wstest/ratelimiter/wsini_changetracking.ini
 ../data/wsini_hw_singlescreen.ini			z:/wstest/ratelimiter/wsini_hw_singlescreen.ini
 ../data/wsini_hw_multiscreen.ini			z:/wstest/ratelimiter/wsini_hw_multiscreen.ini
--- a/windowing/windowserver/test/t_ratelimiter/tratelimitdrawer/ratelimitdrawer.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/t_ratelimiter/tratelimitdrawer/ratelimitdrawer.h	Tue Jul 20 13:27:44 2010 +0300
@@ -23,8 +23,8 @@
 #define RATELIMITDRAWER_H_
 
 #include <e32std.h>
-#include "Graphics/WSGRAPHICDRAWER.H"
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include "graphics/WSGRAPHICDRAWER.H"
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
 #include "../inc/constants.h"
 
 /**
--- a/windowing/windowserver/test/tauto/TCapKey.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/tauto/TCapKey.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1996-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"
@@ -455,16 +455,39 @@
 	TInt retVal;
 	TInt resCount=Client()->iWs.ResourceCount();
 	for(TInt index=0;index<numErrorKeys;index++)
-	{
-		retVal = Client()->iGroup->GroupWin()->CaptureKey(errorKeys[index].keyCode,errorKeys[index].modifier_mask,errorKeys[index].modifiers);
+		{
+		retVal = Client()->iGroup->GroupWin()->CaptureKey(errorKeys[index].keyCode,errorKeys[index].modifier_mask,errorKeys[index].modifiers, errorKeys[index].priority);
 		TEST(retVal==KErrArgument);
 		if (retVal!=KErrArgument)
-			INFO_PRINTF3(_L("Client()->iGroup->GroupWin()->CaptureKey() return value - Expected: %d, Actual: %d"), KErrArgument, retVal);	
-	}
+			{
+			_LIT(KMsg, "CaptureKey() with bad parameter set %d returned %d - expected KErrArgument (%d)");
+			LOG_MESSAGE4(KMsg, index, retVal, KErrArgument);	
+			}
+
+		retVal = Client()->iGroup->GroupWin()->CaptureKeyUpAndDowns(errorKeys[index].keyCode, errorKeys[index].modifier_mask, errorKeys[index].modifiers, errorKeys[index].priority);
+		TEST(retVal == KErrArgument);
+		if (retVal != KErrArgument)
+			{
+			_LIT(KMsg, "CaptureKeyUpAndDowns() with bad parameter set %d returned %d - expected KErrArgument (%d)");
+			LOG_MESSAGE4(KMsg, index, retVal, KErrArgument);	
+			}
+
+		retVal = Client()->iGroup->GroupWin()->CaptureLongKey(errorKeys[index].keyCode, errorKeys[index].keyCode, errorKeys[index].modifier_mask, errorKeys[index].modifiers, errorKeys[index].priority, ELongCaptureNormal);
+		TEST(retVal == KErrArgument);
+		if (retVal != KErrArgument)
+			{
+			_LIT(KMsg, "CaptureLongKey() with bad parameter set %d returned %d - expected KErrArgument (%d)");
+			LOG_MESSAGE4(KMsg, index, retVal, KErrArgument);	
+			}
+		}
+
 	retVal = Client()->iWs.ResourceCount();
 	TEST(retVal==resCount);
 	if (retVal!=resCount)
-		INFO_PRINTF3(_L("Client()->iWs.ResourceCount() return value - Expected: %d, Actual: %d"), resCount, retVal);	
+		{
+		_LIT(KMsg, "Resource count %d - expected %d");
+		LOG_MESSAGE3(KMsg, retVal, resCount);	
+		}
 	}
 
 void CTCaptureKey::SetMode(TTestMode aMode)
@@ -801,8 +824,10 @@
 @SYMTestStatus      Implemented
 
 @SYMTestActions     Memorizes amount of objects that the server has allocated for that client.
-					Tries to register 3 different capture keys with invalid
-					modifiers and modifirs mask pair.
+					Tries to register capture keys with invalid modifiers and
+					modifier mask pairs, using each of the RWindowGroup capture
+					functions CaptureKey(), CaptureKeyUpAndDowns() and
+					CaptureLongKey().
 
 @SYMTestExpectedResults Makes sure that the number of server-side objects for the 
 					session didn't change.
--- a/windowing/windowserver/test/tauto/TCapKey.H	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/tauto/TCapKey.H	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1996-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"
@@ -157,12 +157,21 @@
 	TInt keyCode;
 	TUint modifier_mask;
 	TUint modifiers;
+	TInt priority;
 	};
 
 LOCAL_D SErrorCapKey errorKeys[]={
-	{'a',EModifierFunc|EModifierShift,EModifierFunc|EModifierCtrl},
-	{'1',0,EModifierFunc},
-	{3,EModifierCtrl,EModifierCtrl|EModifierShift},
+	{'a', EModifierFunc|EModifierShift,EModifierFunc|EModifierCtrl, 0},
+	{'1', 0, EModifierFunc, 0},
+	{3, EModifierCtrl,EModifierCtrl|EModifierShift, 0},
+	// @SYMPREQ 417-61800: Check that attempts to capture keys with
+	// EModifierLong in the modifier mask fail with KErrArgument.
+	{'T', EModifierLongKey, 0, 0},
+	{'u', EModifierLongKey|EModifierAlt, EModifierLongKey, 0},
+	{'V', EModifierLongKey|EModifierShift, EModifierLongKey|EModifierShift, 0},
+	// @SYMPREQ 417-61800: Check that attempts to capture keys with a priority
+	// of KMinTInt fail with KErrArgument.
+	{'W', 0, 0, KMinTInt},
 	};
 
 const TInt numCapKeys=sizeof(capKeys)/sizeof(capKeys[0]);
--- a/windowing/windowserver/test/tauto/TEVENT.H	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/tauto/TEVENT.H	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1996-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"
@@ -38,6 +38,7 @@
 
 const TInt EMaxEventQueueSize=32;
 const TInt EMinQueueSize = 2;
+const TUint KModifiersIgnore = 0xffffffff;
 
 
 class CTEventTest;
@@ -263,6 +264,11 @@
 		// Add additional enum values before this line
 		EMaxCancelCaptureKeyApis
 		};
+	enum TLongkeyCapPriorityTests
+		{
+		ELongkeyCaptureSamePriority,
+		ELongkeyCaptureDiffPriority
+		};
 private:
 	void RunTestsL(TBool aNeedChildWindows=EFalse);
 	void RunTestsRestoreAreaL(TBool aNeedChildWindows);
@@ -285,13 +291,17 @@
 	void Password_NextSetOfEvents();
 	void GroupListChanged_NextSetOfEventsL();
 	void VisibilityChanged_NextSetOfEventsL();
+#ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA  	
+	void KeyEventTranslation_NextSetOfEventsL();
+	void KeyEventBlocking_NextSetOfEventsL();
+	void KeyEventAppRestriction_NextSetOfEventsL();
+	void KeyEventAppPriority_NextSetOfEventsL();
 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS	
-#ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA  	
 	void SurfaceVisibilityChanged1_NextSetOfEventsL();
 	void SurfaceVisibilityChanged2_NextSetOfEventsL();
 	void SurfaceVisibilityChanged3_NextSetOfEventsL();
+#endif //SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
 #endif //TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
-#endif //SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
 	void CheckTimeStamp_NextSetOfEventsL();
 	void RepeatableKeysL();
 	void PointerCapture_NextSetOfEventsL();
@@ -311,8 +321,8 @@
 	void EventHandlerRemoval_AddEventHandlerMultipleTimes();
 	void CheckPointerCursorInDifferentScreenMode(TSizeMode aMode,TPoint aOrigin);
 	void SimulateAndCheck(TPoint aOrigin,TSize aScale,TInt aXOffset,TInt aYOffset,TPointerEvent::TType aEventType,TRect aPointerCursorArea);
-	void AddExpectedKey(TInt aEventCode, TInt aScanCode, TInt aCode=0, TInt aRepeats=0, TUint aModifiers=0);
-	void AddExpectedKeyDownUp(TInt aScanCode, TInt aCode=0, TInt aRepeats=0, TUint aModifiers=0);
+	void AddExpectedKey(TInt aEventCode, TInt aScanCode, TInt aCode=0, TInt aRepeats=0, TUint aModifiers=KModifiersIgnore);
+	void AddExpectedKeyDownUp(TInt aScanCode, TInt aCode=0, TInt aRepeats=0, TUint aModifiers=KModifiersIgnore);
 	void AddExpectedEvent(TInt aEventCode, CTWinBase* aWin);
 	void AddExpectedEvent(TInt aEventCode);
 	void AddExpectedEvent(TInt aEventCode,RWindowGroup* aWindow);
@@ -358,6 +368,11 @@
 #endif
 	void TestCaptureAndCancelCapturePair(TCaptureKeyApis aCaptureApi, TCancelCaptureKeyApis aCancelCaptureApi);
 	static TInt GenerateAnEvent(TAny* aEventTest);
+	void CheckLongkeyCaptureWithPriority(TLongkeyCapPriorityTests aTestType);
+	void DelayForRepeatEvents(TInt aNumeratorFracVal, TInt aDenominatorFracVal);
+#ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA 	
+	void SpawnCaptureAppL(RProcess& aProcess);
+#endif
 private:
 	CTBlankWindow* iBlankWin;
 	RBlankWindow iBackingWindow;
@@ -390,13 +405,17 @@
 	TBool iIs3DPointer;
 	TBool iPtrPluginLoaded;
 	TInt iYOffset;
+	TTimeIntervalMicroSeconds32 iKeyBoardRepeatInitialDelay;
+	TTimeIntervalMicroSeconds32 iKeyBoardRepeatNextDelay;
+#ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA 	
+	RProcess iCaptureApp1;
+	RProcess iCaptureApp2;
 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS	
-#ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA 	
 	TSurfaceId iSurfaceId;
 	RSurfaceManager iSurfaceManager;
 	CPeriodic* iTimeOutCallback;
+#endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
-#endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
 	};
 
 class CTQueueWindowGroup : public CTWindowGroup
--- a/windowing/windowserver/test/tauto/TEvent.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/tauto/TEvent.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1996-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"
@@ -37,6 +37,9 @@
 
 _LIT(KKeyClickPluginDll, "click.dll");
 
+const TInt KLongKeyCaptureLowPriority = 1;
+const TInt KLongKeyCaptureHighPriority = 2;
+
 CTQueueClient::CTQueueClient(CTEventTest *aTest) : iTest(aTest)
 	{
 	}
@@ -203,6 +206,7 @@
 		TestL(wsEvent.Type()==expectedEvent.Type() && wsEvent.Handle()==expectedEvent.Handle());
 		}		
 	iLastEventError=(wsEvent.Type()==EEventErrorMessage);
+
 	switch(wsEvent.Type())
 		{
 		case EEventKey:
@@ -212,7 +216,7 @@
 				{
 				_LIT(KKeysDiff,"Count=%d  Key Code Exp=%d (%c)  Act=%d (%c)");
 				buf.Copy(KStartString);
-				buf.AppendFormat(KKeysDiff,iEventCount,iEventCount,eKeyCode,eKeyCode,wsKeyCode,wsKeyCode);
+				buf.AppendFormat(KKeysDiff,iEventCount,eKeyCode,eKeyCode,wsKeyCode,wsKeyCode);
 				iTest->LOG_MESSAGE(buf);
 				}
 			wsKeyRepeat=wsEvent.Key()->iRepeats,eKeyRepeat=expectedEvent.Key()->iRepeats;
@@ -224,10 +228,15 @@
 				iTest->LOG_MESSAGE(buf);
 				}
 		#endif
-			TestL(wsEvent.Key()->iCode==expectedEvent.Key()->iCode && wsEvent.Key()->iRepeats>=expectedEvent.Key()->iRepeats
-								&& (wsEvent.Key()->iRepeats>0)==(expectedEvent.Key()->iRepeats>0));		//Fall Through
+			TestL(wsEvent.Key()->iCode==expectedEvent.Key()->iCode &&
+				wsEvent.Key()->iRepeats>=expectedEvent.Key()->iRepeats &&
+				(wsEvent.Key()->iRepeats>0)==(expectedEvent.Key()->iRepeats>0));
+			// Fall Through
 		case EEventKeyDown:
 		case EEventKeyUp:
+			{
+			TUint wsModifiers = wsEvent.Key()->iModifiers;
+			TUint eModifiers = expectedEvent.Key()->iModifiers;
 		#if defined(FAIL_LOGGING)
 			wsKeyScan=wsEvent.Key()->iScanCode,eKeyScan=expectedEvent.Key()->iScanCode;
 			if (wsKeyScan!=eKeyScan)
@@ -237,8 +246,18 @@
 				buf.AppendFormat(KScanDiff,iEventCount,eKeyScan,eKeyScan,wsKeyScan,wsKeyScan);
 				iTest->LOG_MESSAGE(buf);
 				}
+
+			if (eModifiers != KModifiersIgnore && wsModifiers != eModifiers)
+				{
+				_LIT(KModDiff,"Count=%d  Modifiers Exp=0x%x  Act=0x%x");
+				buf.Copy(KStartString);
+				buf.AppendFormat(KModDiff, iEventCount, eModifiers, wsModifiers);
+				iTest->LOG_MESSAGE(buf);
+				}
 		#endif
-			TestL(wsEvent.Key()->iScanCode==expectedEvent.Key()->iScanCode);
+			TestL(wsEvent.Key()->iScanCode == expectedEvent.Key()->iScanCode &&
+				(eModifiers == KModifiersIgnore || wsModifiers == eModifiers));
+			}
 			break;
 		case EEventModifiersChanged:
 			{
@@ -708,7 +727,8 @@
 		{
 		iIs3DPointer=EFalse;
 		}
-#endif		
+#endif
+	TheClient->iWs.GetKeyboardRepeatRate(iKeyBoardRepeatInitialDelay, iKeyBoardRepeatNextDelay);
 	}
 
 void CTEventTest::Failed()
@@ -820,7 +840,7 @@
 	group.SetOrdinalPosition(position,priority);
 	}
 
-void CTEventTest::AddExpectedKey(TInt aEventCode, TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=0*/)
+void CTEventTest::AddExpectedKey(TInt aEventCode, TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=KModifiersIgnore*/)
 	{
 	TPckgBuf<TWsEvent> evtPkg;
 	TWsEvent& event=evtPkg();
@@ -834,15 +854,27 @@
 	event.Key()->iRepeats=aRepeats;
 	iQueueClient->AddExpectedEvent(event);
 	if (iAddToClick)
+		{
+		if (aModifiers == KModifiersIgnore)
+			{
+			// Key click tests assume zero modifiers in click event by default
+			event.Key()->iModifiers = 0;
+			}
 		iClick.CommandReply(EClickEventAdd,evtPkg);
-	}
-
-void CTEventTest::AddExpectedKeyDownUp(TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=0*/)
+		}
+	}
+
+void CTEventTest::AddExpectedKeyDownUp(TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=KModifiersIgnore*/)
 	{
 	__ASSERT_DEBUG(aScanCode<'a' || aScanCode>'z',AutoPanic(EAutoPanicScanCapital));
-	AddExpectedKey(EEventKeyDown,aScanCode,0,aRepeats,aModifiers);
+	// EModiferAutorepeatable can be present in EEventKey but is never valid
+	// in EEventKeyDown and EEventKeyUp. 
+	TUint modifiersDownUp = (aModifiers == KModifiersIgnore) ?
+		aModifiers : aModifiers & ~EModifierAutorepeatable;
+
+	AddExpectedKey(EEventKeyDown,aScanCode,0,aRepeats,modifiersDownUp);
 	AddExpectedKey(EEventKey,aScanCode,aCode,aRepeats,aModifiers);
-	AddExpectedKey(EEventKeyUp,aScanCode,0,aRepeats,aModifiers);
+	AddExpectedKey(EEventKeyUp,aScanCode,0,aRepeats,modifiersDownUp);
 	}
 
 void CTEventTest::AddExpectedEvent(TInt aEventCode, CTWinBase* aWin)
@@ -1160,20 +1192,32 @@
 	case 27:
 	    RawEventRepeatTest_NextSetOfEventsL();
 	    break;
-	    
-#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS	    
+
 #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA 	    
     case 28:
-        SurfaceVisibilityChanged1_NextSetOfEventsL();
+        KeyEventTranslation_NextSetOfEventsL();
         break;
     case 29:
-        SurfaceVisibilityChanged2_NextSetOfEventsL();
+        KeyEventBlocking_NextSetOfEventsL();
         break;
     case 30:
+        KeyEventAppRestriction_NextSetOfEventsL();
+        break;
+    case 31:
+        KeyEventAppPriority_NextSetOfEventsL();
+        break;
+#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS	    
+    case 32:
+        SurfaceVisibilityChanged1_NextSetOfEventsL();
+        break;
+    case 33:
+        SurfaceVisibilityChanged2_NextSetOfEventsL();
+        break;
+    case 34:
         SurfaceVisibilityChanged3_NextSetOfEventsL();
         break;
+#endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
-#endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
         
 	default:
 		AutoPanic(EAutoPanicWrongTest);
@@ -3545,8 +3589,8 @@
 			break;
 		case 2:
 			AddExpectedKey(EEventKeyDown,EStdKeyRightShift,0,0,EModifierRightShift|EModifierShift);
-			AddExpectedKeyDownUp('B','B',0,EModifierRightShift|EModifierShift);
-			AddExpectedKeyDownUp('W','W',0,EModifierRightShift|EModifierShift);
+			AddExpectedKeyDownUp('B','B',0,EModifierRightShift|EModifierShift|EModifierAutorepeatable);
+			AddExpectedKeyDownUp('W','W',0,EModifierRightShift|EModifierShift|EModifierAutorepeatable);
 			AddExpectedKey(EEventKeyUp,EStdKeyRightShift);
 			iQueueClient->iWs.Flush();
 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyRightShift);		//1 event
@@ -3854,11 +3898,9 @@
 
 void CTEventTest::CaptureLong_NextSetOfEventsL()
 	{
-	TTimeIntervalMicroSeconds32 initialTime,time;
-	TheClient->iWs.GetKeyboardRepeatRate(initialTime,time);
 	#if defined(LOGGING)
 		TLogMessageText logMessageText;
-		_LIT(KSet,"CaptureLong SetOfEvents: %d of 14");
+		_LIT(KSet,"CaptureLong SetOfEvents: %d of 23");
 		logMessageText.Format(KSet,iEventSet);
 		INFO_PRINTF1(logMessageText);
 	#endif
@@ -3872,53 +3914,72 @@
 			AddExpectedKeyDownUp('A','a');
 			break;
 		case 1:
-			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','a',0,0,2,ELongCaptureNormal);
+			// Test CaptureLongKey() with modifier value EModifierShift and flag value ELongCaptureNormal
+			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','a',EModifierShift,EModifierShift,2,ELongCaptureNormal);
 			iQueueClient->iWs.Flush();
+			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftShift);
 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
 			TheClient->iWs.Flush();
-			User::After(initialTime.Int()+time.Int()/3);
+			DelayForRepeatEvents(1, 3);
 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
+			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftShift);
+			AddExpectedKey(EEventKeyDown,EStdKeyLeftShift);
 			AddExpectedKey(EEventKeyDown,EStdKeySpace);
-			AddExpectedKey(EEventKey,EStdKeySpace,' ');
-			AddExpectedKey(EEventKey,EStdKeySpace,'a',1);
+			AddExpectedKey(EEventKey,EStdKeySpace,' ',0,EModifierLeftShift|EModifierShift|EModifierAutorepeatable);
+			AddExpectedKey(EEventKey,EStdKeySpace,'a',1,EModifierLongKey|EModifierLeftShift|EModifierShift|EModifierAutorepeatable);
 			AddExpectedKey(EEventKeyUp,EStdKeySpace);
+			AddExpectedKey(EEventKeyUp,EStdKeyLeftShift);
 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
 			break;
-		case 2:
-			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','a',0,0,2,ELongCaptureWaitShort);
+		case 2:	
+			// Test CaptureLongKey() with modifier value EModifierFunc and flag value ELongCaptureWaitShort
+			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(EKeyEnter,'a',EModifierFunc,EModifierFunc,2,ELongCaptureWaitShort);
 			iQueueClient->iWs.Flush();
-			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
+			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftFunc);
+			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyEnter);
 			TheClient->iWs.Flush();
-			User::After(initialTime.Int()+time.Int()/3);
-			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
+			DelayForRepeatEvents(1, 3);
+			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyEnter);
+			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftFunc);
 			iTest->SimulateKeyDownUp(EStdKeySpace);
-			AddExpectedKey(EEventKeyDown,EStdKeySpace);
-			AddExpectedKey(EEventKey,EStdKeySpace,'a',1);
-			AddExpectedKey(EEventKeyUp,EStdKeySpace);
+			AddExpectedKey(EEventKeyDown,EStdKeyLeftFunc);
+			AddExpectedKey(EEventKeyDown,EStdKeyEnter);
+			AddExpectedKey(EEventKey,EStdKeyEnter,'a',1,EModifierLongKey|EModifierLeftFunc|EModifierFunc|EModifierAutorepeatable);
+			AddExpectedKey(EEventKeyUp,EStdKeyEnter);
+			AddExpectedKey(EEventKeyUp,EStdKeyLeftFunc);
 			AddExpectedKeyDownUp(EStdKeySpace,' ');
 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
 			break;
 		case 3:
-			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','a',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents);
+			// Test CaptureLongKey() with modifier values EModifierFunc|EModifierAlt and flag values ELongCaptureNormal|ELongCaptureRepeatEvents)
+			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(EKeyEnter,'a',EModifierFunc|EModifierAlt,EModifierFunc|EModifierAlt,2,ELongCaptureNormal|ELongCaptureRepeatEvents);
 			iQueueClient->iWs.Flush();
-			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
+			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftFunc);
+			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftAlt);
+			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyEnter);
 			TheClient->iWs.Flush();
-			User::After(initialTime.Int()+5*time.Int());
-			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
-			AddExpectedKey(EEventKeyDown,EStdKeySpace);
-			AddExpectedKey(EEventKey,EStdKeySpace,' ');
-			AddExpectedKey(EEventKey,EStdKeySpace,'a',2);
-			AddExpectedKey(EEventKeyUp,EStdKeySpace);
+			DelayForRepeatEvents(5, 1);
+			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyEnter);
+			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftAlt);
+			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftFunc);
+			AddExpectedKey(EEventKeyDown,EStdKeyLeftFunc);
+			AddExpectedKey(EEventKeyDown,EStdKeyLeftAlt);
+			AddExpectedKey(EEventKeyDown,EStdKeyEnter);
+			AddExpectedKey(EEventKey,EStdKeyEnter,EKeyEnter,0,EModifierLeftFunc|EModifierFunc|EModifierLeftAlt|EModifierAlt|EModifierAutorepeatable);
+			AddExpectedKey(EEventKey,EStdKeyEnter,'a',2,EModifierLongKey|EModifierLeftFunc|EModifierFunc|EModifierLeftAlt|EModifierAlt|EModifierAutorepeatable);
+			AddExpectedKey(EEventKeyUp,EStdKeyEnter);
+			AddExpectedKey(EEventKeyUp,EStdKeyLeftAlt);
+			AddExpectedKey(EEventKeyUp,EStdKeyLeftFunc);
 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
 			break;
 		case 4:
 			iQueueClient->iWs.Flush();
 			iTest->SimulateKey(TRawEvent::EKeyDown,'Z');
 			TheClient->iWs.Flush();
-			User::After(initialTime.Int()+3*time.Int());
+			DelayForRepeatEvents(3, 1);
 			iTest->SimulateKey(TRawEvent::EKeyDown,'Y');
 			TheClient->iWs.Flush();
-			User::After(initialTime.Int()+2*time.Int());
+			DelayForRepeatEvents(2, 1);
 			iTest->SimulateKey(TRawEvent::EKeyUp,'Z');
 			iTest->SimulateKey(TRawEvent::EKeyUp,'Y');
 			AddExpectedKey(EEventKeyDown,'Z');
@@ -3934,13 +3995,13 @@
 			iQueueClient->iWs.Flush();
 			iTest->SimulateKey(TRawEvent::EKeyDown,'Z');
 			TheClient->iWs.Flush();
-			User::After(initialTime.Int()+3*time.Int());
+			DelayForRepeatEvents(3, 1);
 			iTest->SimulateKey(TRawEvent::EKeyDown,'Y');
 			TheClient->iWs.Flush();
-			User::After(initialTime.Int()+5*time.Int()/2);
+			DelayForRepeatEvents(5, 2);
 			iTest->SimulateKey(TRawEvent::EKeyUp,'Y');
 			TheClient->iWs.Flush();
-			User::After(initialTime.Int()+2*time.Int());
+			DelayForRepeatEvents(2, 1);
 			iTest->SimulateKey(TRawEvent::EKeyUp,'Z');
 			AddExpectedKey(EEventKeyDown,'Z');
 			AddExpectedKey(EEventKey,'Z','z');
@@ -3957,12 +4018,12 @@
 			iQueueClient->iWs.Flush();
 			iTest->SimulateKey(TRawEvent::EKeyDown,'X');
 			TheClient->iWs.Flush();
-			User::After(initialTime.Int()+3*time.Int());
+			DelayForRepeatEvents(3, 1);
 			iTest->SimulateKeyDownUp(EStdKeySpace);
 			TheClient->iWs.Flush();
 			if(!iTest->IsFullRomL())
 				{
-				User::After(initialTime.Int()+2*time.Int());
+				DelayForRepeatEvents(2, 1);
 				}
 			iTest->SimulateKey(TRawEvent::EKeyUp,'X');
 			AddExpectedKey(EEventKeyDown,'X');
@@ -3983,14 +4044,14 @@
 			iQueueClient->iWs.Flush();
 			iTest->SimulateKey(TRawEvent::EKeyDown,'X');
 			TheClient->iWs.Flush();
-			User::After(initialTime.Int()+5*time.Int());
+			DelayForRepeatEvents(5, 1);
 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
 			TheClient->iWs.Flush();
-			User::After(initialTime.Int()+time.Int()/3);
+			DelayForRepeatEvents(1, 3);
 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
 			TheClient->iWs.Flush();
 			User::ResetInactivityTime();
-			User::After(initialTime.Int()+4*time.Int());
+			DelayForRepeatEvents(4, 1);
 			iTest->SimulateKey(TRawEvent::EKeyUp,'X');
 			AddExpectedKey(EEventKeyDown,'X');
 			AddExpectedKey(EEventKey,'X','x');
@@ -4008,7 +4069,7 @@
 			iQueueClient->iWs.Flush();
 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
 			TheClient->iWs.Flush();
-			User::After(initialTime.Int()+5*time.Int());
+			DelayForRepeatEvents(5, 1);
 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
 			AddExpectedKey(EEventKeyDown,EStdKeySpace);
 			AddExpectedKey(EEventKey,EStdKeySpace,'c',1);
@@ -4022,10 +4083,10 @@
 			iQueueClient->iWs.Flush();
 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
 			TheClient->iWs.Flush();
-			User::After(initialTime.Int()+5*time.Int()/2);
+			DelayForRepeatEvents(5, 2);
 			iTest->SimulateKeyDownUp(EStdKeyEscape);
 			TheClient->iWs.Flush();
-			User::After(initialTime.Int()+3*time.Int());
+			DelayForRepeatEvents(3, 1);
 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
 			AddExpectedKey(EEventKeyDown,EStdKeySpace);
 			AddExpectedKey(EEventKey,EStdKeySpace,' ');
@@ -4045,33 +4106,36 @@
 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
 			TheClient->iWs.Flush();
 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
-			User::After(initialTime.Int()+5*time.Int());
+			DelayForRepeatEvents(5, 1);
 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
 			AddExpectedKey(EEventKeyDown,EStdKeySpace);
 			AddExpectedKey(EEventKey,EStdKeySpace,' ');
 			AddExpectedKey(EEventKeyUp,EStdKeySpace);
 			break;
 		case 11:
-			//Cancel a capture key up and down event whilst a repeat is underway
-			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKeyUpAndDowns(EStdKeySpace,0,0);
+			// Cancel a key up/down capture whilst a repeat is underway.
+			// This should have no effect since only key press events are
+			// repeated.
+			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKeyUpAndDowns('X',0,0);
 			iQueueClient->iWs.Flush();
 			iTest->SimulateKey(TRawEvent::EKeyDown,'X');
 			TheClient->iWs.Flush();
 			iQueueClient->iGroup->GroupWin()->CancelCaptureKeyUpAndDowns(iCaptureKey);
-			User::After(initialTime.Int()+5*time.Int());
+			DelayForRepeatEvents(5, 1);
 			iTest->SimulateKey(TRawEvent::EKeyUp,'X');
 			AddExpectedKey(EEventKeyDown,'X');
 			AddExpectedKey(EEventKey,'X','x');
+			AddExpectedKey(EEventKey,'X','x',2);
 			AddExpectedKey(EEventKeyUp,'X');
 			break;
 		case 12:
 			//Cancel a capture key event whilst a repeat is underway
-			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKey(EStdKeySpace,0,0);
+			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKey('y',0,0);
 			iQueueClient->iWs.Flush();
 			iTest->SimulateKey(TRawEvent::EKeyDown,'Y');
 			TheClient->iWs.Flush();
 			iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey);
-			User::After(initialTime.Int()+5*time.Int());
+			DelayForRepeatEvents(5, 1);
 			iTest->SimulateKey(TRawEvent::EKeyUp,'Y');
 			AddExpectedKey(EEventKeyDown,'Y');
 			AddExpectedKey(EEventKey,'Y','y');
@@ -4079,13 +4143,13 @@
 			break;
 		case 13:
 			//Variation on case 12 i.e. change in the timing of the CancelCaptureKey call
-			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKey(EStdKeySpace,0,0);
+			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKey('z',0,0);
 			iQueueClient->iWs.Flush();
 			iTest->SimulateKey(TRawEvent::EKeyDown,'Z');
 			TheClient->iWs.Flush();
-			User::After(initialTime.Int()+5*time.Int()/2);
+			DelayForRepeatEvents(5, 2);
 			iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey);
-			User::After(initialTime.Int()+5*time.Int()/2);
+			DelayForRepeatEvents(5, 2);
 			iTest->SimulateKey(TRawEvent::EKeyUp,'Z');
 			AddExpectedKey(EEventKeyDown,'Z');
 			AddExpectedKey(EEventKey,'Z','z');
@@ -4102,7 +4166,7 @@
 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
 			TheClient->iWs.Flush();
 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
-			User::After(initialTime.Int()+time.Int()/3);
+			DelayForRepeatEvents(1, 3);
 
 			TheClient->iGroup->GroupWin()->CancelCaptureKey(shortCaptKey);
 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
@@ -4110,6 +4174,132 @@
 			AddExpectedKey(EEventKeyUp,EStdKeySpace);
 			}
 			break;
+		case 15:
+			// @SYMPREQ 417-61800: Check that long key events are marked with
+			// EModifierLongKey and short events are not.
+			iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey('m', 'm', 0, 0, 0, ELongCaptureNormal);
+			iQueueClient->iWs.Flush();
+			iTest->SimulateKey(TRawEvent::EKeyDown, 'M');
+			TheClient->iWs.Flush();
+			DelayForRepeatEvents(1, 3);
+			iTest->SimulateKey(TRawEvent::EKeyUp, 'M');
+			AddExpectedKey(EEventKeyDown, 'M', 0, 0, 0);
+			AddExpectedKey(EEventKey, 'M', 'm', 0, EModifierAutorepeatable);
+			AddExpectedKey(EEventKey, 'M', 'm', 1, EModifierLongKey | EModifierAutorepeatable);
+			AddExpectedKey(EEventKeyUp, 'M', 0, 0, 0);
+			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
+			break;
+		case 16:
+			CheckLongkeyCaptureWithPriority(ELongkeyCaptureDiffPriority);
+			break;
+		case 17:
+			CheckLongkeyCaptureWithPriority(ELongkeyCaptureSamePriority);
+			break;
+		case 18:
+			// Test CaptureLongKey() with flag value ELongCaptureWaitShort
+			// when key is not held down long enough to generate a long event.
+			// Verify that short event is delivered when the key is released.
+			iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey('p', 'p', 0, 0, 0, ELongCaptureWaitShort);
+			iQueueClient->iWs.Flush();
+			iTest->SimulateKey(TRawEvent::EKeyDown, 'P');
+			TheClient->iWs.Flush();
+			User::After(iKeyBoardRepeatInitialDelay.Int() / 2);
+			iTest->SimulateKey(TRawEvent::EKeyUp, 'P');
+			TheClient->iWs.Flush();
+			iTest->SimulateKeyDownUp(EStdKeySpace);
+			AddExpectedKey(EEventKeyDown, 'P');
+			AddExpectedKey(EEventKey, 'P', 'p', 0, EModifierAutorepeatable);
+			AddExpectedKey(EEventKeyUp, 'P');
+			AddExpectedKeyDownUp(EStdKeySpace, ' ');
+			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
+			break;
+		case 19:
+			{
+			// Cancel a capture key event whilst a repeat is underway for a
+			// different capture. This should not cancel repeating.
+			iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureKey('q', 0, 0);
+			TInt captureKey2 = iQueueClient->iGroup->GroupWin()->CaptureKey('r', 0, 0);
+			iQueueClient->iWs.Flush();
+			iTest->SimulateKey(TRawEvent::EKeyDown, 'Q');
+			TheClient->iWs.Flush();
+			iQueueClient->iGroup->GroupWin()->CancelCaptureKey(captureKey2);
+			DelayForRepeatEvents(5, 1);
+			iTest->SimulateKey(TRawEvent::EKeyUp, 'Q');
+			AddExpectedKey(EEventKeyDown, 'Q');
+			AddExpectedKey(EEventKey, 'Q', 'q', 0, EModifierAutorepeatable);
+			AddExpectedKey(EEventKey, 'Q', 'q', 2, EModifierAutorepeatable);
+			AddExpectedKey(EEventKeyUp, 'Q');
+			iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey);
+			}
+			break;
+		case 20:
+			{
+			// Cancel a long capture key event whilst a repeat is underway for
+			// a different capture. This should not cancel repeating.
+			iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey('s', 's', 0, 0, 2, ELongCaptureNormal|ELongCaptureRepeatEvents);
+			TInt captureKey2 = iQueueClient->iGroup->GroupWin()->CaptureLongKey('t', 't', 0, 0, 2, ELongCaptureNormal|ELongCaptureRepeatEvents);
+			iQueueClient->iWs.Flush();
+			iTest->SimulateKey(TRawEvent::EKeyDown, 'S');
+			TheClient->iWs.Flush();
+			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(captureKey2);
+			DelayForRepeatEvents(5, 1);
+			iTest->SimulateKey(TRawEvent::EKeyUp, 'S');
+			AddExpectedKey(EEventKeyDown, 'S');
+			AddExpectedKey(EEventKey, 'S', 's', 0, EModifierAutorepeatable);
+			AddExpectedKey(EEventKey, 'S', 's', 2, EModifierLongKey | EModifierAutorepeatable);
+			AddExpectedKey(EEventKeyUp, 'S');
+			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
+			}
+			break;
+		case 21:
+			{
+			// Test CaptureLongKey() with a user specified initial repeat time.
+			// Simulate holding down the key for a period shorter than the
+			// specified delay. Verify that a long key event is NOT generated.
+			// (Note that the period is longer than the default initial repeat
+			// time, thus proving that CaptureLongKey() has honoured the delay
+			// argument.)
+			TTimeIntervalMicroSeconds32 delay(iKeyBoardRepeatInitialDelay.Int() * 4);
+			iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey(delay, 'u', 'u', 0, 0, 0, ELongCaptureNormal);
+			iQueueClient->iWs.Flush();
+			iTest->SimulateKey(TRawEvent::EKeyDown, 'U');
+			TheClient->iWs.Flush();
+			User::After(delay.Int() / 2);
+			iTest->SimulateKey(TRawEvent::EKeyUp, 'U');
+			TheClient->iWs.Flush();
+			iTest->SimulateKeyDownUp(EStdKeySpace);
+			AddExpectedKey(EEventKeyDown, 'U');
+			AddExpectedKey(EEventKey, 'U', 'u', 0, EModifierAutorepeatable);
+			AddExpectedKey(EEventKeyUp, 'U');
+			AddExpectedKeyDownUp(EStdKeySpace, ' ');
+			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
+			}
+			break;
+		case 22:
+			{
+			// Test CaptureLongKey() with a user specified initial repeat time.
+			// Simulate holding down the key for a period longer than the
+			// specified delay. Verify that a long key event is generated.
+			// (Note that the period is shorter than the default initial repeat
+			// time, thus proving that CaptureLongKey() has honoured the delay
+			// argument.)
+			TTimeIntervalMicroSeconds32 delay(iKeyBoardRepeatInitialDelay.Int() / 4);
+			iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey(delay, 'v', 'v', 0, 0, 0, ELongCaptureNormal);
+			iQueueClient->iWs.Flush();
+			iTest->SimulateKey(TRawEvent::EKeyDown, 'V');
+			TheClient->iWs.Flush();
+			User::After(delay.Int() * 2);
+			iTest->SimulateKey(TRawEvent::EKeyUp, 'V');
+			TheClient->iWs.Flush();
+			iTest->SimulateKeyDownUp(EStdKeySpace);
+			AddExpectedKey(EEventKeyDown, 'V');
+			AddExpectedKey(EEventKey, 'V', 'v', 0, EModifierAutorepeatable);
+			AddExpectedKey(EEventKey, 'V', 'v', 1, EModifierLongKey | EModifierAutorepeatable);
+			AddExpectedKey(EEventKeyUp, 'V');
+			AddExpectedKeyDownUp(EStdKeySpace, ' ');
+			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
+			}
+			break;
 		default:
 			CActiveScheduler::Stop();
 			break;
@@ -4117,6 +4307,485 @@
 	TheClient->iWs.Flush();
 	}
 
+/** Function used for checking CaptureLongKey() works fine with different priorities.
+
+If two window groups have requested capture of the same key with different priorities, 
+then the event should be delivered to the group that specified higher priority 
+(even if it is in the background).
+
+If two window groups have requested capture of the same key with same priorities,
+then the event should be delivered to the group that requested capture most recently.
+
+@param aTestType Enum value specifying test with same priority or with different priority
+*/
+void CTEventTest::CheckLongkeyCaptureWithPriority(TLongkeyCapPriorityTests aTestType)
+	{
+	TInt ordinalPriority = TheClient->iGroup->GroupWin()->OrdinalPriority();
+	TInt ordinalPosition = TheClient->iGroup->GroupWin()->OrdinalPosition();
+	// Bring other window group to foreground and request capture with lower/same priority
+	// And request capture from iQueueClient group window with higher priority
+	TheClient->iGroup->GroupWin()->SetOrdinalPosition(0, 10);
+	TInt capKeyFrontWin = TheClient->iGroup->GroupWin()->CaptureLongKey('m', 'm', 0, 0, (aTestType == ELongkeyCaptureDiffPriority ? KLongKeyCaptureLowPriority : KLongKeyCaptureHighPriority), ELongCaptureNormal);
+	iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey('m', 'm', 0, 0, KLongKeyCaptureHighPriority, ELongCaptureNormal);
+	iQueueClient->iWs.Flush();
+	iTest->SimulateKey(TRawEvent::EKeyDown, 'M');
+	TheClient->iWs.Flush();
+	DelayForRepeatEvents(1, 3);
+	iTest->SimulateKey(TRawEvent::EKeyUp, 'M');
+	AddExpectedEvent(EEventFocusLost);
+	//Note: Button down/up events along with immediate key events are not delivered to iQueueCLient's window group
+	//as they are sent to foreground/focused window group
+	AddExpectedKey(EEventKey, 'M', 'm', 1, EModifierLongKey | EModifierAutorepeatable);
+	iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
+	TheClient->iGroup->GroupWin()->CancelCaptureLongKey(capKeyFrontWin);
+	TheClient->iGroup->GroupWin()->SetOrdinalPosition(ordinalPosition, ordinalPriority);
+	AddExpectedEvent(EEventFocusGained);
+	}
+
+/** Function used for delaying current thread so that repeat events can be generated.
+
+It uses iKeyBoardRepeatInitialDelay and iKeyBoardRepeatNextDelay variables to get the desired delay.
+The idea is to wait for initial delay + some extra value so that first repeat is generated.
+For more than one repeat events, wait will be initial delay + next delay + some extra value, and so on.
+
+The extra value is taken as fraction of iKeyBoardRepeatNextDelay.
+
+@param aNumeratorFracVal Numerator value of the fraction.
+@param aDenominatorFracVal Denominator value of the fraction.
+*/
+void CTEventTest::DelayForRepeatEvents(TInt aNumeratorFracVal, TInt aDenominatorFracVal)
+	{
+	if (!aNumeratorFracVal || !aDenominatorFracVal)
+		return;
+	User::After(iKeyBoardRepeatInitialDelay.Int() + (iKeyBoardRepeatNextDelay.Int()*aNumeratorFracVal/aDenominatorFracVal));
+	}
+
+#ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA  	
+void CTEventTest::KeyEventTranslation_NextSetOfEventsL()
+	{
+	TTimeIntervalMicroSeconds32 initialTime;
+	TTimeIntervalMicroSeconds32 time;
+	TheClient->iWs.GetKeyboardRepeatRate(initialTime, time);
+
+	RWindowGroup* wg = iQueueClient->iGroup->GroupWin();
+
+	#if defined(LOGGING)
+		TLogMessageText logMessageText;
+		_LIT(KSet,"KeyEventTranslation SetOfEvents: %d of 5");
+		logMessageText.Format(KSet,iEventSet);
+		INFO_PRINTF1(logMessageText);
+	#endif
+
+	switch (iEventSet++)
+		{
+		case 0:
+			iQueueClient->iWs.Flush();
+			iTest->SimulateKeyDownUp('A');
+			AddExpectedEvent(EEventFocusGained);
+			AddExpectedKeyDownUp('A','a');
+			break;
+		case 1:
+			// Test key event translation using CaptureKey()
+			iCaptureKey = wg->CaptureKey(EKeyDevice0, 0, 0);
+			TEST(iCaptureKey >= 0);
+			iQueueClient->iWs.Flush();
+			iTest->SimulateKeyDownUp(EStdKeyDevice1);
+			TheClient->iWs.Flush();
+			AddExpectedKey(EEventKeyDown, EStdKeyDevice1, 0, 0);
+			AddExpectedKey(EEventKey, EStdKeyDevice1, EKeyDevice0, 0);
+			AddExpectedKey(EEventKeyUp, EStdKeyDevice1, 0, 0);
+			wg->CancelCaptureKey(iCaptureKey);
+			break;
+		case 2:
+			// Test key event translation using CaptureKeyUpAndDowns()
+			iCaptureKey = wg->CaptureKeyUpAndDowns(EStdKeyDevice0, 0, 0);
+			TEST(iCaptureKey >= 0);
+			iQueueClient->iWs.Flush();
+			iTest->SimulateKeyDownUp(EStdKeyDevice1);
+			TheClient->iWs.Flush();
+			AddExpectedKey(EEventKeyDown, EStdKeyDevice0, 0, 0);
+			AddExpectedKey(EEventKey, EStdKeyDevice1, EKeyDevice1, 0);
+			AddExpectedKey(EEventKeyUp, EStdKeyDevice0, 0, 0);
+			wg->CancelCaptureKeyUpAndDowns(iCaptureKey);
+			break;
+		case 3:
+			// Test key event translation using CaptureLongKey()
+			iCaptureKey = wg->CaptureLongKey(EKeyDevice0, EKeyDevice0, 0, 0, 0, ELongCaptureNormal);
+			TEST(iCaptureKey >= 0);
+			iQueueClient->iWs.Flush();
+
+			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyDevice1);
+			TheClient->iWs.Flush();
+			User::After(initialTime.Int() + time.Int() / 3);
+			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyDevice1);
+			TheClient->iWs.Flush();
+
+			AddExpectedKey(EEventKeyDown, EStdKeyDevice1, 0, 0);
+			AddExpectedKey(EEventKey, EStdKeyDevice1, EKeyDevice1, 0, EModifierAutorepeatable);
+			AddExpectedKey(EEventKey, EStdKeyDevice1, EKeyDevice0, 1, EModifierLongKey | EModifierAutorepeatable);
+			AddExpectedKey(EEventKeyUp, EStdKeyDevice1, 0, 0);
+
+			wg->CancelCaptureLongKey(iCaptureKey);
+			break;
+		case 4:
+			// Negative test: check that the capture key code listed in the
+			// translation table of the Key Routing Plug-in is not translated
+			// in the absence of any capture request for the mapped key.
+			iTest->SimulateKeyDownUp(EStdKeyDevice1);
+			TheClient->iWs.Flush();
+			AddExpectedKey(EEventKeyDown, EStdKeyDevice1, 0, 0);
+			AddExpectedKey(EEventKey, EStdKeyDevice1, EKeyDevice1, 0);
+			AddExpectedKey(EEventKeyUp, EStdKeyDevice1, 0, 0);
+			break;
+		default:
+			CActiveScheduler::Stop();
+			break;
+		}
+
+	TheClient->iWs.Flush();
+	}
+
+void CTEventTest::KeyEventBlocking_NextSetOfEventsL()
+	{
+	TTimeIntervalMicroSeconds32 initialTime;
+	TTimeIntervalMicroSeconds32 time;
+	TheClient->iWs.GetKeyboardRepeatRate(initialTime, time);
+
+	RWindowGroup* wg = iQueueClient->iGroup->GroupWin();
+
+	#if defined(LOGGING)
+		TLogMessageText logMessageText;
+		_LIT(KSet,"KeyEventBlocking SetOfEvents: %d of 5");
+		logMessageText.Format(KSet,iEventSet);
+		INFO_PRINTF1(logMessageText);
+	#endif
+
+	switch (iEventSet++)
+		{
+		case 0:
+			iQueueClient->iWs.Flush();
+			iTest->SimulateKeyDownUp('A');
+			AddExpectedEvent(EEventFocusGained);
+			AddExpectedKeyDownUp('A','a');
+			break;
+		case 1:
+			// Simulate pressing a blocked key (Device3) while no
+			// key capture is in effect.
+			iTest->SimulateKeyDownUp(EStdKeyDevice3);
+			iTest->SimulateKeyDownUp('B');
+			TheClient->iWs.Flush();
+			AddExpectedKeyDownUp('B','b');
+			break;
+		case 2:
+			// Use RWindowGroup::CaptureKey() to capture EKeyDevice3
+			// and simulate pressing the blocked key again.
+			iCaptureKey = wg->CaptureKey(EKeyDevice3, 0, 0);
+			TEST(iCaptureKey >= 0);
+			iQueueClient->iWs.Flush();
+			iTest->SimulateKeyDownUp(EStdKeyDevice3);
+			iTest->SimulateKeyDownUp('B');
+			TheClient->iWs.Flush();
+			AddExpectedKey(EEventKey, EStdKeyDevice3, EKeyDevice3, 0);
+			AddExpectedKeyDownUp('B','b');
+			wg->CancelCaptureKey(iCaptureKey);
+			break;
+		case 3:
+			// Repeat using CaptureKeyUpAndDowns()
+			iCaptureKey = wg->CaptureKeyUpAndDowns(EStdKeyDevice3, 0, 0);
+			TEST(iCaptureKey >= 0);
+			iQueueClient->iWs.Flush();
+			iTest->SimulateKeyDownUp(EStdKeyDevice3);
+			iTest->SimulateKeyDownUp('B');
+			TheClient->iWs.Flush();
+			AddExpectedKey(EEventKeyDown, EStdKeyDevice3, 0, 0);
+			AddExpectedKey(EEventKeyUp, EStdKeyDevice3, 0, 0);
+			AddExpectedKeyDownUp('B','b');
+			wg->CancelCaptureKeyUpAndDowns(iCaptureKey);
+			break;
+		case 4:
+			// Repeat using CaptureLongKey()
+			iCaptureKey = wg->CaptureLongKey(EKeyDevice3, EKeyDevice3, 0, 0, 0, ELongCaptureNormal);
+			TEST(iCaptureKey >= 0);
+			iQueueClient->iWs.Flush();
+			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyDevice3);
+			TheClient->iWs.Flush();
+			User::After(initialTime.Int() + time.Int() / 3);
+			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyDevice3);
+			iTest->SimulateKeyDownUp('B');
+			TheClient->iWs.Flush();
+			AddExpectedKey(EEventKey, EStdKeyDevice3, EKeyDevice3, 1, EModifierLongKey | EModifierAutorepeatable);
+			AddExpectedKeyDownUp('B','b');
+			wg->CancelCaptureLongKey(iCaptureKey);
+			break;
+		default:
+			CActiveScheduler::Stop();
+			break;
+		}
+
+	TheClient->iWs.Flush();
+	}
+
+void CTEventTest::KeyEventAppRestriction_NextSetOfEventsL()
+	{
+	TTimeIntervalMicroSeconds32 initialTime;
+	TTimeIntervalMicroSeconds32 time;
+	TheClient->iWs.GetKeyboardRepeatRate(initialTime, time);
+
+	RWindowGroup* wg = iQueueClient->iGroup->GroupWin();
+
+	#if defined(LOGGING)
+		TLogMessageText logMessageText;
+		_LIT(KSet,"KeyEventAppRestriction SetOfEvents: %d of 4");
+		logMessageText.Format(KSet,iEventSet);
+		INFO_PRINTF1(logMessageText);
+	#endif
+
+	switch (iEventSet++)
+		{
+		case 0:
+			// Make window group non-focusable so that it receives only
+			// keys that are captured and not those that are default-routed.
+			wg->EnableReceiptOfFocus(EFalse);
+			iQueueClient->iWs.Flush();
+			AddExpectedEvent(EEventFocusGained);
+			AddExpectedEvent(EEventFocusLost);
+			break;
+		case 1:
+			// Using RWindowGroup::CaptureKey(), attempt to capture a key
+			// that is restricted by UID to another application.
+			iCaptureKey = wg->CaptureKey(EKeyF20, 0, 0);
+			TEST(iCaptureKey == KErrPermissionDenied);
+			// Now capture a key that is restricted to the current
+			// application's UID and simulate pressing the restricted key.
+			iCaptureKey = wg->CaptureKey(EKeyF21, 0, 0);
+			TEST(iCaptureKey >= 0);
+			iQueueClient->iWs.Flush();
+			// Can't use SimulateKeyDownUp() here due to its check that scan
+			// codes are not in the range corresponding to lower case letters
+			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF21);
+			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF21);
+			TheClient->iWs.Flush();
+			AddExpectedKey(EEventKey, EStdKeyF21, EKeyF21, 0);
+			wg->CancelCaptureKey(iCaptureKey);
+			break;
+		case 2:
+			// Repeat using CaptureKeyUpAndDowns()
+			iCaptureKey = wg->CaptureKeyUpAndDowns(EStdKeyF20, 0, 0);
+			TEST(iCaptureKey == KErrPermissionDenied);
+			iCaptureKey = wg->CaptureKeyUpAndDowns(EStdKeyF21, 0, 0);
+			TEST(iCaptureKey >= 0);
+			iQueueClient->iWs.Flush();
+			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF21);
+			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF21);
+			TheClient->iWs.Flush();
+			AddExpectedKey(EEventKeyDown, EStdKeyF21, 0, 0);
+			AddExpectedKey(EEventKeyUp, EStdKeyF21, 0, 0);
+			wg->CancelCaptureKeyUpAndDowns(iCaptureKey);
+			break;
+		case 3:
+			// Repeat using CaptureLongKey()
+			iCaptureKey = wg->CaptureLongKey(EKeyF20, EKeyF20, 0, 0, 0, ELongCaptureNormal);
+			TEST(iCaptureKey == KErrPermissionDenied);
+			iCaptureKey = wg->CaptureLongKey(EKeyF21, EKeyF21, 0, 0, 0, ELongCaptureNormal);
+			TEST(iCaptureKey >= 0);
+			iQueueClient->iWs.Flush();
+			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF21);
+			TheClient->iWs.Flush();
+			User::After(initialTime.Int() + time.Int() / 3);
+			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF21);
+			TheClient->iWs.Flush();
+			AddExpectedKey(EEventKey, EStdKeyF21, EKeyF21, 1, EModifierLongKey | EModifierAutorepeatable);
+			wg->CancelCaptureLongKey(iCaptureKey);
+			break;
+		default:
+			CActiveScheduler::Stop();
+			break;
+		}
+
+	TheClient->iWs.Flush();
+	}
+
+void CTEventTest::KeyEventAppPriority_NextSetOfEventsL()
+	{
+	TTimeIntervalMicroSeconds32 initialTime;
+	TTimeIntervalMicroSeconds32 time;
+	TheClient->iWs.GetKeyboardRepeatRate(initialTime, time);
+
+	RWindowGroup* wg = iQueueClient->iGroup->GroupWin();
+	TInt handle1 = 0;
+	TInt handle2 = 0;
+	TInt handle3 = 0;
+	TInt handle4 = 0;
+	TInt handle5 = 0;
+	TInt handle6 = 0;
+
+	#if defined(LOGGING)
+		TLogMessageText logMessageText;
+		_LIT(KSet,"KeyEventAppPriority SetOfEvents: %d of 5");
+		logMessageText.Format(KSet,iEventSet);
+		INFO_PRINTF1(logMessageText);
+	#endif
+
+	switch (iEventSet++)
+		{
+		case 0:
+			SpawnCaptureAppL(iCaptureApp1);
+			iQueueClient->iWs.Flush();
+			AddExpectedEvent(EEventFocusGained);
+			AddExpectedEvent(EEventFocusLost);
+			break;
+		case 1:
+			// Use RWindowGroup::CaptureKey() to capture EKeyF22
+			// and EKeyF23 with priority 0. Simulate pressing both
+			// keys. Since the current application has precedence by UID
+			// for capture of EKeyF22, it should receive that key
+			// but should not receive EKeyF23.
+			handle1 = wg->CaptureKey(EKeyF22, 0, 0);
+			handle2 = wg->CaptureKey(EKeyF23, 0, 0);
+			TEST(handle1 >= 0);
+			TEST(handle2 >= 0);
+			iQueueClient->iWs.Flush();
+			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF22);
+			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF22);
+			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF23);
+			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF23);
+			TheClient->iWs.Flush();
+			AddExpectedKey(EEventKey, EStdKeyF22, EKeyF22, 0);
+			wg->CancelCaptureKey(handle1);
+			wg->CancelCaptureKey(handle2);
+			break;
+		case 2:
+			// Repeat using CaptureKeyUpAndDowns()
+			handle1 = wg->CaptureKeyUpAndDowns(EStdKeyF22, 0, 0);
+			handle2 = wg->CaptureKeyUpAndDowns(EStdKeyF23, 0, 0);
+			TEST(handle1 >= 0);
+			TEST(handle2 >= 0);
+			iQueueClient->iWs.Flush();
+			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF22);
+			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF22);
+			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF23);
+			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF23);
+			TheClient->iWs.Flush();
+			AddExpectedKey(EEventKeyDown, EStdKeyF22, 0, 0);
+			AddExpectedKey(EEventKeyUp, EStdKeyF22, 0, 0);
+			wg->CancelCaptureKeyUpAndDowns(handle1);
+			wg->CancelCaptureKeyUpAndDowns(handle2);
+			break;
+		case 3:
+			// Repeat using CaptureLongKey()
+			handle1 = wg->CaptureLongKey(EKeyF22, EKeyF22, 0, 0, 0, ELongCaptureNormal);
+			handle2 = wg->CaptureLongKey(EKeyF23, EKeyF23, 0, 0, 0, ELongCaptureNormal);
+			TEST(handle1 >= 0);
+			TEST(handle2 >= 0);
+			iQueueClient->iWs.Flush();
+
+			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF22);
+			TheClient->iWs.Flush();
+			User::After(initialTime.Int() + time.Int() / 3);
+			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF22);
+
+			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF23);
+			TheClient->iWs.Flush();
+			User::After(initialTime.Int() + time.Int() / 3);
+			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF23);
+			TheClient->iWs.Flush();
+
+			AddExpectedKey(EEventKey, EStdKeyF22, EKeyF22, 1, EModifierLongKey | EModifierAutorepeatable);
+			wg->CancelCaptureLongKey(handle1);
+			wg->CancelCaptureLongKey(handle2);
+			break;
+		case 4:
+			// Repeat with additional capture requests for improved code
+			// coverage. (Also verifies that UID-based precedence works even
+			// when another app makes the most recent capture request.)
+			// Spawn a second capture app so that requests occur in the
+			// following order:
+			// 1. CaptureApp1, priority 1 (outstanding)
+			// 2. Current App, priority 0, precedence by UID
+			// 3. CaptureApp2, priority 1
+			// Note that all three capture types are tested together here.
+			handle1 = wg->CaptureKey(EKeyF22, 0, 0);
+			handle2 = wg->CaptureKey(EKeyF23, 0, 0);
+			handle3 = wg->CaptureKeyUpAndDowns(EStdKeyF22, 0, 0);
+			handle4 = wg->CaptureKeyUpAndDowns(EStdKeyF23, 0, 0);
+			handle5 = wg->CaptureLongKey(EKeyF22, EKeyF22, 0, 0, 0, ELongCaptureNormal);
+			handle6 = wg->CaptureLongKey(EKeyF23, EKeyF23, 0, 0, 0, ELongCaptureNormal);
+			TEST(handle1 >= 0);
+			TEST(handle2 >= 0);
+			TEST(handle3 >= 0);
+			TEST(handle4 >= 0);
+			TEST(handle5 >= 0);
+			TEST(handle6 >= 0);
+			iQueueClient->iWs.Flush();
+
+			SpawnCaptureAppL(iCaptureApp2);
+
+			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF22);
+			TheClient->iWs.Flush();
+			User::After(initialTime.Int() + time.Int() / 3);
+			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF22);
+
+			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF23);
+			TheClient->iWs.Flush();
+			User::After(initialTime.Int() + time.Int() / 3);
+			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF23);
+			TheClient->iWs.Flush();
+
+			AddExpectedKey(EEventKeyDown, EStdKeyF22, 0, 0);
+			AddExpectedKey(EEventKey, EStdKeyF22, EKeyF22, 0);
+			AddExpectedKey(EEventKey, EStdKeyF22, EKeyF22, 1, EModifierLongKey | EModifierAutorepeatable);
+			AddExpectedKey(EEventKeyUp, EStdKeyF22, 0, 0);
+			wg->CancelCaptureKey(handle1);
+			wg->CancelCaptureKey(handle2);
+			wg->CancelCaptureKeyUpAndDowns(handle3);
+			wg->CancelCaptureKeyUpAndDowns(handle4);
+			wg->CancelCaptureLongKey(handle5);
+			wg->CancelCaptureLongKey(handle6);
+			break;
+		default:
+			iCaptureApp1.Kill(KErrNone);
+			iCaptureApp2.Kill(KErrNone);
+			iCaptureApp1.Close();
+			iCaptureApp2.Close();
+			CActiveScheduler::Stop();
+			break;
+		}
+
+	TheClient->iWs.Flush();
+	}
+
+/**
+Spawn another application that will capture the keys EKeyF22 and
+EKeyF23 with high priority.
+
+@param aProcess		Process to create
+*/
+void CTEventTest::SpawnCaptureAppL(RProcess& aProcess)
+	{
+	_LIT(KCaptureApp, "tevent_captureapp.exe");
+	TInt error = aProcess.Create(KCaptureApp, KNullDesC);
+	if (error != KErrNone)
+		{
+#if defined(LOGGING)
+		TLogMessageText logMessageText;
+		_LIT(KLog, "Cannot create capture app - error %d");
+		logMessageText.Format(KLog, error);
+		INFO_PRINTF1(logMessageText);
+#endif
+		User::Leave(error);
+		}
+
+	// Make rendezvous request to capture app
+	TRequestStatus status;
+	aProcess.Rendezvous(status);
+	aProcess.Resume();
+
+	// Wait for capture app to make its capture requests
+	User::WaitForRequest(status);
+	TEST(status.Int() == KErrNone);
+	}
+#endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA  	
+
 #define PASSWORD_START_OF_DAY 4
 void CTEventTest::Password_NextSetOfEvents()
 	{
@@ -6316,15 +6985,19 @@
 	_LIT(KTest25,"Mismatched Pointer Events");
 	_LIT(KTest26,"Pointer Buffer Purge");
 	_LIT(KTest27,"TRawEvent test for Repeats");
+#ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA 
+	_LIT(KTest28,"Translation of key events by routing plug-in");
+	_LIT(KTest29,"Blocking of key events by routing plug-in");
+	_LIT(KTest30,"App UID based restriction of key capture");
+	_LIT(KTest31,"App UID based routing of key events");
 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS            
-#ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA 
-	_LIT(KTest28,"Transparent Surface Visibility Changed Events 1");
-	_LIT(KTest29,"Transparent Surface Visibility Changed Events 2");
-	_LIT(KTest30,"Transparent Surface Visibility Changed Events 3");
+	_LIT(KTest32,"Transparent Surface Visibility Changed Events 1");
+	_LIT(KTest33,"Transparent Surface Visibility Changed Events 2");
+	_LIT(KTest34,"Transparent Surface Visibility Changed Events 3");
+#endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
-#endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
-	_LIT(KTest31A,"Initialize Queue Size without inactive queue");
-	_LIT(KTest31B,"Initialize Queue Size with inactive queue");	
+	_LIT(KTest35A,"Initialize Queue Size without inactive queue");
+	_LIT(KTest35B,"Initialize Queue Size with inactive queue");	
 	
 	if (!TestBase()->ConfigurationSupportsPointerEventTesting())
 	    {
@@ -6644,15 +7317,16 @@
 
 @SYMDEF             DEF081259
 
-@SYMTestCaseDesc    Send events for capturing large areas of text
+@SYMTestCaseDesc    Test RWindowGroup::CaptureLongKey()
 
 @SYMTestPriority    High
 
 @SYMTestStatus      Implemented
 
-@SYMTestActions     Send events for capturing large areas of text
-
-@SYMTestExpectedResults The events are sent to the window without
+@SYMTestActions     Simulate long key presses and check that long key capture
+					and key repeat work as expected.
+
+@SYMTestExpectedResults The correct key events are sent to the window without
 						error
 */
 		case 15:
@@ -6925,8 +7599,118 @@
 		    RunTestsL();
 		    break;
 		    
+#ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA            
+/**
+@SYMTestCaseID      GRAPHICS-WSERV-0751, GRAPHICS-WSERV-0752, GRAPHICS-WSERV-0753
+@SYMPREQ			417-61800
+@SYMTestCaseDesc    Test translation of key events by Key Event Routing plug-in
+@SYMTestPriority    High
+@SYMTestStatus      Implemented
+@SYMTestActions     Use RWindowGroup::CaptureKey() to capture pseudo key
+					Device0 (key code EKeyDevice0, scan code EStdKeyDevice0).
+					Simulate pressing key Device1.
+					Repeat using CaptureKeyUpAndDowns().
+					Repeat using CaptureLongKey().
+					Repeat without any capture requests.
+@SYMTestExpectedResults
+					The key event delivered contains the key or scan code for
+					Device0, if captured. When using CaptureKey() and
+					CaptureLongKey(), only the key code is translated. Using
+					CaptureKeyUpAndDowns(), only the scan code is translated.
+
+Note: this test requires an entry in the translation table of the Key Routing
+Plug-in to map Device0 to Device1 at capture request time.
+*/
+		case 28:
+            ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0751"));
+            iTest->LogSubTest(KTest28);
+            RunTestsL();
+            break;
+
+/**
+@SYMTestCaseID      GRAPHICS-WSERV-0760, GRAPHICS-WSERV-0761, GRAPHICS-WSERV-0762
+@SYMPREQ			417-61800
+@SYMTestCaseDesc    Test blocking of key events by Key Event Routing plug-in
+@SYMTestPriority    High
+@SYMTestStatus      Implemented
+@SYMTestActions     Simulate pressing a blocked key (Device3) while no
+					key capture is in effect.
+					Use RWindowGroup::CaptureKey() to capture EKeyDevice3
+					and simulate pressing the blocked key again.
+					Repeat using CaptureKeyUpAndDowns().
+					Repeat using CaptureLongKey().
+@SYMTestExpectedResults
+					The blocked key event is only delivered when captured and
+					is not routed to the focussed window group by default.
+
+Note: this test requires entries in the Blocked Key Table of the Reference
+Key Routing Plug-in for EKeyDevice3 and EStdKeyDevice3.
+*/
+		case 29:
+            ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0760"));
+            iTest->LogSubTest(KTest29);
+            RunTestsL();
+            break;
+
+/**
+@SYMTestCaseID      GRAPHICS-WSERV-0754, GRAPHICS-WSERV-0755, GRAPHICS-WSERV-0756
+@SYMPREQ			417-61800
+@SYMTestCaseDesc    Test application UID-based restriction of key capture by
+					Key Event Routing plug-in.
+@SYMTestPriority    High
+@SYMTestStatus      Implemented
+@SYMTestActions     Attempt to capture a key that is restricted by UID
+					to another application.
+					Use RWindowGroup::CaptureKey() to capture a key that is
+					restricted to the current application's UID.
+					Simulate pressing the second key.
+					Repeat using CaptureKeyUpAndDowns().
+					Repeat using CaptureLongKey().
+@SYMTestExpectedResults
+					Capture of the first key fails with KErrPermissionDenied.
+					Capture of the second key succeeds and the key event is
+					delivered.
+
+Note: this test requires entries in the Restricted Key Table of the Reference
+Key Routing Plug-in for the chosen keys.
+*/
+		case 30:
+            ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0754"));
+            iTest->LogSubTest(KTest30);
+            RunTestsL();
+            break;
+
+/**
+@SYMTestCaseID      GRAPHICS-WSERV-0757, GRAPHICS-WSERV-0758, GRAPHICS-WSERV-0759
+@SYMPREQ			417-61800
+@SYMTestCaseDesc    Test application UID-based routing of key events by
+					Key Event Routing plug-in.
+@SYMTestPriority    High
+@SYMTestStatus      Implemented
+@SYMTestActions     Invoke another application to capture two different keys
+					with high priority using each of RWindowGroup::CaptureKey(),
+					CaptureKeyUpAndDowns() and CaptureLongKey(). One key of
+					each pair has precedence for capture by the current
+					application's UID (i.e. this test).
+					In the current application, use RWindowGroup::CaptureKey()
+					to capture both keys with lower priority.
+					Simulate pressing the keys.
+					Repeat using CaptureKeyUpAndDowns().
+					Repeat using CaptureLongKey().
+@SYMTestExpectedResults
+					The key event with UID-based precedence is delivered to
+					the current application but the other key is not.
+
+Note: this test requires entries in the Priority Application Table of the
+Reference Key Routing Plug-in for the chosen key.
+*/
+		case 31:
+            ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0757"));
+            iTest->LogSubTest(KTest31);
+            RunTestsL();
+            break;
+
 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS            
-#ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA            
 /**
 @SYMTestCaseID      GRAPHICS-WSERV-2669-0015
 @SYMREQ             REQ13202: Possibility for external layers to appear above UI layer
@@ -6938,9 +7722,9 @@
 @SYMTestActions     Call SetSurfaceTransparency(ETrue) on win2
 @SYMTestExpectedResults Win1 receives visibility event
 */            
-        case 28:
+        case 32:
             ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-2669-0015"));
-            iTest->LogSubTest(KTest28);
+            iTest->LogSubTest(KTest32);
             RunTestsL();
             break;
 /**
@@ -6955,9 +7739,9 @@
 @SYMTestActions     Delete win3
 @SYMTestExpectedResults Both win1 and win2 receive visibility events
 */            
-        case 29:
+        case 33:
             ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-2669-0016"));
-            iTest->LogSubTest(KTest29);
+            iTest->LogSubTest(KTest33);
             RunTestsL();
             break;
 /**
@@ -6971,13 +7755,13 @@
 @SYMTestActions     Move win2 to overlap win1
 @SYMTestExpectedResults No visibility event is received (win1 is still fully visible)
 */            
-        case 30:
+        case 34:
             ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-2669-0017"));
-            iTest->LogSubTest(KTest30);
+            iTest->LogSubTest(KTest34);
             RunTestsL();
             break;
+#endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS  
 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
-#endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS  
 
 /**
 @SYMTestCaseID      GRAPHICS-WSERV-0559
@@ -6994,17 +7778,17 @@
 		case 28:
 #else
 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
-		case 31:
+		case 35:
 #else
-		case 28:
+		case 32:
 #endif
 #endif
 		    // This test was moved to be the last test in the test suite, because it sometimes leaves events in the event queue, 
 		    //it can affect the results of other tests. This test case should be the last test in the test suite. 
 		    ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0484"));
-		    iTest->LogSubTest(KTest31A);
+		    iTest->LogSubTest(KTest35A);
 		    InitializeQueueSizeTestL(EFalse);
-		    iTest->LogSubTest(KTest31B);
+		    iTest->LogSubTest(KTest35B);
 		    InitializeQueueSizeTestL(ETrue);
 		    break;    
 			
--- a/windowing/windowserver/test/tauto/TGRAPHICSDRAWER.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/tauto/TGRAPHICSDRAWER.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -22,7 +22,7 @@
 */
 
 #include "TGRAPHICSDRAWER.H"
-#include "Graphics/WSGRAPHICMSGBUF.H"
+#include "graphics/WSGRAPHICMSGBUF.H"
 
 CTGraphicsDrawer::CTGraphicsDrawer(CTestStep* aStep):
 	CTGraphicsBase(aStep)
--- a/windowing/windowserver/test/tauto/TOOM.CPP	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/tauto/TOOM.CPP	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1996-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"
@@ -66,6 +66,9 @@
 COomFailBase *CreateOomCaptureKeyUpDown(CTOom *aTest)
 	{return(new(ELeave) COomCaptureKeyUpDown(aTest));}
 
+COomFailBase *CreateOomLongKeyCapture(CTOom *aTest)
+	{return(new(ELeave) COomLongKeyCapture(aTest));}
+
 COomFailBase *CreateOomHotKey(CTOom *aTest)
 	{return(new(ELeave) COomHotKey(aTest));}
 
@@ -113,6 +116,7 @@
 	CreateOomPriorityKey,
 	CreateOomCaptureKey,
 	CreateOomCaptureKeyUpDown,
+	CreateOomLongKeyCapture,
 	CreateOomHotKey,
 	CreateOomGroupName,
 	CreateOomSprite,
@@ -421,7 +425,18 @@
 
 //
 
-COomCaptureKey::COomCaptureKey(CTOom *aTest) : COomSetup(aTest)
+COomCaptureKeyBase::COomCaptureKeyBase(CTOom *aTest) : COomSetup(aTest)
+	{}
+
+COomCaptureKeyBase::~COomCaptureKeyBase()
+	{}
+
+void COomCaptureKeyBase::ConstructL()
+	{
+	COomSetup::ConstructL();
+	}
+
+COomCaptureKey::COomCaptureKey(CTOom *aTest) : COomCaptureKeyBase(aTest)
 	{}
 
 COomCaptureKey::~COomCaptureKey()
@@ -433,11 +448,6 @@
 	return(_L("Capture key"));
 	}
 
-void COomCaptureKey::ConstructL()
-	{
-	COomSetup::ConstructL();
-	}
-
 /** Requests a capture keys for a previously created window group
 */
 TInt COomCaptureKey::Fail()
@@ -460,7 +470,7 @@
 
 //
 
-COomCaptureKeyUpDown::COomCaptureKeyUpDown(CTOom *aTest) : COomSetup(aTest)
+COomCaptureKeyUpDown::COomCaptureKeyUpDown(CTOom *aTest) : COomCaptureKeyBase(aTest)
 	{}
 
 COomCaptureKeyUpDown::~COomCaptureKeyUpDown()
@@ -472,11 +482,6 @@
 	return(_L("Capture up/down keys"));
 	}
 
-void COomCaptureKeyUpDown::ConstructL()
-	{
-	COomSetup::ConstructL();
-	}
-
 /** Requests the capture of key-up and key-down events for a previously created window group
 */
 TInt COomCaptureKeyUpDown::Fail()
@@ -499,6 +504,42 @@
 
 //
 
+COomLongKeyCapture::COomLongKeyCapture(CTOom *aTest) : COomCaptureKeyBase(aTest)
+	{}
+
+COomLongKeyCapture::~COomLongKeyCapture()
+	{
+	}
+
+TOomTestName COomLongKeyCapture::TestName()
+	{
+	_LIT(KLongKeyCapTestName, "Long key capture");
+	return KLongKeyCapTestName();
+	}
+
+/** 
+Requests capture of long key events for a previously created window group
+*/
+TInt COomLongKeyCapture::Fail()
+	{
+	for (iIndex=0; iIndex < KNumCapKeyRequest; iIndex++)
+		{
+		TInt ret=iWinGroup.CaptureLongKey(' ','a',0,0,2,ELongCaptureNormal);
+		if (ret<0)
+			return(ret);
+		iCapKey[iIndex]=ret;
+		}
+	return(KErrNone);
+	}
+
+void COomLongKeyCapture::ClearUpL()
+	{
+	for (TInt index=0;index<iIndex;index++)
+		iWinGroup.CancelCaptureLongKey(iCapKey[index]);
+	}
+
+//
+
 COomHotKey::COomHotKey(CTOom *aTest) : COomSetup(aTest)
 	{}
 
--- a/windowing/windowserver/test/tauto/TOOM.H	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/tauto/TOOM.H	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1996-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"
@@ -33,6 +33,8 @@
 
 class CTOom;
 
+const TInt KNumCapKeyRequest = 20;
+
 
 class COomFailBase : public CBase
 	{
@@ -192,32 +194,45 @@
 	TOomTestName TestName();
 	};
 
-class COomCaptureKey : public COomSetup
+class COomCaptureKeyBase : public COomSetup
+	{
+public:
+	COomCaptureKeyBase(CTOom *aTest);
+	~COomCaptureKeyBase();
+	void ConstructL();
+protected:
+	TInt32 iCapKey[KNumCapKeyRequest];
+	TInt iIndex;	
+	};
+
+class COomCaptureKey : public COomCaptureKeyBase
 	{
 public:
 	COomCaptureKey(CTOom *aTest);
 	~COomCaptureKey();
-	void ConstructL();
 	void ClearUpL();
 	TInt Fail();
 	TOomTestName TestName();
-private:
-	TInt32 iCapKey[20];
-	TInt iIndex;
 	};
 
-class COomCaptureKeyUpDown : public COomSetup
+class COomCaptureKeyUpDown : public COomCaptureKeyBase
 	{
 public:
 	COomCaptureKeyUpDown(CTOom *aTest);
 	~COomCaptureKeyUpDown();
-	void ConstructL();
 	void ClearUpL();
 	TInt Fail();
 	TOomTestName TestName();
-private:
-	TInt32 iCapKey[20];
-	TInt iIndex;
+	};
+
+class COomLongKeyCapture : public COomCaptureKeyBase
+	{
+public:
+	COomLongKeyCapture(CTOom *aTest);
+	~COomLongKeyCapture();
+	void ClearUpL();
+	TInt Fail();
+	TOomTestName TestName();
 	};
 
 class COomHotKey : public COomSetup
--- a/windowing/windowserver/test/tauto/talphawin.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/tauto/talphawin.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -371,7 +371,8 @@
 
 	theWin.SetExtent(TPoint(0,0), winSize);
 	theWin.SetBackgroundColor(TRgb(127,0,255,127));
-	TInt mode=theWin.SetRequiredDisplayMode(EColor16MA);
+	TDisplayMode mode = EColor16MAP;
+	theWin.SetRequiredDisplayMode(mode);
 	theWin.SetVisible(ETrue);
 	theWin.SetTransparencyAlphaChannel();
 	theWin.Activate();
@@ -447,7 +448,7 @@
 	CFbsBitmap *bitmapOne;
 	bitmapOne = new (ELeave)CFbsBitmap();
 	CleanupStack::PushL(bitmapOne);
-	User::LeaveIfError(bitmapOne->Create(winSize,static_cast<TDisplayMode>(mode)));
+	User::LeaveIfError(bitmapOne->Create(winSize,mode));
 
 	CFbsBitmapDevice *deviceOne=CFbsBitmapDevice::NewL(bitmapOne);
 	CleanupStack::PushL(deviceOne);
@@ -502,7 +503,7 @@
 	User::LeaveIfError(refWin.Construct(*(BaseWin->WinTreeNode()),(TUint32)&refWin));
 
 	refWin.SetExtent(TPoint(0,0), winSize);
-	refWin.SetRequiredDisplayMode(static_cast<TDisplayMode>(mode));
+	refWin.SetRequiredDisplayMode(mode);
 	refWin.SetVisible(ETrue);
 	refWin.SetTransparencyAlphaChannel();
 	refWin.Activate();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/test/tauto/tdevicerotation.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,823 @@
+// Copyright (c) 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:
+// Set of tests for Tracing Device Rotation. These tests generally test
+// RWsSession::IndicateAppOrientation(...).
+//
+
+/**
+ @file
+ @test
+ @internalComponent - Internal Nokia test code
+*/
+
+#include "tdevicerotation.h"
+#include "themeserverpropertydefine.h"
+#include "..\..\nga\server\renderorientationtracker.h" 
+#include <hal.h>
+#include <hal_data.h>
+#include <w32std.h>
+
+const TInt KPublishTimeout = 1000000; // 1 second in microseconds
+
+//
+// CTDeviceRotation Definition
+//
+
+CTDeviceRotation::CTDeviceRotation(CTestStep* aStep):
+	CTGraphicsBase(aStep), iWaitForPublishOnNextTest(ETrue)
+	{
+	}
+
+CTDeviceRotation::~CTDeviceRotation()
+	{
+    iPublishTimer.Close();
+    
+    iChildWindow.Close();
+    iWindowGroup.Close();
+    iWs.Close();    
+    
+    iSecondChildWindow.Close();
+    iSecondWindowGroup.Close();    
+    iSecondWs.Close();
+   
+    /* This Process called with the argument KThemeServerPropertyDefineCmdDelete, deletes 
+       the theme server RProperty. This is because an RProperty can only be defined and 
+       deleted from within a process with the same UID3 as the RProperty catogory you are 
+       trying to define/delete.*/
+    RProcess themeServerPropertyDefine;
+    TInt err = themeServerPropertyDefine.Create(KThemeServerPropertyDefine,
+            KThemeServerPropertyDefineCmdDelete);
+    if (KErrNone != err)
+        {
+        _LIT(KLog, "themeServerPropertyDefine.Create() failed with error: %d");
+        INFO_PRINTF2(KLog, err);
+        TEST(EFalse);        
+        }
+    //wait for themeServerPropertyDefine process to terminate
+    TRequestStatus themeServerPropertyDefineLogonStatus;
+    themeServerPropertyDefine.Logon(themeServerPropertyDefineLogonStatus);
+    themeServerPropertyDefine.Resume();
+    User::WaitForRequest(themeServerPropertyDefineLogonStatus);
+    if (themeServerPropertyDefineLogonStatus != KErrNone)
+        {
+        _LIT(KLog, "themeServerPropertyDefine.Logon() failed with error: %d");
+        INFO_PRINTF2(KLog, themeServerPropertyDefineLogonStatus);
+        TEST(EFalse);        
+        }
+    themeServerPropertyDefine.Close();
+    
+    iRenderOrientationProperty.Delete(KRenderOrientationCategory, KRenderOrientationKey);
+    iRenderOrientationProperty.Close();
+    iThemeServerOrientationProperty.Close();
+    }
+
+void CTDeviceRotation::ConstructL()
+    {
+    TInt err = iWs.Connect();
+    TESTL(err == KErrNone);
+            
+    err = iSecondWs.Connect();
+    TESTL(KErrNone == err);
+    
+    iWs.SetAutoFlush(ETrue);
+    iSecondWs.SetAutoFlush(ETrue);
+    
+    iWindowGroup = RWindowGroup(iWs);
+    err = iWindowGroup.Construct(iWs.Handle());
+    TESTL(KErrNone == err);
+    iWindowGroup.SetOrdinalPosition(0,1);
+    
+    iChildWindow = RWindow(iWs);
+    err = iChildWindow.Construct(iWindowGroup, reinterpret_cast<TUint32>(&iChildWindow));
+    TESTL(KErrNone == err);    
+
+    iSecondWindowGroup = RWindowGroup(iSecondWs);
+    err = iSecondWindowGroup.Construct(iSecondWs.Handle());
+    TESTL(KErrNone == err);
+    iSecondWindowGroup.SetOrdinalPosition(1,1);
+    
+    iSecondChildWindow = RWindow(iSecondWs);
+    err = iSecondChildWindow.Construct(iSecondWindowGroup, reinterpret_cast<TUint32>(&iSecondChildWindow));
+    TESTL(KErrNone == err);    
+    
+    err= iRenderOrientationProperty.Attach(KRenderOrientationCategory, KRenderOrientationKey, EOwnerThread);
+    TESTL(KErrNone == err);
+    iRenderOrientationProperty.Subscribe(iRenderOrientationStatus);
+    
+    /* This Process called with the argument KThemeServerPropertyDefineCmdDefine, defines
+       the theme server catagory to be the same as the theme servers process ID. This is 
+       because an RProperty can only be defined and deleted from within a process with the 
+       same UID3 as the RProperty catogory you are trying to define/delete.*/
+    RProcess themeServerPropertyDefine;
+    err = themeServerPropertyDefine.Create(KThemeServerPropertyDefine,KThemeServerPropertyDefineCmdDefine);
+    TESTL(KErrNone == err);
+    TRequestStatus themeServerPropertyDefineLogonStatus;
+    themeServerPropertyDefine.Logon(themeServerPropertyDefineLogonStatus);
+    themeServerPropertyDefine.Resume();
+    User::WaitForRequest(themeServerPropertyDefineLogonStatus);
+    TESTL(KErrNone == themeServerPropertyDefineLogonStatus.Int()); 
+    themeServerPropertyDefine.Close(); 
+
+    err = iThemeServerOrientationProperty.Attach(KThemeOrientationCategory, KThemeOrientationKey, EOwnerThread);
+    TESTL(KErrNone == err);
+    
+    SimulateThemeServerOrientation(EDisplayOrientationNormal);
+    
+    iPublishTimer.CreateLocal();
+    }
+
+void CTDeviceRotation::SimulateThemeServerOrientation(TRenderOrientation aOrientation)
+    {
+    _LIT(KFunctionInfo, "SimulateThemeServerOrientation(aOrientation = %d)");
+    INFO_PRINTF2(KFunctionInfo, aOrientation);
+    TInt err = iThemeServerOrientationProperty.Set(aOrientation);
+    if (KErrNone != err)
+        {
+        _LIT(KLog,"iThemeServerOrientationProperty.Set(%d) failed with err %d");
+        INFO_PRINTF3(KLog,aOrientation,err);
+        TEST(EFalse);
+        }
+    switch(aOrientation)
+        {
+        case EDisplayOrientationNormal:
+        case EDisplayOrientation90CW:
+        case EDisplayOrientation180:
+        case EDisplayOrientation270CW:
+            {
+            if(KErrNone == err)
+                {
+                iCurrentThemeServerOrientation = aOrientation;            
+                }                
+            break;
+            }
+        default:
+            _LIT(KLog, "This orientation is not supported by theme server.");
+        	INFO_PRINTF1(KLog);
+        }
+    }
+
+void CTDeviceRotation::IsOrientationCorrect(TRenderOrientation aExpectedOrientation)
+    {
+    // timer to timeout when nothing is published
+    iPublishTimer.After(iPublishTimerStatus, KPublishTimeout);
+    
+    // wait for either
+    User::WaitForRequest(iRenderOrientationStatus, iPublishTimerStatus);
+    
+    // check that the orientation was published or not, as expected
+    if(iWaitForPublishOnNextTest)
+        {
+        // Check that it really has published
+        if(iRenderOrientationStatus.Int()==KErrNone && iPublishTimerStatus.Int()==KRequestPending)
+            {
+            iPublishTimer.Cancel();
+            // re-subscribe
+            iRenderOrientationProperty.Subscribe(iRenderOrientationStatus);            
+            }
+        else
+            {
+            _LIT(KLog,"Timed out (%d) while waiting for render orientation %d to be published");
+            INFO_PRINTF3(KLog,iRenderOrientationStatus.Int(),aExpectedOrientation);        
+            TEST(EFalse);
+            }
+        }
+    else
+        {
+        // Check that it really hasn't published    
+        if(iRenderOrientationStatus.Int()!=KRequestPending)
+            {
+            _LIT(KLog,"Render Orientation %d was published (%d) when not expected (timeout = %d)");
+            INFO_PRINTF4(KLog,aExpectedOrientation, iRenderOrientationStatus.Int(),iPublishTimerStatus.Int());
+            iPublishTimer.Cancel();
+            TEST(EFalse);
+            }
+        else if(iPublishTimerStatus.Int()!=KErrNone)
+            {
+            _LIT(KLog,"Timeout failure %d");
+            INFO_PRINTF2(KLog,iPublishTimerStatus.Int());           
+            TEST(EFalse);        
+            }
+        
+        // reset to default
+        iWaitForPublishOnNextTest = ETrue;
+        }
+    
+    // Retrieve the value.
+    TInt orientation;
+    TInt err = iRenderOrientationProperty.Get(orientation);
+    if(KErrNone != err)
+           {
+           _LIT(KLog,"iThemeServerOrientationProperty.Get(...) failed with err %d");
+           INFO_PRINTF2(KLog,err);
+           TEST(EFalse);
+           }
+    else if(aExpectedOrientation == EDisplayOrientationAuto)
+        {
+        TEST(orientation == iCurrentThemeServerOrientation);
+        CheckHalSetting(iCurrentThemeServerOrientation);
+        }
+    else
+        {
+        TEST(orientation == aExpectedOrientation);
+        CheckHalSetting(static_cast<TRenderOrientation>(orientation));
+        }
+    }
+
+void CTDeviceRotation::CheckHalSetting(TRenderOrientation aOrientation)
+    {
+    HALData::TDigitiserOrientation halOrientationExp = static_cast<HALData::TDigitiserOrientation>
+            (HALData::EDigitiserOrientation_000 + (aOrientation - EDisplayOrientationNormal));
+    TInt halOrientation;
+    TInt err = HAL::Get(iWs.GetFocusScreen(), HALData::EDigitiserOrientation, halOrientation);
+    if (err != KErrNotSupported)
+        {
+        if (err != KErrNone)
+            {
+            _LIT(KLog,"Getting HAL orientation attribute returned error %d when no error expected");
+            INFO_PRINTF2(KLog,err);
+            }
+        TEST(err==KErrNone);
+        if (halOrientationExp != halOrientation)
+            {
+            _LIT(KLog,"HAL orientation is %d when expected to be %d");
+            INFO_PRINTF3(KLog, halOrientation, halOrientationExp);
+            }
+        TEST(halOrientationExp==halOrientation);
+        }
+    else
+        {
+        _LIT(KLog,"HAL-Orientation HALData::EDigitiserOrientation isn't supported by Driver");
+        INFO_PRINTF1(KLog);
+        }
+    }
+
+void CTDeviceRotation::TestIndicateAppOrientation(TRenderOrientation aOrientation)
+	{
+    _LIT(KTestInfo, "TestIndicateAppOrientation(aOrientation = %d)");
+    INFO_PRINTF2(KTestInfo, aOrientation);
+	if (EDisplayOrientationIgnore == aOrientation)
+	    {
+        TEST(EFalse);
+        _LIT(KLog, "TestIndicateAppOrientation(TRenderOrientation aOrientation) cannot be used with EDisplayOrientationIgnore");
+        INFO_PRINTF1(KLog);
+	    }
+	iWs.IndicateAppOrientation(aOrientation);
+	iWindowGroup.SetOrdinalPosition(0);
+	IsOrientationCorrect(aOrientation);
+	}
+
+void CTDeviceRotation::TestIndicateAppOrientation(TRenderOrientation aOrientation, TRenderOrientation aSecondOrientation)
+    {
+    _LIT(KTestInfo, "TestIndicateAppOrientation(aOrientation = %d, aSecondOrientation = %d)");
+    INFO_PRINTF3(KTestInfo, aOrientation, aSecondOrientation);
+    //Inform window serve the orientation status
+    iWs.IndicateAppOrientation(aOrientation);
+    iSecondWs.IndicateAppOrientation(aSecondOrientation);
+    
+    iWindowGroup.SetOrdinalPosition(0,1);
+    iSecondWindowGroup.SetOrdinalPosition(1,1);
+
+    if(aOrientation != EDisplayOrientationIgnore)
+        {
+        IsOrientationCorrect(aOrientation);
+        }
+    else
+        {
+        IsOrientationCorrect(aSecondOrientation);
+        }
+    }
+
+void CTDeviceRotation::TestAppOrientationOnSwap(TRenderOrientation aOrientation, TRenderOrientation aSecondOrientation)
+    {    
+    _LIT(KTestInfo, "TestAppOrientationOnSwap(aOrientation = %d, aSecondOrientation = %d)");
+    INFO_PRINTF3(KTestInfo, aOrientation, aSecondOrientation);
+    
+    iWs.IndicateAppOrientation(aOrientation);
+    iSecondWs.IndicateAppOrientation(aSecondOrientation);
+    
+    iSecondWindowGroup.SetOrdinalPosition(0);
+    if (aSecondOrientation != EDisplayOrientationIgnore)
+        {
+        IsOrientationCorrect(aSecondOrientation);
+        }
+    else
+        {
+        IsOrientationCorrect(aOrientation);
+        }
+    }
+
+void CTDeviceRotation::RunTestCaseL(TInt aCurTestCase)
+	{
+    _LIT(KNewLine, "\n");
+    (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KUnknownSYMTestCaseIDName);
+	switch(aCurTestCase)
+		{
+	    case 1:
+            _LIT(KTestStepID1,"Test Initial Orientations");
+            (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KTestStepID1);
+            INFO_PRINTF1(KNewLine);
+            INFO_PRINTF1(KTestStepID1);
+            TestInitialOrientation();
+            break;
+		case 2:
+    	    _LIT(KTestStepID2,"Test Fixed Orientations");
+            (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KTestStepID2);
+            INFO_PRINTF1(KNewLine);
+            INFO_PRINTF1(KTestStepID2);
+            TestFixedOrientations();
+			break;
+		case 3:
+    	    _LIT(KTestStepID3,"Test Auto Orientation");
+		    (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KTestStepID3);
+		    INFO_PRINTF1(KNewLine);
+		    INFO_PRINTF1(KTestStepID3);
+		    TestAutoOrientation();
+			break;
+		case 4:
+            _LIT(KTestStepID4,"Test Ignore Orientation");
+            (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KTestStepID4);
+            INFO_PRINTF1(KNewLine);
+            INFO_PRINTF1(KTestStepID4);
+            TestIgnoreOrientation();
+			break;
+        case 5:
+            _LIT(KTestStepID5,"Test Swap Orientations");
+            (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KTestStepID5);
+            INFO_PRINTF1(KNewLine);
+            INFO_PRINTF1(KTestStepID5);
+            TestFixedOrientationsOnWindowSwap();
+			break;
+        case 6:
+            _LIT(KTestStepID6,"Test Auto Swap Orientations");
+            (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KTestStepID6);
+            INFO_PRINTF1(KNewLine);
+            INFO_PRINTF1(KTestStepID6);
+            TestAutoOrientationOnWindowSwap();
+            break;
+        case 7:
+            _LIT(KTestStepID7,"Test Ignore Swap Orientations");
+            (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KTestStepID7);
+            INFO_PRINTF1(KNewLine);
+            INFO_PRINTF1(KTestStepID7);
+            TestIgnoreOrientationOnWindowSwap();
+			break;
+        case 8:
+            _LIT(KTestStepID8,"Test Auto Swap Orientations");
+            (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KTestStepID8);
+            INFO_PRINTF1(KNewLine);
+            INFO_PRINTF1(KTestStepID8);
+            TestIgnoreAutoOrientationOnWindowSwap();
+            break;
+        case 9:
+            _LIT(KTestStepID9,"Test Invalid App Orientations");
+            (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KTestStepID9);
+            INFO_PRINTF1(KNewLine);
+            INFO_PRINTF1(KTestStepID9);
+            TestInvalidAppOrientation();
+            break;
+        case 10:
+            _LIT(KTestStepID10,"Test Invalid Theme Server Orientations");
+            (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KTestStepID10);
+            INFO_PRINTF1(KNewLine);
+            INFO_PRINTF1(KTestStepID10);
+            TestInvalidThemeServerOrientation();
+            break;
+		default:
+            (reinterpret_cast<CTDeviceRotationStep*>(iStep))->SetTestStepID(KNotATestSYMTestCaseIDName);
+			(reinterpret_cast<CTDeviceRotationStep*>(iStep))->CloseTMSGraphicsStep();
+			TestComplete();
+		}
+	(reinterpret_cast<CTDeviceRotationStep*>(iStep))->RecordTestResultL();
+	}
+
+
+/**
+ @SYMTestCaseID             GRAPHICS-WSERV-DEVICEROTATION-0001
+ @SYMTestCaseDesc           Test Auto Orientation
+ @SYMPREQ                   460936 Tracking Device Rotation
+ @SYMTestPriority           1
+ @SYMTestPurpose            To test that we can return the correct initial orientation value from 
+                            the windwoserver.
+ @SYMPrerequisites          An RProperty is set up to subscribe to notifications of 
+                            windowserver orientation changes.
+                            We have set up an RWindowGroup at the foreground and not altered its
+                            indicated orientation.
+ @SYMTestActions            1) Get the value of the orientation as published by window server.
+
+ @SYMTestExpectedResults    The windowserver should return EDisplayOrientationNormal
+ */
+void CTDeviceRotation::TestInitialOrientation()
+    {
+    iWaitForPublishOnNextTest = EFalse;
+    IsOrientationCorrect(EDisplayOrientationNormal);
+    }
+
+/**
+ @SYMTestCaseID             GRAPHICS-WSERV-DEVICEROTATION-0002
+ @SYMTestCaseDesc           Test Fixed Orientations
+ @SYMPREQ                   460936 Tracking Device Rotation
+ @SYMTestPriority           1
+ @SYMTestPurpose            To test that we can return the correct orientation value from 
+                            the windwoserver after we indicate the application orientation
+                            as fixed values using RWsSession::IndicateAppOrientation. Any 
+                            theme server orientations should be ignored.
+ @SYMPrerequisites          An RProperty is set up to subscribe to notifications of 
+                            windowserver orientation changes.
+                            An RProperty is set up to publish Theme server Orientation changes. 
+                            We have set up an RWindowGroup in the foreground.
+                            Windowserver orientation currently set to EDisplayOrientationNormal.
+
+ @SYMTestActions            1) Set Theme Server orientation to EDisplayOrientation90CW.
+                            2) Set the RWindowgroup in ordinal position 0 to a fixed orientation.
+                            3) Check the published orinetation value in windowserver.
+                            4) Repeat steps 2) and 3) for all fixed orientations
+                            3) Set Theme Server orientation to EDisplayOrientationNormal.
+                            4) Repeat Steps 2-4).
+
+ @SYMTestExpectedResults    The orientation set in step 2) should always be the same as the 
+                            orientation set in step 2)
+ */
+void CTDeviceRotation::TestFixedOrientations()
+    {
+    iWaitForPublishOnNextTest = EFalse;
+    SimulateThemeServerOrientation(EDisplayOrientation90CW);
+    TestIndicateAppOrientation(EDisplayOrientationNormal);
+    TestIndicateAppOrientation(EDisplayOrientation90CW);
+    TestIndicateAppOrientation(EDisplayOrientation180);
+    TestIndicateAppOrientation(EDisplayOrientation270CW);
+    
+    SimulateThemeServerOrientation(EDisplayOrientationNormal);
+    TestIndicateAppOrientation(EDisplayOrientationNormal);
+    TestIndicateAppOrientation(EDisplayOrientation90CW);
+    TestIndicateAppOrientation(EDisplayOrientation180);
+    TestIndicateAppOrientation(EDisplayOrientation270CW);
+    
+    SimulateThemeServerOrientation(EDisplayOrientation180);
+    TestIndicateAppOrientation(EDisplayOrientationNormal);
+    TestIndicateAppOrientation(EDisplayOrientation90CW);
+    TestIndicateAppOrientation(EDisplayOrientation180);
+    TestIndicateAppOrientation(EDisplayOrientation270CW);
+    
+    SimulateThemeServerOrientation(EDisplayOrientation270CW);
+    TestIndicateAppOrientation(EDisplayOrientationNormal);
+    TestIndicateAppOrientation(EDisplayOrientation90CW);
+    TestIndicateAppOrientation(EDisplayOrientation180);
+    TestIndicateAppOrientation(EDisplayOrientation270CW);    
+    }
+
+/**
+ @SYMTestCaseID             GRAPHICS-WSERV-DEVICEROTATION-0003
+ @SYMTestCaseDesc           Test Auto Orientation
+ @SYMPREQ                   460936 Tracking Device Rotation
+ @SYMTestPriority           1
+ @SYMTestPurpose            To test that we can return the correct orientation value from 
+                            the windwoserver after we indicate the application orientation
+                            as auto values using RWsSession::IndicateAppOrientation. The wserv
+                            should publish the theme server orientation changes only.
+ @SYMPrerequisites          An RProperty is set up to subscribe to notifications of 
+                            windowserver orientation changes.
+                            An RProperty is set up to publish Theme server Orientation changes.
+                            We have set up an RWindowGroup in the foreground.
+                            WindowServer orinetation is not set to EDisplayOrientation90CW.
+
+ @SYMTestActions            1) Set Theme Server orientation to EDisplayOrientation90CW.
+                            2) Set the RWindowgroup in ordinal position 0 to auto orientation.
+                            3) Check the published orinetation value in windowserver.
+                            4) Set Theme Server orientation to EDisplayOrientationNormal.
+                            5) Check the value of the orientation as published by window server.
+                            6) Repeat 4) and 5) for EDisplayOrientation180 and 
+                               EDisplayOrientation270CW
+                            7) repeat 4) and 5) again for EDisplayOrientation270CW
+
+ @SYMTestExpectedResults    We should get expected notifications where orientations have changed.
+                            The orientation checked in step 3) should be the theme server 
+                            orientation set in step 1).
+                            The orientations checked in step 5) should be the theme server 
+                            orientations set in step 4).
+                            We should recieve no notification for step 7).
+ */
+void CTDeviceRotation::TestAutoOrientation()
+    {
+    SimulateThemeServerOrientation(EDisplayOrientation90CW);
+    TestIndicateAppOrientation(EDisplayOrientationAuto);
+    SimulateThemeServerOrientation(EDisplayOrientationNormal);
+    IsOrientationCorrect(iCurrentThemeServerOrientation);
+    // Now flip it upside down to ensure that nothing assumes this will only be updated incrementally
+    SimulateThemeServerOrientation(EDisplayOrientation180);
+    IsOrientationCorrect(iCurrentThemeServerOrientation);
+    SimulateThemeServerOrientation(EDisplayOrientation270CW);
+    IsOrientationCorrect(iCurrentThemeServerOrientation);
+    
+    // And check that wserv doesn't publish if the theme server publishes the existing orientation
+    SimulateThemeServerOrientation(EDisplayOrientation270CW);
+    iWaitForPublishOnNextTest = EFalse;    
+    IsOrientationCorrect(iCurrentThemeServerOrientation);
+    }
+
+/**
+ @SYMTestCaseID             GRAPHICS-WSERV-DEVICEROTATION-0004
+ @SYMTestCaseDesc           Test Ignore Orientation
+ @SYMPREQ                   460936 Tracking Device Rotation
+ @SYMTestPriority           1
+ @SYMTestPurpose            To test that we can return the correct orientation value from 
+                            the windwoserver after we indicate the front applications 
+                            orientation as ignore.  
+ @SYMPrerequisites          An RProperty is set up to subscribe to notifications of 
+                            windowserver orientation changes.
+                            An RProperty is set up to publish Theme server Orientation changes.
+                            We have set up two RWindowGroups in the ordinal positions 0 and 1. 
+                            WindowServer orinetation is not set to EDisplayOrientationNormal.
+
+ @SYMTestActions            1) Set Theme Server orientation to EDisplayOrientation90CW.
+                            2) Set the RWindowGroup in ordinal position 0 to a ignore orientation.
+                            3) Set the RWindowgroup in ordinal position 1 to a fixed orientation.
+                            4) Check the published orinetation value in windowserver.
+                            5) Repeat steps 2-4) varying the fixed orientation set in step 2).
+                            6) Set Theme Server orientation to EDisplayOrientation90CW.
+                            7) Set the RWindowGroup in ordinal position 0 to a ignore orientation.
+                            8) Set the RWindowgroup in ordinal position 1 to a fixed orientation.
+                            9) Check the published orinetation value in windowserver.
+                            10) Set Theme Server orientation to EDisplayOrientationNormal.
+                            11) Check the published orinetation value in windowserver.
+
+ @SYMTestExpectedResults    We should get expected notifications where orientations have changed.
+                            All orientations checked in step 4) should be the fixed orientations 
+                            of the windows in ordinal position 1, as set in step 3).
+                            The orientation checked in step 9) should be the theme server 
+                            orientation set in step 6).
+                            The orientation checked in step 11) should be the theme server 
+                            orientation set in step 10).
+ */
+void CTDeviceRotation::TestIgnoreOrientation()
+    {
+    SimulateThemeServerOrientation(EDisplayOrientation90CW);
+    TestIndicateAppOrientation(EDisplayOrientationIgnore, EDisplayOrientationNormal);
+    TestIndicateAppOrientation(EDisplayOrientationIgnore, EDisplayOrientation90CW);
+    TestIndicateAppOrientation(EDisplayOrientationIgnore, EDisplayOrientation180);
+    TestIndicateAppOrientation(EDisplayOrientationIgnore, EDisplayOrientation270CW);
+    
+    SimulateThemeServerOrientation(EDisplayOrientation90CW);
+    TestIndicateAppOrientation(EDisplayOrientationIgnore, EDisplayOrientationAuto);
+    SimulateThemeServerOrientation(EDisplayOrientationNormal);
+    IsOrientationCorrect(iCurrentThemeServerOrientation);
+    }
+
+/**
+ @SYMTestCaseID             GRAPHICS-WSERV-DEVICEROTATION-0005
+ @SYMTestCaseDesc           Test Fixed Orientations On Swap
+ @SYMPREQ                   460936 Tracking Device Rotation
+ @SYMTestPriority           1
+ @SYMTestPurpose            To test that we get notifactation of a change in orientation and can 
+                            return the correct orientation value from the windwoserver after we 
+                            swap windows with varying fixed orienations.  
+ @SYMPrerequisites          An RProperty is set up to subscribe to notifications of 
+                            windowserver orientation changes.
+                            We have set up two RWindowGroups in the ordinal positions 0 and 1. 
+
+ @SYMTestActions            1) Set the RWindowGroup in ordinal position 0 to a fixed orientation.
+                            2) Set the RWindowgroup in ordinal position 1 to a fixed orientation.
+                            3) Check the published orinetation value in windowserver.
+                            4) Move the RWindowGroup ordinal position 1 to the ordinal position 0.
+                            5) Check the published orinetation value in windowserver.
+                            6) Repeat steps 1-5 but vary the values the fixed orientation of the 
+                               RWindows set in steps 1) and 2)
+
+ @SYMTestExpectedResults    We should get expected notifications where orientations have changed.
+                            All orientations checked in step 3) should be the fixed orientations 
+                            of the windows in ordinal position 0, as set in step 1).
+                            The orientations checked in step 5) should be the fixed orientations 
+                            of the windows which was in ordinal position 1 before each swap, as 
+                            set in step 2).
+ */
+void CTDeviceRotation::TestFixedOrientationsOnWindowSwap()
+    {
+    iWaitForPublishOnNextTest = EFalse;
+    TestIndicateAppOrientation(EDisplayOrientationNormal, EDisplayOrientationNormal);
+    iWaitForPublishOnNextTest = EFalse;
+    TestAppOrientationOnSwap(EDisplayOrientationNormal, EDisplayOrientationNormal);
+    TestIndicateAppOrientation(EDisplayOrientationNormal, EDisplayOrientation90CW);
+    TestAppOrientationOnSwap(EDisplayOrientationNormal, EDisplayOrientation90CW);
+    TestIndicateAppOrientation(EDisplayOrientation90CW, EDisplayOrientationNormal);
+    TestAppOrientationOnSwap(EDisplayOrientation90CW, EDisplayOrientationNormal);
+    }
+
+/**
+ @SYMTestCaseID             GRAPHICS-WSERV-DEVICEROTATION-0006
+ @SYMTestCaseDesc           Test Auto Orientations On Swap
+ @SYMPREQ                   460936 Tracking Device Rotation
+ @SYMTestPriority           1
+ @SYMTestPurpose            To test that we get notifactation of a change in orientation and can 
+                            return the correct orientation value from the windwoserver after we 
+                            swap windows with auto orienations.  
+ @SYMPrerequisites          An RProperty is set up to subscribe to notifications of 
+                            windowserver orientation changes.
+                            An RProperty is set up to publish Theme server Orientation changes.
+                            We have set up two RWindowGroups in the ordinal positions 0 and 1.
+                            WindowServer orinetation is not set to EDisplayOrientation270CW. 
+
+ @SYMTestActions            1) Set the theme server orientation.
+                            2) Set the RWindowGroup in ordinal position 0 to a fixed orientation.
+                            3) Set the RWindowGroup in ordinal position 1 to auto orientation.
+                            4) Check the published orinetation value in windowserver.
+                            5) Move the RWindowGroup ordinal position 1 to the ordinal position 0. 
+                            6) Check the published orinetation value in windowserver.
+                            7) Repeat steps 1-6 but vary the values of the theme server 
+                               orientation in step 1) and the fixed orientation of the frontwindow
+                               in 2)
+ @SYMTestExpectedResults    We should get expected notifications where orientations have changed.
+                            All orientations checked in step 4) should be the fixed orientations 
+                            of the front windows, which have been set in step 2).
+                            All orientations checked in step 6) should be the theme server 
+                            orientations set in step 1)
+ */
+void CTDeviceRotation::TestAutoOrientationOnWindowSwap()
+    {
+    SimulateThemeServerOrientation(EDisplayOrientation90CW);
+    TestIndicateAppOrientation(EDisplayOrientation270CW, EDisplayOrientationAuto);
+    TestAppOrientationOnSwap(EDisplayOrientation270CW, EDisplayOrientationAuto);
+    SimulateThemeServerOrientation(EDisplayOrientationNormal);
+    TestIndicateAppOrientation(EDisplayOrientationAuto, EDisplayOrientation180);
+    TestAppOrientationOnSwap(EDisplayOrientationAuto, EDisplayOrientation180);
+    
+    SimulateThemeServerOrientation(EDisplayOrientation90CW);
+    TestIndicateAppOrientation(EDisplayOrientation90CW, EDisplayOrientationAuto);
+    iWaitForPublishOnNextTest = EFalse;
+    TestAppOrientationOnSwap(EDisplayOrientation90CW, EDisplayOrientationAuto);
+    SimulateThemeServerOrientation(EDisplayOrientationNormal);
+    TestIndicateAppOrientation(EDisplayOrientationAuto, EDisplayOrientationNormal);
+    iWaitForPublishOnNextTest = EFalse;
+    TestAppOrientationOnSwap(EDisplayOrientationAuto, EDisplayOrientationNormal);
+    }
+
+/**
+ @SYMTestCaseID             GRAPHICS-WSERV-DEVICEROTATION-0007
+ @SYMTestCaseDesc           Test Swap Orientations with Ignore Orientation
+ @SYMPREQ                   460936 Tracking Device Rotation
+ @SYMTestPriority           1
+ @SYMTestPurpose            To test that we get notifactation of a change in orientation and can 
+                            return the correct orientation value from the windwoserver after we 
+                            swap windows with ignore orienations.  
+ @SYMPrerequisites          An RProperty is set up to subscribe to notifications of 
+                            windowserver orientation changes.
+                            An RProperty is set up to publish Theme server Orientation changes.
+                            We have set up two RWindowGroups in the ordinal positions 0 and 1. 
+
+ @SYMTestActions            1) Set the theme server orientation.
+                            2) Set the RWindowGroup in ordinal position 0 to ignore orientation.
+                            3) Set the RWindowGroup in ordinal position 1 to a fixed orientation.
+                            4) Check the published orinetation value in windowserver.
+                            5) Move the RWindowGroup ordinal position 1 to the ordinal position 0. 
+                            6) Check the published orinetation value in windowserver.
+                            7) Repeat steps 1-6 but vary the values of the theme server 
+                               orientation in step 1) and the fixed orientation of the frontwindow
+                               in 3)
+                            8) Set the theme server orientation.
+                            9) Set the RWindowGroup in ordinal position 0 to a fixedorientation.
+                            10) Set the RWindowGroup in ordinal position 1 to ignore orienation.
+                            11) Repeat steps 4-6) 
+                            12) Repeat steps 8-11) but vary the values of the theme server 
+                               orientation in step 8) and the fixed orientation of the 
+                               RwindowGroup in 9)                            
+                               
+ @SYMTestExpectedResults    We should get expected notifications where orientations have changed.
+                            All orientations checked in step 4) and 6) should be the fixed 
+                            orientations RWindowGroups which have been set in step 3).
+                            All orientations checked in step 11) should be the fixed orientations 
+                            of the front RWindowGroups which have been set in step 9).
+*/
+void CTDeviceRotation::TestIgnoreOrientationOnWindowSwap()
+    {
+    SimulateThemeServerOrientation(EDisplayOrientation90CW);
+    TestIndicateAppOrientation(EDisplayOrientationIgnore, EDisplayOrientation270CW);
+    TestAppOrientationOnSwap(EDisplayOrientationIgnore, EDisplayOrientation180);
+    
+    SimulateThemeServerOrientation(EDisplayOrientationNormal);
+    TestIndicateAppOrientation(EDisplayOrientationIgnore, EDisplayOrientationNormal);
+    TestAppOrientationOnSwap(EDisplayOrientationIgnore, EDisplayOrientation90CW);
+    
+    SimulateThemeServerOrientation(EDisplayOrientation90CW);
+    TestIndicateAppOrientation(EDisplayOrientation270CW, EDisplayOrientationIgnore);
+    TestAppOrientationOnSwap(EDisplayOrientation180, EDisplayOrientationIgnore);    
+    
+    SimulateThemeServerOrientation(EDisplayOrientationNormal);
+    TestIndicateAppOrientation(EDisplayOrientationNormal, EDisplayOrientationIgnore);
+    TestAppOrientationOnSwap(EDisplayOrientation90CW, EDisplayOrientationIgnore);
+    }
+
+/**
+ @SYMTestCaseID             GRAPHICS-WSERV-DEVICEROTATION-0008
+ @SYMTestCaseDesc           Test Swap Orientations with Auto and Ignore Orientations
+ @SYMPREQ                   460936 Tracking Device Rotation
+ @SYMTestPriority           1
+ @SYMTestPurpose            To test that we get notifactation of a change in orientation and can 
+                            return the correct orientation value from the windwoserver after we 
+                            swap windows with auto and ignore orienations.  
+ @SYMPrerequisites          An RProperty is set up to subscribe to notifications of 
+                            windowserver orientation changes.
+                            An RProperty is set up to publish Theme server Orientation changes.
+                            We have set up two RWindowGroups in the ordinal positions 0 and 1. 
+ @SYMTestActions            1) Set the theme server orientation to EDisplayOrientationNormal.
+                            2) Set the RWindowGroup in ordinal position 0 to auto orientation.
+                            3) Set the RWindowGroup in ordinal position 1 to ignore orientation.
+                            4) Check the published orinetation value in windowserver.
+                            5) Set the theme server orientation to EDisplayOrientation90CW.
+                            6) Check the published orinetation value in windowserver.
+                            7) Set the theme server orientation to EDisplayOrientationNormal.
+                            8) Move the RWindowGroup in ordinal position 1 to ordinal position 0.
+                            9) Check the published orinetation value in windowserver.
+                            10) Set the theme server orientation to EDisplayOrientation90CW.
+                            11) Check the published orinetation value in windowserver.
+
+ @SYMTestExpectedResults    We should get expected notifications where orientations have changed.
+                            The orientations checked in step 4), 6), 9) and  11) should all be 
+                            the orientations set to the themeserver in steps 1), 5), 8) and 10)
+                            respecvtively. 
+*/
+void CTDeviceRotation::TestIgnoreAutoOrientationOnWindowSwap()
+    {
+    SimulateThemeServerOrientation(EDisplayOrientationNormal);
+    TestIndicateAppOrientation(EDisplayOrientationAuto, EDisplayOrientationIgnore);
+    SimulateThemeServerOrientation(EDisplayOrientation90CW);
+    IsOrientationCorrect(iCurrentThemeServerOrientation);
+    
+    SimulateThemeServerOrientation(EDisplayOrientationNormal);
+    iSecondWindowGroup.SetOrdinalPosition(0);
+    IsOrientationCorrect(iCurrentThemeServerOrientation);
+    SimulateThemeServerOrientation(EDisplayOrientation90CW);
+    IsOrientationCorrect(iCurrentThemeServerOrientation);
+    }
+
+/**
+ @SYMTestCaseID             GRAPHICS-WSERV-DEVICEROTATION-0009
+ @SYMTestCaseDesc           Test Invalid App Orientation
+ @SYMPREQ                   ###TrackingDeviceRotation### TODO replace me
+ @SYMTestPriority           1
+ @SYMTestPurpose            To test that an invalid orientation is ignored.
+ @SYMPrerequisites          An RProperty is set up to subscribe to notifications of 
+                            windowserver orientation changes.
+                            An RProperty is set up to publish Theme server Orientation changes.
+                            We have set up an RWindowGroup in ordinal position 0.
+ @SYMTestActions            1) Set the theme server orientation to EDisplayOrientationNormal.
+                            2) Set the RWindowGroup in ordinal position 0 to 
+                               EDisplayOrientation90CW.
+                            4) Check the published orinetation value in windowserver.
+                            5) Set the RWindowGroup in ordinal position 0 to an invalid 
+                               orientation.
+                            6) Check the published orinetation value in windowserver.
+
+ @SYMTestExpectedResults    Wserv should publish an orientation change for 2) but not for 5).
+                            The orientations checked in steps 4) and 6) should both be the 
+                            orientation set in step 2).
+*/
+void CTDeviceRotation::TestInvalidAppOrientation()
+	{
+	SimulateThemeServerOrientation(EDisplayOrientationNormal);
+	TestIndicateAppOrientation(EDisplayOrientation90CW);
+	iWs.IndicateAppOrientation(static_cast<TRenderOrientation>(1000));
+	iWaitForPublishOnNextTest = EFalse;
+	IsOrientationCorrect(EDisplayOrientation90CW);
+	}
+
+/**
+ @SYMTestCaseID             GRAPHICS-WSERV-DEVICEROTATION-0010
+ @SYMTestCaseDesc           Test Invalid Theme Server Orientation
+ @SYMPREQ                   ###TrackingDeviceRotation### TODO replace me
+ @SYMTestPriority           1
+ @SYMTestPurpose            To test that an invalid theme server orientation is ignored when
+                            the app orientation has been set to auto.
+ @SYMPrerequisites          An RProperty is set up to subscribe to notifications of 
+                            windowserver orientation changes.
+                            An RProperty is set up to publish Theme server Orientation changes.
+                            We have set up an RWindowGroup in ordinal position 0.
+ @SYMTestActions            1) Set the theme server orientation to EDisplayOrientationNormal.
+                            2) Set the RWindowGroup in ordinal position 0 to 
+                               EDisplayOrientationAuto.
+                            4) Check the published orinetation value in windowserver.
+                            5) Set the theme server orientation to an invalid orientation.
+                            6) Check the published orinetation value in windowserver.
+
+ @SYMTestExpectedResults    Wserv should publish an orientation change for 2) but not for 5).
+                            The orientations checked in steps 4) and 6) should both be the 
+                            theme server orientation set in step 1).
+*/
+void CTDeviceRotation::TestInvalidThemeServerOrientation()
+	{
+	SimulateThemeServerOrientation(EDisplayOrientationNormal);
+	TestIndicateAppOrientation(EDisplayOrientationAuto);
+	SimulateThemeServerOrientation(static_cast<TRenderOrientation>(5000));
+	iWaitForPublishOnNextTest = EFalse;
+	IsOrientationCorrect(EDisplayOrientationNormal);
+	}
+
+__CONSTRUCT_STEP__(DeviceRotation)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/test/tauto/tdevicerotation.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,110 @@
+// Copyright (c) 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:
+// Set of tests for Tracing Device Rotation. These tests generally test
+// the RWsSession::IndicateAppOrientation(...) API.
+//
+
+/**
+ @file
+ @test
+ @internalComponent - Internal Nokia test code
+*/
+
+#ifndef __TDEVICERORATION_H__
+#define __TDEVICERORATION_H__
+
+#include <e32std.h>
+#include <w32std.h>
+#include <e32property.h>
+#include <test/testexecutestepbase.h>
+#include "../tlib/testbase.h"
+#include "AUTO.H"
+#include "TGraphicsHarness.h"
+#include <wspublishandsubscribedata.h>
+
+//
+// CTDeviceRotation Definition
+//
+
+class CTDeviceRotation: public CTGraphicsBase
+	{
+public:
+    CTDeviceRotation(CTestStep* aStep);
+	~CTDeviceRotation();
+	/*Sets the windowing environment,*/
+	void ConstructL();
+
+protected:
+	//from 	CTGraphicsStep - Calls the device rotation test.
+	virtual void RunTestCaseL(TInt aCurTestCase);
+private: 
+	//tool functions
+	void SimulateThemeServerOrientation(TRenderOrientation aExpectedaOrientation);
+	void CheckHalSetting(TRenderOrientation aOrientation);
+	void IsOrientationCorrect(TRenderOrientation aOrientation);
+	void TestIndicateAppOrientation(TRenderOrientation aOrientation);
+	void TestIndicateAppOrientation(TRenderOrientation aOrientation, TRenderOrientation aSecondOrientation);
+	void TestIgnoredAppOrientation(TRenderOrientation aSecondOrientation, TInt aThemeServerOrientation, TInt aExpectedOrientation);
+	void TestAppOrientationOnSwap(TRenderOrientation aOrientation, TRenderOrientation aSecondOrientation);
+	//For TESTL
+	inline void testBooleanTrueL(TBool aCondition, const TText8* aFile, TInt aLine) 
+	    {
+	    iStep->testBooleanTrueL(aCondition, aFile, aLine, ETrue);
+	    }
+private:
+	//Test Cases
+	void TestInitialOrientation();
+	void TestFixedOrientations();
+	void TestAutoOrientation();
+	void TestIgnoreOrientation();
+	void TestFixedOrientationsOnWindowSwap();
+	void TestAutoOrientationOnWindowSwap();
+	void TestIgnoreOrientationOnWindowSwap();
+	void TestIgnoreAutoOrientationOnWindowSwap();
+	void TestInvalidAppOrientation();
+	void TestInvalidThemeServerOrientation();
+	
+private:
+	//members
+	// First Session and Window Group
+	RWsSession iWs;
+	RWindowGroup iWindowGroup;
+    RWindow iChildWindow;
+    // Second Session and Window Group
+	RWsSession iSecondWs;
+	RWindowGroup iSecondWindowGroup;
+	RWindow iSecondChildWindow;
+		
+	RProperty iRenderOrientationProperty;
+	RTimer iPublishTimer;
+	TRequestStatus iPublishTimerStatus;
+	TRequestStatus iRenderOrientationStatus;
+	RProperty iThemeServerOrientationProperty;
+
+	TRenderOrientation iCurrentThemeServerOrientation;
+	TBool iWaitForPublishOnNextTest; //Set to EFalse to skip waiting for publish on next test, default ETrue, Resets to ETrue on each Test.
+	};
+
+class CTDeviceRotationStep : public CTGraphicsStep
+	{
+public:
+	CTDeviceRotationStep();
+protected:
+	//from CTGraphicsStep
+	virtual CTGraphicsBase* CreateTestL();
+	};
+
+_LIT(KTDeviceRotationStep,"TDeviceRotation");
+
+#endif //TDEVICERORATION
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/test/tauto/tevent_captureapp.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,67 @@
+// Copyright (c) 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:
+// Helper application for TEvent test case GRAPHICS-WSERV-0757
+//
+
+#include <e32base.h>
+#include <e32debug.h>
+#include <w32std.h>
+
+const TInt KCapturePriority = 2;
+
+LOCAL_C void MainL()
+	{
+	RWsSession session;
+	User::LeaveIfError(session.Connect());
+	CleanupClosePushL(session);
+	RWindowGroup group(session);
+	User::LeaveIfError(group.Construct(0));
+
+	// Capture keys EKeyF22 and EKeyF23 with raised
+	// priority for each of the three capture types.
+	TInt handle1 = User::LeaveIfError(group.CaptureKey(EKeyF22, 0, 0, KCapturePriority));
+	TInt handle2 = User::LeaveIfError(group.CaptureKeyUpAndDowns(EStdKeyF22, 0, 0, KCapturePriority));
+	TInt handle3 = User::LeaveIfError(group.CaptureLongKey(EKeyF22, EKeyF22, 0, 0, KCapturePriority, ELongCaptureNormal));
+	TInt handle4 = User::LeaveIfError(group.CaptureKey(EKeyF23, 0, 0, KCapturePriority));
+	TInt handle5 = User::LeaveIfError(group.CaptureKeyUpAndDowns(EStdKeyF23, 0, 0, KCapturePriority));
+	TInt handle6 = User::LeaveIfError(group.CaptureLongKey(EKeyF23, EKeyF23, 0, 0, KCapturePriority, ELongCaptureNormal));
+
+	// Complete rendezvous with TEvent. This signals that all the capture
+	// requests have been made.
+	RProcess::Rendezvous(KErrNone);
+
+	// Wait until killed by TEvent
+	User::WaitForAnyRequest();
+
+	group.CancelCaptureKey(handle1);
+	group.CancelCaptureKeyUpAndDowns(handle2);
+	group.CancelCaptureLongKey(handle3);
+	group.CancelCaptureKey(handle4);
+	group.CancelCaptureKeyUpAndDowns(handle5);
+	group.CancelCaptureLongKey(handle6);
+
+	CleanupStack::PopAndDestroy(&session);
+	}
+
+GLDEF_C TInt E32Main()
+	{	
+	__UHEAP_MARK;
+
+	CTrapCleanup* cleanupStack = CTrapCleanup::New(); 	
+	TRAPD(ret, MainL());	
+	delete cleanupStack;
+	
+	__UHEAP_MARKEND;
+	return ret;
+	}
--- a/windowing/windowserver/test/tauto/tgc.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/tauto/tgc.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -1290,7 +1290,11 @@
 	 * that we use matching color depths for our off-screen bitmaps so that accuracy is
 	 * not lost since we compare bitmaps from the screen versus off-screen.
 	 */
-	const TDisplayMode displayMode = device->DisplayMode();
+	TDisplayMode displayMode = device->DisplayMode();
+	if (TDisplayModeUtils::NumDisplayModeBitsPerPixel(displayMode) == 32)
+	    {
+	    displayMode = EColor16MAP;
+	    }
 		
 	_LIT(KText,"RemoteGc & MWsGraphicsContext");
 	TFontSpec fSpec(KTestFontTypefaceName,23);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/test/tauto/themeserverpropertydefine.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,88 @@
+// Copyright (c) 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:
+// This Process called with the argument KThemeServerPropertyDefineCmdDefine, defines
+// the theme server RProperty catagory to be the same as the theme servers process ID. 
+// Called with the argument KThemeServerPropertyDefineCmdDelete, it will delete the 
+// theme server RProperty. This is because an RProperty can only be defined and deleted 
+// from within a process with the same UID3 as the RProperty catogory you are trying to 
+// define/delete.
+//
+
+/**
+ @file
+ @test
+ @internalComponent - Internal Nokia test code
+ */
+
+#include <BACLINE.H> 
+#include <e32base.h>
+#include <e32property.h>
+#include "..\..\nga\server\renderorientationtracker.h" //for KThemeOrientationCatagory and KThemeOrientationKey
+#include "themeserverpropertydefine.h"
+
+void DefineThemeServerPropertyL()
+    {
+    RProperty themeServerOrientationProperty;
+    const TSecurityPolicy KThemeOrientationReadSecurityPolicy(
+            TSecurityPolicy::EAlwaysPass);
+    const TSecurityPolicy KThemeOrientationWriteSecurityPolicy(
+            TSecurityPolicy::EAlwaysPass);
+    User::LeaveIfError(RProperty::Define(   KThemeOrientationCategory,
+                                            KThemeOrientationKey, 
+                                            RProperty::EInt,
+                                            KThemeOrientationReadSecurityPolicy,
+                                            KThemeOrientationWriteSecurityPolicy));
+    themeServerOrientationProperty.Close();
+    }
+
+void DeleteThemeServerPropertyL()
+    {
+    TInt err = KErrNone;
+    RProperty themeServerOrientationProperty;
+    User::LeaveIfError(themeServerOrientationProperty.Delete(
+            KThemeOrientationCategory, KThemeOrientationKey));
+    themeServerOrientationProperty.Close();
+    }
+
+void MainL()
+    {
+    CCommandLineArguments* args = CCommandLineArguments::NewLC();
+    TPtrC argumentPrt(args->Arg(1));
+    if (argumentPrt == KThemeServerPropertyDefineCmdDefine)
+        {
+        DefineThemeServerPropertyL();
+        }
+    else if (argumentPrt == KThemeServerPropertyDefineCmdDelete)
+        {
+        DeleteThemeServerPropertyL();
+        }
+    else
+        {
+        User::Leave(KErrNotSupported);
+        }
+    CleanupStack::PopAndDestroy(args);
+    }
+
+GLDEF_C TInt E32Main()
+    {
+    CTrapCleanup* cleanUpStack = CTrapCleanup::New();
+    if (cleanUpStack == NULL)
+        {
+        return KErrNoMemory;
+        }
+    TRAPD(err, MainL());
+    delete cleanUpStack;
+    return (err);
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/test/tauto/themeserverpropertydefine.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,29 @@
+// Copyright (c) 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:
+// Header Defines the EXE name as well as the two possible command line 
+// arguments for twsthemeserverdefine.exe
+
+/**
+ @file
+ @test
+ @internalComponent - Internal Nokia test code
+ */
+#ifndef THEMESERVERSIMULATION_H_
+#define THEMESERVERSIMULATION_H_
+
+_LIT(KThemeServerPropertyDefine, "twsthemeserverpropertydefine.exe");
+_LIT(KThemeServerPropertyDefineCmdDefine, "define");
+_LIT(KThemeServerPropertyDefineCmdDelete, "delete");
+
+#endif /* THEMESERVERSIMULATION_H_ */
--- a/windowing/windowserver/test/tdynamicres/group/bld.inf	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/tdynamicres/group/bld.inf	Tue Jul 20 13:27:44 2010 +0300
@@ -33,6 +33,7 @@
 ../scripts/wsdynamicresbasic_isotropic_scaling.script	z:/wstest/dynamicres/wsdynamicresbasic_isotropic_scaling.script
 ../scripts/wsdynamicresbasic_anisotropic_scaling.script	z:/wstest/dynamicres/wsdynamicresbasic_anisotropic_scaling.script
 ../scripts/wsdynamicresbasic_openvg_isotropic.script	z:/wstest/dynamicres/wsdynamicresbasic_openvg_isotropic.script
+../scripts/wsdynamicresbasic_sirocco.script	z:/wstest/dynamicres/wsdynamicresbasic_sirocco.script
 #endif // SYMBIAN_BUILD_GCE
 wstestdynamicres.iby	/epoc32/rom/include/wstestdynamicres.iby
 ../scripts/wsdynamicresclassic.script	z:/wstest/dynamicres/wsdynamicresclassic.script
--- a/windowing/windowserver/test/tdynamicres/group/wstestdynamicres.iby	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/tdynamicres/group/wstestdynamicres.iby	Tue Jul 20 13:27:44 2010 +0300
@@ -39,6 +39,7 @@
 data=DATAZ_\wstest\dynamicres\wsdynamicresbasic_isotropic_scaling.script	wstest\dynamicres\wsdynamicresbasic_isotropic_scaling.script
 data=DATAZ_\wstest\dynamicres\wsdynamicresbasic_no_scaling.script	wstest\dynamicres\wsdynamicresbasic_no_scaling.script
 data=DATAZ_\wstest\dynamicres\wsdynamicresbasic_openvg_isotropic.script	wstest\dynamicres\wsdynamicresbasic_openvg_isotropic.script
+data=DATAZ_\wstest\dynamicres\wsdynamicresbasic_sirocco.script	wstest\dynamicres\wsdynamicresbasic_sirocco.script
 #endif
 
 #endif
--- a/windowing/windowserver/test/tdynamicres/group/wstestdynamicres_helium.pkg	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/tdynamicres/group/wstestdynamicres_helium.pkg	Tue Jul 20 13:27:44 2010 +0300
@@ -36,11 +36,5 @@
 ;REM Window Server Dynamic Resolution Test Scripts [no plugins]
 
 ;//Please execute only the tests appropriate to your hardware capabilities.
-"\epoc32\data\z\wstest\dynamicres\wsdynamicresclassic.script"-"c:\wstest\dynamicres\wsdynamicresclassic.script"
+"\epoc32\data\z\wstest\dynamicres\wsdynamicresbasic_sirocco.script"-"c:\wstest\dynamicres\wsdynamicresbasic_sirocco.script"
 
-"\epoc32\data\z\wstest\dynamicres\wsdynamicresbasic_anisotropic_scaling.script"-"c:\wstest\dynamicres\wsdynamicresbasic_anisotropic_scaling.script"
-"\epoc32\data\z\wstest\dynamicres\wsdynamicresbasic_integer_scaling.script"-"c:\wstest\dynamicres\wsdynamicresbasic_integer_scaling.script"
-"\epoc32\data\z\wstest\dynamicres\wsdynamicresbasic_isotropic_scaling.script"-"c:\wstest\dynamicres\wsdynamicresbasic_isotropic_scaling.script"
-"\epoc32\data\z\wstest\dynamicres\wsdynamicresbasic_no_scaling.script"-"c:\wstest\dynamicres\wsdynamicresbasic_no_scaling.script"
-"\epoc32\data\z\wstest\dynamicres\wsdynamicresbasic_openvg_isotropic.script"-"c:\wstest\dynamicres\wsdynamicresbasic_openvg_isotropic.script"
-
--- a/windowing/windowserver/test/tdynamicres/inc/wsdynamicresbase.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/tdynamicres/inc/wsdynamicresbase.h	Tue Jul 20 13:27:44 2010 +0300
@@ -81,12 +81,7 @@
 	void CommonOverlayWindowSetupL(RWindow& aWindow, const TRgb& aColor);
 	void ResizeTestCommonSetupL(RWindow& aWindow, const TRgb& aColor);
 
-	void MakeTestWindowPairL(TRect aOuterRect,TRgb aOuterColor,TRect aInnerRect,TRgb aInnerColor);
 	void LargerTestWindow(TInt aPercentOfBack=80);
-	void DestroyTestWindowPair(TBool aKillTestBack=ETrue,TBool aKillTestFront=ETrue,TBool aKillTestChildren=ETrue);
-	void MakeTestWindowTripleL(TRect aOuterRect,TRgb aOuterColor,TRect aInnerRect,TRgb aInnerColor,TRect aChildRect,TRgb aChildColor,TRect aSecondChildRect,TRgb aSecondChildColor);
-	void CreateTestWindowQuadL(TRect aOuterRect,TRgb aOuterColor,TRect aInnerRect,TRgb aInnerColor,TRect aChildRect,TRgb aChildColor,TRect aSecondChildRect,TRgb aSecondChildColor);
-	void MakeTestWindowTripleL(TRect aOuterRect,TRgb aOuterColor,TRect aInnerRect,TRgb aInnerColor,TRect aChildRect,TRgb aChildColor);
 	void MakeExtraChildWindowL(const RWindowBase& aFromParent,TRect aChildRect,TRgb aChildColor);
 	struct LoopingGcPtr;
 	LoopingGcPtr	LoopBeginActivateWithWipe(const TRegion& aRegion,RWindow& aWin,TRgb aColor);
@@ -121,7 +116,7 @@
 		void				CreateSharedUtilityL()const ;
 		};
 	static const TPostTestCleanup& PostTestCleanupInstance();
-	RWindow	iTestBack;
+	RBlankWindow	iTestBack;
 	RWindow	iTestFront;
 	RWindow	iTestChild;
 	RWindow	iTestSecondChild;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/test/tdynamicres/scripts/wsdynamicresbasic_sirocco.script	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,59 @@
+//
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description: 
+//
+
+LOAD_SUITE wsdynamicrestestserver 
+
+RUN_TEST_STEP 100 wsdynamicrestestserver TEFUnit.CGlobalSettings.SetScreenNoL.0
+
+RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0001L
+RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0002L
+RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0003L
+RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0004L
+// skipped for Sirocco builds
+// RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0005L
+RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0006L
+RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0007L
+RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0008L
+RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0009L
+//0010 skipped
+RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0011L
+RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0012L
+// skipped for Sirocco builds
+// RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0013L
+//0014 skipped
+RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0015L
+//0016 0017 skipped
+RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0018L
+
+//0021 skipped
+
+RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0031L
+RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0032L
+RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0033L
+//0034 skipped
+
+//RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0041L.0
+RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0042L.0
+//RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0041L.1
+RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0042L.1
+
+// skipped for Sirocco builds
+// RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0051L
+//0052 0053 skipped
+
+RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0101L
+RUN_TEST_STEP 200 wsdynamicrestestserver TEFUnit.CWsDynamicResBasic.GRAPHICS_WSERV_DYNAMICRES_0102L
+
--- a/windowing/windowserver/test/tdynamicres/src/t_wsdynamicreswinbase.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/tdynamicres/src/t_wsdynamicreswinbase.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -526,7 +526,9 @@
 		for (TInt index=0;index<KMaxInfoLines;index++)
 			{
 			if (iTestInfo[index].Length())
+			    {
 				iInfoGc->DrawText(iTestInfo[index],textRect,textRect.Size().iHeight*3/4,iInfoGc->ECenter);
+			    }
 			textRect.Move(0,rowHeight);
 			}
 		iInfoGc->DiscardFont();
--- a/windowing/windowserver/test/tdynamicres/src/wsdynamicresbase.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/tdynamicres/src/wsdynamicresbase.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -144,70 +144,6 @@
 	User::After(TTimeIntervalMicroSeconds32(aMilliseconds * 1000));
 	}
 
-/**	Creates the normal scenario used by these tests.
- *  With a large window behind and small window in front.
- *  If the windows already exist then they are just repositioned and redrawn.
- * 	@param	aOuterRect	Position of back window
- * 	@param	aOuterColor	Background colour for back window
- * 	@param	aInnerRect	Position of front window
- * 	@param	aInnerColor	Background colour for front window
- * 
- **/
-void CWsDynamicResBase::MakeTestWindowPairL(TRect aOuterRect,TRgb aOuterColor,TRect aInnerRect,TRgb aInnerColor)
-	{
-	if (!iTestBack.WsHandle())
-		{
-		iTestBack=RWindow(iSession);
-		ASSERT_EQUALS_X(iTestBack.Construct(iGroup, ++iWindowHandle), KErrNone);
-#ifdef  FLICKER
-		iTestBack.Activate();
-#endif
-		iTestBack.SetRequiredDisplayMode(iDisplayMode);
-		iTestBack.SetBackgroundColor(aOuterColor);
-		iTestBack.SetExtent(aOuterRect.iTl,aOuterRect.Size());
-#ifndef FLICKER
-		iTestBack.Activate();
-#endif
-		}
-	else
-		{
-		iTestBack.SetRequiredDisplayMode(iDisplayMode);
-		iTestBack.SetBackgroundColor(aOuterColor);
-		iTestBack.SetExtent(aOuterRect.iTl,aOuterRect.Size());
-		}
-	iTestBack.BeginRedraw();
-	ActivateWithWipe(iGc,iTestBack,aOuterColor);
-	iGc->Deactivate();
-	iTestBack.EndRedraw();
-	iTestBack.SetVisible(ETrue);
-	
-	if (!iTestFront.WsHandle())
-		{
-		iTestFront=RWindow(iSession);
-		ASSERT_EQUALS_X(iTestFront.Construct(iGroup, ++iWindowHandle), KErrNone);
-#ifdef FLICKER
-		iTestFront.Activate();
-#endif
-		iTestFront.SetRequiredDisplayMode(iDisplayMode);
-		iTestFront.SetBackgroundColor(aInnerColor);	
-		iTestFront.SetExtent(aInnerRect.iTl,aInnerRect.Size());
-
-#ifndef FLICKER
-		iTestFront.Activate();
-#endif
-		}
-	else
-		{
-		iTestFront.SetRequiredDisplayMode(iDisplayMode);
-		iTestFront.SetBackgroundColor(aInnerColor);
-		iTestFront.SetExtent(aInnerRect.iTl,aInnerRect.Size());
-		}
-	
-	DrawPlainUI(iTestFront,EFalse,aInnerColor);
-	iTestFront.SetVisible(ETrue);
-	
-	}
-
 void CWsDynamicResBase::LargerTestWindow(TInt aPercentOfBack)
 	{
 	TRect newPos=iTestPos;
@@ -221,72 +157,6 @@
 	
 	}
 
-/** Destroys some or all of the test windows so the test can loop (or test the state after destruction.
- *  The windows are destroyed when the test exits normally.
- * 	Child windows are automatically killed when parent window is killed!
- * 
- **/
-void CWsDynamicResBase::DestroyTestWindowPair(TBool aKillTestBack,TBool aKillTestFront,TBool aKillTestChildren)
-	{
-	if (aKillTestBack && iTestBack.WsHandle())
-		{
-		iTestBack.Close();
-		}
-	if (aKillTestFront && iTestFront.WsHandle())
-		{
-		iTestFront.Close();
-		}
-	if (aKillTestChildren)
-		{
-		if (iTestChild.WsHandle())
-			{
-			iTestChild.Close();
-			}
-		if (iTestSecondChild.WsHandle())
-			{
-			iTestSecondChild.Close();
-			}
-		}
-	}
-/**	Creates a child window inside the front window of the usual test scenario
-*  With a large window behind and small window in front.
- *  If the windows already exist then they are just repositioned and redrawn.
- * 	@param	aOuterRect	Position of back window
- * 	@param	aOuterColor	Background colour for back window
- * 	@param	aInnerRect	Position of front window
- * 	@param	aInnerColor	Background colour for front window
- * 	@param	aChildRect	Position of child window
- * 	@param	aChildColor	Background colour for child window
- * 	@param	aSecondChildRect	Position of Second child window
- * 	@param	aSecondChildColor	Background colour for Second child window
- * 
- **/
-void CWsDynamicResBase::MakeTestWindowTripleL(TRect aOuterRect,TRgb aOuterColor,TRect aInnerRect,TRgb aInnerColor,TRect aChildRect,TRgb aChildColor,TRect aSecondChildRect,TRgb aSecondChildColor)
-	{
-	MakeTestWindowTripleL(aOuterRect,aOuterColor,aInnerRect,aInnerColor,aChildRect,aChildColor);
-
-	MakeExtraChildWindowL(iTestChild,aSecondChildRect,aSecondChildColor);
-	}
-
-/**	Creates a child window inside the front window of the usual test scenario
-*  With a large window behind and small window in front.
- *  If the windows already exist then they are just repositioned and redrawn.
- * 	@param	aOuterRect	Position of back window
- * 	@param	aOuterColor	Background colour for back window
- * 	@param	aInnerRect	Position of front window
- * 	@param	aInnerColor	Background colour for front window
- * 	@param	aChildRect	Position of child window
- * 	@param	aChildColor	Background colour for child window
- *  @param	aSecondChildRect	Position of second child window
- * 	@param	aSecondChildColor	Background colour for second child window
- * 
- **/
-void CWsDynamicResBase::CreateTestWindowQuadL(TRect aOuterRect,TRgb aOuterColor,TRect aInnerRect,TRgb aInnerColor,TRect aChildRect,TRgb aChildColor,TRect aSecondChildRect,TRgb aSecondChildColor)
-	{
-	MakeTestWindowTripleL(aOuterRect,aOuterColor,aInnerRect,aInnerColor,aChildRect,aChildColor);
-	
-	MakeExtraChildWindowL(iTestFront,aSecondChildRect,aSecondChildColor);
-	}
 
 void CWsDynamicResBase::MakeExtraChildWindowL(const RWindowBase& aFromParent,TRect aChildRect,TRgb aChildColor)
 	{
@@ -347,39 +217,6 @@
 	return CWsDynamicResWinBase::BeginActivateWithWipe(aRegion,aWin,aColor);
 	}
 
-/**	Creates a child window inside the front window of the usual test scenario
-*  With a large window behind and small window in front.
- *  If the windows already exist then they are just repositioned and redrawn.
- * 	@param	aOuterRect	Position of back window
- * 	@param	aOuterColor	Background colour for back window
- * 	@param	aInnerRect	Position of front window
- * 	@param	aInnerColor	Background colour for front window
- * 	@param	aChildRect	Position of child window
- * 	@param	aChildColor	Background colour for child window
- * 
- **/
-void CWsDynamicResBase::MakeTestWindowTripleL(TRect aOuterRect,TRgb aOuterColor,TRect aInnerRect,TRgb aInnerColor,TRect aChildRect,TRgb aChildColor)
-	{
-	MakeTestWindowPairL(aOuterRect,aOuterColor,aInnerRect,aInnerColor);
-	ASSERT(iTestFront.WsHandle());
-	
-	if (!iTestChild.WsHandle())
-		{
-		iTestChild=RWindow(iSession);
-		ASSERT_EQUALS_X(iTestChild.Construct(iTestFront, ++iWindowHandle), KErrNone);
-		iTestChild.SetRequiredDisplayMode(iDisplayMode);
-		}
-	iTestChild.SetBackgroundColor(aChildColor);
-	iTestChild.SetExtent(aChildRect.iTl,aChildRect.Size());
-	iTestChild.Activate();
-	iTestChild.BeginRedraw();
-	iGc->Activate(iCompare);
-	iGc->SetBrushColor(iBlue);
-	iGc->Clear();
-	iGc->Deactivate();
-	iTestChild.EndRedraw();
-	iTestChild.SetVisible(ETrue);
-	}
 /**	
  * 	Generates a valid surfaceID for the current display mode.
  * 	This is then used in negative testing.
--- a/windowing/windowserver/test/tdynamicres/src/wsdynamicresbasic.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/tdynamicres/src/wsdynamicresbasic.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -509,6 +509,7 @@
 	For each, check if event has been received
 @SYMTestExpectedResults	
 	Based on type of change, check event
+	@note Test uses HAL to simulate display disconnection. Not supported on production platforms.
 */
 void	CWsDynamicResBasic::GRAPHICS_WSERV_DYNAMICRES_0005L()
 	{
@@ -683,16 +684,12 @@
 	TInt error;
 	MakeTitleAndCompareWindowsL(_L("GFX_WSERV_DYNAMICRES_0006L"),_L("Change Resolution"));
 
-	iTestBack=RWindow(iSession);
+	iTestBack=RBlankWindow(iSession);
 	ASSERT_EQUALS(iTestBack.Construct(iGroup, ++iWindowHandle), KErrNone);
 	iTestBack.SetRequiredDisplayMode(iDisplayMode);
-	iTestBack.SetBackgroundColor(TRgb(255,0,0));
+	iTestBack.SetColor(TRgb(255,0,0));
 	iTestBack.SetExtent(iTestPos.iTl,iTestPos.Size());
 	iTestBack.Activate();
-	iTestBack.BeginRedraw();
-	ActivateWithWipe(iGc,iTestBack,TRgb(255,0,0));
-	iGc->Deactivate();
-	iTestBack.EndRedraw();
 	iTestBack.SetVisible(ETrue);
 	
 	struct DrawCompare
@@ -902,17 +899,14 @@
 	TInt error;
 	MakeTitleAndCompareWindowsL(_L("GFX_WSERV_DYNAMICRES_0008L"),_L("Change Size Mode"));
 
-	iTestBack=RWindow(iSession);
-	ASSERT_EQUALS(iTestBack.Construct(iGroup, ++iWindowHandle), KErrNone);
-	iTestBack.SetRequiredDisplayMode(iDisplayMode);
-	iTestBack.SetBackgroundColor(TRgb(255,0,0));
-	iTestBack.SetExtent(iTestPos.iTl,iTestPos.Size());
-	iTestBack.Activate();
-	iTestBack.BeginRedraw();
-	ActivateWithWipe(iGc,iTestBack,TRgb(255,0,0));
-	iGc->Deactivate();
-	iTestBack.EndRedraw();
-	iTestBack.SetVisible(ETrue);
+    iTestBack=RBlankWindow(iSession);
+    ASSERT_EQUALS(iTestBack.Construct(iGroup, ++iWindowHandle), KErrNone);
+    iTestBack.SetRequiredDisplayMode(iDisplayMode);
+    iTestBack.SetColor(TRgb(255,0,0));
+    iTestBack.SetExtent(iTestPos.iTl,iTestPos.Size());
+    iTestBack.Activate();
+    iTestBack.SetVisible(ETrue);
+    iSession.Finish(ETrue);
 	
 	
 	if (CWindowGc*	gc=BeginActivateWithWipe(ETrue,iCompare,TRgb(128,128,128)))
@@ -1084,17 +1078,13 @@
 	MakeTitleAndCompareWindowsL(_L("GFX_WSERV_DYNAMICRES_0009L"),_L("Change Size Mode"));
 	iSession.Finish(ETrue);
 
-	iTestBack=RWindow(iSession);
-	ASSERT_EQUALS(iTestBack.Construct(iGroup, ++iWindowHandle), KErrNone);
-	iTestBack.SetRequiredDisplayMode(iDisplayMode);
-	iTestBack.SetBackgroundColor(TRgb(255,0,0));
-	iTestBack.SetExtent(iTestPos.iTl,iTestPos.Size());
-	iTestBack.Activate();
-	iTestBack.BeginRedraw();
-	ActivateWithWipe(iGc,iTestBack,TRgb(255,0,0));
-	iGc->Deactivate();
-	iTestBack.EndRedraw();
-	iTestBack.SetVisible(ETrue);
+    iTestBack=RBlankWindow(iSession);
+    ASSERT_EQUALS(iTestBack.Construct(iGroup, ++iWindowHandle), KErrNone);
+    iTestBack.SetRequiredDisplayMode(iDisplayMode);
+    iTestBack.SetColor(TRgb(255,0,0));
+    iTestBack.SetExtent(iTestPos.iTl,iTestPos.Size());
+    iTestBack.Activate();
+    iTestBack.SetVisible(ETrue);
 	iSession.Finish(ETrue);
 	
 	struct DrawCompare
@@ -1503,8 +1493,7 @@
 
 void CDSATestDrawing::Draw()
 	{
-	iWin->Invalidate();
-	iWin->BeginRedraw();
+	//Should not invalidate the window containing DSA drawing. That's the whole point!
 	CFbsBitGc* gc = iDSA->Gc();
 	gc->SetPenStyle(gc->ESolidPen);
 	gc->SetPenColor(TRgb(255,0,0));
@@ -1512,7 +1501,6 @@
 	iRect.Shrink(1, 1);
 	gc->DrawRect(iRect);
 	iDSA->ScreenDevice()->Update();
-	iWin->EndRedraw();
 	
 	}
 void CDSATestDrawing::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/) 
@@ -1637,8 +1625,6 @@
 			continue;
 			}
 		
-		//if my rectangle's iTl is (0,0) and iBr is (100,100). Why does it gives me the rect width and height
-		//both 100? 0 - 100 is 101 pixels drawn. Or does this indicates iBr is exclusive and iTl is inclusive?
 		//Ruo: Oh I almost believe iBr is exclusive now
 		TDisplayConfiguration dispConfigAfter2;
 		interface->GetConfiguration(dispConfigAfter2);
@@ -2722,12 +2708,16 @@
 		TInt completeCount = 0;
 		while (notComplete)
 			{
+            RDebug::Printf("iInfoScreenDevice->SetAppScreenMode");
 			iInfoScreenDevice->SetAppScreenMode(screenModeList[index]);
 			iSession.Finish(ETrue);
 			iSession.HeapSetFail(RHeap::EDeterministic,heapFail);
+            RDebug::Printf("iInfoScreenDevice->SetAppScreenMode");
 			iInfoScreenDevice->SetScreenMode(screenModeList[index]);
+            RDebug::Printf("SetScreenMode done");
 			iSession.HeapSetFail(RHeap::ENone,0);
 			iSession.Finish(ETrue);
+            RDebug::Printf("Finish done");
 			Pause(50);
 			TInt newMode = iInfoScreenDevice->CurrentScreenMode();
 
@@ -2736,7 +2726,7 @@
 				completeCount++;
 				if (completeCount == 5)
 					{
-					INFO_PRINTF2(_L("Succeeded with heapFail = %d"),heapFail);
+					INFO_PRINTF3(_L("Mode %i Succeeded with heapFail = %d"),index, heapFail);
 					notComplete = EFalse;
 					}
 				iInfoScreenDevice->SetAppScreenMode(screenModeList[0]);
@@ -3740,6 +3730,8 @@
 
 	if (aBitmapRegionPairArray.Count()>0)
 		{
+        RDebug::Printf("Checking");
+        TInt countchecks=0;
 		for (TInt i=0; i<width; i++)
 			{
 			for (TInt j=0; j<height; j++)
@@ -3822,6 +3814,7 @@
 				}
 			}
 		}
+	
 	ignoreDueToResizing.Close();
 	if (errorPixels+diffPixels < 2)
 		{
--- a/windowing/windowserver/test/tframerate/framerate.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/tframerate/framerate.h	Tue Jul 20 13:27:44 2010 +0300
@@ -23,8 +23,8 @@
 #define __GRAPHICDRAWERTESTFRAMERATE_H__
 
 #include <e32std.h>
-#include "Graphics/WSGRAPHICDRAWER.H"
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include "graphics/WSGRAPHICDRAWER.H"
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
 
 //Maximum number of animations at a time.
 #define KMaxAnim 100
--- a/windowing/windowserver/test/tlisten/listener.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/tlisten/listener.h	Tue Jul 20 13:27:44 2010 +0300
@@ -23,8 +23,8 @@
 #define __LISTENER_H__
 
 #include <bitstd.h>
-#include "Graphics/WSGRAPHICDRAWER.H"
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include "graphics/WSGRAPHICDRAWER.H"
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
 
 class CFbsBitmap;
 class CFbsBitmapDevice;
--- a/windowing/windowserver/test/tredir/redirector.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/test/tredir/redirector.h	Tue Jul 20 13:27:44 2010 +0300
@@ -22,8 +22,8 @@
 #ifndef __REDIRECTOR_H__
 #define __REDIRECTOR_H__
 
-#include "Graphics/WSGRAPHICDRAWER.H"
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include "graphics/WSGRAPHICDRAWER.H"
+#include <graphics/WSGRAPHICDRAWERINTERFACE.H>
 
 class CFbsBitmap;
 class CFbsBitmapDevice;
--- a/windowing/windowserver/wins_switching/ws32_stubs.h	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserver/wins_switching/ws32_stubs.h	Tue Jul 20 13:27:44 2010 +0300
@@ -5292,6 +5292,15 @@
 	_asm jmp common_dispatch
 	}
 
+__declspec(dllexport)
+__declspec(naked)
+void call_vector_587 ()
+	{
+	// ; void RWsSession::IndicateAppOrientation(enum TRenderOrientation)
+	_asm mov eax, 587
+	_asm jmp common_dispatch
+	}
+
 }
-#define MAX_ORDINAL 587
-
+#define MAX_ORDINAL 588
+
--- a/windowing/windowserverplugins/group/bld.inf	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserverplugins/group/bld.inf	Tue Jul 20 13:27:44 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// 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"
@@ -30,6 +30,8 @@
 
 PRJ_MMPFILES
 
+#include "../keyeventrouting/group/bld.inf"
+
 #ifndef SYMBIAN_GRAPHICS_BUILD_OPENWF_WSERV
 #include "../restricted/group/BLD.INF"
 #else
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserverplugins/keyeventrouting/bwins/keyrouteru.def	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewL@CKeyEventRouter@@SAPAV1@XZ @ 1 NONAME ; class CKeyEventRouter * CKeyEventRouter::NewL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserverplugins/keyeventrouting/eabi/keyrouteru.def	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	_ZN15CKeyEventRouter4NewLEv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserverplugins/keyeventrouting/group/bld.inf	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,29 @@
+// Copyright (c) 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:
+// Key Event Routing plug-in for Window Server
+//
+
+PRJ_EXPORTS
+../bwins/keyrouteru.def	SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/def/bwins/keyrouteru.def)
+../eabi/keyrouteru.def	SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/def/eabi/keyrouteru.def)
+keyeventrouting.iby		/epoc32/rom/include/keyeventrouting.iby
+
+PRJ_TESTEXPORTS
+keyeventrouting_test.iby		/epoc32/rom/include/keyeventrouting_test.iby
+
+PRJ_MMPFILES
+keyeventrouting.mmp
+
+PRJ_TESTMMPFILES
+keyeventrouting_test.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserverplugins/keyeventrouting/group/keyeventrouting.iby	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,22 @@
+// Copyright (c) 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: 
+// Key Event Routing plug-in for Window Server
+//
+
+#ifndef __KEYEVENTROUTING_IBY__
+#define __KEYEVENTROUTING_IBY__
+
+file=ABI_DIR\BUILD_DIR\keyrouter.dll		System\Libs\keyrouter.dll
+
+#endif // __KEYEVENTROUTING_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserverplugins/keyeventrouting/group/keyeventrouting.mmp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,28 @@
+// Copyright (c) 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:
+// Key Event Routing plug-in for Window Server
+//
+
+TARGET		keyrouter.dll
+TARGETTYPE	dll
+CAPABILITY  PowerMgmt ReadDeviceData WriteDeviceData ProtServ
+UID			0x102872e1 0x102872e2
+VENDORID	0x70000001
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SOURCEPATH	../src
+SOURCE		keyrouter.cpp
+
+LIBRARY		euser.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserverplugins/keyeventrouting/group/keyeventrouting_test.iby	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,22 @@
+// Copyright (c) 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: 
+// Key Event Routing plug-in for Window Server: test version
+//
+
+#ifndef __KEYEVENTROUTING_TEST_IBY__
+#define __KEYEVENTROUTING_TEST_IBY__
+
+file=ABI_DIR\BUILD_DIR\keyrouter_test.dll		System\Libs\keyrouter_test.dll
+
+#endif // __KEYEVENTROUTING_TEST_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserverplugins/keyeventrouting/group/keyeventrouting_test.mmp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,32 @@
+// Copyright (c) 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:
+// Key Event Routing plug-in for Window Server: test version
+//
+
+TARGET		keyrouter_test.dll
+TARGETTYPE	dll
+CAPABILITY  PowerMgmt ReadDeviceData WriteDeviceData ProtServ
+UID			0x102872e1 0x102872e6
+VENDORID	0x70000001
+
+MACRO		KEYROUTER_TEST
+
+DEFFILE		keyrouter.def
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+SOURCEPATH	../src
+SOURCE		keyrouter.cpp
+
+LIBRARY		euser.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserverplugins/keyeventrouting/src/keyaliases.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,110 @@
+// Copyright (c) 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:
+// Key code and scan code aliases for platform specific keys.
+// The definitions are as per S60 <mw/eikon.hrh> with the addition of the
+// full set of scan codes.
+
+/**
+@file
+@internalTechnology
+@prototype
+*/
+
+#include <e32keys.h>
+
+/**
+TStdScanCode aliases
+*/
+#define EStdKeyPhoneSend		EStdKeyYes
+#define EStdKeyPhoneEnd			EStdKeyNo
+#define EStdKeyCBA1				EStdKeyDevice0
+#define EStdKeyCBA2				EStdKeyDevice1
+#define EStdKeyPowerOff			EStdKeyDevice2
+#define EStdKeyOK				EStdKeyDevice3
+#define EStdKeyGripOpen			EStdKeyDevice4
+#define EStdKeyGripClose		EStdKeyDevice5
+#define EStdKeySide				EStdKeyDevice6	// Voice key
+#define EStdKeyCamera			EStdKeyDevice7
+#define EStdKeyTwistOpen		EStdKeyDevice8
+#define EStdKeyTwistClose		EStdKeyDevice9
+#define EStdKeyFlipOpen			EStdKeyDeviceA
+#define EStdKeyFlipClose		EStdKeyDeviceB
+#define EStdKeyLock				EStdKeyDeviceF
+#define EStdKeyLeftUpArrow		EStdKeyDevice10	// Diagonal arrow event
+#define EStdKeyRightUpArrow		EStdKeyDevice11	// Diagonal arrow event
+#define EStdKeyRightDownArrow	EStdKeyDevice12	// Diagonal arrow event
+#define EStdKeyLeftDownArrow	EStdKeyDevice13	// Diagonal arrow event
+#define EStdKeyVolumeUp			EStdKeyIncVolume
+#define EStdKeyVolumeDown		EStdKeyDecVolume
+#define EStdKeyApplication		EStdKeyApplication0
+#define EStdKeyPoC				EStdKeyApplication1
+#define EStdKeyPlay				EStdKeyApplication2
+#define EStdKeyStop				EStdKeyApplication3
+#define EStdKeyForward			EStdKeyApplication4
+#define EStdKeyRewind			EStdKeyApplication5
+#define EStdKeyOperator			EStdKeyApplication6
+#define EStdKeyQwertyOn			EStdKeyApplication7
+#define EStdKeyQwertyOff		EStdKeyApplication8
+#define EStdKeyNext				EStdKeyApplication9
+#define EStdKeyPrevious			EStdKeyApplicationA
+#define EStdKeyHoldSwitch		EStdKeyApplicationB
+#define EStdKeyZoomIn			EStdKeyApplicationC
+#define EStdKeyZoomOut			EStdKeyApplicationD
+#define EStdKey4x10QwertyOn		EStdKeyApplicationE
+#define EStdKey3x11QwertyOn		EStdKeyApplication10
+#define EStdKeyHalfQwertyOn		EStdKeyApplication11
+#define EStdKeyCustomKeyboardOn	EStdKeyApplication12
+
+/**
+TKeyCode aliases
+*/
+#define EKeyPhoneSend			EKeyYes
+#define EKeyPhoneEnd			EKeyNo
+#define EKeyCBA1				EKeyDevice0
+#define EKeyCBA2				EKeyDevice1
+#define EKeyPowerOff			EKeyDevice2
+#define EKeyOK					EKeyDevice3
+#define EKeyGripOpen			EKeyDevice4
+#define EKeyGripClose			EKeyDevice5
+#define EKeySide				EKeyDevice6		// Voice key
+#define EKeyCamera				EKeyDevice7
+#define EKeyTwistOpen			EKeyDevice8
+#define EKeyTwistClose			EKeyDevice9
+#define EKeyFlipOpen			EKeyDeviceA
+#define EKeyFlipClose			EKeyDeviceB
+#define EKeyLock				EKeyDeviceF
+#define EKeyLeftUpArrow			EKeyDevice10	// Diagonal arrow event
+#define EKeyRightUpArrow		EKeyDevice11	// Diagonal arrow event
+#define EKeyRightDownArrow		EKeyDevice12	// Diagonal arrow event
+#define EKeyLeftDownArrow		EKeyDevice13	// Diagonal arrow event
+#define EKeyVolumeUp			EKeyIncVolume
+#define EKeyVolumeDown			EKeyDecVolume
+#define EKeyApplication 		EKeyApplication0
+#define EKeyPoC					EKeyApplication1
+#define EKeyPlay				EKeyApplication2
+#define EKeyStop				EKeyApplication3
+#define EKeyForward				EKeyApplication4
+#define EKeyRewind				EKeyApplication5
+#define EKeyOperator			EKeyApplication6
+#define EKeyQwertyOn			EKeyApplication7
+#define EKeyQwertyOff			EKeyApplication8
+#define EKeyNext				EKeyApplication9
+#define EKeyPrevious			EKeyApplicationA
+#define EKeyHoldSwitch			EKeyApplicationB
+#define EKeyZoomIn				EKeyApplicationC
+#define EKeyZoomOut				EKeyApplicationD
+#define EKey4x10QwertyOn		EKeyApplicationE
+#define EKey3x11QwertyOn		EKeyApplication10
+#define EKeyHalfQwertyOn		EKeyApplication11
+#define EKeyCustomKeyboardOn	EKeyApplication12
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserverplugins/keyeventrouting/src/keyrouter.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,543 @@
+// Copyright (c) 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:
+// Reference implementation of Key Event Routing plug-in
+
+/**
+@file
+@internalTechnology
+@prototype
+*/
+
+#include <e32cmn.h>
+#include <e32debug.h>
+#include "keyrouterimpl.h"
+#include "keyaliases.h"
+
+#ifndef KEYROUTER_TEST
+// Temporary: to be made configurable
+#define COMBINED_POWER_END_KEY
+#endif
+
+/**
+Privileged application UIDs
+*/
+#ifdef KEYROUTER_TEST
+const TInt KUidTAutoServer = 0x10205152;
+const TInt KUidReservedApp = 0x102872e3;
+#else
+const TInt KUidPhoneApp = 0x100058b3;
+const TInt KUidSysAp = 0x100058f3;
+const TInt KUidAutoLock = 0x100059b5;
+const TInt KUidHomeScreen = 0x20022f35;
+const TInt KUidAknCapServer = 0x10207218;
+#endif
+
+#if defined(KEYROUTER_TEST) || defined(COMBINED_POWER_END_KEY)
+/**
+Key Capture Translation Table
+
+The following scan codes and key codes are translated at capture-request time.
+
+@note	The data in this table is for example/test purposes only.
+*/
+const TTranslationEntry KTranslations[] =
+	{
+		// Req. scancode,	Capture scancode,	Req. keycode,	Capture keycode
+#ifndef KEYROUTER_TEST
+		// On devices with a combined Power and End key, that key produces a
+		// PowerOff code. Map capture requests for the End key to PowerOff.
+		// At routing time, an End key event will automatically be delivered
+		// to the capturing application.
+		{ EStdKeyPhoneEnd,	EStdKeyPowerOff,	EKeyPhoneEnd,	EKeyPowerOff }
+#else
+		// Entry for TEvent test case GRAPHICS-WSERV-0751.
+		// Capture requests for psuedo key Device0 are mapped to capture
+		// the real key Device1.
+		{ EStdKeyDevice0,	EStdKeyDevice1,		EKeyDevice0,	EKeyDevice1 }
+#endif
+	};
+
+const TInt KNumTranslations = TABLE_SIZE(KTranslations);
+#endif // defined(KEYROUTER_TEST) || defined(COMBINED_POWER_END_KEY)
+
+/**
+Restricted Key Table
+
+The following keys may be captured only by the specified applications.
+More than one application may be listed for a given key-type combination.
+*/
+const TRestrictedKeyEntry KRestrictedKeys[] =
+	{
+#ifndef KEYROUTER_TEST
+		// Short Apps key events may only be captured by HomeScreen, SysApp,
+		// AutoLock, Phone and AknCapServer.
+		{ EStdKeyApplication,	ECaptureTypeKeyUpDown,	KUidHomeScreen },
+		{ EKeyApplication,		ECaptureTypeKey,		KUidHomeScreen },
+		{ EStdKeyApplication,	ECaptureTypeKeyUpDown,	KUidSysAp },
+		{ EKeyApplication,		ECaptureTypeKey,		KUidSysAp },
+		{ EStdKeyApplication,	ECaptureTypeKeyUpDown,	KUidAutoLock },
+		{ EKeyApplication,		ECaptureTypeKey,		KUidAutoLock },
+		{ EStdKeyApplication,	ECaptureTypeKeyUpDown,	KUidPhoneApp },
+		{ EKeyApplication,		ECaptureTypeKey,		KUidPhoneApp },
+		{ EStdKeyApplication,	ECaptureTypeKeyUpDown,	KUidAknCapServer },
+		{ EKeyApplication,		ECaptureTypeKey,		KUidAknCapServer },
+
+		// Long Apps key events may only be captured by SysAp (for launching
+		// the task switcher), AutoLock and Phone.
+		{ EKeyApplication,		ECaptureTypeLongKey,	KUidSysAp },
+		{ EKeyApplication,		ECaptureTypeLongKey,	KUidAutoLock },
+		{ EKeyApplication,		ECaptureTypeLongKey,	KUidPhoneApp },
+
+		// Only SysAp and AutoLock are allowed to capture Power key events
+		{ EKeyPowerOff,			ECaptureTypeKey,		KUidSysAp },
+		{ EKeyPowerOff,			ECaptureTypeLongKey,	KUidSysAp },
+		{ EStdKeyPowerOff,		ECaptureTypeKeyUpDown,	KUidSysAp },
+		{ EKeyPowerOff,			ECaptureTypeKey,		KUidAutoLock },
+		{ EKeyPowerOff,			ECaptureTypeLongKey,	KUidAutoLock },
+		{ EStdKeyPowerOff,		ECaptureTypeKeyUpDown,	KUidAutoLock },
+
+		// Only AutoLock is allowed to capture Lock key events
+		{ EKeyLock,				ECaptureTypeKey,		KUidAutoLock },
+		{ EKeyLock,				ECaptureTypeLongKey,	KUidAutoLock },
+		{ EStdKeyLock,			ECaptureTypeKeyUpDown,	KUidAutoLock }
+#else
+		// The following entries are for test purposes only.
+		// Test Case GRAPHICS-WSERV-0754. Only a reserved UID is allowed to
+		// capture F20 key events.
+		{ EKeyF20,				ECaptureTypeKey,		KUidReservedApp },
+		{ EKeyF20,				ECaptureTypeLongKey,	KUidReservedApp },
+		{ EStdKeyF20,			ECaptureTypeKeyUpDown,	KUidReservedApp },
+		// Only the reserved UID and the TAuto tests are allowed to capture
+		// F21 key events
+		{ EKeyF21,				ECaptureTypeKey,		KUidReservedApp },
+		{ EKeyF21,				ECaptureTypeLongKey,	KUidReservedApp },
+		{ EStdKeyF21,			ECaptureTypeKeyUpDown,	KUidReservedApp },
+		{ EKeyF21,				ECaptureTypeKey,		KUidTAutoServer },
+		{ EKeyF21,				ECaptureTypeLongKey,	KUidTAutoServer },
+		{ EStdKeyF21,			ECaptureTypeKeyUpDown,	KUidTAutoServer }
+#endif
+	};
+
+/**
+Application Priority Table
+
+The following applications have fixed priorities for capture of the associated
+key. The priority specified in this table overrides the priority in the capture
+request. When any other application captures a key listed here, the priority is
+forced to zero.
+
+@note	If a key should be never be delivered to any other application, then
+		it should be placed in KRestrictedKeys[] instead.
+*/
+const TAppPriorityEntry KAppPriorityKeys[] =
+	{
+#ifndef KEYROUTER_TEST
+		// The Phone app has priority for capture of Send key events
+		{ EStdKeyPhoneSend,	ECaptureTypeKeyUpDown,	KUidPhoneApp, 1 },
+		{ EKeyPhoneSend,	ECaptureTypeKey,		KUidPhoneApp, 1 },
+		{ EKeyPhoneSend,	ECaptureTypeLongKey,	KUidPhoneApp, 1 },
+
+		// The Phone app has the highest priority for capture of End key
+		// events. Note: any applications that capture these events apart
+		// from those listed here (e.g. other telephony apps) will effectively
+		// have priority 0.
+		{ EStdKeyPhoneEnd,	ECaptureTypeKeyUpDown,	KUidPhoneApp, 1 },
+		{ EKeyPhoneEnd,		ECaptureTypeKey,		KUidPhoneApp, 1 },
+		{ EKeyPhoneEnd,		ECaptureTypeLongKey,	KUidPhoneApp, 1 },
+
+		// The Home Screen app has low priority for capture of End key events
+		{ EStdKeyPhoneEnd,	ECaptureTypeKeyUpDown,	KUidHomeScreen, -1 },
+		{ EKeyPhoneEnd,		ECaptureTypeKey,		KUidHomeScreen, -1 },
+		{ EKeyPhoneEnd,		ECaptureTypeLongKey,	KUidHomeScreen, -1 },
+
+		// SysAp has the lowest priority for capture of End key events
+		{ EStdKeyPhoneEnd,	ECaptureTypeKeyUpDown,	KUidSysAp, -2 },
+		{ EKeyPhoneEnd,		ECaptureTypeKey,		KUidSysAp, -2 },
+		{ EKeyPhoneEnd,		ECaptureTypeLongKey,	KUidSysAp, -2 },
+
+#ifdef COMBINED_POWER_END_KEY
+		// SysAp has the same priority for capture of Power key events as
+		// it does for End key events. This is necessary to maintain correct
+		// relative priorities when there is a combined Power and End key.
+		{ EStdKeyPowerOff,	ECaptureTypeKeyUpDown,	KUidSysAp, -2 },
+		{ EKeyPowerOff,		ECaptureTypeKey,		KUidSysAp, -2 },
+		{ EKeyPowerOff,		ECaptureTypeLongKey,	KUidSysAp, -2 }
+#endif
+
+#else // KEYROUTER_TEST
+		// The following entries are for test purposes only.
+		// Test Case GRAPHICS-WSERV-0757. TAuto tests have priority for
+		// capture of F22 key events.
+		{ EStdKeyF22,		ECaptureTypeKeyUpDown,	KUidTAutoServer, 1 },
+		{ EKeyF22,			ECaptureTypeKey,		KUidTAutoServer, 1 },
+		{ EKeyF22,			ECaptureTypeLongKey,	KUidTAutoServer, 1 }
+#endif // KEYROUTER_TEST
+	};
+
+#ifdef KEYROUTER_TEST
+/**
+Blocked key table.
+
+The following keys are not routed by default.
+
+@note	The data in this table is for example/test purposes only.
+		Since long key events are never routed by default, there is no need
+		to list them here.
+*/
+const TBlockedKeyEntry KBlockedKeys[] =
+	{
+		// Entries for TEvent test case GRAPHICS-WSERV-0760
+		{ EStdKeyDevice3,	ECaptureTypeKeyUpDown },
+		{ EKeyDevice3,		ECaptureTypeKey }
+	};
+
+const TInt KNumBlockedKeys = TABLE_SIZE(KBlockedKeys);
+#endif // KEYROUTER_TEST
+
+const TInt KNumRestrictedKeys = TABLE_SIZE(KRestrictedKeys);
+const TInt KNumAppPriorityKeys = TABLE_SIZE(KAppPriorityKeys);
+const TInt KCaptureKeyArrayGranularity = 5;
+
+/**
+Create and return an instance of CKeyEventRouter
+
+@return	Pointer to new router instance
+*/
+EXPORT_C CKeyEventRouter* CKeyEventRouter::NewL()
+	{
+	return new(ELeave) CKeyEventRouterImpl;
+	}
+
+CKeyEventRouterImpl::CKeyEventRouterImpl()
+: iCaptureKeys(KCaptureKeyArrayGranularity, _FOFF(TKeyCaptureRequest, iHandle))
+	{
+	}
+
+CKeyEventRouterImpl::~CKeyEventRouterImpl()
+	{
+	iCaptureKeys.Close();
+	}
+
+/**
+Add a new key capture request
+
+@param	aRequest	Capture request details
+
+@see CKeyEventRouter::AddCaptureKeyL
+*/
+void CKeyEventRouterImpl::AddCaptureKeyL(const TKeyCaptureRequest& aRequest)
+	{
+	CheckCaptureKeyL(aRequest);
+	iCaptureKeys.InsertL(aRequest, 0);
+	ProcessAppPriorities(iCaptureKeys[0]);
+	TranslateCaptureKey(aRequest.iType, iCaptureKeys[0].iInputCode);
+	}
+
+   
+/**
+Update an existing key capture request
+
+@param	aRequest	Updated capture request details
+
+@note	This function is used only for window server hotkeys, hence key/scan
+		code translation and processing of special application priorities are
+		omitted.
+
+@see CKeyEventRouter::UpdateCaptureKeyL
+*/
+void CKeyEventRouterImpl::UpdateCaptureKeyL(const TKeyCaptureRequest& aRequest)
+	{
+	ASSERT(!aRequest.iWindowGroup);
+	CheckCaptureKeyL(aRequest);
+
+	TInt index = iCaptureKeys.Find(aRequest);
+	ASSERT(index != KErrNotFound);
+
+	if (index != KErrNotFound)
+		{
+		iCaptureKeys[index] = aRequest;
+		}
+	}
+
+/**
+Cancel a key capture request
+
+@param	aType		Capture type
+@param	aHandle		Opaque handle of request to be cancelled
+
+@see CKeyEventRouter::CancelCaptureKey
+
+Note: aType is unused in this implementation, but is present to permit
+implementations that use separate lists for each of the three capture types.
+*/
+void CKeyEventRouterImpl::CancelCaptureKey(TKeyCaptureType /*aType*/, TAny* aHandle)
+	{
+	TKeyCaptureRequest request;
+	request.iHandle = aHandle;
+
+	TInt index = iCaptureKeys.Find(request);
+	if (index != KErrNotFound)
+		{
+		iCaptureKeys.Remove(index);
+		}
+	}
+
+/**
+Route the key event described by aInput and return its destination in iOutput
+
+@param	aInput		Input data with key event to be routed
+@param	aOutput		Output key event and routing results
+
+@see CKeyEventRouter::RouteKey
+*/
+void CKeyEventRouterImpl::RouteKey(const TKeyEventRouterInput& aInput, TKeyEventRouterOutput& aOutput)
+	{
+	TUint inputCode = (aInput.iType == ECaptureTypeKeyUpDown) ?
+						aInput.iKeyEvent.iScanCode : aInput.iKeyEvent.iCode;
+	TInt priority = KMinTInt;
+	TInt captureCount = iCaptureKeys.Count();
+	TKeyCaptureRequest* matchRequest = NULL;
+
+	// Find the highest priority matching capture request. If there are
+	// multiple entries with the same priority then use the first one, i.e.
+	// the most recent request.
+	for (TInt index = 0; index < captureCount; index++)
+		{
+		TKeyCaptureRequest& request = iCaptureKeys[index];
+		if (request.iType == aInput.iType &&
+			request.iInputCode == inputCode &&
+		    (aInput.iKeyEvent.iModifiers & request.iModifierMask) == request.iModifiers &&
+			(request.iPriority > priority))
+			{
+			matchRequest = &request;
+			priority = request.iPriority;
+			}
+		}
+
+	if (matchRequest)
+		{
+		// Found matching capture request. Route the key event to the window
+		// group that made the capture request.
+		aOutput.iWindowGroup = matchRequest->iWindowGroup;
+		if (aInput.iType == ECaptureTypeKeyUpDown)
+			{
+			aOutput.iKeyEvent.iScanCode = matchRequest->iOutputCode;
+			aOutput.iKeyEvent.iCode = aInput.iKeyEvent.iCode;
+#ifdef COMBINED_POWER_END_KEY
+			// When routing to SysAp on devices with a combined Power and End
+			// key, deliver this event as PowerOff if the HomeScreen currently
+			// has focus, otherwise as End. (Note that when the HomeScreen app
+			// is showing the application library, it will capture the End key
+			// itself with higher priority.)
+			if (matchRequest->iAppUid.iUid == KUidSysAp &&
+				aInput.iKeyEvent.iScanCode == EStdKeyPowerOff)
+				{
+				aOutput.iKeyEvent.iScanCode =
+					(aInput.iFocusAppUid.iUid == KUidHomeScreen) ?
+					EStdKeyPowerOff : EStdKeyPhoneEnd;
+				}
+#endif
+			}
+		else
+			{
+			aOutput.iKeyEvent.iScanCode = aInput.iKeyEvent.iScanCode;
+			aOutput.iKeyEvent.iCode = matchRequest->iOutputCode;
+#ifdef COMBINED_POWER_END_KEY
+			if (matchRequest->iAppUid.iUid == KUidSysAp &&
+				aInput.iKeyEvent.iCode == EKeyPowerOff)
+				{
+				aOutput.iKeyEvent.iCode =
+					(aInput.iFocusAppUid.iUid == KUidHomeScreen) ?
+					EKeyPowerOff : EKeyPhoneEnd;
+				}
+#endif
+			}
+		aOutput.iKeyEvent.iModifiers = aInput.iKeyEvent.iModifiers;
+		aOutput.iCaptureHandle = matchRequest->iHandle;
+		aOutput.iResult = ECaptured;
+		}
+#ifdef KEYROUTER_TEST
+	else if (IsKeyBlocked(aInput.iType, inputCode))
+		{
+		// No matching capture request and key is blocked. Do not route.
+		aOutput.iResult = EConsumed;
+		}
+#endif
+	else
+		{
+		// No matching capture request. Route the key event to the current
+		// focussed window group.
+		aOutput.iWindowGroup = aInput.iFocusWindowGroup;
+		aOutput.iKeyEvent = aInput.iKeyEvent;
+		aOutput.iCaptureHandle = NULL;
+		aOutput.iResult = ERouted;
+		}
+	}
+
+/**
+Check that capture request arguments are sane and capture is allowed
+
+@param	aRequest	Capture request details
+
+@leave	KErrArgument if modifier state contains bits that are not in the
+		modifier mask or modifier mask contains EModifierLongKey or priority
+		is KMinTInt.
+		KErrPermissionDenied if key is restricted to capture by a specific
+		application UID and the UID of the requesting app does not match.
+
+@note	Requests with a priority of KMinTint would never be captured: this was
+		also true of the previous implementation in ektran.dll but was ignored.
+		Client code must use the appropriate API function to capture short or
+		long key events, so including EModifierLongKey in the modifier mask is
+		not allowed. (Hotkeys are excepted since a mask of 0xffffffff is used
+		to disable them).
+*/
+void CKeyEventRouterImpl::CheckCaptureKeyL(const TKeyCaptureRequest& aRequest)
+	{
+	if ((aRequest.iModifiers & ~aRequest.iModifierMask) != 0 ||
+		(aRequest.iModifierMask & EModifierLongKey) != 0 && aRequest.iWindowGroup != NULL ||
+		aRequest.iPriority == KMinTInt)
+		{
+		User::Leave(KErrArgument);
+		}
+
+	if (aRequest.iWindowGroup != NULL && IsRestrictedKey(aRequest))
+		{
+		User::Leave(KErrPermissionDenied);
+		}
+	}
+
+/**
+Check if the requested key capture is restricted by application UID
+
+@param	aRequest	Capture request details
+
+@return	ETrue if the key-type combination in aRequest is listed in
+		KRestrictedKeys[] but the requesting application UID does not match
+		any entry in the table; otherwise EFalse.
+*/
+TBool CKeyEventRouterImpl::IsRestrictedKey(const TKeyCaptureRequest& aRequest)
+	{
+	TBool foundKey = EFalse;
+
+	for (const TRestrictedKeyEntry* entry = KRestrictedKeys; entry < &KRestrictedKeys[KNumRestrictedKeys]; entry++)
+		{
+		if (entry->iCode == aRequest.iInputCode &&
+			entry->iType == aRequest.iType)
+			{
+			foundKey = ETrue;
+			if (entry->iAppUidValue == aRequest.iAppUid.iUid)
+				{
+				return EFalse;
+				}
+			}
+		}
+
+	return foundKey;
+	}
+
+/**
+Process special application priorities
+
+@param	aRequest	Capture request details. If the key-type combination is
+					listed in KAppPriorityKeys[], then the capture priority is
+					replaced with the configured priority for the requesting
+					application, or with zero if the application UID does not
+					match any entry in the table.
+*/
+void CKeyEventRouterImpl::ProcessAppPriorities(TKeyCaptureRequest& aRequest)
+	{
+	TBool foundKey = EFalse;
+
+	for (const TAppPriorityEntry* entry = KAppPriorityKeys; entry < &KAppPriorityKeys[KNumAppPriorityKeys]; entry++)
+		{
+		if (entry->iCode == aRequest.iInputCode &&
+			entry->iType == aRequest.iType)
+			{
+			foundKey = ETrue;
+			if (entry->iAppUidValue == aRequest.iAppUid.iUid)
+				{
+				aRequest.iPriority = entry->iAppPriority;
+				return;
+				}
+			}
+		}
+
+	if (foundKey)
+		{
+		aRequest.iPriority = 0;
+		}
+	}
+
+#ifdef KEYROUTER_TEST
+/**
+Check if the specified key is blocked from default routing
+
+@param	aType		Key capture type
+@param	aCode		Scan code or key code
+
+@return	ETrue if key is blocked, otherwise EFalse.
+*/
+TBool CKeyEventRouterImpl::IsKeyBlocked(TKeyCaptureType aType, TUint aCode)
+	{
+	for (const TBlockedKeyEntry* entry = KBlockedKeys; entry < &KBlockedKeys[KNumBlockedKeys]; entry++)
+		{
+		if (entry->iCode == aCode && entry->iType == aType)
+			{
+			return ETrue;
+			}
+		}
+
+		return EFalse;
+	}
+#endif // KEYROUTER_TEST
+
+/**
+Translate the scan or key code of a capture request
+
+@param	aType	Key capture type
+@param	aCode	Key code or scan code, updated to translated value (if any)
+
+@note	This function is used to translate the input key or scan code of a
+		capture request on addition to the capture list. When a key event that
+		matches the list entry is routed, the output code will be taken from
+		TKeyCaptureRequest.iOutputCode and hence automatically translated again
+		(typically back to the original input code of the request, unless the
+		input and output codes were different). For example, a request to
+		capture key code A will be translated to key code B in the capture list.
+		When RouteKey() processes an event with key code B and selects that
+		list entry, it will output key code A for delivery to the application.
+*/
+void CKeyEventRouterImpl::TranslateCaptureKey(TKeyCaptureType aType, TUint& aCode)
+	{
+#if defined(KEYROUTER_TEST) || defined(COMBINED_POWER_END_KEY)
+	for (const TTranslationEntry* entry = KTranslations; entry < &KTranslations[KNumTranslations]; entry++)
+		{
+		if (aType == ECaptureTypeKeyUpDown)
+			{
+			if (aCode == entry->iRequestScanCode)
+				{
+				aCode = entry->iCaptureScanCode;
+				}
+			}
+		else
+			{
+			if (aCode == entry->iRequestKeyCode)
+				{
+				aCode = entry->iCaptureKeyCode;
+				}
+			}
+		}
+#endif
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserverplugins/keyeventrouting/src/keyrouterimpl.h	Tue Jul 20 13:27:44 2010 +0300
@@ -0,0 +1,92 @@
+// Copyright (c) 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:
+// Reference implementation of Key Event Routing plug-in
+
+/**
+@file
+@internalTechnology
+@prototype
+*/
+
+#ifndef KEYROUTERIMPL_H
+#define KEYROUTERIMPL_H
+
+#include <graphics/wskeyrouter.h>
+
+/** Key Capture Translation Table entry */
+struct TTranslationEntry
+	{
+	TUint	iRequestScanCode;
+	TUint	iCaptureScanCode;
+	TUint	iRequestKeyCode;
+	TUint	iCaptureKeyCode;
+	};
+
+/** Restricted Key Table entry */
+struct TRestrictedKeyEntry
+	{
+	TUint			iCode;
+	TKeyCaptureType	iType;
+	TInt			iAppUidValue;
+	};
+
+/** Application Priority Table entry */
+struct TAppPriorityEntry
+	{
+	TUint			iCode;
+	TKeyCaptureType	iType;
+	TInt			iAppUidValue;
+	TInt			iAppPriority;
+	};
+
+#ifdef KEYROUTER_TEST
+/** Blocked Key Table entry */
+struct TBlockedKeyEntry
+	{
+	TUint			iCode;
+	TKeyCaptureType	iType;
+	};
+#endif // KEYROUTER_TEST
+
+#define TABLE_SIZE(table) (sizeof(table) / sizeof((table)[0]))
+
+/**
+Key Event Router implementation class
+*/
+NONSHARABLE_CLASS(CKeyEventRouterImpl) : public CKeyEventRouter
+	{
+public:
+	CKeyEventRouterImpl();
+	~CKeyEventRouterImpl();
+
+	// From CKeyEventRouter
+	void AddCaptureKeyL(const TKeyCaptureRequest& aRequest);
+	void UpdateCaptureKeyL(const TKeyCaptureRequest& aRequest);
+	void CancelCaptureKey(TKeyCaptureType aType, TAny* aHandle);
+	void RouteKey(const TKeyEventRouterInput& aInput,
+				  TKeyEventRouterOutput& aOutput);
+private:
+	void CheckCaptureKeyL(const TKeyCaptureRequest& aRequest);
+	void ProcessAppPriorities(TKeyCaptureRequest& aRequest);
+	void TranslateCaptureKey(TKeyCaptureType aType, TUint& aCode);
+	TBool IsRestrictedKey(const TKeyCaptureRequest& aRequest);
+#ifdef KEYROUTER_TEST
+	TBool IsKeyBlocked(TKeyCaptureType aType, TUint aCode);
+#endif
+
+private:
+	RArray<TKeyCaptureRequest>	iCaptureKeys;
+	};
+
+#endif // KEYROUTERIMPL_H
--- a/windowing/windowserverplugins/openwfc/group/stdplugin.mmp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserverplugins/openwfc/group/stdplugin.mmp	Tue Jul 20 13:27:44 2010 +0300
@@ -75,6 +75,7 @@
 LIBRARY     wfcinterop.lib
 LIBRARY     surfacemanager.lib
 LIBRARY	 	libEGL.lib
+LIBRARY	 	bitgdi.lib
 //TODO Change the following line once eglsynchelper has been corrected
 //     to be available as a dynamic library
 STATICLIBRARY  eglsynchelper.lib
--- a/windowing/windowserverplugins/openwfc/group/wserv_std_plugins.iby	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserverplugins/openwfc/group/wserv_std_plugins.iby	Tue Jul 20 13:27:44 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 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"
@@ -30,4 +30,6 @@
 ECOM_PLUGIN(10286378.dll,10286378.rsc)
 #endif
 
+#include <keyeventrouting.iby>
+
 #endif // __WSERV_STD_PLUGINS_IBY__
--- a/windowing/windowserverplugins/openwfc/src/displayrenderstage.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserverplugins/openwfc/src/displayrenderstage.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -312,7 +312,10 @@
 
 TDisplayMode CDisplayRenderStage::DisplayMode() const
 	{
-	return iRenderTarget->DisplayMode();
+	const TInt KThirtyTwoBpp = 32;
+	const TDisplayMode dm = iRenderTarget->DisplayMode();
+	const TInt bpp = TDisplayModeUtils::NumDisplayModeBitsPerPixel(dm);
+	return bpp == KThirtyTwoBpp ? CFbsDevice::DisplayMode16M() : dm;
 	}
 
 TSize CDisplayRenderStage::SizeInPixels() const
--- a/windowing/windowserverplugins/openwfc/src/fbrenderstage.cpp	Tue Jun 22 15:21:29 2010 +0300
+++ b/windowing/windowserverplugins/openwfc/src/fbrenderstage.cpp	Tue Jul 20 13:27:44 2010 +0300
@@ -18,6 +18,7 @@
 #include "panic.h"
 #include <graphics/wsdisplaycontrol.h>
 #include "displaypolicy.h"
+#include <graphics/sgutils.h>
 #include "utils.h"
 
 #if defined(__WINS__) && defined(_DEBUG)
@@ -154,7 +155,18 @@
 	if (iniFile->FindVar(iNextScreenDevice->ScreenNumber(), KFlickerBufferMode, flickerBufferModeName))
 		displayMode = ParseDisplayMode(flickerBufferModeName);
 	if (displayMode == ENone)
-		displayMode = iNextScreenDevice->DisplayMode();
+		{
+		// Display render stage MWsScreenDevice::DisplayMode now reports the supported screendriver display mode in 32bpp. 
+		// It is necessary in order to maintain BC with 3rd party apps and DSA framework.
+		// The reported display mode may be different from the actual UI surface pixel format, so flicker buffer
+	    // must not rely on DisplayMode() to determine pixel format for its rendering target.
+		//
+		MWsUiBuffer* uiBuf = aNextStage->ObjectInterface<MWsUiBuffer>();
+		if (uiBuf)
+			{
+			displayMode = SgUtils::PixelFormatToDisplayMode(uiBuf->PixelFormat());
+			}
+		}
 	STD_ASSERT_DEBUG(displayMode!=ENone, EPluginPanicNoDisplayModeFound);
 	
 	const TUint32 usage = ESgUsageDirectGdiTarget | ESgUsageWindowGcSource;