windowing/windowserver/inc/CommandBuffer.h
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     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 //
       
    15 
       
    16 #ifndef __COMMANDBUFFER_H__
       
    17 #define __COMMANDBUFFER_H__
       
    18 
       
    19 #include <w32std.h>
       
    20 #include <s32mem.h>
       
    21 #include <graphics/remotegcutils.h>
       
    22 
       
    23 class CBitmapCache;
       
    24 class CFontsCache;
       
    25 class CDrawableCacheBase;
       
    26 class CDrawSection;
       
    27 class MWsGraphicsContext;
       
    28 
       
    29 /**
       
    30 MWsGraphicResolver should be implemented by CWsGraphicDrawers that want to be able to play DrawWsGraphic drawcommands.
       
    31 @publishedPartner
       
    32 @released*/
       
    33 class MWsGraphicResolver
       
    34 	{
       
    35 public:
       
    36 	/**
       
    37 	This method is called when a DrawWsGraphics drawcommand is played by the commandbuffer. The CWsGraphicDrawer that
       
    38 	implements this method needs to resolve the WsGraphics from the MWsGraphicDrawerEnvironment and then draw it.
       
    39 	
       
    40 	@param aId The id of the WsGraphic.
       
    41 	@param aIsUid If ETrue the WsGraphic has a uid.
       
    42 	@param aRect The rect to draw the WsGraphic in.
       
    43 	@param aData Data passed along with the DrawWsGraphic command.
       
    44 	*/
       
    45 	virtual void DrawWsGraphic(TInt aId, TBool aIsUid, const TRect& aRect, const TDesC8& aData) const = 0;
       
    46 	};
       
    47 
       
    48 /**
       
    49 The commandbuffer can record and play drawcommands.
       
    50 It has an array of CDrawSections which contains information about every redraw that has been recorded.
       
    51 @publishedPartner
       
    52 @released*/
       
    53 NONSHARABLE_CLASS(CCommandBuffer): public CBase
       
    54 	{
       
    55 public:
       
    56 	IMPORT_C static CCommandBuffer* NewL();	
       
    57 	IMPORT_C ~CCommandBuffer();	
       
    58 	IMPORT_C void InternalizeL(const TDesC8& aBuf);
       
    59 	IMPORT_C void InternalizeAppendL(const TDesC8& aBuf);
       
    60 	IMPORT_C const TRegion& ClippingRegion() const;
       
    61 	IMPORT_C TInt Play(const TPoint& aPosition, const TRect& aSourceRect, const MWsGraphicResolver& aWsGraphicResolver, CBitmapContext& aBitmapContext);
       
    62 	IMPORT_C TInt Play(const TPoint& aMasterOrigin, const TRegion * aMasterClippingRegion, const TRect& aMasterClippingRect, const MWsGraphicResolver& aWsGraphicResolver, CBitmapContext& aContext);
       
    63 	IMPORT_C TInt Play(const TPoint& aOffset, const TRegion* aClippingRegion, const TRect& aSourceRect, const MWsGraphicResolver& aWsGraphicResolver, MWsGraphicsContext& aGraphicsContext);
       
    64 	IMPORT_C TInt Play(const TPoint& aOffset, const TRegion* aClippingRegion, const TRect& aSourceRect, RWsSession& aWsSession, CWindowGc& aWindowGc);
       
    65 
       
    66 	IMPORT_C TBool IsIdentical(const CCommandBuffer& aBuffer) const;
       
    67 	void ExternalizeL(RWsGraphicMsgBuf& aMsgBuf, TBool aEntireBuffer);
       
    68 	void Reset();	
       
    69 	void Prepare(const TRect& aDrawRect);
       
    70 	TInt Finish(const TRect& aDrawRect, const TRect& aBoundingRect, TBool aHasBitmapCommand);	
       
    71 	
       
    72 	template<typename TClass> void Write(const TClass& aValue);	
       
    73 	void WriteText(const TDesC16 &aText);
       
    74 	void WriteText(const TDesC8 &aText);
       
    75 	
       
    76 private:
       
    77 	void ConstructL();
       
    78 	CCommandBuffer();
       
    79 	
       
    80 	// Help methods
       
    81 	void Tidy();
       
    82 	TBool AllSectionsExternalized() const; 
       
    83 	TBool CheckForDuplicate(const CDrawSection& aDrawSection) const;
       
    84 	void UpdateClippingRegion(TInt aDrawSectionIndex);
       
    85 	// Reading writing
       
    86 	void Write(const TUint8* aSrc, TUint aLength);	
       
    87 	void DoWriteTextL(const TDesC8 &aText);	
       
    88 	void ReadL(TUint8* aDest, TUint aLength);
       
    89 	template<typename TClass> void ReadL(TClass& aValue);	
       
    90 	void ReadTextLC(TPtrC8& aText);
       
    91 	void ReadTextLC(TPtrC16& aText);
       
    92 	void DoReadTextLC(TPtrC8& aText,TBool a16Bit);
       
    93 	
       
    94 	// Drawing the commands
       
    95 #ifdef SYMBIAN_GRAPHICS_GCE
       
    96 	template<typename ContextType> void DoPlayL(const MWsGraphicResolver& aWsGraphicResolver, ContextType& aGraphicsContext);
       
    97 	template<typename ContextType> void DrawSectionL(const CDrawSection& aDrawSection, const MWsGraphicResolver& aWsGraphicResolver, ContextType& aGraphicsContext);
       
    98 #else
       
    99 	void DoPlayL(const MWsGraphicResolver& aWsGraphicResolver, CBitmapContext& aBitmapContext);
       
   100 	void DrawSectionL(const CDrawSection& aDrawSection, const MWsGraphicResolver& aWsGraphicResolver, CBitmapContext& aBitmapContext);
       
   101 #endif
       
   102 #if defined(SYMBIAN_GRAPHICS_GCE)
       
   103 	template<typename ContextType> void Clear(ContextType& aGraphicsContext) const;
       
   104 	template<typename ContextType> void ClearRectL(ContextType& aGraphicsContext);
       
   105 	template<typename ContextType> void CopyRectL(ContextType& aGraphicsContext);
       
   106 	template<typename ContextType> void BitBlt1L(ContextType& aGraphicsContext);
       
   107 	void DoBitBlt1L(CWindowGc& aWindowGc, TPoint aPoint, TInt aHandle);
       
   108 	void DoBitBlt1L(MWsGraphicsContext& aGraphicsContext, TPoint aPoint, TInt aHandle);
       
   109 	template<typename ContextType> void BitBlt2L(ContextType& aGraphicsContext);
       
   110 	void DoBitBlt2L(CWindowGc& aWindowGc, TPoint aPoint, TInt aHandle, TRect aSourceRect);
       
   111 	void DoBitBlt2L(MWsGraphicsContext& aGraphicsContext, TPoint aPoint, TInt aHandle, TRect aSourceRect);
       
   112 	template<typename ContextType> void BitBltMaskedL(ContextType& aGraphicsContext);
       
   113 	void DoBitBltMaskedL(CWindowGc& aWindowGc, TPoint aPoint, TInt aBitmapHandle, TRect aSourceRect, TInt aMaskHandle, TBool aInvertMask);
       
   114 	void DoBitBltMaskedL(MWsGraphicsContext& aGraphicsContext, TPoint aPoint, TInt aBitmapHandle, TRect aSourceRect, TInt aMaskHandle, TBool aInvertMask);
       
   115 	void SetFadedL(CWindowGc& aWindowGc);
       
   116 	void SetFadingParametersL(CWindowGc& aWindowGc);
       
   117 	template<typename ContextType> void AlphaBlendBitmapsL(ContextType& aGraphicsContext);
       
   118 	void DoAlphaBlendBitmapsL(CWindowGc& aWindowGc, TPoint aDestPoint, TInt aSrcHandle, TRect aSourceRect, TInt aAlphaHandle, TPoint aAlphaPoint);
       
   119 	void DoAlphaBlendBitmapsL(MWsGraphicsContext& aGraphicsContext, TPoint aDestPoint, TInt aSrcHandle, TRect aSourceRect, TInt aAlphaHandle, TPoint aAlphaPoint);
       
   120 	template<typename ContextType> void SetOriginL(ContextType& aGraphicsContext);
       
   121 	template<typename ContextType> void SetDrawModeL(ContextType& aGraphicsContext);
       
   122 	void DoSetDrawModeL(CWindowGc& aWindowGc, CGraphicsContext::TDrawMode aDrawMode);
       
   123 	void DoSetDrawModeL(MWsGraphicsContext& aGraphicsContext, CGraphicsContext::TDrawMode aDrawMode);
       
   124 	template<typename ContextType> void SetClippingRectL(ContextType& aGraphicsContext);
       
   125 	template<typename ContextType> void CancelClippingRect(ContextType& aGraphicsContext);
       
   126 	void Reset(CWindowGc& aWindowGc);
       
   127 	void Reset(MWsGraphicsContext& aGraphicsContext);
       
   128 	template<typename ContextType> void UseFontL(ContextType& aGraphicsContext);
       
   129 	void DoUseFontL(CWindowGc& aWindowGc, TInt aFontHandle);
       
   130 	void DoUseFontL(MWsGraphicsContext& aGraphicsContext, TInt aFontHandle);
       
   131 	void DiscardFont(CWindowGc& aWindowGc) const;
       
   132 	void DiscardFont(MWsGraphicsContext& aGraphicsContext) const;
       
   133 	template<typename ContextType> void SetUnderlineStyleL(ContextType& aGraphicsContext);
       
   134 	void DoSetUnderlineStyleL(CWindowGc& aWindowGc, TFontUnderline aUnderlineStyle);
       
   135 	void DoSetUnderlineStyleL(MWsGraphicsContext& aGraphicsContext, TFontUnderline aUnderlineStyle);
       
   136 	template<typename ContextType> void SetStrikethroughStyleL(ContextType& aGraphicsContext);
       
   137 	void DoSetStrikethroughStyleL(CWindowGc& aWindowGc, TFontStrikethrough aStrikethroughStyle);
       
   138 	void DoSetStrikethroughStyleL(MWsGraphicsContext& aGraphicsContext, TFontStrikethrough aStrikethroughStyle);
       
   139 	template<typename ContextType> void SetWordJustificationL(ContextType& aGraphicsContext);
       
   140 	template<typename ContextType> void SetCharJustificationL(ContextType& aGraphicsContext);
       
   141 	template<typename ContextType> void SetPenColorL(ContextType& aGraphicsContext);
       
   142 	template<typename ContextType> void SetPenStyleL(ContextType& aGraphicsContext);
       
   143 	void DoSetPenStyleL(CWindowGc& aWindowGc, CGraphicsContext::TPenStyle aPenStyle);
       
   144 	void DoSetPenStyleL(MWsGraphicsContext& aGraphicsContext, CGraphicsContext::TPenStyle aPenStyle);
       
   145 	template<typename ContextType> void SetPenSizeL(ContextType& aGraphicsContext);
       
   146 	void DoSetPenSizeL(CWindowGc& aWindowGc, TSize aSize);
       
   147 	void DoSetPenSizeL(MWsGraphicsContext& aGraphicsContext, TSize aSize);
       
   148 	template<typename ContextType> void SetBrushColorL(ContextType& aGraphicsContext);
       
   149 	template<typename ContextType> void SetBrushStyleL(ContextType& aGraphicsContext);
       
   150 	void DoSetBrushStyleL(CWindowGc& aWindowGc, CGraphicsContext::TBrushStyle aBrushStyle);
       
   151 	void DoSetBrushStyleL(MWsGraphicsContext& aGraphicsContext, CGraphicsContext::TBrushStyle aBrushStyle);
       
   152 	template<typename ContextType> void SetBrushOriginL(ContextType& aGraphicsContext);
       
   153 	template<typename ContextType> void UseBrushPatternL(ContextType& aGraphicsContext);
       
   154 	void DoUseBrushPatternL(CWindowGc& aWindowGc, TInt aDeviceHandle);
       
   155 	void DoUseBrushPatternL(MWsGraphicsContext& aGraphicsContext, TInt aDeviceHandle);
       
   156 	void DiscardBrushPattern(CWindowGc& aWindowGc) const;
       
   157 	void DiscardBrushPattern(MWsGraphicsContext& aGraphicsContext) const;
       
   158 	template<typename ContextType> void MoveToL(ContextType& aGraphicsContext);
       
   159 	template<typename ContextType> void MoveByL(ContextType& aGraphicsContext);
       
   160 	template<typename ContextType> void PlotL(ContextType& aGraphicsContext);
       
   161 	template<typename ContextType> void DrawArcL(ContextType& aGraphicsContext);
       
   162 	template<typename ContextType> void DrawLineL(ContextType& aGraphicsContext);
       
   163 	template<typename ContextType> void DrawLineToL(ContextType& aGraphicsContext);
       
   164 	template<typename ContextType> void DrawLineByL(ContextType& aGraphicsContext);
       
   165 	void DrawPolyLineL(CWindowGc& aWindowGc);
       
   166 	void DrawPolyLineL(MWsGraphicsContext& aGraphicsContext);
       
   167 	template<typename ContextType> void DrawPieL(ContextType& aGraphicsContext);
       
   168 	template<typename ContextType> void DrawEllipseL(ContextType& aGraphicsContext);
       
   169 	template<typename ContextType> void DrawRectL(ContextType& aGraphicsContext);
       
   170 	template<typename ContextType> void DrawRoundRectL(ContextType& aGraphicsContext);
       
   171 	void DrawPolygonL(CWindowGc& aWindowGc);
       
   172 	void DrawPolygonL(MWsGraphicsContext& aGraphicsContext);
       
   173 	void DrawBitmap1L(CWindowGc& aWindowGc);
       
   174 	void DrawBitmap1L(MWsGraphicsContext& aGraphicsContext);
       
   175 	template<typename ContextType> void DrawBitmap2L(ContextType& aGraphicsContext);
       
   176 	void DoDrawBitmap2L(CWindowGc& aWindowGc, TRect aDestRect, TInt aBitmapHandle);
       
   177 	void DoDrawBitmap2L(MWsGraphicsContext& aGraphicsContext, TRect aDestRect, TInt aBitmapHandle);
       
   178 	template<typename ContextType> void DrawBitmap3L(ContextType& aGraphicsContext);
       
   179 	void DoDrawBitmap3L(CWindowGc& aWindowGc, TRect aDestRect, TInt aBitmapHandle, TRect aSourceRect);
       
   180 	void DoDrawBitmap3L(MWsGraphicsContext& aGraphicsContext, TRect aDestRect, TInt aBitmapHandle, TRect aSourceRect);
       
   181 	template<typename ContextType> void DrawBitmapMaskedL(ContextType& aGraphicsContext);
       
   182 	void DoDrawBitmapMaskedL(CWindowGc& aWindowGc, TRect aDestRect, TInt aBitmapHandle, TRect aSourceRect, TInt aMaskHandle, TBool aInvertedMask);
       
   183 	void DoDrawBitmapMaskedL(MWsGraphicsContext& aGraphicsContext, TRect aDestRect, TInt aBitmapHandle, TRect aSourceRect, TInt aMaskHandle, TBool aInvertedMask);
       
   184 	template<typename ContextType> void DrawText1L(ContextType& aGraphicsContext);
       
   185 	void DoDrawText1L(CWindowGc& aWindowGc, TPtrC16 aText, TPoint aPoint);
       
   186 	void DoDrawText1L(MWsGraphicsContext& aGraphicsContext, TPtrC16 aText, TPoint aPoint);
       
   187 	template<typename ContextType> void DrawText2L(ContextType& aGraphicsContext);
       
   188 	void DoDrawText2L(CWindowGc& aWindowGc, TPtrC16 aText, TRect aBox, TInt aBaselineOffset, CGraphicsContext::TTextAlign aHoriz, TInt aLeftMargin);
       
   189 	void DoDrawText2L(MWsGraphicsContext& aGraphicsContext, TPtrC16 aText, TRect aBox, TInt aBaselineOffset, CGraphicsContext::TTextAlign aHoriz, TInt aLeftMargin);
       
   190 	template<typename ContextType> void DrawText3L(ContextType& aGraphicsContext);
       
   191 	void DoDrawText3L(CWindowGc& aWindowGc, TPtrC16 aText, TPoint aPoint);
       
   192 	void DoDrawText3L(MWsGraphicsContext& aGraphicsContext, TPtrC16 aText, TPoint aPoint);
       
   193 	template<typename ContextType> void DrawText4L(ContextType& aGraphicsContext);
       
   194 	void DoDrawText4L(CWindowGc& aWindowGc, TPtrC16 aText, CGraphicsContext::TTextParameters aParam, TPoint aPoint);
       
   195 	void DoDrawText4L(MWsGraphicsContext& aGraphicsContext, TPtrC16 aText, CGraphicsContext::TTextParameters aParam, TPoint aPoint);
       
   196 	template<typename ContextType> void DrawText5L(ContextType& aGraphicsContext);
       
   197 	void DoDrawText5L(CWindowGc& aWindowGc, TPtrC16 aText, CGraphicsContext::TTextParameters aParam, TRect aBox, TInt aBaselineOffset, CGraphicsContext::TTextAlign aHoriz, TInt aLeftMargin);
       
   198 	void DoDrawText5L(MWsGraphicsContext& aGraphicsContext, TPtrC16 aText, CGraphicsContext::TTextParameters aParam, TRect aBox, TInt aBaselineOffset, CGraphicsContext::TTextAlign aHoriz, TInt aLeftMargin);
       
   199 	template<typename ContextType> void MapColorsL(ContextType& aGraphicsContext);
       
   200 	template<typename ContextType> void SetClippingRegionL(ContextType& aGraphicsContext);
       
   201 	template<typename ContextType> void CancelClippingRegion(ContextType& aGraphicsContext);
       
   202 	void DoCancelClippingRegion(CWindowGc& aWindowGc);
       
   203 	void DoCancelClippingRegion(MWsGraphicsContext& aGraphicsContext);
       
   204 	template<typename ContextType> void DrawTextVertical1L(ContextType& aGraphicsContext);
       
   205 	void DoDrawTextVertical1L(CWindowGc& aWindowGc, TPtrC16 aText, TPoint aPoint, TBool aUp);
       
   206 	void DoDrawTextVertical1L(MWsGraphicsContext& aGraphicsContext, TPtrC16 aText, TPoint aPoint, TBool aUp);
       
   207 	template<typename ContextType> void DrawTextVertical2L(ContextType& aGraphicsContext);
       
   208 	void DoDrawTextVertical2L(CWindowGc& aWindowGc, TPtrC16 aText, TRect aBox, TInt aBaselineOffset, TBool aUp, CGraphicsContext::TTextAlign aVertical, TInt aMargin);
       
   209 	void DoDrawTextVertical2L(MWsGraphicsContext& aGraphicsContext, TPtrC16 aText, TRect aBox, TInt aBaselineOffset, TBool aUp, CGraphicsContext::TTextAlign aVertical, TInt aMargin);
       
   210 	template<typename ContextType> void DrawTextVertical3L(ContextType& aGraphicsContext);
       
   211 	void DoDrawTextVertical3L(CWindowGc& aWindowGc, TPtrC16 aText, CGraphicsContext::TTextParameters aParam, TPoint aPoint, TBool aUp);
       
   212 	void DoDrawTextVertical3L(MWsGraphicsContext& aGraphicsContext, TPtrC16 aText, CGraphicsContext::TTextParameters aParam, TPoint aPoint, TBool aUp);
       
   213 	template<typename ContextType> void DrawTextVertical4L(ContextType& aGraphicsContext);
       
   214 	void DoDrawTextVertical4L(CWindowGc& aWindowGc, TPtrC16 aText, CGraphicsContext::TTextParameters aParam, TRect aBox, TInt aBaselineOffset, TBool aUp, CGraphicsContext::TTextAlign aVertical, TInt aMargin);
       
   215 	void DoDrawTextVertical4L(MWsGraphicsContext& aGraphicsContext, TPtrC16 aText, CGraphicsContext::TTextParameters aParam, TRect aBox, TInt aBaselineOffset, TBool aUp, CGraphicsContext::TTextAlign aVertical, TInt aMargin);
       
   216 	void DrawWsGraphic1L(const MWsGraphicResolver& aWsGraphicResolver);
       
   217 	void DrawWsGraphic2L(const MWsGraphicResolver& aWsGraphicResolver);
       
   218 	template<typename ContextType> void SetShadowColorL(ContextType& aGraphicsContext);
       
   219 	void DoSetShadowColorL(CWindowGc& aWindowGc, TRgb aShadowColor);
       
   220 	void DoSetShadowColorL(MWsGraphicsContext& aGraphicsContext, TRgb aShadowColor);
       
   221 	template<typename ContextType> void DrawResourceToPosL(ContextType& aGraphicsContext);
       
   222 	template<typename ContextType> void DrawResourceToRectL(ContextType& aGraphicsContext);
       
   223 	template<typename ContextType> void DrawResourceFromRectToRectL(ContextType& aGraphicsContext);
       
   224 	template<typename ContextType> void DrawResourceWithDataL(ContextType& aGraphicsContext);
       
   225 	void DoDrawResourceToPos(CWindowGc& aGraphicsContext, const TAny* aDrawableSource, const TPoint& aPos, CWindowGc::TGraphicsRotation aRotation);
       
   226 	void DoDrawResourceToRect(CWindowGc& aGraphicsContext, const TAny* aDrawableSource, const TRect& aRect, CWindowGc::TGraphicsRotation aRotation);
       
   227 	void DoDrawResourceFromRectToRect(CWindowGc& aGraphicsContext, const TAny* aDrawableSource, const TRect& aRectDest, const TRect& aRectSrc, CWindowGc::TGraphicsRotation aRotation);
       
   228 	void DoDrawResourceWithData(CWindowGc& aGraphicsContext, const TAny* aDrawableSource, const TRect& aRect, const TDesC8& aParam);
       
   229 	void DoDrawResourceToPos(MWsGraphicsContext& aGraphicsContext, const TAny* aDrawableSource, const TPoint& aPos, CWindowGc::TGraphicsRotation aRotation);
       
   230 	void DoDrawResourceToRect(MWsGraphicsContext& aGraphicsContext, const TAny* aDrawableSource, const TRect& aRect, CWindowGc::TGraphicsRotation aRotation);
       
   231 	void DoDrawResourceFromRectToRect(MWsGraphicsContext& aGraphicsContext, const TAny* aDrawableSource, const TRect& aRectDest, const TRect& aRectSrc, CWindowGc::TGraphicsRotation aRotation);
       
   232 	void DoDrawResourceWithData(MWsGraphicsContext& aGraphicsContext, const TAny* aDrawableSource, const TRect& aRect, const TDesC8& aParam);
       
   233 #else //SYMBIAN_GRAPHICS_GCE
       
   234 	void Clear(CBitmapContext& aBitmapContext) const;
       
   235 	void ClearRectL(CBitmapContext& aBitmapContext);	
       
   236 	void CopyRectL(CBitmapContext& aBitmapContext);
       
   237 	void BitBlt1L(CBitmapContext& aBitmapContext);
       
   238 	void BitBlt2L(CBitmapContext& aBitmapContext);
       
   239 	void BitBltMaskedL(CBitmapContext& aBitmapContext);
       
   240 	void SetFadedL(CBitmapContext& aBitmapContext);
       
   241 	void SetFadingParametersL(CBitmapContext& aBitmapContext);
       
   242 	void AlphaBlendBitmapsL(CBitmapContext& aBitmapContext);
       
   243 	void SetOriginL(CBitmapContext& aBitmapContext);
       
   244 	void SetDrawModeL(CBitmapContext& aBitmapContext);
       
   245 	void SetClippingRectL(CBitmapContext& aBitmapContext);
       
   246 	void CancelClippingRect(CBitmapContext& aBitmapContext);
       
   247 	void Reset(CBitmapContext& aBitmapContext);
       
   248 	void UseFontL(CBitmapContext& aBitmapContext);
       
   249 	void DiscardFont(CBitmapContext& aBitmapContext) const;
       
   250 	void SetUnderlineStyleL(CBitmapContext& aBitmapContext);
       
   251 	void SetStrikethroughStyleL(CBitmapContext& aBitmapContext);
       
   252 	void SetWordJustificationL(CBitmapContext& aBitmapContext);	
       
   253 	void SetCharJustificationL(CBitmapContext& aBitmapContext);
       
   254 	void SetPenColorL(CBitmapContext& aBitmapContext);
       
   255 	void SetPenStyleL(CBitmapContext& aBitmapContext);
       
   256 	void SetPenSizeL(CBitmapContext& aBitmapContext);
       
   257 	void SetBrushColorL(CBitmapContext& aBitmapContext);
       
   258 	void SetBrushStyleL(CBitmapContext& aBitmapContext);
       
   259 	void SetBrushOriginL(CBitmapContext& aBitmapContext);
       
   260 	void UseBrushPatternL(CBitmapContext& aBitmapContext);
       
   261 	void DiscardBrushPattern(CBitmapContext& aBitmapContext) const;
       
   262 	void MoveToL(CBitmapContext& aBitmapContext);
       
   263 	void MoveByL(CBitmapContext& aBitmapContext);
       
   264 	void PlotL(CBitmapContext& aBitmapContext);
       
   265 	void DrawArcL(CBitmapContext& aBitmapContext);
       
   266 	void DrawLineL(CBitmapContext& aBitmapContext);
       
   267 	void DrawLineToL(CBitmapContext& aBitmapContext);
       
   268 	void DrawLineByL(CBitmapContext& aBitmapContext);
       
   269 	void DrawPolyLineL(CBitmapContext& aBitmapContext);
       
   270 	void DrawPieL(CBitmapContext& aBitmapContext);
       
   271 	void DrawEllipseL(CBitmapContext& aBitmapContext);
       
   272 	void DrawRectL(CBitmapContext& aBitmapContext);
       
   273 	void DrawRoundRectL(CBitmapContext& aBitmapContext);
       
   274 	void DrawPolygonL(CBitmapContext& aBitmapContext);
       
   275 	void DrawBitmap1L(CBitmapContext& aBitmapContext);
       
   276 	void DrawBitmap2L(CBitmapContext& aBitmapContext);
       
   277 	void DrawBitmap3L(CBitmapContext& aBitmapContext);
       
   278 	void DrawBitmapMaskedL(CBitmapContext& aBitmapContext);
       
   279 	void DrawText1L(CBitmapContext& aBitmapContext);
       
   280 	void DrawText2L(CBitmapContext& aBitmapContext);
       
   281 	void DrawText3L(CBitmapContext& aBitmapContext);
       
   282 	void MapColorsL(CBitmapContext& aBitmapContext);
       
   283 	void SetClippingRegionL(CBitmapContext& aBitmapContext);
       
   284 	void CancelClippingRegion(CBitmapContext& aBitmapContext);
       
   285 	void DrawTextVertical1L(CBitmapContext& aBitmapContext);
       
   286 	void DrawTextVertical2L(CBitmapContext& aBitmapContext);
       
   287 	void DrawWsGraphic1L(const MWsGraphicResolver& aWsGraphicResolver);
       
   288 	void DrawWsGraphic2L(const MWsGraphicResolver& aWsGraphicResolver);
       
   289 	void SetShadowColorL(CBitmapContext& aBitmapContext);
       
   290 #endif //SYMBIAN_GRAPHICS_GCE
       
   291 private:
       
   292 	// Values set by the system calling play
       
   293 	TPoint iMasterOrigin;
       
   294 	const TRegion * iMasterClippingRegion;
       
   295 	const TRegion * iActiveMasterClippingRegion;
       
   296 	
       
   297 	RRegionBuf<10> iDrawSectionClippingRegion;
       
   298 	TRect iMasterClippingRect;
       
   299 	TRect iDrawSectionRect;
       
   300 	
       
   301 	// Values set by the draw commands executed during play
       
   302 	TPoint iOrigin;
       
   303 	RRegionBuf<10> iClippingRegion;
       
   304 	TRect iClippingRect;
       
   305 	TBool iParsedClippingRegionIsSet;
       
   306 	
       
   307 #ifndef SYMBIAN_GRAPHICS_GCE 
       
   308 	TPoint iOffSet; //only used by nonnga in order to preserve compatibility with nga
       
   309 	RRegionBuf<10> iCurrentSectionClippingRegion; //only used by nonnga in order to preserve compatibility with nga
       
   310 #else
       
   311 	RRegion iIntersectedRegion;
       
   312 	CDrawableCacheBase* iDrawableCache;
       
   313 #endif
       
   314 	
       
   315 	TInt iError;		
       
   316 	CBufBase* iRecordSegBuf;
       
   317 	CBitmapCache* iBitmapCache;
       
   318 	CFontsCache* iFontCache;	
       
   319 	CBufBase* iBufRead;
       
   320 	RBufReadStream iBufReadStream;
       
   321 	RPointerArray<CDrawSection> iDrawSections;
       
   322 	};
       
   323 
       
   324 template<typename TClass> void CCommandBuffer::Write(const TClass& aValue)
       
   325 	{
       
   326 	__ASSERT_COMPILE(sizeof(TClass) <= KMaxTUint8);
       
   327 	
       
   328 	#ifdef _DEBUG
       
   329 		const TUint8 size = sizeof(TClass);
       
   330 		Write(reinterpret_cast<const TUint8*>(&size), 1);
       
   331 	#endif
       
   332 
       
   333 	Write(reinterpret_cast<const TUint8*>(&aValue), sizeof(TClass));
       
   334 	}
       
   335 	
       
   336 template<typename TClass> void CCommandBuffer::ReadL(TClass& aValue)
       
   337 	{
       
   338 	__ASSERT_COMPILE(sizeof(TClass) <= KMaxTUint8);	
       
   339 	
       
   340 	#ifdef _DEBUG
       
   341 		TUint8 size = 0;
       
   342 		ReadL(reinterpret_cast<TUint8*>(&size), 1);
       
   343 		ASSERT(sizeof(TClass) == size);
       
   344 	#endif
       
   345 
       
   346 	ReadL(reinterpret_cast<TUint8*>(&aValue), sizeof(TClass));	
       
   347 	}
       
   348 	
       
   349 #endif	// __COMMANDBUFFER_H__