| 
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 "textendedbitmap.h"
  | 
| 
sl@0
 | 
    17  | 
#include "tdirectgditestbase.h"
  | 
| 
sl@0
 | 
    18  | 
#include <gdi.h>
  | 
| 
sl@0
 | 
    19  | 
#include <s32mem.h>
  | 
| 
sl@0
 | 
    20  | 
#include <e32base.h>
  | 
| 
sl@0
 | 
    21  | 
#include <e32uid.h>
  | 
| 
sl@0
 | 
    22  | 
  | 
| 
sl@0
 | 
    23  | 
  | 
| 
sl@0
 | 
    24  | 
const TInt KIterationsToTest = 1000;
  | 
| 
sl@0
 | 
    25  | 
const TDisplayMode KDisplayMode = EColor64K;
  | 
| 
sl@0
 | 
    26  | 
// Test the performance of extended bitmaps using the extended bitmap
  | 
| 
sl@0
 | 
    27  | 
// Uid supported by the test example rasterizer
  | 
| 
sl@0
 | 
    28  | 
const TUid KExtendedBitmapUid = {0x10285A78};
 | 
| 
sl@0
 | 
    29  | 
  | 
| 
sl@0
 | 
    30  | 
  | 
| 
sl@0
 | 
    31  | 
CTExtendedBitmap::CTExtendedBitmap()
  | 
| 
sl@0
 | 
    32  | 
	{
 | 
| 
sl@0
 | 
    33  | 
	SetTestStepName(KTExtendedBitmap);
  | 
| 
sl@0
 | 
    34  | 
	}
  | 
| 
sl@0
 | 
    35  | 
  | 
| 
sl@0
 | 
    36  | 
CTExtendedBitmap::~CTExtendedBitmap()
  | 
| 
sl@0
 | 
    37  | 
	{		
 | 
| 
sl@0
 | 
    38  | 
	delete iExtendedBmp;
  | 
| 
sl@0
 | 
    39  | 
	delete [] iExtendedBmpData;
  | 
| 
sl@0
 | 
    40  | 
	delete iNormalBmp;
  | 
| 
sl@0
 | 
    41  | 
	delete iTargetBmp;
  | 
| 
sl@0
 | 
    42  | 
	delete iBitmapDevice;
  | 
| 
sl@0
 | 
    43  | 
	delete iBitGc;		
  | 
| 
sl@0
 | 
    44  | 
	}
  | 
| 
sl@0
 | 
    45  | 
  | 
| 
sl@0
 | 
    46  | 
/**
  | 
| 
sl@0
 | 
    47  | 
Override of base class pure virtual
  | 
| 
sl@0
 | 
    48  | 
Our implementation only gets called if the base class doTestStepPreambleL() did
  | 
| 
sl@0
 | 
    49  | 
not leave. That being the case, the current test result value will be EPass.
  | 
| 
sl@0
 | 
    50  | 
  | 
| 
sl@0
 | 
    51  | 
@return - TVerdict code
  | 
| 
sl@0
 | 
    52  | 
*/
  | 
| 
sl@0
 | 
    53  | 
TVerdict CTExtendedBitmap::doTestStepL()
  | 
| 
sl@0
 | 
    54  | 
	{
 | 
| 
sl@0
 | 
    55  | 
	SetTestStepID(_L("GRAPHICS-UI-BENCH-0159"));
 | 
| 
sl@0
 | 
    56  | 
	CreateExtendedBitmapL();	
  | 
| 
sl@0
 | 
    57  | 
	RecordTestResultL();
  | 
| 
sl@0
 | 
    58  | 
	SetTestStepID(_L("GRAPHICS-UI-BENCH-0160"));
 | 
| 
sl@0
 | 
    59  | 
	DeleteExtendedBitmapL();
  | 
| 
sl@0
 | 
    60  | 
	RecordTestResultL();
  | 
| 
sl@0
 | 
    61  | 
	SetTestStepID(_L("GRAPHICS-UI-BENCH-0161"));
 | 
| 
sl@0
 | 
    62  | 
	GetScanlinePreRenderedExtendedBitmapL();
  | 
| 
sl@0
 | 
    63  | 
	RecordTestResultL();
  | 
| 
sl@0
 | 
    64  | 
	SetTestStepID(_L("GRAPHICS-UI-BENCH-0162"));
 | 
| 
sl@0
 | 
    65  | 
	GetScanlineNonPreRenderedExtendedBitmapL();
  | 
| 
sl@0
 | 
    66  | 
	RecordTestResultL();
  | 
| 
sl@0
 | 
    67  | 
	SetTestStepID(_L("GRAPHICS-UI-BENCH-0163"));
 | 
| 
sl@0
 | 
    68  | 
	BitBltExtendedBitmapL();
  | 
| 
sl@0
 | 
    69  | 
	RecordTestResultL();
  | 
| 
sl@0
 | 
    70  | 
	SetTestStepID(_L("GRAPHICS-UI-BENCH-0164"));
 | 
| 
sl@0
 | 
    71  | 
	BitBltNormalBitmapL();
  | 
| 
sl@0
 | 
    72  | 
	RecordTestResultL();
  | 
| 
sl@0
 | 
    73  | 
	SetTestStepID(_L("GRAPHICS-UI-BENCH-0165"));
 | 
| 
sl@0
 | 
    74  | 
	DrawBitmapExtendedBitmapL();
  | 
| 
sl@0
 | 
    75  | 
	RecordTestResultL();
  | 
| 
sl@0
 | 
    76  | 
	SetTestStepID(_L("GRAPHICS-UI-BENCH-0166"));
 | 
| 
sl@0
 | 
    77  | 
	DrawBitmapNormalBitmapL();
  | 
| 
sl@0
 | 
    78  | 
	RecordTestResultL();
  | 
| 
sl@0
 | 
    79  | 
	SetTestStepID(_L("GRAPHICS-UI-BENCH-0173"));
 | 
| 
sl@0
 | 
    80  | 
	GetPixelL(ETrue);	// extended bitmap
  | 
| 
sl@0
 | 
    81  | 
	RecordTestResultL();
  | 
| 
sl@0
 | 
    82  | 
	SetTestStepID(_L("GRAPHICS-UI-BENCH-0173"));
 | 
| 
sl@0
 | 
    83  | 
	GetPixelL(EFalse);	// normal bitmap
  | 
| 
sl@0
 | 
    84  | 
	RecordTestResultL();
  | 
| 
sl@0
 | 
    85  | 
		
  | 
| 
sl@0
 | 
    86  | 
	return TestStepResult();
  | 
| 
sl@0
 | 
    87  | 
	}
  | 
