os/graphics/graphicstest/uibench/src/te_graphicsperformanceSuiteServer.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicstest/uibench/src/te_graphicsperformanceSuiteServer.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,165 @@
     1.4 +// Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +/**
    1.20 + @file
    1.21 + @test
    1.22 + @internalComponent - Internal Symbian test code 
    1.23 +*/
    1.24 +
    1.25 +#include "te_graphicsperformanceSuiteServer.h"
    1.26 +#include "tbitbltperf.h"
    1.27 +#include "tfbsfonthandleperf.h"
    1.28 +#include "tfbsbitmaphandleperf.h"
    1.29 +#include "talphadrawing.h"
    1.30 +#include "tscrollingperf.h"
    1.31 +#include "toptimisedbmp.h"
    1.32 +#include "tscaleddrawbitmap.h"
    1.33 +#include "tsolidcolour.h"
    1.34 +#include "talphablend.h"
    1.35 +#include "tsimpledrawing.h"
    1.36 +#include "tshadowperf.h"
    1.37 +#include "tredrawing.h"
    1.38 +#include "tnonredrawdrawing.h"
    1.39 +#include "tgdifontrenderingperf.h"
    1.40 +#include "toutlineshadowdrawing.h"
    1.41 +#include "tfadeperf.h"
    1.42 +#include "tredrawstoreperf.h"
    1.43 +#include "ttranslucent.h"
    1.44 +#include "tspriteperf.h"
    1.45 +#include "textendedbitmap.h"
    1.46 +#include "tfbsglyphdata.h"
    1.47 +
    1.48 +/**
    1.49 +Same code for Secure and non-secure variants
    1.50 +Called inside the MainL() function to create and start the
    1.51 +CTestServer derived server.
    1.52 +
    1.53 +@return - Instance of the test server
    1.54 +*/
    1.55 +CTe_graphicsperformanceSuite* CTe_graphicsperformanceSuite::NewL()
    1.56 +	{
    1.57 +	CTe_graphicsperformanceSuite * server = new (ELeave) CTe_graphicsperformanceSuite();
    1.58 +	CleanupStack::PushL(server);
    1.59 +
    1.60 +	// Get server name from process so we can use SetCap to change the capabilites and use this server with a different filename
    1.61 +	RProcess handle = RProcess();
    1.62 +	TParsePtrC serverName(handle.FileName());
    1.63 +
    1.64 +	server->ConstructL(serverName.Name());
    1.65 +	CleanupStack::Pop(server);
    1.66 +	return server;
    1.67 +	}
    1.68 +
    1.69 +
    1.70 +/**
    1.71 +MainL - uses the new Rendezvous() call to sync with the client
    1.72 +*/
    1.73 +LOCAL_C void MainL()
    1.74 +	{
    1.75 +	// Active scheduler only for this thread. Test need to create own active scheduler	
    1.76 +	CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
    1.77 +	CActiveScheduler::Install(scheduler);
    1.78 +
    1.79 +	CTe_graphicsperformanceSuite* server = NULL;
    1.80 +
    1.81 +	// Create the CTestServer derived server
    1.82 +	TRAPD(err,server = CTe_graphicsperformanceSuite::NewL());
    1.83 +	if(!err)
    1.84 +		{
    1.85 +		// Sync with the client and enter the active scheduler
    1.86 +		RProcess::Rendezvous(KErrNone);
    1.87 +		scheduler->Start();
    1.88 +		}
    1.89 +	delete server;
    1.90 +	delete scheduler;
    1.91 +	}
    1.92 +
    1.93 +
    1.94 +/**
    1.95 +Secure variant only
    1.96 +Process entry point. Called by client using RProcess API
    1.97 +
    1.98 +@return - Standard Epoc error code on process exit
    1.99 +*/
   1.100 +GLDEF_C TInt E32Main()
   1.101 +	{
   1.102 +	__UHEAP_MARK;
   1.103 +	CTrapCleanup* cleanup = CTrapCleanup::New();
   1.104 +	if(cleanup == NULL)
   1.105 +		{
   1.106 +		return KErrNoMemory;
   1.107 +		}
   1.108 +	TRAPD(err,MainL());
   1.109 +	delete cleanup;
   1.110 +	__UHEAP_MARKEND;
   1.111 +	return err;
   1.112 +    }
   1.113 +
   1.114 +/**
   1.115 +Secure and non-secure variants
   1.116 +Implementation of CTestServer pure virtual
   1.117 +
   1.118 +@return - A CTestStep derived instance
   1.119 +*/
   1.120 +CTestStep* CTe_graphicsperformanceSuite::CreateTestStep(const TDesC& aStepName)
   1.121 +	{
   1.122 +	CTestStep* testStep = NULL;
   1.123 +	if(aStepName == KTBitBltPerfName)
   1.124 +		testStep = new CTBitBltPerf();
   1.125 +	else if(aStepName == KTFbsFontHandlePerfName)
   1.126 +		testStep = new CTFbsFontHandlePerf();
   1.127 +	else if(aStepName == KTFbsBitmapHandlePerfName)
   1.128 +		testStep = new CTFbsBitmapHandlePerf();
   1.129 +	else if(aStepName == KTAlphaDrawing)
   1.130 +		testStep = new CTAlphaDrawing();
   1.131 +	else if(aStepName == KScrollingPerfName)
   1.132 +		testStep = new CScrollingPerf();
   1.133 +	else if(aStepName == KTOptimisedBmpStep)
   1.134 +		testStep = new CTOptimisedBmp();
   1.135 +	else if(aStepName == KTScaledDrawBitmap)
   1.136 +		testStep = new CTScaledDrawBitmap();
   1.137 +	else if (aStepName == KTSolidColourName)
   1.138 +		testStep = new CTSolidColour();
   1.139 +	else if(aStepName == KAlphaBlendTest)
   1.140 +		testStep = new CAlphaBlendTestNormal();
   1.141 +	else if(aStepName == KAlphaBlendTestIType)
   1.142 +		testStep = new CAlphaBlendTestIType();
   1.143 +	else if (aStepName == KTSimpleDrawingPerfName)
   1.144 +		testStep = new CTSimpleDrawing();
   1.145 +	else if (aStepName == KTShadowPerfName)
   1.146 +		testStep = new CTShadowPerf();
   1.147 +	else if (aStepName == KTFadePerfName)
   1.148 +		testStep = new CTFadePerf();
   1.149 +	else if (aStepName == KRedrawingTest)
   1.150 +		testStep = new CRedrawingTest();
   1.151 +	else if (aStepName == KTNonRedrawDrawing)
   1.152 +		testStep = new CTNonRedrawDrawing();
   1.153 + 	else if (aStepName == KTGDIFontRenderingPerfName)
   1.154 +		testStep = new CTGDIFontRenderingPerf();
   1.155 +	else if(aStepName == KTOutlineShadowDrawing)
   1.156 +		testStep = new CTOutlineShadowDrawing();
   1.157 +	else if(aStepName == KTRedrawstorePerf)
   1.158 +		testStep = new CTRedrawstorePerf();	
   1.159 +	else if(aStepName == KTTranslucent)
   1.160 +		testStep = new CTTranslucent();	
   1.161 +	else if (aStepName == KTSpritePerfName)
   1.162 +		testStep = new CTSpritePerf();
   1.163 +	else if(aStepName == KTExtendedBitmap)
   1.164 +		testStep = new CTExtendedBitmap();
   1.165 +	else if(aStepName == KTFbsGlyphData)
   1.166 +		testStep = new CTFbsGlyphData();
   1.167 +	return testStep;
   1.168 +	}