os/mm/mmplugins/mmfwplugins/src/Plugin/subtitle/subtitlegraphicdrawer/mmfsubtitlegraphicdrawer.h
Update contrib.
1 // Copyright (c) 2008-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.
21 #ifndef MMFSUBTITLEGRAPHICDRAWER_H
22 #define MMFSUBTITLEGRAPHICDRAWER_H
25 #include <graphics/wsgraphicdrawer.h>
26 #include <graphics/wsgraphicdrawerinterface.h>
28 #include "mmfsubtitlegraphicmessage.h"
31 * Forward declarations
33 class TSubtitleGraphicState;
36 Defines the MMF subtitle graphic drawer CRP component. Used to display subtitles
39 NONSHARABLE_CLASS(CMMFSubtitleGraphicDrawer): public CWsGraphicDrawer
42 enum {EImplUid = 0x10285C9C};
45 virtual ~CMMFSubtitleGraphicDrawer();
46 static CMMFSubtitleGraphicDrawer* NewL();
48 // From CwsGraphicDrawer
49 void ConstructL(MWsGraphicDrawerEnvironment& aEnv,const TGraphicDrawerId& aId, MWsClient& aOwner, const TDesC8& aData);
50 virtual void HandleMessage(const TDesC8& aData);
51 virtual void DoDraw(MWsGc& aGc, const TRect& aRect, const TDesC8& aData) const;
55 void ProcessMessageInit(TSubtitleCrpMsgInit& aMessage);
56 void ProcessMessageDrawFrame(TSubtitleCrpMsgDrawFrame& aMessage);
57 void ProcessMessageSwapFrame(TSubtitleCrpMsgRenderSwapFrame& aMessage);
58 void DoBitBlt(MWsGc& aGc, const TRect& aRect) const;
61 enum TSubtitleGraphicState
63 ESubtitleGraphicStateWaiting = 0,
64 ESubtitleGraphicStateInit = 10,
65 ESubtitleGraphicStateInitSimple = 20,
66 ESubtitleGraphicStateDrawFrame = 30,
67 ESubtitleGraphicStateRefreshContent = 40,
68 ESubtitleGraphicStateSwapFrame = 50,
69 ESubtitleGraphicStateClear = 60
72 enum TSubtitleGraphicFrame
74 ESubtitleGraphicFrame1 = 1,
75 ESubtitleGraphicFrame2 = 2,
76 ESubtitleGraphicFrame3 = 3
81 Handles to subtitle frames.
82 Used for double-buffered rendering approach
83 @see CWsInterleaveGraphicDrawer::ProcessMessageInit()
89 Used to store one-off subtitle rendering requests
90 @see CWsInterleaveGraphicDrawer::ProcessMessageDrawFrame()
92 CFbsBitmap* iTempBitmap;
95 Status of current bitmap handles. Stored here for effeciency as they are
96 checked every DoDraw() call.
100 TBool iTempBitmapValid;
104 Indicates the current frame. This is the buffer that will be drawn
105 on the next call to @see SwapFrame() or when WServ invalidates a sub-portion
107 ESubtitleGraphicFrame1: @see iBitmapHandle1
108 ESubtitleGraphicFrame2: @see iBitmapHandle2
109 ESubtitleGraphicFrame3: @see iTempBitmapHandle
111 TSubtitleGraphicFrame iCurrentFrame;
114 Indicates the region of the current bitmap that contains new image data
119 Stores the previous frames dirty region.
121 TRect iOldDirtyRegion;
124 The current CRP region stored on the first call to DoDraw()
126 mutable TRect iSubtitleRegion;
129 Indicates how long the current frame should be displayed for
131 TTimeIntervalMicroSeconds iDisplayDuration;
134 Indicates the system time that the current frame expires. Calculated
135 from the current system time and the display duration given on a
136 ESubtitleGraphicStateDrawFrame/ESubtitleGraphicStateSwapFrame frame message.
138 mutable TTime iDisplayClearDue;
141 The current CRP state
143 mutable TSubtitleGraphicState iState;
145 mutable TBool iCaptureRegion;