Update contrib.
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\drivers\edisp\epoc\vga\vgatext.cpp
15 // Brutus display driver
21 const TUint KCharAttrib=0x17; // white on blue
24 #define __DEBUG_PRINT(a) RDebug::Print(a)
25 #define __DEBUG_PRINT2(a,b) RDebug::Print(a,b)
27 #define __DEBUG_PRINT(a)
28 #define __DEBUG_PRINT2(a,b)
31 class CScreenDriverVgaText : public CScreenDriver
34 CScreenDriverVgaText();
35 virtual void Init(TSize &aScreenSize,TSize &aFontSize);
36 virtual void Blit(const TText *aBuffer,TInt aLength,const TPoint &aPosition);
37 virtual TBool ScrollUp(const TRect& aRect);
38 virtual void Clear(const TRect& aRect);
40 virtual void SetPixel(const TPoint& aPoint,TUint8 aColour);
41 virtual TInt GetPixel(const TPoint& aPoint);
42 virtual void SetWord(const TPoint& aPoint,TInt aWord);
43 virtual TInt GetWord(const TPoint& aPoint);
44 virtual void SetLine(const TPoint& aPoint,const TPixelLine& aPixelLine);
45 virtual void GetLine(const TPoint& aPoint,TPixelLine& aPixelLine);
47 virtual void SetPaletteEntry(TColorIndex anIndex,TUint8 aRed,TUint8 aGreen,TUint8 aBlue);
48 virtual void GetPaletteEntry(TColorIndex anIndex,TUint8 &aRed,TUint8 &aGreen,TUint8 &aBlue);
49 virtual void SetForegroundColor(TColorIndex anIndex);
50 virtual void SetBackgroundColor(TColorIndex anIndex);
51 virtual void GetAttributeColors(TColorIndex* anArray);
52 virtual TInt SetMode(TVideoMode aMode);
58 friend class CScreenDriver;
61 CScreenDriverVgaText::CScreenDriverVgaText()
66 __DEBUG_PRINT(_L("CSD::Ctor"));
70 CScreenDriver* NewScreenDriverVgaText()
72 // Return the actual screen driver.
76 __DEBUG_PRINT(_L("CSD::New"));
78 CScreenDriverVgaText* s=new CScreenDriverVgaText;
82 TPckg<TScreenInfoV01> infoPckg(info);
83 UserSvr::ScreenInfo(infoPckg);
84 if (!info.iScreenAddressValid)
89 s->iScreen = (TUint16*)(TUint32(info.iScreenAddress)+0x18000);
95 void CScreenDriverVgaText::Init(TSize& aScreenSize, TSize& aFontSize)
97 // Report screen information
101 __DEBUG_PRINT(_L("CSD::Init"));
102 aFontSize=TSize(8,10);
103 aScreenSize.iWidth=iSizeX;
104 aScreenSize.iHeight=iSizeY;
108 for (i=0; i<iSizeX*iSizeY; ++i)
112 TInt CScreenDriverVgaText::SetMode(TVideoMode /*aMode*/)
114 // Set the screen mode
117 __DEBUG_PRINT(_L("CSD::SetMode"));
118 return(KErrNotSupported);
121 void CScreenDriverVgaText::Blit(const TText* aBuf, TInt aLen, const TPoint& aPos)
123 // Write contiguous block of characters to some segment of a line on the display
130 TUint16* pS=iScreen+aPos.iY*iSizeX+aPos.iX;
131 TUint8* pSB=(TUint8*)pS;
144 TBool CScreenDriverVgaText::ScrollUp(const TRect& aRect)
146 // Scroll a rectangle of the screen up one character, don't update bottom line
150 __DEBUG_PRINT(_L("CSD::ScrollUp"));
151 TUint16* pT=iScreen+aRect.iTl.iY*iSizeX+aRect.iTl.iX;
152 TUint16* pS=pT+iSizeX;
153 TUint16* pE=iScreen+aRect.iBr.iY*iSizeX;
154 TInt w=aRect.iBr.iX-aRect.iTl.iX;
157 for (; pS<pE; pT+=iSizeX, pS+=iSizeX)
159 Mem::Copy(pT,pS,w*2);
165 void CScreenDriverVgaText::Clear(const TRect& aRect)
167 // Clear a rectangle of the screen, don't clear bottom line
171 __DEBUG_PRINT(_L("CSD::Clear"));
172 TUint16* pT=iScreen+aRect.iTl.iY*iSizeX+aRect.iTl.iX;
173 TUint16* pE=iScreen+aRect.iBr.iY*iSizeX;
174 TInt w=aRect.iBr.iX-aRect.iTl.iX;
177 for (; pT<pE; pT+=iSizeX)
182 *pT2++=KCharAttrib<<8;
187 void CScreenDriverVgaText::SetPixel(const TPoint& /*aPoint*/, TUint8 /*aColour*/)
189 __DEBUG_PRINT(_L("CSD::SetPix"));
192 TInt CScreenDriverVgaText::GetPixel(const TPoint& /*aPoint*/)
194 __DEBUG_PRINT(_L("CSD::GetPix"));
198 void CScreenDriverVgaText::SetWord(const TPoint& /*aPoint*/, TInt /*aWord*/)
200 __DEBUG_PRINT(_L("CSD::SetWord"));
203 TInt CScreenDriverVgaText::GetWord(const TPoint& /*aPoint*/)
205 __DEBUG_PRINT(_L("CSD::GetWord"));
209 void CScreenDriverVgaText::SetLine(const TPoint& /*aPoint*/, const TPixelLine& /*aPixelLine*/)
211 __DEBUG_PRINT(_L("CSD::SetLine"));
214 void CScreenDriverVgaText::GetLine(const TPoint& /*aPoint*/, TPixelLine& /*aPixelLine*/)
216 __DEBUG_PRINT(_L("CSD::GetLine"));
219 void CScreenDriverVgaText::SetPaletteEntry(TColorIndex /*anIndex*/, TUint8 /*aRed*/, TUint8 /*aGreen*/, TUint8 /*aBlue*/)
223 void CScreenDriverVgaText::GetPaletteEntry(TColorIndex /*anIndex*/, TUint8& /*aRed*/, TUint8& /*aGreen*/, TUint8& /*aBlue*/)
227 void CScreenDriverVgaText::SetForegroundColor(TColorIndex /*anIndex*/)
231 void CScreenDriverVgaText::SetBackgroundColor(TColorIndex /*anIndex*/)
235 void CScreenDriverVgaText::GetAttributeColors(TColorIndex* /*anArray*/)