os/graphics/graphicstest/uibench/src/talphadrawing.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
/**
sl@0
    17
 @file
sl@0
    18
 @test
sl@0
    19
 @internalComponent - Internal Symbian test code 
sl@0
    20
*/
sl@0
    21
 
sl@0
    22
#include "talphadrawing.h"
sl@0
    23
#include <hal.h>
sl@0
    24
sl@0
    25
// When enabled allows testing with a variable windows size rather than fixed size
sl@0
    26
#define _TESTWITHVARIABLEWINDOWSIZE
sl@0
    27
sl@0
    28
// Test bitmap file location
sl@0
    29
_LIT(KAlphaTestBitmap,"z:\\system\\data\\uibench_24bit.mbm");
sl@0
    30
sl@0
    31
const TInt KIterationsToTest = 100; 		// Number of iterations to run tests
sl@0
    32
const TInt KDelay = 100000; 		// 0.1 seconds
sl@0
    33
const TInt KRotationGranulatity = 8;// Rotation array granularity
sl@0
    34
sl@0
    35
/**
sl@0
    36
Clear window to selected colour
sl@0
    37
*/
sl@0
    38
LOCAL_C void ClearWindow(RWsSession& aSession, RWindow& aWindow, CWindowGc* aGc, TRgb aColor)
sl@0
    39
{
sl@0
    40
	// clear so we can see bitmap version has completed
sl@0
    41
	aWindow.Invalidate();
sl@0
    42
	aWindow.BeginRedraw();
sl@0
    43
	aGc->Activate(aWindow);
sl@0
    44
	aGc->SetBrushColor(aColor);
sl@0
    45
	aGc->Clear();
sl@0
    46
	aGc->Deactivate();
sl@0
    47
	aWindow.EndRedraw();
sl@0
    48
	aSession.Flush();
sl@0
    49
}
sl@0
    50
sl@0
    51
/**
sl@0
    52
Draws a b/w checkerboard onto a RWindow
sl@0
    53
*/
sl@0
    54
LOCAL_C void ChessBoard(RWsSession& aSession, RWindow& aWindow, CWindowGc* aGc)
sl@0
    55
	{
sl@0
    56
	const TSize size = aWindow.Size();
sl@0
    57
	
sl@0
    58
	aGc->Activate(aWindow);
sl@0
    59
	aGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
sl@0
    60
	aGc->SetPenStyle(CGraphicsContext::ENullPen);
sl@0
    61
sl@0
    62
	aGc->SetBrushColor(KRgbBlack);
sl@0
    63
	aGc->Clear();
sl@0
    64
	aGc->SetBrushColor(KRgbWhite);
sl@0
    65
	TInt x0 = 0;
sl@0
    66
	TPoint point;
sl@0
    67
	const TInt checkerSize = 32;
sl@0
    68
	for(point.iY=0; point.iY < size.iHeight; point.iY += checkerSize)
sl@0
    69
		{
sl@0
    70
		for(point.iX=x0; point.iX < size.iWidth; point.iX += checkerSize*2)
sl@0
    71
			{
sl@0
    72
			TRect rect(point, TSize(checkerSize, checkerSize));
sl@0
    73
			aGc->DrawRect(rect);
sl@0
    74
			}
sl@0
    75
		x0 = checkerSize - x0;
sl@0
    76
		}
sl@0
    77
	aGc->Deactivate();
sl@0
    78
	aSession.Flush();
sl@0
    79
	}
sl@0
    80
	
sl@0
    81
/**
sl@0
    82
RBlankWindow on top layer gets set visible/invisible to measure timing of drawing the windows below
sl@0
    83
*/
sl@0
    84
