photosgallery/viewframework/tvout/inc/glxhdmisurfaceupdater.h
branchRCL_3
changeset 25 191387a8b767
parent 22 2dac0fdba72b
child 35 420f6808bf21
--- a/photosgallery/viewframework/tvout/inc/glxhdmisurfaceupdater.h	Wed Apr 14 15:57:24 2010 +0300
+++ b/photosgallery/viewframework/tvout/inc/glxhdmisurfaceupdater.h	Tue Apr 27 16:37:53 2010 +0300
@@ -25,6 +25,8 @@
 #include "graphics/surface.h"
 #include "graphics/surfaceupdateclient.h"
 #include <graphics/surfaceconfiguration.h>
+
+// forward decleration
 class CGlxActiveCallBack;
 class CGlxHdmiDecoderAO;
 class CImageDecoder;
@@ -39,16 +41,16 @@
     {
 public:
     /*
-     * 
+     * NewL
      */
     static CGlxHdmiSurfaceUpdater* NewL(RWindow* aWindow, const TDesC& aImageFile, 
-                                         MGlxGenCallback* aCallBack);
-    
+            CFbsBitmap* aFsBitmap, MGlxGenCallback* aCallBack);
+
     /*
-     * destructor
+     * Destructor
      */
     ~CGlxHdmiSurfaceUpdater();
-    
+
 public:
     /*
      * This is to cancel the active object from decoding 
@@ -58,78 +60,82 @@
     /*
      * This updates the new image.
      */
-    void UpdateNewImageL(const TDesC& aImageFile);
-    
+    void UpdateNewImageL(const TDesC& aImageFile,CFbsBitmap* aFsBitmap);
+
     /*
      * Activate Zoom 
      */
     void ActivateZoom(TBool aAutoZoomOut);
     /*
-    * Deactivate Zoom 
-    */
+     * Deactivate Zoom 
+     */
     void DeactivateZoom();
     /*
      * Zoom in our out depending on parameter 
      */
     void Zoom(TBool aZoom);
-	
-	/*
+
+    /*
 	ShiftToCloningMOde
-	*/
-	void ShiftToCloningMode();
-	
-	/*
+     */
+    void ShiftToCloningMode();
+
+    /*
 	ShiftToPostingMode
-	*/
-	void ShiftToPostingMode();
+     */
+    void ShiftToPostingMode();
 
 private:
     /*
-     * Ctor 
+     * Constructor 
      */
-    CGlxHdmiSurfaceUpdater(RWindow* aWindow, const TDesC& aImageFile,
-                            MGlxGenCallback* aCallBack);
-    
+    CGlxHdmiSurfaceUpdater(RWindow* aWindow, MGlxGenCallback* aCallBack);
+
     /*
      * ConstructL()
      */
-    void ConstructL();   
-    
+    void ConstructL(CFbsBitmap* aFsBitmap,const TDesC& aImageFile);   
+
     /*
      * Create a New surface with given size
      */
     void CreateSurfaceL();
     /*
-    * @param1 size 
-    */
-   void MapSurfaceL();
+     * @param1 size 
+     */
+    void MapSurfaceL();
 
+    /*
+     * This fundtion wont be called , could be used if double buffering is planned in future
+     * to start the second decoder AO and update the surface with a new session. 
+     */
     static TInt SurfBuffer0Ready(TAny* aObject);    
+    
     /*
      * Call a refresh on the screen  
      */
     void Refresh();
-    
+
     /*
      * Dump the buffer on to the surface stride 
      */
     void SwapBuffers();
-    
+
     /*
      * Release contents 
      */
     void ReleaseContent();
-    
+
     /*
      * Create bitmap  
      */
     void CreateBitmapL();
-    
+
     /*
      * Create an image decoder with given file
      * @param1 - Image file 
      */
-    void CreateImageDecoderL(const TDesC& aImageFile);
+    void CreateImageDecoderL();
 
     /*
      * Creating all enablers for HDMI
@@ -138,16 +144,56 @@
      */
     void CreateHdmiL(TBool aCreateSurface = ETrue);
 
+    /*
+     * This if for zoom timer timeout
+     */
     static TInt TimeOut(TAny* aSelf);
