os/graphics/graphicsdeviceinterface/screendriver/tsrc/Tlld.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2003-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 //
    15 
    16 #ifndef __TLLD_H_
    17 #define __TLLD_H_
    18 
    19 #include <gdi.h>
    20 #include <bitdraw.h>
    21 #include "TGraphicsHarness.h"
    22 
    23 #define KRgbFadedBlack		TRgb(0x808080)
    24 const TInt KNumDispModes = 13;
    25 const TInt KNumDrawModes = 6;
    26 const TInt KNumTestRects = 10;
    27 const TInt KNumTestColors = 12;
    28 const TInt KNumTestBackgrounds = 6;
    29 const TInt KNumShadowModes = 4;
    30 const TInt KCheckBinaryPixelBufferSize = 64;
    31 const TInt KNumBlendingColors = 3;
    32 const TInt KNumColorsToBlend = 4;
    33 
    34 //this is to allow EColor16MAP to be tested with extra colours
    35 const TUint32 KMaxNon16Colours = 9;
    36 
    37 //this is to allow EColor16MAP to be tested with extra background colours
    38 const TUint32 KMaxNon16BackColours = 3;
    39 
    40 const TDisplayMode TestDisplayMode[KNumDispModes] =
    41 	{
    42 	EGray2,
    43 	EGray4,
    44 	EGray16,
    45 	EGray256,
    46 	EColor16,
    47 	EColor256,
    48 	EColor4K,
    49 	EColor64K,
    50 	EColor16M,
    51 	ERgb,
    52 	EColor16MU,
    53 	EColor16MAP,
    54 	EColor16MA,
    55 	};
    56 
    57 const TPtrC DisplayModeNames[KNumDispModes] =
    58 	{
    59 	_L("EGray2"),
    60 	_L("EGray4"),
    61 	_L("EGray16"),
    62 	_L("EGray256"),
    63 	_L("EColor16"),
    64 	_L("EColor256"),
    65 	_L("EColor4K"),
    66 	_L("EColor64K"),
    67 	_L("EColor16M"),
    68 	_L("ERgb"),
    69 	_L("EColor16MU"),
    70 	_L("EColor16MAP"),
    71 	_L("EColor16MA"),
    72 	};
    73 
    74 const TDisplayMode TestDisplayMode1[] =
    75 	{
    76 	EGray2,
    77 	EGray4,
    78 	EGray16,
    79 	EGray256,
    80 	EColor16,
    81 	EColor256,
    82 	EColor4K,
    83 	EColor64K,
    84 	EColor16M,
    85 	EColor16MU,
    86 	EColor16MAP,
    87 	EColor16MA,
    88 	};
    89 
    90 const TPtrC DisplayModeNames1[] =
    91 	{
    92 	_L("EGray2"),
    93 	_L("EGray4"),
    94 	_L("EGray16"),
    95 	_L("EGray256"),
    96 	_L("EColor16"),
    97 	_L("EColor256"),
    98 	_L("EColor4K"),
    99 	_L("EColor64K"),
   100 	_L("EColor16M"),
   101 	_L("EColor16MU"),
   102 	_L("EColor16MAP"),
   103 	_L("EColor16MA"),
   104 	};
   105 
   106 const CGraphicsContext::TDrawMode TestDrawMode[KNumDrawModes] =
   107 	{
   108 	CGraphicsContext::EDrawModePEN,
   109 	CGraphicsContext::EDrawModeAND,
   110 	CGraphicsContext::EDrawModeXOR,
   111 	CGraphicsContext::EDrawModeOR,
   112 	CGraphicsContext::EDrawModeNOTSCREEN,
   113 	CGraphicsContext::EDrawModeNOTPEN
   114 	};
   115 
   116 const TRect TestRect[KNumTestRects] =
   117 	{
   118 	TRect(0,0,31,31),
   119 	TRect(1,1,2,2),
   120 	TRect(1,1,2,31),
   121 	TRect(2,1,31,2),
   122 	TRect(1,1,2,31),
   123 	TRect(1,1,30,31),
   124 	TRect(1,1,33,33),
   125 	TRect(31,0,65,1),
   126 	TRect(0,0,30,34), //needs a height >32
   127 	TRect(1,1,7,7) // for DEF123772
   128 	};
   129 
   130 const TRgb TestColor[KNumTestColors] =
   131 	{
   132 	KRgbBlack,
   133 	KRgbDarkGray,
   134 	KRgbGray,
   135 	KRgbWhite,
   136 	KRgbRed,
   137 	KRgbCyan,
   138 	TRgb(230,180,70),
   139 	TRgb(150,240,30),
   140 	TRgb(20,250,160),
   141 	TRgb((TUint32)0xff2665A3),
   142 	TRgb((TUint32)0x002766A4),
   143 	TRgb((TUint32)0x57339A4E),
   144 	};
   145 
   146 const TRgb TestBackground[KNumTestBackgrounds] =
   147 	{
   148 	KRgbWhite,
   149 	KRgbBlack,
   150 	TRgb(20,250,160),
   151 	TRgb(0xff27D99f),
   152 	TRgb(0x00E73121),
   153 	TRgb(0x771FE3B7),
   154 	};
   155 
   156 const TUint8 ditherlutab[16][4]=
   157 	{{	0x0,	0x0,	0x0,	0x0,	},
   158 	{	0x5,	0x0,	0x0,	0x0,	},
   159 	{	0x5,	0x0,	0x0,	0x5,	},
   160 	{	0x5,	0x0,	0x0,	0x5,	},
   161 	{	0x5,	0x0,	0x5,	0x5,	},
   162 	{	0x5,	0x5,	0x5,	0x5,	},
   163 	{	0xa,	0x5,	0x5,	0x5,	},
   164 	{	0xa,	0x5,	0x5,	0xa,	},
   165 	{	0xa,	0x5,	0x5,	0xa,	},
   166 	{	0xa,	0x5,	0xa,	0xa,	},
   167 	{	0xa,	0xa,	0xa,	0xa,	},
   168 	{	0xf,	0xa,	0xa,	0xa,	},
   169 	{	0xf,	0xa,	0xa,	0xf,	},
   170 	{	0xf,	0xa,	0xa,	0xf,	},
   171 	{	0xf,	0xa,	0xf,	0xf,	},
   172 	{	0xf,	0xf,	0xf,	0xf		}};
   173 
   174 /**
   175 This array has three colours, It would be used to blend the four colours using WriteRgbOutlineAndShadow ().
   176 Four colours which needs blending are
   177 O - Outline colour, first entry of this table
   178 S - Shadow colour, second entry in this table
   179 F - Foreground colour i.e. third entry and,
   180 B - Background colur, It will be set inside the test function.
   181 */
   182 const TRgb TestOSFBColorsForBlending[KNumBlendingColors][KNumColorsToBlend] =
   183 	{
   184 	{ KRgbBlack, TRgb(220,150,164,138), KRgbMagenta, KRgbWhite},
   185 	{ KRgbDarkMagenta, KRgbBlue, KRgbDarkYellow, TRgb(20,250,160, 128)},
   186 	{ TRgb(230,180,70,10), KRgbGreen, TRgb(20,250,160,168), KRgbBlack}
   187 	};
   188 
   189 /**
   190 This lookup table is used for outline and shadow fonts. Four entries of this table represents
   191 % of Outline, Shadow, Fill and Background color to be used to get the final color to be
   192 displayed on screen.
   193 
   194 While doing the blending of four colors it would use the following formula,
   195 
   196 blendedXXXColor = (XXXOutlinePenColor * FourColorBlendLookup[index][KOutlineColorIndex] +
   197 			   		XXXShadowColor * FourColorBlendLookup[index][KShadowColorIndex] +
   198 			  		XXXFillColor * FourColorBlendLookup[index][KFillColorIndex] +
   199 			  		backgroundColor.XXX() * FourColorBlendLookup[index][KBackgroundColorIndex]) >> 8;
   200 where XXX can be Red, Green or Blue
   201 and index is the 8-bit value which will be provided by the rasterizer to decide which
   202 entry of lookup table should be used. Right shift by eight will divide the calculated value in % with
   203 256 to get the actual colour.
   204 
   205 This table is provided by Monotype and MUST NOT be changed.
   206 */
   207 const TInt FourColorBlendLookup[256][4] = {
   208 	{ 0, 0, 0, 255 },
   209 	{ 0, 0, 17, 238 },
   210 	{ 0, 0, 34, 221 },
   211 	{ 0, 0, 51, 204 },
   212 	{ 0, 0, 68, 187 },
   213 	{ 0, 0, 85, 170 },
   214 	{ 0, 0, 102, 153 },
   215 	{ 0, 0, 119, 136 },
   216 	{ 0, 0, 136, 119 },
   217 	{ 0, 0, 153, 102 },
   218 	{ 0, 0, 170, 85 },
   219 	{ 0, 0, 187, 68 },
   220 	{ 0, 0, 204, 51 },
   221 	{ 0, 0, 221, 34 },
   222 	{ 0, 0, 238, 17 },
   223 	{ 0, 0, 255, 0 },
   224 	{ 0, 17, 0, 238 },
   225 	{ 0, 34, 0, 221 },
   226 	{ 0, 51, 0, 204 },
   227 	{ 0, 68, 0, 187 },
   228 	{ 0, 85, 0, 170 },
   229 	{ 0, 102, 0, 153 },
   230 	{ 0, 119, 0, 136 },
   231 	{ 0, 136, 0, 119 },
   232 	{ 0, 153, 0, 102 },
   233 	{ 0, 170, 0, 85 },
   234 	{ 0, 187, 0, 68 },
   235 	{ 0, 204, 0, 51 },
   236 	{ 0, 221, 0, 34 },
   237 	{ 0, 238, 0, 17 },
   238 	{ 0, 255, 0, 0 },
   239 	{ 17, 0, 0, 238 },
   240 	{ 34, 0, 0, 221 },
   241 	{ 51, 0, 0, 204 },
   242 	{ 68, 0, 0, 187 },
   243 	{ 85, 0, 0, 170 },
   244 	{ 102, 0, 0, 153 },
   245 	{ 119, 0, 0, 136 },
   246 	{ 136, 0, 0, 119 },
   247 	{ 153, 0, 0, 102 },
   248 	{ 170, 0, 0, 85 },
   249 	{ 187, 0, 0, 68 },
   250 	{ 204, 0, 0, 51 },
   251 	{ 221, 0, 0, 34 },
   252 	{ 238, 0, 0, 17 },
   253 	{ 255, 0, 0, 0 },
   254 	{ 0, 17, 238, 0 },
   255 	{ 0, 34, 221, 0 },
   256 	{ 0, 51, 204, 0 },
   257 	{ 0, 68, 187, 0 },
   258 	{ 0, 85, 170, 0 },
   259 	{ 0, 102, 153, 0 },
   260 	{ 0, 119, 136, 0 },
   261 	{ 0, 136, 119, 0 },
   262 	{ 0, 153, 102, 0 },
   263 	{ 0, 170, 85 ,0 },
   264 	{ 0, 187, 68 ,0 },
   265 	{ 0, 204, 51, 0 },
   266 	{ 0, 221, 34, 0 },
   267 	{ 0, 238, 17, 0 },
   268 	{ 238, 17, 0, 0 },
   269 	{ 221, 34, 0, 0 },
   270 	{ 204, 51, 0, 0 },
   271 	{ 187, 68, 0, 0 },
   272 	{ 170, 85, 0, 0 },
   273 	{ 153, 102, 0, 0 },
   274 	{ 136, 119, 0, 0 },
   275 	{ 119, 136, 0, 0 },
   276 	{ 102, 153, 0, 0 },
   277 	{ 85, 170, 0, 0 },
   278 	{ 68, 187, 0, 0 },
   279 	{ 51, 204, 0, 0 },
   280 	{ 34, 221, 0, 0 },
   281 	{ 17, 238, 0, 0 },
   282 	{ 238, 0, 17, 0 },
   283 	{ 221, 0, 34, 0 },
   284 	{ 204, 0, 51, 0 },
   285 	{ 187, 0, 68, 0 },
   286 	{ 170, 0, 85, 0 },
   287 	{ 153, 0, 102, 0 },
   288 	{ 136, 0, 119, 0 },
   289 	{ 119, 0, 136, 0 },
   290 	{ 102, 0, 153, 0 },
   291 	{ 85, 0, 170, 0 } ,
   292 	{ 68, 0, 187, 0 },
   293 	{ 51, 0, 204, 0 },
   294 	{ 34, 0, 221, 0 },
   295 	{ 17, 0, 238, 0 },
   296 	{ 210, 23, 0, 22 },
   297 	{ 179, 60, 0, 16 },
   298 	{ 145, 94, 0, 16 },
   299 	{ 119, 119, 0, 17 },
   300 	{ 94, 145, 0, 16 },
   301 	{ 60, 179, 0, 16 },
   302 	{ 23, 210, 0, 22 },
   303 	{ 176, 40, 0, 39 },
   304 	{ 142, 74, 0, 39 },
   305 	{ 113, 96, 0, 46 },
   306 	{ 91, 125, 0, 39 },
   307 	{ 62, 147, 0, 46 },
   308 	{ 40, 176, 0, 39 },
   309 	{ 179, 17, 0, 59 },
   310 	{ 147, 45, 0, 63 },
   311 	{ 17, 179, 0, 59 },
   312 	{ 145, 17, 0, 93 },
   313 	{ 125, 40, 0, 90 },
   314 	{ 108, 74, 0, 73 },
   315 	{ 74, 108, 0, 73 },
   316 	{ 85, 85, 0, 85 },
   317 	{ 40, 142, 0, 73 },
   318 	{ 119, 17, 0, 119 },
   319 	{ 96, 45, 0, 114 },
   320 	{ 74, 74, 0, 107 },
   321 	{ 45, 113, 0, 97 },
   322 	{ 17, 145, 0, 93 },
   323 	{ 94, 17, 0, 144 },
   324 	{ 74, 40, 0, 141 },
   325 	{ 45, 62, 0, 148 },
   326 	{ 40, 91, 0, 124 },
   327 	{ 17, 119, 0, 119 },
   328 	{ 17, 94, 0, 144 },
   329 	{ 60, 17, 0, 178 },
   330 	{ 40, 40, 0, 175 },
   331 	{ 17, 60, 0, 178 },
   332 	{ 23, 23, 0, 209 },
   333 	{ 0, 210, 23, 22 },
   334 	{ 0, 179, 60, 16 },
   335 	{ 0, 145, 94, 16 },
   336 	{ 0, 119, 119, 17 },
   337 	{ 0, 94 ,145, 16 },
   338 	{ 0, 60 ,179, 16 },
   339 	{ 0, 23, 210, 22 },
   340 	{ 0, 176, 40, 39 },
   341 	{ 0, 142, 74, 39 },
   342 	{ 0, 113, 96, 46 },
   343 	{ 0, 91, 125, 39 },
   344 	{ 0, 62, 147, 46 },
   345 	{ 0, 40, 176, 39 },
   346 	{ 0, 179, 17, 59 },
   347 	{ 0, 147, 45, 63 },
   348 	{ 0, 17, 179, 59 },
   349 	{ 0, 145, 17, 93 },
   350 	{ 0, 125, 40, 90 },
   351 	{ 0, 108, 74, 73 },
   352 	{ 0, 74, 108, 73 },
   353 	{ 0, 85, 85, 85 },
   354 	{ 0, 40, 142, 73 },
   355 	{ 0, 119, 17, 119 },
   356 	{ 0, 96, 45, 114 },
   357 	{ 0, 74, 74, 107 },
   358 	{ 0, 45, 113, 97 },
   359 	{ 0, 17, 145, 93 },
   360 	{ 0, 94, 17, 144 },
   361 	{ 0, 74, 40, 141 },
   362 	{ 0, 45, 62, 148 },
   363 	{ 0, 40, 91, 124 },
   364 	{ 0, 17, 119, 119 },
   365 	{ 0, 17, 94, 144 },
   366 	{ 0, 60, 17, 178 },
   367 	{ 0, 40, 40, 175 },
   368 	{ 0, 17, 60, 178 },
   369 	{ 0, 23, 23, 209 },
   370 	{ 23, 0, 210, 22 },
   371 	{ 60, 0, 179, 16 },
   372 	{ 94, 0, 145, 16 },
   373 	{ 119, 0, 119, 17 },
   374 	{ 145, 0, 94, 16 },
   375 	{ 179, 0, 60, 16 },
   376 	{ 210, 0, 23, 22 },
   377 	{ 40, 0, 176, 39 },
   378 	{ 74, 0, 142, 39 },
   379 	{ 96, 0, 113, 46 },
   380 	{ 125, 0, 91, 39 },
   381 	{ 147, 0, 62, 46 },
   382 	{ 176, 0, 40, 39 },
   383 	{ 17, 0, 179, 59 },
   384 	{ 45, 0, 147, 63 },
   385 	{ 179, 0, 17, 59 },
   386 	{ 17, 0, 145, 93 },
   387 	{ 40, 0, 125, 90 },
   388 	{ 74, 0, 108, 73 },
   389 	{ 108, 0, 74, 73 },
   390 	{ 85, 0, 85, 85 },
   391 	{ 142, 0, 40, 73 },
   392 	{ 17, 0, 119, 119 },
   393 	{ 45, 0, 96, 114 },
   394 	{ 74, 0, 74, 107 },
   395 	{ 113, 0, 45, 97 },
   396 	{ 145, 0, 17, 93 },
   397 	{ 17, 0, 94, 144 },
   398 	{ 40, 0, 74, 141 },
   399 	{ 62, 0, 45, 148 },
   400 	{ 91, 0, 40, 124 },
   401 	{ 119, 0, 17, 119 },
   402 	{ 94, 0, 17, 144 },
   403 	{ 17, 0, 60, 178 },
   404 	{ 40, 0, 40, 175 },
   405 	{ 60, 0, 17, 178 },
   406 	{ 23, 0, 23, 209 },
   407 	{ 209, 23, 23, 0 },
   408 	{ 178, 17, 60, 0 },
   409 	{ 144, 17, 94, 0 },
   410 	{ 119, 17, 119, 0 },
   411 	{ 93, 17, 145, 0 },
   412 	{ 59, 17, 179, 0 },
   413 	{ 22, 23, 210, 0 },
   414 	{ 175, 40, 40, 0 },
   415 	{ 141, 40, 74, 0 },
   416 	{ 114, 45, 96, 0 },
   417 	{ 90, 40, 125, 0 },
   418 	{ 63, 45, 147, 0 },
   419 	{ 39, 40, 176, 0 },
   420 	{ 178, 60, 17, 0 },
   421 	{ 148, 62, 45, 0 },
   422 	{ 16, 60, 179, 0 },
   423 	{ 144, 94, 17, 0 },
   424 	{ 124, 91, 40, 0 },
   425 	{ 107, 74, 74, 0 },
   426 	{ 73, 74, 108, 0 },
   427 	{ 85, 85, 85, 0 },
   428 	{ 39, 74, 142, 0 },
   429 	{ 119, 119, 17, 0 },
   430 	{ 97, 113, 45, 0 },
   431 	{ 73, 108, 74, 0 },
   432 	{ 46, 96, 113, 0 },
   433 	{ 16, 94, 145, 0 },
   434 	{ 93, 145, 17, 0 },
   435 	{ 73, 142, 40, 0 },
   436 	{ 46, 147, 62, 0 },
   437 	{ 39, 125, 91, 0 },
   438 	{ 17, 119, 119, 0 },
   439 	{ 16, 145, 94, 0 },
   440 	{ 59, 179, 17, 0 },
   441 	{ 39, 176, 40, 0 },
   442 	{ 16, 179, 60, 0 },
   443 	{ 22, 210, 23, 0 },
   444 	{ 32, 32 ,32, 159 },
   445 	{ 32, 32 ,74, 117 },
   446 	{ 32, 32 ,116, 75 },
   447 	{ 32, 32 ,158, 33 },
   448 	{ 74, 32, 32, 117 },
   449 	{ 74, 32, 74, 75 },
   450 	{ 74, 32, 116, 33 },
   451 	{ 116, 32, 32, 75 },
   452 	{ 116, 32, 74, 33 },
   453 	{ 158, 32, 32, 33 },
   454 	{ 32, 74, 32, 117 },
   455 	{ 32, 74, 74, 75 },
   456 	{ 32, 74, 116, 33 },
   457 	{ 74, 74, 32, 75 },
   458 	{ 74, 74, 74, 33 },
   459 	{ 116, 74, 32, 33 },
   460 	{ 32, 116, 32, 75 },
   461 	{ 32, 116, 74, 33 },
   462 	{ 74, 116, 32, 33 },
   463 	{ 32, 158, 32, 33 },
   464 	};
   465 
   466 class TColorConvertor
   467 	{
   468 public:
   469 	virtual TInt Index(TRgb aColor) = 0;
   470 	virtual TRgb Color(TInt aIndex) = 0;
   471 	};
   472 
   473 class TNullColorConvertor : public TColorConvertor
   474 	{
   475 public:
   476 	virtual TInt Index(TRgb /*aColor*/) { return 0; }
   477 	virtual TRgb Color(TInt /*aIndex*/) { return KRgbBlack; }
   478 	};
   479 
   480 class TGray2ColorConvertor : public TColorConvertor
   481 	{
   482 public:
   483 	virtual TInt Index(TRgb aColor) { return aColor.Gray2(); }
   484 	virtual TRgb Color(TInt aIndex) { return TRgb::Gray2(aIndex); }
   485 	};
   486 
   487 class TGray4ColorConvertor : public TColorConvertor
   488 	{
   489 public:
   490 	virtual TInt Index(TRgb aColor) { return aColor.Gray4(); }
   491 	virtual TRgb Color(TInt aIndex) { return TRgb::Gray4(aIndex); }
   492 	};
   493 
   494 class TGray16ColorConvertor : public TColorConvertor
   495 	{
   496 public:
   497 	virtual TInt Index(TRgb aColor) { return aColor.Gray16(); }
   498 	virtual TRgb Color(TInt aIndex) { return TRgb::Gray16(aIndex); }
   499 	};
   500 
   501 class TGray256ColorConvertor : public TColorConvertor
   502 	{
   503 public:
   504 	virtual TInt Index(TRgb aColor) { return aColor.Gray256(); }
   505 	virtual TRgb Color(TInt aIndex) { return TRgb::Gray256(aIndex); }
   506 	};
   507 
   508 class TColor16ColorConvertor : public TColorConvertor
   509 	{
   510 public:
   511 	virtual TInt Index(TRgb aColor) { return aColor.Color16(); }
   512 	virtual TRgb Color(TInt aIndex) { return TRgb::Color16(aIndex); }
   513 	};
   514 
   515 class TColor256ColorConvertor : public TColorConvertor
   516 	{
   517 public:
   518 	virtual TInt Index(TRgb aColor) { return aColor.Color256(); }
   519 	virtual TRgb Color(TInt aIndex) { return TRgb::Color256(aIndex); }
   520 	};
   521 
   522 class TColor4KColorConvertor : public TColorConvertor
   523 	{
   524 public:
   525 	virtual TInt Index(TRgb aColor) { return aColor.Color4K(); }
   526 	virtual TRgb Color(TInt aIndex) { return TRgb::Color4K(aIndex); }
   527 	};
   528 
   529 class TColor64KColorConvertor : public TColorConvertor
   530 	{
   531 public:
   532 	virtual TInt Index(TRgb aColor) { return aColor.Color64K(); }
   533 	virtual TRgb Color(TInt aIndex) { return TRgb::Color64K(aIndex); }
   534 	};
   535 
   536 class TColor16MColorConvertor : public TColorConvertor
   537 	{
   538 public:
   539 	virtual TInt Index(TRgb aColor) { return aColor.Color16M(); }
   540 	virtual TRgb Color(TInt aIndex) { return TRgb::Color16M(aIndex); }
   541 	};
   542 
   543 class TColor16MUColorConvertor : public TColorConvertor
   544 	{
   545 public:
   546 	virtual TInt Index(TRgb aColor) { return aColor.Color16MU(); }
   547 	virtual TRgb Color(TInt aIndex) { return TRgb::Color16MU(aIndex); }
   548 	};
   549 
   550 class TColor16MAColorConvertor : public TColorConvertor
   551 	{
   552 public:
   553 	virtual TInt Index(TRgb aColor) { return aColor.Color16MA(); }
   554 	virtual TRgb Color(TInt aIndex) { return TRgb::Color16MA(aIndex); }
   555 	};
   556 
   557 class TColor16MAPColorConvertor : public TColorConvertor
   558 	{
   559 public:
   560 	virtual TInt Index(TRgb aColor) { return aColor.Color16MAP(); }
   561 	virtual TRgb Color(TInt aIndex) { return TRgb::Color16MAP(aIndex); }
   562 	};
   563 
   564 class CTLowLevel : public CTGraphicsBase
   565 	{
   566 enum TPostShadowMode
   567 	{
   568 	ENoPostShadow,
   569 	EPostShadow,
   570 	EPostFade,
   571 	EPostShadowFade,
   572 	};
   573 public:
   574 	CTLowLevel(CTestStep* aStep);
   575 	~CTLowLevel();
   576 protected:
   577 //from 	CTGraphicsStep
   578 	virtual void RunTestCaseL(TInt aCurTestCase);
   579 	void TestScreenDrawL(TDisplayMode aDisplayMode);
   580 private:
   581 	void Reset();
   582 	void Report();
   583 	void TestBitmapDraw(TDisplayMode aDisplayMode,const TSize& aSize);
   584 	void Test();
   585 	void TestParams();
   586 	void TestReadLine();
   587 	void TestWriteRgb();
   588 	void TestWriteLine();
   589 	void TestWriteBinary();
   590 	void TestWriteRGBAlpha();
   591 	void TestWriteAlphaLineEx();
   592 	void TestWriteAlphaLineNoShadowEx();
   593 	void TestWriteMaskLineNoShadowEx();
   594 	void ClosePanicDialogs();
   595 	void TestFastBlendBitmapMasked(const TInt aRetry = 0);
   596 	void TestShadow();
   597 	void TestWriteRgbOutlineAndShadow();
   598 	inline TInt ByteSize();
   599 	inline TBool Check(TBool aValue);
   600 	void CheckBuffer(TUint8* aWriteBuffer,TDisplayMode aWriteDispMode,TUint8* aReadBuffer,TDisplayMode aReadDispMode,TInt aPixelLength);
   601 	void CheckBinary(const TRect& aRect,TUint32* aBuffer,TRgb aForeColor,TRgb aBackColor,CGraphicsContext::TDrawMode aDrawMode,TInt aShadowMode,TBool aWrapDataWords,TBool aUp);
   602 	void CheckRgb(const TPoint& aPoint,TRgb aColor,TRgb aBackgroundColor,CGraphicsContext::TDrawMode aDrawMode,TInt aShadowMode);
   603 	void CheckRgb(const TRect& aRect,TRgb aColor,TRgb aBackgroundColor,CGraphicsContext::TDrawMode aDrawMode,TInt aShadowMode);
   604 	void CheckShadowRgb(const TRect& aRect,TRgb aColor,TInt aShadowMode);
   605 	void CheckScanline(TInt aX,TInt aY,TInt aLength,TRgb aFore1,TRgb aFore2,TRgb aBack1,TRgb aBack2,CGraphicsContext::TDrawMode aDrawMode);
   606 	void CheckLine(TUint8* aWriteBuffer,TUint8* aReadBuffer,TUint8* aBackBuffer,TInt aPixelLength,CGraphicsContext::TDrawMode aDrawMode,TDisplayMode aDispMode);
   607 	void CheckPixel(TUint8* aWriteBuffer,TDisplayMode aWriteDispMode,TUint8* aReadBuffer,TDisplayMode aReadDispMode,TInt aPixelLength,TDisplayMode aCompareDispMode);
   608 	void CheckBackground(const TRect& aRect,TRgb aBackgroundColor);
   609 	TBool CheckBlendedOutlineAndShadow(TRgb aOutlinePenColor, TRgb aShadowColor, TRgb aFillColor, TRgb aBackgroundColor, TInt aLookupIndex, TInt aLength, TUint8* aReadBuffer);
   610 	void Clear(TRgb aColor);
   611 	void CheckMatch(TUint32 aFirst, TUint32 aSecond);
   612 	TRgb ExtractRgbValue(TInt aX,TUint8* aBuffer,TDisplayMode aDispMode);
   613 	TUint32 ExtractBinaryValue(TInt aX,TUint32* aBuffer,TDisplayMode aDispMode);
   614 	void FillArray(TRgb aColor,TRgb aArray[4]);
   615 	void FillBuffer(TUint8* aBuffer, TInt aByteSize, TDisplayMode aDispMode, TBool aNoAlpha16MU = EFalse);
   616 	TInt LongWidth(TInt aWidth,TDisplayMode aDispMode);
   617 	void Normalize(TRgb& aColor);
   618 	void Normalize(TRgb& aColor, TDisplayMode aDispMode);
   619 	void Normalize(TRgb& aColor,TRgb aDitherColors[4]);
   620 	TRgb RgbValue(TRgb aFore,TRgb aBack,CGraphicsContext::TDrawMode aDrawMode);
   621 	TUint32 BinaryValue(TRgb aFore,TRgb aBack,CGraphicsContext::TDrawMode aDrawMode);
   622 	void Shadow(TRgb& aColor,TInt aShadowMode);
   623 	void Shadow(TUint8* aBuffer,TInt aByteLength,TInt aShadowMode);
   624 	TUint8 FadeGray(TInt aGray256);
   625 	TRgb FadeRgb(TRgb aColor, TBool aFastFade = EFalse);
   626 	TColorConvertor& ColorConvertor(TDisplayMode aDisplayMode);
   627 	void Blend(TUint8* aBuffer,TUint8* aBufferDest,TDisplayMode aDispMode);
   628 	void PostBlendShadow(TUint32 &aPmaColor);
   629 	void TestUserDisplayModeMapping();
   630 	void PrepareDestPixel(TDisplayMode aDevDisplayMode, TRgb& aRgb, TInt aDstAlpha);
   631 	void CheckMappedRgb(TDisplayMode aDevDisplayMode, TDisplayMode aUserDisplayMode, TRgb aRgb);
   632 	void CheckNormalizedRgb(TRgb aReadRgb, TRgb aCheckRgb, TDisplayMode aDevDisplayMode, TDisplayMode aUserDisplayMode, TBool aWriteRgbAlphaLine);
   633 	void WriteBinaryValue(TUint32 aX, TAny* const aPtr, TDisplayMode aMode, TUint32 aValue) const;
   634 	void MaskedBlendBuffer(TAny* aSrc, TDisplayMode aSrcMode, TAny* aDst,
   635 			TDisplayMode aDstMode, TUint32* aMsk, TInt aWidth, TBool aInvert);
   636 	TUint32 BytesForPixels(TUint32 aPixels, TDisplayMode aMode);
   637 	TBool CompareBlendMaskResults(TAny* aActual, TAny* aExpected, 
   638 			TUint32 aWidth, TDisplayMode aMode, TBool aBlended, TDisplayMode aSrcMode = ENone);
   639 protected:
   640 	CFbsDrawDevice* iDrawDevice;
   641 	TUint8* iBits;
   642 	TUint32* iBuf;
   643 	TDisplayMode iDispMode;
   644 	TDisplayMode iUserDispMode;
   645 	TInt iOrientation;
   646 	TSize iSize;
   647 	TInt iLongWidth;
   648 	TInt iTestNo;
   649 	TInt iIteration;
   650 	TInt iReportIteration;
   651 	TInt iTotalReportIterations;
   652 	TNullColorConvertor iNullConvertor;
   653 	TGray2ColorConvertor iGray2Convertor;
   654 	TGray4ColorConvertor iGray4Convertor;
   655 	TGray16ColorConvertor iGray16Convertor;
   656 	TGray256ColorConvertor iGray256Convertor;
   657 	TColor16ColorConvertor iColor16Convertor;
   658 	TColor256ColorConvertor iColor256Convertor;
   659 	TColor4KColorConvertor iColor4KConvertor;
   660 	TColor64KColorConvertor iColor64KConvertor;
   661 	TColor16MColorConvertor iColor16MConvertor;
   662 	TColor16MUColorConvertor iColor16MUConvertor;
   663 	TColor16MAColorConvertor iColor16MAConvertor;
   664 	TColor16MAPColorConvertor iColor16MAPConvertor;
   665 	TColorConvertor* iColorConvertor[15];
   666 	TInt iOrientationEnd;
   667 	TInt iCurScreenDeviceModeIndex;
   668 	TBool iFuzzyMatch;
   669 	TBool iBlendTestColors;
   670 	TPostShadowMode iPostBlendShadow;
   671 	TBool i16MAUserDispMode;
   672 	TBool iUseFastFade; //used to check whether fast fading method is required or not
   673 						// while calling FadeRgb from CTLowLevel::Shadow(TRgb& aColor,TInt aShadowMode)
   674 	TBool iLastFailTestNo;
   675 	};//end of - class TestLowLevel
   676 
   677 class CTLowLevel1 : public CTLowLevel
   678 	{
   679 public:
   680 	CTLowLevel1(CTestStep* aStep);
   681 protected:
   682 //from 	CTGraphicsStep
   683 	virtual void RunTestCaseL(TInt aCurTestCase);
   684 	};
   685 
   686 class CTLowLevelStep : public CTGraphicsStep
   687 	{
   688 public:
   689 	CTLowLevelStep();
   690 protected:
   691 	//from CTGraphicsStep
   692 	virtual CTGraphicsBase* CreateTestL();
   693 	};
   694 
   695 _LIT(KTLowLevelStep,"TLowLevel");
   696 
   697 class CTLowLevel1Step : public CTGraphicsStep
   698 	{
   699 public:
   700 	CTLowLevel1Step();
   701 protected:
   702 	//from CTGraphicsStep
   703 	virtual CTGraphicsBase* CreateTestL();
   704 	};
   705 
   706 _LIT(KTLowLevel1Step,"TLowLevel1");
   707 
   708 #endif//__TLLD_H_