| 
sl@0
 | 
    88  | 
  | 
| 
sl@0
 | 
    89  | 
/**
  | 
| 
sl@0
 | 
    90  | 
Called before doTestStepL() to allow
  | 
| 
sl@0
 | 
    91  | 
initialization steps common to each test case to take place.
  | 
| 
sl@0
 | 
    92  | 
  | 
| 
sl@0
 | 
    93  | 
@return - TVerdict code
  | 
| 
sl@0
 | 
    94  | 
*/
  | 
| 
sl@0
 | 
    95  | 
TVerdict CTExtendedBitmap::doTestStepPreambleL()
  | 
| 
sl@0
 | 
    96  | 
	{
 | 
| 
sl@0
 | 
    97  | 
	TVerdict res = CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL();
  | 
| 
sl@0
 | 
    98  | 
	
  | 
| 
sl@0
 | 
    99  | 
	const TRgb colors[] = {TRgb(0,255,255), TRgb(255,0,255), TRgb(255,255,0)};
 | 
| 
sl@0
 | 
   100  | 
	const TInt numColors = sizeof(colors)/sizeof(colors[0]);
  | 
| 
sl@0
 | 
   101  | 
	const TUint8 stripe = 1; // 1 mean draw horizontal stripes, 0 means draw vertical stripes
  | 
| 
sl@0
 | 
   102  | 
	iExtendedBmpDataSize = sizeof(colors)+sizeof(stripe); // estimate the data size
  | 
| 
sl@0
 | 
   103  | 
	iExtendedBmpData = new(ELeave) TUint8[iExtendedBmpDataSize];
  | 
| 
sl@0
 | 
   104  | 
	RMemWriteStream ws;
  | 
| 
sl@0
 | 
   105  | 
	ws.Open(iExtendedBmpData, iExtendedBmpDataSize);
  | 
| 
sl@0
 | 
   106  | 
	CleanupClosePushL(ws);
  | 
| 
sl@0
 | 
   107  | 
	for (TInt i = 0; i < numColors; i++)
  | 
| 
sl@0
 | 
   108  | 
		{
 | 
| 
sl@0
 | 
   109  | 
		ws << colors[i];
  | 
| 
sl@0
 | 
   110  | 
		}
  | 
| 
sl@0
 | 
   111  | 
	ws << stripe;
  | 
| 
sl@0
 | 
   112  | 
	iExtendedBmpDataSize = ws.Sink()->TellL(MStreamBuf::EWrite).Offset(); // get the actual size written
  | 
| 
sl@0
 | 
   113  | 
	CleanupStack::PopAndDestroy(&ws);
  | 
| 
sl@0
 | 
   114  | 
	
  | 
| 
sl@0
 | 
   115  | 
	iExtendedBmp = new(ELeave) CFbsBitmap;	
  | 
| 
sl@0
 | 
   116  | 
	TInt err = iExtendedBmp->CreateExtendedBitmap(KBitmapSize, KDisplayMode, KExtendedBitmapUid, iExtendedBmpData, iExtendedBmpDataSize);
  | 
| 
sl@0
 | 
   117  | 
	TESTL(err == KErrNone);
  | 
| 
sl@0
 | 
   118  | 
	
  | 
| 
sl@0
 | 
   119  | 
	iNormalBmp = new(ELeave) CFbsBitmap;
  | 
| 
sl@0
 | 
   120  | 
	err = iNormalBmp->Create(KBitmapSize, KDisplayMode);
  | 
| 
sl@0
 | 
   121  | 
	TESTL(err == KErrNone);
  | 
| 
sl@0
 | 
   122  | 
	
  | 
| 
sl@0
 | 
   123  | 
	iTargetBmp = new(ELeave) CFbsBitmap;
  | 
| 
sl@0
 | 
   124  | 
	err = iTargetBmp->Create(KBitmapSize, KDisplayMode);
  | 
| 
sl@0
 | 
   125  | 
	TESTL(err == KErrNone);
  | 
| 
sl@0
 | 
   126  | 
	
  | 
| 
sl@0
 | 
   127  | 
	iBitmapDevice = CFbsBitmapDevice::NewL(iTargetBmp);
  | 
| 
sl@0
 | 
   128  | 
	TESTL(iBitmapDevice != NULL);
  | 
| 
sl@0
 | 
   129  | 
	
  | 
| 
sl@0
 | 
   130  | 
	iBitGc = CFbsBitGc::NewL();
  | 
| 
sl@0
 | 
   131  | 
	iBitGc->Activate(iBitmapDevice);	
  | 
| 
sl@0
 | 
   132  | 
		
  | 
| 
sl@0
 | 
   133  | 
	iRasterizer = CFbsBitmap::Rasterizer();
  | 
| 
sl@0
 | 
   134  | 
	if (iRasterizer == NULL)
  | 
| 
sl@0
 | 
   135  | 
		{
 | 
| 
sl@0
 | 
   136  | 
		INFO_PRINTF1(_L("Error: Extended bitmap tests only work when the example rasterizer is available, make sure \"-DFBSRASTERIZER_DLL=fbsrasterizer_test.dll\" is included in your rombuild command."));
 | 
| 
sl@0
 | 
   137  | 
		User::Leave(KErrGeneral);
  | 
| 
sl@0
 | 
   138  | 
		}
  | 
| 
sl@0
 | 
   139  | 
	
  | 
| 
sl@0
 | 
   140  | 
	return res;
  | 
| 
sl@0
 | 
   141  | 
	}
  | 
| 
sl@0
 | 
   142  | 
  | 
| 
sl@0
 | 
   143  | 
