sl@0
|
1 |
// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// A class which wraps OpenWF element related functionality.
|
sl@0
|
15 |
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#ifndef ELEMENTWRAPPER_H_
|
sl@0
|
19 |
#define ELEMENTWRAPPER_H_
|
sl@0
|
20 |
|
sl@0
|
21 |
#include "openwfcwrapper.h"
|
sl@0
|
22 |
#include <graphics/wselement.h>
|
sl@0
|
23 |
#include <graphics/surface.h>
|
sl@0
|
24 |
#include <WF/wfc.h>
|
sl@0
|
25 |
|
sl@0
|
26 |
#if defined(ENABLE_LI_LOGGING)
|
sl@0
|
27 |
#define LILOG(X) RDebug::Printf X
|
sl@0
|
28 |
#else
|
sl@0
|
29 |
#define LILOG(X)
|
sl@0
|
30 |
#endif
|
sl@0
|
31 |
|
sl@0
|
32 |
#define OWF_SURFACE_WIDTH (768) /* needs to be > 640 + 2 to allow S60 nHD config to work */
|
sl@0
|
33 |
#define OWF_SURFACE_HEIGHT (768) /* needs to be > 640 + 2 to allow S60 nHD config to work */
|
sl@0
|
34 |
|
sl@0
|
35 |
NONSHARABLE_CLASS(CElementWrapper) : public CBase, public MWsElement
|
sl@0
|
36 |
{
|
sl@0
|
37 |
public:
|
sl@0
|
38 |
enum TOwfUpdates
|
sl@0
|
39 |
{ //All setters should set EUpdate_PostIllegalUpdate
|
sl@0
|
40 |
EUpdate_None = 0,
|
sl@0
|
41 |
|
sl@0
|
42 |
EUpdate_DESTINATION_RECTANGLE = 0x00000001,
|
sl@0
|
43 |
EUpdate_SOURCE = 0x00000002,
|
sl@0
|
44 |
EUpdate_SOURCE_RECTANGLE = 0x00000004,
|
sl@0
|
45 |
EUpdate_SOURCE_FLIP = 0x00000008,
|
sl@0
|
46 |
EUpdate_SOURCE_ROTATION = 0x00000010,
|
sl@0
|
47 |
EUpdate_SOURCE_SCALE_FILTER = 0x00000020, //No client-side code yet to drive this
|
sl@0
|
48 |
EUpdate_TRANSPARENCY_TYPES = 0x00000040,
|
sl@0
|
49 |
EUpdate_GLOBAL_ALPHA = 0x00000080,
|
sl@0
|
50 |
EUpdate_MASK = 0x00000100, //No client-side code yet to drive this
|
sl@0
|
51 |
EUpdate_DESTINATION_CLIP_RECTANGLE = EUpdate_DESTINATION_RECTANGLE|EUpdate_SOURCE_RECTANGLE,
|
sl@0
|
52 |
|
sl@0
|
53 |
EUpdate_SOURCE_GEOMETRY_SET = EUpdate_SOURCE_RECTANGLE|EUpdate_SOURCE_FLIP|EUpdate_SOURCE_ROTATION,
|
sl@0
|
54 |
EUpdate_ALL_ATTRIBS = 0x000fffff,
|
sl@0
|
55 |
EUpdate_AttributesIllegal = 0x00100000, //If set then the owf scene will not be updated because it would be illegal.
|
sl@0
|
56 |
EUpdate_SettingValid = 0x00200000,
|
sl@0
|
57 |
|
sl@0
|
58 |
EUpdate_Insert = 0x01000000,
|
sl@0
|
59 |
EUpdate_Remove = 0x02000000,
|
sl@0
|
60 |
EUpdate_Destroy = 0x04000000,
|
sl@0
|
61 |
EUpdate_SceneCommited = 0x10000000,
|
sl@0
|
62 |
};
|
sl@0
|
63 |
|
sl@0
|
64 |
public: // from MWsElement
|
sl@0
|
65 |
const TSurfaceId& ConnectedSurface() const;
|
sl@0
|
66 |
TInt ConnectSurface(const TSurfaceId& aSurface);
|
sl@0
|
67 |
|
sl@0
|
68 |
TInt SetSourceRectangle(const TRect& aSrc);
|
sl@0
|
69 |
TInt GetSourceRectangle(TRect& aSrc);
|
sl@0
|
70 |
|
sl@0
|
71 |
TInt SetSourceFlipping(const TBool aFlip);
|
sl@0
|
72 |
TBool SourceFlipping() const;
|
sl@0
|
73 |
|
sl@0
|
74 |
MWsElement* ElementAbove();
|
sl@0
|
75 |
MWsElement* ElementBelow();
|
sl@0
|
76 |
|
sl@0
|
77 |
TInt SetGlobalAlpha(const TInt aAlpha);
|
sl@0
|
78 |
void GlobalAlpha(TInt& aAlpha) const;
|
sl@0
|
79 |
|
sl@0
|
80 |
TInt SetSourceRotation(const TElementRotation aElementRotation);
|
sl@0
|
81 |
MWsElement::TElementRotation SourceRotation() const;
|
sl@0
|
82 |
|
sl@0
|
83 |
TInt SetTargetRendererFlags(const TUint32& aTargetRendererFlags);
|
sl@0
|
84 |
TInt SetRenderStageFlags(const TUint32& aRenderStageFlags);
|
sl@0
|
85 |
void GetTargetRendererFlags(TUint32& aTargetRendererFlags) const;
|
sl@0
|
86 |
void GetRenderStageFlags(TUint32& aRenderStageFlags) const;
|
sl@0
|
87 |
|
sl@0
|
88 |
TInt SetDestinationRectangle(const TRect& aDest);
|
sl@0
|
89 |
TInt GetDestinationRectangle(TRect& aDest) const;
|
sl@0
|
90 |
TInt SetDestinationClippingRect(const TRect& aDestClipRect);
|
sl@0
|
91 |
TInt GetDestinationClippingRect(TRect& aDestClipRect) const;
|
sl@0
|
92 |
|
sl@0
|
93 |
public:
|
sl@0
|
94 |
static CElementWrapper* NewL(COpenWfcWrapper& aCOpenWfcWrapper, CElementWrapper*& aCleanupPrevRef);
|
sl@0
|
95 |
CElementWrapper(COpenWfcWrapper& aOpenWfcWrapper);
|
sl@0
|
96 |
~CElementWrapper();
|
sl@0
|
97 |
void ConstructL(CElementWrapper*& aCleanupPrevRef);
|
sl@0
|
98 |
void RemoveAfter(CElementWrapper** apBelow);
|
sl@0
|
99 |
void InsertAfter(CElementWrapper*& aRefBelow, CElementWrapper* aBelow, TOwfUpdates aUpdateFlag);
|
sl@0
|
100 |
CElementWrapper** RefsMyElementBelow();
|
sl@0
|
101 |
CElementWrapper*& MyElementAbove();
|
sl@0
|
102 |
COpenWfcWrapper& Owner()const { return iOpenWfcWrapper;}
|
sl@0
|
103 |
TBool FlushSceneChanges();
|
sl@0
|
104 |
WFCElement Element(){ return iElement;};
|
sl@0
|
105 |
TOwfUpdates UpdateFlags()const {return static_cast<TOwfUpdates>(iUpdateFlags);}
|
sl@0
|
106 |
TInt ReplicateElements(WFCContext aContext, WFCElement& aPreviousTargetElement, const TPoint& aOffset);
|
sl@0
|
107 |
|
sl@0
|
108 |
protected:
|
sl@0
|
109 |
void SetEltDestinationRectangle(WFCElement aElement)const;
|
sl@0
|
110 |
void SetEltDestinationRectangle(WFCElement aElement, const TPoint& aOffset)const;
|
sl@0
|
111 |
void SetEltSource(WFCElement aElement)const;
|
sl@0
|
112 |
void SetEltSourceComposed();
|
sl@0
|
113 |
void SetEltSourceRectangle(WFCElement aElement);
|
sl@0
|
114 |
void SetEltSourceFlip(WFCElement aElement)const;
|
sl@0
|
115 |
void SetEltTransparencyTypes(WFCElement aElement)const;
|
sl@0
|
116 |
void FlushAttributeChanges(WFCElement aElement, TInt aUpdateFlags);
|
sl@0
|
117 |
TBool IsNewElementLegal()const;
|
sl@0
|
118 |
|
sl@0
|
119 |
private: //methods
|
sl@0
|
120 |
TBool UnsetSurface(TSurfaceId& aSurface);
|
sl@0
|
121 |
static TInt WfcRotation(MWsElement::TElementRotation aRotation);
|
sl@0
|
122 |
void HelpStreamGetHeader(khronos_int32_t* width, khronos_int32_t* height )const;
|
sl@0
|
123 |
TRect SetSourceDestRect(const TRect& aDestElementRect, const TRect& aDestElementClippedRect,const TRect& aSrcOriginalElementRect,const TBool& aElementFlip,const MWsElement::TElementRotation& aElementRotation) const;
|
sl@0
|
124 |
TInt SurfaceInfo(const TSurfaceId& aSurface, RSurfaceManager::TInfoBuf& aInfo);
|
sl@0
|
125 |
|
sl@0
|
126 |
|
sl@0
|
127 |
private: //data
|
sl@0
|
128 |
TUint iUpdateFlags;
|
sl@0
|
129 |
COpenWfcWrapper& iOpenWfcWrapper;
|
sl@0
|
130 |
TSurfaceId iComposedSurfaceId;
|
sl@0
|
131 |
TSurfaceId iSurfaceId;
|
sl@0
|
132 |
TSize iSurfaceSize;
|
sl@0
|
133 |
TRect iSourcRect;
|
sl@0
|
134 |
TRect iDestinationRect;
|
sl@0
|
135 |
TRect iDestinationClippingRect;
|
sl@0
|
136 |
TInt iGlobalAlpha;
|
sl@0
|
137 |
TBool iFlipped;
|
sl@0
|
138 |
MWsElement::TElementRotation iRotation;
|
sl@0
|
139 |
TUint32 iTargetRendererFlags;
|
sl@0
|
140 |
TUint32 iRenderStageFlags;
|
sl@0
|
141 |
WFCElement iElement;
|
sl@0
|
142 |
CElementWrapper* iElementAbove; //used to maintain the scene list
|
sl@0
|
143 |
CElementWrapper* iElementBelow; //used to maintain the scene list
|
sl@0
|
144 |
CElementWrapper** iCleanupPrevRef; //used to clean up the context on exit
|
sl@0
|
145 |
CElementWrapper* iCleanupNext; //used to clean up the context on exit
|
sl@0
|
146 |
};
|
sl@0
|
147 |
|
sl@0
|
148 |
#endif /* ELEMENTWRAPPER_H_ */
|