|         |      1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). | 
|         |      2 // All rights reserved. | 
|         |      3 // This component and the accompanying materials are made available | 
|         |      4 // under the terms of "Eclipse Public License v1.0" | 
|         |      5 // which accompanies this distribution, and is available | 
|         |      6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". | 
|         |      7 // | 
|         |      8 // Initial Contributors: | 
|         |      9 // Nokia Corporation - initial contribution. | 
|         |     10 // | 
|         |     11 // Contributors: | 
|         |     12 // | 
|         |     13 // Description: | 
|         |     14 // This test application is used to test how the scaling works with CFbsBitGc drawing methods. | 
|         |     15 // TDrawComposite template class is used for the testing. When instantiated, it expects two | 
|         |     16 // template arguments - TDrawFunctor and TDrawParam: | 
|         |     17 // 1. TDrawFunctor class. It represents the "functor/function object" pattern and  | 
|         |     18 // must implement  "void operator()(CFbsBitGc* aGraphicsContext, TDrawParam* aPrm)" method. | 
|         |     19 // 2. TDrawParam class. This is a template argument for  | 
|         |     20 // "void TDrawFunctor::operator()(CFbsBitGc* aGraphicsContext, TDrawParam* aPrm)" method. | 
|         |     21 // If the overloaded "()" operator does not need a parameter, TEmpty class can be used as  | 
|         |     22 // a template parameter. | 
|         |     23 // When you instantiate TDrawComposite template class and call TDrawComposite::Draw() method, | 
|         |     24 // it will perform all pre- and post- drawing steps, calling  | 
|         |     25 // "void TDrawFunctor::operator()(CFbsBitGc* aGraphicsContext, TDrawParam* aPrm)"  | 
|         |     26 // at the right time. | 
|         |     27 // If you want to do the test step by step, set "aCallGetch" parameter of TDrawComposite's | 
|         |     28 // constructor to ETrue, when using it. | 
|         |     29 //  | 
|         |     30 // | 
|         |     31  | 
|         |     32 #include <hal.h> | 
|         |     33 #include "TBitgdiScaling.h" | 
|         |     34  | 
|         |     35 // | 
|         |     36 //Constants | 
|         |     37 // | 
|         |     38 //X and Y scaling factors. | 
|         |     39 const TInt KScalingFactorX = 3; | 
|         |     40 const TInt KScalingFactorY = 2; | 
|         |     41 //Test bitmap | 
|         |     42 _LIT(KTestBmp, "z:\\system\\data\\BmCTest.mbm"); | 
|         |     43  | 
|         |     44 //This clas might be used as a TDrawParam template parameter | 
|         |     45 class TEmpty | 
|         |     46 	{ | 
|         |     47 	}; | 
|         |     48  | 
|         |     49 //This clas is used for testing CFbsBitGc drawing methods against the new scaling functionality. | 
|         |     50 template <class TDrawFunctor, class TDrawParam> class TDrawComposite | 
|         |     51 	{ | 
|         |     52 public: | 
|         |     53 	TDrawComposite(const TPoint& aOrigin, TDrawFunctor& aFunctor,  | 
|         |     54 				   TDrawParam* aDrawParam, TBool aCallGetch = EFalse) : | 
|         |     55 		iOrigin(aOrigin), | 
|         |     56 		iFunctor(aFunctor), | 
|         |     57 		iPrm(aDrawParam), | 
|         |     58 		iCallGetch(aCallGetch) | 
|         |     59 		{ | 
|         |     60 		} | 
|         |     61 	void Draw(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext, CTGraphicsBase* aTest) | 
|         |     62 		{ | 
|         |     63 		__ASSERT_DEBUG(aScreenDevice, User::Invariant()); | 
|         |     64 		__ASSERT_DEBUG(aGraphicsContext, User::Invariant()); | 
|         |     65 	 | 
|         |     66 		PreDrawStep(aScreenDevice, aGraphicsContext); | 
|         |     67 		iFunctor(aGraphicsContext, iPrm); | 
|         |     68 		TInt err = aScreenDevice->SetScalingFactor(iOrigin, KScalingFactorX, KScalingFactorY, 1, 1); | 
|         |     69 		aTest -> TEST2(err, KErrNone); | 
|         |     70 		aGraphicsContext->Activate(aScreenDevice); | 
|         |     71 		iFunctor(aGraphicsContext, iPrm); | 
|         |     72 		PostDrawStep(aScreenDevice, aGraphicsContext); | 
|         |     73 		err = aScreenDevice->SetScalingFactor(TPoint (0, 0), 1, 1, 1, 1); | 
|         |     74 		aTest -> TEST2(err, KErrNone); | 
|         |     75 		aGraphicsContext->Activate(aScreenDevice); | 
|         |     76 		} | 
|         |     77 private: | 
|         |     78 	void PreDrawStep(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext) | 
|         |     79 		{ | 
|         |     80 		aGraphicsContext->Clear(); | 
|         |     81 		TSize screenSize = aScreenDevice->SizeInPixels(); | 
|         |     82 		TRect rc(iOrigin.iX, iOrigin.iY, screenSize.iWidth - 1, screenSize.iHeight - 1); | 
|         |     83 		aGraphicsContext->DrawRect(rc); | 
|         |     84 		aScreenDevice->Update(); | 
|         |     85 		} | 
|         |     86 	void PostDrawStep(CFbsScreenDevice* aScreenDevice, CFbsBitGc*) | 
|         |     87 		{ | 
|         |     88 		aScreenDevice->Update(); | 
|         |     89 		} | 
|         |     90  | 
|         |     91 private: | 
|         |     92 	TPoint iOrigin; | 
|         |     93 	TDrawFunctor& iFunctor; | 
|         |     94 	TDrawParam* iPrm; | 
|         |     95 	TBool iCallGetch; | 
|         |     96 	}; | 
|         |     97  | 
|         |     98 // | 
|         |     99 //TDrawTextFunctor class is used for CFbsBitGc text drawing/scaling tests | 
|         |    100 class TDrawTextFunctor | 
|         |    101 	{ | 
|         |    102 public: | 
|         |    103 	void operator()(CFbsBitGc* aGraphicsContext, CFont* aFont) | 
|         |    104 		{ | 
|         |    105 		__ASSERT_DEBUG(aFont, User::Invariant()); | 
|         |    106 		_LIT(KTestText, "ABCDEFGH-0123456789"); | 
|         |    107 		_LIT(KTestText2, "ijklmnopqrst"); | 
|         |    108 		TPoint textPos = TPoint(0, aFont->AscentInPixels()); | 
|         |    109 		TPoint textPos2 = TPoint(3, aFont->AscentInPixels() + 3); | 
|         |    110 		TInt text2Width = aFont->TextWidthInPixels(KTestText2); | 
|         |    111 		TPoint textPos3 = TPoint(aFont->HeightInPixels() * 3, aFont->AscentInPixels() + text2Width + 3); | 
|         |    112  | 
|         |    113 		aGraphicsContext->DrawText(KTestText, textPos); | 
|         |    114 		aGraphicsContext->DrawTextVertical(KTestText2, textPos2, EFalse); | 
|         |    115 		aGraphicsContext->DrawTextVertical(KTestText2, textPos3, ETrue); | 
|         |    116 		} | 
|         |    117 	}; | 
|         |    118  | 
|         |    119  | 
|         |    120 // | 
|         |    121 //TDrawBitmapFunctor class is used for CFbsBitGc bitmap (DrawBitmap) drawing/scaling tests | 
|         |    122 class TDrawBitmapFunctor | 
|         |    123 	{ | 
|         |    124 public: | 
|         |    125 	void operator()(CFbsBitGc* aGraphicsContext, CFbsBitmap* aBitmap) | 
|         |    126 		{ | 
|         |    127 		__ASSERT_DEBUG(aBitmap, User::Invariant()); | 
|         |    128 		TSize size = aBitmap->SizeInPixels(); | 
|         |    129 		aGraphicsContext->DrawBitmap(TRect(2, 2, size.iWidth + 2, size.iHeight + 2), aBitmap); | 
|         |    130 		} | 
|         |    131 	}; | 
|         |    132  | 
|         |    133  | 
|         |    134 // | 
|         |    135 //TBitBltMaskedFunctor class is used for CFbsBitGc::BitBltMasked drawing/scaling tests | 
|         |    136 struct TMaskedBitmapPrm | 
|         |    137 	{ | 
|         |    138 	CFbsBitmap* iBitmap; | 
|         |    139 	CFbsBitmap* iMaskBitmap; | 
|         |    140 	}; | 
|         |    141 class TBitBltMaskedFunctor | 
|         |    142 	{ | 
|         |    143 public: | 
|         |    144 	void operator()(CFbsBitGc* aGraphicsContext, TMaskedBitmapPrm* aPrm) | 
|         |    145 		{ | 
|         |    146 		__ASSERT_DEBUG(aPrm, User::Invariant()); | 
|         |    147 		TSize size = aPrm->iBitmap->SizeInPixels(); | 
|         |    148 		TPoint pt(2, 2); | 
|         |    149 		TPoint pt2(pt.iX + size.iWidth + 10, pt.iY); | 
|         |    150 		TRect rc(pt, size); | 
|         |    151 		aGraphicsContext->BitBlt(pt, aPrm->iBitmap); | 
|         |    152 		aGraphicsContext->BitBltMasked(pt2, aPrm->iBitmap, rc, aPrm->iMaskBitmap, EFalse); | 
|         |    153 		} | 
|         |    154 	}; | 
|         |    155  | 
|         |    156 //------------- | 
|         |    157 CTBitgdiScaling::CTBitgdiScaling(CTestStep* aStep) : | 
|         |    158 	CTGraphicsBase(aStep) | 
|         |    159 	{ | 
|         |    160 	 | 
|         |    161 	} | 
|         |    162  | 
|         |    163 CTBitgdiScaling::~CTBitgdiScaling() | 
|         |    164 	{ | 
|         |    165 	delete iScreenDevice; | 
|         |    166 	delete iGraphicsContext; | 
|         |    167 	delete iScreenDevice2; | 
|         |    168 	delete iGraphicsContext2; | 
|         |    169 	} | 
|         |    170 	 | 
|         |    171 void CTBitgdiScaling::ConstructL() | 
|         |    172 	{ | 
|         |    173 #if defined __WINS__ || defined __WINSCW__ | 
|         |    174  	ChangeScreenDeviceL(); | 
|         |    175 #endif//defined __WINS__ || defined __WINSCW__ | 
|         |    176  | 
|         |    177 	TDisplayMode theDisplayMode = (static_cast<CTBitgdiScalingStep*>(iStep))->DisplayMode(); | 
|         |    178 	_LIT(KLog,"Screen Display Mode %S"); | 
|         |    179 	INFO_PRINTF2(KLog,&ColorModeName(theDisplayMode)); | 
|         |    180 	TInt err = CreateScreenDeviceAndContextL(theDisplayMode, iScreenDevice, iGraphicsContext); | 
|         |    181 	TEST(err == KErrNone); | 
|         |    182 	 | 
|         |    183 	err = CreateScreenDeviceAndContextL(theDisplayMode, iScreenDevice2, iGraphicsContext2); | 
|         |    184 	TSize size = iScreenDevice->SizeInPixels(); | 
|         |    185 	_LIT(KSize,"[%d,%d] screen pixels"); | 
|         |    186 	INFO_PRINTF3(KSize, size.iWidth, size.iHeight); | 
|         |    187 	TEST(err == KErrNone); | 
|         |    188 	} | 
|         |    189 	 | 
|         |    190 void CTBitgdiScaling::RunTestCaseL(TInt aCurTestCase) | 
|         |    191 	{ | 
|         |    192 	((CTBitgdiScalingStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); | 
|         |    193 	switch(aCurTestCase) | 
|         |    194 		{ | 
|         |    195 	case 1: | 
|         |    196 		((CTBitgdiScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0032")); | 
|         |    197 		FontScalingL(iScreenDevice, iGraphicsContext); | 
|         |    198 		break; | 
|         |    199 	case 2: | 
|         |    200 		((CTBitgdiScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0033")); | 
|         |    201 		BitmapScalingL(iScreenDevice, iGraphicsContext); | 
|         |    202 		break; | 
|         |    203 	case 3: | 
|         |    204 		((CTBitgdiScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0034")); | 
|         |    205 		BitBltMaskedScalingL(iScreenDevice, iGraphicsContext); | 
|         |    206 		break; | 
|         |    207 	case 4: | 
|         |    208 		((CTBitgdiScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0035")); | 
|         |    209 		DrawingScalingL(iScreenDevice, iGraphicsContext); | 
|         |    210 		break; | 
|         |    211 	case 5: | 
|         |    212 		((CTBitgdiScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0036")); | 
|         |    213 		MapColors(iScreenDevice, iGraphicsContext); | 
|         |    214 		break; | 
|         |    215 	case 6: | 
|         |    216 /** | 
|         |    217   @SYMTestCaseID GRAPHICS-BITGDI-0117 | 
|         |    218 */ | 
|         |    219 		((CTBitgdiScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0117")); | 
|         |    220 		BitmapScalingL(iScreenDevice, iGraphicsContext, iScreenDevice2, iGraphicsContext2); | 
|         |    221 		break; | 
|         |    222 	case 7: | 
|         |    223 		((CTBitgdiScalingStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0037")); | 
|         |    224 		RunTests2L(); | 
|         |    225 		return; | 
|         |    226 	case 8: | 
|         |    227 		((CTBitgdiScalingStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); | 
|         |    228 		((CTBitgdiScalingStep*)iStep)->CloseTMSGraphicsStep(); | 
|         |    229 		TestComplete(); | 
|         |    230 		break; | 
|         |    231 		} | 
|         |    232 	((CTBitgdiScalingStep*)iStep)->RecordTestResultL(); | 
|         |    233 	} | 
|         |    234  | 
|         |    235 //This function creates screen device and graphics context objects and pushesh them on the | 
|         |    236 //cleanup stack. | 
|         |    237 TInt CTBitgdiScaling::CreateScreenDeviceAndContextL(TDisplayMode aDisplayMode, | 
|         |    238 									CFbsScreenDevice*& aScreenDevice, | 
|         |    239 									CFbsBitGc*& aGraphicsContext) | 
|         |    240 	{ | 
|         |    241 	__ASSERT_DEBUG(!aScreenDevice, User::Invariant()); | 
|         |    242 	__ASSERT_DEBUG(!aGraphicsContext, User::Invariant()); | 
|         |    243 	TRAPD(err, aScreenDevice = CFbsScreenDevice::NewL(KNullDesC, aDisplayMode)); | 
|         |    244 	if (err!=KErrNone) | 
|         |    245 		{ | 
|         |    246 		_LIT(KLog,"Failed to create screen device for mode %S  err=%d"); | 
|         |    247 		INFO_PRINTF3(KLog,&ColorModeName(aDisplayMode),err); | 
|         |    248 		} | 
|         |    249 	if(err == KErrNotSupported) | 
|         |    250 		{ | 
|         |    251 		return err; | 
|         |    252 		} | 
|         |    253 	TEST(err == KErrNone); | 
|         |    254 	err = aScreenDevice->CreateContext((CGraphicsContext*&)aGraphicsContext); | 
|         |    255 	if (err!=KErrNone) | 
|         |    256 		{ | 
|         |    257 		_LIT(KLog,"Failed to create screen graphics context  mode %S  err=%d"); | 
|         |    258 		INFO_PRINTF3(KLog,&ColorModeName(aDisplayMode),err); | 
|         |    259 		} | 
|         |    260 	TEST(err == KErrNone); | 
|         |    261 	aGraphicsContext->SetUserDisplayMode(aDisplayMode); | 
|         |    262 	aScreenDevice->ChangeScreenDevice(NULL); | 
|         |    263 	aScreenDevice->SetAutoUpdate(EFalse); | 
|         |    264 	return err; | 
|         |    265 	} | 
|         |    266  | 
|         |    267 #if defined __WINS__ || defined __WINSCW__ | 
|         |    268 //This test function might be used to debug ChangeScreenDevice() call. | 
|         |    269 void CTBitgdiScaling::ChangeScreenDeviceL() | 
|         |    270 	{ | 
|         |    271 	CFbsScreenDevice* screenDevice1=NULL; | 
|         |    272 	TInt leaveErr=KErrNone;; | 
|         |    273 	TInt depth1= EColor256; | 
|         |    274  | 
|         |    275 	// Try to get a colour screendevice | 
|         |    276 	for (;depth1<EColorLast && !screenDevice1;depth1++) | 
|         |    277 		{ | 
|         |    278 		TRAP(leaveErr,screenDevice1 = CFbsScreenDevice::NewL(KNullDesC, TDisplayMode(depth1))); | 
|         |    279 		} | 
|         |    280 	if (leaveErr != KErrNone || !screenDevice1) | 
|         |    281 		{ | 
|         |    282 		// Try to get a greyscale screendevice as failed to get a colour one | 
|         |    283 		for (depth1=ENone;depth1<EColor256 && !screenDevice1;depth1++) | 
|         |    284 			{ | 
|         |    285 			TRAP(leaveErr,screenDevice1 = CFbsScreenDevice::NewL(KNullDesC, TDisplayMode(depth1))); | 
|         |    286 			} | 
|         |    287 		if (leaveErr != KErrNone || !screenDevice1) | 
|         |    288 			{ | 
|         |    289 			INFO_PRINTF1(_L("Failed to create any screen devices. Re-leaving")); | 
|         |    290 			User::Leave(leaveErr); | 
|         |    291 			} | 
|         |    292 		} | 
|         |    293 	CleanupStack::PushL(screenDevice1); | 
|         |    294  | 
|         |    295 	CFbsBitGc* graphicsContext1 = NULL; | 
|         |    296 	User::LeaveIfError(screenDevice1->CreateContext(graphicsContext1)); | 
|         |    297 	CleanupStack::PushL(graphicsContext1); | 
|         |    298 	graphicsContext1->SetUserDisplayMode(EColor256); | 
|         |    299 	screenDevice1->ChangeScreenDevice(NULL); | 
|         |    300 	screenDevice1->SetAutoUpdate(EFalse); | 
|         |    301  | 
|         |    302 	TInt err = screenDevice1->SetScalingFactor(TPoint(440, 40), 1, 1, 1, 1); | 
|         |    303 	TEST(err == KErrNone); | 
|         |    304 	graphicsContext1->Activate(screenDevice1); | 
|         |    305 	TRect rect1; | 
|         |    306 	screenDevice1->GetDrawRect(rect1); | 
|         |    307  | 
|         |    308 	CFbsScreenDevice* screenDevice2 = NULL; | 
|         |    309 	for (TInt depth2=ENone;depth2<EColorLast && ! screenDevice1;depth2++) | 
|         |    310 		if (depth2!=depth1) | 
|         |    311 			{ | 
|         |    312 			TRAP(leaveErr,screenDevice2 = CFbsScreenDevice::NewL(KNullDesC, TDisplayMode(depth2))) | 
|         |    313 			} | 
|         |    314 	if (leaveErr != KErrNone || !screenDevice2) | 
|         |    315 		{ | 
|         |    316 			INFO_PRINTF1(_L("Failed to create a different screen device - test skipped")); | 
|         |    317 		 | 
|         |    318 		} | 
|         |    319 	else | 
|         |    320 		{ | 
|         |    321 		CleanupStack::PushL(screenDevice2); | 
|         |    322 		TRect rect2; | 
|         |    323 		screenDevice2->GetDrawRect(rect2); | 
|         |    324  | 
|         |    325 		screenDevice1->ChangeScreenDevice(screenDevice2); | 
|         |    326 		graphicsContext1->Activate(screenDevice1); | 
|         |    327 		screenDevice1->GetDrawRect(rect1); | 
|         |    328 		TEST(rect1 == rect2); | 
|         |    329 		TRegionFix<1> area(rect2); | 
|         |    330 		graphicsContext1->SetClippingRegion(&area); | 
|         |    331 		::CleanupStack::PopAndDestroy(screenDevice2); | 
|         |    332 		} | 
|         |    333 	::CleanupStack::PopAndDestroy(2);//screenDevice1 and graphicsContext1 | 
|         |    334 	} | 
|         |    335 #endif//defined __WINS__ || defined __WINSCW__ | 
|         |    336  | 
|         |    337 /** | 
|         |    338   @SYMTestCaseID GRAPHICS-BITGDI-0032 | 
|         |    339   | 
|         |    340   @SYMDEF              | 
|         |    341  | 
|         |    342   @SYMTestCaseDesc FontScalingL function is used for CFbsBitGc text drawing/scaling tests | 
|         |    343     | 
|         |    344   @SYMTestPriority High | 
|         |    345  | 
|         |    346   @SYMTestStatus Implemented | 
|         |    347  | 
|         |    348   @SYMTestActions Tests the drawing of some text to screen in specified height | 
|         |    349   | 
|         |    350   @SYMTestExpectedResults Test should perform graphics operations succesfully.  | 
|         |    351 */ | 
|         |    352 // | 
|         |    353 void CTBitgdiScaling::FontScalingL(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext) | 
|         |    354 	{ | 
|         |    355 	__ASSERT_DEBUG(aScreenDevice, User::Invariant()); | 
|         |    356 	__ASSERT_DEBUG(aGraphicsContext, User::Invariant()); | 
|         |    357 	INFO_PRINTF1(_L("Font Scaling")); | 
|         |    358 	const TInt KTypeFacesCnt = aScreenDevice->NumTypefaces(); | 
|         |    359 	for(TInt i=0;i<KTypeFacesCnt;++i) | 
|         |    360 		{ | 
|         |    361 		TTypefaceSupport typeFaceSupport; | 
|         |    362 		aScreenDevice->TypefaceSupport(typeFaceSupport, i); | 
|         |    363 		TFontSpec fontSpec; | 
|         |    364 		fontSpec.iTypeface = typeFaceSupport.iTypeface; | 
|         |    365 		fontSpec.iHeight = 14; | 
|         |    366 		CFont* font = NULL; | 
|         |    367 		User::LeaveIfError(aScreenDevice->GetNearestFontToDesignHeightInPixels(font, fontSpec)); | 
|         |    368 		TDesC& fontName = fontSpec.iTypeface.iName; | 
|         |    369 		RDebug::Print(_L("%S\r\n"), &fontName); | 
|         |    370 		aGraphicsContext->UseFont(font); | 
|         |    371 		DrawTestText(aScreenDevice, aGraphicsContext, font); | 
|         |    372 		aScreenDevice->ReleaseFont(font); | 
|         |    373 		} | 
|         |    374 	} | 
|         |    375  | 
|         |    376 /** | 
|         |    377   @SYMTestCaseID GRAPHICS-BITGDI-0033 | 
|         |    378   | 
|         |    379   @SYMDEF              | 
|         |    380  | 
|         |    381   @SYMTestCaseDesc BitmapScalingL fucntion is used for CFbsBitGc bitmap (DrawBitmap) drawing/scaling tests | 
|         |    382     | 
|         |    383   @SYMTestPriority High | 
|         |    384  | 
|         |    385   @SYMTestStatus Implemented | 
|         |    386  | 
|         |    387   @SYMTestActions Loads in a number of bitmaps then scales them to the screen | 
|         |    388   | 
|         |    389   @SYMTestExpectedResults Test should perform graphics operations succesfully.  | 
|         |    390 */ | 
|         |    391 void CTBitgdiScaling::BitmapScalingL(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext) | 
|         |    392 	{ | 
|         |    393 	INFO_PRINTF1(_L("Bitmap Scaling")); | 
|         |    394 	CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; | 
|         |    395 	CleanupStack::PushL(bitmap); | 
|         |    396 	//8 - it is the number of bitmaps in mbm file - see GenBitmaps.mk where this mbm file is generated | 
|         |    397 	for(TInt i=0;i<8;i++) | 
|         |    398 		{ | 
|         |    399 		bitmap->Reset(); | 
|         |    400 		User::LeaveIfError(bitmap->Load(KTestBmp, i)); | 
|         |    401 		TSize size = bitmap->SizeInPixels(); | 
|         |    402 		TPoint ptOrigin(size.iWidth + 10, 3); | 
|         |    403  | 
|         |    404 		TDrawBitmapFunctor functor; | 
|         |    405 		TDrawComposite<TDrawBitmapFunctor, CFbsBitmap> composite(ptOrigin, functor, bitmap); | 
|         |    406 		composite.Draw(aScreenDevice, aGraphicsContext, this); | 
|         |    407 		} | 
|         |    408 	CleanupStack::PopAndDestroy(bitmap); | 
|         |    409 	} | 
|         |    410  | 
|         |    411 /** | 
|         |    412   @SYMTestCaseID GRAPHICS-BITGDI-0034 | 
|         |    413   | 
|         |    414   @SYMDEF              | 
|         |    415  | 
|         |    416   @SYMTestCaseDesc BitBltMaskedScalingL fucntion is used for CFbsBitGc::BitBltMasked drawing/scaling tests | 
|         |    417     | 
|         |    418   @SYMTestPriority High | 
|         |    419  | 
|         |    420   @SYMTestStatus Implemented | 
|         |    421  | 
|         |    422   @SYMTestActions Loads in a number of bitmaps and their masks then scales them to the screen | 
|         |    423   | 
|         |    424   @SYMTestExpectedResults Test should perform graphics operations succesfully.  | 
|         |    425 */	 | 
|         |    426 void CTBitgdiScaling::BitBltMaskedScalingL(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext) | 
|         |    427 	{ | 
|         |    428 	INFO_PRINTF1(_L("BitBltMasked Scaling")); | 
|         |    429  | 
|         |    430 	CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; | 
|         |    431 	CleanupStack::PushL(bitmap); | 
|         |    432 	User::LeaveIfError(bitmap->Load(KTestBmp, 0)); | 
|         |    433 	TSize size = bitmap->SizeInPixels(); | 
|         |    434  | 
|         |    435 	CFbsBitmap* maskBitmap = new (ELeave) CFbsBitmap; | 
|         |    436 	CleanupStack::PushL(maskBitmap); | 
|         |    437 	User::LeaveIfError(maskBitmap->Create(size, EGray256)); | 
|         |    438  | 
|         |    439 	TBitmapUtil bmpUtil(maskBitmap); | 
|         |    440 	bmpUtil.Begin(TPoint(0, 0)); | 
|         |    441 	for(TInt i=0;i<size.iWidth;++i) | 
|         |    442 		{ | 
|         |    443 		for(TInt j=0;j<size.iHeight;++j) | 
|         |    444 			{ | 
|         |    445 			bmpUtil.SetPos(TPoint(i, j)); | 
|         |    446 			bmpUtil.SetPixel(0x00555555); | 
|         |    447 			} | 
|         |    448 		} | 
|         |    449 	bmpUtil.End(); | 
|         |    450  | 
|         |    451 	TPoint ptOrigin(size.iWidth * 3, 7); | 
|         |    452 	TMaskedBitmapPrm prm = {bitmap, maskBitmap}; | 
|         |    453 	TBitBltMaskedFunctor functor; | 
|         |    454 	TDrawComposite<TBitBltMaskedFunctor, TMaskedBitmapPrm> composite(ptOrigin, functor, &prm); | 
|         |    455 	composite.Draw(aScreenDevice, aGraphicsContext, this); | 
|         |    456 	CleanupStack::PopAndDestroy(2);//maskBitmap and bitmap | 
|         |    457 	} | 
|         |    458  | 
|         |    459 /** | 
|         |    460   @SYMTestCaseID GRAPHICS-BITGDI-0035 | 
|         |    461   | 
|         |    462   @SYMDEF              | 
|         |    463  | 
|         |    464   @SYMTestCaseDesc DrawingScalingL function is used for CFbsBitGc::DrawXXX drawing/scaling tests | 
|         |    465     | 
|         |    466   @SYMTestPriority High | 
|         |    467  | 
|         |    468   @SYMTestStatus Implemented | 
|         |    469  | 
|         |    470   @SYMTestActions Tests the scaling various basic graphic primitives | 
|         |    471   | 
|         |    472   @SYMTestExpectedResults Test should perform graphics operations succesfully.  | 
|         |    473 */ | 
|         |    474 void CTBitgdiScaling::DrawingScalingL(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext) | 
|         |    475 	{ | 
|         |    476 	DrawArc(aScreenDevice, aGraphicsContext); | 
|         |    477 	DrawPie(aScreenDevice, aGraphicsContext); | 
|         |    478 	DrawRoundRect(aScreenDevice, aGraphicsContext); | 
|         |    479 	DrawPolyLineL(aScreenDevice, aGraphicsContext); | 
|         |    480 	DrawPolyLineNoEndPointL(aScreenDevice, aGraphicsContext); | 
|         |    481 	DrawPolygonL(aScreenDevice, aGraphicsContext); | 
|         |    482 	DrawEllipse(aScreenDevice, aGraphicsContext); | 
|         |    483 	DrawLine(aScreenDevice, aGraphicsContext); | 
|         |    484 	DrawRect(aScreenDevice, aGraphicsContext); | 
|         |    485 	ShadowFade(aScreenDevice, aGraphicsContext); | 
|         |    486 	} | 
|         |    487  | 
|         |    488 // | 
|         |    489 //TMapColorsFunctor class is used for CFbsBitGc::MapColors drawing/scaling tests | 
|         |    490 class TMapColorsFunctor | 
|         |    491 	{ | 
|         |    492 public: | 
|         |    493 	void operator()(CFbsBitGc* aGraphicsContext, TEmpty*) | 
|         |    494 		{ | 
|         |    495 		aGraphicsContext->DrawRect(TRect(7, 13, 45, 67)); | 
|         |    496 		TRgb colors[] = {TRgb(0x00, 0x00, 0x00), TRgb(0xFF, 0x20, 0x20)}; | 
|         |    497 		aGraphicsContext->MapColors(TRect(5, 10, 50, 70), colors); | 
|         |    498 		} | 
|         |    499 	}; | 
|         |    500  | 
|         |    501 /** | 
|         |    502   @SYMTestCaseID GRAPHICS-BITGDI-0036 | 
|         |    503   | 
|         |    504   @SYMDEF              | 
|         |    505  | 
|         |    506   @SYMTestCaseDesc MapColors function is used for CFbsBitGc::MapColors drawing/scaling tests | 
|         |    507     | 
|         |    508   @SYMTestPriority High | 
|         |    509  | 
|         |    510   @SYMTestStatus Implemented | 
|         |    511  | 
|         |    512   @SYMTestActions tests scaling of mapp3ed colours | 
|         |    513   | 
|         |    514   @SYMTestExpectedResults Test should perform graphics operations succesfully.  | 
|         |    515 */ | 
|         |    516 // | 
|         |    517 void CTBitgdiScaling::MapColors(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext) | 
|         |    518 	{ | 
|         |    519 	INFO_PRINTF1(_L("MapColors scaling")); | 
|         |    520 	TMapColorsFunctor functor; | 
|         |    521 	TDrawComposite<TMapColorsFunctor, TEmpty> composite(TPoint(83, 11), functor, NULL); | 
|         |    522 	composite.Draw(aScreenDevice, aGraphicsContext, this); | 
|         |    523 	} | 
|         |    524  | 
|         |    525 //BitmapScalingL fucntion is used for CFbsBitGc bitmap (DrawBitmap) drawing/scaling tests | 
|         |    526 //2 screen devices used - scaled and non-scaled | 
|         |    527 void CTBitgdiScaling::BitmapScalingL(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext,  | 
|         |    528 						   CFbsScreenDevice* aScreenDevice2, CFbsBitGc* aGraphicsContext2, | 
|         |    529 						   TBool aCallGetch) | 
|         |    530 	{ | 
|         |    531 	__ASSERT_DEBUG(aScreenDevice, User::Invariant()); | 
|         |    532 	__ASSERT_DEBUG(aGraphicsContext, User::Invariant()); | 
|         |    533 	__ASSERT_DEBUG(aScreenDevice2, User::Invariant()); | 
|         |    534 	__ASSERT_DEBUG(aGraphicsContext2, User::Invariant()); | 
|         |    535  | 
|         |    536 	INFO_PRINTF1(_L("Bitmap Scaling - 2 devices")); | 
|         |    537  | 
|         |    538 	CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; | 
|         |    539 	CleanupStack::PushL(bitmap); | 
|         |    540  | 
|         |    541 	//8 - it is the number of bitmaps in mbm file - see GenBitmaps.mk where this mbm file is generated | 
|         |    542 	for(TInt i=0;i<8;i++) | 
|         |    543 		{ | 
|         |    544 		bitmap->Reset(); | 
|         |    545 		User::LeaveIfError(bitmap->Load(KTestBmp, i)); | 
|         |    546 		TSize size = bitmap->SizeInPixels(); | 
|         |    547 		TPoint ptOrigin(size.iWidth + 10, 3); | 
|         |    548  | 
|         |    549 		TInt err = aScreenDevice2->SetScalingFactor(ptOrigin, KScalingFactorX, KScalingFactorY, 1, 1); | 
|         |    550 		TEST(err == KErrNone); | 
|         |    551 		aGraphicsContext2->Activate(aScreenDevice2); | 
|         |    552  | 
|         |    553 		aGraphicsContext->Clear(); | 
|         |    554 		aGraphicsContext2->Clear(); | 
|         |    555  | 
|         |    556 		TSize screenSize = aScreenDevice->SizeInPixels(); | 
|         |    557 		TRect rc(0, 0, screenSize.iWidth - 1, screenSize.iHeight - 1); | 
|         |    558 		aGraphicsContext->DrawRect(rc); | 
|         |    559  | 
|         |    560 		aGraphicsContext->DrawBitmap(TRect(2, 2, size.iWidth + 2, size.iHeight + 2), bitmap); | 
|         |    561  | 
|         |    562 		TSize screenSize2 = aScreenDevice2->SizeInPixels(); | 
|         |    563 		TRect rc2(0, 0, screenSize2.iWidth - 1, screenSize2.iHeight - 1); | 
|         |    564 		aGraphicsContext2->DrawRect(rc2); | 
|         |    565  | 
|         |    566 		aGraphicsContext2->DrawBitmap(TRect(2, 2, size.iWidth + 2, size.iHeight + 2), bitmap); | 
|         |    567  | 
|         |    568 		aScreenDevice->Update(); | 
|         |    569 		aScreenDevice2->Update(); | 
|         |    570  | 
|         |    571 		if(aCallGetch) | 
|         |    572 			{ | 
|         |    573 			//TheTest.Getch(); | 
|         |    574 			} | 
|         |    575 		} | 
|         |    576 	CleanupStack::PopAndDestroy(bitmap); | 
|         |    577 	} | 
|         |    578  | 
|         |    579 //DrawTestText function is used for CFbsBitGc text drawing/scaling tests | 
|         |    580 void CTBitgdiScaling::DrawTestText(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext, CFont* aFont) | 
|         |    581 	{ | 
|         |    582 	__ASSERT_DEBUG(aFont, User::Invariant()); | 
|         |    583 	TPoint ptOrigin(aFont->HeightInPixels() * 4, aFont->AscentInPixels() * 2); | 
|         |    584 	TDrawTextFunctor functor; | 
|         |    585 	TDrawComposite<TDrawTextFunctor, CFont> composite(ptOrigin, functor, aFont); | 
|         |    586 	composite.Draw(aScreenDevice, aGraphicsContext, this); | 
|         |    587 	} | 
|         |    588  | 
|         |    589 // | 
|         |    590 //TDrawArcFunctor class is used for CFbsBitGc::DrawArc drawing/scaling tests | 
|         |    591 class TDrawArcFunctor | 
|         |    592 	{ | 
|         |    593 public: | 
|         |    594 	void operator()(CFbsBitGc* aGraphicsContext, TEmpty*) | 
|         |    595 		{ | 
|         |    596 		aGraphicsContext->DrawArc(TRect(0, 0, 40, 40), TPoint(0, 20), TPoint(40, 20)); | 
|         |    597 		} | 
|         |    598 	}; | 
|         |    599  | 
|         |    600 //DrawArc function is used for CFbsBitGc::DrawArc drawing/scaling tests | 
|         |    601 void CTBitgdiScaling::DrawArc(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext) | 
|         |    602 	{ | 
|         |    603 	INFO_PRINTF1(_L("DrawArc scaling")); | 
|         |    604 	TDrawArcFunctor functor; | 
|         |    605 	TDrawComposite<TDrawArcFunctor, TEmpty> composite(TPoint(40, 0), functor, NULL); | 
|         |    606 	composite.Draw(aScreenDevice, aGraphicsContext, this); | 
|         |    607 	} | 
|         |    608  | 
|         |    609 // | 
|         |    610 //TDrawPieFunctor class is used for CFbsBitGc::DrawPie drawing/scaling tests | 
|         |    611 class TDrawPieFunctor | 
|         |    612 	{ | 
|         |    613 public: | 
|         |    614 	void operator()(CFbsBitGc* aGraphicsContext, TEmpty*) | 
|         |    615 		{ | 
|         |    616 		aGraphicsContext->DrawPie(TRect(0, 0, 40, 40), TPoint(0, 20), TPoint(40, 20)); | 
|         |    617 		} | 
|         |    618 	}; | 
|         |    619  | 
|         |    620 //DrawPie function is used for CFbsBitGc::DrawPie drawing/scaling tests | 
|         |    621 void CTBitgdiScaling::DrawPie(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext) | 
|         |    622 	{ | 
|         |    623 	INFO_PRINTF1(_L("DrawPie scaling")); | 
|         |    624 	TDrawPieFunctor functor; | 
|         |    625 	TDrawComposite<TDrawPieFunctor, TEmpty> composite(TPoint(40, 0), functor, NULL); | 
|         |    626 	composite.Draw(aScreenDevice, aGraphicsContext, this); | 
|         |    627 	} | 
|         |    628  | 
|         |    629 // | 
|         |    630 //TDrawRoundRectFunctor class is used for CFbsBitGc::DrawRoundRect drawing/scaling tests | 
|         |    631 class TDrawRoundRectFunctor | 
|         |    632 	{ | 
|         |    633 public: | 
|         |    634 	void operator()(CFbsBitGc* aGraphicsContext, TEmpty*) | 
|         |    635 		{ | 
|         |    636 		aGraphicsContext->DrawRoundRect(TRect(0, 0, 40, 40), TSize(5, 5)); | 
|         |    637 		} | 
|         |    638 	}; | 
|         |    639  | 
|         |    640 //DrawRoundRect function is used for CFbsBitGc::DrawRoundRect drawing/scaling tests | 
|         |    641 void CTBitgdiScaling::DrawRoundRect(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext) | 
|         |    642 	{ | 
|         |    643 	INFO_PRINTF1(_L("DrawRoundRect scaling")); | 
|         |    644 	TDrawRoundRectFunctor functor; | 
|         |    645 	TDrawComposite<TDrawRoundRectFunctor, TEmpty> composite(TPoint(40, 0), functor, NULL); | 
|         |    646 	composite.Draw(aScreenDevice, aGraphicsContext, this); | 
|         |    647 	} | 
|         |    648  | 
|         |    649 // | 
|         |    650  | 
|         |    651 typedef CArrayFixFlat<TPoint> CPointArray; | 
|         |    652  | 
|         |    653 //TDrawPolyLineFunctor class is used for CFbsBitGc::DrawPolyLine drawing/scaling tests | 
|         |    654 class TDrawPolyLineFunctor | 
|         |    655 	{ | 
|         |    656 public: | 
|         |    657 	void operator()(CFbsBitGc* aGraphicsContext, CPointArray* aPoints) | 
|         |    658 		{ | 
|         |    659 		aGraphicsContext->DrawPolyLine(aPoints); | 
|         |    660 		} | 
|         |    661 	}; | 
|         |    662  | 
|         |    663 //DrawPolyLineL function is used for CFbsBitGc::DrawPolyLine drawing/scaling tests | 
|         |    664 void CTBitgdiScaling::DrawPolyLineL(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext) | 
|         |    665 	{ | 
|         |    666 	INFO_PRINTF1(_L("DrawPolyLine scaling")); | 
|         |    667 	CPointArray* points = new (ELeave) CPointArray (4); | 
|         |    668 	CleanupStack::PushL(points); | 
|         |    669 	TPoint pt(1, 1); | 
|         |    670 	points->AppendL(pt); | 
|         |    671 	pt.SetXY(77, 23); | 
|         |    672 	points->AppendL(pt); | 
|         |    673 	pt.SetXY(38, 63); | 
|         |    674 	points->AppendL(pt); | 
|         |    675 	pt.SetXY(70, 51); | 
|         |    676 	points->AppendL(pt); | 
|         |    677 	TDrawPolyLineFunctor functor; | 
|         |    678 	TDrawComposite<TDrawPolyLineFunctor, CPointArray> composite(TPoint(80, 0), functor, | 
|         |    679 																points); | 
|         |    680 	composite.Draw(aScreenDevice, aGraphicsContext, this); | 
|         |    681 	CleanupStack::PopAndDestroy(points); | 
|         |    682 	} | 
|         |    683  | 
|         |    684 // | 
|         |    685 //TDrawPolyLineNoEndPointFunctor class is used for CFbsBitGc::DrawPolyLineNoEndPoint drawing/scaling tests | 
|         |    686 class TDrawPolyLineNoEndPointFunctor | 
|         |    687 	{ | 
|         |    688 public: | 
|         |    689 	void operator()(CFbsBitGc* aGraphicsContext, CPointArray* aPoints) | 
|         |    690 		{ | 
|         |    691 		aGraphicsContext->DrawPolyLineNoEndPoint(aPoints); | 
|         |    692 		} | 
|         |    693 	}; | 
|         |    694  | 
|         |    695 //DrawPolyLineNoEndPointL function is used for CFbsBitGc::DrawPolyLineNoEndPoint drawing/scaling tests | 
|         |    696 void CTBitgdiScaling::DrawPolyLineNoEndPointL(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext) | 
|         |    697 	{ | 
|         |    698 	INFO_PRINTF1(_L("DrawPolyLineNoEndPoint scaling")); | 
|         |    699 	CPointArray* points = new (ELeave) CPointArray (4); | 
|         |    700 	CleanupStack::PushL(points); | 
|         |    701 	TPoint pt(1, 1); | 
|         |    702 	points->AppendL(pt); | 
|         |    703 	pt.SetXY(77, 23); | 
|         |    704 	points->AppendL(pt); | 
|         |    705 	pt.SetXY(38, 63); | 
|         |    706 	points->AppendL(pt); | 
|         |    707 	pt.SetXY(70, 51); | 
|         |    708 	points->AppendL(pt); | 
|         |    709 	TDrawPolyLineNoEndPointFunctor functor; | 
|         |    710 	TDrawComposite<TDrawPolyLineNoEndPointFunctor, CPointArray> composite( | 
|         |    711 																	TPoint(80, 0), functor, | 
|         |    712 																	points); | 
|         |    713 	composite.Draw(aScreenDevice, aGraphicsContext, this); | 
|         |    714 	CleanupStack::PopAndDestroy(points); | 
|         |    715 	} | 
|         |    716  | 
|         |    717 // | 
|         |    718 //TDrawPolygonFunctor class is used for CFbsBitGc::DrawPolygon drawing/scaling tests | 
|         |    719 class TDrawPolygonFunctor | 
|         |    720 	{ | 
|         |    721 public: | 
|         |    722 	void operator()(CFbsBitGc* aGraphicsContext, CPointArray* aPoints) | 
|         |    723 		{ | 
|         |    724 		aGraphicsContext->DrawPolygon(aPoints); | 
|         |    725 		} | 
|         |    726 	}; | 
|         |    727  | 
|         |    728 //DrawPolygon function is used for CFbsBitGc::DrawPolygon drawing/scaling tests | 
|         |    729 void CTBitgdiScaling::DrawPolygonL(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext) | 
|         |    730 	{ | 
|         |    731 	INFO_PRINTF1(_L("DrawPolygon scaling")); | 
|         |    732 	CPointArray* points = new (ELeave) CPointArray (6); | 
|         |    733 	CleanupStack::PushL(points); | 
|         |    734 	TPoint pt(1, 20); | 
|         |    735 	points->AppendL(pt); | 
|         |    736 	pt.SetXY(23, 3); | 
|         |    737 	points->AppendL(pt); | 
|         |    738 	pt.SetXY(61, 29); | 
|         |    739 	points->AppendL(pt); | 
|         |    740 	pt.SetXY(51, 47); | 
|         |    741 	points->AppendL(pt); | 
|         |    742 	pt.SetXY(31, 39); | 
|         |    743 	points->AppendL(pt); | 
|         |    744 	pt.SetXY(44, 17); | 
|         |    745 	points->AppendL(pt); | 
|         |    746 	TDrawPolygonFunctor functor; | 
|         |    747 	TDrawComposite<TDrawPolygonFunctor, CPointArray> composite(TPoint(80, 0), functor, | 
|         |    748 															   points); | 
|         |    749 	composite.Draw(aScreenDevice, aGraphicsContext, this); | 
|         |    750 	CleanupStack::PopAndDestroy(points); | 
|         |    751 	} | 
|         |    752  | 
|         |    753 // | 
|         |    754 //TDrawEllipseFunctor class is used for CFbsBitGc::DrawEllipse drawing/scaling tests | 
|         |    755 class TDrawEllipseFunctor | 
|         |    756 	{ | 
|         |    757 public: | 
|         |    758 	void operator()(CFbsBitGc* aGraphicsContext, TEmpty*) | 
|         |    759 		{ | 
|         |    760 		aGraphicsContext->DrawEllipse(TRect(11, 13, 40, 70)); | 
|         |    761 		} | 
|         |    762 	}; | 
|         |    763  | 
|         |    764 //DrawEllipse function is used for CFbsBitGc::DrawEllipse drawing/scaling tests | 
|         |    765 void CTBitgdiScaling::DrawEllipse(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext) | 
|         |    766 	{ | 
|         |    767 	INFO_PRINTF1(_L("DrawEllipse scaling")); | 
|         |    768 	TDrawEllipseFunctor functor; | 
|         |    769 	TDrawComposite<TDrawEllipseFunctor, TEmpty> composite(TPoint(50, 27), functor, NULL); | 
|         |    770 	composite.Draw(aScreenDevice, aGraphicsContext, this); | 
|         |    771 	} | 
|         |    772  | 
|         |    773 // | 
|         |    774 //TDrawLineFunctor class is used for CFbsBitGc::DrawLine drawing/scaling tests | 
|         |    775 class TDrawLineFunctor | 
|         |    776 	{ | 
|         |    777 public: | 
|         |    778 	void operator()(CFbsBitGc* aGraphicsContext, TEmpty*) | 
|         |    779 		{ | 
|         |    780 		aGraphicsContext->DrawLine(TPoint(7, 13), TPoint(45, 67)); | 
|         |    781 		aGraphicsContext->DrawLineTo(TPoint(33, 53)); | 
|         |    782 		aGraphicsContext->DrawLineBy(TPoint(11, 53)); | 
|         |    783 		} | 
|         |    784 	}; | 
|         |    785  | 
|         |    786 //DrawLine function is used for CFbsBitGc::DrawLineXX drawing/scaling tests | 
|         |    787 void CTBitgdiScaling::DrawLine(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext) | 
|         |    788 	{ | 
|         |    789 	INFO_PRINTF1(_L("DrawLineXX scaling")); | 
|         |    790 	TDrawLineFunctor functor; | 
|         |    791 	TDrawComposite<TDrawLineFunctor, TEmpty> composite(TPoint(83, 11), functor, NULL); | 
|         |    792 	composite.Draw(aScreenDevice, aGraphicsContext, this); | 
|         |    793 	} | 
|         |    794  | 
|         |    795 // | 
|         |    796 //TDrawRectFunctor class is used for CFbsBitGc::DrawRect drawing/scaling tests | 
|         |    797 class TDrawRectFunctor | 
|         |    798 	{ | 
|         |    799 public: | 
|         |    800 	void operator()(CFbsBitGc* aGraphicsContext, TEmpty*) | 
|         |    801 		{ | 
|         |    802 		aGraphicsContext->DrawRect(TRect(7, 13, 45, 67)); | 
|         |    803 		} | 
|         |    804 	}; | 
|         |    805  | 
|         |    806 //DrawRect function is used for CFbsBitGc::DrawRect drawing/scaling tests | 
|         |    807 void CTBitgdiScaling::DrawRect(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext) | 
|         |    808 	{ | 
|         |    809 	INFO_PRINTF1(_L("DrawRect scaling")); | 
|         |    810 	TDrawRectFunctor functor; | 
|         |    811 	TDrawComposite<TDrawRectFunctor, TEmpty> composite(TPoint(83, 11), functor, NULL); | 
|         |    812 	composite.Draw(aScreenDevice, aGraphicsContext, this); | 
|         |    813 	} | 
|         |    814  | 
|         |    815 // | 
|         |    816 //TShadowFadeFunctor class is used for CFbsBitGc::ShadowArea/FadeArea drawing/scaling tests | 
|         |    817 class TShadowFadeFunctor | 
|         |    818 	{ | 
|         |    819 public: | 
|         |    820 	void operator()(CFbsBitGc* aGraphicsContext, TEmpty*) | 
|         |    821 		{ | 
|         |    822 		aGraphicsContext->SetBrushStyle(CGraphicsContext::ESolidBrush); | 
|         |    823  | 
|         |    824 		aGraphicsContext->SetBrushColor(TRgb(0xBB, 0x34, 0x55)); | 
|         |    825 		aGraphicsContext->DrawRect(TRect(1, 1, 40, 20)); | 
|         |    826 		aGraphicsContext->DrawRect(TRect(20, 20, 40, 40)); | 
|         |    827 		RRegion shadowRgn; | 
|         |    828 		shadowRgn.AddRect(TRect(1, 1, 40, 20)); | 
|         |    829 		shadowRgn.AddRect(TRect(20, 20, 40, 40)); | 
|         |    830 		aGraphicsContext->ShadowArea(&shadowRgn); | 
|         |    831 		shadowRgn.Close(); | 
|         |    832  | 
|         |    833 		aGraphicsContext->SetBrushColor(TRgb(0xFF, 0x00, 0xFF)); | 
|         |    834 		aGraphicsContext->DrawRect(TRect(3, 25, 17, 33)); | 
|         |    835 		aGraphicsContext->DrawRect(TRect(1, 43, 67, 55)); | 
|         |    836 		RRegion fadeRgn; | 
|         |    837 		fadeRgn.AddRect(TRect(3, 25, 17, 33)); | 
|         |    838 		fadeRgn.AddRect(TRect(1, 43, 67, 55)); | 
|         |    839 		aGraphicsContext->FadeArea(&fadeRgn); | 
|         |    840 		fadeRgn.Close(); | 
|         |    841  | 
|         |    842 		aGraphicsContext->SetBrushColor(TRgb(0xFF, 0xFF, 0xFF)); | 
|         |    843 		aGraphicsContext->SetBrushStyle(CGraphicsContext::ENullBrush); | 
|         |    844 		} | 
|         |    845 	}; | 
|         |    846  | 
|         |    847 //ShadowFade function is used for CFbsBitGc::ShadowArea/FadeArea drawing/scaling tests | 
|         |    848 void CTBitgdiScaling::ShadowFade(CFbsScreenDevice* aScreenDevice, CFbsBitGc* aGraphicsContext) | 
|         |    849 	{ | 
|         |    850 	INFO_PRINTF1(_L("Shadow/Fade scaling")); | 
|         |    851 	TShadowFadeFunctor functor; | 
|         |    852 	TDrawComposite<TShadowFadeFunctor, TEmpty> composite(TPoint(83, 11), functor, NULL); | 
|         |    853 	composite.Draw(aScreenDevice, aGraphicsContext, this); | 
|         |    854 	} | 
|         |    855  | 
|         |    856 //-------------- | 
|         |    857 __CONSTRUCT_STEP__(BitgdiScaling) | 
|         |    858  | 
|         |    859 void CTBitgdiScalingStep::TestSetupL() | 
|         |    860 	{ | 
|         |    861 	iDisplayMode = GetDisplayModeL(); | 
|         |    862 	} | 
|         |    863  | 
|         |    864 TDisplayMode CTBitgdiScalingStep::GetDisplayModeL() | 
|         |    865 	{ | 
|         |    866 	CFbsScreenDevice* device = NULL; | 
|         |    867 	TDisplayMode mode = EColor64K; | 
|         |    868 	TRAPD(err, device = CFbsScreenDevice::NewL(KNullDesC, mode)); | 
|         |    869 	if (err == KErrNotSupported) | 
|         |    870 		{ | 
|         |    871 		mode = EColor256; | 
|         |    872 		TRAP(err, device = CFbsScreenDevice::NewL(KNullDesC, mode)); | 
|         |    873 		} | 
|         |    874 	if (err == KErrNotSupported) | 
|         |    875 		{ | 
|         |    876 		mode = EColor16MA; | 
|         |    877 		TRAP(err, device = CFbsScreenDevice::NewL(KNullDesC, mode)); | 
|         |    878 		} | 
|         |    879 	if (err == KErrNotSupported) | 
|         |    880 		{ | 
|         |    881 		mode = EColor16MAP; | 
|         |    882 		TRAP(err, device = CFbsScreenDevice::NewL(KNullDesC, mode)); | 
|         |    883 		} | 
|         |    884 	TESTL(err == KErrNone); | 
|         |    885 	delete device; | 
|         |    886 	return mode; | 
|         |    887 	} |