-	
-	/*
-	* ModifySurface positions of the surface to be displayed on screen
-	*/
-	void ModifySurfacePostion();
+
+    /*
+     * ModifySurface positions of the surface to be displayed on screen
+     */
+    void ModifySurfacePostion();
+
+    /*
+     * Process the image for TV 
+     */
+    void ProcessTvImage();
+
+    /*
+     * Shows the FS thumbnail first before showing 
+     * Decoded HD image 
+     */
+    void ShowFsThumbnailL();
+
+    /*
+     * Recalculate the size for png/bmp as decoder fails to 
+     * decode for desired size 
+     */
+    TSize ReCalculateSizeL();
+
+    /*
+     * If the image format is non jpeg, then we need to calculate as per
+     * reduction factor and reduced size as what the decoder is going to return us
+     * This function returns if that needs to be done. 
+     */
+    TBool DoesMimeTypeNeedsRecalculateL();
+
+    /*
+     * If the image format is non jpeg, then we need to scale the bitmap after it is
+     * decoded, as the return value would not fit the screen 
+     */
+    void ScaleDecodedBitmapL(TInt aBitmapIndex);
+
+    /*
+     * InitiateHDMI
+     */
+    void InitiateHdmiL(CFbsBitmap* aFsBitmap,const TDesC& aImageFile);
+
 private:
-    RWindow* iWindow;
-    const TDesC& iImagePath;
-    MGlxGenCallback* iCallBack;
+    RWindow*        iWindow;                        // window object
+    CFbsBitmap*     iFsBitmap;                      // FS bitmap
+    MGlxGenCallback* iCallBack;                     // callback to the HdmiContainer window
+    HBufC*          iImagePath;                     // To store the image uri path
 
     // GCE Surface
     RSurfaceUpdateSession iSurfUpdateSession;
@@ -156,29 +202,44 @@
     RChunk*                 iSurfChunk;             // RChunk
     TInt                    iSurfaceStride;         // surface stride
     TSurfaceConfiguration   iConfig;                // surface configuration for zoom
-    
-    TSize               iZoomRectSz ;
-    CFbsBitmap*         iDecodedBitmap;             //Decoded bitmap of the focussed image
-    
+
+    CFbsBitmap*         iDecodedBitmap[3];          // Array of Decoded bitmaps of the focussed image
+                                                    // 1 - contains FS/Grid Thumbnail, 2- HD image, 
+                                                    // (optional)3-Scaled png/bmp images
+
     void*               iSurfBuffer;               // Surface buffer
     CGlxActiveCallBack* iSurfBufferAO;             // Surface buffer AO 
-    
+
     //ICL
     CGlxHdmiDecoderAO*  iGlxDecoderAO;              // Internal Image decoder AO              
     CImageDecoder*      iImageDecoder;              // Image Decoder
     RFs                 iFsSession;                 // RFs
+
+    TPoint      iLeftCornerForZoom;                 //  
+    CPeriodic*  iTimer;                             // Timer for Zoom   
     
-    TPoint iLeftCornerForZoom;
-    CPeriodic* iTimer;
-    TBool iZoom;
-	TBool iBitmapReady;
-	TBool iAutoZoomOut;
-	TBool iSurfSessionConnected;
+    // Various objects to store sizes and count
+    TSize       iTvScreenSize;                      // to store the Tv screen size
+    TSize       iTargetBitmapSize;                  // To Store the target bitmap size to display(as per Aspect Ratio)
+    
+    // Various flags to store values
+    TBool       iZoom;                              // Is zoomed
+    TBool       iBitmapReady;                       // If the bitmap is decoded and ready
+    TBool       iAutoZoomOut;                       // If the UI has asked for auto zoomout
+    TBool       iSurfSessionConnected;              // If surface session is connected
 	TBool iShiftToCloning;
+    TBool       iShwFsThumbnail;                    // If the Fs thumbnail is to be shown before decoding HD images
+    TBool       iIsNonJpeg;                         // If the item is non jpeg
+
 #ifdef _DEBUG
     TTime iStartTime;
     TTime iStopTime;
 #endif   
-    
+	// The bitmap index in the array of bitmaps
+    enum {
+        EFSBitmapIndex = 0,
+        EJpgDecodedBitmapIndex,
+		ENonJpgDecodedBitmapIndex
+        };
     };
 #endif /* GLXHDMISURFACEUPDATER_H_ */