graphicsapitest/graphicssvs/fbserv/inc/T_DataFbsBitmap.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) 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:
*
*/

/**
@test
@internalComponent

This contains CT_DataFbsBitmap
*/

#if (!defined __T_DATA_FBS_BITMAP_H__)
#define __T_DATA_FBS_BITMAP_H__

//	User Includes
#include "DataWrapperBase.h"

//	EPOC includes
#include <e32std.h>
#include <fbs.h>
#include <s32file.h>
#include <bitdev.h>

class CT_DataFbsBitmap : public CDataWrapperBase
	{
public:
	static CT_DataFbsBitmap*	NewL();
	~CT_DataFbsBitmap();

	virtual TBool	DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);

	virtual TAny*	GetObject();
    virtual void    SetObjectL(TAny* aAny);
	virtual void	DisownObjectL();

protected:
	CT_DataFbsBitmap();
	void	ConstructL();

	virtual CFbsBitmap*		GetFbsBitmap() const;

	void	RunL(CActive* aActive, TInt aIndex);
	void	DoCancel(CActive* aActive, TInt aIndex);

private:
	void	DestroyData();
	void	DoCmdNewL();
	void	DoCmdDestructor();
	void	DoCmdCompress(const TDesC& aSection);
	void	DoCmdCompressInBackground(const TDesC& aSection, const TInt aAsyncErrorIndex);
	void	DoCmdCreate(const TDesC& aSection);
	void	DoCmdCreateHardwareBitmap(const TDesC& aSection);
	void	DoCmdDataAddress(const TDesC& aSection);
	void	DoCmdDataStride(const TDesC& aSection);
	void	DoCmdDisplayMode(const TDesC& aSection);
	void	DoCmdDuplicateL(const TDesC& aSection);
	void	DoCmdExternalizeL(const TDesC& aSection);
	void	DoCmdExternalizeRectangleL(const TDesC& aSection);
	void	DoCmdGetPaletteL(const TDesC& aSection);
	void	DoCmdGetPixel(const TDesC& aSection);
	void	DoCmdGetScanLineL(const TDesC& aSection);
	void	DoCmdGetVerticalScanLineL(const TDesC& aSection);
	void	DoCmdHandle(const TDesC& aSection);
	void	DoCmdHardwareBitmapHandle(const TDesC& aSection);
	void	DoCmdHeader();
	void	DoCmdHorizontalPixelsToTwips(const TDesC& aSection);
	void	DoCmdHorizontalTwipsToPixels(const TDesC& aSection);
	void	DoCmdInitialDisplayMode(const TDesC& aSection);
	void	DoCmdInternalizeL(const TDesC& aSection);
	void	DoCmdIsCompressedInRAM(const TDesC& aSection);
	void	DoCmdIsFileInRom(const TDesC& aSection);
	void	DoCmdIsLargeBitmap(const TDesC& aSection);
	void	DoCmdIsMonochrome(const TDesC& aSection);
	void	DoCmdIsRomBitmap(const TDesC& aSection);
	void	DoCmdLoadL(const TDesC& aSection);
	void	DoCmdLoadAndCompressL(const TDesC& aSection);
	void	DoCmdLockHeap(const TDesC& aSection);
	void	DoCmdLockHeapLC(const TDesC& aSection);
	void	DoCmdPaletteAttributes(const TDesC& aSection);
	void	DoCmdReset();
	void	DoCmdResize(const TDesC& aSection);
	void	DoCmdSave(const TDesC& aSection);
	void	DoCmdScanLineLength(const TDesC& aSection);
	void	DoCmdSetDisplayMode(const TDesC& aSection);
	void	DoCmdSetPaletteL(const TDesC& aSection);
	void	DoCmdSetRomBitmapL(const TDesC& aSection);
	void	DoCmdSetScanLineL(const TDesC& aSection);
	void	DoCmdSetSizeInTwipsL(const TDesC& aSection);
	void	DoCmdSizeInPixels(const TDesC& aSection);
	void	DoCmdSizeInTwips(const TDesC& aSection);
	void	DoCmdStoreL(const TDesC& aSection);
	void	DoCmdSwapWidthAndHeight();
	void	DoCmdUnlockHeapL(const TDesC& aSection);
	void	DoCmdVerticalPixelsToTwips(const TDesC& aSection);
	void	DoCmdVerticalTwipsToPixels(const TDesC& aSection);

	//	MTPActiveCallback implementation
	void	RunCompressInBackground(const TInt aIndex);
	void	DoCancelCompressInBackground(const TInt aIndex);

	//	Helpers
	void				ExternalizeImplL(const TDesC& aSection, const TRect& aRect, TBool aUseRect);
	void				LoadOrLoadAndCompressL(const TDesC& aSection, TBool aCompress);
	inline TDisplayMode	GetDisplayMode() const;

private:
	/** CFbsBitmap class instance that is tested */
	CFbsBitmap*			iFbsBitmap;
	TDisplayMode		iDisplayMode;

	/** Pop when unlocking */
	TBool				iPopWhenUnlocking;
	
	TBool				iCompressFailed;

	/** Active object for CompressInBackground async operation */
	CActiveCallback*	iActiveCompressInBackground;
	};

#include "T_DataFbsBitmap.inl"

#endif /* __T_DATA_FBS_BITMAP_H__ */