sl@0: // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // A class which wraps OpenWF element related functionality. sl@0: sl@0: // sl@0: sl@0: #ifndef ELEMENTWRAPPER_H_ sl@0: #define ELEMENTWRAPPER_H_ sl@0: sl@0: #include "openwfcwrapper.h" sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #if defined(ENABLE_LI_LOGGING) sl@0: #define LILOG(X) RDebug::Printf X sl@0: #else sl@0: #define LILOG(X) sl@0: #endif sl@0: sl@0: #define OWF_SURFACE_WIDTH (768) /* needs to be > 640 + 2 to allow S60 nHD config to work */ sl@0: #define OWF_SURFACE_HEIGHT (768) /* needs to be > 640 + 2 to allow S60 nHD config to work */ sl@0: sl@0: NONSHARABLE_CLASS(CElementWrapper) : public CBase, public MWsElement sl@0: { sl@0: public: sl@0: enum TOwfUpdates sl@0: { //All setters should set EUpdate_PostIllegalUpdate sl@0: EUpdate_None = 0, sl@0: sl@0: EUpdate_DESTINATION_RECTANGLE = 0x00000001, sl@0: EUpdate_SOURCE = 0x00000002, sl@0: EUpdate_SOURCE_RECTANGLE = 0x00000004, sl@0: EUpdate_SOURCE_FLIP = 0x00000008, sl@0: EUpdate_SOURCE_ROTATION = 0x00000010, sl@0: EUpdate_SOURCE_SCALE_FILTER = 0x00000020, //No client-side code yet to drive this sl@0: EUpdate_TRANSPARENCY_TYPES = 0x00000040, sl@0: EUpdate_GLOBAL_ALPHA = 0x00000080, sl@0: EUpdate_MASK = 0x00000100, //No client-side code yet to drive this sl@0: EUpdate_DESTINATION_CLIP_RECTANGLE = EUpdate_DESTINATION_RECTANGLE|EUpdate_SOURCE_RECTANGLE, sl@0: sl@0: EUpdate_SOURCE_GEOMETRY_SET = EUpdate_SOURCE_RECTANGLE|EUpdate_SOURCE_FLIP|EUpdate_SOURCE_ROTATION, sl@0: EUpdate_ALL_ATTRIBS = 0x000fffff, sl@0: EUpdate_AttributesIllegal = 0x00100000, //If set then the owf scene will not be updated because it would be illegal. sl@0: EUpdate_SettingValid = 0x00200000, sl@0: sl@0: EUpdate_Insert = 0x01000000, sl@0: EUpdate_Remove = 0x02000000, sl@0: EUpdate_Destroy = 0x04000000, sl@0: EUpdate_SceneCommited = 0x10000000, sl@0: }; sl@0: sl@0: public: // from MWsElement sl@0: const TSurfaceId& ConnectedSurface() const; sl@0: TInt ConnectSurface(const TSurfaceId& aSurface); sl@0: sl@0: TInt SetSourceRectangle(const TRect& aSrc); sl@0: TInt GetSourceRectangle(TRect& aSrc); sl@0: sl@0: TInt SetSourceFlipping(const TBool aFlip); sl@0: TBool SourceFlipping() const; sl@0: sl@0: MWsElement* ElementAbove(); sl@0: MWsElement* ElementBelow(); sl@0: sl@0: TInt SetGlobalAlpha(const TInt aAlpha); sl@0: void GlobalAlpha(TInt& aAlpha) const; sl@0: sl@0: TInt SetSourceRotation(const TElementRotation aElementRotation); sl@0: MWsElement::TElementRotation SourceRotation() const; sl@0: sl@0: TInt SetTargetRendererFlags(const TUint32& aTargetRendererFlags); sl@0: TInt SetRenderStageFlags(const TUint32& aRenderStageFlags); sl@0: void GetTargetRendererFlags(TUint32& aTargetRendererFlags) const; sl@0: void GetRenderStageFlags(TUint32& aRenderStageFlags) const; sl@0: sl@0: TInt SetDestinationRectangle(const TRect& aDest); sl@0: TInt GetDestinationRectangle(TRect& aDest) const; sl@0: TInt SetDestinationClippingRect(const TRect& aDestClipRect); sl@0: TInt GetDestinationClippingRect(TRect& aDestClipRect) const; sl@0: sl@0: public: sl@0: static CElementWrapper* NewL(COpenWfcWrapper& aCOpenWfcWrapper, CElementWrapper*& aCleanupPrevRef); sl@0: CElementWrapper(COpenWfcWrapper& aOpenWfcWrapper); sl@0: ~CElementWrapper(); sl@0: void ConstructL(CElementWrapper*& aCleanupPrevRef); sl@0: void RemoveAfter(CElementWrapper** apBelow); sl@0: void InsertAfter(CElementWrapper*& aRefBelow, CElementWrapper* aBelow, TOwfUpdates aUpdateFlag); sl@0: CElementWrapper** RefsMyElementBelow(); sl@0: CElementWrapper*& MyElementAbove(); sl@0: COpenWfcWrapper& Owner()const { return iOpenWfcWrapper;} sl@0: TBool FlushSceneChanges(); sl@0: WFCElement Element(){ return iElement;}; sl@0: TOwfUpdates UpdateFlags()const {return static_cast(iUpdateFlags);} sl@0: TInt ReplicateElements(WFCContext aContext, WFCElement& aPreviousTargetElement, const TPoint& aOffset); sl@0: sl@0: protected: sl@0: void SetEltDestinationRectangle(WFCElement aElement)const; sl@0: void SetEltDestinationRectangle(WFCElement aElement, const TPoint& aOffset)const; sl@0: void SetEltSource(WFCElement aElement)const; sl@0: void SetEltSourceComposed(); sl@0: void SetEltSourceRectangle(WFCElement aElement); sl@0: void SetEltSourceFlip(WFCElement aElement)const; sl@0: void SetEltTransparencyTypes(WFCElement aElement)const; sl@0: void FlushAttributeChanges(WFCElement aElement, TInt aUpdateFlags); sl@0: TBool IsNewElementLegal()const; sl@0: sl@0: private: //methods sl@0: TBool UnsetSurface(TSurfaceId& aSurface); sl@0: static TInt WfcRotation(MWsElement::TElementRotation aRotation); sl@0: void HelpStreamGetHeader(khronos_int32_t* width, khronos_int32_t* height )const; sl@0: TRect SetSourceDestRect(const TRect& aDestElementRect, const TRect& aDestElementClippedRect,const TRect& aSrcOriginalElementRect,const TBool& aElementFlip,const MWsElement::TElementRotation& aElementRotation) const; sl@0: TInt SurfaceInfo(const TSurfaceId& aSurface, RSurfaceManager::TInfoBuf& aInfo); sl@0: sl@0: sl@0: private: //data sl@0: TUint iUpdateFlags; sl@0: COpenWfcWrapper& iOpenWfcWrapper; sl@0: TSurfaceId iComposedSurfaceId; sl@0: TSurfaceId iSurfaceId; sl@0: TSize iSurfaceSize; sl@0: TRect iSourcRect; sl@0: TRect iDestinationRect; sl@0: TRect iDestinationClippingRect; sl@0: TInt iGlobalAlpha; sl@0: TBool iFlipped; sl@0: MWsElement::TElementRotation iRotation; sl@0: TUint32 iTargetRendererFlags; sl@0: TUint32 iRenderStageFlags; sl@0: WFCElement iElement; sl@0: CElementWrapper* iElementAbove; //used to maintain the scene list sl@0: CElementWrapper* iElementBelow; //used to maintain the scene list sl@0: CElementWrapper** iCleanupPrevRef; //used to clean up the context on exit sl@0: CElementWrapper* iCleanupNext; //used to clean up the context on exit sl@0: }; sl@0: sl@0: #endif /* ELEMENTWRAPPER_H_ */