84 TSurfaceParamsCommon iCommonParams; |
88 TSurfaceParamsCommon iCommonParams; |
85 TSurfaceType iSurfaceType; |
89 TSurfaceType iSurfaceType; |
86 }; |
90 }; |
87 |
91 |
88 |
92 |
|
93 |
89 //Interface for creating, drawing to and submitting content for a surface |
94 //Interface for creating, drawing to and submitting content for a surface |
90 //Derived classes can implement different types of surface, that can be |
95 //Derived classes can implement different types of surface, that can be |
91 //used in the same test code. Ie surface manager surface (raw), egl window |
96 //used in the same test code. Ie surface manager surface (raw), egl window |
92 //surface, video surface, viewfinder surface. |
97 //surface, video surface, viewfinder surface. |
93 class CSurface: public CBase |
98 class CSurface: public CBase |
94 { |
99 { |
95 public: |
100 public: |
96 virtual void CreateL(TInt aIndex) = 0; |
101 // This function is kept for compatibility - new code should use offset |
|
102 // form of CreateL... |
|
103 virtual void CreateL(TInt aIndex); |
|
104 // Allow an offset for the top left corner of the surface on screen. |
|
105 virtual void CreateL(TInt aIndex, const TPoint& aOffset) = 0; |
97 virtual void DrawContentL(TInt aImageIndex) = 0; |
106 virtual void DrawContentL(TInt aImageIndex) = 0; |
98 virtual void DrawContentL(const TRgb& aColour) = 0; |
107 virtual void DrawContentL(const TRgb& aColour) = 0; |
99 virtual void SubmitContentL(TBool aShouldWaitForDisplay, TInt aRectIndex = 0) = 0; |
108 virtual void DrawComplexL(const TRgb& aColour) = 0; |
|
109 virtual TInt SubmitContent(TBool aShouldWaitForDisplay, TInt aRectIndex = 0) = 0; |
100 virtual TSurfaceId SurfaceId() const = 0; |
110 virtual TSurfaceId SurfaceId() const = 0; |
101 virtual void GetSurfaceParamsL(TSurfaceParamsRemote &aParams) = 0; |
111 virtual void GetSurfaceParamsL(TSurfaceParamsRemote &aParams) = 0; |
102 virtual const TText *GetSurfaceTypeStr() const = 0; |
112 virtual const TText *GetSurfaceTypeStr() const = 0; |
103 virtual TInt Notify(TNotification aWhen, TRequestStatus &aStatus, TUint32 aXTimes) = 0; |
113 virtual TInt Notify(TNotification aWhen, TRequestStatus &aStatus, TUint32 aXTimes) = 0; |
104 virtual TInt WaitFor(TNotification aWhen, TRequestStatus &aStatus, TInt aTimeoutInMicroseconds, TUint32& aTimeStamp) = 0; |
114 virtual TInt WaitFor(TNotification aWhen, TRequestStatus &aStatus, TInt aTimeoutInMicroseconds, TUint32& aTimeStamp) = 0; |
|
115 virtual TInt SizeInBytes() const; |
|
116 |
|
117 |
|
118 TSize Size(); |
105 |
119 |
106 public: |
120 public: |
107 // Factory function to create a surface of aSurfType. |
121 // Factory function to create a surface of aSurfType. |
108 static CSurface *SurfaceFactoryL(TSurfaceType aSurfType); |
122 static CSurface *SurfaceFactoryL(TSurfaceType aSurfType); |
109 protected: |
123 protected: |
110 TInt iParamIndex; |
124 TInt iParamIndex; |
|
125 TSize iActualSize; |
111 }; |
126 }; |
112 |
127 |
113 |
128 |
114 //Raw surface implements CSurface for basic surface manager surface. |
129 //Raw surface implements CSurface for basic surface manager surface. |
115 class CRawSurface : public CSurface |
130 class CRawSurface : public CSurface |
116 { |
131 { |
117 public: |
132 public: |
118 static CRawSurface* NewL(); |
133 static CRawSurface* NewL(); |
119 ~CRawSurface(); |
134 ~CRawSurface(); |
120 |
135 |
121 //From CSurface. |
136 // From CSurface |
122 void CreateL(TInt aIndex); |
137 virtual void CreateL(TInt aIndex, const TPoint& aOffset); |
123 void GetSurfAttribs(RSurfaceManager::TSurfaceCreationAttributesBuf &aSurfaceAttribs, TInt aIndex); |
|
124 void DrawContentL(TInt aIndex); |
138 void DrawContentL(TInt aIndex); |
125 void DrawContentL(const TRgb& aColour); |
139 void DrawContentL(const TRgb& aColour); |
126 void SubmitContentL(TBool aShouldWaitForDisplay, TInt aRectIndex = 0); |
140 void DrawComplexL(const TRgb& aColour); |
|
141 TInt SubmitContent(TBool aShouldWaitForDisplay, TInt aRectIndex = 0); |
127 TSurfaceId SurfaceId() const; |
142 TSurfaceId SurfaceId() const; |
128 void GetSurfaceParamsL(TSurfaceParamsRemote &aParams); |
143 void GetSurfaceParamsL(TSurfaceParamsRemote &aParams); |
129 virtual const TText *GetSurfaceTypeStr() const; |
144 virtual const TText *GetSurfaceTypeStr() const; |
130 virtual TInt Notify(TNotification aWhen, TRequestStatus &aStatus, TUint32 aXTimes); |
145 virtual TInt Notify(TNotification aWhen, TRequestStatus &aStatus, TUint32 aXTimes); |
131 virtual TInt WaitFor(TNotification aWhen, TRequestStatus &aStatus, TInt aTimeoutInMicroseconds, TUint32& aTimeStamp); |
146 virtual TInt WaitFor(TNotification aWhen, TRequestStatus &aStatus, TInt aTimeoutInMicroseconds, TUint32& aTimeStamp); |
132 |
147 |
133 protected: |
148 protected: |
134 CRawSurface(); |
149 CRawSurface(); |
135 void ConstructL(); |
150 void ConstructL(); |
136 TUint8* MapSurfaceAndGetInfoLC(RSurfaceManager::TSurfaceInfoV01& aInfo); |
151 TUint8* MapSurfaceAndGetInfoLC(RSurfaceManager::TSurfaceInfoV01& aInfo); |
|
152 void GetSurfAttribs(RSurfaceManager::TSurfaceCreationAttributesBuf &aSurfaceAttribs, TInt aIndex, TInt aSizeIndex); |
137 |
153 |
138 private: |
154 private: |
139 static TInt PixelSize(TUidPixelFormat aPixelFormat); |
155 static TInt PixelSize(TUidPixelFormat aPixelFormat); |
140 static TRequestStatus *GetRequestPtr(TNotification aWhen); |
156 static TRequestStatus *GetRequestPtr(TNotification aWhen); |
141 |
157 |
142 private: |
158 private: |
143 RSurfaceUpdateSession iSurfaceUpdate; |
159 RSurfaceUpdateSession iSurfaceUpdate; |
144 TRequestStatus iAvailable; |
160 TRequestStatus iAvailable; |
145 TRequestStatus iDisplayed; |
161 TRequestStatus iDisplayed; |
146 TRequestStatus iDisplayedXTimes; |
162 TRequestStatus iDisplayedXTimes; |
147 TTimeStamp iTimeStamp; |
163 TTimeStamp iTimeStamp; |
148 TInt iDrawBuffer; |
164 TInt iDrawBuffer; |
149 RChunk iSurfaceChunk; |
165 RChunk iSurfaceChunk; |
150 |
166 |
151 protected: |
167 protected: |
152 TInt iBuffers; |
168 TInt iBuffers; |
153 RSurfaceManager iSurfaceManager; |
169 RSurfaceManager iSurfaceManager; |
154 TSurfaceId iSurfaceId; |
170 TSurfaceId iSurfaceId; |
155 }; |
171 }; |
156 |
172 |
157 // Simple wrapper to enable a list of "singlebuffer" in the list of buffer types. |
173 // Simple wrapper to enable a list of "singlebuffer" in the list of buffer types. |
158 class CRawSingleBufferSurface : public CRawSurface |
174 class CRawSingleBufferSurface : public CRawSurface |
159 { |
175 { |
160 public: |
176 public: |
161 static CRawSingleBufferSurface* NewL(); |
177 static CRawSingleBufferSurface* NewL(); |
162 ~CRawSingleBufferSurface(); |
178 ~CRawSingleBufferSurface(); |
163 |
179 |
164 //From CSurface. |
180 virtual void CreateL(TInt aIndex, const TPoint& aOffset); |
165 void CreateL(TInt aIndex); |
|
166 virtual const TText *GetSurfaceTypeStr() const; |
181 virtual const TText *GetSurfaceTypeStr() const; |
167 }; |
182 }; |
168 |
183 |
169 // Forward declare classes that we do not need to know the content of. |
184 // Forward declare classes that we do not need to know the content of. |
170 class CWindow; |
185 class CWindow; |
171 class CTestVgImage; |
186 class CTestVgImage; |
172 |
187 |
173 class CEglWindowSurface : public CSurface |
188 class CEglSurfaceBase : public CSurface |
174 { |
189 { |
175 public: |
190 public: |
176 static CEglWindowSurface* NewL(); |
191 void CreateL(TInt aIndex, const TPoint& aOffset); |
177 ~CEglWindowSurface(); |
|
178 |
|
179 void CreateL(TInt aIndex); |
|
180 void DrawContentL(TInt aImageIndex); |
192 void DrawContentL(TInt aImageIndex); |
181 void DrawContentL(const TRgb& aColour); |
193 void DrawContentL(const TRgb& aColour); |
182 void SubmitContentL(TBool aShouldWaitForDisplay, TInt aRectIndex = 0); |
194 void DrawComplexL(const TRgb& aColour); |
|
195 TInt SubmitContent(TBool aShouldWaitForDisplay, TInt aRectIndex = 0); |
|
196 TInt Activate(); |
183 void ActivateL(); |
197 void ActivateL(); |
184 TSurfaceId SurfaceId() const; |
|
185 void GetSurfaceParamsL(TSurfaceParamsRemote &aParams); |
198 void GetSurfaceParamsL(TSurfaceParamsRemote &aParams); |
186 virtual const TText *GetSurfaceTypeStr() const; |
|
187 virtual TInt Notify(TNotification aWhen, TRequestStatus &aStatus, TUint32 aXTimes); |
199 virtual TInt Notify(TNotification aWhen, TRequestStatus &aStatus, TUint32 aXTimes); |
188 virtual TInt WaitFor(TNotification aWhen, TRequestStatus &aStatus, TInt aTimeoutInMicroseconds, TUint32& aTimeStamp); |
200 virtual TInt WaitFor(TNotification aWhen, TRequestStatus &aStatus, TInt aTimeoutInMicroseconds, TUint32& aTimeStamp); |
189 |
201 |
190 private: |
202 protected: |
191 CEglWindowSurface(); |
203 void BaseCreateL(TInt aIndex, EGLint aSurfaceType); |
192 void ConstructL(); |
204 virtual void DoCreateL(TInt aIndex, const TPoint& aOffset, TInt aSizeIndex) = 0; |
193 |
205 void Destroy(); |
194 private: |
206 |
|
207 protected: |
195 EGLContext iContext; |
208 EGLContext iContext; |
196 EGLSurface iSurface; |
209 EGLSurface iSurface; |
197 EGLDisplay iDisplay; |
210 EGLDisplay iDisplay; |
|
211 EGLConfig iConfig; |
|
212 }; |
|
213 |
|
214 class CEglWindowSurface : public CEglSurfaceBase |
|
215 { |
|
216 public: |
|
217 static CEglWindowSurface* NewL(); |
|
218 ~CEglWindowSurface(); |
|
219 |
|
220 TSurfaceId SurfaceId() const; |
|
221 virtual const TText *GetSurfaceTypeStr() const; |
|
222 |
|
223 private: |
|
224 CEglWindowSurface(); |
|
225 void DoCreateL(TInt aIndex, const TPoint& aOffset, TInt aSizeIndex); |
|
226 void ConstructL(); |
|
227 |
|
228 private: |
198 CWindow* iWindow; |
229 CWindow* iWindow; |
199 }; |
230 }; |
200 |
231 |
|
232 class CEglPBufferSurface : public CEglSurfaceBase |
|
233 { |
|
234 public: |
|
235 static CEglPBufferSurface* NewL(); |
|
236 ~CEglPBufferSurface(); |
|
237 TSurfaceId SurfaceId() const; |
|
238 |
|
239 virtual const TText *GetSurfaceTypeStr() const; |
|
240 |
|
241 TInt SizeInBytes() const; |
|
242 |
|
243 private: |
|
244 CEglPBufferSurface(); |
|
245 void ConstructL(); |
|
246 void DoCreateL(TInt aIndex, const TPoint& aOffset, TInt aSizeIndex); |
|
247 }; |
201 |
248 |
202 |
249 |
203 #endif |
250 #endif |