photosgallery/viewframework/texturemanager/inc/glxbitmapdecoderwrapper.h
branchRCL_3
changeset 75 01504893d9cb
parent 60 5b3385a43d68
equal deleted inserted replaced
68:5b238bc8ffb6 75:01504893d9cb
    22 #define C_GLXBITMAPDECODERWRAPPER_H
    22 #define C_GLXBITMAPDECODERWRAPPER_H
    23 
    23 
    24 // INCLUDE FILES
    24 // INCLUDE FILES
    25 #include<alf/alftimedvalue.h>
    25 #include<alf/alftimedvalue.h>
    26 #include <IclExtJpegApi.h>  // For CExtJpegDecoder
    26 #include <IclExtJpegApi.h>  // For CExtJpegDecoder
       
    27 // For decoding via TNM 
       
    28 #include <thumbnailmanager.h>
       
    29 #include <thumbnailmanagerobserver.h>
       
    30 #include <thumbnailobjectsource.h>
       
    31 #include <thumbnaildata.h>
       
    32 #include <glxmedia.h>
    27 
    33 
    28 /**
    34 /**
    29  * Observer interface used to be notified when texture bitmap   is completed.
    35  * Observer interface used to be notified when texture bitmap   is completed.
    30  */
    36  */
    31 NONSHARABLE_CLASS( MGlxBitmapDecoderObserver )
    37 NONSHARABLE_CLASS( MGlxBitmapDecoderObserver )
    40 /**
    46 /**
    41  * This class does the decoding of the images in steps depending on the size of the images .
    47  * This class does the decoding of the images in steps depending on the size of the images .
    42  * this is a wrapper class, doesn't actually decode the images.
    48  * this is a wrapper class, doesn't actually decode the images.
    43  */
    49  */
    44 
    50 
    45 class CGlxBitmapDecoderWrapper: public CActive
    51 class CGlxBitmapDecoderWrapper: public CBase
       
    52                                ,public MThumbnailManagerObserver
       
    53     
    46     {
    54     {
    47 public:
    55 public:
    48     /*This Enums specifies the state of the Decoding*/
    56     /*This Enums specifies the state of the Decoding*/
    49     enum TDecoderState
    57     enum TDecoderState
    50         {
    58         {
    70     /**
    78     /**
    71      * intiates the Decoding the Image and updates the no:of steps to decode
    79      * intiates the Decoding the Image and updates the no:of steps to decode
    72      * @param aSourceFileName :contains the file name
    80      * @param aSourceFileName :contains the file name
    73      * @param aindex:contains the index value
    81      * @param aindex:contains the index value
    74      */
    82      */
    75     void DoDecodeImageL(const TDesC & aSourceFileName,TInt aIndex);
    83     void DoDecodeImageL(const TGlxMedia& aMedia,TInt aIndex);
    76 
    84 
    77     /**
    85     /**
    78      * starts the decoding and updates the state of the decoding
    86      * starts the decoding and updates the state of the decoding
    79      */
    87      */
    80     void DecodeImageL();
    88     void DecodeImageL();
    81     /**
    89     /**
    82      * Request free memory with Out of Memory Monitor
    90      * Request free memory with Out of Memory Monitor
    83      * @param aBytesRequested : Request for free memory in Bytes
    91      * @param aBytesRequested : Request for free memory in Bytes
    84      */
    92      */
    85     TInt OOMRequestFreeMemoryL( TInt aBytesRequested);
    93     TInt OOMRequestFreeMemoryL( TInt aBytesRequested);
       
    94     /**
       
    95      * Cancels all the pending requests and release resources
       
    96      */
       
    97     void CancelRequest();
    86 
    98 
    87 public:    
    99     
    88     /**
       
    89      * Standard Active object functions
       
    90      */
       
    91     virtual void RunL();
       
    92     virtual void DoCancel();
       
    93 
       
    94 private:
   100 private:
    95     /**
   101     /**
    96      * Constructor
   102      * Constructor
    97      */
   103      */
    98     CGlxBitmapDecoderWrapper();
   104     CGlxBitmapDecoderWrapper();
    99     
   105     
   100     /**
   106     /**
   101      * Second-phase constuction 
   107      * Second-phase constuction 
   102      */
   108      */
   103     void ConstructL(MGlxBitmapDecoderObserver* aObserver);
   109     void ConstructL(MGlxBitmapDecoderObserver* aObserver);
   104     
       
   105     /**
   110     /**
   106      * If the image format is non jpeg, then we need to calculate as per
   111      * Gets Thumbnails from TNM. 
   107      * reduction factor and reduced size as what the decoder is going to return us
       
   108      * This function returns if that needs to be done. 
       
   109      */
   112      */
   110     TBool DoesMimeTypeNeedsRecalculateL();
   113     void GetThumbnailL( HBufC* aImagePath );
   111     
       
   112     /**
   114     /**
   113      * Recalculate the size for png/bmp as decoder fails to 
   115     *  From MThumbnailManagerObserver, not used
   114      * decode for desired size 
   116     */
   115      */
   117     virtual void ThumbnailPreviewReady( MThumbnailData& aThumbnail, 
   116     TSize ReCalculateSizeL();
   118                                 TThumbnailRequestId aId );
       
   119                                 
       
   120     /**
       
   121     *  From MThumbnailManagerObserver
       
   122     */  
       
   123     virtual void ThumbnailReady( TInt aError, 
       
   124                          MThumbnailData& aThumbnail, 
       
   125                          TThumbnailRequestId aId );
   117 
   126 
   118 private:    
   127 private:    
   119     /* Contains the TextureManagerImpl object,calls the HandleBitmapDecoded*/
   128     /* Contains the TextureManagerImpl object,calls the HandleBitmapDecoded*/
   120     MGlxBitmapDecoderObserver* iObserver;
   129     MGlxBitmapDecoderObserver* iObserver;
   121     /*Specifies the Decoder */
       
   122     CImageDecoder* iImageDecoder; // decoder from ICL API
       
   123     /*Contains the Thumbnail Index*/
   130     /*Contains the Thumbnail Index*/
   124     TInt iThumbnailIndex;
   131     TInt iThumbnailIndex;
   125     /*Contains the Bitmap generated*/
   132     /*Contains the Bitmap generated*/
   126     CFbsBitmap* iBitmap;
   133     CFbsBitmap* iBitmap;
   127     /*contains the original size of the image*/
   134     /*contains the original size of the image*/
   128     TAlfRealSize iOriginalSize;
   135     TAlfRealSize iOriginalSize;
   129     /*A handle to a file server session.*/ 
       
   130     RFs iFs;
       
   131     /*To store the target image size*/
   136     /*To store the target image size*/
   132     TSize iTargetBitmapSize;
   137     TSize iTargetBitmapSize;
   133     /*To store the image uri path*/ 
   138     /*To store the image uri path*/ 
   134     HBufC* iImagePath;                     
   139     HBufC* iImagePath;                     
   135 #ifdef _DEBUG
   140 #ifdef _DEBUG
   136     TTime iStartTime;
   141     TTime iStartTime;
   137     TTime iStopTime;
   142     TTime iStopTime;
   138 #endif
   143 #endif
       
   144 
       
   145     CThumbnailManager* iTnManager;
       
   146     TThumbnailRequestId iTnReqId;
   139     };
   147     };
   140 
   148 
   141 #endif //C_GLXBITMAPDECODERWRAPPER_H
   149 #endif //C_GLXBITMAPDECODERWRAPPER_H