Update contrib.
1 // Copyright (c) 2005-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 @internalComponent - Internal Symbian test code
22 #ifndef __TE_GRAPHICSPERFORMANCE_STEP_BASE__
23 #define __TE_GRAPHICSPERFORMANCE_STEP_BASE__
27 #include <test/tprofiler.h>
28 #include <test/testexecutestepbase.h>
29 #include <test/ttmsgraphicsstep.h>
30 #include "te_graphicsperformanceSuiteDefs.h"
31 #include "tdisplaymode_mapping.h"
33 TSize GetPixmapSizeInPixels();
35 // Define TRgb constants to be used in test cases
36 #define TRANSPARENT_BLACK TRgb(0,0,0,0)
37 #define BLACK_SEMI_TRANSPARENT TRgb(0,0,0,0x40)
38 #define RED_SEMI_TRANSPARENT TRgb(0xff,0,0,0x40)
39 #define GREEN_SEMI_TRANSPARENT TRgb(0,0xff,0,0x40)
40 #define BLUE_SEMI_TRANSPARENT TRgb(0,0,0xff,0x40)
41 #define YELLOW_SEMI_TRANSPARENT TRgb(0xff,0xff,0,0x40)
44 Creates a virtual bitmap device if a real screen device of the specified display mode is not supported by the hardware
46 class CVirtualBitmapDevice : public CBase
49 virtual ~CVirtualBitmapDevice();
50 static CVirtualBitmapDevice* NewL(TDisplayMode aDisplayMode, TBool aForceOffscreen);
52 CBitmapDevice& BitmapDevice();
54 virtual int CreateContext(CGraphicsContext *&aGc);
55 virtual TSize SizeInPixels() const;
56 TInt isScreenDevice();
58 void ConstructL(TDisplayMode aDisplayMode, TBool aForceOffscreen);
61 CBitmapDevice* iBitmapDevice; // The virtual or real screen device
62 CFbsBitmap* iBitmap; // Virtual bitmap
63 TBool iIsScreenDevice; // ETrue if the hardware supports the screen device at the specified display mode
67 Creates a virtual bitmap device if a real screen device of the specified display mode is not supported by the hardware.
68 It is similar to CVirtualBitmapDevice but it uses CFbsDrawDevice directly.
70 class CVirtualDrawDevice : public CBase
73 virtual ~CVirtualDrawDevice();
74 static CVirtualDrawDevice* NewL(TDisplayMode aDisplayMode);
75 CFbsDrawDevice& DrawDevice();
78 void ConstructL(TDisplayMode aDisplayMode);
79 TInt ByteSize(const TSize& aSize, TDisplayMode aDisplayMode);
82 CFbsDrawDevice* iDrawDevice; // The virtual or real screen device
83 TUint8* iDeviceMemory; // Used for virtual draw device
84 TSize iSize; // Used for Clear
85 TBool iIsDrawDevice; // ETrue if the hardware supports the screen device at the specified display mode
88 /****************************************************************************
89 * The reason to have a new step base is that it is very much possible
90 * that the all individual test steps have project related common variables
92 * and this is the place to define these common variable and members.
94 ****************************************************************************/
95 class CTe_graphicsperformanceSuiteStepBase : public CTTMSGraphicsStep
98 static const TDesC& ColorModeName(TDisplayMode aMode);
99 virtual ~CTe_graphicsperformanceSuiteStepBase();
100 CTe_graphicsperformanceSuiteStepBase();
101 CVirtualBitmapDevice* ScreenDevice();
103 void SetScreenModeL(TDisplayMode aScreenMode, TBool aForceUseOffscreen=EFalse);
104 CFbsBitmap* CreateSoftwareBitmapLC(const TSize& aSize, TDisplayMode aMode);
105 void CopyBitmapL(CFbsBitmap* aDst, CFbsBitmap* aSrc);
106 CFbsBitmap* CopyIntoNewBitmapL(CFbsBitmap* aSrc, TDisplayMode aDisplayMode);
107 CFbsBitmap* LoadBitmapL(const TDesC& aName, TInt aIndex);
108 static TRgb InterpolateColour(TRgb aLo, TRgb aHi, TInt aX, TInt aN);
109 static void VerticalGradientAlphaL(CFbsBitmap* aBitmap, TRgb aLo, TRgb aHi);
110 void SetDrawDeviceModeL(TDisplayMode aScreenMode);
111 TInt GetDrawDeviceInterfaceL(TInt aInterfaceId, TAny *&aInterface);
112 void ClearDrawDeviceL(TRgb aColor);
113 CFbsBitmap* CreateCheckedBoardL(TDisplayMode aDisplayMode, TSize aSize, TSize aChecksPerAxis) const;
114 virtual CFbsBitmap* GetTargetAsBitmapL();
115 TInt WriteTargetOutput(TPtrC aName);
116 static void ExtractListL(TPtrC aList, RArray<TPtrC>& aListItems);
120 virtual TVerdict doTestStepPreambleL();
121 virtual TVerdict doTestStepPostambleL();
126 //TBool IsFoundScreenMode(TDisplayMode aScreenMode);
129 CVirtualBitmapDevice * iScreenDevice;
131 CVirtualDrawDevice* iDrawDevice;
132 CTProfiler* iProfiler;
138 CActiveScheduler* iScheduler;
140 // Sanity checking flag as read in from the ini file. If ETrue, WriteTargetOutput() will generate
141 // a bitmap of the target, otherwise it will perform no operation.
146 // Define 16 RGB colors
147 #define KRgbBlack TRgb(0x000000)
148 #define KRgbDarkGray TRgb(0x555555)
149 #define KRgbDarkRed TRgb(0x000080)
150 #define KRgbDarkGreen TRgb(0x008000)
151 #define KRgbDarkYellow TRgb(0x008080)
152 #define KRgbDarkBlue TRgb(0x800000)
153 #define KRgbDarkMagenta TRgb(0x800080)
154 #define KRgbDarkCyan TRgb(0x808000)
155 #define KRgbRed TRgb(0x0000ff)
156 #define KRgbGreen TRgb(0x00ff00)
157 #define KRgbYellow TRgb(0x00ffff)
158 #define KRgbBlue TRgb(0xff0000)
159 #define KRgbMagenta TRgb(0xff00ff)
160 #define KRgbCyan TRgb(0xffff00)
161 #define KRgbGray TRgb(0xaaaaaa)
162 #define KRgbWhite TRgb(0xffffff)
164 // A 16 RGB color table
165 const TRgb KColor16Table[] =