imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp
equal
deleted
inserted
replaced
50 // --------------------------------------------------------------------------- |
50 // --------------------------------------------------------------------------- |
51 // CThumbnailImageDecoder::CThumbnailImageDecoder() |
51 // CThumbnailImageDecoder::CThumbnailImageDecoder() |
52 // C++ default constructor can NOT contain any code, that might leave. |
52 // C++ default constructor can NOT contain any code, that might leave. |
53 // --------------------------------------------------------------------------- |
53 // --------------------------------------------------------------------------- |
54 // |
54 // |
55 CThumbnailImageDecoder::CThumbnailImageDecoder( RFs& aFs ): CActive( |
55 CThumbnailImageDecoder::CThumbnailImageDecoder( RFs& aFs ): |
56 EPriorityStandard ), iFs( aFs ) |
56 CActive(EPriorityStandard ), iBitmap( NULL ), iJpegReadBuffer( NULL ), |
|
57 iExifThumbImage( NULL ), iFs( aFs ), iBuffer( NULL ) |
57 { |
58 { |
58 CActiveScheduler::Add( this ); |
59 CActiveScheduler::Add( this ); |
59 } |
60 } |
60 |
61 |
61 |
62 |
246 // ----------------------------------------------------------------------------- |
247 // ----------------------------------------------------------------------------- |
247 // |
248 // |
248 void CThumbnailImageDecoder::Release() |
249 void CThumbnailImageDecoder::Release() |
249 { |
250 { |
250 Cancel(); |
251 Cancel(); |
|
252 |
|
253 delete iDecoder; |
|
254 iDecoder = NULL; |
|
255 |
|
256 delete iBitmap; |
|
257 iBitmap = NULL; |
251 delete iJpegReadBuffer; |
258 delete iJpegReadBuffer; |
252 iJpegReadBuffer = NULL; |
259 iJpegReadBuffer = NULL; |
253 delete iExifThumbImage; |
260 delete iExifThumbImage; |
254 iExifThumbImage = NULL; |
261 iExifThumbImage = NULL; |
255 delete iDecoder; |
262 |
256 iDecoder = NULL; |
263 iBuffer = NULL; // we don't own the buffer |
257 } |
264 } |
258 |
265 |
259 |
266 |
260 // ----------------------------------------------------------------------------- |
267 // ----------------------------------------------------------------------------- |
261 // CThumbnailImageDecoder::DoCancel() |
268 // CThumbnailImageDecoder::DoCancel() |
264 void CThumbnailImageDecoder::DoCancel() |
271 void CThumbnailImageDecoder::DoCancel() |
265 { |
272 { |
266 if ( iDecoder ) |
273 if ( iDecoder ) |
267 { |
274 { |
268 iDecoder->Cancel(); |
275 iDecoder->Cancel(); |
269 delete iJpegReadBuffer; |
|
270 iJpegReadBuffer = NULL; |
|
271 delete iExifThumbImage; |
|
272 iExifThumbImage = NULL; |
|
273 delete iDecoder; |
276 delete iDecoder; |
274 iDecoder = NULL; |
277 iDecoder = NULL; |
275 } |
278 } |
|
279 |
|
280 delete iBitmap; |
|
281 iBitmap = NULL; |
|
282 delete iJpegReadBuffer; |
|
283 iJpegReadBuffer = NULL; |
|
284 delete iExifThumbImage; |
|
285 iExifThumbImage = NULL; |
|
286 |
|
287 iBuffer = NULL; // we don't own the buffer |
276 } |
288 } |
277 |
289 |
278 |
290 |
279 // ----------------------------------------------------------------------------- |
291 // ----------------------------------------------------------------------------- |
280 // CThumbnailImageDecoder::RunL() |
292 // CThumbnailImageDecoder::RunL() |
284 { |
296 { |
285 // This call takes ownership of iBitmap |
297 // This call takes ownership of iBitmap |
286 iObserver->ThumbnailProviderReady( iStatus.Int(), iBitmap, iOriginalSize, iEXIF, iPortrait ); |
298 iObserver->ThumbnailProviderReady( iStatus.Int(), iBitmap, iOriginalSize, iEXIF, iPortrait ); |
287 |
299 |
288 iBitmap = NULL; // owned by server now |
300 iBitmap = NULL; // owned by server now |
|
301 iBuffer = NULL; // we don't own the buffer |
|
302 |
289 Release(); |
303 Release(); |
290 } |
304 } |
291 |
305 |
292 |
306 |
293 // ----------------------------------------------------------------------------- |
307 // ----------------------------------------------------------------------------- |
568 { |
582 { |
569 options = ( CImageDecoder::TOptions )( CImageDecoder::EOptionNoDither | |
583 options = ( CImageDecoder::TOptions )( CImageDecoder::EOptionNoDither | |
570 CImageDecoder::EPreferFastDecode | CImageDecoder::EOptionAlwaysThread ); |
584 CImageDecoder::EPreferFastDecode | CImageDecoder::EOptionAlwaysThread ); |
571 } |
585 } |
572 |
586 |
573 TRAPD( err, iDecoder = CExtJpegDecoder::DataNewL( iFs, * iExifThumbImage, |
587 TRAPD( err, iDecoder = CExtJpegDecoder::DataNewL( iFs, * iExifThumbImage, options )); |
574 options )); |
|
575 |
588 |
576 if ( err == KErrNotFound || err == KErrNotSupported ) |
589 if ( err == KErrNotFound || err == KErrNotSupported ) |
577 { |
590 { |
578 delete iDecoder; |
591 delete iDecoder; |
579 iDecoder = NULL; |
592 iDecoder = NULL; |