/**
  | 
| 
sl@0
 | 
   144  | 
@SYMTestCaseID
  | 
| 
sl@0
 | 
   145  | 
GRAPHICS-UI-BENCH-0159
  | 
| 
sl@0
 | 
   146  | 
  | 
| 
sl@0
 | 
   147  | 
@SYMPREQ 
  | 
| 
sl@0
 | 
   148  | 
PREQ2096
  | 
| 
sl@0
 | 
   149  | 
  | 
| 
sl@0
 | 
   150  | 
@SYMREQ
  | 
| 
sl@0
 | 
   151  | 
REQ10847
  | 
| 
sl@0
 | 
   152  | 
REQ10849
  | 
| 
sl@0
 | 
   153  | 
  | 
| 
sl@0
 | 
   154  | 
@SYMTestCaseDesc
  | 
| 
sl@0
 | 
   155  | 
The test determines how long it takes to create an extended bitmap.
  | 
| 
sl@0
 | 
   156  | 
  | 
| 
sl@0
 | 
   157  | 
@SYMTestActions
  | 
| 
sl@0
 | 
   158  | 
Measure the average time taken to create an extended bitmap by creating an
  | 
| 
sl@0
 | 
   159  | 
extended bitmap 1000 times and then calculating the average time.
  | 
| 
sl@0
 | 
   160  | 
  | 
| 
sl@0
 | 
   161  | 
@SYMTestExpectedResults
  | 
| 
sl@0
 | 
   162  | 
Test should pass and display total test time and time per extended bitmap creation.
  | 
| 
sl@0
 | 
   163  | 
*/
  | 
| 
sl@0
 | 
   164  | 
void CTExtendedBitmap::CreateExtendedBitmapL()
  | 
| 
sl@0
 | 
   165  | 
	{		
 | 
| 
sl@0
 | 
   166  | 
	CFbsBitmap* bmp = new(ELeave) CFbsBitmap;
  | 
| 
sl@0
 | 
   167  | 
	TESTL(bmp != NULL);
  | 
| 
sl@0
 | 
   168  | 
	CleanupStack::PushL(bmp);
  | 
| 
sl@0
 | 
   169  | 
	
  | 
| 
sl@0
 | 
   170  | 
	iProfiler->InitResults();	
  | 
| 
sl@0
 | 
   171  | 
	for(TInt count=KIterationsToTest; count>0; --count)
  | 
| 
sl@0
 | 
   172  | 
		{		
 | 
| 
sl@0
 | 
   173  | 
		iProfiler->StartTimer();		
  | 
| 
sl@0
 | 
   174  | 
		TInt err = bmp->CreateExtendedBitmap(KBitmapSize, EColor64K, KExtendedBitmapUid, iExtendedBmpData, iExtendedBmpDataSize);						
  | 
| 
sl@0
 | 
   175  | 
		iProfiler->MarkResultSetL();
  | 
| 
sl@0
 | 
   176  | 
		TESTL(err == KErrNone);
  | 
| 
sl@0
 | 
   177  | 
		
  | 
| 
sl@0
 | 
   178  | 
		// Reset the bitmap so the time taken to reset it the next time CreateExtendedBitmap()
  | 
| 
sl@0
 | 
   179  | 
		// is called is not included in the test
  | 
| 
sl@0
 | 
   180  | 
		bmp->Reset();
  | 
| 
sl@0
 | 
   181  | 
		
  | 
| 
sl@0
 | 
   182  | 
		}	
  | 
| 
sl@0
 | 
   183  | 
	iProfiler->ResultsAnalysis(_L("Create-ExtendedBitmap-64K"), 0, EColor64K, EColor64K, KIterationsToTest);
 | 
| 
sl@0
 | 
   184  | 
	
  | 
| 
sl@0
 | 
   185  | 
	CleanupStack::PopAndDestroy(bmp);
  | 
| 
sl@0
 | 
   186  | 
	}
  | 
| 
sl@0
 | 
   187  | 
  | 
| 
sl@0
 | 
   188  | 
/**
  | 
| 
sl@0
 | 
   189  | 
@SYMTestCaseID
  | 
| 
sl@0
 | 
   190  | 
GRAPHICS-UI-BENCH-0160
  | 
| 
sl@0
 | 
   191  | 
  | 
| 
sl@0
 | 
   192  | 
@SYMPREQ 
  | 
| 
sl@0
 | 
   193  | 
PREQ2096
  | 
| 
sl@0
 | 
   194  | 
  | 
| 
sl@0
 | 
   195  | 
@SYMREQ
  | 
| 
sl@0
 | 
   196  | 
REQ10847
  | 
| 
sl@0
 | 
   197  | 
REQ10849
  | 
| 
sl@0
 | 
   198  | 
  | 
| 
sl@0
 | 
   199  | 
@SYMTestCaseDesc
  | 
| 
sl@0
 | 
   200  | 
The test determines how long it takes to delete an extended bitmap.
  | 
| 
sl@0
 | 
   201  | 
  | 
| 
sl@0
 | 
   202  | 
@SYMTestActions
  | 
| 
sl@0
 | 
   203  | 
Measure the average time taken to delete an extended bitmap by creating and
  | 
| 
sl@0
 | 
   204  | 
deleting an extended bitmap 1000 times and then calculating the average time for the deletion.
  | 
| 
sl@0
 | 
   205  | 
  | 
| 
sl@0
 | 
   206  | 
@SYMTestExpectedResults
  | 
| 
sl@0
 | 
   207  | 
Test should pass and display total test time and time per extended bitmap deletion.
  | 
| 
sl@0
 | 
   208  | 
*/
  | 
| 
sl@0
 | 
   209  | 
void CTExtendedBitmap::DeleteExtendedBitmapL()
  | 
| 
sl@0
 | 
   210  | 
	{		
 | 
| 
sl@0
 | 
   211  | 
	CFbsBitmap* bmp = new(ELeave) CFbsBitmap;
  | 
| 
sl@0
 | 
   212  | 
	TESTL(bmp != NULL);
  | 
| 
sl@0
 | 
   213  | 
	CleanupStack::PushL(bmp);
  | 
| 
sl@0
 | 
   214  | 
	
  | 
| 
sl@0
 | 
   215  | 
	iProfiler->InitResults();	
  | 
| 
sl@0
 | 
   216  | 
	for(TInt count=KIterationsToTest; count>0; --count)
  | 
| 
sl@0
 | 
   217  | 
		{						
 | 
| 
sl@0
 | 
   218  | 
		TInt err = bmp->CreateExtendedBitmap(KBitmapSize, EColor64K, KExtendedBitmapUid, iExtendedBmpData, iExtendedBmpDataSize);
  | 
| 
sl@0
 | 
   219  | 
		TESTL(err == KErrNone);		
  | 
| 
sl@0
 | 
   220  | 
		CleanupStack::Pop(bmp);
  | 
| 
sl@0
 | 
   221  | 
		
  | 
| 
sl@0
 | 
   222  | 
		iProfiler->StartTimer();
  | 
| 
sl@0
 | 
   223  | 
		delete bmp;
  | 
| 
sl@0
 | 
   224  | 
		iProfiler->MarkResultSetL();
  | 
| 
sl@0
 | 
   225  | 
		
  | 
| 
sl@0
 | 
   226  | 
		bmp = new(ELeave) CFbsBitmap;		
  | 
| 
sl@0
 | 
   227  | 
		TESTL(bmp != NULL);
  | 
| 
sl@0
 | 
   228  | 
		CleanupStack::PushL(bmp);
  | 
| 
sl@0
 | 
   229  | 
		}	
  | 
| 
sl@0
 | 
   230  | 
	iProfiler->ResultsAnalysis(_L("Delete-ExtendedBitmap-64K"), 0, EColor64K, EColor64K, KIterationsToTest);
 | 
| 
sl@0
 | 
   231  | 
	
  | 
| 
sl@0
 | 
   232  | 
	CleanupStack::PopAndDestroy(bmp);
  | 
| 
sl@0
 | 
   233  | 
	}
  | 
| 
sl@0
 | 
   234  | 
  | 
| 
sl@0
 | 
   235  | 
/**
  | 
| 
sl@0
 | 
   236  | 
@SYMTestCaseID
  | 
| 
sl@0
 | 
   237  | 
GRAPHICS-UI-BENCH-0161
  | 
| 
sl@0
 | 
   238  | 
  | 
| 
sl@0
 | 
   239  | 
@SYMPREQ 
  | 
| 
sl@0
 | 
   240  | 
PREQ2096
  | 
| 
sl@0
 | 
   241  | 
  | 
| 
sl@0
 | 
   242  | 
@SYMREQ 
  | 
| 
sl@0
 | 
   243  | 
REQ10847 
  | 
| 
sl@0
 | 
   244  | 
REQ10860
  | 
| 
sl@0
 | 
   245  | 
  | 
| 
sl@0
 | 
   246  | 
@SYMTestCaseDesc
  | 
| 
sl@0
 | 
   247  | 
Measure the average time taken to get a scanline from an extended bitmap directly using
  | 
| 
sl@0
 | 
   248  | 
the example rasterizer where there is one call to BeginBitmap() and EndBitmap() for 
  | 
| 
sl@0
 | 
   249  | 
many GetScanLine() calls. This test only measures the performance of the example rasterizer. 
  | 
| 
sl@0
 | 
   250  | 
It is included here to help isolate performance changes in CTExtendedBitmap::BitBltExtendedBitmapL() 
  | 
| 
sl@0
 | 
   251  | 
and CTExtendedBitmap::DrawBitmapExtendedBitmapL().
  | 
| 
sl@0
 | 
   252  | 
  | 
| 
sl@0
 | 
   253  | 
@SYMTestActions
  | 
| 
sl@0
 | 
   254  | 
Measure the average time taken to get a scanline from an extended bitmap directly using
  | 
| 
sl@0
 | 
   255  | 
the example rasterizer by calling CFbsRasterizer::ScanLine() 1000 times for an extended
  | 
| 
sl@0
 | 
   256  | 
bitmap.
  | 
| 
sl@0
 | 
   257  | 
  | 
| 
sl@0
 | 
   258  | 
@SYMTestExpectedResults
  | 
| 
sl@0
 | 
   259  | 
Test should pass and display total test time and time per scanline.
  | 
| 
sl@0
 | 
   260  | 
  | 
| 
sl@0
 | 
   261  | 
@see GetScanlineNonPreRenderedExtendedBitmapL()
  | 
| 
sl@0
 | 
   262  | 
*/
  | 
| 
sl@0
 | 
   263  | 
void CTExtendedBitmap::GetScanlinePreRenderedExtendedBitmapL()
  | 
| 
sl@0
 | 
   264  | 
	{			
 | 
| 
sl@0
 | 
   265  | 
	CFbsRasterizer::TBitmapDesc bitmapDesc;
  | 
| 
sl@0
 | 
   266  | 
	TInt64 bitmapId = iExtendedBmp->SerialNumber();
  | 
| 
sl@0
 | 
   267  | 
	bitmapDesc.iSizeInPixels = KBitmapSize;
  | 
| 
sl@0
 | 
   268  | 
	bitmapDesc.iDispMode = KDisplayMode;
  | 
| 
sl@0
 | 
   269  | 
	bitmapDesc.iDataType = KExtendedBitmapUid;
  | 
| 
sl@0
 | 
   270  | 
	bitmapDesc.iData = iExtendedBmpData;
  | 
| 
sl@0
 | 
   271  | 
	bitmapDesc.iDataSize = iExtendedBmpDataSize;	
  | 
| 
sl@0
 | 
   272  | 
	iRasterizer->BeginBitmap(bitmapId, bitmapDesc, NULL);
  | 
| 
sl@0
 | 
   273  | 
		
  | 
| 
sl@0
 | 
   274  | 
	TInt h;
  | 
| 
sl@0
 | 
   275  | 
	const TUint32* scanline;
  | 
| 
sl@0
 | 
   276  | 
	TPoint point(0,0);
  | 
| 
sl@0
 | 
   277  | 
	
  | 
| 
sl@0
 | 
   278  | 
	iProfiler->InitResults();
  | 
| 
sl@0
 | 
   279  | 
	for(TInt count=KIterationsToTest; count>0; --count)
  | 
| 
sl@0
 | 
   280  | 
		{								
 | 
| 
sl@0
 | 
   281  | 
		for (h = 0; h < KBitmapSize.iHeight; h++)
  | 
| 
sl@0
 | 
   282  | 
			{
 | 
| 
sl@0
 | 
   283  | 
			point.iY = h;
  | 
| 
sl@0
 | 
   284  | 
			scanline = iRasterizer->ScanLine(bitmapId, point, KBitmapSize.iWidth);
  | 
| 
sl@0
 | 
   285  | 
			TESTL(scanline != NULL);
  | 
| 
sl@0
 | 
   286  | 
			}
  | 
| 
sl@0
 | 
   287  | 
		iProfiler->MarkResultSetL();
  | 
| 
sl@0
 | 
   288  | 
		}	
  | 
| 
sl@0
 | 
   289  | 
	iProfiler->ResultsAnalysis(_L("GetScanline-PreRendered-64K"), 0, EColor64K, EColor64K, KIterationsToTest);
 | 
| 
sl@0
 | 
   290  | 
	
  | 
| 
sl@0
 | 
   291  | 
	iRasterizer->EndBitmap(bitmapId);
  | 
| 
sl@0
 | 
   292  | 
	}
  | 