void CTAlphaDrawing::DrawBlankWindowL (RWindow& /*aForeGndWin*/, TInt aIters)
sl@0
    85
	{	
sl@0
    86
	// Create a blank window that is the size of the screen so that we can set this visible to hide the window underneath
sl@0
    87
	// and then hide it to force redraw of the window underneath
sl@0
    88
	RBlankWindow blankWindow = RBlankWindow(iWsSession);
sl@0
    89
	CleanupClosePushL(blankWindow);
sl@0
    90
	User::LeaveIfError(blankWindow.Construct(iWinGroup, (TInt)this+1));	
sl@0
    91
	blankWindow.SetSize(iScreenDevice->SizeInPixels());
sl@0
    92
	blankWindow.SetColor(TRgb(0x3399ff));	
sl@0
    93
	blankWindow.Activate();
sl@0
    94
	
sl@0
    95
#ifdef _TESTWITHVARIABLEWINDOWSIZE
sl@0
    96
	// Create a small window that moves position
sl@0
    97
	RBlankWindow blankWindow2 = RBlankWindow(iWsSession);
sl@0
    98
	CleanupClosePushL(blankWindow2);
sl@0
    99
	User::LeaveIfError(blankWindow2.Construct(iWinGroup, (TInt)this+2));
sl@0
   100
	blankWindow2.SetSize(TSize(10,10));
sl@0
   101
	blankWindow2.SetColor(TRgb(0x99ff33));
sl@0
   102
	TInt px = iScreenDevice->SizeInPixels().iWidth/2;
sl@0
   103
	TInt py = iScreenDevice->SizeInPixels().iHeight/2;
sl@0
   104
	blankWindow2.SetPosition(TPoint(px, py));
sl@0
   105
	blankWindow2.Activate();
sl@0
   106
#endif	
sl@0
   107
	
sl@0
   108
	TBool onoff=ETrue;
sl@0
   109
	
sl@0
   110
	iProfiler->InitResults();
sl@0
   111
	for(TInt i=aIters; i>=0; i--)
sl@0
   112
		{
sl@0
   113
		blankWindow.SetVisible(onoff=!onoff);
sl@0
   114
				
sl@0
   115
#ifdef _TESTWITHVARIABLEWINDOWSIZE
sl@0
   116
		blankWindow2.SetSize(TSize(10+i, 10+i));
sl@0
   117
		blankWindow2.SetPosition(TPoint(px--, py--));
sl@0
   118
		if (px<0) px=150; 
sl@0
   119
		if (py<0) py=150;
sl@0
   120
#endif
sl@0
   121
sl@0
   122
		iWsSession.Flush();
sl@0
   123
		iProfiler->MarkResultSetL();
sl@0
   124
		}	
sl@0
   125
	
sl@0
   126
#ifdef _TESTWITHVARIABLEWINDOWSIZE
sl@0
   127
	CleanupStack::PopAndDestroy(&blankWindow2);
sl@0
   128
#endif
sl@0
   129
	CleanupStack::PopAndDestroy(&blankWindow);
sl@0
   130
	}
sl@0
   131
sl@0
   132
/**
sl@0
   133
Helper function to calculate processor cycles per pixel as a characteristic number for rendering speed
sl@0
   134
*/
sl@0
   135
TInt CTAlphaDrawing::CyclesPerPixel(TInt64 aDuration, TInt aIters, TInt aWidth, TInt aHeight, TInt aCPUSpeed) 
sl@0
   136
	{	
sl@0
   137
	TInt64 pixs=aWidth*aHeight;
sl@0
   138
	TInt64 cpuHz=aCPUSpeed;
sl@0
   139
	
sl@0
   140
	TInt64 ret=(aDuration*cpuHz)/pixs/1000/aIters;
sl@0
   141
	return ret;
sl@0
   142
	}
sl@0
   143
sl@0
   144
/*
sl@0
   145
Helper function that draws a window
sl@0
   146
*/
sl@0
   147
