Cleaned up eglbringuptest code bug235_bringup_0
authorGareth Stockwell <gareth.stockwell@accenture.com>
Fri, 22 Oct 2010 22:19:05 +0100
branchbug235_bringup_0
changeset 210 da03feddbab7
parent 208 7df094ed4a3f
child 211 3804ba25b23f
Cleaned up eglbringuptest code - Refactored CEGLRendering construction to separate EGL and VG setup - Consistently check EGL and VG errors after each API call - Standardised RDebug::Printf statements to all start with [EBT] - Removed unused libraries from MMP file - Removed unused openvgengine.h - Removed various unused member variables - Removed unused CWsCanvas class
egl/sfegltest/group/eglbringuptest.mmp
egl/sfegltest/inc/eglrendering.h
egl/sfegltest/inc/openvgengine.h
egl/sfegltest/src/eglrendering.cpp
egl/sfegltest/src/main.cpp
--- a/egl/sfegltest/group/eglbringuptest.mmp	Fri Oct 22 11:59:21 2010 +0100
+++ b/egl/sfegltest/group/eglbringuptest.mmp	Fri Oct 22 22:19:05 2010 +0100
@@ -32,30 +32,23 @@
 target          eglbringuptest.exe
 targettype      exe
 uid             0x100039ce 0x12345678
+epocheapsize	0x1000 0x800000
 
 userinclude     .
-userinclude 	../inc/
+userinclude		../inc/
 systeminclude   /epoc32/include
 systeminclude   /epoc32/include/stdapis
 systeminclude   /epoc32/include/platform
 
-library			libegl.lib		// EGL
-library			libopenvg.lib	// OpenVG
+sourcepath		../src
+source			main.cpp
+source			eglrendering.cpp
 
 library         euser.lib
 library         libc.lib
-library         fbscli.lib
 library         ws32.lib
-library 		gdi.lib
-library     	bitgdi.lib
-library         hal.lib
-library			efsrv.lib
-library			fntstr.lib
-
-sourcepath		../src
-source			main.cpp
-source			eglrendering.cpp 
-
-epocheapsize 0x1000 0x800000
+library			libegl.lib
+library			libopenvg.lib
 
 smpsafe
+
--- a/egl/sfegltest/inc/eglrendering.h	Fri Oct 22 11:59:21 2010 +0100
+++ b/egl/sfegltest/inc/eglrendering.h	Fri Oct 22 22:19:05 2010 +0100
@@ -15,46 +15,46 @@
 #ifndef __EGLRENDERING_H__
 #define __EGLRENDERING_H__
 
-
 #include <e32base.h>
 #include <w32std.h>
 #include <EGL/egl.h>
 #include <VG/openvg.h>
-#include <VG/vgu.h>
 
 class CEGLRendering : public CBase
 	{
 public:
-	static CEGLRendering* NewL(RWindow& aWindow, TBool);
-	static CEGLRendering* NewLC(RWindow& aWindow,TBool);
-
+	static CEGLRendering* NewL(RWindow& aWindow);
 	~CEGLRendering();
 
 	void Start();
 	void Stop();
-	
-	static void EGLCheckError();
-	static void EGLCheckReturnError(EGLBoolean aBool);
-	static void VGCheckError();
+
 	void UpdateDisplay();
 	static TInt TimerCallBack(TAny* aDemo);
-	
+
 private:
 	CEGLRendering(RWindow& aWindow);
-	void ConstructL(TBool);	
+	void ConstructL();
+
+    static void EGLCheckError();
+    static void EGLCheckReturnError(EGLBoolean aBool);
+    static void VGCheckError();
+    
+    void EglSetupL();
+    void VgSetup();
+    void VgPaint();
 	
 private:
 	RWindow& iWindow;
-			
 	CPeriodic* iTimer;
-	
-	CFbsBitmap* iBitmap;	
+	CFbsBitmap* iBitmap;
 	TInt iCount;
-
 	EGLDisplay iDisplay;
 	EGLSurface iSurface;
-	EGLContext iContextVG;
+	EGLContext iContext;
+	VGPaint iVGPaint;
+	VGPath iVGPath;
 	};
 
+#endif
 
