graphicstest/uibench/src/tsimpledrawing.cpp
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     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".
       
     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.h"
       
    23 
       
    24 const TInt KIterationsToTest = 100;
       
    25 
       
    26 const TInt KTextDrawingIterationsToTest = 2000;
       
    27 
       
    28 _LIT(KTestBitmap, "z:\\system\\data\\uibench_24bit.mbm");
       
    29 _LIT(KTextPhrase, "abcdefABCDEF0123456789");
       
    30 const TInt KTextPhraseLength = KTextPhrase().Length();
       
    31 _LIT(KFontTypeface, "DejaVu Sans Condensed");
       
    32 _LIT(KLongTextPhrase, "The quick brown fox jumps over the lazy dog.");
       
    33 const TInt KFontSize = 14;
       
    34 
       
    35 const TInt KTopLeftX = 1;
       
    36 const TInt KTopLeftY = 1;
       
    37 const TInt KBottomRightX = 639;
       
    38 const TInt KBottomRightY = 239;
       
    39 const TInt KWidth = KBottomRightX - KTopLeftX;
       
    40 
       
    41 CTSimpleDrawing::CTSimpleDrawing()
       
    42 	{
       
    43 	SetTestStepName(KTSimpleDrawingPerfName);
       
    44 	}
       
    45 	
       
    46 CTSimpleDrawing::~CTSimpleDrawing()	
       
    47 	{	
       
    48 	delete iBitmap;
       
    49 	delete iBidiText;
       
    50 	iTs->ReleaseFont(iFont);
       
    51 	iTs->ReleaseFont(iLargeFont);
       
    52 	delete iTs;
       
    53 	}
       
    54 
       
    55 TVerdict CTSimpleDrawing::doTestStepPreambleL()
       
    56 	{
       
    57 	CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL();
       
    58 	iTs = CFbsTypefaceStore::NewL(NULL);
       
    59 	
       
    60 	TInt fontError = iTs->GetNearestFontToDesignHeightInPixels(iFont, TFontSpec(KFontTypeface, KFontSize));
       
    61 	TInt largeFontError = iTs->GetNearestFontToDesignHeightInPixels(iLargeFont,TFontSpec(KFontTypeface, 40));	
       
    62 	iBitmap=new(ELeave) CFbsBitmap;
       
    63 
       
    64 	TInt ret = iBitmap->Load(KTestBitmap, EMbmTbmpTbmp, EFalse);
       
    65 	User::LeaveIfError(ret);
       
    66 	
       
    67 	iScreenRect.SetRect(KTopLeftX,KTopLeftY,KBottomRightX,KBottomRightY);
       
    68 	iBidiText = TBidiText::NewL(KTextPhrase, 1);
       
    69 	return TestStepResult();
       
    70 	}
       
    71 
       
    72 /**
       
    73 Override of base class pure virtual
       
    74 Our implementation only gets called if the base class doTestStepPreambleL() did
       
    75 not leave. That being the case, the current test result value will be EPass.
       
    76 
       
    77 @return - TVerdict code
       
    78 */
       
    79 TVerdict CTSimpleDrawing::doTestStepL()
       
    80 	{
       
    81 	for (TInt dispModeIndex = KNumValidDisplayModes-1; dispModeIndex >= 0; --dispModeIndex)
       
    82 		{
       
    83 		SetScreenModeL(KValidDisplayModes[dispModeIndex]);
       
    84 		iDevice = &iScreenDevice->BitmapDevice();
       
    85 		SetTestStepID(_L("GRAPHICS-UI-BENCH-0027"));
       
    86 		ClearingL();
       
    87 		RecordTestResultL();
       
    88 		SetTestStepID(_L("GRAPHICS-UI-BENCH-0040"));
       
    89 		AndClearingL();
       
    90 		RecordTestResultL();
       
    91 		SetTestStepID(_L("GRAPHICS-UI-BENCH-0030"));
       
    92 		LineDrawingL();
       
    93 		RecordTestResultL();
       
    94 		SetTestStepID(_L("GRAPHICS-UI-BENCH-0043"));
       
    95 		VerticalLinesL();
       
    96 		RecordTestResultL();
       
    97 		SetTestStepID(_L("GRAPHICS-UI-BENCH-0094"));
       
    98 		HorizontalLinesL();
       
    99 		RecordTestResultL();
       
   100 		SetTestStepID(_L("GRAPHICS-UI-BENCH-0034"));
       
   101 		TextDrawingL();
       
   102 		RecordTestResultL();
       
   103 		SetTestStepID(_L("GRAPHICS-UI-BENCH-0169"));
       
   104 		TextDrawingAntiAliasedL();
       
   105 		RecordTestResultL();
       
   106 		SetTestStepID(_L("GRAPHICS-UI-BENCH-0170"));
       
   107 		MeasureTextL();
       
   108 		RecordTestResultL();
       
   109 		SetTestStepID(_L("GRAPHICS-UI-BENCH-0033"));
       
   110 		TextDrawingWithOverheadL();
       
   111 		RecordTestResultL();
       
   112 		SetTestStepID(_L("GRAPHICS-UI-BENCH-0035"));
       
   113 		LargeTextDrawingL();
       
   114 		RecordTestResultL();
       
   115 		SetTestStepID(_L("GRAPHICS-UI-BENCH-0036"));
       
   116 		BidiTextDrawingL();
       
   117 		RecordTestResultL();
       
   118 		SetTestStepID(_L("GRAPHICS-UI-BENCH-0037"));
       
   119 		LargeBidiTextDrawingL(); 
       
   120 		RecordTestResultL();
       
   121 		SetTestStepID(_L("GRAPHICS-UI-BENCH-0032"));
       
   122 		CopyRectL();
       
   123 		RecordTestResultL();
       
   124 		SetTestStepID(_L("GRAPHICS-UI-BENCH-0041"));
       
   125 		AndCopyRectL();
       
   126 		RecordTestResultL();
       
   127 		SetTestStepID(_L("GRAPHICS-UI-BENCH-0042"));
       
   128 		MaskBlittingL();
       
   129 		RecordTestResultL();
       
   130 		SetTestStepID(_L("GRAPHICS-UI-BENCH-0028"));
       
   131 		ShadowingL();
       
   132 		RecordTestResultL();
       
   133 		DrawRectL();
       
   134 		SetTestStepID(_L("GRAPHICS-UI-BENCH-0031"));
       
   135 		ThickLinesL();
       
   136 		RecordTestResultL();
       
   137 		SetTestStepID(_L("GRAPHICS-UI-BENCH-0029"));
       
   138 		ColorMappingL();
       
   139 		RecordTestResultL();
       
   140 		SetTestStepID(_L("GRAPHICS-UI-BENCH-0044"));
       
   141 		BltBmpL();
       
   142 		RecordTestResultL();
       
   143 		SetTestStepID(_L("GRAPHICS-UI-BENCH-0045"));
       
   144 		BltGcL();
       
   145 		RecordTestResultL();
       
   146 		SetTestStepID(_L("GRAPHICS-UI-BENCH-0038"));
       
   147 		BitmapDrawingL();
       
   148 		RecordTestResultL();
       
   149 		}	
       
   150 	return TestStepResult();
       
   151 	}
       
   152 
       
   153 /**
       
   154 @SYMTestCaseID
       
   155 GRAPHICS-UI-BENCH-0027
       
   156 
       
   157 @SYMTestCaseDesc
       
   158 Clear screen
       
   159 
       
   160 @SYMTestActions
       
   161 Compare the results over time
       
   162 
       
   163 @SYMTestExpectedResults
       
   164 Measure average time to complete one cycle
       
   165 */
       
   166 void CTSimpleDrawing::ClearingL()
       
   167 	{
       
   168 	_LIT(KTestName, "Clear Screen");
       
   169 	iProfiler->InitResults();
       
   170 	for(TInt count=0;count<KIterationsToTest;count++)
       
   171 		{
       
   172 		iGc->Clear(iScreenRect);
       
   173 		}
       
   174 	iScreenDevice->Update();
       
   175 	iProfiler->MarkResultSetL();
       
   176 	iProfiler->ResultsAnalysisPixelRate(KTestName, 0, 0, iDevice->DisplayMode(), KIterationsToTest, iScreenRect.Size().iWidth * iScreenRect.Size().iHeight);
       
   177 	}
       
   178 
       
   179 /**
       
   180 @SYMTestCaseID
       
   181 GRAPHICS-UI-BENCH-0028
       
   182 
       
   183 @SYMTestCaseDesc
       
   184 Set shadow area
       
   185 
       
   186 @SYMTestActions
       
   187 Compare the results over time
       
   188 
       
   189 @SYMTestExpectedResults
       
   190 Measure average time to complete one cycle
       
   191 */
       
   192 void CTSimpleDrawing::ShadowingL()
       
   193 	{
       
   194 	_LIT(KTestName, "Shadowing");
       
   195 	iProfiler->InitResults();
       
   196 	TRegionFix<1> area(iScreenRect);
       
   197 	TInt reps=KIterationsToTest;
       
   198 	for(TInt count=0;count<reps;count++)
       
   199 		{
       
   200 		iGc->ShadowArea(&area);
       
   201 		}	
       
   202 	iScreenDevice->Update();
       
   203 	iProfiler->MarkResultSetL();
       
   204 	iProfiler->ResultsAnalysisPixelRate(KTestName, 0, 0, iDevice->DisplayMode(), KIterationsToTest, iScreenRect.Size().iWidth * iScreenRect.Size().iHeight);
       
   205 	}
       
   206 
       
   207 /**
       
   208 @SYMTestCaseID
       
   209 GRAPHICS-UI-BENCH-0029
       
   210 
       
   211 @SYMTestCaseDesc
       
   212 Maps pixels in the specified rectangle
       
   213 
       
   214 @SYMTestActions
       
   215 Compare the results over time
       
   216 
       
   217 @SYMTestExpectedResults
       
   218 Measure average time to complete one cycle
       
   219 */
       
   220 void CTSimpleDrawing::ColorMappingL()
       
   221 	{
       
   222 	_LIT(KTestName, "Colour Mapping");
       
   223 	iProfiler->InitResults();
       
   224 	TRgb colortable[4];
       
   225 	colortable[0]=TRgb::Gray2(0);
       
   226 	colortable[1]=TRgb::Gray2(1);
       
   227 	colortable[2]=TRgb::Gray2(1);
       
   228 	colortable[3]=TRgb::Gray2(0);
       
   229 	TInt reps=KIterationsToTest;
       
   230 	for(TInt count=0;count<reps;count++)
       
   231 		{
       
   232 		iGc->MapColors(iScreenRect,colortable);
       
   233 		}		
       
   234 	iScreenDevice->Update();
       
   235 	iProfiler->MarkResultSetL();
       
   236 	iProfiler->ResultsAnalysisPixelRate(KTestName, 0, 0, iDevice->DisplayMode(), KIterationsToTest, iScreenRect.Size().iWidth * iScreenRect.Size().iHeight);
       
   237 	
       
   238 	}
       
   239 
       
   240 /**
       
   241 @SYMTestCaseID
       
   242 GRAPHICS-UI-BENCH-0030
       
   243 
       
   244 @SYMTestCaseDesc
       
   245 Draws a diagonal one pixel line
       
   246 
       
   247 @SYMTestActions
       
   248 Compare the results over time
       
   249 
       
   250 @SYMTestExpectedResults
       
   251 Measure average time to complete one cycle
       
   252 */
       
   253 void CTSimpleDrawing::LineDrawingL()
       
   254 	{
       
   255 	_LIT(KTestName, "Line Drawing");
       
   256 	iProfiler->InitResults();
       
   257 	for(TInt count=0;count<KIterationsToTest;count++)
       
   258 		{
       
   259 		iGc->DrawLine(iScreenRect.iTl,iScreenRect.iBr);
       
   260 		}
       
   261 	iScreenDevice->Update();
       
   262 	iProfiler->MarkResultSetL();
       
   263 	TReal pixels;
       
   264 	Math::Sqrt(pixels, (iScreenRect.iBr.iX-iScreenRect.iTl.iX)*(iScreenRect.iBr.iX-iScreenRect.iTl.iX)+(iScreenRect.iBr.iY-iScreenRect.iTl.iY)*(iScreenRect.iBr.iY-iScreenRect.iTl.iY));
       
   265 	iProfiler->ResultsAnalysisPixelRate(KTestName, 0, 0, iDevice->DisplayMode(), KIterationsToTest, static_cast<TInt>(pixels));
       
   266 	}
       
   267 
       
   268 /**
       
   269 @SYMTestCaseID
       
   270 GRAPHICS-UI-BENCH-0031
       
   271 
       
   272 @SYMTestCaseDesc
       
   273 Draws a diagonal thick line
       
   274 
       
   275 @SYMTestActions
       
   276 Compare the results over time
       
   277 
       
   278 @SYMTestExpectedResults
       
   279 Measure average time to complete one cycle
       
   280 */
       
   281 void CTSimpleDrawing::ThickLinesL()
       
   282 	{
       
   283 	_LIT(KTestName, "Draw Thick Lines");
       
   284 	iGc->SetPenSize(TSize(10,10));
       
   285 	TInt reps=KIterationsToTest;
       
   286 	iProfiler->InitResults();
       
   287 	for(TInt count=0;count<reps;count++)
       
   288 		{
       
   289 		iGc->DrawLine(iScreenRect.iTl,iScreenRect.iBr);
       
   290 		}
       
   291 	iScreenDevice->Update();
       
   292 	iProfiler->MarkResultSetL();
       
   293 	TReal pixels;
       
   294 	Math::Sqrt(pixels, (iScreenRect.iBr.iX-iScreenRect.iTl.iX)*(iScreenRect.iBr.iX-iScreenRect.iTl.iX)+(iScreenRect.iBr.iY-iScreenRect.iTl.iY)*(iScreenRect.iBr.iY-iScreenRect.iTl.iY));
       
   295 	iProfiler->ResultsAnalysisPixelRate(KTestName, 0, 0, iDevice->DisplayMode(), KIterationsToTest, 10*static_cast<TInt>(pixels));
       
   296 	iGc->SetPenSize(TSize(1,1));
       
   297 	}
       
   298 
       
   299 /**
       
   300 @SYMTestCaseID
       
   301 GRAPHICS-UI-BENCH-0032
       
   302 
       
   303 @SYMTestCaseDesc
       
   304 Copy a rectangle from one part of the screen to another
       
   305 
       
   306 @SYMTestActions
       
   307 Compare the results over time
       
   308 
       
   309 @SYMTestExpectedResults
       
   310 Measure average time to complete one cycle
       
   311 */
       
   312 void CTSimpleDrawing::CopyRectL()
       
   313 	{
       
   314 	_LIT(KTestName, "CopyRect");		
       
   315 	iProfiler->InitResults();
       
   316 	TInt reps=KIterationsToTest;
       
   317 	for(TInt count=0;count<reps;count++)
       
   318 		{
       
   319 		iGc->CopyRect(TPoint(2,2),iScreenRect);
       
   320 		}		
       
   321 	iScreenDevice->Update();
       
   322 	iProfiler->MarkResultSetL();
       
   323 	iProfiler->ResultsAnalysisPixelRate(KTestName, 0, 0, iDevice->DisplayMode(), KIterationsToTest, iScreenRect.Size().iWidth * iScreenRect.Size().iHeight);	
       
   324 	}
       
   325 
       
   326 /**
       
   327 @SYMTestCaseID
       
   328 GRAPHICS-UI-BENCH-0034
       
   329 
       
   330 @SYMTestCaseDesc
       
   331 Draw text.
       
   332 
       
   333 @SYMTestActions
       
   334 Compare the results over time
       
   335 
       
   336 @SYMTestExpectedResults
       
   337 Measure average time to complete one cycle
       
   338 */
       
   339 void CTSimpleDrawing::TextDrawingL()
       
   340 	{
       
   341 	_LIT(KTestName, "Text Drawing");	
       
   342 	iGc->UseFont(iFont);
       
   343 	// Call once outside of timing loop to stop glyph-caching from affecting measurements.
       
   344 	iGc->DrawText(KTextPhrase,TPoint(10,100));
       
   345 	
       
   346 	iProfiler->InitResults();
       
   347 	for(TInt count=0;count<KTextDrawingIterationsToTest;count++)
       
   348 		{
       
   349 		iGc->DrawText(KTextPhrase,TPoint(10,100));		
       
   350 		}
       
   351 	iScreenDevice->Update();	
       
   352 	iProfiler->MarkResultSetL();
       
   353 	iProfiler->ResultsAnalysisCharacterRate(KTestName, 0, 0, iDevice->DisplayMode(), KTextDrawingIterationsToTest, KTextPhraseLength);
       
   354 	iGc->DiscardFont();	
       
   355 	}
       
   356 
       
   357 /**
       
   358 @SYMTestCaseID 
       
   359 GRAPHICS-UI-BENCH-0169
       
   360 
       
   361 @SYMTestCaseDesc
       
   362 Draw anti-aliased text.
       
   363 
       
   364 @SYMTestActions
       
   365 Compare the results over time
       
   366 
       
   367 @SYMTestExpectedResults
       
   368 Measure average time to complete one cycle
       
   369 */
       
   370 void CTSimpleDrawing::TextDrawingAntiAliasedL()
       
   371 	{
       
   372 	_LIT(KTestName, "Anti Aliased Text Drawing");		
       
   373 	CFont* font = NULL;
       
   374 	TFontSpec fs(KFontTypeface, KFontSize);
       
   375 	fs.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
       
   376 	TESTL(iTs->GetNearestFontToDesignHeightInPixels(font, fs) == KErrNone);
       
   377 	iGc->UseFont(font);
       
   378 	
       
   379 	// Call once outside of timing loop to stop addition of glyphs to the glyph-cache
       
   380 	// from affecting measurements.	
       
   381 	TPoint pos(10,100);
       
   382 	iGc->DrawText(KTextPhrase, pos);
       
   383 	
       
   384 	iProfiler->InitResults();
       
   385 	for(TInt count=KTextDrawingIterationsToTest; count>=0; count--)
       
   386 		{
       
   387 		iGc->DrawText(KTextPhrase, pos);		
       
   388 		}
       
   389 	iScreenDevice->Update();	
       
   390 	
       
   391 	iProfiler->MarkResultSetL();
       
   392 	iProfiler->ResultsAnalysisCharacterRate(KTestName, 0, 0, iDevice->DisplayMode(), KTextDrawingIterationsToTest, KTextPhrase().Length());
       
   393 	
       
   394 	iGc->DiscardFont();	
       
   395 	iTs->ReleaseFont(font);
       
   396 	}
       
   397 
       
   398 /**
       
   399 @SYMTestCaseID GRAPHICS-UI-BENCH-0033
       
   400 
       
   401 @SYMTestCaseDesc
       
   402 Draw text, with additional overhead.
       
   403 
       
   404 @SYMTestActions
       
   405 Compare the results over time
       
   406 
       
   407 @SYMTestExpectedResults
       
   408 Measure average time to complete one cycle
       
   409 */
       
   410 void CTSimpleDrawing::TextDrawingWithOverheadL()
       
   411 	{
       
   412 	_LIT(KTestName, "Text Drawing With Overhead");	
       
   413 	iGc->UseFont(iFont);	
       
   414 	iProfiler->InitResults();
       
   415 	for(TInt count=0;count<KTextDrawingIterationsToTest;count++)
       
   416 		{
       
   417 		(void)iFont->TextWidthInPixels(KTextPhrase); //do nothing with this, just need the overhead
       
   418 		(void)iFont->AscentInPixels(); //more typical overhead in a drawtext operation
       
   419 		iGc->DrawText(KTextPhrase,TPoint(10,100));		
       
   420 		}
       
   421 	iScreenDevice->Update();	
       
   422 	iProfiler->MarkResultSetL();
       
   423 	iProfiler->ResultsAnalysisCharacterRate(KTestName, 0, 0, iDevice->DisplayMode(), KTextDrawingIterationsToTest, KTextPhraseLength);
       
   424 	iGc->DiscardFont();	
       
   425 	}
       
   426 
       
   427 /**
       
   428 @SYMTestCaseID
       
   429 GRAPHICS-UI-BENCH-0170
       
   430 
       
   431 @SYMTestCaseDesc
       
   432 Call CFont::MeasureText() a number of times.
       
   433 
       
   434 @SYMTestActions
       
   435 Compare the results over time
       
   436 
       
   437 @SYMTestExpectedResults
       
   438 Measure average time to complete one cycle
       
   439 */
       
   440 void CTSimpleDrawing::MeasureTextL()
       
   441 	{	
       
   442 	_LIT(KTestName, "Measure Text");			
       
   443 	iGc->UseFont(iFont);
       
   444 	
       
   445 	// set up the input params for MeasureText()
       
   446 	TInt textLength = KLongTextPhrase().Length();
       
   447 	CFont::TMeasureTextInput measureTextInput;
       
   448 	measureTextInput.iCharJustNum = 0;
       
   449 	measureTextInput.iCharJustExcess = 0;
       
   450 	measureTextInput.iWordJustNum = 0;
       
   451 	measureTextInput.iWordJustExcess = 0;
       
   452 	measureTextInput.iFlags |= CFont::TMeasureTextInput::EFVisualOrder; // left-to-right	
       
   453 	measureTextInput.iStartInputChar = 0;
       
   454 	measureTextInput.iEndInputChar = textLength - 1;	
       
   455 	CFont::TMeasureTextOutput measureTextOutput;
       
   456 	
       
   457 	// Call once outside of timing loop to stop addition of glyphs to the glyph-cache
       
   458 	// from affecting measurements.
       
   459 	iFont->MeasureText(KLongTextPhrase, &measureTextInput, &measureTextOutput);
       
   460 	
       
   461 	iProfiler->InitResults();
       
   462 	for(TInt count=KTextDrawingIterationsToTest; count>=0; count--)
       
   463 		{
       
   464 		iFont->MeasureText(KLongTextPhrase, &measureTextInput, &measureTextOutput);		
       
   465 		}
       
   466 	iScreenDevice->Update();
       
   467 	
       
   468 	iProfiler->MarkResultSetL();
       
   469 	iProfiler->ResultsAnalysisCharacterRate(KTestName, 0, 0, iDevice->DisplayMode(), KTextDrawingIterationsToTest, textLength);
       
   470 	
       
   471 	iGc->DiscardFont();		
       
   472 	}
       
   473 
       
   474 /**
       
   475 @SYMTestCaseID
       
   476 GRAPHICS-UI-BENCH-0035
       
   477 
       
   478 @SYMTestCaseDesc
       
   479 Draw large text
       
   480 
       
   481 @SYMTestActions
       
   482 Compare the results over time
       
   483 
       
   484 @SYMTestExpectedResults
       
   485 Measure average time to complete one cycle
       
   486 */
       
   487 void CTSimpleDrawing::LargeTextDrawingL()
       
   488 	{
       
   489 	_LIT(KTestName, "Large Text Drawing");	
       
   490 	iGc->UseFont(iLargeFont);
       
   491 	// Call once outside of timing loop to stop glyph-caching from affecting measurements.   
       
   492 	iGc->DrawText(KTextPhrase,TPoint(10,100));
       
   493 	
       
   494 	iProfiler->InitResults();
       
   495 	for(TInt count=0;count<KTextDrawingIterationsToTest;count++)
       
   496 		{
       
   497 		(void)iLargeFont->TextWidthInPixels(KTextPhrase); //do nothing with this, just need the overhead
       
   498 		(void)iLargeFont->AscentInPixels(); //more typical overhead in a drawtext operation
       
   499 		iGc->DrawText(KTextPhrase,TPoint(10,100));
       
   500 		}
       
   501 	iScreenDevice->Update();	
       
   502 	iProfiler->MarkResultSetL();
       
   503 	iProfiler->ResultsAnalysisCharacterRate(KTestName, 0, 0, iDevice->DisplayMode(), KTextDrawingIterationsToTest, KTextPhraseLength);
       
   504 	iGc->DiscardFont();	
       
   505 	}
       
   506 
       
   507 /**
       
   508 @SYMTestCaseID
       
   509 GRAPHICS-UI-BENCH-0036
       
   510 
       
   511 @SYMTestCaseDesc
       
   512 Bidi draw text
       
   513 
       
   514 @SYMTestActions
       
   515 Compare the results over time
       
   516 
       
   517 @SYMTestExpectedResults
       
   518 Measure average time to complete one cycle
       
   519 */
       
   520 void CTSimpleDrawing::BidiTextDrawingL()
       
   521 	{
       
   522 	_LIT(KTestName, "Bidi Text Drawing");	
       
   523 	iGc->UseFont(iFont);			
       
   524 	iProfiler->InitResults();
       
   525 	for(TInt count=0;count<KTextDrawingIterationsToTest;count++)
       
   526 		{
       
   527 		iBidiText->WrapText(KWidth, *iFont, 0);
       
   528 		iBidiText->DrawText(*iGc,TPoint(10,100));
       
   529 		}
       
   530 	iScreenDevice->Update();
       
   531 	iProfiler->MarkResultSetL();
       
   532 	iProfiler->ResultsAnalysisCharacterRate(KTestName, 0, 0, iDevice->DisplayMode(), KTextDrawingIterationsToTest, KTextPhraseLength);
       
   533 	iGc->DiscardFont();	
       
   534 	}
       
   535 
       
   536 /**
       
   537 @SYMTestCaseID
       
   538 GRAPHICS-UI-BENCH-0037
       
   539 
       
   540 @SYMTestCaseDesc
       
   541 Bidi large draw text
       
   542 
       
   543 @SYMTestActions
       
   544 Compare the results over time
       
   545 
       
   546 @SYMTestExpectedResults
       
   547 Measure average time to complete one cycle
       
   548 */
       
   549 void CTSimpleDrawing::LargeBidiTextDrawingL()
       
   550 	{
       
   551 	_LIT(KTestName, "Large Bidi Text Drawing");	
       
   552 	iGc->UseFont(iLargeFont);	
       
   553 	iProfiler->InitResults();
       
   554 	for(TInt count=0;count<KTextDrawingIterationsToTest;count++)
       
   555 		{
       
   556 		iBidiText->WrapText(KWidth, *iFont, 0);
       
   557 		iBidiText->DrawText(*iGc,TPoint(10,100));
       
   558 		}
       
   559 	iScreenDevice->Update();
       
   560 	iProfiler->MarkResultSetL();
       
   561 	iProfiler->ResultsAnalysisCharacterRate(KTestName, 0, 0, iDevice->DisplayMode(), KTextDrawingIterationsToTest, KTextPhraseLength);
       
   562 	iGc->DiscardFont();	
       
   563 	}
       
   564 
       
   565 /**
       
   566 @SYMTestCaseID
       
   567 GRAPHICS-UI-BENCH-0038
       
   568 
       
   569 @SYMTestCaseDesc
       
   570 Drawbitmap
       
   571 
       
   572 @SYMTestActions
       
   573 Compare the results over time
       
   574 
       
   575 @SYMTestExpectedResults
       
   576 Measure average time to complete one cycle
       
   577 */
       
   578 void CTSimpleDrawing::BitmapDrawingL()
       
   579 	{
       
   580 	_LIT(KTestName, "Bitmap Drawing");
       
   581 	TEST(iBitmap->Handle() != 0);		
       
   582 
       
   583 	TInt reps=KIterationsToTest;
       
   584 	TRect bmprect(iBitmap->SizeInPixels());			
       
   585 	iProfiler->InitResults();
       
   586 	for(TInt count=0;count<reps;count++)
       
   587 		{		
       
   588 		iGc->DrawBitmap(iScreenRect,iBitmap,bmprect);
       
   589 		}
       
   590 	iScreenDevice->Update();		
       
   591 	iProfiler->MarkResultSetL();
       
   592 	iProfiler->ResultsAnalysisPixelRate(KTestName, 0, 0, iDevice->DisplayMode(), KIterationsToTest, bmprect.Size().iWidth * bmprect.Size().iHeight);	
       
   593 	}
       
   594 
       
   595 
       
   596 /**
       
   597 @SYMTestCaseID
       
   598 GRAPHICS-UI-BENCH-0039
       
   599 
       
   600 @SYMTestCaseDesc
       
   601 Paint
       
   602 
       
   603 @SYMTestActions
       
   604 Set bitmap as brush and draw rectangle using this brush
       
   605 
       
   606 @SYMTestExpectedResults
       
   607 Measure average time to complete one cycle
       
   608 */
       
   609 void CTSimpleDrawing::DrawRectL()
       
   610 	{
       
   611 	_LIT(KTestName, "DrawRect");
       
   612 	TEST(iBitmap->Handle() != 0);
       
   613 
       
   614 	iGc->UseBrushPattern(iBitmap);
       
   615 	iGc->SetBrushStyle(CGraphicsContext::EPatternedBrush);	
       
   616 	iProfiler->InitResults();
       
   617 	for(TInt count=0;count<KIterationsToTest;count++)
       
   618 		{
       
   619 		iGc->DrawRect(iScreenRect);
       
   620 		}		
       
   621 	iScreenDevice->Update();		
       
   622 	iProfiler->MarkResultSetL();
       
   623 	iProfiler->ResultsAnalysisPixelRate(KTestName, 0, 0, iDevice->DisplayMode(), KIterationsToTest, iScreenRect.Size().iWidth * iScreenRect.Size().iHeight);
       
   624 	iGc->SetBrushStyle(CGraphicsContext::ENullBrush);	
       
   625 	}
       
   626 
       
   627 /**
       
   628 @SYMTestCaseID
       
   629 GRAPHICS-UI-BENCH-0040
       
   630 
       
   631 @SYMTestCaseDesc
       
   632 Clear screen with drawmode AND
       
   633 
       
   634 @SYMTestActions
       
   635 Compare the results over time
       
   636 
       
   637 @SYMTestExpectedResults
       
   638 Measure average time to complete one cycle
       
   639 */
       
   640 void CTSimpleDrawing::AndClearingL()
       
   641 	{
       
   642 	_LIT(KTestName, "And Clearing");
       
   643 	iGc->SetDrawMode(CGraphicsContext::EDrawModeAND);			
       
   644 	iProfiler->InitResults();
       
   645 	for(TInt count=0;count<KIterationsToTest;count++)
       
   646 		{
       
   647 		iGc->Clear(iScreenRect);
       
   648 		}		
       
   649 	iScreenDevice->Update();	
       
   650 	iProfiler->MarkResultSetL();
       
   651 	iProfiler->ResultsAnalysisPixelRate(KTestName, 0, 0, iDevice->DisplayMode(), KIterationsToTest, iScreenRect.Size().iWidth * iScreenRect.Size().iHeight);
       
   652 	iGc->SetDrawMode(CGraphicsContext::EDrawModePEN);	
       
   653 	}
       
   654 
       
   655 /**
       
   656 @SYMTestCaseID
       
   657 GRAPHICS-UI-BENCH-0041
       
   658 
       
   659 @SYMTestCaseDesc
       
   660 CopyRect with drawmode AND
       
   661 
       
   662 @SYMTestActions
       
   663 Compare the results over time
       
   664 
       
   665 @SYMTestExpectedResults
       
   666 Measure average time to complete one cycle
       
   667 */
       
   668 void CTSimpleDrawing::AndCopyRectL()
       
   669 	{
       
   670 	_LIT(KTestName, "And CopyRect");
       
   671 	iGc->SetDrawMode(CGraphicsContext::EDrawModeAND);
       
   672 	TRect r(iScreenRect);
       
   673 	r.Grow(1,1);	
       
   674 	iProfiler->InitResults();
       
   675 	for(TInt count=0;count<KIterationsToTest;count++)
       
   676 		{
       
   677 		iGc->CopyRect(TPoint(32,32),r);
       
   678 		}		
       
   679 	iScreenDevice->Update();
       
   680 	iProfiler->MarkResultSetL();
       
   681 	iProfiler->ResultsAnalysisPixelRate(KTestName, 0, 0, iDevice->DisplayMode(), KIterationsToTest, r.Size().iWidth * r.Size().iHeight);
       
   682 	iGc->SetDrawMode(CGraphicsContext::EDrawModePEN);	
       
   683 	}
       
   684 
       
   685 /**
       
   686 @SYMTestCaseID
       
   687 GRAPHICS-UI-BENCH-0042
       
   688 
       
   689 @SYMTestCaseDesc
       
   690 BitbltMasked
       
   691 
       
   692 @SYMTestActions
       
   693 Compare the results over time
       
   694 
       
   695 @SYMTestExpectedResults
       
   696 Measure average time to complete one cycle
       
   697 */
       
   698 void CTSimpleDrawing::MaskBlittingL()
       
   699 	{
       
   700 	_LIT(KTestName, "Mask Blitting");
       
   701 	TEST(iBitmap->Handle() != 0);	
       
   702 
       
   703 	TRect bmprect(iBitmap->SizeInPixels());	
       
   704 	iProfiler->InitResults();
       
   705 	for(TInt count=0;count<KIterationsToTest;count++)
       
   706 		{
       
   707 		iGc->BitBltMasked(TPoint(0,0),iBitmap,bmprect,iBitmap,ETrue);
       
   708 		}
       
   709 	iScreenDevice->Update();		
       
   710 	iProfiler->MarkResultSetL();
       
   711 	iProfiler->ResultsAnalysisPixelRate(KTestName, 0, 0, iDevice->DisplayMode(), KIterationsToTest, bmprect.Size().iWidth * bmprect.Size().iHeight);	
       
   712 	}
       
   713 
       
   714 /**
       
   715 @SYMTestCaseID
       
   716 GRAPHICS-UI-BENCH-0043
       
   717 
       
   718 @SYMTestCaseDesc
       
   719 Draw vertical line
       
   720 
       
   721 @SYMTestActions
       
   722 Compare the results over time
       
   723 
       
   724 @SYMTestExpectedResults
       
   725 Measure average time to complete one cycle
       
   726 */
       
   727 void CTSimpleDrawing::VerticalLinesL()
       
   728 	{
       
   729 	_LIT(KTestName, "Vertical Lines");	
       
   730 	iProfiler->InitResults();
       
   731 	for(TInt count=0;count<KIterationsToTest;count++)
       
   732 		{		
       
   733 		iGc->DrawLine(TPoint(iScreenRect.iTl.iX+count, iScreenRect.iTl.iY),TPoint(iScreenRect.iTl.iX+count,iScreenRect.iBr.iY));	
       
   734 		}	
       
   735 	iScreenDevice->Update();
       
   736 	iProfiler->MarkResultSetL();
       
   737 	iProfiler->ResultsAnalysisPixelRate(KTestName, 0, 0, iDevice->DisplayMode(), KIterationsToTest, iScreenRect.iBr.iY-iScreenRect.iTl.iY);	
       
   738 	}
       
   739 
       
   740 /**
       
   741 @SYMTestCaseID
       
   742 GRAPHICS-UI-BENCH-0044
       
   743 
       
   744 @SYMTestCaseDesc
       
   745 BltBlt
       
   746 
       
   747 @SYMTestActions
       
   748 Compare the results over time
       
   749 
       
   750 @SYMTestExpectedResults
       
   751 Measure average time to complete one cycle
       
   752 */
       
   753 void CTSimpleDrawing::BltBmpL()
       
   754 	{
       
   755 	_LIT(KTestName, "Bitblt");
       
   756 	TEST(iBitmap->Handle() != 0);	
       
   757 
       
   758 	TInt reps=KIterationsToTest;
       
   759 	TPoint zero(0,0);	
       
   760 	iProfiler->InitResults();
       
   761 	for(TInt count=0;count<reps;count++)
       
   762 		{
       
   763 		iGc->BitBlt(zero,iBitmap);
       
   764 		}		
       
   765 	iScreenDevice->Update();
       
   766 	iProfiler->MarkResultSetL();
       
   767 	iProfiler->ResultsAnalysisPixelRate(KTestName, 0, iBitmap->DisplayMode(), iDevice->DisplayMode(), KIterationsToTest, iBitmap->SizeInPixels().iWidth * iBitmap->SizeInPixels().iHeight);	
       
   768 	}
       
   769 
       
   770 /**
       
   771 @SYMTestCaseID
       
   772 GRAPHICS-UI-BENCH-0045
       
   773 
       
   774 @SYMTestCaseDesc
       
   775 Bitblt from another GC
       
   776 
       
   777 @SYMTestActions
       
   778 Compare the results over time
       
   779 
       
   780 @SYMTestExpectedResults
       
   781 Measure average time to complete one cycle
       
   782 */
       
   783 void CTSimpleDrawing::BltGcL()
       
   784 	{
       
   785 	_LIT(KTestName, "Blt Gc");
       
   786 	TEST(iBitmap->Handle() != 0);
       
   787 
       
   788 	TInt reps=KIterationsToTest;
       
   789 	TPoint zero(0,0);
       
   790 	CFbsBitmapDevice* device=NULL;
       
   791 	TRAP_IGNORE(device=CFbsBitmapDevice::NewL(iBitmap));
       
   792 	CFbsBitGc* gc=NULL;
       
   793 	device->CreateContext(gc);	
       
   794 	iProfiler->InitResults();
       
   795 	for(TInt count=0;count<reps;count++)
       
   796 		{
       
   797 		iGc->BitBlt(zero,*gc);
       
   798 		}		
       
   799 	iScreenDevice->Update();
       
   800 	iProfiler->MarkResultSetL();
       
   801 	iProfiler->ResultsAnalysisPixelRate(KTestName, 0, iBitmap->DisplayMode(), iDevice->DisplayMode(), KIterationsToTest, iBitmap->SizeInPixels().iWidth * iBitmap->SizeInPixels().iHeight);
       
   802 	delete gc;
       
   803 	delete device;	
       
   804 	}
       
   805 
       
   806 /**
       
   807 @SYMTestCaseID
       
   808 GRAPHICS-UI-BENCH-0094
       
   809 
       
   810 @SYMTestCaseDesc
       
   811 Draw horizontal line
       
   812 
       
   813 @SYMTestActions
       
   814 Compare the results over time
       
   815 
       
   816 @SYMTestExpectedResults
       
   817 Measure average time to complete one cycle
       
   818 */
       
   819 void CTSimpleDrawing::HorizontalLinesL()
       
   820 	{
       
   821 	_LIT(KTestName, "Horizontal Lines");	
       
   822 	iProfiler->InitResults();
       
   823 	for(TInt count=0;count<KIterationsToTest;count++)
       
   824 		{		
       
   825 		iGc->DrawLine(TPoint(iScreenRect.iTl.iX, iScreenRect.iTl.iY+count), TPoint(iScreenRect.iBr.iX, iScreenRect.iTl.iY+count));
       
   826 		}	
       
   827 	iScreenDevice->Update();
       
   828 	iProfiler->MarkResultSetL();
       
   829 	iProfiler->ResultsAnalysisPixelRate(KTestName, 0, 0, iDevice->DisplayMode(), KIterationsToTest, iScreenRect.iBr.iX-iScreenRect.iTl.iX);	
       
   830 	}