imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimageprovider.cpp
branchRCL_3
changeset 21 6257223ede8a
parent 20 2b4b06654caa
child 22 9d4d3445ce6e
equal deleted inserted replaced
20:2b4b06654caa 21:6257223ede8a
    23 #include "thumbnailimagedecoder.h"
    23 #include "thumbnailimagedecoder.h"
    24 #include "thumbnailimagedecoderv2.h"
    24 #include "thumbnailimagedecoderv2.h"
    25 #include "thumbnailmanageruids.hrh"
    25 #include "thumbnailmanageruids.hrh"
    26 #include "thumbnaillog.h"
    26 #include "thumbnaillog.h"
    27 #include "thumbnailmanagerconstants.h"
    27 #include "thumbnailmanagerconstants.h"
       
    28 #include "OstTraceDefinitions.h"
       
    29 #ifdef OST_TRACE_COMPILER_IN_USE
       
    30 #include "thumbnailimageproviderTraces.h"
       
    31 #endif
       
    32 
    28 
    33 
    29 #ifndef IMPLEMENTATION_PROXY_ENTRY
    34 #ifndef IMPLEMENTATION_PROXY_ENTRY
    30 typedef TAny* TProxyNewLPtr;
    35 typedef TAny* TProxyNewLPtr;
    31 #define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) \
    36 #define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) \
    32 { {aUid}, static_cast<TProxyNewLPtr>(aFuncPtr) }
    37 { {aUid}, static_cast<TProxyNewLPtr>(aFuncPtr) }
    53 // ---------------------------------------------------------------------------
    58 // ---------------------------------------------------------------------------
    54 //
    59 //
    55 CThumbnailImageProvider::CThumbnailImageProvider()
    60 CThumbnailImageProvider::CThumbnailImageProvider()
    56     {
    61     {
    57     TN_DEBUG1( "CThumbnailImageProvider::CThumbnailImageProvider()" );
    62     TN_DEBUG1( "CThumbnailImageProvider::CThumbnailImageProvider()" );
       
    63     OstTrace0( TRACE_NORMAL, CTHUMBNAILIMAGEPROVIDER_CTHUMBNAILIMAGEPROVIDER, "CThumbnailImageProvider::CThumbnailImageProvider" );
    58     }
    64     }
    59 
    65 
    60 
    66 
    61 // ---------------------------------------------------------------------------
    67 // ---------------------------------------------------------------------------
    62 // CThumbnailImageProvider::~CThumbnailImageProvider()
    68 // CThumbnailImageProvider::~CThumbnailImageProvider()
    64 // ---------------------------------------------------------------------------
    70 // ---------------------------------------------------------------------------
    65 //
    71 //
    66 CThumbnailImageProvider::~CThumbnailImageProvider()
    72 CThumbnailImageProvider::~CThumbnailImageProvider()
    67     {
    73     {
    68     TN_DEBUG1( "CThumbnailImageProvider::~CThumbnailImageProvider()" );
    74     TN_DEBUG1( "CThumbnailImageProvider::~CThumbnailImageProvider()" );
       
    75     OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILIMAGEPROVIDER_CTHUMBNAILIMAGEPROVIDER, "CThumbnailImageProvider::~CThumbnailImageProvider" );
    69     delete iImageDecoder;
    76     delete iImageDecoder;
    70     iImageDecoder = NULL;
    77     iImageDecoder = NULL;
    71     delete iImageDecoderv2;
    78     delete iImageDecoderv2;
    72     iImageDecoderv2 = NULL;
    79     iImageDecoderv2 = NULL;
    73     REComSession::DestroyedImplementation( iDtor_ID_Key );
    80     REComSession::DestroyedImplementation( iDtor_ID_Key );
    82 void CThumbnailImageProvider::GetThumbnailL( RFs& aFs, RFile64& aFile, const
    89 void CThumbnailImageProvider::GetThumbnailL( RFs& aFs, RFile64& aFile, const
    83     TDataType& aMimeType, const CThumbnailManager::TThumbnailFlags aFlags,
    90     TDataType& aMimeType, const CThumbnailManager::TThumbnailFlags aFlags,
    84     const TDisplayMode /*aDisplayMode*/, const CThumbnailManager::TThumbnailQualityPreference aQualityPreference )
    91     const TDisplayMode /*aDisplayMode*/, const CThumbnailManager::TThumbnailQualityPreference aQualityPreference )
    85     {
    92     {
    86     TN_DEBUG1( "CThumbnailImageProvider::GetThumbnailL() start" );
    93     TN_DEBUG1( "CThumbnailImageProvider::GetThumbnailL() start" );
       
    94     OstTrace0( TRACE_NORMAL, CTHUMBNAILIMAGEPROVIDER_GETTHUMBNAILL, "CThumbnailImageProvider::GetThumbnailL - start" );
    87 
    95 
    88     if ( !iImageDecoder )
    96     if ( !iImageDecoder )
    89         {
    97         {
    90         iImageDecoder = new( ELeave )CThumbnailImageDecoder( aFs );
    98         iImageDecoder = new( ELeave )CThumbnailImageDecoder( aFs );
    91         }
    99         }
    93     iMimeType = aMimeType;
   101     iMimeType = aMimeType;
    94     iFlags = aFlags;
   102     iFlags = aFlags;
    95     iQualityPreference = aQualityPreference;
   103     iQualityPreference = aQualityPreference;
    96 	//set default mode displaymode from global constants
   104 	//set default mode displaymode from global constants
    97     iDisplayMode = KStoreDisplayMode;
   105     iDisplayMode = KStoreDisplayMode;
    98     
   106 
       
   107 //Symbian^4 specific
       
   108     if ( KJpegMime() != iMimeType.Des8() ) 
       
   109         {
       
   110         iDisplayMode = EColor16M;
       
   111         }
       
   112 		
       
   113 //TODO currently only ARM platforms supports MAP mode
       
   114 #if !(defined(__CC_ARM) || defined(__ARMCC__))
       
   115     iDisplayMode = EColor16M;
       
   116 #endif	
       
   117 	
    99     iImageDecoder->CreateL( aFile, *iObserver, iQualityPreference, iMimeType, iTargetSize );
   118     iImageDecoder->CreateL( aFile, *iObserver, iQualityPreference, iMimeType, iTargetSize );
   100     iOriginalSize = iImageDecoder->OriginalSize();
   119     iOriginalSize = iImageDecoder->OriginalSize();
   101     iImageDecoder->DecodeL( iDisplayMode, iFlags );
   120     iImageDecoder->DecodeL( iDisplayMode, iFlags );
   102     
   121     
   103     TN_DEBUG1( "CThumbnailImageProvider::GetThumbnailL() end" );
   122     TN_DEBUG1( "CThumbnailImageProvider::GetThumbnailL() end" );
       
   123     OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILIMAGEPROVIDER_GETTHUMBNAILL, "CThumbnailImageProvider::GetThumbnailL - end" );
   104     }
   124     }
   105 
   125 
   106 // ---------------------------------------------------------------------------
   126 // ---------------------------------------------------------------------------
   107 // CThumbnailImageProvider::GetThumbnailL()
   127 // CThumbnailImageProvider::GetThumbnailL()
   108 // Provides the thumbnail image
   128 // Provides the thumbnail image
   111 void CThumbnailImageProvider::GetThumbnailL( RFs& aFs, TDesC8* aBuffer, const
   131 void CThumbnailImageProvider::GetThumbnailL( RFs& aFs, TDesC8* aBuffer, const
   112     TDataType& aMimeType, const CThumbnailManager::TThumbnailFlags aFlags,
   132     TDataType& aMimeType, const CThumbnailManager::TThumbnailFlags aFlags,
   113     const TDisplayMode /*aDisplayMode*/, const CThumbnailManager::TThumbnailQualityPreference aQualityPreference )
   133     const TDisplayMode /*aDisplayMode*/, const CThumbnailManager::TThumbnailQualityPreference aQualityPreference )
   114     {
   134     {
   115     TN_DEBUG1( "CThumbnailImageProvider::GetThumbnailL() start" );
   135     TN_DEBUG1( "CThumbnailImageProvider::GetThumbnailL() start" );
       
   136     OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILIMAGEPROVIDER_GETTHUMBNAILL, "CThumbnailImageProvider::GetThumbnailL - start" );
   116     
   137     
   117     if ( !iImageDecoder )
   138     if ( !iImageDecoder )
   118         {
   139         {
   119         iImageDecoder = new( ELeave )CThumbnailImageDecoder( aFs );
   140         iImageDecoder = new( ELeave )CThumbnailImageDecoder( aFs );
   120         }
   141         }
   122     iMimeType = aMimeType;
   143     iMimeType = aMimeType;
   123     iFlags = aFlags;
   144     iFlags = aFlags;
   124     iQualityPreference = aQualityPreference;
   145     iQualityPreference = aQualityPreference;
   125 	//set default mode displaymode from global constants
   146 	//set default mode displaymode from global constants
   126     iDisplayMode = KStoreDisplayMode;
   147     iDisplayMode = KStoreDisplayMode;
   127     
   148 	
       
   149 //Symbian^4 specific
       
   150     if ( KJpegMime() != iMimeType.Des8() ) 
       
   151         {
       
   152         iDisplayMode = EColor16M;
       
   153         }
       
   154 
       
   155 //TODO currently only ARM platforms supports MAP mode
       
   156 #if !(defined(__CC_ARM) || defined(__ARMCC__))
       
   157     iDisplayMode = EColor16M;
       
   158 #endif	
       
   159 		
   128     iImageDecoder->CreateL( aBuffer, *iObserver, iQualityPreference, iMimeType, iTargetSize );
   160     iImageDecoder->CreateL( aBuffer, *iObserver, iQualityPreference, iMimeType, iTargetSize );
   129     iOriginalSize = iImageDecoder->OriginalSize();
   161     iOriginalSize = iImageDecoder->OriginalSize();
   130     iImageDecoder->DecodeL( iDisplayMode, iFlags );
   162     iImageDecoder->DecodeL( iDisplayMode, iFlags );
   131     
   163     
   132     TN_DEBUG1( "CThumbnailImageProvider::GetThumbnailL() end" );
   164     TN_DEBUG1( "CThumbnailImageProvider::GetThumbnailL() end" );
       
   165     OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILIMAGEPROVIDER_GETTHUMBNAILL, "CThumbnailImageProvider::GetThumbnailL - end" );
   133     }
   166     }
   134 
   167 
   135 // ---------------------------------------------------------------------------
   168 // ---------------------------------------------------------------------------
   136 // CThumbnailImageProvider::GetThumbnailL()
   169 // CThumbnailImageProvider::GetThumbnailL()
   137 // Provides the thumbnail image
   170 // Provides the thumbnail image
   138 // ---------------------------------------------------------------------------
   171 // ---------------------------------------------------------------------------
   139 //
   172 //
   140 void CThumbnailImageProvider::GetThumbnailL( RFs& aFs, TDesC8& aBuffer)
   173 void CThumbnailImageProvider::GetThumbnailL( RFs& aFs, TDesC8& aBuffer)
   141     {
   174     {
   142     TN_DEBUG1( "CThumbnailImageProvider::GetThumbnailL() start" );
   175     TN_DEBUG1( "CThumbnailImageProvider::GetThumbnailL() start" );
       
   176     OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILIMAGEPROVIDER_GETTHUMBNAILL, "CThumbnailImageProvider::GetThumbnailL - start" );
   143 
   177 
   144     if ( !iImageDecoderv2 )
   178     if ( !iImageDecoderv2 )
   145         {     
   179         {     
   146         iImageDecoderv2 = new( ELeave )CThumbnailImageDecoderv2( aFs);
   180         iImageDecoderv2 = new( ELeave )CThumbnailImageDecoderv2( aFs);
   147         }
   181         }
   149     iImageDecoderv2->CreateL(aBuffer, *iObserver);
   183     iImageDecoderv2->CreateL(aBuffer, *iObserver);
   150        
   184        
   151     iImageDecoderv2->DecodeL();
   185     iImageDecoderv2->DecodeL();
   152     
   186     
   153     TN_DEBUG1( "CThumbnailImageProvider::GetThumbnailL() end" );
   187     TN_DEBUG1( "CThumbnailImageProvider::GetThumbnailL() end" );
       
   188     OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILIMAGEPROVIDER_GETTHUMBNAILL, "CThumbnailImageProvider::GetThumbnailL - end" );
   154     }
   189     }
   155 
   190 
   156 // ---------------------------------------------------------------------------
   191 // ---------------------------------------------------------------------------
   157 // Cancel thumbnail request
   192 // Cancel thumbnail request
   158 // ---------------------------------------------------------------------------
   193 // ---------------------------------------------------------------------------