|
1 // Copyright (c) 2007-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 // |
|
15 |
|
16 #ifndef __DISPLAYRENDERSTAGE_H__ |
|
17 #define __DISPLAYRENDERSTAGE_H__ |
|
18 |
|
19 #include <graphics/surfaceupdateclient.h> |
|
20 #include <graphics/wsrenderstage.h> |
|
21 #include <graphics/wsscreendevice.h> |
|
22 #include <graphics/wsdisplaycontrol.h> |
|
23 #include <graphics/wsdisplaymapping.h> |
|
24 #include <graphics/wsdisplaypolicy.h> |
|
25 #include <graphics/wsscene.h> |
|
26 #include <graphics/wselement.h> |
|
27 #include <alf/alfcompositionclient.h> |
|
28 #include "alfstreamerconsts.h" |
|
29 #include "alfrenderstageutils.h" |
|
30 |
|
31 class RSgImageCollection; |
|
32 class CDisplayPolicy; |
|
33 class CRsDisplayChangeNotifier; |
|
34 class CRsConfigChangeNotifier; |
|
35 class COpenWfcWrapper; |
|
36 class CScreenCaptureUtil; |
|
37 class CElementWrapper; |
|
38 |
|
39 |
|
40 |
|
41 /** |
|
42 This is the implementation of CWsRenderStage which is created by a CDisplayRenderStageFactory |
|
43 */ |
|
44 class CDisplayRenderStage : |
|
45 public CWsRenderStage, |
|
46 public MWsScreenDevice, |
|
47 public MWsDisplayControl, |
|
48 public MWsDisplayMapping, |
|
49 public MWsDisplayPolicy, |
|
50 public MWsScene, |
|
51 public MWsWindowTreeObserver, |
|
52 public MAlfCompositionController |
|
53 { |
|
54 friend class COpenWfcWrapper; |
|
55 |
|
56 public: |
|
57 static CDisplayRenderStage* NewL(MWsGraphicDrawerEnvironment* aEnv, MWsScreen* aScreen, TInt aScreenNumber); |
|
58 ~CDisplayRenderStage(); |
|
59 |
|
60 public: //from CWsRenderStage |
|
61 TAny* ResolveObjectInterface(TUint aTypeId); |
|
62 void Begin(const TRegion* aRegion); |
|
63 void End(TRequestStatus* aFinished); |
|
64 |
|
65 public: //from MWsScreenDevice |
|
66 TInt ScreenNumber() const; |
|
67 TDisplayMode DisplayMode() const; |
|
68 TSize SizeInPixels() const; |
|
69 TSize SizeInTwips() const; |
|
70 TRect PointerRect() const; |
|
71 void GetPixel(TRgb& aColor, const TPoint& aPixel) const; |
|
72 void GetScanLine(TDes8& aScanLine, const TPoint& aStartPixel, TInt aPixelLength, TDisplayMode aDispMode) const; |
|
73 TBool RectCompare(const TRect& aRect1, const TRect& aRect2) const; |
|
74 void CopyScreenToBitmapL(CFbsBitmap* aBitmap, const TRect &aRect) const; |
|
75 void ClearDisplay(TRgb aBackColor); |
|
76 |
|
77 public: //from MWsScene |
|
78 TInt SetSceneRotation(const MWsScene::TSceneRotation aSceneRotation); |
|
79 MWsScene::TSceneRotation SceneRotation() const; |
|
80 MWsElement* CreateSceneElementL(); |
|
81 void DestroySceneElement(MWsElement* aElement); |
|
82 TInt InsertSceneElement(MWsElement* aInsertElement, MWsElement* aSubordinateElement); |
|
83 TInt RemoveSceneElement(MWsElement* aRemoveElement); |
|
84 void ComposePendingScene(TSurfaceId& aOffScreenTarget, TRequestStatus* aCompleted); |
|
85 TInt RegisterSurface(const TSurfaceId& aSurface); |
|
86 TInt UnregisterSurface(const TSurfaceId& aSurface); |
|
87 |
|
88 public: // from MWsDisplayControl/MDisplayControlBase |
|
89 void NotifyOnDisplayChange(TRequestStatus& aStatus); |
|
90 void NotifyOnDisplayChangeCancel(); |
|
91 void NotifyOnConfigChange(TRequestStatus& aStatus); |
|
92 void NotifyOnConfigChangeCancel(); |
|
93 TInt NumberOfResolutions() const; |
|
94 TInt GetResolutions(RArray<TResolution>& aResolutions) const; |
|
95 void GetConfiguration(TDisplayConfiguration& aConfig) const; |
|
96 TInt SetConfigurationAndBuffer(const TDisplayConfiguration& aConfig,const TSize* aUiSize); |
|
97 TInt SetConfiguration(const TDisplayConfiguration& aConfig); |
|
98 TInt PreferredDisplayVersion() const; |
|
99 |
|
100 public: //from MWsDisplayMapping/MDisplayMapping |
|
101 virtual TInt MapCoordinates(TCoordinateSpace aSourceSpace, const TRect& aSource, TCoordinateSpace aTargetSpace, TRect& aTarget) const; |
|
102 void SetSizeModeExtent(TRect& aExtent, TBitFlags32 aContext); |
|
103 |
|
104 public://from MWsDisplayPolicy |
|
105 virtual void NewAppModesAvailable(); |
|
106 TInt GetSizeModeConfiguration(TInt aScreenSizeMode, TDisplayConfiguration& aConfig, TRect& aSizeModePosition) const; |
|
107 TInt SuitableAppMode(TDisplayStatus aSituation); |
|
108 void SetLastAppMode(TInt aMode); |
|
109 |
|
110 public: |
|
111 |
|
112 void NodeCreated(const MWsWindowTreeNode& aWindowTreeNode, const MWsWindowTreeNode* aParent) { if (iWindowTreeObserver) iWindowTreeObserver->NodeCreated(aWindowTreeNode, aParent);} |
|
113 void NodeReleased(const MWsWindowTreeNode& aWindowTreeNode) { if (iWindowTreeObserver) iWindowTreeObserver->NodeReleased(aWindowTreeNode);} |
|
114 void NodeActivated(const MWsWindowTreeNode& aWindowTreeNode) { if (iWindowTreeObserver) iWindowTreeObserver->NodeActivated(aWindowTreeNode);} |
|
115 void NodeExtentChanged(const MWsWindowTreeNode& aWindowTreeNode, const TRect& aRect) { if (iWindowTreeObserver) iWindowTreeObserver->NodeExtentChanged(aWindowTreeNode, aRect);} |
|
116 void SiblingOrderChanged(const MWsWindowTreeNode& aWindowTreeNode, TInt aNewPos) { if (iWindowTreeObserver) iWindowTreeObserver->SiblingOrderChanged(aWindowTreeNode, aNewPos);} |
|
117 void FlagChanged(const MWsWindowTreeNode& aWindowTreeNode, TFlags aFlag, TBool aNewValue) { if (iWindowTreeObserver) iWindowTreeObserver->FlagChanged(aWindowTreeNode,aFlag, aNewValue);} |
|
118 void AttributeChanged(const MWsWindowTreeNode& aWindowTreeNode, TAttributes aAttribute) { if (iWindowTreeObserver) iWindowTreeObserver->AttributeChanged(aWindowTreeNode, aAttribute);} |
|
119 void FadeCountChanged(const MWsWindowTreeNode& aWindowTreeNode, TInt aFadeCount) { if (iWindowTreeObserver) iWindowTreeObserver->FadeCountChanged(aWindowTreeNode, aFadeCount);} |
|
120 void TransparentRegionChanged(const MWsWindowTreeNode& aWindowTreeNode, const TRegion& aNewTransparentRegion, const TRegion* aNewOpaqueRegion) { if (iWindowTreeObserver) iWindowTreeObserver->TransparentRegionChanged(aWindowTreeNode, aNewTransparentRegion, aNewOpaqueRegion);} |
|
121 void ElementAdded(const MWsWindowTreeNode& aWindowTreeNode, const MWsElement& aElement); |
|
122 void MovedToWindowGroup(const MWsWindowTreeNode& aWindowTreeNode, const MWsWindowTreeNode& aNewWindowGroupNode) { if (iWindowTreeObserver) iWindowTreeObserver->MovedToWindowGroup(aWindowTreeNode, aNewWindowGroupNode);} |
|
123 void WindowGroupChained(const MWsWindowTreeNode& aParent, const MWsWindowTreeNode& aChild) { if (iWindowTreeObserver) iWindowTreeObserver->WindowGroupChained(aParent, aChild);} |
|
124 void WindowGroupChainBrokenAfter(const MWsWindowTreeNode& aWindowGroupNode) { if (iWindowTreeObserver) iWindowTreeObserver->WindowGroupChainBrokenAfter(aWindowGroupNode);} |
|
125 void FadeAllChildren(const MWsWindowTreeNode& aWindowTreeNode, TBool aFaded) { if (iWindowTreeObserver) iWindowTreeObserver->FadeAllChildren(aWindowTreeNode, aFaded);} |
|
126 |
|
127 public: //MAlfCompositionController |
|
128 TInt EnableAlpha(TBool aEnable = ETrue); |
|
129 TInt SetOpacity(TReal32 aOpacity) __SOFTFP; |
|
130 TInt SetRotation(TInt aRotationInDegrees); |
|
131 TInt SetExtent(const TRect& aRect, TInt aScreen); |
|
132 void SetIsBackgroundAnim(TBool ETrue); |
|
133 TInt SetSourceRect(const TRect& aRect); |
|
134 TInt CreateTargetL(TInt aTarget, TInt aClientHandle, TInt aGrpHandle); |
|
135 void SetTargetL(TInt aTarget); |
|
136 void SetExtentSurfaceId(const TSurfaceId& aSurfaceId); |
|
137 TInt SetOrder(TInt aTarget, TInt aTop, TBool aAbove, TBool aCombineTargets); |
|
138 void DeleteTarget(TInt aTarget); |
|
139 void LowOnGraphicsMemory(); |
|
140 void GraphicsMemoryGood(); |
|
141 void AlfBridgeCallback(TInt aEvent, TAny* aData); |
|
142 |
|
143 public: |
|
144 |
|
145 private: |
|
146 CDisplayRenderStage(TInt aScreenNumber); |
|
147 void ConstructL(MWsGraphicDrawerEnvironment* aEnv, MWsScreen* aScreen, TInt aScreenNumber); |
|
148 void ElementUseAlphaFlagChangedL(MWsElement& aElement, TBool aEnabled); |
|
149 MWsElement* FindElement(TInt aWindowGroupId, TInt aWindowHandle); |
|
150 CElementWrapper* FindElementTarget(TInt aTarget); |
|
151 void AlfWindowListenerCallback( TAlfNativeWindowData* aData ); |
|
152 void SetTarget(MWsElement* aElement); |
|
153 private: |
|
154 TInt iScreenNumber; |
|
155 TTimeStamp iTimeStamp; |
|
156 RSurfaceUpdateSession iSurfaceUpdateSession; |
|
157 const TRegion* iUpdateRegion; |
|
158 //CDirectGdiDriver* iDGdiDriver; |
|
159 //CRenderTarget* iRenderTarget; |
|
160 COpenWfcWrapper* iOpenWfcWrapper; |
|
161 MWsDisplayControl* iOpenWfcWrapperDisplayControl; |
|
162 |
|
163 CDisplayPolicy* iDisplayPolicy; |
|
164 TBool iDisplayPolicyEnabled; |
|
165 |
|
166 //required for display and config change notification |
|
167 CRsDisplayChangeNotifier* iDispNotifier; |
|
168 CRsConfigChangeNotifier* iConfigNotifier; |
|
169 |
|
170 TBool iRunningOnLowMem; |
|
171 MAlfBridge* iAlfBridge; |
|
172 MWsElement* iAlfElement; |
|
173 MWsElement* iUiElement; |
|
174 CElementWrapper* iTargetElement; |
|
175 MAlfCompositionAgnosticWindowTreeObserver* iWindowTreeObserver; |
|
176 |
|
177 struct TElementData |
|
178 { |
|
179 MWsElement* iElement; |
|
180 TSurfaceId iSurfaceId; |
|
181 TUint32 iWindowGrpId; |
|
182 TUint32 iWindowHandle; |
|
183 TUint32 iWindowTreeNodeId; |
|
184 |
|
185 TElementData(MWsElement* aElement, TSurfaceId aSurfaceId, TInt aWindowGrpId, TUint32 aWindowHandle, TUint32 aWindowTreeNodeId) |
|
186 { |
|
187 iElement = aElement; |
|
188 iSurfaceId = aSurfaceId; |
|
189 iWindowGrpId = aWindowGrpId; |
|
190 iWindowHandle = aWindowHandle; |
|
191 iWindowTreeNodeId = aWindowTreeNodeId; |
|
192 } |
|
193 }; |
|
194 |
|
195 RArray<TElementData> iElementArray; |
|
196 |
|
197 struct SElementTarget |
|
198 { |
|
199 TInt iTarget; |
|
200 CElementWrapper* iElement; |
|
201 }; |
|
202 |
|
203 TSurfaceId iExtentSurfaceId; |
|
204 |
|
205 RArray<SElementTarget> iElementTargets; |
|
206 public: |
|
207 mutable CScreenCaptureUtil* iScreenCaptureUtil; |
|
208 }; |
|
209 |
|
210 #endif //__DISPLAYRENDERSTAGE_H__ |