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