|
1 /* |
|
2 * Copyright (c) 2008-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: Definition of CHuiCanvasWsSwGc. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __HUICANVASWSSWGC_H__ |
|
21 #define __HUICANVASWSSWGC_H__ |
|
22 |
|
23 #include <uiacceltk/HuiVisual.h> |
|
24 #include "huicanvaswsgc.h" |
|
25 #include "huicanvaspainter.h" |
|
26 #include <bitstd.h> |
|
27 |
|
28 const TInt KHuiCanvasWsSwGcRegionGranularity = 10; |
|
29 |
|
30 /** |
|
31 * This class is used internally by the toolkit and thus should |
|
32 * not be used by the applications directly. |
|
33 */ |
|
34 NONSHARABLE_CLASS(CHuiCanvasWsSwGc) : public CHuiCanvasWsGc |
|
35 { |
|
36 |
|
37 protected: |
|
38 /** |
|
39 * Constructor. |
|
40 */ |
|
41 CHuiCanvasWsSwGc(); |
|
42 |
|
43 /** |
|
44 * Second-phase constructor. |
|
45 */ |
|
46 void ConstructL(); |
|
47 |
|
48 public: |
|
49 /** |
|
50 * Constructor. |
|
51 */ |
|
52 static CHuiCanvasWsSwGc* NewL(); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 ~CHuiCanvasWsSwGc(); |
|
58 |
|
59 public: |
|
60 |
|
61 // CFbsBitGc functionality |
|
62 virtual void WsBitBltL(TInt aBitmapHandle, TPoint aPoint); |
|
63 virtual void WsBitBltRectL(TInt aBitmapHandle, TPoint aPoint, TRect aRect) ; |
|
64 virtual void WsBitBltMaskedL(TInt aBitmapHandle, TInt aMaskHandle, TInt aInvertMask, TPoint aPoint, TRect aRect) ; |
|
65 virtual void WsBitBltMaskedPointL(TInt aBitmapHandle, TInt aMaskHandle, TPoint aPoint1, TPoint aPoint2, TRect aRect) ; |
|
66 virtual void WsResetClippingRegionL() ; |
|
67 virtual void WsClearL(); |
|
68 virtual void WsClearRectL(TRect& aRect) ; |
|
69 virtual void WsResetBrushPatternL() ; |
|
70 virtual void WsResetFontL() ; |
|
71 virtual void WsDrawArcL(TPoint aPoint1, TPoint aPoint2, TRect aRect) ; |
|
72 virtual void WsDrawPieL(TPoint aPoint1, TPoint aPoint2, TRect aRect) ; |
|
73 virtual void WsDrawBitmap1L(TInt aBitmapHandle, TRect aRect) ; |
|
74 virtual void WsDrawBitmap2L(TInt aBitmapHandle, TRect aRect1, TRect aRect2) ; |
|
75 virtual void WsDrawBitmap3L(TInt aBitmapHandle, TPoint aPoint) ; |
|
76 virtual void WsDrawBitmapMaskedL(TInt aBitmapHandle, TInt aMaskHandle, TInt aInvertMask, TRect& aRect1, TRect& aRect2) ; |
|
77 virtual void WsDrawRoundRectL(TPoint aPoint, TRect& aRect) ; |
|
78 virtual void WsDrawPolyLineL(CArrayFix<TPoint>* aPointerArray) ; |
|
79 virtual void WsDrawPolyLineNoEndPointL(TPoint* aPointerArray, TInt aCount); |
|
80 virtual void WsDrawPolygonL(CArrayFix<TPoint>* aPointerArray, TInt aFillRule ) ; |
|
81 virtual void WsDrawEllipseL(TRect& aRect) ; |
|
82 virtual void WsDrawLineL(TPoint& aStart, TPoint& aEnd) ; |
|
83 virtual void WsDrawLineToL(TPoint& aPoint); |
|
84 virtual void WsDrawLineByL(TPoint& aPoint) ; |
|
85 virtual void WsDrawRectL(TRect& aRect) ; |
|
86 virtual void WsDrawText1L(TPtr& aTextValue, THuiCanvasTextParameters& aTextParameters) ; |
|
87 virtual void WsDrawText2L(TPtr& aTextValue, TPoint& aPoint,THuiCanvasTextParameters& aTextParameters) ; |
|
88 virtual void WsDrawText3L(TPtr& aTextValue, TRect& aRect, THuiCanvasTextParameters& aTextParameters) ; |
|
89 virtual void WsDrawText4L(TPtr& aTextValue, TRect& aRect, TInt aBaselineOffset, TInt aTextAlign, TInt aTextMargin,THuiCanvasTextParameters& aTextParameters) ; |
|
90 virtual void WsDrawText5L(TPtr& aTextValue, TRect& aRect, TInt aBaselineOffset, TInt aTextAlign, TInt aTextMargin,TInt aTextWidth, THuiCanvasTextParameters& aTextParameters) ; |
|
91 virtual void WsDrawTextVertical1L(TPtr& aTextValue, TInt aTextUp, THuiCanvasTextParameters& aTextParameters) ; |
|
92 virtual void WsDrawTextVertical2L(TPtr& aTextValue, TInt aTextUp,TPoint& aPoint, THuiCanvasTextParameters& aTextParameters) ; |
|
93 virtual void WsDrawTextVertical3L(TPtr& aTextValue, TInt aTextUp, TRect& aRect, THuiCanvasTextParameters& aTextParameters) ; |
|
94 virtual void WsDrawTextVertical4L(TPtr& aTextValue, TRect& aRect, TInt aBaselineOffset, TInt aTextUp, TInt aTextAlign, TInt aTextMargin, THuiCanvasTextParameters& aTextParameters) ; |
|
95 virtual void WsDrawTextVertical5L(TPtr& aTextValue, TRect& aRect, TInt aBaselineOffset, TInt aTextUp, TInt aTextAlign, TInt aTextMargin, TInt aTextWidth, THuiCanvasTextParameters& aTextParameters) ; |
|
96 virtual void WsMoveToL( TPoint& aPoint) ; |
|
97 virtual void WsMoveByL( TPoint& aPoint) ; |
|
98 virtual void WsPlotL(TPoint& aPoint) ; |
|
99 virtual void WsResetL() ; |
|
100 virtual void WsSetBrushColorL( TRgb aColor) ; |
|
101 virtual void WsSetBrushOriginL( TPoint& aPoint) ; |
|
102 virtual void WsSetBrushStyleL( TInt aStyle) ; |
|
103 virtual void WsSetClippingRegionL( RRegion& aRegion) ; |
|
104 virtual void WsSetDrawModeL( TInt aDrawModew) ; |
|
105 virtual void WsSetOriginL( TPoint& aOrigin); |
|
106 virtual void WsSetPenColorL( TRgb aColor) ; |
|
107 virtual void WsSetPenStyleL( TInt aStyle) ; |
|
108 virtual void WsSetPenSizeL( TInt aWidth, TInt aHeight) ; |
|
109 virtual void WsSetTextShadowColorL( TRgb aColor) ; |
|
110 virtual void WsSetCharJustificationL( TInt aExcessiveWidth, TInt aNumGap) ; |
|
111 virtual void WsSetWordJustificationL( TInt aExcessiveWidth, TInt aNumGap) ; |
|
112 virtual void WsSetUnderlineStyleL( TInt aValue) ; |
|
113 virtual void WsSetBrushPatternL( TInt aValue) ; |
|
114 virtual void WsSetFontL( TInt aFontId) ; |
|
115 virtual void WsCopyRectL( TPoint& aPoint, TRect& aRect) ; |
|
116 virtual void WsCopySettingsL() ; |
|
117 virtual void WsUpdateJustificationL( TPtr& aTextValue) ; |
|
118 virtual void WsUpdateJustificationVerticalL( TInt aValue, TPtr& aTextValue) ; |
|
119 virtual void WsSetFontNoDuplicateL( TInt aCurrentFont) ; |
|
120 virtual void WsSetClippingRectL( TRect& aRect) ; |
|
121 virtual void WsCancelClippingRectL() ; |
|
122 virtual void WsSetFadedL( TInt& aFaded) ; |
|
123 virtual void WsSetFadingParametersL( TInt aFaded1, TInt aFaded2) ; |
|
124 virtual void WsFadeAreaL( RRegion& aRegion) ; |
|
125 virtual void WsMapColorsL() ; |
|
126 virtual void WsSetUserDisplayModeL( TInt aMode) ; |
|
127 virtual void WsUseFontL(TInt aCurrentFont) ; |
|
128 |
|
129 // Extended CFbsBitGc functionality |
|
130 virtual void WsCombinedBitBltMaskedL(TRect aDestinationRect, const RArray<THuiCachedCombinedImageParams>& aBlits); |
|
131 |
|
132 // Canvas functionality |
|
133 virtual void BeginActionL(TInt aAction, TRect aDisplayRect,const CHuiCanvasVisual& aUser, TBool aIsCachePrepared, const TRegion& aUpdateRegion); |
|
134 virtual void EnableUpdateRegion(const TRegion& aUpdateRegion, TBool aClear); |
|
135 virtual void DisableUpdateRegion(); |
|
136 virtual void EndActionL(const TRegion& aUpdateRegion, TBool aUpdateDisplay); |
|
137 virtual TInt SetCapturingBufferL(CFbsBitmap* aTarget); |
|
138 virtual CHuiCanvasGc& CanvasGc() const; |
|
139 virtual void SetPositionDelta( TPoint& aPoint ); |
|
140 virtual void ClearCache(); |
|
141 |
|
142 virtual void SetRelativeOrientation(CHuiGc::TOrientation aOrientation); |
|
143 |
|
144 virtual TBool IsRenderBufferEnabled() const; |
|
145 virtual TBool IsRenderBufferPrepared() const; |
|
146 virtual TBool IsRenderBufferInitialized() const; |
|
147 |
|
148 virtual TInt EnableRenderbuffer(TBool aEnable = ETrue); |
|
149 virtual THuiCanvasWsGcType Type() const; |
|
150 |
|
151 protected: |
|
152 |
|
153 void DoBeginDrawL(TBool aIsCachePrepared); |
|
154 void DoEndDrawL(); |
|
155 TPoint AdjustCoordinates(TPoint aPoint); |
|
156 TRect AdjustCoordinates(TRect aRect); |
|
157 TDisplayMode SelectDisplayMode(); |
|
158 TRect RoundedDisplayRect() const; |
|
159 CFbsBitmap* CreateMovedMaskL(CFbsBitmap& aOriginalMask, TPoint aNewTopLeftCorner); |
|
160 TBool IsRenderingEnabled() const; |
|
161 |
|
162 |
|
163 /** |
|
164 * Drawing related data |
|
165 */ |
|
166 TRect iWsClipRect; |
|
167 TPoint iWsOrigin; |
|
168 |
|
169 /** |
|
170 * The difference between the original position (when first drawn) of the |
|
171 * window and the current position after visual position has been changed |
|
172 */ |
|
173 TPoint iPosDelta; |
|
174 |
|
175 /** |
|
176 * Currently ongiong action, scan or draw. |
|
177 */ |
|
178 TInt iAction; |
|
179 |
|
180 /** |
|
181 * Flag to tell wheter something really has been drawn into this gc |
|
182 */ |
|
183 TBool iIsReallyDirty; |
|
184 |
|
185 /** |
|
186 * Backbuffer |
|
187 */ |
|
188 CFbsBitGc* iBitGc; |
|
189 CFbsBitmap* iBitBitmap; |
|
190 CFbsBitmapDevice* iBitDevice; |
|
191 |
|
192 /** |
|
193 * Buffer for capturing window drawing into bitmap |
|
194 */ |
|
195 CFbsBitGc* iCapturingBitGc; |
|
196 CFbsBitmap* iCapturingBitBitmap; |
|
197 CFbsBitmapDevice* iCapturingBitDevice; |
|
198 |
|
199 /** |
|
200 * Canvas related |
|
201 */ |
|
202 CHuiCanvasGc* iCanvasGc; |
|
203 const CHuiCanvasVisual* iVisual; |
|
204 |
|
205 /** |
|
206 * RRegionBuf is used instead of RRegion for better performance. |
|
207 */ |
|
208 RRegionBuf<KHuiCanvasWsSwGcRegionGranularity> iWsClipRegion; |
|
209 RRegionBuf<KHuiCanvasWsSwGcRegionGranularity> iTempRegion; |
|
210 RRegionBuf<KHuiCanvasWsSwGcRegionGranularity> iDefaultClipRegion; |
|
211 |
|
212 /** |
|
213 * ETrue if cache is prepared, EFalse otherwise. |
|
214 */ |
|
215 TBool iBitmapPrepared; |
|
216 |
|
217 /** |
|
218 * ETrue if cache is initialized, EFalse otherwise. |
|
219 */ |
|
220 TBool iBitmapInitialized; |
|
221 |
|
222 }; |
|
223 #endif // __HUICANVASWSSWGC_H__ |