os/graphics/graphicstest/uibench/src/te_graphicsperformanceSuiteServer.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2005-2010 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 "te_graphicsperformanceSuiteServer.h"
    23 #include "tbitbltperf.h"
    24 #include "tfbsfonthandleperf.h"
    25 #include "tfbsbitmaphandleperf.h"
    26 #include "talphadrawing.h"
    27 #include "tscrollingperf.h"
    28 #include "toptimisedbmp.h"
    29 #include "tscaleddrawbitmap.h"
    30 #include "tsolidcolour.h"
    31 #include "talphablend.h"
    32 #include "tsimpledrawing.h"
    33 #include "tshadowperf.h"
    34 #include "tredrawing.h"
    35 #include "tnonredrawdrawing.h"
    36 #include "tgdifontrenderingperf.h"
    37 #include "toutlineshadowdrawing.h"
    38 #include "tfadeperf.h"
    39 #include "tredrawstoreperf.h"
    40 #include "ttranslucent.h"
    41 #include "tspriteperf.h"
    42 #include "textendedbitmap.h"
    43 #include "tfbsglyphdata.h"
    44 
    45 /**
    46 Same code for Secure and non-secure variants
    47 Called inside the MainL() function to create and start the
    48 CTestServer derived server.
    49 
    50 @return - Instance of the test server
    51 */
    52 CTe_graphicsperformanceSuite* CTe_graphicsperformanceSuite::NewL()
    53 	{
    54 	CTe_graphicsperformanceSuite * server = new (ELeave) CTe_graphicsperformanceSuite();
    55 	CleanupStack::PushL(server);
    56 
    57 	// Get server name from process so we can use SetCap to change the capabilites and use this server with a different filename
    58 	RProcess handle = RProcess();
    59 	TParsePtrC serverName(handle.FileName());
    60 
    61 	server->ConstructL(serverName.Name());
    62 	CleanupStack::Pop(server);
    63 	return server;
    64 	}
    65 
    66 
    67 /**
    68 MainL - uses the new Rendezvous() call to sync with the client
    69 */
    70 LOCAL_C void MainL()
    71 	{
    72 	// Active scheduler only for this thread. Test need to create own active scheduler	
    73 	CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
    74 	CActiveScheduler::Install(scheduler);
    75 
    76 	CTe_graphicsperformanceSuite* server = NULL;
    77 
    78 	// Create the CTestServer derived server
    79 	TRAPD(err,server = CTe_graphicsperformanceSuite::NewL());
    80 	if(!err)
    81 		{
    82 		// Sync with the client and enter the active scheduler
    83 		RProcess::Rendezvous(KErrNone);
    84 		scheduler->Start();
    85 		}
    86 	delete server;
    87 	delete scheduler;
    88 	}
    89 
    90 
    91 /**
    92 Secure variant only
    93 Process entry point. Called by client using RProcess API
    94 
    95 @return - Standard Epoc error code on process exit
    96 */
    97 GLDEF_C TInt E32Main()
    98 	{
    99 	__UHEAP_MARK;
   100 	CTrapCleanup* cleanup = CTrapCleanup::New();
   101 	if(cleanup == NULL)
   102 		{
   103 		return KErrNoMemory;
   104 		}
   105 	TRAPD(err,MainL());
   106 	delete cleanup;
   107 	__UHEAP_MARKEND;
   108 	return err;
   109     }
   110 
   111 /**
   112 Secure and non-secure variants
   113 Implementation of CTestServer pure virtual
   114 
   115 @return - A CTestStep derived instance
   116 */
   117 CTestStep* CTe_graphicsperformanceSuite::CreateTestStep(const TDesC& aStepName)
   118 	{
   119 	CTestStep* testStep = NULL;
   120 	if(aStepName == KTBitBltPerfName)
   121 		testStep = new CTBitBltPerf();
   122 	else if(aStepName == KTFbsFontHandlePerfName)
   123 		testStep = new CTFbsFontHandlePerf();
   124 	else if(aStepName == KTFbsBitmapHandlePerfName)
   125 		testStep = new CTFbsBitmapHandlePerf();
   126 	else if(aStepName == KTAlphaDrawing)
   127 		testStep = new CTAlphaDrawing();
   128 	else if(aStepName == KScrollingPerfName)
   129 		testStep = new CScrollingPerf();
   130 	else if(aStepName == KTOptimisedBmpStep)
   131 		testStep = new CTOptimisedBmp();
   132 	else if(aStepName == KTScaledDrawBitmap)
   133 		testStep = new CTScaledDrawBitmap();
   134 	else if (aStepName == KTSolidColourName)
   135 		testStep = new CTSolidColour();
   136 	else if(aStepName == KAlphaBlendTest)
   137 		testStep = new CAlphaBlendTestNormal();
   138 	else if(aStepName == KAlphaBlendTestIType)
   139 		testStep = new CAlphaBlendTestIType();
   140 	else if (aStepName == KTSimpleDrawingPerfName)
   141 		testStep = new CTSimpleDrawing();
   142 	else if (aStepName == KTShadowPerfName)
   143 		testStep = new CTShadowPerf();
   144 	else if (aStepName == KTFadePerfName)
   145 		testStep = new CTFadePerf();
   146 	else if (aStepName == KRedrawingTest)
   147 		testStep = new CRedrawingTest();
   148 	else if (aStepName == KTNonRedrawDrawing)
   149 		testStep = new CTNonRedrawDrawing();
   150  	else if (aStepName == KTGDIFontRenderingPerfName)
   151 		testStep = new CTGDIFontRenderingPerf();
   152 	else if(aStepName == KTOutlineShadowDrawing)
   153 		testStep = new CTOutlineShadowDrawing();
   154 	else if(aStepName == KTRedrawstorePerf)
   155 		testStep = new CTRedrawstorePerf();	
   156 	else if(aStepName == KTTranslucent)
   157 		testStep = new CTTranslucent();	
   158 	else if (aStepName == KTSpritePerfName)
   159 		testStep = new CTSpritePerf();
   160 	else if(aStepName == KTExtendedBitmap)
   161 		testStep = new CTExtendedBitmap();
   162 	else if(aStepName == KTFbsGlyphData)
   163 		testStep = new CTFbsGlyphData();
   164 	return testStep;
   165 	}