|
1 /* |
|
2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Defines CHuiDisplay, a drawing buffer into which a the toolkit |
|
15 * contents (visuals) are drawn. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __HUIDISPLAY_H__ |
|
22 #define __HUIDISPLAY_H__ |
|
23 |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <coemain.h> |
|
27 #include <gdi.h> |
|
28 #include <uiacceltk/HuiGc.h> |
|
29 #include <uiacceltk/HuiObserverArray.h> |
|
30 #include <uiacceltk/HuiOwnedPointer.h> |
|
31 #include <uiacceltk/HuiRoster.h> |
|
32 #include <uiacceltk/huidisplaybackgrounditem.h> |
|
33 |
|
34 |
|
35 /* Forward declarations */ |
|
36 class MHuiRenderSurface; |
|
37 class CHuiEnv; |
|
38 class CHuiVisual; |
|
39 class CHuiControl; |
|
40 class CHuiControlGroup; |
|
41 class CHuiTransformation; |
|
42 class CHuiRosterImpl; |
|
43 class CHuiDisplay; |
|
44 class CCoeControl; |
|
45 class RDrawableWindow; |
|
46 |
|
47 /* Screen buffer uids */ |
|
48 const TUid KHuiUidBackBufferAll = {0x2000e59d}; // Not used |
|
49 const TUid KHuiUidBackBufferScreen0 = {0x2000e59e}; |
|
50 const TUid KHuiUidBackBufferScreen1 = {0x2000e59f}; |
|
51 const TUid KHuiUidBackBufferTvOutNormal = {0x2000e5a0}; |
|
52 const TUid KHuiUidBackBufferTvOutWide = {0x2000e5a1}; |
|
53 |
|
54 /** |
|
55 * The intended usage of the display. The display may use this info to |
|
56 * prioritize the HW usage and route content. |
|
57 * Vendor specific meanings may be used at the end of the enum space. |
|
58 */ |
|
59 enum THuiDisplayUsageHint |
|
60 { |
|
61 EHuiDisplayUsageGeneric = 0x00000001, |
|
62 EHuiDisplayUsage3D = 0x00000002, |
|
63 EHuiDisplayUsageVideoPlayback = 0x00000004, |
|
64 EHuiDisplayUsageVideoCapture = 0x00000008, |
|
65 EHuiDisplayUsageViewfinder = 0x00000010, |
|
66 EHuiDisplayUsageStillImage = 0x00000011, |
|
67 EHuiDisplayUsageVendorSpecific = 0x80000000 |
|
68 }; |
|
69 |
|
70 |
|
71 /** |
|
72 * Roster observers are notified before and after draw. |
|
73 */ |
|
74 class MHuiRosterObserver |
|
75 { |
|
76 public: |
|
77 |
|
78 /** |
|
79 * Called to notify that roster draw is about to start. |
|
80 */ |
|
81 virtual void NotifyRosterDrawStart(CHuiDisplay& aDisplay) = 0; |
|
82 |
|
83 /** |
|
84 * Called to notify that roster draw is finished. |
|
85 */ |
|
86 virtual void NotifyRosterDrawEnd(CHuiDisplay& aDisplay) = 0; |
|
87 |
|
88 }; |
|
89 |
|
90 /** |
|
91 * Display refresh observers are notified before a display refresh begins. |
|
92 */ |
|
93 class MHuiDisplayRefreshObserver |
|
94 { |
|
95 public: |
|
96 |
|
97 /** |
|
98 * Called to notify the observer that a display refresh is about to begin. |
|
99 * The observer should prepare its state for the display. |
|
100 */ |
|
101 virtual void NotifyDisplayRefreshStarted(CHuiDisplay& aDisplay) = 0; |
|
102 |
|
103 }; |
|
104 |
|
105 |
|
106 /** |
|
107 * Display deletion observer is notified when the display is about to be |
|
108 * destroyed. |
|
109 */ |
|
110 class MHuiDisplayDeletionObserver |
|
111 { |
|
112 public: |
|
113 |
|
114 /** |
|
115 * Called to notify the observer that a display is about to be destroyed. |
|
116 */ |
|
117 virtual void NotifyDisplayDeletion(CHuiDisplay& aDisplay) = 0; |
|
118 |
|
119 }; |
|
120 |
|
121 |
|
122 /** |
|
123 * Display size observer is notified when the display is resized. |
|
124 */ |
|
125 class MHuiDisplayVisibleAreaObserver |
|
126 { |
|
127 public: |
|
128 |
|
129 /** |
|
130 * Called to notify the observer that a display has been resized. |
|
131 * |
|
132 * @param aDisplay Display that sends the notification. |
|
133 */ |
|
134 virtual void NotifyDisplayVisibleAreaChanged(CHuiDisplay& aDisplay) = 0; |
|
135 |
|
136 }; |
|
137 |
|
138 class MHuiScreenBufferObserver |
|
139 { |
|
140 public: |
|
141 |
|
142 enum THuiScreenBufferEvent |
|
143 { |
|
144 ENone, |
|
145 EBufferComplete = ENone, |
|
146 ECreated, // Buffer created |
|
147 EDeleted, // Buffer deleted |
|
148 ERestored, // Not yet implemented |
|
149 EReleased, // Not yet implemented |
|
150 EBufferDrawComplete // Buffer has been drawn to the internal window |
|
151 }; |
|
152 |
|
153 /** |
|
154 * This is called when all the content have been draw to the buffer. |
|
155 * If EFalse is returned, the buffer will be locked until the observer unlocks it. |
|
156 * If ETrue is returned, the buffer is unlocked automatically, immediately after this method returns. |
|
157 * |
|
158 * @param aBufferUid Unique id of the buffer. |
|
159 * @param aDisplayRect Screen buffer rect. |
|
160 * @param aDirtyRect Dirty rect for the buffer. |
|
161 * @return Return True, if buffer can be freed automatically after this call. |
|
162 */ |
|
163 virtual TBool ScreenBufferComplete(TUid aBufferUid, TRect& aDisplayRect, TRect& aDirtyRect) = 0; |
|
164 |
|
165 /** |
|
166 * Alf calls this when e.g. the back buffer is created or deleted. |
|
167 * |
|
168 * @param aId The unique id of the buffer. |
|
169 * @param aEvent @see MAlfScreenBufferObserver::TAlfScreenBufferEvent |
|
170 */ |
|
171 virtual void HandleScreenBufferEvent(TUid aBufferUid, TInt aEvent) = 0; |
|
172 }; |
|
173 |
|
174 |
|
175 /** |
|
176 * This interface is to be used when drawing the buffer to the window etc. |
|
177 */ |
|
178 class MHuiBufferDrawer |
|
179 { |
|
180 public: |
|
181 // Clean all resources, usually delete this |
|
182 virtual void ReleaseDrawer() = 0; |
|
183 }; |
|
184 |
|
185 /** |
|
186 * This interface is to be used when modifying the buffer (sent back to server). |
|
187 * Could be attached to special content visual. |
|
188 */ |
|
189 class MHuiGc |
|
190 { |
|
191 public: |
|
192 // Clean all resources, usually delete this |
|
193 virtual void ReleaseGc() = 0; |
|
194 }; |
|
195 |
|
196 /* |
|
197 * Internal class. Not for public API. |
|
198 */ |
|
199 class MHuiFbsBitmapBufferGc: public MHuiGc |
|
200 { |
|
201 public: |
|
202 virtual CFbsBitmap* Bitmap() = 0; |
|
203 }; |
|
204 |
|
205 |
|
206 /** |
|
207 * CHuiDisplays are the drawing surfaces for the applications using the |
|
208 * toolkit. |
|
209 * |
|
210 * To be able to display any content with the toolkit, application must |
|
211 * create an instance of CHuiDisplay. For that @see CHuiDisplayCoeControl |
|
212 * class and @see CHuiEnv::NewDisplayL(). |
|
213 * |
|
214 * CHuiDisplay is drawing buffer into which a roster is drawn. The drawing is |
|
215 * done on the rendering surface associated with the display. The drawing |
|
216 * surface itself can be an on-screen surface (attached to an RWindow) or an |
|
217 * off-screen surface (buffer in memory). |
|
218 * |
|
219 * The display can be set to draw only onto a portion of the surface, so that |
|
220 * multiple displays can share a single surface. The portion of the surface |
|
221 * used by the display is set with SetVisibleArea(). |
|
222 * |
|
223 * Displays remain owned by an environment (a CHuiEnv instance). |
|
224 * |
|
225 */ |
|
226 NONSHARABLE_CLASS(CHuiDisplay) : public CBase, |
|
227 public MCoeMessageMonitorObserver |
|
228 { |
|
229 public: |
|
230 |
|
231 /* Types. */ |
|
232 |
|
233 /** Background clear modes. */ |
|
234 enum TClearMode |
|
235 { |
|
236 /** Do not clear. This is more like an optimization flag. |
|
237 * Using this with OpenGL ES renderer results |
|
238 * to undefined (Trashed) background - so be sure to display content that |
|
239 * fills the entire screen. With the BITGDI renderer the |
|
240 * behavior is similar but the display are will show the previously |
|
241 * rendered avkon content (if any). */ |
|
242 EClearNone, |
|
243 |
|
244 /** Clear with a solid color. */ |
|
245 EClearWithColor, |
|
246 |
|
247 /** Clear with the skin background texture. */ |
|
248 EClearWithSkinBackground |
|
249 }; |
|
250 |
|
251 /** Display types. */ |
|
252 |
|
253 enum TDisplayType |
|
254 { |
|
255 /** @deprecated: Primary LCD display. */ |
|
256 EDisplayLcd0 = 0x0, |
|
257 |
|
258 /** @deprecated: Secondary LCD display, e.g. the cover display. */ |
|
259 EDisplayLcd1 = 0x1, |
|
260 |
|
261 /** @deprecated: TV out */ |
|
262 EDisplayTvOut = 0x2, |
|
263 |
|
264 /** @deprecated: TV out widescreen */ |
|
265 EDisplayTvOutWide = 0x3, |
|
266 |
|
267 /** Physical screen */ |
|
268 EDisplayNormal = 0x10, |
|
269 |
|
270 /** Virtual display */ |
|
271 EDisplayVirtual = 0x20, |
|
272 |
|
273 /** @deprecated: Off screen buffer */ |
|
274 EDisplayOffScreenBuffer = 0x40 |
|
275 }; |
|
276 |
|
277 /** Texture bitmap format info */ |
|
278 |
|
279 class CTextureBitmapFormat: public CBase |
|
280 { |
|
281 public: |
|
282 CTextureBitmapFormat(TDisplayMode aImage, TDisplayMode aMask) |
|
283 : iImage(aImage), iMask(aMask) |
|
284 {} |
|
285 private: |
|
286 CTextureBitmapFormat(const CTextureBitmapFormat& p); |
|
287 public: |
|
288 TDisplayMode iImage; |
|
289 TDisplayMode iMask; |
|
290 }; |
|
291 |
|
292 |
|
293 /* RnD: visual outline drawing */ |
|
294 enum TDrawVisualOutline |
|
295 { |
|
296 EDrawVisualOutlineNone, |
|
297 EDrawVisualOutlineAllVisuals, //draw outline for all visuals |
|
298 EDrawVisualOutlineSelectedVisuals //draw outline for selected visuals and their child visuals |
|
299 }; |
|
300 |
|
301 |
|
302 /* Constructors and destructor. */ |
|
303 |
|
304 /** |
|
305 * Constructors. |
|
306 * This constructor should never be called explicitly by application developers, |
|
307 * new displays should be created through the environment instead. |
|
308 * |
|
309 * @param aEnv The environment that manages this display. |
|
310 * @param aNativeControl Native control where the display will be used (or <code>NULL</code>). |
|
311 * @param aDisplayType Display type. |
|
312 * @param aScreenBufferUid Screen buffer uid. |
|
313 * @see CHuiEnv::NewDisplayL(). |
|
314 */ |
|
315 CHuiDisplay(CHuiEnv& aEnv, CCoeControl* aNativeControl, TInt aDisplayType, TUid aScreenBufferUid); |
|
316 CHuiDisplay(CHuiEnv& aEnv, RWindow* aNativeWindow, TInt aDisplayType, TUid aScreenBufferUid); |
|
317 |
|
318 |
|
319 /** |
|
320 * Destructor |
|
321 */ |
|
322 IMPORT_C ~CHuiDisplay(); |
|
323 |
|
324 /** |
|
325 * Second-phase constructor. Creates a window and a rendering surface. |
|
326 * Not exported because displays must be created using CHuiEnv. |
|
327 * |
|
328 * @param aRect Frame rectangle for container. |
|
329 * @param aSharedRoster Existing roster to use. |
|
330 */ |
|
331 void ConstructL(const TRect& aRect, CHuiRoster* aSharedRoster); |
|
332 |
|
333 /* Methods. */ |
|
334 |
|
335 /** @beginAPI */ |
|
336 |
|
337 /** |
|
338 * Returns the environment of the display. |
|
339 */ |
|
340 IMPORT_C CHuiEnv& Env(); |
|
341 |
|
342 /** |
|
343 * Activates or deactivates the display. Active displays are refreshed, |
|
344 * deactivated ones are not. Display activation and deactivation is |
|
345 * normally carried out automatically. |
|
346 * |
|
347 * @param aActivate <code>ETrue</code> to activate. |
|
348 */ |
|
349 IMPORT_C void Activate(TBool aActivate); |
|
350 |
|
351 /** |
|
352 * Determines if the display is active. |
|
353 * |
|
354 * @return <code>ETrue</code>, if the display is active. |
|
355 */ |
|
356 IMPORT_C TBool Active() const; |
|
357 |
|
358 /** |
|
359 * Sets a new size for the display. The display's rendering surface will |
|
360 * also be resized. |
|
361 * |
|
362 * @param aSize New size for the display. |
|
363 */ |
|
364 IMPORT_C void SetSizeL(const TSize& aSize); |
|
365 |
|
366 /** |
|
367 * Returns the size of the display. The rendering surface of the display |
|
368 * has this same size. This size may be greater than the visible display |
|
369 * area, for example when multiple displays are drawn onto the same surface. |
|
370 * |
|
371 * @return Size of the display and its rendering surface. |
|
372 * @see VisibleArea() |
|
373 * @see SetVisibleArea() |
|
374 */ |
|
375 IMPORT_C TSize Size() const; |
|
376 |
|
377 /** |
|
378 * Sets the visible area of the display. The visible area is the area on |
|
379 * the display's rendering surface where the display is drawn. Normally |
|
380 * a display covers the entire rendering surface, but in the situation |
|
381 * where multiple displays are drawn on the same surface, this would be |
|
382 * used to define the visible area of each display. |
|
383 * If there is no graphics context, this method has no effect. |
|
384 * |
|
385 * @param aArea Visible area for the display. |
|
386 * @see Size() |
|
387 */ |
|
388 IMPORT_C void SetVisibleArea(const TRect& aArea); |
|
389 |
|
390 /** |
|
391 * Returns the visible area of the display. |
|
392 * |
|
393 * @return Visible area of the display. Affected by display orientation |
|
394 * so that the returned rectangle uses the oriented coordinate |
|
395 * space. |
|
396 * |
|
397 * @todo Test that the coordinates are calculated correctly. |
|
398 * @see Size() |
|
399 */ |
|
400 IMPORT_C TRect VisibleArea() const; |
|
401 |
|
402 /** |
|
403 * Sets display orientation. |
|
404 * |
|
405 * @param aOrientation Display orientation. |
|
406 */ |
|
407 IMPORT_C void SetOrientation(CHuiGc::TOrientation aOrientation); |
|
408 |
|
409 /** |
|
410 * Determines the orientation of the display, such as horizontal |
|
411 * or vertical. |
|
412 * |
|
413 * @return Orientation. |
|
414 * @see CHuiGc::TOrientation |
|
415 */ |
|
416 IMPORT_C CHuiGc::TOrientation Orientation() const; |
|
417 |
|
418 /** |
|
419 * Sets the flag that enables the use of depth testing. |
|
420 * |
|
421 * @param aUseDepth <code>ETrue</code> to enable depth. |
|
422 */ |
|
423 IMPORT_C void SetUseDepth(TBool aUseDepth); |
|
424 |
|
425 /** |
|
426 * Sets the flag that tells the display to clear the background before |
|
427 * doing a refresh. Creates new objects required to be able to clear |
|
428 * the background with the defined mode. |
|
429 * |
|
430 * @param aClearBackground Background clearing mode. |
|
431 * @see SetBackgroundColor() |
|
432 */ |
|
433 IMPORT_C void SetClearBackgroundL(TClearMode aClearBackground); |
|
434 |
|
435 /** |
|
436 * Sets the background color of the display, if background clearing has |
|
437 * been enabled. |
|
438 * |
|
439 * @param aBackgroundColor The color to set the background to. |
|
440 * @see SetClearBackgroundL() |
|
441 */ |
|
442 IMPORT_C void SetBackgroundColor(const TRgb& aBackgroundColor); |
|
443 |
|
444 /** |
|
445 * Sets the items that specify how to clear display before display refresh. |
|
446 * Items may have overlapping rectangles, drawing order is same as item order |
|
447 * in the parameter array. But having lots of overlapping drawing |
|
448 * causes negative performance impact. |
|
449 * |
|
450 * This method is alternative to SetClearBackgroundL and SetBackgroundColor |
|
451 * methods. |
|
452 * |
|
453 * @see SetBackgroundColor() |
|
454 * @see SetClearBackgroundL() |
|
455 * @param aItems Array of items that specify how to clear the background. |
|
456 * |
|
457 */ |
|
458 IMPORT_C void SetBackgroundItemsL(const RArray<THuiDisplayBackgroundItem>& aItems); |
|
459 |
|
460 /** |
|
461 * Makes a screen capture of the display's current content. |
|
462 * This method uses the screen capture method of the current |
|
463 * graphics context. This may return differing data depending on the |
|
464 * chosen graphics context, and screen capture may not be supported. |
|
465 * The returned pointer may be allocated from inside the graphics context, |
|
466 * it may need to be deleted afterwards. |
|
467 * |
|
468 * @param aSize Size of the captured image. |
|
469 * |
|
470 * @return Captured pixel data, in the form returned by the HuiGc. |
|
471 * @see HuiGles10Gc::CaptureLC() |
|
472 */ |
|
473 IMPORT_C TUint8* CaptureLC(TSize& aSize) const; |
|
474 |
|
475 /** |
|
476 * Returns the transformation for the entire display. |
|
477 */ |
|
478 IMPORT_C CHuiTransformation& Transformation() const; |
|
479 |
|
480 /** |
|
481 * Returns the roster of the display. |
|
482 */ |
|
483 IMPORT_C CHuiRoster& Roster(); |
|
484 |
|
485 /** |
|
486 * Returns the const roster of the display. |
|
487 */ |
|
488 IMPORT_C const CHuiRoster& Roster() const; |
|
489 |
|
490 /** |
|
491 * Shows or hides the display. The application should call this if |
|
492 * the display goes to background. |
|
493 * |
|
494 * @param aShow ETrue if display is shown. EFalse if display is hidden. |
|
495 */ |
|
496 IMPORT_C void Show(TBool aShow); |
|
497 |
|
498 /** |
|
499 * Flag the entire display as dirty. |
|
500 */ |
|
501 IMPORT_C void SetDirty(); |
|
502 /** |
|
503 * Sets the rendering quality of the display. |
|
504 */ |
|
505 IMPORT_C void SetQuality(THuiQuality aRenderingQuality); |
|
506 |
|
507 /** |
|
508 * Determines the rendering quality of the display. |
|
509 */ |
|
510 IMPORT_C THuiQuality Quality() const; |
|
511 |
|
512 /** |
|
513 * Tells display the intended usage of the display. Display may use this |
|
514 * information to optimize the drawing. |
|
515 * |
|
516 * @param aUsage |
|
517 * |
|
518 * Possible values for parameter are: |
|
519 * EHuiDisplayUsageGeneric |
|
520 * EHuiDisplayUsage3D |
|
521 * EHuiDisplayUsageVideoPlayback |
|
522 * EHuiDisplayUsageVideoCapture |
|
523 * EHuiDisplayUsageViewfinder |
|
524 * EHuiDisplayUsageStillImage |
|
525 * EHuiDisplayUsageVendorSpecific + n |
|
526 * |
|
527 * Supported values depend on display type |
|
528 * and underlying HW. |
|
529 * |
|
530 * |
|
531 */ |
|
532 IMPORT_C void SetUsageL(TUint aUsageHint); |
|
533 |
|
534 /** |
|
535 * Temporarily release the rendering surfaces used by this display. You |
|
536 * can call this method to free up resources related to display for example |
|
537 * when the display goes to background (ie. is not visible). |
|
538 * @see RestoreL() |
|
539 */ |
|
540 IMPORT_C void Release(); |
|
541 |
|
542 /** |
|
543 * Recreate any released resources of this display. You |
|
544 * can call this method to recreate resources related to display for example |
|
545 * when the display comes back to foreground (ie. becomes visible). |
|
546 * @see Release() |
|
547 */ |
|
548 IMPORT_C void RestoreL(); |
|
549 |
|
550 /** |
|
551 * Lock or unlock the screen buffer. If the buffer is locked the system cannot draw to it. |
|
552 * |
|
553 * @param TBool Lock or unlock the screen buffer |
|
554 */ |
|
555 IMPORT_C void SetScreenBufferLock(TBool aLock); |
|
556 |
|
557 /** |
|
558 * Returns locking state of the screen buffer. |
|
559 * |
|
560 * @return TBool Locking state of the screen buffer |
|
561 */ |
|
562 IMPORT_C TBool IsScreenBufferLocked() const; |
|
563 |
|
564 /** |
|
565 * Returns an instance of an interface for drawing the buffer e.g. to a window. |
|
566 * |
|
567 * @param aInterfaceUid Unique id of the interface. |
|
568 */ |
|
569 IMPORT_C MHuiBufferDrawer* GetDrawingInterface(const TUid& aInterfaceUid); |
|
570 |
|
571 /** |
|
572 * Returns an instance of an interface for drawing to the buffer. |
|
573 * |
|
574 * @param aInterfaceUid Unique id of the interface. |
|
575 */ |
|
576 IMPORT_C MHuiGc* GetGraphicsContext(const TUid& aInterfaceUid); |
|
577 |
|
578 /** |
|
579 * Add an observer for a buffer. There can be only one observer at a time, so this overrides |
|
580 * the previous one. |
|
581 * |
|
582 * @param aObserver Pointer to the observer. |
|
583 */ |
|
584 IMPORT_C void AddScreenBufferObserverL(MHuiScreenBufferObserver* aObserver); |
|
585 |
|
586 /** |
|
587 * Remove observer from the buffer. |
|
588 */ |
|
589 IMPORT_C void RemoveScreenBufferObserver(); |
|
590 |
|
591 /** |
|
592 * Return the screen buffer observer. |
|
593 * |
|
594 * @return Screen buffer observer |
|
595 */ |
|
596 IMPORT_C MHuiScreenBufferObserver* ScreenBufferObserver(); |
|
597 |
|
598 /** |
|
599 * Draw the screen buffer to the internal window |
|
600 */ |
|
601 IMPORT_C void DrawScreenBuffer(); |
|
602 |
|
603 /** |
|
604 * Return the screen buffer uid |
|
605 * |
|
606 * @return Screen buffer uid |
|
607 */ |
|
608 IMPORT_C TUid ScreenBufferUid(); |
|
609 |
|
610 /** |
|
611 * Return the display type. |
|
612 * |
|
613 * @return Display type |
|
614 */ |
|
615 IMPORT_C TInt DisplayType(); |
|
616 |
|
617 /** |
|
618 * For debugging the dirty regions. Do not call in a release version. |
|
619 * Valid only with BitGDI renderer. |
|
620 * |
|
621 * @param aShow ETrue shows the dirty regioins |
|
622 * EFalse hides the dirty regions (default) |
|
623 */ |
|
624 IMPORT_C void ShowDirtyRegions( TBool aShow = ETrue ); |
|
625 |
|
626 /** |
|
627 * Get a list of preferred texture formats that are optimal for the renderer. The formats are |
|
628 * in descending preference order, if applicable. |
|
629 * |
|
630 * This method can be used for finding suitable format for textures to be created with |
|
631 * EHuiTextureFlagAllowDirectBitmapUsage flag. |
|
632 * |
|
633 * The ownership of array items is given to caller. The application should call ResetAndDestroy() |
|
634 * for the array before it goes out of scope, even if an error is returned. |
|
635 * |
|
636 * @param aTextureFormats returns a list of preferred formats for this display. |
|
637 * @return Error code. |
|
638 */ |
|
639 IMPORT_C TInt GetPreferredTextureFormats(RPointerArray<CHuiDisplay::CTextureBitmapFormat>& aTextureFormats); |
|
640 |
|
641 /** |
|
642 * Sets clipping rect for display visible area. Does not modify actual visible area, |
|
643 * but drawing outside the given clipping rect is clipped. Setting new VisibleArea |
|
644 * cancels automatically clipping rect that has possibly been set with this method. |
|
645 * @param aVisibleAreaClippingRect Clipping rect for visible area. Setting rect to value |
|
646 * TRect(0,0,0,0) disables clipping. |
|
647 */ |
|
648 IMPORT_C void SetVisibleAreaClippingRect(const TRect& aVisibleAreaClippingRect); |
|
649 |
|
650 /** |
|
651 * For debugging purposes. Do not call in a release version - needs a RnD central |
|
652 * repository key for activation. See programmers guide for more information. |
|
653 * |
|
654 * @param aDrawVisualOutline Holds the flag value for drawing visual outline. |
|
655 * @see TDrawVisualOutline |
|
656 */ |
|
657 IMPORT_C void SetDrawVisualOutline( TUint aDrawVisualOutline ); |
|
658 |
|
659 /** @endAPI */ |
|
660 |
|
661 /** |
|
662 * Returns the graphics context of the display. |
|
663 */ |
|
664 CHuiGc* Gc(); |
|
665 |
|
666 /** |
|
667 * Returns the native control associated with the display, if there is one. |
|
668 * |
|
669 * @return CCoeControl in which the display is shown, or <code>NULL</code>. |
|
670 */ |
|
671 IMPORT_C CCoeControl* NativeControl(); |
|
672 |
|
673 /** |
|
674 * If there is a native window associated with the display (e.g., the |
|
675 * display is using a native window as a rendering surface), returns |
|
676 * a pointer to the window. |
|
677 * |
|
678 * @return Pointer to native window, or <code>NULL</code>. |
|
679 */ |
|
680 RDrawableWindow* NativeWindow(); |
|
681 |
|
682 /** |
|
683 * Returns the rendering surface of the display. |
|
684 */ |
|
685 IMPORT_C MHuiRenderSurface& RenderSurface() const; |
|
686 |
|
687 /** |
|
688 * Determines whether the display contains any dirty regions. Dirty |
|
689 * regions are areas of the display that have changed but the changes |
|
690 * are not yet visible on the screen. |
|
691 * |
|
692 * @return <code>ETrue</code>, if one or more dirty regions have been |
|
693 * defined. Otherwise <code>EFalse</code>. |
|
694 */ |
|
695 TBool IsDirty() const; |
|
696 |
|
697 /** |
|
698 * Defines a new dirty region that needs to be updated when the next |
|
699 * refresh cycle is triggered. Called by visuals when they are modified. |
|
700 * The dirty regions are stored within the CHuiDisplay class, and are used |
|
701 * to decide which visuals need to be redrawn during the next refresh. |
|
702 * |
|
703 * @param aDirtyRegion The area of the display that needs to be redrawn |
|
704 * in screen coordinates. |
|
705 */ |
|
706 void AddDirtyRegion(const TRect& aDirtyRegion); |
|
707 |
|
708 /** |
|
709 * Defines a new dirty region that needs to be updated when the next |
|
710 * refresh cycle is triggered. Combines given previous and current dirty regions. |
|
711 * Current dirty region is returned to the caller, before clipping and combining. |
|
712 * Called by visuals when they are modified. The dirty regions are stored within |
|
713 * the CHuiDisplay class, and are used to decide which visuals need to be redrawn |
|
714 * during the next refresh. |
|
715 * |
|
716 * @param aPrevDirtyRegion The previous dirty area. |
|
717 * @param aDirtyRegion The area of the display that needs to be redrawn |
|
718 * in screen coordinates. |
|
719 */ |
|
720 void CombineAndAddDirtyRegion(const TRect& aPrevDirtyRegion, TRect& aDirtyRegion); |
|
721 |
|
722 /** |
|
723 * Refresh the display. This is only meaningful if there are dirty |
|
724 * regions in the display. All dirty regions are cleared after the |
|
725 * refresh is complete. |
|
726 * |
|
727 * @return <code>ETrue</code>, if something was done that may lead to |
|
728 * visible changes on the display. <code>EFalse</code>, if there |
|
729 * was nothing to refresh. |
|
730 */ |
|
731 TBool Refresh(); |
|
732 |
|
733 /** |
|
734 * Returns the implementation of the roster. |
|
735 */ |
|
736 CHuiRosterImpl& RosterImpl() const; |
|
737 |
|
738 /** |
|
739 * Clear all change flags of visuals in the display's roster. |
|
740 */ |
|
741 void ClearChanged(); |
|
742 |
|
743 /** |
|
744 * Return the display intended usage. |
|
745 */ |
|
746 IMPORT_C TUint Usage() const; |
|
747 |
|
748 /** |
|
749 * Return the value of the S60 Platform specific unit. |
|
750 */ |
|
751 TReal32 UnitValue() const; |
|
752 |
|
753 /** |
|
754 * Returns the window transformation for the entire display. |
|
755 */ |
|
756 CHuiTransformation& WindowTransformation() const; |
|
757 |
|
758 /** |
|
759 * Returns ETrue if this display is for TV-out |
|
760 */ |
|
761 IMPORT_C TBool IsDisplayTypeTvOut() const; |
|
762 |
|
763 /** |
|
764 * Returns ETrue if this display is able to utilize transformations when calculating dirty areas. |
|
765 */ |
|
766 TBool UseTransformedDirtyRegions() const; |
|
767 |
|
768 /** |
|
769 * Returns EFalse if this display is already set dirty enough so that adding new dirty regions does |
|
770 * not make anymore diffenrence. |
|
771 */ |
|
772 TBool IsDirtyScanNeeded() const; |
|
773 |
|
774 /** |
|
775 * Rnd: returns the draw Visual outline flag value |
|
776 * |
|
777 * @return Visual outline setting. |
|
778 */ |
|
779 TUint DrawVisualOutline() const; |
|
780 |
|
781 /** |
|
782 * Sets texture which is drawn on top of the the frame. |
|
783 * Ownership is transferred to CHuiDisplay. |
|
784 */ |
|
785 IMPORT_C void SetForegroundTexture(CHuiTexture* aTexture); |
|
786 |
|
787 /** |
|
788 * Gets texture which is drawn on top of the the frame. |
|
789 */ |
|
790 IMPORT_C CHuiTexture* ForegroundTexture() const; |
|
791 |
|
792 /** |
|
793 * Sets bitmap which is drawn on top of the frame |
|
794 * (when used with @c SetForegroundTexture). |
|
795 * |
|
796 * This bitmap is modified before visuals are rendered; |
|
797 * dirty areas are cleared. Thus, the bitmap should |
|
798 * have alpha channel. |
|
799 * @param aBitmap foreground bitmap. |
|
800 */ |
|
801 IMPORT_C void SetForegroundBitmapL(CFbsBitmap* aBitmap); |
|
802 |
|
803 /** |
|
804 * Retuns foreground bitmap set in @c SetForegroundBitmapL. |
|
805 */ |
|
806 IMPORT_C CFbsBitmap* ForegroundBitmap() const; |
|
807 |
|
808 private: |
|
809 |
|
810 /** |
|
811 * Draws foreground texture. |
|
812 */ |
|
813 void DrawForegroundTexture(); |
|
814 |
|
815 /** |
|
816 * Returns ETrue if this displays renderer is BitGdi |
|
817 */ |
|
818 TBool IsRendererBitgdi() const; |
|
819 |
|
820 /** |
|
821 * Returns ETrue if this displays renderer is OpenGLES or OpenVG (even if those |
|
822 * are implemented using SW). Returns EFalse if the render is bitgdi. |
|
823 */ |
|
824 TBool IsRendererHWAccelerated() const; |
|
825 |
|
826 /** |
|
827 * Clips given dirty rect to the visible area. |
|
828 */ |
|
829 void ClipDirtyRect(TRect& aRect); |
|
830 |
|
831 void ClipDirtyRect(TRect& aRect, TRect aClippingRect); |
|
832 |
|
833 /** |
|
834 * Transforms given dirty rect. |
|
835 */ |
|
836 void TransformDirtyRect(TRect& aRect); |
|
837 |
|
838 void ClearWithColor(TRect aRect); |
|
839 void ClearWithSkinBackground(TRect aRect); |
|
840 void ClearWithBackgroundItems(TRect aRect); |
|
841 |
|
842 void BitgdiClearWithColor(TRect aRect); |
|
843 void BitgdiClearWithSkinBackground(TRect aRect); |
|
844 void BitgdiClearWithBackgroundItems(TRect aRect); |
|
845 |
|
846 void HWAcceleratedClearWithColor(TRect aRect); |
|
847 void HWAcceleratedClearWithSkinBackground(TRect aRect); |
|
848 void HWAcceleratedClearWithBackgroundItems(TRect aRect); |
|
849 |
|
850 TRect VisibleAreaClippingRect() const; |
|
851 TBool IsVisibleAreaClippingEnabled() const; |
|
852 |
|
853 public: // from MCoeMessageMonitorObserver |
|
854 |
|
855 void MonitorWsMessage(const TWsEvent& aEvent); |
|
856 |
|
857 protected: |
|
858 |
|
859 /* Types. */ |
|
860 |
|
861 /** Array of dirty region rectangles. */ |
|
862 typedef RArray<TRect> RDirtyRegions; |
|
863 |
|
864 |
|
865 /* Methods. */ |
|
866 |
|
867 /** |
|
868 * Add to a specific array. |
|
869 */ |
|
870 static void AddDirtyRegion(const TRect& aDirtyRegion, RDirtyRegions& aRegions, TBool aGrow = ETrue); |
|
871 |
|
872 |
|
873 private: |
|
874 |
|
875 /** The environment that manages this display. */ |
|
876 CHuiEnv& iEnv; |
|
877 |
|
878 /** The display type. */ |
|
879 TInt iDisplayType; |
|
880 |
|
881 /** Pointer to the native window of this display (if any). */ |
|
882 CCoeControl* iNativeControl; |
|
883 |
|
884 /** Size of the display. */ |
|
885 TSize iSize; |
|
886 |
|
887 /** Rendering surface of the display. */ |
|
888 MHuiRenderSurface* iRenderSurface; |
|
889 |
|
890 /** Graphics context for drawing. */ |
|
891 CHuiGc* iGc; |
|
892 |
|
893 /** Transformation for the entire display. */ |
|
894 CHuiTransformation* iTransform; |
|
895 |
|
896 /** Control roster of the display. */ |
|
897 RHuiOwnedPointer<CHuiRoster> iRoster; |
|
898 |
|
899 /** Flag that tells whether the display should currently be refreshed. */ |
|
900 TBool iActive; |
|
901 |
|
902 /** Determines if depth testing can be used during rendering. */ |
|
903 TBool iUseDepth; |
|
904 |
|
905 /** Determines if the background should be cleared before drawing. */ |
|
906 TInt iClearBackground; |
|
907 |
|
908 /** Background color for the display, if clearing enabled. */ |
|
909 TRgb iBackgroundColor; |
|
910 |
|
911 /** If true, updates the renderer state before the next frame is drawn. |
|
912 Normally it is assumed that it is necessary to set the state only |
|
913 once. */ |
|
914 TBool iUpdateRenderState; |
|
915 |
|
916 |
|
917 /** @todo The dirty tracker should support both frame copying and swapping. */ |
|
918 /** Is ETrue if the screen was dirtied at all in the last update.*/ |
|
919 TBool iGotDirtyReports; |
|
920 |
|
921 /** |
|
922 * Array of all the dirty regions of the display. |
|
923 * This is flipped with iDirtyRegions2 every other frame. |
|
924 */ |
|
925 RDirtyRegions iDirtyRegions; |
|
926 |
|
927 /** |
|
928 * Secondary array of all the dirty regions of the display. |
|
929 * This is flipped with iDirtyRegions every other frame. |
|
930 */ |
|
931 RDirtyRegions iDirtyRegions2; |
|
932 |
|
933 /** Points to either iDirtyRegions or iDirtyRegions2. */ |
|
934 RDirtyRegions* iCurrentDirtyRegions; |
|
935 |
|
936 /** Points to either iDirtyRegions or iDirtyRegions2. */ |
|
937 RDirtyRegions* iPreviousDirtyRegions; |
|
938 |
|
939 /** Info how display is used */ |
|
940 TInt iUsageHint; |
|
941 |
|
942 /** Determines whether this display is on the foreground in the system or not. */ |
|
943 TBool iOnForeground; |
|
944 |
|
945 public: |
|
946 |
|
947 /* Public properties. */ |
|
948 |
|
949 /** Observers notified before a refresh begins. */ |
|
950 RHuiObserverArray<MHuiDisplayRefreshObserver> iRefreshObservers; |
|
951 |
|
952 /** Observers notified before display deleted. */ |
|
953 RHuiObserverArray<MHuiDisplayDeletionObserver> iDeletionObservers; |
|
954 |
|
955 /** Observers notified after display visible area changed. */ |
|
956 RHuiObserverArray<MHuiDisplayVisibleAreaObserver> iVisibleAreaObservers; |
|
957 |
|
958 /** Observers notified before a roster draw begins and ends. */ |
|
959 RHuiObserverArray<MHuiRosterObserver> iRosterObservers; |
|
960 |
|
961 private: |
|
962 |
|
963 /** Screen buffer uid */ |
|
964 TUid iScreenBufferUid; |
|
965 |
|
966 /** Screen buffer lock */ |
|
967 TBool iIsScreenBufferLocked; |
|
968 |
|
969 /** Screen buffer observer */ |
|
970 MHuiScreenBufferObserver* iScreenBufferObserver; |
|
971 |
|
972 /** Transformation for the entire display. */ |
|
973 CHuiTransformation* iWindowTransform; |
|
974 |
|
975 /** Is ETrue if the screen was reported as fully dirtied in the last update */ |
|
976 TBool iWholeDisplayAreaIsDirty; |
|
977 |
|
978 /** Is ETrue if dirty regions are transformed */ |
|
979 TBool iUseTransformedDirtyRegions; |
|
980 |
|
981 // RnD |
|
982 TBool iDrawDirtyRegions; |
|
983 TUint iDrawVisualOutline; |
|
984 |
|
985 RArray<THuiDisplayBackgroundItem> iBackgroundItems; |
|
986 |
|
987 TRect iVisibleAreaClippingRect; |
|
988 RWindow* iNativeWindow; // Not owned |
|
989 |
|
990 /** Texture which is draw on top of the roster */ |
|
991 CHuiTexture* iForegroundTexture; |
|
992 |
|
993 /** Foreground bitmap */ |
|
994 CFbsBitmap* iForegroundBitmap; |
|
995 /** Device for foreground bitmap */ |
|
996 CFbsBitmapDevice* iForegroundBitmapDevice; |
|
997 /** Graphics context for foreground bitmap */ |
|
998 CFbsBitGc* iForegroundBitmapGc; |
|
999 }; |
|
1000 |
|
1001 #endif // __HUIDISPLAY_H__ |