sl@0
|
1 |
// Copyright (c) 2007-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 "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 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include "directgdiadapter.h"
|
sl@0
|
17 |
#include "swdirectgdiengine.h"
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@see MDirectGdiEngine::CopyRect()
|
sl@0
|
21 |
*/
|
sl@0
|
22 |
void CSwDirectGdiEngine::CopyRect(const TPoint& aOffset, const TRect& aRect)
|
sl@0
|
23 |
{
|
sl@0
|
24 |
TRect deviceRect;
|
sl@0
|
25 |
iDrawDevice->GetDrawRect(deviceRect);
|
sl@0
|
26 |
const TPoint back(TPoint(0,0) - aOffset);
|
sl@0
|
27 |
TRect rcpy(aRect);
|
sl@0
|
28 |
rcpy.Move(iOrigin);
|
sl@0
|
29 |
rcpy.Intersection(deviceRect);
|
sl@0
|
30 |
((TRegion*)iDefaultRegionPtr)->Sort(aOffset);
|
sl@0
|
31 |
|
sl@0
|
32 |
TRect targetRect(rcpy);
|
sl@0
|
33 |
targetRect.Move(aOffset);
|
sl@0
|
34 |
targetRect.BoundingRect(rcpy);
|
sl@0
|
35 |
|
sl@0
|
36 |
TRect clipRect(0,0,0,0);
|
sl@0
|
37 |
const TInt limit = iDefaultRegionPtr->Count();
|
sl@0
|
38 |
for(TInt count = 0; count < limit; count++)
|
sl@0
|
39 |
{
|
sl@0
|
40 |
clipRect = (*iDefaultRegionPtr)[count];
|
sl@0
|
41 |
|
sl@0
|
42 |
clipRect.Move(back);
|
sl@0
|
43 |
if (!clipRect.Intersects(rcpy))
|
sl@0
|
44 |
{
|
sl@0
|
45 |
continue;
|
sl@0
|
46 |
}
|
sl@0
|
47 |
|
sl@0
|
48 |
clipRect.Intersection(rcpy);
|
sl@0
|
49 |
DirectGdi::TDrawMode drawMode = iDrawMode;
|
sl@0
|
50 |
iDrawMode = DirectGdi::EDrawModeWriteAlpha;
|
sl@0
|
51 |
DoCopyRect(aOffset, clipRect);
|
sl@0
|
52 |
iDrawMode = drawMode; // restore the previous draw mode
|
sl@0
|
53 |
clipRect.Move(aOffset);
|
sl@0
|
54 |
iDrawDevice->UpdateRegion(clipRect);
|
sl@0
|
55 |
}
|
sl@0
|
56 |
}
|
sl@0
|
57 |
|
sl@0
|
58 |
/**
|
sl@0
|
59 |
@see CopyRect()
|
sl@0
|
60 |
@panic DGDIAdapter 1013, if aRect or aOffset are outside of the destination bounds (debug only).
|
sl@0
|
61 |
*/
|
sl@0
|
62 |
void CSwDirectGdiEngine::DoCopyRect(const TPoint& aOffset, const TRect& aRect)
|
sl@0
|
63 |
{
|
sl@0
|
64 |
#ifdef _DEBUG
|
sl@0
|
65 |
TRect deviceRect;
|
sl@0
|
66 |
iDrawDevice->GetDrawRect(deviceRect);
|
sl@0
|
67 |
#endif
|
sl@0
|
68 |
GRAPHICS_ASSERT_DEBUG(aRect.iTl.iX >= deviceRect.iTl.iX, EDirectGdiPanicOutOfBounds);
|
sl@0
|
69 |
GRAPHICS_ASSERT_DEBUG(aRect.iTl.iY >= deviceRect.iTl.iY, EDirectGdiPanicOutOfBounds);
|
sl@0
|
70 |
GRAPHICS_ASSERT_DEBUG(aRect.iBr.iX <= deviceRect.iBr.iX, EDirectGdiPanicOutOfBounds);
|
sl@0
|
71 |
GRAPHICS_ASSERT_DEBUG(aRect.iBr.iY <= deviceRect.iBr.iY, EDirectGdiPanicOutOfBounds);
|
sl@0
|
72 |
|
sl@0
|
73 |
TRect offsetRect(aRect);
|
sl@0
|
74 |
offsetRect.Move(aOffset);
|
sl@0
|
75 |
|
sl@0
|
76 |
GRAPHICS_ASSERT_DEBUG(offsetRect.iTl.iX >= deviceRect.iTl.iX, EDirectGdiPanicOutOfBounds);
|
sl@0
|
77 |
GRAPHICS_ASSERT_DEBUG(offsetRect.iTl.iY >= deviceRect.iTl.iY, EDirectGdiPanicOutOfBounds);
|
sl@0
|
78 |
GRAPHICS_ASSERT_DEBUG(offsetRect.iBr.iX <= deviceRect.iBr.iX, EDirectGdiPanicOutOfBounds);
|
sl@0
|
79 |
GRAPHICS_ASSERT_DEBUG(offsetRect.iBr.iY <= deviceRect.iBr.iY, EDirectGdiPanicOutOfBounds);
|
sl@0
|
80 |
|
sl@0
|
81 |
TInt y1 = aRect.iTl.iY;
|
sl@0
|
82 |
TInt y2 = aRect.iBr.iY;
|
sl@0
|
83 |
TInt yinc = 1; // default y2>y1
|
sl@0
|
84 |
if (aOffset.iY > 0) // y1>y2
|
sl@0
|
85 |
{
|
sl@0
|
86 |
y1 = aRect.iBr.iY - 1;
|
sl@0
|
87 |
y2 = aRect.iTl.iY - 1;
|
sl@0
|
88 |
yinc = -1;
|
sl@0
|
89 |
}
|
sl@0
|
90 |
|
sl@0
|
91 |
const TInt width = aRect.Width();
|
sl@0
|
92 |
const TInt xoffset = aRect.iTl.iX + aOffset.iX;
|
sl@0
|
93 |
const TDisplayMode dispMode = ScanLineBufferDisplayMode(iDrawDevice);
|
sl@0
|
94 |
TUint32* scanLineBuffer = iDrawDevice->ScanLineBuffer();
|
sl@0
|
95 |
|
sl@0
|
96 |
for (TInt row = y1; row != y2; row += yinc)
|
sl@0
|
97 |
{
|
sl@0
|
98 |
iDrawDevice->ReadLine(aRect.iTl.iX, row, width, scanLineBuffer, dispMode);
|
sl@0
|
99 |
iDrawDevice->WriteLine(xoffset, row + aOffset.iY, width, scanLineBuffer, GcDrawMode(iDrawMode));
|
sl@0
|
100 |
}
|
sl@0
|
101 |
}
|
sl@0
|
102 |
|
sl@0
|
103 |
/**
|
sl@0
|
104 |
@see MDirectGdiEngine::DrawRect()
|
sl@0
|
105 |
*/
|
sl@0
|
106 |
void CSwDirectGdiEngine::DrawRect(const TRect& aRect)
|
sl@0
|
107 |
{
|
sl@0
|
108 |
TRect rcpy(aRect);
|
sl@0
|
109 |
|
sl@0
|
110 |
iBrushBitmap.BeginDataAccess();
|
sl@0
|
111 |
|
sl@0
|
112 |
if ((iPenSize.iWidth == 1) && (iPenSize.iHeight == 1) && iPenStyle != DirectGdi::ENullPen)
|
sl@0
|
113 |
{
|
sl@0
|
114 |
const TInt width = rcpy.Width();
|
sl@0
|
115 |
const TInt height = rcpy.Height();
|
sl@0
|
116 |
const TPoint currentLinePosition = iLinePosition;
|
sl@0
|
117 |
|
sl@0
|
118 |
if (iPenStyle != DirectGdi::ESolidPen)
|
sl@0
|
119 |
{
|
sl@0
|
120 |
iDotParam = 0;
|
sl@0
|
121 |
}
|
sl@0
|
122 |
|
sl@0
|
123 |
DoDrawLine(rcpy.iTl,TPoint(rcpy.iBr.iX,rcpy.iTl.iY),ETrue); // top
|
sl@0
|
124 |
|
sl@0
|
125 |
if (height > 2 && width > 1)
|
sl@0
|
126 |
{
|
sl@0
|
127 |
DoDrawLine(TPoint(rcpy.iBr.iX-1,rcpy.iTl.iY+1),TPoint(rcpy.iBr.iX-1,rcpy.iBr.iY-1),ETrue); // right
|
sl@0
|
128 |
}
|
sl@0
|
129 |
|
sl@0
|
130 |
if (height > 1)
|
sl@0
|
131 |
{
|
sl@0
|
132 |
DoDrawLine(TPoint(rcpy.iBr.iX-1,rcpy.iBr.iY-1),TPoint(rcpy.iTl.iX-1,rcpy.iBr.iY-1),ETrue); // bottom
|
sl@0
|
133 |
}
|
sl@0
|
134 |
|
sl@0
|
135 |
if (height > 2)
|
sl@0
|
136 |
{
|
sl@0
|
137 |
DoDrawLine(TPoint(rcpy.iTl.iX,rcpy.iBr.iY-2),rcpy.iTl,ETrue); // left
|
sl@0
|
138 |
}
|
sl@0
|
139 |
|
sl@0
|
140 |
// Restore internal line position in case it has been modified by DoDrawLine().
|
sl@0
|
141 |
// DrawRect() should not be modifying it.
|
sl@0
|
142 |
iLinePosition = currentLinePosition;
|
sl@0
|
143 |
|
sl@0
|
144 |
if (width < 3 || height < 3)
|
sl@0
|
145 |
{
|
sl@0
|
146 |
goto nofill;
|
sl@0
|
147 |
}
|
sl@0
|
148 |
|
sl@0
|
149 |
rcpy.Shrink(1,1);
|
sl@0
|
150 |
rcpy.Move(iOrigin);
|
sl@0
|
151 |
}
|
sl@0
|
152 |
else if ((iPenStyle != DirectGdi::ENullPen) && (iPenSize.iWidth >= 1 && iPenSize.iHeight >= 1))
|
sl@0
|
153 |
{
|
sl@0
|
154 |
rcpy.Move(iOrigin);
|
sl@0
|
155 |
|
sl@0
|
156 |
const DirectGdi::TBrushStyle tempbrushstyle = iBrushStyle;
|
sl@0
|
157 |
const TRgb tempbrushColor = iBrushColor;
|
sl@0
|
158 |
const DirectGdi::TDrawMode tempdrawmode = iDrawMode;
|
sl@0
|
159 |
|
sl@0
|
160 |
const TInt halfpenwidth = (iPenSize.iWidth - 1) >> 1;
|
sl@0
|
161 |
const TInt halfpenheight = (iPenSize.iHeight - 1) >> 1;
|
sl@0
|
162 |
const TInt otherhalfwidth = (iPenSize.iWidth >> 1) + 1;
|
sl@0
|
163 |
const TInt otherhalfheight = (iPenSize.iHeight >> 1) + 1;
|
sl@0
|
164 |
|
sl@0
|
165 |
rcpy.iBr.iX--;
|
sl@0
|
166 |
rcpy.iBr.iY--;
|
sl@0
|
167 |
|
sl@0
|
168 |
if (((rcpy.iBr.iY - rcpy.iTl.iY) <= (iPenSize.iHeight + 1)) || ((rcpy.iBr.iX - rcpy.iTl.iX) <= (iPenSize.iWidth + 1)))
|
sl@0
|
169 |
{
|
sl@0
|
170 |
iBrushColor = iPenColor;
|
sl@0
|
171 |
iBrushStyle = DirectGdi::ESolidBrush;
|
sl@0
|
172 |
if(iDrawMode != DirectGdi::EDrawModeWriteAlpha)
|
sl@0
|
173 |
{
|
sl@0
|
174 |
iDrawMode = DirectGdi::EDrawModePEN;
|
sl@0
|
175 |
}
|
sl@0
|
176 |
|
sl@0
|
177 |
rcpy.iTl.iX -= halfpenwidth;
|
sl@0
|
178 |
rcpy.iTl.iY -= halfpenheight;
|
sl@0
|
179 |
rcpy.iBr.iX += otherhalfwidth;
|
sl@0
|
180 |
rcpy.iBr.iY += otherhalfheight;
|
sl@0
|
181 |
RectFill(rcpy);
|
sl@0
|
182 |
}
|
sl@0
|
183 |
else
|
sl@0
|
184 |
{
|
sl@0
|
185 |
// In the event the pen outline is semi-transparent, we must do the fill first so that the
|
sl@0
|
186 |
// outline is blended over the top.
|
sl@0
|
187 |
RectFill(rcpy);
|
sl@0
|
188 |
|
sl@0
|
189 |
iBrushColor = iPenColor;
|
sl@0
|
190 |
iBrushStyle = DirectGdi::ESolidBrush;
|
sl@0
|
191 |
if(iDrawMode != DirectGdi::EDrawModeWriteAlpha)
|
sl@0
|
192 |
{
|
sl@0
|
193 |
iDrawMode = DirectGdi::EDrawModePEN;
|
sl@0
|
194 |
}
|
sl@0
|
195 |
RectFill(TRect(rcpy.iTl.iX - halfpenwidth,rcpy.iTl.iY - halfpenheight,rcpy.iBr.iX + otherhalfwidth,rcpy.iTl.iY + otherhalfheight)); // top
|
sl@0
|
196 |
RectFill(TRect(rcpy.iTl.iX - halfpenwidth,rcpy.iTl.iY + otherhalfheight,rcpy.iTl.iX + otherhalfwidth,rcpy.iBr.iY - halfpenheight)); // left
|
sl@0
|
197 |
RectFill(TRect(rcpy.iBr.iX - halfpenwidth,rcpy.iTl.iY + otherhalfheight,rcpy.iBr.iX + otherhalfwidth,rcpy.iBr.iY - halfpenheight)); // right
|
sl@0
|
198 |
RectFill(TRect(rcpy.iTl.iX - halfpenwidth,rcpy.iBr.iY - halfpenheight,rcpy.iBr.iX + otherhalfwidth,rcpy.iBr.iY + otherhalfheight)); // bottom
|
sl@0
|
199 |
}
|
sl@0
|
200 |
|
sl@0
|
201 |
iBrushStyle = tempbrushstyle;
|
sl@0
|
202 |
iBrushColor = tempbrushColor;
|
sl@0
|
203 |
iDrawMode = tempdrawmode;
|
sl@0
|
204 |
goto nofill;
|
sl@0
|
205 |
}
|
sl@0
|
206 |
else
|
sl@0
|
207 |
{
|
sl@0
|
208 |
rcpy.Move(iOrigin);
|
sl@0
|
209 |
}
|
sl@0
|
210 |
|
sl@0
|
211 |
RectFill(rcpy);
|
sl@0
|
212 |
|
sl@0
|
213 |
nofill:
|
sl@0
|
214 |
iBrushBitmap.EndDataAccess(ETrue);
|
sl@0
|
215 |
}
|
sl@0
|
216 |
|
sl@0
|
217 |
/**
|
sl@0
|
218 |
Fills the given area using the current brush.
|
sl@0
|
219 |
|
sl@0
|
220 |
@param aRect The area to fill.
|
sl@0
|
221 |
@panic DGDIAdapter 1013, if the a clipping rectangle is fully outside of the destination bounds (debug only).
|
sl@0
|
222 |
@panic DGDIAdapter 7, if using EPatternedBrush with no brush pattern bitmap.
|
sl@0
|
223 |
*/
|
sl@0
|
224 |
void CSwDirectGdiEngine::RectFill(const TRect& aRect)
|
sl@0
|
225 |
{
|
sl@0
|
226 |
if (aRect.IsEmpty() || iBrushStyle == DirectGdi::ENullBrush)
|
sl@0
|
227 |
{
|
sl@0
|
228 |
return;
|
sl@0
|
229 |
}
|
sl@0
|
230 |
|
sl@0
|
231 |
const TPoint origin = iOrigin + iBrushOrigin;
|
sl@0
|
232 |
const TInt limit = iDefaultRegionPtr->Count();
|
sl@0
|
233 |
TRect clipRect(0,0,0,0);
|
sl@0
|
234 |
for (TInt count = 0; count < limit; count++)
|
sl@0
|
235 |
{
|
sl@0
|
236 |
clipRect = (*iDefaultRegionPtr)[count];
|
sl@0
|
237 |
if (!clipRect.Intersects(aRect))
|
sl@0
|
238 |
{
|
sl@0
|
239 |
continue;
|
sl@0
|
240 |
}
|
sl@0
|
241 |
|
sl@0
|
242 |
clipRect.Intersection(aRect);
|
sl@0
|
243 |
|
sl@0
|
244 |
#ifdef _DEBUG
|
sl@0
|
245 |
TRect deviceRect;
|
sl@0
|
246 |
iDrawDevice->GetDrawRect(deviceRect);
|
sl@0
|
247 |
GRAPHICS_ASSERT_DEBUG(clipRect.iTl.iX >= deviceRect.iTl.iX, EDirectGdiPanicOutOfBounds);
|
sl@0
|
248 |
GRAPHICS_ASSERT_DEBUG(clipRect.iTl.iY >= deviceRect.iTl.iY, EDirectGdiPanicOutOfBounds);
|
sl@0
|
249 |
GRAPHICS_ASSERT_DEBUG(clipRect.iBr.iX <= deviceRect.iBr.iX, EDirectGdiPanicOutOfBounds);
|
sl@0
|
250 |
GRAPHICS_ASSERT_DEBUG(clipRect.iBr.iY <= deviceRect.iBr.iY, EDirectGdiPanicOutOfBounds);
|
sl@0
|
251 |
#endif
|
sl@0
|
252 |
|
sl@0
|
253 |
TInt xcoord = clipRect.iTl.iX;
|
sl@0
|
254 |
TInt ycoord = clipRect.iTl.iY;
|
sl@0
|
255 |
const CGraphicsContext::TDrawMode drawMode = GcDrawMode(iDrawMode);
|
sl@0
|
256 |
|
sl@0
|
257 |
switch(iBrushStyle)
|
sl@0
|
258 |
{
|
sl@0
|
259 |
case DirectGdi::ESolidBrush:
|
sl@0
|
260 |
iDrawDevice->WriteRgbMulti(clipRect.iTl.iX,clipRect.iTl.iY,
|
sl@0
|
261 |
clipRect.Width(),clipRect.Height(),iBrushColor,drawMode);
|
sl@0
|
262 |
break;
|
sl@0
|
263 |
case DirectGdi::EPatternedBrush:
|
sl@0
|
264 |
{
|
sl@0
|
265 |
iBrushBitmap.BeginDataAccess();
|
sl@0
|
266 |
CBitwiseBitmap* brushbitmap = iBrushBitmap.Address();
|
sl@0
|
267 |
|
sl@0
|
268 |
GRAPHICS_ASSERT_ALWAYS(brushbitmap != NULL, EDirectGdiPanicInvalidBitmap);
|
sl@0
|
269 |
|
sl@0
|
270 |
TRect sourcerect(clipRect);
|
sl@0
|
271 |
sourcerect.Move(-origin);
|
sl@0
|
272 |
|
sl@0
|
273 |
DoBitBlt(clipRect.iTl,brushbitmap,iBrushBitmap.DataAddress(),iBrushBitmap.DataStride(),sourcerect);
|
sl@0
|
274 |
iBrushBitmap.EndDataAccess(ETrue);
|
sl@0
|
275 |
break;
|
sl@0
|
276 |
}
|
sl@0
|
277 |
case DirectGdi::EHorizontalHatchBrush:
|
sl@0
|
278 |
iDrawDevice->WriteRgbMulti(clipRect.iTl.iX,clipRect.iTl.iY,
|
sl@0
|
279 |
clipRect.Width(),clipRect.Height(),iBrushColor,drawMode);
|
sl@0
|
280 |
while (Abs((ycoord - origin.iY) % 3) != 2)
|
sl@0
|
281 |
{
|
sl@0
|
282 |
ycoord++;
|
sl@0
|
283 |
}
|
sl@0
|
284 |
for (; ycoord < clipRect.iBr.iY; ycoord += 3)
|
sl@0
|
285 |
{
|
sl@0
|
286 |
iDrawDevice->WriteRgbMulti(clipRect.iTl.iX,ycoord,clipRect.Width(),1,iPenColor,drawMode);
|
sl@0
|
287 |
}
|
sl@0
|
288 |
break;
|
sl@0
|
289 |
case DirectGdi::EVerticalHatchBrush:
|
sl@0
|
290 |
iDrawDevice->WriteRgbMulti(clipRect.iTl.iX,clipRect.iTl.iY,
|
sl@0
|
291 |
clipRect.Width(),clipRect.Height(),iBrushColor,drawMode);
|
sl@0
|
292 |
while (Abs((xcoord - origin.iX) % 3) != 2)
|
sl@0
|
293 |
{
|
sl@0
|
294 |
xcoord++;
|
sl@0
|
295 |
}
|
sl@0
|
296 |
for (; xcoord < clipRect.iBr.iX; xcoord += 3)
|
sl@0
|
297 |
{
|
sl@0
|
298 |
iDrawDevice->WriteRgbMulti(xcoord,clipRect.iTl.iY,1,clipRect.Height(),iPenColor,drawMode);
|
sl@0
|
299 |
}
|
sl@0
|
300 |
break;
|
sl@0
|
301 |
case DirectGdi::ESquareCrossHatchBrush:
|
sl@0
|
302 |
iDrawDevice->WriteRgbMulti(clipRect.iTl.iX,clipRect.iTl.iY,
|
sl@0
|
303 |
clipRect.Width(),clipRect.Height(),iBrushColor,drawMode);
|
sl@0
|
304 |
while (Abs((ycoord - origin.iY) % 3) != 2)
|
sl@0
|
305 |
{
|
sl@0
|
306 |
ycoord++;
|
sl@0
|
307 |
}
|
sl@0
|
308 |
for (; ycoord < clipRect.iBr.iY; ycoord += 3) // horizontal lines
|
sl@0
|
309 |
{
|
sl@0
|
310 |
iDrawDevice->WriteRgbMulti(clipRect.iTl.iX,ycoord,clipRect.Width(),1,iPenColor,drawMode);
|
sl@0
|
311 |
}
|
sl@0
|
312 |
|
sl@0
|
313 |
ycoord = clipRect.iTl.iY;
|
sl@0
|
314 |
while (Abs((ycoord - origin.iY) % 3) != 2 && ycoord < clipRect.iBr.iY) // above the top horizontal line
|
sl@0
|
315 |
{
|
sl@0
|
316 |
xcoord = clipRect.iTl.iX;
|
sl@0
|
317 |
while (Abs((xcoord - origin.iX) % 3) != 2)
|
sl@0
|
318 |
{
|
sl@0
|
319 |
xcoord++;
|
sl@0
|
320 |
}
|
sl@0
|
321 |
for (; xcoord < clipRect.iBr.iX; xcoord += 3)
|
sl@0
|
322 |
{
|
sl@0
|
323 |
iDrawDevice->WriteRgb(xcoord,ycoord,iPenColor,drawMode);
|
sl@0
|
324 |
}
|
sl@0
|
325 |
ycoord++;
|
sl@0
|
326 |
}
|
sl@0
|
327 |
ycoord += 3;
|
sl@0
|
328 |
for (; ycoord < clipRect.iBr.iY; ycoord += 3) // between the top and bottom horizontals
|
sl@0
|
329 |
{
|
sl@0
|
330 |
xcoord = clipRect.iTl.iX;
|
sl@0
|
331 |
while (Abs((xcoord - origin.iX) % 3) != 2)
|
sl@0
|
332 |
{
|
sl@0
|
333 |
xcoord++;
|
sl@0
|
334 |
}
|
sl@0
|
335 |
for (; xcoord < clipRect.iBr.iX; xcoord += 3)
|
sl@0
|
336 |
{
|
sl@0
|
337 |
iDrawDevice->WriteRgbMulti(xcoord,ycoord - 2,1,2,iPenColor,drawMode);
|
sl@0
|
338 |
}
|
sl@0
|
339 |
}
|
sl@0
|
340 |
|
sl@0
|
341 |
ycoord -= 3;
|
sl@0
|
342 |
while (ycoord < clipRect.iBr.iY) // below the bottom horizontal
|
sl@0
|
343 |
{
|
sl@0
|
344 |
xcoord = clipRect.iTl.iX;
|
sl@0
|
345 |
while (Abs((xcoord - origin.iX) % 3) != 2)
|
sl@0
|
346 |
{
|
sl@0
|
347 |
xcoord++;
|
sl@0
|
348 |
}
|
sl@0
|
349 |
for (; xcoord < clipRect.iBr.iX; xcoord += 3)
|
sl@0
|
350 |
{
|
sl@0
|
351 |
iDrawDevice->WriteRgb(xcoord,ycoord,iPenColor,drawMode);
|
sl@0
|
352 |
}
|
sl@0
|
353 |
ycoord++;
|
sl@0
|
354 |
}
|
sl@0
|
355 |
break;
|
sl@0
|
356 |
case DirectGdi::EForwardDiagonalHatchBrush:
|
sl@0
|
357 |
iDrawDevice->WriteRgbMulti(clipRect.iTl.iX,clipRect.iTl.iY,
|
sl@0
|
358 |
clipRect.Width(),clipRect.Height(),iBrushColor,drawMode);
|
sl@0
|
359 |
for (; ycoord < clipRect.iBr.iY; ycoord++)
|
sl@0
|
360 |
{
|
sl@0
|
361 |
xcoord = clipRect.iTl.iX;
|
sl@0
|
362 |
TInt diff = (origin.iX + origin.iY - xcoord - ycoord) % 3;
|
sl@0
|
363 |
if (diff < 0)
|
sl@0
|
364 |
{
|
sl@0
|
365 |
diff += 3;
|
sl@0
|
366 |
}
|
sl@0
|
367 |
xcoord += diff;
|
sl@0
|
368 |
for (; xcoord < clipRect.iBr.iX; xcoord += 3)
|
sl@0
|
369 |
{
|
sl@0
|
370 |
iDrawDevice->WriteRgb(xcoord,ycoord,iPenColor,drawMode);
|
sl@0
|
371 |
}
|
sl@0
|
372 |
}
|
sl@0
|
373 |
break;
|
sl@0
|
374 |
case DirectGdi::ERearwardDiagonalHatchBrush:
|
sl@0
|
375 |
iDrawDevice->WriteRgbMulti(clipRect.iTl.iX,clipRect.iTl.iY,
|
sl@0
|
376 |
clipRect.Width(),clipRect.Height(),iBrushColor,drawMode);
|
sl@0
|
377 |
for (; ycoord < clipRect.iBr.iY; ycoord++)
|
sl@0
|
378 |
{
|
sl@0
|
379 |
xcoord = clipRect.iTl.iX;
|
sl@0
|
380 |
TInt diff = (origin.iX - origin.iY - xcoord + ycoord) % 3;
|
sl@0
|
381 |
if (diff < 0)
|
sl@0
|
382 |
{
|
sl@0
|
383 |
diff += 3;
|
sl@0
|
384 |
}
|
sl@0
|
385 |
xcoord += diff;
|
sl@0
|
386 |
for (; xcoord < clipRect.iBr.iX; xcoord += 3)
|
sl@0
|
387 |
{
|
sl@0
|
388 |
iDrawDevice->WriteRgb(xcoord,ycoord,iPenColor,drawMode);
|
sl@0
|
389 |
}
|
sl@0
|
390 |
}
|
sl@0
|
391 |
break;
|
sl@0
|
392 |
case DirectGdi::EDiamondCrossHatchBrush:
|
sl@0
|
393 |
{
|
sl@0
|
394 |
iDrawDevice->WriteRgbMulti(clipRect.iTl.iX,clipRect.iTl.iY,
|
sl@0
|
395 |
clipRect.Width(),clipRect.Height(),iBrushColor,drawMode);
|
sl@0
|
396 |
TInt sum = xcoord + ycoord - origin.iX - origin.iY;
|
sl@0
|
397 |
for (; ycoord < clipRect.iBr.iY; ycoord++,sum++)
|
sl@0
|
398 |
{
|
sl@0
|
399 |
TInt currentsum = sum;
|
sl@0
|
400 |
for (xcoord = clipRect.iTl.iX; xcoord < clipRect.iBr.iX; xcoord++,currentsum++)
|
sl@0
|
401 |
{
|
sl@0
|
402 |
if((currentsum & 1) == 0 && ((currentsum & 3) != 0 || ((xcoord-origin.iX) & 1) == 1))
|
sl@0
|
403 |
{
|
sl@0
|
404 |
iDrawDevice->WriteRgb(xcoord,ycoord,iPenColor,drawMode);
|
sl@0
|
405 |
}
|
sl@0
|
406 |
}
|
sl@0
|
407 |
}
|
sl@0
|
408 |
break;
|
sl@0
|
409 |
}
|
sl@0
|
410 |
default:
|
sl@0
|
411 |
return;
|
sl@0
|
412 |
}
|
sl@0
|
413 |
|
sl@0
|
414 |
iDrawDevice->UpdateRegion(clipRect);
|
sl@0
|
415 |
}
|
sl@0
|
416 |
}
|