graphicsdeviceinterface/screendriver/tsrc/tscdvdevorientation.h
author Faisal Memon <faisal.memon@nokia.com>
Fri, 14 May 2010 15:41:33 +0100
branchNewGraphicsArchitecture
changeset 64 5c983aa672ea
parent 0 5d03bc08d59c
permissions -rw-r--r--
Merge 1. Pull in cpp files in the performance enhanced Khronos RI OVG files which are newly added. I've ignored platform-specific cpp files for linux, macosx, and null operating systems because this local solution has its own platform glue (i.e. facility to target Bitmaps but no full windowing support). I've ignored sfEGLInterface.cpp because this is used as a bridge to go from EGL to Nokia's Platsim which offers an EGL service. That's not relevant to this implementation because this is ARM side code, not Intel side. I just left a comment to sfEGLInterface.cpp in case we need to pick up this later on. The current code compiles on winscw. Prior to this fix, the code works on winscw, and can launch the SVG tiger (tiger.exe). That takes about 20 seconds to render. I hope to always be able to show this icon on each commit, and the plan is for the render time to reduce with this series of submissions. On this commit, the tiger renders ok in 20 seconds.

// Copyright (c) 2004-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:
//

#if !defined(__TSCDVDEVORIENTATION_H__)
#define __TSCDVDEVORIENTATION_H__

#include "TGraphicsHarness.h"
#include <graphics/surface.h>
#include <pixelformats.h>
#include <bitdrawsurface.h>


LOCAL_D const TUint KPanicThreadHeapSize=0x4000;
_LIT(KSCDVPanicCategory,"SCDV");

//
// Panic testing //
//
typedef TInt (*TPanicFunction)(TDeviceOrientation aOrientation, TDisplayMode aDisplayMode,TInt aScreenNo);

struct SPanicParams
	{
	TPanicFunction functionName;
	TDeviceOrientation* pointerDeviceOrientation;
	TDisplayMode* pointerDisplayMode;
	TInt* pointerScreenNo;
	};

enum TPanicExitReasons
	{
	EWsExitReasonBad=0x12345678,
	EWsExitReasonFinished
	};

enum TAutoPanics
	{
	EAutoPanicTestFailed=0xBAADF00D,
	EAutoPanicPanicFailed=0xF00DBAAD
	};
	
class CPanicTest : public CBase
	{
public:
	CPanicTest();
	~CPanicTest();
	TInt LaunchPanicThread(RThread &aThread, SPanicParams *aPtr);
	TInt TestInvalidModePanicL(TPanicFunction aFunction, TScreenDriverPanic aExitReason,TDisplayMode* aPtr2, TDeviceOrientation* aPtr, TInt* aPtrScreenNo, TBool* aTestFinished = NULL);

	TInt TestPanicL(SPanicParams *aPtr, TInt aExitReason, const TDesC &aCategory, TBool* aTestFinished=NULL);
	TInt TestPanicL(TPanicFunction aFunction, TInt aExitReason, const TDesC &aCategory, TDisplayMode* aPtr2,TDeviceOrientation* aPtr, TInt* aPtrScreenNo, TBool* aTestFinished=NULL);
	TInt iActualPanicCode;
	TInt iThreadNumber;
	};



class CTDevOrientation: public CTGraphicsBase
	{
public:

	CTDevOrientation(CTestStep *aTest, RArray<TInt> aArrayDispModes);
	CTDevOrientation(CTestStep *aTest);
	~CTDevOrientation();
	void RunTestCaseL(TInt aCurTestCase);
	
	TBool GetSurfaceIdInterfaceL(const TInt& aScreenNo,const TDisplayMode& aDisplayMode, CFbsDrawDevice*& aDrawScreenDevice, MSurfaceId*& aSurfaceIdInterface );

	TBool ChooseOrientationMode( MSurfaceId* aSurfaceIdInterface);
	
    void TestValidButUnavailableOrientationL(MSurfaceId* aSurfaceIdInterface,TDisplayMode aDisplayMode);
	void TestSetDeviceOrientationWithInvalidModeL(TDisplayMode aDisplayMode);
	void TestGetSurfaceWithValidDispModeL( const MSurfaceId* aSurfaceIdInterface, const TDisplayMode& aDisplayMode, TInt aScreenNo);
	void TestGetDeviceOrientation(MSurfaceId* aSurfaceIdInterface);
	void TestDeviceOrientationSettingandGetting( MSurfaceId* aSurfaceIdInterface);
	void TestHorizontalVerticalTwips(const CFbsDrawDevice* aDrawScreenDevice,  MSurfaceId* aSurfaceIdInterface, TDisplayMode aDisplayMode, TInt aScreenNo);
	void TestSetDeviceOrientationWithValidMode(const CFbsDrawDevice* aDrawScreenDevice,  MSurfaceId* aSurfaceIdInterface, TDisplayMode aDisplayMode, TInt aScreenNo);
    void TestSetDisplayMode(CFbsDrawDevice* aDrawScreenDevice,MSurfaceId* aSurfaceIdInterface);


private:
	void ConstructL();
	TBool ReqBppAndPixelFormat(TDisplayMode aDisplayMode, TInt& aBpp, TUint32& aPixelFormat);

private:	
	TSize iPhysSize;
    RArray<TDeviceOrientation> iArrayOrientation;
	// handle to initiate the panic tests
	CPanicTest *iPanicTest;
	RArray<TInt> iArrayDispModesPerScreen;
	TInt iCurrScreen;
	};

  
class CTDevOrientationStep : public CTGraphicsStep
	{
public:
	CTDevOrientationStep();
protected:	
	//from CTGraphicsStep
	virtual CTGraphicsBase* CreateTestL();
	virtual void TestSetupL();
	};

_LIT(KTDevOrientationStep,"TDevOrientation");


#endif