void CTAlphaDrawing::TestDrawWindowL(TDisplayMode aMode, TInt aIters, TTestCase aTestCase, const TDesC& aTestName)
sl@0
   148
	{
sl@0
   149
	RWindow foregndWindow = RWindow(iWsSession);
sl@0
   150
	User::LeaveIfError(foregndWindow.Construct(iWinGroup, (TInt)this+3));
sl@0
   151
	
sl@0
   152
	CFbsBitmap * bmpModeDep = CreateSoftwareBitmapLC(iScreenDevice->SizeInPixels(), aMode);
sl@0
   153
	CopyBitmapL(bmpModeDep, iSourceImage);
sl@0
   154
	
sl@0
   155
	foregndWindow.BeginRedraw();
sl@0
   156
	iWindowGc->Activate(foregndWindow);
sl@0
   157
	iWindowGc->SetBrushStyle(CGraphicsContext::ENullBrush);
sl@0
   158
	iWindowGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
sl@0
   159
	iWindowGc->DrawBitmap(iScreenDevice->SizeInPixels(), bmpModeDep, bmpModeDep->SizeInPixels());
sl@0
   160
	iWindowGc->Deactivate();
sl@0
   161
	foregndWindow.EndRedraw();
sl@0
   162
	iWsSession.Flush();
sl@0
   163
		
sl@0
   164
	switch (aTestCase)
sl@0
   165
		{
sl@0
   166
		case EUseOpaqueDraw:
sl@0
   167
			foregndWindow.SetNonTransparent();	
sl@0
   168
			break;
sl@0
   169
		case EUseTransparencyFactor:
sl@0
   170
			User::LeaveIfError(foregndWindow.SetTransparencyFactor(TRgb(0xbbbbbb,128)));
sl@0
   171
			break;
sl@0
   172
		}
sl@0
   173
		
sl@0
   174
	foregndWindow.Activate();
sl@0
   175
sl@0
   176
	// Start performance test and analyse results
sl@0
   177
	DrawBlankWindowL(foregndWindow, aIters);
sl@0
   178
	iProfiler->ResultsAnalysis(aTestName, 0, aMode, 0, aIters);
sl@0
   179
sl@0
   180
	foregndWindow.Close();
sl@0
   181
	
sl@0
   182
	CleanupStack::PopAndDestroy(bmpModeDep);
sl@0
   183
	User::After(KDelay);
sl@0
   184
	}
sl@0
   185
sl@0
   186
/**
sl@0
   187
   @SYMTestCaseID
sl@0
   188
   GRAPHICS-UI-BENCH-0013
sl@0
   189
sl@0
   190
   @SYMTestCaseDesc
sl@0
   191
   The test determines how long it takes to draw an opaque (non-transparent) window composition.
sl@0
   192
sl@0
   193
   @SYMTestActions
sl@0
   194
   Compare the results over time, and before and after changes to wserv code.
sl@0
   195
sl@0
   196
   @SYMTestExpectedResults
sl@0
   197
   Test should pass and display total test time and cycles per pixel
sl@0
   198
*/
sl@0
   199
void CTAlphaDrawing::DoTestDrawOpaqueWindowL(TDisplayMode aMode, TInt aIters) 
sl@0
   200
	{
sl@0
   201
	TestDrawWindowL(aMode, aIters, EUseOpaqueDraw, _L("WinOpaque"));
sl@0
   202
	}
sl@0
   203
	
sl@0
   204
/**
sl@0
   205
   @SYMTestCaseID
sl@0
   206
   GRAPHICS-UI-BENCH-0014
sl@0
   207
sl@0
   208
   @SYMTestCaseDesc
sl@0
   209
   The test determines how long it takes to draw transparent window compositions with window SetTransparencyFactor.
sl@0
   210
sl@0
   211
   @SYMTestActions
sl@0
   212
   Compare the results over time, and before and after changes to wserv code.
sl@0
   213
sl@0
   214
   @SYMTestExpectedResults
sl@0
   215
   Test should pass and display total test time and cycles per pixel
sl@0
   216
*/
sl@0
   217
void CTAlphaDrawing::DoTestDrawTransparentWindowFactorL(TDisplayMode aMode, TInt aIters) 
sl@0
   218
	{	
sl@0
   219
	TestDrawWindowL(aMode, aIters, EUseTransparencyFactor, _L("WinTrFac"));	
sl@0
   220
	}
sl@0
   221
sl@0
   222