| 
sl@0
 | 
   293  | 
  | 
| 
sl@0
 | 
   294  | 
/**
  | 
| 
sl@0
 | 
   295  | 
@SYMTestCaseID
  | 
| 
sl@0
 | 
   296  | 
GRAPHICS-UI-BENCH-0162
  | 
| 
sl@0
 | 
   297  | 
  | 
| 
sl@0
 | 
   298  | 
@SYMPREQ PREQ2096
  | 
| 
sl@0
 | 
   299  | 
  | 
| 
sl@0
 | 
   300  | 
@SYMREQ 
  | 
| 
sl@0
 | 
   301  | 
REQ10847 
  | 
| 
sl@0
 | 
   302  | 
REQ10860
  | 
| 
sl@0
 | 
   303  | 
  | 
| 
sl@0
 | 
   304  | 
@SYMTestCaseDesc
  | 
| 
sl@0
 | 
   305  | 
Measure the average time taken to get a scanline from an extended bitmap directly using
  | 
| 
sl@0
 | 
   306  | 
the example rasterizer where the calls to BeginBitmap() and EndBitmap() are done for each 
  | 
| 
sl@0
 | 
   307  | 
GetScanLine().
  | 
| 
sl@0
 | 
   308  | 
  | 
| 
sl@0
 | 
   309  | 
@SYMTestActions
  | 
| 
sl@0
 | 
   310  | 
Call CFbsRasterizer::ScanLine() 1000 times for an extended bitmap. This test case is similar 
  | 
| 
sl@0
 | 
   311  | 
to GetScanlinePreRenderedExtendedBitmapL() but in this case each CFbsRasterizer::ScanLine() 
  | 
| 
sl@0
 | 
   312  | 
call is bracketed by CFbsRasterizer::BeginBitmap() and CFbsRasterizer::EndBitmap() to highlight 
  | 
| 
sl@0
 | 
   313  | 
the performance hit that would be seen by an application calling CFbsBitmap::GetScanLine() 
  | 
| 
sl@0
 | 
   314  | 
when using an extended bitmap rasterizer that does not have a cache. 
  | 
| 
sl@0
 | 
   315  | 
  | 
| 
sl@0
 | 
   316  | 
@SYMTestExpectedResults
  | 
| 
sl@0
 | 
   317  | 
Test should pass and display total test time and time per scanline when bracketed by 
  | 
| 
sl@0
 | 
   318  | 
CFbsRasterizer::BeginBitmap() and CFbsRasterizer::EndBitmap().
  | 
| 
sl@0
 | 
   319  | 
  | 
| 
sl@0
 | 
   320  | 
@see GetScanlinePreRenderedExtendedBitmapL()
  | 
| 
sl@0
 | 
   321  | 
*/
  | 
| 
sl@0
 | 
   322  | 
void CTExtendedBitmap::GetScanlineNonPreRenderedExtendedBitmapL()
  | 
| 
sl@0
 | 
   323  | 
	{				
 | 
| 
sl@0
 | 
   324  | 
	CFbsRasterizer::TBitmapDesc bitmapDesc;
  | 
| 
sl@0
 | 
   325  | 
	TInt64 bitmapId = iExtendedBmp->SerialNumber();
  | 
| 
sl@0
 | 
   326  | 
	bitmapDesc.iSizeInPixels = KBitmapSize;
  | 
| 
sl@0
 | 
   327  | 
	bitmapDesc.iDispMode = KDisplayMode;
  | 
| 
sl@0
 | 
   328  | 
	bitmapDesc.iDataType = KExtendedBitmapUid;
  | 
| 
sl@0
 | 
   329  | 
	bitmapDesc.iData = iExtendedBmpData;
  | 
| 
sl@0
 | 
   330  | 
	bitmapDesc.iDataSize = iExtendedBmpDataSize;		
  | 
| 
sl@0
 | 
   331  | 
		
  | 
| 
sl@0
 | 
   332  | 
	TInt h;
  | 
| 
sl@0
 | 
   333  | 
	const TUint32* scanline;
  | 
| 
sl@0
 | 
   334  | 
	TPoint point(0,0);
  | 
| 
sl@0
 | 
   335  | 
	
  | 
| 
sl@0
 | 
   336  | 
	iProfiler->InitResults();
  | 
| 
sl@0
 | 
   337  | 
	for(TInt count=KIterationsToTest; count>0; --count)
  | 
| 
sl@0
 | 
   338  | 
		{
 | 
| 
sl@0
 | 
   339  | 
		for (h = 0; h < KBitmapSize.iHeight; h++)
  | 
| 
sl@0
 | 
   340  | 
			{
 | 
| 
sl@0
 | 
   341  | 
			// Only the first call to BeginBitmap() should cause rasterization of the bitmap,
  | 
| 
sl@0
 | 
   342  | 
			// since the test rasterizer has a cache of recently used bitmaps.
  | 
| 
sl@0
 | 
   343  | 
			iRasterizer->BeginBitmap(bitmapId, bitmapDesc, NULL);
  | 
| 
sl@0
 | 
   344  | 
			point.iY = h;
  | 
| 
sl@0
 | 
   345  | 
			scanline = iRasterizer->ScanLine(bitmapId, point, KBitmapSize.iWidth);
  | 
| 
sl@0
 | 
   346  | 
			TESTL(scanline != NULL);
  | 
| 
sl@0
 | 
   347  | 
			iRasterizer->EndBitmap(bitmapId);
  | 
| 
sl@0
 | 
   348  | 
			}
  | 
| 
sl@0
 | 
   349  | 
		iProfiler->MarkResultSetL();
  | 
| 
sl@0
 | 
   350  | 
		}
  | 
| 
sl@0
 | 
   351  | 
	iProfiler->ResultsAnalysis(_L("GetScanline-NonPreRendered-64K"), 0, EColor64K, EColor64K, KIterationsToTest);
 | 
| 
sl@0
 | 
   352  | 
	}
  | 
