First public contribution.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
18 #ifndef __SCREEN_REDRAW_H__
19 #define __SCREEN_REDRAW_H__
26 #include <graphics/WSGRAPHICDRAWERINTERFACE.H>
27 #include "graphics/wsgraphicdrawerinternal.h"
31 class TWalkWindowTreeSchedule;
33 //#define USE_DEBUG_REGIONS
36 The CScreenRedraw maintains the areas of the screen which need to be updated, and handles some of the
37 scheduling of draw code to do so. It has a close relationship with the animation scheduler, which
38 by default will be the CDefaultAnimationScheduler in server.cpp
40 class CScreenRedraw : public CBase, public MWsScreenRedraw, public MWsWindowVisibilityObserver
43 static CScreenRedraw * NewL(CScreen& aScreen);
44 virtual ~CScreenRedraw();
45 const TTime& Now() const;
46 void ScheduleRegionUpdate(const TRegion* aDefinitelyDirty);
48 void ScheduleRedraw();
49 void ScheduleAnimation(TAnimType aType, const TRect& aRect,const TTimeIntervalMicroSeconds& aFromNow,const TTimeIntervalMicroSeconds& aFreq,const TTimeIntervalMicroSeconds& aStop, CWsWindow* aWindow);
50 TBool IsScheduled(TAnimType aType, const TRect& aRect, CWsWindow* aWindow) const;
51 void OnAnimation(TRequestStatus* aFinished);
52 void AddRedrawRegion(const TRegion& aRegion, TBool aSchedule = ETrue, TRedrawDepth aDepth = ERedrawAll);
54 void DiscardAllSchedules();
55 void ScheduleRender(const TTimeIntervalMicroSeconds& aFromNow);
56 void ScheduleWindow(CWsWindow* aWindow);
57 void RemoveFromScheduledList(CWsWindow* aWindow);
58 void RemoveFromTimedDrawList(CWsWindow* aWindow);
59 void ScheduleQuickFade( CWsWindow* aWin );
60 void RemoveFromQuickFadeList( CWsWindow* aWin );
61 TBool IsQuickFadeScheduled( CWsWindow* aWin ) const;
62 void AcceptFadeRequest( CWsWindow* aWin, TBool aFadeOn);
63 inline TBool IsAnimating() const { return iAnimating; }
64 public: // Implementing MWsScreenRedraw
65 void SetObserver(MWsScreenRedrawObserver* aObserver);
66 TBool IsUpdatePending();
67 const TRegion * AnimationRegion() const;
70 public: // Implementing MWsObjectProvider
71 TAny * ResolveObjectInterface(TUint aTypeId);
73 public: // Implementing MWsWindowVisibilityObserver
74 void VisibilityChanged();
75 void SetWindowVisibility(const MWsWindow& aWindow, const TRegion& aVisibleRegion);
78 MWsTextCursor* RenderStageTextCursor() const;
81 CScreenRedraw(CScreen& aScreen);
83 void AddQuickFadeableRegions(TRegion& aRegion);
84 void DoQuickFade(MWsGraphicsContext* aGc, TRegion& aAccumulatedDrawing);
85 TBool ScheduleTimedRects(TRegion& aScheduledFloatingSpriteRegion);
86 void Render(CWsWindow& aWin, MWsGraphicsContext& aGc, const TWalkWindowTreeSchedule& aScheduler);
87 void OomRender(CWsWindow& aWin, MWsGraphicsContext& aGc, const TWalkWindowTreeSchedule& aScheduler);
88 #ifdef USE_DEBUG_REGIONS
89 void DebugRect(TRgb aColor, TRgb aFill, const TRect * aRect);
90 void DebugRegion(TRgb aColor, TRgb aFill, const TRegion * aRegion);
92 #ifdef USE_DEBUG_FRAME_CAPTURE
93 void CaptureFrame(const TRegion* aRegion);
94 void SetupFrameCaptureResourcesL(const TSize& aScreenSize, TDisplayMode aScreenDisplayMode);
95 void LogRegion(const TDesC& aPrefix, const TDesC& aFunctionName, const TRegion* aRegion);
101 TTimedRect(TAnimType aType, const TRect& aRect, const TTime& aTime, CWsWindow* aWindow);
106 static TInt Compare(const TTimedRect& aOne,const TTimedRect& aOther);
115 TBool iRegionUpdateScheduled;
116 TBool iRenderScheduled;
117 RArray<TTimedRect> iTimedDrawRect;
118 RWsRegionBuf<20> iInvalid; // Region that needs to be redrawn (eg window contents changed).
119 RWsRegionBuf<20> iTopElement; // Region that we need to draw, but don't need to redraw (eg new window)
120 const TRegion * iAnimationRegion; // Region being redrawn during animation
121 MWsScreenRedrawObserver* iObserver;
122 CWsRenderStage * iRenderStages;
123 MWsTextCursor* iRenderStageTextCursor;
124 CWsWindow* iScheduledWindowList; // Linked list of scheduled windows (only used in DirtyWindowTracking mode)
125 TBool iVisibilityUpdateScheduled;
126 RPointerArray<CWsWindow> iQuickFadeList;
127 #ifdef USE_DEBUG_FRAME_CAPTURE
129 TPtrC iFrameCaptureLocation;
130 CFbsBitmap* iDebugBitmap;
131 CFbsBitmapDevice* iDebugBitmapDevice;
132 CFbsBitGc* iDebugBitmapGc;
133 #endif //USE_DEBUG_FRAME_CAPTURE
136 #endif //__SCREEN_REDRAW_H__