sl@0
|
1 |
// Copyright (c) 2007-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 "tbitbltmaskedbase.h"
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
CTBitBltMaskedBase::CTBitBltMaskedBase()
|
sl@0
|
20 |
{
|
sl@0
|
21 |
|
sl@0
|
22 |
}
|
sl@0
|
23 |
|
sl@0
|
24 |
CTBitBltMaskedBase::~CTBitBltMaskedBase()
|
sl@0
|
25 |
{
|
sl@0
|
26 |
|
sl@0
|
27 |
}
|
sl@0
|
28 |
|
sl@0
|
29 |
/**
|
sl@0
|
30 |
Write target output.
|
sl@0
|
31 |
Call method from base class with test case name and combined source pixel format and mask type string.
|
sl@0
|
32 |
@param aTestCaseName Name of test case.
|
sl@0
|
33 |
@return KErrNone if successful, otherwise one of the system-wide error codes.
|
sl@0
|
34 |
*/
|
sl@0
|
35 |
TInt CTBitBltMaskedBase::WriteTargetOutput(TPtrC aTestCaseName)
|
sl@0
|
36 |
{
|
sl@0
|
37 |
TBuf<KFileNameLength> postfix;
|
sl@0
|
38 |
postfix.Append(KSourceString);
|
sl@0
|
39 |
postfix.Append(KSeparator);
|
sl@0
|
40 |
postfix.Append(TDisplayModeMapping::ConvertPixelFormatToShortPixelFormatString(
|
sl@0
|
41 |
iTestParams.iSourcePixelFormat));
|
sl@0
|
42 |
|
sl@0
|
43 |
postfix.Append(KSeparator);
|
sl@0
|
44 |
if(iInvertMask)
|
sl@0
|
45 |
{
|
sl@0
|
46 |
postfix.Append(_L16("Invert"));
|
sl@0
|
47 |
}
|
sl@0
|
48 |
postfix.Append(_L16("M"));
|
sl@0
|
49 |
|
sl@0
|
50 |
if(iMaskPixelFormat == EUidPixelFormatL_8)
|
sl@0
|
51 |
{
|
sl@0
|
52 |
postfix.Append(_L16("L8"));
|
sl@0
|
53 |
}
|
sl@0
|
54 |
else if(iMaskPixelFormat == EUidPixelFormatL_1)
|
sl@0
|
55 |
{
|
sl@0
|
56 |
postfix.Append(_L16("L1"));
|
sl@0
|
57 |
}
|
sl@0
|
58 |
|
sl@0
|
59 |
return CTDirectGdiStepBase::WriteTargetOutput(iTestParams, aTestCaseName, &postfix);
|
sl@0
|
60 |
}
|
sl@0
|
61 |
|
sl@0
|
62 |
/**
|
sl@0
|
63 |
Create set of bitmaps needed for tests.
|
sl@0
|
64 |
@param aPixelFormat Source pixel format of bitmap.
|
sl@0
|
65 |
*/
|
sl@0
|
66 |
void CTBitBltMaskedBase::CreateBitmapsL(TUidPixelFormat aPixelFormat)
|
sl@0
|
67 |
{
|
sl@0
|
68 |
CTBitBltBase::CreateBitmapsL(aPixelFormat);
|
sl@0
|
69 |
iNotInitialisedMask = new (ELeave)CFbsBitmap();
|
sl@0
|
70 |
iZeroSizeMask = new (ELeave)CFbsBitmap();
|
sl@0
|
71 |
TESTL(KErrNone == iZeroSizeMask->Create(TSize(0,0), TDisplayModeMapping::MapPixelFormatToDisplayMode(EUidPixelFormatL_1)));
|
sl@0
|
72 |
iMask1L1 = CreateCheckedBoardBitmapL(EUidPixelFormatL_1, KBitmap1Size, TSize(4, 4));
|
sl@0
|
73 |
iMask2L1 = CreateCheckedBoardBitmapL(EUidPixelFormatL_1, KBitmap2Size, TSize(8, 8));
|
sl@0
|
74 |
iMask1L8 = CreateMaskingPixmapL(EUidPixelFormatL_8, KBitmap1Size);
|
sl@0
|
75 |
iMask2L8 = CreateMaskingPixmapL(EUidPixelFormatL_8, KBitmap2Size);
|
sl@0
|
76 |
iCompressedMaskL8 = CreateMaskingPixmapL(EUidPixelFormatL_8, KBitmap2Size);
|
sl@0
|
77 |
iCompressedMaskL8->Compress();
|
sl@0
|
78 |
iBlackWhiteBitmap = CreateBlackWhiteBitmapL(aPixelFormat, KBitmap2Size, TSize(8, 8));
|
sl@0
|
79 |
}
|
sl@0
|
80 |
|
sl@0
|
81 |
/**
|
sl@0
|
82 |
Delete set of test bitmaps.
|
sl@0
|
83 |
*/
|
sl@0
|
84 |
void CTBitBltMaskedBase::DeleteBitmaps()
|
sl@0
|
85 |
{
|
sl@0
|
86 |
delete iNotInitialisedMask;
|
sl@0
|
87 |
iNotInitialisedMask = NULL;
|
sl@0
|
88 |
delete iZeroSizeMask;
|
sl@0
|
89 |
iZeroSizeMask = NULL;
|
sl@0
|
90 |
delete iMask1L1;
|
sl@0
|
91 |
iMask1L1 = NULL;
|
sl@0
|
92 |
delete iMask2L1;
|
sl@0
|
93 |
iMask2L1 = NULL;
|
sl@0
|
94 |
delete iMask1L8;
|
sl@0
|
95 |
iMask1L8 = NULL;
|
sl@0
|
96 |
delete iMask2L8;
|
sl@0
|
97 |
iMask2L8 = NULL;
|
sl@0
|
98 |
delete iCompressedMaskL8;
|
sl@0
|
99 |
iCompressedMaskL8 = NULL;
|
sl@0
|
100 |
delete iBlackWhiteBitmap;
|
sl@0
|
101 |
iBlackWhiteBitmap = NULL;
|
sl@0
|
102 |
CTBitBltBase::DeleteBitmaps();
|
sl@0
|
103 |
}
|
sl@0
|
104 |
|
sl@0
|
105 |
/**
|
sl@0
|
106 |
Begin iteration through mask types.
|
sl@0
|
107 |
All needed variables are initialized to start iteration.
|
sl@0
|
108 |
*/
|
sl@0
|
109 |
void CTBitBltMaskedBase::BeginMaskIteration()
|
sl@0
|
110 |
{
|
sl@0
|
111 |
iMaskType = EMaskL1;
|
sl@0
|
112 |
iMaskPixelFormat = EUidPixelFormatL_1;
|
sl@0
|
113 |
iInvertMask = EFalse;
|
sl@0
|
114 |
iCurrentMask1 = iMask1L1;
|
sl@0
|
115 |
iCurrentMask2 = iMask2L1;
|
sl@0
|
116 |
}
|
sl@0
|
117 |
|
sl@0
|
118 |
/**
|
sl@0
|
119 |
Next iteration of mask types.
|
sl@0
|
120 |
Generates next mask type.
|
sl@0
|
121 |
@return EFalse is returned if end of iterations else ETrue.
|
sl@0
|
122 |
*/
|
sl@0
|
123 |
TBool CTBitBltMaskedBase::NextMaskIteration()
|
sl@0
|
124 |
{
|
sl@0
|
125 |
iMaskType++;
|
sl@0
|
126 |
switch(iMaskType)
|
sl@0
|
127 |
{
|
sl@0
|
128 |
case EMaskL1:
|
sl@0
|
129 |
{
|
sl@0
|
130 |
iMaskPixelFormat = EUidPixelFormatL_1;
|
sl@0
|
131 |
iInvertMask = EFalse;
|
sl@0
|
132 |
iCurrentMask1 = iMask1L1;
|
sl@0
|
133 |
iCurrentMask2 = iMask2L1;
|
sl@0
|
134 |
break;
|
sl@0
|
135 |
}
|
sl@0
|
136 |
|
sl@0
|
137 |
case EMaskL1Inv:
|
sl@0
|
138 |
{
|
sl@0
|
139 |
iMaskPixelFormat = EUidPixelFormatL_1;
|
sl@0
|
140 |
iInvertMask = ETrue;
|
sl@0
|
141 |
iCurrentMask1 = iMask1L1;
|
sl@0
|
142 |
iCurrentMask2 = iMask2L1;
|
sl@0
|
143 |
break;
|
sl@0
|
144 |
}
|
sl@0
|
145 |
|
sl@0
|
146 |
case EMaskL8:
|
sl@0
|
147 |
{
|
sl@0
|
148 |
iMaskPixelFormat = EUidPixelFormatL_8;
|
sl@0
|
149 |
iInvertMask = EFalse;
|
sl@0
|
150 |
iCurrentMask1 = iMask1L8;
|
sl@0
|
151 |
iCurrentMask2 = iMask2L8;
|
sl@0
|
152 |
break;
|
sl@0
|
153 |
}
|
sl@0
|
154 |
|
sl@0
|
155 |
case EMaskIterationEnd:
|
sl@0
|
156 |
{
|
sl@0
|
157 |
return EFalse;
|
sl@0
|
158 |
}
|
sl@0
|
159 |
}
|
sl@0
|
160 |
|
sl@0
|
161 |
return ETrue;
|
sl@0
|
162 |
}
|
sl@0
|
163 |
|
sl@0
|
164 |
/**
|
sl@0
|
165 |
Common positioning test function for BitBltMasked() and DrawBitmapMasked() tests.
|
sl@0
|
166 |
The test iterates positions over whole target, outside target and on the target boundaries
|
sl@0
|
167 |
and call tested function for those positions.
|
sl@0
|
168 |
@param aTestName Name of test case.
|
sl@0
|
169 |
@param aFunc Tested function. EBitBltMasked and EDrawBitmapMasked are supported.
|
sl@0
|
170 |
*/
|
sl@0
|
171 |
void CTBitBltMaskedBase::TestPositioningBaseL(const TDesC& aTestName, TBitBltFuncType aFunc)
|
sl@0
|
172 |
{
|
sl@0
|
173 |
if (iRunningOomTests)
|
sl@0
|
174 |
{
|
sl@0
|
175 |
// OOM tests take too long if this test is run. Doesn't test anything new for OOM over other tests.
|
sl@0
|
176 |
return;
|
sl@0
|
177 |
}
|
sl@0
|
178 |
CFbsBitmap* bitmap;
|
sl@0
|
179 |
if(iTestParams.iDoCompressed)
|
sl@0
|
180 |
{
|
sl@0
|
181 |
bitmap = iCompressedBitmap;
|
sl@0
|
182 |
}
|
sl@0
|
183 |
else
|
sl@0
|
184 |
{
|
sl@0
|
185 |
bitmap = iConcentricRectsBitmap1;
|
sl@0
|
186 |
}
|
sl@0
|
187 |
|
sl@0
|
188 |
TInt width = iGdiTarget->SizeInPixels().iWidth;
|
sl@0
|
189 |
TInt height = iGdiTarget->SizeInPixels().iHeight;
|
sl@0
|
190 |
TInt bmpWidth = bitmap->SizeInPixels().iWidth;
|
sl@0
|
191 |
TInt bmpHeight = bitmap->SizeInPixels().iHeight;
|
sl@0
|
192 |
TSize bmpSize(bmpWidth, bmpHeight);
|
sl@0
|
193 |
|
sl@0
|
194 |
ResetGc();
|
sl@0
|
195 |
|
sl@0
|
196 |
TPositionIterator posIterator(-30, width+30, bmpWidth, -30, height+30, bmpHeight);
|
sl@0
|
197 |
posIterator.Begin();
|
sl@0
|
198 |
|
sl@0
|
199 |
do
|
sl@0
|
200 |
{
|
sl@0
|
201 |
TPoint pos(posIterator.iPosX+posIterator.iIndexY, posIterator.iPosY+posIterator.iIndexX);
|
sl@0
|
202 |
|
sl@0
|
203 |
if(aFunc == EBitBltMasked)
|
sl@0
|
204 |
{
|
sl@0
|
205 |
if(iMaskPixelFormat == EUidPixelFormatL_1)
|
sl@0
|
206 |
{
|
sl@0
|
207 |
iGc->BitBltMasked(pos, *bitmap,
|
sl@0
|
208 |
TRect(TPoint(0, 0), bmpSize), *iCurrentMask1, iInvertMask);
|
sl@0
|
209 |
}
|
sl@0
|
210 |
else
|
sl@0
|
211 |
{
|
sl@0
|
212 |
// additionaly mask position is iterated
|
sl@0
|
213 |
iGc->BitBltMasked(pos, *bitmap,
|
sl@0
|
214 |
TRect(TPoint(0, 0), bmpSize), *iCurrentMask1, TPoint(posIterator.iIndexX, posIterator.iIndexY));
|
sl@0
|
215 |
}
|
sl@0
|
216 |
}
|
sl@0
|
217 |
else // (aFunc == EDrawBitmapMasked)
|
sl@0
|
218 |
{
|
sl@0
|
219 |
iGc->DrawBitmapMasked(TRect(pos, bmpSize), *bitmap,
|
sl@0
|
220 |
TRect(TPoint(0, 0), bmpSize), *iCurrentMask1, iInvertMask);
|
sl@0
|
221 |
}
|
sl@0
|
222 |
}
|
sl@0
|
223 |
while(posIterator.Next());
|
sl@0
|
224 |
|
sl@0
|
225 |
// WORKAROUND:
|
sl@0
|
226 |
// It looks like AlphaBlendBitmaps() (which is mapped on DrawBitmapMasked() with alpha for BitGDI)
|
sl@0
|
227 |
// do not support clipping and returns KErrArgument for destination rect (partialy) outside the target.
|
sl@0
|
228 |
if(aFunc == EBitBltMasked)
|
sl@0
|
229 |
{
|
sl@0
|
230 |
if(iUseDirectGdi || (iMaskPixelFormat == EUidPixelFormatL_1) || (iGc->GetError() != KErrArgument))
|
sl@0
|
231 |
{
|
sl@0
|
232 |
TESTNOERROR(iGc->GetError());
|
sl@0
|
233 |
}
|
sl@0
|
234 |
}
|
sl@0
|
235 |
else
|
sl@0
|
236 |
{
|
sl@0
|
237 |
TESTNOERROR(iGc->GetError());
|
sl@0
|
238 |
}
|
sl@0
|
239 |
if(!iTestParams.iDoCompressed)
|
sl@0
|
240 |
TESTNOERRORL(WriteTargetOutput(aTestName));
|
sl@0
|
241 |
}
|
sl@0
|
242 |
|
sl@0
|
243 |
/**
|
sl@0
|
244 |
Common invalid parameters test function for BitBltMasked() and DrawBitmapMasked() tests.
|
sl@0
|
245 |
The function tests against invalid source rectangle, zero size source bitmap (both should
|
sl@0
|
246 |
return KErrArgument) and not initialised source bitmap (should return KErrBadHandle).
|
sl@0
|
247 |
@param aTestName Name of test case.
|
sl@0
|
248 |
@param aFunc Tested function. EBitBltMasked and EDrawBitmapMasked are supported.
|
sl@0
|
249 |
*/
|
sl@0
|
250 |
void CTBitBltMaskedBase::TestInvalidParametersBaseL(const TDesC& aTestName, TBitBltFuncType aFunc)
|
sl@0
|
251 |
{
|
sl@0
|
252 |
ResetGc();
|
sl@0
|
253 |
|
sl@0
|
254 |
CFbsBitmap* bitmap = iConcentricRectsBitmap2;
|
sl@0
|
255 |
|
sl@0
|
256 |
TInt bmpWidth = bitmap->SizeInPixels().iWidth;
|
sl@0
|
257 |
TInt bmpHeight = bitmap->SizeInPixels().iHeight;
|
sl@0
|
258 |
TSize bmpSize(bmpWidth, bmpHeight);
|
sl@0
|
259 |
|
sl@0
|
260 |
// invalid source rectangle
|
sl@0
|
261 |
RArray<TRect> rectArray;
|
sl@0
|
262 |
CleanupClosePushL(rectArray);
|
sl@0
|
263 |
TInt err = KErrNone;
|
sl@0
|
264 |
err |= rectArray.Append(TRect(-30, -30, -10, -10));
|
sl@0
|
265 |
err |= rectArray.Append(TRect(bmpWidth+10, bmpHeight+10, bmpWidth+20, bmpHeight+20));
|
sl@0
|
266 |
err |= rectArray.Append(TRect(bmpWidth, bmpHeight, 0, 0));
|
sl@0
|
267 |
err |= rectArray.Append(TRect(-10, -10, -30, -30));
|
sl@0
|
268 |
err |= rectArray.Append(TRect(0, 0, 0, 0));
|
sl@0
|
269 |
TESTL(KErrNone == err);
|
sl@0
|
270 |
|
sl@0
|
271 |
for(TInt i = 0; i < rectArray.Count(); i++)
|
sl@0
|
272 |
{
|
sl@0
|
273 |
if(aFunc == EBitBltMasked)
|
sl@0
|
274 |
{
|
sl@0
|
275 |
iGc->BitBltMasked(TPoint(i*20, 0), *bitmap, rectArray[i], *iMask1L1, EFalse);
|
sl@0
|
276 |
}
|
sl@0
|
277 |
else // (aFunc == EDrawBitmapMasked)
|
sl@0
|
278 |
{
|
sl@0
|
279 |
iGc->DrawBitmapMasked(TRect(TPoint(i*20, 0), bmpSize), *bitmap, rectArray[i], *iMask1L1, EFalse);
|
sl@0
|
280 |
}
|
sl@0
|
281 |
}
|
sl@0
|
282 |
|
sl@0
|
283 |
TESTNOERRORL(iGc->GetError());
|
sl@0
|
284 |
|
sl@0
|
285 |
CleanupStack::PopAndDestroy(&rectArray);
|
sl@0
|
286 |
|
sl@0
|
287 |
TRect zeroRect(TPoint(0, 0), TSize(0, 0));
|
sl@0
|
288 |
|
sl@0
|
289 |
if(aFunc == EBitBltMasked)
|
sl@0
|
290 |
{
|
sl@0
|
291 |
// invalid source bitmap, zero size bitmap
|
sl@0
|
292 |
iGc->BitBltMasked(TPoint(0, 20), *iZeroSizeBitmap, zeroRect, *iMask1L1, EFalse);
|
sl@0
|
293 |
CheckErrorsL(KErrArgument, KErrNone, (TText8*)__FILE__, __LINE__);
|
sl@0
|
294 |
|
sl@0
|
295 |
iGc->BitBltMasked(TPoint(20, 20), *iZeroSizeBitmap, zeroRect, *iMask1L8, TPoint(0, 0));
|
sl@0
|
296 |
TESTL(iGc->GetError() == KErrArgument);
|
sl@0
|
297 |
|
sl@0
|
298 |
iGc->BitBltMasked(TPoint(20, 20), *iZeroSizeBitmap, zeroRect, *iMask1L8, TPoint(0, 0));
|
sl@0
|
299 |
TESTL(iGc->GetError() == KErrArgument);
|
sl@0
|
300 |
|
sl@0
|
301 |
// invalid source bitmap, not initialised bitmap
|
sl@0
|
302 |
iGc->BitBltMasked(TPoint(0, 40), *iNotInitialisedBitmap, zeroRect, *iMask1L1, EFalse);
|
sl@0
|
303 |
CheckErrorsL(KErrBadHandle, KErrNone, (TText8*)__FILE__, __LINE__);
|
sl@0
|
304 |
|
sl@0
|
305 |
iGc->BitBltMasked(TPoint(20, 40), *iNotInitialisedBitmap, zeroRect, *iMask1L8, TPoint(0, 0));
|
sl@0
|
306 |
TESTL(iGc->GetError() == iUseDirectGdi ? KErrBadHandle : KErrArgument);
|
sl@0
|
307 |
|
sl@0
|
308 |
TRect bmpRect(TPoint(0, 0), bmpSize);
|
sl@0
|
309 |
|
sl@0
|
310 |
// BitGDI performs drawing when mask is zero sized or not initialised
|
sl@0
|
311 |
// so we test only in DirectGDI
|
sl@0
|
312 |
if(iUseDirectGdi)
|
sl@0
|
313 |
{
|
sl@0
|
314 |
// invalid mask, zero size mask
|
sl@0
|
315 |
iGc->BitBltMasked(TPoint(0, 60), *bitmap, bmpRect, *iZeroSizeMask, EFalse);
|
sl@0
|
316 |
TESTL(iGc->GetError() == KErrArgument);
|
sl@0
|
317 |
|
sl@0
|
318 |
iGc->BitBltMasked(TPoint(20, 60), *bitmap, bmpRect, *iZeroSizeMask, TPoint(0, 0));
|
sl@0
|
319 |
TESTL(iGc->GetError() == KErrArgument);
|
sl@0
|
320 |
|
sl@0
|
321 |
// invalid mask, not initialised mask
|
sl@0
|
322 |
iGc->BitBltMasked(TPoint(0, 80), *bitmap, bmpRect, *iNotInitialisedMask, EFalse);
|
sl@0
|
323 |
TESTL(iGc->GetError() == KErrBadHandle);
|
sl@0
|
324 |
|
sl@0
|
325 |
iGc->BitBltMasked(TPoint(20, 80), *bitmap, bmpRect, *iNotInitialisedMask, TPoint(0, 0));
|
sl@0
|
326 |
TESTL(iGc->GetError() == KErrBadHandle);
|
sl@0
|
327 |
}
|
sl@0
|
328 |
}
|
sl@0
|
329 |
else // (aFunc == EDrawBitmapMasked)
|
sl@0
|
330 |
{
|
sl@0
|
331 |
// invalid source bitmap, zero size bitmap
|
sl@0
|
332 |
iGc->DrawBitmapMasked(TRect(TPoint(0, 20), TSize(0, 0)), *iZeroSizeBitmap, zeroRect, *iMask1L1, EFalse);
|
sl@0
|
333 |
CheckErrorsL(KErrArgument, KErrNone, (TText8*)__FILE__, __LINE__);
|
sl@0
|
334 |
|
sl@0
|
335 |
// invalid source bitmap, not initialised bitmap
|
sl@0
|
336 |
iGc->DrawBitmapMasked(TRect(TPoint(0, 40), TSize(0, 0)), *iNotInitialisedBitmap, zeroRect, *iMask1L1, EFalse);
|
sl@0
|
337 |
CheckErrorsL(KErrBadHandle, KErrNone, (TText8*)__FILE__, __LINE__);
|
sl@0
|
338 |
|
sl@0
|
339 |
// invalid mask, zero size mask
|
sl@0
|
340 |
TRect bmpRect(TPoint(0, 0), bmpSize);
|
sl@0
|
341 |
iGc->DrawBitmapMasked(TRect(TPoint(0, 60), bmpSize), *bitmap, bmpRect, *iZeroSizeMask, EFalse);
|
sl@0
|
342 |
CheckErrorsL(KErrArgument, KErrNone, (TText8*)__FILE__, __LINE__);
|
sl@0
|
343 |
|
sl@0
|
344 |
// invalid mask, not initialised mask
|
sl@0
|
345 |
iGc->DrawBitmapMasked(TRect(TPoint(0, 80), bmpSize), *bitmap, bmpRect, *iNotInitialisedMask, EFalse);
|
sl@0
|
346 |
CheckErrorsL(KErrBadHandle, KErrNone, (TText8*)__FILE__, __LINE__);
|
sl@0
|
347 |
}
|
sl@0
|
348 |
|
sl@0
|
349 |
// Test if target is clear. By definition, images rendered using any invalid parameter,
|
sl@0
|
350 |
// should result in no change in the target.
|
sl@0
|
351 |
//This test is not valid for BitGDI as it generates an output if mask size is zero.
|
sl@0
|
352 |
if(iUseDirectGdi)
|
sl@0
|
353 |
{
|
sl@0
|
354 |
TBool res = TestTargetL(KRgbWhite);
|
sl@0
|
355 |
TEST(res);
|
sl@0
|
356 |
// output the bitmap if there was an error to assist with debugging
|
sl@0
|
357 |
if (res == EFalse)
|
sl@0
|
358 |
{
|
sl@0
|
359 |
TESTNOERRORL(WriteTargetOutput(aTestName));
|
sl@0
|
360 |
}
|
sl@0
|
361 |
}
|
sl@0
|
362 |
|
sl@0
|
363 |
}
|
sl@0
|
364 |
|
sl@0
|
365 |
/**
|
sl@0
|
366 |
Common source bitmap cloning test function for BitBltMasked() and DrawBitmapMasked() tests.
|
sl@0
|
367 |
@param aTestName Name of test case.
|
sl@0
|
368 |
@param aFunc Tested function. EBitBltMasked and EDrawBitmapMasked are supported.
|
sl@0
|
369 |
*/
|
sl@0
|
370 |
void CTBitBltMaskedBase::TestSourceBitmapCloningBaseL(const TDesC& aTestName, TBitBltFuncType aFunc)
|
sl@0
|
371 |
{
|
sl@0
|
372 |
ResetGc();
|
sl@0
|
373 |
|
sl@0
|
374 |
TInt width = iGdiTarget->SizeInPixels().iWidth;
|
sl@0
|
375 |
TInt height = iGdiTarget->SizeInPixels().iHeight;
|
sl@0
|
376 |
|
sl@0
|
377 |
TSize bmpSize(KBitmap2Size);
|
sl@0
|
378 |
|
sl@0
|
379 |
for(TInt i = 0; i < 5; i++)
|
sl@0
|
380 |
{
|
sl@0
|
381 |
CFbsBitmap* bitmap = CreateConcentricRectsBitmapL(iTestParams.iSourcePixelFormat, bmpSize);
|
sl@0
|
382 |
if(iTestParams.iDoCompressed)
|
sl@0
|
383 |
bitmap->Compress();
|
sl@0
|
384 |
|
sl@0
|
385 |
if(aFunc == EBitBltMasked)
|
sl@0
|
386 |
{
|
sl@0
|
387 |
iGc->BitBltMasked(TPoint(55-35+i*10+1, -60+80+i*7+1), *bitmap,
|
sl@0
|
388 |
TRect(TPoint(0, 0), bmpSize), *iCurrentMask2, iInvertMask);
|
sl@0
|
389 |
}
|
sl@0
|
390 |
else // (aFunc == EDrawBitmapMasked)
|
sl@0
|
391 |
{
|
sl@0
|
392 |
iGc->DrawBitmapMasked(TRect(TPoint(55-35+i*10+1, -60+80+i*7+1), bmpSize), *bitmap,
|
sl@0
|
393 |
TRect(TPoint(0, 0), bmpSize), *iCurrentMask2, iInvertMask);
|
sl@0
|
394 |
}
|
sl@0
|
395 |
|
sl@0
|
396 |
delete bitmap;
|
sl@0
|
397 |
bitmap = NULL;
|
sl@0
|
398 |
|
sl@0
|
399 |
bmpSize -= TSize(10, 15);
|
sl@0
|
400 |
}
|
sl@0
|
401 |
|
sl@0
|
402 |
TESTNOERRORL(iGc->GetError());
|
sl@0
|
403 |
if(!iTestParams.iDoCompressed)
|
sl@0
|
404 |
TESTNOERRORL(WriteTargetOutput(aTestName));
|
sl@0
|
405 |
}
|
sl@0
|
406 |
|
sl@0
|
407 |
/**
|
sl@0
|
408 |
Common mask cloning test function for BitBltMasked() and DrawBitmapMasked() tests.
|
sl@0
|
409 |
@param aTestName Name of test case.
|
sl@0
|
410 |
@param aFunc Tested function. EBitBltMasked and EDrawBitmapMasked are supported.
|
sl@0
|
411 |
*/
|
sl@0
|
412 |
void CTBitBltMaskedBase::TestMaskCloningBaseL(const TDesC& aTestName, TBitBltFuncType aFunc)
|
sl@0
|
413 |
{
|
sl@0
|
414 |
ResetGc();
|
sl@0
|
415 |
|
sl@0
|
416 |
TSize maskSize(KBitmap2Size);
|
sl@0
|
417 |
|
sl@0
|
418 |
for(TInt i = 0; i < 5; i++)
|
sl@0
|
419 |
{
|
sl@0
|
420 |
CFbsBitmap* mask = CreateCheckedBoardBitmapL(EUidPixelFormatL_1, maskSize, TSize(8, 8));
|
sl@0
|
421 |
if(iTestParams.iDoCompressed)
|
sl@0
|
422 |
mask->Compress();
|
sl@0
|
423 |
|
sl@0
|
424 |
if(aFunc == EBitBltMasked)
|
sl@0
|
425 |
{
|
sl@0
|
426 |
iGc->BitBltMasked(TPoint(55-35+i*10+1, -60+80+i*7+1), *iConcentricRectsBitmap2,
|
sl@0
|
427 |
TRect(TPoint(0, 0), KBitmap2Size), *mask, iInvertMask);
|
sl@0
|
428 |
}
|
sl@0
|
429 |
else // (aFunc == EDrawBitmapMasked)
|
sl@0
|
430 |
{
|
sl@0
|
431 |
iGc->DrawBitmapMasked(TRect(TPoint(55-35+i*10+1, -60+80+i*7+1), iConcentricRectsBitmap2->SizeInPixels()),
|
sl@0
|
432 |
*iConcentricRectsBitmap2, TRect(TPoint(0, 0), KBitmap2Size), *mask, iInvertMask);
|
sl@0
|
433 |
}
|
sl@0
|
434 |
|
sl@0
|
435 |
delete mask;
|
sl@0
|
436 |
mask = NULL;
|
sl@0
|
437 |
|
sl@0
|
438 |
maskSize -= TSize(10, 15);
|
sl@0
|
439 |
}
|
sl@0
|
440 |
|
sl@0
|
441 |
TESTNOERRORL(iGc->GetError());
|
sl@0
|
442 |
|
sl@0
|
443 |
if(!iTestParams.iDoCompressed)
|
sl@0
|
444 |
TESTNOERRORL(WriteTargetOutput(aTestName));
|
sl@0
|
445 |
}
|