| 
sl@0
 | 
   353  | 
  | 
| 
sl@0
 | 
   354  | 
/**
  | 
| 
sl@0
 | 
   355  | 
@SYMTestCaseID
  | 
| 
sl@0
 | 
   356  | 
GRAPHICS-UI-BENCH-0163
  | 
| 
sl@0
 | 
   357  | 
  | 
| 
sl@0
 | 
   358  | 
@SYMPREQ 
  | 
| 
sl@0
 | 
   359  | 
PREQ2096
  | 
| 
sl@0
 | 
   360  | 
  | 
| 
sl@0
 | 
   361  | 
@SYMREQ
  | 
| 
sl@0
 | 
   362  | 
REQ10857
  | 
| 
sl@0
 | 
   363  | 
REQ10859
  | 
| 
sl@0
 | 
   364  | 
  | 
| 
sl@0
 | 
   365  | 
@SYMTestCaseDesc
  | 
| 
sl@0
 | 
   366  | 
The test determines how long it takes to BitBlt() an extended bitmap to an offscreen bitmap.
  | 
| 
sl@0
 | 
   367  | 
This test is paired with BitBltNormalBitmapL().
  | 
| 
sl@0
 | 
   368  | 
  | 
| 
sl@0
 | 
   369  | 
@SYMTestActions
  | 
| 
sl@0
 | 
   370  | 
Measure the time taken to BitBlt() an extended bitmap to an offscreen buffer 1000 times
  | 
| 
sl@0
 | 
   371  | 
and calculate the average time taken. 
  | 
| 
sl@0
 | 
   372  | 
  | 
| 
sl@0
 | 
   373  | 
@SYMTestExpectedResults
  | 
| 
sl@0
 | 
   374  | 
Test should pass and display total test time and time per image BitBlt().
  | 
| 
sl@0
 | 
   375  | 
  | 
| 
sl@0
 | 
   376  | 
@see BitBltNormalBitmapL()
  | 
| 
sl@0
 | 
   377  | 
*/
  | 
| 
sl@0
 | 
   378  | 
void CTExtendedBitmap::BitBltExtendedBitmapL()
  | 
| 
sl@0
 | 
   379  | 
	{			
 | 
| 
sl@0
 | 
   380  | 
	const TPoint pt(0,0);
  | 
| 
sl@0
 | 
   381  | 
	
  | 
| 
sl@0
 | 
   382  | 
	iProfiler->InitResults();	
  | 
| 
sl@0
 | 
   383  | 
	for(TInt count=KIterationsToTest; count>0; --count)
  | 
| 
sl@0
 | 
   384  | 
		{
 | 
| 
sl@0
 | 
   385  | 
		iBitGc->BitBlt(pt, iExtendedBmp);
  | 
| 
sl@0
 | 
   386  | 
		iProfiler->MarkResultSetL();
  | 
| 
sl@0
 | 
   387  | 
		}	
  | 
| 
sl@0
 | 
   388  | 
	iProfiler->ResultsAnalysis(_L("BitBlt-ExtendedBitmap-64K"), 0, EColor64K, EColor64K, KIterationsToTest);
 | 
| 
sl@0
 | 
   389  | 
	}
  | 
| 
sl@0
 | 
   390  | 
  | 
| 
sl@0
 | 
   391  | 
/**
  | 
| 
sl@0
 | 
   392  | 
@SYMTestCaseID
  | 
| 
sl@0
 | 
   393  | 
GRAPHICS-UI-BENCH-0164
  | 
| 
sl@0
 | 
   394  | 
  | 
| 
sl@0
 | 
   395  | 
@SYMPREQ PREQ2096
  | 
| 
sl@0
 | 
   396  | 
  | 
| 
sl@0
 | 
   397  | 
@SYMTestCaseDesc
  | 
| 
sl@0
 | 
   398  | 
The test determines how long it takes to BitBlt() a standard bitmap that is the same size
  | 
| 
sl@0
 | 
   399  | 
as the extended bitmap used in the previous test case BitBltExtendedBitmapL().
  | 
| 
sl@0
 | 
   400  | 
This test is paired with BitBltExtendedBitmapL().
  | 
| 
sl@0
 | 
   401  | 
  | 
| 
sl@0
 | 
   402  | 
@SYMTestActions
  | 
| 
sl@0
 | 
   403  | 
Measure the time taken to BitBlt() a normal bitmap to an offscreen buffer 1000 times
  | 
| 
sl@0
 | 
   404  | 
and calculate the average time taken.
  | 
| 
sl@0
 | 
   405  | 
  | 
| 
sl@0
 | 
   406  | 
@SYMTestExpectedResults
  | 
| 
sl@0
 | 
   407  | 
Test should pass and display total test time and time per image BitBlt().
  | 
| 
sl@0
 | 
   408  | 
  | 
| 
sl@0
 | 
   409  | 
@see BitBltExtendedBitmapL()
  | 
| 
sl@0
 | 
   410  | 
*/
  | 
| 
sl@0
 | 
   411  | 
void CTExtendedBitmap::BitBltNormalBitmapL()
  | 
