|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // A class which wraps OpenWF element related functionality. |
|
15 |
|
16 // |
|
17 |
|
18 #ifndef ELEMENTWRAPPER_H_ |
|
19 #define ELEMENTWRAPPER_H_ |
|
20 |
|
21 #include "openwfcwrapper.h" |
|
22 #include <graphics/wselement.h> |
|
23 #include <graphics/surface.h> |
|
24 #include <WF/wfc.h> |
|
25 |
|
26 #if defined(ENABLE_LI_LOGGING) |
|
27 #define LILOG(X) RDebug::Printf X |
|
28 #else |
|
29 #define LILOG(X) |
|
30 #endif |
|
31 |
|
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 */ |
|
34 |
|
35 NONSHARABLE_CLASS(CElementWrapper) : public CBase, public MWsElement |
|
36 { |
|
37 public: |
|
38 enum TOwfUpdates |
|
39 { //All setters should set EUpdate_PostIllegalUpdate |
|
40 EUpdate_None = 0, |
|
41 |
|
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, |
|
52 |
|
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, |
|
57 EUpdate_DontLockSource = 0x00400000, |
|
58 |
|
59 EUpdate_Insert = 0x01000000, |
|
60 EUpdate_Remove = 0x02000000, |
|
61 EUpdate_Destroy = 0x04000000, |
|
62 EUpdate_SceneCommited = 0x10000000, |
|
63 }; |
|
64 |
|
65 public: // from MWsElement |
|
66 const TSurfaceId& ConnectedSurface() const; |
|
67 TInt ConnectSurface(const TSurfaceId& aSurface); |
|
68 |
|
69 TInt SetSourceRectangle(const TRect& aSrc); |
|
70 TInt GetSourceRectangle(TRect& aSrc); |
|
71 |
|
72 TInt SetSourceFlipping(const TBool aFlip); |
|
73 TBool SourceFlipping() const; |
|
74 |
|
75 MWsElement* ElementAbove(); |
|
76 MWsElement* ElementBelow(); |
|
77 |
|
78 TInt SetGlobalAlpha(const TInt aAlpha); |
|
79 void GlobalAlpha(TInt& aAlpha) const; |
|
80 |
|
81 TInt SetSourceRotation(const TElementRotation aElementRotation); |
|
82 MWsElement::TElementRotation SourceRotation() const; |
|
83 |
|
84 TInt SetTargetRendererFlags(const TUint32& aTargetRendererFlags); |
|
85 TInt SetRenderStageFlags(const TUint32& aRenderStageFlags); |
|
86 void GetTargetRendererFlags(TUint32& aTargetRendererFlags) const; |
|
87 void GetRenderStageFlags(TUint32& aRenderStageFlags) const; |
|
88 |
|
89 TInt SetDestinationRectangle(const TRect& aDest); |
|
90 TInt GetDestinationRectangle(TRect& aDest) const; |
|
91 TInt SetDestinationClippingRect(const TRect& aDestClipRect); |
|
92 TInt GetDestinationClippingRect(TRect& aDestClipRect) const; |
|
93 |
|
94 public: |
|
95 static CElementWrapper* NewL(COpenWfcWrapper& aCOpenWfcWrapper, CElementWrapper*& aCleanupPrevRef); |
|
96 CElementWrapper(COpenWfcWrapper& aOpenWfcWrapper); |
|
97 ~CElementWrapper(); |
|
98 void ConstructL(CElementWrapper*& aCleanupPrevRef); |
|
99 void RemoveAfter(CElementWrapper** apBelow); |
|
100 void InsertAfter(CElementWrapper*& aRefBelow, CElementWrapper* aBelow, TOwfUpdates aUpdateFlag); |
|
101 CElementWrapper** RefsMyElementBelow(); |
|
102 CElementWrapper*& MyElementAbove(); |
|
103 COpenWfcWrapper& Owner()const { return iOpenWfcWrapper;} |
|
104 TBool FlushSceneChanges(); |
|
105 WFCElement Element(){ return iElement;}; |
|
106 TOwfUpdates UpdateFlags()const {return static_cast<TOwfUpdates>(iUpdateFlags);} |
|
107 TInt ReplicateElements(WFCContext aContext, WFCElement& aPreviousTargetElement, const TPoint& aOffset); |
|
108 |
|
109 protected: |
|
110 void SetEltDestinationRectangle(WFCElement aElement)const; |
|
111 void SetEltDestinationRectangle(WFCElement aElement, const TPoint& aOffset)const; |
|
112 void SetEltSource(WFCElement aElement)const; |
|
113 void SetEltSourceComposed(); |
|
114 void SetEltSourceRectangle(WFCElement aElement); |
|
115 void SetEltSourceFlip(WFCElement aElement)const; |
|
116 void SetEltTransparencyTypes(WFCElement aElement)const; |
|
117 void FlushAttributeChanges(WFCElement aElement, TInt aUpdateFlags); |
|
118 TBool IsNewElementLegal()const; |
|
119 |
|
120 private: //methods |
|
121 TBool UnsetSurface(TSurfaceId& aSurface); |
|
122 static TInt WfcRotation(MWsElement::TElementRotation aRotation); |
|
123 void HelpStreamGetHeader(khronos_int32_t* width, khronos_int32_t* height )const; |
|
124 TRect SetSourceDestRect(const TRect& aDestElementRect, const TRect& aDestElementClippedRect,const TRect& aSrcOriginalElementRect,const TBool& aElementFlip,const MWsElement::TElementRotation& aElementRotation) const; |
|
125 TInt SurfaceInfo(const TSurfaceId& aSurface, RSurfaceManager::TInfoBuf& aInfo); |
|
126 |
|
127 |
|
128 private: //data |
|
129 TUint iUpdateFlags; |
|
130 COpenWfcWrapper& iOpenWfcWrapper; |
|
131 TSurfaceId iComposedSurfaceId; |
|
132 TSurfaceId iSurfaceId; |
|
133 TSize iSurfaceSize; |
|
134 TRect iSourcRect; |
|
135 TRect iDestinationRect; |
|
136 TRect iDestinationClippingRect; |
|
137 TInt iGlobalAlpha; |
|
138 TBool iFlipped; |
|
139 MWsElement::TElementRotation iRotation; |
|
140 TUint32 iTargetRendererFlags; |
|
141 TUint32 iRenderStageFlags; |
|
142 WFCElement iElement; |
|
143 CElementWrapper* iElementAbove; //used to maintain the scene list |
|
144 CElementWrapper* iElementBelow; //used to maintain the scene list |
|
145 CElementWrapper** iCleanupPrevRef; //used to clean up the context on exit |
|
146 CElementWrapper* iCleanupNext; //used to clean up the context on exit |
|
147 }; |
|
148 |
|
149 #endif /* ELEMENTWRAPPER_H_ */ |