graphicsdeviceinterface/bitgdi/tbit/TClip.h
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 2003-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 __TCLIP_H__
       
    17 #define __TCLIP_H__
       
    18 
       
    19 #include "TGraphicsHarness.h"
       
    20 
       
    21 #define testtext _L("Test text")
       
    22 #define largetesttext _L("W")
       
    23 
       
    24 class CTClipStep;
       
    25 
       
    26 class CTClip : public CTGraphicsBase
       
    27 	{
       
    28 public:
       
    29 	enum TGraphicsOps
       
    30 		{
       
    31 	EFirstGop,
       
    32 		EPlot,
       
    33 		EDrawLine,
       
    34 		EDottedLine,
       
    35 		EDashedLine,
       
    36 		EWideLine,
       
    37 		EDrawArc,
       
    38 		EDottedArc,
       
    39 		EDrawRect,
       
    40 		EVerticalHatchRect,
       
    41 		EForwardDiagonalHatchRect,
       
    42 		EHorizontalHatchRect,
       
    43 		ERearwardDiagonalHatchRect,
       
    44 		ESquareCrossHatchRect,
       
    45 		EDiamondCrossHatchRect,
       
    46 		EVerticalHatchEllipse,
       
    47 		EForwardDiagonalHatchEllipse,
       
    48 		EHorizontalHatchEllipse,
       
    49 		ERearwardDiagonalHatchEllipse,
       
    50 		ESquareCrossHatchEllipse,
       
    51 		EDiamondCrossHatchEllipse,
       
    52 		EDottedRect,
       
    53 		ECopyRect,
       
    54 		EDrawEllipse,
       
    55 		EDottedEllipse,
       
    56 		EDrawRoundRect,
       
    57 		EDottedRoundRect,
       
    58 		EDrawPie,
       
    59 		EDottedPie,
       
    60 		EDrawPolygon,
       
    61 		EDrawText,
       
    62 		EBoxText,
       
    63 		EDrawTextVertical,
       
    64 		ELargeText,
       
    65 		ELargeBoxText,
       
    66 		ELargeTextVertical,
       
    67 		EPaintRect,
       
    68 		EBitBltContext,
       
    69 		EBitBltBitmap,
       
    70 		EBitBltMasked,
       
    71 		EDrawBitmap,
       
    72 		EBitmapLarge,
       
    73 		EBitmapSmall,
       
    74 		EBitBltMaskedBinary,
       
    75 		EBitBltMaskedBinary64K,
       
    76 		EBitBltMaskedBinary16MU,
       
    77 		EBitBltMaskedAlpha,
       
    78 		EBitBltMaskedAlpha64K,
       
    79 		EBitBltMaskedAlpha16MU,
       
    80 		EBitBltMaskedAlpha16MA,
       
    81 		EBitBltMaskedBinary16MA,
       
    82 	EGraphicsOps,
       
    83 	ETerminator
       
    84 		};
       
    85 	enum TTestConsts
       
    86 		{
       
    87 		ERegions=10
       
    88 		};
       
    89 	enum TColors
       
    90 		{
       
    91 		EForeground=0,
       
    92 		EBackground=0xff
       
    93 		};
       
    94 public:
       
    95 	CTClip(CTestStep* aStep,
       
    96 			TInt aTestAppNo,
       
    97 			CFbsScreenDevice* aDev,
       
    98 			CFbsBitGc* aCon,
       
    99 			CFbsBitmap* aBmp,
       
   100 			CFbsFont* aFont,
       
   101 			CFbsFont* aLargeFont);
       
   102 	~CTClip();
       
   103 	void TestRectRgn();
       
   104 	void TestHoriRgn();
       
   105 	void TestVertRgn();
       
   106 	void TestSimpleRgn();
       
   107 	void TestComplexRgn();
       
   108 	void ScanArea(TInt,TInt,TInt,TInt);
       
   109 	void CheckInside(const TRect&,const TRect&);
       
   110 	void Clear();
       
   111 protected:
       
   112 //from 	CTGraphicsStep
       
   113 	virtual void RunTestCaseL(TInt aCurTestCase);
       
   114 	void ConstructL();
       
   115 private:
       
   116 	void DrawToScreen(TRegion& aClipReg,TRect aRect);
       
   117 	void DrawToScreen(const TRect& aClipRect,TRect aRect);
       
   118 	void DoDraw(TRect aRect,TBool aClipped);
       
   119 	void Message(const TDesC& aMessage);
       
   120 	TBool SetUpTest(TInt &aTestMode);
       
   121 	inline CTClipStep* Step();
       
   122 private:
       
   123 	TInt iTestAppNo;
       
   124 	CFbsScreenDevice* iDev;
       
   125 	CFbsBitGc* iCon;
       
   126 	TRect iClientRect;
       
   127 	TInt iGopNum;
       
   128 	TRect* iClipList;
       
   129 	TInt iTestSection;
       
   130 	CFbsBitmap* iBitmap;
       
   131 	CFbsBitmap* iBitmap64K;
       
   132 	CFbsBitmap* iBitmap16MU;
       
   133 	CFbsBitmap* iBitmap16MA;
       
   134 	CFbsBitmap* iBitmapMask;
       
   135 	CFbsBitmap* iBitmapAlpha;
       
   136 	CFbsFont* iFont;
       
   137 	CFbsFont* iLargeFont;
       
   138 	TSize iBmpSize;
       
   139 	};
       
   140 
       
   141 GLREF_C	void CreateTestEnvironment(CFbsScreenDevice*& aDev, CFbsBitGc*& aGc, 
       
   142 								   CFbsFont*& aFont, CFbsFont*& aLargeFont);
       
   143 GLREF_C	void DestroyTestEnvironment(CFbsScreenDevice* aDev, CFbsBitGc* aGc, 
       
   144 								   CFbsFont* aFont, CFbsFont* aLargeFont);
       
   145 
       
   146 
       
   147 class CTClipStep : public CTGraphicsStep
       
   148 	{
       
   149 public:
       
   150 	CTClipStep();
       
   151 	~CTClipStep();
       
   152 	inline TBool IgnoreDiffs();
       
   153 protected:	
       
   154 	//from CTGraphicsStep
       
   155 	virtual CTGraphicsBase* CreateTestL();
       
   156 	virtual void TestSetupL();
       
   157 	virtual void TestClose();
       
   158 private:
       
   159 	TInt CreateScreenDevice(TDisplayMode aMode);
       
   160 	void CreateTestEnvironment();
       
   161 	void DestroyTestEnvironment();
       
   162 protected:
       
   163 	TInt iTestAppNo;
       
   164 private:
       
   165 	CFbsScreenDevice* iDev;
       
   166 	CFbsBitGc* iGc;
       
   167 	CFbsFont* iFont;
       
   168 	CFbsFont* iLargeFont;
       
   169 	CFbsBitmap* iBmp;
       
   170 	TBool iIgnoreDiffs;
       
   171 	};
       
   172 
       
   173 class CTClip2Step : public CTClipStep
       
   174 	{
       
   175 public:
       
   176 	CTClip2Step();
       
   177 	};
       
   178 
       
   179 _LIT(KTClipStep,"TClip");
       
   180 _LIT(KTClip2Step,"TClip2");
       
   181 
       
   182 #endif//__TCLIP_H_