-#endif 
--- a/egl/sfegltest/inc/openvgengine.h	Fri Oct 22 11:59:21 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +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:
-
-#ifndef OPENVGENGINE_H_
-#define OPENVGENGINE_H_
-
-#include <VG/openvg.h>
-#include <EGL/egl.h>
-
-// image Height/Width
-const TInt KImageSize = 128;
-
-//KMaxCoversExample3 refers to the number of album covers visible on the screen at any given point
-const TInt KMaxDisplayCoversExample3 = 40;
-const TInt KMaxDisplayLeftExample3 = -3;
-const TInt KMaxDisplayRightExample3 = 3;
-
-
-// the max number of covers you can store
-const TInt KMaxCoversExample3 = 40;
-	
-
-#endif 
--- a/egl/sfegltest/src/eglrendering.cpp	Fri Oct 22 11:59:21 2010 +0100
+++ b/egl/sfegltest/src/eglrendering.cpp	Fri Oct 22 22:19:05 2010 +0100
@@ -12,256 +12,244 @@
 //
 // Description:
 
+#include "eglrendering.h"
 #include <string.h>
-#include "eglrendering.h"
-#include "openvgengine.h"
-#include <hal.h>
 
 const TInt KTimerDelay = 0;
 
-
 /** Attributes to be passed into eglChooseConfig */
-const EGLint	KColorRGBA8888AttribList[] =
+const EGLint KAttribList[] =
 		{
 		EGL_RED_SIZE,			8,
 		EGL_GREEN_SIZE,			8,
 		EGL_BLUE_SIZE,			8,
         EGL_ALPHA_SIZE,         8,
 		EGL_SURFACE_TYPE,		EGL_WINDOW_BIT,
-		EGL_RENDERABLE_TYPE, 	EGL_OPENVG_BIT,
+		EGL_RENDERABLE_TYPE,	EGL_OPENVG_BIT,
 		EGL_NONE
 		};
 
+void CEGLRendering::EGLCheckError()
+    {
+    EGLint error = eglGetError();
+    if(EGL_SUCCESS != error)
+        {
+        RDebug::Printf("[EBT] CEglRendering::EGLCheckError error %d", error);
+        User::Panic(_L("EBT-EGL"), error);
+        }
+    }
 
-CEGLRendering* CEGLRendering::NewL(RWindow& aWindow, TBool aQhd)
+void CEGLRendering::EGLCheckReturnError(EGLBoolean aBool)
+    {
+    if(!aBool)
+        {
+        RDebug::Printf("[EBT] CEglRendering::EGLCheckReturnError false");
+        User::Panic(_L("EGL-EGL-RTN"), eglGetError());
+        }
+    }
+
+void CEGLRendering::VGCheckError()
+    {
+    VGint error = vgGetError();
+    if(VG_NO_ERROR != error)
+        {
+        RDebug::Printf("[EBT] CEglRendering::VGCheckError error %d", error);
+        User::Panic(_L("EBT-VG"), error);
+        }
+    }
+
+CEGLRendering* CEGLRendering::NewL(RWindow& aWindow)
 	{
-	CEGLRendering* self = CEGLRendering::NewLC(aWindow, aQhd);
-	CleanupStack::Pop(self);
-	return self;
-	}
-
-
-CEGLRendering* CEGLRendering::NewLC(RWindow& aWindow, TBool aQhd)
-	{
-	CEGLRendering* self = new(ELeave) CEGLRendering(aWindow);
+	CEGLRendering* self = new (ELeave) CEGLRendering(aWindow);
 	CleanupStack::PushL(self);
-	self->ConstructL(aQhd);
+	self->ConstructL();
+    CleanupStack::Pop(self);
 	return self;
 	}
 
