os/graphics/graphicsdeviceinterface/bitgdi/tbit/TBitgdiScaling.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicsdeviceinterface/bitgdi/tbit/TBitgdiScaling.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,887 @@
     1.4 +// Copyright (c) 2004-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 +// This test application is used to test how the scaling works with CFbsBitGc drawing methods.
    1.18 +// TDrawComposite template class is used for the testing. When instantiated, it expects two
    1.19 +// template arguments - TDrawFunctor and TDrawParam:
    1.20 +// 1. TDrawFunctor class. It represents the "functor/function object" pattern and 
    1.21 +// must implement  "void operator()(CFbsBitGc* aGraphicsContext, TDrawParam* aPrm)" method.
    1.22 +// 2. TDrawParam class. This is a template argument for 
    1.23 +// "void TDrawFunctor::operator()(CFbsBitGc* aGraphicsContext, TDrawParam* aPrm)" method.
    1.24 +// If the overloaded "()" operator does not need a parameter, TEmpty class can be used as 
    1.25 +// a template parameter.
    1.26 +// When you instantiate TDrawComposite template class and call TDrawComposite::Draw() method,
    1.27 +// it will perform all pre- and post- drawing steps, calling 
    1.28 +// "void TDrawFunctor::operator()(CFbsBitGc* aGraphicsContext, TDrawParam* aPrm)" 
    1.29 +// at the right time.
    1.30 +// If you want to do the test step by step, set "aCallGetch" parameter of TDrawComposite's
    1.31 +// constructor to ETrue, when using it.
    1.32 +// 
    1.33 +//
    1.34 +
    1.35 +#include <hal.h>
    1.36 +#include "TBitgdiScaling.h"
    1.37 +
    1.38 +//
    1.39 +//Constants
    1.40 +//
    1.41 +//X and Y scaling factors.
    1.42 +const TInt KScalingFactorX = 3;
    1.43 +const TInt KScalingFactorY = 2;
    1.44 +//Test bitmap
    1.45 +_LIT(KTestBmp, "z:\\system\\data\\BmCTest.mbm");
    1.46 +
    1.47 +//This clas might be used as a TDrawParam template parameter
    1.48 +class TEmpty
    1.49 +	{
    1.50 +	};
    1.51 +
    1.52 +//This clas is used for testing CFbsBitGc drawing methods against the new scaling functionality.
    1.53 +template <class TDrawFunctor, class TDrawParam> class TDrawComposite
    1.54 +	{
    1.55 +public:
    1.56 +	TDrawComposite(const TPoint& aOrigin, TDrawFunctor& aFunctor, 
    1.57 +				   TDrawParam* aDrawParam, TBool aCallGetch = EFalse) :
    1.58 +		iOrigin(aOrigin),
    1.59 +		iFunctor(aFunctor),
    1.60 +		iPrm(aDrawParam),
    1.61 +		iCallGetch(aCallGetch)
    1.62 +		{
    1.63 +		}
    1.64 +	void Draw(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext, CTGraphicsBase* aTest)
    1.65 +		{
    1.66 +		__ASSERT_DEBUG(aScreenDevice, User::Invariant());
    1.67 +		__ASSERT_DEBUG(aGraphicsContext, User::Invariant());
    1.68 +	
    1.69 +		PreDrawStep(aScreenDevice, aGraphicsContext);
    1.70 +		iFunctor(aGraphicsContext, iPrm);
    1.71 +		TInt err = aScreenDevice->SetScalingFactor(iOrigin, KScalingFactorX, KScalingFactorY, 1, 1);
    1.72 +		aTest -> TEST2(err, KErrNone);
    1.73 +		aGraphicsContext->Activate(aScreenDevice);
    1.74 +		iFunctor(aGraphicsContext, iPrm);
    1.75 +		PostDrawStep(aScreenDevice, aGraphicsContext);
    1.76 +		err = aScreenDevice->SetScalingFactor(TPoint (0, 0), 1, 1, 1, 1);
    1.77 +		aTest -> TEST2(err, KErrNone);
    1.78 +		aGraphicsContext->Activate(aScreenDevice);
    1.79 +		}
    1.80 +private:
    1.81 +	void PreDrawStep(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
    1.82 +		{
    1.83 +		aGraphicsContext->Clear();
    1.84 +		TSize screenSize = aScreenDevice->SizeInPixels();
    1.85 +		TRect rc(iOrigin.iX, iOrigin.iY, screenSize.iWidth - 1, screenSize.iHeight - 1);
    1.86 +		aGraphicsContext->DrawRect(rc);
    1.87 +		aScreenDevice->Update();
    1.88 +		}
    1.89 +	void PostDrawStep(CFbsScreenDevice* aScreenDevice, CFbsBitGc*)
    1.90 +		{
    1.91 +		aScreenDevice->Update();
    1.92 +		}
    1.93 +
    1.94 +private:
    1.95 +	TPoint iOrigin;
    1.96 +	TDrawFunctor& iFunctor;
    1.97 +	TDrawParam* iPrm;
    1.98 +	TBool iCallGetch;
    1.99 +	};
   1.100 +
   1.101 +//
   1.102 +//TDrawTextFunctor class is used for CFbsBitGc text drawing/scaling tests
   1.103 +class TDrawTextFunctor
   1.104 +	{
   1.105 +public:
   1.106 +	void operator()(CFbsBitGc* aGraphicsContext, CFont* aFont)
   1.107 +		{
   1.108 +		__ASSERT_DEBUG(aFont, User::Invariant());
   1.109 +		_LIT(KTestText, "ABCDEFGH-0123456789");
   1.110 +		_LIT(KTestText2, "ijklmnopqrst");
   1.111 +		TPoint textPos = TPoint(0, aFont->AscentInPixels());
   1.112 +		TPoint textPos2 = TPoint(3, aFont->AscentInPixels() + 3);
   1.113 +		TInt text2Width = aFont->TextWidthInPixels(KTestText2);
   1.114 +		TPoint textPos3 = TPoint(aFont->HeightInPixels() * 3, aFont->AscentInPixels() + text2Width + 3);
   1.115 +
   1.116 +		aGraphicsContext->DrawText(KTestText, textPos);
   1.117 +		aGraphicsContext->DrawTextVertical(KTestText2, textPos2, EFalse);
   1.118 +		aGraphicsContext->DrawTextVertical(KTestText2, textPos3, ETrue);
   1.119 +		}
   1.120 +	};
   1.121 +
   1.122 +
   1.123 +//
   1.124 +//TDrawBitmapFunctor class is used for CFbsBitGc bitmap (DrawBitmap) drawing/scaling tests
   1.125 +class TDrawBitmapFunctor
   1.126 +	{
   1.127 +public:
   1.128 +	void operator()(CFbsBitGc* aGraphicsContext, CFbsBitmap* aBitmap)
   1.129 +		{
   1.130 +		__ASSERT_DEBUG(aBitmap, User::Invariant());
   1.131 +		TSize size = aBitmap->SizeInPixels();
   1.132 +		aGraphicsContext->DrawBitmap(TRect(2, 2, size.iWidth + 2, size.iHeight + 2), aBitmap);
   1.133 +		}
   1.134 +	};
   1.135 +
   1.136 +
   1.137 +//
   1.138 +//TBitBltMaskedFunctor class is used for CFbsBitGc::BitBltMasked drawing/scaling tests
   1.139 +struct TMaskedBitmapPrm
   1.140 +	{
   1.141 +	CFbsBitmap* iBitmap;
   1.142 +	CFbsBitmap* iMaskBitmap;
   1.143 +	};
   1.144 +class TBitBltMaskedFunctor
   1.145 +	{
   1.146 +public:
   1.147 +	void operator()(CFbsBitGc* aGraphicsContext, TMaskedBitmapPrm* aPrm)
   1.148 +		{
   1.149 +		__ASSERT_DEBUG(aPrm, User::Invariant());
   1.150 +		TSize size = aPrm->iBitmap->SizeInPixels();
   1.151 +		TPoint pt(2, 2);
   1.152 +		TPoint pt2(pt.iX + size.iWidth + 10, pt.iY);
   1.153 +		TRect rc(pt, size);
   1.154 +		aGraphicsContext->BitBlt(pt, aPrm->iBitmap);
   1.155 +		aGraphicsContext->BitBltMasked(pt2, aPrm->iBitmap, rc, aPrm->iMaskBitmap, EFalse);
   1.156 +		}
   1.157 +	};
   1.158 +
   1.159 +//-------------
   1.160 +CTBitgdiScaling::CTBitgdiScaling(CTestStep* aStep) :
   1.161 +	CTGraphicsBase(aStep)
   1.162 +	{
   1.163 +	
   1.164 +	}
   1.165 +
   1.166 +CTBitgdiScaling::~CTBitgdiScaling()
   1.167 +	{
   1.168 +	delete iScreenDevice;
   1.169 +	delete iGraphicsContext;
   1.170 +	delete iScreenDevice2;
   1.171 +	delete iGraphicsContext2;
   1.172 +	}
   1.173 +	
   1.174 +void CTBitgdiScaling::ConstructL()
   1.175 +	{
   1.176 +#if defined __WINS__ || defined __WINSCW__
   1.177 + 	ChangeScreenDeviceL();
   1.178 +#endif//defined __WINS__ || defined __WINSCW__
   1.179 +
   1.180 +	TDisplayMode theDisplayMode = (static_cast<CTBitgdiScalingStep*>(iStep))->DisplayMode();
   1.181 +	_LIT(KLog,"Screen Display Mode %S");
   1.182 +	INFO_PRINTF2(KLog,&ColorModeName(theDisplayMode));
   1.183 +	TInt err = CreateScreenDeviceAndContextL(theDisplayMode, iScreenDevice, iGraphicsContext);
   1.184 +	TEST(err == KErrNone);
   1.185 +	
   1.186 +	err = CreateScreenDeviceAndContextL(theDisplayMode, iScreenDevice2, iGraphicsContext2);
   1.187 +	TSize size = iScreenDevice->SizeInPixels();
   1.188 +	_LIT(KSize,"[%d,%d] screen pixels");
   1.189 +	INFO_PRINTF3(KSize, size.iWidth, size.iHeight);
   1.190 +	TEST(err == KErrNone);
   1.191 +	}
   1.192 +	
   1.193 +void CTBitgdiScaling::RunTestCaseL(TInt aCurTestCase)
   1.194 +	{
   1.195 +	((CTBitgdiScalingStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
   1.196 +	switch(aCurTestCase)
   1.197 +		{
   1.198 +	case 1:
   1.199 +		((CTBitgdiScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0032"));
   1.200 +		FontScalingL(iScreenDevice, iGraphicsContext);
   1.201 +		break;
   1.202 +	case 2:
   1.203 +		((CTBitgdiScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0033"));
   1.204 +		BitmapScalingL(iScreenDevice, iGraphicsContext);
   1.205 +		break;
   1.206 +	case 3:
   1.207 +		((CTBitgdiScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0034"));
   1.208 +		BitBltMaskedScalingL(iScreenDevice, iGraphicsContext);
   1.209 +		break;
   1.210 +	case 4:
   1.211 +		((CTBitgdiScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0035"));
   1.212 +		DrawingScalingL(iScreenDevice, iGraphicsContext);
   1.213 +		break;
   1.214 +	case 5:
   1.215 +		((CTBitgdiScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0036"));
   1.216 +		MapColors(iScreenDevice, iGraphicsContext);
   1.217 +		break;
   1.218 +	case 6:
   1.219 +/**
   1.220 +  @SYMTestCaseID GRAPHICS-BITGDI-0117
   1.221 +*/
   1.222 +		((CTBitgdiScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0117"));
   1.223 +		BitmapScalingL(iScreenDevice, iGraphicsContext, iScreenDevice2, iGraphicsContext2);
   1.224 +		break;
   1.225 +	case 7:
   1.226 +		((CTBitgdiScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0037"));
   1.227 +		RunTests2L();
   1.228 +		return;
   1.229 +	case 8:
   1.230 +		((CTBitgdiScalingStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
   1.231 +		((CTBitgdiScalingStep*)iStep)->CloseTMSGraphicsStep();
   1.232 +		TestComplete();
   1.233 +		break;
   1.234 +		}
   1.235 +	((CTBitgdiScalingStep*)iStep)->RecordTestResultL();
   1.236 +	}
   1.237 +
   1.238 +//This function creates screen device and graphics context objects and pushesh them on the
   1.239 +//cleanup stack.
   1.240 +TInt CTBitgdiScaling::CreateScreenDeviceAndContextL(TDisplayMode aDisplayMode,
   1.241 +									CFbsScreenDevice*& aScreenDevice,
   1.242 +									CFbsBitGc*& aGraphicsContext)
   1.243 +	{
   1.244 +	__ASSERT_DEBUG(!aScreenDevice, User::Invariant());
   1.245 +	__ASSERT_DEBUG(!aGraphicsContext, User::Invariant());
   1.246 +	TRAPD(err, aScreenDevice = CFbsScreenDevice::NewL(KNullDesC, aDisplayMode));
   1.247 +	if (err!=KErrNone)
   1.248 +		{
   1.249 +		_LIT(KLog,"Failed to create screen device for mode %S  err=%d");
   1.250 +		INFO_PRINTF3(KLog,&ColorModeName(aDisplayMode),err);
   1.251 +		}
   1.252 +	if(err == KErrNotSupported)
   1.253 +		{
   1.254 +		return err;
   1.255 +		}
   1.256 +	TEST(err == KErrNone);
   1.257 +	err = aScreenDevice->CreateContext((CGraphicsContext*&)aGraphicsContext);
   1.258 +	if (err!=KErrNone)
   1.259 +		{
   1.260 +		_LIT(KLog,"Failed to create screen graphics context  mode %S  err=%d");
   1.261 +		INFO_PRINTF3(KLog,&ColorModeName(aDisplayMode),err);
   1.262 +		}
   1.263 +	TEST(err == KErrNone);
   1.264 +	aGraphicsContext->SetUserDisplayMode(aDisplayMode);
   1.265 +	aScreenDevice->ChangeScreenDevice(NULL);
   1.266 +	aScreenDevice->SetAutoUpdate(EFalse);
   1.267 +	return err;
   1.268 +	}
   1.269 +
   1.270 +#if defined __WINS__ || defined __WINSCW__
   1.271 +//This test function might be used to debug ChangeScreenDevice() call.
   1.272 +void CTBitgdiScaling::ChangeScreenDeviceL()
   1.273 +	{
   1.274 +	CFbsScreenDevice* screenDevice1=NULL;
   1.275 +	TInt leaveErr=KErrNone;;
   1.276 +	TInt depth1= EColor256;
   1.277 +
   1.278 +	// Try to get a colour screendevice
   1.279 +	for (;depth1<EColorLast && !screenDevice1;depth1++)
   1.280 +		{
   1.281 +		TRAP(leaveErr,screenDevice1 = CFbsScreenDevice::NewL(KNullDesC, TDisplayMode(depth1)));
   1.282 +		}
   1.283 +	if (leaveErr != KErrNone || !screenDevice1)
   1.284 +		{
   1.285 +		// Try to get a greyscale screendevice as failed to get a colour one
   1.286 +		for (depth1=ENone;depth1<EColor256 && !screenDevice1;depth1++)
   1.287 +			{
   1.288 +			TRAP(leaveErr,screenDevice1 = CFbsScreenDevice::NewL(KNullDesC, TDisplayMode(depth1)));
   1.289 +			}
   1.290 +		if (leaveErr != KErrNone || !screenDevice1)
   1.291 +			{
   1.292 +			INFO_PRINTF1(_L("Failed to create any screen devices. Re-leaving"));
   1.293 +			User::Leave(leaveErr);
   1.294 +			}
   1.295 +		}
   1.296 +	CleanupStack::PushL(screenDevice1);
   1.297 +
   1.298 +	CFbsBitGc* graphicsContext1 = NULL;
   1.299 +	User::LeaveIfError(screenDevice1->CreateContext(graphicsContext1));
   1.300 +	CleanupStack::PushL(graphicsContext1);
   1.301 +	graphicsContext1->SetUserDisplayMode(EColor256);
   1.302 +	screenDevice1->ChangeScreenDevice(NULL);
   1.303 +	screenDevice1->SetAutoUpdate(EFalse);
   1.304 +
   1.305 +	TInt err = screenDevice1->SetScalingFactor(TPoint(440, 40), 1, 1, 1, 1);
   1.306 +	TEST(err == KErrNone);
   1.307 +	graphicsContext1->Activate(screenDevice1);
   1.308 +	TRect rect1;
   1.309 +	screenDevice1->GetDrawRect(rect1);
   1.310 +
   1.311 +	CFbsScreenDevice* screenDevice2 = NULL;
   1.312 +	for (TInt depth2=ENone;depth2<EColorLast && ! screenDevice1;depth2++)
   1.313 +		if (depth2!=depth1)
   1.314 +			{
   1.315 +			TRAP(leaveErr,screenDevice2 = CFbsScreenDevice::NewL(KNullDesC, TDisplayMode(depth2)))
   1.316 +			}
   1.317 +	if (leaveErr != KErrNone || !screenDevice2)
   1.318 +		{
   1.319 +			INFO_PRINTF1(_L("Failed to create a different screen device - test skipped"));
   1.320 +		
   1.321 +		}
   1.322 +	else
   1.323 +		{
   1.324 +		CleanupStack::PushL(screenDevice2);
   1.325 +		TRect rect2;
   1.326 +		screenDevice2->GetDrawRect(rect2);
   1.327 +
   1.328 +		screenDevice1->ChangeScreenDevice(screenDevice2);
   1.329 +		graphicsContext1->Activate(screenDevice1);
   1.330 +		screenDevice1->GetDrawRect(rect1);
   1.331 +		TEST(rect1 == rect2);
   1.332 +		TRegionFix<1> area(rect2);
   1.333 +		graphicsContext1->SetClippingRegion(&area);
   1.334 +		::CleanupStack::PopAndDestroy(screenDevice2);
   1.335 +		}
   1.336 +	::CleanupStack::PopAndDestroy(2);//screenDevice1 and graphicsContext1
   1.337 +	}
   1.338 +#endif//defined __WINS__ || defined __WINSCW__
   1.339 +
   1.340 +/**
   1.341 +  @SYMTestCaseID GRAPHICS-BITGDI-0032
   1.342 + 
   1.343 +  @SYMDEF             
   1.344 +
   1.345 +  @SYMTestCaseDesc FontScalingL function is used for CFbsBitGc text drawing/scaling tests
   1.346 +   
   1.347 +  @SYMTestPriority High
   1.348 +
   1.349 +  @SYMTestStatus Implemented
   1.350 +
   1.351 +  @SYMTestActions Tests the drawing of some text to screen in specified height
   1.352 + 
   1.353 +  @SYMTestExpectedResults Test should perform graphics operations succesfully. 
   1.354 +*/
   1.355 +//
   1.356 +void CTBitgdiScaling::FontScalingL(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
   1.357 +	{
   1.358 +	__ASSERT_DEBUG(aScreenDevice, User::Invariant());
   1.359 +	__ASSERT_DEBUG(aGraphicsContext, User::Invariant());
   1.360 +	INFO_PRINTF1(_L("Font Scaling"));
   1.361 +	const TInt KTypeFacesCnt = aScreenDevice->NumTypefaces();
   1.362 +	for(TInt i=0;i<KTypeFacesCnt;++i)
   1.363 +		{
   1.364 +		TTypefaceSupport typeFaceSupport;
   1.365 +		aScreenDevice->TypefaceSupport(typeFaceSupport, i);
   1.366 +		TFontSpec fontSpec;
   1.367 +		fontSpec.iTypeface = typeFaceSupport.iTypeface;
   1.368 +		fontSpec.iHeight = 14;
   1.369 +		CFont* font = NULL;
   1.370 +		User::LeaveIfError(aScreenDevice->GetNearestFontToDesignHeightInPixels(font, fontSpec));
   1.371 +		TDesC& fontName = fontSpec.iTypeface.iName;
   1.372 +		RDebug::Print(_L("%S\r\n"), &fontName);
   1.373 +		aGraphicsContext->UseFont(font);
   1.374 +		DrawTestText(aScreenDevice, aGraphicsContext, font);
   1.375 +		aScreenDevice->ReleaseFont(font);
   1.376 +		}
   1.377 +	}
   1.378 +
   1.379 +/**
   1.380 +  @SYMTestCaseID GRAPHICS-BITGDI-0033
   1.381 + 
   1.382 +  @SYMDEF             
   1.383 +
   1.384 +  @SYMTestCaseDesc BitmapScalingL fucntion is used for CFbsBitGc bitmap (DrawBitmap) drawing/scaling tests
   1.385 +   
   1.386 +  @SYMTestPriority High
   1.387 +
   1.388 +  @SYMTestStatus Implemented
   1.389 +
   1.390 +  @SYMTestActions Loads in a number of bitmaps then scales them to the screen
   1.391 + 
   1.392 +  @SYMTestExpectedResults Test should perform graphics operations succesfully. 
   1.393 +*/
   1.394 +void CTBitgdiScaling::BitmapScalingL(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
   1.395 +	{
   1.396 +	INFO_PRINTF1(_L("Bitmap Scaling"));
   1.397 +	CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
   1.398 +	CleanupStack::PushL(bitmap);
   1.399 +	//8 - it is the number of bitmaps in mbm file - see GenBitmaps.mk where this mbm file is generated
   1.400 +	for(TInt i=0;i<8;i++)
   1.401 +		{
   1.402 +		bitmap->Reset();
   1.403 +		User::LeaveIfError(bitmap->Load(KTestBmp, i));
   1.404 +		TSize size = bitmap->SizeInPixels();
   1.405 +		TPoint ptOrigin(size.iWidth + 10, 3);
   1.406 +
   1.407 +		TDrawBitmapFunctor functor;
   1.408 +		TDrawComposite<TDrawBitmapFunctor, CFbsBitmap> composite(ptOrigin, functor, bitmap);
   1.409 +		composite.Draw(aScreenDevice, aGraphicsContext, this);
   1.410 +		}
   1.411 +	CleanupStack::PopAndDestroy(bitmap);
   1.412 +	}
   1.413 +
   1.414 +/**
   1.415 +  @SYMTestCaseID GRAPHICS-BITGDI-0034
   1.416 + 
   1.417 +  @SYMDEF             
   1.418 +
   1.419 +  @SYMTestCaseDesc BitBltMaskedScalingL fucntion is used for CFbsBitGc::BitBltMasked drawing/scaling tests
   1.420 +   
   1.421 +  @SYMTestPriority High
   1.422 +
   1.423 +  @SYMTestStatus Implemented
   1.424 +
   1.425 +  @SYMTestActions Loads in a number of bitmaps and their masks then scales them to the screen
   1.426 + 
   1.427 +  @SYMTestExpectedResults Test should perform graphics operations succesfully. 
   1.428 +*/	
   1.429 +void CTBitgdiScaling::BitBltMaskedScalingL(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
   1.430 +	{
   1.431 +	INFO_PRINTF1(_L("BitBltMasked Scaling"));
   1.432 +
   1.433 +	CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
   1.434 +	CleanupStack::PushL(bitmap);
   1.435 +	User::LeaveIfError(bitmap->Load(KTestBmp, 0));
   1.436 +	TSize size = bitmap->SizeInPixels();
   1.437 +
   1.438 +	CFbsBitmap* maskBitmap = new (ELeave) CFbsBitmap;
   1.439 +	CleanupStack::PushL(maskBitmap);
   1.440 +	User::LeaveIfError(maskBitmap->Create(size, EGray256));
   1.441 +
   1.442 +	TBitmapUtil bmpUtil(maskBitmap);
   1.443 +	bmpUtil.Begin(TPoint(0, 0));
   1.444 +	for(TInt i=0;i<size.iWidth;++i)
   1.445 +		{
   1.446 +		for(TInt j=0;j<size.iHeight;++j)
   1.447 +			{
   1.448 +			bmpUtil.SetPos(TPoint(i, j));
   1.449 +			bmpUtil.SetPixel(0x00555555);
   1.450 +			}
   1.451 +		}
   1.452 +	bmpUtil.End();
   1.453 +
   1.454 +	TPoint ptOrigin(size.iWidth * 3, 7);
   1.455 +	TMaskedBitmapPrm prm = {bitmap, maskBitmap};
   1.456 +	TBitBltMaskedFunctor functor;
   1.457 +	TDrawComposite<TBitBltMaskedFunctor, TMaskedBitmapPrm> composite(ptOrigin, functor, &prm);
   1.458 +	composite.Draw(aScreenDevice, aGraphicsContext, this);
   1.459 +	CleanupStack::PopAndDestroy(2);//maskBitmap and bitmap
   1.460 +	}
   1.461 +
   1.462 +/**
   1.463 +  @SYMTestCaseID GRAPHICS-BITGDI-0035
   1.464 + 
   1.465 +  @SYMDEF             
   1.466 +
   1.467 +  @SYMTestCaseDesc DrawingScalingL function is used for CFbsBitGc::DrawXXX drawing/scaling tests
   1.468 +   
   1.469 +  @SYMTestPriority High
   1.470 +
   1.471 +  @SYMTestStatus Implemented
   1.472 +
   1.473 +  @SYMTestActions Tests the scaling various basic graphic primitives
   1.474 + 
   1.475 +  @SYMTestExpectedResults Test should perform graphics operations succesfully. 
   1.476 +*/
   1.477 +void CTBitgdiScaling::DrawingScalingL(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
   1.478 +	{
   1.479 +	DrawArc(aScreenDevice, aGraphicsContext);
   1.480 +	DrawPie(aScreenDevice, aGraphicsContext);
   1.481 +	DrawRoundRect(aScreenDevice, aGraphicsContext);
   1.482 +	DrawPolyLineL(aScreenDevice, aGraphicsContext);
   1.483 +	DrawPolyLineNoEndPointL(aScreenDevice, aGraphicsContext);
   1.484 +	DrawPolygonL(aScreenDevice, aGraphicsContext);
   1.485 +	DrawEllipse(aScreenDevice, aGraphicsContext);
   1.486 +	DrawLine(aScreenDevice, aGraphicsContext);
   1.487 +	DrawRect(aScreenDevice, aGraphicsContext);
   1.488 +	ShadowFade(aScreenDevice, aGraphicsContext);
   1.489 +	}
   1.490 +
   1.491 +//
   1.492 +//TMapColorsFunctor class is used for CFbsBitGc::MapColors drawing/scaling tests
   1.493 +class TMapColorsFunctor
   1.494 +	{
   1.495 +public:
   1.496 +	void operator()(CFbsBitGc* aGraphicsContext, TEmpty*)
   1.497 +		{
   1.498 +		aGraphicsContext->DrawRect(TRect(7, 13, 45, 67));
   1.499 +		TRgb colors[] = {TRgb(0x00, 0x00, 0x00), TRgb(0xFF, 0x20, 0x20)};
   1.500 +		aGraphicsContext->MapColors(TRect(5, 10, 50, 70), colors);
   1.501 +		}
   1.502 +	};
   1.503 +
   1.504 +/**
   1.505 +  @SYMTestCaseID GRAPHICS-BITGDI-0036
   1.506 + 
   1.507 +  @SYMDEF             
   1.508 +
   1.509 +  @SYMTestCaseDesc MapColors function is used for CFbsBitGc::MapColors drawing/scaling tests
   1.510 +   
   1.511 +  @SYMTestPriority High
   1.512 +
   1.513 +  @SYMTestStatus Implemented
   1.514 +
   1.515 +  @SYMTestActions tests scaling of mapp3ed colours
   1.516 + 
   1.517 +  @SYMTestExpectedResults Test should perform graphics operations succesfully. 
   1.518 +*/
   1.519 +//
   1.520 +void CTBitgdiScaling::MapColors(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
   1.521 +	{
   1.522 +	INFO_PRINTF1(_L("MapColors scaling"));
   1.523 +	TMapColorsFunctor functor;
   1.524 +	TDrawComposite<TMapColorsFunctor, TEmpty> composite(TPoint(83, 11), functor, NULL);
   1.525 +	composite.Draw(aScreenDevice, aGraphicsContext, this);
   1.526 +	}
   1.527 +
   1.528 +//BitmapScalingL fucntion is used for CFbsBitGc bitmap (DrawBitmap) drawing/scaling tests
   1.529 +//2 screen devices used - scaled and non-scaled
   1.530 +void CTBitgdiScaling::BitmapScalingL(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext, 
   1.531 +						   CFbsScreenDevice* aScreenDevice2, CFbsBitGc* aGraphicsContext2,
   1.532 +						   TBool aCallGetch)
   1.533 +	{
   1.534 +	__ASSERT_DEBUG(aScreenDevice, User::Invariant());
   1.535 +	__ASSERT_DEBUG(aGraphicsContext, User::Invariant());
   1.536 +	__ASSERT_DEBUG(aScreenDevice2, User::Invariant());
   1.537 +	__ASSERT_DEBUG(aGraphicsContext2, User::Invariant());
   1.538 +
   1.539 +	INFO_PRINTF1(_L("Bitmap Scaling - 2 devices"));
   1.540 +
   1.541 +	CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
   1.542 +	CleanupStack::PushL(bitmap);
   1.543 +
   1.544 +	//8 - it is the number of bitmaps in mbm file - see GenBitmaps.mk where this mbm file is generated
   1.545 +	for(TInt i=0;i<8;i++)
   1.546 +		{
   1.547 +		bitmap->Reset();
   1.548 +		User::LeaveIfError(bitmap->Load(KTestBmp, i));
   1.549 +		TSize size = bitmap->SizeInPixels();
   1.550 +		TPoint ptOrigin(size.iWidth + 10, 3);
   1.551 +
   1.552 +		TInt err = aScreenDevice2->SetScalingFactor(ptOrigin, KScalingFactorX, KScalingFactorY, 1, 1);
   1.553 +		TEST(err == KErrNone);
   1.554 +		aGraphicsContext2->Activate(aScreenDevice2);
   1.555 +
   1.556 +		aGraphicsContext->Clear();
   1.557 +		aGraphicsContext2->Clear();
   1.558 +
   1.559 +		TSize screenSize = aScreenDevice->SizeInPixels();
   1.560 +		TRect rc(0, 0, screenSize.iWidth - 1, screenSize.iHeight - 1);
   1.561 +		aGraphicsContext->DrawRect(rc);
   1.562 +
   1.563 +		aGraphicsContext->DrawBitmap(TRect(2, 2, size.iWidth + 2, size.iHeight + 2), bitmap);
   1.564 +
   1.565 +		TSize screenSize2 = aScreenDevice2->SizeInPixels();
   1.566 +		TRect rc2(0, 0, screenSize2.iWidth - 1, screenSize2.iHeight - 1);
   1.567 +		aGraphicsContext2->DrawRect(rc2);
   1.568 +
   1.569 +		aGraphicsContext2->DrawBitmap(TRect(2, 2, size.iWidth + 2, size.iHeight + 2), bitmap);
   1.570 +
   1.571 +		aScreenDevice->Update();
   1.572 +		aScreenDevice2->Update();
   1.573 +
   1.574 +		if(aCallGetch)
   1.575 +			{
   1.576 +			//TheTest.Getch();
   1.577 +			}
   1.578 +		}
   1.579 +	CleanupStack::PopAndDestroy(bitmap);
   1.580 +	}
   1.581 +
   1.582 +//DrawTestText function is used for CFbsBitGc text drawing/scaling tests
   1.583 +void CTBitgdiScaling::DrawTestText(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext, CFont* aFont)
   1.584 +	{
   1.585 +	__ASSERT_DEBUG(aFont, User::Invariant());
   1.586 +	TPoint ptOrigin(aFont->HeightInPixels() * 4, aFont->AscentInPixels() * 2);
   1.587 +	TDrawTextFunctor functor;
   1.588 +	TDrawComposite<TDrawTextFunctor, CFont> composite(ptOrigin, functor, aFont);
   1.589 +	composite.Draw(aScreenDevice, aGraphicsContext, this);
   1.590 +	}
   1.591 +
   1.592 +//
   1.593 +//TDrawArcFunctor class is used for CFbsBitGc::DrawArc drawing/scaling tests
   1.594 +class TDrawArcFunctor
   1.595 +	{
   1.596 +public:
   1.597 +	void operator()(CFbsBitGc* aGraphicsContext, TEmpty*)
   1.598 +		{
   1.599 +		aGraphicsContext->DrawArc(TRect(0, 0, 40, 40), TPoint(0, 20), TPoint(40, 20));
   1.600 +		}
   1.601 +	};
   1.602 +
   1.603 +//DrawArc function is used for CFbsBitGc::DrawArc drawing/scaling tests
   1.604 +void CTBitgdiScaling::DrawArc(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
   1.605 +	{
   1.606 +	INFO_PRINTF1(_L("DrawArc scaling"));
   1.607 +	TDrawArcFunctor functor;
   1.608 +	TDrawComposite<TDrawArcFunctor, TEmpty> composite(TPoint(40, 0), functor, NULL);
   1.609 +	composite.Draw(aScreenDevice, aGraphicsContext, this);
   1.610 +	}
   1.611 +
   1.612 +//
   1.613 +//TDrawPieFunctor class is used for CFbsBitGc::DrawPie drawing/scaling tests
   1.614 +class TDrawPieFunctor
   1.615 +	{
   1.616 +public:
   1.617 +	void operator()(CFbsBitGc* aGraphicsContext, TEmpty*)
   1.618 +		{
   1.619 +		aGraphicsContext->DrawPie(TRect(0, 0, 40, 40), TPoint(0, 20), TPoint(40, 20));
   1.620 +		}
   1.621 +	};
   1.622 +
   1.623 +//DrawPie function is used for CFbsBitGc::DrawPie drawing/scaling tests
   1.624 +void CTBitgdiScaling::DrawPie(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
   1.625 +	{
   1.626 +	INFO_PRINTF1(_L("DrawPie scaling"));
   1.627 +	TDrawPieFunctor functor;
   1.628 +	TDrawComposite<TDrawPieFunctor, TEmpty> composite(TPoint(40, 0), functor, NULL);
   1.629 +	composite.Draw(aScreenDevice, aGraphicsContext, this);
   1.630 +	}
   1.631 +
   1.632 +//
   1.633 +//TDrawRoundRectFunctor class is used for CFbsBitGc::DrawRoundRect drawing/scaling tests
   1.634 +class TDrawRoundRectFunctor
   1.635 +	{
   1.636 +public:
   1.637 +	void operator()(CFbsBitGc* aGraphicsContext, TEmpty*)
   1.638 +		{
   1.639 +		aGraphicsContext->DrawRoundRect(TRect(0, 0, 40, 40), TSize(5, 5));
   1.640 +		}
   1.641 +	};
   1.642 +
   1.643 +//DrawRoundRect function is used for CFbsBitGc::DrawRoundRect drawing/scaling tests
   1.644 +void CTBitgdiScaling::DrawRoundRect(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
   1.645 +	{
   1.646 +	INFO_PRINTF1(_L("DrawRoundRect scaling"));
   1.647 +	TDrawRoundRectFunctor functor;
   1.648 +	TDrawComposite<TDrawRoundRectFunctor, TEmpty> composite(TPoint(40, 0), functor, NULL);
   1.649 +	composite.Draw(aScreenDevice, aGraphicsContext, this);
   1.650 +	}
   1.651 +
   1.652 +//
   1.653 +
   1.654 +typedef CArrayFixFlat<TPoint> CPointArray;
   1.655 +
   1.656 +//TDrawPolyLineFunctor class is used for CFbsBitGc::DrawPolyLine drawing/scaling tests
   1.657 +class TDrawPolyLineFunctor
   1.658 +	{
   1.659 +public:
   1.660 +	void operator()(CFbsBitGc* aGraphicsContext, CPointArray* aPoints)
   1.661 +		{
   1.662 +		aGraphicsContext->DrawPolyLine(aPoints);
   1.663 +		}
   1.664 +	};
   1.665 +
   1.666 +//DrawPolyLineL function is used for CFbsBitGc::DrawPolyLine drawing/scaling tests
   1.667 +void CTBitgdiScaling::DrawPolyLineL(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
   1.668 +	{
   1.669 +	INFO_PRINTF1(_L("DrawPolyLine scaling"));
   1.670 +	CPointArray* points = new (ELeave) CPointArray (4);
   1.671 +	CleanupStack::PushL(points);
   1.672 +	TPoint pt(1, 1);
   1.673 +	points->AppendL(pt);
   1.674 +	pt.SetXY(77, 23);
   1.675 +	points->AppendL(pt);
   1.676 +	pt.SetXY(38, 63);
   1.677 +	points->AppendL(pt);
   1.678 +	pt.SetXY(70, 51);
   1.679 +	points->AppendL(pt);
   1.680 +	TDrawPolyLineFunctor functor;
   1.681 +	TDrawComposite<TDrawPolyLineFunctor, CPointArray> composite(TPoint(80, 0), functor,
   1.682 +																points);
   1.683 +	composite.Draw(aScreenDevice, aGraphicsContext, this);
   1.684 +	CleanupStack::PopAndDestroy(points);
   1.685 +	}
   1.686 +
   1.687 +//
   1.688 +//TDrawPolyLineNoEndPointFunctor class is used for CFbsBitGc::DrawPolyLineNoEndPoint drawing/scaling tests
   1.689 +class TDrawPolyLineNoEndPointFunctor
   1.690 +	{
   1.691 +public:
   1.692 +	void operator()(CFbsBitGc* aGraphicsContext, CPointArray* aPoints)
   1.693 +		{
   1.694 +		aGraphicsContext->DrawPolyLineNoEndPoint(aPoints);
   1.695 +		}
   1.696 +	};
   1.697 +
   1.698 +//DrawPolyLineNoEndPointL function is used for CFbsBitGc::DrawPolyLineNoEndPoint drawing/scaling tests
   1.699 +void CTBitgdiScaling::DrawPolyLineNoEndPointL(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
   1.700 +	{
   1.701 +	INFO_PRINTF1(_L("DrawPolyLineNoEndPoint scaling"));
   1.702 +	CPointArray* points = new (ELeave) CPointArray (4);
   1.703 +	CleanupStack::PushL(points);
   1.704 +	TPoint pt(1, 1);
   1.705 +	points->AppendL(pt);
   1.706 +	pt.SetXY(77, 23);
   1.707 +	points->AppendL(pt);
   1.708 +	pt.SetXY(38, 63);
   1.709 +	points->AppendL(pt);
   1.710 +	pt.SetXY(70, 51);
   1.711 +	points->AppendL(pt);
   1.712 +	TDrawPolyLineNoEndPointFunctor functor;
   1.713 +	TDrawComposite<TDrawPolyLineNoEndPointFunctor, CPointArray> composite(
   1.714 +																	TPoint(80, 0), functor,
   1.715 +																	points);
   1.716 +	composite.Draw(aScreenDevice, aGraphicsContext, this);
   1.717 +	CleanupStack::PopAndDestroy(points);
   1.718 +	}
   1.719 +
   1.720 +//
   1.721 +//TDrawPolygonFunctor class is used for CFbsBitGc::DrawPolygon drawing/scaling tests
   1.722 +class TDrawPolygonFunctor
   1.723 +	{
   1.724 +public:
   1.725 +	void operator()(CFbsBitGc* aGraphicsContext, CPointArray* aPoints)
   1.726 +		{
   1.727 +		aGraphicsContext->DrawPolygon(aPoints);
   1.728 +		}
   1.729 +	};
   1.730 +
   1.731 +//DrawPolygon function is used for CFbsBitGc::DrawPolygon drawing/scaling tests
   1.732 +void CTBitgdiScaling::DrawPolygonL(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
   1.733 +	{
   1.734 +	INFO_PRINTF1(_L("DrawPolygon scaling"));
   1.735 +	CPointArray* points = new (ELeave) CPointArray (6);
   1.736 +	CleanupStack::PushL(points);
   1.737 +	TPoint pt(1, 20);
   1.738 +	points->AppendL(pt);
   1.739 +	pt.SetXY(23, 3);
   1.740 +	points->AppendL(pt);
   1.741 +	pt.SetXY(61, 29);
   1.742 +	points->AppendL(pt);
   1.743 +	pt.SetXY(51, 47);
   1.744 +	points->AppendL(pt);
   1.745 +	pt.SetXY(31, 39);
   1.746 +	points->AppendL(pt);
   1.747 +	pt.SetXY(44, 17);
   1.748 +	points->AppendL(pt);
   1.749 +	TDrawPolygonFunctor functor;
   1.750 +	TDrawComposite<TDrawPolygonFunctor, CPointArray> composite(TPoint(80, 0), functor,
   1.751 +															   points);
   1.752 +	composite.Draw(aScreenDevice, aGraphicsContext, this);
   1.753 +	CleanupStack::PopAndDestroy(points);
   1.754 +	}
   1.755 +
   1.756 +//
   1.757 +//TDrawEllipseFunctor class is used for CFbsBitGc::DrawEllipse drawing/scaling tests
   1.758 +class TDrawEllipseFunctor
   1.759 +	{
   1.760 +public:
   1.761 +	void operator()(CFbsBitGc* aGraphicsContext, TEmpty*)
   1.762 +		{
   1.763 +		aGraphicsContext->DrawEllipse(TRect(11, 13, 40, 70));
   1.764 +		}
   1.765 +	};
   1.766 +
   1.767 +//DrawEllipse function is used for CFbsBitGc::DrawEllipse drawing/scaling tests
   1.768 +void CTBitgdiScaling::DrawEllipse(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
   1.769 +	{
   1.770 +	INFO_PRINTF1(_L("DrawEllipse scaling"));
   1.771 +	TDrawEllipseFunctor functor;
   1.772 +	TDrawComposite<TDrawEllipseFunctor, TEmpty> composite(TPoint(50, 27), functor, NULL);
   1.773 +	composite.Draw(aScreenDevice, aGraphicsContext, this);
   1.774 +	}
   1.775 +
   1.776 +//
   1.777 +//TDrawLineFunctor class is used for CFbsBitGc::DrawLine drawing/scaling tests
   1.778 +class TDrawLineFunctor
   1.779 +	{
   1.780 +public:
   1.781 +	void operator()(CFbsBitGc* aGraphicsContext, TEmpty*)
   1.782 +		{
   1.783 +		aGraphicsContext->DrawLine(TPoint(7, 13), TPoint(45, 67));
   1.784 +		aGraphicsContext->DrawLineTo(TPoint(33, 53));
   1.785 +		aGraphicsContext->DrawLineBy(TPoint(11, 53));
   1.786 +		}
   1.787 +	};
   1.788 +
   1.789 +//DrawLine function is used for CFbsBitGc::DrawLineXX drawing/scaling tests
   1.790 +void CTBitgdiScaling::DrawLine(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
   1.791 +	{
   1.792 +	INFO_PRINTF1(_L("DrawLineXX scaling"));
   1.793 +	TDrawLineFunctor functor;
   1.794 +	TDrawComposite<TDrawLineFunctor, TEmpty> composite(TPoint(83, 11), functor, NULL);
   1.795 +	composite.Draw(aScreenDevice, aGraphicsContext, this);
   1.796 +	}
   1.797 +
   1.798 +//
   1.799 +//TDrawRectFunctor class is used for CFbsBitGc::DrawRect drawing/scaling tests
   1.800 +class TDrawRectFunctor
   1.801 +	{
   1.802 +public:
   1.803 +	void operator()(CFbsBitGc* aGraphicsContext, TEmpty*)
   1.804 +		{
   1.805 +		aGraphicsContext->DrawRect(TRect(7, 13, 45, 67));
   1.806 +		}
   1.807 +	};
   1.808 +
   1.809 +//DrawRect function is used for CFbsBitGc::DrawRect drawing/scaling tests
   1.810 +void CTBitgdiScaling::DrawRect(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
   1.811 +	{
   1.812 +	INFO_PRINTF1(_L("DrawRect scaling"));
   1.813 +	TDrawRectFunctor functor;
   1.814 +	TDrawComposite<TDrawRectFunctor, TEmpty> composite(TPoint(83, 11), functor, NULL);
   1.815 +	composite.Draw(aScreenDevice, aGraphicsContext, this);
   1.816 +	}
   1.817 +
   1.818 +//
   1.819 +//TShadowFadeFunctor class is used for CFbsBitGc::ShadowArea/FadeArea drawing/scaling tests
   1.820 +class TShadowFadeFunctor
   1.821 +	{
   1.822 +public:
   1.823 +	void operator()(CFbsBitGc* aGraphicsContext, TEmpty*)
   1.824 +		{
   1.825 +		aGraphicsContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
   1.826 +
   1.827 +		aGraphicsContext->SetBrushColor(TRgb(0xBB, 0x34, 0x55));
   1.828 +		aGraphicsContext->DrawRect(TRect(1, 1, 40, 20));
   1.829 +		aGraphicsContext->DrawRect(TRect(20, 20, 40, 40));
   1.830 +		RRegion shadowRgn;
   1.831 +		shadowRgn.AddRect(TRect(1, 1, 40, 20));
   1.832 +		shadowRgn.AddRect(TRect(20, 20, 40, 40));
   1.833 +		aGraphicsContext->ShadowArea(&shadowRgn);
   1.834 +		shadowRgn.Close();
   1.835 +
   1.836 +		aGraphicsContext->SetBrushColor(TRgb(0xFF, 0x00, 0xFF));
   1.837 +		aGraphicsContext->DrawRect(TRect(3, 25, 17, 33));
   1.838 +		aGraphicsContext->DrawRect(TRect(1, 43, 67, 55));
   1.839 +		RRegion fadeRgn;
   1.840 +		fadeRgn.AddRect(TRect(3, 25, 17, 33));
   1.841 +		fadeRgn.AddRect(TRect(1, 43, 67, 55));
   1.842 +		aGraphicsContext->FadeArea(&fadeRgn);
   1.843 +		fadeRgn.Close();
   1.844 +
   1.845 +		aGraphicsContext->SetBrushColor(TRgb(0xFF, 0xFF, 0xFF));
   1.846 +		aGraphicsContext->SetBrushStyle(CGraphicsContext::ENullBrush);
   1.847 +		}
   1.848 +	};
   1.849 +
   1.850 +//ShadowFade function is used for CFbsBitGc::ShadowArea/FadeArea drawing/scaling tests
   1.851 +void CTBitgdiScaling::ShadowFade(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext)
   1.852 +	{
   1.853 +	INFO_PRINTF1(_L("Shadow/Fade scaling"));
   1.854 +	TShadowFadeFunctor functor;
   1.855 +	TDrawComposite<TShadowFadeFunctor, TEmpty> composite(TPoint(83, 11), functor, NULL);
   1.856 +	composite.Draw(aScreenDevice, aGraphicsContext, this);
   1.857 +	}
   1.858 +
   1.859 +//--------------
   1.860 +__CONSTRUCT_STEP__(BitgdiScaling)
   1.861 +
   1.862 +void CTBitgdiScalingStep::TestSetupL()
   1.863 +	{
   1.864 +	iDisplayMode = GetDisplayModeL();
   1.865 +	}
   1.866 +
   1.867 +TDisplayMode CTBitgdiScalingStep::GetDisplayModeL()
   1.868 +	{
   1.869 +	CFbsScreenDevice* device = NULL;
   1.870 +	TDisplayMode mode = EColor64K;
   1.871 +	TRAPD(err, device = CFbsScreenDevice::NewL(KNullDesC, mode));
   1.872 +	if (err == KErrNotSupported)
   1.873 +		{
   1.874 +		mode = EColor256;
   1.875 +		TRAP(err, device = CFbsScreenDevice::NewL(KNullDesC, mode));
   1.876 +		}
   1.877 +	if (err == KErrNotSupported)
   1.878 +		{
   1.879 +		mode = EColor16MA;
   1.880 +		TRAP(err, device = CFbsScreenDevice::NewL(KNullDesC, mode));
   1.881 +		}
   1.882 +	if (err == KErrNotSupported)
   1.883 +		{
   1.884 +		mode = EColor16MAP;
   1.885 +		TRAP(err, device = CFbsScreenDevice::NewL(KNullDesC, mode));
   1.886 +		}
   1.887 +	TESTL(err == KErrNone);
   1.888 +	delete device;
   1.889 +	return mode;
   1.890 +	}