/**
sl@0
   223
   @SYMTestCaseID
sl@0
   224
   GRAPHICS-UI-BENCH-0015
sl@0
   225
sl@0
   226
   @SYMTestCaseDesc
sl@0
   227
   The test determines how long it takes to draw transparent window compositions with SetTransparencyBitmap.
sl@0
   228
sl@0
   229
   @SYMTestActions
sl@0
   230
   Compare the results over time, and before and after changes to wserv code.
sl@0
   231
sl@0
   232
   @SYMTestExpectedResults
sl@0
   233
   Test should pass and display total test time and cycles per pixel
sl@0
   234
*/
sl@0
   235
void CTAlphaDrawing::DoTestDrawTransparentWindowBitmapL(TDisplayMode aMode, TInt aIters) 
sl@0
   236
	{	
sl@0
   237
	RWindow foregndWindow;
sl@0
   238
	foregndWindow = RWindow(iWsSession);
sl@0
   239
	User::LeaveIfError(foregndWindow.Construct(iWinGroup, (TInt)this+5));
sl@0
   240
	
sl@0
   241
	CFbsBitmap * sourceAlpha  = CreateSoftwareBitmapLC(iScreenDevice->SizeInPixels(), EGray256);
sl@0
   242
	VerticalGradientAlphaL(sourceAlpha, TRgb(0xffffffff), TRgb(0x00000000));
sl@0
   243
	
sl@0
   244
	CFbsBitmap * bmpModeDep  = CreateSoftwareBitmapLC(iScreenDevice->SizeInPixels(), aMode);
sl@0
   245
	CopyBitmapL(bmpModeDep, iSourceImage);
sl@0
   246
	
sl@0
   247
	foregndWindow.BeginRedraw();
sl@0
   248
	iWindowGc->Activate(foregndWindow);
sl@0
   249
	iWindowGc->SetBrushStyle(CGraphicsContext::ENullBrush);
sl@0
   250
	iWindowGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
sl@0
   251
	iWindowGc->DrawBitmap(iScreenDevice->SizeInPixels(), bmpModeDep, bmpModeDep->SizeInPixels());
sl@0
   252
	
sl@0
   253
	// Set transparency bitmap for this window
sl@0
   254
	User::LeaveIfError(foregndWindow.SetTransparencyBitmap(*sourceAlpha));
sl@0
   255
	
sl@0
   256
	iWindowGc->Deactivate();
sl@0
   257
	foregndWindow.EndRedraw();
sl@0
   258
	iWsSession.Flush();
sl@0
   259
sl@0
   260
	foregndWindow.Activate();
sl@0
   261
	
sl@0
   262
	DrawBlankWindowL(foregndWindow,aIters);
sl@0
   263
	iProfiler->ResultsAnalysis(_L("WinTrBmp"), 0, aMode, 0, aIters);
sl@0
   264
	
sl@0
   265
	foregndWindow.Close();
sl@0
   266
	
sl@0
   267
	CleanupStack::PopAndDestroy(2, sourceAlpha);
sl@0
   268
	User::After(KDelay);
sl@0
   269
	}
sl@0
   270
sl@0
   271
/**
sl@0
   272
@SYMTestCaseID GRAPHICS-UI-BENCH-0016
sl@0
   273
@SYMTestPriority High
sl@0
   274
@SYMREQ 0000
sl@0
   275
@SYMTestCaseDesc 
sl@0
   276
Test test determines how long it takes to draw transparent window compositions with SetTransparencyAlphaChannel.
sl@0
   277
sl@0
   278
@SYMTestActions
sl@0
   279
Compare the results over time, and before and after changes to wserv code.
sl@0
   280
sl@0
   281
@SYMTestExpectedResults
sl@0
   282
Test should pass and display total test time and cycles per pixel
sl@0
   283
*/
sl@0
   284
