|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // CPlaybackGc and associated classes definitions |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __PLAYBACKGC_H__ |
|
19 #define __PLAYBACKGC_H__ |
|
20 |
|
21 #include "wnredraw.h" |
|
22 #include "cliwin.h" |
|
23 |
|
24 class CWsFbsFont; |
|
25 |
|
26 class CPlaybackGc : public CBase, public MWsGc |
|
27 { |
|
28 public: |
|
29 static void InitStaticsL(); |
|
30 static void DeleteStatics(); |
|
31 static CPlaybackGc * Instance() { return iSelf; } |
|
32 public: |
|
33 void ConstructL(); |
|
34 void Activate(CWsClientWindow * aWin, CFbsBitGc * aGc, const TRegion * aRegion); |
|
35 void CommandL(TWsGcOpcodes aOpcode, const TDesC8& aCmdData); |
|
36 void Deactivate(); |
|
37 inline CFbsBitGc *Gdi() const; |
|
38 void SetOrigin(const TPoint &aOrigin); |
|
39 void InternalizeL(const CBufBase& aBuffer,TInt& aStartPos); |
|
40 void InternalizeClippingRegionL(RReadStream& aReadStream); |
|
41 TInt FbsBitmapHandle(TInt aOpcode, const TWsGcCmdUnion &pData, TInt& aMaskHandle); |
|
42 TInt WsBitmapHandle(TInt aOpcode, const TWsGcCmdUnion &pData, TInt& aMaskHandle); |
|
43 // implementing MWsGc |
|
44 MWsClient& Client(); |
|
45 MWsScreen& Screen(); |
|
46 TPoint GcOrigin() const; |
|
47 const TRegion& ClippingRegion(); |
|
48 CFbsBitGc& BitGc(); |
|
49 TInt PushBitGcSettings(); |
|
50 void PopBitGcSettings(); |
|
51 const TTime& Now() const; |
|
52 void ScheduleAnimation(const TRect& aRect,const TTimeIntervalMicroSeconds& aFromNow); |
|
53 void ScheduleAnimation(const TRect& aRect,const TTimeIntervalMicroSeconds& aFromNow,const TTimeIntervalMicroSeconds& aFreq,const TTimeIntervalMicroSeconds& aStop); |
|
54 void SetGcOrigin(const TPoint& aOrigin); |
|
55 void SetTargetRegion(const TRegion* aRegion); |
|
56 void Reset(); |
|
57 public: // from MWsObjectProvider |
|
58 TAny * ResolveObjectInterface(TUint aId); |
|
59 private: |
|
60 CPlaybackGc(); |
|
61 ~CPlaybackGc(); |
|
62 void DoDrawing(TWsGcOpcodes aOpcode, const TDesC8& aCmdData); |
|
63 void CancelUserClippingRegion(); |
|
64 void RemoteReadDataAndDrawL(const CWsGraphicDrawer* aGraphic, CWsClient* aOwner, const TWsGcCmdUnion &aData); |
|
65 void DoDrawCommand(TWsGcOpcodes aOpcode, const TDesC8& aCmdData, const TRegion *aRegion); |
|
66 void SetClippingRect(const TRect &aRect); |
|
67 const RWsRegion& Region(); |
|
68 void DoDrawPolygon(const TWsGcCmdDrawPolygon *aDrawPolygon); |
|
69 void DoDrawPolyLine(const TWsGcCmdDrawPolyLine *aDrawPolyLine, TBool aContinued); |
|
70 void GcOwnerPanic(TClientPanic aPanic); |
|
71 void ResetClippingRect(); |
|
72 void EndSegmentedPolygon(); |
|
73 void StartSegmentedDrawPolygonL(const TWsGcCmdStartSegmentedDrawPolygon *aDrawPolygon); |
|
74 void SegmentedDrawPolygonData(const TWsGcCmdSegmentedDrawPolygonData *aDrawPolygon); |
|
75 void UpdateJustification(TText* aText,TInt aLen, const TDesC8& aCmdData); |
|
76 void InternalizeAlphaValueL(RReadStream& aReadStream); |
|
77 |
|
78 void CheckPolyData(const TAny* aDataPtr, TInt aHeaderSize, TInt aNumPoints); |
|
79 TPtrC BufferTPtr(TText* aStart, TInt aLen, const TDesC8& aCmdData); |
|
80 // Data |
|
81 private: |
|
82 static CPlaybackGc * iSelf; |
|
83 CWsClientWindow *iWin; |
|
84 TPoint iMasterOrigin; // Origin available to wserv. Usually the window origin. |
|
85 CFbsBitGc * iGc; |
|
86 CWsFbsFont * iFont; |
|
87 const TRegion *iTargetRegion; //Clipping region set by wserv window management. |
|
88 RWsRegion* iUserDefinedClippingRegion; //Clipping region that is set explicitly by the user. |
|
89 const TRegion *iDrawRegion; //Pointer to one of the above regions |
|
90 TRect iClippingRect; // All drawing clipped to this rectangle in addition to other clipping |
|
91 TBool iClippingRectSet; // ETrue if the iClippingRect is in use |
|
92 TPoint iOrigin; // User defined origin, relative to the top left of the window |
|
93 TPoint iLinePos; // Current line position for LineBy, LineTo etc |
|
94 TPoint *iPolyPoints; |
|
95 TInt iPolyPointListSize; |
|
96 CFbsBitmap *iScratchBitmap; |
|
97 CFbsBitmap *iScratchMaskBitmap; |
|
98 // members used for keeping state when drawing CWsGraphicDrawers |
|
99 CBufBase* iGcBuf; |
|
100 const TRegion* iCurrentClippingRegion; // Clipping region while doing DoDrawCommand |
|
101 }; |
|
102 |
|
103 #endif // __PLAYBACKGC_H__ |