sl@0
|
1 |
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32\drivers\edisp\emul\win32\wd_wins.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <e32cmn.h>
|
sl@0
|
19 |
#include <e32cmn_private.h>
|
sl@0
|
20 |
#include <emulator.h>
|
sl@0
|
21 |
#define WIN32_LEAN_AND_MEAN
|
sl@0
|
22 |
#pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union
|
sl@0
|
23 |
#include <windows.h>
|
sl@0
|
24 |
#pragma warning( default : 4201 ) // nonstandard extension used : nameless struct/union
|
sl@0
|
25 |
#include "ws_std.h"
|
sl@0
|
26 |
|
sl@0
|
27 |
// Driver for WINS platform using windows stock font
|
sl@0
|
28 |
|
sl@0
|
29 |
#define FONTWIDTH 8
|
sl@0
|
30 |
#define FONTHEIGHT 12
|
sl@0
|
31 |
|
sl@0
|
32 |
struct rgbValues{
|
sl@0
|
33 |
TUint8 iRed;
|
sl@0
|
34 |
TUint8 iGreen;
|
sl@0
|
35 |
TUint8 iBlue;
|
sl@0
|
36 |
};
|
sl@0
|
37 |
|
sl@0
|
38 |
const TUint8 KMonoRed0=50;
|
sl@0
|
39 |
const TUint8 KMonoGreen0=100;
|
sl@0
|
40 |
const TUint8 KMonoBlue0=200;
|
sl@0
|
41 |
const TUint8 KMonoRed1=250;
|
sl@0
|
42 |
const TUint8 KMonoGreen1=250;
|
sl@0
|
43 |
const TUint8 KMonoBlue1=20;
|
sl@0
|
44 |
|
sl@0
|
45 |
const TColorIndex KMonoAttributes[8]=
|
sl@0
|
46 |
{
|
sl@0
|
47 |
1, // Normal foreground
|
sl@0
|
48 |
0, // Normal background
|
sl@0
|
49 |
1, // Bold foreground
|
sl@0
|
50 |
0, // Bold background
|
sl@0
|
51 |
0, // Inverse foreground
|
sl@0
|
52 |
1, // Inverse background
|
sl@0
|
53 |
0, // Highlight foreground
|
sl@0
|
54 |
1 // Highlight background
|
sl@0
|
55 |
};
|
sl@0
|
56 |
|
sl@0
|
57 |
const TColorIndex KColor256Attributes[8]=
|
sl@0
|
58 |
{
|
sl@0
|
59 |
38, // Normal foreground
|
sl@0
|
60 |
33, // Normal background
|
sl@0
|
61 |
36, // Bold foreground
|
sl@0
|
62 |
38, // Bold background
|
sl@0
|
63 |
33, // Inverse foreground
|
sl@0
|
64 |
38, // Inverse background
|
sl@0
|
65 |
38, // Highlight foreground
|
sl@0
|
66 |
36 // Highlight background
|
sl@0
|
67 |
};
|
sl@0
|
68 |
|
sl@0
|
69 |
class CScreenDriverWins : public CScreenDriver
|
sl@0
|
70 |
{
|
sl@0
|
71 |
friend class CScreenDriver;
|
sl@0
|
72 |
public:
|
sl@0
|
73 |
CScreenDriverWins();
|
sl@0
|
74 |
virtual void Init(TSize &aScreenSize,TSize &aFontSize);
|
sl@0
|
75 |
virtual void Blit(const TText *aBuffer,TInt aLength,const TPoint &aPosition);
|
sl@0
|
76 |
virtual TBool ScrollUp(const TRect& aRect);
|
sl@0
|
77 |
virtual void Clear(const TRect& aRect);
|
sl@0
|
78 |
|
sl@0
|
79 |
virtual void SetPixel(const TPoint& aPoint,TUint8 aColour);
|
sl@0
|
80 |
virtual TInt GetPixel(const TPoint& aPoint);
|
sl@0
|
81 |
virtual void SetWord(const TPoint& aPoint,TInt aWord);
|
sl@0
|
82 |
virtual TInt GetWord(const TPoint& aPoint);
|
sl@0
|
83 |
virtual void SetLine(const TPoint& aPoint,const TPixelLine& aPixelLine);
|
sl@0
|
84 |
virtual void GetLine(const TPoint& aPoint,TPixelLine& aPixelLine);
|
sl@0
|
85 |
virtual void SetPaletteEntry(TColorIndex anIndex,TUint8 aRed,TUint8 aGreen,TUint8 aBlue);
|
sl@0
|
86 |
virtual void GetPaletteEntry(TColorIndex anIndex,TUint8 &aRed,TUint8 &aGreen,TUint8 &aBlue);
|
sl@0
|
87 |
virtual void SetForegroundColor(TColorIndex anIndex);
|
sl@0
|
88 |
virtual void SetBackgroundColor(TColorIndex anIndex);
|
sl@0
|
89 |
virtual void GetAttributeColors(TColorIndex* anArray);
|
sl@0
|
90 |
|
sl@0
|
91 |
virtual TInt SetMode(TVideoMode aMode);
|
sl@0
|
92 |
|
sl@0
|
93 |
static TBool IsHankaku(const TText aCode);
|
sl@0
|
94 |
virtual TPoint GraphicsPosition(const TPoint& aPosition);
|
sl@0
|
95 |
virtual void ScreenBufferScrollUp(const TRect& aRect);
|
sl@0
|
96 |
virtual void ScreenBufferClear(const TRect& aRect);
|
sl@0
|
97 |
private:
|
sl@0
|
98 |
TText* iScreenBuffer;
|
sl@0
|
99 |
|
sl@0
|
100 |
private:
|
sl@0
|
101 |
HFONT iFont;
|
sl@0
|
102 |
HDC iDc;
|
sl@0
|
103 |
TSize iTextScreenSize;
|
sl@0
|
104 |
TScreenInfoV01 iScreenInfo;
|
sl@0
|
105 |
TVideoMode iMode;
|
sl@0
|
106 |
rgbValues* iPalette;
|
sl@0
|
107 |
};
|
sl@0
|
108 |
|
sl@0
|
109 |
|
sl@0
|
110 |
TPoint CScreenDriverWins::GraphicsPosition(const TPoint& aPosition)
|
sl@0
|
111 |
{
|
sl@0
|
112 |
TPoint pos(0,aPosition.iY*FONTHEIGHT);
|
sl@0
|
113 |
TText* pS=iScreenBuffer+(iTextScreenSize.iWidth*aPosition.iY);
|
sl@0
|
114 |
TText* pE=pS+aPosition.iX;
|
sl@0
|
115 |
for (TText* pT=pS;pT<pE;++pT)
|
sl@0
|
116 |
pos.iX+=IsHankaku(*pT) ? FONTWIDTH : FONTWIDTH*2;
|
sl@0
|
117 |
return(pos);
|
sl@0
|
118 |
}
|
sl@0
|
119 |
|
sl@0
|
120 |
TBool CScreenDriverWins::IsHankaku(const TText aCode)
|
sl@0
|
121 |
{
|
sl@0
|
122 |
if (aCode >= 0xff61 && aCode <= 0xff9f)
|
sl@0
|
123 |
return ETrue; // HANKAKU KATAKANA code
|
sl@0
|
124 |
if (aCode >= 0x2550 && aCode <= 0x259f)
|
sl@0
|
125 |
return ETrue; // HANKAKU Graphics code
|
sl@0
|
126 |
if (aCode < 0x100)
|
sl@0
|
127 |
return ETrue; // Alphanumeric codes means HANKAKU
|
sl@0
|
128 |
return EFalse;
|
sl@0
|
129 |
}
|
sl@0
|
130 |
|
sl@0
|
131 |
void CScreenDriverWins::ScreenBufferScrollUp(const TRect& aRect)
|
sl@0
|
132 |
{
|
sl@0
|
133 |
TText* src=&iScreenBuffer[(aRect.iTl.iY+1)*iTextScreenSize.iWidth+aRect.iTl.iX];
|
sl@0
|
134 |
TText* dest=&iScreenBuffer[aRect.iTl.iY*iTextScreenSize.iWidth+aRect.iTl.iX];
|
sl@0
|
135 |
for (TInt j=0;j<aRect.iBr.iY-aRect.iTl.iY;++j)
|
sl@0
|
136 |
{
|
sl@0
|
137 |
TInt r=j*iTextScreenSize.iWidth;
|
sl@0
|
138 |
for (TInt i=0;i<aRect.iBr.iX-aRect.iTl.iX+1;++i)
|
sl@0
|
139 |
{
|
sl@0
|
140 |
TInt p = r+i;
|
sl@0
|
141 |
dest[p] = src[p];
|
sl@0
|
142 |
}
|
sl@0
|
143 |
}
|
sl@0
|
144 |
}
|
sl@0
|
145 |
|
sl@0
|
146 |
void CScreenDriverWins::ScreenBufferClear(const TRect& aRect)
|
sl@0
|
147 |
{
|
sl@0
|
148 |
TText* dest=&iScreenBuffer[aRect.iTl.iY*iTextScreenSize.iWidth+aRect.iTl.iX];
|
sl@0
|
149 |
for (TInt j=0;j<aRect.iBr.iY-aRect.iTl.iY+1;++j)
|
sl@0
|
150 |
{
|
sl@0
|
151 |
TInt r=j*iTextScreenSize.iWidth;
|
sl@0
|
152 |
for (TInt i=0;i<aRect.iBr.iX-aRect.iTl.iX+1;++i)
|
sl@0
|
153 |
dest[r+i] = 0x0020;
|
sl@0
|
154 |
}
|
sl@0
|
155 |
}
|
sl@0
|
156 |
|
sl@0
|
157 |
CScreenDriverWins::CScreenDriverWins()
|
sl@0
|
158 |
//
|
sl@0
|
159 |
// Constructor
|
sl@0
|
160 |
//
|
sl@0
|
161 |
{
|
sl@0
|
162 |
|
sl@0
|
163 |
TPckg<TScreenInfoV01> sI(iScreenInfo);
|
sl@0
|
164 |
UserSvr::ScreenInfo(sI);
|
sl@0
|
165 |
iPalette=(rgbValues *)User::Alloc(256*sizeof(rgbValues));
|
sl@0
|
166 |
}
|
sl@0
|
167 |
|
sl@0
|
168 |
EXPORT_C CScreenDriver *CScreenDriver::New()
|
sl@0
|
169 |
//
|
sl@0
|
170 |
// Return the actual screen driver.
|
sl@0
|
171 |
//
|
sl@0
|
172 |
{
|
sl@0
|
173 |
|
sl@0
|
174 |
CScreenDriverWins *pS=new CScreenDriverWins;
|
sl@0
|
175 |
if (!pS)
|
sl@0
|
176 |
return(NULL);
|
sl@0
|
177 |
if (!pS->iScreenInfo.iWindowHandleValid)
|
sl@0
|
178 |
{
|
sl@0
|
179 |
delete pS;
|
sl@0
|
180 |
return(NULL);
|
sl@0
|
181 |
}
|
sl@0
|
182 |
pS->iTextScreenSize=pS->iScreenInfo.iScreenSize;
|
sl@0
|
183 |
pS->iTextScreenSize.iWidth/=FONTWIDTH; // Convert from GDI units to character positions
|
sl@0
|
184 |
pS->iTextScreenSize.iHeight/=FONTHEIGHT;
|
sl@0
|
185 |
pS->iScreenBuffer=new TText[pS->iTextScreenSize.iWidth*pS->iTextScreenSize.iHeight];
|
sl@0
|
186 |
if (!pS->iScreenBuffer)
|
sl@0
|
187 |
{
|
sl@0
|
188 |
delete pS;
|
sl@0
|
189 |
return(NULL);
|
sl@0
|
190 |
}
|
sl@0
|
191 |
|
sl@0
|
192 |
__LOCK_HOST;
|
sl@0
|
193 |
HWND win=(HWND)pS->iScreenInfo.iWindowHandle;
|
sl@0
|
194 |
pS->iDc=GetDC(win);
|
sl@0
|
195 |
DWORD fontCharacterSet;
|
sl@0
|
196 |
LANGID language;
|
sl@0
|
197 |
fontCharacterSet=ANSI_CHARSET;
|
sl@0
|
198 |
language=(LANGID)PRIMARYLANGID(GetSystemDefaultLangID());
|
sl@0
|
199 |
if (language==LANG_JAPANESE) fontCharacterSet=SHIFTJIS_CHARSET;
|
sl@0
|
200 |
pS->iFont=CreateFontA(FONTHEIGHT+1, // logical font height
|
sl@0
|
201 |
FONTWIDTH+1, // logical average character width
|
sl@0
|
202 |
0, // angle of escapement
|
sl@0
|
203 |
0, // base-line orientation angle
|
sl@0
|
204 |
FW_DONTCARE, // font weight
|
sl@0
|
205 |
0, // italic attribute
|
sl@0
|
206 |
0, // underline attribute
|
sl@0
|
207 |
0, // strikeout attribute
|
sl@0
|
208 |
fontCharacterSet, // character set identifier
|
sl@0
|
209 |
OUT_RASTER_PRECIS, // output precision
|
sl@0
|
210 |
CLIP_CHARACTER_PRECIS, // clipping precision
|
sl@0
|
211 |
DEFAULT_QUALITY, // output quality
|
sl@0
|
212 |
FIXED_PITCH, // pitch and family
|
sl@0
|
213 |
"Terminal" // typeface name string
|
sl@0
|
214 |
);
|
sl@0
|
215 |
if (!pS->iFont)
|
sl@0
|
216 |
{
|
sl@0
|
217 |
delete pS->iScreenBuffer;
|
sl@0
|
218 |
delete pS;
|
sl@0
|
219 |
return(NULL);
|
sl@0
|
220 |
}
|
sl@0
|
221 |
|
sl@0
|
222 |
// On some Windows9x PCs, the font we assume under NT isn't always present,
|
sl@0
|
223 |
// but it's important we get a font with height 12. Therefore increase the
|
sl@0
|
224 |
// height setting and try again. This seems always to do the trick.
|
sl@0
|
225 |
TEXTMETRIC textMetrics;
|
sl@0
|
226 |
HFONT oldFont=REINTERPRET_CAST(HFONT,SelectObject(pS->iDc,pS->iFont));
|
sl@0
|
227 |
TBool tryNewFont=FALSE;
|
sl@0
|
228 |
if (GetTextMetrics(pS->iDc, &textMetrics) && (textMetrics.tmHeight<12))
|
sl@0
|
229 |
tryNewFont=TRUE;
|
sl@0
|
230 |
SelectObject(pS->iDc, oldFont);
|
sl@0
|
231 |
if (tryNewFont)
|
sl@0
|
232 |
{
|
sl@0
|
233 |
HFONT newFont=CreateFontA(FONTHEIGHT+2,
|
sl@0
|
234 |
FONTWIDTH+1,
|
sl@0
|
235 |
0,
|
sl@0
|
236 |
0,
|
sl@0
|
237 |
FW_DONTCARE,
|
sl@0
|
238 |
0,
|
sl@0
|
239 |
0,
|
sl@0
|
240 |
0,
|
sl@0
|
241 |
fontCharacterSet,
|
sl@0
|
242 |
OUT_RASTER_PRECIS,
|
sl@0
|
243 |
CLIP_CHARACTER_PRECIS,
|
sl@0
|
244 |
DEFAULT_QUALITY,
|
sl@0
|
245 |
FIXED_PITCH,
|
sl@0
|
246 |
"Terminal"
|
sl@0
|
247 |
);
|
sl@0
|
248 |
if (newFont)
|
sl@0
|
249 |
pS->iFont=newFont;
|
sl@0
|
250 |
}
|
sl@0
|
251 |
|
sl@0
|
252 |
return(pS);
|
sl@0
|
253 |
}
|
sl@0
|
254 |
|
sl@0
|
255 |
void CScreenDriverWins::Init(TSize &aScreenSize,TSize &aFontSize)
|
sl@0
|
256 |
//
|
sl@0
|
257 |
// Report screen information
|
sl@0
|
258 |
//
|
sl@0
|
259 |
{
|
sl@0
|
260 |
|
sl@0
|
261 |
aFontSize=TSize(FONTWIDTH,FONTHEIGHT);
|
sl@0
|
262 |
aScreenSize=iTextScreenSize;
|
sl@0
|
263 |
}
|
sl@0
|
264 |
|
sl@0
|
265 |
TInt CScreenDriverWins::SetMode(TVideoMode aMode)
|
sl@0
|
266 |
//
|
sl@0
|
267 |
// Set the screen mode
|
sl@0
|
268 |
//
|
sl@0
|
269 |
{
|
sl@0
|
270 |
|
sl@0
|
271 |
// Reset the palette
|
sl@0
|
272 |
|
sl@0
|
273 |
if (aMode==EColor256)
|
sl@0
|
274 |
{
|
sl@0
|
275 |
TInt x, y, z, t;
|
sl@0
|
276 |
|
sl@0
|
277 |
for(t=0;t<16;t++)
|
sl@0
|
278 |
{
|
sl@0
|
279 |
iPalette[t].iRed=(TUint8)(t*8);
|
sl@0
|
280 |
iPalette[t].iGreen=(TUint8)(t*8);
|
sl@0
|
281 |
iPalette[t].iBlue=(TUint8)(t*8);
|
sl@0
|
282 |
}
|
sl@0
|
283 |
for(t=16;t<32;t++)
|
sl@0
|
284 |
{
|
sl@0
|
285 |
iPalette[t].iRed=(TUint8)(t*8+7);
|
sl@0
|
286 |
iPalette[t].iGreen=(TUint8)(t*8+7);
|
sl@0
|
287 |
iPalette[t].iBlue=(TUint8)(t*8+7);
|
sl@0
|
288 |
}
|
sl@0
|
289 |
for(x=0;x<2;x++)
|
sl@0
|
290 |
for(y=0;y<2;y++)
|
sl@0
|
291 |
for(z=0;z<2;z++)
|
sl@0
|
292 |
{
|
sl@0
|
293 |
iPalette[t].iRed=(TUint8)(x*255);
|
sl@0
|
294 |
iPalette[t].iGreen=(TUint8)(y*255);
|
sl@0
|
295 |
iPalette[t].iBlue=(TUint8)(z*255);
|
sl@0
|
296 |
t++;
|
sl@0
|
297 |
}
|
sl@0
|
298 |
for(x=0;x<6;x++)
|
sl@0
|
299 |
for(y=0;y<6;y++)
|
sl@0
|
300 |
for(z=0;z<6;z++)
|
sl@0
|
301 |
{
|
sl@0
|
302 |
iPalette[t].iRed=(TUint8)(x*51);
|
sl@0
|
303 |
iPalette[t].iGreen=(TUint8)(y*51);
|
sl@0
|
304 |
iPalette[t].iBlue=(TUint8)(z*51);
|
sl@0
|
305 |
t++;
|
sl@0
|
306 |
}
|
sl@0
|
307 |
iMode=aMode;
|
sl@0
|
308 |
return(KErrNone);
|
sl@0
|
309 |
}
|
sl@0
|
310 |
if (aMode==EMono)
|
sl@0
|
311 |
{
|
sl@0
|
312 |
iPalette[0].iRed=KMonoRed0;
|
sl@0
|
313 |
iPalette[0].iGreen=KMonoGreen0;
|
sl@0
|
314 |
iPalette[0].iBlue=KMonoBlue0;
|
sl@0
|
315 |
iPalette[1].iRed=KMonoRed1;
|
sl@0
|
316 |
iPalette[1].iGreen=KMonoGreen1;
|
sl@0
|
317 |
iPalette[1].iBlue=KMonoBlue1;
|
sl@0
|
318 |
iMode=aMode;
|
sl@0
|
319 |
return(KErrNone);
|
sl@0
|
320 |
}
|
sl@0
|
321 |
return(KErrNotSupported);
|
sl@0
|
322 |
}
|
sl@0
|
323 |
|
sl@0
|
324 |
void CScreenDriverWins::Blit(const TText *aBuffer, TInt aLength, const TPoint &aPosition)
|
sl@0
|
325 |
//
|
sl@0
|
326 |
// Write contiguous block of characters to some segment of a line on the display
|
sl@0
|
327 |
//
|
sl@0
|
328 |
{
|
sl@0
|
329 |
|
sl@0
|
330 |
if (iDc)
|
sl@0
|
331 |
{
|
sl@0
|
332 |
|
sl@0
|
333 |
// Create a font of the appropriate metrics. The character
|
sl@0
|
334 |
// set selection depends on the context. The text console
|
sl@0
|
335 |
// was originally designed with the code page 850 line drawing
|
sl@0
|
336 |
// characters, so in the 8-bit version we continue to select
|
sl@0
|
337 |
// this, until we are in a position to supply a specific font
|
sl@0
|
338 |
// with the SDK. In the 16-bit version, we can use an ANSI
|
sl@0
|
339 |
// font and the proper line drawing characters defined in Unicode.
|
sl@0
|
340 |
// For a Japanese environment, an attempt is made to select a
|
sl@0
|
341 |
// font that supports the shift-JIS character set.
|
sl@0
|
342 |
|
sl@0
|
343 |
__LOCK_HOST;
|
sl@0
|
344 |
HFONT oldFont=REINTERPRET_CAST(HFONT,SelectObject(iDc,iFont));
|
sl@0
|
345 |
if (oldFont)
|
sl@0
|
346 |
{
|
sl@0
|
347 |
TPtrC buf(aBuffer,aLength);
|
sl@0
|
348 |
TBuf<0x100> b;
|
sl@0
|
349 |
b.Copy(buf);
|
sl@0
|
350 |
TText* code =(TText*)b.Ptr();
|
sl@0
|
351 |
Mem::Copy(iScreenBuffer+((aPosition.iY*iTextScreenSize.iWidth)+aPosition.iX),code,aLength*2);
|
sl@0
|
352 |
TPoint ap=GraphicsPosition(aPosition);
|
sl@0
|
353 |
for (TInt i=0;i<aLength;++i)
|
sl@0
|
354 |
{
|
sl@0
|
355 |
TInt fontWidth = IsHankaku(*code) ? FONTWIDTH : FONTWIDTH*2;
|
sl@0
|
356 |
RECT rect;
|
sl@0
|
357 |
SetRect(&rect, ap.iX, ap.iY, ap.iX + fontWidth, ap.iY + FONTHEIGHT);
|
sl@0
|
358 |
// The following function is better than TextOutW because it will fill in the gaps
|
sl@0
|
359 |
// if we get a font smaller than the appropriate size.
|
sl@0
|
360 |
ExtTextOutW(iDc, ap.iX, ap.iY, ETO_OPAQUE, &rect, (const unsigned short *)code, 1, NULL);
|
sl@0
|
361 |
ap.iX+=fontWidth;
|
sl@0
|
362 |
code++;
|
sl@0
|
363 |
}
|
sl@0
|
364 |
SelectObject(iDc,oldFont);
|
sl@0
|
365 |
}
|
sl@0
|
366 |
GdiFlush();
|
sl@0
|
367 |
}
|
sl@0
|
368 |
}
|
sl@0
|
369 |
|
sl@0
|
370 |
TBool CScreenDriverWins::ScrollUp(const TRect& aRect)
|
sl@0
|
371 |
//
|
sl@0
|
372 |
// Scroll a rectangle of the screen up one line, the bottom line is not updated, return ETrue on sucess
|
sl@0
|
373 |
//
|
sl@0
|
374 |
{
|
sl@0
|
375 |
|
sl@0
|
376 |
ScreenBufferScrollUp(aRect);
|
sl@0
|
377 |
// Create MSVC RECT from E32 TRect
|
sl@0
|
378 |
__LOCK_HOST;
|
sl@0
|
379 |
RECT rect;
|
sl@0
|
380 |
rect.left=(aRect.iTl.iX)*FONTWIDTH;
|
sl@0
|
381 |
rect.top=(aRect.iTl.iY+1)*FONTHEIGHT;
|
sl@0
|
382 |
rect.right=(aRect.iBr.iX)*FONTWIDTH;
|
sl@0
|
383 |
rect.bottom=(aRect.iBr.iY)*FONTHEIGHT;
|
sl@0
|
384 |
RECT updateRect;
|
sl@0
|
385 |
ScrollWindowEx((HWND)iScreenInfo.iWindowHandle,0,-FONTHEIGHT,&rect,NULL,NULL,&updateRect,0);
|
sl@0
|
386 |
GdiFlush();
|
sl@0
|
387 |
if (updateRect.bottom==0 || (rect.bottom==updateRect.bottom && updateRect.bottom==updateRect.top+FONTHEIGHT))
|
sl@0
|
388 |
return ETrue;
|
sl@0
|
389 |
return EFalse;
|
sl@0
|
390 |
}
|
sl@0
|
391 |
|
sl@0
|
392 |
void CScreenDriverWins::Clear(const TRect& aRect)
|
sl@0
|
393 |
//
|
sl@0
|
394 |
// Clear a rectangle of the screen
|
sl@0
|
395 |
//
|
sl@0
|
396 |
{
|
sl@0
|
397 |
|
sl@0
|
398 |
ScreenBufferClear(aRect);
|
sl@0
|
399 |
// Create MSVC RECT from E32 TRect
|
sl@0
|
400 |
__LOCK_HOST;
|
sl@0
|
401 |
RECT rect;
|
sl@0
|
402 |
rect.left=(aRect.iTl.iX)*FONTWIDTH;
|
sl@0
|
403 |
rect.top=(aRect.iTl.iY)*FONTHEIGHT;
|
sl@0
|
404 |
rect.right=(aRect.iBr.iX)*FONTWIDTH;
|
sl@0
|
405 |
rect.bottom=(aRect.iBr.iY)*FONTHEIGHT;
|
sl@0
|
406 |
FillRect(GetDC((HWND)iScreenInfo.iWindowHandle),&rect,NULL);
|
sl@0
|
407 |
GdiFlush();
|
sl@0
|
408 |
}
|
sl@0
|
409 |
|
sl@0
|
410 |
void CScreenDriverWins::SetPaletteEntry(TColorIndex anIndex,TUint8 aRed,TUint8 aGreen,TUint8 aBlue)
|
sl@0
|
411 |
{
|
sl@0
|
412 |
|
sl@0
|
413 |
if(iMode==EColor256)
|
sl@0
|
414 |
{
|
sl@0
|
415 |
iPalette[anIndex].iRed=aRed;iPalette[anIndex].iGreen=aGreen;iPalette[anIndex].iBlue=aBlue;
|
sl@0
|
416 |
}
|
sl@0
|
417 |
}
|
sl@0
|
418 |
|
sl@0
|
419 |
void CScreenDriverWins::GetPaletteEntry(TColorIndex anIndex,TUint8 &aRed,TUint8 &aGreen,TUint8 &aBlue)
|
sl@0
|
420 |
{
|
sl@0
|
421 |
|
sl@0
|
422 |
aRed=iPalette[anIndex].iRed;aGreen=iPalette[anIndex].iGreen;aBlue=iPalette[anIndex].iBlue;
|
sl@0
|
423 |
}
|
sl@0
|
424 |
|
sl@0
|
425 |
void CScreenDriverWins::SetForegroundColor(TColorIndex anIndex)
|
sl@0
|
426 |
{
|
sl@0
|
427 |
|
sl@0
|
428 |
__LOCK_HOST;
|
sl@0
|
429 |
TInt index=anIndex;
|
sl@0
|
430 |
index=Min(index,(1<<iMode)-1);
|
sl@0
|
431 |
SetTextColor(iDc,RGB(iPalette[index].iRed,iPalette[index].iGreen,iPalette[index].iBlue));
|
sl@0
|
432 |
GdiFlush();
|
sl@0
|
433 |
}
|
sl@0
|
434 |
|
sl@0
|
435 |
void CScreenDriverWins::SetBackgroundColor(TColorIndex anIndex)
|
sl@0
|
436 |
{
|
sl@0
|
437 |
|
sl@0
|
438 |
__LOCK_HOST;
|
sl@0
|
439 |
TInt index=anIndex;
|
sl@0
|
440 |
index=Min(index,(1<<iMode)-1);
|
sl@0
|
441 |
SetBkColor(iDc,RGB(iPalette[index].iRed,iPalette[index].iGreen,iPalette[index].iBlue));
|
sl@0
|
442 |
GdiFlush();
|
sl@0
|
443 |
}
|
sl@0
|
444 |
|
sl@0
|
445 |
void CScreenDriverWins::GetAttributeColors(TColorIndex* anArray)
|
sl@0
|
446 |
//
|
sl@0
|
447 |
//
|
sl@0
|
448 |
//
|
sl@0
|
449 |
{
|
sl@0
|
450 |
if(iMode==EMono)
|
sl@0
|
451 |
Mem::Copy(anArray,KMonoAttributes,sizeof(KMonoAttributes));
|
sl@0
|
452 |
else if(iMode==EColor256)
|
sl@0
|
453 |
Mem::Copy(anArray,KColor256Attributes,sizeof(KColor256Attributes));
|
sl@0
|
454 |
}
|
sl@0
|
455 |
|
sl@0
|
456 |
void CScreenDriverWins::SetPixel(const TPoint& /*aPoint*/,TUint8 /*aColour*/)
|
sl@0
|
457 |
{
|
sl@0
|
458 |
}
|
sl@0
|
459 |
|
sl@0
|
460 |
TInt CScreenDriverWins::GetPixel(const TPoint& /*aPoint*/)
|
sl@0
|
461 |
{
|
sl@0
|
462 |
return 0;
|
sl@0
|
463 |
}
|
sl@0
|
464 |
|
sl@0
|
465 |
void CScreenDriverWins::SetWord(const TPoint& /*aPoint*/,TInt /*aWord*/)
|
sl@0
|
466 |
{
|
sl@0
|
467 |
}
|
sl@0
|
468 |
|
sl@0
|
469 |
TInt CScreenDriverWins::GetWord(const TPoint& /*aPoint*/)
|
sl@0
|
470 |
{
|
sl@0
|
471 |
return 0;
|
sl@0
|
472 |
}
|
sl@0
|
473 |
|
sl@0
|
474 |
void CScreenDriverWins::SetLine(const TPoint& /*aPoint*/,const TPixelLine& /*aPixelLine*/)
|
sl@0
|
475 |
{
|
sl@0
|
476 |
}
|
sl@0
|
477 |
|
sl@0
|
478 |
void CScreenDriverWins::GetLine(const TPoint& /*aPoint*/,TPixelLine& /*aPixelLine*/)
|
sl@0
|
479 |
{
|
sl@0
|
480 |
}
|
sl@0
|
481 |
|