void CTAlphaDrawing::DoTestDrawTransparentWindowAlphaChannelL(TDisplayMode aMode, TInt aIters) 
sl@0
   285
	{		
sl@0
   286
	RWindow foregndWindow;
sl@0
   287
	foregndWindow = RWindow(iWsSession);
sl@0
   288
	User::LeaveIfError(foregndWindow.Construct(iWinGroup, (TInt)this+6));	
sl@0
   289
	
sl@0
   290
	CFbsBitmap * sourceAlpha  = CreateSoftwareBitmapLC(iSourceImage->SizeInPixels(), EGray256);
sl@0
   291
	VerticalGradientAlphaL(sourceAlpha, TRgb(0xffffffff), TRgb(0x00000000));
sl@0
   292
	
sl@0
   293
	CFbsBitmap * bmpModeDep  = CreateSoftwareBitmapLC(iScreenDevice->SizeInPixels(), aMode);
sl@0
   294
	CopyBitmapL(bmpModeDep, iSourceImage);
sl@0
   295
		
sl@0
   296
	TPoint point;
sl@0
   297
	TRect  rect(iScreenDevice->SizeInPixels());
sl@0
   298
			
sl@0
   299
	foregndWindow.BeginRedraw();
sl@0
   300
	iWindowGc->Activate(foregndWindow);
sl@0
   301
	iWindowGc->SetBrushStyle(CGraphicsContext::ENullBrush);
sl@0
   302
	iWindowGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
sl@0
   303
	
sl@0
   304
	iWindowGc->DrawBitmapMasked(rect, bmpModeDep, bmpModeDep->SizeInPixels(), sourceAlpha, EFalse);
sl@0
   305
	
sl@0
   306
	User::LeaveIfError(foregndWindow.SetTransparencyAlphaChannel());
sl@0
   307
	
sl@0
   308
	iWindowGc->Deactivate();
sl@0
   309
	foregndWindow.EndRedraw();
sl@0
   310
	iWsSession.Flush();
sl@0
   311
sl@0
   312
	foregndWindow.Activate();
sl@0
   313
	
sl@0
   314
	DrawBlankWindowL(foregndWindow,aIters);
sl@0
   315
	iProfiler->ResultsAnalysis(_L("WinTrAlphaCh"), 0, aMode, 0, aIters);
sl@0
   316
			
sl@0
   317
	foregndWindow.Close();
sl@0
   318
	CleanupStack::PopAndDestroy(2, sourceAlpha);			
sl@0
   319
	User::After(KDelay);
sl@0
   320
	}
sl@0
   321
sl@0
   322
/**
sl@0
   323
   @SYMTestCaseID
sl@0
   324
   GRAPHICS-UI-BENCH-0017
sl@0
   325
sl@0
   326
   @SYMTestCaseDesc
sl@0
   327
   Creates foreground window with alpha channel transparency.
sl@0
   328
   An image with alpha mask is bitblitted to this window.
sl@0
   329
   The test determines how long it takes to create a window
sl@0
   330
sl@0
   331
   @SYMTestActions
sl@0
   332
   Compare the results over time, and before and after changes to wserv code.
sl@0
   333
sl@0
   334
   @SYMTestExpectedResults
sl@0
   335
   Test should pass and display total test time and cycles per pixel
sl@0
   336
*/
sl@0
   337
