photosgallery/viewframework/tvout/inc/glxhdmisurfaceupdater.h
branchRCL_3
changeset 25 191387a8b767
parent 22 2dac0fdba72b
child 35 420f6808bf21
equal deleted inserted replaced
22:2dac0fdba72b 25:191387a8b767
    23 // GCE Surface
    23 // GCE Surface
    24 #include "graphics/surfacemanager.h"
    24 #include "graphics/surfacemanager.h"
    25 #include "graphics/surface.h"
    25 #include "graphics/surface.h"
    26 #include "graphics/surfaceupdateclient.h"
    26 #include "graphics/surfaceupdateclient.h"
    27 #include <graphics/surfaceconfiguration.h>
    27 #include <graphics/surfaceconfiguration.h>
       
    28 
       
    29 // forward decleration
    28 class CGlxActiveCallBack;
    30 class CGlxActiveCallBack;
    29 class CGlxHdmiDecoderAO;
    31 class CGlxHdmiDecoderAO;
    30 class CImageDecoder;
    32 class CImageDecoder;
    31 class TSurfaceConfiguration;
    33 class TSurfaceConfiguration;
    32 class MGlxGenCallback
    34 class MGlxGenCallback
    37 
    39 
    38 class CGlxHdmiSurfaceUpdater: public CBase
    40 class CGlxHdmiSurfaceUpdater: public CBase
    39     {
    41     {
    40 public:
    42 public:
    41     /*
    43     /*
    42      * 
    44      * NewL
    43      */
    45      */
    44     static CGlxHdmiSurfaceUpdater* NewL(RWindow* aWindow, const TDesC& aImageFile, 
    46     static CGlxHdmiSurfaceUpdater* NewL(RWindow* aWindow, const TDesC& aImageFile, 
    45                                          MGlxGenCallback* aCallBack);
    47             CFbsBitmap* aFsBitmap, MGlxGenCallback* aCallBack);
       
    48 
       
    49     /*
       
    50      * Destructor
       
    51      */
       
    52     ~CGlxHdmiSurfaceUpdater();
       
    53 
       
    54 public:
       
    55     /*
       
    56      * This is to cancel the active object from decoding 
       
    57      */
       
    58     void HandleRunL(TRequestStatus& aStatus);
       
    59 
       
    60     /*
       
    61      * This updates the new image.
       
    62      */
       
    63     void UpdateNewImageL(const TDesC& aImageFile,CFbsBitmap* aFsBitmap);
       
    64 
       
    65     /*
       
    66      * Activate Zoom 
       
    67      */
       
    68     void ActivateZoom(TBool aAutoZoomOut);
       
    69     /*
       
    70      * Deactivate Zoom 
       
    71      */
       
    72     void DeactivateZoom();
       
    73     /*
       
    74      * Zoom in our out depending on parameter 
       
    75      */
       
    76     void Zoom(TBool aZoom);
       
    77 
       
    78     /*
       
    79 	ShiftToCloningMOde
       
    80      */
       
    81     void ShiftToCloningMode();
       
    82 
       
    83     /*
       
    84 	ShiftToPostingMode
       
    85      */
       
    86     void ShiftToPostingMode();
       
    87 
       
    88 private:
       
    89     /*
       
    90      * Constructor 
       
    91      */
       
    92     CGlxHdmiSurfaceUpdater(RWindow* aWindow, MGlxGenCallback* aCallBack);
       
    93 
       
    94     /*
       
    95      * ConstructL()
       
    96      */
       
    97     void ConstructL(CFbsBitmap* aFsBitmap,const TDesC& aImageFile);   
       
    98 
       
    99     /*
       
   100      * Create a New surface with given size
       
   101      */
       
   102     void CreateSurfaceL();
       
   103     /*
       
   104      * @param1 size 
       
   105      */
       
   106     void MapSurfaceL();
       
   107 
       
   108     /*
       
   109      * This fundtion wont be called , could be used if double buffering is planned in future
       
   110      * to start the second decoder AO and update the surface with a new session. 
       
   111      */
       
   112     static TInt SurfBuffer0Ready(TAny* aObject);    
    46     
   113     
    47     /*
   114     /*
    48      * destructor
       
    49      */
       
    50     ~CGlxHdmiSurfaceUpdater();
       
    51     
       
    52 public:
       
    53     /*
       
    54      * This is to cancel the active object from decoding 
       
    55      */
       
    56     void HandleRunL(TRequestStatus& aStatus);
       
    57 
       
    58     /*
       
    59      * This updates the new image.
       
    60      */
       
    61     void UpdateNewImageL(const TDesC& aImageFile);
       
    62     
       
    63     /*
       
    64      * Activate Zoom 
       
    65      */
       
    66     void ActivateZoom(TBool aAutoZoomOut);
       
    67     /*
       
    68     * Deactivate Zoom 
       
    69     */
       
    70     void DeactivateZoom();
       
    71     /*
       
    72      * Zoom in our out depending on parameter 
       
    73      */
       
    74     void Zoom(TBool aZoom);
       
    75 	
       
    76 	/*
       
    77 	ShiftToCloningMOde
       
    78 	*/
       
    79 	void ShiftToCloningMode();
       
    80 	
       
    81 	/*
       
    82 	ShiftToPostingMode
       
    83 	*/
       
    84 	void ShiftToPostingMode();
       
    85 
       
    86 private:
       
    87     /*
       
    88      * Ctor 
       
    89      */
       
    90     CGlxHdmiSurfaceUpdater(RWindow* aWindow, const TDesC& aImageFile,
       
    91                             MGlxGenCallback* aCallBack);
       
    92     
       
    93     /*
       
    94      * ConstructL()
       
    95      */
       
    96     void ConstructL();   
       
    97     
       
    98     /*
       
    99      * Create a New surface with given size
       
   100      */
       
   101     void CreateSurfaceL();
       
   102     /*
       
   103     * @param1 size 
       
   104     */
       
   105    void MapSurfaceL();
       
   106 
       
   107     static TInt SurfBuffer0Ready(TAny* aObject);    
       
   108     /*
       
   109      * Call a refresh on the screen  
   115      * Call a refresh on the screen  
   110      */
   116      */
   111     void Refresh();
   117     void Refresh();
   112     
   118 
   113     /*
   119     /*
   114      * Dump the buffer on to the surface stride 
   120      * Dump the buffer on to the surface stride 
   115      */
   121      */
   116     void SwapBuffers();
   122     void SwapBuffers();
   117     
   123 
   118     /*
   124     /*
   119      * Release contents 
   125      * Release contents 
   120      */
   126      */
   121     void ReleaseContent();
   127     void ReleaseContent();
   122     
   128 
   123     /*
   129     /*
   124      * Create bitmap  
   130      * Create bitmap  
   125      */
   131      */
   126     void CreateBitmapL();
   132     void CreateBitmapL();
   127     
   133 
   128     /*
   134     /*
   129      * Create an image decoder with given file
   135      * Create an image decoder with given file
   130      * @param1 - Image file 
   136      * @param1 - Image file 
   131      */
   137      */
   132     void CreateImageDecoderL(const TDesC& aImageFile);
   138     void CreateImageDecoderL();
   133 
   139 
   134     /*
   140     /*
   135      * Creating all enablers for HDMI
   141      * Creating all enablers for HDMI
   136      * @param1 if creating a surface is required, 
   142      * @param1 if creating a surface is required, 
   137      * by default it is not required
   143      * by default it is not required
   138      */
   144      */
   139     void CreateHdmiL(TBool aCreateSurface = ETrue);
   145     void CreateHdmiL(TBool aCreateSurface = ETrue);
   140 
   146 
       
   147     /*
       
   148      * This if for zoom timer timeout
       
   149      */
   141     static TInt TimeOut(TAny* aSelf);
   150     static TInt TimeOut(TAny* aSelf);
   142 	
   151 
   143 	/*
   152     /*
   144 	* ModifySurface positions of the surface to be displayed on screen
   153      * ModifySurface positions of the surface to be displayed on screen
   145 	*/
   154      */
   146 	void ModifySurfacePostion();
   155     void ModifySurfacePostion();
       
   156 
       
   157     /*
       
   158      * Process the image for TV 
       
   159      */
       
   160     void ProcessTvImage();
       
   161 
       
   162     /*
       
   163      * Shows the FS thumbnail first before showing 
       
   164      * Decoded HD image 
       
   165      */
       
   166     void ShowFsThumbnailL();
       
   167 
       
   168     /*
       
   169      * Recalculate the size for png/bmp as decoder fails to 
       
   170      * decode for desired size 
       
   171      */
       
   172     TSize ReCalculateSizeL();
       
   173 
       
   174     /*
       
   175      * If the image format is non jpeg, then we need to calculate as per
       
   176      * reduction factor and reduced size as what the decoder is going to return us
       
   177      * This function returns if that needs to be done. 
       
   178      */
       
   179     TBool DoesMimeTypeNeedsRecalculateL();
       
   180 
       
   181     /*
       
   182      * If the image format is non jpeg, then we need to scale the bitmap after it is
       
   183      * decoded, as the return value would not fit the screen 
       
   184      */
       
   185     void ScaleDecodedBitmapL(TInt aBitmapIndex);
       
   186 
       
   187     /*
       
   188      * InitiateHDMI
       
   189      */
       
   190     void InitiateHdmiL(CFbsBitmap* aFsBitmap,const TDesC& aImageFile);
       
   191 
   147 private:
   192 private:
   148     RWindow* iWindow;
   193     RWindow*        iWindow;                        // window object
   149     const TDesC& iImagePath;
   194     CFbsBitmap*     iFsBitmap;                      // FS bitmap
   150     MGlxGenCallback* iCallBack;
   195     MGlxGenCallback* iCallBack;                     // callback to the HdmiContainer window
       
   196     HBufC*          iImagePath;                     // To store the image uri path
   151 
   197 
   152     // GCE Surface
   198     // GCE Surface
   153     RSurfaceUpdateSession iSurfUpdateSession;
   199     RSurfaceUpdateSession iSurfUpdateSession;
   154     TSurfaceId              iSurfId;                // TSurfaceId                             
   200     TSurfaceId              iSurfId;                // TSurfaceId                             
   155     RSurfaceManager*        iSurfManager;           // RSurfaceManager
   201     RSurfaceManager*        iSurfManager;           // RSurfaceManager
   156     RChunk*                 iSurfChunk;             // RChunk
   202     RChunk*                 iSurfChunk;             // RChunk
   157     TInt                    iSurfaceStride;         // surface stride
   203     TInt                    iSurfaceStride;         // surface stride
   158     TSurfaceConfiguration   iConfig;                // surface configuration for zoom
   204     TSurfaceConfiguration   iConfig;                // surface configuration for zoom
   159     
   205 
   160     TSize               iZoomRectSz ;
   206     CFbsBitmap*         iDecodedBitmap[3];          // Array of Decoded bitmaps of the focussed image
   161     CFbsBitmap*         iDecodedBitmap;             //Decoded bitmap of the focussed image
   207                                                     // 1 - contains FS/Grid Thumbnail, 2- HD image, 
   162     
   208                                                     // (optional)3-Scaled png/bmp images
       
   209 
   163     void*               iSurfBuffer;               // Surface buffer
   210     void*               iSurfBuffer;               // Surface buffer
   164     CGlxActiveCallBack* iSurfBufferAO;             // Surface buffer AO 
   211     CGlxActiveCallBack* iSurfBufferAO;             // Surface buffer AO 
   165     
   212 
   166     //ICL
   213     //ICL
   167     CGlxHdmiDecoderAO*  iGlxDecoderAO;              // Internal Image decoder AO              
   214     CGlxHdmiDecoderAO*  iGlxDecoderAO;              // Internal Image decoder AO              
   168     CImageDecoder*      iImageDecoder;              // Image Decoder
   215     CImageDecoder*      iImageDecoder;              // Image Decoder
   169     RFs                 iFsSession;                 // RFs
   216     RFs                 iFsSession;                 // RFs
       
   217 
       
   218     TPoint      iLeftCornerForZoom;                 //  
       
   219     CPeriodic*  iTimer;                             // Timer for Zoom   
   170     
   220     
   171     TPoint iLeftCornerForZoom;
   221     // Various objects to store sizes and count
   172     CPeriodic* iTimer;
   222     TSize       iTvScreenSize;                      // to store the Tv screen size
   173     TBool iZoom;
   223     TSize       iTargetBitmapSize;                  // To Store the target bitmap size to display(as per Aspect Ratio)
   174 	TBool iBitmapReady;
   224     
   175 	TBool iAutoZoomOut;
   225     // Various flags to store values
   176 	TBool iSurfSessionConnected;
   226     TBool       iZoom;                              // Is zoomed
       
   227     TBool       iBitmapReady;                       // If the bitmap is decoded and ready
       
   228     TBool       iAutoZoomOut;                       // If the UI has asked for auto zoomout
       
   229     TBool       iSurfSessionConnected;              // If surface session is connected
   177 	TBool iShiftToCloning;
   230 	TBool iShiftToCloning;
       
   231     TBool       iShwFsThumbnail;                    // If the Fs thumbnail is to be shown before decoding HD images
       
   232     TBool       iIsNonJpeg;                         // If the item is non jpeg
       
   233 
   178 #ifdef _DEBUG
   234 #ifdef _DEBUG
   179     TTime iStartTime;
   235     TTime iStartTime;
   180     TTime iStopTime;
   236     TTime iStopTime;
   181 #endif   
   237 #endif   
   182     
   238 	// The bitmap index in the array of bitmaps
       
   239     enum {
       
   240         EFSBitmapIndex = 0,
       
   241         EJpgDecodedBitmapIndex,
       
   242 		ENonJpgDecodedBitmapIndex
       
   243         };
   183     };
   244     };
   184 #endif /* GLXHDMISURFACEUPDATER_H_ */
   245 #endif /* GLXHDMISURFACEUPDATER_H_ */