diff -r 000000000000 -r a41df078684a kernel/eka/drivers/edisp/epoc/vga/vgatext.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kernel/eka/drivers/edisp/epoc/vga/vgatext.cpp Mon Oct 19 15:55:17 2009 +0100 @@ -0,0 +1,238 @@ +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// e32\drivers\edisp\epoc\vga\vgatext.cpp +// Brutus display driver +// +// + +#include "ws_std.h" + +const TUint KCharAttrib=0x17; // white on blue + +#if 0 +#define __DEBUG_PRINT(a) RDebug::Print(a) +#define __DEBUG_PRINT2(a,b) RDebug::Print(a,b) +#else +#define __DEBUG_PRINT(a) +#define __DEBUG_PRINT2(a,b) +#endif + +class CScreenDriverVgaText : public CScreenDriver + { +public: + CScreenDriverVgaText(); + virtual void Init(TSize &aScreenSize,TSize &aFontSize); + virtual void Blit(const TText *aBuffer,TInt aLength,const TPoint &aPosition); + virtual TBool ScrollUp(const TRect& aRect); + virtual void Clear(const TRect& aRect); + + virtual void SetPixel(const TPoint& aPoint,TUint8 aColour); + virtual TInt GetPixel(const TPoint& aPoint); + virtual void SetWord(const TPoint& aPoint,TInt aWord); + virtual TInt GetWord(const TPoint& aPoint); + virtual void SetLine(const TPoint& aPoint,const TPixelLine& aPixelLine); + virtual void GetLine(const TPoint& aPoint,TPixelLine& aPixelLine); + + virtual void SetPaletteEntry(TColorIndex anIndex,TUint8 aRed,TUint8 aGreen,TUint8 aBlue); + virtual void GetPaletteEntry(TColorIndex anIndex,TUint8 &aRed,TUint8 &aGreen,TUint8 &aBlue); + virtual void SetForegroundColor(TColorIndex anIndex); + virtual void SetBackgroundColor(TColorIndex anIndex); + virtual void GetAttributeColors(TColorIndex* anArray); + virtual TInt SetMode(TVideoMode aMode); +public: + TInt iMode; + TUint16* iScreen; + TInt iSizeX; + TInt iSizeY; + friend class CScreenDriver; + }; + +CScreenDriverVgaText::CScreenDriverVgaText() +// +// Constructor +// + { + __DEBUG_PRINT(_L("CSD::Ctor")); + iMode=EMono; + } + +CScreenDriver* NewScreenDriverVgaText() +// +// Return the actual screen driver. +// + { + + __DEBUG_PRINT(_L("CSD::New")); + + CScreenDriverVgaText* s=new CScreenDriverVgaText; + if (!s) + return NULL; + TScreenInfoV01 info; + TPckg infoPckg(info); + UserSvr::ScreenInfo(infoPckg); + if (!info.iScreenAddressValid) + { + delete s; + return NULL; + } + s->iScreen = (TUint16*)(TUint32(info.iScreenAddress)+0x18000); + s->iSizeX=80; + s->iSizeY=25; + return s; + } + +void CScreenDriverVgaText::Init(TSize& aScreenSize, TSize& aFontSize) +// +// Report screen information +// + { + + __DEBUG_PRINT(_L("CSD::Init")); + aFontSize=TSize(8,10); + aScreenSize.iWidth=iSizeX; + aScreenSize.iHeight=iSizeY; + + TInt i; + TUint16* p=iScreen; + for (i=0; i0) + { + for (; pS0) + { + for (; pT