os/kernelhwsrv/kernel/eka/drivers/edisp/epoc/generic/wd_generic.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/drivers/edisp/epoc/generic/wd_generic.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,1282 @@
     1.4 +// Copyright (c) 1997-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 the License "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 +// WD_TEMPLATE.CPP
    1.18 +// Screen Driver for Text Window Server
    1.19 +// TO DO: (mandatory)
    1.20 +// This is the screen driver for the simple text Window Server supplied as part of
    1.21 +// E32. It is required to run the text shell, E32 & F32 tests etc.
    1.22 +// This is a working generic implementation which you shouldn't need to alter, but
    1.23 +// you may customise it if required. e.g. Change the default display mode or colors.
    1.24 +// ASSUMPTIONS MADE BY THIS IMPLEMENTATION
    1.25 +// * The start of each character on the display is byte aligned.
    1.26 +// 
    1.27 +//
    1.28 +
    1.29 +#include "ws_std.h"
    1.30 +#include <e32twin.h>
    1.31 +#include <hal.h>
    1.32 +#include "u32std.h"
    1.33 +#include <videodriver.h>
    1.34 +
    1.35 +#if 0
    1.36 +#define __DEBUG_PRINT(a) RDebug::Print(a)
    1.37 +#define __DEBUG_PRINT2(a,b) RDebug::Print(a,b)
    1.38 +#else
    1.39 +#define __DEBUG_PRINT(a)
    1.40 +#define __DEBUG_PRINT2(a,b)
    1.41 +#endif
    1.42 +
    1.43 +#ifdef __X86__
    1.44 +extern CScreenDriver* NewScreenDriverVgaText();
    1.45 +#endif
    1.46 +
    1.47 +const TUint32 KHwAccBlockFill=1;
    1.48 +const TUint32 KHwAccBlockCopy=2;
    1.49 +
    1.50 +inline TInt HwBlockFill(SRectOpInfo &a)
    1.51 +	{
    1.52 +	return UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalBlockFill, &a, NULL);
    1.53 +	}
    1.54 +
    1.55 +inline TInt HwBlockCopy(SRectOpInfo &a)
    1.56 +	{
    1.57 +	return UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalBlockCopy, &a, NULL);
    1.58 +	}
    1.59 +
    1.60 +/**
    1.61 + * Main screen driver implementation class.
    1.62 + *
    1.63 + * TO DO: (optional)
    1.64 + *
    1.65 + * The public API of this class is defined by the CScreenDriver class.
    1.66 + * You may want to add some private definitions to this.
    1.67 + */
    1.68 +class CScreenDriverTemplate : public CScreenDriver
    1.69 +	{
    1.70 +public:
    1.71 +	CScreenDriverTemplate();
    1.72 +	virtual void Init(TSize &aScreenSize,TSize &aFontSize);
    1.73 +	virtual void Blit(const TText *aBuffer,TInt aLength,const TPoint &aPosition);
    1.74 +	virtual TBool ScrollUp(const TRect& aRect);
    1.75 +	virtual void Clear(const TRect& aRect);
    1.76 +
    1.77 +	virtual void SetPixel(const TPoint& aPoint,TUint8 aColour);
    1.78 +	virtual TInt GetPixel(const TPoint& aPoint);
    1.79 +	virtual void SetWord(const TPoint& aPoint,TInt aWord);
    1.80 +	virtual TInt GetWord(const TPoint& aPoint);
    1.81 +	virtual void SetLine(const TPoint& aPoint,const TPixelLine& aPixelLine);
    1.82 +	virtual void GetLine(const TPoint& aPoint,TPixelLine& aPixelLine);
    1.83 +
    1.84 +	virtual void SetPaletteEntry(TColorIndex anIndex,TUint8 aRed,TUint8 aGreen,TUint8 aBlue);
    1.85 +	virtual void GetPaletteEntry(TColorIndex anIndex,TUint8 &aRed,TUint8 &aGreen,TUint8 &aBlue);
    1.86 +	virtual void SetForegroundColor(TColorIndex anIndex);
    1.87 +	virtual void SetBackgroundColor(TColorIndex anIndex);
    1.88 +	virtual void GetAttributeColors(TColorIndex* anArray);
    1.89 +	virtual TInt SetMode(TVideoMode aMode);
    1.90 +private:
    1.91 +	TUint8* CharPosToScreenAddress(const TPoint& aCharPos);
    1.92 +	TInt ColorToPixel(TInt aColorRgb);
    1.93 +	void CalcColorMode();
    1.94 +private:
    1.95 +	TInt iDisplayMode;
    1.96 +	TInt iMode;
    1.97 +	TInt iScreenAddress;
    1.98 +	TInt iScreenWidth;
    1.99 +	TInt iScreenHeight;
   1.100 +	TInt iScreenOffsetBetweenLines;
   1.101 +	TInt iBitsPerPixel;
   1.102 +	TInt iIsMono;
   1.103 +	TInt iIsPalettized;
   1.104 +	TInt iPixelSize;
   1.105 +	TInt iBackgroundPixel;
   1.106 +	TInt iTextPixel;
   1.107 +	TUint32 iBackgroundFill;
   1.108 +	TUint32 iTextFill;
   1.109 +	TUint32 iHwAcc;
   1.110 +	static const TUint8 Reverse[256];
   1.111 +	static const TUint8 Font[256][10];
   1.112 +	friend class CScreenDriver;
   1.113 +	};
   1.114 +
   1.115 +
   1.116 +/**
   1.117 + * Table used to reverse the bits in a byte
   1.118 + *
   1.119 + * For example, index 0x03 (= 0000 0011 binary)
   1.120 + * returns 0xC0 (= 1100 0000 binary)
   1.121 + */
   1.122 +const TUint8 CScreenDriverTemplate::Reverse[256] =
   1.123 +	{
   1.124 +	0x00,0x80,0x40,0xC0,0x20,0xA0,0x60,0xE0,0x10,0x90,0x50,0xD0,0x30,0xB0,0x70,0xF0,
   1.125 +	0x08,0x88,0x48,0xC8,0x28,0xA8,0x68,0xE8,0x18,0x98,0x58,0xD8,0x38,0xB8,0x78,0xF8,
   1.126 +	0x04,0x84,0x44,0xC4,0x24,0xA4,0x64,0xE4,0x14,0x94,0x54,0xD4,0x34,0xB4,0x74,0xF4,
   1.127 +	0x0C,0x8C,0x4C,0xCC,0x2C,0xAC,0x6C,0xEC,0x1C,0x9C,0x5C,0xDC,0x3C,0xBC,0x7C,0xFC,
   1.128 +	0x02,0x82,0x42,0xC2,0x22,0xA2,0x62,0xE2,0x12,0x92,0x52,0xD2,0x32,0xB2,0x72,0xF2,
   1.129 +	0x0A,0x8A,0x4A,0xCA,0x2A,0xAA,0x6A,0xEA,0x1A,0x9A,0x5A,0xDA,0x3A,0xBA,0x7A,0xFA,
   1.130 +	0x06,0x86,0x46,0xC6,0x26,0xA6,0x66,0xE6,0x16,0x96,0x56,0xD6,0x36,0xB6,0x76,0xF6,
   1.131 +	0x0E,0x8E,0x4E,0xCE,0x2E,0xAE,0x6E,0xEE,0x1E,0x9E,0x5E,0xDE,0x3E,0xBE,0x7E,0xFE,
   1.132 +	0x01,0x81,0x41,0xC1,0x21,0xA1,0x61,0xE1,0x11,0x91,0x51,0xD1,0x31,0xB1,0x71,0xF1,
   1.133 +	0x09,0x89,0x49,0xC9,0x29,0xA9,0x69,0xE9,0x19,0x99,0x59,0xD9,0x39,0xB9,0x79,0xF9,
   1.134 +	0x05,0x85,0x45,0xC5,0x25,0xA5,0x65,0xE5,0x15,0x95,0x55,0xD5,0x35,0xB5,0x75,0xF5,
   1.135 +	0x0D,0x8D,0x4D,0xCD,0x2D,0xAD,0x6D,0xED,0x1D,0x9D,0x5D,0xDD,0x3D,0xBD,0x7D,0xFD,
   1.136 +	0x03,0x83,0x43,0xC3,0x23,0xA3,0x63,0xE3,0x13,0x93,0x53,0xD3,0x33,0xB3,0x73,0xF3,
   1.137 +	0x0B,0x8B,0x4B,0xCB,0x2B,0xAB,0x6B,0xEB,0x1B,0x9B,0x5B,0xDB,0x3B,0xBB,0x7B,0xFB,
   1.138 +	0x07,0x87,0x47,0xC7,0x27,0xA7,0x67,0xE7,0x17,0x97,0x57,0xD7,0x37,0xB7,0x77,0xF7,
   1.139 +	0x0F,0x8F,0x4F,0xCF,0x2F,0xAF,0x6F,0xEF,0x1F,0x9F,0x5F,0xDF,0x3F,0xBF,0x7F,0xFF
   1.140 +	};
   1.141 +
   1.142 +
   1.143 +
   1.144 +/**
   1.145 + * Define a font to be used
   1.146 + * This is an 8x10 Font taken from the MISA driver
   1.147 + * 
   1.148 + * TO DO: (mandatory)
   1.149 + */
   1.150 +const TInt KPixelsPerChar = 8;	// character width in pixels
   1.151 +const TInt KLinesPerChar = 10;	// character height in pixels
   1.152 +
   1.153 +const TUint8 CScreenDriverTemplate::Font[256][10] =
   1.154 + 	{
   1.155 +		{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
   1.156 +		{0x7E,0x81,0xA5,0x81,0xBD,0x99,0x81,0x7E,0x00,0x00},
   1.157 +		{0x7E,0xFF,0xDB,0xFF,0xC3,0xE7,0xFF,0x7E,0x00,0x00},
   1.158 +		{0x6C,0xFE,0xFE,0xFE,0x7C,0x38,0x10,0x00,0x00,0x00},
   1.159 +		{0x10,0x38,0x7C,0xFE,0x7C,0x38,0x10,0x00,0x00,0x00},
   1.160 +		{0x38,0x7C,0x38,0xFE,0xFE,0x7C,0x38,0x7C,0x00,0x00},
   1.161 +		{0x10,0x10,0x38,0x7C,0xFE,0x7C,0x38,0x7C,0x00,0x00},
   1.162 +		{0x00,0x00,0x18,0x3C,0x3C,0x18,0x00,0x00,0x00,0x00},
   1.163 +		{0xFF,0xFF,0xE7,0xC3,0xC3,0xE7,0xFF,0xFF,0x00,0x00},
   1.164 +		{0x00,0x3C,0x66,0x42,0x42,0x66,0x3C,0x00,0x00,0x00},
   1.165 +		{0xFF,0xC3,0x99,0xBD,0xBD,0x99,0xC3,0xFF,0x00,0x00},
   1.166 +		{0x0F,0x07,0x0F,0x7D,0xCC,0xCC,0xCC,0x78,0x00,0x00},
   1.167 +		{0x3C,0x66,0x66,0x66,0x3C,0x18,0x7E,0x18,0x00,0x00},
   1.168 +		{0x3F,0x33,0x3F,0x30,0x30,0x70,0xF0,0xE0,0x00,0x00},
   1.169 +		{0x7F,0x63,0x7F,0x63,0x63,0x67,0xE6,0xC0,0x00,0x00},
   1.170 +		{0x99,0x5A,0x3C,0xE7,0xE7,0x3C,0x5A,0x99,0x00,0x00},
   1.171 +
   1.172 +		{0x80,0xE0,0xF8,0xFE,0xF8,0xE0,0x80,0x00,0x00,0x00},
   1.173 +		{0x02,0x0E,0x3E,0xFE,0x3E,0x0E,0x02,0x00,0x00,0x00},
   1.174 +		{0x18,0x3C,0x7E,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00},
   1.175 +		{0x66,0x66,0x66,0x66,0x66,0x00,0x66,0x00,0x00,0x00},
   1.176 +		{0x7F,0xDB,0xDB,0x7B,0x1B,0x1B,0x1B,0x00,0x00,0x00},
   1.177 +		{0x3E,0x63,0x38,0x6C,0x6C,0x38,0xCC,0x78,0x00,0x00},
   1.178 +		{0x00,0x00,0x00,0x00,0x7E,0x7E,0x7E,0x00,0x00,0x00},
   1.179 +		{0x18,0x3C,0x7E,0x18,0x7E,0x3C,0x18,0xFF,0x00,0x00},
   1.180 +		{0x18,0x3C,0x7E,0x18,0x18,0x18,0x18,0x00,0x00,0x00},
   1.181 +		{0x18,0x18,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00,0x00},
   1.182 +		{0x00,0x18,0x0C,0xFE,0x0C,0x18,0x00,0x00,0x00,0x00},
   1.183 +		{0x00,0x30,0x60,0xFE,0x60,0x30,0x00,0x00,0x00,0x00},
   1.184 +		{0x00,0x00,0xC0,0xC0,0xC0,0xFE,0x00,0x00,0x00,0x00},
   1.185 +		{0x00,0x24,0x66,0xFF,0x66,0x24,0x00,0x00,0x00,0x00},
   1.186 +		{0x00,0x18,0x3C,0x7E,0xFF,0xFF,0x00,0x00,0x00,0x00},
   1.187 +		{0x00,0xFF,0xFF,0x7E,0x3C,0x18,0x00,0x00,0x00,0x00},
   1.188 +
   1.189 +		{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
   1.190 +		{0x30,0x78,0x78,0x78,0x30,0x00,0x30,0x00,0x00,0x00},	// !
   1.191 +		{0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
   1.192 +		{0x6C,0x6C,0xFE,0x6C,0xFE,0x6C,0x6C,0x00,0x00,0x00},	//#
   1.193 +		{0x30,0x7C,0xC0,0x78,0x0C,0xF8,0x30,0x00,0x00,0x00},	//$
   1.194 +		{0x00,0xC6,0xCC,0x18,0x30,0x66,0xC6,0x00,0x00,0x00},
   1.195 +		{0x38,0x6C,0x38,0x76,0xDC,0xCC,0x76,0x00,0x00,0x00},
   1.196 +		{0x60,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
   1.197 +		{0x18,0x30,0x60,0x60,0x60,0x30,0x18,0x00,0x00,0x00},
   1.198 +		{0x60,0x30,0x18,0x18,0x18,0x30,0x60,0x00,0x00,0x00},
   1.199 +		{0x00,0x66,0x3C,0xFF,0x3C,0x66,0x00,0x00,0x00,0x00},
   1.200 +		{0x00,0x30,0x30,0xFC,0x30,0x30,0x00,0x00,0x00,0x00},
   1.201 +		{0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00,0x00},
   1.202 +		{0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00},	//-
   1.203 +		{0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00},	//.
   1.204 +		{0x06,0x0C,0x18,0x30,0x60,0xC0,0x80,0x00,0x00,0x00},	///
   1.205 +
   1.206 +		{0x7C,0xC6,0xCE,0xDE,0xF6,0xE6,0x7C,0x00,0x00,0x00},	//0
   1.207 +		{0x30,0x70,0x30,0x30,0x30,0x30,0xFC,0x00,0x00,0x00},
   1.208 +		{0x78,0xCC,0x0C,0x38,0x60,0xCC,0xFC,0x00,0x00,0x00},
   1.209 +		{0x78,0xCC,0x0C,0x38,0x0C,0xCC,0x78,0x00,0x00,0x00},
   1.210 +		{0x1C,0x3C,0x6C,0xCC,0xFE,0x0C,0x1E,0x00,0x00,0x00},
   1.211 +		{0xFC,0xC0,0xF8,0x0C,0x0C,0xCC,0x78,0x00,0x00,0x00},
   1.212 +		{0x38,0x60,0xC0,0xF8,0xCC,0xCC,0x78,0x00,0x00,0x00},
   1.213 +		{0xFC,0xCC,0x0C,0x18,0x30,0x30,0x30,0x00,0x00,0x00},
   1.214 +		{0x78,0xCC,0xCC,0x78,0xCC,0xCC,0x78,0x00,0x00,0x00},
   1.215 +		{0x78,0xCC,0xCC,0x7C,0x0C,0x18,0x70,0x00,0x00,0x00},	//9
   1.216 +		{0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x00,0x00,0x00},	//:
   1.217 +		{0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x60,0x00,0x00},	//;
   1.218 +		{0x18,0x30,0x60,0xC0,0x60,0x30,0x18,0x00,0x00,0x00},	//<
   1.219 +		{0x00,0x00,0xFC,0x00,0x00,0xFC,0x00,0x00,0x00,0x00},	//=
   1.220 +		{0x60,0x30,0x18,0x0C,0x18,0x30,0x60,0x00,0x00,0x00},	//>
   1.221 +		{0x78,0xCC,0x0C,0x18,0x30,0x00,0x30,0x00,0x00,0x00},	//?
   1.222 +
   1.223 +		{0x7C,0xC6,0xDE,0xDE,0xDE,0xC0,0x78,0x00,0x00,0x00},	//@
   1.224 +		{0x30,0x78,0xCC,0xCC,0xFC,0xCC,0xCC,0x00,0x00,0x00},	//A
   1.225 +		{0xFC,0x66,0x66,0x7C,0x66,0x66,0xFC,0x00,0x00,0x00},	//B
   1.226 +		{0x3C,0x66,0xC0,0xC0,0xC0,0x66,0x3C,0x00,0x00,0x00},	//C
   1.227 +		{0xF8,0x6C,0x66,0x66,0x66,0x6C,0xF8,0x00,0x00,0x00},	//D
   1.228 +		{0x7E,0x60,0x60,0x78,0x60,0x60,0x7E,0x00,0x00,0x00},	//E
   1.229 +		{0x7E,0x60,0x60,0x78,0x60,0x60,0x60,0x00,0x00,0x00},	//F
   1.230 +		{0x3C,0x66,0xC0,0xC0,0xCE,0x66,0x3E,0x00,0x00,0x00},	//G
   1.231 +		{0xCC,0xCC,0xCC,0xFC,0xCC,0xCC,0xCC,0x00,0x00,0x00},	//H
   1.232 +		{0x78,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00},	//I
   1.233 +		{0x1E,0x0C,0x0C,0x0C,0xCC,0xCC,0x78,0x00,0x00,0x00},	//J
   1.234 +		{0xE6,0x66,0x6C,0x78,0x6C,0x66,0xE6,0x00,0x00,0x00},	//K
   1.235 +		{0x60,0x60,0x60,0x60,0x60,0x60,0x7E,0x00,0x00,0x00},	//L
   1.236 +		{0xC6,0xEE,0xFE,0xFE,0xD6,0xC6,0xC6,0x00,0x00,0x00},	//M
   1.237 +		{0xC6,0xE6,0xF6,0xDE,0xCE,0xC6,0xC6,0x00,0x00,0x00},	//N
   1.238 +		{0x38,0x6C,0xC6,0xC6,0xC6,0x6C,0x38,0x00,0x00,0x00},	//O
   1.239 +
   1.240 +		{0xFC,0x66,0x66,0x7C,0x60,0x60,0xF0,0x00,0x00,0x00},	//P
   1.241 +		{0x78,0xCC,0xCC,0xCC,0xDC,0x78,0x1C,0x00,0x00,0x00},	//Q
   1.242 +		{0xFC,0x66,0x66,0x7C,0x6C,0x66,0xE6,0x00,0x00,0x00},	//R
   1.243 +		{0x78,0xCC,0xE0,0x70,0x1C,0xCC,0x78,0x00,0x00,0x00},	//S
   1.244 +		{0xFC,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x00},	//T
   1.245 +		{0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xFC,0x00,0x00,0x00},	//U
   1.246 +		{0xCC,0xCC,0xCC,0xCC,0xCC,0x78,0x30,0x00,0x00,0x00},	//V
   1.247 +		{0xC6,0xC6,0xC6,0xD6,0xFE,0xEE,0xC6,0x00,0x00,0x00},	//W
   1.248 +		{0xC6,0xC6,0x6C,0x38,0x38,0x6C,0xC6,0x00,0x00,0x00},	//X
   1.249 +		{0xCC,0xCC,0xCC,0x78,0x30,0x30,0x78,0x00,0x00,0x00},	//Y
   1.250 +		{0xFE,0x06,0x0C,0x18,0x30,0x60,0xFE,0x00,0x00,0x00},	//Z
   1.251 +		{0x78,0x60,0x60,0x60,0x60,0x60,0x78,0x00,0x00,0x00},
   1.252 +		{0xC0,0x60,0x30,0x18,0x0C,0x06,0x02,0x00,0x00,0x00},
   1.253 +		{0x78,0x18,0x18,0x18,0x18,0x18,0x78,0x00,0x00,0x00},
   1.254 +		{0x10,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00,0x00,0x00},
   1.255 +		{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00},
   1.256 +
   1.257 +		{0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
   1.258 +		{0x00,0x00,0x78,0x0C,0x7C,0xCC,0x76,0x00,0x00,0x00},
   1.259 +		{0xE0,0x60,0x60,0x7C,0x66,0x66,0xDC,0x00,0x00,0x00},
   1.260 +		{0x00,0x00,0x78,0xCC,0xC0,0xCC,0x78,0x00,0x00,0x00},
   1.261 +		{0x1C,0x0C,0x0C,0x7C,0xCC,0xCC,0x76,0x00,0x00,0x00},
   1.262 +		{0x00,0x00,0x78,0xCC,0xFC,0xC0,0x78,0x00,0x00,0x00},
   1.263 +		{0x38,0x6C,0x60,0xF0,0x60,0x60,0xF0,0x00,0x00,0x00},
   1.264 +		{0x00,0x00,0x76,0xCC,0xCC,0x7C,0x0C,0xF8,0x00,0x00},
   1.265 +		{0xE0,0x60,0x6C,0x76,0x66,0x66,0xE6,0x00,0x00,0x00},
   1.266 +		{0x30,0x00,0x70,0x30,0x30,0x30,0x78,0x00,0x00,0x00},
   1.267 +		{0x0C,0x00,0x0C,0x0C,0x0C,0xCC,0xCC,0x78,0x00,0x00},
   1.268 +		{0xE0,0x60,0x66,0x6C,0x78,0x6C,0xE6,0x00,0x00,0x00},
   1.269 +		{0x70,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00},
   1.270 +		{0x00,0x00,0xCC,0xFE,0xFE,0xD6,0xC6,0x00,0x00,0x00},
   1.271 +		{0x00,0x00,0xF8,0xCC,0xCC,0xCC,0xCC,0x00,0x00,0x00},
   1.272 +		{0x00,0x00,0x78,0xCC,0xCC,0xCC,0x78,0x00,0x00,0x00},
   1.273 +
   1.274 +		{0x00,0x00,0xDC,0x66,0x66,0x7C,0x60,0xF0,0x00,0x00},
   1.275 +		{0x00,0x00,0x76,0xCC,0xCC,0x7C,0x0C,0x1E,0x00,0x00},
   1.276 +		{0x00,0x00,0xDC,0x76,0x66,0x60,0xF0,0x00,0x00,0x00},
   1.277 +		{0x00,0x00,0x7C,0xC0,0x78,0x0C,0xF8,0x00,0x00,0x00},
   1.278 +		{0x10,0x30,0x7C,0x30,0x30,0x34,0x18,0x00,0x00,0x00},
   1.279 +		{0x00,0x00,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00},
   1.280 +		{0x00,0x00,0xCC,0xCC,0xCC,0x78,0x30,0x00,0x00,0x00},
   1.281 +		{0x00,0x00,0xC6,0xD6,0xFE,0xFE,0x6C,0x00,0x00,0x00},
   1.282 +		{0x00,0x00,0xC6,0x6C,0x38,0x6C,0xC6,0x00,0x00,0x00},
   1.283 +		{0x00,0x00,0xCC,0xCC,0xCC,0x7C,0x0C,0xF8,0x00,0x00},
   1.284 +		{0x00,0x00,0xFC,0x98,0x30,0x64,0xFC,0x00,0x00,0x00},
   1.285 +		{0x1C,0x30,0x30,0xE0,0x30,0x30,0x1C,0x00,0x00,0x00},
   1.286 +		{0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x00,0x00,0x00},
   1.287 +		{0xE0,0x30,0x30,0x1C,0x30,0x30,0xE0,0x00,0x00,0x00},
   1.288 +		{0x76,0xDC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
   1.289 +		{0x00,0x10,0x38,0x6C,0xC6,0xC6,0xFE,0x00,0x00,0x00},
   1.290 +
   1.291 +		{0x3C,0x66,0x60,0x66,0x3C,0x0C,0x06,0x3C,0x00,0x00},
   1.292 +		{0x00,0x66,0x00,0x66,0x66,0x66,0x3F,0x00,0x00,0x00},
   1.293 +		{0x0E,0x00,0x3C,0x66,0x7E,0x60,0x3C,0x00,0x00,0x00},
   1.294 +		{0x7E,0xC3,0x3C,0x06,0x3E,0x66,0x3F,0x00,0x00,0x00},
   1.295 +		{0x66,0x00,0x3C,0x06,0x3E,0x66,0x3F,0x00,0x00,0x00},
   1.296 +		{0x70,0x00,0x3C,0x06,0x3E,0x66,0x3F,0x00,0x00,0x00},
   1.297 +		{0x18,0x18,0x3C,0x06,0x3E,0x66,0x3F,0x00,0x00,0x00},
   1.298 +		{0x00,0x00,0x3C,0x60,0x60,0x3C,0x06,0x1C,0x00,0x00},
   1.299 +		{0x7E,0xC3,0x3C,0x66,0x7E,0x60,0x3C,0x00,0x00,0x00},
   1.300 +		{0x66,0x00,0x3C,0x66,0x7E,0x60,0x3C,0x00,0x00,0x00},
   1.301 +		{0x70,0x00,0x3C,0x66,0x7E,0x60,0x3C,0x00,0x00,0x00},
   1.302 +		{0x66,0x00,0x38,0x18,0x18,0x18,0x3C,0x00,0x00,0x00},
   1.303 +		{0x7C,0xC6,0x38,0x18,0x18,0x18,0x3C,0x00,0x00,0x00},
   1.304 +		{0x70,0x00,0x38,0x18,0x18,0x18,0x3C,0x00,0x00,0x00},
   1.305 +		{0x63,0x1C,0x36,0x63,0x7F,0x63,0x63,0x00,0x00,0x00},
   1.306 +		{0x18,0x18,0x00,0x3C,0x66,0x7E,0x66,0x00,0x00,0x00},
   1.307 +
   1.308 +		{0x0E,0x00,0x7E,0x30,0x3C,0x30,0x7E,0x00,0x00,0x00},
   1.309 +		{0x00,0x00,0x7F,0x0C,0x7F,0xCC,0x7F,0x00,0x00,0x00},
   1.310 +		{0x1F,0x36,0x66,0x7F,0x66,0x66,0x67,0x00,0x00,0x00},
   1.311 +		{0x3C,0x66,0x00,0x3C,0x66,0x66,0x3C,0x00,0x00,0x00},
   1.312 +		{0x00,0x66,0x00,0x3C,0x66,0x66,0x3C,0x00,0x00,0x00},
   1.313 +		{0x00,0x70,0x00,0x3C,0x66,0x66,0x3C,0x00,0x00,0x00},
   1.314 +		{0x3C,0x66,0x00,0x66,0x66,0x66,0x3F,0x00,0x00,0x00},
   1.315 +		{0x00,0x70,0x00,0x66,0x66,0x66,0x3F,0x00,0x00,0x00},
   1.316 +		{0x00,0x66,0x00,0x66,0x66,0x3E,0x06,0x7C,0x00,0x00},
   1.317 +		{0xC3,0x18,0x3C,0x66,0x66,0x3C,0x18,0x00,0x00,0x00},
   1.318 +		{0x66,0x00,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00},
   1.319 +		{0x18,0x18,0x7E,0xC0,0xC0,0x7E,0x18,0x18,0x00,0x00},
   1.320 +		{0x1C,0x36,0x32,0x78,0x30,0x73,0x7E,0x00,0x00,0x00},	//£
   1.321 +		{0x66,0x66,0x3C,0x7E,0x18,0x7E,0x18,0x18,0x00,0x00},
   1.322 +		{0xF8,0xCC,0xCC,0xFA,0xC6,0xCF,0xC6,0xC7,0x00,0x00},
   1.323 +		{0x0E,0x1B,0x18,0x3C,0x18,0x18,0xD8,0x70,0x00,0x00},
   1.324 +
   1.325 +		{0x0E,0x00,0x3C,0x06,0x3E,0x66,0x3F,0x00,0x00,0x00},
   1.326 +		{0x1C,0x00,0x38,0x18,0x18,0x18,0x3C,0x00,0x00,0x00},
   1.327 +		{0x00,0x0E,0x00,0x3C,0x66,0x66,0x3C,0x00,0x00,0x00},
   1.328 +		{0x00,0x0E,0x00,0x66,0x66,0x66,0x3F,0x00,0x00,0x00},
   1.329 +		{0x00,0x7C,0x00,0x7C,0x66,0x66,0x66,0x00,0x00,0x00},
   1.330 +		{0x7E,0x00,0x66,0x76,0x7E,0x6E,0x66,0x00,0x00,0x00},
   1.331 +		{0x3C,0x6C,0x6C,0x3E,0x00,0x7E,0x00,0x00,0x00,0x00},
   1.332 +		{0x38,0x6C,0x6C,0x38,0x00,0x7C,0x00,0x00,0x00,0x00},
   1.333 +		{0x18,0x00,0x18,0x30,0x60,0x66,0x3C,0x00,0x00,0x00},
   1.334 +		{0x00,0x00,0x00,0x7E,0x60,0x60,0x00,0x00,0x00,0x00},
   1.335 +		{0x00,0x00,0x00,0x7E,0x06,0x06,0x00,0x00,0x00,0x00},
   1.336 +		{0xC3,0xC6,0xCC,0xDE,0x33,0x66,0xCC,0x0F,0x00,0x00},
   1.337 +		{0xC3,0xC6,0xCC,0xDB,0x37,0x6F,0xCF,0x03,0x00,0x00},
   1.338 +		{0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x00,0x00,0x00},
   1.339 +		{0x00,0x33,0x66,0xCC,0x66,0x33,0x00,0x00,0x00,0x00},
   1.340 +		{0x00,0xCC,0x66,0x33,0x66,0xCC,0x00,0x00,0x00,0x00},
   1.341 +
   1.342 +		{0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x00,0x00},
   1.343 +		{0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA},
   1.344 +		{0xDB,0x77,0xDB,0xEE,0xDB,0x77,0xDB,0xEE,0xDB,0x77},
   1.345 +		{0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18},
   1.346 +		{0x18,0x18,0x18,0x18,0xF8,0x18,0x18,0x18,0x18,0x18},
   1.347 +		{0x18,0x18,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18},
   1.348 +		{0x36,0x36,0x36,0x36,0xF6,0x36,0x36,0x36,0x36,0x36},
   1.349 +		{0x00,0x00,0x00,0x00,0xFE,0x36,0x36,0x36,0x36,0x36},
   1.350 +		{0x00,0x00,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18},
   1.351 +		{0x36,0x36,0xF6,0x06,0xF6,0x36,0x36,0x36,0x36,0x36},
   1.352 +		{0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36},
   1.353 +		{0x00,0x00,0xFE,0x06,0xF6,0x36,0x36,0x36,0x36,0x36},
   1.354 +		{0x36,0x36,0xF6,0x06,0xFE,0x00,0x00,0x00,0x00,0x00},
   1.355 +		{0x36,0x36,0x36,0x36,0xFE,0x00,0x00,0x00,0x00,0x00},
   1.356 +		{0x18,0x18,0xF8,0x18,0xF8,0x00,0x00,0x00,0x00,0x00},
   1.357 +		{0x00,0x00,0x00,0x00,0xF8,0x18,0x18,0x18,0x18,0x18},
   1.358 +
   1.359 +		{0x18,0x18,0x18,0x18,0x1F,0x00,0x00,0x00,0x00,0x00},
   1.360 +		{0x18,0x18,0x18,0x18,0xFF,0x00,0x00,0x00,0x00,0x00},
   1.361 +		{0x00,0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18},
   1.362 +		{0x18,0x18,0x18,0x18,0x1F,0x18,0x18,0x18,0x18,0x18},
   1.363 +		{0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00},
   1.364 +		{0x18,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x18,0x18},
   1.365 +		{0x18,0x18,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18},
   1.366 +		{0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x36,0x36},
   1.367 +		{0x36,0x36,0x37,0x30,0x3F,0x00,0x00,0x00,0x00,0x00},
   1.368 +		{0x00,0x00,0x3F,0x30,0x37,0x36,0x36,0x36,0x36,0x36},
   1.369 +		{0x36,0x36,0xF7,0x00,0xFF,0x00,0x00,0x00,0x00,0x00},
   1.370 +		{0x00,0x00,0xFF,0x00,0xF7,0x36,0x36,0x36,0x36,0x36},
   1.371 +		{0x36,0x36,0x37,0x30,0x37,0x36,0x36,0x36,0x36,0x36},
   1.372 +		{0x00,0x00,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00},
   1.373 +		{0x36,0x36,0xF7,0x00,0xF7,0x36,0x36,0x36,0x36,0x36},
   1.374 +		{0x18,0x18,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00},
   1.375 +
   1.376 +		{0x36,0x36,0x36,0x36,0xFF,0x00,0x00,0x00,0x00,0x00},
   1.377 +		{0x00,0x00,0xFF,0x00,0xFF,0x18,0x18,0x18,0x18,0x18},
   1.378 +		{0x00,0x00,0x00,0x00,0xFF,0x36,0x36,0x36,0x36,0x36},
   1.379 +		{0x36,0x36,0x36,0x36,0x3F,0x00,0x00,0x00,0x00,0x00},
   1.380 +		{0x18,0x18,0x1F,0x18,0x1F,0x00,0x00,0x00,0x00,0x00},
   1.381 +		{0x00,0x00,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18},
   1.382 +		{0x00,0x00,0x00,0x00,0x3F,0x36,0x36,0x36,0x36,0x36},
   1.383 +		{0x36,0x36,0x36,0x36,0xFF,0x36,0x36,0x36,0x36,0x36},
   1.384 +		{0x18,0x18,0xFF,0x18,0xFF,0x18,0x18,0x18,0x18,0x18},
   1.385 +		{0x18,0x18,0x18,0x18,0xF8,0x00,0x00,0x00,0x00,0x00},
   1.386 +		{0x00,0x00,0x00,0x00,0x1F,0x18,0x18,0x18,0x18,0x18},
   1.387 +		{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00},
   1.388 +		{0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00},
   1.389 +		{0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0x00,0x00},
   1.390 +		{0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x00,0x00},
   1.391 +		{0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00},
   1.392 +
   1.393 +		{0x00,0x00,0x3B,0x6E,0x64,0x6E,0x3B,0x00,0x00,0x00},
   1.394 +		{0x00,0x3C,0x66,0x7C,0x66,0x7C,0x60,0x60,0x00,0x00},
   1.395 +		{0x00,0x7E,0x66,0x60,0x60,0x60,0x60,0x00,0x00,0x00},
   1.396 +		{0x00,0x7F,0x36,0x36,0x36,0x36,0x36,0x00,0x00,0x00},
   1.397 +		{0x7E,0x66,0x30,0x18,0x30,0x66,0x7E,0x00,0x00,0x00},
   1.398 +		{0x00,0x00,0x3F,0x6C,0x6C,0x6C,0x38,0x00,0x00,0x00},
   1.399 +		{0x00,0x33,0x33,0x33,0x33,0x3E,0x30,0x60,0x00,0x00},
   1.400 +		{0x00,0x3B,0x6E,0x0C,0x0C,0x0C,0x0C,0x00,0x00,0x00},
   1.401 +		{0x7E,0x18,0x3C,0x66,0x66,0x3C,0x18,0x7E,0x00,0x00},
   1.402 +		{0x1C,0x36,0x63,0x7F,0x63,0x36,0x1C,0x00,0x00,0x00},
   1.403 +		{0x1C,0x36,0x63,0x63,0x36,0x36,0x77,0x00,0x00,0x00},
   1.404 +		{0x0E,0x18,0x0C,0x3E,0x66,0x66,0x3C,0x00,0x00,0x00},
   1.405 +		{0x00,0x00,0x7E,0xDB,0xDB,0x7E,0x00,0x00,0x00,0x00},
   1.406 +		{0x06,0x0C,0x7E,0xDB,0xDB,0x7E,0x60,0xC0,0x00,0x00},
   1.407 +		{0x1C,0x60,0xC0,0xFC,0xC0,0x60,0x1C,0x00,0x00,0x00},
   1.408 +		{0x3C,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00},
   1.409 +
   1.410 +		{0x00,0x7E,0x00,0x7E,0x00,0x7E,0x00,0x00,0x00,0x00},
   1.411 +		{0x18,0x18,0x7E,0x18,0x18,0x00,0x7E,0x00,0x00,0x00},
   1.412 +		{0x30,0x18,0x0C,0x18,0x30,0x00,0x7E,0x00,0x00,0x00},
   1.413 +		{0x0C,0x18,0x30,0x18,0x0C,0x00,0x7E,0x00,0x00,0x00},
   1.414 +		{0x0E,0x1B,0x1B,0x18,0x18,0x18,0x18,0x18,0x00,0x00},
   1.415 +		{0x18,0x18,0x18,0x18,0x18,0xD8,0xD8,0x70,0x00,0x00},
   1.416 +		{0x18,0x18,0x00,0x7E,0x00,0x18,0x18,0x00,0x00,0x00},
   1.417 +		{0x00,0x76,0xDC,0x00,0x76,0xDC,0x00,0x00,0x00,0x00},
   1.418 +		{0x38,0x6C,0x6C,0x38,0x00,0x00,0x00,0x00,0x00,0x00},
   1.419 +		{0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00},
   1.420 +		{0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00},
   1.421 +		{0x0F,0x0C,0x0C,0x0C,0xEC,0x6C,0x3C,0x1C,0x00,0x00},
   1.422 +		{0x78,0x6C,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00},
   1.423 +		{0x70,0x18,0x30,0x60,0x78,0x00,0x00,0x00,0x00,0x00},
   1.424 +		{0x00,0x00,0x3C,0x3C,0x3C,0x3C,0x00,0x00,0x00,0x00},
   1.425 +		{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
   1.426 +	};
   1.427 +
   1.428 +
   1.429 +
   1.430 +/**
   1.431 + * A copy of the standard 256 color palette used by the SymbianOS.
   1.432 + * Each value is in the format 00000000bbbbbbbbggggggggrrrrrrrr
   1.433 + */
   1.434 +const TUint32 Palette256[256] =
   1.435 +	{
   1.436 +	0x00000000,	0x00000033,	0x00000066,	0x00000099,	0x000000cc,	0x000000ff,
   1.437 +	0x00003300,	0x00003333,	0x00003366,	0x00003399,	0x000033cc,	0x000033ff,
   1.438 +	0x00006600,	0x00006633,	0x00006666,	0x00006699,	0x000066cc,	0x000066ff,
   1.439 +	0x00009900,	0x00009933,	0x00009966,	0x00009999,	0x000099cc,	0x000099ff,
   1.440 +	0x0000cc00,	0x0000cc33,	0x0000cc66,	0x0000cc99,	0x0000cccc,	0x0000ccff,
   1.441 +	0x0000ff00,	0x0000ff33,	0x0000ff66,	0x0000ff99,	0x0000ffcc,	0x0000ffff,
   1.442 +
   1.443 +	0x00330000,	0x00330033,	0x00330066,	0x00330099,	0x003300cc,	0x003300ff,
   1.444 +	0x00333300,	0x00333333,	0x00333366,	0x00333399,	0x003333cc,	0x003333ff,
   1.445 +	0x00336600,	0x00336633,	0x00336666,	0x00336699,	0x003366cc,	0x003366ff,
   1.446 +	0x00339900,	0x00339933,	0x00339966,	0x00339999,	0x003399cc,	0x003399ff,
   1.447 +	0x0033cc00,	0x0033cc33,	0x0033cc66,	0x0033cc99,	0x0033cccc,	0x0033ccff,
   1.448 +	0x0033ff00,	0x0033ff33,	0x0033ff66,	0x0033ff99,	0x0033ffcc,	0x0033ffff,
   1.449 +
   1.450 +	0x00660000,	0x00660033,	0x00660066,	0x00660099,	0x006600cc,	0x006600ff,
   1.451 +	0x00663300,	0x00663333,	0x00663366,	0x00663399,	0x006633cc,	0x006633ff,
   1.452 +	0x00666600,	0x00666633,	0x00666666,	0x00666699,	0x006666cc,	0x006666ff,
   1.453 +	0x00669900,	0x00669933,	0x00669966,	0x00669999,	0x006699cc,	0x006699ff,
   1.454 +	0x0066cc00,	0x0066cc33,	0x0066cc66,	0x0066cc99,	0x0066cccc,	0x0066ccff,
   1.455 +	0x0066ff00,	0x0066ff33,	0x0066ff66,	0x0066ff99,	0x0066ffcc,	0x0066ffff,
   1.456 +
   1.457 +	0x00111111, 0x00222222, 0x00444444, 0x00555555, 0x00777777,
   1.458 +	0x00000011, 0x00000022, 0x00000044, 0x00000055, 0x00000077,
   1.459 +	0x00001100,	0x00002200,	0x00004400,	0x00005500,	0x00007700,
   1.460 +	0x00110000,	0x00220000,	0x00440000,	0x00550000,	0x00770000,
   1.461 +
   1.462 +	0x00880000,	0x00aa0000,	0x00bb0000,	0x00dd0000,	0x00ee0000,
   1.463 +	0x00008800,	0x0000aa00,	0x0000bb00,	0x0000dd00,	0x0000ee00,
   1.464 +	0x00000088,	0x000000aa,	0x000000bb,	0x000000dd,	0x000000ee,
   1.465 +	0x00888888, 0x00aaaaaa, 0x00bbbbbb, 0x00dddddd, 0x00eeeeee,
   1.466 +
   1.467 +	0x00990000,	0x00990033,	0x00990066,	0x00990099,	0x009900cc,	0x009900ff,
   1.468 +	0x00993300,	0x00993333,	0x00993366,	0x00993399,	0x009933cc,	0x009933ff,
   1.469 +	0x00996600,	0x00996633,	0x00996666,	0x00996699,	0x009966cc,	0x009966ff,
   1.470 +	0x00999900,	0x00999933,	0x00999966,	0x00999999,	0x009999cc,	0x009999ff,
   1.471 +	0x0099cc00,	0x0099cc33,	0x0099cc66,	0x0099cc99,	0x0099cccc,	0x0099ccff,
   1.472 +	0x0099ff00,	0x0099ff33,	0x0099ff66,	0x0099ff99,	0x0099ffcc,	0x0099ffff,
   1.473 +
   1.474 +	0x00cc0000,	0x00cc0033,	0x00cc0066,	0x00cc0099,	0x00cc00cc,	0x00cc00ff,
   1.475 +	0x00cc3300,	0x00cc3333,	0x00cc3366,	0x00cc3399,	0x00cc33cc,	0x00cc33ff,
   1.476 +	0x00cc6600,	0x00cc6633,	0x00cc6666,	0x00cc6699,	0x00cc66cc,	0x00cc66ff,
   1.477 +	0x00cc9900,	0x00cc9933,	0x00cc9966,	0x00cc9999,	0x00cc99cc,	0x00cc99ff,
   1.478 +	0x00cccc00,	0x00cccc33,	0x00cccc66,	0x00cccc99,	0x00cccccc,	0x00ccccff,
   1.479 +	0x00ccff00,	0x00ccff33,	0x00ccff66,	0x00ccff99,	0x00ccffcc,	0x00ccffff,
   1.480 +
   1.481 +	0x00ff0000,	0x00ff0033,	0x00ff0066,	0x00ff0099,	0x00ff00cc,	0x00ff00ff,
   1.482 +	0x00ff3300,	0x00ff3333,	0x00ff3366,	0x00ff3399,	0x00ff33cc,	0x00ff33ff,
   1.483 +	0x00ff6600,	0x00ff6633,	0x00ff6666,	0x00ff6699,	0x00ff66cc,	0x00ff66ff,
   1.484 +	0x00ff9900,	0x00ff9933,	0x00ff9966,	0x00ff9999,	0x00ff99cc,	0x00ff99ff,
   1.485 +	0x00ffcc00,	0x00ffcc33,	0x00ffcc66,	0x00ffcc99,	0x00ffcccc,	0x00ffccff,
   1.486 +	0x00ffff00,	0x00ffff33,	0x00ffff66,	0x00ffff99,	0x00ffffcc,	0x00ffffff
   1.487 +	};
   1.488 +
   1.489 +/**
   1.490 + * Construct and return the new screen driver
   1.491 + */
   1.492 +EXPORT_C CScreenDriver* CScreenDriver::New()
   1.493 +	{
   1.494 +	__DEBUG_PRINT(_L("CSD::New"));
   1.495 +
   1.496 +#ifdef __X86__
   1.497 +	TInt mode=0;
   1.498 +	HAL::Get(HAL::EDisplayMode, mode);
   1.499 +	if (mode==0)
   1.500 +		return NewScreenDriverVgaText();
   1.501 +#endif
   1.502 +	CScreenDriverTemplate *pS=new CScreenDriverTemplate;
   1.503 +	if (pS->iScreenAddress)
   1.504 +		{
   1.505 +		return(pS);
   1.506 +		}
   1.507 +	delete pS;
   1.508 +	return(NULL);
   1.509 +	}
   1.510 +
   1.511 +
   1.512 +
   1.513 +/**
   1.514 + * Implementation of the screen driver
   1.515 + * Constructor
   1.516 + */
   1.517 +
   1.518 +CScreenDriverTemplate::CScreenDriverTemplate()
   1.519 +	{
   1.520 +
   1.521 +	__DEBUG_PRINT(_L("CSD::Ctor"));
   1.522 +	
   1.523 +	//
   1.524 +	// Start in default mode the display driver is in
   1.525 +	//
   1.526 +	TInt offset;
   1.527 +	TInt r = HAL::Get(HAL::EDisplayMode, iDisplayMode);
   1.528 +	if(r!=KErrNone)
   1.529 +		goto fail;
   1.530 +	__DEBUG_PRINT2(_L("EDisplayMode %d"), iDisplayMode);
   1.531 +	
   1.532 +	iBitsPerPixel = iDisplayMode; //getbpp needs the current mode as its param
   1.533 +	r = HAL::Get(HAL::EDisplayBitsPerPixel,iBitsPerPixel);	
   1.534 +	if(r!=KErrNone)
   1.535 +		goto fail;
   1.536 +	__DEBUG_PRINT2(_L("EDisplayBitsPerPixel %d"), iBitsPerPixel);
   1.537 +
   1.538 +	iIsPalettized = iDisplayMode; //ispalettized needs the current mode as its param
   1.539 +	r = HAL::Get(HAL::EDisplayIsPalettized,iIsPalettized);	
   1.540 +	if(r!=KErrNone)
   1.541 +		goto fail;
   1.542 +	__DEBUG_PRINT2(_L("EDisplayIsPalettized %d"),iIsPalettized);
   1.543 +
   1.544 +	iIsMono = iDisplayMode; //ispalettized needs the current mode as its param
   1.545 +	r = HAL::Get(HAL::EDisplayIsMono, iIsMono);	
   1.546 +	if(r!=KErrNone)
   1.547 +		goto fail;
   1.548 +	__DEBUG_PRINT2(_L("EDisplayIsMono  %d"), iIsMono);
   1.549 +
   1.550 +	
   1.551 +	CalcColorMode();
   1.552 +
   1.553 +	__DEBUG_PRINT2(_L("iMode is %d"),iMode);
   1.554 +	//
   1.555 +	// Obtain the screen info from HAL
   1.556 +	//
   1.557 +	r = HAL::Get(HAL::EDisplayMemoryAddress,iScreenAddress);
   1.558 +	if(r!=KErrNone)
   1.559 +		goto fail;
   1.560 +	__DEBUG_PRINT2(_L("EDisplayMemoryAddress 0x%x"), iScreenAddress);
   1.561 +	
   1.562 +	offset = iDisplayMode;
   1.563 +	r = HAL::Get(HAL::EDisplayOffsetToFirstPixel,offset);
   1.564 +	if(r!=KErrNone)
   1.565 +		goto fail;
   1.566 +	__DEBUG_PRINT2(_L("EDisplayOffsetToFirstPixel  %d"),offset);
   1.567 +	iScreenAddress += offset;
   1.568 +
   1.569 +	iScreenOffsetBetweenLines = iDisplayMode;
   1.570 +	r = HAL::Get(HAL::EDisplayOffsetBetweenLines,iScreenOffsetBetweenLines);
   1.571 +	if(r!=KErrNone)
   1.572 +		goto fail;
   1.573 +	__DEBUG_PRINT2(_L("EDisplayOffsetBetweenLines  %d"), iScreenOffsetBetweenLines);
   1.574 +	
   1.575 +	r = HAL::Get(HAL::EDisplayXPixels,iScreenWidth);
   1.576 +	if(r!=KErrNone)
   1.577 +		goto fail;
   1.578 +	__DEBUG_PRINT2(_L("EDisplayXPixels  %d"),iScreenWidth);
   1.579 +	
   1.580 +	r = HAL::Get(HAL::EDisplayYPixels,iScreenHeight);
   1.581 +	if(r!=KErrNone)
   1.582 +		goto fail;
   1.583 +	__DEBUG_PRINT2(_L("EDisplayYPixels  %d"), iScreenHeight);
   1.584 +
   1.585 +	if(iMode==EColor256)
   1.586 +		{
   1.587 +		// Setup palette (this is the standard SymbianOS 256 colour palette)
   1.588 +		for(TInt i=0; i<256; i++)
   1.589 +			{
   1.590 +			TInt entry = Palette256[i]+(i<<24);
   1.591 +			HAL::Set(HAL::EDisplayPaletteEntry,entry); // Ignore error
   1.592 +			}
   1.593 +	__DEBUG_PRINT(_L("EColor256"));
   1.594 +		}
   1.595 +	else if(iMode==EGray16)
   1.596 +		{
   1.597 +		// Setup palette
   1.598 +		for(TInt i=0; i<16; i++)
   1.599 +			{
   1.600 +			TInt entry = i|(i<<4);
   1.601 +			entry |= entry<<8;
   1.602 +			entry |= entry<<12;
   1.603 +			HAL::Set(HAL::EDisplayPaletteEntry,entry); // Ignore error
   1.604 +			}
   1.605 +	__DEBUG_PRINT(_L("EGray16"));
   1.606 +		}
   1.607 +	else if(iMode==EGray4)
   1.608 +		{
   1.609 +		// Setup palette
   1.610 +		for(TInt i=0; i<4; i++)
   1.611 +			{
   1.612 +			TInt entry = i|(i<<2);
   1.613 +			entry |= entry<<4;
   1.614 +			entry |= entry<<8;
   1.615 +			entry |= entry<<10;
   1.616 +			HAL::Set(HAL::EDisplayPaletteEntry,entry); // Ignore error
   1.617 +			}
   1.618 +	__DEBUG_PRINT(_L("EGray4"));
   1.619 +		}
   1.620 +	else if(iMode==EMono)
   1.621 +		{
   1.622 +		// Setup palette
   1.623 +		TInt entry = 0;
   1.624 +		HAL::Set(HAL::EDisplayPaletteEntry,entry); // Ignore error
   1.625 +		entry = 0x01FFFFFF;
   1.626 +		HAL::Set(HAL::EDisplayPaletteEntry,entry); // Ignore error
   1.627 +	__DEBUG_PRINT(_L("EMono"));
   1.628 +		}
   1.629 +	else
   1.630 +		{
   1.631 +		__DEBUG_PRINT(_L("unknown mode"));
   1.632 +
   1.633 +		}
   1.634 +
   1.635 +	//
   1.636 +	// Initialise values used for drawing
   1.637 +	//
   1.638 +	if(iBitsPerPixel==12)
   1.639 +		iPixelSize = 16;
   1.640 +	else
   1.641 +		iPixelSize = iBitsPerPixel;
   1.642 +
   1.643 +	{
   1.644 +	TInt KBackgroundColor = 0xff0000; // color in format 0xbbggrr
   1.645 +	TInt KTextColor = 0xffffff;		// color in format 0xbbggrr
   1.646 +
   1.647 +	if (( iBitsPerPixel == 24 ) || ( iBitsPerPixel == 32 ) )
   1.648 +		{
   1.649 +		iPixelSize = 32;
   1.650 +//		KTextColor = 0x00FFFF;//Text color yellow when 24ubpp
   1.651 +		}
   1.652 +
   1.653 +	if(iPixelSize<8)
   1.654 +		{
   1.655 +		KBackgroundColor = 0xffffff; // color in format 0xbbggrr
   1.656 +		KTextColor = 0x000000;		// color in format 0xbbggrr
   1.657 +		}
   1.658 +
   1.659 +	iBackgroundPixel = ColorToPixel(KBackgroundColor);
   1.660 +	iBackgroundFill = iBackgroundPixel;
   1.661 +	{
   1.662 +	TInt shift = iPixelSize;
   1.663 +	while(shift<32)
   1.664 +		{
   1.665 +		iBackgroundFill |= iBackgroundFill<<shift;
   1.666 +		shift <<= 1;
   1.667 +		}
   1.668 +	}
   1.669 +
   1.670 +	iTextPixel = ColorToPixel(KTextColor);
   1.671 +	iTextFill = iTextPixel;
   1.672 +	{
   1.673 +	TInt shift = iPixelSize;
   1.674 +	while(shift<32)
   1.675 +		{
   1.676 +		iTextFill |= iTextFill<<shift;
   1.677 +		shift <<= 1;
   1.678 +		}
   1.679 +	}
   1.680 +	}
   1.681 +
   1.682 +	SRectOpInfo roi;
   1.683 +	Mem::FillZ(&roi, sizeof(roi));
   1.684 +	if (HwBlockFill(roi)==KErrNone)
   1.685 +		iHwAcc |= KHwAccBlockFill;
   1.686 +	if (HwBlockCopy(roi)==KErrNone)
   1.687 +		iHwAcc |= KHwAccBlockCopy;
   1.688 +
   1.689 +	//
   1.690 +	// Done
   1.691 +	//
   1.692 +	__DEBUG_PRINT(_L("CSD::Ctor done"));
   1.693 +	return;
   1.694 +
   1.695 +fail:
   1.696 +
   1.697 +	iScreenAddress = NULL;
   1.698 +	__DEBUG_PRINT2(_L("CSD::Ctor failed r=%d"),r);
   1.699 +	}
   1.700 +
   1.701 +
   1.702 +void CScreenDriverTemplate::Init(TSize &aScreenSize,TSize &aFontSize)
   1.703 +//
   1.704 +// Initialise the screen driver and report screen information
   1.705 +//
   1.706 +	{
   1.707 +
   1.708 +	__DEBUG_PRINT(_L("CSD::Init"));
   1.709 +
   1.710 +	aFontSize=TSize(KPixelsPerChar,KLinesPerChar);
   1.711 +	aScreenSize.iWidth=iScreenWidth/KPixelsPerChar;
   1.712 +	aScreenSize.iHeight=iScreenHeight/KLinesPerChar;
   1.713 +
   1.714 +	Clear(aScreenSize);
   1.715 +	}
   1.716 +
   1.717 +
   1.718 +TInt CScreenDriverTemplate::SetMode(TVideoMode aMode)
   1.719 +	{
   1.720 +	/**
   1.721 +	 * TO DO: (optional)
   1.722 +	 *
   1.723 +	 * If you support multiple video modes then implement video mode switching
   1.724 +	 * here. After the mode switch the screen contents should appear as before.
   1.725 +	 * The current mode should be stored in iMode, and other member data updated
   1.726 +	 * as appropriate. I.e. iScreenAddress, iScreenWidth, iScreenHeight, 
   1.727 +	 * iScreenOffsetBetweenLines, iBitsPerPixel and iPixelSize (See ctor code.)
   1.728 +	 */
   1.729 +
   1.730 +	__DEBUG_PRINT(_L("CSD::SetMode"));
   1.731 +	return(aMode==iMode ? KErrNone : KErrNotSupported);
   1.732 +	}
   1.733 +
   1.734 +
   1.735 +TUint8* CScreenDriverTemplate::CharPosToScreenAddress(const TPoint& aCharPos)
   1.736 +//
   1.737 +// Returns the screen address for the given character position 
   1.738 +//
   1.739 +	{
   1.740 +	return (TUint8*)iScreenAddress +
   1.741 +		aCharPos.iY * iScreenOffsetBetweenLines * KLinesPerChar +
   1.742 +		((aCharPos.iX * KPixelsPerChar * iPixelSize) >> 3);
   1.743 +	}
   1.744 +
   1.745 +void CScreenDriverTemplate::CalcColorMode()
   1.746 +	{
   1.747 +	iMode = 0;
   1.748 +	//calculate the color mode
   1.749 +	if (iIsPalettized)
   1.750 +		{
   1.751 +		if (iIsMono)
   1.752 +			{
   1.753 +			if (1 == iBitsPerPixel)
   1.754 +				iMode = EMono;
   1.755 +			else if (2 == iBitsPerPixel)
   1.756 +				iMode = EGray4;
   1.757 +			else if (4 == iBitsPerPixel)
   1.758 +				iMode = EGray16;
   1.759 +			}
   1.760 +		else
   1.761 +			{
   1.762 +			if (8 == iBitsPerPixel)
   1.763 +				iMode = EColor256;
   1.764 +			else if (4 == iBitsPerPixel)
   1.765 +				iMode = EGray16;			//we are color but color16 is not supported
   1.766 +			}
   1.767 +		}
   1.768 +	else
   1.769 +		{
   1.770 +		if (!iIsMono)
   1.771 +			{
   1.772 +			if (12 == iBitsPerPixel)
   1.773 +				iMode = EColor4K;
   1.774 +			else if (16 == iBitsPerPixel)
   1.775 +				iMode = EColor64K;
   1.776 +			else if (24 == iBitsPerPixel)
   1.777 +				iMode = EColor16M;
   1.778 +			else if (32 == iBitsPerPixel)
   1.779 +				iMode = EColor16M;			
   1.780 +			}
   1.781 +		}
   1.782 +
   1.783 +	}
   1.784 +
   1.785 +TInt CScreenDriverTemplate::ColorToPixel(TInt aColorRgb)
   1.786 +//
   1.787 +// Returns the pixel value which is closest to the given RGB value
   1.788 +//
   1.789 +	{
   1.790 +	TInt r = aColorRgb&0xFF;
   1.791 +	TInt g = (aColorRgb>>8)&0xFF;
   1.792 +	TInt b = (aColorRgb>>16)&0xFF;
   1.793 +
   1.794 +	switch(iMode)
   1.795 +		{
   1.796 +	case EColor16M:
   1.797 +		return (r<<16)+(g<<8)+b;
   1.798 +
   1.799 +	case EColor64K:
   1.800 +		return ((r>>3)<<11)+((g>>2)<<5)+(b>>3);
   1.801 +
   1.802 +	case EColor4K:
   1.803 +		return ((r>>4)<<8)+((g>>4)<<4)+(b>>4);
   1.804 +
   1.805 +	case EColor256:
   1.806 +		{
   1.807 +		TInt best = 0;
   1.808 +		TInt bestDif = KMaxTInt;
   1.809 +		for(TInt i=0; i<256; i++)
   1.810 +			{
   1.811 +			TInt value = Palette256[i];
   1.812 +			TInt dr = (value&0xFF)-r;
   1.813 +			TInt dg = ((value>>8)&0xFF)-g;
   1.814 +			TInt db = ((value>>16)&0xFF)-b;
   1.815 +			TInt dif = dr*dr + dg*dg + db*db;
   1.816 +			if(dif<bestDif)
   1.817 +				{
   1.818 +				bestDif = dif;
   1.819 +				best = i;
   1.820 +				}
   1.821 +			}
   1.822 +		return best;
   1.823 +		}
   1.824 +
   1.825 +	case EGray16:
   1.826 +		return (r*2+g*4+b)>>7;
   1.827 +
   1.828 +	case EGray4:
   1.829 +		return (r*2+g*4+b)>>9;
   1.830 +
   1.831 +	case EMono:
   1.832 +		return (r*2+g*4+b)>>10;
   1.833 +		}
   1.834 +
   1.835 +	return 0;
   1.836 +	}
   1.837 +
   1.838 +
   1.839 +void CScreenDriverTemplate::Blit(const TText *aBuffer, TInt aLength, const TPoint &aPosition)
   1.840 +//
   1.841 +// Write contiguous block of characters to some segment of a line on the display
   1.842 +//
   1.843 +	{
   1.844 +	//
   1.845 +	// ASSUMPTION:
   1.846 +	//
   1.847 +	// The start of each character on the display is byte aligned.
   1.848 +	// i.e. KPixelsPerChar*iPixelSize%8 == 0
   1.849 +
   1.850 +	// Clip text to screen width
   1.851 +	if(aLength+aPosition.iX > iScreenWidth/KPixelsPerChar)
   1.852 +		aLength = iScreenWidth/KPixelsPerChar-aPosition.iX;
   1.853 +
   1.854 +	TUint8* screenPtr = CharPosToScreenAddress(aPosition);
   1.855 +	TInt lineAddon = iScreenOffsetBetweenLines-((iPixelSize*KPixelsPerChar)>>3);
   1.856 +	TInt bgPixel = iBackgroundPixel;
   1.857 +	TInt textPixel = iTextPixel;
   1.858 +
   1.859 +	while(aLength-->0)
   1.860 +		{
   1.861 +		TUint8* pixelPtr = screenPtr;
   1.862 +		screenPtr += (iPixelSize*KPixelsPerChar)>>3;
   1.863 +		TInt character = (*aBuffer++)&0xff;
   1.864 +		TInt y;
   1.865 +
   1.866 +		switch(iPixelSize)
   1.867 +			{
   1.868 +
   1.869 +		case 1:
   1.870 +			for(y=0; y<KLinesPerChar; y++)
   1.871 +				{
   1.872 +				TInt bitData = Font[character][y];
   1.873 +				TInt bitMask = 1<<(KPixelsPerChar-1);
   1.874 +				TInt pixelShift = 0;
   1.875 +				TInt byte = 0;
   1.876 +				do
   1.877 +					{
   1.878 +					if(bitData & bitMask)
   1.879 +						byte |= textPixel<<pixelShift;
   1.880 +					else
   1.881 +						byte |= bgPixel<<pixelShift;
   1.882 +					if(pixelShift<7)
   1.883 +						pixelShift++;
   1.884 +					else
   1.885 +						{
   1.886 +						*pixelPtr++ = (TUint8)byte;
   1.887 +						byte = 0;
   1.888 +						pixelShift = 0;
   1.889 +						}
   1.890 +					bitMask >>= 1;
   1.891 +					}
   1.892 +				while(bitMask);
   1.893 +				pixelPtr += lineAddon;
   1.894 +				}
   1.895 +			break;
   1.896 +
   1.897 +		case 2:
   1.898 +			for(y=0; y<KLinesPerChar; y++)
   1.899 +				{
   1.900 +				TInt bitData = Font[character][y];
   1.901 +				TInt bitMask = 1<<(KPixelsPerChar-1);
   1.902 +				do
   1.903 +					{
   1.904 +					TInt byte;
   1.905 +					if(bitData & bitMask)
   1.906 +						byte = textPixel;
   1.907 +					else
   1.908 +						byte = bgPixel;
   1.909 +					bitMask >>= 1;
   1.910 +
   1.911 +					if(bitData & bitMask)
   1.912 +						byte |= textPixel<<2;
   1.913 +					else
   1.914 +						byte |= bgPixel<<2;
   1.915 +					bitMask >>= 1;
   1.916 +
   1.917 +					if(bitData & bitMask)
   1.918 +						byte |= textPixel<<4;
   1.919 +					else
   1.920 +						byte |= bgPixel<<4;
   1.921 +					bitMask >>= 1;
   1.922 +
   1.923 +					if(bitData & bitMask)
   1.924 +						byte |= textPixel<<6;
   1.925 +					else
   1.926 +						byte |= bgPixel<<6;
   1.927 +					*pixelPtr++ = (TUint8)byte;
   1.928 +					bitMask >>= 1;
   1.929 +					}
   1.930 +				while(bitMask);
   1.931 +				pixelPtr += lineAddon;
   1.932 +				}
   1.933 +			break;
   1.934 +
   1.935 +		case 4:
   1.936 +			for(y=0; y<KLinesPerChar; y++)
   1.937 +				{
   1.938 +				TInt bitData = Font[character][y];
   1.939 +				TInt bitMask = 1<<(KPixelsPerChar-1);
   1.940 +				do
   1.941 +					{
   1.942 +					TInt byte;
   1.943 +					if(bitData & bitMask)
   1.944 +						byte = textPixel;
   1.945 +					else
   1.946 +						byte = bgPixel;
   1.947 +					bitMask >>= 1;
   1.948 +
   1.949 +					if(bitData & bitMask)
   1.950 +						byte |= textPixel<<4;
   1.951 +					else
   1.952 +						byte |= bgPixel<<4;
   1.953 +					*pixelPtr++ = (TUint8)byte;
   1.954 +					bitMask >>= 1;
   1.955 +					}
   1.956 +				while(bitMask);
   1.957 +				pixelPtr += lineAddon;
   1.958 +				}
   1.959 +			break;
   1.960 +
   1.961 +		case 8:
   1.962 +			for(y=0; y<KLinesPerChar; y++)
   1.963 +				{
   1.964 +				TInt bitData = Font[character][y];
   1.965 +				TInt bitMask = 1<<(KPixelsPerChar-1);
   1.966 +				do
   1.967 +					{
   1.968 +					if(bitData & bitMask)
   1.969 +						*pixelPtr++ = (TUint8)textPixel;
   1.970 +					else
   1.971 +						*pixelPtr++ = (TUint8)bgPixel;
   1.972 +					bitMask >>= 1;
   1.973 +					}
   1.974 +				while(bitMask);
   1.975 +				pixelPtr += lineAddon;
   1.976 +				}
   1.977 +			break;
   1.978 +
   1.979 +		case 16:
   1.980 +			for(y=0; y<KLinesPerChar; y++)
   1.981 +				{
   1.982 +				TInt bitData = Font[character][y];
   1.983 +				TInt bitMask = 1<<(KPixelsPerChar-1);
   1.984 +				do
   1.985 +					{
   1.986 +					if(bitData & bitMask)
   1.987 +						{
   1.988 +						*pixelPtr++ = (TUint8)textPixel;
   1.989 +						*pixelPtr++ = (TUint8)(textPixel>>8);
   1.990 +						}
   1.991 +					else
   1.992 +						{
   1.993 +						*pixelPtr++ = (TUint8)bgPixel;
   1.994 +						*pixelPtr++ = (TUint8)(bgPixel>>8);
   1.995 +						}
   1.996 +					bitMask >>= 1;
   1.997 +					}
   1.998 +				while(bitMask);
   1.999 +				pixelPtr += lineAddon;
  1.1000 +				}
  1.1001 +			break;
  1.1002 +
  1.1003 +		case 24:
  1.1004 +			for(y=0; y<KLinesPerChar; y++)
  1.1005 +				{
  1.1006 +				TInt bitData = Font[character][y];
  1.1007 +				TInt bitMask = 1<<(KPixelsPerChar-1);
  1.1008 +				do
  1.1009 +					{
  1.1010 +					if(bitData & bitMask)
  1.1011 +						{
  1.1012 +						*pixelPtr++ = (TUint8)textPixel;
  1.1013 +						*pixelPtr++ = (TUint8)(textPixel>>8);
  1.1014 +						*pixelPtr++ = (TUint8)(textPixel>>16);
  1.1015 +						}
  1.1016 +					else
  1.1017 +						{
  1.1018 +						*pixelPtr++ = (TUint8)bgPixel;
  1.1019 +						*pixelPtr++ = (TUint8)(bgPixel>>8);
  1.1020 +						*pixelPtr++ = (TUint8)(bgPixel>>16);
  1.1021 +						}
  1.1022 +					bitMask >>= 1;
  1.1023 +					}
  1.1024 +				while(bitMask);
  1.1025 +				pixelPtr += lineAddon;
  1.1026 +				}
  1.1027 +			break;
  1.1028 +
  1.1029 +		case 32:
  1.1030 +			for(y=0; y<KLinesPerChar; y++)
  1.1031 +				{
  1.1032 +				TInt bitData = Font[character][y];
  1.1033 +				TInt bitMask = 1<<(KPixelsPerChar-1);
  1.1034 +				do
  1.1035 +					{
  1.1036 +					if(bitData & bitMask)
  1.1037 +						{
  1.1038 +						*pixelPtr++ = (TUint8)textPixel;//Blue
  1.1039 +						*pixelPtr++ = (TUint8)(textPixel>>8);//Green
  1.1040 +						*pixelPtr++ = (TUint8)(textPixel>>16);//Red
  1.1041 +                        ++pixelPtr;
  1.1042 +						}
  1.1043 +					else
  1.1044 +						{
  1.1045 +						*pixelPtr++ = (TUint8)bgPixel;//Blue
  1.1046 +						*pixelPtr++ = (TUint8)(bgPixel>>8);//Green
  1.1047 +						*pixelPtr++ = (TUint8)(bgPixel>>16);//Red
  1.1048 +                        ++pixelPtr;
  1.1049 +						}
  1.1050 +					bitMask >>= 1;
  1.1051 +					}
  1.1052 +				while(bitMask);
  1.1053 +				pixelPtr += lineAddon;
  1.1054 +				}
  1.1055 +			break;
  1.1056 +
  1.1057 +			}
  1.1058 +		}
  1.1059 +	}
  1.1060 +
  1.1061 +
  1.1062 +TBool CScreenDriverTemplate::ScrollUp(const TRect& aRect)
  1.1063 +//
  1.1064 +// Scroll a rectangle of the screen up one character, don't update bottom line
  1.1065 +//
  1.1066 +	{
  1.1067 +	__DEBUG_PRINT(_L("CSD::ScrollUp"));
  1.1068 +
  1.1069 +	if (iHwAcc & KHwAccBlockCopy)
  1.1070 +		{
  1.1071 +		SRectOpInfo roi;
  1.1072 +		roi.iX = KPixelsPerChar*aRect.iTl.iX;
  1.1073 +		roi.iY = KLinesPerChar*aRect.iTl.iY;
  1.1074 +		roi.iWidth = aRect.Width()*KPixelsPerChar;
  1.1075 +		roi.iHeight = (aRect.Height()-1) * KLinesPerChar;
  1.1076 +		roi.iSrcX = roi.iX;
  1.1077 +		roi.iSrcY = roi.iY + KLinesPerChar;
  1.1078 +		HwBlockCopy(roi);
  1.1079 +		return ETrue;
  1.1080 +		}
  1.1081 +	TUint8* dstAddress = CharPosToScreenAddress(aRect.iTl);
  1.1082 +	TUint8* srcAddress = dstAddress + iScreenOffsetBetweenLines * KLinesPerChar;
  1.1083 +	TInt lines = (aRect.Height()-1) * KLinesPerChar;
  1.1084 +	TInt bytesPerLine = (aRect.Width() * KPixelsPerChar * iPixelSize)>>3;
  1.1085 +
  1.1086 +	while(lines>0)
  1.1087 +		{
  1.1088 +        Mem::Copy(dstAddress,srcAddress,bytesPerLine);
  1.1089 +		srcAddress += iScreenOffsetBetweenLines;
  1.1090 +		dstAddress += iScreenOffsetBetweenLines;
  1.1091 +		--lines;
  1.1092 +		}
  1.1093 +
  1.1094 +	return ETrue;
  1.1095 +	}
  1.1096 +
  1.1097 +
  1.1098 +void CScreenDriverTemplate::Clear(const TRect& aRect)
  1.1099 +//
  1.1100 +// Clears a rectangular region with the background colour
  1.1101 +//
  1.1102 +	{
  1.1103 +	__DEBUG_PRINT(_L("CSD::Clear"));
  1.1104 +
  1.1105 +	if (iHwAcc & KHwAccBlockFill)
  1.1106 +		{
  1.1107 +		SRectOpInfo roi;
  1.1108 +		roi.iX = KPixelsPerChar*aRect.iTl.iX;
  1.1109 +		roi.iY = KLinesPerChar*aRect.iTl.iY;
  1.1110 +		roi.iWidth = aRect.Width()*KPixelsPerChar;
  1.1111 +		roi.iHeight = aRect.Height() * KLinesPerChar;
  1.1112 +		roi.iSrcX = roi.iX;
  1.1113 +		roi.iSrcY = roi.iY;
  1.1114 +		roi.iColor = iBackgroundFill;
  1.1115 +		HwBlockCopy(roi);
  1.1116 +		return;
  1.1117 +		}
  1.1118 +
  1.1119 +	TUint8* dstAddress = CharPosToScreenAddress(aRect.iTl);
  1.1120 +	TInt lines = aRect.Height() * KLinesPerChar;
  1.1121 +	TInt bytesPerLine = (aRect.Width() * KPixelsPerChar * iPixelSize)>>3;
  1.1122 +
  1.1123 +	switch(iPixelSize)
  1.1124 +		{
  1.1125 +	case 32:
  1.1126 +		while(lines>0)
  1.1127 +			{
  1.1128 +			TUint32 fillValue = iBackgroundFill;
  1.1129 +			TUint8* ptr = dstAddress;
  1.1130 +			TUint8* ptrLimit = ptr+bytesPerLine;
  1.1131 +			while(ptr<ptrLimit)
  1.1132 +				{
  1.1133 +				*ptr++ = (TUint8)fillValue;//Blue
  1.1134 +				*ptr++ = (TUint8)(fillValue<<8);//Green
  1.1135 +				*ptr++ = (TUint8)(fillValue<<16);//Red
  1.1136 +                ++ptr;
  1.1137 +				}
  1.1138 +			dstAddress += iScreenOffsetBetweenLines;
  1.1139 +			--lines;
  1.1140 +			}
  1.1141 +		break;
  1.1142 +
  1.1143 +	case 24:
  1.1144 +		while(lines>0)
  1.1145 +			{
  1.1146 +			TUint32 fillValue = iBackgroundFill;
  1.1147 +			TUint8* ptr = dstAddress;
  1.1148 +			TUint8* ptrLimit = ptr+bytesPerLine;
  1.1149 +			while(ptr<ptrLimit)
  1.1150 +				{
  1.1151 +				*ptr++ = (TUint8)fillValue;
  1.1152 +				*ptr++ = (TUint8)(fillValue<<8);
  1.1153 +				*ptr++ = (TUint8)(fillValue<<16);
  1.1154 +				}
  1.1155 +			dstAddress += iScreenOffsetBetweenLines;
  1.1156 +			--lines;
  1.1157 +			}
  1.1158 +		break;
  1.1159 +
  1.1160 +	case 16:
  1.1161 +		while(lines>0)
  1.1162 +			{
  1.1163 +			TUint32 fillValue = iBackgroundFill;
  1.1164 +			TUint8* ptr = dstAddress;
  1.1165 +			TUint8* ptrLimit = ptr+bytesPerLine;
  1.1166 +			while(ptr<ptrLimit)
  1.1167 +				{
  1.1168 +				*ptr++ = (TUint8)fillValue;
  1.1169 +				*ptr++ = (TUint8)(fillValue<<8);
  1.1170 +				}
  1.1171 +			dstAddress += iScreenOffsetBetweenLines;
  1.1172 +			--lines;
  1.1173 +			}
  1.1174 +		break;
  1.1175 +
  1.1176 +	default:
  1.1177 +		while(lines>0)
  1.1178 +			{
  1.1179 +			Mem::Fill(dstAddress,bytesPerLine,iBackgroundFill);
  1.1180 +			dstAddress += iScreenOffsetBetweenLines;
  1.1181 +			--lines;
  1.1182 +			}
  1.1183 +		break;
  1.1184 +		}
  1.1185 +	}
  1.1186 +
  1.1187 +
  1.1188 +
  1.1189 +/**
  1.1190 + * You don't need to implement this function.
  1.1191 + */
  1.1192 +void CScreenDriverTemplate::SetPixel(const TPoint& /*aPoint*/,TUint8 /*aColour*/)
  1.1193 +	{
  1.1194 +	__DEBUG_PRINT(_L("CSD::SetPix"));
  1.1195 +	}
  1.1196 +
  1.1197 +
  1.1198 +/**
  1.1199 + * You don't need to implement this function.
  1.1200 + */
  1.1201 +TInt CScreenDriverTemplate::GetPixel(const TPoint& /*aPoint*/)
  1.1202 +	{
  1.1203 +	__DEBUG_PRINT(_L("CSD::GetPix"));
  1.1204 +	return 0;
  1.1205 +	}
  1.1206 +
  1.1207 +
  1.1208 +/**
  1.1209 + * You don't need to implement this function.
  1.1210 + */
  1.1211 +void CScreenDriverTemplate::SetWord(const TPoint& /*aPoint*/,TInt /*aWord*/)
  1.1212 +	{
  1.1213 +	__DEBUG_PRINT(_L("CSD::SetWord"));
  1.1214 +	}
  1.1215 +
  1.1216 +
  1.1217 +/**
  1.1218 + * You don't need to implement this function.
  1.1219 + */
  1.1220 +TInt CScreenDriverTemplate::GetWord(const TPoint& /*aPoint*/)
  1.1221 +	{
  1.1222 +	__DEBUG_PRINT(_L("CSD::GetWord"));
  1.1223 +	return 0;
  1.1224 +	}
  1.1225 +
  1.1226 +
  1.1227 +// You don't need to implement the following functions
  1.1228 +
  1.1229 +/**
  1.1230 + * You don't need to implement this function.
  1.1231 + */
  1.1232 +void CScreenDriverTemplate::SetLine(const TPoint& /*aPoint*/,const TPixelLine& /*aPixelLine*/)
  1.1233 +	{
  1.1234 +	__DEBUG_PRINT(_L("CSD::SetLine"));
  1.1235 +	}
  1.1236 +
  1.1237 +
  1.1238 +/**
  1.1239 + * You don't need to implement this function.
  1.1240 + */
  1.1241 +void CScreenDriverTemplate::GetLine(const TPoint& /*aPoint*/,TPixelLine& /*aPixelLine*/)
  1.1242 +	{
  1.1243 +	__DEBUG_PRINT(_L("CSD::GetLine"));
  1.1244 +	}
  1.1245 +
  1.1246 +
  1.1247 +/**
  1.1248 + * You don't need to implement this function.
  1.1249 + */
  1.1250 +void CScreenDriverTemplate::SetPaletteEntry(TColorIndex /*anIndex*/,TUint8 /*aRed*/,TUint8 /*aGreen*/,TUint8 /*aBlue*/)
  1.1251 +	{
  1.1252 +	}
  1.1253 +
  1.1254 +
  1.1255 +/**
  1.1256 + * You don't need to implement this function.
  1.1257 + */
  1.1258 +void CScreenDriverTemplate::GetPaletteEntry(TColorIndex /*anIndex*/,TUint8& /*aRed*/,TUint8& /*aGreen*/,TUint8& /*aBlue*/)
  1.1259 +	{
  1.1260 +	}
  1.1261 +
  1.1262 +
  1.1263 +/**
  1.1264 + * You don't need to implement this function.
  1.1265 + */
  1.1266 +void CScreenDriverTemplate::SetForegroundColor(TColorIndex /*anIndex*/)
  1.1267 +	{
  1.1268 +	}
  1.1269 +
  1.1270 +
  1.1271 +/**
  1.1272 + * You don't need to implement this function.
  1.1273 + */
  1.1274 +void CScreenDriverTemplate::SetBackgroundColor(TColorIndex /*anIndex*/)
  1.1275 +	{
  1.1276 +	}
  1.1277 +
  1.1278 +
  1.1279 +/**
  1.1280 + * You don't need to implement this function.
  1.1281 + */
  1.1282 +void CScreenDriverTemplate::GetAttributeColors(TColorIndex* /*anArray*/)
  1.1283 +	{
  1.1284 +	}
  1.1285 +