os/mm/mmplugins/mmfwplugins/src/Plugin/subtitle/subtitlegraphicdrawer/mmfsubtitlegraphicdrawer.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmplugins/mmfwplugins/src/Plugin/subtitle/subtitlegraphicdrawer/mmfsubtitlegraphicdrawer.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,148 @@
     1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +/**
    1.20 + @file
    1.21 + @internalComponent
    1.22 +*/
    1.23 +
    1.24 +#ifndef MMFSUBTITLEGRAPHICDRAWER_H
    1.25 +#define MMFSUBTITLEGRAPHICDRAWER_H
    1.26 +  
    1.27 +#include <bitstd.h>
    1.28 +#include <graphics/wsgraphicdrawer.h>
    1.29 +#include <graphics/wsgraphicdrawerinterface.h>
    1.30 +
    1.31 +#include "mmfsubtitlegraphicmessage.h"
    1.32 +
    1.33 +/**
    1.34 + * Forward declarations
    1.35 + */
    1.36 +class TSubtitleGraphicState;
    1.37 +
    1.38 +/** 
    1.39 +Defines the MMF subtitle graphic drawer CRP component.  Used to display subtitles 
    1.40 +over video content.  
    1.41 +*/
    1.42 +NONSHARABLE_CLASS(CMMFSubtitleGraphicDrawer): public CWsGraphicDrawer
    1.43 +    {  
    1.44 +public:
    1.45 +    enum {EImplUid = 0x10285C9C};
    1.46 +                
    1.47 +public:
    1.48 +	virtual ~CMMFSubtitleGraphicDrawer();
    1.49 +    static CMMFSubtitleGraphicDrawer* NewL();
    1.50 +   
    1.51 +	// From CwsGraphicDrawer
    1.52 +    void ConstructL(MWsGraphicDrawerEnvironment& aEnv,const TGraphicDrawerId& aId, MWsClient& aOwner, const TDesC8& aData);
    1.53 +    virtual void HandleMessage(const TDesC8& aData);
    1.54 +    virtual void DoDraw(MWsGc& aGc, const TRect& aRect, const TDesC8& aData) const;
    1.55 +
    1.56 +private:
    1.57 +	// Message handling..
    1.58 +	void ProcessMessageInit(TSubtitleCrpMsgInit& aMessage);
    1.59 +	void ProcessMessageDrawFrame(TSubtitleCrpMsgDrawFrame& aMessage);
    1.60 +	void ProcessMessageSwapFrame(TSubtitleCrpMsgRenderSwapFrame& aMessage);
    1.61 +	void DoBitBlt(MWsGc& aGc, const TRect& aRect) const;
    1.62 +	
    1.63 +private:
    1.64 +    enum TSubtitleGraphicState
    1.65 +		{
    1.66 +		ESubtitleGraphicStateWaiting    			= 0,
    1.67 +		ESubtitleGraphicStateInit 					= 10,
    1.68 +		ESubtitleGraphicStateInitSimple 			= 20,
    1.69 +		ESubtitleGraphicStateDrawFrame 				= 30,
    1.70 +		ESubtitleGraphicStateRefreshContent			= 40,
    1.71 +		ESubtitleGraphicStateSwapFrame 				= 50,
    1.72 +		ESubtitleGraphicStateClear					= 60
    1.73 +		};
    1.74 +		
    1.75 +	enum TSubtitleGraphicFrame
    1.76 +		{
    1.77 +		ESubtitleGraphicFrame1 = 1,
    1.78 +		ESubtitleGraphicFrame2 = 2,
    1.79 +		ESubtitleGraphicFrame3 = 3
    1.80 +		};
    1.81 +      
    1.82 +private:
    1.83 +	/**
    1.84 +	Handles to subtitle frames.
    1.85 +	Used for double-buffered rendering approach 
    1.86 +	@see CWsInterleaveGraphicDrawer::ProcessMessageInit()
    1.87 +	*/
    1.88 +    CFbsBitmap* iBitmap1;
    1.89 +    CFbsBitmap* iBitmap2; 
    1.90 +    
    1.91 +    /**
    1.92 +    Used to store one-off subtitle rendering requests
    1.93 +    @see CWsInterleaveGraphicDrawer::ProcessMessageDrawFrame()
    1.94 +    */
    1.95 +    CFbsBitmap* iTempBitmap;
    1.96 +    
    1.97 +    /**
    1.98 +    Status of current bitmap handles.  Stored here for effeciency as they are 
    1.99 +    checked every DoDraw() call.
   1.100 +    */
   1.101 +    TBool iBitmap1Valid;
   1.102 +    TBool iBitmap2Valid;
   1.103 +    TBool iTempBitmapValid;
   1.104 +    
   1.105 +   
   1.106 +    /**
   1.107 +    Indicates the current frame.  This is the buffer that will be drawn
   1.108 +    on the next call to @see SwapFrame() or when WServ invalidates a sub-portion
   1.109 +    of the screen
   1.110 +    ESubtitleGraphicFrame1: @see iBitmapHandle1
   1.111 +    ESubtitleGraphicFrame2: @see iBitmapHandle2
   1.112 +    ESubtitleGraphicFrame3: @see iTempBitmapHandle
   1.113 +    */
   1.114 +    TSubtitleGraphicFrame iCurrentFrame;
   1.115 +    	
   1.116 +	/**
   1.117 +	Indicates the region of the current bitmap that contains new image data
   1.118 +	*/
   1.119 +	TRect iDirtyRegion;
   1.120 +	
   1.121 +	/**
   1.122 +	Stores the previous frames dirty region. 
   1.123 +	*/
   1.124 +	TRect iOldDirtyRegion;
   1.125 +	
   1.126 +	/**
   1.127 +	The current CRP region stored on the first call to DoDraw()
   1.128 +	*/
   1.129 +	mutable TRect iSubtitleRegion;
   1.130 +	
   1.131 +	/**
   1.132 +	Indicates how long the current frame should be displayed for
   1.133 +	*/
   1.134 +	TTimeIntervalMicroSeconds iDisplayDuration;
   1.135 +	
   1.136 +	/**
   1.137 +	Indicates the system time that the current frame expires.   Calculated
   1.138 +	from the current system time and the display duration given on a 
   1.139 +	ESubtitleGraphicStateDrawFrame/ESubtitleGraphicStateSwapFrame frame message.
   1.140 +	*/
   1.141 +	mutable TTime iDisplayClearDue;
   1.142 +	
   1.143 +	/**
   1.144 +	The current CRP state
   1.145 +	*/
   1.146 +	mutable TSubtitleGraphicState iState;
   1.147 +	
   1.148 +	mutable TBool iCaptureRegion;
   1.149 +};
   1.150 +
   1.151 +#endif