os/graphics/graphicsdeviceinterface/screendriver/tsrc/Tlld.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicsdeviceinterface/screendriver/tsrc/Tlld.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,708 @@
     1.4 +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef __TLLD_H_
    1.20 +#define __TLLD_H_
    1.21 +
    1.22 +#include <gdi.h>
    1.23 +#include <bitdraw.h>
    1.24 +#include "TGraphicsHarness.h"
    1.25 +
    1.26 +#define KRgbFadedBlack		TRgb(0x808080)
    1.27 +const TInt KNumDispModes = 13;
    1.28 +const TInt KNumDrawModes = 6;
    1.29 +const TInt KNumTestRects = 10;
    1.30 +const TInt KNumTestColors = 12;
    1.31 +const TInt KNumTestBackgrounds = 6;
    1.32 +const TInt KNumShadowModes = 4;
    1.33 +const TInt KCheckBinaryPixelBufferSize = 64;
    1.34 +const TInt KNumBlendingColors = 3;
    1.35 +const TInt KNumColorsToBlend = 4;
    1.36 +
    1.37 +//this is to allow EColor16MAP to be tested with extra colours
    1.38 +const TUint32 KMaxNon16Colours = 9;
    1.39 +
    1.40 +//this is to allow EColor16MAP to be tested with extra background colours
    1.41 +const TUint32 KMaxNon16BackColours = 3;
    1.42 +
    1.43 +const TDisplayMode TestDisplayMode[KNumDispModes] =
    1.44 +	{
    1.45 +	EGray2,
    1.46 +	EGray4,
    1.47 +	EGray16,
    1.48 +	EGray256,
    1.49 +	EColor16,
    1.50 +	EColor256,
    1.51 +	EColor4K,
    1.52 +	EColor64K,
    1.53 +	EColor16M,
    1.54 +	ERgb,
    1.55 +	EColor16MU,
    1.56 +	EColor16MAP,
    1.57 +	EColor16MA,
    1.58 +	};
    1.59 +
    1.60 +const TPtrC DisplayModeNames[KNumDispModes] =
    1.61 +	{
    1.62 +	_L("EGray2"),
    1.63 +	_L("EGray4"),
    1.64 +	_L("EGray16"),
    1.65 +	_L("EGray256"),
    1.66 +	_L("EColor16"),
    1.67 +	_L("EColor256"),
    1.68 +	_L("EColor4K"),
    1.69 +	_L("EColor64K"),
    1.70 +	_L("EColor16M"),
    1.71 +	_L("ERgb"),
    1.72 +	_L("EColor16MU"),
    1.73 +	_L("EColor16MAP"),
    1.74 +	_L("EColor16MA"),
    1.75 +	};
    1.76 +
    1.77 +const TDisplayMode TestDisplayMode1[] =
    1.78 +	{
    1.79 +	EGray2,
    1.80 +	EGray4,
    1.81 +	EGray16,
    1.82 +	EGray256,
    1.83 +	EColor16,
    1.84 +	EColor256,
    1.85 +	EColor4K,
    1.86 +	EColor64K,
    1.87 +	EColor16M,
    1.88 +	EColor16MU,
    1.89 +	EColor16MAP,
    1.90 +	EColor16MA,
    1.91 +	};
    1.92 +
    1.93 +const TPtrC DisplayModeNames1[] =
    1.94 +	{
    1.95 +	_L("EGray2"),
    1.96 +	_L("EGray4"),
    1.97 +	_L("EGray16"),
    1.98 +	_L("EGray256"),
    1.99 +	_L("EColor16"),
   1.100 +	_L("EColor256"),
   1.101 +	_L("EColor4K"),
   1.102 +	_L("EColor64K"),
   1.103 +	_L("EColor16M"),
   1.104 +	_L("EColor16MU"),
   1.105 +	_L("EColor16MAP"),
   1.106 +	_L("EColor16MA"),
   1.107 +	};
   1.108 +
   1.109 +const CGraphicsContext::TDrawMode TestDrawMode[KNumDrawModes] =
   1.110 +	{
   1.111 +	CGraphicsContext::EDrawModePEN,
   1.112 +	CGraphicsContext::EDrawModeAND,
   1.113 +	CGraphicsContext::EDrawModeXOR,
   1.114 +	CGraphicsContext::EDrawModeOR,
   1.115 +	CGraphicsContext::EDrawModeNOTSCREEN,
   1.116 +	CGraphicsContext::EDrawModeNOTPEN
   1.117 +	};
   1.118 +
   1.119 +const TRect TestRect[KNumTestRects] =
   1.120 +	{
   1.121 +	TRect(0,0,31,31),
   1.122 +	TRect(1,1,2,2),
   1.123 +	TRect(1,1,2,31),
   1.124 +	TRect(2,1,31,2),
   1.125 +	TRect(1,1,2,31),
   1.126 +	TRect(1,1,30,31),
   1.127 +	TRect(1,1,33,33),
   1.128 +	TRect(31,0,65,1),
   1.129 +	TRect(0,0,30,34), //needs a height >32
   1.130 +	TRect(1,1,7,7) // for DEF123772
   1.131 +	};
   1.132 +
   1.133 +const TRgb TestColor[KNumTestColors] =
   1.134 +	{
   1.135 +	KRgbBlack,
   1.136 +	KRgbDarkGray,
   1.137 +	KRgbGray,
   1.138 +	KRgbWhite,
   1.139 +	KRgbRed,
   1.140 +	KRgbCyan,
   1.141 +	TRgb(230,180,70),
   1.142 +	TRgb(150,240,30),
   1.143 +	TRgb(20,250,160),
   1.144 +	TRgb((TUint32)0xff2665A3),
   1.145 +	TRgb((TUint32)0x002766A4),
   1.146 +	TRgb((TUint32)0x57339A4E),
   1.147 +	};
   1.148 +
   1.149 +const TRgb TestBackground[KNumTestBackgrounds] =
   1.150 +	{
   1.151 +	KRgbWhite,
   1.152 +	KRgbBlack,
   1.153 +	TRgb(20,250,160),
   1.154 +	TRgb(0xff27D99f),
   1.155 +	TRgb(0x00E73121),
   1.156 +	TRgb(0x771FE3B7),
   1.157 +	};
   1.158 +
   1.159 +const TUint8 ditherlutab[16][4]=
   1.160 +	{{	0x0,	0x0,	0x0,	0x0,	},
   1.161 +	{	0x5,	0x0,	0x0,	0x0,	},
   1.162 +	{	0x5,	0x0,	0x0,	0x5,	},
   1.163 +	{	0x5,	0x0,	0x0,	0x5,	},
   1.164 +	{	0x5,	0x0,	0x5,	0x5,	},
   1.165 +	{	0x5,	0x5,	0x5,	0x5,	},
   1.166 +	{	0xa,	0x5,	0x5,	0x5,	},
   1.167 +	{	0xa,	0x5,	0x5,	0xa,	},
   1.168 +	{	0xa,	0x5,	0x5,	0xa,	},
   1.169 +	{	0xa,	0x5,	0xa,	0xa,	},
   1.170 +	{	0xa,	0xa,	0xa,	0xa,	},
   1.171 +	{	0xf,	0xa,	0xa,	0xa,	},
   1.172 +	{	0xf,	0xa,	0xa,	0xf,	},
   1.173 +	{	0xf,	0xa,	0xa,	0xf,	},
   1.174 +	{	0xf,	0xa,	0xf,	0xf,	},
   1.175 +	{	0xf,	0xf,	0xf,	0xf		}};
   1.176 +
   1.177 +/**
   1.178 +This array has three colours, It would be used to blend the four colours using WriteRgbOutlineAndShadow ().
   1.179 +Four colours which needs blending are
   1.180 +O - Outline colour, first entry of this table
   1.181 +S - Shadow colour, second entry in this table
   1.182 +F - Foreground colour i.e. third entry and,
   1.183 +B - Background colur, It will be set inside the test function.
   1.184 +*/
   1.185 +const TRgb TestOSFBColorsForBlending[KNumBlendingColors][KNumColorsToBlend] =
   1.186 +	{
   1.187 +	{ KRgbBlack, TRgb(220,150,164,138), KRgbMagenta, KRgbWhite},
   1.188 +	{ KRgbDarkMagenta, KRgbBlue, KRgbDarkYellow, TRgb(20,250,160, 128)},
   1.189 +	{ TRgb(230,180,70,10), KRgbGreen, TRgb(20,250,160,168), KRgbBlack}
   1.190 +	};
   1.191 +
   1.192 +/**
   1.193 +This lookup table is used for outline and shadow fonts. Four entries of this table represents
   1.194 +% of Outline, Shadow, Fill and Background color to be used to get the final color to be
   1.195 +displayed on screen.
   1.196 +
   1.197 +While doing the blending of four colors it would use the following formula,
   1.198 +
   1.199 +blendedXXXColor = (XXXOutlinePenColor * FourColorBlendLookup[index][KOutlineColorIndex] +
   1.200 +			   		XXXShadowColor * FourColorBlendLookup[index][KShadowColorIndex] +
   1.201 +			  		XXXFillColor * FourColorBlendLookup[index][KFillColorIndex] +
   1.202 +			  		backgroundColor.XXX() * FourColorBlendLookup[index][KBackgroundColorIndex]) >> 8;
   1.203 +where XXX can be Red, Green or Blue
   1.204 +and index is the 8-bit value which will be provided by the rasterizer to decide which
   1.205 +entry of lookup table should be used. Right shift by eight will divide the calculated value in % with
   1.206 +256 to get the actual colour.
   1.207 +
   1.208 +This table is provided by Monotype and MUST NOT be changed.
   1.209 +*/
   1.210 +const TInt FourColorBlendLookup[256][4] = {
   1.211 +	{ 0, 0, 0, 255 },
   1.212 +	{ 0, 0, 17, 238 },
   1.213 +	{ 0, 0, 34, 221 },
   1.214 +	{ 0, 0, 51, 204 },
   1.215 +	{ 0, 0, 68, 187 },
   1.216 +	{ 0, 0, 85, 170 },
   1.217 +	{ 0, 0, 102, 153 },
   1.218 +	{ 0, 0, 119, 136 },
   1.219 +	{ 0, 0, 136, 119 },
   1.220 +	{ 0, 0, 153, 102 },
   1.221 +	{ 0, 0, 170, 85 },
   1.222 +	{ 0, 0, 187, 68 },
   1.223 +	{ 0, 0, 204, 51 },
   1.224 +	{ 0, 0, 221, 34 },
   1.225 +	{ 0, 0, 238, 17 },
   1.226 +	{ 0, 0, 255, 0 },
   1.227 +	{ 0, 17, 0, 238 },
   1.228 +	{ 0, 34, 0, 221 },
   1.229 +	{ 0, 51, 0, 204 },
   1.230 +	{ 0, 68, 0, 187 },
   1.231 +	{ 0, 85, 0, 170 },
   1.232 +	{ 0, 102, 0, 153 },
   1.233 +	{ 0, 119, 0, 136 },
   1.234 +	{ 0, 136, 0, 119 },
   1.235 +	{ 0, 153, 0, 102 },
   1.236 +	{ 0, 170, 0, 85 },
   1.237 +	{ 0, 187, 0, 68 },
   1.238 +	{ 0, 204, 0, 51 },
   1.239 +	{ 0, 221, 0, 34 },
   1.240 +	{ 0, 238, 0, 17 },
   1.241 +	{ 0, 255, 0, 0 },
   1.242 +	{ 17, 0, 0, 238 },
   1.243 +	{ 34, 0, 0, 221 },
   1.244 +	{ 51, 0, 0, 204 },
   1.245 +	{ 68, 0, 0, 187 },
   1.246 +	{ 85, 0, 0, 170 },
   1.247 +	{ 102, 0, 0, 153 },
   1.248 +	{ 119, 0, 0, 136 },
   1.249 +	{ 136, 0, 0, 119 },
   1.250 +	{ 153, 0, 0, 102 },
   1.251 +	{ 170, 0, 0, 85 },
   1.252 +	{ 187, 0, 0, 68 },
   1.253 +	{ 204, 0, 0, 51 },
   1.254 +	{ 221, 0, 0, 34 },
   1.255 +	{ 238, 0, 0, 17 },
   1.256 +	{ 255, 0, 0, 0 },
   1.257 +	{ 0, 17, 238, 0 },
   1.258 +	{ 0, 34, 221, 0 },
   1.259 +	{ 0, 51, 204, 0 },
   1.260 +	{ 0, 68, 187, 0 },
   1.261 +	{ 0, 85, 170, 0 },
   1.262 +	{ 0, 102, 153, 0 },
   1.263 +	{ 0, 119, 136, 0 },
   1.264 +	{ 0, 136, 119, 0 },
   1.265 +	{ 0, 153, 102, 0 },
   1.266 +	{ 0, 170, 85 ,0 },
   1.267 +	{ 0, 187, 68 ,0 },
   1.268 +	{ 0, 204, 51, 0 },
   1.269 +	{ 0, 221, 34, 0 },
   1.270 +	{ 0, 238, 17, 0 },
   1.271 +	{ 238, 17, 0, 0 },
   1.272 +	{ 221, 34, 0, 0 },
   1.273 +	{ 204, 51, 0, 0 },
   1.274 +	{ 187, 68, 0, 0 },
   1.275 +	{ 170, 85, 0, 0 },
   1.276 +	{ 153, 102, 0, 0 },
   1.277 +	{ 136, 119, 0, 0 },
   1.278 +	{ 119, 136, 0, 0 },
   1.279 +	{ 102, 153, 0, 0 },
   1.280 +	{ 85, 170, 0, 0 },
   1.281 +	{ 68, 187, 0, 0 },
   1.282 +	{ 51, 204, 0, 0 },
   1.283 +	{ 34, 221, 0, 0 },
   1.284 +	{ 17, 238, 0, 0 },
   1.285 +	{ 238, 0, 17, 0 },
   1.286 +	{ 221, 0, 34, 0 },
   1.287 +	{ 204, 0, 51, 0 },
   1.288 +	{ 187, 0, 68, 0 },
   1.289 +	{ 170, 0, 85, 0 },
   1.290 +	{ 153, 0, 102, 0 },
   1.291 +	{ 136, 0, 119, 0 },
   1.292 +	{ 119, 0, 136, 0 },
   1.293 +	{ 102, 0, 153, 0 },
   1.294 +	{ 85, 0, 170, 0 } ,
   1.295 +	{ 68, 0, 187, 0 },
   1.296 +	{ 51, 0, 204, 0 },
   1.297 +	{ 34, 0, 221, 0 },
   1.298 +	{ 17, 0, 238, 0 },
   1.299 +	{ 210, 23, 0, 22 },
   1.300 +	{ 179, 60, 0, 16 },
   1.301 +	{ 145, 94, 0, 16 },
   1.302 +	{ 119, 119, 0, 17 },
   1.303 +	{ 94, 145, 0, 16 },
   1.304 +	{ 60, 179, 0, 16 },
   1.305 +	{ 23, 210, 0, 22 },
   1.306 +	{ 176, 40, 0, 39 },
   1.307 +	{ 142, 74, 0, 39 },
   1.308 +	{ 113, 96, 0, 46 },
   1.309 +	{ 91, 125, 0, 39 },
   1.310 +	{ 62, 147, 0, 46 },
   1.311 +	{ 40, 176, 0, 39 },
   1.312 +	{ 179, 17, 0, 59 },
   1.313 +	{ 147, 45, 0, 63 },
   1.314 +	{ 17, 179, 0, 59 },
   1.315 +	{ 145, 17, 0, 93 },
   1.316 +	{ 125, 40, 0, 90 },
   1.317 +	{ 108, 74, 0, 73 },
   1.318 +	{ 74, 108, 0, 73 },
   1.319 +	{ 85, 85, 0, 85 },
   1.320 +	{ 40, 142, 0, 73 },
   1.321 +	{ 119, 17, 0, 119 },
   1.322 +	{ 96, 45, 0, 114 },
   1.323 +	{ 74, 74, 0, 107 },
   1.324 +	{ 45, 113, 0, 97 },
   1.325 +	{ 17, 145, 0, 93 },
   1.326 +	{ 94, 17, 0, 144 },
   1.327 +	{ 74, 40, 0, 141 },
   1.328 +	{ 45, 62, 0, 148 },
   1.329 +	{ 40, 91, 0, 124 },
   1.330 +	{ 17, 119, 0, 119 },
   1.331 +	{ 17, 94, 0, 144 },
   1.332 +	{ 60, 17, 0, 178 },
   1.333 +	{ 40, 40, 0, 175 },
   1.334 +	{ 17, 60, 0, 178 },
   1.335 +	{ 23, 23, 0, 209 },
   1.336 +	{ 0, 210, 23, 22 },
   1.337 +	{ 0, 179, 60, 16 },
   1.338 +	{ 0, 145, 94, 16 },
   1.339 +	{ 0, 119, 119, 17 },
   1.340 +	{ 0, 94 ,145, 16 },
   1.341 +	{ 0, 60 ,179, 16 },
   1.342 +	{ 0, 23, 210, 22 },
   1.343 +	{ 0, 176, 40, 39 },
   1.344 +	{ 0, 142, 74, 39 },
   1.345 +	{ 0, 113, 96, 46 },
   1.346 +	{ 0, 91, 125, 39 },
   1.347 +	{ 0, 62, 147, 46 },
   1.348 +	{ 0, 40, 176, 39 },
   1.349 +	{ 0, 179, 17, 59 },
   1.350 +	{ 0, 147, 45, 63 },
   1.351 +	{ 0, 17, 179, 59 },
   1.352 +	{ 0, 145, 17, 93 },
   1.353 +	{ 0, 125, 40, 90 },
   1.354 +	{ 0, 108, 74, 73 },
   1.355 +	{ 0, 74, 108, 73 },
   1.356 +	{ 0, 85, 85, 85 },
   1.357 +	{ 0, 40, 142, 73 },
   1.358 +	{ 0, 119, 17, 119 },
   1.359 +	{ 0, 96, 45, 114 },
   1.360 +	{ 0, 74, 74, 107 },
   1.361 +	{ 0, 45, 113, 97 },
   1.362 +	{ 0, 17, 145, 93 },
   1.363 +	{ 0, 94, 17, 144 },
   1.364 +	{ 0, 74, 40, 141 },
   1.365 +	{ 0, 45, 62, 148 },
   1.366 +	{ 0, 40, 91, 124 },
   1.367 +	{ 0, 17, 119, 119 },
   1.368 +	{ 0, 17, 94, 144 },
   1.369 +	{ 0, 60, 17, 178 },
   1.370 +	{ 0, 40, 40, 175 },
   1.371 +	{ 0, 17, 60, 178 },
   1.372 +	{ 0, 23, 23, 209 },
   1.373 +	{ 23, 0, 210, 22 },
   1.374 +	{ 60, 0, 179, 16 },
   1.375 +	{ 94, 0, 145, 16 },
   1.376 +	{ 119, 0, 119, 17 },
   1.377 +	{ 145, 0, 94, 16 },
   1.378 +	{ 179, 0, 60, 16 },
   1.379 +	{ 210, 0, 23, 22 },
   1.380 +	{ 40, 0, 176, 39 },
   1.381 +	{ 74, 0, 142, 39 },
   1.382 +	{ 96, 0, 113, 46 },
   1.383 +	{ 125, 0, 91, 39 },
   1.384 +	{ 147, 0, 62, 46 },
   1.385 +	{ 176, 0, 40, 39 },
   1.386 +	{ 17, 0, 179, 59 },
   1.387 +	{ 45, 0, 147, 63 },
   1.388 +	{ 179, 0, 17, 59 },
   1.389 +	{ 17, 0, 145, 93 },
   1.390 +	{ 40, 0, 125, 90 },
   1.391 +	{ 74, 0, 108, 73 },
   1.392 +	{ 108, 0, 74, 73 },
   1.393 +	{ 85, 0, 85, 85 },
   1.394 +	{ 142, 0, 40, 73 },
   1.395 +	{ 17, 0, 119, 119 },
   1.396 +	{ 45, 0, 96, 114 },
   1.397 +	{ 74, 0, 74, 107 },
   1.398 +	{ 113, 0, 45, 97 },
   1.399 +	{ 145, 0, 17, 93 },
   1.400 +	{ 17, 0, 94, 144 },
   1.401 +	{ 40, 0, 74, 141 },
   1.402 +	{ 62, 0, 45, 148 },
   1.403 +	{ 91, 0, 40, 124 },
   1.404 +	{ 119, 0, 17, 119 },
   1.405 +	{ 94, 0, 17, 144 },
   1.406 +	{ 17, 0, 60, 178 },
   1.407 +	{ 40, 0, 40, 175 },
   1.408 +	{ 60, 0, 17, 178 },
   1.409 +	{ 23, 0, 23, 209 },
   1.410 +	{ 209, 23, 23, 0 },
   1.411 +	{ 178, 17, 60, 0 },
   1.412 +	{ 144, 17, 94, 0 },
   1.413 +	{ 119, 17, 119, 0 },
   1.414 +	{ 93, 17, 145, 0 },
   1.415 +	{ 59, 17, 179, 0 },
   1.416 +	{ 22, 23, 210, 0 },
   1.417 +	{ 175, 40, 40, 0 },
   1.418 +	{ 141, 40, 74, 0 },
   1.419 +	{ 114, 45, 96, 0 },
   1.420 +	{ 90, 40, 125, 0 },
   1.421 +	{ 63, 45, 147, 0 },
   1.422 +	{ 39, 40, 176, 0 },
   1.423 +	{ 178, 60, 17, 0 },
   1.424 +	{ 148, 62, 45, 0 },
   1.425 +	{ 16, 60, 179, 0 },
   1.426 +	{ 144, 94, 17, 0 },
   1.427 +	{ 124, 91, 40, 0 },
   1.428 +	{ 107, 74, 74, 0 },
   1.429 +	{ 73, 74, 108, 0 },
   1.430 +	{ 85, 85, 85, 0 },
   1.431 +	{ 39, 74, 142, 0 },
   1.432 +	{ 119, 119, 17, 0 },
   1.433 +	{ 97, 113, 45, 0 },
   1.434 +	{ 73, 108, 74, 0 },
   1.435 +	{ 46, 96, 113, 0 },
   1.436 +	{ 16, 94, 145, 0 },
   1.437 +	{ 93, 145, 17, 0 },
   1.438 +	{ 73, 142, 40, 0 },
   1.439 +	{ 46, 147, 62, 0 },
   1.440 +	{ 39, 125, 91, 0 },
   1.441 +	{ 17, 119, 119, 0 },
   1.442 +	{ 16, 145, 94, 0 },
   1.443 +	{ 59, 179, 17, 0 },
   1.444 +	{ 39, 176, 40, 0 },
   1.445 +	{ 16, 179, 60, 0 },
   1.446 +	{ 22, 210, 23, 0 },
   1.447 +	{ 32, 32 ,32, 159 },
   1.448 +	{ 32, 32 ,74, 117 },
   1.449 +	{ 32, 32 ,116, 75 },
   1.450 +	{ 32, 32 ,158, 33 },
   1.451 +	{ 74, 32, 32, 117 },
   1.452 +	{ 74, 32, 74, 75 },
   1.453 +	{ 74, 32, 116, 33 },
   1.454 +	{ 116, 32, 32, 75 },
   1.455 +	{ 116, 32, 74, 33 },
   1.456 +	{ 158, 32, 32, 33 },
   1.457 +	{ 32, 74, 32, 117 },
   1.458 +	{ 32, 74, 74, 75 },
   1.459 +	{ 32, 74, 116, 33 },
   1.460 +	{ 74, 74, 32, 75 },
   1.461 +	{ 74, 74, 74, 33 },
   1.462 +	{ 116, 74, 32, 33 },
   1.463 +	{ 32, 116, 32, 75 },
   1.464 +	{ 32, 116, 74, 33 },
   1.465 +	{ 74, 116, 32, 33 },
   1.466 +	{ 32, 158, 32, 33 },
   1.467 +	};
   1.468 +
   1.469 +class TColorConvertor
   1.470 +	{
   1.471 +public:
   1.472 +	virtual TInt Index(TRgb aColor) = 0;
   1.473 +	virtual TRgb Color(TInt aIndex) = 0;
   1.474 +	};
   1.475 +
   1.476 +class TNullColorConvertor : public TColorConvertor
   1.477 +	{
   1.478 +public:
   1.479 +	virtual TInt Index(TRgb /*aColor*/) { return 0; }
   1.480 +	virtual TRgb Color(TInt /*aIndex*/) { return KRgbBlack; }
   1.481 +	};
   1.482 +
   1.483 +class TGray2ColorConvertor : public TColorConvertor
   1.484 +	{
   1.485 +public:
   1.486 +	virtual TInt Index(TRgb aColor) { return aColor.Gray2(); }
   1.487 +	virtual TRgb Color(TInt aIndex) { return TRgb::Gray2(aIndex); }
   1.488 +	};
   1.489 +
   1.490 +class TGray4ColorConvertor : public TColorConvertor
   1.491 +	{
   1.492 +public:
   1.493 +	virtual TInt Index(TRgb aColor) { return aColor.Gray4(); }
   1.494 +	virtual TRgb Color(TInt aIndex) { return TRgb::Gray4(aIndex); }
   1.495 +	};
   1.496 +
   1.497 +class TGray16ColorConvertor : public TColorConvertor
   1.498 +	{
   1.499 +public:
   1.500 +	virtual TInt Index(TRgb aColor) { return aColor.Gray16(); }
   1.501 +	virtual TRgb Color(TInt aIndex) { return TRgb::Gray16(aIndex); }
   1.502 +	};
   1.503 +
   1.504 +class TGray256ColorConvertor : public TColorConvertor
   1.505 +	{
   1.506 +public:
   1.507 +	virtual TInt Index(TRgb aColor) { return aColor.Gray256(); }
   1.508 +	virtual TRgb Color(TInt aIndex) { return TRgb::Gray256(aIndex); }
   1.509 +	};
   1.510 +
   1.511 +class TColor16ColorConvertor : public TColorConvertor
   1.512 +	{
   1.513 +public:
   1.514 +	virtual TInt Index(TRgb aColor) { return aColor.Color16(); }
   1.515 +	virtual TRgb Color(TInt aIndex) { return TRgb::Color16(aIndex); }
   1.516 +	};
   1.517 +
   1.518 +class TColor256ColorConvertor : public TColorConvertor
   1.519 +	{
   1.520 +public:
   1.521 +	virtual TInt Index(TRgb aColor) { return aColor.Color256(); }
   1.522 +	virtual TRgb Color(TInt aIndex) { return TRgb::Color256(aIndex); }
   1.523 +	};
   1.524 +
   1.525 +class TColor4KColorConvertor : public TColorConvertor
   1.526 +	{
   1.527 +public:
   1.528 +	virtual TInt Index(TRgb aColor) { return aColor.Color4K(); }
   1.529 +	virtual TRgb Color(TInt aIndex) { return TRgb::Color4K(aIndex); }
   1.530 +	};
   1.531 +
   1.532 +class TColor64KColorConvertor : public TColorConvertor
   1.533 +	{
   1.534 +public:
   1.535 +	virtual TInt Index(TRgb aColor) { return aColor.Color64K(); }
   1.536 +	virtual TRgb Color(TInt aIndex) { return TRgb::Color64K(aIndex); }
   1.537 +	};
   1.538 +
   1.539 +class TColor16MColorConvertor : public TColorConvertor
   1.540 +	{
   1.541 +public:
   1.542 +	virtual TInt Index(TRgb aColor) { return aColor.Color16M(); }
   1.543 +	virtual TRgb Color(TInt aIndex) { return TRgb::Color16M(aIndex); }
   1.544 +	};
   1.545 +
   1.546 +class TColor16MUColorConvertor : public TColorConvertor
   1.547 +	{
   1.548 +public:
   1.549 +	virtual TInt Index(TRgb aColor) { return aColor.Color16MU(); }
   1.550 +	virtual TRgb Color(TInt aIndex) { return TRgb::Color16MU(aIndex); }
   1.551 +	};
   1.552 +
   1.553 +class TColor16MAColorConvertor : public TColorConvertor
   1.554 +	{
   1.555 +public:
   1.556 +	virtual TInt Index(TRgb aColor) { return aColor.Color16MA(); }
   1.557 +	virtual TRgb Color(TInt aIndex) { return TRgb::Color16MA(aIndex); }
   1.558 +	};
   1.559 +
   1.560 +class TColor16MAPColorConvertor : public TColorConvertor
   1.561 +	{
   1.562 +public:
   1.563 +	virtual TInt Index(TRgb aColor) { return aColor.Color16MAP(); }
   1.564 +	virtual TRgb Color(TInt aIndex) { return TRgb::Color16MAP(aIndex); }
   1.565 +	};
   1.566 +
   1.567 +class CTLowLevel : public CTGraphicsBase
   1.568 +	{
   1.569 +enum TPostShadowMode
   1.570 +	{
   1.571 +	ENoPostShadow,
   1.572 +	EPostShadow,
   1.573 +	EPostFade,
   1.574 +	EPostShadowFade,
   1.575 +	};
   1.576 +public:
   1.577 +	CTLowLevel(CTestStep* aStep);
   1.578 +	~CTLowLevel();
   1.579 +protected:
   1.580 +//from 	CTGraphicsStep
   1.581 +	virtual void RunTestCaseL(TInt aCurTestCase);
   1.582 +	void TestScreenDrawL(TDisplayMode aDisplayMode);
   1.583 +private:
   1.584 +	void Reset();
   1.585 +	void Report();
   1.586 +	void TestBitmapDraw(TDisplayMode aDisplayMode,const TSize& aSize);
   1.587 +	void Test();
   1.588 +	void TestParams();
   1.589 +	void TestReadLine();
   1.590 +	void TestWriteRgb();
   1.591 +	void TestWriteLine();
   1.592 +	void TestWriteBinary();
   1.593 +	void TestWriteRGBAlpha();
   1.594 +	void TestWriteAlphaLineEx();
   1.595 +	void TestWriteAlphaLineNoShadowEx();
   1.596 +	void TestWriteMaskLineNoShadowEx();
   1.597 +	void ClosePanicDialogs();
   1.598 +	void TestFastBlendBitmapMasked(const TInt aRetry = 0);
   1.599 +	void TestShadow();
   1.600 +	void TestWriteRgbOutlineAndShadow();
   1.601 +	inline TInt ByteSize();
   1.602 +	inline TBool Check(TBool aValue);
   1.603 +	void CheckBuffer(TUint8* aWriteBuffer,TDisplayMode aWriteDispMode,TUint8* aReadBuffer,TDisplayMode aReadDispMode,TInt aPixelLength);
   1.604 +	void CheckBinary(const TRect& aRect,TUint32* aBuffer,TRgb aForeColor,TRgb aBackColor,CGraphicsContext::TDrawMode aDrawMode,TInt aShadowMode,TBool aWrapDataWords,TBool aUp);
   1.605 +	void CheckRgb(const TPoint& aPoint,TRgb aColor,TRgb aBackgroundColor,CGraphicsContext::TDrawMode aDrawMode,TInt aShadowMode);
   1.606 +	void CheckRgb(const TRect& aRect,TRgb aColor,TRgb aBackgroundColor,CGraphicsContext::TDrawMode aDrawMode,TInt aShadowMode);
   1.607 +	void CheckShadowRgb(const TRect& aRect,TRgb aColor,TInt aShadowMode);
   1.608 +	void CheckScanline(TInt aX,TInt aY,TInt aLength,TRgb aFore1,TRgb aFore2,TRgb aBack1,TRgb aBack2,CGraphicsContext::TDrawMode aDrawMode);
   1.609 +	void CheckLine(TUint8* aWriteBuffer,TUint8* aReadBuffer,TUint8* aBackBuffer,TInt aPixelLength,CGraphicsContext::TDrawMode aDrawMode,TDisplayMode aDispMode);
   1.610 +	void CheckPixel(TUint8* aWriteBuffer,TDisplayMode aWriteDispMode,TUint8* aReadBuffer,TDisplayMode aReadDispMode,TInt aPixelLength,TDisplayMode aCompareDispMode);
   1.611 +	void CheckBackground(const TRect& aRect,TRgb aBackgroundColor);
   1.612 +	TBool CheckBlendedOutlineAndShadow(TRgb aOutlinePenColor, TRgb aShadowColor, TRgb aFillColor, TRgb aBackgroundColor, TInt aLookupIndex, TInt aLength, TUint8* aReadBuffer);
   1.613 +	void Clear(TRgb aColor);
   1.614 +	void CheckMatch(TUint32 aFirst, TUint32 aSecond);
   1.615 +	TRgb ExtractRgbValue(TInt aX,TUint8* aBuffer,TDisplayMode aDispMode);
   1.616 +	TUint32 ExtractBinaryValue(TInt aX,TUint32* aBuffer,TDisplayMode aDispMode);
   1.617 +	void FillArray(TRgb aColor,TRgb aArray[4]);
   1.618 +	void FillBuffer(TUint8* aBuffer, TInt aByteSize, TDisplayMode aDispMode, TBool aNoAlpha16MU = EFalse);
   1.619 +	TInt LongWidth(TInt aWidth,TDisplayMode aDispMode);
   1.620 +	void Normalize(TRgb& aColor);
   1.621 +	void Normalize(TRgb& aColor, TDisplayMode aDispMode);
   1.622 +	void Normalize(TRgb& aColor,TRgb aDitherColors[4]);
   1.623 +	TRgb RgbValue(TRgb aFore,TRgb aBack,CGraphicsContext::TDrawMode aDrawMode);
   1.624 +	TUint32 BinaryValue(TRgb aFore,TRgb aBack,CGraphicsContext::TDrawMode aDrawMode);
   1.625 +	void Shadow(TRgb& aColor,TInt aShadowMode);
   1.626 +	void Shadow(TUint8* aBuffer,TInt aByteLength,TInt aShadowMode);
   1.627 +	TUint8 FadeGray(TInt aGray256);
   1.628 +	TRgb FadeRgb(TRgb aColor, TBool aFastFade = EFalse);
   1.629 +	TColorConvertor& ColorConvertor(TDisplayMode aDisplayMode);
   1.630 +	void Blend(TUint8* aBuffer,TUint8* aBufferDest,TDisplayMode aDispMode);
   1.631 +	void PostBlendShadow(TUint32 &aPmaColor);
   1.632 +	void TestUserDisplayModeMapping();
   1.633 +	void PrepareDestPixel(TDisplayMode aDevDisplayMode, TRgb& aRgb, TInt aDstAlpha);
   1.634 +	void CheckMappedRgb(TDisplayMode aDevDisplayMode, TDisplayMode aUserDisplayMode, TRgb aRgb);
   1.635 +	void CheckNormalizedRgb(TRgb aReadRgb, TRgb aCheckRgb, TDisplayMode aDevDisplayMode, TDisplayMode aUserDisplayMode, TBool aWriteRgbAlphaLine);
   1.636 +	void WriteBinaryValue(TUint32 aX, TAny* const aPtr, TDisplayMode aMode, TUint32 aValue) const;
   1.637 +	void MaskedBlendBuffer(TAny* aSrc, TDisplayMode aSrcMode, TAny* aDst,
   1.638 +			TDisplayMode aDstMode, TUint32* aMsk, TInt aWidth, TBool aInvert);
   1.639 +	TUint32 BytesForPixels(TUint32 aPixels, TDisplayMode aMode);
   1.640 +	TBool CompareBlendMaskResults(TAny* aActual, TAny* aExpected, 
   1.641 +			TUint32 aWidth, TDisplayMode aMode, TBool aBlended, TDisplayMode aSrcMode = ENone);
   1.642 +protected:
   1.643 +	CFbsDrawDevice* iDrawDevice;
   1.644 +	TUint8* iBits;
   1.645 +	TUint32* iBuf;
   1.646 +	TDisplayMode iDispMode;
   1.647 +	TDisplayMode iUserDispMode;
   1.648 +	TInt iOrientation;
   1.649 +	TSize iSize;
   1.650 +	TInt iLongWidth;
   1.651 +	TInt iTestNo;
   1.652 +	TInt iIteration;
   1.653 +	TInt iReportIteration;
   1.654 +	TInt iTotalReportIterations;
   1.655 +	TNullColorConvertor iNullConvertor;
   1.656 +	TGray2ColorConvertor iGray2Convertor;
   1.657 +	TGray4ColorConvertor iGray4Convertor;
   1.658 +	TGray16ColorConvertor iGray16Convertor;
   1.659 +	TGray256ColorConvertor iGray256Convertor;
   1.660 +	TColor16ColorConvertor iColor16Convertor;
   1.661 +	TColor256ColorConvertor iColor256Convertor;
   1.662 +	TColor4KColorConvertor iColor4KConvertor;
   1.663 +	TColor64KColorConvertor iColor64KConvertor;
   1.664 +	TColor16MColorConvertor iColor16MConvertor;
   1.665 +	TColor16MUColorConvertor iColor16MUConvertor;
   1.666 +	TColor16MAColorConvertor iColor16MAConvertor;
   1.667 +	TColor16MAPColorConvertor iColor16MAPConvertor;
   1.668 +	TColorConvertor* iColorConvertor[15];
   1.669 +	TInt iOrientationEnd;
   1.670 +	TInt iCurScreenDeviceModeIndex;
   1.671 +	TBool iFuzzyMatch;
   1.672 +	TBool iBlendTestColors;
   1.673 +	TPostShadowMode iPostBlendShadow;
   1.674 +	TBool i16MAUserDispMode;
   1.675 +	TBool iUseFastFade; //used to check whether fast fading method is required or not
   1.676 +						// while calling FadeRgb from CTLowLevel::Shadow(TRgb& aColor,TInt aShadowMode)
   1.677 +	TBool iLastFailTestNo;
   1.678 +	};//end of - class TestLowLevel
   1.679 +
   1.680 +class CTLowLevel1 : public CTLowLevel
   1.681 +	{
   1.682 +public:
   1.683 +	CTLowLevel1(CTestStep* aStep);
   1.684 +protected:
   1.685 +//from 	CTGraphicsStep
   1.686 +	virtual void RunTestCaseL(TInt aCurTestCase);
   1.687 +	};
   1.688 +
   1.689 +class CTLowLevelStep : public CTGraphicsStep
   1.690 +	{
   1.691 +public:
   1.692 +	CTLowLevelStep();
   1.693 +protected:
   1.694 +	//from CTGraphicsStep
   1.695 +	virtual CTGraphicsBase* CreateTestL();
   1.696 +	};
   1.697 +
   1.698 +_LIT(KTLowLevelStep,"TLowLevel");
   1.699 +
   1.700 +class CTLowLevel1Step : public CTGraphicsStep
   1.701 +	{
   1.702 +public:
   1.703 +	CTLowLevel1Step();
   1.704 +protected:
   1.705 +	//from CTGraphicsStep
   1.706 +	virtual CTGraphicsBase* CreateTestL();
   1.707 +	};
   1.708 +
   1.709 +_LIT(KTLowLevel1Step,"TLowLevel1");
   1.710 +
   1.711 +#endif//__TLLD_H_