os/graphics/graphicstest/uibench/src/tspriteperf.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2008-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 /**
    17  @file
    18  @test
    19  @internalComponent - Internal Symbian test code 
    20 */
    21  
    22 #include "tspriteperf.h"
    23 
    24 const TInt KIterationsToTest = 60; 		// Number of iterations to run tests
    25 
    26 RTAnim::RTAnim() : RAnim()
    27 	{
    28 	}
    29 
    30 RTAnim::RTAnim(RAnimDll& aDll) : RAnim(aDll)
    31 	{
    32 	}
    33 
    34 CTSpritePerf::~CTSpritePerf()
    35 	{
    36 	}
    37 
    38 CTSpritePerf::CTSpritePerf()
    39 	{
    40 	SetTestStepName(KTSpritePerfName);
    41 	}
    42 
    43 /**
    44 Override of base class virtual
    45 
    46 @return - TVerdict code
    47 */
    48 TVerdict CTSpritePerf::doTestStepPreambleL()
    49 	{
    50 	User::LeaveIfError(iWs.Connect());
    51 	CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL();
    52 		
    53 	return TestStepResult();
    54 	}
    55 
    56 
    57 TVerdict CTSpritePerf::doTestStepPostambleL()
    58 	{
    59 	iWs.Close();
    60 		
    61 	return TestStepResult();
    62 	}
    63 
    64 /**	Override of base class pure virtual
    65 	Our implementation only gets called if the base class doTestStepPreambleL() did
    66 	not leave. That being the case, the current test result value will be EPass.
    67 
    68 	@return - TVerdict code
    69 */
    70 TVerdict CTSpritePerf::doTestStepL()
    71 	{
    72 	SetTestStepID(_L("GRAPHICS-UI-BENCH-0128"));
    73 	SpriteAnimOverWholeScreenL();
    74 	RecordTestResultL();
    75 	SetTestStepID(_L("GRAPHICS-UI-BENCH-0129"));
    76 	SpriteAnimUnderTranslucentWindowsL();
    77 	RecordTestResultL();
    78 	SetTestStepID(_L("GRAPHICS-UI-BENCH-0130"));
    79 	SpriteAnimWithSemitransparentMaskOverWholeScreenL();
    80 	RecordTestResultL();
    81 	SetTestStepID(_L("GRAPHICS-UI-BENCH-0131"));
    82 	SpriteAnimWithSemitransparentMaskUnderTranslucentWindowsL();
    83 	RecordTestResultL();
    84 
    85 	SetTestStepID(_L("GRAPHICS-UI-BENCH-0143"));
    86 	OpaqueFloatingSpriteNonOverlapUpdateAreaL();
    87 	RecordTestResultL();
    88 	SetTestStepID(_L("GRAPHICS-UI-BENCH-0144"));
    89 	SemitransparentFloatingSpriteNonOverlapUpdateAreaL();
    90 	RecordTestResultL();
    91 	SetTestStepID(_L("GRAPHICS-UI-BENCH-0145"));
    92 	OpaqueFloatingSpriteOverlapUpdateAreaL();
    93 	RecordTestResultL();
    94 	SetTestStepID(_L("GRAPHICS-UI-BENCH-0146"));
    95 	SemitransparentFloatingSpriteOverlapUpdateAreaL();
    96 	RecordTestResultL();
    97 	return TestStepResult();
    98 	}
    99 
   100 /** Set up the window server environment and load the animation DLL which will be used for 
   101   	the sprite performance test cases.
   102     The RWsSession is connected to the window server, the CWsScreenDevice and the RWindowGroup
   103     members are constructed. Also the client-side interface to the server-side animation DLL is
   104     constructed and the animation DLL is loaded. 
   105  */
   106 void CTSpritePerf::SetUpWindowEnvironmentL(RAnimDll* aAnimDll)
   107 	{
   108 	SetScreenModeL(EColor16MA);
   109 	
   110 	if (aAnimDll)
   111 		{
   112 		TInt err = aAnimDll->Load(KAnimDLLName);
   113 		if (err)
   114 			{
   115 			INFO_PRINTF3(_L("DLL file %S was not loaded properly, leave with error code %i"),KAnimDLLName,err);
   116 			User::Leave(err);
   117 			}
   118 		}
   119 	
   120 	iWsScreenDev = new(ELeave) CWsScreenDevice(iWs);
   121 	User::LeaveIfError(iWsScreenDev->Construct());
   122 	TSize screenSize = iWsScreenDev->SizeInPixels();
   123 	
   124 	iWinGroup = new(ELeave) RWindowGroup(iWs);
   125 	User::LeaveIfError(iWinGroup->Construct(reinterpret_cast<TUint32>(iWinGroup),iWsScreenDev));
   126 	}
   127 
   128 /** Populate the RWindow array member by constructing RWindow objects. Set the background colour of the windows according to the
   129    	tranparency flag. Make the windows visible, activate them and draw them.
   130   
   131   	@param aUseTransparency the transparency flag of the windows
   132  */
   133 void CTSpritePerf::ConstructArrayOfWindowsL(TBool aUseTransparency)
   134 	{
   135 	TRect rect(TPoint(0,0),iWsScreenDev->SizeInPixels());
   136 	TInt i;
   137 	TUint32 winID;
   138 	for (i=0;i<ENumWins;++i)
   139 		{
   140 		iWins[i]=new(ELeave) RWindow(iWs);
   141 		winID = reinterpret_cast<TUint32>(iWinGroup+i+1);
   142 		if (i==0)
   143 			User::LeaveIfError(iWins[i]->Construct(*iWinGroup,winID)); //iWinGroup is the parent of iWins[0]
   144 		else
   145 			User::LeaveIfError(iWins[i]->Construct(*iWins[0],winID)); //iWins[0] is the the parent for every subsequent window
   146 		rect.Resize(-rect.Width()/10,-rect.Height()/10);
   147 		iWins[i]->SetExtent(TPoint(0,0),rect.Size());
   148 		if (aUseTransparency)
   149 			{	
   150 			iWins[i]->SetTransparencyAlphaChannel();
   151 			iBackColour[i]= TRgb(240,(200*i)/ENumWins,170-(20*i)/ENumWins,(60*(i+1))/ENumWins); //assign a different background colour to each window in a pseudo-random manner
   152 			iWins[i]->SetBackgroundColor(iBackColour[i]); //semi-transparent window (R,G,B,Alpha)
   153 			}
   154 		else
   155 			{
   156 			iBackColour[i]= TRgb(180,(200*i)/ENumWins,170-(20*i)/ENumWins,255);
   157 			iWins[i]->SetBackgroundColor(iBackColour[i]); //opaque window
   158 			}
   159 			
   160 		iWins[i]->SetVisible(ETrue);
   161 		iWins[i]->Activate();	
   162 		iWins[i]->Invalidate();
   163 		iWins[i]->BeginRedraw();
   164 		iWins[i]->EndRedraw();
   165 		}
   166 			
   167 	iWs.Flush();
   168 	iWs.Finish();
   169 	}
   170 
   171 /** Release the resources that the window server environment, the window construction and the client-side
   172   	interface to animation DLL have allocated.
   173  */
   174 void CTSpritePerf::ReleaseWindowsAndEnvironment()
   175 	{
   176 	for (TInt i=0;i<ENumWins;++i)
   177 		{
   178 		if (iWins[i])
   179 			iWins[i]->Close();
   180 		delete iWins[i];
   181 		iWins[i]=NULL;
   182 		}
   183 	
   184 	if(iWinGroup)
   185 		iWinGroup->Close();
   186 	delete iWinGroup;
   187 	iWinGroup=NULL;
   188 	
   189 	delete iWsScreenDev;
   190 	iWsScreenDev=NULL;
   191 	}
   192 
   193 
   194 /**
   195 @SYMTestCaseID
   196 GRAPHICS-UI-BENCH-0128
   197 
   198 @SYMPREQ PREQ1841
   199 
   200 @SYMTestCaseDesc
   201 Tests how long it takes to draw the bitmap of a sprite over the whole screen
   202 
   203 @SYMTestActions
   204 Set up the window server environment, load the animation DLL and construct an array of opaque windows.
   205 Construct an opaque sprite having the window group as parent. Append a single member (appropriately initialised) to it 
   206 and construct a sprite animation linked to the sprite. Over a specific number of iterations perform some 
   207 draw operations on the sprite animation. Record the time the draw requests and the actual drawing require 
   208 and release the resources.
   209 
   210 @SYMTestExpectedResults
   211 Test should pass and display average test time per iteration
   212 */
   213 void CTSpritePerf::SpriteAnimOverWholeScreenL()
   214 	{
   215 	_LIT(KTestName, "SpriteAnimOverWholeScreenL");
   216 	SpriteAnimTestL(KTestName, ETrue, EFalse);
   217 	}
   218 
   219 /**
   220 @SYMTestCaseID
   221 GRAPHICS-UI-BENCH-0129
   222 
   223 @SYMPREQ PREQ1841
   224 
   225 @SYMTestCaseDesc
   226 Tests how long it takes to draw the bitmap of a sprite under transparent windows
   227 
   228 @SYMTestActions
   229 Set up the window server environment, load the animation DLL and construct an array of translucent windows.
   230 Construct an opaque sprite having the bottom window as parent. Append a single member (appropriately initialised) to it.
   231 and construct a sprite animation linked to the sprite. Over a specific number of iterations perform some draw 
   232 operations on the sprite animation. Record the time the draw requests and the actual drawing require and release the
   233 resources.
   234 
   235 @SYMTestExpectedResults
   236 Test should pass and display average test time per iteration
   237 */
   238 void CTSpritePerf::SpriteAnimUnderTranslucentWindowsL()
   239 	{
   240 	_LIT(KTestName, "SpriteAnimUnderTranslucentWindowsL");
   241 	SpriteAnimTestL(KTestName, EFalse, EFalse);
   242 	}
   243 
   244 /**
   245 @SYMTestCaseID
   246 GRAPHICS-UI-BENCH-0130
   247 
   248 @SYMPREQ PREQ1841
   249 
   250 @SYMTestCaseDesc
   251 Tests how long it takes to draw the bitmap of a sprite over the whole screen, when the bitmap mask is partially transparent
   252 
   253 @SYMTestActions
   254 Set up the window server environment, load the animation DLL and construct an array of opaque windows.
   255 Construct a semitransparent sprite having the window group as parent. Append a single member (appropriately initialised)
   256 to it and construct a sprite animation linked to the sprite. Over a specific number of iterations perform some draw
   257 operations on the sprite animation. Record the time the draw requests and the actual drawing require and release the resources.
   258 
   259 @SYMTestExpectedResults
   260 Test should pass and display average test time per iteration
   261 */
   262 void CTSpritePerf::SpriteAnimWithSemitransparentMaskOverWholeScreenL()
   263 	{
   264 	_LIT(KTestName, "SpriteAnimWithSemitransparentMaskOverWholeScreenL");
   265 	SpriteAnimTestL(KTestName, ETrue, ETrue);
   266 	}
   267 
   268 /**
   269 @SYMTestCaseID
   270 GRAPHICS-UI-BENCH-0131
   271 
   272 @SYMPREQ PREQ1841
   273 
   274 @SYMTestCaseDesc
   275 Tests how long it takes to draw the bitmap of a sprite under translucent windows,  when the bitmap mask is partially transparent
   276 
   277 @SYMTestActions
   278 Set up the window server environment, load the animation DLL and construct an array of translucent windows.
   279 Construct a semitransparent sprite having the bottom window as parent. Append a single member (appropriately initialised)
   280 to it and construct a sprite animation linked to the sprite. Over a specific number of iterations perform some draw
   281 operations on the sprite animation. Record the time the draw requests and the actual drawing require and release the resources.
   282 
   283 @SYMTestExpectedResults
   284 Test should pass and display average test time per iteration
   285 */
   286 void CTSpritePerf::SpriteAnimWithSemitransparentMaskUnderTranslucentWindowsL()
   287 	{
   288 	_LIT(KTestName, "SpriteAnimWithSemitransparentMaskUnderTranslucentWindowsL");
   289 	SpriteAnimTestL(KTestName, EFalse, ETrue);
   290 	}
   291 
   292 static void CleanupWindows(TAny* aPtr)
   293 	{
   294 	RWindow** wins = static_cast<RWindow**>(aPtr);
   295 	for (TInt i=0;i<CTSpritePerf::ENumWins;++i)
   296 		{
   297 		if (wins[i])
   298 			{
   299 			wins[i]->Close();
   300 			delete wins[i];
   301 			wins[i]=NULL;
   302 			}
   303 		}
   304 	}
   305 
   306 static void CleanupWindowGroup(TAny* aPtr)
   307 	{
   308 	RWindowGroup** windowGroup = static_cast<RWindowGroup**>(aPtr);
   309 	if (*windowGroup)
   310 		{
   311 		(*windowGroup)->Close();
   312 		delete *windowGroup;
   313 		*windowGroup=NULL;
   314 		}
   315 	}
   316 
   317 static void CleanupScreenDevice(TAny* aPtr)
   318 	{
   319 	CWsScreenDevice** screenDevice = static_cast<CWsScreenDevice**>(aPtr);
   320 	delete *screenDevice;
   321 	*screenDevice=NULL;	
   322 	}
   323 
   324 /*
   325    Set up the window server environment, load the animation DLL and construct an array of (opaque/translucent) windows.
   326    Construct an opaque/semitransparent sprite with a single member, initialise it and construct a sprite animation linked to the sprite. 
   327    Over a specific number of iterations perform some draw operations on the sprite animation. Record the time 
   328    the draw requests and the actual drawing require and release the resources.
   329   
   330    @param aTestName the name of the test case
   331    @param aOverWholeScreen the flag deciding whether the windows are opaque or tranparent and thus deciding whether 
   332   		  the sprite is drawn over the whole screen or under transparent windows
   333    @param aTransparentMask the transparency flag of the sprite bitmap mask
   334  */
   335 void CTSpritePerf::SpriteAnimTestL(const TDesC& aTestName,TBool aOverWholeScreen, TBool aTransparentMask)
   336 	{
   337 	RAnimDll animDll(iWs);
   338 	CleanupClosePushL(animDll);
   339 	
   340 	TCleanupItem cleanupScreenDevice(CleanupScreenDevice,&iWsScreenDev);
   341 	CleanupStack::PushL(cleanupScreenDevice);
   342 	TCleanupItem cleanupWindowGroup(CleanupWindowGroup,&iWinGroup);
   343 	CleanupStack::PushL(cleanupWindowGroup);
   344 	SetUpWindowEnvironmentL(&animDll);
   345 	
   346 	TCleanupItem cleanupWindows(CleanupWindows,iWins);
   347 	CleanupStack::PushL(cleanupWindows);
   348 	ConstructArrayOfWindowsL(!aOverWholeScreen);
   349 	
   350 	RWsSprite sprite(iWs);
   351 	CleanupClosePushL(sprite);
   352 	if (aOverWholeScreen)
   353 		User::LeaveIfError(sprite.Construct(*iWinGroup,TPoint(10,10),ESpriteNoChildClip));
   354 	else
   355 		User::LeaveIfError(sprite.Construct(*iWins[0],TPoint(10,10),ESpriteNoChildClip));
   356 
   357 	CFbsBitmap* bitmap=new(ELeave) CFbsBitmap();
   358 	CleanupStack::PushL(bitmap);
   359 	User::LeaveIfError(bitmap->Create(TSize(40,42),EColor16MA));
   360 
   361 	CFbsBitmap* bitmap2 = NULL; //used as bitmap mask for sprite member of opaque sprite 
   362 	CFbsBitmap* bitmap3 = NULL; //used as bitmap mask for sprite member of semitransparent sprite 
   363 	
   364 	if (!aTransparentMask)
   365 		{ 
   366 		//opaque sprite uses a bitmap mask set to white
   367 		bitmap2=new(ELeave) CFbsBitmap();
   368 		CleanupStack::PushL(bitmap2);
   369 		User::LeaveIfError(bitmap2->Create(TSize(40,42),EColor16MA));
   370 		}
   371 	else	
   372 		{ 
   373 		//semitransparent sprite uses a bitmap mask, in which 
   374 		// *the bottom right quarter is set to black making the sprite fully transparent in this area
   375 		// *the remaining region is set to a gray shade allowing the sprite to be semitransparent in this area
   376 		bitmap3=new(ELeave) CFbsBitmap();
   377 		CleanupStack::PushL(bitmap3);
   378 		User::LeaveIfError(bitmap3->Create(TSize(40,42),EColor16MA));
   379 		
   380 		CFbsBitmapDevice *device=CFbsBitmapDevice::NewL(bitmap3);
   381 		CleanupStack::PushL(device);
   382 		CFbsBitGc *gc;
   383 		User::LeaveIfError(device->CreateContext(gc));
   384 		CleanupStack::PushL(gc);
   385 
   386 		gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
   387 		gc->SetPenSize(TSize());
   388 		TSize bitmapSize=bitmap3->SizeInPixels();
   389 		TSize size=bitmapSize;
   390 		size.SetSize(size.iWidth/2,size.iHeight/2);
   391 		TPoint point=size.AsPoint();
   392 		gc->SetBrushColor(TRgb(128,128,128));
   393 		gc->DrawRect(TRect(TPoint(),bitmapSize));
   394 		gc->SetBrushColor(TRgb(0,0,0));
   395 		gc->DrawRect(TRect(point,size));
   396 		}
   397 			
   398 	TSpriteMember member;
   399 	member.iBitmap=bitmap;
   400 	if (aTransparentMask)
   401 		member.iMaskBitmap=bitmap3;
   402 	else
   403 		member.iMaskBitmap=bitmap2;
   404 	member.iInvertMask=EFalse;
   405 	member.iDrawMode=CGraphicsContext::EDrawModePEN;
   406 	member.iOffset=TPoint();
   407 	member.iInterval=TTimeIntervalMicroSeconds32(200000);
   408 	
   409 	sprite.AppendMember(member);
   410 	
   411 	RTAnim spriteAnim(animDll);
   412 	CleanupClosePushL(spriteAnim);
   413 	TPtrC8 des(NULL,0);
   414 	TPoint pos(10,20);
   415 	User::LeaveIfError(spriteAnim.Construct(sprite,ESpriteAnimType,des));
   416 	User::After(500000);
   417 		
   418 	iProfiler->InitResults();
   419 	for (TInt count=KIterationsToTest; count>=0; --count)
   420 		{
   421 		iProfiler->StartTimer();
   422 		// draw on sprite member's bitmap and update the sprite member
   423 		spriteAnim.Command(EADllDraw1);
   424 		spriteAnim.Command(EADllDraw2);
   425 		spriteAnim.Command(EADllDraw3);
   426 		iWs.Flush();
   427 		iProfiler->MarkResultSetL();
   428 		User::After(100000);
   429 		spriteAnim.Command(EADllDrawBlank);
   430 		iWs.Flush();
   431 		User::After(100000);
   432 		}
   433 	
   434 	iProfiler->ResultsAnalysis(aTestName, 0, EColor16MA, EColor16MA, KIterationsToTest);
   435 	
   436 	if (!aTransparentMask)
   437 		CleanupStack::PopAndDestroy(4); //sprite, bitmaps (2), testanim
   438 	else
   439 		CleanupStack::PopAndDestroy(6); //sprite, bitmaps (2), device, gc, testanim
   440 	CleanupStack::Pop(3); //cleanup items(3)
   441 	CleanupStack::PopAndDestroy(1); //anim Dll
   442 	ReleaseWindowsAndEnvironment();
   443 	}
   444 
   445 /**
   446 @SYMTestCaseID
   447 GRAPHICS-UI-BENCH-0143
   448 
   449 @SYMPREQ PREQ1841
   450 
   451 @SYMTestCaseDesc
   452 Tests how long it takes to draw the bitmap of an opaque sprite, when it lies over an area that is not updated.
   453 
   454 @SYMTestActions
   455 Set up the window server environment and construct an array of opaque windows.
   456 Construct an opaque floating sprite and place it over an area that will not be followingly updated.
   457 Append a single member to it. Over a specific number of iterations update a screen area. Record the time
   458 the actual drawing requires and release the resources.
   459 
   460 @SYMTestExpectedResults
   461 Test should pass and display average test time per iteration
   462 */
   463 void CTSpritePerf::OpaqueFloatingSpriteNonOverlapUpdateAreaL()
   464 	{
   465 	_LIT(KTestName, "OpaqueFloatingSpriteNonOverlapUpdateAreaL");
   466 	FloatingSpriteTestL(KTestName, ETrue, EFalse);
   467 	}
   468 
   469 /**
   470 @SYMTestCaseID
   471 GRAPHICS-UI-BENCH-0144
   472 
   473 @SYMPREQ PREQ1841
   474 
   475 @SYMTestCaseDesc
   476 Tests how long it takes to draw the bitmap of a semitransparent sprite, when it lies over an area that is not updated.
   477 
   478 @SYMTestActions
   479 Set up the window server environment and construct an array of opaque windows.
   480 Construct a semitransparent floating sprite and place it over an area that will not be followingly updated.
   481 Append a single member to it. Over a specific number of iterations update a screen area. Record the time
   482 the actual drawing requires and release the resources.
   483 
   484 @SYMTestExpectedResults
   485 Test should pass and display average test time per iteration
   486 */
   487 void CTSpritePerf::SemitransparentFloatingSpriteNonOverlapUpdateAreaL()
   488 	{
   489 	_LIT(KTestName, "SemitransparentFloatingSpriteNonOverlapUpdateAreaL");
   490 	FloatingSpriteTestL(KTestName, EFalse, EFalse);
   491 	}
   492 
   493 /**
   494 @SYMTestCaseID
   495 GRAPHICS-UI-BENCH-0145
   496 
   497 @SYMPREQ PREQ1841
   498 
   499 @SYMTestCaseDesc
   500 Tests how long it takes to draw the bitmap of an opaque sprite, when it lies over an area that is updated.
   501 
   502 @SYMTestActions
   503 Set up the window server environment and construct an array of opaque windows.
   504 Construct an opaque floating sprite and place it over an area that will be followingly updated.
   505 Append a single member to it. Over a specific number of iterations update a screen area. Record the time
   506 the actual drawing requires and release the resources.
   507 
   508 @SYMTestExpectedResults
   509 Test should pass and display average test time per iteration
   510 */
   511 void CTSpritePerf::OpaqueFloatingSpriteOverlapUpdateAreaL()
   512 	{
   513 	_LIT(KTestName, "OpaqueFloatingSpriteOverlapUpdateAreaL");
   514 	FloatingSpriteTestL(KTestName, ETrue, ETrue);
   515 	}
   516 
   517 /**
   518 @SYMTestCaseID
   519 GRAPHICS-UI-BENCH-0146
   520 
   521 @SYMPREQ PREQ1841
   522 
   523 @SYMTestCaseDesc
   524 Tests how long it takes to draw the bitmap of a semitransparent sprite, when it lies over an area that is updated.
   525 
   526 @SYMTestActions
   527 Set up the window server environment and construct an array of opaque windows.
   528 Construct a semitransparent floating sprite and place it over an area that will be followingly updated.
   529 Append a single member to it. Over a specific number of iterations update a screen area. Record the time
   530 the actual drawing requires and release the resources.
   531 
   532 @SYMTestExpectedResults
   533 Test should pass and display average test time per iteration
   534 */
   535 void CTSpritePerf::SemitransparentFloatingSpriteOverlapUpdateAreaL()
   536 	{
   537 	_LIT(KTestName, "SemitransparentFloatingSpriteOverlapUpdateAreaL");
   538 	FloatingSpriteTestL(KTestName, EFalse, ETrue);
   539 	}
   540 
   541 /*
   542    Set up the window server environment and construct an array of opaque windows.
   543    Construct an opaque/semitransparent sprite attached to the window group, thus being a floating sprite.
   544    Append a single member to the sprite. Over a specific number of iterations update a screen area by rotating
   545    the background colour of the windows (excluding top window). Record the time the actual drawing requires
   546    in total (for redrawing the windows and the sprite) and release the resources.
   547   
   548    @param aTestName the name of the test case
   549    @param aIsOpaqueSprite the flag deciding whether the sprite is opaque or semitranparent
   550    @param aOverlapUpdateArea the flag deciding whether the sprite overlaps the update area or not
   551  */
   552 void CTSpritePerf::FloatingSpriteTestL(const TDesC& aTestName, TBool aIsOpaqueSprite, TBool aOverlapUpdateArea)
   553 	{
   554 	TCleanupItem cleanupScreenDevice(CleanupScreenDevice,&iWsScreenDev);
   555 	CleanupStack::PushL(cleanupScreenDevice);
   556 	TCleanupItem cleanupWindowGroup(CleanupWindowGroup,&iWinGroup);
   557 	CleanupStack::PushL(cleanupWindowGroup);
   558 	SetUpWindowEnvironmentL(NULL);
   559 	
   560 	TCleanupItem cleanupWindows(CleanupWindows,iWins);
   561 	CleanupStack::PushL(cleanupWindows);
   562 	ConstructArrayOfWindowsL(EFalse);
   563 	
   564 	RWsSprite sprite(iWs);
   565 	CleanupClosePushL(sprite);
   566 	TPoint point=TPoint();
   567 	if (aOverlapUpdateArea)
   568 		{
   569 		//sprite is set to be right over the area off the top window, where the other windows overlap
   570 		TSize topWinSize= iWins[ENumWins-1]->Size();
   571 		point=TPoint(0,topWinSize.iHeight);
   572 		}
   573 	User::LeaveIfError(sprite.Construct(*iWinGroup,point,ESpriteNoChildClip));
   574 		
   575 	CFbsBitmap* bitmap = new(ELeave) CFbsBitmap;
   576 	CleanupStack::PushL(bitmap);
   577 	User::LeaveIfError(bitmap->Create(iWsScreenDev->SizeInPixels(), iWsScreenDev->DisplayMode()));
   578 	User::LeaveIfError(bitmap->Load(TEST_BITMAP_NAME,0));
   579 	TSize bitmapSize=bitmap->SizeInPixels();
   580 	
   581 	CFbsBitmap* bitmap2 = new(ELeave) CFbsBitmap;
   582 	CleanupStack::PushL(bitmap2);
   583 	User::LeaveIfError(bitmap2->Create(bitmapSize, iWsScreenDev->DisplayMode())); //blank bitmap
   584 	
   585 	TSpriteMember member;
   586 		
   587 	member.iBitmap=bitmap;
   588 	if (aIsOpaqueSprite)
   589 		member.iMaskBitmap=bitmap2;
   590 	else
   591 		member.iMaskBitmap=bitmap;
   592 	member.iInvertMask=EFalse;
   593 	member.iDrawMode=CGraphicsContext::EDrawModePEN;
   594 	member.iOffset=TPoint();
   595 	member.iInterval=TTimeIntervalMicroSeconds32(200000);
   596 	User::LeaveIfError(sprite.AppendMember(member));
   597 	User::LeaveIfError(sprite.Activate());  //make the sprite visible
   598 	User::After(1000000);
   599 	
   600 	iProfiler->InitResults();
   601 	for (TInt count=KIterationsToTest; count>=0; --count)
   602 		{
   603 		iProfiler->StartTimer();
   604 		//cause a screen area to be updated by rotating the background colour of the windows in the array 
   605 		//apart from the colour of the top window  
   606 		for (TInt i=0;i<ENumWins-1;i++)
   607 			{
   608 			TRgb tempBackColour = iBackColour[0];
   609 			if (i!=ENumWins-1)
   610 				iBackColour[i]=iBackColour[(i+1)%(ENumWins-1)];
   611 			else
   612 				iBackColour[ENumWins-2]=tempBackColour;
   613 			iWins[i]->SetBackgroundColor(iBackColour[i]);
   614 			iWins[i]->Invalidate();
   615 			iWins[i]->BeginRedraw();
   616 			iWins[i]->EndRedraw();
   617 			}
   618 		iWs.Flush();
   619 		iWs.Finish();
   620 		iProfiler->MarkResultSetL();
   621 		User::After(100000);
   622 		}
   623 		
   624 	iProfiler->ResultsAnalysis(aTestName, 0, EColor16MA, EColor16MA, KIterationsToTest);
   625 	
   626 	CleanupStack::PopAndDestroy(3); //sprite, bitmaps(2)
   627 	CleanupStack::Pop(3); //cleanup items(3)
   628 	ReleaseWindowsAndEnvironment();
   629 	}