os/graphics/graphicsapitest/screendriverhaitest/screendriver/src/t_cfbsdrawdevicedata.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:
    15 *
    16 */
    17 
    18 #include "t_cfbsdrawdevicedata.h"
    19 #include <hal.h>
    20 #include <e32math.h>
    21 
    22 _LIT(KDisplayMode, 					"displayMode");
    23 _LIT(KDrawMode, 					"drawMode");
    24 _LIT(KOrientationMode,				"orientationMode");
    25 _LIT(KShadowMode, 					"shadowMode");
    26 _LIT(KBackColor, 					"backColor");
    27 _LIT(KNumRect,	 					"numRect");
    28 _LIT(KRectangles, 					"rectangles");
    29 _LIT(KRectangleSection, 			"RECTANGLES");
    30 _LIT(KNumTestRect,		 			"numTestRect");
    31 _LIT(KAutoUpdate,					"autoUpdate");
    32 _LIT(KCmdNewScreenDeviceL,			"NewScreenDeviceL");
    33 _LIT(KCmdDestructor,				"~");
    34 _LIT(KCmdInitScreen,				"InitScreen");
    35 _LIT(KCmdSetDisplayMode,			"SetDisplayMode");
    36 _LIT(KCmdSetAutoUpdate,				"SetAutoUpdate");
    37 _LIT(KCmdOrientationsAvailable,		"OrientationsAvailable");
    38 _LIT(KCmdSetOrientation,			"SetOrientation");
    39 _LIT(KCmdWriteRgb, 					"WriteRgb");
    40 _LIT(KCmdWriteLine, 				"WriteLine");
    41 _LIT(KCmdWriteBinaryLine, 			"WriteBinaryLine");
    42 _LIT(KCmdWriteRgbMulti, 			"WriteRgbMulti");
    43 _LIT(KCmdReadLine,		 			"ReadLine");
    44 _LIT(KCmdWriteRGBAlphaLine, 		"WriteRGBAlphaLine");
    45 _LIT(KCmdSetShadowMode, 			"SetShadowMode");
    46 _LIT(KCmdShadowArea, 				"ShadowArea");
    47 _LIT(KCmdWriteBinary, 				"WriteBinary");
    48 _LIT(KCmdWriteBinaryLineVertical, 	"WriteBinaryLineVertical");
    49 _LIT(KNoShadow,						"ENoShadow");
    50 _LIT(KShadow,						"EShadow");
    51 _LIT(KFade,							"EFade");
    52 _LIT(KShadowFade,					"EShadowFade");
    53 _LIT(KNone, 						"ENone");
    54 _LIT(KGray2,						"EGray2");
    55 _LIT(KGray4,						"EGray4");
    56 _LIT(KGray16,						"EGray16");
    57 _LIT(KGray256,						"EGray256");
    58 _LIT(KColor16,						"EColor16");
    59 _LIT(KColor256,						"EColor256");
    60 _LIT(KColor64K,						"EColor64K");
    61 _LIT(KColor16M,						"EColor16M");
    62 _LIT(KRgb,							"ERgb");
    63 _LIT(KColor4K,						"EColor4K");
    64 _LIT(KColor16MU,					"EColor16MU");
    65 _LIT(KColor16MA,					"EColor16MA");
    66 _LIT(KColor16MAP,					"EColor16MAP");
    67 _LIT(KColorLast,					"EColorLast");
    68 _LIT(KDrawModePEN,					"EDrawModePEN");
    69 _LIT(KDrawModeAND,					"EDrawModeAND");
    70 _LIT(KDrawModeXOR,					"EDrawModeXOR");
    71 _LIT(KDrawModeOR,					"EDrawModeOR");
    72 _LIT(KDrawModeNOTSCREEN,			"EDrawModeNOTSCREEN");
    73 _LIT(KDrawModeNOTPEN,				"EDrawModeNOTPEN");
    74 _LIT(KDelay,						"delay");
    75 _LIT(KOrientationNormal,			"EOrientationNormal");
    76 _LIT(KOrientationRotated90,			"EOrientationRotated90");
    77 _LIT(KOrientationRotated180,		"EOrientationRotated180");
    78 _LIT(KOrientationRotated270,		"EOrientationRotated270");
    79 
    80 /**
    81  * Shadow modes
    82  */
    83 const CDataWrapperBase::TEnumEntryTable	CT_CFbsDrawDeviceData::iEnumShadowModes[] =
    84 	{
    85 	KNoShadow,		1,
    86 	KShadow,		2,
    87 	KFade,			3,
    88 	KShadowFade,	4
    89 	};
    90 
    91 /**
    92  *Display Modes
    93  */
    94 const CDataWrapperBase::TEnumEntryTable	CT_CFbsDrawDeviceData::iEnumDisplayModes[] =
    95 	{
    96 	KNone,			ENone,
    97 	KGray2,			EGray2,
    98 	KGray4,			EGray4,
    99 	KGray16,		EGray16,
   100 	KGray256,		EGray256,
   101 	KColor16,		EColor16,
   102 	KColor256,		EColor256,
   103 	KColor64K,		EColor64K,
   104 	KColor16M,		EColor16M,
   105 	KRgb,			ERgb,
   106 	KColor4K,		EColor4K,
   107 	KColor16MU,		EColor16MU,
   108 	KColor16MA,		EColor16MA,
   109 	KColor16MA,		EColorLast,
   110 	KColor16MAP,	EColor16MAP,
   111 	KColorLast, 	EColor64K
   112 	};
   113 
   114 /**
   115  * Draw modes
   116  */
   117 const CDataWrapperBase::TEnumEntryTable CT_CFbsDrawDeviceData::iEnumDrawModes[] =
   118 	{
   119 	KDrawModePEN,		CGraphicsContext::EDrawModePEN,
   120 	KDrawModeAND,		CGraphicsContext::EDrawModeAND,
   121 	KDrawModeXOR,		CGraphicsContext::EDrawModeXOR,
   122 	KDrawModeOR,		CGraphicsContext::EDrawModeOR,
   123 	KDrawModeNOTSCREEN,	CGraphicsContext::EDrawModeNOTSCREEN,
   124 	KDrawModeNOTPEN,	CGraphicsContext::EDrawModeNOTPEN
   125 	};
   126 
   127 const CDataWrapperBase::TEnumEntryTable CT_CFbsDrawDeviceData::iEnumOrientationModes[] =
   128 	{
   129 	KOrientationNormal,		CFbsDrawDevice::EOrientationNormal,
   130 	KOrientationRotated90,	CFbsDrawDevice::EOrientationRotated90,
   131 	KOrientationRotated180,	CFbsDrawDevice::EOrientationRotated180,	 
   132 	KOrientationRotated270,	CFbsDrawDevice::EOrientationRotated270
   133 	};
   134 
   135 CT_CFbsDrawDeviceData* CT_CFbsDrawDeviceData::NewL() 
   136 	{
   137 	CT_CFbsDrawDeviceData*	ret = new (ELeave) CT_CFbsDrawDeviceData();
   138 	CleanupStack::PushL(ret);
   139 	ret->ConstructL();
   140 	CleanupStack::Pop(ret);
   141 	return ret;
   142 	}
   143 
   144 
   145 CT_CFbsDrawDeviceData::CT_CFbsDrawDeviceData()
   146 :	iDrawDevice(NULL),	
   147 	iDMode(CGraphicsContext::EDrawModePEN),	
   148 	iDispMode(EColor64K),	
   149 	iOrientation(0),	
   150 	iSize(0,0),	
   151 	iPostBlendShadow(ENoPostShadow),
   152 	iTestRect(),
   153 	iNumTestRects(0)
   154 	{	
   155 	}
   156 
   157 
   158 void CT_CFbsDrawDeviceData::ConstructL()
   159 	{
   160 	}
   161 
   162 /**
   163  * Public destructor
   164  */
   165 CT_CFbsDrawDeviceData::~CT_CFbsDrawDeviceData()
   166 	{
   167 	DestroyData();
   168 	}
   169 
   170 
   171 /**
   172  * Return a pointer to the object that the data wraps
   173  *
   174  * @return	pointer to the object that the data wraps
   175  */
   176 TAny* CT_CFbsDrawDeviceData::GetObject()
   177 	{
   178 	return iDrawDevice;
   179 	}
   180 
   181 /**
   182  * Command for Destructor
   183  */
   184 void CT_CFbsDrawDeviceData::DoCmdDestructor()
   185 	{
   186 	DestroyData();
   187 	}
   188 
   189 /**
   190  * Destroys used objects
   191  */
   192 void CT_CFbsDrawDeviceData::DestroyData()
   193 	{
   194 	iTestRect.Reset();
   195 	iTestRect.Close();
   196 	iDispMode = ENone;
   197 	iSize.SetSize(0,0);
   198 	
   199 	if(iDrawDevice)
   200 		{		
   201 		delete iDrawDevice;
   202 		iDrawDevice = NULL;		
   203 		}
   204 	}
   205 
   206 /**
   207  * Process a command read from the ini file
   208  *
   209  * @param aCommand			The command to process
   210  * @param aSection			The section in the ini containing data for the command
   211  * @param aAsyncErrorIndex	Command index for async calls to return errors to
   212  *
   213  * @return					ETrue if the command is processed
   214  *
   215  * @leave					System wide error
   216  */
   217 TBool CT_CFbsDrawDeviceData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, 
   218 		const TInt/* aAsyncErrorIndex*/)
   219 	{
   220 	TBool	ret = ETrue;
   221 
   222 	if 	( aCommand==KCmdInitScreen )
   223 		{
   224 		DoCmdInitScreen();
   225 		}
   226 	else if ( aCommand==KCmdSetDisplayMode )	
   227 		{
   228 		DoCmdSetDisplayMode();
   229 		}
   230 	else if ( aCommand==KCmdSetAutoUpdate )	
   231 		{
   232 		DoCmdSetAutoUpdate(aSection);
   233 		}
   234 	else if ( aCommand==KCmdOrientationsAvailable )	
   235 		{
   236 		DoCmdOrientationsAvailable();
   237 		}
   238 	else if ( aCommand==KCmdSetOrientation )	
   239 		{
   240 		DoCmdSetOrientation(aSection);
   241 		}
   242 	else if ( aCommand==KCmdNewScreenDeviceL )	
   243 		{
   244 		DoCmdNewScreenDeviceL(aSection);
   245 		}
   246 	else if ( aCommand==KCmdDestructor )	
   247 		{
   248 		DoCmdDestructor();
   249 		}
   250 	else if ( aCommand==KCmdWriteLine )	
   251 		{
   252 		DoCmdWriteLineL(aSection);		
   253 		}
   254 	else if ( aCommand==KCmdWriteBinaryLine )	
   255 		{
   256 		DoCmdWriteBinaryLineL(aSection);		
   257 		}
   258 	else if ( aCommand==KCmdWriteRgb )	
   259 		{
   260 		DoCmdWriteRgb(aSection);		
   261 		}
   262 	else if( aCommand==KCmdWriteRgbMulti )
   263 		{
   264 		DoCmdWriteRgbMulti(aSection);		
   265 		}
   266 	else if( aCommand==KCmdReadLine )
   267 		{
   268 		DoCmdReadLineL(aSection);		
   269 		}
   270 	else if( aCommand==KCmdWriteRGBAlphaLine )
   271 		{
   272 		DoCmdWriteRGBAlphaLineL(aSection);		
   273 		}
   274 	else if( aCommand==KCmdSetShadowMode )
   275 		{
   276 		DoCmdSetShadowMode(aSection);
   277 		}
   278 	else if( aCommand==KCmdShadowArea )
   279 		{
   280 		DoCmdShadowArea(aSection);
   281 		}
   282 	else if( aCommand==KCmdWriteBinary )
   283 		{
   284 		DoCmdWriteBinaryL(aSection);
   285 		}
   286 	else if( aCommand==KCmdWriteBinaryLineVertical )
   287 		{
   288 		DoCmdWriteBinaryLineVerticalL(aSection);
   289 		}	
   290 	else
   291 		{
   292 		ret = EFalse;
   293 		}
   294 	
   295 	return ret;
   296 	}
   297 
   298 /**
   299  * Tests WriteRgbMulti method from CFbsDrawDevice
   300  * @param aSection			The section in the ini containing data for the command
   301  * @return 							KErrNone if no error found.
   302  */
   303 void CT_CFbsDrawDeviceData::DoCmdWriteRgbMulti(const TTEFSectionName& aSection)
   304 	{
   305 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::DoCmdWriteRgbMulti"));
   306 	TInt drawMode;
   307 	TInt delay=0;
   308 	TInt nRect = 0;
   309 	TBool dataOk=ETrue;
   310 	
   311 	GETFROMCONFIGMANDATORY(Int, aSection, KNumRect(),nRect,_L("Error in getting parameter %S from INI file"),dataOk);
   312 	GETFROMCONFIGMANDATORY(Int, aSection, KDelay(),delay,_L("Error in getting parameter %S from INI file"),dataOk);
   313 	
   314 	if ( !GetEnumFromConfig(aSection, KDrawMode(), iEnumDrawModes, drawMode) )
   315 		{
   316 		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDrawMode());
   317 		SetBlockResult(EFail);
   318 		dataOk = EFalse;
   319 		}
   320 	if(dataOk)
   321 		{
   322 		INFO_PRINTF2(_L("Change draw mode to: %d"), drawMode);
   323 		iDMode=CGraphicsContext::TDrawMode(drawMode);
   324 		
   325 		for (TInt nBackColor = 0; nBackColor < KNumTestBackgrounds; nBackColor++)
   326 			{
   327 			TRgb backColor = TestColor[nBackColor];
   328 			Clear(backColor);
   329 			for (TInt nColor = 0; nColor < KNumTestColors; nColor++)
   330 				{
   331 				TInt shadowMode = EPostFade;
   332 				TRect rect = iTestRect[nRect];			
   333 				TRgb color = TestColor[nColor];				
   334 				SetShadowAndFadingMode(shadowMode,100, 200);
   335 				iDrawDevice->WriteRgbMulti(rect.iTl.iX,rect.iTl.iY,rect.Width(),rect.Height(),color,iDMode);
   336 				
   337 				User::After(delay);
   338 				}
   339 			}
   340 		}
   341 	INFO_PRINTF1(_L("*END* CT_CFbsDrawDeviceData::DoCmdWriteRgbMulti"));
   342 	}
   343 
   344 /**
   345  * Tests WriteRgb method from CFbsDrawDevice
   346  */
   347 void CT_CFbsDrawDeviceData::DoCmdWriteRgb(const TTEFSectionName& aSection)
   348 	{
   349 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::DoCmdWriteRgb"));
   350 	TInt drawMode;
   351 	TInt nRect = 0;	
   352 	TInt delay;
   353 	TBool dataOk=ETrue;
   354 	
   355 	if (!GetEnumFromConfig(aSection, KDrawMode(), iEnumDrawModes,drawMode))
   356 		{
   357 		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDrawMode());
   358 		SetBlockResult(EFail);
   359 		dataOk = EFalse;
   360 		}
   361 	GETFROMCONFIGMANDATORY(Int, aSection, KDelay(),delay,_L("Error in getting parameter %S from INI file"),dataOk);
   362 	GETFROMCONFIGMANDATORY(Int, aSection, KNumRect(),nRect,_L("Error in getting parameter %S from INI file"),dataOk);
   363 	
   364 	if (dataOk)
   365 		{
   366 		iDMode=CGraphicsContext::TDrawMode(drawMode); 	
   367 		for (TInt nBackColor = 0; nBackColor < KNumTestBackgrounds; nBackColor++)
   368 			{			
   369 			TRgb backColor = TestBackground[nBackColor];
   370 			Clear(backColor);
   371 			for (TInt nColor = 0; nColor < KNumTestColors; nColor++)
   372 				{					
   373 				TInt shadowMode = ENoPostShadow;																					
   374 				TRect rect = iTestRect[nRect];
   375 				TRgb color = TestColor[nColor];
   376 				SetShadowAndFadingMode(shadowMode,100, 200);
   377 				iDrawDevice->WriteRgb(rect.iTl.iX,rect.iTl.iY,color,iDMode);
   378 				User::After(delay);
   379 				}			
   380 			}
   381 		}
   382 	INFO_PRINTF1(_L("*END* CT_CFbsDrawDeviceData::DoCmdWriteRgb"));
   383 	}
   384 
   385 /**
   386  *  Validates the received parameters and handles errors returned from TestScreenDrawL
   387  *  @param aSection			The section in the ini containing data for the command
   388  * 	@return 							KErrNone if no error found.
   389  */
   390 void CT_CFbsDrawDeviceData::DoCmdNewScreenDeviceL(const TTEFSectionName& aSection)
   391  	{
   392  	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::DoCmdNewScreenDeviceL"));
   393  	
   394  	if(iDrawDevice)
   395  		{
   396  		delete iDrawDevice;
   397 	 	iDrawDevice=NULL;
   398  		}
   399  	TInt drawMode;
   400  	TBool dataOk = ETrue;
   401  	if (!GetEnumFromConfig(aSection, KDisplayMode(), iEnumDisplayModes, drawMode))
   402  		{
   403  		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDisplayMode());
   404  	    SetBlockResult(EFail);
   405  	    dataOk = EFalse;
   406  	    }
   407  	if(dataOk)
   408  		{
   409  		TDisplayMode displayMode = TDisplayMode(drawMode);
   410  		iDispMode = displayMode;
   411  		TInt ScreenNo = 0;
   412  		
   413 	 	User::LeaveIfError(HAL::Get(KDefaultScreenNo, HALData::EDisplayXPixels,iSize.iWidth));
   414 	 	User::LeaveIfError(HAL::Get(KDefaultScreenNo, HALData::EDisplayYPixels,iSize.iHeight));
   415 	 	INFO_PRINTF3(_L("WIDTH from HAL %i \nHEIGHT from HAL %i"),iSize.iWidth,iSize.iHeight);
   416 	 	ASSERT(iSize.iWidth > 0 && iSize.iHeight > 0);
   417 	 	 	
   418 	 		 	
   419 	 	TRAPD(ret,iDrawDevice = CFbsDrawDevice::NewScreenDeviceL(ScreenNo,displayMode));
   420 	 		
   421 	 	// check error code
   422 	 	if(ret != KErrNone)
   423 	 		{
   424 	 		ERR_PRINTF2(_L("CFbsDrawDevice creation error: %d"), ret);
   425 	 		SetError(ret);
   426 	 		}
   427 	 	else
   428 	 		{
   429 	 		GETFROMCONFIGMANDATORY(Int, KRectangleSection(), KNumTestRect(),iNumTestRects,_L("Error in getting parameter %S from INI file"),dataOk);
   430 	 		
   431 	 		if (!InitRectangles())
   432 	 			{ 				
   433 	 			SetBlockResult(EFail);
   434 	 			ERR_PRINTF1(_L("Error: Test Rectangles NOT set!")); 						
   435 	 			}
   436 	 		else
   437 	 			{ 	 			
   438 	 			INFO_PRINTF1(_L("Test Rectangles are now set!"));	
   439 	 			}
   440 	 		}
   441 	 	INFO_PRINTF1(_L("** DoCmdNewScreenDeviceL succeded!"));	
   442  		}
   443  	INFO_PRINTF1(_L("*END* CT_CFbsDrawDeviceData::DoCmdNewScreenDeviceL"));
   444  	}
   445 
   446 /**
   447  * Inits Screen
   448  */
   449 void CT_CFbsDrawDeviceData::DoCmdInitScreen()
   450 	{
   451 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::DoCmdInitScreen"));
   452 	TInt err = iDrawDevice->InitScreen();
   453 	if(err != KErrNone)
   454 		{		
   455 		ERR_PRINTF2(_L("InitScreen error: %d"), err);
   456 		SetError(err);
   457 		}
   458 	INFO_PRINTF1(_L("*END* CT_CFbsDrawDeviceData::DoCmdInitScreen"));
   459 	}
   460 
   461 /**
   462  * Sets Display Mode
   463  * */
   464 void CT_CFbsDrawDeviceData::DoCmdSetDisplayMode()
   465 	{
   466 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::DoCmdSetDisplayMode"));
   467 	iDrawDevice->SetDisplayMode(iDrawDevice);
   468 	INFO_PRINTF1(_L("*END* CT_CFbsDrawDeviceData::DoCmdSetDisplayMode"));
   469 	}
   470 
   471 /**
   472  * Sets or unsets auto-update for the screen.
   473  */
   474 void CT_CFbsDrawDeviceData::DoCmdSetAutoUpdate(const TTEFSectionName& aSection)
   475 	{
   476 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::DoCmdSetAutoUpdate"));
   477 	TBool autoUpdate=ETrue;
   478 	GETFROMCONFIGOPTIONAL(Bool, aSection, KAutoUpdate(),autoUpdate,_L("Error in getting parameter %S from INI file"));
   479 	iDrawDevice->SetAutoUpdate(autoUpdate);
   480 	INFO_PRINTF1(_L("*END* CT_CFbsDrawDeviceData::DoCmdSetAutoUpdate"));
   481 	}
   482 
   483 /**
   484  * checks for Available Orientations
   485  */
   486 void CT_CFbsDrawDeviceData::DoCmdOrientationsAvailable()
   487 	{
   488 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::DoCmdOrientationsAvailable"));
   489 	TBool orientation[4];
   490 	iDrawDevice->OrientationsAvailable(orientation);
   491 	INFO_PRINTF2(_L("Orientation Normal : %i"),orientation[CFbsDrawDevice::EOrientationNormal]);
   492 	INFO_PRINTF2(_L("Orientation Rotated 90 : %i"),orientation[CFbsDrawDevice::EOrientationRotated90]);
   493 	INFO_PRINTF2(_L("Orientation Rotated 180 : %i"),orientation[CFbsDrawDevice::EOrientationRotated180]);	 
   494 	INFO_PRINTF2(_L("Orientation Rotated 270 : %i"),orientation[CFbsDrawDevice::EOrientationRotated270]);
   495 	INFO_PRINTF1(_L("*END* CT_CFbsDrawDeviceData::DoCmdOrientationsAvailable"));
   496 	}
   497 
   498 /**
   499  * Sets orientation
   500  */
   501 void CT_CFbsDrawDeviceData::DoCmdSetOrientation(const TTEFSectionName& aSection)
   502 	{
   503 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::DoCmdSetOrientation"));
   504 	TBool dataOk = ETrue;
   505 	
   506 	
   507 	if ( !GetEnumFromConfig(aSection, KOrientationMode(), iEnumOrientationModes, iOrientation) )
   508 		{
   509 		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KOrientationMode());
   510 		SetBlockResult(EFail);
   511 		dataOk = EFalse;
   512 		}
   513 	
   514 	if(dataOk)
   515 		{
   516 		
   517 		TBool orientationSupported = iDrawDevice->SetOrientation(CFbsDrawDevice::TOrientation(iOrientation));
   518 		
   519 		if (orientationSupported)
   520 			{
   521 			INFO_PRINTF2(_L("Orientation was set to: %d"), iOrientation);
   522 			if (iOrientation & 1)
   523 				{
   524 				iSize.SetSize(iSize.iHeight, iSize.iWidth);
   525 				}
   526 			}
   527 		else
   528 			{
   529 			ERR_PRINTF1(_L("Orientation not Supported"));
   530 			}
   531 		}
   532 	INFO_PRINTF1(_L("*END* CT_CFbsDrawDeviceData::DoCmdSetOrientation"));		
   533 	}
   534 
   535 /**
   536  * Tests WriteLine method from CFbsDrawDevice
   537  */
   538 void CT_CFbsDrawDeviceData::DoCmdWriteLineL(const TTEFSectionName& aSection)
   539 	{
   540 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::DoCmdWriteLineL"));
   541 	TInt byteSize = (ByteSize() / iSize.iHeight);
   542 	TInt delay;
   543 	TBool dataOk = ETrue;
   544 	
   545 	INFO_PRINTF2(_L("After setting bytesize %d"),byteSize);
   546 	TUint8* backBuffer  = new(ELeave) TUint8[byteSize];
   547 	CleanupStack::PushL(backBuffer);
   548 	TUint8* writeBuffer = new(ELeave) TUint8[byteSize];
   549 	CleanupStack::PushL(writeBuffer);
   550 	TUint8* copyBuffer  = new(ELeave) TUint8[byteSize];
   551 	CleanupStack::PushL(copyBuffer);
   552 	TUint8* readBuffer  = new(ELeave) TUint8[byteSize];
   553 	CleanupStack::PushL(readBuffer);
   554 	
   555 	INFO_PRINTF1(_L("after setting buffers"));
   556 	
   557 	TInt drawMode;	
   558 	if (!GetEnumFromConfig(aSection, KDrawMode(), iEnumDrawModes,drawMode))
   559 		{
   560 		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDrawMode());
   561 		SetBlockResult(EFail);
   562 		dataOk = EFalse;
   563 	    }
   564 	GETFROMCONFIGMANDATORY(Int, aSection, KDelay(),delay,_L("Error in getting parameter %S from INI file"),dataOk);
   565 	
   566 	INFO_PRINTF1(_L("Test Rectangles are now set!"));
   567 	TInt nRect = 0;
   568 	GETFROMCONFIGMANDATORY(Int, aSection, KNumRect(),nRect,_L("Error in getting parameter %S from INI file"),dataOk);
   569 	
   570 	TRect rect = iTestRect[nRect];
   571 	TInt nBackColor = 0;
   572 	GETFROMCONFIGMANDATORY(Int, aSection, KBackColor(),nBackColor,_L("Error in getting parameter %S from INI file"),dataOk);
   573 	
   574 	if(dataOk)
   575 		{
   576 		iDMode=CGraphicsContext::TDrawMode(drawMode);
   577 		TRgb b = TestBackground[nBackColor];
   578 		Clear(b);
   579 		for (TInt yy = rect.iTl.iY; yy < rect.iBr.iY; yy++)
   580 			{
   581 			FillBuffer(writeBuffer,byteSize,iDispMode);
   582 				
   583 			Mem::Copy(copyBuffer,writeBuffer,byteSize);
   584 			iDrawDevice->WriteLine(rect.iTl.iX,yy,rect.Width(),(TUint32*)writeBuffer,iDMode);
   585 			Mem::FillZ(readBuffer,byteSize);
   586 			User::After(delay);
   587 			}
   588 		}		
   589 		INFO_PRINTF1(_L("Deleting buffers"));	
   590         CleanupStack::PopAndDestroy(4);	
   591 		INFO_PRINTF1(_L("Buffers deleted"));		
   592 		INFO_PRINTF1(_L("*END* CT_CFbsDrawDeviceData::DoCmdWriteLineL"));
   593 	}
   594 
   595 /**
   596  * Tests WriteBinaryLine from CFbsDrawDevice
   597  */
   598 void CT_CFbsDrawDeviceData::DoCmdWriteBinaryLineL(const TTEFSectionName& aSection)
   599 	{
   600 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::DoCmdWriteBinaryLineL"));
   601 	TInt drawMode;
   602 	TInt nRect = 0;
   603 	TInt delay;
   604 	TBool dataOk = ETrue;
   605 	
   606 	if (!GetEnumFromConfig(aSection, KDrawMode(),iEnumDrawModes, drawMode))
   607 		{
   608 		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDrawMode());
   609 		SetBlockResult(EFail);
   610 		dataOk = EFalse;
   611 		}
   612 	GETFROMCONFIGMANDATORY(Int, aSection, KDelay(),delay,_L("Error in getting parameter %S from INI file"),dataOk);
   613 	
   614 	if (!GetIntFromConfig(aSection, KNumRect(), nRect))
   615 		{
   616 		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KNumRect());
   617 		SetBlockResult(EFail);
   618 		dataOk = EFalse;
   619 		}
   620 	TInt nBackColor = 0;
   621 	if (!GetIntFromConfig(aSection, KBackColor(), nBackColor))
   622 		{
   623 		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KBackColor());
   624 		SetBlockResult(EFail);
   625 		dataOk = EFalse;
   626 		}
   627 	TInt shadowMode = ENoPostShadow;	
   628 	if (!GetEnumFromConfig(aSection, KShadowMode(), iEnumShadowModes, shadowMode))
   629 		{
   630 		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KShadowMode());
   631 		SetBlockResult(EFail);
   632 		dataOk = EFalse;
   633 		}
   634 	
   635 	if(dataOk)
   636 		{
   637 		iDMode=CGraphicsContext::TDrawMode(drawMode);
   638 		
   639 		TInt byteSize = ByteSize() / iSize.iHeight;
   640 		TInt wordSize = (byteSize + 3) / 4;
   641 		TUint32* writeBuffer = new(ELeave) TUint32[wordSize];
   642 		CleanupStack::PushL(writeBuffer);
   643 		INFO_PRINTF1(_L("Test Rectangles are now set!"));
   644 		
   645 		
   646 		TRect rect = iTestRect[nRect];
   647 			
   648 		
   649 			
   650 		for (TInt nColor = 0; nColor < KNumTestColors; nColor++)
   651 			{
   652 			if (rect.Width() > KRectWidth)
   653 				{
   654 				rect.iBr.iX = rect.iTl.iX + KRectWidth;
   655 				}
   656 			if (rect.Width() < 1)
   657 				{
   658 				rect.iBr.iX = rect.iTl.iX + 1;
   659 				}
   660 				
   661 			TRgb backgroundColor = TestBackground[nBackColor];
   662 			Clear(backgroundColor);
   663 			TRgb testColor = TestColor[nColor];
   664 				
   665 			iDrawDevice->SetShadowMode(CFbsDrawDevice::TShadowMode(shadowMode));
   666 			FillBuffer((TUint8*)writeBuffer,byteSize,iDispMode);
   667 			iDrawDevice->WriteBinaryLine(rect.iTl.iX,rect.iTl.iY,writeBuffer,rect.Width(),testColor,iDMode);
   668 			User::After(delay);
   669 			}		
   670 		CleanupStack::PopAndDestroy();
   671 		writeBuffer = NULL;
   672 		}
   673 	INFO_PRINTF1(_L("*END* CT_CFbsDrawDeviceData::DoCmdWriteBinaryLineL"));
   674 	}
   675 
   676 /**
   677  * Tests ReadLine from CFbsDrawDevice
   678  * @param aSection			The section in the ini containing data for the command
   679  * @return 					KErrNone if no error found.
   680  */
   681 void CT_CFbsDrawDeviceData::DoCmdReadLineL(const TTEFSectionName& aSection)
   682 	{
   683 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::DoCmdReadLineL"));
   684 	TInt byteSize = ByteSize() / iSize.iHeight;
   685 	TUint8* writeBuffer = new(ELeave) TUint8[byteSize];
   686 	CleanupStack::PushL(writeBuffer);
   687 	TUint8* readBuffer = new(ELeave) TUint8[iSize.iWidth * sizeof(TRgb)];
   688 	CleanupStack::PushL(readBuffer);
   689 	
   690 	FillBuffer((TUint8*)writeBuffer,byteSize,iDispMode);
   691 	FillBuffer((TUint8*)readBuffer,byteSize,iDispMode);
   692 	
   693 	TInt nBackColor = 0;
   694 	if (!GetIntFromConfig(aSection, KBackColor(), nBackColor))
   695 		{
   696 		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KBackColor());
   697 		SetBlockResult(EFail);
   698 	    }
   699 	
   700 	TRgb b = TestColor[nBackColor];
   701 	Clear(b);
   702 
   703 	for (TInt nDispMode = 0; nDispMode < KNumDispModes; nDispMode++)
   704 		{
   705 		TDisplayMode dispMode = TestDisplayMode[nDispMode];
   706 		
   707 		for (TInt cnt=0;cnt<2;cnt++)
   708 			{
   709 			if (cnt==0)  //first time 
   710 				{
   711 				iDrawDevice->SetUserDisplayMode(dispMode);
   712 				}
   713 			else
   714 				{
   715 				iDrawDevice->SetUserDisplayMode(iDispMode);
   716 				}
   717 				
   718 			for (TInt nRect = 0; nRect < iNumTestRects; nRect++)
   719 				{
   720 				TRect rect = iTestRect[nRect];
   721 				for (TInt yy = rect.iTl.iY; yy < rect.iBr.iY; yy++)
   722 					{
   723 					FillBuffer(writeBuffer,byteSize,iDispMode);
   724 					Mem::FillZ(readBuffer,byteSize);
   725 					iDrawDevice->ReadLine(rect.iTl.iX,yy,rect.Width(),(TUint32*)readBuffer,dispMode);
   726 					Mem::FillZ(readBuffer,byteSize);
   727 					}
   728 				}
   729 			}
   730 		}	
   731     CleanupStack::PopAndDestroy(2);
   732 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::DoCmdReadLineL"));
   733 	}
   734 
   735 /**
   736  * Tests RGBAlphaLine from CFbsDrawDevice
   737  * @param aSection			The section in the ini containing data for the command
   738  * @return 					KErrNone if no error found.
   739  */
   740 void CT_CFbsDrawDeviceData::DoCmdWriteRGBAlphaLineL(const TTEFSectionName& aSection)
   741 	{
   742 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::DoCmdWriteRGBAlphaLineL"));
   743 	TInt drawMode;
   744 	
   745  	if (!GetEnumFromConfig(aSection, KDrawMode(), iEnumDrawModes,drawMode))
   746  		{
   747  		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDrawMode());
   748  		SetBlockResult(EFail);
   749  	    }
   750  	
   751  	iDMode=CGraphicsContext::TDrawMode(drawMode);
   752  	TInt byteSize = ByteSize() / iSize.iHeight;
   753 	INFO_PRINTF1(_L("In TestWriteRGBAlphaLine"));
   754 	
   755 	TUint8* writeBuffer = new(ELeave) TUint8[iSize.iWidth * 4];
   756 	CleanupStack::PushL(writeBuffer);
   757 	TUint8* writeBuffer2 = new(ELeave) TUint8[iSize.iWidth * 4];
   758 	CleanupStack::PushL(writeBuffer2);
   759 	TUint8* maskBuffer = new(ELeave) TUint8[iSize.iWidth * 4];
   760 	CleanupStack::PushL(maskBuffer);
   761 	
   762 	FillBuffer(writeBuffer,byteSize,iDispMode);
   763 	FillBuffer(writeBuffer2,byteSize,iDispMode);
   764 	FillBuffer(maskBuffer,byteSize,iDispMode);
   765 	
   766 	TInt nRect;
   767 	for (TInt maskFillCount=0; maskFillCount<KMaskFill;maskFillCount++)
   768 		{
   769 		for (nRect = 0; nRect < iNumTestRects; nRect++)
   770 			{
   771 			for (TInt nBackColor = 0; nBackColor < KNumTestBackgrounds; nBackColor++)
   772 				{
   773 				TRgb testColor = TestColor[nBackColor];
   774 				Clear(testColor);
   775 				for (TInt nColor = 0; nColor < KNumTestColors; nColor++)
   776 					{
   777 					//ensure the colour has the 0xff mask value
   778 					TRgb checkColor;
   779 					TRgb c = TestColor[nColor];
   780 					TUint32 internal = c.Internal();
   781 					TInt yy;
   782 					TRect rect = iTestRect[nRect];
   783 					TInt shadowMode =ENoPostShadow;
   784 					//use a combined alpha for the check colour
   785 					TUint32 combinedAlpha = MaskFill[maskFillCount]*((internal&0xff000000)>>24);
   786 					combinedAlpha = ((combinedAlpha <<16) & 0xff000000);
   787 					checkColor.SetInternal((internal&0x00ffffff)|combinedAlpha);
   788 					SetShadowAndFadingMode(shadowMode,100, 200);
   789 					for (yy = rect.iTl.iY; yy < rect.iBr.iY; yy++)
   790 						{
   791 						iDrawDevice->WriteRgbAlphaLine(rect.iTl.iX,yy,rect.Width(),
   792 								writeBuffer,
   793 								writeBuffer2,
   794 								maskBuffer,
   795 								iDMode);
   796 						}
   797 					//require to Shadow After the checkColor, no shadow with a zero mask
   798 					TBool shadowModeChanged = EFalse;
   799 					if (MaskFill[maskFillCount])
   800 						{
   801 						iPostBlendShadow = (TPostShadowMode) shadowMode;
   802 						shadowMode = 0;
   803 						shadowModeChanged = ETrue;
   804 						}
   805 					if(shadowModeChanged)
   806 						{
   807 						shadowMode = iPostBlendShadow;
   808 						}
   809 					iPostBlendShadow = ENoPostShadow;
   810 					}
   811 				}
   812 			}
   813 		}
   814 	INFO_PRINTF1(_L("** delete buffers"));
   815     CleanupStack::PopAndDestroy(3);
   816 	INFO_PRINTF1(_L("*END* CT_CFbsDrawDeviceData::DoCmdWriteRGBAlphaLineL"));
   817 	}
   818 
   819 /**
   820  * Tests ShadowArea from CFbsDrawDevice
   821  * @return 	KErrNone if no error found.
   822  */
   823 void CT_CFbsDrawDeviceData::DoCmdShadowArea(const TTEFSectionName& aSection)
   824 	{
   825 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::DoCmdShadowArea"));
   826 	TInt delay=0;
   827 	TBool dataOk = ETrue;
   828 	
   829 	GETFROMCONFIGMANDATORY(Int, aSection, KDelay(),delay,_L("Error in getting parameter %S from INI file"),dataOk);
   830 	
   831 	if(dataOk)
   832 		{
   833 		INFO_PRINTF1(_L("In TestShadow()"));
   834 		TInt nBackColor = 1;	 	
   835 		TRgb testColor = TestColor[nBackColor];
   836 		Clear(testColor);
   837 
   838 		for (TInt shadowMode = 0; shadowMode < KNumShadowModes; shadowMode++)
   839 			{
   840 			for (TInt nRect = 0; nRect < iNumTestRects; nRect++)
   841 				{
   842 				for (TInt nColor = 0; nColor < KNumTestColors; nColor++)
   843 					{
   844 					TRect rect = iTestRect[nRect];
   845 					iDrawDevice->SetShadowMode(CFbsDrawDevice::TShadowMode(shadowMode));
   846 					iDrawDevice->ShadowArea(rect);
   847 					
   848 					User::After(delay);
   849 					}
   850 				}
   851 			}
   852 		}
   853 	INFO_PRINTF1(_L("*END* CT_CFbsDrawDeviceData::DoCmdShadowArea"));
   854 			
   855 	}
   856 
   857 /**
   858  * Tests WriteBinaryLineVertical from CFbsDrawDevice
   859  * @return 			KErrNone if no error found.
   860  */
   861 void CT_CFbsDrawDeviceData::DoCmdWriteBinaryLineVerticalL(const TTEFSectionName& aSection)
   862 	{
   863 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::DoCmdWriteBinaryLineVerticalL"));
   864 	TInt drawMode;
   865  	TInt delay;
   866  	TBool dataOk = ETrue;
   867 	if (!GetEnumFromConfig(aSection, KDrawMode(), iEnumDrawModes,drawMode))
   868 		{
   869 		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDrawMode());
   870 		SetBlockResult(EFail);
   871 		dataOk = EFalse;
   872 		}
   873 	GETFROMCONFIGMANDATORY(Int, aSection, KDelay(),delay,_L("Error in getting parameter %S from INI file"),dataOk);
   874 	TInt nRect = 0;
   875 	if (!GetIntFromConfig(aSection, KNumRect(), nRect))
   876 		{
   877 		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KNumRect());
   878 		SetBlockResult(EFail);
   879 		dataOk = EFalse;
   880 		}
   881 
   882 	if(dataOk)
   883 		{
   884 		iDMode=CGraphicsContext::TDrawMode(drawMode);
   885 		
   886 		TInt byteSize = ByteSize() / iSize.iHeight;
   887 		TInt wordSize = (byteSize + 3) / 4;
   888 		TUint32* writeBuffer = new(ELeave) TUint32[wordSize];
   889 		TInt nBackColor = 1;
   890 		TInt nColor = 4;					
   891 		
   892 		TRect rect = iTestRect[nRect];
   893 		if (rect.Width() > KRectWidth)
   894 			{
   895 			rect.iBr.iX = rect.iTl.iX + KRectWidth;
   896 			}
   897 		if (rect.Width() < 1)
   898 			{
   899 			rect.iBr.iX = rect.iTl.iX + 1;
   900 			}
   901 		
   902 		TRgb b = TestBackground[nBackColor];
   903 		TRgb c = TestColor[nColor];
   904 		Clear(b);
   905 
   906 
   907 		//NOTE Call Command within script: SetShadowmode
   908 		FillBuffer((TUint8*)writeBuffer,byteSize,iDispMode);
   909 		iDrawDevice->WriteBinaryLineVertical(rect.iTl.iX,rect.iBr.iY - 1,writeBuffer,rect.Height(),c,iDMode,ETrue);
   910 
   911 		User::After(delay);
   912 		delete [] writeBuffer;
   913 		writeBuffer = NULL;
   914 		}
   915 	INFO_PRINTF1(_L("*END* CT_CFbsDrawDeviceData::DoCmdWriteBinaryLineVerticalL"));
   916 	}
   917 
   918 /**
   919  * Sets the current shadowing mode
   920  * @param aSection			The section in the ini containing data for the command
   921  */
   922 void CT_CFbsDrawDeviceData::DoCmdSetShadowMode(const TTEFSectionName& aSection)
   923 	{
   924 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::DoCmdSetShadowMode"));
   925 	TInt shadowMode = ENoPostShadow;
   926 	if(!GetEnumFromConfig(aSection, KShadowMode(), iEnumShadowModes, shadowMode))
   927 		{
   928 		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KShadowMode());
   929 		SetBlockResult(EFail);
   930 		}
   931 	else
   932 		{
   933 		iDrawDevice->SetShadowMode(CFbsDrawDevice::TShadowMode(shadowMode));
   934 		}
   935 	INFO_PRINTF1(_L("*END* CT_CFbsDrawDeviceData::DoCmdSetShadowMode"));
   936 	}
   937 
   938 /**
   939  * Tests WriteBinary method from CFbsDrawDevice
   940  * @param aSection			The section in the ini containing data for the command
   941  * @return 							KErrNone if no error found.
   942  */
   943 void CT_CFbsDrawDeviceData::DoCmdWriteBinaryL(const TTEFSectionName& aSection)
   944 	{
   945 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::DoCmdWriteBinaryL"));
   946 	TInt drawMode;
   947 	TInt delay;
   948 	TBool dataOk = ETrue;
   949 	if (!GetEnumFromConfig(aSection, KDrawMode(), iEnumDrawModes,drawMode))
   950 		{
   951 		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDrawMode());
   952 		SetBlockResult(EFail);
   953 		dataOk = EFalse;
   954 		}
   955 	GETFROMCONFIGMANDATORY(Int, aSection, KDelay(),delay,_L("Error in getting parameter %S from INI file"),dataOk);
   956 	TInt nRect = 0;
   957 	if (!GetIntFromConfig(aSection, KNumRect(), nRect))
   958 		{
   959 		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KNumRect());
   960 		SetBlockResult(EFail);
   961 		dataOk = EFalse;
   962 		}
   963 	if(dataOk)
   964 		{
   965 		iDMode=CGraphicsContext::TDrawMode(drawMode);
   966 		TInt byteSize = ByteSize() / iSize.iHeight;
   967 		TInt wordSize = (byteSize + 3) / 4;
   968 		TUint32* writeBuffer = new (ELeave)TUint32[wordSize];
   969 		
   970 		TRect rect = iTestRect[nRect];
   971 		TInt nBackColor = 0;
   972 		TInt nColor = 4;
   973 
   974 		if (rect.Width() > KRectWidth)
   975 			{
   976 			rect.iBr.iX = rect.iTl.iX + KRectWidth;
   977 			}
   978 		if (rect.Width() < 1)
   979 			{
   980 			rect.iBr.iX = rect.iTl.iX + 1;
   981 			}
   982 		
   983 		TRgb b = TestBackground[nBackColor];
   984 		Clear(b);
   985 		TRgb c = TestColor[nColor];
   986 		//NOTE Call Command within script: SetShadowmode
   987 		FillBuffer((TUint8*)writeBuffer,byteSize,iDispMode);
   988 		iDrawDevice->WriteBinary(rect.iTl.iX,rect.iTl.iY,writeBuffer,rect.Width(),rect.Height(),c,iDMode);
   989 		
   990 		User::After(delay);
   991 		delete [] writeBuffer;
   992 		writeBuffer = NULL;
   993 		}
   994 	INFO_PRINTF1(_L("*END* CT_CFbsDrawDeviceData::DoCmdWriteBinaryL"));
   995 	}
   996 
   997 /**
   998  * Clears screen with specified color
   999  */
  1000 void CT_CFbsDrawDeviceData::Clear(TRgb aColor)
  1001 	{
  1002 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::Clear"));
  1003 	iDrawDevice->SetShadowMode(CFbsDrawDevice::ENoShadow);
  1004 	iDrawDevice->WriteRgbMulti(0,0,iSize.iWidth,iSize.iHeight,aColor,CGraphicsContext::EDrawModeWriteAlpha);
  1005 	INFO_PRINTF1(_L("*END* CT_CFbsDrawDeviceData::Clear"));
  1006 	}
  1007 /**
  1008  * Sets Shadow and fading modes
  1009  * @param one of the supported shadow modes ENoShadow,EShadow,EFade,EShadowFade
  1010  * @param a black point
  1011  * @param a white point
  1012  */
  1013 void CT_CFbsDrawDeviceData::SetShadowAndFadingMode(TInt shadowMode,TInt blackPoint, TInt whitePoint)
  1014 	{
  1015 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::SetShadowAndFadingMode"));
  1016 	iDrawDevice->SetFadingParameters(blackPoint,whitePoint);  
  1017 	iDrawDevice->SetShadowMode(CFbsDrawDevice::TShadowMode(shadowMode));
  1018 	INFO_PRINTF1(_L("*END* CT_CFbsDrawDeviceData::SetShadowAndFadingMode"));
  1019 	}
  1020 
  1021 
  1022 /**
  1023  * Fills a buffer to be displayed on screen
  1024  * 
  1025  * @param aBuffer
  1026  * @param aByteSize
  1027  * @param aDispMode
  1028  */
  1029 void CT_CFbsDrawDeviceData::FillBuffer(TUint8* aBuffer,TInt aByteSize,TDisplayMode aDispMode)
  1030 	{
  1031 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::FillBuffer"));
  1032 	TUint8* bufferLimit = aBuffer + aByteSize;
  1033 
  1034 	TInt64 seed = TInt64(TInt(aBuffer) * aByteSize * aDispMode * User::TickCount());
  1035 
  1036 	if (aDispMode != EColor4K)
  1037 		{
  1038 		while (aBuffer < bufferLimit)
  1039 			{
  1040 			*aBuffer++ = (TUint8)Math::Rand(seed);
  1041 			}
  1042 		}
  1043 	else
  1044 		{
  1045 		while (aBuffer < bufferLimit)
  1046 			{
  1047 			if (TInt(aBuffer) & 3 == 3)
  1048 				{
  1049 				*aBuffer++ = 0;
  1050 				}
  1051 			else
  1052 				{
  1053 				*aBuffer++ = (TUint8)Math::Rand(seed);
  1054 				}
  1055 			}
  1056 		}
  1057 	INFO_PRINTF1(_L("*END* CT_CFbsDrawDeviceData::FillBuffer"));
  1058 	}
  1059 
  1060 /**
  1061  * Sets the Byte Size based on screen Width and Height
  1062  */
  1063 TInt CT_CFbsDrawDeviceData::ByteSize()
  1064 	{
  1065 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::ByteSize"));	
  1066 	TInt wordSize = iSize.iWidth;
  1067 	switch (iDispMode)
  1068 		{
  1069 	case EGray2:
  1070 		wordSize = (wordSize + 31) / 32;
  1071 		break;
  1072 	case EGray4:
  1073 		wordSize = (wordSize + 15) / 16;
  1074 		break;
  1075 	case EGray16:
  1076 	case EColor16:
  1077 		wordSize = (wordSize + 7) / 8;
  1078 		break;
  1079 	case EGray256:
  1080 	case EColor256:
  1081 		wordSize = (wordSize + 3) / 4;
  1082 		break;
  1083 	case EColor4K:
  1084 	case EColor64K:
  1085 		wordSize = (wordSize + 1) / 2;
  1086 		break;
  1087 	case EColor16M:
  1088 		wordSize = (((wordSize * 3) + 11) / 12) * 3;
  1089 		break;
  1090 	case EColor16MU:
  1091 	case EColor16MA:
  1092 		//Should not be changed!
  1093 		break;
  1094 	default:
  1095 		break;
  1096 		};
  1097 	
  1098 	INFO_PRINTF1(_L("*END* CT_CFbsDrawDeviceData::ByteSize"));	
  1099 	return wordSize * iSize.iHeight * 4;
  1100 	}
  1101 
  1102 /**
  1103  *	This method reads a string with this form: (a,,b,c,d) and splits it in an TInt array. 
  1104  * 
  1105  */
  1106 void CT_CFbsDrawDeviceData::ReadRectL(HBufC& aString, RArray<TInt>& aResult)
  1107 	{
  1108 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::ReadRectL"));
  1109 	TChar chr;
  1110 	TLex lex(aString);
  1111 	TBuf<256> buf;
  1112 	
  1113 	lex.Inc();			
  1114 	while(!lex.Eos())
  1115         {
  1116         chr = lex.Get();
  1117         // Check if there was a list separator
  1118         if (chr == ',')
  1119             {
  1120             HBufC* param = buf.AllocLC();
  1121             buf.Zero();
  1122             TInt x = 0;
  1123             TLex lexX(*param);
  1124             lexX.Val(x);
  1125             aResult.Append(x);
  1126             CleanupStack::Pop(param); // pointer to buf is stored in RPointerArray
  1127             }
  1128         // If not separator character we can store the character into array
  1129         else
  1130             {
  1131             if (chr != ')')
  1132             	{
  1133             	buf.Append(chr);
  1134             	}
  1135             }
  1136         }
  1137         
  1138 	HBufC* param = buf.AllocLC();
  1139 	TInt x = 0;
  1140     TLex lexX(*param);
  1141     lexX.Val(x);
  1142     aResult.Append(x);	
  1143 	CleanupStack::PopAndDestroy(param);
  1144 	INFO_PRINTF1(_L("*END* CT_CFbsDrawDeviceData::ReadRectL"));
  1145 	}
  1146 
  1147 /**
  1148  *	This method reads a string with this form: (a,,b,c,d) and splits it in an TInt array. 
  1149  * 
  1150  */
  1151 TBool CT_CFbsDrawDeviceData::InitRectangles()
  1152 	{
  1153 	INFO_PRINTF1(_L("*START* CT_CFbsDrawDeviceData::InitRectangles"));
  1154 	TBool readResult = ETrue;
  1155 	RPointerArray<HBufC> dimensions;
  1156 	RArray<TInt> result;
  1157 	TInt err = KErrNone;
  1158 	
  1159 	if ( GetArrayRectFromConfig( KRectangleSection(), KRectangles(), dimensions))//its validated by the above call	
  1160 		{
  1161 		for (TInt i = 0; i < iNumTestRects; i++)
  1162 			{
  1163 			TRAP(err , ReadRectL(*dimensions[i], result));
  1164 			if (err != KErrNone)
  1165 				{
  1166 				readResult = EFalse;
  1167 				break;
  1168 				}
  1169 			else
  1170 				{							
  1171 				iTestRect.Append(TRect(result[0],result[1],result[2],result[3]));
  1172 				result.Reset();
  1173 				}
  1174 			}		
  1175 		} 
  1176 	else
  1177 		{		
  1178 		readResult = EFalse;
  1179 		}
  1180 	dimensions.ResetAndDestroy();
  1181 	result.Reset();
  1182 	result.Close();
  1183 
  1184 	INFO_PRINTF1(_L("*END* CT_CFbsDrawDeviceData::InitRectangles"));
  1185   	return readResult;
  1186 
  1187 	}