|
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 "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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <fntstore.h> |
|
17 #include <bitmap.h> |
|
18 #include <bitstd.h> |
|
19 #include <bitdev.h> |
|
20 #include "BITPANIC.H" |
|
21 #include <graphicsaccelerator.h> |
|
22 #include <bitdraw.h> |
|
23 #include <graphics/fbsrasterizer.h> |
|
24 |
|
25 /** |
|
26 Copies a rectangle. |
|
27 |
|
28 The function provides a concrete implementation of the pure virtual |
|
29 function <code>CBitmapContext::CopyRect()</code>. The function |
|
30 behaviour is the same as documented in that class. |
|
31 */ |
|
32 EXPORT_C void CFbsBitGc::CopyRect(const TPoint& aOffset,const TRect& aRect) |
|
33 { |
|
34 if(CheckDevice(aRect) || aRect.IsEmpty() || aOffset == TPoint(0,0)) |
|
35 return; |
|
36 |
|
37 CFbsDrawDevice* drawDevice = iDevice->iDrawDevice; |
|
38 |
|
39 TRect deviceRect; |
|
40 drawDevice->GetDrawRect(deviceRect); |
|
41 const TPoint back(TPoint(0,0)-aOffset); |
|
42 TRect rcpy(aRect); |
|
43 rcpy.Move(iOrigin); |
|
44 rcpy.Intersection(deviceRect); |
|
45 ((TRegion*)iDefaultRegionPtr)->Sort(aOffset); |
|
46 |
|
47 TRect clippedBoundingRect(rcpy); |
|
48 clippedBoundingRect.Move(aOffset); |
|
49 AddRect(clippedBoundingRect); |
|
50 clippedBoundingRect.BoundingRect(rcpy); |
|
51 if(!clippedBoundingRect.Intersects(iUserClipRect)) |
|
52 return; |
|
53 |
|
54 SetupDevice(); |
|
55 iDevice->DrawingBegin(); |
|
56 |
|
57 const TInt limit=iDefaultRegionPtr->Count(); |
|
58 for(TInt count=0;count<limit;count++) |
|
59 { |
|
60 iClipRect=(*iDefaultRegionPtr)[count]; |
|
61 if(UserClipRect(iClipRect)) |
|
62 continue; |
|
63 iClipRect.Move(back); |
|
64 if(!iClipRect.Intersects(rcpy)) |
|
65 continue; |
|
66 |
|
67 iClipRect.Intersection(rcpy); |
|
68 TDrawMode drawMode = iDrawMode; |
|
69 iDrawMode = EDrawModeWriteAlpha; |
|
70 DoCopyRect(aOffset,iClipRect); |
|
71 iDrawMode = drawMode; // restore the previous draw mode |
|
72 iClipRect.Move(aOffset); |
|
73 drawDevice->UpdateRegion(iClipRect); |
|
74 } |
|
75 |
|
76 iDevice->DrawingEnd(); |
|
77 } |
|
78 |
|
79 void CFbsBitGc::DoCopyRect(const TPoint& aOffset,const TRect& rect) |
|
80 { |
|
81 CFbsDrawDevice* drawDevice = iDevice->iDrawDevice; |
|
82 #ifdef _DEBUG |
|
83 TRect deviceRect; |
|
84 drawDevice->GetDrawRect(deviceRect); |
|
85 #endif |
|
86 BG_ASSERT_DEBUG(rect.iTl.iX >= deviceRect.iTl.iX, EBitgdiPanicOutOfBounds); |
|
87 BG_ASSERT_DEBUG(rect.iTl.iY >= deviceRect.iTl.iY, EBitgdiPanicOutOfBounds); |
|
88 BG_ASSERT_DEBUG(rect.iBr.iX <= deviceRect.iBr.iX, EBitgdiPanicOutOfBounds); |
|
89 BG_ASSERT_DEBUG(rect.iBr.iY <= deviceRect.iBr.iY, EBitgdiPanicOutOfBounds); |
|
90 |
|
91 TRect offrect(rect); |
|
92 offrect.Move(aOffset); |
|
93 |
|
94 BG_ASSERT_DEBUG(offrect.iTl.iX >= deviceRect.iTl.iX, EBitgdiPanicOutOfBounds); |
|
95 BG_ASSERT_DEBUG(offrect.iTl.iY >= deviceRect.iTl.iY, EBitgdiPanicOutOfBounds); |
|
96 BG_ASSERT_DEBUG(offrect.iBr.iX <= deviceRect.iBr.iX, EBitgdiPanicOutOfBounds); |
|
97 BG_ASSERT_DEBUG(offrect.iBr.iY <= deviceRect.iBr.iY, EBitgdiPanicOutOfBounds); |
|
98 |
|
99 TInt y1 = rect.iTl.iY,y2 = rect.iBr.iY,yinc = 1; // default y2>y1 |
|
100 if (aOffset.iY > 0) // y1>y2 |
|
101 { |
|
102 y1 = rect.iBr.iY - 1; |
|
103 y2 = rect.iTl.iY - 1; |
|
104 yinc = -1; |
|
105 } |
|
106 |
|
107 const TInt width = rect.Width(); |
|
108 const TInt xoffset = rect.iTl.iX + aOffset.iX; |
|
109 const TDisplayMode dispMode = ScanLineBufferDisplayMode(drawDevice); |
|
110 TUint32* scanLineBuffer = drawDevice->ScanLineBuffer(); |
|
111 |
|
112 for (TInt row = y1; row != y2; row += yinc) |
|
113 { |
|
114 drawDevice->ReadLine(rect.iTl.iX,row,width,scanLineBuffer,dispMode); |
|
115 drawDevice->WriteLine(xoffset,row + aOffset.iY,width, scanLineBuffer,iDrawMode); |
|
116 } |
|
117 } |
|
118 |
|
119 /** |
|
120 Draws and fills a rectangle. |
|
121 |
|
122 The function provides a concrete implementation of the pure virtual |
|
123 function <code>CGraphicsContext::DrawRect()</code>. The function |
|
124 behaviour is the same as documented in that class. |
|
125 */ |
|
126 EXPORT_C void CFbsBitGc::DrawRect(const TRect& aRect) |
|
127 { |
|
128 if (CheckDevice(aRect)) |
|
129 return; |
|
130 |
|
131 TRect rcpy(aRect); |
|
132 TRect clippedBoundingRect(rcpy); |
|
133 clippedBoundingRect.Move(iOrigin); |
|
134 clippedBoundingRect.Grow((iPenSize.iWidth >> 1) + 1,(iPenSize.iHeight >> 1) + 1); |
|
135 if(!clippedBoundingRect.Intersects(iUserClipRect)) |
|
136 return; |
|
137 |
|
138 CGraphicsAccelerator* ga = GraphicsAccelerator(); |
|
139 |
|
140 SetupDevice(); |
|
141 iDevice->DrawingBegin(); |
|
142 iBrushBitmap.BeginDataAccess(); |
|
143 CFbsRasterizer* brushRasterizer = PrepareRasterizerForExtendedBitmap(iBrushBitmap); |
|
144 |
|
145 if (iPenSize.iWidth == 1 && iPenSize.iHeight == 1 && iPenStyle != ENullPen) |
|
146 { |
|
147 const TInt width = rcpy.Width(); |
|
148 const TInt height = rcpy.Height(); |
|
149 const TPoint currentLinePosition = iLinePosition; |
|
150 |
|
151 if (iPenStyle != ESolidPen) |
|
152 iDotParam = 0; |
|
153 |
|
154 if (width) |
|
155 DoDrawLine(rcpy.iTl,TPoint(rcpy.iBr.iX,rcpy.iTl.iY),ETrue); // top |
|
156 |
|
157 if (height > 2 && width > 1) |
|
158 DoDrawLine(TPoint(rcpy.iBr.iX-1,rcpy.iTl.iY+1),TPoint(rcpy.iBr.iX-1,rcpy.iBr.iY-1),ETrue); // right |
|
159 |
|
160 if (width && height > 1) |
|
161 DoDrawLine(TPoint(rcpy.iBr.iX-1,rcpy.iBr.iY-1),TPoint(rcpy.iTl.iX-1,rcpy.iBr.iY-1),ETrue); // bottom |
|
162 |
|
163 if (height > 2) |
|
164 DoDrawLine(TPoint(rcpy.iTl.iX,rcpy.iBr.iY-2),rcpy.iTl,ETrue); // left |
|
165 |
|
166 // Restore internal line position in case it has been modified by DoDrawLine(). |
|
167 // DrawRect() should not be modifying it. |
|
168 iLinePosition = currentLinePosition; |
|
169 |
|
170 if (width < 3 || height < 3) |
|
171 goto nofill; |
|
172 |
|
173 rcpy.Shrink(1,1); |
|
174 rcpy.Move(iOrigin); |
|
175 } |
|
176 else if (iPenStyle != ENullPen && (iPenSize.iWidth >= 1 && iPenSize.iHeight >= 1)) |
|
177 { |
|
178 rcpy.Move(iOrigin); |
|
179 |
|
180 const TBrushStyle tempbrushstyle = iBrushStyle; |
|
181 iBrushStyle = ESolidBrush; |
|
182 const TRgb tempbrushColor = iBrushColor; |
|
183 iBrushColor = iPenColor; |
|
184 const CGraphicsContext::TDrawMode tempdrawmode = iDrawMode; |
|
185 |
|
186 if(iDrawMode != CGraphicsContext::EDrawModeWriteAlpha) |
|
187 { |
|
188 iDrawMode = CGraphicsContext::EDrawModePEN; |
|
189 } |
|
190 |
|
191 const TInt halfpenwidth = (iPenSize.iWidth - 1) >> 1; |
|
192 const TInt halfpenheight = (iPenSize.iHeight - 1) >> 1; |
|
193 const TInt otherhalfwidth = (iPenSize.iWidth >> 1) + 1; |
|
194 const TInt otherhalfheight = (iPenSize.iHeight >> 1) + 1; |
|
195 |
|
196 rcpy.iBr.iX--; |
|
197 rcpy.iBr.iY--; |
|
198 |
|
199 if (rcpy.iBr.iY - rcpy.iTl.iY <= iPenSize.iHeight + 1 || rcpy.iBr.iX - rcpy.iTl.iX <= iPenSize.iWidth + 1) |
|
200 { |
|
201 rcpy.iTl.iX -= halfpenwidth; |
|
202 rcpy.iTl.iY -= halfpenheight; |
|
203 rcpy.iBr.iX += otherhalfwidth; |
|
204 rcpy.iBr.iY += otherhalfheight; |
|
205 |
|
206 RectFill(rcpy); |
|
207 |
|
208 iBrushStyle = tempbrushstyle; |
|
209 iBrushColor = tempbrushColor; |
|
210 iDrawMode = tempdrawmode; |
|
211 |
|
212 goto nofill; |
|
213 } |
|
214 else |
|
215 { |
|
216 RectFill(TRect(rcpy.iTl.iX - halfpenwidth,rcpy.iTl.iY - halfpenheight,rcpy.iBr.iX + otherhalfwidth,rcpy.iTl.iY + otherhalfheight)); // top |
|
217 RectFill(TRect(rcpy.iTl.iX - halfpenwidth,rcpy.iTl.iY + otherhalfheight,rcpy.iTl.iX + otherhalfwidth,rcpy.iBr.iY - halfpenheight)); // left |
|
218 RectFill(TRect(rcpy.iBr.iX - halfpenwidth,rcpy.iTl.iY + otherhalfheight,rcpy.iBr.iX + otherhalfwidth,rcpy.iBr.iY - halfpenheight)); // right |
|
219 RectFill(TRect(rcpy.iTl.iX - halfpenwidth,rcpy.iBr.iY - halfpenheight,rcpy.iBr.iX + otherhalfwidth,rcpy.iBr.iY + otherhalfheight)); // bottom |
|
220 |
|
221 rcpy.iTl.iX += otherhalfwidth; |
|
222 rcpy.iTl.iY += otherhalfheight; |
|
223 rcpy.iBr.iX -= halfpenwidth; |
|
224 rcpy.iBr.iY -= halfpenheight; |
|
225 |
|
226 iBrushStyle = tempbrushstyle; |
|
227 iBrushColor = tempbrushColor; |
|
228 iDrawMode = tempdrawmode; |
|
229 } |
|
230 } |
|
231 else |
|
232 rcpy.Move(iOrigin); |
|
233 |
|
234 //use Graphics accelerator if available |
|
235 if(ga) |
|
236 { |
|
237 TInt i = -1; |
|
238 //Draw rect |
|
239 if(iPenStyle == ENullPen && iShadowMode == CFbsDrawDevice::ENoShadow) |
|
240 { |
|
241 if(iBrushStyle == ESolidBrush ) |
|
242 { |
|
243 // EDrawModePEN and EDrawModeWriteAlpha mode should use the same method when |
|
244 // (1) solid brush with opaque color is used. Or |
|
245 // (2) solid brush with transparent color is used but display mode is |
|
246 // other than EColor64K, EColor16MU, EColor16MA, EColor16MAP. |
|
247 // in the same way as the software implemantation does and calls WriteRgbMulti method. |
|
248 if(iDrawMode == EDrawModeWriteAlpha) |
|
249 { |
|
250 i = 0; |
|
251 } |
|
252 else if(iDrawMode == EDrawModePEN) |
|
253 { |
|
254 if(iBrushColor.Alpha() == 255) |
|
255 { |
|
256 i = 0; |
|
257 } |
|
258 else |
|
259 { |
|
260 TDisplayMode dispMode = iDevice->DisplayMode(); |
|
261 if(dispMode != EColor64K && dispMode != EColor16MU && dispMode != EColor16MA && dispMode != EColor16MAP) |
|
262 { |
|
263 i = 0; |
|
264 } |
|
265 } |
|
266 } |
|
267 //Invert color |
|
268 else if(iDrawMode == EDrawModeNOTSCREEN) |
|
269 { |
|
270 i = 1; |
|
271 } |
|
272 } |
|
273 //use a patter brush |
|
274 else if(iBrushStyle == EPatternedBrush) |
|
275 { |
|
276 i = 2; |
|
277 } |
|
278 } |
|
279 |
|
280 if(i != -1) |
|
281 { |
|
282 TInt gaOperationResult = KErrUnknown; |
|
283 iDevice->DrawingEnd(); |
|
284 |
|
285 const TInt limit=iDefaultRegionPtr->Count(); |
|
286 for (TInt count = 0; count < limit; count++) |
|
287 { |
|
288 iClipRect = (*iDefaultRegionPtr)[count]; |
|
289 if (!iClipRect.Intersects(rcpy)) |
|
290 continue; |
|
291 |
|
292 iClipRect.Intersection(rcpy); |
|
293 if (UserClipRect(iClipRect)) |
|
294 continue; |
|
295 |
|
296 switch(i) |
|
297 { |
|
298 case 0: |
|
299 gaOperationResult = ga->Operation(TGopFilledRect(iClipRect,iBrushColor)); |
|
300 break; |
|
301 case 1: |
|
302 gaOperationResult = ga->Operation(TGopInvertRect(iClipRect)); |
|
303 break; |
|
304 case 2: |
|
305 CFbsBitmap* brushbitmap = (CFbsBitmap*)&iBrushBitmap; |
|
306 BG_ASSERT_ALWAYS(iBrushUsed,EBitgdiPanicInvalidBitmap); |
|
307 BG_ASSERT_ALWAYS(brushbitmap != NULL,EBitgdiPanicInvalidBitmap); |
|
308 |
|
309 TAcceleratedBitmapSpec brushBitmapSpec(brushbitmap); |
|
310 TGopFillPattern gopFillPattern; |
|
311 gopFillPattern.iBitmap = brushBitmapSpec; |
|
312 gopFillPattern.iOrigin = iBrushOrigin; |
|
313 gaOperationResult = ga->Operation(TGopFilledRectWithPattern(iClipRect,gopFillPattern)); |
|
314 break; |
|
315 } |
|
316 if(gaOperationResult != KErrNone) |
|
317 break; |
|
318 } |
|
319 if(gaOperationResult == KErrNone) |
|
320 goto finish; |
|
321 iDevice->DrawingBegin(); |
|
322 } |
|
323 } |
|
324 |
|
325 RectFill(rcpy); |
|
326 |
|
327 nofill: |
|
328 iDevice->DrawingEnd(); |
|
329 finish: |
|
330 if (brushRasterizer) |
|
331 { |
|
332 brushRasterizer->EndBitmap(iBrushBitmap.SerialNumber()); |
|
333 } |
|
334 iBrushBitmap.EndDataAccess(ETrue); |
|
335 } |
|
336 |
|
337 // if iBrushBitmap is an extended bitmap, PrepareRasterizerForExtendedBitmap() must have been called before this method |
|
338 void CFbsBitGc::RectFill(const TRect& aRect) |
|
339 { |
|
340 if (aRect.IsEmpty() || iBrushStyle == ENullBrush) |
|
341 return; |
|
342 |
|
343 CFbsDrawDevice* drawDevice = iDevice->iDrawDevice; |
|
344 |
|
345 AddRect(aRect); |
|
346 |
|
347 const TPoint origin = iOrigin + iBrushOrigin; |
|
348 |
|
349 const TInt limit=iDefaultRegionPtr->Count(); |
|
350 for (TInt count = 0; count < limit; count++) |
|
351 { |
|
352 iClipRect = (*iDefaultRegionPtr)[count]; |
|
353 if (!iClipRect.Intersects(aRect)) |
|
354 continue; |
|
355 |
|
356 iClipRect.Intersection(aRect); |
|
357 if (UserClipRect(iClipRect)) |
|
358 continue; |
|
359 |
|
360 #ifdef _DEBUG |
|
361 TRect deviceRect; |
|
362 drawDevice->GetDrawRect(deviceRect); |
|
363 #endif |
|
364 BG_ASSERT_DEBUG(iClipRect.iTl.iX >= deviceRect.iTl.iX, EBitgdiPanicOutOfBounds); |
|
365 BG_ASSERT_DEBUG(iClipRect.iTl.iY >= deviceRect.iTl.iY, EBitgdiPanicOutOfBounds); |
|
366 BG_ASSERT_DEBUG(iClipRect.iBr.iX <= deviceRect.iBr.iX, EBitgdiPanicOutOfBounds); |
|
367 BG_ASSERT_DEBUG(iClipRect.iBr.iY <= deviceRect.iBr.iY, EBitgdiPanicOutOfBounds); |
|
368 |
|
369 TInt xcoord = iClipRect.iTl.iX; |
|
370 TInt ycoord = iClipRect.iTl.iY; |
|
371 |
|
372 |
|
373 switch(iBrushStyle) |
|
374 { |
|
375 case ESolidBrush: |
|
376 drawDevice->WriteRgbMulti(iClipRect.iTl.iX,iClipRect.iTl.iY, |
|
377 iClipRect.Width(),iClipRect.Height(),iBrushColor,iDrawMode); |
|
378 break; |
|
379 case EPatternedBrush: |
|
380 { |
|
381 CBitwiseBitmap* brushbitmap = iBrushBitmap.Address(); |
|
382 BG_ASSERT_ALWAYS(iBrushUsed,EBitgdiPanicInvalidBitmap); |
|
383 BG_ASSERT_ALWAYS(brushbitmap != NULL,EBitgdiPanicInvalidBitmap); |
|
384 |
|
385 TRect sourcerect(iClipRect); |
|
386 sourcerect.Move(-origin); |
|
387 DoBitBlt(iClipRect.iTl,brushbitmap,iBrushBitmap.DataAddress(),iBrushBitmap.DataStride(),sourcerect); |
|
388 break; |
|
389 } |
|
390 case EHorizontalHatchBrush: |
|
391 drawDevice->WriteRgbMulti(iClipRect.iTl.iX,iClipRect.iTl.iY, |
|
392 iClipRect.Width(),iClipRect.Height(),iBrushColor,iDrawMode); |
|
393 while (Abs((ycoord - origin.iY) % 3) != 2) |
|
394 ycoord++; |
|
395 for (; ycoord < iClipRect.iBr.iY; ycoord += 3) |
|
396 drawDevice->WriteRgbMulti(iClipRect.iTl.iX,ycoord,iClipRect.Width(),1,iPenColor,iDrawMode); |
|
397 break; |
|
398 case EVerticalHatchBrush: |
|
399 drawDevice->WriteRgbMulti(iClipRect.iTl.iX,iClipRect.iTl.iY, |
|
400 iClipRect.Width(),iClipRect.Height(),iBrushColor,iDrawMode); |
|
401 while (Abs((xcoord - origin.iX) % 3) != 2) |
|
402 xcoord++; |
|
403 for (; xcoord < iClipRect.iBr.iX; xcoord += 3) |
|
404 drawDevice->WriteRgbMulti(xcoord,iClipRect.iTl.iY,1,iClipRect.Height(),iPenColor,iDrawMode); |
|
405 break; |
|
406 case ESquareCrossHatchBrush: |
|
407 drawDevice->WriteRgbMulti(iClipRect.iTl.iX,iClipRect.iTl.iY, |
|
408 iClipRect.Width(),iClipRect.Height(),iBrushColor,iDrawMode); |
|
409 while (Abs((ycoord - origin.iY) % 3) != 2) |
|
410 ycoord++; |
|
411 for (; ycoord < iClipRect.iBr.iY; ycoord += 3) // horizontal lines |
|
412 drawDevice->WriteRgbMulti(iClipRect.iTl.iX,ycoord,iClipRect.Width(),1,iPenColor,iDrawMode); |
|
413 |
|
414 ycoord = iClipRect.iTl.iY; |
|
415 while (Abs((ycoord - origin.iY) % 3) != 2 && ycoord < iClipRect.iBr.iY) // above the top horizontal line |
|
416 { |
|
417 xcoord = iClipRect.iTl.iX; |
|
418 while (Abs((xcoord - origin.iX) % 3) != 2) |
|
419 xcoord++; |
|
420 for (; xcoord < iClipRect.iBr.iX; xcoord += 3) |
|
421 drawDevice->WriteRgb(xcoord,ycoord,iPenColor,iDrawMode); |
|
422 ycoord++; |
|
423 } |
|
424 |
|
425 ycoord += 3; |
|
426 for (; ycoord < iClipRect.iBr.iY; ycoord += 3) // between the top and bottom horizontals |
|
427 { |
|
428 xcoord = iClipRect.iTl.iX; |
|
429 while (Abs((xcoord - origin.iX) % 3) != 2) |
|
430 xcoord++; |
|
431 for (; xcoord < iClipRect.iBr.iX; xcoord += 3) |
|
432 drawDevice->WriteRgbMulti(xcoord,ycoord - 2,1,2,iPenColor,iDrawMode); |
|
433 } |
|
434 |
|
435 ycoord -= 3; |
|
436 while (ycoord < iClipRect.iBr.iY) // below the bottom horizontal |
|
437 { |
|
438 xcoord = iClipRect.iTl.iX; |
|
439 while (Abs((xcoord - origin.iX) % 3) != 2) |
|
440 xcoord++; |
|
441 for (; xcoord < iClipRect.iBr.iX; xcoord += 3) |
|
442 drawDevice->WriteRgb(xcoord,ycoord,iPenColor,iDrawMode); |
|
443 ycoord++; |
|
444 } |
|
445 break; |
|
446 case EForwardDiagonalHatchBrush: |
|
447 drawDevice->WriteRgbMulti(iClipRect.iTl.iX,iClipRect.iTl.iY, |
|
448 iClipRect.Width(),iClipRect.Height(),iBrushColor,iDrawMode); |
|
449 for (; ycoord < iClipRect.iBr.iY; ycoord++) |
|
450 { |
|
451 xcoord = iClipRect.iTl.iX; |
|
452 TInt diff = (origin.iX + origin.iY - xcoord - ycoord) % 3; |
|
453 if (diff < 0) |
|
454 diff += 3; |
|
455 xcoord += diff; |
|
456 for (; xcoord < iClipRect.iBr.iX; xcoord += 3) |
|
457 drawDevice->WriteRgb(xcoord,ycoord,iPenColor,iDrawMode); |
|
458 } |
|
459 break; |
|
460 case ERearwardDiagonalHatchBrush: |
|
461 drawDevice->WriteRgbMulti(iClipRect.iTl.iX,iClipRect.iTl.iY, |
|
462 iClipRect.Width(),iClipRect.Height(),iBrushColor,iDrawMode); |
|
463 for (; ycoord < iClipRect.iBr.iY; ycoord++) |
|
464 { |
|
465 xcoord = iClipRect.iTl.iX; |
|
466 TInt diff = (origin.iX - origin.iY - xcoord + ycoord) % 3; |
|
467 if (diff < 0) |
|
468 diff += 3; |
|
469 xcoord += diff; |
|
470 for (; xcoord < iClipRect.iBr.iX; xcoord += 3) |
|
471 drawDevice->WriteRgb(xcoord,ycoord,iPenColor,iDrawMode); |
|
472 } |
|
473 break; |
|
474 case EDiamondCrossHatchBrush: |
|
475 { |
|
476 drawDevice->WriteRgbMulti(iClipRect.iTl.iX,iClipRect.iTl.iY, |
|
477 iClipRect.Width(),iClipRect.Height(),iBrushColor,iDrawMode); |
|
478 TInt sum = xcoord + ycoord - origin.iX - origin.iY; |
|
479 for (; ycoord < iClipRect.iBr.iY; ycoord++,sum++) |
|
480 { |
|
481 TInt currentsum = sum; |
|
482 for (xcoord = iClipRect.iTl.iX; xcoord < iClipRect.iBr.iX; xcoord++,currentsum++) |
|
483 { |
|
484 if((currentsum & 1) == 0 && ((currentsum & 3) != 0 || ((xcoord-origin.iX) & 1) == 1)) |
|
485 drawDevice->WriteRgb(xcoord,ycoord,iPenColor,iDrawMode); |
|
486 } |
|
487 } |
|
488 break; |
|
489 } |
|
490 default: |
|
491 return; |
|
492 } |
|
493 |
|
494 drawDevice->UpdateRegion(iClipRect); |
|
495 } |
|
496 } |
|
497 |