void CTAlphaDrawing::DoTestCreateWindowL(TDisplayMode aMode, TInt aIters) 
sl@0
   338
	{
sl@0
   339
	RWindow foregndWindow;
sl@0
   340
	
sl@0
   341
	CFbsBitmap * sourceAlpha  = CreateSoftwareBitmapLC(iSourceImage->SizeInPixels(), EGray256);
sl@0
   342
	VerticalGradientAlphaL(sourceAlpha, TRgb(0xffffffff), TRgb(0x00000000));
sl@0
   343
		
sl@0
   344
	CFbsBitmap * bmpModeDep  = CreateSoftwareBitmapLC(iScreenDevice->SizeInPixels(), aMode);
sl@0
   345
	CopyBitmapL(bmpModeDep, iSourceImage);
sl@0
   346
	
sl@0
   347
	TPoint point;
sl@0
   348
	TRect  rect(iScreenDevice->SizeInPixels());
sl@0
   349
	iProfiler->InitResults();
sl@0
   350
	for(TInt i=KIterationsToTest; i>=0; i--)
sl@0
   351
		{
sl@0
   352
		foregndWindow = RWindow(iWsSession);
sl@0
   353
		User::LeaveIfError(foregndWindow.Construct(iWinGroup, (TInt)this+7));
sl@0
   354
		
sl@0
   355
		foregndWindow.BeginRedraw();
sl@0
   356
		iWindowGc->Activate(foregndWindow);
sl@0
   357
		iWindowGc->SetBrushStyle(CGraphicsContext::ENullBrush);
sl@0
   358
		iWindowGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
sl@0
   359
		iWindowGc->DrawBitmapMasked(rect, bmpModeDep, bmpModeDep->SizeInPixels(), sourceAlpha, EFalse);
sl@0
   360
					
sl@0
   361
		TInt ret = foregndWindow.SetTransparencyAlphaChannel();
sl@0
   362
		if (ret == KErrNotSupported)
sl@0
   363
			ERR_PRINTF1(_L("Transparency not enabled - Turn on transparency in wsini.ini file"));			
sl@0
   364
		User::LeaveIfError(ret);			
sl@0
   365
		
sl@0
   366
		iWindowGc->Deactivate();
sl@0
   367
		foregndWindow.EndRedraw();
sl@0
   368
		iWsSession.Flush();
sl@0
   369
sl@0
   370
		foregndWindow.Activate();
sl@0
   371
				
sl@0
   372
		iWsSession.Flush();
sl@0
   373
		iProfiler->MarkResultSetL();
sl@0
   374
				
sl@0
   375
		foregndWindow.Close();
sl@0
   376
		}
sl@0
   377
	iProfiler->ResultsAnalysis(_L("WinCreation"), 0, aMode, 0, aIters);
sl@0
   378
	CleanupStack::PopAndDestroy(2, sourceAlpha);					
sl@0
   379
	User::After(KDelay);
sl@0
   380
	}
sl@0
   381
sl@0
   382
CTAlphaDrawing::~CTAlphaDrawing()
sl@0
   383
	{
sl@0
   384
	delete iSourceImage;
sl@0
   385
	delete iWindowGc;	
sl@0
   386
	delete iScreenDevice;
sl@0
   387
	iBackgndWindow.Close();
sl@0
   388
	iWinGroup.Close();
sl@0
   389
	iWsSession.Close();
sl@0
   390
	RFbsSession::Disconnect();
sl@0
   391
	}
sl@0
   392
	
sl@0
   393
CTAlphaDrawing::CTAlphaDrawing()
sl@0
   394
	{
sl@0
   395
	SetTestStepName(KTAlphaDrawing);
sl@0
   396
	}
sl@0
   397
sl@0
   398
/**
sl@0
   399
Override of base class virtual
sl@0
   400
sl@0
   401
@return - TVerdict code
sl@0
   402
*/
sl@0
   403
TVerdict CTAlphaDrawing::doTestStepPreambleL()
sl@0
   404
	{			
sl@0
   405
	CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL();
sl@0
   406
	
sl@0
   407
	HAL::Get(HALData::ECPUSpeed,iCPUSpeed);
sl@0
   408
	
sl@0
   409
	User::LeaveIfError(RFbsSession::Connect());
sl@0
   410
	User::LeaveIfError(iWsSession.Connect());
sl@0
   411
sl@0
   412
	iScreenDevice = new (ELeave) CWsScreenDevice(iWsSession);
sl@0
   413
	User::LeaveIfError(iScreenDevice->Construct(0));	// screen number (0 is first screen)
sl@0
   414
	
sl@0
   415
	iSourceImage  = LoadBitmapL(KAlphaTestBitmap,0);
sl@0
   416
	
sl@0
   417
	iWindowGc = new (ELeave) CWindowGc(iScreenDevice);
sl@0
   418
	User::LeaveIfError(iWindowGc->Construct());
sl@0
   419
	
sl@0
   420
	TDisplayMode windowMode = iScreenDevice->DisplayMode();
sl@0
   421
	
sl@0
   422
	iWinGroup  = RWindowGroup(iWsSession);
sl@0
   423
	User::LeaveIfError(iWinGroup.Construct(1, EFalse));
sl@0
   424
	
sl@0
   425
	iBackgndWindow = RWindow(iWsSession);
sl@0
   426
	User::LeaveIfError(iBackgndWindow.Construct(iWinGroup, (TInt)this+8));
sl@0
   427
	iBackgndWindow.Activate();
sl@0
   428
	
sl@0
   429
	iBackgndWindow.SetNonTransparent();	
sl@0
   430
	iBackgndWindow.Invalidate();
sl@0
   431
	
sl@0
   432
	iWsSession.Flush();	
sl@0
   433
	return TestStepResult();
sl@0
   434
	}