| 
sl@0
 | 
   412  | 
	{		
 | 
| 
sl@0
 | 
   413  | 
	const TPoint pt(0,0);
  | 
| 
sl@0
 | 
   414  | 
	
  | 
| 
sl@0
 | 
   415  | 
	iProfiler->InitResults();	
  | 
| 
sl@0
 | 
   416  | 
	for(TInt count=KIterationsToTest; count>0; --count)
  | 
| 
sl@0
 | 
   417  | 
		{
 | 
| 
sl@0
 | 
   418  | 
		iBitGc->BitBlt(pt, iNormalBmp);
  | 
| 
sl@0
 | 
   419  | 
		iProfiler->MarkResultSetL();
  | 
| 
sl@0
 | 
   420  | 
		}	
  | 
| 
sl@0
 | 
   421  | 
	iProfiler->ResultsAnalysis(_L("BitBlt-NormalBitmap-64K"), 0, EColor64K, EColor64K, KIterationsToTest);
 | 
| 
sl@0
 | 
   422  | 
	}
  | 
| 
sl@0
 | 
   423  | 
  | 
| 
sl@0
 | 
   424  | 
/**
  | 
| 
sl@0
 | 
   425  | 
@SYMTestCaseID
  | 
| 
sl@0
 | 
   426  | 
GRAPHICS-UI-BENCH-0165
  | 
| 
sl@0
 | 
   427  | 
  | 
| 
sl@0
 | 
   428  | 
@SYMPREQ 
  | 
| 
sl@0
 | 
   429  | 
PREQ2096
  | 
| 
sl@0
 | 
   430  | 
  | 
| 
sl@0
 | 
   431  | 
@SYMREQ
  | 
| 
sl@0
 | 
   432  | 
REQ10857
  | 
| 
sl@0
 | 
   433  | 
REQ10859
  | 
| 
sl@0
 | 
   434  | 
  | 
| 
sl@0
 | 
   435  | 
@SYMTestCaseDesc
  | 
| 
sl@0
 | 
   436  | 
The test determines how long it takes to draw an extended bitmap to an offscreen bitmap
  | 
| 
sl@0
 | 
   437  | 
using DrawBitmap(). This test is paired with DrawBitmapNormalBitmapL().
  | 
| 
sl@0
 | 
   438  | 
  | 
| 
sl@0
 | 
   439  | 
@SYMTestActions
  | 
| 
sl@0
 | 
   440  | 
Measure the time taken to DrawBitmap() an extended bitmap to an offscreen buffer 1000 times
  | 
| 
sl@0
 | 
   441  | 
and calculate the average time taken. This test is paired with DrawBitmapNormalBitmapL().
  | 
| 
sl@0
 | 
   442  | 
  | 
| 
sl@0
 | 
   443  | 
@SYMTestExpectedResults
  | 
| 
sl@0
 | 
   444  | 
Test should pass and display total test time and time per image DrawBitmap().
  | 
| 
sl@0
 | 
   445  | 
  | 
| 
sl@0
 | 
   446  | 
@see DrawBitmapNormalBitmapL()
  | 
| 
sl@0
 | 
   447  | 
*/
  | 
| 
sl@0
 | 
   448  | 
void CTExtendedBitmap::DrawBitmapExtendedBitmapL()
  | 
| 
sl@0
 | 
   449  | 
	{			
 | 
| 
sl@0
 | 
   450  | 
	const TPoint pt(0,0);
  | 
| 
sl@0
 | 
   451  | 
	const TRect rect(pt, KBitmapSize);
  | 
| 
sl@0
 | 
   452  | 
	
  | 
| 
sl@0
 | 
   453  | 
	iProfiler->InitResults();	
  | 
| 
sl@0
 | 
   454  | 
	for(TInt count=KIterationsToTest; count>0; --count)
  | 
| 
sl@0
 | 
   455  | 
		{
 | 
| 
sl@0
 | 
   456  | 
		iBitGc->DrawBitmap(rect, iExtendedBmp, rect);
  | 
| 
sl@0
 | 
   457  | 
		iProfiler->MarkResultSetL();
  | 
| 
sl@0
 | 
   458  | 
		}	
  | 
| 
sl@0
 | 
   459  | 
	iProfiler->ResultsAnalysis(_L("DrawBitmap-ExtendedBitmap-64K"), 0, EColor64K, EColor64K, KIterationsToTest);
 | 
| 
sl@0
 | 
   460  | 
	}
  | 
| 
sl@0
 | 
   461  | 
  | 
| 
sl@0
 | 
   462  | 
/**
  | 
| 
sl@0
 | 
   463  | 
@SYMTestCaseID
  | 
| 
sl@0
 | 
   464  | 
GRAPHICS-UI-BENCH-0166
  | 
| 
sl@0
 | 
   465  | 
  | 
| 
sl@0
 | 
   466  | 
@SYMPREQ PREQ2096
  | 
| 
sl@0
 | 
   467  | 
  | 
| 
sl@0
 | 
   468  | 
@SYMTestCaseDesc
  | 
| 
sl@0
 | 
   469  | 
The test determines how long it takes to draw a standard bitmap that is the same size
  | 
| 
sl@0
 | 
   470  | 
as the extended bitmap used in the previous test case (DrawBitmapExtendedBitmapL()) 
  | 
| 
sl@0
 | 
   471  | 
using DrawBitmap(). This test is paired with DrawBitmapExtendedBitmapL().
  | 
| 
sl@0
 | 
   472  | 
This test is paired with DrawBitmapExtendedBitmapL().
  | 
| 
sl@0
 | 
   473  | 
  | 
| 
sl@0
 | 
   474  | 
@SYMTestActions
  | 
| 
sl@0
 | 
   475  | 
Measure the time taken to DrawBitmap() a normal bitmap to an offscreen buffer 1000 times
  | 
| 
sl@0
 | 
   476  | 
and calculate the average time taken.
  | 
| 
sl@0
 | 
   477  | 
  | 
| 
sl@0
 | 
   478  | 
@SYMTestExpectedResults
  | 
| 
sl@0
 | 
   479  | 
Test should pass and display total test time and time per image DrawBitmap().
  | 
| 
sl@0
 | 
   480  | 
  | 
| 
sl@0
 | 
   481  | 
@see DrawBitmapExtendedBitmapL()
  | 
| 
sl@0
 | 
   482  | 
*/
  | 
