photosgallery/viewframework/texturemanager/inc/glxtexturemanagerimpl.h
branchRCL_3
changeset 23 b023a8d2866a
parent 19 420f6808bf21
equal deleted inserted replaced
21:f9e827349359 23:b023a8d2866a
    48 class CGlxResolutionUtility;
    48 class CGlxResolutionUtility;
    49 class MGlxTextureObserver;
    49 class MGlxTextureObserver;
    50 class CGlxBitmapDecoderWrapper;
    50 class CGlxBitmapDecoderWrapper;
    51 class MGlxBitmapDecoderObserver;
    51 class MGlxBitmapDecoderObserver;
    52 class CGlxThumbnailAttribute;
    52 class CGlxThumbnailAttribute;
       
    53 
       
    54 const TInt KGlxMaxFrameCount = 25;
       
    55 
    53 /**
    56 /**
    54  *  CGlxTextureManagerImpl
    57  *  CGlxTextureManagerImpl
    55  *
    58  *
    56  *  Implementation of Texture Manager component. 
    59  *  Implementation of Texture Manager component. 
    57  *
    60  *
   158 	* @param aIdSpaceId The Id of the Id space in which the media Id is defined	
   161 	* @param aIdSpaceId The Id of the Id space in which the media Id is defined	
   159     * @return Created texture: ownership transfered
   162     * @return Created texture: ownership transfered
   160     */
   163     */
   161     CAlfTexture& CreateAnimatedGifTextureL(const TDesC& aFilename, const TSize& aSize,
   164     CAlfTexture& CreateAnimatedGifTextureL(const TDesC& aFilename, const TSize& aSize,
   162                                            const TGlxMedia& aMedia, TGlxIdSpaceId aIdSpaceId);
   165                                            const TGlxMedia& aMedia, TGlxIdSpaceId aIdSpaceId);
   163 
   166  	
       
   167 	/**
       
   168     * Creates textures for the given GIF media
       
   169 	* @param aMedia The media item
       
   170 	* @param aIdSpaceId The Id of the Id space in which the media Id is defined
       
   171 	* @param aFrameNumber frame number of gif media
       
   172     * @param aBitmap Bitmap for the particular frame
       
   173 	* @return Created texture: ownership transfered
       
   174     */    
       
   175     CAlfTexture& CreateDRMAnimatedGifTextureL(const TGlxMedia& aMedia,
       
   176             TGlxIdSpaceId aIdSpaceId, TInt aFrameNumber, CFbsBitmap* aBitmap, CFbsBitmap* aBitmapMask);
   164     /**
   177     /**
   165      * Removes the texture if it was created by CreateThumbnailTextureL or
   178      * Removes the texture if it was created by CreateThumbnailTextureL or
   166      * CreateZoomedTextureL
   179      * CreateZoomedTextureL
   167      * @param aTexture The texture to be removed
   180      * @param aTexture The texture to be removed
   168      */
   181      */
   330             {
   343             {
   331         	// return true if the Media Id match
   344         	// return true if the Media Id match
   332             return *aMediaId == aThumbData.iMediaId;
   345             return *aMediaId == aThumbData.iMediaId;
   333             }
   346             }
   334          };
   347          };
       
   348     
       
   349     /**
       
   350      * TGlxDRMGifThumbnailIcon
       
   351      * Values associated with a DRM Gif thumbnail.
       
   352      */
       
   353     class TGlxDRMGifThumbnailIcon
       
   354         {
       
   355     public:
       
   356         TInt iTextureId[KGlxMaxFrameCount];
       
   357         CAlfTexture* iTexture[KGlxMaxFrameCount];
       
   358         TMPXAttribute iAttribId;
       
   359         TSize iRequiredSize;
       
   360         TGlxMediaId iMediaId;
       
   361         TGlxIdSpaceId iIdSpaceId;
       
   362         MGlxTextureObserver* iObserver;
       
   363         CFbsBitmap* iBitmap[KGlxMaxFrameCount];
       
   364         CFbsBitmap* iBitmapMask[KGlxMaxFrameCount];
       
   365         TTime iImageDate;
       
   366         /**
       
   367          * Helper function to be able to find texture from array
       
   368          */
       
   369         static TBool MatchTexture(const CAlfTexture* aTexture,
       
   370                 const TGlxDRMGifThumbnailIcon& aThumbData)
       
   371             {
       
   372             // return true if the address of the texture match
       
   373             return aTexture == aThumbData.iTexture[0];
       
   374             }
       
   375 
       
   376         /**
       
   377          * Helper function to be able to find mediaid from array
       
   378          */
       
   379         static TBool MatchMediaId(const TGlxMediaId* aMediaId,
       
   380                 const TGlxDRMGifThumbnailIcon& aThumbData)
       
   381             {
       
   382             // return true if the Media Id match
       
   383             return *aMediaId == aThumbData.iMediaId;
       
   384             }
       
   385         };
   335     /**
   386     /**
   336     * Requests the best match texture. If it already exists this method does nothing.
   387     * Requests the best match texture. If it already exists this method does nothing.
   337     * However if it doed not exist it will create it and replace the old texture
   388     * However if it doed not exist it will create it and replace the old texture
   338     * if necessary.
   389     * if necessary.
   339     * @param aSize The size of the requested texture
   390     * @param aSize The size of the requested texture
   405     * @param aIdSpaceId The Id of the Id space in which the media Id is defined	
   456     * @param aIdSpaceId The Id of the Id space in which the media Id is defined	
   406     * @param aThumbnailIndex on return will contain the Index of the thumbnail in the iAnimatedTnmList
   457     * @param aThumbnailIndex on return will contain the Index of the thumbnail in the iAnimatedTnmList
   407     *        or KErrNotFound
   458     *        or KErrNotFound
   408     * @return ETrue if Thumbnail is available, EFalse if it needs to be created
   459     * @return ETrue if Thumbnail is available, EFalse if it needs to be created
   409     */
   460     */
   410     TBool CGlxTextureManagerImpl::GetAnimatedGifThumbnailIndex( TSize aSize,
   461     TBool GetAnimatedGifThumbnailIndex( TSize aSize,
   411             const TGlxMedia& aMedia, const TGlxIdSpaceId& aIdSpaceId,
   462             const TGlxMedia& aMedia, const TGlxIdSpaceId& aIdSpaceId,
       
   463             TInt& aThumbnailIndex);
       
   464      /**
       
   465     * GetDRMAnimatedGifThumbnailIndex
       
   466     * @param aMedia The TGlxMedia item.
       
   467     * @param aIdSpaceId The Id of the Id space in which the media Id is defined	
       
   468     * @param aThumbnailIndex on return will contain the Index of the thumbnail in the iAnimatedTnmList
       
   469     *        or KErrNotFound
       
   470     * @return ETrue if Thumbnail is available, EFalse if it needs to be created
       
   471     */   
       
   472     TBool GetDRMAnimatedGifThumbnailIndex(const TGlxMedia& aMedia, const TGlxIdSpaceId& aIdSpaceId,
   412             TInt& aThumbnailIndex);
   473             TInt& aThumbnailIndex);
   413 private:
   474 private:
   414     // Alf Texture manager (not owned) 
   475     // Alf Texture manager (not owned) 
   415     CAlfTextureManager& iAlfTextureManager;
   476     CAlfTextureManager& iAlfTextureManager;
   416 
   477 
   426     // List containing data for textures generated from zoomed thumbnail. 
   487     // List containing data for textures generated from zoomed thumbnail. 
   427     RArray<TGlxThumbnailIcon> iZoomedList;
   488     RArray<TGlxThumbnailIcon> iZoomedList;
   428 
   489 
   429     // List containing data for textures generated from Animated thumbnail. 
   490     // List containing data for textures generated from Animated thumbnail. 
   430     RArray<TGlxThumbnailIcon> iAnimatedTnmList;
   491     RArray<TGlxThumbnailIcon> iAnimatedTnmList;
       
   492     
       
   493     // List containing data for textures generated from DRM Gif Animated thumbnail. 
       
   494     RArray<TGlxDRMGifThumbnailIcon> iDRMGifAnimatedTnmList;
   431         
   495         
   432     // List of .mif filenames of files containing icons. 
   496     // List of .mif filenames of files containing icons. 
   433     CDesCArrayFlat* iMifFilenames;
   497     CDesCArrayFlat* iMifFilenames;
   434     
   498     
   435     // DRM utility class 
   499     // DRM utility class