|
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 // SCREEN_REDRAW.H |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __SCREEN_REDRAW_H__ |
|
19 #define __SCREEN_REDRAW_H__ |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <e32std.h> |
|
23 #include <gdi.h> |
|
24 #include "wstypes.h" |
|
25 #include <Graphics/WSGRAPHICDRAWERINTERFACE.H> |
|
26 |
|
27 class CScreen; |
|
28 class CWsRenderStage; |
|
29 class CWsWindow; |
|
30 |
|
31 //#define USE_DEBUG_REGIONS |
|
32 |
|
33 /** |
|
34 The CScreenRedraw maintains the areas of the screen which need to be updated, and handles some of the |
|
35 scheduling of draw code to do so. It has a close relationship with the animation scheduler, which |
|
36 by default will be the CDefaultAnimationScheduler in server.cpp |
|
37 */ |
|
38 class CScreenRedraw : public CBase, public MWsScreenRedraw |
|
39 { |
|
40 public: |
|
41 static CScreenRedraw * NewL(CScreen& aScreen); |
|
42 virtual ~CScreenRedraw(); |
|
43 const TTime& Now() const; |
|
44 void ScheduleRegionUpdate(const TRegion* aDefinitelyDirty); |
|
45 void RegionUpdate(); |
|
46 void ScheduleRedraw(); |
|
47 void ScheduleAnimation(const TRect& aRect,const TTimeIntervalMicroSeconds& aFromNow,const TTimeIntervalMicroSeconds& aFreq,const TTimeIntervalMicroSeconds& aStop); |
|
48 void OnAnimation(); |
|
49 void AddRedrawRegion(const TRegion& aRegion, TBool aSchedule = ETrue, TRedrawDepth aDepth = ERedrawAll); |
|
50 void DoRedrawNow(); |
|
51 void DiscardAllSchedules(); |
|
52 void ScheduleRender(const TTimeIntervalMicroSeconds& aFromNow); |
|
53 void ScheduleWinFadeNoRedraw( CWsWindow* aWin ); |
|
54 void AcceptFadeRequest( CWsWindow* aWin, TBool aIsFaded, TBool aIsBehind, TBool aIncludeChildren = EFalse ); |
|
55 |
|
56 public: // Implementing MWsScreenRedraw |
|
57 void SetObserver(MWsScreenRedrawObserver* aObserver); |
|
58 TBool IsUpdatePending(); |
|
59 const TRegion * AnimationRegion() const; |
|
60 void UpdateDevice(); |
|
61 |
|
62 public: // Implementing MWsObjectProvider |
|
63 TAny * ResolveObjectInterface(TUint aTypeId); |
|
64 |
|
65 void BanThisRegionUpdate( TRegion& aForbiddenRegion ); |
|
66 void LiftRegionUpdateBan( TRegion& aFormerForbiddenRegion ); |
|
67 |
|
68 private: |
|
69 CScreenRedraw(CScreen& aScreen); |
|
70 void ConstructL(); |
|
71 # ifdef USE_DEBUG_REGIONS |
|
72 void DebugRect(TRgb aColor, TRgb aFill, const TRect * aRect); |
|
73 void DebugRegion(TRgb aColor, TRgb aFill, const TRegion * aRegion); |
|
74 # endif |
|
75 |
|
76 private: |
|
77 struct TTimedRect |
|
78 { |
|
79 TTimedRect(const TRect& aRect, const TTime& aTime); |
|
80 TRect iRect; |
|
81 TTime iTime; |
|
82 static TInt Compare(const TTimedRect& aOne,const TTimedRect& aOther); |
|
83 }; |
|
84 |
|
85 private: |
|
86 CScreen& iScreen; |
|
87 mutable TTime iNow; |
|
88 mutable TTime iNext; |
|
89 TBool iScheduled; |
|
90 TBool iAnimating; |
|
91 TBool iRegionUpdateScheduled; |
|
92 TBool iRenderScheduled; |
|
93 RArray<TTimedRect> iTimedDrawRect; |
|
94 RRegionBuf<20> iInvalid; // Region that needs to be redrawn (eg window contents changed). |
|
95 RRegionBuf<20> iTopLayer; // Region that we need to draw, but don't need to redraw (eg new window) |
|
96 const TRegion * iAnimationRegion; // Region being redrawn during animation |
|
97 MWsScreenRedrawObserver* iObserver; |
|
98 CWsRenderStage * iRenderStages; |
|
99 RRegion iBannedRegion; |
|
100 }; |
|
101 |
|
102 #endif //__SCREEN_REDRAW_H__ |