sl@0
   435
	
sl@0
   436
/** 
sl@0
   437
Override of base class pure virtual
sl@0
   438
Our implementation only gets called if the base class doTestStepPreambleL() did
sl@0
   439
not leave. That being the case, the current test result value will be EPass.
sl@0
   440
sl@0
   441
Creates background window with black & white checker board. 
sl@0
   442
This background windows is used for each test case in this file
sl@0
   443
sl@0
   444
@return TVerdict code
sl@0
   445
*/	
sl@0
   446
TVerdict CTAlphaDrawing::doTestStepL()
sl@0
   447
	{	
sl@0
   448
	TInt iters = KIterationsToTest;
sl@0
   449
	
sl@0
   450
	INFO_PRINTF5(_L("TAlphaDrawing - Iterations:%d, CPUSpeed:%d kHz, Width: %d px, Height: %d px"),iters,iCPUSpeed,iScreenDevice->SizeInPixels().iWidth,iScreenDevice->SizeInPixels().iHeight);
sl@0
   451
	
sl@0
   452
	// tests to execute
sl@0
   453
	TBool iniok; TInt inival;
sl@0
   454
	iniok = GetIntFromConfig(_L("AlphaDrawingTests"), _L("testCreateWindowAlpha"), inival);
sl@0
   455
	TBool testCreateWindowAlpha					= ((iniok==EFalse) || (inival > 0));
sl@0
   456
	iniok = GetIntFromConfig(_L("AlphaDrawingTests"), _L("testDrawOpaqueWindow"), inival);	
sl@0
   457
	TBool testDrawOpaqueWindow					= ((iniok==EFalse) || (inival > 0));
sl@0
   458
	iniok = GetIntFromConfig(_L("AlphaDrawingTests"), _L("testDrawTransparentFactorWindow"), inival);
sl@0
   459
	TBool testDrawTransparentFactorWindow			= ((iniok==EFalse) || (inival > 0));
sl@0
   460
	iniok = GetIntFromConfig(_L("AlphaDrawingTests"), _L("testDrawTransparentWindowPerPixel"), inival);
sl@0
   461
	TBool testDrawTransparentWindowPerPixel			= ((iniok==EFalse) || (inival > 0));
sl@0
   462
	iniok = GetIntFromConfig(_L("AlphaDrawingTests"), _L("testDrawTransparentWindowPerPixelAlpha"), inival);
sl@0
   463
	TBool testDrawTransparentWindowPerPixelAlpha 	= ((iniok==EFalse) || (inival > 0));
sl@0
   464
	
sl@0
   465
	const TSize iWindowSize=iBackgndWindow.Size();
sl@0
   466
	
sl@0
   467
	// Initalise test - clear window and create checker board on background windows
sl@0
   468
	ClearWindow(iWsSession, iBackgndWindow, iWindowGc, BLACK_SEMI_TRANSPARENT);
sl@0
   469
	ChessBoard(iWsSession, iBackgndWindow, iWindowGc);
sl@0
   470
	
sl@0
   471
	iWsSession.Flush();
sl@0
   472
	
sl@0
   473
	TInt screenModesCnt=iScreenDevice->NumScreenModes();
sl@0
   474
	CArrayFixFlat<TInt> * rotationList=NULL;
sl@0
   475
sl@0
   476
	rotationList = new (ELeave) CArrayFixFlat<TInt>(KRotationGranulatity);
sl@0
   477
	CleanupStack::PushL(rotationList);
sl@0
   478
	
sl@0
   479
	for (TInt scm=0; scm<screenModesCnt; scm++) 
sl@0
   480
		{			
sl@0
   481
		iScreenDevice->GetRotationsList(scm,rotationList);
sl@0
   482
		
sl@0
   483
		for (TInt rot = 0; rot < rotationList->Count(); rot++) 
sl@0
   484
			{		
sl@0
   485
			TPixelsAndRotation	pxrot;
sl@0
   486
			pxrot.iPixelSize	=iWindowSize;
sl@0
   487
			
sl@0
   488
			iRotation=(CFbsBitGc::TGraphicsOrientation)rotationList->At(rot);
sl@0
   489
			pxrot.iRotation	=iRotation;
sl@0
   490
			
sl@0
   491
			iScreenDevice->SetScreenSizeAndRotation(pxrot);
sl@0
   492
			
sl@0
   493
			for(int m=0; m<1; m++)
sl@0
   494
				{
sl@0
   495
				// test drawing speed of window creation and destruction
sl@0
   496
				if ( testCreateWindowAlpha )
sl@0
   497
					{
sl@0
   498
					SetTestStepID(_L("GRAPHICS-UI-BENCH-0017"));
sl@0
   499
					DoTestCreateWindowL(KValidDisplayModes[m],iters);	
sl@0
   500
					RecordTestResultL();
sl@0
   501
					}
sl@0
   502
					
sl@0
   503
				// test drawing speed of an opaque window composition
sl@0
   504
				if ( testDrawOpaqueWindow )
sl@0
   505
					{	
sl@0
   506
					SetTestStepID(_L("GRAPHICS-UI-BENCH-0013"));
sl@0
   507
					DoTestDrawOpaqueWindowL(KValidDisplayModes[m],iters);	
sl@0
   508
					RecordTestResultL();
sl@0
   509
					}
sl@0
   510
				
sl@0
   511
				// test drawing speed of a transparent window composition with a transparency factor
sl@0
   512
				if ( testDrawTransparentFactorWindow )
sl@0
   513
					{
sl@0
   514
					SetTestStepID(_L("GRAPHICS-UI-BENCH-0014"));
sl@0
   515
					DoTestDrawTransparentWindowFactorL(KValidDisplayModes[m],iters);	
sl@0
   516
					RecordTestResultL();
sl@0
   517
					}
sl@0
   518
					
sl@0
   519
				// test drawing speed of a transparent window composition with a transparency bitmap
sl@0
   520
				if ( testDrawTransparentWindowPerPixel )
sl@0
   521
					{
sl@0
   522
					SetTestStepID(_L("GRAPHICS-UI-BENCH-0015"));
sl@0
   523
					DoTestDrawTransparentWindowBitmapL(KValidDisplayModes[m],iters);	
sl@0
   524
					RecordTestResultL();
sl@0
   525
					}
sl@0
   526
				
sl@0
   527
				// test drawing speed of a transparent window composition with alpha channel transparency
sl@0
   528
				if ( testDrawTransparentWindowPerPixelAlpha )
sl@0
   529
					{
sl@0
   530
					SetTestStepID(_L("GRAPHICS-UI-BENCH-0016"));
sl@0
   531
					DoTestDrawTransparentWindowAlphaChannelL(KValidDisplayModes[m],iters);	
sl@0
   532
					RecordTestResultL();
sl@0
   533
					}						
sl@0
   534
				} // m...Modes				
sl@0
   535
			} // rot ... Rotations			
sl@0
   536
		}	
sl@0
   537
	CleanupStack::PopAndDestroy(rotationList);
sl@0
   538
	TVerdict a = TestStepResult();
sl@0
   539
	return TestStepResult();
sl@0
   540
	}