|
1 /* |
|
2 * Copyright (c) 2009 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: Recording graphics context used to cache drawing commands |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <bitdev.h> |
|
21 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
22 #include <graphics/gdi/gdiconsts.h> |
|
23 #include <graphics/gdi/gdistructs.h> |
|
24 #endif // SYMBIAN_ENABLE_SPLIT_HEADERS |
|
25 #include <e32err.h> |
|
26 |
|
27 #include "aknrecordinggc.h" |
|
28 |
|
29 #ifdef _DEBUG |
|
30 _LIT( KOverFlow, "Array overflow" ); |
|
31 _LIT( KBadArgument, "Bad argument"); |
|
32 #endif // _DEBUG |
|
33 |
|
34 // ======== MEMBER FUNCTIONS ======== |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // CAknRecordingGc::CAknRecordingGc |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 CAknRecordingGc::CAknRecordingGc( CWindowGc* aRealGc ) : |
|
41 CWindowGc( static_cast<CWsScreenDevice*>( aRealGc->Device() ) ) |
|
42 { |
|
43 iRealGc = aRealGc; |
|
44 iCurrentLine = -1; |
|
45 } |
|
46 |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CAknRecordingGc::ConstructL |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 void CAknRecordingGc::ConstructL( const TSize& /*aSize*/ ) |
|
53 { |
|
54 // iOffScreenBmp = new ( ELeave ) CFbsBitmap; |
|
55 // User::LeaveIfError( iOffScreenBmp->Create( TSize( 360, 640 ) /*aSize*/, EColor64K ) ); |
|
56 // iBitmapDevice = CFbsBitmapDevice::NewL( iOffScreenBmp ); |
|
57 // User::LeaveIfError( iBitmapDevice->CreateContext( iBitGc ) ); |
|
58 } |
|
59 |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // CAknRecordingGc::~CAknRecordingGc |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 CAknRecordingGc::~CAknRecordingGc() |
|
66 { |
|
67 iLines.ResetAndDestroy(); |
|
68 delete iOffScreenBmp; |
|
69 delete iBitGc; |
|
70 delete iBitmapDevice; |
|
71 } |
|
72 |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CAknRecordingGc::FlushBuffer |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 void CAknRecordingGc::FlushBuffer( const TRect& aRect, TInt aLineToSkip ) |
|
79 { |
|
80 if ( iLines.Count() == 0 ) |
|
81 { |
|
82 return; |
|
83 } |
|
84 |
|
85 CBufferItem* item = NULL; |
|
86 CLineData* line = NULL; |
|
87 CBitmapContext* gc = iRealGc; |
|
88 |
|
89 // modify target rectangle to match recorded coordinates |
|
90 TInt topY = iLines[0]->iRect.iTl.iY; |
|
91 TRect rect( aRect ); |
|
92 rect.iTl.iY += topY; |
|
93 rect.iBr.iY += topY; |
|
94 |
|
95 // move out-of-screen rectangle to match real screen coordinates |
|
96 rect.Move( 1000, 0 ); |
|
97 |
|
98 if ( iUseBitGc ) |
|
99 { |
|
100 gc = iBitGc; |
|
101 } |
|
102 |
|
103 TRect realRect( TPoint( 1000, 0 ), iLines[0]->iRect.Size() ); |
|
104 TRect includeNextLine( realRect ); |
|
105 for ( TInt i = 0; i < iLines.Count(); ++i ) |
|
106 { |
|
107 line = iLines[i]; |
|
108 |
|
109 if ( rect.Intersects( includeNextLine ) && i != aLineToSkip ) |
|
110 { |
|
111 gc->SetOrigin( TPoint( aRect.iTl.iX-line->iRect.iTl.iX, -rect.iTl.iY + realRect.iTl.iY ) ); |
|
112 |
|
113 for ( TInt ii = 0; ii < line->iItems.Count(); ++ii ) |
|
114 { |
|
115 item = line->iItems[ii]; |
|
116 |
|
117 switch ( item->iType ) |
|
118 { |
|
119 case CBufferItem::EShortText: |
|
120 gc->DrawText( *item->iText, item->iPosition ); |
|
121 break; |
|
122 |
|
123 case CBufferItem::ELongText: |
|
124 gc->DrawText( *item->iText, item->iBox, item->iBaseLineOffset, item->iHorizontal, item->iLeftMargin ); |
|
125 break; |
|
126 |
|
127 case CBufferItem::ESetPenColor: |
|
128 gc->SetPenColor( item->iColor ); |
|
129 break; |
|
130 |
|
131 /* case CBufferItem::EBitBlt2: |
|
132 iRealGc->BitBlt( item->iPosition, item->iBitmap, item->iBox ); |
|
133 break;*/ |
|
134 |
|
135 case CBufferItem::EBitBltMasked1: |
|
136 gc->BitBltMasked( item->iPosition, item->iBitmap, item->iBox, item->iMask, item->iInvertMask ); |
|
137 break; |
|
138 |
|
139 case CBufferItem::EUseFont: |
|
140 gc->UseFont( item->iFont ); |
|
141 break; |
|
142 |
|
143 case CBufferItem::EDiscardFont: |
|
144 gc->DiscardFont(); |
|
145 break; |
|
146 |
|
147 case CBufferItem::ESetDrawMode: |
|
148 gc->SetDrawMode( item->iDrawMode ); |
|
149 break; |
|
150 |
|
151 case CBufferItem::ESetClippingRect: |
|
152 gc->SetClippingRect( item->iBox ); |
|
153 break; |
|
154 |
|
155 case CBufferItem::ECancelClippingRect: |
|
156 gc->CancelClippingRect(); |
|
157 break; |
|
158 |
|
159 case CBufferItem::ESetBrushColor: |
|
160 gc->SetBrushColor( item->iColor ); |
|
161 break; |
|
162 |
|
163 case CBufferItem::ESetBrushStyle: |
|
164 gc->SetBrushStyle( item->iBrushStyle ); |
|
165 break; |
|
166 |
|
167 case CBufferItem::EDrawRect: |
|
168 gc->DrawRect( item->iRect ); |
|
169 break; |
|
170 case CBufferItem::EClear: |
|
171 gc->Clear( item->iRect ); |
|
172 break; |
|
173 } |
|
174 } |
|
175 |
|
176 gc->CancelClippingRect(); |
|
177 } |
|
178 else if ( realRect.iTl.iY > aRect.iBr.iY ) |
|
179 { |
|
180 break; |
|
181 } |
|
182 |
|
183 realRect.Move( 0, line->iRect.Height() ); |
|
184 includeNextLine = realRect; |
|
185 if( i < iLines.Count()-1 ) |
|
186 includeNextLine.iBr.iY += iLines[i+1]->iRect.Height(); |
|
187 } |
|
188 |
|
189 gc->SetOrigin( TPoint( 0, 0 ) ); |
|
190 |
|
191 if ( iUseBitGc ) |
|
192 { |
|
193 iRealGc->BitBlt( TPoint( 0, 0 ), iOffScreenBmp, TRect( 0, 0, 360, 500 ) ); |
|
194 } |
|
195 } |
|
196 |
|
197 |
|
198 // ----------------------------------------------------------------------------- |
|
199 // CAknRecordingGc::PurgeBuffer |
|
200 // ----------------------------------------------------------------------------- |
|
201 // |
|
202 void CAknRecordingGc::PurgeBuffer() |
|
203 { |
|
204 iLines.ResetAndDestroy(); |
|
205 iCurrentLine = -1; |
|
206 } |
|
207 |
|
208 |
|
209 // ----------------------------------------------------------------------------- |
|
210 // CAknRecordingGc::PrepareForNewLineL |
|
211 // ----------------------------------------------------------------------------- |
|
212 // |
|
213 void CAknRecordingGc::PrepareForNewLineL( const TRect& aRect ) |
|
214 { |
|
215 CLineData* newLine = new ( ELeave ) CLineData; |
|
216 newLine->iRect = aRect; |
|
217 iLines.AppendL( newLine ); |
|
218 iCurrentLine = iLines.Count() - 1; |
|
219 } |
|
220 |
|
221 |
|
222 // ----------------------------------------------------------------------------- |
|
223 // CAknRecordingGc::ReplaceLineL |
|
224 // ----------------------------------------------------------------------------- |
|
225 // |
|
226 void CAknRecordingGc::ReplaceLineL( TInt aLine ) |
|
227 { |
|
228 if ( aLine < iLines.Count() ) |
|
229 { |
|
230 TRect rect( iLines[aLine]->iRect ); |
|
231 |
|
232 delete iLines[aLine]; |
|
233 iLines[aLine] = NULL; |
|
234 iLines[aLine] = new ( ELeave ) CLineData; |
|
235 iLines[aLine]->iRect = rect; |
|
236 } |
|
237 |
|
238 iCurrentLine = aLine; |
|
239 } |
|
240 |
|
241 |
|
242 // ----------------------------------------------------------------------------- |
|
243 // CAknRecordingGc::UseBitGc |
|
244 // ----------------------------------------------------------------------------- |
|
245 // |
|
246 void CAknRecordingGc::UseBitGc( TBool aUseBitGc ) |
|
247 { |
|
248 iUseBitGc = aUseBitGc; |
|
249 } |
|
250 |
|
251 |
|
252 // ----------------------------------------------------------------------------- |
|
253 // CAknRecordingGc::InsertLineL |
|
254 // ----------------------------------------------------------------------------- |
|
255 // |
|
256 void CAknRecordingGc::InsertLineL( TInt aLine, const TRect& aRect ) |
|
257 { |
|
258 CLineData* newLine = new ( ELeave ) CLineData; |
|
259 newLine->iRect = aRect; |
|
260 |
|
261 iLines.Insert( newLine, aLine ); |
|
262 iCurrentLine = aLine; |
|
263 } |
|
264 |
|
265 |
|
266 // ----------------------------------------------------------------------------- |
|
267 // CAknRecordingGc::InsertLineL |
|
268 // ----------------------------------------------------------------------------- |
|
269 // |
|
270 void CAknRecordingGc::InsertLineL( TInt aLine ) |
|
271 { |
|
272 InsertLineL( aLine, TRect( 0, 0, 0, 0 ) ); |
|
273 } |
|
274 |
|
275 |
|
276 // ----------------------------------------------------------------------------- |
|
277 // CAknRecordingGc::AppendLineL |
|
278 // ----------------------------------------------------------------------------- |
|
279 // |
|
280 void CAknRecordingGc::AppendLineL() |
|
281 { |
|
282 PrepareForNewLineL( TRect( 0, 0, 0, 0 ) ); |
|
283 } |
|
284 |
|
285 |
|
286 // ----------------------------------------------------------------------------- |
|
287 // CAknRecordingGc::PurgeLine |
|
288 // ----------------------------------------------------------------------------- |
|
289 // |
|
290 void CAknRecordingGc::PurgeLine( TInt aLine ) |
|
291 { |
|
292 if ( aLine < iLines.Count() ) |
|
293 { |
|
294 iLines[aLine]->iItems.ResetAndDestroy(); |
|
295 iCurrentLine = aLine; |
|
296 } |
|
297 } |
|
298 |
|
299 |
|
300 // ----------------------------------------------------------------------------- |
|
301 // CAknRecordingGc::SetLineRect |
|
302 // ----------------------------------------------------------------------------- |
|
303 // |
|
304 void CAknRecordingGc::SetLineRect( TInt aLine, const TRect& aRect ) |
|
305 { |
|
306 __ASSERT_DEBUG( aLine < iLines.Count(), User::Panic( KOverFlow, KErrOverflow ) ); |
|
307 iLines[aLine]->iRect = aRect; |
|
308 } |
|
309 |
|
310 |
|
311 // ----------------------------------------------------------------------------- |
|
312 // CAknRecordingGc::DeleteLine |
|
313 // ----------------------------------------------------------------------------- |
|
314 // |
|
315 void CAknRecordingGc::DeleteLine( TInt aLine ) |
|
316 { |
|
317 if ( aLine != -1 && aLine < iLines.Count() ) |
|
318 { |
|
319 delete iLines[aLine]; |
|
320 iLines.Remove( aLine ); |
|
321 } |
|
322 } |
|
323 |
|
324 |
|
325 // ----------------------------------------------------------------------------- |
|
326 // CAknRecordingGc::CBufferItem::~CBufferItem() |
|
327 // ----------------------------------------------------------------------------- |
|
328 // |
|
329 CAknRecordingGc::CBufferItem::~CBufferItem() |
|
330 { |
|
331 delete iText; |
|
332 delete iBitmap; |
|
333 delete iMask; |
|
334 } |
|
335 |
|
336 |
|
337 // ----------------------------------------------------------------------------- |
|
338 // CAknRecordingGc::CLineData::~CLineData() |
|
339 // ----------------------------------------------------------------------------- |
|
340 // |
|
341 CAknRecordingGc::CLineData::~CLineData() |
|
342 { |
|
343 iItems.ResetAndDestroy(); |
|
344 } |
|
345 |
|
346 |
|
347 // ----------------------------------------------------------------------------- |
|
348 // CAknRecordingGc::BufferItem |
|
349 // ----------------------------------------------------------------------------- |
|
350 // |
|
351 CAknRecordingGc::CBufferItem* CAknRecordingGc::BufferItem() |
|
352 { |
|
353 CBufferItem* buffer ( NULL ); |
|
354 TRAP_IGNORE( buffer = new ( ELeave ) CBufferItem ); |
|
355 TRAP_IGNORE( iLines[iCurrentLine]->iItems.AppendL( buffer ) ); |
|
356 buffer->iPosition.SetXY( -1, -1 ); |
|
357 |
|
358 return buffer; |
|
359 } |
|
360 |
|
361 // --------------------------------------------------------------------------- |
|
362 // From class CWindowGc |
|
363 // --------------------------------------------------------------------------- |
|
364 // |
|
365 void CAknRecordingGc::Activate( RDrawableWindow& /*aDevice*/ ) |
|
366 { |
|
367 } |
|
368 |
|
369 |
|
370 // --------------------------------------------------------------------------- |
|
371 // From class CWindowGc |
|
372 // --------------------------------------------------------------------------- |
|
373 // |
|
374 void CAknRecordingGc::Deactivate() |
|
375 { |
|
376 } |
|
377 |
|
378 |
|
379 // --------------------------------------------------------------------------- |
|
380 // From class CWindowGc |
|
381 // --------------------------------------------------------------------------- |
|
382 // |
|
383 CGraphicsDevice* CAknRecordingGc::Device() const |
|
384 { |
|
385 return NULL; |
|
386 } |
|
387 |
|
388 |
|
389 // --------------------------------------------------------------------------- |
|
390 // From class CWindowGc |
|
391 // |
|
392 // --------------------------------------------------------------------------- |
|
393 // |
|
394 void CAknRecordingGc::SetOrigin( const TPoint& /*aPoint*/ ) |
|
395 { |
|
396 } |
|
397 |
|
398 |
|
399 // --------------------------------------------------------------------------- |
|
400 // From class CWindowGc |
|
401 // --------------------------------------------------------------------------- |
|
402 // |
|
403 void CAknRecordingGc::SetDrawMode( TDrawMode aDrawingMode ) |
|
404 { |
|
405 CBufferItem* buffer = BufferItem(); |
|
406 buffer->iType = CBufferItem::ESetDrawMode; |
|
407 buffer->iDrawMode = aDrawingMode; |
|
408 } |
|
409 |
|
410 |
|
411 // --------------------------------------------------------------------------- |
|
412 // From class CWindowGc |
|
413 // --------------------------------------------------------------------------- |
|
414 // |
|
415 void CAknRecordingGc::SetClippingRect( const TRect& aRect ) |
|
416 { |
|
417 CBufferItem* buffer = BufferItem(); |
|
418 buffer->iType = CBufferItem::ESetClippingRect; |
|
419 buffer->iBox = aRect; |
|
420 buffer->iPosition = aRect.iTl; |
|
421 } |
|
422 |
|
423 |
|
424 // --------------------------------------------------------------------------- |
|
425 // From class CWindowGc |
|
426 // --------------------------------------------------------------------------- |
|
427 // |
|
428 void CAknRecordingGc::CancelClippingRect() |
|
429 { |
|
430 CBufferItem* buffer = BufferItem(); |
|
431 buffer->iType = CBufferItem::ECancelClippingRect; |
|
432 } |
|
433 |
|
434 |
|
435 // --------------------------------------------------------------------------- |
|
436 // From class CWindowGc |
|
437 // --------------------------------------------------------------------------- |
|
438 // |
|
439 TInt CAknRecordingGc::SetClippingRegion( const TRegion& /*aRegion*/ ) |
|
440 { |
|
441 return 0; |
|
442 } |
|
443 |
|
444 |
|
445 // --------------------------------------------------------------------------- |
|
446 // From class CWindowGc |
|
447 // --------------------------------------------------------------------------- |
|
448 // |
|
449 void CAknRecordingGc::Reset() |
|
450 { |
|
451 } |
|
452 |
|
453 |
|
454 // --------------------------------------------------------------------------- |
|
455 // From class CWindowGc |
|
456 // --------------------------------------------------------------------------- |
|
457 // |
|
458 void CAknRecordingGc::UseFont( const CFont* aFont ) |
|
459 { |
|
460 CBufferItem* buffer = BufferItem(); |
|
461 buffer->iType = CBufferItem::EUseFont; |
|
462 buffer->iFont = aFont; |
|
463 } |
|
464 |
|
465 |
|
466 // --------------------------------------------------------------------------- |
|
467 // From class CWindowGc |
|
468 // --------------------------------------------------------------------------- |
|
469 // |
|
470 void CAknRecordingGc::DiscardFont() |
|
471 { |
|
472 CBufferItem* buffer = BufferItem(); |
|
473 buffer->iType = CBufferItem::EDiscardFont; |
|
474 } |
|
475 |
|
476 |
|
477 // --------------------------------------------------------------------------- |
|
478 // From class CWindowGc |
|
479 // --------------------------------------------------------------------------- |
|
480 // |
|
481 void CAknRecordingGc::SetUnderlineStyle( TFontUnderline /*aUnderlineStyle*/ ) |
|
482 { |
|
483 } |
|
484 |
|
485 |
|
486 // --------------------------------------------------------------------------- |
|
487 // From class CWindowGc |
|
488 // --------------------------------------------------------------------------- |
|
489 // |
|
490 void CAknRecordingGc::SetStrikethroughStyle( |
|
491 TFontStrikethrough /*aStrikethroughStyle*/ ) |
|
492 { |
|
493 } |
|
494 |
|
495 |
|
496 |
|
497 // --------------------------------------------------------------------------- |
|
498 // From class CWindowGc |
|
499 // --------------------------------------------------------------------------- |
|
500 // |
|
501 void CAknRecordingGc::SetWordJustification( TInt /*aExcessWidth*/, |
|
502 TInt /*aNumGaps*/ ) |
|
503 { |
|
504 } |
|
505 |
|
506 |
|
507 // --------------------------------------------------------------------------- |
|
508 // From class CWindowGc |
|
509 // --------------------------------------------------------------------------- |
|
510 // |
|
511 void CAknRecordingGc::SetCharJustification( TInt /*aExcessWidth*/, |
|
512 TInt /*aNumChars*/ ) |
|
513 { |
|
514 } |
|
515 |
|
516 |
|
517 // --------------------------------------------------------------------------- |
|
518 // From class CWindowGc |
|
519 // --------------------------------------------------------------------------- |
|
520 // |
|
521 void CAknRecordingGc::SetPenColor( const TRgb& aColor ) |
|
522 { |
|
523 CBufferItem* buffer = BufferItem(); |
|
524 buffer->iType = CBufferItem::ESetPenColor; |
|
525 buffer->iColor = aColor; |
|
526 } |
|
527 |
|
528 |
|
529 // --------------------------------------------------------------------------- |
|
530 // From class CWindowGc |
|
531 // --------------------------------------------------------------------------- |
|
532 // |
|
533 void CAknRecordingGc::SetPenStyle( TPenStyle /*aPenStyle*/ ) |
|
534 { |
|
535 } |
|
536 |
|
537 |
|
538 // --------------------------------------------------------------------------- |
|
539 // From class CWindowGc |
|
540 // --------------------------------------------------------------------------- |
|
541 // |
|
542 void CAknRecordingGc::SetPenSize( const TSize& /*aSize*/ ) |
|
543 { |
|
544 } |
|
545 |
|
546 |
|
547 // --------------------------------------------------------------------------- |
|
548 // From class CWindowGc |
|
549 // --------------------------------------------------------------------------- |
|
550 // |
|
551 void CAknRecordingGc::SetBrushColor( const TRgb& aColor ) |
|
552 { |
|
553 CBufferItem* buffer = BufferItem(); |
|
554 buffer->iType = CBufferItem::ESetBrushColor; |
|
555 buffer->iColor = aColor; |
|
556 } |
|
557 |
|
558 |
|
559 // --------------------------------------------------------------------------- |
|
560 // From class CWindowGc |
|
561 // --------------------------------------------------------------------------- |
|
562 // |
|
563 void CAknRecordingGc::SetBrushStyle( TBrushStyle aBrushStyle ) |
|
564 { |
|
565 CBufferItem* buffer = BufferItem(); |
|
566 buffer->iType = CBufferItem::ESetBrushStyle; |
|
567 buffer->iBrushStyle = aBrushStyle; |
|
568 } |
|
569 |
|
570 |
|
571 // --------------------------------------------------------------------------- |
|
572 // From class CWindowGc |
|
573 // --------------------------------------------------------------------------- |
|
574 // |
|
575 void CAknRecordingGc::SetBrushOrigin( const TPoint& /*aOrigin*/ ) |
|
576 { |
|
577 } |
|
578 |
|
579 |
|
580 // --------------------------------------------------------------------------- |
|
581 // From class CWindowGc |
|
582 // --------------------------------------------------------------------------- |
|
583 // |
|
584 void CAknRecordingGc::UseBrushPattern( const CFbsBitmap* /*aDevice*/ ) |
|
585 { |
|
586 } |
|
587 |
|
588 |
|
589 // --------------------------------------------------------------------------- |
|
590 // From class CWindowGc |
|
591 // --------------------------------------------------------------------------- |
|
592 // |
|
593 void CAknRecordingGc::DiscardBrushPattern() |
|
594 { |
|
595 } |
|
596 |
|
597 |
|
598 // --------------------------------------------------------------------------- |
|
599 // From class CWindowGc |
|
600 // --------------------------------------------------------------------------- |
|
601 // |
|
602 void CAknRecordingGc::MoveTo( const TPoint& /*aPoint*/ ) |
|
603 { |
|
604 } |
|
605 |
|
606 |
|
607 // --------------------------------------------------------------------------- |
|
608 // From class CWindowGc |
|
609 // --------------------------------------------------------------------------- |
|
610 // |
|
611 void CAknRecordingGc::MoveBy( const TPoint& /*aPoint*/ ) |
|
612 { |
|
613 } |
|
614 |
|
615 |
|
616 // --------------------------------------------------------------------------- |
|
617 // From class CWindowGc |
|
618 // --------------------------------------------------------------------------- |
|
619 // |
|
620 void CAknRecordingGc::Plot( const TPoint& /*aPoint*/ ) |
|
621 { |
|
622 } |
|
623 |
|
624 |
|
625 // --------------------------------------------------------------------------- |
|
626 // From class CWindowGc |
|
627 // --------------------------------------------------------------------------- |
|
628 // |
|
629 void CAknRecordingGc::DrawArc( const TRect& /*aRect*/, const TPoint& /*aStart*/, |
|
630 const TPoint& /*aEnd*/ ) |
|
631 { |
|
632 } |
|
633 |
|
634 |
|
635 // --------------------------------------------------------------------------- |
|
636 // From class CWindowGc |
|
637 // --------------------------------------------------------------------------- |
|
638 // |
|
639 void CAknRecordingGc::DrawLine( const TPoint& /*aPoint1*/, |
|
640 const TPoint& /*aPoint2*/ ) |
|
641 { |
|
642 } |
|
643 |
|
644 |
|
645 // --------------------------------------------------------------------------- |
|
646 // From class CWindowGc |
|
647 // --------------------------------------------------------------------------- |
|
648 // |
|
649 void CAknRecordingGc::DrawLineTo( const TPoint& /*aPoint*/ ) |
|
650 { |
|
651 } |
|
652 |
|
653 |
|
654 // --------------------------------------------------------------------------- |
|
655 // From class CWindowGc |
|
656 // --------------------------------------------------------------------------- |
|
657 // |
|
658 void CAknRecordingGc::DrawLineBy( const TPoint& /*aPoint*/ ) |
|
659 { |
|
660 } |
|
661 |
|
662 |
|
663 // --------------------------------------------------------------------------- |
|
664 // From class CWindowGc |
|
665 // --------------------------------------------------------------------------- |
|
666 // |
|
667 void CAknRecordingGc::DrawPolyLine( const CArrayFix<TPoint>* /*aPointList*/ ) |
|
668 { |
|
669 } |
|
670 |
|
671 |
|
672 // --------------------------------------------------------------------------- |
|
673 // From class CWindowGc |
|
674 // --------------------------------------------------------------------------- |
|
675 // |
|
676 void CAknRecordingGc::DrawPolyLine( const TPoint* /*aPointList*/, |
|
677 TInt /*aNumPoints*/ ) |
|
678 { |
|
679 } |
|
680 |
|
681 |
|
682 // --------------------------------------------------------------------------- |
|
683 // From class CWindowGc |
|
684 // --------------------------------------------------------------------------- |
|
685 // |
|
686 void CAknRecordingGc::DrawPie( const TRect& /*aRect*/, const TPoint& /*aStart*/, |
|
687 const TPoint& /*aEnd*/ ) |
|
688 { |
|
689 } |
|
690 |
|
691 |
|
692 // --------------------------------------------------------------------------- |
|
693 // From class CWindowGc |
|
694 // --------------------------------------------------------------------------- |
|
695 // |
|
696 void CAknRecordingGc::DrawEllipse( const TRect& /*aRect*/ ) |
|
697 { |
|
698 } |
|
699 |
|
700 |
|
701 // --------------------------------------------------------------------------- |
|
702 // From class CWindowGc |
|
703 // --------------------------------------------------------------------------- |
|
704 // |
|
705 void CAknRecordingGc::DrawRect( const TRect& aRect ) |
|
706 { |
|
707 CBufferItem* buffer = BufferItem(); |
|
708 buffer->iType = CBufferItem::EDrawRect; |
|
709 buffer->iRect = aRect; |
|
710 } |
|
711 |
|
712 |
|
713 // --------------------------------------------------------------------------- |
|
714 // From class CWindowGc |
|
715 // --------------------------------------------------------------------------- |
|
716 // |
|
717 void CAknRecordingGc::DrawRoundRect( const TRect& /*aRect*/, |
|
718 const TSize& /*aEllipse*/ ) |
|
719 { |
|
720 } |
|
721 |
|
722 |
|
723 // --------------------------------------------------------------------------- |
|
724 // From class CWindowGc |
|
725 // --------------------------------------------------------------------------- |
|
726 // |
|
727 TInt CAknRecordingGc::DrawPolygon( const CArrayFix<TPoint>* /*aPointList*/, |
|
728 TFillRule /*aFillRule*/ ) |
|
729 { |
|
730 return 0; |
|
731 } |
|
732 |
|
733 |
|
734 // --------------------------------------------------------------------------- |
|
735 // From class CWindowGc |
|
736 // --------------------------------------------------------------------------- |
|
737 // |
|
738 TInt CAknRecordingGc::DrawPolygon( const TPoint* /*aPointList*/, |
|
739 TInt /*aNumPoints*/, TFillRule /*aFillRule*/ ) |
|
740 { |
|
741 return 0; |
|
742 } |
|
743 |
|
744 |
|
745 // --------------------------------------------------------------------------- |
|
746 // From class CWindowGc |
|
747 // --------------------------------------------------------------------------- |
|
748 // |
|
749 void CAknRecordingGc::DrawBitmap( const TPoint& /*aTopLeft*/, |
|
750 const CFbsBitmap* /*aDevice*/ ) |
|
751 { |
|
752 } |
|
753 |
|
754 |
|
755 // --------------------------------------------------------------------------- |
|
756 // From class CWindowGc |
|
757 // --------------------------------------------------------------------------- |
|
758 // |
|
759 void CAknRecordingGc::DrawBitmap( const TRect& /*aDestRect*/, |
|
760 const CFbsBitmap* /*aDevice*/ ) |
|
761 { |
|
762 } |
|
763 |
|
764 |
|
765 // --------------------------------------------------------------------------- |
|
766 // From class CWindowGc |
|
767 // --------------------------------------------------------------------------- |
|
768 // |
|
769 void CAknRecordingGc::DrawBitmap( const TRect& /*aDestRect*/, |
|
770 const CFbsBitmap* /*aDevice*/, const TRect& /*aSourceRect*/ ) |
|
771 { |
|
772 } |
|
773 |
|
774 |
|
775 // --------------------------------------------------------------------------- |
|
776 // From class CWindowGc |
|
777 // --------------------------------------------------------------------------- |
|
778 // |
|
779 void CAknRecordingGc::DrawBitmapMasked( const TRect& /*aDestRect*/, |
|
780 const CFbsBitmap* /*aBitmap*/, const TRect& /*aSourceRect*/, |
|
781 const CFbsBitmap* /*aMaskBitmap*/, TBool /*aInvertMask*/ ) |
|
782 { |
|
783 } |
|
784 |
|
785 |
|
786 // --------------------------------------------------------------------------- |
|
787 // From class CWindowGc |
|
788 // --------------------------------------------------------------------------- |
|
789 // |
|
790 void CAknRecordingGc::DrawBitmapMasked( const TRect& /*aDestRect*/, |
|
791 const CWsBitmap* /*aBitmap*/, const TRect& /*aSourceRect*/, |
|
792 const CWsBitmap* /*aMaskBitmap*/, TBool /*aInvertMask*/ ) |
|
793 { |
|
794 } |
|
795 |
|
796 |
|
797 // --------------------------------------------------------------------------- |
|
798 // From class CWindowGc |
|
799 // --------------------------------------------------------------------------- |
|
800 // |
|
801 void CAknRecordingGc::DrawText( const TDesC& aBuf, const TPoint& aPos ) |
|
802 { |
|
803 CBufferItem* buffer = BufferItem(); |
|
804 buffer->iType = CBufferItem::EShortText; |
|
805 TRAP_IGNORE( buffer->iText = aBuf.AllocL() ); |
|
806 buffer->iPosition = aPos; |
|
807 } |
|
808 |
|
809 |
|
810 // --------------------------------------------------------------------------- |
|
811 // From class CWindowGc |
|
812 // --------------------------------------------------------------------------- |
|
813 // |
|
814 void CAknRecordingGc::DrawText( const TDesC& aBuf, const TRect& aBox, |
|
815 TInt aBaselineOffset, TTextAlign aHoriz, TInt aLeftMrg ) |
|
816 { |
|
817 CBufferItem* buffer = BufferItem(); |
|
818 buffer->iType = CBufferItem::ELongText; |
|
819 TRAP_IGNORE( buffer->iText = aBuf.AllocL() ); |
|
820 buffer->iBox = aBox; |
|
821 buffer->iBaseLineOffset = aBaselineOffset; |
|
822 buffer->iHorizontal = aHoriz; |
|
823 buffer->iLeftMargin = aLeftMrg; |
|
824 buffer->iPosition = aBox.iTl; |
|
825 } |
|
826 |
|
827 |
|
828 // --------------------------------------------------------------------------- |
|
829 // From class CWindowGc |
|
830 // --------------------------------------------------------------------------- |
|
831 // |
|
832 void CAknRecordingGc::Clear() |
|
833 { |
|
834 } |
|
835 |
|
836 |
|
837 // --------------------------------------------------------------------------- |
|
838 // From class CWindowGc |
|
839 // --------------------------------------------------------------------------- |
|
840 // |
|
841 void CAknRecordingGc::Clear( const TRect& aRect ) |
|
842 { |
|
843 CBufferItem* buffer = BufferItem(); |
|
844 buffer->iType = CBufferItem::EClear; |
|
845 buffer->iRect = aRect; |
|
846 } |
|
847 |
|
848 |
|
849 // --------------------------------------------------------------------------- |
|
850 // From class CWindowGc |
|
851 // --------------------------------------------------------------------------- |
|
852 // |
|
853 void CAknRecordingGc::CopyRect( const TPoint& /*aOffset*/, |
|
854 const TRect& /*aRect */ ) |
|
855 { |
|
856 } |
|
857 |
|
858 |
|
859 // --------------------------------------------------------------------------- |
|
860 // From class CWindowGc |
|
861 // --------------------------------------------------------------------------- |
|
862 // |
|
863 void CAknRecordingGc::BitBlt( const TPoint& /*aPos*/, |
|
864 const CFbsBitmap* /*aBitmap*/ ) |
|
865 { |
|
866 } |
|
867 |
|
868 |
|
869 // --------------------------------------------------------------------------- |
|
870 // From class CWindowGc |
|
871 // --------------------------------------------------------------------------- |
|
872 // |
|
873 void CAknRecordingGc::BitBlt( const TPoint& aDestination, |
|
874 const CFbsBitmap* aBitmap, const TRect& aSource ) |
|
875 { |
|
876 if ( iUseBitGc ) |
|
877 { |
|
878 iBitGc->BitBlt( aDestination, aBitmap, aSource ); |
|
879 } |
|
880 /* CBufferItem* buffer = new ( ELeave ) CBufferItem; |
|
881 buffer->iType = CBufferItem::EBitBlt2; |
|
882 buffer->iPosition = aDestination; |
|
883 buffer->iBitmap = aBitmap; |
|
884 buffer->iBox = aSource; |
|
885 |
|
886 iLines[iCurrentLine]->iItems.AppendL( buffer );*/ |
|
887 } |
|
888 |
|
889 |
|
890 // --------------------------------------------------------------------------- |
|
891 // From class CWindowGc |
|
892 // --------------------------------------------------------------------------- |
|
893 // |
|
894 void CAknRecordingGc::BitBltMasked( const TPoint& aPoint, |
|
895 const CFbsBitmap* aBitmap, const TRect& aSourceRect, |
|
896 const CFbsBitmap* aMaskBitmap, TBool aInvertMask ) |
|
897 { |
|
898 if ( !iUseBitGc ) |
|
899 { |
|
900 CBufferItem* buffer = BufferItem(); |
|
901 buffer->iType = CBufferItem::EBitBltMasked1; |
|
902 buffer->iPosition = aPoint; |
|
903 buffer->iBox = aSourceRect; |
|
904 buffer->iInvertMask = aInvertMask; |
|
905 |
|
906 // Make a duplicate of passed in bitmap, so that to make sure |
|
907 // the bitmap won't be freed when FlushBuffer(). (Duplicate |
|
908 // only increases the access count for bitmap) |
|
909 CFbsBitmap* bitmap = NULL; |
|
910 CFbsBitmap* maskBitmap = NULL; |
|
911 TRAP_IGNORE( bitmap = new (ELeave) CFbsBitmap() ); |
|
912 TRAP_IGNORE( maskBitmap = new (ELeave) CFbsBitmap() ); |
|
913 bitmap->Duplicate(aBitmap->Handle()); |
|
914 maskBitmap->Duplicate(aMaskBitmap->Handle()); |
|
915 buffer->iBitmap = bitmap; |
|
916 buffer->iMask = maskBitmap; |
|
917 } |
|
918 else |
|
919 { |
|
920 iBitGc->BitBltMasked( aPoint, aBitmap, aSourceRect, aMaskBitmap, aInvertMask ); |
|
921 } |
|
922 } |
|
923 |
|
924 |
|
925 // --------------------------------------------------------------------------- |
|
926 // From class CWindowGc |
|
927 // --------------------------------------------------------------------------- |
|
928 // |
|
929 void CAknRecordingGc::BitBlt( const TPoint& /*aPoint*/, |
|
930 const CWsBitmap* /*aBitmap*/ ) |
|
931 { |
|
932 } |
|
933 |
|
934 |
|
935 // --------------------------------------------------------------------------- |
|
936 // From class CWindowGc |
|
937 // --------------------------------------------------------------------------- |
|
938 // |
|
939 void CAknRecordingGc::BitBlt( const TPoint& /*aDestination*/, |
|
940 const CWsBitmap* /*aBitmap*/, const TRect& /*aSource*/ ) |
|
941 { |
|
942 } |
|
943 |
|
944 |
|
945 // --------------------------------------------------------------------------- |
|
946 // From class CWindowGc |
|
947 // --------------------------------------------------------------------------- |
|
948 // |
|
949 void CAknRecordingGc::BitBltMasked( const TPoint& /*aPoint*/, |
|
950 const CWsBitmap* /*aBitmap*/, const TRect& /*aSourceRect*/, |
|
951 const CWsBitmap* /*aMaskBitmap*/, TBool /*aInvertMask*/ ) |
|
952 { |
|
953 } |
|
954 |
|
955 |
|
956 // --------------------------------------------------------------------------- |
|
957 // From class CWindowGc |
|
958 // --------------------------------------------------------------------------- |
|
959 // |
|
960 void CAknRecordingGc::MapColors( const TRect& /*aRect*/, const TRgb* /*aColors*/, |
|
961 TInt /*aNumPairs*/, TBool /*aMapForwards*/ ) |
|
962 { |
|
963 } |
|
964 |
|
965 |
|
966 // --------------------------------------------------------------------------- |
|
967 // From class CWindowGc |
|
968 // --------------------------------------------------------------------------- |
|
969 // |
|
970 void CAknRecordingGc::DrawTextVertical( const TDesC& /*aText*/, |
|
971 const TPoint& /*aPos*/, TBool /*aUp*/ ) |
|
972 { |
|
973 } |
|
974 |
|
975 |
|
976 // --------------------------------------------------------------------------- |
|
977 // From class CWindowGc |
|
978 // --------------------------------------------------------------------------- |
|
979 // |
|
980 void CAknRecordingGc::DrawTextVertical( const TDesC& /*aText*/, |
|
981 const TRect& /*aBox*/, TInt /*aBaselineOffset*/, TBool /*aUp*/, |
|
982 TTextAlign /*aVert*/, TInt /*aMargin*/ ) |
|
983 { |
|
984 } |
|
985 |
|
986 |
|
987 // --------------------------------------------------------------------------- |
|
988 // From class CWindowGc |
|
989 // --------------------------------------------------------------------------- |
|
990 // |
|
991 void CAknRecordingGc::SetDitherOrigin( const TPoint& /*aPoint*/ ) |
|
992 { |
|
993 } |
|
994 |
|
995 |
|
996 // --------------------------------------------------------------------------- |
|
997 // From class CWindowGc |
|
998 // --------------------------------------------------------------------------- |
|
999 // |
|
1000 TInt SetClippingRegion( const TRegion& /*aRegion*/ ) |
|
1001 { |
|
1002 return 0; |
|
1003 } |
|
1004 |
|
1005 |
|
1006 // --------------------------------------------------------------------------- |
|
1007 // From class CWindowGc |
|
1008 // --------------------------------------------------------------------------- |
|
1009 // |
|
1010 void CAknRecordingGc::CancelClippingRegion() |
|
1011 { |
|
1012 } |
|
1013 |
|
1014 |
|
1015 // --------------------------------------------------------------------------- |
|
1016 // From class CWindowGc |
|
1017 // --------------------------------------------------------------------------- |
|
1018 // |
|
1019 void CAknRecordingGc::SetOpaque( TBool /*aDrawOpaque*/ ) |
|
1020 { |
|
1021 } |
|
1022 |
|
1023 |
|
1024 // --------------------------------------------------------------------------- |
|
1025 // From class CWindowGc |
|
1026 // --------------------------------------------------------------------------- |
|
1027 // |
|
1028 void CAknRecordingGc::SetFaded( TBool /*aFaded*/ ) |
|
1029 { |
|
1030 } |
|
1031 |
|
1032 |
|
1033 // --------------------------------------------------------------------------- |
|
1034 // From class CWindowGc |
|
1035 // --------------------------------------------------------------------------- |
|
1036 // |
|
1037 void CAknRecordingGc::SetFadingParameters( TUint8 /*aBlackMap*/, |
|
1038 TUint8 /*aWhiteMap*/ ) |
|
1039 { |
|
1040 } |
|
1041 |
|
1042 |
|
1043 // --------------------------------------------------------------------------- |
|
1044 // From class CWindowGc |
|
1045 // --------------------------------------------------------------------------- |
|
1046 // |
|
1047 TInt CAknRecordingGc::AlphaBlendBitmaps( const TPoint& /*aDestPt*/, |
|
1048 const CFbsBitmap* /*aSrcBmp*/, const TRect& /*aSrcRect*/, |
|
1049 const CFbsBitmap* /*aAlphaBmp*/, const TPoint& /*aAlphaPt*/ ) |
|
1050 { |
|
1051 return 0; |
|
1052 } |
|
1053 |
|
1054 |
|
1055 // --------------------------------------------------------------------------- |
|
1056 // From class CWindowGc |
|
1057 // --------------------------------------------------------------------------- |
|
1058 // |
|
1059 TInt CAknRecordingGc::AlphaBlendBitmaps( const TPoint& /*aDestPt*/, |
|
1060 const CWsBitmap* /*aSrcBmp*/, const TRect& /*aSrcRect*/, |
|
1061 const CWsBitmap* /*aAlphaBmp*/, const TPoint& /*aAlphaPt*/ ) |
|
1062 { |
|
1063 return 0; |
|
1064 } |
|
1065 |
|
1066 |
|
1067 // --------------------------------------------------------------------------- |
|
1068 // From class CWindowGc |
|
1069 // --------------------------------------------------------------------------- |
|
1070 // |
|
1071 TAny* CAknRecordingGc::Interface( TUid /*aInterfaceId*/ ) |
|
1072 { |
|
1073 return NULL; |
|
1074 } |
|
1075 |
|
1076 |
|
1077 // --------------------------------------------------------------------------- |
|
1078 // From class CWindowGc |
|
1079 // --------------------------------------------------------------------------- |
|
1080 // |
|
1081 const TAny* CAknRecordingGc::Interface( TUid /*aInterfaceId*/ ) const |
|
1082 { |
|
1083 return NULL; |
|
1084 } |
|
1085 |
|
1086 |
|
1087 // --------------------------------------------------------------------------- |
|
1088 // From class CWindowGc |
|
1089 // --------------------------------------------------------------------------- |
|
1090 // |
|
1091 TInt CAknRecordingGc::APIExtension( TUid aUid, TAny*& /*aOutput*/, |
|
1092 TAny* aInput ) |
|
1093 { |
|
1094 if (aUid == KDrawTextInContextUid) |
|
1095 { |
|
1096 __ASSERT_DEBUG( aInput, User::Panic(KBadArgument, KErrArgument )); |
|
1097 TDrawTextInContextInternal* contextParam = |
|
1098 static_cast<TDrawTextInContextInternal*>(aInput); |
|
1099 const TTextParameters* params = &contextParam->iParam; |
|
1100 __ASSERT_DEBUG( params, User::Panic(KBadArgument, KErrArgument )); |
|
1101 TPtrC textToDraw = contextParam->iText.Mid( params->iStart, |
|
1102 params->iEnd - params->iStart ); |
|
1103 DrawText(textToDraw, contextParam->iPosition); |
|
1104 return KErrNone; |
|
1105 } |
|
1106 else |
|
1107 { |
|
1108 return KErrNotSupported; |
|
1109 } |
|
1110 } |