-CEGLRendering::~CEGLRendering()
-	{
-	Stop();
-	
-	delete iTimer;
-
-	if (iContextVG!=EGL_NO_CONTEXT)
-		{
-		EGLCheckReturnError(eglDestroyContext(iDisplay,iContextVG));
-		}
-	
-	if (iSurface!=EGL_NO_SURFACE)
-		{
-		EGLCheckReturnError(eglDestroySurface(iDisplay,iSurface));
-		}
-	
-	// Call eglMakeCurrent() to ensure the surfaces and contexts are truly destroyed. 
-	EGLCheckReturnError(eglMakeCurrent(iDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
-
-	EGLCheckReturnError(eglTerminate(iDisplay));
-	EGLCheckReturnError(eglReleaseThread());
-
-	delete iBitmap;
-	}
-
-void CEGLRendering::Start()
-	{
-	// Start drawing the screen periodically
-	iTimer->Start(0, KTimerDelay, TCallBack(TimerCallBack,this));
-	}
-
-void CEGLRendering::Stop()
-	{
-	if(iTimer)
-		{
-		iTimer->Cancel();
-		}	
-	}
-
-void CEGLRendering::EGLCheckError()
-	{
-	EGLint error = eglGetError();
-	if(error != EGL_SUCCESS)
-		{
-		User::Panic(_L("EGL error"), error);
-		}
-	}
-
-void CEGLRendering::VGCheckError()
-	{
-	VGint error = vgGetError();
-	if(error != VG_NO_ERROR)
-		{
-		User::Panic(_L("OpenVG error"), error);
-		}
-	}
-
-void CEGLRendering::EGLCheckReturnError(EGLBoolean aBool)
-	{
-	if (!aBool)
-		{
-		User::Panic(_L("EGL return error"),eglGetError());
- 		}
-	}
-
-
 CEGLRendering::CEGLRendering(RWindow& aWindow)
-	: iWindow(aWindow),iCount(0)
+	:  iWindow(aWindow)
+	,  iCount(0)
 	{
 	}
 
 /*
  * Construct EGL objects, and OpenVG binding.
- * 
+ *
  * Here we collaborate with EGL to associate a session, pick and configuration, assign
  * it to the window we have, and then bind the OpenVG rendering API to our newly created
  * context.
- * 
+ *
  * In bring up terms, here is where the first EGL code entry points are called from.  Its
  * the natural point where an EGL bringup starts debugging from, assuming the core EGL
  * works in terms of supporting EGL sync objects (needed for boot before we get to the
  * ESHELL command prompt).
  */
-void CEGLRendering::ConstructL(TBool aQhd)
+void CEGLRendering::ConstructL()
     {
-	RDebug::Printf("CEGLRendering::ConstructL");
-	
-	// Refresh timer	
+	RDebug::Printf("[EBT] CEGLRendering::ConstructL");
 	iTimer = CPeriodic::NewL(CActive::EPriorityIdle);
-	
-	const TDisplayMode dispMode = iWindow.DisplayMode();
-	const TSize windowSize(iWindow.Size());
+	EglSetupL();
+	VgSetup();
+	VgPaint();
+	}
 
-	// Create display object
-	iDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
-	RDebug::Printf("CEGLRendering::ConstructL 1");
-	EGLCheckError();
+void CEGLRendering::EglSetupL()
+    {
+    RDebug::Printf("[EBT] CEGLRendering::EglSetupL eglGetDisplay");
+    iDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+    EGLCheckError();
 
-	// Initialize display object
-	EGLCheckReturnError(eglInitialize(iDisplay, NULL, NULL));
-	RDebug::Printf("CEGLRendering::ConstructL 2");
-	
-	RDebug::Printf("Vendor string %s", eglQueryString(iDisplay, EGL_VENDOR));
-	RDebug::Printf("Version string %s", eglQueryString(iDisplay, EGL_VERSION));
-	RDebug::Printf("Version string %s", eglQueryString(iDisplay, EGL_EXTENSIONS));
+    RDebug::Printf("[EBT] CEGLRendering::EglSetupL eglInitialize");
+    EGLCheckReturnError(eglInitialize(iDisplay, NULL, NULL));
+
+    RDebug::Printf("[EBT] CEGLRendering::EglSetupL vendor %s", eglQueryString(iDisplay, EGL_VENDOR));
+    RDebug::Printf("[EBT] CEGLRendering::EglSetupL version %s", eglQueryString(iDisplay, EGL_VERSION));
+    RDebug::Printf("[EBT] CEGLRendering::EglSetupL extensions %s", eglQueryString(iDisplay, EGL_EXTENSIONS));
 
-		
-	// Check that EGL provides the capabilities for this app.
-	TInt error = KErrNone;
-	if ( NULL == strstr(eglQueryString(iDisplay, EGL_CLIENT_APIS), "OpenVG") ) 
-		{
-		RDebug::Printf("OpenVG not listed in supported client APIs %s", eglQueryString(iDisplay, EGL_CLIENT_APIS));
-		error = KErrNotSupported;
-		}
-		
+    // Check that EGL provides the capabilities for this app.
+    if(NULL == strstr(eglQueryString(iDisplay, EGL_CLIENT_APIS), "OpenVG"))
+        {
+        RDebug::Printf("[EBT] CEGLRendering::EglSetupL OpenVG not listed in supported client APIs %s", eglQueryString(iDisplay, EGL_CLIENT_APIS));
+        User::Leave(KErrNotSupported);
+        }
+
+    if(NULL == strstr(eglQueryString(iDisplay, EGL_EXTENSIONS), "EGL_SYMBIAN_COMPOSITION") )
+        {
+        RDebug::Printf("[EBT] CEGLRendering::EglSetupL EGL_SYMBIAN_COMPOSITION not listed in extension string %s", eglQueryString(iDisplay, EGL_EXTENSIONS));
+        User::Leave(KErrNotSupported);
+        }
 
-	if ( NULL == strstr(eglQueryString(iDisplay, EGL_EXTENSIONS), "EGL_SYMBIAN_COMPOSITION") ) 
-		{
-		RDebug::Printf("EGL_SYMBIAN_COMPOSITION not listed in extension string %s", eglQueryString(iDisplay, EGL_EXTENSIONS));
-		error = KErrNotSupported;
-		}
-	if (error != KErrNone)
-		{
-		User::Leave(error);
-		}
+    RDebug::Printf("[EBT] CEGLRendering::EglSetupL eglChooseConfig");
+    EGLint numConfigs = 0;
+    EGLConfig chosenConfig = 0;
+    EGLCheckReturnError(eglChooseConfig(iDisplay, KAttribList, &chosenConfig, 1, &numConfigs));
+    if (0 == numConfigs)
+        {
+        RDebug::Printf("[EBT] No matching configs found", eglQueryString(iDisplay, EGL_EXTENSIONS));
+        User::Leave(KErrNotSupported);
+        }
 
-	EGLint numConfigs;
-	EGLConfig chosenConfig = 0;
+    RDebug::Printf("[EBT] CEGLRendering::EglSetupL eglBindApi");
+    EGLCheckReturnError(eglBindAPI(EGL_OPENVG_API));
+    
+    RDebug::Printf("[EBT] CEGLRendering::EglSetupL eglCreateWindowSurface");
+    iSurface = eglCreateWindowSurface(iDisplay, chosenConfig, &iWindow, NULL);
+    EGLCheckError();
 
-	// Choose the config to use
-	EGLCheckReturnError(eglChooseConfig(iDisplay, KColorRGBA8888AttribList, &chosenConfig, 1, &numConfigs));
-	RDebug::Printf("CEGLRendering::ConstructL 3");
-	if (numConfigs == 0)
-		{
-		RDebug::Printf("No matching configs found", eglQueryString(iDisplay, EGL_EXTENSIONS));
-		User::Leave(KErrNotSupported);
-		}
-	
-	// Create window surface to draw direct to.
-	EGLCheckReturnError(eglBindAPI(EGL_OPENVG_API));
-	RDebug::Printf("CEGLRendering::ConstructL 4");
-	iSurface = eglCreateWindowSurface(iDisplay, chosenConfig, &iWindow, NULL);
-	RDebug::Printf("CEGLRendering::ConstructL 5");
-	EGLCheckError();
-
-	TInt redSize, greenSize, blueSize, alphaSize;
+    RDebug::Printf("[EBT] CEGLRendering::EglSetupL eglGetConfigAttrib");
+    TInt redSize, greenSize, blueSize, alphaSize;
+    EGLCheckReturnError(eglGetConfigAttrib(iDisplay, chosenConfig, EGL_ALPHA_SIZE, &alphaSize));
+    EGLCheckReturnError(eglGetConfigAttrib(iDisplay, chosenConfig, EGL_RED_SIZE, &redSize));
+    EGLCheckReturnError(eglGetConfigAttrib(iDisplay, chosenConfig, EGL_GREEN_SIZE, &greenSize));
+    EGLCheckReturnError(eglGetConfigAttrib(iDisplay, chosenConfig, EGL_BLUE_SIZE, &blueSize));
+    RDebug::Printf("[EBT] CEGLRendering::EglSetupL id:%d alpha:%d red:%d green:%d blue:%d",
+                   chosenConfig, alphaSize, redSize, greenSize, blueSize);
 
-	EGLCheckReturnError(eglGetConfigAttrib(iDisplay, chosenConfig, EGL_ALPHA_SIZE, &alphaSize));
-	EGLCheckReturnError(eglGetConfigAttrib(iDisplay, chosenConfig, EGL_RED_SIZE, &redSize));
-	EGLCheckReturnError(eglGetConfigAttrib(iDisplay, chosenConfig, EGL_GREEN_SIZE, &greenSize));
-	EGLCheckReturnError(eglGetConfigAttrib(iDisplay, chosenConfig, EGL_BLUE_SIZE, &blueSize));
-	RDebug::Print(_L("EGLConfig id:%d alpha:%d red:%d green:%d blue:%d"), chosenConfig,
-			alphaSize, redSize, greenSize, blueSize);
-	RDebug::Printf("CEGLRendering::ConstructL 6");
+    RDebug::Printf("[EBT] CEGLRendering::EglSetupL eglCreateContext");
+    iContext = eglCreateContext(iDisplay, chosenConfig, EGL_NO_CONTEXT, NULL);
+    EGLCheckError();
 
-	// Create context to store surface settings
-	iContextVG = eglCreateContext(iDisplay, chosenConfig, EGL_NO_CONTEXT, NULL);
-	RDebug::Printf("CEGLRendering::ConstructL 7");
-	EGLCheckError();
-	
-	CEGLRendering::EGLCheckReturnError(eglMakeCurrent(iDisplay, iSurface, iSurface, iContextVG));
-	RDebug::Printf("CEGLRendering::ConstructL 8");
+    RDebug::Printf("[EBT] CEGLRendering::EglSetupL eglMakeCurrent");
+    CEGLRendering::EGLCheckReturnError(eglMakeCurrent(iDisplay, iSurface, iSurface, iContext));
+    }
 
-    // Now try and draw a line (blue)
-    static VGubyte const starSegments[] = 
+void CEGLRendering::VgSetup()
+    {
+    static VGubyte const Segments[] =
         {
         VG_MOVE_TO_ABS,
         VG_LINE_TO_REL,
         VG_CLOSE_PATH
         };
-    
-    static VGfloat const starCoords[] = 
+
+    static VGfloat const Coords[] =
         {
         110, 35,
         50, 160,
         };
-        
-        
+
     VGfloat strokeColor[4]  = {1.f, 0.f, 0.f, 1.f};
+
+    RDebug::Printf("[EBT] CEGLRendering::VgSetup vgCreatePaint");
+    iVGPaint = vgCreatePaint();
+    VGCheckError();
+
+    RDebug::Printf("[EBT] CEGLRendering::VgSetup vgSetParameterX");
+    vgSetParameteri(iVGPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
+    VGCheckError();
+    vgSetParameterfv(iVGPaint, VG_PAINT_COLOR, 4, strokeColor);
+    VGCheckError();
     
-    VGPaint strokePaint = vgCreatePaint();
-
-    vgSetParameteri(strokePaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
-    vgSetParameterfv(strokePaint, VG_PAINT_COLOR, 4, strokeColor);
-    
-    VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD,
+    RDebug::Printf("[EBT] CEGLRendering::VgSetup vgCreatePath");
+    iVGPath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
                             VG_PATH_DATATYPE_F,
                             1.0f, // scale
                             0.0f, // bias
                             3,    // segmentCapacityHint
-                            4,   // coordCapacityHint
+                            4,    // coordCapacityHint
                             VG_PATH_CAPABILITY_ALL);
-                            
-    ASSERT(vgGetError() == VG_NO_ERROR);
-    RDebug::Printf("vgCreatePath");
+    VGCheckError();
+    
+    RDebug::Printf("[EBT] CEGLRendering::VgSetup vgAppendPathData");
+    vgAppendPathData(iVGPath, sizeof(Segments), Segments, Coords);
+    VGCheckError();
+    }
+
+void CEGLRendering::VgPaint()
+    {
+    RDebug::Printf("[EBT] CEGLRendering::VgPaint vgSetPaint");
+    vgSetPaint(iVGPaint, VG_STROKE_PATH);
+    VGCheckError();
     
-                            
-    vgAppendPathData(path, sizeof(starSegments), starSegments, starCoords);
-    ASSERT(vgGetError() == VG_NO_ERROR);
-    RDebug::Printf("vgAppendPathData");
+    RDebug::Printf("[EBT] CEGLRendering::VgPaint vgDrawPath");
+    vgDrawPath(iVGPath, VG_STROKE_PATH);
+    VGCheckError();
+
+    RDebug::Printf("[EBT] CEGLRendering::VgPaint eglSwapBuffers");
+    eglSwapBuffers(iDisplay, iSurface);
+    EGLCheckError();
+    }
+
+CEGLRendering::~CEGLRendering()
+    {
+    RDebug::Printf("[EBT] CEGLRendering::~CEGLRendering");
     
-    vgSetPaint(strokePaint, VG_STROKE_PATH);
-    
-    // Draw the star directly using the OpenVG API.
-    vgDrawPath(path, VG_FILL_PATH | VG_STROKE_PATH);
-    ASSERT(vgGetError() == VG_NO_ERROR);
-    RDebug::Printf("vgDrawPath");
-    
-    eglSwapBuffers(iDisplay, iSurface);
-    RDebug::Printf("eglSwapBuffers");
-    EGLCheckError();
-	}
+    Stop();
+
+    delete iTimer;
+
+    if (EGL_NO_CONTEXT != iContext)
+        {
+        EGLCheckReturnError(eglDestroyContext(iDisplay, iContext));
+        }
+
+    if (EGL_NO_SURFACE != iSurface)
+        {
+        EGLCheckReturnError(eglDestroySurface(iDisplay,iSurface));
+        }
 
+    // Call eglMakeCurrent() to ensure the surfaces and contexts are truly destroyed.
+    EGLCheckReturnError(eglMakeCurrent(iDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
+    EGLCheckReturnError(eglTerminate(iDisplay));
+    EGLCheckReturnError(eglReleaseThread());
+
+    delete iBitmap;
+    }
+
+void CEGLRendering::Start()
+    {
+    // Start drawing the screen periodically
+    iTimer->Start(0, KTimerDelay, TCallBack(TimerCallBack, this));
+    }
+
+void CEGLRendering::Stop()
+    {
+    if(iTimer)
+        {
+        iTimer->Cancel();
+        }
+    }
 
 /** Update the display */
 void CEGLRendering::UpdateDisplay()
@@ -273,7 +261,7 @@
 /** Callback called by refresh timer */
 TInt CEGLRendering::TimerCallBack(TAny* aDemo)
 	{
-	
 	static_cast<CEGLRendering*>(aDemo)->UpdateDisplay();
 	return KErrNone;
 	}
+
--- a/egl/sfegltest/src/main.cpp	Fri Oct 22 11:59:21 2010 +0100
+++ b/egl/sfegltest/src/main.cpp	Fri Oct 22 22:19:05 2010 +0100
@@ -23,100 +23,49 @@
 // Amount of time for which to run the app
 static const TInt KAppRunDuration = 5000000;
 
-class CWsRedrawHandler;
-
 class CWsCanvas: public CBase
 {
 public:
 	static CWsCanvas* NewL(TInt, const TPoint&);
 	~CWsCanvas();
 
-	void DrawNow();
-	void Redraw();
-	void Draw(const TRect&);
+	RWsSession& Session() { return iWs; }
+	RWindow& Window() { return iWin; }
+    const TSize& ScreenSize() const { return iSz; }
 
-	RWsSession& Session() {return iWs;}
-	RWindow& Window() {return iWin;}
-	RWindowGroup& Group() {return iGrp;}
-	CWindowGc* Gc() {return iGc;}
-	CWsScreenDevice* Screen() {return iScr;}
-    inline TSize ScreenSize() const;
-	
 private:
 	CWsCanvas(TInt, const TPoint&);
 	void ConstructL();
-	
+
 private:
-    TInt iScrId;
-	TPoint iPos;
+    const TInt iScrId;
+	const TPoint iPos;
 	TSize iSz;
 	RWsSession iWs;
 	RWindowGroup iGrp;
 	RWindow iWin;
 	CWsScreenDevice* iScr;
 	CWindowGc* iGc;
-	CWsRedrawHandler* iRedrawHandler;
 };
 
-class CWsRedrawHandler: public CActive
-{
-public:
-	CWsRedrawHandler(CWsCanvas&);
-	~CWsRedrawHandler();
-	
-	void RunL();
-	void DoCancel();
-	
-private:
-	CWsCanvas& iCanvas;	
-};
-
-class CWsApp: public CBase
-    {
-public:
-	static CWsApp* NewL();
-	~CWsApp();
-	void Start();
-	void Stop();
-	
-private:
-	static TInt TimerCallBack(TAny* aApp);
-
-private:
-	CWsApp();
-    void ConstructL();
-    
-    CPeriodic* iTimer;
-    CWsCanvas* iAppView;    
-	CEGLRendering* iDemo;	
-	TBool iCallWindow;	
-	
-    TPoint iQvgaPos;
-    TPoint iQhdPos;
-	TBool iQhd;
-	TPoint iPos;
-	TSize iSz;
-	TInt iScrId;
-    };
-
 /**
  * Create a canvas to draw to.
- * 
+ *
  * @param aScrId	Screen number to use
  * @param aPos		Position on screen to use
  */
 CWsCanvas* CWsCanvas::NewL(TInt aScrId, const TPoint& aPos)
 	{
-	CWsCanvas* c = new(ELeave) CWsCanvas(aScrId, aPos);
-	CleanupStack::PushL(c);
-	c->ConstructL();
-	CleanupStack::Pop(c);
-
-	return c;
+	CWsCanvas* self = new (ELeave) CWsCanvas(aScrId, aPos);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
 	}
 
-CWsCanvas::CWsCanvas(TInt aScrId, const TPoint& aPos):
-	iScrId(aScrId), iPos(aPos)
+CWsCanvas::CWsCanvas(TInt aScrId, const TPoint& aPos)
+    :   iScrId(aScrId)
+    ,   iPos(aPos)
 	{
 	}
 
@@ -126,18 +75,17 @@
 	delete iScr;
 	iGrp.Close();
 	iWin.Close();
-	delete iRedrawHandler;
 	iWs.Close();
 	}
 
 /**
  * Construct the application canvas.
- * 
+ *
  * Here we setup the collaboration with the Window Server.  We want to get a window
  * on the appropriate screen, and setup a redraw handler so we can re-paint our window
  * when the Window Server wants us to.
  */
-void CWsCanvas::ConstructL()	
+void CWsCanvas::ConstructL()
 	{
 	TInt err = iWs.Connect();
 	User::LeaveIfError(err);
@@ -148,7 +96,7 @@
 
 	err = iScr->CreateContext(iGc);
 	User::LeaveIfError(err);
-	
+
 	iGrp = RWindowGroup(iWs);
 	err = iGrp.Construct(0xbadf00d, ETrue, iScr);
 	User::LeaveIfError(err);
@@ -156,114 +104,69 @@
 	iWin = RWindow(iWs);
 	err = iWin.Construct(iGrp, (TUint32)this);
 	User::LeaveIfError(err);
-	
+
 	iSz = iScr->SizeInPixels();
 	iWin.SetExtent(iPos, iSz);
 	iWin.SetBackgroundColor();
 	iWin.Activate();
-	
-	iWs.Flush();
-
-	iRedrawHandler = new(ELeave) CWsRedrawHandler(*this);
-	iWs.SetFocusScreen(iScrId);
-	}
-
-void CWsCanvas::DrawNow()
-	{
-	iWin.Invalidate();
-	Redraw();
-	}
-
-void CWsCanvas::Redraw()
-	{
-	iWin.BeginRedraw();
-	iGc->Activate(iWin);
-	Draw(TRect(TPoint(), iSz));
-	iGc->Deactivate();
-	iWin.EndRedraw();
 
 	iWs.Flush();
-	}
 
-void CWsCanvas::Draw(const TRect& /*aRect*/)
-	{
-	}
-
-inline TSize CWsCanvas::ScreenSize() const
-    {
-    return iSz;
-    }
-
-CWsRedrawHandler::CWsRedrawHandler(CWsCanvas& aCanvas):
-        CActive(CActive::EPriorityStandard),
-        iCanvas(aCanvas)
-	{
-	CActiveScheduler::Add(this);
-	
-	iStatus = KRequestPending;	
-	iCanvas.Session().RedrawReady(&iStatus);
-	SetActive();
-	}
-
-CWsRedrawHandler::~CWsRedrawHandler()
-	{
-	Cancel();
+	iWs.SetFocusScreen(iScrId);
 	}
+	
+class CWsApp : public CBase
+    {
+public:
+    static CWsApp* NewL();
+    ~CWsApp();
+    void Start();
+    void Stop();
 
-void CWsRedrawHandler::RunL()
-	{
-	TWsRedrawEvent e;
-	iCanvas.Session().GetRedraw(e);
-	if (e.Handle() == (TInt) &iCanvas)
-		{
-		iCanvas.Redraw();		
-		}
+private:
+    static TInt TimerCallBack(TAny* aApp);
 
-	iStatus = KRequestPending;
-	iCanvas.Session().RedrawReady(&iStatus);
-	SetActive();
-	}
+private:
+    CWsApp();
+    void ConstructL();
 
-void CWsRedrawHandler::DoCancel()
-	{
-	iCanvas.Session().RedrawReadyCancel();
-	}
+private:
+    CPeriodic* iTimer;
+    CWsCanvas* iAppView;
+    CEGLRendering* iDemo;
+    TPoint iPos;
+    TSize iSz;
+    TInt iScrId;
+    };
 
-
-CWsApp::CWsApp():
-	iQvgaPos(160,60),
-	iQhdPos(0,0),
-	iQhd(ETrue)
+CWsApp::CWsApp()
 	{
 	}
 
 CWsApp* CWsApp::NewL()
 	{
-	RDebug::Printf("CWsApp::NewL()");
-	CWsApp* app = new(ELeave) CWsApp;
-	CleanupStack::PushL(app);
-	app->ConstructL();
-	CleanupStack::Pop(app);
-	
-	return app;
+	RDebug::Printf("[EBT] CWsApp::NewL");
+	CWsApp* self = new (ELeave) CWsApp;
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
 	}
 
 /**
  * Constructor for CWsApp
- * 
+ *
  * @note This constructor looks at the command line argument, if any, supplied when
- * 		 launching the application.  If specified, its used as the screen number to
- * 		 target the output of the program.  By default, screen 0 is used.
+ *		 launching the application.  If specified, its used as the screen number to
+ *		 target the output of the program.  By default, screen 0 is used.
  */
 void CWsApp::ConstructL()
     {
-	RDebug::Printf("CWsApp::ConstructL()");
-	
+	RDebug::Printf("[EBT] CWsApp::ConstructL");
+
 	// Set a timer to stop the application after a short time
 	iTimer = CPeriodic::NewL(CActive::EPriorityIdle);
 	iTimer->Start(KAppRunDuration, KAppRunDuration, TCallBack(TimerCallBack,this));
-	
-    iPos = iQhd? iQhdPos : iQvgaPos;
 
 	iScrId = KDefaultScreenNo;
 	if (User::CommandLineLength() > 0)
@@ -272,81 +175,73 @@
 		User::CommandLine(arg);
 		iScrId = (TInt)(arg[0]-'0');
 		}
-	RDebug::Printf("CWsApp::ConstructL() 1");	    
+
+	RDebug::Printf("[EBT] CWsApp::ConstructL 1");
 	iAppView = CWsCanvas::NewL(iScrId, iPos);
-	RDebug::Printf("CWsApp::ConstructL() 2");	    
-	iDemo = CEGLRendering::NewL(iAppView->Window(), iQhd);
-	RDebug::Printf("CWsApp::ConstructL() 3");	    
+	RDebug::Printf("[EBT] CWsApp::ConstructL 2");
+	iDemo = CEGLRendering::NewL(iAppView->Window());
+	RDebug::Printf("[EBT] CWsApp::ConstructL 3");
 	iDemo->Start();
-	RDebug::Printf("CWsApp::ConstructL() 4");	    
-
+	RDebug::Printf("[EBT] CWsApp::ConstructL 4");
 	iSz = iAppView->ScreenSize();
-	RDebug::Printf("CWsApp::ConstructL() 5");	    
-
-	//Connstruct dialog Box
-	// Get a 212x76 pixel box in the centre of the window.
-	TRect rcDialog(TRect(iPos, iSz));
-
-#ifdef PORTRAIT_MODE
-	rcDialog.Shrink((rcDialog.Width() - 76) / 2, (rcDialog.Height() - 212) / 2);
-#else	
-	rcDialog.Shrink((rcDialog.Width() - 212) / 2, (rcDialog.Height() - 76) / 2);
-#endif
-
-	iCallWindow = EFalse;
+	RDebug::Printf("[EBT] CWsApp::ConstructL 5");
 	}
 
 TInt CWsApp::TimerCallBack(TAny* aApp)
     {
+    RDebug::Printf("[EBT] CWsApp::TimerCallBack");
     reinterpret_cast<CWsApp*>(aApp)->Stop();
     return KErrNone;
     }
 
 void CWsApp::Start()
 	{
-	RDebug::Printf("CWsApp::Start");
+	RDebug::Printf("[EBT] CWsApp::Start");
 	CActiveScheduler::Start();
 	}
 
 void CWsApp::Stop()
 	{
-	CActiveScheduler::Stop();
+    RDebug::Printf("[EBT] CWsApp::Stop");
+    CActiveScheduler::Stop();
 	}
 
 CWsApp::~CWsApp()
-	{	
+	{
+    RDebug::Printf("[EBT] CWsApp::~CWsApp");
 	delete iDemo;
+    RDebug::Printf("[EBT] CWsApp::~CWsApp 1");
 	delete iAppView;
+    RDebug::Printf("[EBT] CWsApp::~CWsApp 2");
 	delete iTimer;
+    RDebug::Printf("[EBT] CWsApp::~CWsApp 3");
 	}
 
 /**
  * Application second level entry point.
- * 
+ *
  * Launches the application specific class CWsApp and calls Start() on it.
- * 
+ *
  * @pre Active scheduler established.
  */
 void MainL()
 	{
-	RDebug::Printf("ebt ::MainL");
+	RDebug::Printf("[EBT] ::MainL");
 	CWsApp* app = CWsApp::NewL();
 	CleanupStack::PushL(app);
-
     app->Start();
-    
 	CleanupStack::PopAndDestroy(1, app);
 	}
 
 /**
  * Application entry point.
- * 
+ *
  * This sets up the application environment active scheduler and runs MainL under a trap
  * harness.
  */
 GLDEF_C TInt E32Main()
     {
-	RDebug::Printf("ebt ::E32Main");
+	RDebug::Printf("[EBT] ::E32Main");
 
 	CTrapCleanup* tc = CTrapCleanup::New();
 	if (!tc)
@@ -363,8 +258,9 @@
 
 	CActiveScheduler::Install(as);
 	TRAPD(err, MainL());
-	
+
 	delete as;
 	delete tc;
 	return err;
     }
+