windowing/windowserver/nga/SERVER/gc.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 // CWsGc and associated classes definitions
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __GC_H__
       
    19 #define __GC_H__
       
    20 
       
    21 #include "wnredraw.h"
       
    22 #include "cliwin.h"
       
    23 #include "graphicscontextstate.h"
       
    24 
       
    25 class CWsFbsFont;
       
    26 
       
    27 class CWsGc : public CWsObject
       
    28 	{
       
    29 	enum {ETextPtrBufLen=0x100};	// Buffer of TText, used on stack
       
    30 // Functions
       
    31 public:
       
    32 	static CWsGc* NewL(CWsClient *aOwner);
       
    33 	~CWsGc();
       
    34 	static void InitStaticsL();
       
    35 	static void DeleteStatics();
       
    36 	void CommandL(TInt aOpcode, const TAny *aCmdData);
       
    37 	void Deactivate();
       
    38 	inline void SetNextWinGc(CWsGc *aGc);
       
    39 	inline CWsGc *NextWinGc() const;
       
    40 	TInt ExternalizeL(CBufBase& aBuffer, TInt aStartPos);
       
    41 	TInt ExternalizeClippingRegionL(RWriteStream& aWriteStreem);
       
    42 	TInt FbsBitmapHandle(TInt aOpcode, const TWsGcCmdUnion &pData, TInt& aMaskHandle);
       
    43 	TInt WsBitmapHandle(TInt aOpcode, const TWsGcCmdUnion &pData, TInt& aMaskHandle);
       
    44 	TInt WsDrawableSourceHandle(TInt aOpcode, const TWsGcCmdUnion &aData);
       
    45 	void Reactivate();
       
    46 private:
       
    47 	CWsGc(CWsClient *aOwner);
       
    48 	void ConstructL();
       
    49 	void Activate(CWsClientWindow *win);
       
    50 	void DoDrawing2(TWsGcOpcodes aOpcode, const TWsGcCmdUnion &pData);
       
    51 	void SetGcAttribute(TInt aOpcode, TWsGcCmdUnion pData);
       
    52 	void SetOrigin(const TPoint &aOrigin);
       
    53 
       
    54 	void DoDrawing0L(TWsGcOpcodes aOpcode, const TWsGcCmdUnion &pData);
       
    55 	void DoDrawing1(TWsGcOpcodes aOpcode, const TWsGcCmdUnion &pData);
       
    56 	void Activate(const TInt &aHandle);
       
    57 	void DoDrawCommand(TWsGcOpcodes aOpcode, const TWsGcCmdUnion &pData);
       
    58 	void SetClippingRegionL(TInt aCountRegion);
       
    59 	void SetClippingRect(const TRect &aRect);
       
    60 	void CancelClippingRegion();
       
    61 	void DoDrawPolygon(const TWsGcCmdDrawPolygon *aDrawPolygon);
       
    62 	void DoDrawPolyLine(const TWsGcCmdDrawPolyLine *aDrawPolyLine, TBool aContinued);
       
    63 	void GcOwnerPanic(TClientPanic aPanic);
       
    64 	void ResetClippingRect();
       
    65 	void EndSegmentedPolygon();
       
    66 	void StartSegmentedDrawPolygonL(const TWsGcCmdStartSegmentedDrawPolygon* aDrawPolygon);
       
    67 	void SegmentedDrawPolygonData(const TWsGcCmdSegmentedDrawPolygonData* aDrawPolygon);
       
    68 	void UpdateJustification(TText* aText,TInt aLen);
       
    69 	void UpdateJustification(TText* aText,TInt aLen,CGraphicsContext::TTextParameters* aParam);
       
    70 #if defined(_DEBUG)
       
    71 	inline TBool IsPolyPointData() {return(iPolyPointListSize>0 || iPolyPoints!=NULL);}
       
    72 #endif
       
    73 	void ExternalizeAlphaValueL(RWriteStream& aWriteStream);
       
    74 	TPtrC BufferTPtr(TText* aStart,TInt aLen);
       
    75 	void CheckPolyData(const TAny* aDataPtr, TInt aHeaderSize, TInt aNumPoints);
       
    76 // Data
       
    77 private:
       
    78 	CFbsBitGc *iBackedUpWinGc;
       
    79 	CWsClientWindow *iWin;
       
    80 	CWsGc *iNextWinGc;
       
    81 	CWsFbsFont *iFont;
       
    82 	RWsRegion* iUserDefinedClippingRegion; //Clipping region that is set explicitly by the user.
       
    83 	TRect iClippingRect;	// All drawing clipped to this rectangle in addition to other clipping
       
    84 	TBool iClippingRectSet;	// ETrue if the iClippingRect is in use
       
    85 	TPoint iOrigin;			// User defined origin, relative to the top left of the window
       
    86 	TPoint iLinePos;		// Current line position for LineBy, LineTo etc
       
    87 	TPoint *iPolyPoints;
       
    88 	TInt iPolyPointListSize;
       
    89 	//member used for storing graphics context data for Internalize/Externalize
       
    90 	TInternalGcStatus iInternalStatus;
       
    91 	// static variables
       
    92 	static CFbsBitmap *iScratchBitmap;
       
    93 	static CFbsBitmap *iScratchMaskBitmap;
       
    94 	};
       
    95 
       
    96 inline void CWsGc::SetNextWinGc(CWsGc *aGc)
       
    97 	{
       
    98 	iNextWinGc=aGc;
       
    99 	}
       
   100 
       
   101 inline CWsGc *CWsGc::NextWinGc() const
       
   102 	{
       
   103 	return(iNextWinGc);
       
   104 	}
       
   105 
       
   106 #endif