Update contrib.
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 #include "RemoteGcUtils.h"
18 #include "CommandBuffer.h"
19 #include <graphics/gdi/gdiconsts.h>
22 Creates a new remotegc.
24 @param aDevice The windowserver screendevice to use.
25 @param aCommandBufferObserver Pointer to a commandbufferobserver.
26 @return A pointer to a new instance of CRemoteGc.
28 EXPORT_C CRemoteGc* CRemoteGc::NewL(CWsScreenDevice* aDevice)
30 CRemoteGc* remoteGc = new (ELeave) CRemoteGc(aDevice);
31 CleanupStack::PushL(remoteGc);
32 remoteGc->ConstructL();
33 CleanupStack::Pop(remoteGc);
37 CRemoteGc::CRemoteGc(CWsScreenDevice* aDevice) : CWindowGc(aDevice), iCommandBufferObserver(NULL)
41 EXPORT_C CRemoteGc::~CRemoteGc()
43 delete iCommandBuffer;
46 void CRemoteGc::ConstructL()
48 User::LeaveIfError(CWindowGc::Construct());
49 iCommandBuffer = CCommandBuffer::NewL();
52 EXPORT_C void CRemoteGc::SetCommandBufferObserver(MCommandBufferObserver* aCommandBufferObserver)
54 iCommandBufferObserver = aCommandBufferObserver;
58 Resets the commandbuffer.
60 EXPORT_C void CRemoteGc::ResetCommandBuffer()
62 iCommandBuffer->Reset();
66 Externalizes commandbuffer sections into a format which makes it possible to send over IPC.
67 If ETrue is sent as a parameter to this method, the entire commandbuffer will be externalized,
68 otherwise only sections which has not been externalized before will be externalized. Note that if only
69 not externalized sections is asked for, the flag will be reset on that section so next call
70 to ExternalizeLC will not externalize that section.
72 @param aMsgBuf A buffer used to externalize the commandbuffer to.
73 @param aEntireBuffer If ETrue, the entire commandbuffer will be externalized, otherwise only sections which has not been externalized before.
75 EXPORT_C void CRemoteGc::ExternalizeL(RWsGraphicMsgBuf& aMsgBuf, TBool aEntireBuffer)
77 return iCommandBuffer->ExternalizeL(aMsgBuf, aEntireBuffer);
81 Prepares the remotegc to be drawn to.
83 @param aRect The rect to be drawn.
85 EXPORT_C void CRemoteGc::BeginDraw(const TRect& aRect)
88 iBoundingRect = TRect();
89 iHasBitmapCommand = EFalse;
90 iCommandBuffer->Prepare(aRect);
94 Finishes the current redraw.
95 This method should be called when drawing to the remotegc is complete.
97 EXPORT_C void CRemoteGc::EndDraw()
99 iBoundingRect.Intersection(iDrawRect);
100 const TInt err = iCommandBuffer->Finish(iDrawRect, iBoundingRect, iHasBitmapCommand);
102 if(iCommandBufferObserver && !err)
103 iCommandBufferObserver->CommandBufferUpdated(iDrawRect, iBoundingRect);
106 void CRemoteGc::Activate(RDrawableWindow &aDevice)
108 BeginDraw(aDevice.GetDrawRect());
109 CWindowGc::Activate(aDevice);
112 void CRemoteGc::Deactivate()
114 CWindowGc::Deactivate();
118 void CRemoteGc::Clear()
120 iCommandBuffer->Write<TDrawCode>(ECommandClear);
121 iBoundingRect.BoundingRect(iDrawRect);
124 void CRemoteGc::Clear(const TRect& aRect)
126 iCommandBuffer->Write<TDrawCode>(ECommandClearRect);
127 iCommandBuffer->Write<TRect>(aRect);
128 iBoundingRect.BoundingRect(aRect);
131 void CRemoteGc::CopyRect(const TPoint &anOffset, const TRect &aRect)
133 iCommandBuffer->Write<TDrawCode>(ECommandCopyRect);
134 iCommandBuffer->Write<TPoint>(anOffset);
135 iCommandBuffer->Write<TRect>(aRect);
136 iBoundingRect.BoundingRect(iDrawRect);
139 void CRemoteGc::BitBlt(const TPoint &aPoint, const CFbsBitmap *aBitmap)
141 __ASSERT_DEBUG(aBitmap, User::Invariant());
144 iCommandBuffer->Write<TDrawCode>(ECommandBitBlt1);
145 iCommandBuffer->Write<TPoint>(aPoint);
146 iCommandBuffer->Write<TInt>(aBitmap->Handle());
147 iBoundingRect.BoundingRect(TRect(aPoint, aBitmap->SizeInPixels()));
148 iHasBitmapCommand = ETrue;
152 void CRemoteGc::BitBlt(const TPoint &aDestination, const CFbsBitmap *aBitmap, const TRect &aSource)
154 __ASSERT_DEBUG(aBitmap, User::Invariant());
157 iCommandBuffer->Write<TDrawCode>(ECommandBitBlt2);
158 iCommandBuffer->Write<TPoint>(aDestination);
159 iCommandBuffer->Write<TInt>(aBitmap->Handle());
160 iCommandBuffer->Write<TRect>(aSource);
161 iBoundingRect.BoundingRect(TRect(aDestination, aSource.Size()));
162 iHasBitmapCommand = ETrue;
166 void CRemoteGc::BitBltMasked(const TPoint& aPoint, const CFbsBitmap* aBitmap, const TRect& aSourceRect, const CFbsBitmap* aMaskBitmap, TBool aInvertMask)
168 __ASSERT_DEBUG(aBitmap && aMaskBitmap, User::Invariant());
169 if(aBitmap && aMaskBitmap)
171 iCommandBuffer->Write<TDrawCode>(ECommandBitBltMasked);
172 iCommandBuffer->Write<TPoint>(aPoint);
173 iCommandBuffer->Write<TInt>(aBitmap->Handle());
174 iCommandBuffer->Write<TRect>(aSourceRect);
175 iCommandBuffer->Write<TInt>(aMaskBitmap->Handle());
176 iCommandBuffer->Write<TBool>(aInvertMask);
177 iBoundingRect.BoundingRect(TRect(aPoint, aSourceRect.Size()));
178 iHasBitmapCommand = ETrue;
182 void CRemoteGc::BitBlt(const TPoint &aPoint, const CWsBitmap *aBitmap)
184 BitBlt(aPoint, reinterpret_cast<const CFbsBitmap*>(aBitmap));
187 void CRemoteGc::BitBlt(const TPoint &aDestination, const CWsBitmap *aBitmap, const TRect &aSource)
189 BitBlt(aDestination, reinterpret_cast<const CFbsBitmap*>(aBitmap), aSource);
192 void CRemoteGc::BitBltMasked(const TPoint& aPoint, const CWsBitmap *aBitmap, const TRect& aSourceRect, const CWsBitmap *aMaskBitmap, TBool aInvertMask)
194 BitBltMasked(aPoint, reinterpret_cast<const CFbsBitmap*>(aBitmap), aSourceRect, reinterpret_cast<const CFbsBitmap*>(aMaskBitmap), aInvertMask);
197 void CRemoteGc::SetFaded(TBool aFaded)
199 iCommandBuffer->Write<TDrawCode>(ECommandSetFaded);
200 iCommandBuffer->Write<TBool>(aFaded);
203 void CRemoteGc::SetFadingParameters(TUint8 aBlackMap,TUint8 aWhiteMap)
205 iCommandBuffer->Write<TDrawCode>(ECommandSetFadingParameters);
206 iCommandBuffer->Write<TUint8>(aBlackMap);
207 iCommandBuffer->Write<TUint8>(aWhiteMap);
210 TInt CRemoteGc::AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp, const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp, const TPoint& aAlphaPt)
212 iCommandBuffer->Write<TDrawCode>(ECommandAlphaBlendBitmaps);
213 iCommandBuffer->Write<TPoint>(aDestPt);
214 iCommandBuffer->Write<TInt>(aSrcBmp->Handle());
215 iCommandBuffer->Write<TRect>(aSrcRect);
216 iCommandBuffer->Write<TInt>(aAlphaBmp->Handle());
217 iCommandBuffer->Write<TPoint>(aAlphaPt);
218 iBoundingRect.BoundingRect(iDrawRect);
219 iHasBitmapCommand = ETrue;
223 TInt CRemoteGc::AlphaBlendBitmaps(const TPoint& aDestPt, const CWsBitmap* aSrcBmp, const TRect& aSrcRect, const CWsBitmap* aAlphaBmp, const TPoint& aAlphaPt)
225 return AlphaBlendBitmaps(aDestPt, reinterpret_cast<const CFbsBitmap*>(aSrcBmp), aSrcRect, reinterpret_cast<const CFbsBitmap*>(aAlphaBmp), aAlphaPt);
228 void CRemoteGc::SetOrigin(const TPoint &aPoint)
230 iCommandBuffer->Write<TDrawCode>(ECommandSetOrigin);
231 iCommandBuffer->Write<TPoint>(aPoint);
234 void CRemoteGc::SetDrawMode(TDrawMode aDrawingMode)
236 iCommandBuffer->Write<TDrawCode>(ECommandSetDrawMode);
237 iCommandBuffer->Write<TDrawMode>(aDrawingMode);
240 void CRemoteGc::SetClippingRect(const TRect& aRect)
242 iCommandBuffer->Write<TDrawCode>(ECommandSetClippingRect);
243 iCommandBuffer->Write<TRect>(aRect);
246 void CRemoteGc::CancelClippingRect()
248 iCommandBuffer->Write<TDrawCode>(ECommandCancelClippingRect);
251 void CRemoteGc::Reset()
253 iCommandBuffer->Write<TDrawCode>(ECommandReset);
256 void CRemoteGc::UseFont(const CFont *aFont)
258 iCommandBuffer->Write<TDrawCode>(ECommandUseFont);
259 iCommandBuffer->Write<TInt>(((CFbsFont*)aFont)->Handle());
262 void CRemoteGc::DiscardFont()
264 iCommandBuffer->Write<TDrawCode>(ECommandDiscardFont);
267 void CRemoteGc::SetUnderlineStyle(TFontUnderline aUnderlineStyle)
269 iCommandBuffer->Write<TDrawCode>(ECommandSetUnderlineStyle);
270 iCommandBuffer->Write<TFontUnderline>(aUnderlineStyle);
273 void CRemoteGc::SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle)
275 iCommandBuffer->Write<TDrawCode>(ECommandSetStrikethroughStyle);
276 iCommandBuffer->Write<TFontStrikethrough>(aStrikethroughStyle);
279 void CRemoteGc::SetWordJustification(TInt aExcessWidth, TInt aNumGaps)
281 iCommandBuffer->Write<TDrawCode>(ECommandSetWordJustification);
282 iCommandBuffer->Write<TInt>(aExcessWidth);
283 iCommandBuffer->Write<TInt>(aNumGaps);
286 void CRemoteGc::SetCharJustification(TInt aExcessWidth, TInt aNumChars)
288 iCommandBuffer->Write<TDrawCode>(ECommandSetCharJustification);
289 iCommandBuffer->Write<TInt>(aExcessWidth);
290 iCommandBuffer->Write<TInt>(aNumChars);
293 void CRemoteGc::SetPenColor(const TRgb &aColor)
295 iCommandBuffer->Write<TDrawCode>(ECommandSetPenColor);
296 iCommandBuffer->Write<TRgb>(aColor);
299 void CRemoteGc::SetPenStyle(TPenStyle aPenStyle)
301 iCommandBuffer->Write<TDrawCode>(ECommandSetPenStyle);
302 iCommandBuffer->Write<TPenStyle>(aPenStyle);
305 void CRemoteGc::SetPenSize(const TSize& aSize)
307 iCommandBuffer->Write<TDrawCode>(ECommandSetPenSize);
308 iCommandBuffer->Write<TSize>(aSize);
311 void CRemoteGc::SetBrushColor(const TRgb &aColor)
313 iCommandBuffer->Write<TDrawCode>(ECommandSetBrushColor);
314 iCommandBuffer->Write<TRgb>(aColor);
317 void CRemoteGc::SetBrushStyle(TBrushStyle aBrushStyle)
319 iCommandBuffer->Write<TDrawCode>(ECommandSetBrushStyle);
320 iCommandBuffer->Write<TBrushStyle>(aBrushStyle);
323 void CRemoteGc::SetBrushOrigin(const TPoint &aOrigin)
325 iCommandBuffer->Write<TDrawCode>(ECommandSetBrushOrigin);
326 iCommandBuffer->Write<TPoint>(aOrigin);
329 void CRemoteGc::UseBrushPattern(const CFbsBitmap *aDevice)
331 iCommandBuffer->Write<TDrawCode>(ECommandUseBrushPattern);
332 iCommandBuffer->Write<TInt>(aDevice->Handle());
335 void CRemoteGc::DiscardBrushPattern()
337 iCommandBuffer->Write<TDrawCode>(ECommandDiscardBrushPattern);
340 void CRemoteGc::MoveTo(const TPoint &aPoint)
342 iCommandBuffer->Write<TDrawCode>(ECommandMoveTo);
343 iCommandBuffer->Write<TPoint>(aPoint);
346 void CRemoteGc::MoveBy(const TPoint &aPoint)
348 iCommandBuffer->Write<TDrawCode>(ECommandMoveBy);
349 iCommandBuffer->Write<TPoint>(aPoint);
352 void CRemoteGc::Plot(const TPoint &aPoint)
354 iCommandBuffer->Write<TDrawCode>(ECommandPlot);
355 iCommandBuffer->Write<TPoint>(aPoint);
356 iBoundingRect.BoundingRect(iDrawRect);
359 void CRemoteGc::DrawArc(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd)
361 iCommandBuffer->Write<TDrawCode>(ECommandDrawArc);
362 iCommandBuffer->Write<TRect>(aRect);
363 iCommandBuffer->Write<TPoint>(aStart);
364 iCommandBuffer->Write<TPoint>(aEnd);
365 iBoundingRect.BoundingRect(iDrawRect);
368 void CRemoteGc::DrawLine(const TPoint &aPoint1,const TPoint &aPoint2)
370 iCommandBuffer->Write<TDrawCode>(ECommandDrawLine);
371 iCommandBuffer->Write<TPoint>(aPoint1);
372 iCommandBuffer->Write<TPoint>(aPoint2);
373 iBoundingRect.BoundingRect(iDrawRect);
376 void CRemoteGc::DrawLineTo(const TPoint &aPoint)
378 iCommandBuffer->Write<TDrawCode>(ECommandDrawLineTo);
379 iCommandBuffer->Write<TPoint>(aPoint);
380 iBoundingRect.BoundingRect(iDrawRect);
383 void CRemoteGc::DrawLineBy(const TPoint &aPoint)
385 iCommandBuffer->Write<TDrawCode>(ECommandDrawLineBy);
386 iCommandBuffer->Write<TPoint>(aPoint);
387 iBoundingRect.BoundingRect(iDrawRect);
390 void CRemoteGc::DrawPolyLine(const CArrayFix<TPoint> *aPointList)
392 iCommandBuffer->Write<TDrawCode>(ECommandDrawPolyLine);
393 iCommandBuffer->Write<TInt>(aPointList->Count()); // Write number of points
395 const TInt count = aPointList->Count();
396 for(TInt i = 0; i < count; i++)
398 iCommandBuffer->Write<TPoint>(aPointList->At(i));
400 iBoundingRect.BoundingRect(iDrawRect);
403 void CRemoteGc::DrawPolyLine(const TPoint* aPointList, TInt aNumPoints)
405 iCommandBuffer->Write<TDrawCode>(ECommandDrawPolyLine);
406 iCommandBuffer->Write<TInt>(aNumPoints); // Write number of points
408 for(TInt i = 0; i < aNumPoints; i++)
410 iCommandBuffer->Write<TPoint>(aPointList[i]);
412 iBoundingRect.BoundingRect(iDrawRect);
415 void CRemoteGc::DrawPie(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd)
417 iCommandBuffer->Write<TDrawCode>(ECommandDrawPie);
418 iCommandBuffer->Write<TRect>(aRect);
419 iCommandBuffer->Write<TPoint>(aStart);
420 iCommandBuffer->Write<TPoint>(aEnd);
421 iBoundingRect.BoundingRect(iDrawRect);
424 void CRemoteGc::DrawEllipse(const TRect &aRect)
426 iCommandBuffer->Write<TDrawCode>(ECommandDrawEllipse);
427 iCommandBuffer->Write<TRect>(aRect);
428 iBoundingRect.BoundingRect(iDrawRect);
431 void CRemoteGc::DrawRect(const TRect &aRect)
433 iCommandBuffer->Write<TDrawCode>(ECommandDrawRect);
434 iCommandBuffer->Write<TRect>(aRect);
435 iBoundingRect.BoundingRect(iDrawRect);
438 void CRemoteGc::DrawRoundRect(const TRect &aRect,const TSize &aEllipse)
440 iCommandBuffer->Write<TDrawCode>(ECommandDrawRoundRect);
441 iCommandBuffer->Write<TRect>(aRect);
442 iCommandBuffer->Write<TSize>(aEllipse);
443 iBoundingRect.BoundingRect(iDrawRect);
446 TInt CRemoteGc::DrawPolygon(const CArrayFix<TPoint> *aPointList, TFillRule aFillRule)
448 iCommandBuffer->Write<TDrawCode>(ECommandDrawPolygon);
449 iCommandBuffer->Write<TInt>(aPointList->Count()); // Write number of points
451 for(TInt i = 0; i < aPointList->Count(); i++)
453 iCommandBuffer->Write<TPoint>(aPointList->At(i));
456 iCommandBuffer->Write<TFillRule>(aFillRule);
457 iBoundingRect.BoundingRect(iDrawRect);
461 TInt CRemoteGc::DrawPolygon(const TPoint* aPointList, TInt aNumPoints, TFillRule aFillRule)
463 iCommandBuffer->Write<TDrawCode>(ECommandDrawPolygon);
464 iCommandBuffer->Write<TInt>(aNumPoints); // Write number of points
466 for(TInt i = 0; i < aNumPoints; i++)
468 iCommandBuffer->Write<TPoint>(aPointList[i]);
471 iCommandBuffer->Write<TFillRule>(aFillRule);
472 iBoundingRect.BoundingRect(iDrawRect);
476 void CRemoteGc::DrawBitmap(const TPoint &aTopLeft, const CFbsBitmap *aDevice)
478 iCommandBuffer->Write<TDrawCode>(ECommandDrawBitmap1);
479 iCommandBuffer->Write<TPoint>(aTopLeft);
480 iCommandBuffer->Write<TInt>(aDevice->Handle());
481 iBoundingRect.BoundingRect(TRect(aTopLeft, aDevice->SizeInPixels()));
482 iHasBitmapCommand = ETrue;
485 void CRemoteGc::DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aDevice)
487 iCommandBuffer->Write<TDrawCode>(ECommandDrawBitmap2);
488 iCommandBuffer->Write<TRect>(aDestRect);
489 iCommandBuffer->Write<TInt>(aDevice->Handle());
490 iBoundingRect.BoundingRect(aDestRect);
491 iHasBitmapCommand = ETrue;
494 void CRemoteGc::DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aDevice, const TRect &aSourceRect)
496 iCommandBuffer->Write<TDrawCode>(ECommandDrawBitmap3);
497 iCommandBuffer->Write<TRect>(aDestRect);
498 iCommandBuffer->Write<TInt>(aDevice->Handle());
499 iCommandBuffer->Write<TRect>(aSourceRect);
500 iBoundingRect.BoundingRect(aDestRect);
501 iHasBitmapCommand = ETrue;
504 void CRemoteGc::DrawBitmapMasked(const TRect& aDestRect, const CFbsBitmap* aBitmap, const TRect& aSourceRect, const CFbsBitmap* aMaskBitmap, TBool aInvertMask)
506 iCommandBuffer->Write<TDrawCode>(ECommandDrawBitmapMasked);
507 iCommandBuffer->Write<TRect>(aDestRect);
508 iCommandBuffer->Write<TInt>(aBitmap->Handle());
509 iCommandBuffer->Write<TRect>(aSourceRect);
510 iCommandBuffer->Write<TInt>(aMaskBitmap->Handle());
511 iCommandBuffer->Write<TBool>(aInvertMask);
512 iBoundingRect.BoundingRect(aDestRect);
513 iHasBitmapCommand = ETrue;
516 void CRemoteGc::DrawBitmapMasked(const TRect& aDestRect, const CWsBitmap* aBitmap, const TRect& aSourceRect, const CWsBitmap* aMaskBitmap, TBool aInvertMask)
518 DrawBitmapMasked(aDestRect, reinterpret_cast<const CFbsBitmap*>(aBitmap), aSourceRect, reinterpret_cast<const CFbsBitmap*>(aMaskBitmap), aInvertMask);
521 void CRemoteGc::DrawText(const TDesC &aBuf,const TPoint &aPos)
523 iCommandBuffer->Write<TDrawCode>(ECommandDrawText1);
524 iCommandBuffer->WriteText(aBuf);
525 iCommandBuffer->Write<TPoint>(aPos);
526 iBoundingRect.BoundingRect(iDrawRect);
529 void CRemoteGc::DrawText(const TDesC &aBuf, const TRect &aBox, TInt aBaselineOffset, TTextAlign aHoriz, TInt aLeftMrg)
531 iCommandBuffer->Write<TDrawCode>(ECommandDrawText2);
532 iCommandBuffer->WriteText(aBuf);
533 iCommandBuffer->Write<TRect>(aBox);
534 iCommandBuffer->Write<TInt>(aBaselineOffset);
535 iCommandBuffer->Write<TTextAlign>(aHoriz);
536 iCommandBuffer->Write<TInt>(aLeftMrg);
537 iBoundingRect.BoundingRect(aBox);
540 void CRemoteGc::DrawText(const TDesC& aText, const TPoint& aPosition, const TDrawTextParam& aParam)
542 iCommandBuffer->Write<TDrawCode>(ECommandDrawText3);
543 iCommandBuffer->WriteText(aText);
544 iCommandBuffer->Write<TPoint>(aPosition);
545 iCommandBuffer->Write<TDrawTextParam>(aParam);
546 iBoundingRect.BoundingRect(iDrawRect);
549 void CRemoteGc::MapColors(const TRect& aRect, const TRgb* aColors, TInt aNumPairs, TBool aMapForwards)
551 iCommandBuffer->Write<TDrawCode>(ECommandMapColors);
552 iCommandBuffer->Write<TRect>(aRect);
553 iCommandBuffer->Write<TInt>(aNumPairs);
555 for(TInt i = 0; i < aNumPairs; i++)
557 iCommandBuffer->Write<TRgb>(aColors[i]);
558 iCommandBuffer->Write<TRgb>(aColors[i+1]);
561 iCommandBuffer->Write<TBool>(aMapForwards);
564 TInt CRemoteGc::SetClippingRegion(const TRegion &aRegion)
566 iCommandBuffer->Write<TDrawCode>(ECommandSetClippingRegion);
568 const TInt count = aRegion.Count();
569 iCommandBuffer->Write<TInt>(count);
571 for(TInt i = 0; i < count; i++)
573 iCommandBuffer->Write<TRect>(aRegion.RectangleList()[i]);
579 void CRemoteGc::CancelClippingRegion()
581 iCommandBuffer->Write<TDrawCode>(ECommandCancelClippingRegion);
584 void CRemoteGc::DrawTextVertical(const TDesC& aText, const TPoint& aPos, TBool aUp)
586 iCommandBuffer->Write<TDrawCode>(ECommandDrawTextVertical1);
587 iCommandBuffer->WriteText(aText);
588 iCommandBuffer->Write<TPoint>(aPos);
589 iCommandBuffer->Write<TBool>(aUp);
590 iBoundingRect.BoundingRect(iDrawRect);
593 void CRemoteGc::DrawTextVertical(const TDesC& aText, const TRect& aBox, TInt aBaselineOffset, TBool aUp, TTextAlign aVert, TInt aMargin)
595 iCommandBuffer->Write<TDrawCode>(ECommandDrawTextVertical2);
596 iCommandBuffer->WriteText(aText);
597 iCommandBuffer->Write<TRect>(aBox);
598 iCommandBuffer->Write<TInt>(aBaselineOffset);
599 iCommandBuffer->Write<TBool>(aUp);
600 iCommandBuffer->Write<TTextAlign>(aVert);
601 iCommandBuffer->Write<TInt>(aMargin);
602 iBoundingRect.BoundingRect(aBox);
605 void CRemoteGc::DrawWsGraphic(const TWsGraphicId& aId,const TRect& aDestRect)
607 iCommandBuffer->Write<TDrawCode>(ECommandDrawWsGraphic1);
608 iCommandBuffer->Write<TInt>(aId.IsUid()? aId.Uid().iUid: aId.Id());
609 iCommandBuffer->Write<TBool>(aId.IsUid());
610 iCommandBuffer->Write<TRect>(aDestRect);
611 iBoundingRect.BoundingRect(aDestRect);
614 void CRemoteGc::DrawWsGraphic(const TWsGraphicId& aId,const TRect& aDestRect,const TDesC8& aData)
616 iCommandBuffer->Write<TDrawCode>(ECommandDrawWsGraphic2);
617 iCommandBuffer->Write<TInt>(aId.IsUid()? aId.Uid().iUid: aId.Id());
618 iCommandBuffer->Write<TBool>(aId.IsUid());
619 iCommandBuffer->Write<TRect>(aDestRect);
620 iCommandBuffer->WriteText(aData);
621 iBoundingRect.BoundingRect(aDestRect);
624 void CRemoteGc::SetDitherOrigin(const TPoint& /*aPoint*/)
626 // do nothing, does not apply to CBitmapContext which CCommandBuffer is using
629 void CRemoteGc::SetOpaque(TBool /*aDrawOpaque*/)
631 // overrides to prevent calling CWindowGc::SetOpaque, it's specific to how wserv blends windows content
634 TInt CRemoteGc::APIExtension(TUid aUid, TAny*& aOutput, TAny* aInput)
636 if (aUid == KSetShadowColor)
638 return APIExSetShadowColor(aInput);
640 /* Future cases may be placed here later.*/
643 return CBitmapContext::APIExtension(aUid, aOutput, aInput);
647 TInt CRemoteGc::APIExSetShadowColor(TAny* aShadowColor)
649 const TRgb shadowColor = *(reinterpret_cast<TRgb*> (aShadowColor));
650 iCommandBuffer->Write<TDrawCode>(ECommandSetShadowColor);
651 iCommandBuffer->Write<TRgb>(shadowColor);