os/mm/mmplugins/mmfwplugins/src/Plugin/subtitle/subtitlegraphicdrawer/mmfsubtitlegraphicdrawer.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
/**
sl@0
    17
 @file
sl@0
    18
 @internalComponent
sl@0
    19
*/
sl@0
    20
sl@0
    21
#ifndef MMFSUBTITLEGRAPHICDRAWER_H
sl@0
    22
#define MMFSUBTITLEGRAPHICDRAWER_H
sl@0
    23
  
sl@0
    24
#include <bitstd.h>
sl@0
    25
#include <graphics/wsgraphicdrawer.h>
sl@0
    26
#include <graphics/wsgraphicdrawerinterface.h>
sl@0
    27
sl@0
    28
#include "mmfsubtitlegraphicmessage.h"
sl@0
    29
sl@0
    30
/**
sl@0
    31
 * Forward declarations
sl@0
    32
 */
sl@0
    33
class TSubtitleGraphicState;
sl@0
    34
sl@0
    35
/** 
sl@0
    36
Defines the MMF subtitle graphic drawer CRP component.  Used to display subtitles 
sl@0
    37
over video content.  
sl@0
    38
*/
sl@0
    39
NONSHARABLE_CLASS(CMMFSubtitleGraphicDrawer): public CWsGraphicDrawer
sl@0
    40
    {  
sl@0
    41
public:
sl@0
    42
    enum {EImplUid = 0x10285C9C};
sl@0
    43
                
sl@0
    44
public:
sl@0
    45
	virtual ~CMMFSubtitleGraphicDrawer();
sl@0
    46
    static CMMFSubtitleGraphicDrawer* NewL();
sl@0
    47
   
sl@0
    48
	// From CwsGraphicDrawer
sl@0
    49
    void ConstructL(MWsGraphicDrawerEnvironment& aEnv,const TGraphicDrawerId& aId, MWsClient& aOwner, const TDesC8& aData);
sl@0
    50
    virtual void HandleMessage(const TDesC8& aData);
sl@0
    51
    virtual void DoDraw(MWsGc& aGc, const TRect& aRect, const TDesC8& aData) const;
sl@0
    52
sl@0
    53
private:
sl@0
    54
	// Message handling..
sl@0
    55
	void ProcessMessageInit(TSubtitleCrpMsgInit& aMessage);
sl@0
    56
	void ProcessMessageDrawFrame(TSubtitleCrpMsgDrawFrame& aMessage);
sl@0
    57
	void ProcessMessageSwapFrame(TSubtitleCrpMsgRenderSwapFrame& aMessage);
sl@0
    58
	void DoBitBlt(MWsGc& aGc, const TRect& aRect) const;
sl@0
    59
	
sl@0
    60
private:
sl@0
    61
    enum TSubtitleGraphicState
sl@0
    62
		{
sl@0
    63
		ESubtitleGraphicStateWaiting    			= 0,
sl@0
    64
		ESubtitleGraphicStateInit 					= 10,
sl@0
    65
		ESubtitleGraphicStateInitSimple 			= 20,
sl@0
    66
		ESubtitleGraphicStateDrawFrame 				= 30,
sl@0
    67
		ESubtitleGraphicStateRefreshContent			= 40,
sl@0
    68
		ESubtitleGraphicStateSwapFrame 				= 50,
sl@0
    69
		ESubtitleGraphicStateClear					= 60
sl@0
    70
		};
sl@0
    71
		
sl@0
    72
	enum TSubtitleGraphicFrame
sl@0
    73
		{
sl@0
    74
		ESubtitleGraphicFrame1 = 1,
sl@0
    75
		ESubtitleGraphicFrame2 = 2,
sl@0
    76
		ESubtitleGraphicFrame3 = 3
sl@0
    77
		};
sl@0
    78
      
sl@0
    79
private:
sl@0
    80
	/**
sl@0
    81
	Handles to subtitle frames.
sl@0
    82
	Used for double-buffered rendering approach 
sl@0
    83
	@see CWsInterleaveGraphicDrawer::ProcessMessageInit()
sl@0
    84
	*/
sl@0
    85
    CFbsBitmap* iBitmap1;
sl@0
    86
    CFbsBitmap* iBitmap2; 
sl@0
    87
    
sl@0
    88
    /**
sl@0
    89
    Used to store one-off subtitle rendering requests
sl@0
    90
    @see CWsInterleaveGraphicDrawer::ProcessMessageDrawFrame()
sl@0
    91
    */
sl@0
    92
    CFbsBitmap* iTempBitmap;
sl@0
    93
    
sl@0
    94
    /**
sl@0
    95
    Status of current bitmap handles.  Stored here for effeciency as they are 
sl@0
    96
    checked every DoDraw() call.
sl@0
    97
    */
sl@0
    98
    TBool iBitmap1Valid;
sl@0
    99
    TBool iBitmap2Valid;
sl@0
   100
    TBool iTempBitmapValid;
sl@0
   101
    
sl@0
   102
   
sl@0
   103
    /**
sl@0
   104
    Indicates the current frame.  This is the buffer that will be drawn
sl@0
   105
    on the next call to @see SwapFrame() or when WServ invalidates a sub-portion
sl@0
   106
    of the screen
sl@0
   107
    ESubtitleGraphicFrame1: @see iBitmapHandle1
sl@0
   108
    ESubtitleGraphicFrame2: @see iBitmapHandle2
sl@0
   109
    ESubtitleGraphicFrame3: @see iTempBitmapHandle
sl@0
   110
    */
sl@0
   111
    TSubtitleGraphicFrame iCurrentFrame;
sl@0
   112
    	
sl@0
   113
	/**
sl@0
   114
	Indicates the region of the current bitmap that contains new image data
sl@0
   115
	*/
sl@0
   116
	TRect iDirtyRegion;
sl@0
   117
	
sl@0
   118
	/**
sl@0
   119
	Stores the previous frames dirty region. 
sl@0
   120
	*/
sl@0
   121
	TRect iOldDirtyRegion;
sl@0
   122
	
sl@0
   123
	/**
sl@0
   124
	The current CRP region stored on the first call to DoDraw()
sl@0
   125
	*/
sl@0
   126
	mutable TRect iSubtitleRegion;
sl@0
   127
	
sl@0
   128
	/**
sl@0
   129
	Indicates how long the current frame should be displayed for
sl@0
   130
	*/
sl@0
   131
	TTimeIntervalMicroSeconds iDisplayDuration;
sl@0
   132
	
sl@0
   133
	/**
sl@0
   134
	Indicates the system time that the current frame expires.   Calculated
sl@0
   135
	from the current system time and the display duration given on a 
sl@0
   136
	ESubtitleGraphicStateDrawFrame/ESubtitleGraphicStateSwapFrame frame message.
sl@0
   137
	*/
sl@0
   138
	mutable TTime iDisplayClearDue;
sl@0
   139
	
sl@0
   140
	/**
sl@0
   141
	The current CRP state
sl@0
   142
	*/
sl@0
   143
	mutable TSubtitleGraphicState iState;
sl@0
   144
	
sl@0
   145
	mutable TBool iCaptureRegion;
sl@0
   146
};
sl@0
   147
sl@0
   148
#endif