sl@0: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // WD_TEMPLATE.CPP sl@0: // Screen Driver for Text Window Server sl@0: // TO DO: (mandatory) sl@0: // This is the screen driver for the simple text Window Server supplied as part of sl@0: // E32. It is required to run the text shell, E32 & F32 tests etc. sl@0: // This is a working generic implementation which you shouldn't need to alter, but sl@0: // you may customise it if required. e.g. Change the default display mode or colors. sl@0: // ASSUMPTIONS MADE BY THIS IMPLEMENTATION sl@0: // * The start of each character on the display is byte aligned. sl@0: // sl@0: // sl@0: sl@0: #include "ws_std.h" sl@0: #include sl@0: #include sl@0: #include "u32std.h" sl@0: #include sl@0: sl@0: #if 0 sl@0: #define __DEBUG_PRINT(a) RDebug::Print(a) sl@0: #define __DEBUG_PRINT2(a,b) RDebug::Print(a,b) sl@0: #else sl@0: #define __DEBUG_PRINT(a) sl@0: #define __DEBUG_PRINT2(a,b) sl@0: #endif sl@0: sl@0: #ifdef __X86__ sl@0: extern CScreenDriver* NewScreenDriverVgaText(); sl@0: #endif sl@0: sl@0: const TUint32 KHwAccBlockFill=1; sl@0: const TUint32 KHwAccBlockCopy=2; sl@0: sl@0: inline TInt HwBlockFill(SRectOpInfo &a) sl@0: { sl@0: return UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalBlockFill, &a, NULL); sl@0: } sl@0: sl@0: inline TInt HwBlockCopy(SRectOpInfo &a) sl@0: { sl@0: return UserSvr::HalFunction(EHalGroupDisplay, EDisplayHalBlockCopy, &a, NULL); sl@0: } sl@0: sl@0: /** sl@0: * Main screen driver implementation class. sl@0: * sl@0: * TO DO: (optional) sl@0: * sl@0: * The public API of this class is defined by the CScreenDriver class. sl@0: * You may want to add some private definitions to this. sl@0: */ sl@0: class CScreenDriverTemplate : public CScreenDriver sl@0: { sl@0: public: sl@0: CScreenDriverTemplate(); sl@0: virtual void Init(TSize &aScreenSize,TSize &aFontSize); sl@0: virtual void Blit(const TText *aBuffer,TInt aLength,const TPoint &aPosition); sl@0: virtual TBool ScrollUp(const TRect& aRect); sl@0: virtual void Clear(const TRect& aRect); sl@0: sl@0: virtual void SetPixel(const TPoint& aPoint,TUint8 aColour); sl@0: virtual TInt GetPixel(const TPoint& aPoint); sl@0: virtual void SetWord(const TPoint& aPoint,TInt aWord); sl@0: virtual TInt GetWord(const TPoint& aPoint); sl@0: virtual void SetLine(const TPoint& aPoint,const TPixelLine& aPixelLine); sl@0: virtual void GetLine(const TPoint& aPoint,TPixelLine& aPixelLine); sl@0: sl@0: virtual void SetPaletteEntry(TColorIndex anIndex,TUint8 aRed,TUint8 aGreen,TUint8 aBlue); sl@0: virtual void GetPaletteEntry(TColorIndex anIndex,TUint8 &aRed,TUint8 &aGreen,TUint8 &aBlue); sl@0: virtual void SetForegroundColor(TColorIndex anIndex); sl@0: virtual void SetBackgroundColor(TColorIndex anIndex); sl@0: virtual void GetAttributeColors(TColorIndex* anArray); sl@0: virtual TInt SetMode(TVideoMode aMode); sl@0: private: sl@0: TUint8* CharPosToScreenAddress(const TPoint& aCharPos); sl@0: TInt ColorToPixel(TInt aColorRgb); sl@0: void CalcColorMode(); sl@0: private: sl@0: TInt iDisplayMode; sl@0: TInt iMode; sl@0: TInt iScreenAddress; sl@0: TInt iScreenWidth; sl@0: TInt iScreenHeight; sl@0: TInt iScreenOffsetBetweenLines; sl@0: TInt iBitsPerPixel; sl@0: TInt iIsMono; sl@0: TInt iIsPalettized; sl@0: TInt iPixelSize; sl@0: TInt iBackgroundPixel; sl@0: TInt iTextPixel; sl@0: TUint32 iBackgroundFill; sl@0: TUint32 iTextFill; sl@0: TUint32 iHwAcc; sl@0: static const TUint8 Reverse[256]; sl@0: static const TUint8 Font[256][10]; sl@0: friend class CScreenDriver; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: * Table used to reverse the bits in a byte sl@0: * sl@0: * For example, index 0x03 (= 0000 0011 binary) sl@0: * returns 0xC0 (= 1100 0000 binary) sl@0: */ sl@0: const TUint8 CScreenDriverTemplate::Reverse[256] = sl@0: { sl@0: 0x00,0x80,0x40,0xC0,0x20,0xA0,0x60,0xE0,0x10,0x90,0x50,0xD0,0x30,0xB0,0x70,0xF0, sl@0: 0x08,0x88,0x48,0xC8,0x28,0xA8,0x68,0xE8,0x18,0x98,0x58,0xD8,0x38,0xB8,0x78,0xF8, sl@0: 0x04,0x84,0x44,0xC4,0x24,0xA4,0x64,0xE4,0x14,0x94,0x54,0xD4,0x34,0xB4,0x74,0xF4, sl@0: 0x0C,0x8C,0x4C,0xCC,0x2C,0xAC,0x6C,0xEC,0x1C,0x9C,0x5C,0xDC,0x3C,0xBC,0x7C,0xFC, sl@0: 0x02,0x82,0x42,0xC2,0x22,0xA2,0x62,0xE2,0x12,0x92,0x52,0xD2,0x32,0xB2,0x72,0xF2, sl@0: 0x0A,0x8A,0x4A,0xCA,0x2A,0xAA,0x6A,0xEA,0x1A,0x9A,0x5A,0xDA,0x3A,0xBA,0x7A,0xFA, sl@0: 0x06,0x86,0x46,0xC6,0x26,0xA6,0x66,0xE6,0x16,0x96,0x56,0xD6,0x36,0xB6,0x76,0xF6, sl@0: 0x0E,0x8E,0x4E,0xCE,0x2E,0xAE,0x6E,0xEE,0x1E,0x9E,0x5E,0xDE,0x3E,0xBE,0x7E,0xFE, sl@0: 0x01,0x81,0x41,0xC1,0x21,0xA1,0x61,0xE1,0x11,0x91,0x51,0xD1,0x31,0xB1,0x71,0xF1, sl@0: 0x09,0x89,0x49,0xC9,0x29,0xA9,0x69,0xE9,0x19,0x99,0x59,0xD9,0x39,0xB9,0x79,0xF9, sl@0: 0x05,0x85,0x45,0xC5,0x25,0xA5,0x65,0xE5,0x15,0x95,0x55,0xD5,0x35,0xB5,0x75,0xF5, sl@0: 0x0D,0x8D,0x4D,0xCD,0x2D,0xAD,0x6D,0xED,0x1D,0x9D,0x5D,0xDD,0x3D,0xBD,0x7D,0xFD, sl@0: 0x03,0x83,0x43,0xC3,0x23,0xA3,0x63,0xE3,0x13,0x93,0x53,0xD3,0x33,0xB3,0x73,0xF3, sl@0: 0x0B,0x8B,0x4B,0xCB,0x2B,0xAB,0x6B,0xEB,0x1B,0x9B,0x5B,0xDB,0x3B,0xBB,0x7B,0xFB, sl@0: 0x07,0x87,0x47,0xC7,0x27,0xA7,0x67,0xE7,0x17,0x97,0x57,0xD7,0x37,0xB7,0x77,0xF7, sl@0: 0x0F,0x8F,0x4F,0xCF,0x2F,0xAF,0x6F,0xEF,0x1F,0x9F,0x5F,0xDF,0x3F,0xBF,0x7F,0xFF sl@0: }; sl@0: sl@0: sl@0: sl@0: /** sl@0: * Define a font to be used sl@0: * This is an 8x10 Font taken from the MISA driver sl@0: * sl@0: * TO DO: (mandatory) sl@0: */ sl@0: const TInt KPixelsPerChar = 8; // character width in pixels sl@0: const TInt KLinesPerChar = 10; // character height in pixels sl@0: sl@0: const TUint8 CScreenDriverTemplate::Font[256][10] = sl@0: { sl@0: {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x7E,0x81,0xA5,0x81,0xBD,0x99,0x81,0x7E,0x00,0x00}, sl@0: {0x7E,0xFF,0xDB,0xFF,0xC3,0xE7,0xFF,0x7E,0x00,0x00}, sl@0: {0x6C,0xFE,0xFE,0xFE,0x7C,0x38,0x10,0x00,0x00,0x00}, sl@0: {0x10,0x38,0x7C,0xFE,0x7C,0x38,0x10,0x00,0x00,0x00}, sl@0: {0x38,0x7C,0x38,0xFE,0xFE,0x7C,0x38,0x7C,0x00,0x00}, sl@0: {0x10,0x10,0x38,0x7C,0xFE,0x7C,0x38,0x7C,0x00,0x00}, sl@0: {0x00,0x00,0x18,0x3C,0x3C,0x18,0x00,0x00,0x00,0x00}, sl@0: {0xFF,0xFF,0xE7,0xC3,0xC3,0xE7,0xFF,0xFF,0x00,0x00}, sl@0: {0x00,0x3C,0x66,0x42,0x42,0x66,0x3C,0x00,0x00,0x00}, sl@0: {0xFF,0xC3,0x99,0xBD,0xBD,0x99,0xC3,0xFF,0x00,0x00}, sl@0: {0x0F,0x07,0x0F,0x7D,0xCC,0xCC,0xCC,0x78,0x00,0x00}, sl@0: {0x3C,0x66,0x66,0x66,0x3C,0x18,0x7E,0x18,0x00,0x00}, sl@0: {0x3F,0x33,0x3F,0x30,0x30,0x70,0xF0,0xE0,0x00,0x00}, sl@0: {0x7F,0x63,0x7F,0x63,0x63,0x67,0xE6,0xC0,0x00,0x00}, sl@0: {0x99,0x5A,0x3C,0xE7,0xE7,0x3C,0x5A,0x99,0x00,0x00}, sl@0: sl@0: {0x80,0xE0,0xF8,0xFE,0xF8,0xE0,0x80,0x00,0x00,0x00}, sl@0: {0x02,0x0E,0x3E,0xFE,0x3E,0x0E,0x02,0x00,0x00,0x00}, sl@0: {0x18,0x3C,0x7E,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00}, sl@0: {0x66,0x66,0x66,0x66,0x66,0x00,0x66,0x00,0x00,0x00}, sl@0: {0x7F,0xDB,0xDB,0x7B,0x1B,0x1B,0x1B,0x00,0x00,0x00}, sl@0: {0x3E,0x63,0x38,0x6C,0x6C,0x38,0xCC,0x78,0x00,0x00}, sl@0: {0x00,0x00,0x00,0x00,0x7E,0x7E,0x7E,0x00,0x00,0x00}, sl@0: {0x18,0x3C,0x7E,0x18,0x7E,0x3C,0x18,0xFF,0x00,0x00}, sl@0: {0x18,0x3C,0x7E,0x18,0x18,0x18,0x18,0x00,0x00,0x00}, sl@0: {0x18,0x18,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00,0x00}, sl@0: {0x00,0x18,0x0C,0xFE,0x0C,0x18,0x00,0x00,0x00,0x00}, sl@0: {0x00,0x30,0x60,0xFE,0x60,0x30,0x00,0x00,0x00,0x00}, sl@0: {0x00,0x00,0xC0,0xC0,0xC0,0xFE,0x00,0x00,0x00,0x00}, sl@0: {0x00,0x24,0x66,0xFF,0x66,0x24,0x00,0x00,0x00,0x00}, sl@0: {0x00,0x18,0x3C,0x7E,0xFF,0xFF,0x00,0x00,0x00,0x00}, sl@0: {0x00,0xFF,0xFF,0x7E,0x3C,0x18,0x00,0x00,0x00,0x00}, sl@0: sl@0: {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x30,0x78,0x78,0x78,0x30,0x00,0x30,0x00,0x00,0x00}, // ! sl@0: {0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x6C,0x6C,0xFE,0x6C,0xFE,0x6C,0x6C,0x00,0x00,0x00}, //# sl@0: {0x30,0x7C,0xC0,0x78,0x0C,0xF8,0x30,0x00,0x00,0x00}, //$ sl@0: {0x00,0xC6,0xCC,0x18,0x30,0x66,0xC6,0x00,0x00,0x00}, sl@0: {0x38,0x6C,0x38,0x76,0xDC,0xCC,0x76,0x00,0x00,0x00}, sl@0: {0x60,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x18,0x30,0x60,0x60,0x60,0x30,0x18,0x00,0x00,0x00}, sl@0: {0x60,0x30,0x18,0x18,0x18,0x30,0x60,0x00,0x00,0x00}, sl@0: {0x00,0x66,0x3C,0xFF,0x3C,0x66,0x00,0x00,0x00,0x00}, sl@0: {0x00,0x30,0x30,0xFC,0x30,0x30,0x00,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00,0x00}, sl@0: {0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00}, //- sl@0: {0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00}, //. sl@0: {0x06,0x0C,0x18,0x30,0x60,0xC0,0x80,0x00,0x00,0x00}, /// sl@0: sl@0: {0x7C,0xC6,0xCE,0xDE,0xF6,0xE6,0x7C,0x00,0x00,0x00}, //0 sl@0: {0x30,0x70,0x30,0x30,0x30,0x30,0xFC,0x00,0x00,0x00}, sl@0: {0x78,0xCC,0x0C,0x38,0x60,0xCC,0xFC,0x00,0x00,0x00}, sl@0: {0x78,0xCC,0x0C,0x38,0x0C,0xCC,0x78,0x00,0x00,0x00}, sl@0: {0x1C,0x3C,0x6C,0xCC,0xFE,0x0C,0x1E,0x00,0x00,0x00}, sl@0: {0xFC,0xC0,0xF8,0x0C,0x0C,0xCC,0x78,0x00,0x00,0x00}, sl@0: {0x38,0x60,0xC0,0xF8,0xCC,0xCC,0x78,0x00,0x00,0x00}, sl@0: {0xFC,0xCC,0x0C,0x18,0x30,0x30,0x30,0x00,0x00,0x00}, sl@0: {0x78,0xCC,0xCC,0x78,0xCC,0xCC,0x78,0x00,0x00,0x00}, sl@0: {0x78,0xCC,0xCC,0x7C,0x0C,0x18,0x70,0x00,0x00,0x00}, //9 sl@0: {0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x00,0x00,0x00}, //: sl@0: {0x00,0x30,0x30,0x00,0x00,0x30,0x30,0x60,0x00,0x00}, //; sl@0: {0x18,0x30,0x60,0xC0,0x60,0x30,0x18,0x00,0x00,0x00}, //< sl@0: {0x00,0x00,0xFC,0x00,0x00,0xFC,0x00,0x00,0x00,0x00}, //= sl@0: {0x60,0x30,0x18,0x0C,0x18,0x30,0x60,0x00,0x00,0x00}, //> sl@0: {0x78,0xCC,0x0C,0x18,0x30,0x00,0x30,0x00,0x00,0x00}, //? sl@0: sl@0: {0x7C,0xC6,0xDE,0xDE,0xDE,0xC0,0x78,0x00,0x00,0x00}, //@ sl@0: {0x30,0x78,0xCC,0xCC,0xFC,0xCC,0xCC,0x00,0x00,0x00}, //A sl@0: {0xFC,0x66,0x66,0x7C,0x66,0x66,0xFC,0x00,0x00,0x00}, //B sl@0: {0x3C,0x66,0xC0,0xC0,0xC0,0x66,0x3C,0x00,0x00,0x00}, //C sl@0: {0xF8,0x6C,0x66,0x66,0x66,0x6C,0xF8,0x00,0x00,0x00}, //D sl@0: {0x7E,0x60,0x60,0x78,0x60,0x60,0x7E,0x00,0x00,0x00}, //E sl@0: {0x7E,0x60,0x60,0x78,0x60,0x60,0x60,0x00,0x00,0x00}, //F sl@0: {0x3C,0x66,0xC0,0xC0,0xCE,0x66,0x3E,0x00,0x00,0x00}, //G sl@0: {0xCC,0xCC,0xCC,0xFC,0xCC,0xCC,0xCC,0x00,0x00,0x00}, //H sl@0: {0x78,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00}, //I sl@0: {0x1E,0x0C,0x0C,0x0C,0xCC,0xCC,0x78,0x00,0x00,0x00}, //J sl@0: {0xE6,0x66,0x6C,0x78,0x6C,0x66,0xE6,0x00,0x00,0x00}, //K sl@0: {0x60,0x60,0x60,0x60,0x60,0x60,0x7E,0x00,0x00,0x00}, //L sl@0: {0xC6,0xEE,0xFE,0xFE,0xD6,0xC6,0xC6,0x00,0x00,0x00}, //M sl@0: {0xC6,0xE6,0xF6,0xDE,0xCE,0xC6,0xC6,0x00,0x00,0x00}, //N sl@0: {0x38,0x6C,0xC6,0xC6,0xC6,0x6C,0x38,0x00,0x00,0x00}, //O sl@0: sl@0: {0xFC,0x66,0x66,0x7C,0x60,0x60,0xF0,0x00,0x00,0x00}, //P sl@0: {0x78,0xCC,0xCC,0xCC,0xDC,0x78,0x1C,0x00,0x00,0x00}, //Q sl@0: {0xFC,0x66,0x66,0x7C,0x6C,0x66,0xE6,0x00,0x00,0x00}, //R sl@0: {0x78,0xCC,0xE0,0x70,0x1C,0xCC,0x78,0x00,0x00,0x00}, //S sl@0: {0xFC,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x00}, //T sl@0: {0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xFC,0x00,0x00,0x00}, //U sl@0: {0xCC,0xCC,0xCC,0xCC,0xCC,0x78,0x30,0x00,0x00,0x00}, //V sl@0: {0xC6,0xC6,0xC6,0xD6,0xFE,0xEE,0xC6,0x00,0x00,0x00}, //W sl@0: {0xC6,0xC6,0x6C,0x38,0x38,0x6C,0xC6,0x00,0x00,0x00}, //X sl@0: {0xCC,0xCC,0xCC,0x78,0x30,0x30,0x78,0x00,0x00,0x00}, //Y sl@0: {0xFE,0x06,0x0C,0x18,0x30,0x60,0xFE,0x00,0x00,0x00}, //Z sl@0: {0x78,0x60,0x60,0x60,0x60,0x60,0x78,0x00,0x00,0x00}, sl@0: {0xC0,0x60,0x30,0x18,0x0C,0x06,0x02,0x00,0x00,0x00}, sl@0: {0x78,0x18,0x18,0x18,0x18,0x18,0x78,0x00,0x00,0x00}, sl@0: {0x10,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00}, sl@0: sl@0: {0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x78,0x0C,0x7C,0xCC,0x76,0x00,0x00,0x00}, sl@0: {0xE0,0x60,0x60,0x7C,0x66,0x66,0xDC,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x78,0xCC,0xC0,0xCC,0x78,0x00,0x00,0x00}, sl@0: {0x1C,0x0C,0x0C,0x7C,0xCC,0xCC,0x76,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x78,0xCC,0xFC,0xC0,0x78,0x00,0x00,0x00}, sl@0: {0x38,0x6C,0x60,0xF0,0x60,0x60,0xF0,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x76,0xCC,0xCC,0x7C,0x0C,0xF8,0x00,0x00}, sl@0: {0xE0,0x60,0x6C,0x76,0x66,0x66,0xE6,0x00,0x00,0x00}, sl@0: {0x30,0x00,0x70,0x30,0x30,0x30,0x78,0x00,0x00,0x00}, sl@0: {0x0C,0x00,0x0C,0x0C,0x0C,0xCC,0xCC,0x78,0x00,0x00}, sl@0: {0xE0,0x60,0x66,0x6C,0x78,0x6C,0xE6,0x00,0x00,0x00}, sl@0: {0x70,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00}, sl@0: {0x00,0x00,0xCC,0xFE,0xFE,0xD6,0xC6,0x00,0x00,0x00}, sl@0: {0x00,0x00,0xF8,0xCC,0xCC,0xCC,0xCC,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x78,0xCC,0xCC,0xCC,0x78,0x00,0x00,0x00}, sl@0: sl@0: {0x00,0x00,0xDC,0x66,0x66,0x7C,0x60,0xF0,0x00,0x00}, sl@0: {0x00,0x00,0x76,0xCC,0xCC,0x7C,0x0C,0x1E,0x00,0x00}, sl@0: {0x00,0x00,0xDC,0x76,0x66,0x60,0xF0,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x7C,0xC0,0x78,0x0C,0xF8,0x00,0x00,0x00}, sl@0: {0x10,0x30,0x7C,0x30,0x30,0x34,0x18,0x00,0x00,0x00}, sl@0: {0x00,0x00,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00}, sl@0: {0x00,0x00,0xCC,0xCC,0xCC,0x78,0x30,0x00,0x00,0x00}, sl@0: {0x00,0x00,0xC6,0xD6,0xFE,0xFE,0x6C,0x00,0x00,0x00}, sl@0: {0x00,0x00,0xC6,0x6C,0x38,0x6C,0xC6,0x00,0x00,0x00}, sl@0: {0x00,0x00,0xCC,0xCC,0xCC,0x7C,0x0C,0xF8,0x00,0x00}, sl@0: {0x00,0x00,0xFC,0x98,0x30,0x64,0xFC,0x00,0x00,0x00}, sl@0: {0x1C,0x30,0x30,0xE0,0x30,0x30,0x1C,0x00,0x00,0x00}, sl@0: {0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x00,0x00,0x00}, sl@0: {0xE0,0x30,0x30,0x1C,0x30,0x30,0xE0,0x00,0x00,0x00}, sl@0: {0x76,0xDC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x00,0x10,0x38,0x6C,0xC6,0xC6,0xFE,0x00,0x00,0x00}, sl@0: sl@0: {0x3C,0x66,0x60,0x66,0x3C,0x0C,0x06,0x3C,0x00,0x00}, sl@0: {0x00,0x66,0x00,0x66,0x66,0x66,0x3F,0x00,0x00,0x00}, sl@0: {0x0E,0x00,0x3C,0x66,0x7E,0x60,0x3C,0x00,0x00,0x00}, sl@0: {0x7E,0xC3,0x3C,0x06,0x3E,0x66,0x3F,0x00,0x00,0x00}, sl@0: {0x66,0x00,0x3C,0x06,0x3E,0x66,0x3F,0x00,0x00,0x00}, sl@0: {0x70,0x00,0x3C,0x06,0x3E,0x66,0x3F,0x00,0x00,0x00}, sl@0: {0x18,0x18,0x3C,0x06,0x3E,0x66,0x3F,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x3C,0x60,0x60,0x3C,0x06,0x1C,0x00,0x00}, sl@0: {0x7E,0xC3,0x3C,0x66,0x7E,0x60,0x3C,0x00,0x00,0x00}, sl@0: {0x66,0x00,0x3C,0x66,0x7E,0x60,0x3C,0x00,0x00,0x00}, sl@0: {0x70,0x00,0x3C,0x66,0x7E,0x60,0x3C,0x00,0x00,0x00}, sl@0: {0x66,0x00,0x38,0x18,0x18,0x18,0x3C,0x00,0x00,0x00}, sl@0: {0x7C,0xC6,0x38,0x18,0x18,0x18,0x3C,0x00,0x00,0x00}, sl@0: {0x70,0x00,0x38,0x18,0x18,0x18,0x3C,0x00,0x00,0x00}, sl@0: {0x63,0x1C,0x36,0x63,0x7F,0x63,0x63,0x00,0x00,0x00}, sl@0: {0x18,0x18,0x00,0x3C,0x66,0x7E,0x66,0x00,0x00,0x00}, sl@0: sl@0: {0x0E,0x00,0x7E,0x30,0x3C,0x30,0x7E,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x7F,0x0C,0x7F,0xCC,0x7F,0x00,0x00,0x00}, sl@0: {0x1F,0x36,0x66,0x7F,0x66,0x66,0x67,0x00,0x00,0x00}, sl@0: {0x3C,0x66,0x00,0x3C,0x66,0x66,0x3C,0x00,0x00,0x00}, sl@0: {0x00,0x66,0x00,0x3C,0x66,0x66,0x3C,0x00,0x00,0x00}, sl@0: {0x00,0x70,0x00,0x3C,0x66,0x66,0x3C,0x00,0x00,0x00}, sl@0: {0x3C,0x66,0x00,0x66,0x66,0x66,0x3F,0x00,0x00,0x00}, sl@0: {0x00,0x70,0x00,0x66,0x66,0x66,0x3F,0x00,0x00,0x00}, sl@0: {0x00,0x66,0x00,0x66,0x66,0x3E,0x06,0x7C,0x00,0x00}, sl@0: {0xC3,0x18,0x3C,0x66,0x66,0x3C,0x18,0x00,0x00,0x00}, sl@0: {0x66,0x00,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00}, sl@0: {0x18,0x18,0x7E,0xC0,0xC0,0x7E,0x18,0x18,0x00,0x00}, sl@0: {0x1C,0x36,0x32,0x78,0x30,0x73,0x7E,0x00,0x00,0x00}, //£ sl@0: {0x66,0x66,0x3C,0x7E,0x18,0x7E,0x18,0x18,0x00,0x00}, sl@0: {0xF8,0xCC,0xCC,0xFA,0xC6,0xCF,0xC6,0xC7,0x00,0x00}, sl@0: {0x0E,0x1B,0x18,0x3C,0x18,0x18,0xD8,0x70,0x00,0x00}, sl@0: sl@0: {0x0E,0x00,0x3C,0x06,0x3E,0x66,0x3F,0x00,0x00,0x00}, sl@0: {0x1C,0x00,0x38,0x18,0x18,0x18,0x3C,0x00,0x00,0x00}, sl@0: {0x00,0x0E,0x00,0x3C,0x66,0x66,0x3C,0x00,0x00,0x00}, sl@0: {0x00,0x0E,0x00,0x66,0x66,0x66,0x3F,0x00,0x00,0x00}, sl@0: {0x00,0x7C,0x00,0x7C,0x66,0x66,0x66,0x00,0x00,0x00}, sl@0: {0x7E,0x00,0x66,0x76,0x7E,0x6E,0x66,0x00,0x00,0x00}, sl@0: {0x3C,0x6C,0x6C,0x3E,0x00,0x7E,0x00,0x00,0x00,0x00}, sl@0: {0x38,0x6C,0x6C,0x38,0x00,0x7C,0x00,0x00,0x00,0x00}, sl@0: {0x18,0x00,0x18,0x30,0x60,0x66,0x3C,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x00,0x7E,0x60,0x60,0x00,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x00,0x7E,0x06,0x06,0x00,0x00,0x00,0x00}, sl@0: {0xC3,0xC6,0xCC,0xDE,0x33,0x66,0xCC,0x0F,0x00,0x00}, sl@0: {0xC3,0xC6,0xCC,0xDB,0x37,0x6F,0xCF,0x03,0x00,0x00}, sl@0: {0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x00,0x00,0x00}, sl@0: {0x00,0x33,0x66,0xCC,0x66,0x33,0x00,0x00,0x00,0x00}, sl@0: {0x00,0xCC,0x66,0x33,0x66,0xCC,0x00,0x00,0x00,0x00}, sl@0: sl@0: {0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x00,0x00}, sl@0: {0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA}, sl@0: {0xDB,0x77,0xDB,0xEE,0xDB,0x77,0xDB,0xEE,0xDB,0x77}, sl@0: {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}, sl@0: {0x18,0x18,0x18,0x18,0xF8,0x18,0x18,0x18,0x18,0x18}, sl@0: {0x18,0x18,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18}, sl@0: {0x36,0x36,0x36,0x36,0xF6,0x36,0x36,0x36,0x36,0x36}, sl@0: {0x00,0x00,0x00,0x00,0xFE,0x36,0x36,0x36,0x36,0x36}, sl@0: {0x00,0x00,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18}, sl@0: {0x36,0x36,0xF6,0x06,0xF6,0x36,0x36,0x36,0x36,0x36}, sl@0: {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}, sl@0: {0x00,0x00,0xFE,0x06,0xF6,0x36,0x36,0x36,0x36,0x36}, sl@0: {0x36,0x36,0xF6,0x06,0xFE,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x36,0x36,0x36,0x36,0xFE,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x18,0x18,0xF8,0x18,0xF8,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x00,0x00,0xF8,0x18,0x18,0x18,0x18,0x18}, sl@0: sl@0: {0x18,0x18,0x18,0x18,0x1F,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x18,0x18,0x18,0x18,0xFF,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18}, sl@0: {0x18,0x18,0x18,0x18,0x1F,0x18,0x18,0x18,0x18,0x18}, sl@0: {0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x18,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x18,0x18}, sl@0: {0x18,0x18,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18}, sl@0: {0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x36,0x36}, sl@0: {0x36,0x36,0x37,0x30,0x3F,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x3F,0x30,0x37,0x36,0x36,0x36,0x36,0x36}, sl@0: {0x36,0x36,0xF7,0x00,0xFF,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x00,0x00,0xFF,0x00,0xF7,0x36,0x36,0x36,0x36,0x36}, sl@0: {0x36,0x36,0x37,0x30,0x37,0x36,0x36,0x36,0x36,0x36}, sl@0: {0x00,0x00,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x36,0x36,0xF7,0x00,0xF7,0x36,0x36,0x36,0x36,0x36}, sl@0: {0x18,0x18,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00}, sl@0: sl@0: {0x36,0x36,0x36,0x36,0xFF,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x00,0x00,0xFF,0x00,0xFF,0x18,0x18,0x18,0x18,0x18}, sl@0: {0x00,0x00,0x00,0x00,0xFF,0x36,0x36,0x36,0x36,0x36}, sl@0: {0x36,0x36,0x36,0x36,0x3F,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x18,0x18,0x1F,0x18,0x1F,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18}, sl@0: {0x00,0x00,0x00,0x00,0x3F,0x36,0x36,0x36,0x36,0x36}, sl@0: {0x36,0x36,0x36,0x36,0xFF,0x36,0x36,0x36,0x36,0x36}, sl@0: {0x18,0x18,0xFF,0x18,0xFF,0x18,0x18,0x18,0x18,0x18}, sl@0: {0x18,0x18,0x18,0x18,0xF8,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x00,0x00,0x1F,0x18,0x18,0x18,0x18,0x18}, sl@0: {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00}, sl@0: {0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00}, sl@0: {0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0x00,0x00}, sl@0: {0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x00,0x00}, sl@0: {0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00}, sl@0: sl@0: {0x00,0x00,0x3B,0x6E,0x64,0x6E,0x3B,0x00,0x00,0x00}, sl@0: {0x00,0x3C,0x66,0x7C,0x66,0x7C,0x60,0x60,0x00,0x00}, sl@0: {0x00,0x7E,0x66,0x60,0x60,0x60,0x60,0x00,0x00,0x00}, sl@0: {0x00,0x7F,0x36,0x36,0x36,0x36,0x36,0x00,0x00,0x00}, sl@0: {0x7E,0x66,0x30,0x18,0x30,0x66,0x7E,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x3F,0x6C,0x6C,0x6C,0x38,0x00,0x00,0x00}, sl@0: {0x00,0x33,0x33,0x33,0x33,0x3E,0x30,0x60,0x00,0x00}, sl@0: {0x00,0x3B,0x6E,0x0C,0x0C,0x0C,0x0C,0x00,0x00,0x00}, sl@0: {0x7E,0x18,0x3C,0x66,0x66,0x3C,0x18,0x7E,0x00,0x00}, sl@0: {0x1C,0x36,0x63,0x7F,0x63,0x36,0x1C,0x00,0x00,0x00}, sl@0: {0x1C,0x36,0x63,0x63,0x36,0x36,0x77,0x00,0x00,0x00}, sl@0: {0x0E,0x18,0x0C,0x3E,0x66,0x66,0x3C,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x7E,0xDB,0xDB,0x7E,0x00,0x00,0x00,0x00}, sl@0: {0x06,0x0C,0x7E,0xDB,0xDB,0x7E,0x60,0xC0,0x00,0x00}, sl@0: {0x1C,0x60,0xC0,0xFC,0xC0,0x60,0x1C,0x00,0x00,0x00}, sl@0: {0x3C,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00}, sl@0: sl@0: {0x00,0x7E,0x00,0x7E,0x00,0x7E,0x00,0x00,0x00,0x00}, sl@0: {0x18,0x18,0x7E,0x18,0x18,0x00,0x7E,0x00,0x00,0x00}, sl@0: {0x30,0x18,0x0C,0x18,0x30,0x00,0x7E,0x00,0x00,0x00}, sl@0: {0x0C,0x18,0x30,0x18,0x0C,0x00,0x7E,0x00,0x00,0x00}, sl@0: {0x0E,0x1B,0x1B,0x18,0x18,0x18,0x18,0x18,0x00,0x00}, sl@0: {0x18,0x18,0x18,0x18,0x18,0xD8,0xD8,0x70,0x00,0x00}, sl@0: {0x18,0x18,0x00,0x7E,0x00,0x18,0x18,0x00,0x00,0x00}, sl@0: {0x00,0x76,0xDC,0x00,0x76,0xDC,0x00,0x00,0x00,0x00}, sl@0: {0x38,0x6C,0x6C,0x38,0x00,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x0F,0x0C,0x0C,0x0C,0xEC,0x6C,0x3C,0x1C,0x00,0x00}, sl@0: {0x78,0x6C,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x70,0x18,0x30,0x60,0x78,0x00,0x00,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x3C,0x3C,0x3C,0x3C,0x00,0x00,0x00,0x00}, sl@0: {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} sl@0: }; sl@0: sl@0: sl@0: sl@0: /** sl@0: * A copy of the standard 256 color palette used by the SymbianOS. sl@0: * Each value is in the format 00000000bbbbbbbbggggggggrrrrrrrr sl@0: */ sl@0: const TUint32 Palette256[256] = sl@0: { sl@0: 0x00000000, 0x00000033, 0x00000066, 0x00000099, 0x000000cc, 0x000000ff, sl@0: 0x00003300, 0x00003333, 0x00003366, 0x00003399, 0x000033cc, 0x000033ff, sl@0: 0x00006600, 0x00006633, 0x00006666, 0x00006699, 0x000066cc, 0x000066ff, sl@0: 0x00009900, 0x00009933, 0x00009966, 0x00009999, 0x000099cc, 0x000099ff, sl@0: 0x0000cc00, 0x0000cc33, 0x0000cc66, 0x0000cc99, 0x0000cccc, 0x0000ccff, sl@0: 0x0000ff00, 0x0000ff33, 0x0000ff66, 0x0000ff99, 0x0000ffcc, 0x0000ffff, sl@0: sl@0: 0x00330000, 0x00330033, 0x00330066, 0x00330099, 0x003300cc, 0x003300ff, sl@0: 0x00333300, 0x00333333, 0x00333366, 0x00333399, 0x003333cc, 0x003333ff, sl@0: 0x00336600, 0x00336633, 0x00336666, 0x00336699, 0x003366cc, 0x003366ff, sl@0: 0x00339900, 0x00339933, 0x00339966, 0x00339999, 0x003399cc, 0x003399ff, sl@0: 0x0033cc00, 0x0033cc33, 0x0033cc66, 0x0033cc99, 0x0033cccc, 0x0033ccff, sl@0: 0x0033ff00, 0x0033ff33, 0x0033ff66, 0x0033ff99, 0x0033ffcc, 0x0033ffff, sl@0: sl@0: 0x00660000, 0x00660033, 0x00660066, 0x00660099, 0x006600cc, 0x006600ff, sl@0: 0x00663300, 0x00663333, 0x00663366, 0x00663399, 0x006633cc, 0x006633ff, sl@0: 0x00666600, 0x00666633, 0x00666666, 0x00666699, 0x006666cc, 0x006666ff, sl@0: 0x00669900, 0x00669933, 0x00669966, 0x00669999, 0x006699cc, 0x006699ff, sl@0: 0x0066cc00, 0x0066cc33, 0x0066cc66, 0x0066cc99, 0x0066cccc, 0x0066ccff, sl@0: 0x0066ff00, 0x0066ff33, 0x0066ff66, 0x0066ff99, 0x0066ffcc, 0x0066ffff, sl@0: sl@0: 0x00111111, 0x00222222, 0x00444444, 0x00555555, 0x00777777, sl@0: 0x00000011, 0x00000022, 0x00000044, 0x00000055, 0x00000077, sl@0: 0x00001100, 0x00002200, 0x00004400, 0x00005500, 0x00007700, sl@0: 0x00110000, 0x00220000, 0x00440000, 0x00550000, 0x00770000, sl@0: sl@0: 0x00880000, 0x00aa0000, 0x00bb0000, 0x00dd0000, 0x00ee0000, sl@0: 0x00008800, 0x0000aa00, 0x0000bb00, 0x0000dd00, 0x0000ee00, sl@0: 0x00000088, 0x000000aa, 0x000000bb, 0x000000dd, 0x000000ee, sl@0: 0x00888888, 0x00aaaaaa, 0x00bbbbbb, 0x00dddddd, 0x00eeeeee, sl@0: sl@0: 0x00990000, 0x00990033, 0x00990066, 0x00990099, 0x009900cc, 0x009900ff, sl@0: 0x00993300, 0x00993333, 0x00993366, 0x00993399, 0x009933cc, 0x009933ff, sl@0: 0x00996600, 0x00996633, 0x00996666, 0x00996699, 0x009966cc, 0x009966ff, sl@0: 0x00999900, 0x00999933, 0x00999966, 0x00999999, 0x009999cc, 0x009999ff, sl@0: 0x0099cc00, 0x0099cc33, 0x0099cc66, 0x0099cc99, 0x0099cccc, 0x0099ccff, sl@0: 0x0099ff00, 0x0099ff33, 0x0099ff66, 0x0099ff99, 0x0099ffcc, 0x0099ffff, sl@0: sl@0: 0x00cc0000, 0x00cc0033, 0x00cc0066, 0x00cc0099, 0x00cc00cc, 0x00cc00ff, sl@0: 0x00cc3300, 0x00cc3333, 0x00cc3366, 0x00cc3399, 0x00cc33cc, 0x00cc33ff, sl@0: 0x00cc6600, 0x00cc6633, 0x00cc6666, 0x00cc6699, 0x00cc66cc, 0x00cc66ff, sl@0: 0x00cc9900, 0x00cc9933, 0x00cc9966, 0x00cc9999, 0x00cc99cc, 0x00cc99ff, sl@0: 0x00cccc00, 0x00cccc33, 0x00cccc66, 0x00cccc99, 0x00cccccc, 0x00ccccff, sl@0: 0x00ccff00, 0x00ccff33, 0x00ccff66, 0x00ccff99, 0x00ccffcc, 0x00ccffff, sl@0: sl@0: 0x00ff0000, 0x00ff0033, 0x00ff0066, 0x00ff0099, 0x00ff00cc, 0x00ff00ff, sl@0: 0x00ff3300, 0x00ff3333, 0x00ff3366, 0x00ff3399, 0x00ff33cc, 0x00ff33ff, sl@0: 0x00ff6600, 0x00ff6633, 0x00ff6666, 0x00ff6699, 0x00ff66cc, 0x00ff66ff, sl@0: 0x00ff9900, 0x00ff9933, 0x00ff9966, 0x00ff9999, 0x00ff99cc, 0x00ff99ff, sl@0: 0x00ffcc00, 0x00ffcc33, 0x00ffcc66, 0x00ffcc99, 0x00ffcccc, 0x00ffccff, sl@0: 0x00ffff00, 0x00ffff33, 0x00ffff66, 0x00ffff99, 0x00ffffcc, 0x00ffffff sl@0: }; sl@0: sl@0: /** sl@0: * Construct and return the new screen driver sl@0: */ sl@0: EXPORT_C CScreenDriver* CScreenDriver::New() sl@0: { sl@0: __DEBUG_PRINT(_L("CSD::New")); sl@0: sl@0: #ifdef __X86__ sl@0: TInt mode=0; sl@0: HAL::Get(HAL::EDisplayMode, mode); sl@0: if (mode==0) sl@0: return NewScreenDriverVgaText(); sl@0: #endif sl@0: CScreenDriverTemplate *pS=new CScreenDriverTemplate; sl@0: if (pS->iScreenAddress) sl@0: { sl@0: return(pS); sl@0: } sl@0: delete pS; sl@0: return(NULL); sl@0: } sl@0: sl@0: sl@0: sl@0: /** sl@0: * Implementation of the screen driver sl@0: * Constructor sl@0: */ sl@0: sl@0: CScreenDriverTemplate::CScreenDriverTemplate() sl@0: { sl@0: sl@0: __DEBUG_PRINT(_L("CSD::Ctor")); sl@0: sl@0: // sl@0: // Start in default mode the display driver is in sl@0: // sl@0: TInt offset; sl@0: TInt r = HAL::Get(HAL::EDisplayMode, iDisplayMode); sl@0: if(r!=KErrNone) sl@0: goto fail; sl@0: __DEBUG_PRINT2(_L("EDisplayMode %d"), iDisplayMode); sl@0: sl@0: iBitsPerPixel = iDisplayMode; //getbpp needs the current mode as its param sl@0: r = HAL::Get(HAL::EDisplayBitsPerPixel,iBitsPerPixel); sl@0: if(r!=KErrNone) sl@0: goto fail; sl@0: __DEBUG_PRINT2(_L("EDisplayBitsPerPixel %d"), iBitsPerPixel); sl@0: sl@0: iIsPalettized = iDisplayMode; //ispalettized needs the current mode as its param sl@0: r = HAL::Get(HAL::EDisplayIsPalettized,iIsPalettized); sl@0: if(r!=KErrNone) sl@0: goto fail; sl@0: __DEBUG_PRINT2(_L("EDisplayIsPalettized %d"),iIsPalettized); sl@0: sl@0: iIsMono = iDisplayMode; //ispalettized needs the current mode as its param sl@0: r = HAL::Get(HAL::EDisplayIsMono, iIsMono); sl@0: if(r!=KErrNone) sl@0: goto fail; sl@0: __DEBUG_PRINT2(_L("EDisplayIsMono %d"), iIsMono); sl@0: sl@0: sl@0: CalcColorMode(); sl@0: sl@0: __DEBUG_PRINT2(_L("iMode is %d"),iMode); sl@0: // sl@0: // Obtain the screen info from HAL sl@0: // sl@0: r = HAL::Get(HAL::EDisplayMemoryAddress,iScreenAddress); sl@0: if(r!=KErrNone) sl@0: goto fail; sl@0: __DEBUG_PRINT2(_L("EDisplayMemoryAddress 0x%x"), iScreenAddress); sl@0: sl@0: offset = iDisplayMode; sl@0: r = HAL::Get(HAL::EDisplayOffsetToFirstPixel,offset); sl@0: if(r!=KErrNone) sl@0: goto fail; sl@0: __DEBUG_PRINT2(_L("EDisplayOffsetToFirstPixel %d"),offset); sl@0: iScreenAddress += offset; sl@0: sl@0: iScreenOffsetBetweenLines = iDisplayMode; sl@0: r = HAL::Get(HAL::EDisplayOffsetBetweenLines,iScreenOffsetBetweenLines); sl@0: if(r!=KErrNone) sl@0: goto fail; sl@0: __DEBUG_PRINT2(_L("EDisplayOffsetBetweenLines %d"), iScreenOffsetBetweenLines); sl@0: sl@0: r = HAL::Get(HAL::EDisplayXPixels,iScreenWidth); sl@0: if(r!=KErrNone) sl@0: goto fail; sl@0: __DEBUG_PRINT2(_L("EDisplayXPixels %d"),iScreenWidth); sl@0: sl@0: r = HAL::Get(HAL::EDisplayYPixels,iScreenHeight); sl@0: if(r!=KErrNone) sl@0: goto fail; sl@0: __DEBUG_PRINT2(_L("EDisplayYPixels %d"), iScreenHeight); sl@0: sl@0: if(iMode==EColor256) sl@0: { sl@0: // Setup palette (this is the standard SymbianOS 256 colour palette) sl@0: for(TInt i=0; i<256; i++) sl@0: { sl@0: TInt entry = Palette256[i]+(i<<24); sl@0: HAL::Set(HAL::EDisplayPaletteEntry,entry); // Ignore error sl@0: } sl@0: __DEBUG_PRINT(_L("EColor256")); sl@0: } sl@0: else if(iMode==EGray16) sl@0: { sl@0: // Setup palette sl@0: for(TInt i=0; i<16; i++) sl@0: { sl@0: TInt entry = i|(i<<4); sl@0: entry |= entry<<8; sl@0: entry |= entry<<12; sl@0: HAL::Set(HAL::EDisplayPaletteEntry,entry); // Ignore error sl@0: } sl@0: __DEBUG_PRINT(_L("EGray16")); sl@0: } sl@0: else if(iMode==EGray4) sl@0: { sl@0: // Setup palette sl@0: for(TInt i=0; i<4; i++) sl@0: { sl@0: TInt entry = i|(i<<2); sl@0: entry |= entry<<4; sl@0: entry |= entry<<8; sl@0: entry |= entry<<10; sl@0: HAL::Set(HAL::EDisplayPaletteEntry,entry); // Ignore error sl@0: } sl@0: __DEBUG_PRINT(_L("EGray4")); sl@0: } sl@0: else if(iMode==EMono) sl@0: { sl@0: // Setup palette sl@0: TInt entry = 0; sl@0: HAL::Set(HAL::EDisplayPaletteEntry,entry); // Ignore error sl@0: entry = 0x01FFFFFF; sl@0: HAL::Set(HAL::EDisplayPaletteEntry,entry); // Ignore error sl@0: __DEBUG_PRINT(_L("EMono")); sl@0: } sl@0: else sl@0: { sl@0: __DEBUG_PRINT(_L("unknown mode")); sl@0: sl@0: } sl@0: sl@0: // sl@0: // Initialise values used for drawing sl@0: // sl@0: if(iBitsPerPixel==12) sl@0: iPixelSize = 16; sl@0: else sl@0: iPixelSize = iBitsPerPixel; sl@0: sl@0: { sl@0: TInt KBackgroundColor = 0xff0000; // color in format 0xbbggrr sl@0: TInt KTextColor = 0xffffff; // color in format 0xbbggrr sl@0: sl@0: if (( iBitsPerPixel == 24 ) || ( iBitsPerPixel == 32 ) ) sl@0: { sl@0: iPixelSize = 32; sl@0: // KTextColor = 0x00FFFF;//Text color yellow when 24ubpp sl@0: } sl@0: sl@0: if(iPixelSize<8) sl@0: { sl@0: KBackgroundColor = 0xffffff; // color in format 0xbbggrr sl@0: KTextColor = 0x000000; // color in format 0xbbggrr sl@0: } sl@0: sl@0: iBackgroundPixel = ColorToPixel(KBackgroundColor); sl@0: iBackgroundFill = iBackgroundPixel; sl@0: { sl@0: TInt shift = iPixelSize; sl@0: while(shift<32) sl@0: { sl@0: iBackgroundFill |= iBackgroundFill<> 3); sl@0: } sl@0: sl@0: void CScreenDriverTemplate::CalcColorMode() sl@0: { sl@0: iMode = 0; sl@0: //calculate the color mode sl@0: if (iIsPalettized) sl@0: { sl@0: if (iIsMono) sl@0: { sl@0: if (1 == iBitsPerPixel) sl@0: iMode = EMono; sl@0: else if (2 == iBitsPerPixel) sl@0: iMode = EGray4; sl@0: else if (4 == iBitsPerPixel) sl@0: iMode = EGray16; sl@0: } sl@0: else sl@0: { sl@0: if (8 == iBitsPerPixel) sl@0: iMode = EColor256; sl@0: else if (4 == iBitsPerPixel) sl@0: iMode = EGray16; //we are color but color16 is not supported sl@0: } sl@0: } sl@0: else sl@0: { sl@0: if (!iIsMono) sl@0: { sl@0: if (12 == iBitsPerPixel) sl@0: iMode = EColor4K; sl@0: else if (16 == iBitsPerPixel) sl@0: iMode = EColor64K; sl@0: else if (24 == iBitsPerPixel) sl@0: iMode = EColor16M; sl@0: else if (32 == iBitsPerPixel) sl@0: iMode = EColor16M; sl@0: } sl@0: } sl@0: sl@0: } sl@0: sl@0: TInt CScreenDriverTemplate::ColorToPixel(TInt aColorRgb) sl@0: // sl@0: // Returns the pixel value which is closest to the given RGB value sl@0: // sl@0: { sl@0: TInt r = aColorRgb&0xFF; sl@0: TInt g = (aColorRgb>>8)&0xFF; sl@0: TInt b = (aColorRgb>>16)&0xFF; sl@0: sl@0: switch(iMode) sl@0: { sl@0: case EColor16M: sl@0: return (r<<16)+(g<<8)+b; sl@0: sl@0: case EColor64K: sl@0: return ((r>>3)<<11)+((g>>2)<<5)+(b>>3); sl@0: sl@0: case EColor4K: sl@0: return ((r>>4)<<8)+((g>>4)<<4)+(b>>4); sl@0: sl@0: case EColor256: sl@0: { sl@0: TInt best = 0; sl@0: TInt bestDif = KMaxTInt; sl@0: for(TInt i=0; i<256; i++) sl@0: { sl@0: TInt value = Palette256[i]; sl@0: TInt dr = (value&0xFF)-r; sl@0: TInt dg = ((value>>8)&0xFF)-g; sl@0: TInt db = ((value>>16)&0xFF)-b; sl@0: TInt dif = dr*dr + dg*dg + db*db; sl@0: if(dif>7; sl@0: sl@0: case EGray4: sl@0: return (r*2+g*4+b)>>9; sl@0: sl@0: case EMono: sl@0: return (r*2+g*4+b)>>10; sl@0: } sl@0: sl@0: return 0; sl@0: } sl@0: sl@0: sl@0: void CScreenDriverTemplate::Blit(const TText *aBuffer, TInt aLength, const TPoint &aPosition) sl@0: // sl@0: // Write contiguous block of characters to some segment of a line on the display sl@0: // sl@0: { sl@0: // sl@0: // ASSUMPTION: sl@0: // sl@0: // The start of each character on the display is byte aligned. sl@0: // i.e. KPixelsPerChar*iPixelSize%8 == 0 sl@0: sl@0: // Clip text to screen width sl@0: if(aLength+aPosition.iX > iScreenWidth/KPixelsPerChar) sl@0: aLength = iScreenWidth/KPixelsPerChar-aPosition.iX; sl@0: sl@0: TUint8* screenPtr = CharPosToScreenAddress(aPosition); sl@0: TInt lineAddon = iScreenOffsetBetweenLines-((iPixelSize*KPixelsPerChar)>>3); sl@0: TInt bgPixel = iBackgroundPixel; sl@0: TInt textPixel = iTextPixel; sl@0: sl@0: while(aLength-->0) sl@0: { sl@0: TUint8* pixelPtr = screenPtr; sl@0: screenPtr += (iPixelSize*KPixelsPerChar)>>3; sl@0: TInt character = (*aBuffer++)&0xff; sl@0: TInt y; sl@0: sl@0: switch(iPixelSize) sl@0: { sl@0: sl@0: case 1: sl@0: for(y=0; y>= 1; sl@0: } sl@0: while(bitMask); sl@0: pixelPtr += lineAddon; sl@0: } sl@0: break; sl@0: sl@0: case 2: sl@0: for(y=0; y>= 1; sl@0: sl@0: if(bitData & bitMask) sl@0: byte |= textPixel<<2; sl@0: else sl@0: byte |= bgPixel<<2; sl@0: bitMask >>= 1; sl@0: sl@0: if(bitData & bitMask) sl@0: byte |= textPixel<<4; sl@0: else sl@0: byte |= bgPixel<<4; sl@0: bitMask >>= 1; sl@0: sl@0: if(bitData & bitMask) sl@0: byte |= textPixel<<6; sl@0: else sl@0: byte |= bgPixel<<6; sl@0: *pixelPtr++ = (TUint8)byte; sl@0: bitMask >>= 1; sl@0: } sl@0: while(bitMask); sl@0: pixelPtr += lineAddon; sl@0: } sl@0: break; sl@0: sl@0: case 4: sl@0: for(y=0; y>= 1; sl@0: sl@0: if(bitData & bitMask) sl@0: byte |= textPixel<<4; sl@0: else sl@0: byte |= bgPixel<<4; sl@0: *pixelPtr++ = (TUint8)byte; sl@0: bitMask >>= 1; sl@0: } sl@0: while(bitMask); sl@0: pixelPtr += lineAddon; sl@0: } sl@0: break; sl@0: sl@0: case 8: sl@0: for(y=0; y>= 1; sl@0: } sl@0: while(bitMask); sl@0: pixelPtr += lineAddon; sl@0: } sl@0: break; sl@0: sl@0: case 16: sl@0: for(y=0; y>8); sl@0: } sl@0: else sl@0: { sl@0: *pixelPtr++ = (TUint8)bgPixel; sl@0: *pixelPtr++ = (TUint8)(bgPixel>>8); sl@0: } sl@0: bitMask >>= 1; sl@0: } sl@0: while(bitMask); sl@0: pixelPtr += lineAddon; sl@0: } sl@0: break; sl@0: sl@0: case 24: sl@0: for(y=0; y>8); sl@0: *pixelPtr++ = (TUint8)(textPixel>>16); sl@0: } sl@0: else sl@0: { sl@0: *pixelPtr++ = (TUint8)bgPixel; sl@0: *pixelPtr++ = (TUint8)(bgPixel>>8); sl@0: *pixelPtr++ = (TUint8)(bgPixel>>16); sl@0: } sl@0: bitMask >>= 1; sl@0: } sl@0: while(bitMask); sl@0: pixelPtr += lineAddon; sl@0: } sl@0: break; sl@0: sl@0: case 32: sl@0: for(y=0; y>8);//Green sl@0: *pixelPtr++ = (TUint8)(textPixel>>16);//Red sl@0: ++pixelPtr; sl@0: } sl@0: else sl@0: { sl@0: *pixelPtr++ = (TUint8)bgPixel;//Blue sl@0: *pixelPtr++ = (TUint8)(bgPixel>>8);//Green sl@0: *pixelPtr++ = (TUint8)(bgPixel>>16);//Red sl@0: ++pixelPtr; sl@0: } sl@0: bitMask >>= 1; sl@0: } sl@0: while(bitMask); sl@0: pixelPtr += lineAddon; sl@0: } sl@0: break; sl@0: sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: TBool CScreenDriverTemplate::ScrollUp(const TRect& aRect) sl@0: // sl@0: // Scroll a rectangle of the screen up one character, don't update bottom line sl@0: // sl@0: { sl@0: __DEBUG_PRINT(_L("CSD::ScrollUp")); sl@0: sl@0: if (iHwAcc & KHwAccBlockCopy) sl@0: { sl@0: SRectOpInfo roi; sl@0: roi.iX = KPixelsPerChar*aRect.iTl.iX; sl@0: roi.iY = KLinesPerChar*aRect.iTl.iY; sl@0: roi.iWidth = aRect.Width()*KPixelsPerChar; sl@0: roi.iHeight = (aRect.Height()-1) * KLinesPerChar; sl@0: roi.iSrcX = roi.iX; sl@0: roi.iSrcY = roi.iY + KLinesPerChar; sl@0: HwBlockCopy(roi); sl@0: return ETrue; sl@0: } sl@0: TUint8* dstAddress = CharPosToScreenAddress(aRect.iTl); sl@0: TUint8* srcAddress = dstAddress + iScreenOffsetBetweenLines * KLinesPerChar; sl@0: TInt lines = (aRect.Height()-1) * KLinesPerChar; sl@0: TInt bytesPerLine = (aRect.Width() * KPixelsPerChar * iPixelSize)>>3; sl@0: sl@0: while(lines>0) sl@0: { sl@0: Mem::Copy(dstAddress,srcAddress,bytesPerLine); sl@0: srcAddress += iScreenOffsetBetweenLines; sl@0: dstAddress += iScreenOffsetBetweenLines; sl@0: --lines; sl@0: } sl@0: sl@0: return ETrue; sl@0: } sl@0: sl@0: sl@0: void CScreenDriverTemplate::Clear(const TRect& aRect) sl@0: // sl@0: // Clears a rectangular region with the background colour sl@0: // sl@0: { sl@0: __DEBUG_PRINT(_L("CSD::Clear")); sl@0: sl@0: if (iHwAcc & KHwAccBlockFill) sl@0: { sl@0: SRectOpInfo roi; sl@0: roi.iX = KPixelsPerChar*aRect.iTl.iX; sl@0: roi.iY = KLinesPerChar*aRect.iTl.iY; sl@0: roi.iWidth = aRect.Width()*KPixelsPerChar; sl@0: roi.iHeight = aRect.Height() * KLinesPerChar; sl@0: roi.iSrcX = roi.iX; sl@0: roi.iSrcY = roi.iY; sl@0: roi.iColor = iBackgroundFill; sl@0: HwBlockCopy(roi); sl@0: return; sl@0: } sl@0: sl@0: TUint8* dstAddress = CharPosToScreenAddress(aRect.iTl); sl@0: TInt lines = aRect.Height() * KLinesPerChar; sl@0: TInt bytesPerLine = (aRect.Width() * KPixelsPerChar * iPixelSize)>>3; sl@0: sl@0: switch(iPixelSize) sl@0: { sl@0: case 32: sl@0: while(lines>0) sl@0: { sl@0: TUint32 fillValue = iBackgroundFill; sl@0: TUint8* ptr = dstAddress; sl@0: TUint8* ptrLimit = ptr+bytesPerLine; sl@0: while(ptr0) sl@0: { sl@0: TUint32 fillValue = iBackgroundFill; sl@0: TUint8* ptr = dstAddress; sl@0: TUint8* ptrLimit = ptr+bytesPerLine; sl@0: while(ptr0) sl@0: { sl@0: TUint32 fillValue = iBackgroundFill; sl@0: TUint8* ptr = dstAddress; sl@0: TUint8* ptrLimit = ptr+bytesPerLine; sl@0: while(ptr0) sl@0: { sl@0: Mem::Fill(dstAddress,bytesPerLine,iBackgroundFill); sl@0: dstAddress += iScreenOffsetBetweenLines; sl@0: --lines; sl@0: } sl@0: break; sl@0: } sl@0: } sl@0: sl@0: sl@0: sl@0: /** sl@0: * You don't need to implement this function. sl@0: */ sl@0: void CScreenDriverTemplate::SetPixel(const TPoint& /*aPoint*/,TUint8 /*aColour*/) sl@0: { sl@0: __DEBUG_PRINT(_L("CSD::SetPix")); sl@0: } sl@0: sl@0: sl@0: /** sl@0: * You don't need to implement this function. sl@0: */ sl@0: TInt CScreenDriverTemplate::GetPixel(const TPoint& /*aPoint*/) sl@0: { sl@0: __DEBUG_PRINT(_L("CSD::GetPix")); sl@0: return 0; sl@0: } sl@0: sl@0: sl@0: /** sl@0: * You don't need to implement this function. sl@0: */ sl@0: void CScreenDriverTemplate::SetWord(const TPoint& /*aPoint*/,TInt /*aWord*/) sl@0: { sl@0: __DEBUG_PRINT(_L("CSD::SetWord")); sl@0: } sl@0: sl@0: sl@0: /** sl@0: * You don't need to implement this function. sl@0: */ sl@0: TInt CScreenDriverTemplate::GetWord(const TPoint& /*aPoint*/) sl@0: { sl@0: __DEBUG_PRINT(_L("CSD::GetWord")); sl@0: return 0; sl@0: } sl@0: sl@0: sl@0: // You don't need to implement the following functions sl@0: sl@0: /** sl@0: * You don't need to implement this function. sl@0: */ sl@0: void CScreenDriverTemplate::SetLine(const TPoint& /*aPoint*/,const TPixelLine& /*aPixelLine*/) sl@0: { sl@0: __DEBUG_PRINT(_L("CSD::SetLine")); sl@0: } sl@0: sl@0: sl@0: /** sl@0: * You don't need to implement this function. sl@0: */ sl@0: void CScreenDriverTemplate::GetLine(const TPoint& /*aPoint*/,TPixelLine& /*aPixelLine*/) sl@0: { sl@0: __DEBUG_PRINT(_L("CSD::GetLine")); sl@0: } sl@0: sl@0: sl@0: /** sl@0: * You don't need to implement this function. sl@0: */ sl@0: void CScreenDriverTemplate::SetPaletteEntry(TColorIndex /*anIndex*/,TUint8 /*aRed*/,TUint8 /*aGreen*/,TUint8 /*aBlue*/) sl@0: { sl@0: } sl@0: sl@0: sl@0: /** sl@0: * You don't need to implement this function. sl@0: */ sl@0: void CScreenDriverTemplate::GetPaletteEntry(TColorIndex /*anIndex*/,TUint8& /*aRed*/,TUint8& /*aGreen*/,TUint8& /*aBlue*/) sl@0: { sl@0: } sl@0: sl@0: sl@0: /** sl@0: * You don't need to implement this function. sl@0: */ sl@0: void CScreenDriverTemplate::SetForegroundColor(TColorIndex /*anIndex*/) sl@0: { sl@0: } sl@0: sl@0: sl@0: /** sl@0: * You don't need to implement this function. sl@0: */ sl@0: void CScreenDriverTemplate::SetBackgroundColor(TColorIndex /*anIndex*/) sl@0: { sl@0: } sl@0: sl@0: sl@0: /** sl@0: * You don't need to implement this function. sl@0: */ sl@0: void CScreenDriverTemplate::GetAttributeColors(TColorIndex* /*anArray*/) sl@0: { sl@0: } sl@0: