sl@0
|
1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include <w32std.h>
|
sl@0
|
17 |
#include "wsdynamicresbase.h"
|
sl@0
|
18 |
#include "teflogextensions.h"
|
sl@0
|
19 |
#include "globalsettings.h"
|
sl@0
|
20 |
#include <bitdraw.h>
|
sl@0
|
21 |
#include <bitdrawinterfaceid.h>
|
sl@0
|
22 |
#include <bitdrawsurface.h>
|
sl@0
|
23 |
#include <graphics/surfaceconfiguration.h>
|
sl@0
|
24 |
#include "regionextend.h"
|
sl@0
|
25 |
|
sl@0
|
26 |
|
sl@0
|
27 |
#if defined(__X86GCC__)
|
sl@0
|
28 |
extern "C" TInt atexit(void (*function)(void))
|
sl@0
|
29 |
{
|
sl@0
|
30 |
return KErrNone;
|
sl@0
|
31 |
}
|
sl@0
|
32 |
#endif
|
sl@0
|
33 |
|
sl@0
|
34 |
CWsDynamicResBase::CWsDynamicResBase():
|
sl@0
|
35 |
iUtility(this)
|
sl@0
|
36 |
{
|
sl@0
|
37 |
}
|
sl@0
|
38 |
|
sl@0
|
39 |
CWsDynamicResBase::~CWsDynamicResBase()
|
sl@0
|
40 |
{
|
sl@0
|
41 |
}
|
sl@0
|
42 |
|
sl@0
|
43 |
/**
|
sl@0
|
44 |
Common set up code for all tests.
|
sl@0
|
45 |
|
sl@0
|
46 |
Creates the session and window group for further windows, plus a simple white
|
sl@0
|
47 |
background to obscure any unwanted stuff behind the test. Sets up the surface
|
sl@0
|
48 |
update session and surface manager, to work with surfaces. Creates a screen
|
sl@0
|
49 |
device for use in the tests.
|
sl@0
|
50 |
*/
|
sl@0
|
51 |
void CWsDynamicResBase::SetupL()
|
sl@0
|
52 |
{
|
sl@0
|
53 |
SetupL(EFalse);
|
sl@0
|
54 |
}
|
sl@0
|
55 |
void CWsDynamicResBase::SetupL(TBool aUseOtherScreenForInfo)
|
sl@0
|
56 |
{
|
sl@0
|
57 |
CWsDynamicResWinBase::SetupL(aUseOtherScreenForInfo);
|
sl@0
|
58 |
|
sl@0
|
59 |
|
sl@0
|
60 |
//clean-up if previous test abended
|
sl@0
|
61 |
if (PostTestCleanupInstance().iSharedUtility)
|
sl@0
|
62 |
{
|
sl@0
|
63 |
//Temp removed - may be causing ONB fails!
|
sl@0
|
64 |
// if (PostTestCleanupInstance().iSharedUtility->DestroyAll())
|
sl@0
|
65 |
// {
|
sl@0
|
66 |
// INFO_PRINTF1(_L("Destroyed some surfaces from previous test."));
|
sl@0
|
67 |
//
|
sl@0
|
68 |
// }
|
sl@0
|
69 |
}
|
sl@0
|
70 |
if (!PostTestCleanupInstance().iCleanedUpOnExit)
|
sl@0
|
71 |
PostTestCleanupInstance().iCleanedUpOnExit=EFalse;
|
sl@0
|
72 |
|
sl@0
|
73 |
if (!GCEIsSupported())
|
sl@0
|
74 |
{
|
sl@0
|
75 |
INFO_PRINTF1(_L("Some Setup skipped: GCE support is not loaded"));
|
sl@0
|
76 |
return;
|
sl@0
|
77 |
}
|
sl@0
|
78 |
|
sl@0
|
79 |
TRAPD(err_FailedToCreateSurfaceUtility, iUtility = CSurfaceUtility::NewL( PostTestCleanupInstance().iSharedUtility));
|
sl@0
|
80 |
ASSERT_EQUALS(err_FailedToCreateSurfaceUtility,KErrNone);
|
sl@0
|
81 |
|
sl@0
|
82 |
|
sl@0
|
83 |
}
|
sl@0
|
84 |
|
sl@0
|
85 |
/**
|
sl@0
|
86 |
Common tear down code for all tests.
|
sl@0
|
87 |
|
sl@0
|
88 |
Windows, group and session created are closed. Screen device is destroyed.
|
sl@0
|
89 |
Surfaces, manager and update session are closed.
|
sl@0
|
90 |
*/
|
sl@0
|
91 |
void CWsDynamicResBase::TearDownL()
|
sl@0
|
92 |
{
|
sl@0
|
93 |
CWsDynamicResWinBase::TearDownL();
|
sl@0
|
94 |
delete iUtility();
|
sl@0
|
95 |
PostTestCleanupInstance().iCleanedUpOnExit=ETrue;
|
sl@0
|
96 |
//Pause(1000);
|
sl@0
|
97 |
}
|
sl@0
|
98 |
/**
|
sl@0
|
99 |
* Note that this is not the ideal mechanism.
|
sl@0
|
100 |
* A derived class may thinks its TearDown is safe to do from delete, but in the class it is derived from it may not be safe
|
sl@0
|
101 |
**/
|
sl@0
|
102 |
void CWsDynamicResBase::TearDownFromDeleteL()
|
sl@0
|
103 |
{
|
sl@0
|
104 |
CWsDynamicResBase::TearDownL();
|
sl@0
|
105 |
}
|
sl@0
|
106 |
|
sl@0
|
107 |
//Allocating an instance of surface utility here means all test code instances will share the same instance of the utility class.
|
sl@0
|
108 |
// Owns the singleton
|
sl@0
|
109 |
/*static*/ const CWsDynamicResBase::TPostTestCleanup& CWsDynamicResBase::PostTestCleanupInstance()
|
sl@0
|
110 |
{
|
sl@0
|
111 |
static
|
sl@0
|
112 |
class RPostTestCleanup:public TPostTestCleanup
|
sl@0
|
113 |
{
|
sl@0
|
114 |
public:
|
sl@0
|
115 |
RPostTestCleanup()
|
sl@0
|
116 |
{
|
sl@0
|
117 |
iSharedUtility=NULL;
|
sl@0
|
118 |
iCleanedUpOnExit=ETrue;
|
sl@0
|
119 |
}
|
sl@0
|
120 |
~RPostTestCleanup()
|
sl@0
|
121 |
{
|
sl@0
|
122 |
// I want to cleanly release the surface utility, but at this point the threads have already been pulled down!
|
sl@0
|
123 |
// if (iSharedUtility)
|
sl@0
|
124 |
// delete iSharedUtility;
|
sl@0
|
125 |
iSharedUtility=NULL; //avoid phoenix behaviour
|
sl@0
|
126 |
}
|
sl@0
|
127 |
} staticInstance;
|
sl@0
|
128 |
return staticInstance;
|
sl@0
|
129 |
}
|
sl@0
|
130 |
|
sl@0
|
131 |
void CWsDynamicResBase::TPostTestCleanup::CreateSharedUtilityL()const
|
sl@0
|
132 |
{
|
sl@0
|
133 |
if (iSharedUtility==NULL)
|
sl@0
|
134 |
iSharedUtility=CSurfaceUtility::NewL();
|
sl@0
|
135 |
}
|
sl@0
|
136 |
|
sl@0
|
137 |
/**
|
sl@0
|
138 |
Pause for the given number of milliseconds.
|
sl@0
|
139 |
|
sl@0
|
140 |
@param aMilliseconds Time to wait in milliseconds.
|
sl@0
|
141 |
*/
|
sl@0
|
142 |
void CWsDynamicResBase::Pause(TInt aMilliseconds)
|
sl@0
|
143 |
{
|
sl@0
|
144 |
User::After(TTimeIntervalMicroSeconds32(aMilliseconds * 1000));
|
sl@0
|
145 |
}
|
sl@0
|
146 |
|
sl@0
|
147 |
void CWsDynamicResBase::LargerTestWindow(TInt aPercentOfBack)
|
sl@0
|
148 |
{
|
sl@0
|
149 |
TRect newPos=iTestPos;
|
sl@0
|
150 |
TSize backSize=iTestPos.Size();
|
sl@0
|
151 |
newPos.Grow((aPercentOfBack-100)*backSize.iWidth/200,(aPercentOfBack-100)*backSize.iHeight/200);
|
sl@0
|
152 |
iCenteredFrontWinRect=newPos;
|
sl@0
|
153 |
if (iTestFront.WsHandle())
|
sl@0
|
154 |
{
|
sl@0
|
155 |
iTestFront.SetExtent(newPos.iTl,newPos.Size());
|
sl@0
|
156 |
}
|
sl@0
|
157 |
|
sl@0
|
158 |
}
|
sl@0
|
159 |
|
sl@0
|
160 |
|
sl@0
|
161 |
void CWsDynamicResBase::MakeExtraChildWindowL(const RWindowBase& aFromParent,TRect aChildRect,TRgb aChildColor)
|
sl@0
|
162 |
{
|
sl@0
|
163 |
ASSERT(aFromParent.WsHandle());
|
sl@0
|
164 |
if (!iTestSecondChild.WsHandle())
|
sl@0
|
165 |
{
|
sl@0
|
166 |
iTestSecondChild=RWindow(iSession);
|
sl@0
|
167 |
ASSERT_EQUALS_X(iTestSecondChild.Construct(aFromParent, ++iWindowHandle), KErrNone);
|
sl@0
|
168 |
iTestSecondChild.SetRequiredDisplayMode(iDisplayMode);
|
sl@0
|
169 |
}
|
sl@0
|
170 |
iTestSecondChild.SetBackgroundColor(aChildColor);
|
sl@0
|
171 |
iTestSecondChild.SetExtent(aChildRect.iTl,aChildRect.Size());
|
sl@0
|
172 |
iTestSecondChild.Activate();
|
sl@0
|
173 |
iTestSecondChild.BeginRedraw();
|
sl@0
|
174 |
iGc->Activate(iCompare);
|
sl@0
|
175 |
iGc->SetBrushColor(iBlue);
|
sl@0
|
176 |
iGc->Clear();
|
sl@0
|
177 |
iGc->Deactivate();
|
sl@0
|
178 |
iTestSecondChild.EndRedraw();
|
sl@0
|
179 |
iTestSecondChild.SetVisible(ETrue);
|
sl@0
|
180 |
}
|
sl@0
|
181 |
|
sl@0
|
182 |
CWsDynamicResBase::LoopingGcPtr CWsDynamicResBase::LoopBeginActivateWithWipe(const TRegion& aRegion,RWindow& aWin,TRgb aColor)
|
sl@0
|
183 |
{
|
sl@0
|
184 |
InvalidateRegion(aRegion,aWin);
|
sl@0
|
185 |
return LoopingGcPtr(aRegion,aWin,aColor,GcForWindow(aWin));
|
sl@0
|
186 |
}
|
sl@0
|
187 |
|
sl@0
|
188 |
//This gets called each itteration of the while loop, and is used to step the rectangle count!
|
sl@0
|
189 |
void CWsDynamicResBase::LoopingGcPtr::operator ++()
|
sl@0
|
190 |
{
|
sl@0
|
191 |
iPass++;
|
sl@0
|
192 |
if (iPass<iRegion.Count())
|
sl@0
|
193 |
{ //Invalidate all the rectangles in the region
|
sl@0
|
194 |
iWin.BeginRedraw(iRegion[iPass]);
|
sl@0
|
195 |
CWsDynamicResWinBase::ActivateWithWipe(iGc,iWin,iColor);
|
sl@0
|
196 |
// return true;
|
sl@0
|
197 |
}
|
sl@0
|
198 |
else
|
sl@0
|
199 |
{
|
sl@0
|
200 |
iGc=NULL;
|
sl@0
|
201 |
// return false;
|
sl@0
|
202 |
}
|
sl@0
|
203 |
}
|
sl@0
|
204 |
|
sl@0
|
205 |
CWindowGc* CWsDynamicResBase::BeginActivateWithWipe(TBool aInvalidate,RWindow& aWin,TRgb aColor)
|
sl@0
|
206 |
{
|
sl@0
|
207 |
return CWsDynamicResWinBase::BeginActivateWithWipe(aInvalidate,aWin,aColor);
|
sl@0
|
208 |
}
|
sl@0
|
209 |
|
sl@0
|
210 |
CWindowGc* CWsDynamicResBase::BeginActivateWithWipe(TBool aInvalidate,TRect aRect,RWindow& aWin,TRgb aColor)
|
sl@0
|
211 |
{
|
sl@0
|
212 |
return CWsDynamicResWinBase::BeginActivateWithWipe(aInvalidate,aRect,aWin,aColor);
|
sl@0
|
213 |
}
|
sl@0
|
214 |
|
sl@0
|
215 |
CWindowGc* CWsDynamicResBase::BeginActivateWithWipe(const TRegion& aRegion,RWindow& aWin,TRgb aColor)
|
sl@0
|
216 |
{
|
sl@0
|
217 |
return CWsDynamicResWinBase::BeginActivateWithWipe(aRegion,aWin,aColor);
|
sl@0
|
218 |
}
|
sl@0
|
219 |
|
sl@0
|
220 |
/**
|
sl@0
|
221 |
* Generates a valid surfaceID for the current display mode.
|
sl@0
|
222 |
* This is then used in negative testing.
|
sl@0
|
223 |
*
|
sl@0
|
224 |
*
|
sl@0
|
225 |
**/
|
sl@0
|
226 |
void CWsDynamicResBase::UISurfaceL(TSurfaceId& aSurfaceId) const
|
sl@0
|
227 |
{
|
sl@0
|
228 |
CFbsDrawDevice* screenDevice=NULL;
|
sl@0
|
229 |
TDisplayMode displayMode=iScreenDevice->DisplayMode();
|
sl@0
|
230 |
screenDevice = CFbsDrawDevice::NewScreenDeviceL(TGlobalSettings::Instance().iScreen, displayMode);
|
sl@0
|
231 |
CleanupStack::PushL(screenDevice);
|
sl@0
|
232 |
TAny* p=NULL;
|
sl@0
|
233 |
User::LeaveIfError(screenDevice->GetInterface(KSurfaceInterfaceID, p));
|
sl@0
|
234 |
MSurfaceId* uiSurface = static_cast<MSurfaceId*>(p);
|
sl@0
|
235 |
uiSurface->GetSurface(aSurfaceId);
|
sl@0
|
236 |
CleanupStack::PopAndDestroy(screenDevice);
|
sl@0
|
237 |
}
|
sl@0
|
238 |
|
sl@0
|
239 |
/**
|
sl@0
|
240 |
Common set up code for creating a surface based window.
|
sl@0
|
241 |
|
sl@0
|
242 |
Given window and surface objects and a color: creates the window and surface,
|
sl@0
|
243 |
sets the window to a default size (the same as the surface), sets the background
|
sl@0
|
244 |
to the bitwise inverse of the given color, sets the surface as the background,
|
sl@0
|
245 |
fills the surface with the color and completes a redraw to prevent an event.
|
sl@0
|
246 |
|
sl@0
|
247 |
@param aWindow The window object, connected to a session.
|
sl@0
|
248 |
@param aSurface The surface object, to be initialized.
|
sl@0
|
249 |
@param aColor The color to fill the surface with.
|
sl@0
|
250 |
*/
|
sl@0
|
251 |
void CWsDynamicResBase::CommonSurfaceWindowSetupL(RWindow& aWindow, TSurfaceId& aSurface, const TRgb& aColor)
|
sl@0
|
252 |
{
|
sl@0
|
253 |
TInt err = KErrNone;
|
sl@0
|
254 |
|
sl@0
|
255 |
TRAP(err, aSurface = iUtility->CreateSurfaceL(TSize(KSurfaceWidth, KSurfaceHeight),
|
sl@0
|
256 |
KSurfaceFormat, KSurfaceWidth * KBytesPerPixel));
|
sl@0
|
257 |
PRINT_ON_ERROR2_L(err, _L("Failed to create surface: %d"), err);
|
sl@0
|
258 |
ASSERT_EQUALS_X(aWindow.Construct(iGroup, ++iWindowHandle), KErrNone);
|
sl@0
|
259 |
|
sl@0
|
260 |
aWindow.SetRequiredDisplayMode(iDisplayMode);
|
sl@0
|
261 |
aWindow.SetExtent(TPoint(0, 0), TSize(KSurfaceWidth, KSurfaceHeight));
|
sl@0
|
262 |
aWindow.SetBackgroundColor(TRgb(aColor.Value() ^ 0xFFFFFF));
|
sl@0
|
263 |
|
sl@0
|
264 |
ASSERT_EQUALS_X(aWindow.SetBackgroundSurface(aSurface), KErrNone);
|
sl@0
|
265 |
|
sl@0
|
266 |
TRAP(err, iUtility->FillSurfaceL(aSurface, aColor));
|
sl@0
|
267 |
PRINT_ON_ERROR2_L(err, _L("Failed to fill surface: %d"), err);
|
sl@0
|
268 |
DrawUIContent(aWindow);
|
sl@0
|
269 |
}
|
sl@0
|
270 |
|
sl@0
|
271 |
/**
|
sl@0
|
272 |
Common set up code for resizing tests.
|
sl@0
|
273 |
|
sl@0
|
274 |
Similar to the common surface window code, but filling the surface with a grid
|
sl@0
|
275 |
instead of a solid color. The grid lines are always black. Also, the background
|
sl@0
|
276 |
color is always blue.
|
sl@0
|
277 |
*/
|
sl@0
|
278 |
void CWsDynamicResBase::ResizeTestCommonSetupL(RWindow& aWindow, const TRgb& aColor)
|
sl@0
|
279 |
{
|
sl@0
|
280 |
// Session and group created in SetUpL()
|
sl@0
|
281 |
|
sl@0
|
282 |
TSurfaceId surface;
|
sl@0
|
283 |
TInt err = KErrNone;
|
sl@0
|
284 |
|
sl@0
|
285 |
TRAP(err, surface = iUtility->CreateSurfaceL(TSize(KSurfaceWidth, KSurfaceHeight),
|
sl@0
|
286 |
KSurfaceFormat, KSurfaceWidth * KBytesPerPixel));
|
sl@0
|
287 |
PRINT_ON_ERROR2_L(err, _L("Failed to create surface: %d"), err);
|
sl@0
|
288 |
|
sl@0
|
289 |
ASSERT_EQUALS_X(aWindow.Construct(iGroup, ++iWindowHandle), KErrNone);
|
sl@0
|
290 |
|
sl@0
|
291 |
aWindow.SetRequiredDisplayMode(iDisplayMode);
|
sl@0
|
292 |
aWindow.SetExtent(TPoint(0, 0), TSize(KSurfaceWidth, KSurfaceHeight));
|
sl@0
|
293 |
aWindow.SetBackgroundColor(iBlue);
|
sl@0
|
294 |
ASSERT_EQUALS_X(aWindow.SetBackgroundSurface(surface), KErrNone);
|
sl@0
|
295 |
|
sl@0
|
296 |
TRAP(err, iUtility->GridFillSurfaceL(surface, aColor, TRgb(0)));
|
sl@0
|
297 |
PRINT_ON_ERROR2_L(err, _L("Failed to grid fill surface: %d"), err);
|
sl@0
|
298 |
DrawUIContent(aWindow);
|
sl@0
|
299 |
}
|
sl@0
|
300 |
|
sl@0
|
301 |
CFbsBitmap* CWsDynamicResBase::RotateBitmapLC(const CFbsBitmap* aSrcBitmap)
|
sl@0
|
302 |
{
|
sl@0
|
303 |
CFbsBitmap* rv=new CFbsBitmap;
|
sl@0
|
304 |
CleanupStack::PushL(rv);
|
sl@0
|
305 |
TSize srcSize=aSrcBitmap->SizeInPixels();
|
sl@0
|
306 |
rv->Create(TSize(srcSize.iHeight,srcSize.iWidth),EColor16MA);
|
sl@0
|
307 |
TRgb* linestore=new TRgb[srcSize.iHeight];
|
sl@0
|
308 |
TPtr8 buff((unsigned char*)linestore,srcSize.iHeight*sizeof(TRgb),srcSize.iHeight*sizeof(TRgb));
|
sl@0
|
309 |
for (TInt col=0;col<aSrcBitmap->SizeInPixels().iWidth;col++)
|
sl@0
|
310 |
{
|
sl@0
|
311 |
for (TInt row=0,brow=srcSize.iHeight-1;row<srcSize.iHeight;row++,brow--)
|
sl@0
|
312 |
{
|
sl@0
|
313 |
aSrcBitmap->GetPixel(linestore[row],TPoint(col,brow));
|
sl@0
|
314 |
}
|
sl@0
|
315 |
rv->SetScanLine(buff,col);
|
sl@0
|
316 |
}
|
sl@0
|
317 |
delete[] linestore;
|
sl@0
|
318 |
return rv;
|
sl@0
|
319 |
}
|
sl@0
|
320 |
|
sl@0
|
321 |
|
sl@0
|
322 |
//
|
sl@0
|
323 |
//
|
sl@0
|
324 |
//
|
sl@0
|
325 |
// Pattern checking. Is a given pattern still present?
|
sl@0
|
326 |
// To make life interesting, the pattern is stored backwards!
|
sl@0
|
327 |
// The pattern is fibonnacci sequence masked to byte:
|
sl@0
|
328 |
// 1 2 3 5 8 13 21 34 55 89 144 233 121
|
sl@0
|
329 |
// 98 219 61 24 85 109 194 47 241 32 17 49 66
|
sl@0
|
330 |
// 115 181 40 221 5 226 231 201 176 121 41 162
|
sl@0
|
331 |
//
|
sl@0
|
332 |
//
|
sl@0
|
333 |
void Pattern::Fill(void* aTrg,TInt aOffset,TInt aLength)
|
sl@0
|
334 |
{
|
sl@0
|
335 |
unsigned char* ptr=(unsigned char*)aTrg;
|
sl@0
|
336 |
TInt a=0;
|
sl@0
|
337 |
TInt b=1;
|
sl@0
|
338 |
while (--aLength)
|
sl@0
|
339 |
{
|
sl@0
|
340 |
TInt c=a+b;
|
sl@0
|
341 |
*(ptr+aOffset+aLength)=c&0xff;
|
sl@0
|
342 |
a=b;
|
sl@0
|
343 |
b=c;
|
sl@0
|
344 |
}
|
sl@0
|
345 |
}
|
sl@0
|
346 |
TBool Pattern::Check(void* aTrg,TInt aOffset,TInt aLength)
|
sl@0
|
347 |
{
|
sl@0
|
348 |
unsigned char* ptr=(unsigned char*)aTrg;
|
sl@0
|
349 |
TInt a=0;
|
sl@0
|
350 |
TInt b=1;
|
sl@0
|
351 |
while (--aLength)
|
sl@0
|
352 |
{
|
sl@0
|
353 |
TInt c=a+b;
|
sl@0
|
354 |
if (*(ptr+aOffset+aLength)!=c&0xff)
|
sl@0
|
355 |
return EFalse;
|
sl@0
|
356 |
a=b;
|
sl@0
|
357 |
b=c;
|
sl@0
|
358 |
}
|
sl@0
|
359 |
return ETrue;
|
sl@0
|
360 |
}
|
sl@0
|
361 |
TBool Pattern::CheckVal(void* aTrg,TInt aOffset,TInt aLength,char val)
|
sl@0
|
362 |
{
|
sl@0
|
363 |
unsigned char* ptr=(unsigned char*)aTrg;
|
sl@0
|
364 |
while (--aLength)
|
sl@0
|
365 |
{
|
sl@0
|
366 |
if (*(ptr+aOffset+aLength)!=val&0xff)
|
sl@0
|
367 |
return EFalse;
|
sl@0
|
368 |
}
|
sl@0
|
369 |
return ETrue;
|
sl@0
|
370 |
}
|
sl@0
|
371 |
|
sl@0
|
372 |
//I have removed these only because they use TRegionExtend
|
sl@0
|
373 |
//
|
sl@0
|
374 |
//TInt CWsDynamicResBase::RegionDiffForUiLayer(TInt aUiLayer)
|
sl@0
|
375 |
// {
|
sl@0
|
376 |
// EWsDebugGetUILayerConfig, //return: TSurfaceConfig //Index UI layer via EWsDebugArgLayerMask
|
sl@0
|
377 |
// EWsDebugGetUILayerBase, //return: TRect[]
|
sl@0
|
378 |
//
|
sl@0
|
379 |
// RRegion layerRegion;
|
sl@0
|
380 |
// TInt layerRegionLen=iSession.DebugInfo(EWsDebugGetUILayerBase,iSession.ObjInd(0,aUiLayer),layerRegion);
|
sl@0
|
381 |
// if (layerRegionLen==KErrCancel)
|
sl@0
|
382 |
// return TRegionExtend::EExact;
|
sl@0
|
383 |
// ASSERT_TRUE(layerRegionLen>=0);
|
sl@0
|
384 |
// TBuf8<sizeof(TSurfaceConfiguration)> configBuf(sizeof(TSurfaceConfiguration));
|
sl@0
|
385 |
// const TSurfaceConfiguration* config;
|
sl@0
|
386 |
// TInt configLen=iSession.DebugInfo(EWsDebugGetUILayerConfig,iSession.ObjInd(0,aUiLayer),configBuf,config);
|
sl@0
|
387 |
// ASSERT_TRUE(configLen>=0);
|
sl@0
|
388 |
// TRect layerExtent;
|
sl@0
|
389 |
// config->GetExtent(layerExtent);
|
sl@0
|
390 |
// TInt retVal=TRegionExtend::Cast(layerRegion).TestDifference(layerExtent.Size());
|
sl@0
|
391 |
// layerRegion.Close();
|
sl@0
|
392 |
// return retVal;
|
sl@0
|
393 |
// }
|
sl@0
|
394 |
//CWsDynamicResBase::FastPathMode CWsDynamicResBase::DeduceUiFastPathMode()
|
sl@0
|
395 |
// {
|
sl@0
|
396 |
// TInt blendedRegionState=RegionDiffForUiLayer(0);
|
sl@0
|
397 |
// TInt opaqueRegionState=RegionDiffForUiLayer(1);
|
sl@0
|
398 |
// if (blendedRegionState&TRegionExtend::ENoIntersect)
|
sl@0
|
399 |
// {
|
sl@0
|
400 |
// if (opaqueRegionState&TRegionExtend::ENoIntersect)
|
sl@0
|
401 |
// {
|
sl@0
|
402 |
// return EFpExternalOpaque; //fullscreen fast-path external surface
|
sl@0
|
403 |
// }
|
sl@0
|
404 |
// else
|
sl@0
|
405 |
// if (opaqueRegionState&TRegionExtend::EAdd)
|
sl@0
|
406 |
// {
|
sl@0
|
407 |
// return (FastPathMode)(EFpUiOpaque|EFpUiRegions); //windowed max-opt no blending
|
sl@0
|
408 |
// }
|
sl@0
|
409 |
// else
|
sl@0
|
410 |
// {
|
sl@0
|
411 |
// return EFpUiOpaque; //full-screen fastpath
|
sl@0
|
412 |
// }
|
sl@0
|
413 |
// }
|
sl@0
|
414 |
// else
|
sl@0
|
415 |
// {
|
sl@0
|
416 |
// if (opaqueRegionState&TRegionExtend::ENoIntersect)
|
sl@0
|
417 |
// {
|
sl@0
|
418 |
// if (blendedRegionState&TRegionExtend::EAdd)
|
sl@0
|
419 |
// {
|
sl@0
|
420 |
// return (FastPathMode)(EFpUiBlended|EFpUiRegions); //windowed max-opt no opaque
|
sl@0
|
421 |
// }
|
sl@0
|
422 |
// else
|
sl@0
|
423 |
// {
|
sl@0
|
424 |
// return (EFpUiBlended); //full-screen blended
|
sl@0
|
425 |
// }
|
sl@0
|
426 |
// }
|
sl@0
|
427 |
// else
|
sl@0
|
428 |
// {
|
sl@0
|
429 |
// if ((blendedRegionState|opaqueRegionState)&TRegionExtend::EAdd)
|
sl@0
|
430 |
// {
|
sl@0
|
431 |
// return (FastPathMode)(EFpUiComplex|EFpUiRegions); //moxed blending, opaque and external max optimisation
|
sl@0
|
432 |
// }
|
sl@0
|
433 |
// else
|
sl@0
|
434 |
// {
|
sl@0
|
435 |
// return EFpUiComplex; //Error! blend and opaque both enabled and full-screen!
|
sl@0
|
436 |
// }
|
sl@0
|
437 |
// }
|
sl@0
|
438 |
//
|
sl@0
|
439 |
// }
|
sl@0
|
440 |
// }
|