diff -r 000000000000 -r 5d03bc08d59c graphicstest/uibench/src/tscaleddrawbitmap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graphicstest/uibench/src/tscaleddrawbitmap.cpp Tue Feb 02 01:47:50 2010 +0200 @@ -0,0 +1,204 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file + @test + @internalComponent - Internal Symbian test code +*/ + +#include "tscaleddrawbitmap.h" + +const TInt KIterationsToTest = 55; +const TInt KDelay = 500*1000; // 0.5 seconds + +#define __CyclesPerPixel(__a,__b) ((TInt)(((__a/(TInt64)__b)*((TInt64)iCPUSpeed)/((TInt64)(iWindowSize.iWidth*iWindowSize.iHeight)))/(TInt64)1000)) + +_LIT(KAlphaTestBitmap,"z:\\system\\data\\uibench_24bit.mbm"); + +const TDisplayMode ModeArray[]= + { + EColor64K, + EColor16MU, + EColor16MA, + EColor16MAP + }; +const TInt ModeCount=sizeof(ModeArray)/sizeof(ModeArray[0]); + +#define FPSHFT 8 +#define VARSIZE TSize((actsizexFP>>FPSHFT),(actsizeyFP>>FPSHFT)) + +/** + @SYMTestCaseID + GRAPHICS-UI-BENCH-0020 + + @SYMTestCaseDesc + The test determines how long DrawBitmap function takes when scaling is involved. + + @SYMTestActions + Compare the results over time, and before and after changes to wserv code. + + @SYMTestExpectedResults + Test should pass and display total test time and cycles per pixel +*/ +void CTScaledDrawBitmap::DoTestScaledDrawBitmapL(TInt aRotation, TDisplayMode aMode, TDisplayMode aScreenMode, TInt aIters) + { + TSize siz=iScreenDevice->SizeInPixels(); + + CFbsBitmap * bmpModeDep = CreateSoftwareBitmapLC(siz, aMode); + + CFbsBitmap * sourceOverImage = LoadBitmapL(KAlphaTestBitmap,0); + CleanupStack::PushL(sourceOverImage); + + CopyBitmapL(bmpModeDep, sourceOverImage); + + TInt startsizeFP=1<SizeInPixels().iWidth)<SizeInPixels().iHeight)<InitResults(); + for (TInt i=1;iDrawBitmap(siz, bmpModeDep,VARSIZE); + actsizexFP+=dxFP; + actsizeyFP+=dyFP; + iProfiler->MarkResultSetL(); + } + + iProfiler->ResultsAnalysis(_L("ScaledDrawBmpVarDest"), aRotation, aMode, aScreenMode, aIters); + + startsizeFP=1<SizeInPixels().iWidth)<SizeInPixels().iHeight)<InitResults(); + for (TInt i=1;iDrawBitmap(VARSIZE, bmpModeDep, siz); + actsizexFP+=dxFP; + actsizeyFP+=dyFP; + iProfiler->MarkResultSetL(); + } + iProfiler->ResultsAnalysis(_L("ScaledDrawBmpVarSrc"), aRotation, aMode, aScreenMode, aIters); + + CFbsBitmap * greyMask = CreateSoftwareBitmapLC(iScreenDevice->SizeInPixels(), EGray256); + VerticalGradientAlphaL(greyMask, TRgb(0xffffffff), TRgb(0x00000000)); + + CFbsBitmap * bmpMask = CreateSoftwareBitmapLC(iScreenDevice->SizeInPixels(), EGray2); + CopyBitmapL(bmpMask, greyMask); + + startsizeFP=1<SizeInPixels().iWidth)<SizeInPixels().iHeight)<InitResults(); + for (TInt i=1;iDrawBitmapMasked(siz, bmpModeDep, VARSIZE, bmpMask, ETrue); + actsizexFP+=dxFP; + actsizeyFP+=dyFP; + iProfiler->MarkResultSetL(); + } + iProfiler->ResultsAnalysis(_L("ScaledDrawBmpMskdVarDest"), aRotation, aMode, aScreenMode, aIters); + + startsizeFP=1<SizeInPixels().iWidth)<SizeInPixels().iHeight)<InitResults(); + for (TInt i=1;iDrawBitmapMasked(VARSIZE, bmpModeDep, siz, bmpMask,ETrue); + actsizexFP+=dxFP; + actsizeyFP+=dyFP; + iProfiler->MarkResultSetL(); + } + + iProfiler->ResultsAnalysis(_L("ScaledDrawBmpMskdVarSrc"), aRotation, aMode, aScreenMode, aIters); + + CleanupStack::PopAndDestroy(4, bmpModeDep); // bmpMask, greyMask, sourceOverImage, bmpModeDep + User::After(KDelay); + } + +CTScaledDrawBitmap::CTScaledDrawBitmap() + { + SetTestStepName(KTScaledDrawBitmap); + } + +/** +@return - TVerdict code +Override of base class pure virtual +Our implementation only gets called if the base class doTestStepPreambleL() did +not leave. That being the case, the current test result value will be EPass. +*/ +TVerdict CTScaledDrawBitmap::doTestStepL() + { + TBool orientation[4]; + TRect blockRect(10, 10, 200, 180); + + for(TInt dispModeIndex = 0; dispModeIndex < KNumValidDisplayModes; dispModeIndex++) + { + SetScreenModeL(KValidDisplayModes[dispModeIndex]); + iGc->OrientationsAvailable(orientation); + for (TInt orient = CFbsBitGc::EGraphicsOrientationNormal; orient <= CFbsBitGc::EGraphicsOrientationRotated270; orient++) + { + if (orientation[orient]) + { + iGc->SetOrientation((CFbsBitGc::TGraphicsOrientation)orient); + SetTestStepID(_L(" GRAPHICS-UI-BENCH-0020")); + + // test drawing speed of scaled bitmaps + for (TInt m=0; m