graphicsdeviceinterface/screendriver/tsrc/TDirectScreenBitmap.cpp
changeset 0 5d03bc08d59c
child 26 15986eb6c500
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <e32test.h>
       
    17 #include <hal.h>
       
    18 #include <bitdraw.h>
       
    19 #include <bitdrawinterfaceid.h>
       
    20 #include <bitdrawsurface.h>
       
    21 #include "cdsb.h"
       
    22 #include <bitstd.h>
       
    23 #include <bitdev.h>
       
    24 #include "BMDRAW.H"
       
    25 
       
    26 #ifdef SYMBIAN_GRAPHICS_GCE
       
    27 #undef __WINS__
       
    28 #elif __WINS__
       
    29 #include "_WININC.H"
       
    30 #endif
       
    31 
       
    32 #include "TDirectScreenBitmap.h"
       
    33 
       
    34 enum 
       
    35 	{
       
    36 	WAIT_TIME = 1*400000
       
    37 	};
       
    38 
       
    39 class CCommonInterfaces
       
    40 	{
       
    41 public:
       
    42 	virtual ~CCommonInterfaces();
       
    43 	TBool ScreenClear();
       
    44 	TBool ScreenClearPartial();
       
    45 	TBool DrawColor(const TRect& aRect,const TRgb& aColour);
       
    46 	CCommonInterfaces(const TRect& aRect, const TDisplayMode& aDispMode,CDirectScreenBitmap* aDSBitmap);
       
    47 	void BeginDraw();
       
    48 	void EndDraw(TRequestStatus& aStatus);
       
    49 	void EndDraw(const TRect& aRect, TRequestStatus& aStatus);
       
    50 	void Drawing(const TRect& aRect);
       
    51 	void DrawColour64KPixel(TInt aX,TInt aY, const TRgb& aColour);
       
    52 
       
    53 protected:
       
    54 	TRect iRect;
       
    55 	TDisplayMode iDispMode;
       
    56    	CDirectScreenBitmap* iDSBitmap;
       
    57    	TAcceleratedBitmapInfo iBitmapInfo;
       
    58    	TBool iDrawingRed;
       
    59 	};
       
    60 
       
    61 CCommonInterfaces::CCommonInterfaces(const TRect& aRect, const TDisplayMode& aDispMode,CDirectScreenBitmap* aDSBitmap):iRect(aRect),iDispMode(aDispMode),iDSBitmap(aDSBitmap),iDrawingRed(ETrue)
       
    62 	{
       
    63 	}
       
    64 
       
    65 CCommonInterfaces::~CCommonInterfaces()
       
    66 	{
       
    67 	
       
    68 	}
       
    69 
       
    70 /** If the display mode of iBitmapInfo is not expected, return EFalse
       
    71  * or render to the back buffer and returns ETrue
       
    72 */
       
    73 TBool CCommonInterfaces::DrawColor(const TRect& aRect,const TRgb& aColour)
       
    74 	{
       
    75 	TRect local = TRect(aRect.iTl-iRect.iTl, aRect.Size());
       
    76 	TUint16* pBuffer16;
       
    77 	TUint32* pBuffer32;
       
    78 
       
    79 	if (iBitmapInfo.iDisplayMode != iDispMode)
       
    80 		{
       
    81 		return EFalse;
       
    82 		}
       
    83 	for (TInt y = local.iTl.iY; y < local.iBr.iY; y++)
       
    84 		{
       
    85 		for (TInt x = local.iTl.iX; x < local.iBr.iX; x++)
       
    86 			{
       
    87 			switch (iDispMode)
       
    88 				{
       
    89 				case EColor64K:
       
    90 					pBuffer16 = (TUint16*)iBitmapInfo.iAddress;
       
    91 					pBuffer16[y*iBitmapInfo.iLinePitch/2+x] = aColour._Color64K();
       
    92 					break;
       
    93 				case EColor16M:
       
    94 					pBuffer16 = (TUint16*)iBitmapInfo.iAddress;
       
    95 					pBuffer16[y*iBitmapInfo.iLinePitch/2+x] = aColour._Color64K();
       
    96 					break;
       
    97 				case EColor16MU:
       
    98 					pBuffer32 = (TUint32*)iBitmapInfo.iAddress;
       
    99 					pBuffer32[y*iBitmapInfo.iLinePitch/4+x] = aColour._Color16MU();
       
   100 					break;
       
   101 				case EColor16MA:
       
   102 					pBuffer32 = (TUint32*)iBitmapInfo.iAddress;
       
   103 					pBuffer32[y*iBitmapInfo.iLinePitch/4+x] = aColour._Color16MA();
       
   104 					break;
       
   105 				case EColor4K:
       
   106 					pBuffer16 = (TUint16*)iBitmapInfo.iAddress;
       
   107 					pBuffer16[y*iBitmapInfo.iLinePitch/2+x] = aColour._Color4K();
       
   108 					break;
       
   109 				case EColor16MAP:
       
   110 					pBuffer32 = (TUint32*)iBitmapInfo.iAddress;
       
   111 					pBuffer32[y*iBitmapInfo.iLinePitch/4+x] = aColour._Color16MAP();
       
   112 					break;
       
   113 				default:
       
   114 					break;
       
   115 				}
       
   116 			}
       
   117 		}
       
   118 	return ETrue;
       
   119 	}
       
   120 
       
   121 TBool CCommonInterfaces::ScreenClear()
       
   122 	{
       
   123     iDSBitmap->BeginUpdate(iBitmapInfo);
       
   124     TBool ret= DrawColor(iRect, KRgbWhite);
       
   125     if (ret)
       
   126     	{
       
   127         TRequestStatus requestStatus;
       
   128         iDSBitmap->EndUpdate(requestStatus);	
       
   129     	}
       
   130     return ret;
       
   131 	}
       
   132 
       
   133 TBool CCommonInterfaces::ScreenClearPartial()
       
   134 	{
       
   135     iDSBitmap->BeginUpdate(iBitmapInfo);
       
   136     TBool ret= DrawColor(iRect, KRgbWhite);
       
   137     if (ret)
       
   138     	{
       
   139         TRequestStatus requestStatus;
       
   140         iDSBitmap->EndUpdate(iRect,requestStatus);	
       
   141     	}
       
   142     return ret;
       
   143 	}
       
   144 
       
   145 void CCommonInterfaces::BeginDraw()
       
   146     {
       
   147     iDSBitmap->BeginUpdate(iBitmapInfo);       
       
   148     }
       
   149 
       
   150 void CCommonInterfaces::EndDraw(TRequestStatus& aStatus)
       
   151     {
       
   152      iDSBitmap->EndUpdate(aStatus);       
       
   153     }
       
   154 
       
   155 void CCommonInterfaces::EndDraw(const TRect& aRect, TRequestStatus& aStatus)
       
   156 	{
       
   157     iDSBitmap->EndUpdate(aRect,aStatus);       
       
   158 	}
       
   159 
       
   160 
       
   161 void CCommonInterfaces::Drawing(const TRect& aRect)
       
   162 	{
       
   163     if (iDrawingRed)
       
   164     	{
       
   165     	DrawColor(aRect,KRgbRed);
       
   166     	iDrawingRed = EFalse;
       
   167     	}
       
   168     else
       
   169     	{
       
   170     	DrawColor(aRect,KRgbBlack);
       
   171     	iDrawingRed = ETrue;
       
   172     	}
       
   173      }
       
   174 
       
   175 void CCommonInterfaces::DrawColour64KPixel(TInt aX,TInt aY, const TRgb& aColour) 
       
   176 	{ 
       
   177 	TUint16 *pBuffer = (TUint16*)iBitmapInfo.iAddress; 
       
   178 	pBuffer[aY*iBitmapInfo.iLinePitch/2+aX] = aColour._Color64K(); 
       
   179 	}
       
   180 
       
   181 class CRendering : public CActive, public CCommonInterfaces
       
   182     {
       
   183  	public:
       
   184  		static CRendering* NewL(const TRect& aRect, const TDisplayMode& aDispMode, CDirectScreenBitmap* aDSBitmap,CDirectScreenBitmap::TSettingsFlags aSettings);
       
   185  		void ProcessFrame();
       
   186  		void EndDraw();
       
   187  		virtual ~CRendering();
       
   188  	protected: // from CActive
       
   189     
       
   190     	void DoCancel();
       
   191     	void RunL();
       
   192     
       
   193     private:
       
   194     
       
   195     	CRendering(const TRect& aRect, const TDisplayMode& aDispMode,CDirectScreenBitmap* aDSBitmap,CDirectScreenBitmap::TSettingsFlags aSettings);
       
   196     	void ConstructL();
       
   197     	
       
   198     private:
       
   199     	
       
   200     	TAcceleratedBitmapInfo iBitmapInfo;
       
   201     	TInt iFrames;	
       
   202     	CDirectScreenBitmap::TSettingsFlags iSettings;
       
   203    
       
   204     };
       
   205 
       
   206 CRendering* CRendering::NewL(const TRect& aRect, const TDisplayMode& aDispMode,CDirectScreenBitmap* aDSBitmap, CDirectScreenBitmap::TSettingsFlags aSettings)
       
   207 	{
       
   208 	CRendering * rendering = new (ELeave) CRendering(aRect, aDispMode, aDSBitmap, aSettings);
       
   209 	CleanupStack::PushL(rendering);
       
   210 	rendering->ConstructL();
       
   211 	CleanupStack::Pop(rendering);
       
   212 	return rendering;
       
   213 	}
       
   214 
       
   215 CRendering::~CRendering()
       
   216     {
       
   217     // "Cancel" is a meaningless call, since the service 
       
   218     // (video driver's screen update process) is not cancellable.
       
   219     // When destroying this active object, you must make sure, 
       
   220     // that the last update request (CDirectScreenBitmap::EndUpdate()) is completed.
       
   221     // Assuming that LCD refresh rate is not less than 60 Hz,
       
   222     // the wait time should be more than 1/60 secs.
       
   223     // (Otherwise a stay signal comes.)
       
   224     User::After(WAIT_TIME); // to let the GCE return a valid request notification back to CDSB
       
   225     						// or surface update panics with EUpdateServPanicDataIntegrity
       
   226     Cancel();
       
   227     }
       
   228  
       
   229 CRendering::CRendering(const TRect& aRect, const TDisplayMode& aDispMode, CDirectScreenBitmap* aDSBitmap,CDirectScreenBitmap::TSettingsFlags aSettings)
       
   230 :CActive( CActive::EPriorityStandard ),CCommonInterfaces(aRect,aDispMode,aDSBitmap),iFrames(0),iSettings(aSettings)
       
   231     {
       
   232     }
       
   233 
       
   234 
       
   235 void CRendering::ConstructL()
       
   236     {
       
   237     CActiveScheduler::Add( this );
       
   238     // clear the screen, and also check the display mode of iBitmapInfo is the same as expected
       
   239     // If not, stop creating the CRendering object. 
       
   240     TBool ret = (iSettings & CDirectScreenBitmap::EIncrementalUpdate) ? ScreenClearPartial() : ScreenClear();
       
   241     if (!ret)
       
   242     	{
       
   243     	User::Leave(KErrGeneral);
       
   244     	}
       
   245     }
       
   246 
       
   247 void CRendering::RunL()
       
   248     {
       
   249     // Video driver finished to draw the last frame on the screen
       
   250     // You may initiate rendering the next frame from here, 
       
   251     // but it would be slow, since there is a delay between CDirectScreenBitmap::EndUpdate() 
       
   252     // and the completition of screen refresh by the video driver	
       
   253     if (iFrames++ <200)
       
   254     	{
       
   255     	ProcessFrame();
       
   256       	}
       
   257     else
       
   258     	{
       
   259     	CActiveScheduler::Stop();
       
   260     	}      
       
   261     }
       
   262  
       
   263 void CRendering::DoCancel()
       
   264     {
       
   265     // Cancel not implemented in service provider, so we can't do anything here
       
   266     }
       
   267  
       
   268 
       
   269 void CRendering::EndDraw()
       
   270     {
       
   271     if (IsActive())
       
   272     	{
       
   273     	Cancel();
       
   274     	}
       
   275     CCommonInterfaces::EndDraw(iStatus);
       
   276     SetActive();
       
   277     }
       
   278  
       
   279 void CRendering::ProcessFrame()
       
   280     {
       
   281     BeginDraw();
       
   282     Drawing(iRect);
       
   283     EndDraw();
       
   284     }
       
   285 
       
   286 
       
   287 //A largely visual test to demonstrate regional refreshing of DirectScreenBitmaps and the correct display function
       
   288 //of the Emulator.
       
   289 class CTDirectScreenBitmap : public CTGraphicsBase
       
   290 	{
       
   291 	public:	
       
   292 		~CTDirectScreenBitmap();
       
   293 		void ConstructL(const TRect &aScreenRect, const CDirectScreenBitmap::TSettingsFlags aSettings,TInt aScreenNo=0);	
       
   294 		void Close();
       
   295 		void DoRefreshCycle(void);
       
   296 		void TestOrientRefresh(CFbsDrawDevice *aDev);
       
   297 		void TestRefreshingWindowsL();
       
   298 		void ExhaustiveTestMergeL(TBool aInSrcPreMul,TBool aInDestPreMul,TBool aOutDestPreMul,TInt aStepSize=1,TInt aChannelControl=1);
       
   299 		void ExhaustiveTestMergePerDispModeL(TDisplayMode aDrawDeviceDispMode, TBool aInSrcPreMul,TBool aInDestPreMul,TBool aOutDestPreMul,TInt aStepSize=1,TInt aChannelControl=1,TInt aOtherChannels=0,TDisplayMode aTestMode=EColor16MA);
       
   300  		void LogColourEvent(TInt aPreMulDestPixColor,TInt aNonPreMulDestPixColor,TInt aPreMulSrcPixelColor,TInt aNonPreMulSrcPixelColor,TReal aVal1,TReal aVal2,TReal aVal3,TRefByValue<const TDesC> aMsg,TBool aErr);
       
   301  		void TestContinuousRefreshingL();
       
   302  		void TestRefreshingTimeL();
       
   303 	private:
       
   304 	    void TestRefreshingWindowsPerDisplayModeL(TDisplayMode aDisplayMode);
       
   305 		void TestContinuousRefreshingPerDisplayModeL(const TDisplayMode& aDisplayMode);
       
   306 		void UpdateFrame();
       
   307 		void MeasureFrame(const TRect &aScreenRect);
       
   308 	    CDirectScreenBitmap::TSettingsFlags iSettings;
       
   309 		CDirectScreenBitmap* iDirectScreenBitmap;
       
   310 		TAcceleratedBitmapInfo iBitmapInfo;
       
   311 		TRequestStatus iRequestStatus;
       
   312 		TRect iFullRect;
       
   313 		TRect iTopLeft;
       
   314 		TRect iTopRight;
       
   315 		TRect iBotLeft; 
       
   316 		TRect iBotRight;
       
   317 		TRect iMiddle;
       
   318 		TInt iScreenType;
       
   319 		CCommonInterfaces* iInterface; 
       
   320 		CRendering* iRendering;
       
   321 	public:
       
   322 		CTDirectScreenBitmap();
       
   323 		CTDirectScreenBitmap(CTestStep* aStep);
       
   324 	protected:
       
   325 	//from 	CTGraphicsStep
       
   326 		virtual void RunTestCaseL(TInt aCurTestCase);
       
   327 	private:
       
   328 		TDisplayMode iDispMode;
       
   329 		TInt iFreq;			// For measuring the average time per frame
       
   330 	    TReal iMeasure ;
       
   331 	    TUint32 iTimeBefore;
       
   332 	    TUint32 iTimeAfter;
       
   333 
       
   334 	};
       
   335 
       
   336 /**
       
   337 The runtime code currently contains a special case when dest starts unmultipled and ends premultiplied. 
       
   338 When src alpha is 0 the dest colour is simply passed through, not converted from unmultiplied to premultiplied. 
       
   339 That causes this fn to record errors, that will get ignored 
       
   340 for all source mask (srcMask==0), and most values of bkgrdChannel.
       
   341 */
       
   342 class TIgnoreSpecialCases  
       
   343 	{ 
       
   344 	public: 
       
   345 		TIgnoreSpecialCases (TBool aInSrcPreMul,TBool aInDestPreMul,TBool aOutDestPreMul) ;
       
   346 		bool operator()(TInt aPreMulDestPixColor,TInt aNonPreMulDestPixColor,TInt aSrcMask,TInt aSrcChannel);
       
   347 		TInt IgnoreCount();
       
   348 		TInt ExpectedIgnoreCount(TInt aFreq);
       
   349       private: 
       
   350 	      TInt iIgnoredCount; 
       
   351 	      TBool iDoIgnore; 
       
   352 	}; 
       
   353 
       
   354 CTDirectScreenBitmap::CTDirectScreenBitmap(CTestStep* aStep) :
       
   355 	CTGraphicsBase(aStep),iMeasure(0)
       
   356 	{
       
   357 	}
       
   358 	
       
   359 CTDirectScreenBitmap::~CTDirectScreenBitmap()
       
   360 	{
       
   361 	Close();
       
   362 	}
       
   363 	
       
   364 //Construct the DirectScreenBitmap and sub-rects for test of the refresh.	
       
   365 //Constructs a DirectScreenBitmap for EDoubleBuffer and EIncrementalUpdate
       
   366 void CTDirectScreenBitmap::ConstructL(const TRect &aScreenRect, const CDirectScreenBitmap::TSettingsFlags aSettings, TInt aScreenType)
       
   367 	{
       
   368 	Close();
       
   369 	iScreenType = aScreenType;
       
   370 	TInt Screenno;
       
   371 	if (iScreenType==CDirectScreenBitmap::EDoubleBuffer || iScreenType==CDirectScreenBitmap::EIncrementalUpdate)  
       
   372 		{
       
   373 		Screenno=iScreenType;
       
   374 		iDirectScreenBitmap = CDirectScreenBitmap::NewL(Screenno);
       
   375 		}
       
   376 	else
       
   377 		{
       
   378 		iDirectScreenBitmap = CDirectScreenBitmap::NewL();
       
   379 		}
       
   380 	iSettings = aSettings;
       
   381 	TInt create=iDirectScreenBitmap->Create(aScreenRect, aSettings);
       
   382 	if (create==KErrNone)
       
   383 		{
       
   384 		iFullRect	 = aScreenRect;
       
   385 		TPoint Pos	 = aScreenRect.iTl;
       
   386 		TSize hSize	 = TSize(aScreenRect.Width()/2, aScreenRect.Height()/2);
       
   387 		TSize hSizeX = TSize(aScreenRect.Width()/2, 0);
       
   388 		TSize hSizeY = TSize(0, aScreenRect.Height()/2);
       
   389 		TSize qSize	 = TSize(aScreenRect.Width()/4, aScreenRect.Height()/4);
       
   390 		
       
   391 		iTopLeft  = TRect(Pos,  hSize);
       
   392 		iTopRight = TRect(Pos + hSizeX, hSize);
       
   393 		iBotLeft  = TRect(Pos + hSizeY, hSize);	
       
   394 		iBotRight = TRect(Pos + hSize,  hSize);
       
   395 		iMiddle   = TRect(Pos + hSize - qSize,  hSize);
       
   396 
       
   397 		iInterface = new (ELeave) CCommonInterfaces(iFullRect, iDispMode, iDirectScreenBitmap);
       
   398 		iRendering = CRendering::NewL(iFullRect,iDispMode,iDirectScreenBitmap,iSettings);
       
   399 		}
       
   400 	else 
       
   401 		{
       
   402 		User::Leave(create);
       
   403 		}
       
   404 	}
       
   405 
       
   406 void CTDirectScreenBitmap::Close()
       
   407 	{
       
   408 	User::After(WAIT_TIME);
       
   409 	delete iDirectScreenBitmap;
       
   410 	iDirectScreenBitmap = NULL;
       
   411 	delete iInterface;
       
   412 	iInterface = NULL;
       
   413 	delete iRendering;
       
   414 	iRendering = NULL;
       
   415 	}
       
   416 
       
   417 
       
   418 //A refresh cycle fills a 2x2 region of RGBW rects and draws it to the screen. If the mode is incremental
       
   419 //The different colour rects are updated seperately to test the sub-region update.
       
   420 void CTDirectScreenBitmap::DoRefreshCycle(void)
       
   421 	{
       
   422 	if ((iSettings & CDirectScreenBitmap::EIncrementalUpdate)&&(!iInterface->ScreenClearPartial()))
       
   423 		{
       
   424 		INFO_PRINTF1(_L("The display mode of the iBitmapInfo is not expected"));
       
   425 		}
       
   426 	else if (!(iSettings & CDirectScreenBitmap::EIncrementalUpdate)&&(!iInterface->ScreenClear()))
       
   427 		{
       
   428 		INFO_PRINTF1(_L("The display mode of the iBitmapInfo is not expected"));
       
   429 		}
       
   430 	else 
       
   431 		{
       
   432 		iInterface->BeginDraw();
       
   433 		iInterface->DrawColor(iTopLeft,KRgbRed);
       
   434 		iInterface->DrawColor(iTopRight,KRgbGreen);
       
   435 		iInterface->DrawColor(iBotLeft,KRgbBlue);
       
   436 		iInterface->DrawColor(iBotRight,KRgbBlack);
       
   437 							
       
   438 		if (!(iSettings & CDirectScreenBitmap::EIncrementalUpdate))
       
   439 			{		
       
   440 			iInterface->EndDraw(iRequestStatus);	
       
   441 			User::After(WAIT_TIME);
       
   442 			}
       
   443 		else
       
   444 			{		
       
   445 			iInterface->EndDraw(iTopLeft, iRequestStatus);	
       
   446 			User::After(WAIT_TIME);
       
   447 			iInterface->BeginDraw();
       
   448 			iInterface->EndDraw(iTopRight, iRequestStatus);	
       
   449 			User::After(WAIT_TIME);
       
   450 			iInterface->BeginDraw();
       
   451 			iInterface->EndDraw(iBotLeft, iRequestStatus);	
       
   452 			User::After(WAIT_TIME);
       
   453 			iInterface->BeginDraw();
       
   454 			iInterface->EndDraw(iBotRight, iRequestStatus);	
       
   455 			User::After(WAIT_TIME);
       
   456 			
       
   457 			iInterface->DrawColor(iMiddle,KRgbCyan);
       
   458 			iInterface->BeginDraw();
       
   459 			iInterface->EndDraw(iMiddle, iRequestStatus);
       
   460 			User::After(WAIT_TIME);
       
   461 
       
   462 			}
       
   463 		__ASSERT_DEBUG(iInterface->ScreenClear(), User::Invariant());
       
   464 		}
       
   465 	}
       
   466 	
       
   467 //Tests the Orientation and Refresh operations
       
   468 void CTDirectScreenBitmap::TestOrientRefresh(CFbsDrawDevice *aDev)
       
   469 	{
       
   470 
       
   471 	MSurfaceId* surfaceIdInterface;
       
   472 	if (KErrNone != aDev->GetInterface(KSurfaceInterfaceID, reinterpret_cast <TAny*&> (surfaceIdInterface)))
       
   473 		{
       
   474 		// GCE is off
       
   475 		TBool orientations[4];
       
   476 		aDev->OrientationsAvailable(orientations);
       
   477 		if ((!orientations[0])&&(!orientations[1])&&(!orientations[2])&&(!orientations[3]))
       
   478 			{
       
   479 			INFO_PRINTF1(_L("TestOrientRefresh(): All 4 orientations not supported? (error for non-gce)"));
       
   480 			}
       
   481 		for (TUint i = 0; i<4; i++)
       
   482 			{
       
   483 			if (orientations[i])
       
   484 				{
       
   485 				if (aDev->SetOrientation((CFbsDrawDevice::TOrientation)i))
       
   486 					{
       
   487 					DoRefreshCycle();	
       
   488 					}
       
   489 				else                                                                                                                                                                                                                                   
       
   490 					{
       
   491 					TEST(EFalse);
       
   492 					}
       
   493 				}
       
   494 			}
       
   495 		aDev->SetOrientation((CFbsDrawDevice::TOrientation)0);
       
   496 		}
       
   497 	else
       
   498 		{
       
   499 		//GCE is on
       
   500 		TInt orientationAvailable = surfaceIdInterface->DeviceOrientationsAvailable();
       
   501 		for (TUint32 i = (TUint32)EDeviceOrientationNormal; i <= (TUint32)EDeviceOrientation270CW; i *= 2)
       
   502 			{
       
   503 			if (orientationAvailable&i)
       
   504 				{
       
   505 				surfaceIdInterface->SetDeviceOrientation((TDeviceOrientation)i);
       
   506 				DoRefreshCycle();	
       
   507 				}
       
   508 			}
       
   509 		surfaceIdInterface->SetDeviceOrientation(EDeviceOrientationNormal);
       
   510 		}
       
   511 	}	
       
   512 
       
   513 
       
   514 /** 
       
   515 @SYMTestCaseID GRAPHICS-CTDirectScreenBitmap-TestRefreshingWindowsL-0001
       
   516 @SYMDEF	PDEF103006
       
   517 @SYMTestCaseDesc Test orientation and Tests refreshing windows for various display modes
       
   518 on all type of screens( full screen non-incremental, full screen double buffer, full screen incremental,
       
   519 sub-region non incremental, sub region double-buffer, sub region incremental). 
       
   520 @SYMTestPriority Critical
       
   521 @SYMTestStatus Implemented
       
   522 @SYMTestActions Create a screen device for all type of screens. Set and test screen orientation 
       
   523 and finally test refreshing windows.
       
   524 @SYMTestExpectedResults
       
   525 The orientation and windows refresh test shall succeed on all screen type for various display mode
       
   526 **/ 
       
   527 void CTDirectScreenBitmap::TestRefreshingWindowsL()
       
   528 {     
       
   529 	 TestRefreshingWindowsPerDisplayModeL(EColor64K);
       
   530 	 TestRefreshingWindowsPerDisplayModeL(EColor16M);   
       
   531 	 TestRefreshingWindowsPerDisplayModeL(EColor16MU);
       
   532 	 TestRefreshingWindowsPerDisplayModeL(EColor16MA);
       
   533 	 TestRefreshingWindowsPerDisplayModeL(EColor4K);     	   
       
   534 	 TestRefreshingWindowsPerDisplayModeL(EColor16MAP); 	   
       
   535 }
       
   536 	
       
   537 /**
       
   538 Perform TestRefreshingWindowsL test as describe above for individual display mode type.
       
   539 @param aDisplayMode : relate to the window color mode to be displayed
       
   540 **/
       
   541 void CTDirectScreenBitmap::TestRefreshingWindowsPerDisplayModeL(TDisplayMode aDisplayMode)
       
   542 {
       
   543 	CFbsDrawDevice *pDev = NULL;	
       
   544 	iDispMode = aDisplayMode;
       
   545 		
       
   546 	TRAPD(err,pDev = CFbsDrawDevice::NewScreenDeviceL(0, aDisplayMode));
       
   547 	if (err)
       
   548 		{
       
   549 		INFO_PRINTF2(_L("Warning: Failed to create screen device for display mode %i - not supported on this config?"),aDisplayMode);
       
   550 
       
   551 		}
       
   552 	else
       
   553 		{
       
   554 		INFO_PRINTF2(_L("Testing RefreshingWindows for display mode %i"),aDisplayMode);
       
   555 		CleanupDeletePushL(pDev);
       
   556 		pDev->InitScreen();
       
   557 
       
   558 		TSize screenSize = pDev->SizeInPixels();
       
   559 		TRect directRect;
       
   560 		
       
   561 		directRect = TRect(TPoint(), screenSize);
       
   562 		//Full screen non-incremental run
       
   563 		INFO_PRINTF1(_L("Full screen non-incremental"));
       
   564 		TRAPD(err,ConstructL(directRect, CDirectScreenBitmap::ENone));
       
   565 		if (err)
       
   566 			{
       
   567 			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
       
   568 			}
       
   569 		else
       
   570 			{
       
   571 			TestOrientRefresh(pDev);
       
   572 			}
       
   573 	
       
   574 		//Full screen double buffer
       
   575 		INFO_PRINTF1(_L("Full screen double-buffer"));
       
   576 		TRAP(err,ConstructL(directRect,CDirectScreenBitmap::EDoubleBuffer,1));
       
   577 		if (err)
       
   578 			{
       
   579 			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
       
   580 			}
       
   581 		else
       
   582 			{
       
   583 			TestOrientRefresh(pDev);
       
   584 			}
       
   585 			
       
   586 		//Full screen incremental run
       
   587 		INFO_PRINTF1(_L("Full screen incremental"));
       
   588 		TRAP(err,ConstructL(directRect, CDirectScreenBitmap::EIncrementalUpdate,2));
       
   589 		if (err)
       
   590 			{
       
   591 			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
       
   592 			}
       
   593 		else
       
   594 			{
       
   595 			TestOrientRefresh(pDev);
       
   596 			}
       
   597 		
       
   598 		//Quarter screen non-incremental run
       
   599 		INFO_PRINTF1(_L("Sub region non-incremental"));
       
   600 		directRect = TRect(TPoint(screenSize.iWidth/2, screenSize.iHeight/2), TSize(screenSize.iWidth/2, screenSize.iHeight/2));
       
   601 		TRAP(err,	ConstructL(directRect, CDirectScreenBitmap::ENone));
       
   602 		if (err)
       
   603 			{
       
   604 			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
       
   605 			}
       
   606 		else
       
   607 			{
       
   608 			TestOrientRefresh(pDev);
       
   609 			}
       
   610 	
       
   611 		//Quarter screen double buffer
       
   612 		INFO_PRINTF1(_L("Sub region double-buffer"));
       
   613 		TRAP(err,ConstructL(directRect,CDirectScreenBitmap::EDoubleBuffer,1));
       
   614 		if (err)
       
   615 			{
       
   616 			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
       
   617 			}
       
   618 		else
       
   619 			{
       
   620 			TestOrientRefresh(pDev);
       
   621 			}
       
   622 						
       
   623 		//Quarter screen incremental run
       
   624 		INFO_PRINTF1(_L("Sub region incremental"));
       
   625 		TRAP(err,ConstructL(directRect, CDirectScreenBitmap::EIncrementalUpdate,2));
       
   626 		if (err)
       
   627 			{
       
   628 			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
       
   629 			}
       
   630 		else
       
   631 			{
       
   632 			TestOrientRefresh(pDev);
       
   633 			}
       
   634 			
       
   635 		CleanupStack::PopAndDestroy(pDev);
       
   636 		}
       
   637 }
       
   638 
       
   639 void CTDirectScreenBitmap::TestContinuousRefreshingL()
       
   640 	{
       
   641 	TestContinuousRefreshingPerDisplayModeL(EColor64K);
       
   642 	TestContinuousRefreshingPerDisplayModeL(EColor16M);   
       
   643 	TestContinuousRefreshingPerDisplayModeL(EColor16MU);
       
   644 	TestContinuousRefreshingPerDisplayModeL(EColor16MA);
       
   645 	TestContinuousRefreshingPerDisplayModeL(EColor4K);     	   
       
   646 	TestContinuousRefreshingPerDisplayModeL(EColor16MAP); 	 
       
   647 	}
       
   648 
       
   649 void CTDirectScreenBitmap::TestContinuousRefreshingPerDisplayModeL(const TDisplayMode& aDisplayMode)
       
   650 	{
       
   651 	
       
   652 	CFbsDrawDevice *pDev = NULL;	
       
   653 	iDispMode = aDisplayMode;
       
   654 		
       
   655 	TRAPD(err,pDev = CFbsDrawDevice::NewScreenDeviceL(0, aDisplayMode));
       
   656 	if (err)
       
   657 		{
       
   658 		INFO_PRINTF2(_L("Warning: Failed to create screen device for display mode %i - not supported on this config?"),iDispMode);
       
   659 
       
   660 		}
       
   661 	else
       
   662 		{
       
   663 		INFO_PRINTF2(_L("Testing Continuous Refreshing for display mode %i"),iDispMode);
       
   664 		CleanupDeletePushL(pDev);
       
   665 		User::LeaveIfError(pDev->InitScreen());
       
   666 
       
   667 		TSize screenSize = pDev->SizeInPixels();
       
   668 		TRect directRect;
       
   669 
       
   670 		// Quarter screen ENone
       
   671 		INFO_PRINTF1(_L("Consecutively update frames at left bottom corner and setting ENone"));
       
   672 		directRect = TRect(TPoint(0, screenSize.iHeight/2), TSize(screenSize.iWidth/2, screenSize.iHeight/2));
       
   673 		TRAPD(err,ConstructL(directRect, CDirectScreenBitmap::ENone));
       
   674 		if (err)
       
   675 			{
       
   676 			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
       
   677 			}
       
   678 		else
       
   679 			{
       
   680 			// use the same iDirectScreenBitmap as CTDirectScreenBitmap 
       
   681 			UpdateFrame();
       
   682 			}
       
   683 		// Quarter screen EDoubleBuffer
       
   684 		INFO_PRINTF1(_L("Consecutively update frames at up right corner and setting EDoubleBuffer"));
       
   685 		directRect = TRect(TPoint(screenSize.iWidth/2, 0), TSize(screenSize.iWidth/2, screenSize.iHeight/2));
       
   686 		TRAP(err,ConstructL(directRect,CDirectScreenBitmap::EDoubleBuffer,1));
       
   687 		if (err)
       
   688 			{
       
   689 			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
       
   690 			}
       
   691 		else
       
   692 			{
       
   693 			// use the same iDirectScreenBitmap as CTDirectScreenBitmap 
       
   694 			UpdateFrame();
       
   695 			}
       
   696 		// Quarter screen EIncremental
       
   697 		INFO_PRINTF1(_L("Consecutively update frames at right bottom corner and setting EIncremental"));
       
   698 		directRect = TRect(TPoint(screenSize.iWidth/2, screenSize.iHeight/2), TSize(screenSize.iWidth/2, screenSize.iHeight/2));
       
   699 		TRAP(err,ConstructL(directRect,CDirectScreenBitmap::EIncrementalUpdate,2));
       
   700 		if (err)
       
   701 			{
       
   702 			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
       
   703 			}
       
   704 		else
       
   705 			{
       
   706 			// use the same iDirectScreenBitmap as CTDirectScreenBitmap 
       
   707 			UpdateFrame();
       
   708 			}
       
   709 		
       
   710 		// Full screen EIncremental
       
   711 		INFO_PRINTF1(_L("Consecutively update frames at full screen and setting EIncremental"));
       
   712 		directRect = TRect(TPoint(0,0), screenSize);
       
   713 		TRAP(err,ConstructL(directRect,CDirectScreenBitmap::EIncrementalUpdate,2));
       
   714 		if (err)
       
   715 			{
       
   716 			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
       
   717 			}
       
   718 		else
       
   719 			{
       
   720 			// use the same iDirectScreenBitmap as CTDirectScreenBitmap 
       
   721 			UpdateFrame();
       
   722 			}
       
   723 		
       
   724 		// Full screen ENone
       
   725 		INFO_PRINTF1(_L("Consecutively update frames at full screen and setting ENone"));
       
   726 		directRect = TRect(TPoint(0,0), screenSize);
       
   727 		TRAP(err,ConstructL(directRect,CDirectScreenBitmap::ENone));
       
   728 		if (err)
       
   729 			{
       
   730 			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
       
   731 			}
       
   732 		else
       
   733 			{
       
   734 			// use the same iDirectScreenBitmap as CTDirectScreenBitmap 
       
   735 			UpdateFrame();
       
   736 			}
       
   737 		
       
   738 		// Full screen EDoubleBuffering
       
   739 		INFO_PRINTF1(_L("Consecutively update frames at full screen and setting EDoubleBuffering"));
       
   740 		directRect = TRect(TPoint(0,0), screenSize);
       
   741 		TRAP(err,ConstructL(directRect,CDirectScreenBitmap::EDoubleBuffer,1));
       
   742 		if (err)
       
   743 			{
       
   744 			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
       
   745 			}
       
   746 		else
       
   747 			{
       
   748 			// use the same iDirectScreenBitmap as CTDirectScreenBitmap 
       
   749 			UpdateFrame();
       
   750 			}
       
   751 		CleanupStack::PopAndDestroy(pDev);
       
   752 		}
       
   753 	}
       
   754 
       
   755 void CTDirectScreenBitmap::UpdateFrame()
       
   756 	{
       
   757 	iRendering->ProcessFrame();
       
   758 	CActiveScheduler::Start();
       
   759 	}
       
   760 
       
   761 void CTDirectScreenBitmap::MeasureFrame(const TRect &aScreenRect)
       
   762 	{
       
   763 	TInt count = 0;
       
   764 	iMeasure = 0;
       
   765 	while (count++<200)
       
   766 		{
       
   767 		__ASSERT_DEBUG(iInterface->ScreenClear(), User::Invariant());
       
   768 		iInterface->BeginDraw();
       
   769 		iInterface->Drawing(aScreenRect);
       
   770 		TRequestStatus status;
       
   771 		iTimeBefore = User::FastCounter();
       
   772 		iInterface->EndDraw(status);
       
   773 		iTimeAfter = User::FastCounter(); 
       
   774 		iMeasure += 1000 * ((TReal)(iTimeAfter - iTimeBefore)) / ((TReal) iFreq);
       
   775 		}
       
   776 	}
       
   777 
       
   778 void CTDirectScreenBitmap::TestRefreshingTimeL()
       
   779 	{
       
   780 	// As other display modes have been tested in other test cases
       
   781 	// Only EColor16MAP is tested here
       
   782 	CFbsDrawDevice *pDev = NULL;	
       
   783 	TDisplayMode aDisplayMode = EColor16MAP;
       
   784 	iDispMode = aDisplayMode;
       
   785 			
       
   786 	TRAPD(err,pDev = CFbsDrawDevice::NewScreenDeviceL(0, aDisplayMode));
       
   787 	if (err)
       
   788 		{
       
   789 		INFO_PRINTF2(_L("Warning: Failed to create screen device for display mode %i - not supported on this config?"),iDispMode);
       
   790 		}
       
   791 	else
       
   792 		{
       
   793 		INFO_PRINTF2(_L("Testing Continuous Refreshing for display mode %i"),iDispMode);
       
   794 		CleanupDeletePushL(pDev);
       
   795 		User::LeaveIfError(pDev->InitScreen());
       
   796 		TSize screenSize = pDev->SizeInPixels();
       
   797 		TRect directRect;
       
   798 
       
   799 		// Quarter screen ENone
       
   800 		INFO_PRINTF1(_L("Consecutively update frames at left bottom corner and setting ENone"));
       
   801 		directRect = TRect(TPoint(0, screenSize.iHeight/2), TSize(screenSize.iWidth/2, screenSize.iHeight/2));
       
   802 		TRAPD(err,ConstructL(directRect, CDirectScreenBitmap::ENone));
       
   803 		if (err)
       
   804 			{
       
   805 			INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
       
   806 			}
       
   807 		else
       
   808 			{
       
   809 			// use the same iDirectScreenBitmap as CTDirectScreenBitmap 
       
   810 		    User::LeaveIfError(HAL::Get(HALData::EFastCounterFrequency, iFreq));
       
   811 
       
   812 			MeasureFrame(directRect);
       
   813 			
       
   814 			INFO_PRINTF2(_L("The total time to render 200 frames is %f"),iMeasure);
       
   815 
       
   816 			}
       
   817 		CleanupStack::PopAndDestroy(pDev);
       
   818 
       
   819 		}
       
   820 	}
       
   821 
       
   822 // TIgnoreSpecialCases 
       
   823 /**
       
   824 The runtime code currently contains a special case when dest starts unmultipled and ends premultiplied. 
       
   825 When src alpha is 0 the dest colour is simply passed through, not converted from unmultiplied to premultiplied. 
       
   826 That causes this fn to record errors, that will get ignored for all Source Mask (srcMask==0), and most values of background channel(bkgrdChannel).
       
   827 */
       
   828 TIgnoreSpecialCases ::TIgnoreSpecialCases (TBool /*aInSrcPreMul*/,TBool aInDestPreMul,TBool aOutDestPreMul) 
       
   829 	{
       
   830   	iDoIgnore=(!aInDestPreMul && aOutDestPreMul); 
       
   831   	iIgnoredCount=0; 
       
   832   	} 
       
   833 	  
       
   834 /**
       
   835 The function returns true if the error should be ignored and  keeps the count of the no. of errors ignored.
       
   836 */	      
       
   837 bool TIgnoreSpecialCases ::operator()(TInt /*aPreMulDestPixColor*/,TInt /*aNonPreMulDestPixColor*/,TInt aSrcMask,TInt /*aSrcChannel*/)
       
   838 	{
       
   839 	if (!iDoIgnore || aSrcMask!=0)
       
   840 		{
       
   841 		return EFalse;
       
   842 		}
       
   843 	iIgnoredCount++;
       
   844 	return ETrue;
       
   845 	} 
       
   846 
       
   847 /**
       
   848 The function returns the no. of errors ignored.
       
   849 */
       
   850 TInt TIgnoreSpecialCases ::IgnoreCount()
       
   851 	{
       
   852 	return iIgnoredCount;
       
   853 	}
       
   854 
       
   855 /**
       
   856 If the special-case is generating ignored errors then it should generate at least this many
       
   857 If not generating errors then the count should be zero. Any other value should be noted to the log.
       
   858 */
       
   859 TInt TIgnoreSpecialCases ::ExpectedIgnoreCount(TInt aFreq)
       
   860 	{
       
   861 	TInt samples=240/aFreq;
       
   862 	return samples*samples*200*2; //This is an approximation.
       
   863 	}
       
   864 		
       
   865 /**
       
   866 This function is used to write to the log file
       
   867 @param  aNonPreMulDestPixColor non pre multiplied destination pixel colour
       
   868 @param  aPreMulSrcPixelColor pre multiplied source pixel colour
       
   869 @param  aNonPreMulSrcPixelColor	non pre multiplied source pixel colour
       
   870 @param  aVal1 it contains the value of the first variable of the message to be displayed
       
   871 @param  aVal2 it contains the value of the second variable of the message to be displayed
       
   872 @param  aVal3 it contains the value of the third variable of the message to be displayed
       
   873 @param  aMsg it contains the message to be printed to the log file
       
   874 @param  aErr if true then the test case fails, if false test passes. log is printed in both the case. TEST does not abort, just reports test case failure
       
   875 */
       
   876 void CTDirectScreenBitmap::LogColourEvent(TInt aPreMulDestPixColor,TInt aNonPreMulDestPixColor,TInt aPreMulSrcPixelColor,TInt aNonPreMulSrcPixelColor,TReal aVal1,TReal aVal2,TReal aVal3,TRefByValue<const TDesC> aMsg,TBool aErr)
       
   877 	{
       
   878 	TEST(aErr==EFalse); // if aErr=True, then the previous test step failed.
       
   879 	INFO_PRINTF4(aMsg,aVal1,aVal2,aVal3);
       
   880 	if (aNonPreMulSrcPixelColor<0)
       
   881 		{
       
   882 		INFO_PRINTF4(_L("Processing source colours for MDest=%i, CDest=%i, MSrc=%i"),aPreMulDestPixColor,aNonPreMulDestPixColor,aPreMulSrcPixelColor);
       
   883 		}
       
   884 	else
       
   885 		{
       
   886 		INFO_PRINTF5(_L("Processing colour set MDest=%i, CDest=%i, MSrc=%i, CSrc=%i"),aPreMulDestPixColor,aNonPreMulDestPixColor,aPreMulSrcPixelColor,aNonPreMulSrcPixelColor);
       
   887 		}
       
   888 	}
       
   889 	
       
   890 /** 
       
   891 @SYMTestCaseID GRAPHICS-CTDirectScreenBitmap-ExhaustiveTestMergeL-0001
       
   892 @SYMDEF	PDEF099416
       
   893 @SYMTestCaseDesc Test that the alpha merge methods work accurately
       
   894 @SYMTestPriority High
       
   895 @SYMTestStatus Implemented
       
   896 @SYMTestActions Create an alpha capable bitmap and throw sample values at the merge function
       
   897 @SYMTestExpectedResults
       
   898 1a)     The merge resultant alpha values do not wrap through 256
       
   899 1b)     The merge resultant alpha values closely match an equivalent floating-point calculation
       
   900 2a)     The merge resultant colours do not wrap through 256
       
   901 2b)     The merge resultant colours do not exceed the resultant alpha if premultiplied output is expected
       
   902 2c)     The merge resultant colours closely match an equivalent floating-point calculation
       
   903 
       
   904 Exhaustive test of Blend function for every pixel value. Tests combinations of source and destination
       
   905 colour and alpha for a particular colour channel (0=red, 1= green, 2=blue). This method emulates the merge
       
   906 operation in floating piont and compares the result with the real merge function. Generally the method is
       
   907 intended to error-test premultiplied or non-multiplied, or permutations, based on the flags aInSrcPreMul,
       
   908 aInDestPreMul,aOutDestPreMul.
       
   909 @param  aInSrcPreMul if true the source pixel colour will be clipped and treated as premultiplied
       
   910 @param  aInDestPreMul if true the destination pixel colour will be clipped and treated as premultiplied
       
   911 @param  aOutDestPreMul if true the calculated pixel colour will be clipped and treated as premultiplied
       
   912 @param  aStepSize specifies how many brightness levels are skipped. 1,3,5,15,17 are good values
       
   913 @param  aChannelControl which channel is controlled  (0=red, 1= green, 2=blue)
       
   914 @param  aOtherChannels value used for other channels. In PM modes this will be clipped to the mask value
       
   915 @param  aTestMode mode of bitmap device. I presume it is consistant with the PreMul flags above
       
   916 **/ 
       
   917 void  CTDirectScreenBitmap::ExhaustiveTestMergeL(TBool aInSrcPreMul,TBool aInDestPreMul,TBool aOutDestPreMul,
       
   918          TInt aStepSize,TInt aChannelControl)
       
   919 	{
       
   920 	ExhaustiveTestMergePerDispModeL(EColor64K,aInSrcPreMul,aInDestPreMul, aOutDestPreMul, aStepSize,aChannelControl);
       
   921 	ExhaustiveTestMergePerDispModeL(EColor4K,aInSrcPreMul,aInDestPreMul, aOutDestPreMul, aStepSize,aChannelControl);
       
   922 	ExhaustiveTestMergePerDispModeL(EColor16M,aInSrcPreMul,aInDestPreMul, aOutDestPreMul, aStepSize,aChannelControl);
       
   923 	ExhaustiveTestMergePerDispModeL(EColor16MU,aInSrcPreMul,aInDestPreMul, aOutDestPreMul, aStepSize,aChannelControl);
       
   924 	ExhaustiveTestMergePerDispModeL(EColor16MA,aInSrcPreMul,aInDestPreMul, aOutDestPreMul, aStepSize,aChannelControl);
       
   925 	ExhaustiveTestMergePerDispModeL(EColor16MAP,aInSrcPreMul,aInDestPreMul, aOutDestPreMul, aStepSize,aChannelControl);
       
   926 	}
       
   927 
       
   928 
       
   929 
       
   930 void CTDirectScreenBitmap::ExhaustiveTestMergePerDispModeL(TDisplayMode aDrawDeviceDispMode, TBool aInSrcPreMul,TBool aInDestPreMul,TBool aOutDestPreMul,
       
   931  		                                                                        TInt aStepSize,TInt aChannelControl,TInt aOtherChannels,
       
   932         	                                                                      TDisplayMode aTestMode)
       
   933 	{
       
   934 	CFbsDrawDevice *pDev = NULL;
       
   935 	iDispMode = aDrawDeviceDispMode;
       
   936 	TRAPD(err,pDev = CFbsDrawDevice::NewScreenDeviceL(0,aDrawDeviceDispMode));
       
   937 	if (err !=KErrNone)
       
   938 		{
       
   939 		INFO_PRINTF2(_L("Warning: Failed to create screen device for display mode %i - not supported on this config?"),iDispMode);
       
   940 		}
       
   941 	else
       
   942 		{
       
   943 		INFO_PRINTF2(_L("Test Exhaustive Merge for display mode %i "),iDispMode);
       
   944 		User::LeaveIfError(pDev->InitScreen());
       
   945 		pDev->SetAutoUpdate(ETrue);
       
   946 		TSize screenSize = pDev->SizeInPixels();
       
   947 
       
   948 		//Full screen non-incremental run
       
   949 		TRect directRect(TPoint(0, 0), screenSize);
       
   950 		INFO_PRINTF1(_L("PDEF099416: Test of pixel merge over full colour and alpha range"));
       
   951 		
       
   952 		TRAPD(err, ConstructL(directRect, CDirectScreenBitmap::ENone));
       
   953 		if (err)
       
   954 		   	{
       
   955 		   	delete pDev;
       
   956 		   	INFO_PRINTF1(_L("The Direct Screen Bitmap object is not created"));
       
   957 		   	}
       
   958 		else
       
   959 		   	{
       
   960 			if (!iInterface->ScreenClear())
       
   961 				{
       
   962 				INFO_PRINTF1(_L("The display mode of the iBitmapInfo is not expected"));
       
   963 				delete pDev; 
       
   964 				return;
       
   965 				}
       
   966 			else 
       
   967 				{
       
   968 				TSize bitmapSize(256,1);
       
   969 				TUint32 bitmapMem[256];
       
   970 				TUint32 srcLine[256];
       
   971 				CFbsDrawDevice* bmd = CFbsDrawDevice::NewBitmapDeviceL(bitmapSize, aTestMode, CFbsBitmap::ScanLineLength(256, aTestMode));
       
   972 				CleanupStack::PushL(bmd);
       
   973 				//initialize
       
   974 				bmd->SetAutoUpdate(EFalse);
       
   975 				bmd->SetBits(bitmapMem);
       
   976 				//Eveything printed to the screen is just to show the error levels graphically.
       
   977 				//Patterns are very interesting sometimes
       
   978 				if (screenSize.iHeight>200 && screenSize.iWidth>600)
       
   979 					{
       
   980 					iInterface->BeginDraw();
       
   981 					iInterface->DrawColor(TRect(260,0,290,30),TRgb(255,0,0));
       
   982 					iInterface->DrawColor(TRect(260,30,290,60),TRgb(100,0,0));
       
   983 					iInterface->DrawColor(TRect(260,60,290,90),TRgb(100,0,0));
       
   984 					iInterface->DrawColor(TRect(260,100,290,130),TRgb(0,255,0));
       
   985 					iInterface->DrawColor(TRect(260,130,290,160),TRgb(0,200,0));
       
   986 					iInterface->DrawColor(TRect(260,160,290,190),TRgb(0,100,0));
       
   987 					iInterface->DrawColor(TRect(560,100,590,130),TRgb(0,0,255));
       
   988 					iInterface->DrawColor(TRect(560,130,590,160),TRgb(0,0,200));
       
   989 					iInterface->DrawColor(TRect(560,160,590,190),TRgb(0,0,100));
       
   990 					iInterface->EndDraw(iRequestStatus);
       
   991 					}
       
   992 				//const
       
   993 				TInt channelMask;
       
   994 				if (aChannelControl<1)
       
   995 					{
       
   996 					channelMask=0x0000FF;	
       
   997 					}
       
   998 				else
       
   999 					{
       
  1000 					if(aChannelControl==1) 
       
  1001 						{
       
  1002 						channelMask=0x00FF00;	
       
  1003 						}
       
  1004 					else
       
  1005 						{
       
  1006 						channelMask=0xFF0000;	
       
  1007 						}
       
  1008 					}
       
  1009 				const TInt otherMask=0xFFFFFF^channelMask;
       
  1010 				const TInt channelMul=channelMask&0x01010101;
       
  1011 				const TInt addFactor=aOtherChannels & otherMask;        //Use to set the other colour channels with a fixed test value
       
  1012 				TInt passFlag=0;
       
  1013 						
       
  1014 				INFO_PRINTF3(_L("AddFactor pass: channel %i others %x "),aChannelControl,addFactor);
       
  1015 				passFlag=passFlag^0x8000;
       
  1016 				const TReal KIgnore=0.00000001;//0.3;
       
  1017 				const TReal KGross=1.51;
       
  1018 				const TReal KMultiplyErrorBrightness=200.0;
       
  1019 				TReal errMax=20;
       
  1020 				TReal errAMax256=0;
       
  1021 				TReal totErrCol=0;
       
  1022 				TReal totErrAlpha=0;
       
  1023 				TReal zeroErrCol=0;
       
  1024 				TReal zeroErrAlpha=0;
       
  1025 				TInt  countAlphas=0;
       
  1026 				TInt countColours=0;
       
  1027 				const TInt stepFactor=aStepSize;     //1, 3, 5, 15, 17;  //This has a ^3 effect on speed
       
  1028 				TIgnoreSpecialCases  ignoreSpecialCases(aInSrcPreMul,aInDestPreMul,aOutDestPreMul);
       
  1029 				//bkgrdMask is background mask/alpha input value
       
  1030 					
       
  1031 				for (TInt bkgrdMask=0;bkgrdMask<256;bkgrdMask+=stepFactor)
       
  1032 				    {
       
  1033 					TInt logLine=-1;
       
  1034 					iInterface->BeginDraw();
       
  1035 					iInterface->DrawColour64KPixel(270+bkgrdMask/screenSize.iHeight,bkgrdMask%screenSize.iHeight, TRgb(addFactor|passFlag));
       
  1036 					TInt maxChannels=256;
       
  1037 					if (aInDestPreMul)
       
  1038 						{
       
  1039 						maxChannels=bkgrdMask+1;	
       
  1040 						}
       
  1041 					TInt clippedother=((addFactor-((bkgrdMask*0x010101)&otherMask))>>8)&otherMask;
       
  1042 					//clippedother is now 0x00FF00FF or 0x00000000 (or 0x00FF0000 or 0x000000FF)
       
  1043 					clippedother=(addFactor&(clippedother^otherMask))|(((bkgrdMask*0x010101)&clippedother));
       
  1044 					//bkgrdChannel is background channel input value. In PM it is 0...bkgrdMask. In NP it is 0...255
       
  1045 					for (TInt bkgrdChannel=0,colour=(bkgrdMask<<24)|clippedother,stepChannel=stepFactor*channelMul;bkgrdChannel<maxChannels;bkgrdChannel+=stepFactor,colour+=stepChannel) 
       
  1046 						{
       
  1047 						TInt failsPerPass=10;
       
  1048 					    logLine++;
       
  1049 					    if (logLine>=screenSize.iHeight)
       
  1050 					       	{
       
  1051 					       	logLine=0;	
       
  1052 					       	}
       
  1053 					    //srcMask is the source mask/alpha
       
  1054 					    for (TInt srcMask=0;srcMask<256;srcMask+=stepFactor)                //0 and 255 are special cases, but need testing anyway!
       
  1055 					    	{
       
  1056 					        TInt maxChannels=256;     //nested
       
  1057 					        if (aInSrcPreMul)
       
  1058 					           	{
       
  1059 					           	maxChannels=srcMask+1;      //In PM-PM source colour passes through unchanged, so skip the tests	
       
  1060 					           	}
       
  1061 					        bmd->WriteRgbMulti(0,0,maxChannels,1,TRgb(colour,bkgrdMask),CGraphicsContext::EDrawModeWriteAlpha);
       
  1062 					        TInt clippedother=((addFactor-((srcMask*0x010101)&otherMask))>>8)&otherMask;
       
  1063 					        //clippedother is now 0x00FF00FF or 0x00000000 (or 0x00FF0000 or 0x000000FF)
       
  1064 					        clippedother=(addFactor&(clippedother^otherMask))|(((srcMask*0x010101)&clippedother));
       
  1065 
       
  1066 					        //srcChannel1 is the source  channel input value. In PM it is 0...srcMask. In NP it is 0...255
       
  1067 					        for (TInt srcChannel1=0,C=(srcMask<<24)+clippedother;srcChannel1<maxChannels;srcChannel1++,C+=channelMul)
       
  1068 					           	{
       
  1069 					            srcLine[srcChannel1]=C;
       
  1070 					            }
       
  1071 					        bmd->WriteLine(0,0,maxChannels,srcLine,CGraphicsContext::EDrawModePEN);
       
  1072 					        TReal errPos=0;
       
  1073 					        TReal errNeg=0;
       
  1074 					        TReal errGross=0;
       
  1075 					        TReal errAPos=0;
       
  1076 					        TReal errANeg=0;
       
  1077 					        TReal errAGross=0;
       
  1078 					        //source multiplier factor for alpha that can then be used to optimise non-multiplied input calculations.
       
  1079 					        TReal srcMultiplier=srcMask/255.0;
       
  1080 					        //destination/background multiplier factor for alpha that can then be used to optimise non-multiplied input calculations.
       
  1081 					        TReal destMultiplier=(bkgrdMask/255.0)*(1.0-srcMultiplier);
       
  1082 							//alphaPixelValue is the alpha pixel value as generated from the library code under test
       
  1083 					        TUint alphaPixelValue=bmd->ReadPixel(0,0).Alpha();
       
  1084 					        //alphaDiff is the difference in alpha between pixel and float calcuation, i.e. the error. This can be less than 1 level of brightness, i.e. insignificant.
       
  1085 					        TReal alphaDiff=0.0;
       
  1086 					        //pre-mul mode does not effect the alpha calculation
       
  1087 					        //alphaOutputValue is a floating-point calculation of the alpha output value using 255.0 as the scaling factor.
       
  1088 					        TReal alphaOutputValue=(srcMultiplier+destMultiplier)*255.0;
       
  1089 					        alphaDiff=alphaOutputValue-alphaPixelValue;
       
  1090 					        zeroErrAlpha+=alphaDiff;
       
  1091 					        if (alphaDiff>KIgnore || alphaDiff<-KIgnore)
       
  1092 					           	{
       
  1093 					           	if (alphaDiff>0)
       
  1094 					               	{
       
  1095 					                if (alphaDiff>KGross)
       
  1096 					                   	{
       
  1097 					                    if (--failsPerPass>0)
       
  1098 					                    	LogColourEvent(bkgrdMask,bkgrdChannel,srcMask,-1,alphaOutputValue,alphaPixelValue,alphaDiff,_L("Big Alpha error: expected %f, got %f"),ETrue);
       
  1099 					                    errAGross+=(alphaDiff-KIgnore)*KMultiplyErrorBrightness;
       
  1100 					                    }
       
  1101 					                else
       
  1102 					                   	{
       
  1103 					                   	errAPos+=(alphaDiff-KIgnore)*KMultiplyErrorBrightness;	
       
  1104 					                   	}
       
  1105 					                totErrAlpha+=alphaDiff;
       
  1106 					                }
       
  1107 					            else
       
  1108 					               	{
       
  1109 					                if(alphaDiff<-KGross)
       
  1110 					                  	{
       
  1111 					                   	if (--failsPerPass>0)
       
  1112 					                   		LogColourEvent(bkgrdMask,bkgrdChannel,srcMask,-1,alphaOutputValue,alphaPixelValue,alphaDiff,_L("Big Alpha error: expected %f, got %f"),ETrue);	
       
  1113 					                   	errAGross-=(alphaDiff+KIgnore)*KMultiplyErrorBrightness;
       
  1114 					                    }
       
  1115 					                else
       
  1116 					                   	{
       
  1117 					                   	errANeg-=(alphaDiff+KIgnore)*KMultiplyErrorBrightness;	
       
  1118 					                   	}
       
  1119 					                totErrAlpha-=alphaDiff;
       
  1120 					                }
       
  1121 					           	}
       
  1122 								TInt errA= STATIC_CAST(TInt,(errAPos-errANeg));
       
  1123 					            countAlphas++;
       
  1124 					            countColours+=maxChannels;
       
  1125 					            //The other channel values should not change while the tested channel is modulated...
       
  1126 					            //So I grab it's value for the zero case to compare.
       
  1127 					            TUint  otherChannels0=bmd->ReadPixel(0,0).Color16MA()&(otherMask|0xff000000);
       
  1128 
       
  1129 					            //srcChannel is the source  channel input value. In PM it is 0...srcMask. In NP it is 0...255
       
  1130 					            for (TInt srcChannel=0;srcChannel<maxChannels;srcChannel++)
       
  1131 					              	{
       
  1132 					                //channelOutputValue is a floating-point calculation of the channel output value using 255.0 as the scaling factor.
       
  1133 					                TReal channelOutputValue;
       
  1134 					                if (aInSrcPreMul)
       
  1135 					                  	{
       
  1136 					                   	channelOutputValue=srcChannel;	
       
  1137 					                   	}
       
  1138 					                else
       
  1139 					                  	{
       
  1140 					                   	channelOutputValue=srcChannel*srcMultiplier;	
       
  1141 					                   	}
       
  1142 					                    	
       
  1143 					                if (aInDestPreMul)
       
  1144 					                   	{
       
  1145 					                   	channelOutputValue+=bkgrdChannel*(1.0-srcMultiplier);	
       
  1146 					                   	}
       
  1147 					                else
       
  1148 					                   	{
       
  1149 					                   	channelOutputValue+=bkgrdChannel*destMultiplier;	
       
  1150 					                   	}
       
  1151 
       
  1152 					                if (!aOutDestPreMul)
       
  1153 					                   	{
       
  1154 					                   	if ((srcMultiplier+destMultiplier)!=0)
       
  1155 					                   		{
       
  1156 					                   		channelOutputValue=channelOutputValue/(srcMultiplier+destMultiplier);	
       
  1157 					                   		}
       
  1158 					                   	}
       
  1159 									TUint readPixel=bmd->ReadPixel(srcChannel,0).Color16MA();
       
  1160 									//channelPixelValue is the channel pixel value as generated from the library code under test
       
  1161 					                TUint channelPixelValue=(readPixel&channelMask)/channelMul;
       
  1162 					                if (aOutDestPreMul)
       
  1163 					                   	{
       
  1164 					                   	if (channelPixelValue>alphaPixelValue)
       
  1165 					                       	{
       
  1166 					                           if (!ignoreSpecialCases(bkgrdMask,bkgrdChannel,srcMask,srcChannel))
       
  1167 					                           	{
       
  1168 					                           	if (--failsPerPass>0)
       
  1169 					                           		{
       
  1170 					                           		LogColourEvent(bkgrdMask,bkgrdChannel,srcMask,srcChannel,alphaPixelValue,channelOutputValue,channelPixelValue,_L("Output multiplied colour exceeds alpha %f: expected %f got %f"),!ignoreSpecialCases(bkgrdMask,bkgrdChannel,srcMask,srcChannel));
       
  1171 					                           			
       
  1172 					                           		}
       
  1173 					                           	}
       
  1174 					                           errGross+=10;   //output value out of range - bright red spot!
       
  1175 					                           }	
       
  1176 					                    	}
       
  1177 					                    TUint   otherChannels=readPixel&(otherMask|0xff000000);
       
  1178 					                    if (otherChannels!=otherChannels0)
       
  1179 					                    	{       //Other channels should all be constant here!
       
  1180 					                    	LogColourEvent(bkgrdMask,bkgrdChannel,srcMask,srcChannel,otherChannels0,otherChannels,0,_L("Output for other channels changed when modulating test channel only - Inter-channel leakage? srcChannel=0 value = %f, this value = %f"),ETrue);
       
  1181 					                    	}
       
  1182 									//channelDiff is the difference in channel between pixel and float calcuation, i.e. the error. This can be less than 1 level of brightness, i.e. insignificant.
       
  1183 					                    TReal channelDiff=channelOutputValue-channelPixelValue;
       
  1184 					                    zeroErrCol+=channelDiff;
       
  1185 
       
  1186 					                    if (channelDiff>KIgnore || channelDiff<-KIgnore)
       
  1187 					                     	if (channelDiff>0)
       
  1188 					                        	{
       
  1189 					                            if (channelDiff>KGross)
       
  1190 					                               	{
       
  1191 					                                if (!ignoreSpecialCases(bkgrdMask,bkgrdChannel,srcMask,srcChannel))
       
  1192 					                                	{
       
  1193 					                                	if (--failsPerPass>0)
       
  1194 					                                		{
       
  1195 					                                		LogColourEvent(bkgrdMask,bkgrdChannel,srcMask,srcChannel,channelOutputValue,channelPixelValue,channelDiff,_L("Big Colour error: expected %f, got %f"),!ignoreSpecialCases(bkgrdMask,bkgrdChannel,srcMask,srcChannel));		
       
  1196 					                                		}
       
  1197 					                                	}
       
  1198 					                                errGross+=channelDiff-KIgnore;
       
  1199 					                                }
       
  1200 					                            else
       
  1201 					                            	{
       
  1202 					                            	errPos+=channelDiff-KIgnore;
       
  1203 					                            	}
       
  1204 					                            totErrCol+=channelDiff;
       
  1205 					                            }
       
  1206 					                         else
       
  1207 					                         	{
       
  1208 					                            if (channelDiff<-KGross)
       
  1209 					                            	{
       
  1210 					                            	if (!ignoreSpecialCases(bkgrdMask,bkgrdChannel,srcMask,srcChannel))
       
  1211 					                            		{
       
  1212 					                            		if (--failsPerPass>0)
       
  1213 					                            			{
       
  1214 					                            			LogColourEvent(bkgrdMask,bkgrdChannel,srcMask,srcChannel,channelOutputValue,channelPixelValue,channelDiff,_L("Big Colour error: expected %f, got %f"),!ignoreSpecialCases(bkgrdMask,bkgrdChannel,srcMask,srcChannel));	
       
  1215 					                            			}
       
  1216 					                            		}
       
  1217 					                                errGross-=channelDiff+KIgnore;
       
  1218 					                                }
       
  1219 					                             else
       
  1220 					                             	{
       
  1221 					                             	errNeg-=channelDiff+KIgnore;	
       
  1222 					                             	}
       
  1223 					                             	
       
  1224 					                             totErrCol-=channelDiff;
       
  1225 					                         	}
       
  1226 					                     	}
       
  1227 
       
  1228 									TReal err=errPos-errNeg;
       
  1229 					                errGross+=errAGross;
       
  1230 					                if (errA>errAMax256)
       
  1231 					                	{
       
  1232 					      	            //LogColourEvent(bkgrdMask,bkgrdChannel,srcMask,-1,errA,0,0,_L("Row alpha error level increase, now: %f"),EFalse);
       
  1233 					        			errAMax256=errA;
       
  1234 					                    }
       
  1235 					                errPos=Min(TReal(255),(errPos*KMultiplyErrorBrightness/TReal(maxChannels)));
       
  1236 					                errNeg=Min(TReal(255),(errNeg*KMultiplyErrorBrightness/TReal(maxChannels)));
       
  1237 					                TReal err256=Min(TReal(255),err*KMultiplyErrorBrightness/TReal(maxChannels));
       
  1238 					                if (err256>errMax)
       
  1239 					                	{
       
  1240 					      	            //LogColourEvent(bkgrdMask,bkgrdChannel,srcMask,-1,err256,err,0,_L("Row colour error level increase, per call now: %f value for row: %f"),EFalse);
       
  1241 					        			errMax=err256;
       
  1242 					                    }
       
  1243 
       
  1244 					               	errAPos=Min(TReal(255),(errAPos));
       
  1245 					                errANeg=Min(TReal(255),(errANeg));
       
  1246 					                errA=Min(255,errA);
       
  1247 					                if (errGross>10)
       
  1248 					                	{
       
  1249 					                	errGross=TReal(255);	
       
  1250 					                	}
       
  1251 					               	else
       
  1252 					               		{
       
  1253 					               		errGross*=TReal(20);	
       
  1254 					               		}
       
  1255 					            	TRect pix(TPoint(),TSize(1,1)); 
       
  1256 					                if (screenSize.iWidth>260) 
       
  1257 					                	{
       
  1258 					                	iInterface->DrawColour64KPixel(srcMask,logLine, TRgb(STATIC_CAST(TInt,errGross),STATIC_CAST(TInt,errNeg),STATIC_CAST(TInt,errPos)));	
       
  1259 					                	}
       
  1260 									if (screenSize.iWidth>360)
       
  1261 										{
       
  1262 										iInterface->DrawColour64KPixel(srcMask+300,logLine, TRgb(STATIC_CAST(TInt,errGross),STATIC_CAST(TInt,errNeg),STATIC_CAST(TInt,errPos)));	
       
  1263 										}
       
  1264 					    			}
       
  1265 					    		
       
  1266 								if (failsPerPass<0) 
       
  1267 					    			{       //note that this count may be out by 1... 
       
  1268 					      			INFO_PRINTF2(_L("Additional %i errors not reported in this pass."),-failsPerPass); 
       
  1269 					      			} 
       
  1270 								} 
       
  1271 
       
  1272 							iInterface->EndDraw(iRequestStatus);
       
  1273 				    		}
       
  1274 							 
       
  1275 					    if (ignoreSpecialCases.IgnoreCount() && ignoreSpecialCases.IgnoreCount()<ignoreSpecialCases.ExpectedIgnoreCount(aStepSize)) 
       
  1276 					       	{ 
       
  1277 					        TEST(ignoreSpecialCases.IgnoreCount()<ignoreSpecialCases.ExpectedIgnoreCount(aStepSize)); 
       
  1278 					        INFO_PRINTF3(_L("There were less ignored special-case errors than exepected (but more than zero):  Expected: 0 or %i, got %i"), 
       
  1279 								ignoreSpecialCases.ExpectedIgnoreCount(aStepSize),ignoreSpecialCases.IgnoreCount()			
       
  1280 							);
       
  1281 					       	} 
       
  1282 					    INFO_PRINTF4(_L("Highest error rows (normalised @%f per row):  Alpha: %f, Colour: %f "),KMultiplyErrorBrightness,errMax,errAMax256); 
       
  1283 					    INFO_PRINTF4(_L("Alpha:  Samples: %i, total abs= %f, total signed=%f (should be 0)"),countAlphas,totErrAlpha,zeroErrAlpha); 
       
  1284 					    INFO_PRINTF4(_L("Colour: Samples: %i, total abs= %f, total signed=%f (should be 0)"),countColours,totErrCol,zeroErrCol); 
       
  1285 
       
  1286 					    CleanupStack::PopAndDestroy(bmd); 
       
  1287 					  	delete pDev; 
       
  1288 				}
       
  1289 		
       
  1290 			}
       
  1291 		}
       
  1292 	} 
       
  1293 
       
  1294 void CTDirectScreenBitmap::RunTestCaseL(TInt aCurTestCase)
       
  1295 	{
       
  1296 		((CTDirectScreenBitmapStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
       
  1297 	switch(aCurTestCase)
       
  1298 		{
       
  1299 	case 1:
       
  1300 		INFO_PRINTF1(_L("INC0594703 : TestRefreshingWindowsL"));
       
  1301 		((CTDirectScreenBitmapStep*)iStep)->SetTestStepID(_L(" GRAPHICS-CTDirectScreenBitmap-TestRefreshingWindowsL-0001"));
       
  1302 		TestRefreshingWindowsL();
       
  1303 		break;
       
  1304 	case 2:
       
  1305 		INFO_PRINTF1(_L("Test Continuous Refreshing Frames"));
       
  1306 		((CTDirectScreenBitmapStep*)iStep)->SetTestStepID(_L(" GRAPHICS-CTDirectScreenBitmap-TestRefreshingWindowsL-0001"));
       
  1307 		TestContinuousRefreshingL();
       
  1308 		break;
       
  1309 	case 3:
       
  1310 		INFO_PRINTF1(_L("Exhaustive merge test"));
       
  1311 		((CTDirectScreenBitmapStep*)iStep)->SetTestStepID(_L(" GRAPHICS-CTDirectScreenBitmap-ExhaustiveTestMergeL-0001"));
       
  1312 		ExhaustiveTestMergeL(EFalse,EFalse,ETrue,5,0);
       
  1313 		((CTDirectScreenBitmapStep*)iStep)->RecordTestResultL();
       
  1314 		((CTDirectScreenBitmapStep*)iStep)->SetTestStepID(_L(" GRAPHICS-CTDirectScreenBitmap-ExhaustiveTestMergeL-0001"));
       
  1315 		ExhaustiveTestMergeL(EFalse,EFalse,ETrue,5,1);
       
  1316 		((CTDirectScreenBitmapStep*)iStep)->RecordTestResultL();
       
  1317 		((CTDirectScreenBitmapStep*)iStep)->SetTestStepID(_L(" GRAPHICS-CTDirectScreenBitmap-ExhaustiveTestMergeL-0001"));
       
  1318 		ExhaustiveTestMergeL(EFalse,EFalse,ETrue,5,2);
       
  1319 		((CTDirectScreenBitmapStep*)iStep)->RecordTestResultL();
       
  1320 		break;
       
  1321 	case 4:
       
  1322 		INFO_PRINTF1(_L("Test refreshing time"));
       
  1323         	((CTDirectScreenBitmapStep*)iStep)->SetTestStepID(_L(" GRAPHICS-CTDirectScreenBitmap-TestRefreshingWindowsL-0001"));
       
  1324 		TestRefreshingTimeL();
       
  1325 		break;
       
  1326 	default:
       
  1327 		((CTDirectScreenBitmapStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
       
  1328 		((CTDirectScreenBitmapStep*)iStep)->CloseTMSGraphicsStep();
       
  1329 		TestComplete();
       
  1330 		break;
       
  1331 		}
       
  1332 	((CTDirectScreenBitmapStep*)iStep)->RecordTestResultL();
       
  1333 	}
       
  1334 
       
  1335 //--------------
       
  1336 __CONSTRUCT_STEP__(DirectScreenBitmap)
       
  1337 
       
  1338 void CTDirectScreenBitmapStep::TestSetupL()
       
  1339 	{
       
  1340 	TInt temp = 0;
       
  1341 	User::LeaveIfError(HAL::Get(HALData::EDisplayColors, temp));//force HAL memory allocation
       
  1342 	}