First public contribution.
1 // Copyright (c) 2009 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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // A class which wraps OpenWF element related functionality.
18 #ifndef ELEMENTWRAPPER_H_
19 #define ELEMENTWRAPPER_H_
21 #include "openwfcwrapper.h"
22 #include <graphics/wselement.h>
23 #include <graphics/surface.h>
26 #if defined(ENABLE_LI_LOGGING)
27 #define LILOG(X) RDebug::Printf X
32 #define OWF_SURFACE_WIDTH (768) /* needs to be > 640 + 2 to allow S60 nHD config to work */
33 #define OWF_SURFACE_HEIGHT (768) /* needs to be > 640 + 2 to allow S60 nHD config to work */
35 NONSHARABLE_CLASS(CElementWrapper) : public CBase, public MWsElement
39 { //All setters should set EUpdate_PostIllegalUpdate
42 EUpdate_DESTINATION_RECTANGLE = 0x00000001,
43 EUpdate_SOURCE = 0x00000002,
44 EUpdate_SOURCE_RECTANGLE = 0x00000004,
45 EUpdate_SOURCE_FLIP = 0x00000008,
46 EUpdate_SOURCE_ROTATION = 0x00000010,
47 EUpdate_SOURCE_SCALE_FILTER = 0x00000020, //No client-side code yet to drive this
48 EUpdate_TRANSPARENCY_TYPES = 0x00000040,
49 EUpdate_GLOBAL_ALPHA = 0x00000080,
50 EUpdate_MASK = 0x00000100, //No client-side code yet to drive this
51 EUpdate_DESTINATION_CLIP_RECTANGLE = EUpdate_DESTINATION_RECTANGLE|EUpdate_SOURCE_RECTANGLE,
53 EUpdate_SOURCE_GEOMETRY_SET = EUpdate_SOURCE_RECTANGLE|EUpdate_SOURCE_FLIP|EUpdate_SOURCE_ROTATION,
54 EUpdate_ALL_ATTRIBS = 0x000fffff,
55 EUpdate_AttributesIllegal = 0x00100000, //If set then the owf scene will not be updated because it would be illegal.
56 EUpdate_SettingValid = 0x00200000,
58 EUpdate_Insert = 0x01000000,
59 EUpdate_Remove = 0x02000000,
60 EUpdate_Destroy = 0x04000000,
61 EUpdate_SceneCommited = 0x10000000,
64 public: // from MWsElement
65 const TSurfaceId& ConnectedSurface() const;
66 TInt ConnectSurface(const TSurfaceId& aSurface);
68 TInt SetSourceRectangle(const TRect& aSrc);
69 TInt GetSourceRectangle(TRect& aSrc);
71 TInt SetSourceFlipping(const TBool aFlip);
72 TBool SourceFlipping() const;
74 MWsElement* ElementAbove();
75 MWsElement* ElementBelow();
77 TInt SetGlobalAlpha(const TInt aAlpha);
78 void GlobalAlpha(TInt& aAlpha) const;
80 TInt SetSourceRotation(const TElementRotation aElementRotation);
81 MWsElement::TElementRotation SourceRotation() const;
83 TInt SetTargetRendererFlags(const TUint32& aTargetRendererFlags);
84 TInt SetRenderStageFlags(const TUint32& aRenderStageFlags);
85 void GetTargetRendererFlags(TUint32& aTargetRendererFlags) const;
86 void GetRenderStageFlags(TUint32& aRenderStageFlags) const;
88 TInt SetDestinationRectangle(const TRect& aDest);
89 TInt GetDestinationRectangle(TRect& aDest) const;
90 TInt SetDestinationClippingRect(const TRect& aDestClipRect);
91 TInt GetDestinationClippingRect(TRect& aDestClipRect) const;
94 static CElementWrapper* NewL(COpenWfcWrapper& aCOpenWfcWrapper, CElementWrapper*& aCleanupPrevRef);
95 CElementWrapper(COpenWfcWrapper& aOpenWfcWrapper);
97 void ConstructL(CElementWrapper*& aCleanupPrevRef);
98 void RemoveAfter(CElementWrapper** apBelow);
99 void InsertAfter(CElementWrapper*& aRefBelow, CElementWrapper* aBelow, TOwfUpdates aUpdateFlag);
100 CElementWrapper** RefsMyElementBelow();
101 CElementWrapper*& MyElementAbove();
102 COpenWfcWrapper& Owner()const { return iOpenWfcWrapper;}
103 TBool FlushSceneChanges();
104 WFCElement Element(){ return iElement;};
105 TOwfUpdates UpdateFlags()const {return static_cast<TOwfUpdates>(iUpdateFlags);}
106 TInt ReplicateElements(WFCContext aContext, WFCElement& aPreviousTargetElement, const TPoint& aOffset);
109 void SetEltDestinationRectangle(WFCElement aElement)const;
110 void SetEltDestinationRectangle(WFCElement aElement, const TPoint& aOffset)const;
111 void SetEltSource(WFCElement aElement)const;
112 void SetEltSourceComposed();
113 void SetEltSourceRectangle(WFCElement aElement);
114 void SetEltSourceFlip(WFCElement aElement)const;
115 void SetEltTransparencyTypes(WFCElement aElement)const;
116 void FlushAttributeChanges(WFCElement aElement, TInt aUpdateFlags);
117 TBool IsNewElementLegal()const;
120 TBool UnsetSurface(TSurfaceId& aSurface);
121 static TInt WfcRotation(MWsElement::TElementRotation aRotation);
122 void HelpStreamGetHeader(khronos_int32_t* width, khronos_int32_t* height )const;
123 TRect SetSourceDestRect(const TRect& aDestElementRect, const TRect& aDestElementClippedRect,const TRect& aSrcOriginalElementRect,const TBool& aElementFlip,const MWsElement::TElementRotation& aElementRotation) const;
124 TInt SurfaceInfo(const TSurfaceId& aSurface, RSurfaceManager::TInfoBuf& aInfo);
129 COpenWfcWrapper& iOpenWfcWrapper;
130 TSurfaceId iComposedSurfaceId;
131 TSurfaceId iSurfaceId;
134 TRect iDestinationRect;
135 TRect iDestinationClippingRect;
138 MWsElement::TElementRotation iRotation;
139 TUint32 iTargetRendererFlags;
140 TUint32 iRenderStageFlags;
142 CElementWrapper* iElementAbove; //used to maintain the scene list
143 CElementWrapper* iElementBelow; //used to maintain the scene list
144 CElementWrapper** iCleanupPrevRef; //used to clean up the context on exit
145 CElementWrapper* iCleanupNext; //used to clean up the context on exit
148 #endif /* ELEMENTWRAPPER_H_ */