|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: AlfRenderStage provides a way to redirect avkon drawing to a graphics accelerator |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * @note: There are a lot of L functions called by non-leaving GC functions and thus possibly causing |
|
20 * WServ and phone to boot in leave situation. That has been done on purpose, because |
|
21 * it is extreamly fatal case if those functions leave. We cannot skip critical commands. |
|
22 * In practise, those functions never leave. |
|
23 * |
|
24 */ |
|
25 |
|
26 #include <gdi.h> |
|
27 #include <uiacceltk/HuiCanvasVisual.h> |
|
28 #include <huiwscanvascommands.h> |
|
29 #include "alfrssendbuffer.h" |
|
30 #include "alfrsgc.h" |
|
31 |
|
32 const TUint8 KNoSupportInAnyRenderer = 63; |
|
33 |
|
34 // --------------------------------------------------------------------------- |
|
35 // NewL |
|
36 // --------------------------------------------------------------------------- |
|
37 // |
|
38 CAlfGraphicsContext* CAlfGraphicsContext::NewL( CAlfRsSendBuffer& aAlfSendBuffer ) |
|
39 { |
|
40 CAlfGraphicsContext* self = new(ELeave) CAlfGraphicsContext( aAlfSendBuffer ); |
|
41 CleanupStack::PushL(self); |
|
42 self->ConstructL(); |
|
43 CleanupStack::Pop(self); |
|
44 return self; |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // C++ constructor |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 CAlfGraphicsContext::CAlfGraphicsContext( CAlfRsSendBuffer& aAlfSendBuffer) : |
|
52 iFontHandle(0), |
|
53 iTextShadowColor( TRgb(KRgbBlack) ), |
|
54 iBrushPatternSet( EFalse ), |
|
55 iPenColor( TRgb( KRgbBlack ) ), |
|
56 iBrushColor( TRgb( KRgbBlack ) ), |
|
57 iSendBuffer( aAlfSendBuffer ) |
|
58 {} |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // ConstructL |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 void CAlfGraphicsContext::ConstructL( ) |
|
65 { |
|
66 iFontHandle = 0; |
|
67 iBrushPatternSet = EFalse; |
|
68 DoReset(); |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // C++ destructor |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 CAlfGraphicsContext::~CAlfGraphicsContext() |
|
76 { |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // BitBlt |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 void CAlfGraphicsContext::BitBlt(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap) |
|
84 { |
|
85 |
|
86 #ifdef _OPTIMIZE_WS_COMMANDS_ADVANCED_ |
|
87 if ( !CheckDelayedClipping( TRect( aDestPos, aSourceBitmap.SizeInPixels()))) |
|
88 { |
|
89 // outside clipping region |
|
90 return; |
|
91 } |
|
92 FlushStateL( iRollback ); |
|
93 #endif |
|
94 |
|
95 iSendBuffer.WriteIntsL(EAlfBitBlt, |
|
96 3, |
|
97 aDestPos.iX, |
|
98 aDestPos.iY, |
|
99 aSourceBitmap.Handle()); |
|
100 |
|
101 const TRect rect = aSourceBitmap.SizeInPixels() + aDestPos; |
|
102 iSendBuffer.AppendPatternSearchCache( aSourceBitmap, NULL, rect, aDestPos, 1 ); |
|
103 iDrawCommandCount++; |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // BitBlt |
|
108 // --------------------------------------------------------------------------- |
|
109 // |
|
110 void CAlfGraphicsContext::BitBlt( |
|
111 const TPoint& aDestPos, |
|
112 const CFbsBitmap& aSourceBitmap, |
|
113 const TRect& aSourceRect ) |
|
114 { |
|
115 #ifdef _OPTIMIZE_WS_COMMANDS_ADVANCED_ |
|
116 if ( !CheckDelayedClipping( TRect( aDestPos, aSourceRect.Size()))) |
|
117 { |
|
118 // outside clipping region |
|
119 return; |
|
120 } |
|
121 FlushStateL( iRollback ); |
|
122 #endif |
|
123 iSendBuffer.WriteIntsL(EAlfBitBltRect, |
|
124 7, |
|
125 aDestPos.iX, |
|
126 aDestPos.iY, |
|
127 aSourceBitmap.Handle(), |
|
128 aSourceRect.iTl.iX, |
|
129 aSourceRect.iTl.iY, |
|
130 aSourceRect.iBr.iX, |
|
131 aSourceRect.iBr.iY ); |
|
132 iSendBuffer.AppendPatternSearchCache( aSourceBitmap, NULL, aSourceRect, aDestPos, 1 ); |
|
133 iDrawCommandCount++; |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------------------------- |
|
137 // BitBltMasked |
|
138 // --------------------------------------------------------------------------- |
|
139 // |
|
140 void CAlfGraphicsContext::BitBltMasked( |
|
141 const TPoint& aDestPos, |
|
142 const CFbsBitmap& aSourceBitmap, |
|
143 const TRect& aSourceRect, |
|
144 const CFbsBitmap& aMaskBitmap, |
|
145 TBool aInvertMask ) |
|
146 { |
|
147 #ifdef _OPTIMIZE_WS_COMMANDS_ADVANCED_ |
|
148 if ( !CheckDelayedClipping( TRect( aDestPos, aSourceRect.Size()))) |
|
149 { |
|
150 // outside clipping region |
|
151 return; |
|
152 } |
|
153 |
|
154 FlushStateL( iRollback ); |
|
155 #endif |
|
156 iSendBuffer.WriteIntsL(EAlfBitBltMasked, |
|
157 9, |
|
158 aDestPos.iX, |
|
159 aDestPos.iY, |
|
160 aSourceBitmap.Handle(), |
|
161 aSourceRect.iTl.iX, |
|
162 aSourceRect.iTl.iY, |
|
163 aSourceRect.iBr.iX, |
|
164 aSourceRect.iBr.iY, |
|
165 aMaskBitmap.Handle(), |
|
166 aInvertMask ); |
|
167 |
|
168 iSendBuffer.AppendPatternSearchCache( |
|
169 aSourceBitmap, |
|
170 &aMaskBitmap, |
|
171 aSourceRect, |
|
172 aDestPos, |
|
173 aInvertMask ); |
|
174 iDrawCommandCount++; |
|
175 } |
|
176 |
|
177 // --------------------------------------------------------------------------- |
|
178 // BitBltMasked |
|
179 // --------------------------------------------------------------------------- |
|
180 // |
|
181 void CAlfGraphicsContext::BitBltMasked( |
|
182 const TPoint& aDestPos, |
|
183 const CFbsBitmap& aSourceBitmap, |
|
184 const TRect& aSourceRect, |
|
185 const CFbsBitmap& aMaskBitmap, |
|
186 const TPoint& aMaskPos ) |
|
187 { |
|
188 #ifdef _OPTIMIZE_WS_COMMANDS_ADVANCED_ |
|
189 if ( !CheckDelayedClipping( TRect( aDestPos, aSourceRect.Size()))) |
|
190 { |
|
191 // outside clipping region |
|
192 return; |
|
193 } |
|
194 FlushStateL( iRollback ); |
|
195 #endif |
|
196 iSendBuffer.WriteIntsL( EAlfBitBltMaskedPoint, |
|
197 10, |
|
198 aDestPos.iX, |
|
199 aDestPos.iY, |
|
200 aSourceBitmap.Handle(), |
|
201 aSourceRect.iTl.iX, |
|
202 aSourceRect.iTl.iY, |
|
203 aSourceRect.iBr.iX, |
|
204 aSourceRect.iBr.iY, |
|
205 aMaskBitmap.Handle(), |
|
206 aMaskPos.iX, |
|
207 aMaskPos.iY ); |
|
208 iDrawCommandCount++; |
|
209 } |
|
210 |
|
211 // --------------------------------------------------------------------------- |
|
212 // Reioion |
|
213 // calls CancelClippingRegion |
|
214 // --------------------------------------------------------------------------- |
|
215 // |
|
216 void CAlfGraphicsContext::ResetClippingRegion() |
|
217 { |
|
218 if ( iClippingRegion.Count() == 0 ) |
|
219 { |
|
220 return; |
|
221 } |
|
222 iClippingRegion.Clear(); |
|
223 #ifdef _OPTIMIZE_WS_COMMANDS_ADVANCED_ |
|
224 iDelayedContextState |= EModifiedClipReset; |
|
225 iDelayedContextState &= ~EModifiedClipRect; |
|
226 iPreviousClippingRegion.Clear(); |
|
227 #else |
|
228 iSendBuffer.WriteCommandL( EAlfResetClippingRegion ); |
|
229 #endif |
|
230 } |
|
231 |
|
232 // --------------------------------------------------------------------------- |
|
233 // Clear |
|
234 // --------------------------------------------------------------------------- |
|
235 // |
|
236 void CAlfGraphicsContext::Clear() |
|
237 { |
|
238 #ifdef _OPTIMIZE_WS_COMMANDS_ADVANCED_ |
|
239 FlushStateL( iRollback ); |
|
240 #endif |
|
241 iSendBuffer.WriteCommandL( EAlfClear ); |
|
242 iDrawCommandCount++; |
|
243 } |
|
244 |
|
245 // --------------------------------------------------------------------------- |
|
246 // Clear |
|
247 // --------------------------------------------------------------------------- |
|
248 // |
|
249 void CAlfGraphicsContext::Clear(const TRect& aRect) |
|
250 { |
|
251 #ifdef _OPTIMIZE_WS_COMMANDS_ADVANCED_ |
|
252 // This will result skipping the preceding clipping rect setting, if text is fully inside the clip |
|
253 CheckDelayedClipping( aRect ); |
|
254 FlushStateL( iRollback ); |
|
255 #endif |
|
256 iSendBuffer.WriteIntsL( EAlfClearRect, |
|
257 4, |
|
258 aRect.iTl.iX, |
|
259 aRect.iTl.iY, |
|
260 aRect.iBr.iX, |
|
261 aRect.iBr.iY ); |
|
262 iDrawCommandCount++; |
|
263 } |
|
264 |
|
265 // --------------------------------------------------------------------------- |
|
266 // ResetBrushPattern |
|
267 // calls DiscardBrushPattern on the other side |
|
268 // --------------------------------------------------------------------------- |
|
269 // |
|
270 void CAlfGraphicsContext::ResetBrushPattern() |
|
271 { |
|
272 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
273 if (!iBrushPatternSet) |
|
274 return; |
|
275 #endif |
|
276 iBrushPatternSet = EFalse; |
|
277 iSendBuffer.WriteCommandL( EAlfResetBrushPattern ); |
|
278 } |
|
279 |
|
280 // --------------------------------------------------------------------------- |
|
281 // ResetFont |
|
282 // calls DiscardFont on the other side |
|
283 // --------------------------------------------------------------------------- |
|
284 // |
|
285 void CAlfGraphicsContext::ResetFont() |
|
286 { |
|
287 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
288 if (iFontHandle == 0) |
|
289 return; |
|
290 #endif |
|
291 iFontHandle = 0; |
|
292 #ifdef _OPTIMIZE_WS_COMMANDS_FONT_ |
|
293 iDelayedContextState |= EModifiedResetFont; |
|
294 iDelayedContextState &= ~EModifiedSetFontNoDuplicate; |
|
295 #else |
|
296 iSendBuffer.WriteCommandL( EAlfResetFont ); |
|
297 #endif |
|
298 } |
|
299 |
|
300 // --------------------------------------------------------------------------- |
|
301 // DrawArc |
|
302 // --------------------------------------------------------------------------- |
|
303 // |
|
304 void CAlfGraphicsContext::DrawArc( |
|
305 const TRect& aRect, |
|
306 const TPoint& aStart, |
|
307 const TPoint& aEnd ) |
|
308 { |
|
309 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
310 FlushStateL( iRollback ); |
|
311 #endif |
|
312 iSendBuffer.WriteIntsL( EAlfDrawArc, |
|
313 8, |
|
314 aRect.iTl.iX, |
|
315 aRect.iTl.iY, |
|
316 aRect.iBr.iX, |
|
317 aRect.iBr.iY, |
|
318 aStart.iX, |
|
319 aStart.iY, |
|
320 aEnd.iX, |
|
321 aEnd.iY ); |
|
322 iDrawCommandCount++; |
|
323 } |
|
324 |
|
325 // --------------------------------------------------------------------------- |
|
326 // DrawPie |
|
327 // --------------------------------------------------------------------------- |
|
328 // |
|
329 void CAlfGraphicsContext::DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd) |
|
330 { |
|
331 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
332 FlushStateL( iRollback ); |
|
333 #endif |
|
334 iSendBuffer.WriteIntsL( EAlfDrawPie, |
|
335 8, |
|
336 aRect.iTl.iX, |
|
337 aRect.iTl.iY, |
|
338 aRect.iBr.iX, |
|
339 aRect.iBr.iY, |
|
340 aStart.iX, |
|
341 aStart.iY, |
|
342 aEnd.iX, |
|
343 aEnd.iY ); |
|
344 iDrawCommandCount++; |
|
345 } |
|
346 |
|
347 // --------------------------------------------------------------------------- |
|
348 // DrawBitmap |
|
349 // --------------------------------------------------------------------------- |
|
350 // |
|
351 void CAlfGraphicsContext::DrawBitmap(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap) |
|
352 { |
|
353 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
354 FlushStateL( iRollback ); |
|
355 #endif |
|
356 iSendBuffer.WriteIntsL( EAlfDrawBitmap1, |
|
357 5, |
|
358 aDestRect.iTl.iX, |
|
359 aDestRect.iTl.iY, |
|
360 aDestRect.iBr.iX, |
|
361 aDestRect.iBr.iY, |
|
362 aSourceBitmap.Handle() ); |
|
363 iDrawCommandCount++; |
|
364 } |
|
365 |
|
366 // --------------------------------------------------------------------------- |
|
367 // DrawBitmap |
|
368 // --------------------------------------------------------------------------- |
|
369 // |
|
370 void CAlfGraphicsContext::DrawBitmap( |
|
371 const TRect& aDestRect, |
|
372 const CFbsBitmap& aSourceBitmap, |
|
373 const TRect& aSourceRect ) |
|
374 { |
|
375 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
376 FlushStateL( iRollback ); |
|
377 #endif |
|
378 iSendBuffer.WriteIntsL( EAlfDrawBitmap2, |
|
379 9, |
|
380 aDestRect.iTl.iX, |
|
381 aDestRect.iTl.iY, |
|
382 aDestRect.iBr.iX, |
|
383 aDestRect.iBr.iY, |
|
384 aSourceBitmap.Handle(), |
|
385 aSourceRect.iTl.iX, |
|
386 aSourceRect.iTl.iY, |
|
387 aSourceRect.iBr.iX, |
|
388 aSourceRect.iBr.iY ); |
|
389 iDrawCommandCount++; |
|
390 } |
|
391 |
|
392 // --------------------------------------------------------------------------- |
|
393 // DrawBitmap |
|
394 // --------------------------------------------------------------------------- |
|
395 // |
|
396 void CAlfGraphicsContext::DrawBitmap(const TPoint &aTopLeft, const CFbsBitmap &aSource) |
|
397 { |
|
398 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
399 FlushStateL( iRollback ); |
|
400 #endif |
|
401 iSendBuffer.WriteIntsL( EAlfDrawBitmap3, |
|
402 3, |
|
403 aTopLeft.iX, |
|
404 aTopLeft.iY, |
|
405 aSource.Handle() ); |
|
406 iDrawCommandCount++; |
|
407 } |
|
408 |
|
409 // --------------------------------------------------------------------------- |
|
410 // DrawBitmapMasked |
|
411 // --------------------------------------------------------------------------- |
|
412 // |
|
413 void CAlfGraphicsContext::DrawBitmapMasked( |
|
414 const TRect& aDestRect, |
|
415 const CFbsBitmap& aSourceBitmap, |
|
416 const TRect& aSourceRect, |
|
417 const CFbsBitmap& aMaskBitmap, |
|
418 TBool aInvertMask ) |
|
419 { |
|
420 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
421 FlushStateL( iRollback ); |
|
422 #endif |
|
423 iSendBuffer.WriteIntsL( EAlfDrawBitmapMasked, |
|
424 11, |
|
425 aDestRect.iTl.iX, |
|
426 aDestRect.iTl.iY, |
|
427 aDestRect.iBr.iX, |
|
428 aDestRect.iBr.iY, |
|
429 aSourceBitmap.Handle(), |
|
430 aSourceRect.iTl.iX, |
|
431 aSourceRect.iTl.iY, |
|
432 aSourceRect.iBr.iX, |
|
433 aSourceRect.iBr.iY, |
|
434 aMaskBitmap.Handle(), |
|
435 aInvertMask ); |
|
436 iDrawCommandCount++; |
|
437 } |
|
438 |
|
439 // --------------------------------------------------------------------------- |
|
440 // DrawRoundRect |
|
441 // --------------------------------------------------------------------------- |
|
442 // |
|
443 void CAlfGraphicsContext::DrawRoundRect(const TRect& aRect, const TSize& aEllipse) |
|
444 { |
|
445 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
446 FlushStateL( iRollback ); |
|
447 #endif |
|
448 iSendBuffer.WriteIntsL( EAlfDrawRoundRect, |
|
449 6, |
|
450 aRect.iTl.iX, |
|
451 aRect.iTl.iY, |
|
452 aRect.iBr.iX, |
|
453 aRect.iBr.iY, |
|
454 aEllipse.iWidth, |
|
455 aEllipse.iHeight ); |
|
456 iDrawCommandCount++; |
|
457 } |
|
458 |
|
459 // --------------------------------------------------------------------------- |
|
460 // DrawPolyLine |
|
461 // Funnel both DrawPolyline to the same |
|
462 // --------------------------------------------------------------------------- |
|
463 // |
|
464 void CAlfGraphicsContext::DrawPolyLine(const CArrayFix<TPoint>* aPoWriteIntList) |
|
465 { |
|
466 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
467 FlushStateL( iRollback ); |
|
468 #endif |
|
469 iSendBuffer.WritePointArrayL( EAlfDrawPolyLine, aPoWriteIntList ); |
|
470 iDrawCommandCount++; |
|
471 } |
|
472 |
|
473 // --------------------------------------------------------------------------- |
|
474 // DrawPolyLine |
|
475 // --------------------------------------------------------------------------- |
|
476 // |
|
477 void CAlfGraphicsContext::DrawPolyLine(const TArray<TPoint>& aPointList) |
|
478 { |
|
479 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
480 FlushStateL( iRollback ); |
|
481 #endif |
|
482 iSendBuffer.WritePointArrayL( EAlfDrawPolyLine, &aPointList ); |
|
483 iDrawCommandCount++; |
|
484 }; |
|
485 // --------------------------------------------------------------------------- |
|
486 // DrawPolyLineNoEndPoint |
|
487 // --------------------------------------------------------------------------- |
|
488 // |
|
489 void CAlfGraphicsContext::DrawPolyLineNoEndPoint( |
|
490 const TPoint *aPoWriteIntList, |
|
491 TInt aNumPoints ) |
|
492 { |
|
493 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
494 FlushStateL( iRollback ); |
|
495 #endif |
|
496 iSendBuffer.WritePointArrayL( EAlfDrawPolyLineNoEndPoint, aPoWriteIntList, aNumPoints ); |
|
497 iDrawCommandCount++; |
|
498 } |
|
499 |
|
500 |
|
501 // --------------------------------------------------------------------------- |
|
502 // DrawPolyLine |
|
503 // --------------------------------------------------------------------------- |
|
504 // |
|
505 void CAlfGraphicsContext::DrawPolyLine(const TPoint *aPoWriteIntList, TInt aNumPoints) |
|
506 { |
|
507 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
508 FlushStateL( iRollback ); |
|
509 #endif |
|
510 iSendBuffer.WritePointArrayL( EAlfDrawPolyLine, aPoWriteIntList, aNumPoints ); |
|
511 iDrawCommandCount++; |
|
512 } |
|
513 |
|
514 // --------------------------------------------------------------------------- |
|
515 // DrawPolyLineNoEndPoint |
|
516 // --------------------------------------------------------------------------- |
|
517 // |
|
518 void CAlfGraphicsContext::DrawPolyLineNoEndPoint(const TArray<TPoint>& aPointList) |
|
519 { |
|
520 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
521 FlushStateL( iRollback ); |
|
522 #endif |
|
523 iSendBuffer.WritePointArrayL( EAlfDrawPolyLineNoEndPoint, &aPointList ); |
|
524 iDrawCommandCount++; |
|
525 } |
|
526 |
|
527 // --------------------------------------------------------------------------- |
|
528 // DrawPolyLineNoEndPoint |
|
529 // --------------------------------------------------------------------------- |
|
530 // |
|
531 void CAlfGraphicsContext::DrawPolyLineNoEndPoint(const CArrayFix<TPoint>* aPoWriteIntList) |
|
532 { |
|
533 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
534 FlushStateL( iRollback ); |
|
535 #endif |
|
536 iSendBuffer.WritePointArrayL( EAlfDrawPolyLineNoEndPoint, aPoWriteIntList ); |
|
537 iDrawCommandCount++; |
|
538 } |
|
539 |
|
540 // --------------------------------------------------------------------------- |
|
541 // DrawPolygon |
|
542 // Funnel all polygons into one. The ouput structure is the same in all of these |
|
543 // --------------------------------------------------------------------------- |
|
544 // |
|
545 void CAlfGraphicsContext::DrawPolygon( |
|
546 const CArrayFix<TPoint>* aPoWriteIntList, |
|
547 TFillRule aFillRule ) |
|
548 { |
|
549 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
550 FlushStateL( iRollback ); |
|
551 #endif |
|
552 iSendBuffer.WritePointArrayL( EAlfDrawPolygon, aPoWriteIntList ); |
|
553 iSendBuffer.WriteIntL( EAlfDrawPolygon, aFillRule ); |
|
554 iDrawCommandCount++; |
|
555 } |
|
556 |
|
557 // --------------------------------------------------------------------------- |
|
558 // DrawPolygon |
|
559 // --------------------------------------------------------------------------- |
|
560 // |
|
561 void CAlfGraphicsContext::DrawPolygon(const TArray<TPoint>& aPointList, TFillRule aFillRule) |
|
562 { |
|
563 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
564 FlushStateL( iRollback ); |
|
565 #endif |
|
566 iSendBuffer.WritePointArrayL( EAlfDrawPolygon, &aPointList ); |
|
567 iSendBuffer.WriteIntL( EAlfDrawPolygon, aFillRule ); |
|
568 iDrawCommandCount++; |
|
569 }; |
|
570 |
|
571 // --------------------------------------------------------------------------- |
|
572 // DrawPolygon |
|
573 // --------------------------------------------------------------------------- |
|
574 // |
|
575 void CAlfGraphicsContext::DrawPolygon( |
|
576 const TPoint *aPoWriteIntList, |
|
577 TInt aNumPoints, |
|
578 TFillRule aFillRule ) |
|
579 { |
|
580 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
581 FlushStateL( iRollback ); |
|
582 #endif |
|
583 iSendBuffer.WritePointArrayL( EAlfDrawPolygon, aPoWriteIntList, aNumPoints ); |
|
584 iSendBuffer.WriteIntL( EAlfDrawPolygon, aFillRule ); |
|
585 iDrawCommandCount++; |
|
586 } |
|
587 |
|
588 // --------------------------------------------------------------------------- |
|
589 // DrawEllipse |
|
590 // --------------------------------------------------------------------------- |
|
591 // |
|
592 void CAlfGraphicsContext::DrawEllipse(const TRect& aRect) |
|
593 { |
|
594 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
595 FlushStateL( iRollback ); |
|
596 #endif |
|
597 iSendBuffer.WriteIntsL( EAlfDrawEllipse, |
|
598 4, |
|
599 aRect.iTl.iX, |
|
600 aRect.iTl.iY, |
|
601 aRect.iBr.iX, |
|
602 aRect.iBr.iY ); |
|
603 iDrawCommandCount++; |
|
604 } |
|
605 |
|
606 // --------------------------------------------------------------------------- |
|
607 // DrawLine |
|
608 // --------------------------------------------------------------------------- |
|
609 // |
|
610 void CAlfGraphicsContext::DrawLine(const TPoint& aStart, const TPoint& aEnd) |
|
611 { |
|
612 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
613 FlushStateL( iRollback ); |
|
614 #endif |
|
615 iSendBuffer.WriteIntsL( EAlfDrawLine, |
|
616 4, |
|
617 aStart.iX, |
|
618 aStart.iY, |
|
619 aEnd.iX, |
|
620 aEnd.iY ); |
|
621 iDrawCommandCount++; |
|
622 } |
|
623 |
|
624 // --------------------------------------------------------------------------- |
|
625 // DrawLineTo |
|
626 // --------------------------------------------------------------------------- |
|
627 // |
|
628 void CAlfGraphicsContext::DrawLineTo(const TPoint& aPoint) |
|
629 { |
|
630 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
631 FlushStateL( iRollback ); |
|
632 #endif |
|
633 iSendBuffer.WriteIntsL( EAlfDrawLineTo, 2, aPoint.iX, aPoint.iY ); |
|
634 iDrawCommandCount++; |
|
635 |
|
636 } |
|
637 |
|
638 // --------------------------------------------------------------------------- |
|
639 // DrawLineBy |
|
640 // --------------------------------------------------------------------------- |
|
641 // |
|
642 void CAlfGraphicsContext::DrawLineBy(const TPoint& aVector) |
|
643 { |
|
644 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
645 FlushStateL( iRollback ); |
|
646 #endif |
|
647 iSendBuffer.WriteIntsL( EAlfDrawLineBy, 2, aVector.iX, aVector.iY ); |
|
648 iDrawCommandCount++; |
|
649 |
|
650 } |
|
651 |
|
652 // --------------------------------------------------------------------------- |
|
653 // DrawRect |
|
654 // --------------------------------------------------------------------------- |
|
655 // |
|
656 void CAlfGraphicsContext::DrawRect(const TRect& aRect) |
|
657 { |
|
658 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
659 FlushStateL( iRollback ); |
|
660 #endif |
|
661 iSendBuffer.WriteIntsL( EAlfDrawRect, |
|
662 4, |
|
663 aRect.iTl.iX, |
|
664 aRect.iTl.iY, |
|
665 aRect.iBr.iX, |
|
666 aRect.iBr.iY ); |
|
667 iDrawCommandCount++; |
|
668 } |
|
669 |
|
670 |
|
671 // --------------------------------------------------------------------------- |
|
672 // DrawText |
|
673 // --------------------------------------------------------------------------- |
|
674 // |
|
675 void CAlfGraphicsContext::DrawText(const TDesC& aText,const TTextParameters* aParam) |
|
676 { |
|
677 TInt tmp; |
|
678 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
679 FlushStateL( iRollback ); |
|
680 #endif |
|
681 iSendBuffer.WriteDescriptorAndIntsL( EAlfDrawText1, aText, |
|
682 (CGraphicsContext::TTextParameters*)aParam->iStart,0, tmp ); |
|
683 |
|
684 iDrawCommandCount++; |
|
685 } |
|
686 |
|
687 // --------------------------------------------------------------------------- |
|
688 // DrawText |
|
689 // --------------------------------------------------------------------------- |
|
690 // |
|
691 void CAlfGraphicsContext::DrawText( |
|
692 const TDesC& aText, |
|
693 const TTextParameters* aParam, |
|
694 const TPoint& aPosition ) |
|
695 { |
|
696 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
697 FlushStateL( iRollback ); |
|
698 #endif |
|
699 iSendBuffer.WriteDescriptorAndIntsL( EAlfDrawText2, aText, |
|
700 (CGraphicsContext::TTextParameters*)aParam, |
|
701 2, |
|
702 aPosition.iX, |
|
703 aPosition.iY ); |
|
704 iDrawCommandCount++; |
|
705 } |
|
706 |
|
707 // --------------------------------------------------------------------------- |
|
708 // DrawText |
|
709 // --------------------------------------------------------------------------- |
|
710 // |
|
711 void CAlfGraphicsContext::DrawText( |
|
712 const TDesC& aText, |
|
713 const TTextParameters* aParam, |
|
714 const TRect& aClipRect ) |
|
715 { |
|
716 #ifdef _OPTIMIZE_WS_COMMANDS_ADVANCED_ |
|
717 CheckDelayedClipping( aClipRect ); |
|
718 #endif |
|
719 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
720 FlushStateL( iRollback ); |
|
721 #endif |
|
722 iSendBuffer.WriteDescriptorAndIntsL( EAlfDrawText3, aText, |
|
723 (CGraphicsContext::TTextParameters*)aParam, |
|
724 4, |
|
725 aClipRect.iTl.iX, |
|
726 aClipRect.iTl.iY, |
|
727 aClipRect.iBr.iX, |
|
728 aClipRect.iBr.iY |
|
729 ); |
|
730 iDrawCommandCount++; |
|
731 } |
|
732 |
|
733 // --------------------------------------------------------------------------- |
|
734 // DrawText |
|
735 // --------------------------------------------------------------------------- |
|
736 // |
|
737 void CAlfGraphicsContext::DrawText( |
|
738 const TDesC& aText, |
|
739 const TTextParameters* aParam, |
|
740 const TRect& aClipFillRect, |
|
741 TInt aBaselineOffset, |
|
742 TTextAlign aHrz, |
|
743 TInt aMargin ) |
|
744 { |
|
745 #ifdef _OPTIMIZE_WS_COMMANDS_ADVANCED_ |
|
746 // This will result skipping the preceding clipping rect setting, if text is fully inside the clip |
|
747 CheckDelayedClipping( aClipFillRect ); |
|
748 #endif |
|
749 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
750 FlushStateL( iRollback ); |
|
751 #endif |
|
752 iSendBuffer.WriteDescriptorAndIntsL( EAlfDrawText4, aText, |
|
753 (CGraphicsContext::TTextParameters*)aParam, |
|
754 7, |
|
755 aClipFillRect.iTl.iX, |
|
756 aClipFillRect.iTl.iY, |
|
757 aClipFillRect.iBr.iX, |
|
758 aClipFillRect.iBr.iY, |
|
759 aBaselineOffset, |
|
760 aHrz, |
|
761 aMargin |
|
762 ); |
|
763 iDrawCommandCount++; |
|
764 } |
|
765 |
|
766 // --------------------------------------------------------------------------- |
|
767 // DrawTextVertical |
|
768 // --------------------------------------------------------------------------- |
|
769 // |
|
770 void CAlfGraphicsContext::DrawTextVertical( |
|
771 const TDesC& aText, |
|
772 const TTextParameters* aParam, |
|
773 TBool aUp ) |
|
774 { |
|
775 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
776 FlushStateL( iRollback ); |
|
777 #endif |
|
778 iSendBuffer.WriteDescriptorAndIntsL( EAlfDrawTextVertical1, aText, |
|
779 (CGraphicsContext::TTextParameters*)aParam, |
|
780 1, |
|
781 aUp |
|
782 ); |
|
783 iDrawCommandCount++; |
|
784 } |
|
785 |
|
786 // --------------------------------------------------------------------------- |
|
787 // DrawTextVertical |
|
788 // --------------------------------------------------------------------------- |
|
789 // |
|
790 void CAlfGraphicsContext::DrawTextVertical( |
|
791 const TDesC& aText, |
|
792 const TTextParameters* aParam, |
|
793 const TPoint& aPosition, |
|
794 TBool aUp ) |
|
795 { |
|
796 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
797 FlushStateL( iRollback ); |
|
798 #endif |
|
799 iSendBuffer.WriteDescriptorAndIntsL( EAlfDrawTextVertical2, aText, |
|
800 (CGraphicsContext::TTextParameters*)aParam, |
|
801 3, |
|
802 aPosition.iX, |
|
803 aPosition.iY, |
|
804 aUp); |
|
805 iDrawCommandCount++; |
|
806 } |
|
807 |
|
808 // --------------------------------------------------------------------------- |
|
809 // DrawTextVertical |
|
810 // --------------------------------------------------------------------------- |
|
811 // |
|
812 void CAlfGraphicsContext::DrawTextVertical( |
|
813 const TDesC& aText, |
|
814 const TTextParameters* aParam, |
|
815 const TRect& aClipRect, |
|
816 TBool aUp ) |
|
817 { |
|
818 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
819 FlushStateL( iRollback ); |
|
820 #endif |
|
821 iSendBuffer.WriteDescriptorAndIntsL( EAlfDrawTextVertical3, aText, |
|
822 (CGraphicsContext::TTextParameters*)aParam, |
|
823 5, |
|
824 aClipRect.iTl.iX, |
|
825 aClipRect.iTl.iY, |
|
826 aClipRect.iBr.iX, |
|
827 aClipRect.iBr.iY, |
|
828 aUp |
|
829 ); |
|
830 iDrawCommandCount++; |
|
831 } |
|
832 // --------------------------------------------------------------------------- |
|
833 // DrawTextVertical |
|
834 // --------------------------------------------------------------------------- |
|
835 // |
|
836 void CAlfGraphicsContext::DrawTextVertical( |
|
837 const TDesC& aText, |
|
838 const TTextParameters* aParam, |
|
839 const TRect& aClipRect, |
|
840 TInt aBaselineOffset, |
|
841 TBool aUp, |
|
842 TTextAlign aVert, |
|
843 TInt aMargin ) |
|
844 { |
|
845 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
846 FlushStateL( iRollback ); |
|
847 #endif |
|
848 iSendBuffer.WriteDescriptorAndIntsL( EAlfDrawTextVertical4, aText, |
|
849 (CGraphicsContext::TTextParameters*)aParam, |
|
850 8, |
|
851 aClipRect.iTl.iX, |
|
852 aClipRect.iTl.iY, |
|
853 aClipRect.iBr.iX, |
|
854 aClipRect.iBr.iY, |
|
855 aBaselineOffset, |
|
856 aUp, |
|
857 aVert, |
|
858 aMargin |
|
859 ); |
|
860 iDrawCommandCount++; |
|
861 } |
|
862 |
|
863 // --------------------------------------------------------------------------- |
|
864 // DrawTextVertical |
|
865 // --------------------------------------------------------------------------- |
|
866 // |
|
867 void CAlfGraphicsContext::DrawTextVertical( |
|
868 const TDesC& aText, |
|
869 const TTextParameters* aParam, |
|
870 const TRect& aClipRect, |
|
871 TInt aBaselineOffset, |
|
872 TInt aTextWidth, |
|
873 TBool aUp, |
|
874 TTextAlign aVert, |
|
875 TInt aMargin ) |
|
876 { |
|
877 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
878 FlushStateL( iRollback ); |
|
879 #endif |
|
880 iSendBuffer.WriteDescriptorAndIntsL( EAlfDrawTextVertical5, aText, |
|
881 (CGraphicsContext::TTextParameters*)aParam, |
|
882 9, |
|
883 aClipRect.iTl.iX, |
|
884 aClipRect.iTl.iY, |
|
885 aClipRect.iBr.iX, |
|
886 aClipRect.iBr.iY, |
|
887 aBaselineOffset, |
|
888 aTextWidth, |
|
889 aUp, |
|
890 aVert, |
|
891 aMargin |
|
892 ); |
|
893 iDrawCommandCount++; |
|
894 } |
|
895 |
|
896 // --------------------------------------------------------------------------- |
|
897 // MoveTo |
|
898 // --------------------------------------------------------------------------- |
|
899 // |
|
900 void CAlfGraphicsContext::MoveTo(const TPoint& aPoint) |
|
901 { |
|
902 iSendBuffer.WriteIntsL( EAlfMoveTo, 2, aPoint.iX, aPoint.iY ); |
|
903 } |
|
904 |
|
905 // --------------------------------------------------------------------------- |
|
906 // MoveBy |
|
907 // --------------------------------------------------------------------------- |
|
908 // |
|
909 void CAlfGraphicsContext::MoveBy(const TPoint& aVector) |
|
910 { |
|
911 iSendBuffer.WriteIntsL( EAlfMoveBy, 2, aVector.iX, aVector.iY ); |
|
912 } |
|
913 |
|
914 // --------------------------------------------------------------------------- |
|
915 // Plot |
|
916 // --------------------------------------------------------------------------- |
|
917 // |
|
918 void CAlfGraphicsContext::Plot(const TPoint& aPoint) |
|
919 { |
|
920 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
921 FlushStateL( iRollback ); |
|
922 #endif |
|
923 iSendBuffer.WriteIntsL( EAlfPlot, 2, aPoint.iX, aPoint.iY ); |
|
924 iDrawCommandCount++; |
|
925 } |
|
926 |
|
927 // --------------------------------------------------------------------------- |
|
928 // Reset |
|
929 // --------------------------------------------------------------------------- |
|
930 // |
|
931 void CAlfGraphicsContext::Reset() |
|
932 { |
|
933 // filter away sequential reset commands |
|
934 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
935 if ( iSendBuffer.PreviousCommand() == EAlfReset ) |
|
936 { |
|
937 return; |
|
938 } |
|
939 #endif |
|
940 DoReset(); |
|
941 iSendBuffer.WriteCommandL( EAlfReset ); |
|
942 } |
|
943 |
|
944 // --------------------------------------------------------------------------- |
|
945 // DoReset |
|
946 // --------------------------------------------------------------------------- |
|
947 // |
|
948 void CAlfGraphicsContext::DoReset() |
|
949 { |
|
950 iFontHandle = 0; |
|
951 iOrigin = KHuiWsDefaultOrigin; |
|
952 iClippingRegion.Clear(); |
|
953 |
|
954 iClippingRect = KHuiWsDefaultUserClipRect; |
|
955 iTextShadowColor = KHuiWsDefaultShadowColor; |
|
956 iBrushPatternSet = EFalse; |
|
957 iPenColor = KHuiWsDefaultPenColor; |
|
958 // SetPenColor( KHuiWsDefaultPenColor ); |
|
959 iPenSize = KHuiWsDefaultPenSize; |
|
960 iDrawMode = KHuiWsDefaultDrawMode; |
|
961 iLinePosition = KHuiWsDefaultLinePosition; |
|
962 |
|
963 |
|
964 iBrushOrigin = KHuiWsDefaultBrushOrigin; |
|
965 iCharJustExcess = KHuiWsDefaultCharJustExcess; |
|
966 iCharJustNum = KHuiWsDefaultCharJustNum; |
|
967 iWordJustExcess = KHuiWsDefaultWordJustExcess; |
|
968 iWordJustNum = KHuiWsDefaultWordJustNum; |
|
969 iDitherOrigin = KHuiWsDefaultDitherOrigin; |
|
970 iDotLength = KHuiWsDefaultDotLength; |
|
971 iDotMask = KHuiWsDefaultDotMask; |
|
972 iDotParam = KHuiWsDefaultDotParam; |
|
973 iDotDirection = KHuiWsDefaultDotDirection; |
|
974 iShadowMode = KHuiWsDefaultShadowMode; |
|
975 iStrikethrough = KHuiWsDefaultStrikethrough; |
|
976 iUnderline = KHuiWsDefaultUnderline; |
|
977 iUserDisplayMode = KHuiWsDefaultUserDisplayMode; |
|
978 iPenStyle = KHuiWsDefaultPenStyle; |
|
979 //SetPenColor( KHuiWsDefaultPenStyle ); |
|
980 |
|
981 |
|
982 #ifdef _OPTIMIZE_WS_COMMANDS_ADVANCED_ |
|
983 iPreviousClippingRegion.Clear(); |
|
984 iPreviousFontHandle = 0; |
|
985 #endif |
|
986 |
|
987 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
988 iDelayedContextState = 0; |
|
989 |
|
990 |
|
991 iPreviousPenStyle = KHuiWsDefaultPenStyle; |
|
992 iPreviousPenColor = KHuiWsDefaultPenColor; |
|
993 |
|
994 iPreviousBrushStyle = KHuiWsDefaultBrushStyle; |
|
995 iPreviousBrushColor = KHuiWsDefaultBrushColor; |
|
996 |
|
997 |
|
998 SetBrushStyle( ENullBrush ); // KHuiWsDefaultBrushStyle |
|
999 SetBrushColor( KHuiWsDefaultBrushColor ); |
|
1000 #else |
|
1001 iBrushColor = KHuiWsDefaultBrushColor; |
|
1002 iBrushStyle = KHuiWsDefaultBrushStyle; |
|
1003 |
|
1004 |
|
1005 #endif |
|
1006 } |
|
1007 |
|
1008 // --------------------------------------------------------------------------- |
|
1009 // SetBrushColor |
|
1010 // --------------------------------------------------------------------------- |
|
1011 // |
|
1012 void CAlfGraphicsContext::SetBrushColor(const TRgb& aColor) |
|
1013 { |
|
1014 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1015 if (aColor == iBrushColor) |
|
1016 return; |
|
1017 #endif |
|
1018 iBrushColor = aColor; |
|
1019 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1020 iDelayedContextState |= EModifiedBrushColor; |
|
1021 #else |
|
1022 iSendBuffer.WriteIntsL( EAlfSetBrushColor, 1, aColor.Internal()); |
|
1023 #endif |
|
1024 } |
|
1025 |
|
1026 // --------------------------------------------------------------------------- |
|
1027 // SetBrushOrigin |
|
1028 // --------------------------------------------------------------------------- |
|
1029 // |
|
1030 void CAlfGraphicsContext::SetBrushOrigin(const TPoint& aOrigin) |
|
1031 { |
|
1032 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1033 if (aOrigin == iBrushOrigin) |
|
1034 return; |
|
1035 #endif |
|
1036 iBrushOrigin = aOrigin; |
|
1037 iSendBuffer.WriteIntsL( EAlfSetBrushOrigin, 2, aOrigin.iX, aOrigin.iY ); |
|
1038 } |
|
1039 |
|
1040 // --------------------------------------------------------------------------- |
|
1041 // SetBrushStyle |
|
1042 // calls SetBrushStyle(MWsGraphicsContextToBitGdiMappings::Convert( |
|
1043 // (MWsGraphicsContext::TBrushStyle)value)) |
|
1044 // --------------------------------------------------------------------------- |
|
1045 // |
|
1046 void CAlfGraphicsContext::SetBrushStyle(TBrushStyle aBrushStyle) |
|
1047 { |
|
1048 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1049 if (aBrushStyle == iBrushStyle) |
|
1050 return; |
|
1051 #endif |
|
1052 iBrushStyle = aBrushStyle; |
|
1053 |
|
1054 if ( aBrushStyle == ENullBrush || aBrushStyle == ESolidBrush || aBrushStyle == EPatternedBrush) |
|
1055 { |
|
1056 // this is supported only by bitgdi |
|
1057 iSendBuffer.SetSupportedCommand( EAlfSetBrushStyle, 0 ); // All renderer support this |
|
1058 } |
|
1059 else |
|
1060 { |
|
1061 // 63 = binary 0b0111111, not supported by any renderer |
|
1062 iSendBuffer.SetSupportedCommand( EAlfSetBrushStyle, KNoSupportInAnyRenderer ); |
|
1063 } |
|
1064 |
|
1065 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1066 iDelayedContextState |= EModifiedBrushStyle; |
|
1067 #else |
|
1068 iSendBuffer.WriteIntL( EAlfSetBrushStyle, aBrushStyle ); |
|
1069 #endif |
|
1070 } |
|
1071 |
|
1072 // --------------------------------------------------------------------------- |
|
1073 // SetClippingRegion |
|
1074 // --------------------------------------------------------------------------- |
|
1075 // |
|
1076 void CAlfGraphicsContext::SetClippingRegion(const TRegion& aRegion) |
|
1077 { |
|
1078 iClippingRegion.Copy( aRegion ); |
|
1079 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1080 iDelayedContextState |= EModifiedClipRect; |
|
1081 iDelayedContextState &= ~EModifiedClipReset; |
|
1082 #else |
|
1083 iSendBuffer.WriteRegionL( EAlfSetClippingRegion, aRegion ); |
|
1084 #endif |
|
1085 } |
|
1086 |
|
1087 // --------------------------------------------------------------------------- |
|
1088 // SetDrawMode |
|
1089 // calls SetDrawMode(MWsGraphicsContextToBitGdiMappings::LossyConvert( |
|
1090 // (MWsGraphicsContext::TDrawMode)value)) |
|
1091 // --------------------------------------------------------------------------- |
|
1092 // |
|
1093 void CAlfGraphicsContext::SetDrawMode(TDrawMode aDrawMode) |
|
1094 { |
|
1095 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1096 if (aDrawMode == iDrawMode) |
|
1097 return; |
|
1098 #endif |
|
1099 iDrawMode = aDrawMode; |
|
1100 iSendBuffer.WriteIntL( EAlfSetDrawMode, aDrawMode); |
|
1101 } |
|
1102 |
|
1103 // --------------------------------------------------------------------------- |
|
1104 // SetOrigin |
|
1105 // --------------------------------------------------------------------------- |
|
1106 // |
|
1107 void CAlfGraphicsContext::SetOrigin(const TPoint& aPoint) |
|
1108 { |
|
1109 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1110 if (iOrigin == aPoint) |
|
1111 return; |
|
1112 #endif |
|
1113 iOrigin = aPoint; |
|
1114 iSendBuffer.WriteIntsL( EAlfSetOrigin, 2, aPoint.iX, aPoint.iY); |
|
1115 } |
|
1116 |
|
1117 // --------------------------------------------------------------------------- |
|
1118 // SetPenColor |
|
1119 // @todo Init to KRgbBlack |
|
1120 // --------------------------------------------------------------------------- |
|
1121 // |
|
1122 void CAlfGraphicsContext::SetPenColor(const TRgb& aColor) |
|
1123 { |
|
1124 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1125 if (aColor == iPenColor) |
|
1126 return; |
|
1127 #endif |
|
1128 iPenColor = aColor; |
|
1129 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1130 iDelayedContextState |= EModifiedPenColor; |
|
1131 #else |
|
1132 iSendBuffer.WriteIntsL( EAlfSetPenColor, 1, aColor.Internal()); |
|
1133 #endif |
|
1134 } |
|
1135 |
|
1136 // --------------------------------------------------------------------------- |
|
1137 // SetPenStyle |
|
1138 // --------------------------------------------------------------------------- |
|
1139 // |
|
1140 void CAlfGraphicsContext::SetPenStyle(TPenStyle aPenStyle) |
|
1141 { |
|
1142 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1143 if (aPenStyle == iPenStyle) |
|
1144 return; |
|
1145 #endif |
|
1146 iPenStyle = aPenStyle; |
|
1147 |
|
1148 if ( aPenStyle == ENullPen || aPenStyle == ESolidPen) |
|
1149 { |
|
1150 // this is supported only by bitgdi |
|
1151 iSendBuffer.SetSupportedCommand( EAlfSetPenStyle, 0 ); // All renderer support this |
|
1152 } |
|
1153 else |
|
1154 { |
|
1155 // 63 = binary 0b0111111, not supported by any renderer |
|
1156 iSendBuffer.SetSupportedCommand( EAlfSetPenStyle, KNoSupportInAnyRenderer ); |
|
1157 } |
|
1158 |
|
1159 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1160 iDelayedContextState |= EModifiedPenStyle; |
|
1161 #else |
|
1162 iSendBuffer.WriteIntL( EAlfSetPenStyle, aPenStyle ); |
|
1163 #endif |
|
1164 } |
|
1165 |
|
1166 // --------------------------------------------------------------------------- |
|
1167 // SetPenSize |
|
1168 // --------------------------------------------------------------------------- |
|
1169 // |
|
1170 void CAlfGraphicsContext::SetPenSize(const TSize& aSize) |
|
1171 { |
|
1172 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1173 if (aSize == iPenSize) |
|
1174 return; |
|
1175 #endif |
|
1176 if ( aSize.iWidth == aSize.iHeight ) |
|
1177 { |
|
1178 // this is supported only by bitgdi |
|
1179 iSendBuffer.SetSupportedCommand( EAlfSetPenSize, 0 ); // All renderer support this |
|
1180 } |
|
1181 else |
|
1182 { |
|
1183 // 63 = binary 0b0111111, not supported by any renderer |
|
1184 iSendBuffer.SetSupportedCommand( EAlfSetPenSize, KNoSupportInAnyRenderer ); |
|
1185 } |
|
1186 iPenSize = aSize; |
|
1187 iSendBuffer.WriteIntsL( EAlfSetPenSize, 2, aSize.iWidth, aSize.iHeight ); |
|
1188 } |
|
1189 |
|
1190 // --------------------------------------------------------------------------- |
|
1191 // SetTextShadowColor |
|
1192 // call to SetShadowColor |
|
1193 // --------------------------------------------------------------------------- |
|
1194 // |
|
1195 void CAlfGraphicsContext::SetTextShadowColor(const TRgb& aColor) |
|
1196 { |
|
1197 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1198 if (iTextShadowColor == aColor) |
|
1199 return; |
|
1200 #endif |
|
1201 iTextShadowColor = aColor; |
|
1202 iSendBuffer.WriteIntsL( EAlfSetTextShadowColor, 1 , aColor.Internal()); |
|
1203 } |
|
1204 |
|
1205 // --------------------------------------------------------------------------- |
|
1206 // SetCharJustification |
|
1207 // --------------------------------------------------------------------------- |
|
1208 // |
|
1209 void CAlfGraphicsContext::SetCharJustification(TInt aExcessWidth, TInt aNumChars) |
|
1210 { |
|
1211 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1212 if (aExcessWidth == iCharJustExcess && aNumChars == iCharJustNum) |
|
1213 return; |
|
1214 #endif |
|
1215 iCharJustExcess = aExcessWidth; |
|
1216 iCharJustNum = aNumChars; |
|
1217 iSendBuffer.WriteIntsL( EAlfSetCharJustification, 2, aExcessWidth, aNumChars ); |
|
1218 } |
|
1219 |
|
1220 // --------------------------------------------------------------------------- |
|
1221 // SetWordJustification |
|
1222 // --------------------------------------------------------------------------- |
|
1223 // |
|
1224 void CAlfGraphicsContext::SetWordJustification(TInt aExcessWidth, TInt aNumGaps) |
|
1225 { |
|
1226 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1227 if (aExcessWidth == iWordJustExcess && aNumGaps == iWordJustNum) |
|
1228 return; |
|
1229 #endif |
|
1230 iWordJustExcess = aExcessWidth; |
|
1231 iWordJustNum = aNumGaps; |
|
1232 iSendBuffer.WriteIntsL( EAlfSetCharJustification, 2, aExcessWidth, aNumGaps ); |
|
1233 } |
|
1234 |
|
1235 // --------------------------------------------------------------------------- |
|
1236 // SetUnderlineStyle |
|
1237 // SetUnderlineStyle(MWsGraphicsContextToBitGdiMappings::Convert( |
|
1238 // (MWsGraphicsContext::TFontUnderline)value)) |
|
1239 // --------------------------------------------------------------------------- |
|
1240 // |
|
1241 void CAlfGraphicsContext::SetUnderlineStyle(TFontUnderline aUnderlineStyle) |
|
1242 { |
|
1243 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1244 if (aUnderlineStyle == iUnderline) |
|
1245 return; |
|
1246 #endif |
|
1247 iUnderline = aUnderlineStyle; |
|
1248 iSendBuffer.WriteIntsL( EAlfSetUnderlineStyle, 1, aUnderlineStyle ); |
|
1249 } |
|
1250 |
|
1251 // --------------------------------------------------------------------------- |
|
1252 // SetStrikethroughStyle |
|
1253 // calls SetStrikethroughStyle(MWsGraphicsContextToBitGdiMappings::Convert( |
|
1254 // (MWsGraphicsContext::TFontStrikethrough)value)); |
|
1255 // --------------------------------------------------------------------------- |
|
1256 // |
|
1257 void CAlfGraphicsContext::SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle) |
|
1258 { |
|
1259 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1260 if (aStrikethroughStyle == iStrikethrough) |
|
1261 return; |
|
1262 #endif |
|
1263 iStrikethrough = aStrikethroughStyle; |
|
1264 iSendBuffer.WriteIntsL( EAlfSetStrikethroughStyle, 1, aStrikethroughStyle ); |
|
1265 } |
|
1266 |
|
1267 // --------------------------------------------------------------------------- |
|
1268 // SetBrushPattern |
|
1269 // --------------------------------------------------------------------------- |
|
1270 // |
|
1271 void CAlfGraphicsContext::SetBrushPattern(const CFbsBitmap& aBitmap) |
|
1272 { |
|
1273 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1274 if ( iBrushPattern == iPreviousBrushPattern ) |
|
1275 { |
|
1276 return; |
|
1277 } |
|
1278 #endif |
|
1279 iBrushPatternSet = ETrue; |
|
1280 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1281 iDelayedContextState |= EModifiedBrushPattern1; |
|
1282 iBrushPattern = aBitmap.Handle(); |
|
1283 #else |
|
1284 iSendBuffer.WriteIntsL( EAlfSetBrushPattern, 1, aBitmap.Handle() ); |
|
1285 #endif |
|
1286 } |
|
1287 |
|
1288 // --------------------------------------------------------------------------- |
|
1289 // SetBrushPattern |
|
1290 // --------------------------------------------------------------------------- |
|
1291 // |
|
1292 void CAlfGraphicsContext::SetBrushPattern(TInt aFbsBitmapHandle) |
|
1293 { |
|
1294 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1295 if ( iBrushPattern == iPreviousBrushPattern ) |
|
1296 { |
|
1297 return; |
|
1298 } |
|
1299 #endif |
|
1300 iBrushPatternSet = ETrue; |
|
1301 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1302 iDelayedContextState |= EModifiedBrushPattern2; |
|
1303 iBrushPattern = aFbsBitmapHandle; |
|
1304 #else |
|
1305 iSendBuffer.WriteIntsL( EAlfSetBrushPattern, 1, aFbsBitmapHandle ); |
|
1306 #endif |
|
1307 } |
|
1308 |
|
1309 // --------------------------------------------------------------------------- |
|
1310 // SetFont |
|
1311 // calls UseFont |
|
1312 // --------------------------------------------------------------------------- |
|
1313 // |
|
1314 void CAlfGraphicsContext::SetFont( const CFont* aFont) |
|
1315 { |
|
1316 const CFbsFont* font = static_cast<const CFbsFont*>(aFont); |
|
1317 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1318 if (iFontHandle == font->Handle()) |
|
1319 return; |
|
1320 #endif |
|
1321 iFontHandle = font->Handle(); |
|
1322 |
|
1323 #ifdef _OPTIMIZE_WS_COMMANDS_FONT_ |
|
1324 iDelayedContextState &= ~EModifiedResetFont; |
|
1325 iDelayedContextState |= EModifiedSetFontNoDuplicate; |
|
1326 #else |
|
1327 iSendBuffer.WriteIntsL( EAlfSetFont, 1, font->Handle() ); |
|
1328 #endif |
|
1329 } |
|
1330 |
|
1331 // --------------------------------------------------------------------------- |
|
1332 // CopyRect |
|
1333 // --------------------------------------------------------------------------- |
|
1334 // |
|
1335 void CAlfGraphicsContext::CopyRect( |
|
1336 const TPoint& aOffset, |
|
1337 const TRect& aRect ) |
|
1338 { |
|
1339 iSendBuffer.WriteIntsL( EAlfCopyRect, 6, |
|
1340 aOffset.iX, |
|
1341 aOffset.iY, |
|
1342 aRect.iTl.iX, |
|
1343 aRect.iTl.iY, |
|
1344 aRect.iBr.iX, |
|
1345 aRect.iBr.iY ); |
|
1346 } |
|
1347 |
|
1348 // --------------------------------------------------------------------------- |
|
1349 // UpdateJustification |
|
1350 // --------------------------------------------------------------------------- |
|
1351 // |
|
1352 void CAlfGraphicsContext::UpdateJustification( |
|
1353 const TDesC& aText, |
|
1354 const TTextParameters* aParam) |
|
1355 { |
|
1356 // Temp is not written to the stream, because 0 parameter is given to WriteDescriptorAndIntsL as TInt count. |
|
1357 // This is simply to avoid creating yet another WriteDescriptorL method. |
|
1358 TInt notUsed; |
|
1359 iSendBuffer.WriteDescriptorAndIntsL( EAlfUpdateJustification, aText, (CGraphicsContext::TTextParameters*)aParam, 0, notUsed ); |
|
1360 } |
|
1361 |
|
1362 // --------------------------------------------------------------------------- |
|
1363 // UpdateJustificationVertical |
|
1364 // --------------------------------------------------------------------------- |
|
1365 // |
|
1366 void CAlfGraphicsContext::UpdateJustificationVertical( |
|
1367 const TDesC& aText, |
|
1368 const TTextParameters* aParam, |
|
1369 TBool aUp ) |
|
1370 { |
|
1371 iSendBuffer.WriteDescriptorAndIntsL( EAlfUpdateJustificationVertical, aText, (CGraphicsContext::TTextParameters*)aParam, 1, aUp ); |
|
1372 } |
|
1373 |
|
1374 // --------------------------------------------------------------------------- |
|
1375 // SetFontNoDuplicate |
|
1376 // --------------------------------------------------------------------------- |
|
1377 // |
|
1378 void CAlfGraphicsContext::SetFontNoDuplicate(const CFont* aFont) |
|
1379 { |
|
1380 const CFbsFont* font = static_cast<const CFbsFont*>(aFont); |
|
1381 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1382 if (iFontHandle == font->Handle()) |
|
1383 return; |
|
1384 #endif |
|
1385 iFontHandle = font->Handle(); |
|
1386 |
|
1387 #ifdef _OPTIMIZE_WS_COMMANDS_FONT_ |
|
1388 iDelayedContextState &= ~EModifiedResetFont; |
|
1389 iDelayedContextState |= EModifiedSetFontNoDuplicate; |
|
1390 #else |
|
1391 iSendBuffer.WriteIntsL( EAlfSetFontNoDuplicate, 1, font->Handle() ); |
|
1392 #endif |
|
1393 |
|
1394 } |
|
1395 |
|
1396 // --------------------------------------------------------------------------- |
|
1397 // HasBrushPattern |
|
1398 // --------------------------------------------------------------------------- |
|
1399 // |
|
1400 TBool CAlfGraphicsContext::HasBrushPattern() const |
|
1401 { |
|
1402 return iBrushPatternSet; |
|
1403 } |
|
1404 |
|
1405 // --------------------------------------------------------------------------- |
|
1406 // HasFont |
|
1407 // --------------------------------------------------------------------------- |
|
1408 // |
|
1409 TBool CAlfGraphicsContext::HasFont() const |
|
1410 { |
|
1411 return iFontHandle; |
|
1412 } |
|
1413 |
|
1414 // --------------------------------------------------------------------------- |
|
1415 // InternalizeL |
|
1416 // --------------------------------------------------------------------------- |
|
1417 // |
|
1418 void CAlfGraphicsContext::InternalizeL(RReadStream& /*aReadStream*/) |
|
1419 { |
|
1420 //iContext->InternalizeL(aReadStream); |
|
1421 } |
|
1422 |
|
1423 // --------------------------------------------------------------------------- |
|
1424 // ExternalizeL |
|
1425 // --------------------------------------------------------------------------- |
|
1426 // |
|
1427 void CAlfGraphicsContext::ExternalizeL(RWriteStream& /*aWriteStream*/) |
|
1428 { |
|
1429 //iContext->ExternalizeL(aWriteStream); |
|
1430 } |
|
1431 |
|
1432 // --------------------------------------------------------------------------- |
|
1433 // BrushColor |
|
1434 // --------------------------------------------------------------------------- |
|
1435 // |
|
1436 TRgb CAlfGraphicsContext::BrushColor() const |
|
1437 { |
|
1438 return iBrushColor; |
|
1439 } |
|
1440 |
|
1441 // --------------------------------------------------------------------------- |
|
1442 // PenColor |
|
1443 // --------------------------------------------------------------------------- |
|
1444 // |
|
1445 TRgb CAlfGraphicsContext::PenColor() const |
|
1446 { |
|
1447 return iPenColor; |
|
1448 } |
|
1449 |
|
1450 // --------------------------------------------------------------------------- |
|
1451 // TextShadowColor |
|
1452 // --------------------------------------------------------------------------- |
|
1453 // |
|
1454 TRgb CAlfGraphicsContext::TextShadowColor() const |
|
1455 { |
|
1456 return iTextShadowColor; |
|
1457 } |
|
1458 |
|
1459 // --------------------------------------------------------------------------- |
|
1460 // CopySettings |
|
1461 // Copies all settings from the specified bitmap graphics context. |
|
1462 // const CFbsBitGc &aGc The bitmap graphics context whose settings are to be copied. |
|
1463 // --------------------------------------------------------------------------- |
|
1464 // |
|
1465 void CAlfGraphicsContext::CopySettings(const MWsGraphicsContext& /*aGc*/) |
|
1466 { |
|
1467 // NOP |
|
1468 } |
|
1469 |
|
1470 // --------------------------------------------------------------------------- |
|
1471 // SetFaded |
|
1472 // --------------------------------------------------------------------------- |
|
1473 // |
|
1474 void CAlfGraphicsContext::SetFaded(TBool /*aFaded*/) |
|
1475 { |
|
1476 } |
|
1477 |
|
1478 // --------------------------------------------------------------------------- |
|
1479 // SetFadingParameters |
|
1480 // --------------------------------------------------------------------------- |
|
1481 // |
|
1482 void CAlfGraphicsContext::SetFadingParameters(TUint8 /*aBlackMap*/, TUint8 /*aWhiteMap*/) |
|
1483 { |
|
1484 } |
|
1485 |
|
1486 // --------------------------------------------------------------------------- |
|
1487 // FadeArea |
|
1488 // --------------------------------------------------------------------------- |
|
1489 // |
|
1490 void CAlfGraphicsContext::FadeArea(const TRegion* /*aRegion*/ ) |
|
1491 { |
|
1492 } |
|
1493 |
|
1494 // --------------------------------------------------------------------------- |
|
1495 // This is not implemented by hitchcock |
|
1496 // --------------------------------------------------------------------------- |
|
1497 // |
|
1498 void CAlfGraphicsContext::MapColors( |
|
1499 const TRect &/*aRect*/, |
|
1500 const TRgb */*aColors*/, |
|
1501 TInt /*aNumPairs*/, |
|
1502 TBool /*aMapForwards*/) |
|
1503 { |
|
1504 } |
|
1505 |
|
1506 // --------------------------------------------------------------------------- |
|
1507 // SetUserDisplayMode |
|
1508 // --------------------------------------------------------------------------- |
|
1509 // |
|
1510 void CAlfGraphicsContext::SetUserDisplayMode(TDisplayMode aDisplayMode) |
|
1511 { |
|
1512 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1513 if (aDisplayMode == iUserDisplayMode) |
|
1514 return; |
|
1515 #endif |
|
1516 iUserDisplayMode = aDisplayMode; |
|
1517 iSendBuffer.WriteIntsL( EAlfSetUserDisplayMode, 1, aDisplayMode ); |
|
1518 } |
|
1519 |
|
1520 // --------------------------------------------------------------------------- |
|
1521 // UseFont |
|
1522 // hes value locally |
|
1523 // @todo Check Symbian reference imnplementation for return value |
|
1524 // --------------------------------------------------------------------------- |
|
1525 // |
|
1526 TInt CAlfGraphicsContext::UseFont(TInt aFontHandle) |
|
1527 { |
|
1528 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1529 if (iFontHandle == aFontHandle) |
|
1530 return KErrNone; |
|
1531 #endif |
|
1532 iFontHandle = aFontHandle; |
|
1533 iSendBuffer.WriteIntsL( EAlfUseFont, 1, aFontHandle ); |
|
1534 // TODO: DANGER!! What should this in REALITY return? |
|
1535 return KErrNone; |
|
1536 } |
|
1537 |
|
1538 // --------------------------------------------------------------------------- |
|
1539 // Origin |
|
1540 // --------------------------------------------------------------------------- |
|
1541 // |
|
1542 TPoint CAlfGraphicsContext::Origin() const |
|
1543 { |
|
1544 return iOrigin; |
|
1545 } |
|
1546 |
|
1547 #ifdef _OPTIMIZE_WS_COMMANDS_ADVANCED_ |
|
1548 // --------------------------------------------------------------------------- |
|
1549 // CheckDelayedClipping |
|
1550 // --------------------------------------------------------------------------- |
|
1551 // |
|
1552 TBool CAlfGraphicsContext::CheckDelayedClipping( TRect aDrawRect ) |
|
1553 { |
|
1554 iDelayedClippingRegion.Copy( iClippingRegion ); |
|
1555 aDrawRect.Move( iOrigin ); |
|
1556 iDelayedDrawRegion.Clear(); |
|
1557 iDelayedDrawRegion.AddRect( aDrawRect ); |
|
1558 iDelayedDrawRegion.Intersect( iDelayedClippingRegion ); |
|
1559 |
|
1560 if ( iDelayedContextState & EModifiedClipRect |
|
1561 && iDelayedDrawRegion.Count() == 1 && iDelayedDrawRegion[0] == aDrawRect ) |
|
1562 { |
|
1563 iDelayedContextState &= ~EModifiedClipRect; |
|
1564 iRollback |= ERollbackClippingState; |
|
1565 return ETrue; |
|
1566 } |
|
1567 |
|
1568 if ( iDelayedDrawRegion.IsEmpty() && iClippingRegion.Count() ) |
|
1569 { |
|
1570 return EFalse; |
|
1571 } |
|
1572 return ETrue; |
|
1573 } |
|
1574 #endif |
|
1575 |
|
1576 // --------------------------------------------------------------------------- |
|
1577 // FlushStateL |
|
1578 // --------------------------------------------------------------------------- |
|
1579 // |
|
1580 #ifdef _OPTIMIZE_WS_COMMANDS_BASIC_ |
|
1581 void CAlfGraphicsContext::FlushStateL( TInt& aRollbackClippingState ) |
|
1582 { |
|
1583 /// Pen |
|
1584 if ( iDelayedContextState & EModifiedPenStyle |
|
1585 && iPenStyle != iPreviousPenStyle ) |
|
1586 { |
|
1587 iSendBuffer.WriteIntL( EAlfSetPenStyle, iPenStyle ); |
|
1588 iPreviousPenStyle = iPenStyle; |
|
1589 } |
|
1590 if ( iDelayedContextState & EModifiedPenColor |
|
1591 && iPenColor != iPreviousPenColor ) |
|
1592 { |
|
1593 iSendBuffer.WriteIntsL( EAlfSetPenColor, 1, iPenColor.Internal()); |
|
1594 iPreviousPenColor = iPenColor; |
|
1595 } |
|
1596 |
|
1597 // Brush - Brush style must be set before any other brush related settings. |
|
1598 if ( iDelayedContextState & EModifiedBrushStyle |
|
1599 && iBrushStyle != iPreviousBrushStyle ) |
|
1600 { |
|
1601 iSendBuffer.WriteIntL( EAlfSetBrushStyle, iBrushStyle ); |
|
1602 iPreviousBrushStyle = iBrushStyle; |
|
1603 } |
|
1604 |
|
1605 if ( iDelayedContextState & EModifiedBrushPattern1 |
|
1606 && iBrushStyle != iPreviousBrushStyle ) |
|
1607 { |
|
1608 iSendBuffer.WriteIntL( EAlfSetBrushPattern, iBrushPattern ); |
|
1609 iPreviousBrushPattern = iBrushPattern; |
|
1610 } |
|
1611 |
|
1612 if ( iDelayedContextState & EModifiedBrushPattern2 |
|
1613 && iBrushStyle != iPreviousBrushStyle ) |
|
1614 { |
|
1615 iSendBuffer.WriteIntL( EAlfSetBrushPattern2, iBrushPattern ); |
|
1616 iPreviousBrushPattern = iBrushPattern; |
|
1617 } |
|
1618 |
|
1619 if ( iDelayedContextState & EModifiedBrushColor |
|
1620 && iBrushColor != iPreviousBrushColor ) |
|
1621 { |
|
1622 iSendBuffer.WriteIntsL( EAlfSetBrushColor, 1, iBrushColor.Internal()); |
|
1623 iPreviousBrushColor = iBrushColor; |
|
1624 } |
|
1625 #ifdef _OPTIMIZE_WS_COMMANDS_ADVANCED_ |
|
1626 // Clipping rect |
|
1627 if ( iDelayedContextState & EModifiedClipRect |
|
1628 && !( iPreviousClippingRegion.Count() == 1 && iClippingRegion.Count() == 1 |
|
1629 && iPreviousClippingRegion[0] == iClippingRegion[0] )) |
|
1630 { |
|
1631 iSendBuffer.WriteRegionL( EAlfSetClippingRegion, iClippingRegion ); |
|
1632 iPreviousClippingRegion.Copy( iClippingRegion ); |
|
1633 } |
|
1634 if ( iDelayedContextState & EModifiedClipReset ) |
|
1635 { |
|
1636 iSendBuffer.WriteCommandL( EAlfResetClippingRegion ); |
|
1637 } |
|
1638 #endif |
|
1639 #ifdef _OPTIMIZE_WS_COMMANDS_FONT_ |
|
1640 // font |
|
1641 if ( iDelayedContextState & EModifiedSetFontNoDuplicate |
|
1642 && iFontHandle != iPreviousFontHandle ) |
|
1643 { |
|
1644 iSendBuffer.WriteIntsL( EAlfSetFontNoDuplicate, 1, iFontHandle ); |
|
1645 iPreviousFontHandle = iFontHandle; |
|
1646 } |
|
1647 if ( iDelayedContextState & EModifiedResetFont ) |
|
1648 { |
|
1649 iSendBuffer.WriteCommandL( EAlfResetFont ); |
|
1650 } |
|
1651 #endif |
|
1652 iDelayedContextState = 0; |
|
1653 |
|
1654 #ifdef _OPTIMIZE_WS_COMMANDS_ADVANCED_ |
|
1655 if ( aRollbackClippingState & ERollbackClippingState ) |
|
1656 { |
|
1657 iDelayedContextState |= EModifiedClipRect; |
|
1658 aRollbackClippingState &= ~ERollbackClippingState; |
|
1659 } |
|
1660 #endif |
|
1661 } |
|
1662 #endif |