24 #include <IclExtJpegApi.h> |
24 #include <IclExtJpegApi.h> |
25 #include "thumbnailimagedecoderv2.h" |
25 #include "thumbnailimagedecoderv2.h" |
26 #include "thumbnaillog.h" |
26 #include "thumbnaillog.h" |
27 #include "thumbnailpanic.h" |
27 #include "thumbnailpanic.h" |
28 #include "thumbnailmanagerconstants.h" |
28 #include "thumbnailmanagerconstants.h" |
29 #include "OstTraceDefinitions.h" |
|
30 #ifdef OST_TRACE_COMPILER_IN_USE |
|
31 #include "thumbnailimagedecoderv2Traces.h" |
|
32 #endif |
|
33 |
|
34 |
29 |
35 // ============================ MEMBER FUNCTIONS =============================== |
30 // ============================ MEMBER FUNCTIONS =============================== |
36 //------------------------------------------------------------------------ |
31 //------------------------------------------------------------------------ |
37 // CThumbnailImageDecoder::CThumbnailImageDecoder() |
32 // CThumbnailImageDecoder::CThumbnailImageDecoder() |
38 // C++ default constructor can NOT contain any code, that might leave. |
33 // C++ default constructor can NOT contain any code, that might leave. |
62 // ----------------------------------------------------------------------------- |
57 // ----------------------------------------------------------------------------- |
63 // |
58 // |
64 void CThumbnailImageDecoderv2::CreateL(TDesC8& aBuffer, MThumbnailProviderObserver& aObserver) |
59 void CThumbnailImageDecoderv2::CreateL(TDesC8& aBuffer, MThumbnailProviderObserver& aObserver) |
65 { |
60 { |
66 TN_DEBUG1( "CThumbnailImageDecoderv2::CreateL() start" ); |
61 TN_DEBUG1( "CThumbnailImageDecoderv2::CreateL() start" ); |
67 OstTrace0( TRACE_NORMAL, CTHUMBNAILIMAGEDECODERV2_CREATEL, "CThumbnailImageDecoderv2::CreateL - start" ); |
|
68 |
62 |
69 iBuffer = &aBuffer; |
63 iBuffer = &aBuffer; |
70 iObserver = &aObserver; |
64 iObserver = &aObserver; |
71 |
65 |
72 CreateDecoderL(); |
66 CreateDecoderL(); |
73 |
67 |
74 TN_DEBUG1( "CThumbnailImageDecoderv2::CreateL() end" ); |
68 TN_DEBUG1( "CThumbnailImageDecoderv2::CreateL() end" ); |
75 OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILIMAGEDECODERV2_CREATEL, "CThumbnailImageDecoderv2::CreateL - end" ); |
|
76 } |
69 } |
77 |
70 |
78 // ----------------------------------------------------------------------------- |
71 // ----------------------------------------------------------------------------- |
79 // CThumbnailImageDecoder::DecodeL() |
72 // CThumbnailImageDecoder::DecodeL() |
80 // Decode the thumbnail image |
73 // Decode the thumbnail image |
81 // ----------------------------------------------------------------------------- |
74 // ----------------------------------------------------------------------------- |
82 // |
75 // |
83 void CThumbnailImageDecoderv2::DecodeL( ) |
76 void CThumbnailImageDecoderv2::DecodeL( ) |
84 { |
77 { |
85 TN_DEBUG1( "CThumbnailImageDecoderv2::DecodeL() start" ); |
78 TN_DEBUG1( "CThumbnailImageDecoderv2::DecodeL() start" ); |
86 OstTrace0( TRACE_NORMAL, CTHUMBNAILIMAGEDECODERV2_DECODEL, "CThumbnailImageDecoderv2::DecodeL - start" ); |
|
87 |
79 |
88 // Create the bitmap |
80 // Create the bitmap |
89 if ( !iBitmap ) |
81 if ( !iBitmap ) |
90 { |
82 { |
91 iBitmap = new( ELeave )CFbsBitmap(); |
83 iBitmap = new( ELeave )CFbsBitmap(); |
186 CExtJpegDecoder::EHwImplementation, iFs, *iBuffer, options )); |
176 CExtJpegDecoder::EHwImplementation, iFs, *iBuffer, options )); |
187 |
177 |
188 if ( decErr != KErrNone ) |
178 if ( decErr != KErrNone ) |
189 { |
179 { |
190 TN_DEBUG2( "CThumbnailImageDecoderv2::CreateDecoderL() - HW CExtJpegDecoder failed = %d", decErr ); |
180 TN_DEBUG2( "CThumbnailImageDecoderv2::CreateDecoderL() - HW CExtJpegDecoder failed = %d", decErr ); |
191 OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILIMAGEDECODERV2_CREATEDECODERL, "CThumbnailImageDecoderv2::CreateDecoderL - HW CExtJpegDecoder failed;decErr=%d", decErr ); |
|
192 TRAP( decErr, iDecoder = CExtJpegDecoder::DataNewL( |
181 TRAP( decErr, iDecoder = CExtJpegDecoder::DataNewL( |
193 CExtJpegDecoder::ESwImplementation, iFs, *iBuffer, options )); |
182 CExtJpegDecoder::ESwImplementation, iFs, *iBuffer, options )); |
194 |
183 |
195 if ( decErr != KErrNone ) |
184 if ( decErr != KErrNone ) |
196 { |
185 { |
197 TN_DEBUG2( "CThumbnailImageDecoderv2::CreateDecoderL() - SW CExtJpegDecoder failed %d", decErr); |
186 TN_DEBUG2( "CThumbnailImageDecoderv2::CreateDecoderL() - SW CExtJpegDecoder failed %d", decErr); |
198 OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILIMAGEDECODERV2_CREATEDECODERL, "CThumbnailImageDecoderv2::CreateDecoderL - SW CExtJpegDecoder failed;decErr=%d", decErr ); |
|
199 LeaveIfCorruptL( decErr ); |
187 LeaveIfCorruptL( decErr ); |
200 |
188 |
201 TRAP( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, KJpegMime(), options ) ); |
189 TRAP( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, KJpegMime(), options ) ); |
202 |
190 |
203 if ( decErr != KErrNone ) |
191 if ( decErr != KErrNone ) |
204 { |
192 { |
205 TN_DEBUG2( "CThumbnailImageDecoderv2::CreateDecoderL() - CImageDecoder failed %d", decErr); |
193 TN_DEBUG2( "CThumbnailImageDecoderv2::CreateDecoderL() - CImageDecoder failed %d", decErr); |
206 OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILIMAGEDECODERV2_CREATEDECODERL, "CThumbnailImageDecoderv2::CreateDecoderL - CImageDecoder failed;decErr=%d", decErr ); |
|
207 LeaveIfCorruptL( decErr ); |
194 LeaveIfCorruptL( decErr ); |
208 |
195 |
209 // don't force any mime type |
196 // don't force any mime type |
210 TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, options ) ); |
197 TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, options ) ); |
211 if ( decErr != KErrNone ) |
198 if ( decErr != KErrNone ) |
212 { |
199 { |
213 TN_DEBUG2( "CThumbnailImageDecoderv2::CImageDecoder() - CImageDecoder no mime error %d", decErr ); |
200 TN_DEBUG2( "CThumbnailImageDecoderv2::CImageDecoder() - CImageDecoder no mime error %d", decErr ); |
214 OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILIMAGEDECODERV2_CREATEDECODERL, "CThumbnailImageDecoderv2::CreateDecoderL - CImageDecoder no mime error;decErr=%d", decErr ); |
|
215 User::Leave( decErr ); |
201 User::Leave( decErr ); |
216 } |
202 } |
217 } |
203 } |
218 |
204 |
219 TN_DEBUG1( "CThumbnailImageDecoderv2::CreateDecoderL() - CImageDecoder created" ); |
205 TN_DEBUG1( "CThumbnailImageDecoderv2::CreateDecoderL() - CImageDecoder created" ); |
220 OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILIMAGEDECODERV2_CREATEDECODERL, "CThumbnailImageDecoderv2::CreateDecoderL - CImageDecoder created" ); |
|
221 } |
206 } |
222 else |
207 else |
223 { |
208 { |
224 TN_DEBUG1( "CThumbnailImageDecoderv2:CreateDecoderL() - SW CExtJpegDecoder created" ); |
209 TN_DEBUG1( "CThumbnailImageDecoderv2:CreateDecoderL() - SW CExtJpegDecoder created" ); |
225 OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILIMAGEDECODERV2_CREATEDECODERL, "CThumbnailImageDecoderv2::CreateDecoderL - SW CExtJpegDecoder created" ); |
|
226 } |
210 } |
227 } |
211 } |
228 else |
212 else |
229 { |
213 { |
230 TN_DEBUG1( "CThumbnailImageDecoderv2::CreateDecoderL() - HW CExtJpegDecoder created" ); |
214 TN_DEBUG1( "CThumbnailImageDecoderv2::CreateDecoderL() - HW CExtJpegDecoder created" ); |
231 OstTrace0( TRACE_NORMAL, DUP7_CTHUMBNAILIMAGEDECODERV2_CREATEDECODERL, "CThumbnailImageDecoderv2::CreateDecoderL - HW CExtJpegDecoder created" ); |
|
232 } |
215 } |
233 |
216 |
234 TN_DEBUG1( "CThumbnailImageDecoderv2::CreateDecoderL() end" ); |
217 TN_DEBUG1( "CThumbnailImageDecoderv2::CreateDecoderL() end" ); |
235 OstTrace0( TRACE_NORMAL, DUP8_CTHUMBNAILIMAGEDECODERV2_CREATEDECODERL, "CThumbnailImageDecoderv2::CreateDecoderL - end" ); |
|
236 } |
218 } |
237 |
219 |
238 // ----------------------------------------------------------------------------- |
220 // ----------------------------------------------------------------------------- |
239 // CThumbnailImageDecoderv2::LeaveIfCorruptL() |
221 // CThumbnailImageDecoderv2::LeaveIfCorruptL() |
240 // Leave if image is corrupted |
222 // Leave if image is corrupted |