os/graphics/graphicstest/uibench/src/talphablend.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicstest/uibench/src/talphablend.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,905 @@
     1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +/**
    1.20 + @file
    1.21 + @test
    1.22 + @internalComponent - Internal Symbian test code 
    1.23 +*/
    1.24 +
    1.25 +#include <gdi.h>
    1.26 +#include "talphablend.h"
    1.27 +
    1.28 +const TInt KIterationsToTest = 100;
    1.29 +const TInt KDrawRectIterationsToTest = KIterationsToTest*5;	// More as faster simpler drawing than bitblits
    1.30 +const TInt KDrawVertLineIterationsToTest = KIterationsToTest*5;
    1.31 +const TInt KDrawTextIterationsToTest = KIterationsToTest*2;// More as drawing fewer pixels than blits.
    1.32 +const TInt KDrawVertTextIterationsToTest = KIterationsToTest;// Slow, less iterations.
    1.33 +
    1.34 +    _LIT(KFontTypeface,"DejaVu Sans Condensed");
    1.35 +//
    1.36 +// We have two overloads of this test, the normal version that runs all tests except...
    1.37 +//
    1.38 +
    1.39 +CAlphaBlendTestNormal::CAlphaBlendTestNormal()
    1.40 +	{
    1.41 +	SetTestStepName(KAlphaBlendTest);
    1.42 +	}
    1.43 +
    1.44 +TVerdict CAlphaBlendTestNormal::doTestStepL()
    1.45 +	{	
    1.46 +	return(CAlphaBlendTest::doTestStepL(EFalse));
    1.47 +	}
    1.48 +
    1.49 +/*
    1.50 +...the iType font variant, this needs the rom configured differently so can not be run with the other tests
    1.51 +to configure the rom for iType fonts you need to use:
    1.52 +
    1.53 +..\iType\binaries\ityperast install
    1.54 +
    1.55 +and to remove them and swich back to normal
    1.56 +
    1.57 + ..\iType\binaries\ityperast uninstall
    1.58 +*/
    1.59 +
    1.60 +CAlphaBlendTestIType::CAlphaBlendTestIType()
    1.61 +	{
    1.62 +	SetTestStepName(KAlphaBlendTestIType);
    1.63 +	}
    1.64 +
    1.65 +TVerdict CAlphaBlendTestIType::doTestStepL()
    1.66 +	{	
    1.67 +	return(CAlphaBlendTest::doTestStepL(ETrue));
    1.68 +	}
    1.69 +
    1.70 +/**
    1.71 +Override of base class pure virtual
    1.72 +Our implementation only gets called if the base class doTestStepPreambleL() did
    1.73 +not leave. That being the case, the current test result value will be EPass.
    1.74 +
    1.75 +@return - TVerdict code
    1.76 +*/
    1.77 +TVerdict CAlphaBlendTest::doTestStepL(TBool aIType)
    1.78 +	{	
    1.79 +	RWsSession wsSession;
    1.80 +	User::LeaveIfError(wsSession.Connect());
    1.81 +	CleanupClosePushL(wsSession);
    1.82 +
    1.83 +	//
    1.84 +	// Uncomment to debug WSERV redraw problems.
    1.85 +	// wsSession.SetAutoFlush(ETrue); 
    1.86 +	
    1.87 +	CWsScreenDevice* windowDevice = new (ELeave) CWsScreenDevice(wsSession);
    1.88 +	CleanupStack::PushL(windowDevice);
    1.89 +	User::LeaveIfError(windowDevice->Construct());
    1.90 +	CWindowGc* windowGc=NULL;	
    1.91 +	User::LeaveIfError(windowDevice->CreateContext(windowGc)); // create graphics context	
    1.92 +	CleanupStack::PushL(windowGc);	
    1.93 +	
    1.94 +	RWindowGroup group;	
    1.95 +	group  = RWindowGroup(wsSession);
    1.96 +	CleanupClosePushL(group);
    1.97 +	User::LeaveIfError(group.Construct(1, EFalse));
    1.98 +	
    1.99 +	RWindow background;
   1.100 +	background = RWindow(wsSession);
   1.101 +	CleanupClosePushL(background);
   1.102 +	User::LeaveIfError(background.Construct(group, 2));
   1.103 +	
   1.104 +	RWindow window;
   1.105 +	window = RWindow(wsSession);
   1.106 +	CleanupClosePushL(window);
   1.107 +	User::LeaveIfError(window.Construct(group, 3));
   1.108 +
   1.109 +	TSize        windowSize = windowDevice->SizeInPixels();
   1.110 +	TDisplayMode windowMode = windowDevice->DisplayMode();
   1.111 +
   1.112 +	background.Activate();
   1.113 +	background.Invalidate();
   1.114 +
   1.115 +	ClearWindow(wsSession, background, windowGc, BLACK_SEMI_TRANSPARENT);	
   1.116 +	ClearWindow(wsSession, window, windowGc, BLACK_SEMI_TRANSPARENT);
   1.117 +	
   1.118 +	window.SetTransparencyAlphaChannel();	
   1.119 +	window.Activate();
   1.120 +	window.Invalidate();
   1.121 +	if (aIType)
   1.122 +		{
   1.123 +		if (CheckMonoTypeInstalledL())
   1.124 +			DoDrawBlendedTestsL(EBlendTestDrawTextIType,wsSession, KDrawVertTextIterationsToTest);
   1.125 +		else
   1.126 +			{
   1.127 +			INFO_PRINTF1(_L("Monotype fonts not installed, skipping test"));
   1.128 +			}
   1.129 +		}
   1.130 +	else
   1.131 +		{
   1.132 +/*
   1.133 +Test speed of blended draw rects on all modes supporting alpha blending
   1.134 +*/	
   1.135 +		DoDrawBlendedTestsL(EBlendTestDrawRect,wsSession, KDrawRectIterationsToTest);
   1.136 +/*
   1.137 +Test speed of blended draw vertical line calls on all modes supporting alpha blending
   1.138 +*/	
   1.139 +		DoDrawBlendedTestsL(EBlendTestVerticalLine,wsSession, KDrawVertLineIterationsToTest);
   1.140 +/*
   1.141 +Test speed of blended draw text calls on all modes supporting alpha blending
   1.142 +*/	
   1.143 +		DoDrawBlendedTestsL(EBlendTestDrawText,wsSession, KDrawTextIterationsToTest);
   1.144 +		DoDrawBlendedTestsL(EBlendTestDrawTextAntiAliased,wsSession, KDrawVertTextIterationsToTest);
   1.145 +		DoDrawBlendedTestsL(EBlendTestDrawVerticalText,wsSession, KDrawVertTextIterationsToTest);
   1.146 +/**
   1.147 +   @SYMTestCaseID
   1.148 +   GRAPHICS-UI-BENCH-0022
   1.149 +
   1.150 +   @SYMTestCaseDesc
   1.151 +   Alphablend test BITBLT with EColor16MA source and EColor16MU destination.
   1.152 +
   1.153 +   @SYMTestActions
   1.154 +   Compare the results over time
   1.155 +
   1.156 +   @SYMTestExpectedResults
   1.157 +*/
   1.158 +		RDebug::Printf("Alpha Tests: EColor16MU, EColor16MA");
   1.159 +		RDebug::Printf("Alpha Blend");	
   1.160 +		SetTestStepID(_L("GRAPHICS-UI-BENCH-0022"));
   1.161 +		DoAlphaBlendBitmapsBitmapTestL(EColor16MA, EColor16MU, wsSession, window, windowGc, KIterationsToTest);	
   1.162 +		RecordTestResultL();
   1.163 +
   1.164 +/**
   1.165 +   @SYMTestCaseID
   1.166 +   GRAPHICS-UI-BENCH-0023
   1.167 +
   1.168 +   @SYMTestCaseDesc
   1.169 +   Test BITBLT with EColor16MA source and EColor16MU destination.
   1.170 +
   1.171 +   @SYMTestActions
   1.172 +   Compare the results over time
   1.173 +
   1.174 +   @SYMTestExpectedResults
   1.175 +*/
   1.176 +		RDebug::Printf("BitBlt Alpha");
   1.177 +		SetTestStepID(_L("GRAPHICS-UI-BENCH-0023"));
   1.178 +		DoBitBltAlphaBitmapTestL(EColor16MA, EColor16MU, wsSession, window, windowGc, KIterationsToTest);
   1.179 +		RecordTestResultL();
   1.180 +	
   1.181 +/**
   1.182 +   @SYMTestCaseID
   1.183 +   GRAPHICS-UI-BENCH-0024
   1.184 +
   1.185 +   @SYMTestCaseDesc
   1.186 +   Alpha blend test BITBLT with EColor16MA source and EColor16MA destination.
   1.187 +
   1.188 +   @SYMTestActions
   1.189 +   Compare the results over time
   1.190 +
   1.191 +   @SYMTestExpectedResults
   1.192 +*/
   1.193 +		RDebug::Printf("Alpha Tests: EColor16MA, EColor16MA");
   1.194 +		RDebug::Printf("Alpha Blend");	
   1.195 +		SetTestStepID(_L("GRAPHICS-UI-BENCH-0024"));
   1.196 +		DoAlphaBlendBitmapsBitmapTestL(EColor16MA,EColor16MA, wsSession, window, windowGc, KIterationsToTest);
   1.197 +		RecordTestResultL();
   1.198 +
   1.199 +/**
   1.200 +   @SYMTestCaseID
   1.201 +   GRAPHICS-UI-BENCH-0025
   1.202 +
   1.203 +   @SYMTestCaseDesc
   1.204 +   Test BITBLT with EColor16MA source and EColor16MA destination.
   1.205 +
   1.206 +   @SYMTestActions
   1.207 +   Compare the results over time
   1.208 +
   1.209 +   @SYMTestExpectedResults
   1.210 +*/
   1.211 +		RDebug::Printf("BitBlt Alpha");
   1.212 +		SetTestStepID(_L("GRAPHICS-UI-BENCH-0025"));
   1.213 +		DoBitBltAlphaBitmapTestL(EColor16MA, EColor16MA, wsSession, window, windowGc, KIterationsToTest);
   1.214 +		RecordTestResultL();
   1.215 +/**
   1.216 +	@SYMTestCaseID
   1.217 +	GRAPHICS-UI-BENCH-0063
   1.218 +	
   1.219 +	@SYMTestCaseDesc
   1.220 +	Test BITBLT with EColor16MAP source and EColor16MAP destination.
   1.221 +	
   1.222 +	@SYMTestActions
   1.223 +	Compare the results over several iterations over time.
   1.224 +	
   1.225 +	@SYMTestExpectedResults
   1.226 +*/
   1.227 +		SetTestStepID(_L("GRAPHICS-UI-BENCH-0063"));
   1.228 +		DoNormalBitBltL(EFalse, EColor16MAP,EColor16MAP, wsSession, window, windowGc, KIterationsToTest);
   1.229 +		RecordTestResultL();
   1.230 +	
   1.231 +/**
   1.232 +	@SYMTestCaseID
   1.233 +	GRAPHICS-UI-BENCH-0064
   1.234 +	
   1.235 +	@SYMTestCaseDesc
   1.236 +	Test BITBLT with EColor16MA source and EColor16MA destination.
   1.237 +	
   1.238 +	@SYMTestActions
   1.239 +	Compare the results over several iterations over time.
   1.240 +	
   1.241 +	@SYMTestExpectedResults
   1.242 +*/
   1.243 +		SetTestStepID(_L("GRAPHICS-UI-BENCH-0064"));
   1.244 +		DoNormalBitBltL(EFalse, EColor16MA,EColor16MA, wsSession, window, windowGc, KIterationsToTest);
   1.245 +		RecordTestResultL();
   1.246 +	
   1.247 +/**
   1.248 +	@SYMTestCaseID
   1.249 +	GRAPHICS-UI-BENCH-0065
   1.250 +	
   1.251 +	@SYMTestCaseDesc
   1.252 +	Test BITBLT with EColor16MAP source and EColor16MA destination.
   1.253 +	
   1.254 +	@SYMTestActions
   1.255 +	Compare the results over several iterations over time.
   1.256 +	
   1.257 +	@SYMTestExpectedResults
   1.258 +*/
   1.259 +		SetTestStepID(_L("GRAPHICS-UI-BENCH-0065"));
   1.260 +		DoNormalBitBltL(EFalse, EColor16MAP,EColor16MA, wsSession, window, windowGc, KIterationsToTest);
   1.261 +		RecordTestResultL();
   1.262 +	
   1.263 +/**
   1.264 +	@SYMTestCaseID
   1.265 +	GRAPHICS-UI-BENCH-0066
   1.266 +	
   1.267 +	@SYMTestCaseDesc
   1.268 +	Test BITBLT with EColor16MA source and EColor16MAP destination.
   1.269 +	
   1.270 +	@SYMTestActions
   1.271 +	Compare the results over several iterations over time.
   1.272 +	
   1.273 +	@SYMTestExpectedResults
   1.274 +*/
   1.275 +		SetTestStepID(_L("GRAPHICS-UI-BENCH-0066"));
   1.276 +		DoNormalBitBltL(EFalse, EColor16MA,EColor16MAP, wsSession, window, windowGc, KIterationsToTest);
   1.277 +		RecordTestResultL();
   1.278 +	
   1.279 +/**
   1.280 +	@SYMTestCaseID
   1.281 +	GRAPHICS-UI-BENCH-0067
   1.282 +	
   1.283 +	@SYMTestCaseDesc
   1.284 +	Test BITBLT with EColor16MU source and EColor16MU destination.
   1.285 +	
   1.286 +	@SYMTestActions
   1.287 +	Compare the results over several iterations over time.
   1.288 +	
   1.289 +	@SYMTestExpectedResults
   1.290 +*/
   1.291 +		SetTestStepID(_L("GRAPHICS-UI-BENCH-0067"));
   1.292 +		DoNormalBitBltL(EFalse, EColor16MU,EColor16MU, wsSession, window, windowGc, KIterationsToTest);
   1.293 +		RecordTestResultL();
   1.294 +	
   1.295 +/**
   1.296 +	@SYMTestCaseID
   1.297 +	GRAPHICS-UI-BENCH-0068
   1.298 +	
   1.299 +	@SYMTestCaseDesc
   1.300 +	Test BITBLT with EColor16MAP source and EColor16MU destination.
   1.301 +	
   1.302 +	@SYMTestActions
   1.303 +	Compare the results over several iterations over time.
   1.304 +	
   1.305 +	@SYMTestExpectedResults
   1.306 +*/
   1.307 +		SetTestStepID(_L("GRAPHICS-UI-BENCH-0068"));
   1.308 +		DoNormalBitBltL(EFalse, EColor16MAP,EColor16MU, wsSession, window, windowGc, KIterationsToTest);
   1.309 +		RecordTestResultL();
   1.310 +	
   1.311 +/**
   1.312 +	@SYMTestCaseID
   1.313 +	GRAPHICS-UI-BENCH-0069
   1.314 +	
   1.315 +	@SYMTestCaseDesc
   1.316 +	Test BITBLT with EColor16MU source and EColor16MAP destination.
   1.317 +	
   1.318 +	@SYMTestActions
   1.319 +	Compare the results over several iterations over time.
   1.320 +	
   1.321 +	@SYMTestExpectedResults
   1.322 +*/
   1.323 +		SetTestStepID(_L("GRAPHICS-UI-BENCH-0069"));
   1.324 +		DoNormalBitBltL(EFalse, EColor16MU,EColor16MAP, wsSession, window, windowGc, KIterationsToTest);
   1.325 +		RecordTestResultL();
   1.326 +	
   1.327 +/**
   1.328 +	@SYMTestCaseID
   1.329 +	GRAPHICS-UI-BENCH-0070
   1.330 +	
   1.331 +	@SYMTestCaseDesc
   1.332 +	Test BITBLT with EColor64K source and EColor16MU destination.
   1.333 +	
   1.334 +	@SYMTestActions
   1.335 +	Compare the results over several iterations over time.
   1.336 +	
   1.337 +	@SYMTestExpectedResults
   1.338 +*/
   1.339 +		SetTestStepID(_L("GRAPHICS-UI-BENCH-0070"));
   1.340 +		DoNormalBitBltL(ETrue, EColor64K,EColor16MU, wsSession, window, windowGc, KIterationsToTest);
   1.341 +		
   1.342 +		RecordTestResultL();
   1.343 +/**
   1.344 +	@SYMTestCaseID
   1.345 +	GRAPHICS-UI-BENCH-0071
   1.346 +	
   1.347 +	@SYMTestCaseDesc
   1.348 +	Test DrawBitmap with different sizes (STRETCHED) with EColor16MAP source and EColor16MAP destination.
   1.349 +	
   1.350 +	@SYMTestActions
   1.351 +	Compare the results over several iterations over time.
   1.352 +	
   1.353 +	@SYMTestExpectedResults
   1.354 +*/
   1.355 +		SetTestStepID(_L("GRAPHICS-UI-BENCH-0071"));
   1.356 +		DoDrawBitmapL(EFalse, EColor16MAP, EColor16MAP, wsSession, window, windowGc, KIterationsToTest);
   1.357 +		RecordTestResultL();
   1.358 +	
   1.359 +/**
   1.360 +	@SYMTestCaseID
   1.361 +	GRAPHICS-UI-BENCH-0072
   1.362 +	
   1.363 +	@SYMTestCaseDesc
   1.364 +	Test DrawBitmap with different sizes (STRETCHED) with EColor16MA source and EColor16MA destination.
   1.365 +	
   1.366 +	@SYMTestActions
   1.367 +	Compare the results over several iterations over time.
   1.368 +	
   1.369 +	@SYMTestExpectedResults
   1.370 +*/
   1.371 +	
   1.372 +		SetTestStepID(_L("GRAPHICS-UI-BENCH-0072"));
   1.373 +		DoDrawBitmapL(EFalse, EColor16MA, EColor16MA, wsSession, window, windowGc, KIterationsToTest);
   1.374 +		RecordTestResultL();
   1.375 +	
   1.376 +/**
   1.377 +	@SYMTestCaseID
   1.378 +	GRAPHICS-UI-BENCH-0073
   1.379 +	
   1.380 +	@SYMTestCaseDesc
   1.381 +	Test DrawBitmap (using alpha mask) with different sizes (STRETCHED) with EColor16MU source and EColor16MU destination.
   1.382 +	
   1.383 +	@SYMTestActions
   1.384 +	Compare the results over several iterations over time.
   1.385 +	
   1.386 +	@SYMTestExpectedResults
   1.387 +*/	
   1.388 +		SetTestStepID(_L("GRAPHICS-UI-BENCH-0073"));
   1.389 +		DoDrawBitmapL(ETrue, EColor16MU, EColor16MU, wsSession, window, windowGc, KIterationsToTest);
   1.390 +		RecordTestResultL();
   1.391 +	
   1.392 +/**
   1.393 +	@SYMTestCaseID
   1.394 +	GRAPHICS-UI-BENCH-0057
   1.395 +	
   1.396 +	@SYMTestCaseDesc
   1.397 +	Test DrawBitmap (using alpha mask) with different sizes (STRETCHED) with EColor16MAP source and EColor16MAP destination.
   1.398 +	
   1.399 +	@SYMTestActions
   1.400 +	Compare the results over several iterations over time.
   1.401 +	
   1.402 +	@SYMTestExpectedResults
   1.403 +*/
   1.404 +		SetTestStepID(_L("GRAPHICS-UI-BENCH-0057"));
   1.405 +		DoDrawBitmapL(ETrue, EColor16MAP, EColor16MAP, wsSession, window, windowGc, KIterationsToTest);	
   1.406 +		RecordTestResultL();
   1.407 +		}
   1.408 +	CleanupStack::PopAndDestroy(6, &wsSession);
   1.409 +	return TestStepResult();
   1.410 +	}
   1.411 +
   1.412 +void CAlphaBlendTest::DoDrawBlendedTestsL(TBlendTestFunc aTestFunc, RWsSession& aSession, TInt aNumIterations)
   1.413 +	{
   1.414 +	TDisplayMode blendModes[]={EColor16MAP,EColor16MA,EColor16MU,EColor64K};
   1.415 +	const TInt KNumBlendTestModes=sizeof(blendModes)/sizeof(TDisplayMode);
   1.416 +	for(TInt modeIndex=0;modeIndex<KNumBlendTestModes;modeIndex++)
   1.417 +		{
   1.418 +		DoDrawBlendedTestL(aTestFunc, 0x40, blendModes[modeIndex], aSession, aNumIterations);
   1.419 +		DoDrawBlendedTestL(aTestFunc, 0xFF, blendModes[modeIndex], aSession, aNumIterations);
   1.420 +		DoDrawBlendedTestL(aTestFunc, 0, blendModes[modeIndex], aSession, aNumIterations);
   1.421 +		}
   1.422 +	}
   1.423 +
   1.424 +void CAlphaBlendTest::DoDrawBlendedTestL(TBlendTestFunc aTestFunc, TInt aAlpha, TDisplayMode aDisplayMode, RWsSession& aSession, TInt aNumIterations)
   1.425 +	{
   1.426 +	SetScreenModeL(aDisplayMode);
   1.427 +	const TSize devSize = iScreenDevice->SizeInPixels();
   1.428 +	// For fair back to back tests of rotated mode we need graphics clipped to a square test area.
   1.429 +	// Although if we aren't going to be comparing rotated results against each other it might be better
   1.430 +	// to allow the tests to use the full available area.
   1.431 +	TSize testSize;
   1.432 +	testSize.iWidth=Min(devSize.iWidth,devSize.iHeight);
   1.433 +	testSize.iHeight=testSize.iWidth;
   1.434 +
   1.435 +	TFontSpec testFontSpec; 
   1.436 +	if (aTestFunc==EBlendTestDrawTextAntiAliased || aTestFunc==EBlendTestDrawTextIType)
   1.437 +		{
   1.438 +		testFontSpec.iTypeface.iName=KFontTypeface;
   1.439 +		if (aTestFunc==EBlendTestDrawTextAntiAliased)
   1.440 +			{
   1.441 +			testFontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
   1.442 +			}
   1.443 +		else
   1.444 +			{
   1.445 +			testFontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
   1.446 +			testFontSpec.iFontStyle.SetEffects(FontEffect::EDropShadow, ETrue);
   1.447 +			testFontSpec.iFontStyle.SetEffects(FontEffect::EOutline, ETrue);
   1.448 +			}
   1.449 +		}
   1.450 +	testFontSpec.iHeight=12;
   1.451 +	// Set bold because sets more pixels, so tests blending code more
   1.452 +	testFontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
   1.453 +	_LIT(KTestBlendTextString,"BLENDTESTWITHBIGSOLIDCHARACTERS0123456789HAVEWERUNOUTOFSCREENYET?OKAFEWMORECHARACTERSJUSTTOMAKESURE");
   1.454 +	const TInt maxTextLen=KTestBlendTextString().Length();
   1.455 +//
   1.456 +	TBool orientations[4];
   1.457 +	iGc->OrientationsAvailable(orientations);
   1.458 +// Use for loop to test across multiple rotations, however the implementation hardly varies at the moment
   1.459 +// so very little point in testing the differences, if in future an optimised route is added for normal
   1.460 +// rotation this test would be worth switching back to looping upto EGraphicsOrientationRotated270.
   1.461 +//
   1.462 +//	const TInt KMaxOrientation=CFbsBitGc::EGraphicsOrientationRotated270;
   1.463 +	const TInt KMaxOrientation=CFbsBitGc::EGraphicsOrientationNormal;
   1.464 +	for (TInt orient = CFbsBitGc::EGraphicsOrientationNormal; orient <= KMaxOrientation; orient++)
   1.465 +		{
   1.466 +		if (orientations[orient])
   1.467 +			{
   1.468 +			iGc->SetOrientation((CFbsBitGc::TGraphicsOrientation)orient);
   1.469 +			User::After(100000);	// Let rotate sort itself out
   1.470 +			iGc->Reset();
   1.471 +			iGc->SetClippingRect(TRect(testSize));
   1.472 +			iGc->SetPenStyle(CGraphicsContext::ESolidPen);
   1.473 +			iGc->SetBrushColor(TRgb(0x80,0x80,0xFF));
   1.474 +			iGc->Clear();
   1.475 +			iGc->SetBrushColor(TRgb(10,128,240,aAlpha));
   1.476 +			iGc->SetPenColor(TRgb(240,128,10,aAlpha));
   1.477 +			iGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
   1.478 +			aSession.Flush();
   1.479 +
   1.480 +			CFbsFont* font=NULL;
   1.481 +			TInt fontHeight=0;
   1.482 +			TInt testParam=0;
   1.483 +			TSize orientatedTestSize=testSize;
   1.484 +			TBuf <32> testName;	
   1.485 +			TGlyphBitmapType checkGlyphBitmapType=EDefaultGlyphBitmap;
   1.486 +			TGlyphBitmapType actualGlyphBitmapType=EDefaultGlyphBitmap;
   1.487 +			TPtrC textPtr;
   1.488 +			switch(aTestFunc)
   1.489 +				{
   1.490 +			case EBlendTestVerticalLine:
   1.491 +				_LIT(KDrawRectVerticalLine,"DrawRectVertLine");
   1.492 +				testName=KDrawRectVerticalLine;
   1.493 +				break;
   1.494 +			case EBlendTestDrawRect:
   1.495 +				_LIT(KDrawRectAlpha,"DrawRectAlpha");
   1.496 +				testName=KDrawRectAlpha;
   1.497 +				iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
   1.498 +				iGc->SetPenStyle(CGraphicsContext::ENullPen);
   1.499 +				break;
   1.500 +			case EBlendTestDrawTextIType:
   1.501 +				_LIT(KDrawTextIType,"DrawTextIT");
   1.502 +				testName=KDrawTextIType;
   1.503 +				testParam=testSize.iHeight;
   1.504 +				checkGlyphBitmapType=EFourColourBlendGlyphBitmap;
   1.505 +				goto drawTextTest;
   1.506 +			case EBlendTestDrawTextAntiAliased:
   1.507 +				_LIT(KDrawTextAA,"DrawTextAA");
   1.508 +				testName=KDrawTextAA;
   1.509 +				testParam=testSize.iHeight;
   1.510 +				checkGlyphBitmapType=EAntiAliasedGlyphBitmap;
   1.511 +				goto drawTextTest;
   1.512 +			case EBlendTestDrawVerticalText:
   1.513 +				_LIT(KDrawTextVert,"DrawTextVert");
   1.514 +				orientatedTestSize.SetSize(orientatedTestSize.iHeight,orientatedTestSize.iWidth);
   1.515 +				testName=KDrawTextVert;
   1.516 +				testParam=testSize.iWidth;
   1.517 +				checkGlyphBitmapType=EMonochromeGlyphBitmap;
   1.518 +				goto drawTextTest;
   1.519 +			case EBlendTestDrawText:
   1.520 +				_LIT(KDrawText,"DrawText");
   1.521 +				testParam=testSize.iHeight;
   1.522 +				testName=KDrawText;
   1.523 +				checkGlyphBitmapType=EMonochromeGlyphBitmap;
   1.524 +drawTextTest:	User::LeaveIfError(iScreenDevice->BitmapDevice().GetNearestFontInPixels((CFont* &)font,testFontSpec));
   1.525 +				fontHeight=font->HeightInPixels();
   1.526 +				iGc->UseFont(font);
   1.527 +				actualGlyphBitmapType=font->FontSpecInTwips().iFontStyle.BitmapType();
   1.528 +				TInt displayLen=Min(font->TextCount(KTestBlendTextString,orientatedTestSize.iWidth)+1,maxTextLen);
   1.529 +				textPtr.Set(KTestBlendTextString().Left(displayLen));
   1.530 +				iScreenDevice->BitmapDevice().ReleaseFont(font);
   1.531 +				break;
   1.532 +				}
   1.533 +			if (checkGlyphBitmapType!=EDefaultGlyphBitmap)
   1.534 +				{
   1.535 +				if (actualGlyphBitmapType!=checkGlyphBitmapType)
   1.536 +					{
   1.537 +					INFO_PRINTF3(_L("Failed to load correct glyph type font, wanted %d, got %d"),checkGlyphBitmapType, actualGlyphBitmapType);
   1.538 +					break;
   1.539 +					}
   1.540 +				}
   1.541 +			_LIT(KAppendAlphaTxt,"[A=0x%02x]");
   1.542 +			testName.AppendFormat(KAppendAlphaTxt,aAlpha);
   1.543 +			iProfiler->InitResults();	
   1.544 +			for(TInt iter=0; iter<aNumIterations; iter++)
   1.545 +				{
   1.546 +				switch(aTestFunc)
   1.547 +					{
   1.548 +				case EBlendTestVerticalLine:
   1.549 +					for(TInt xpos=0; xpos<testSize.iWidth; xpos++)
   1.550 +						iGc->DrawLine(TPoint(xpos,0),TPoint(xpos,testSize.iHeight));
   1.551 +					break;
   1.552 +				case EBlendTestDrawRect:
   1.553 +					iGc->DrawRect(TRect(testSize));
   1.554 +					break;
   1.555 +				case EBlendTestDrawText:
   1.556 +				case EBlendTestDrawVerticalText:
   1.557 +				case EBlendTestDrawTextAntiAliased:
   1.558 +				case EBlendTestDrawTextIType:
   1.559 +					{
   1.560 +					for(TInt pos=0;pos<testParam;pos+=fontHeight)
   1.561 +						{
   1.562 +						if (aTestFunc==EBlendTestDrawVerticalText)
   1.563 +							iGc->DrawTextVertical(textPtr,TPoint(pos,0),EFalse);
   1.564 +						else
   1.565 +							iGc->DrawText(textPtr,TPoint(0,pos));
   1.566 +						}
   1.567 +					break;
   1.568 +					}
   1.569 +					}
   1.570 +				iProfiler->MarkResultSetL();
   1.571 +				}
   1.572 +			INFO_PRINTF3(_L("%S %S"), &testName, &ColorModeName(aDisplayMode));
   1.573 +			iProfiler->ResultsAnalysis(testName, orient, aDisplayMode, aDisplayMode, aNumIterations);
   1.574 +			}
   1.575 +		}
   1.576 +	iGc->SetOrientation(CFbsBitGc::EGraphicsOrientationNormal);
   1.577 +	}
   1.578 +
   1.579 +TBool CAlphaBlendTest::CheckMonoTypeInstalledL()
   1.580 +	{
   1.581 +	SetScreenModeL(EColor16MU);
   1.582 +//
   1.583 +	TFontSpec fontSpec;
   1.584 +	fontSpec.iTypeface.iName = KFontTypeface;
   1.585 +	fontSpec.iHeight = 20;
   1.586 +	fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
   1.587 +	fontSpec.iFontStyle.SetEffects(FontEffect::EDropShadow, ETrue);
   1.588 +	fontSpec.iFontStyle.SetEffects(FontEffect::EOutline, ETrue);
   1.589 +	CFont* font;
   1.590 +	User::LeaveIfError(iScreenDevice->BitmapDevice().GetNearestFontToDesignHeightInPixels((CFont*&)font,fontSpec));
   1.591 +	TBool monoTypeInstalled=font->FontSpecInTwips().iFontStyle.BitmapType()==EFourColourBlendGlyphBitmap;
   1.592 +	iScreenDevice->BitmapDevice().ReleaseFont(font);
   1.593 +	return(monoTypeInstalled);
   1.594 +	}
   1.595 +
   1.596 +/**
   1.597 +Bitblt test
   1.598 +
   1.599 +@param aSrcMode is the source display mode
   1.600 +@param aDstMode is the destination display mode
   1.601 +@param aSession is the windows server session
   1.602 +@param aWindow is a reference to the window
   1.603 +@param aGc is the graphics context of the window
   1.604 +@param aNumIterations is the number of iterations to run the test
   1.605 +*/		
   1.606 +void CAlphaBlendTest::DoBitBltAlphaBitmapTestL(TDisplayMode aSrcMode,TDisplayMode aDstMode, RWsSession& aSession, RWindow& aWindow, CWindowGc* aGc, TInt aNumIterations)
   1.607 +	{	
   1.608 +	const TSize bitmapSize = aWindow.Size();
   1.609 +	
   1.610 +	CFbsBitmap* bitmapTarget = CreateSoftwareBitmapLC(bitmapSize, aDstMode);
   1.611 +	CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmapTarget);
   1.612 +	CleanupStack::PushL(bitmapDevice);
   1.613 +	CFbsBitGc* bitmapGc = NULL;	
   1.614 +	User::LeaveIfError(bitmapDevice->CreateContext(bitmapGc));	
   1.615 +	CleanupStack::PushL(bitmapGc);
   1.616 +	
   1.617 +	CFbsBitmap* source = CreateSoftwareBitmapLC(bitmapSize, aSrcMode);
   1.618 +	CFbsBitmap* sourceAlpha = CreateSoftwareBitmapLC(bitmapSize, EGray256);	// match size to src
   1.619 +	VerticalGradientAlphaL(sourceAlpha, TRgb(0x01010101), TRgb(0xfefefefe));
   1.620 +	VerticalGradientAlphaL(source, TRgb(0x00000000), TRgb(0xffffffff));
   1.621 +
   1.622 +	TPoint point(0,0);
   1.623 +	
   1.624 +	bitmapGc->SetBrushStyle(CGraphicsContext::ENullBrush);
   1.625 +	bitmapGc->SetBrushColor(TRANSPARENT_BLACK);
   1.626 +
   1.627 +	bitmapGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
   1.628 +	bitmapGc->Clear();
   1.629 +	bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
   1.630 +	bitmapGc->BitBlt(point, source);
   1.631 +
   1.632 +	aGc->Activate(aWindow);
   1.633 +	aGc->BitBlt(point, bitmapTarget);
   1.634 +	aGc->Deactivate();
   1.635 +	aSession.Flush();
   1.636 +
   1.637 +	iProfiler->InitResults();		
   1.638 +	for(TInt i=0; i<aNumIterations; i++)
   1.639 +	{
   1.640 +		bitmapGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
   1.641 +		bitmapGc->Clear();
   1.642 +		bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
   1.643 +		bitmapGc->BitBlt(point, source);
   1.644 +		iProfiler->MarkResultSetL();
   1.645 +	}
   1.646 +	
   1.647 +	iProfiler->ResultsAnalysis(_L("DoBitBltAlphaBitmapTestL"), 0, aSrcMode, aDstMode, aNumIterations);
   1.648 +	
   1.649 +	// copy up to screen for sanity check
   1.650 +	aGc->Activate(aWindow);
   1.651 +	aGc->BitBlt(TPoint(), bitmapTarget);
   1.652 +	aGc->Deactivate();
   1.653 +	CleanupStack::PopAndDestroy(5, bitmapTarget); //sourceAlpha, source, bitmapGc, bitmapDevice, bitmapTarget
   1.654 +	}
   1.655 +
   1.656 +
   1.657 +/**
   1.658 +Clears the window to a colour
   1.659 +
   1.660 +@param aSession is the windows server session
   1.661 +@param aWindow is a reference to the window
   1.662 +@param aGc is the graphics context of the window
   1.663 +@param aColor is the colour to clear the window with
   1.664 +*/
   1.665 +void CAlphaBlendTest::ClearWindow(RWsSession& aSession, RWindow& aWindow, CWindowGc* aGc, TRgb aColor)
   1.666 +{
   1.667 +	// clear so we can see bitmap version has completed
   1.668 +	aWindow.Invalidate();
   1.669 +	aWindow.BeginRedraw();
   1.670 +	aGc->Activate(aWindow);
   1.671 +	aGc->SetBrushColor(aColor);
   1.672 +	aGc->Clear();
   1.673 +	aGc->Deactivate();
   1.674 +	aWindow.EndRedraw();
   1.675 +	aSession.Flush();
   1.676 +}
   1.677 +		
   1.678 +/**
   1.679 +BitBlts a bitmap to the windows GC.
   1.680 +
   1.681 +@param aSession is the windows server session
   1.682 +@param aWindow is a reference to the window
   1.683 +@param aGc is the graphics context of the window
   1.684 +@param aImage is the bitmap to bitblt
   1.685 +*/		
   1.686 +void CAlphaBlendTest::BitBlt(RWsSession& aSession, RWindow& aWindow, CWindowGc* aGc, CFbsBitmap& aImage)
   1.687 +	{
   1.688 +	aWindow.Invalidate();
   1.689 +	aWindow.BeginRedraw();
   1.690 +	aGc->Activate(aWindow);
   1.691 +	aGc->BitBlt(TPoint(0,0), &aImage);
   1.692 +	aGc->Deactivate();
   1.693 +	aWindow.EndRedraw();	
   1.694 +	aSession.Flush();	
   1.695 +	}
   1.696 +
   1.697 +/**
   1.698 +Alpha blends two bitmaps together
   1.699 +
   1.700 +@param aDisplayMode1 is the source display mode
   1.701 +@param aDisplayMode2 is the destination display mode
   1.702 +@param aSession is the windows server session
   1.703 +@param aWindow is a reference to the window
   1.704 +@param aGc is the graphics context of the window
   1.705 +@param aNumIterations is the number of iterations to run the test
   1.706 +*/	
   1.707 +void CAlphaBlendTest::DoAlphaBlendBitmapsBitmapTestL(TDisplayMode aSrcMode, TDisplayMode aDstMode, RWsSession& aSession, RWindow& aWindow, CWindowGc* aGc, TInt aNumIterations)
   1.708 +	{
   1.709 +	const TSize bitmapSize = aWindow.Size();	
   1.710 +
   1.711 +	CFbsBitmap* bitmapTarget = CreateSoftwareBitmapLC(bitmapSize, aDstMode);
   1.712 +	CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmapTarget);
   1.713 +	CleanupStack::PushL(bitmapDevice);
   1.714 +	
   1.715 +	CFbsBitGc* bitmapGc=NULL;
   1.716 +	User::LeaveIfError(bitmapDevice->CreateContext(bitmapGc));	
   1.717 +	CleanupStack::PushL(bitmapGc);
   1.718 +		
   1.719 +	CFbsBitmap* sourceUnder  = CreateSoftwareBitmapLC(bitmapSize, aDstMode);
   1.720 +	CFbsBitmap* sourceOver   = CreateSoftwareBitmapLC(bitmapSize, aSrcMode);
   1.721 +	CFbsBitmap* sourceAlpha  = CreateSoftwareBitmapLC(bitmapSize, EGray256);
   1.722 +
   1.723 +	VerticalGradientAlphaL(sourceAlpha, TRgb(0x01010101), TRgb(0xfefefefe));
   1.724 +	VerticalGradientAlphaL(sourceUnder, TRgb(0xff000000), TRgb(0x00ffffff));
   1.725 +	VerticalGradientAlphaL(sourceOver, TRgb(0x00ffffff), TRgb(0xff000000));
   1.726 +	RDebug::Printf("DABBBT 2");
   1.727 +
   1.728 +	TPoint point(0,0);
   1.729 +	TRect  rect(bitmapSize);
   1.730 +	
   1.731 +	bitmapGc->SetBrushStyle(CGraphicsContext::ENullBrush);
   1.732 +	bitmapGc->SetBrushColor(TRANSPARENT_BLACK);
   1.733 +
   1.734 +	bitmapGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
   1.735 +	bitmapGc->Clear();
   1.736 +	bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
   1.737 +	bitmapGc->AlphaBlendBitmaps(point, sourceUnder, sourceOver, rect, point, sourceAlpha, point);		
   1.738 +
   1.739 +	aGc->Activate(aWindow);
   1.740 +	aGc->BitBlt(point, bitmapTarget);
   1.741 +	aGc->Deactivate();
   1.742 +	aSession.Flush();
   1.743 +
   1.744 +	iProfiler->InitResults();
   1.745 +	// blend sourceUnder with sourceOver using alpha mask
   1.746 +	for(TInt i=0; i<aNumIterations; i++)
   1.747 +	{
   1.748 +		bitmapGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
   1.749 +		bitmapGc->Clear();
   1.750 +		bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
   1.751 +		bitmapGc->AlphaBlendBitmaps(point, sourceUnder, sourceOver, rect, point, sourceAlpha, point);
   1.752 +		iProfiler->MarkResultSetL();
   1.753 +	}
   1.754 +	iProfiler->ResultsAnalysis(_L("DoAlphaBlendBitmapsBitmapTestL"), 0, aSrcMode, aDstMode, aNumIterations);
   1.755 +	
   1.756 +	// copy up to screen for sanity check
   1.757 +	BitBlt(aSession, aWindow, aGc, *bitmapTarget);	
   1.758 +	CleanupStack::PopAndDestroy(6, bitmapTarget); // sourceAlpha, sourceOver, sourceUnder, bitmapGc, bitmapDevice, bitmapTarget
   1.759 +	}	
   1.760 +	
   1.761 +/**
   1.762 +Draws a stretched bitmap with or without a mask.
   1.763 +
   1.764 +@param aUseMask set to ETrue to use a alpha mask. Normally used for 16MU display modes that do not store the alpha.
   1.765 +@param aSrcMode is the source display mode
   1.766 +@param aDstMode is the destination display mode
   1.767 +@param aSession is the windows server session
   1.768 +@param aWindow is a reference to the window
   1.769 +@param aGc is the graphics context of the window
   1.770 +@param aNumIterations is the number of iterations to run the test
   1.771 +*/
   1.772 +void CAlphaBlendTest::DoDrawBitmapL(TBool aUseMask, TDisplayMode aSrcMode, TDisplayMode aDstMode, RWsSession& aSession, RWindow& aWindow, CWindowGc* aGc, TInt aNumIterations)
   1.773 +	{		
   1.774 +	const TSize bitmapSize = aWindow.Size();
   1.775 +	
   1.776 +	// Construct target bitmap.
   1.777 +	CFbsBitmap* bitmapTarget = CreateSoftwareBitmapLC(bitmapSize, aDstMode);
   1.778 +	CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmapTarget);
   1.779 +	CleanupStack::PushL(bitmapDevice);
   1.780 +	
   1.781 +	// Construct GC.
   1.782 +	CFbsBitGc* bitmapGc = NULL;
   1.783 +	User::LeaveIfError(bitmapDevice->CreateContext(bitmapGc));
   1.784 +	CleanupStack::PushL(bitmapGc);
   1.785 +	
   1.786 +	// Construct source bitmap.	
   1.787 +	TSize smallerSize(bitmapSize.iWidth/2,  bitmapSize.iHeight/2);
   1.788 +	CFbsBitmap* source = CreateSoftwareBitmapLC(smallerSize, aSrcMode);
   1.789 +	VerticalGradientAlphaL(source, TRgb(0x00000000), TRgb(0xffffffff));	
   1.790 +	CFbsBitmap* sourceAlpha = CreateSoftwareBitmapLC(smallerSize, EGray256);	// match size to src
   1.791 +	VerticalGradientAlphaL(sourceAlpha, TRgb(0x01010101), TRgb(0xfefefefe));
   1.792 +		
   1.793 +	bitmapGc->SetBrushStyle(CGraphicsContext::ENullBrush);
   1.794 +	bitmapGc->SetBrushColor(TRANSPARENT_BLACK);
   1.795 +	bitmapGc->Clear();
   1.796 +	bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
   1.797 +	aGc->Activate(aWindow);
   1.798 +	TPoint point(0,0);
   1.799 +	bitmapGc->BitBlt(point, bitmapTarget);
   1.800 +	aGc->Deactivate();
   1.801 +	aSession.Flush();
   1.802 +
   1.803 +	TBuf <20> testName;
   1.804 +	if (!aUseMask)
   1.805 +		{
   1.806 +		testName=_L("DrawBitmap");
   1.807 +		iProfiler->InitResults();
   1.808 +		for(int i=0; i<aNumIterations; i++)
   1.809 +			{
   1.810 +			bitmapGc->DrawBitmap(TRect(point, bitmapSize), source);
   1.811 +			iProfiler->MarkResultSetL();
   1.812 +			}
   1.813 +		}
   1.814 +	else
   1.815 +		{
   1.816 +		testName=_L("DrawBitmapMasked");
   1.817 +		iProfiler->InitResults();
   1.818 +		for(int i=0; i<aNumIterations; i++)
   1.819 +			{
   1.820 +			bitmapGc->DrawBitmapMasked(TRect(point, bitmapSize), source,TRect(point, smallerSize), sourceAlpha, EFalse);
   1.821 +			iProfiler->MarkResultSetL();
   1.822 +			}
   1.823 +		}
   1.824 +	INFO_PRINTF4(_L("%S(Stretched) with src = %S, dst = %S"), &testName, &ColorModeName(aSrcMode), &ColorModeName(aDstMode));
   1.825 +	iProfiler->ResultsAnalysis(testName, 0, aSrcMode, aDstMode, aNumIterations);
   1.826 +	// copy up to screen for sanity check
   1.827 +	BitBlt(aSession, aWindow, aGc, *bitmapTarget);
   1.828 +	CleanupStack::PopAndDestroy(5, bitmapTarget);
   1.829 +	}
   1.830 +
   1.831 +/**
   1.832 +Performs a BitBlt with or without a mask
   1.833 +
   1.834 +@param aUseMask set to ETrue to use a alpha mask. Normally used for 16MU display modes that do not store the alpha.
   1.835 +@param aSrcMode is the source display mode
   1.836 +@param aDstMode is the destination display mode
   1.837 +@param aSession is the windows server session
   1.838 +@param aWindow is a reference to the window
   1.839 +@param aGc is the graphics context of the window
   1.840 +@param aNumIterations is the number of iterations to run the test
   1.841 +*/
   1.842 +void CAlphaBlendTest::DoNormalBitBltL(TBool aUseMask, TDisplayMode aSrcMode, TDisplayMode aDstMode, RWsSession& aSession, RWindow& aWindow, CWindowGc* aGc, TInt aNumIterations)
   1.843 +	{	
   1.844 +	const TSize bitmapSize = aWindow.Size();
   1.845 +	
   1.846 +	// Construct target bitmap
   1.847 +	CFbsBitmap* bitmapTarget = CreateSoftwareBitmapLC(bitmapSize, aDstMode);
   1.848 +	CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmapTarget);
   1.849 +	CleanupStack::PushL(bitmapDevice);
   1.850 +	
   1.851 +	// Construct GC
   1.852 +	CFbsBitGc* bitmapGc = NULL;	
   1.853 +	User::LeaveIfError(bitmapDevice->CreateContext(bitmapGc));
   1.854 +	CleanupStack::PushL(bitmapGc);
   1.855 +	
   1.856 +	// Construct source bitmap
   1.857 +	CFbsBitmap* source = CreateSoftwareBitmapLC(bitmapSize, aSrcMode);
   1.858 +	VerticalGradientAlphaL(source, TRgb(0x00000000), TRgb(0xffffffff));	
   1.859 +	CFbsBitmap* sourceAlpha = CreateSoftwareBitmapLC(bitmapSize, EGray256);	// match size to src
   1.860 +	VerticalGradientAlphaL(sourceAlpha, TRgb(0x01010101), TRgb(0xfefefefe));
   1.861 +		
   1.862 +	bitmapGc->SetBrushStyle(CGraphicsContext::ENullBrush);
   1.863 +	bitmapGc->SetBrushColor(TRANSPARENT_BLACK);
   1.864 +	bitmapGc->Clear();
   1.865 +	bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
   1.866 +	TPoint point(0,0);
   1.867 +	TRect rect(bitmapSize);
   1.868 +	if (aUseMask)		
   1.869 +		bitmapGc->AlphaBlendBitmaps(point, source, rect, sourceAlpha, point);		
   1.870 +	else
   1.871 +		bitmapGc->BitBlt(point, source);	// BitBlt source to target bitmap		
   1.872 +	
   1.873 +	aGc->Activate(aWindow);
   1.874 +	aGc->BitBlt(point, bitmapTarget);	// BitBlt bitmapTarget to screen
   1.875 +	aGc->Deactivate();
   1.876 +	aSession.Flush();	
   1.877 +	
   1.878 +	TBuf <20> testName;	
   1.879 +	if (aUseMask)
   1.880 +		{
   1.881 +		testName=_L("AlphaBlendBitmaps");
   1.882 +		// blend sourceUnder with sourceOver using alpha mask
   1.883 +		iProfiler->InitResults();		
   1.884 +		for(TInt i=0; i<aNumIterations; i++)
   1.885 +			{
   1.886 +			bitmapGc->Clear();
   1.887 +			bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
   1.888 +			bitmapGc->AlphaBlendBitmaps(point, source, rect, sourceAlpha, point);
   1.889 +			iProfiler->MarkResultSetL();
   1.890 +			}
   1.891 +		}
   1.892 +	else
   1.893 +		{
   1.894 +		testName=_L("Normal BitBlt");
   1.895 +		iProfiler->InitResults();
   1.896 +		for(TInt i=0; i<aNumIterations; i++)
   1.897 +			{
   1.898 +			bitmapGc->BitBlt(point, source);
   1.899 +			iProfiler->MarkResultSetL();
   1.900 +			}
   1.901 +		}
   1.902 +
   1.903 +	INFO_PRINTF4(_L("%S with src = %S, dst = %S"), &testName, &ColorModeName(aSrcMode), &ColorModeName(aDstMode));
   1.904 +	iProfiler->ResultsAnalysis(testName, 0, aSrcMode, aDstMode, aNumIterations);
   1.905 +	// copy up to screen for sanity check
   1.906 +	BitBlt(aSession, aWindow, aGc, *bitmapTarget);
   1.907 +	CleanupStack::PopAndDestroy(5, bitmapTarget);
   1.908 +	}