imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailgeneratetask.cpp
equal
deleted
inserted
replaced
69 iMimeType = TDataType(KNullDesC8); |
69 iMimeType = TDataType(KNullDesC8); |
70 } |
70 } |
71 |
71 |
72 // scaled bitmaps to pool by default |
72 // scaled bitmaps to pool by default |
73 iScaledBitmapToPool = ETrue; |
73 iScaledBitmapToPool = ETrue; |
|
74 iBitmapHandle = 0; |
74 } |
75 } |
75 |
76 |
76 |
77 |
77 // --------------------------------------------------------------------------- |
78 // --------------------------------------------------------------------------- |
78 // CThumbnailGenerateTask::~CThumbnailGenerateTask() |
79 // CThumbnailGenerateTask::~CThumbnailGenerateTask() |
92 { |
93 { |
93 iMissingSizes->Reset(); |
94 iMissingSizes->Reset(); |
94 delete iMissingSizes; |
95 delete iMissingSizes; |
95 } |
96 } |
96 |
97 |
97 if ( iBitmap ) |
98 if ( iBitmapHandle ) |
98 { |
99 { |
99 iServer.DeleteBitmapFromPool( iBitmap->Handle()); |
100 iServer.DeleteBitmapFromPool( iBitmapHandle ); |
100 iBitmap = NULL; |
101 iBitmapHandle = 0; |
101 } |
102 } |
102 |
103 |
103 iProvider = NULL; |
104 iProvider = NULL; |
104 delete iBuffer; |
105 delete iBuffer; |
105 iBuffer = NULL; |
106 iBuffer = NULL; |
317 __ASSERT_DEBUG(( aBitmap ), ThumbnailPanic( EThumbnailNullPointer )); |
318 __ASSERT_DEBUG(( aBitmap ), ThumbnailPanic( EThumbnailNullPointer )); |
318 |
319 |
319 CleanupStack::PushL( aBitmap ); |
320 CleanupStack::PushL( aBitmap ); |
320 iServer.AddBitmapToPoolL( iRequestId.iSession, aBitmap, iRequestId ); |
321 iServer.AddBitmapToPoolL( iRequestId.iSession, aBitmap, iRequestId ); |
321 |
322 |
322 // Keep pointer so we can delete bitmap from pool |
323 // Keep handle so we can delete bitmap from pool |
323 iBitmap = aBitmap; |
324 iBitmapHandle = aBitmap->Handle(); |
324 CleanupStack::Pop( aBitmap ); |
325 CleanupStack::Pop( aBitmap ); |
325 |
326 |
326 // compTask is the scale task which returns the bitmap to the client |
327 // compTask is the scale task which returns the bitmap to the client |
327 CThumbnailScaleTask* complTask = NULL; |
328 CThumbnailScaleTask* complTask = NULL; |
328 |
329 |
353 TN_DEBUG2( "*iMissingSizes)[ i ].iHeight == %d", (*iMissingSizes)[ i ].iSize.iHeight ); |
354 TN_DEBUG2( "*iMissingSizes)[ i ].iHeight == %d", (*iMissingSizes)[ i ].iSize.iHeight ); |
354 } |
355 } |
355 } |
356 } |
356 |
357 |
357 CThumbnailScaleTask* scaleTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename, |
358 CThumbnailScaleTask* scaleTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename, |
358 iBitmap, iOriginalSize, (*iMissingSizes)[ i ].iSize, (*iMissingSizes)[ i ].iCrop, iDisplayMode, |
359 aBitmap, iOriginalSize, (*iMissingSizes)[ i ].iSize, (*iMissingSizes)[ i ].iCrop, iDisplayMode, |
359 KMaxPriority, iTargetUri, (*iMissingSizes)[ i ].iType, iModified, iScaledBitmapToPool, iEXIF, |
360 KMaxPriority, iTargetUri, (*iMissingSizes)[ i ].iType, iModified, iScaledBitmapToPool, iEXIF, |
360 iRequestId); |
361 iRequestId); |
361 CleanupStack::PushL( scaleTask ); |
362 CleanupStack::PushL( scaleTask ); |
362 |
363 |
363 TInt err1 = KErrNone; |
364 TInt err1 = KErrNone; |
389 |
390 |
390 // completion to first task, because task processor works like stack |
391 // completion to first task, because task processor works like stack |
391 if( i == 0 ) |
392 if( i == 0 ) |
392 { |
393 { |
393 // compTask is now responsible for completing the RMessage |
394 // compTask is now responsible for completing the RMessage |
394 scaleTask->SetMessageData( iRequestId, iMessage ); |
395 scaleTask->SetMessageData( iRequestId, iMessage, iClientThread ); |
395 ResetMessageData(); |
396 ResetMessageData(); |
396 } |
397 } |
397 } |
398 } |
398 } |
399 } |
399 else |
400 else |
410 iSize.iHeight = width; |
411 iSize.iHeight = width; |
411 } |
412 } |
412 } |
413 } |
413 |
414 |
414 complTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename, |
415 complTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename, |
415 iBitmap, iOriginalSize, iSize, iFlags& CThumbnailManager |
416 aBitmap, iOriginalSize, iSize, iFlags& CThumbnailManager |
416 ::ECropToAspectRatio, iDisplayMode, KMaxPriority, iTargetUri, |
417 ::ECropToAspectRatio, iDisplayMode, KMaxPriority, iTargetUri, |
417 iThumbnailSize, iModified, iScaledBitmapToPool, iEXIF, iRequestId ); |
418 iThumbnailSize, iModified, iScaledBitmapToPool, iEXIF, iRequestId ); |
418 CleanupStack::PushL( complTask ); |
419 CleanupStack::PushL( complTask ); |
419 |
420 |
420 TInt err1 = KErrNone; |
421 TInt err1 = KErrNone; |
444 iProcessor.AddTaskL( complTask ); |
445 iProcessor.AddTaskL( complTask ); |
445 CleanupStack::Pop( complTask ); |
446 CleanupStack::Pop( complTask ); |
446 |
447 |
447 // compTask is now responsible for completing the RMessage and |
448 // compTask is now responsible for completing the RMessage and |
448 // returning the bitmap to the client |
449 // returning the bitmap to the client |
449 complTask->SetMessageData( iRequestId, iMessage ); |
450 complTask->SetMessageData( iRequestId, iMessage, iClientThread ); |
450 ResetMessageData(); |
451 ResetMessageData(); |
451 } |
452 } |
452 |
453 |
453 // Scale tasks now reference the bitmap in the pool |
454 // Scale tasks now reference the bitmap in the pool |
454 iServer.DeleteBitmapFromPool( iBitmap->Handle()); |
455 iServer.DeleteBitmapFromPool( iBitmapHandle ); |
455 iBitmap = NULL; |
456 iBitmapHandle = 0; |
|
457 aBitmap = NULL; |
456 } |
458 } |
457 |
459 |
458 // --------------------------------------------------------------------------- |
460 // --------------------------------------------------------------------------- |
459 // Defines if scaled bitmaps need to be added to pool |
461 // Defines if scaled bitmaps need to be added to pool |
460 // --------------------------------------------------------------------------- |
462 // --------------------------------------------------------------------------- |