| 
sl@0
 | 
   483  | 
void CTExtendedBitmap::DrawBitmapNormalBitmapL()
  | 
| 
sl@0
 | 
   484  | 
	{		
 | 
| 
sl@0
 | 
   485  | 
	const TPoint pt(0,0);
  | 
| 
sl@0
 | 
   486  | 
	const TRect rect(pt, KBitmapSize);
  | 
| 
sl@0
 | 
   487  | 
	
  | 
| 
sl@0
 | 
   488  | 
	iProfiler->InitResults();	
  | 
| 
sl@0
 | 
   489  | 
	for(TInt count=KIterationsToTest; count>0; --count)
  | 
| 
sl@0
 | 
   490  | 
		{
 | 
| 
sl@0
 | 
   491  | 
		iBitGc->DrawBitmap(rect, iNormalBmp, rect);
  | 
| 
sl@0
 | 
   492  | 
		iProfiler->MarkResultSetL();
  | 
| 
sl@0
 | 
   493  | 
		}	
  | 
| 
sl@0
 | 
   494  | 
	iProfiler->ResultsAnalysis(_L("DrawBitmap-NormalBitmap-64K"), 0, EColor64K, EColor64K, KIterationsToTest);
 | 
| 
sl@0
 | 
   495  | 
	}
  | 
| 
sl@0
 | 
   496  | 
  | 
| 
sl@0
 | 
   497  | 
/**
  | 
| 
sl@0
 | 
   498  | 
@SYMTestCaseID
  | 
| 
sl@0
 | 
   499  | 
GRAPHICS-UI-BENCH-0173
  | 
| 
sl@0
 | 
   500  | 
  | 
| 
sl@0
 | 
   501  | 
@SYMCR
  | 
| 
sl@0
 | 
   502  | 
CR1804
  | 
| 
sl@0
 | 
   503  | 
  | 
| 
sl@0
 | 
   504  | 
@SYMREQ 
  | 
| 
sl@0
 | 
   505  | 
REQ10858
  | 
| 
sl@0
 | 
   506  | 
  | 
| 
sl@0
 | 
   507  | 
@SYMTestCaseDesc
  | 
| 
sl@0
 | 
   508  | 
Measure the average time taken to get 128 pixels from a normal or extended bitmap.
  | 
| 
sl@0
 | 
   509  | 
  | 
| 
sl@0
 | 
   510  | 
@SYMTestActions
  | 
| 
sl@0
 | 
   511  | 
Measure the average time taken to get 128 pixels from a normal or extended bitmap 
  | 
| 
sl@0
 | 
   512  | 
by calling CFbsBitmap::GetPixel() 1000 times on the bitmap.
  | 
| 
sl@0
 | 
   513  | 
  | 
| 
sl@0
 | 
   514  | 
@SYMTestExpectedResults
  | 
| 
sl@0
 | 
   515  | 
Test should pass and display total test time and time per 128 pixels.
  | 
| 
sl@0
 | 
   516  | 
*/
  | 
| 
sl@0
 | 
   517  | 
void CTExtendedBitmap::GetPixelL(TBool aIsExtendedBmp)
  | 
| 
sl@0
 | 
   518  | 
	{
 | 
| 
sl@0
 | 
   519  | 
	CFbsBitmap* bmp = NULL;
  | 
| 
sl@0
 | 
   520  | 
	_LIT(KTestName, "GetPixel-%S-64K");
  | 
| 
sl@0
 | 
   521  | 
	TBuf<30> buf;
  | 
| 
sl@0
 | 
   522  | 
  | 
| 
sl@0
 | 
   523  | 
	if (aIsExtendedBmp)
  | 
| 
sl@0
 | 
   524  | 
		{
 | 
| 
sl@0
 | 
   525  | 
		_LIT(KExtBmpName, "ExtendedBitmap");
  | 
| 
sl@0
 | 
   526  | 
		buf.Format(KTestName, &KExtBmpName);
  | 
| 
sl@0
 | 
   527  | 
		bmp= iExtendedBmp;
  | 
| 
sl@0
 | 
   528  | 
		}
  | 
| 
sl@0
 | 
   529  | 
	else
  | 
| 
sl@0
 | 
   530  | 
		{
 | 
| 
sl@0
 | 
   531  | 
		_LIT(KNormalBmpName, "NormalBitmap");
  | 
| 
sl@0
 | 
   532  | 
		buf.Format(KTestName, &KNormalBmpName);
  | 
| 
sl@0
 | 
   533  | 
		bmp = iNormalBmp;
  | 
| 
sl@0
 | 
   534  | 
		}
  | 
| 
sl@0
 | 
   535  | 
  | 
| 
sl@0
 | 
   536  | 
	TInt y;
  | 
| 
sl@0
 | 
   537  | 
	TPoint point(0,0);
  | 
| 
sl@0
 | 
   538  | 
	TRgb color;
  | 
| 
sl@0
 | 
   539  | 
	iProfiler->InitResults();
  | 
| 
sl@0
 | 
   540  | 
	for(TInt count=KIterationsToTest; count>0; --count)
  | 
| 
sl@0
 | 
   541  | 
		{								
 | 
| 
sl@0
 | 
   542  | 
		for (y = 0; y < KBitmapSize.iHeight; ++y)
  | 
| 
sl@0
 | 
   543  | 
			{
 | 
| 
sl@0
 | 
   544  | 
			point.iY = y;
  | 
| 
sl@0
 | 
   545  | 
			bmp->GetPixel(color, point);
  | 
| 
sl@0
 | 
   546  | 
			}
  | 
| 
sl@0
 | 
   547  | 
		iProfiler->MarkResultSetL();
  | 
| 
sl@0
 | 
   548  | 
		}
  | 
| 
sl@0
 | 
   549  | 
	iProfiler->ResultsAnalysis(buf, 0, KDisplayMode, KDisplayMode, KIterationsToTest);
  | 
| 
sl@0
 | 
   550  | 
	}
  |