sl@0: // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // CWsGc and associated classes definitions sl@0: // sl@0: // sl@0: sl@0: #ifndef __GC_H__ sl@0: #define __GC_H__ sl@0: sl@0: #include "wnredraw.h" sl@0: #include "cliwin.h" sl@0: #include "graphicscontextstate.h" sl@0: sl@0: class CWsFbsFont; sl@0: sl@0: class CWsGc : public CWsObject sl@0: { sl@0: enum {ETextPtrBufLen=0x100}; // Buffer of TText, used on stack sl@0: // Functions sl@0: public: sl@0: static CWsGc* NewL(CWsClient *aOwner); sl@0: ~CWsGc(); sl@0: static void InitStaticsL(); sl@0: static void DeleteStatics(); sl@0: void CommandL(TInt aOpcode, const TAny *aCmdData); sl@0: void Deactivate(); sl@0: inline void SetNextWinGc(CWsGc *aGc); sl@0: inline CWsGc *NextWinGc() const; sl@0: TInt ExternalizeL(CBufBase& aBuffer, TInt aStartPos); sl@0: TInt ExternalizeClippingRegionL(RWriteStream& aWriteStreem); sl@0: TInt FbsBitmapHandle(TInt aOpcode, const TWsGcCmdUnion &pData, TInt& aMaskHandle); sl@0: TInt WsBitmapHandle(TInt aOpcode, const TWsGcCmdUnion &pData, TInt& aMaskHandle); sl@0: TInt WsDrawableSourceHandle(TInt aOpcode, const TWsGcCmdUnion &aData); sl@0: void Reactivate(); sl@0: private: sl@0: CWsGc(CWsClient *aOwner); sl@0: void ConstructL(); sl@0: void Activate(CWsClientWindow *win); sl@0: void DoDrawing2(TWsGcOpcodes aOpcode, const TWsGcCmdUnion &pData); sl@0: void SetGcAttribute(TInt aOpcode, TWsGcCmdUnion pData); sl@0: void SetOrigin(const TPoint &aOrigin); sl@0: sl@0: void DoDrawing0L(TWsGcOpcodes aOpcode, const TWsGcCmdUnion &pData); sl@0: void DoDrawing1(TWsGcOpcodes aOpcode, const TWsGcCmdUnion &pData); sl@0: void Activate(const TInt &aHandle); sl@0: void DoDrawCommand(TWsGcOpcodes aOpcode, const TWsGcCmdUnion &pData); sl@0: void SetClippingRegionL(TInt aCountRegion); sl@0: void SetClippingRect(const TRect &aRect); sl@0: void CancelClippingRegion(); sl@0: void DoDrawPolygon(const TWsGcCmdDrawPolygon *aDrawPolygon); sl@0: void DoDrawPolyLine(const TWsGcCmdDrawPolyLine *aDrawPolyLine, TBool aContinued); sl@0: void GcOwnerPanic(TClientPanic aPanic); sl@0: void ResetClippingRect(); sl@0: void EndSegmentedPolygon(); sl@0: void StartSegmentedDrawPolygonL(const TWsGcCmdStartSegmentedDrawPolygon* aDrawPolygon); sl@0: void SegmentedDrawPolygonData(const TWsGcCmdSegmentedDrawPolygonData* aDrawPolygon); sl@0: void UpdateJustification(TText* aText,TInt aLen); sl@0: void UpdateJustification(TText* aText,TInt aLen,CGraphicsContext::TTextParameters* aParam); sl@0: #if defined(_DEBUG) sl@0: inline TBool IsPolyPointData() {return(iPolyPointListSize>0 || iPolyPoints!=NULL);} sl@0: #endif sl@0: void ExternalizeAlphaValueL(RWriteStream& aWriteStream); sl@0: TPtrC BufferTPtr(TText* aStart,TInt aLen); sl@0: void CheckPolyData(const TAny* aDataPtr, TInt aHeaderSize, TInt aNumPoints); sl@0: // Data sl@0: private: sl@0: CFbsBitGc *iBackedUpWinGc; sl@0: CWsClientWindow *iWin; sl@0: CWsGc *iNextWinGc; sl@0: CWsFbsFont *iFont; sl@0: RWsRegion* iUserDefinedClippingRegion; //Clipping region that is set explicitly by the user. sl@0: TRect iClippingRect; // All drawing clipped to this rectangle in addition to other clipping sl@0: TBool iClippingRectSet; // ETrue if the iClippingRect is in use sl@0: TPoint iOrigin; // User defined origin, relative to the top left of the window sl@0: TPoint iLinePos; // Current line position for LineBy, LineTo etc sl@0: TPoint *iPolyPoints; sl@0: TInt iPolyPointListSize; sl@0: //member used for storing graphics context data for Internalize/Externalize sl@0: TInternalGcStatus iInternalStatus; sl@0: // static variables sl@0: static CFbsBitmap *iScratchBitmap; sl@0: static CFbsBitmap *iScratchMaskBitmap; sl@0: }; sl@0: sl@0: inline void CWsGc::SetNextWinGc(CWsGc *aGc) sl@0: { sl@0: iNextWinGc=aGc; sl@0: } sl@0: sl@0: inline CWsGc *CWsGc::NextWinGc() const sl@0: { sl@0: return(iNextWinGc); sl@0: } sl@0: sl@0: #endif