|
1 // Copyright (c) 2008-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 /** |
|
17 @file |
|
18 @test |
|
19 @internalComponent - Internal Symbian test code |
|
20 */ |
|
21 |
|
22 #include "tsimpledrawing_directgdi.h" |
|
23 |
|
24 #include <graphics/directgdidriver.h> |
|
25 |
|
26 // The number of iterations to perform for each test. All but the line drawing tests |
|
27 // will use this figure. Line tests use the figure below as more repetition is needed. |
|
28 const TInt KIterationsToTest = 200; |
|
29 |
|
30 // This value must not be greater than the extents of the pixmap, otherwise |
|
31 // line-drawing tests will get clipped and results will be distorted. |
|
32 const TInt KLineDrawingIterationsToTest = 750; |
|
33 |
|
34 // Number of iterations for all text-rendering tests. |
|
35 const TInt KTextDrawingIterationsToTest = 2000; |
|
36 |
|
37 _LIT(KTestBitmap, "z:\\system\\data\\uibench_24bit.mbm"); |
|
38 |
|
39 // The following constants should match those in tsimpledrawing.cpp for a like-for-like |
|
40 // comparison. |
|
41 // |
|
42 _LIT(KTextPhrase, "abcdefABCDEF0123456789"); |
|
43 const TInt KTextPhraseLength = KTextPhrase().Length(); |
|
44 |
|
45 CTSimpleDrawingDirectGdi::CTSimpleDrawingDirectGdi() |
|
46 { |
|
47 SetTestStepName(KTSimpleDrawingPerfDirectGdi); |
|
48 } |
|
49 |
|
50 CTSimpleDrawingDirectGdi::~CTSimpleDrawingDirectGdi() |
|
51 { |
|
52 } |
|
53 |
|
54 TVerdict CTSimpleDrawingDirectGdi::doTestStepPreambleL() |
|
55 { |
|
56 CTDirectGdiTestBase::doTestStepPreambleL(); |
|
57 |
|
58 iBitmap = new(ELeave) CFbsBitmap; |
|
59 TInt ret = iBitmap->Load(KTestBitmap, 0, EFalse); |
|
60 TESTL(ret == KErrNone); |
|
61 INFO_PRINTF3(_L("Size of bitmap: %d x %d"), iBitmap->SizeInPixels().iWidth, iBitmap->SizeInPixels().iHeight); |
|
62 |
|
63 iScreenRect = TRect(1,1,GetPixmapSizeInPixels().iWidth, GetPixmapSizeInPixels().iHeight); |
|
64 |
|
65 return TestStepResult(); |
|
66 } |
|
67 |
|
68 |
|
69 /** |
|
70 Override of base class pure virtual |
|
71 Our implementation only gets called if the base class doTestStepPreambleL() did |
|
72 not leave. That being the case, the current test result value will be EPass. |
|
73 |
|
74 @return - TVerdict code |
|
75 */ |
|
76 TVerdict CTSimpleDrawingDirectGdi::doTestStepL() |
|
77 { |
|
78 // Perform all tests for each display mode. |
|
79 for(TInt dispModeIndex = 0; dispModeIndex < iTargetPixelFormatArray.Count(); ++dispModeIndex) |
|
80 { |
|
81 iDisplayMode = TDisplayModeMapping::MapPixelFormatToDisplayMode(iTargetPixelFormatArray[dispModeIndex]); |
|
82 if(SetTargetPixelFormatL(iDisplayMode)) |
|
83 { |
|
84 SetTestStepID(_L("GRAPHICS-UI-BENCH-0098")); |
|
85 ClearingL(); |
|
86 RecordTestResultL(); |
|
87 SetTestStepID(_L("GRAPHICS-UI-BENCH-0099")); |
|
88 LineDrawingL(); |
|
89 RecordTestResultL(); |
|
90 SetTestStepID(_L("GRAPHICS-UI-BENCH-0103")); |
|
91 VerticalLinesL(); |
|
92 RecordTestResultL(); |
|
93 SetTestStepID(_L("GRAPHICS-UI-BENCH-0104")); |
|
94 HorizontalLinesL(); |
|
95 RecordTestResultL(); |
|
96 SetTestStepID(_L("GRAPHICS-UI-BENCH-0101")); |
|
97 CopyRectL(); |
|
98 RecordTestResultL(); |
|
99 SetTestStepID(_L("GRAPHICS-UI-BENCH-0102")); |
|
100 DrawRectL(); |
|
101 RecordTestResultL(); |
|
102 SetTestStepID(_L("GRAPHICS-UI-BENCH-0100")); |
|
103 ThickLinesL(); |
|
104 RecordTestResultL(); |
|
105 SetTestStepID(_L("GRAPHICS-UI-BENCH-0105")); |
|
106 TextDrawingL(); |
|
107 RecordTestResultL(); |
|
108 SetTestStepID(_L("GRAPHICS-UI-BENCH-0171")); |
|
109 TextDrawingAntiAliasedL(); |
|
110 RecordTestResultL(); |
|
111 SetTestStepID(_L("GRAPHICS-UI-BENCH-0106")); |
|
112 TextDrawingWithOverheadL(); |
|
113 RecordTestResultL(); |
|
114 SetTestStepID(_L("GRAPHICS-UI-BENCH-0107")); |
|
115 LargeTextDrawingL(); |
|
116 RecordTestResultL(); |
|
117 } |
|
118 } |
|
119 |
|
120 CloseTMSGraphicsStep(); |
|
121 return TestStepResult(); |
|
122 } |
|
123 |
|
124 TVerdict CTSimpleDrawingDirectGdi::doTestStepPostambleL() |
|
125 { |
|
126 delete iBitmap; |
|
127 iBitmap = NULL; |
|
128 return CTDirectGdiTestBase::doTestStepPostambleL(); |
|
129 } |
|
130 |
|
131 /** |
|
132 @SYMTestCaseID |
|
133 GRAPHICS-UI-BENCH-0098 |
|
134 |
|
135 @SYMPREQ PREQ39 |
|
136 |
|
137 @SYMREQ REQ9236 |
|
138 @SYMREQ REQ9237 |
|
139 |
|
140 @SYMTestCaseDesc |
|
141 Measures the performance of Clear(). |
|
142 |
|
143 @SYMTestActions |
|
144 Clear the target, call Finish() so that when the timer begins all outstanding drawing has finished. |
|
145 For KIterationsToTest, clear the entire contents of the screen, and Finish(). |
|
146 Calculate and log the results as a pixel rate. |
|
147 |
|
148 @SYMTestExpectedResults |
|
149 The performance to be logged as a pixel rate. |
|
150 */ |
|
151 void CTSimpleDrawingDirectGdi::ClearingL() |
|
152 { |
|
153 _LIT (KTestName, "DirectGdi Clear Screen"); |
|
154 |
|
155 // Erase the target |
|
156 iContext->Clear(); |
|
157 iDGdiDriver->Finish(); |
|
158 |
|
159 iProfiler->InitResults (); |
|
160 for (TInt count = 0; count < KIterationsToTest; count++) |
|
161 { |
|
162 iContext->Clear (iScreenRect); |
|
163 iDGdiDriver->Finish (); |
|
164 } |
|
165 iProfiler->MarkResultSetL(); |
|
166 TEST(iDGdiDriver->GetError() == KErrNone); |
|
167 |
|
168 iProfiler->ResultsAnalysisPixelRate(KTestName, 0, 0, iDisplayMode, KIterationsToTest, iScreenRect.Width()*iScreenRect.Height() ); |
|
169 } |
|
170 |
|
171 /** |
|
172 @SYMTestCaseID |
|
173 GRAPHICS-UI-BENCH-0099 |
|
174 |
|
175 @SYMPREQ PREQ39 |
|
176 |
|
177 @SYMREQ REQ9236 |
|
178 @SYMREQ REQ9237 |
|
179 |
|
180 @SYMTestCaseDesc |
|
181 Measures the performance of DrawLine(). |
|
182 Draws a diagonal one pixel line. With each iteration, the left edge of the line is moved down |
|
183 whilst the right edge is moved up, so that varying diagonals are tested. |
|
184 |
|
185 @SYMTestActions |
|
186 Clear the target, call Finish() so that when the timer begins all outstanding drawing has finished. |
|
187 For KLineDrawingIterationsToTest, a line is drawn from from the left edge to the right edge of the |
|
188 target. With each iteration, the left edge is moved down and the right edge is moved up to cover |
|
189 varying angles of line. The lines are drawn with a pen size 1,1. |
|
190 |
|
191 @SYMTestExpectedResults |
|
192 The performance to be logged as a pixel rate. |
|
193 */ |
|
194 void CTSimpleDrawingDirectGdi::LineDrawingL() |
|
195 { |
|
196 _LIT(KTestName, "DirectGdi Line Drawing"); |
|
197 |
|
198 DoLineDrawingL(KTestName(), TSize(1,1)); |
|
199 } |
|
200 |
|
201 /** |
|
202 @SYMTestCaseID |
|
203 GRAPHICS-UI-BENCH-0100 |
|
204 |
|
205 @SYMPREQ PREQ39 |
|
206 |
|
207 @SYMREQ REQ9236 |
|
208 @SYMREQ REQ9237 |
|
209 |
|
210 @SYMTestCaseDesc |
|
211 Measures the performance of DrawLine(). |
|
212 Draws a diagonal thick line. With each iteration, the left edge is moved down and the right edge is |
|
213 moved up so that varying angles are tested. |
|
214 |
|
215 @SYMTestActions |
|
216 Clear the target, call Finish() so that when the timer begins all outstanding drawing has finished. |
|
217 For KLineDrawingIterationsToTest, a line is drawn from from the left edge to the right edge of the |
|
218 target. With each iteration, the left edge is moved down and the right edge is moved up to cover |
|
219 varying angles of line. The lines are drawn with a pen size 10,10. |
|
220 |
|
221 @SYMTestExpectedResults |
|
222 The performance to be logged as a pixel rate. |
|
223 */ |
|
224 void CTSimpleDrawingDirectGdi::ThickLinesL() |
|
225 { |
|
226 _LIT(KTestName, "DirectGdi Draw Thick Lines"); |
|
227 |
|
228 DoLineDrawingL(KTestName(), TSize(10,10)); |
|
229 |
|
230 // Reset the pensize. |
|
231 iContext->SetPenSize(TSize(1, 1)); |
|
232 } |
|
233 |
|
234 /** |
|
235 Helper method. Used by diagonal line drawing tests. |
|
236 @param aName The test name. |
|
237 @param aPenSize The pen size. |
|
238 */ |
|
239 void CTSimpleDrawingDirectGdi::DoLineDrawingL(TPtrC aName, const TSize& aPenSize) |
|
240 { |
|
241 // Erase the target |
|
242 iContext->Clear(); |
|
243 iDGdiDriver->Finish(); |
|
244 |
|
245 TRect rect(iScreenRect); |
|
246 iContext->SetPenSize(aPenSize); |
|
247 iProfiler->InitResults(); |
|
248 for (TInt count = KLineDrawingIterationsToTest; count > 0 ; --count) |
|
249 { |
|
250 iContext->DrawLine(rect.iTl, rect.iBr); |
|
251 ++rect.iTl.iY; |
|
252 --rect.iBr.iY; |
|
253 } |
|
254 iDGdiDriver->Finish(); |
|
255 iProfiler->MarkResultSetL(); |
|
256 TEST(iDGdiDriver->GetError() == KErrNone); |
|
257 WriteTargetOutput(aName); |
|
258 |
|
259 iProfiler->ResultsAnalysisPixelRate(aName, 0, 0, iDisplayMode, KLineDrawingIterationsToTest, rect.Width()*aPenSize.iHeight); |
|
260 } |
|
261 |
|
262 /** |
|
263 @SYMTestCaseID |
|
264 GRAPHICS-UI-BENCH-0101 |
|
265 |
|
266 @SYMPREQ PREQ39 |
|
267 |
|
268 @SYMREQ REQ9236 |
|
269 @SYMREQ REQ9237 |
|
270 |
|
271 @SYMTestCaseDesc |
|
272 Measure the performance of CopyRect(), by copying a rectangle from one part of the screen to another. |
|
273 |
|
274 @SYMTestActions |
|
275 Clear the target, call Finish() so that when the timer begins all outstanding drawing has finished. |
|
276 For KIterationsToTest, the entire screen contents to a location 2 pixels away in X/Y. |
|
277 Call Finish() to force the drawing to complete, before logging the time. |
|
278 |
|
279 @SYMTestExpectedResults |
|
280 The performance to be logged as a pixel rate. |
|
281 */ |
|
282 void CTSimpleDrawingDirectGdi::CopyRectL() |
|
283 { |
|
284 _LIT(KTestName, "DirectGdi CopyRect"); |
|
285 |
|
286 // Erase the target |
|
287 iContext->Clear(); |
|
288 iDGdiDriver->Finish(); |
|
289 |
|
290 iProfiler->InitResults(); |
|
291 for (TInt count = 0; count < KIterationsToTest; count++) |
|
292 { |
|
293 iContext->CopyRect(TPoint(2,2), iScreenRect); |
|
294 } |
|
295 iDGdiDriver->Finish(); |
|
296 iProfiler->MarkResultSetL(); |
|
297 TEST(iDGdiDriver->GetError() == KErrNone); |
|
298 WriteTargetOutput(KTestName()); |
|
299 |
|
300 iProfiler->ResultsAnalysisPixelRate(KTestName, 0, 0, iDisplayMode, KIterationsToTest, iScreenRect.Width()*iScreenRect.Height()); |
|
301 } |
|
302 |
|
303 /** |
|
304 @SYMTestCaseID |
|
305 GRAPHICS-UI-BENCH-0102 |
|
306 |
|
307 @SYMPREQ PREQ39 |
|
308 |
|
309 @SYMREQ REQ9236 |
|
310 @SYMREQ REQ9237 |
|
311 |
|
312 @SYMTestCaseDesc |
|
313 Measure the performance of DrawRect(), with a patterned fill. |
|
314 |
|
315 @SYMTestActions |
|
316 Clear the target, call Finish() so that when the timer begins all outstanding drawing has finished. |
|
317 Set bitmap as brush and draw rectangle using this brush for KIterationsToTest. |
|
318 Call Finish() to force the drawing to complete, before logging the time. |
|
319 |
|
320 @SYMTestExpectedResults |
|
321 The performance to be logged as a pixel rate. |
|
322 */ |
|
323 void CTSimpleDrawingDirectGdi::DrawRectL() |
|
324 { |
|
325 _LIT(KTestName, "DirectGdi DrawRect"); |
|
326 TEST(iBitmap->Handle() != 0); |
|
327 |
|
328 // Erase the target |
|
329 iContext->Clear(); |
|
330 iDGdiDriver->Finish(); |
|
331 |
|
332 iContext->SetBrushPattern(*iBitmap); |
|
333 iContext->SetBrushStyle(DirectGdi::EPatternedBrush); |
|
334 iProfiler->InitResults(); |
|
335 for (TInt count = 0; count < KIterationsToTest; count++) |
|
336 { |
|
337 iContext->DrawRect(iScreenRect); |
|
338 } |
|
339 iDGdiDriver->Finish(); |
|
340 iProfiler->MarkResultSetL(); |
|
341 TEST(iDGdiDriver->GetError() == KErrNone); |
|
342 WriteTargetOutput(KTestName()); |
|
343 |
|
344 iProfiler->ResultsAnalysisPixelRate(KTestName, 0, 0, iDisplayMode, KIterationsToTest, iScreenRect.Width() * iScreenRect.Height()); |
|
345 iContext->SetBrushStyle(DirectGdi::ENullBrush); |
|
346 } |
|
347 |
|
348 /** |
|
349 @SYMTestCaseID |
|
350 GRAPHICS-UI-BENCH-0103 |
|
351 |
|
352 @SYMPREQ PREQ39 |
|
353 |
|
354 @SYMREQ REQ9236 |
|
355 @SYMREQ REQ9237 |
|
356 |
|
357 @SYMTestCaseDesc |
|
358 Measures the performance of DrawLine(), drawing vertical lines. |
|
359 |
|
360 @SYMTestActions |
|
361 Clear the target, call Finish() so that when the timer begins all outstanding drawing has finished. |
|
362 For KLineDrawingIterationsToTest, draw a vertical line from the far left of the target to the right. |
|
363 Call Finish() to force the drawing to complete, before logging the time. |
|
364 The pen size is 1,1. |
|
365 |
|
366 @SYMTestExpectedResults |
|
367 The performance to be logged as a pixel rate. |
|
368 */ |
|
369 void CTSimpleDrawingDirectGdi::VerticalLinesL() |
|
370 { |
|
371 _LIT(KTestName, "DirectGdi Vertical Lines"); |
|
372 |
|
373 // Erase the target |
|
374 iContext->Clear(); |
|
375 iDGdiDriver->Finish(); |
|
376 |
|
377 iContext->SetPenSize(TSize(1, 1)); |
|
378 iProfiler->InitResults(); |
|
379 for (TInt count = 0; count < KLineDrawingIterationsToTest; ++count) |
|
380 { |
|
381 iContext->DrawLine(TPoint(iScreenRect.iTl.iX+count, iScreenRect.iTl.iY), TPoint(iScreenRect.iTl.iX+count, iScreenRect.iBr.iY)); |
|
382 } |
|
383 iDGdiDriver->Finish(); |
|
384 iProfiler->MarkResultSetL(); |
|
385 TEST(iDGdiDriver->GetError() == KErrNone); |
|
386 WriteTargetOutput(KTestName()); |
|
387 |
|
388 iProfiler->ResultsAnalysisPixelRate(KTestName, 0, 0, iDisplayMode, KLineDrawingIterationsToTest, iScreenRect.Height()); |
|
389 } |
|
390 |
|
391 /** |
|
392 @SYMTestCaseID |
|
393 GRAPHICS-UI-BENCH-0104 |
|
394 |
|
395 @SYMPREQ PREQ39 |
|
396 |
|
397 @SYMREQ REQ9236 |
|
398 @SYMREQ REQ9237 |
|
399 |
|
400 @SYMTestCaseDesc |
|
401 Measures the performance of DrawLine(), drawing horizontal lines. |
|
402 |
|
403 @SYMTestActions |
|
404 Clear the target, call Finish() so that when the timer begins all outstanding drawing has finished. |
|
405 For KLineDrawingIterationsToTest, draw a horizontal line from the top of the target to the bottom. |
|
406 Call Finish() to force the drawing to complete, before logging the time. The pen size is 1,1. |
|
407 |
|
408 @SYMTestExpectedResults |
|
409 The performance to be logged as a pixel rate. |
|
410 */ |
|
411 void CTSimpleDrawingDirectGdi::HorizontalLinesL() |
|
412 { |
|
413 _LIT(KTestName, "DirectGdi Horizontal Lines"); |
|
414 |
|
415 // Erase the target |
|
416 iContext->Clear(); |
|
417 iDGdiDriver->Finish(); |
|
418 |
|
419 iContext->SetPenSize(TSize(1, 1)); |
|
420 iProfiler->InitResults(); |
|
421 for (TInt count = 0; count < KLineDrawingIterationsToTest; ++count) |
|
422 { |
|
423 iContext->DrawLine(TPoint(iScreenRect.iTl.iX, iScreenRect.iTl.iY+count), TPoint(iScreenRect.iBr.iX, iScreenRect.iTl.iY+count)); |
|
424 } |
|
425 iDGdiDriver->Finish(); |
|
426 iProfiler->MarkResultSetL(); |
|
427 TEST(iDGdiDriver->GetError() == KErrNone); |
|
428 WriteTargetOutput(KTestName()); |
|
429 |
|
430 iProfiler->ResultsAnalysisPixelRate(KTestName, 0, 0, iDisplayMode, KLineDrawingIterationsToTest, iScreenRect.Width()); |
|
431 } |
|
432 |
|
433 /** |
|
434 @SYMTestCaseID |
|
435 GRAPHICS-UI-BENCH-0105 |
|
436 |
|
437 @SYMPREQ PREQ39 |
|
438 |
|
439 @SYMREQ REQ9236 |
|
440 @SYMREQ REQ9237 |
|
441 |
|
442 @SYMTestCaseDesc |
|
443 Measure the performance of DrawText() when rendering monochrome text. |
|
444 |
|
445 @SYMTestActions |
|
446 Clear the target, call Finish() so that when the timer begins all outstanding drawing has finished. |
|
447 Set the font. |
|
448 Call DrawText() once to force the glyphs into the cache. |
|
449 For KTextDrawingIterationsToTest, draw the same string of text. |
|
450 Call Finish() to force the drawing to complete, before logging the time. |
|
451 |
|
452 @SYMTestExpectedResults |
|
453 The performance to be logged as a pixel rate. |
|
454 */ |
|
455 void CTSimpleDrawingDirectGdi::TextDrawingL() |
|
456 { |
|
457 _LIT(KTestName, "DirectGdi Text Drawing"); |
|
458 // Erase the target |
|
459 iContext->Clear(); |
|
460 iContext->SetFont(iFont); |
|
461 iDGdiDriver->Finish(); |
|
462 |
|
463 // Draw the text once so that we aren't timing the time to load it into the cache. |
|
464 iContext->DrawText(KTextPhrase,NULL,TPoint(10,100)); |
|
465 |
|
466 iProfiler->InitResults(); |
|
467 for(TInt count = KTextDrawingIterationsToTest; count > 0; --count) |
|
468 { |
|
469 iContext->DrawText(KTextPhrase,NULL,TPoint(10,100)); |
|
470 } |
|
471 iDGdiDriver->Finish(); |
|
472 iProfiler->MarkResultSetL(); |
|
473 TEST(iDGdiDriver->GetError() == KErrNone); |
|
474 iProfiler->ResultsAnalysisCharacterRate(KTestName, 0, 0, iDisplayMode, KTextDrawingIterationsToTest, KTextPhraseLength); |
|
475 |
|
476 WriteTargetOutput(KTestName()); |
|
477 iContext->ResetFont(); |
|
478 } |
|
479 |
|
480 /** |
|
481 @SYMTestCaseID |
|
482 GRAPHICS-UI-BENCH-0171 |
|
483 |
|
484 @SYMDEF 135375 |
|
485 |
|
486 @SYMTestCaseDesc |
|
487 Measure the performance of DrawText() when rendering anti-aliased text. |
|
488 |
|
489 @SYMTestActions |
|
490 Clear the target, call Finish() so that when the timer begins all outstanding drawing has finished. |
|
491 Set the font. |
|
492 Call DrawText() once to force the glyphs into the cache. |
|
493 For KTextDrawingIterationsToTest, draw the same string of text. |
|
494 Call Finish() to force the drawing to complete, before logging the time. |
|
495 |
|
496 @SYMTestExpectedResults |
|
497 The performance to be logged as a pixel rate. |
|
498 */ |
|
499 void CTSimpleDrawingDirectGdi::TextDrawingAntiAliasedL() |
|
500 { |
|
501 _LIT(KTestName, "DirectGdi Text Drawing Antialiased"); |
|
502 // Erase the target |
|
503 iContext->Clear(); |
|
504 CFont* font = NULL; |
|
505 TFontSpec fs(KFontTypeface, KFontSize); |
|
506 fs.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap); |
|
507 TESTL(iTs->GetNearestFontToDesignHeightInPixels(font, fs) == KErrNone); |
|
508 iContext->SetFont(font); |
|
509 iDGdiDriver->Finish(); |
|
510 |
|
511 // Draw the text once so that we aren't timing the time to load it into the cache. |
|
512 iContext->DrawText(KTextPhrase,NULL,TPoint(10,100)); |
|
513 |
|
514 iProfiler->InitResults(); |
|
515 for(TInt count = KTextDrawingIterationsToTest; count > 0; --count) |
|
516 { |
|
517 iContext->DrawText(KTextPhrase,NULL,TPoint(10,100)); |
|
518 } |
|
519 iDGdiDriver->Finish(); |
|
520 iProfiler->MarkResultSetL(); |
|
521 |
|
522 TEST(iDGdiDriver->GetError() == KErrNone); |
|
523 iProfiler->ResultsAnalysisCharacterRate(KTestName, 0, 0, iDisplayMode, KTextDrawingIterationsToTest, KTextPhrase().Length()); |
|
524 |
|
525 WriteTargetOutput(KTestName()); |
|
526 iContext->ResetFont(); |
|
527 } |
|
528 |
|
529 /** |
|
530 @SYMTestCaseID |
|
531 GRAPHICS-UI-BENCH-0106 |
|
532 |
|
533 @SYMPREQ PREQ39 |
|
534 |
|
535 @SYMREQ REQ9236 |
|
536 @SYMREQ REQ9237 |
|
537 |
|
538 @SYMTestCaseDesc |
|
539 Measure the performance of DrawText(), with other overhead. |
|
540 |
|
541 @SYMTestActions |
|
542 Clear the target, call Finish() so that when the timer begins all outstanding drawing has finished. |
|
543 Set the font. |
|
544 Call DrawText() once to force the glyphs into the cache. |
|
545 For KTextDrawingIterationsToTest, calculate the text width in pixels, the ascent in pixels, and finally draw the text. |
|
546 Call Finish() to force the drawing to complete, before logging the time. |
|
547 |
|
548 @SYMTestExpectedResults |
|
549 The performance to be logged as a pixel rate. |
|
550 */ |
|
551 void CTSimpleDrawingDirectGdi::TextDrawingWithOverheadL() |
|
552 { |
|
553 _LIT(KTestName, "DirectGdi Text Drawing With Overhead"); |
|
554 // Erase the target |
|
555 iContext->Clear(); |
|
556 iContext->SetFont(iFont); |
|
557 iDGdiDriver->Finish(); |
|
558 |
|
559 // Draw the text once so that we aren't timing the time to load it into the cache. |
|
560 iContext->DrawText(KTextPhrase,NULL,TPoint(10,100)); |
|
561 |
|
562 iProfiler->InitResults(); |
|
563 for(TInt count = KTextDrawingIterationsToTest; count > 0; --count) |
|
564 { |
|
565 (void)iFont->TextWidthInPixels(KTextPhrase); //do nothing with this, just need the overhead |
|
566 (void)iFont->AscentInPixels(); //more typical overhead in a drawtext operation |
|
567 iContext->DrawText(KTextPhrase,NULL,TPoint(10,100)); |
|
568 } |
|
569 iDGdiDriver->Finish(); |
|
570 iProfiler->MarkResultSetL(); |
|
571 TEST(iDGdiDriver->GetError() == KErrNone); |
|
572 iProfiler->ResultsAnalysisCharacterRate(KTestName, 0, 0, iDisplayMode, KTextDrawingIterationsToTest, KTextPhraseLength); |
|
573 |
|
574 WriteTargetOutput(KTestName()); |
|
575 iContext->ResetFont(); |
|
576 } |
|
577 |
|
578 /** |
|
579 @SYMTestCaseID |
|
580 GRAPHICS-UI-BENCH-0107 |
|
581 |
|
582 @SYMPREQ PREQ39 |
|
583 |
|
584 @SYMREQ REQ9236 |
|
585 @SYMREQ REQ9237 |
|
586 |
|
587 @SYMTestCaseDesc |
|
588 Measure the performance of DrawText() when using a large font. |
|
589 |
|
590 @SYMTestActions |
|
591 Clear the target, call Finish() so that when the timer begins all outstanding drawing has finished. |
|
592 Set the large font. |
|
593 For KTextDrawingIterationsToTest, draw the same string of text. |
|
594 Call Finish() to force the drawing to complete, before logging the time. |
|
595 |
|
596 @SYMTestExpectedResults |
|
597 The performance to be logged as a pixel rate. |
|
598 */ |
|
599 void CTSimpleDrawingDirectGdi::LargeTextDrawingL() |
|
600 { |
|
601 _LIT(KTestName, "DirectGdi Large Text Drawing"); |
|
602 // Erase the target |
|
603 iContext->Clear(); |
|
604 iDGdiDriver->Finish(); |
|
605 iContext->SetFont(iLargeFont); |
|
606 // Draw the text once so that we aren't timing the time to load it into the cache. |
|
607 iContext->DrawText(KTextPhrase,NULL,TPoint(10,100)); |
|
608 |
|
609 iProfiler->InitResults(); |
|
610 for(TInt count=0;count<KTextDrawingIterationsToTest;count++) |
|
611 { |
|
612 iContext->DrawText(KTextPhrase,NULL,TPoint(10,100)); |
|
613 } |
|
614 iDGdiDriver->Finish(); |
|
615 iProfiler->MarkResultSetL(); |
|
616 TEST(iDGdiDriver->GetError() == KErrNone); |
|
617 |
|
618 iProfiler->ResultsAnalysisCharacterRate(KTestName, 0, 0, iDisplayMode, KTextDrawingIterationsToTest, KTextPhraseLength); |
|
619 WriteTargetOutput(KTestName()); |
|
620 iContext->ResetFont(); |
|
621 } |