|
64
|
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 |
void SetIsBackgroundAnim(TBool aIsBackgroundAnimationElement)
|
|
|
110 |
{
|
|
|
111 |
iIsBackgroundAnimationElement=aIsBackgroundAnimationElement;
|
|
|
112 |
}
|
|
|
113 |
|
|
|
114 |
TBool IsBackgroundAnimationElement()
|
|
|
115 |
{
|
|
|
116 |
return iIsBackgroundAnimationElement;
|
|
|
117 |
}
|
|
|
118 |
protected:
|
|
|
119 |
void SetEltDestinationRectangle(WFCElement aElement)const;
|
|
|
120 |
void SetEltDestinationRectangle(WFCElement aElement, const TPoint& aOffset)const;
|
|
|
121 |
void SetEltSource(WFCElement aElement)const;
|
|
|
122 |
void SetEltSourceComposed();
|
|
|
123 |
void SetEltSourceRectangle(WFCElement aElement);
|
|
|
124 |
void SetEltSourceFlip(WFCElement aElement)const;
|
|
|
125 |
void SetEltTransparencyTypes(WFCElement aElement)const;
|
|
|
126 |
void FlushAttributeChanges(WFCElement aElement, TInt aUpdateFlags);
|
|
|
127 |
TBool IsNewElementLegal()const;
|
|
|
128 |
|
|
|
129 |
private: //methods
|
|
|
130 |
TBool UnsetSurface(TSurfaceId& aSurface);
|
|
|
131 |
static TInt WfcRotation(MWsElement::TElementRotation aRotation);
|
|
|
132 |
void HelpStreamGetHeader(khronos_int32_t* width, khronos_int32_t* height )const;
|
|
|
133 |
TRect SetSourceDestRect(const TRect& aDestElementRect, const TRect& aDestElementClippedRect,const TRect& aSrcOriginalElementRect,const TBool& aElementFlip,const MWsElement::TElementRotation& aElementRotation) const;
|
|
|
134 |
TInt SurfaceInfo(const TSurfaceId& aSurface, RSurfaceManager::TInfoBuf& aInfo);
|
|
|
135 |
|
|
|
136 |
|
|
|
137 |
private: //data
|
|
|
138 |
TUint iUpdateFlags;
|
|
|
139 |
COpenWfcWrapper& iOpenWfcWrapper;
|
|
|
140 |
TSurfaceId iComposedSurfaceId;
|
|
|
141 |
TSurfaceId iSurfaceId;
|
|
|
142 |
TSize iSurfaceSize;
|
|
|
143 |
TRect iSourcRect;
|
|
|
144 |
TRect iDestinationRect;
|
|
|
145 |
TRect iDestinationClippingRect;
|
|
|
146 |
TInt iGlobalAlpha;
|
|
|
147 |
TBool iFlipped;
|
|
|
148 |
MWsElement::TElementRotation iRotation;
|
|
|
149 |
TUint32 iTargetRendererFlags;
|
|
|
150 |
TUint32 iRenderStageFlags;
|
|
|
151 |
WFCElement iElement;
|
|
|
152 |
CElementWrapper* iElementAbove; //used to maintain the scene list
|
|
|
153 |
CElementWrapper* iElementBelow; //used to maintain the scene list
|
|
|
154 |
CElementWrapper** iCleanupPrevRef; //used to clean up the context on exit
|
|
|
155 |
CElementWrapper* iCleanupNext; //used to clean up the context on exit
|
|
|
156 |
TBool iIsBackgroundAnimationElement;
|
|
|
157 |
};
|
|
|
158 |
|
|
|
159 |
#endif /* ELEMENTWRAPPER_H_ */
|