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() |
172 } |
173 } |
173 |
174 |
174 DoBlacklisting( providerErr, TSize(0,0) ); |
175 DoBlacklisting( providerErr, TSize(0,0) ); |
175 |
176 |
176 User::LeaveIfError( providerErr ); |
177 User::LeaveIfError( providerErr ); |
|
178 |
|
179 TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::StartL() end", this ); |
177 } |
180 } |
178 |
181 |
179 |
182 |
180 // --------------------------------------------------------------------------- |
183 // --------------------------------------------------------------------------- |
181 // CThumbnailGenerateTask::RunL() |
184 // CThumbnailGenerateTask::RunL() |
315 __ASSERT_DEBUG(( aBitmap ), ThumbnailPanic( EThumbnailNullPointer )); |
318 __ASSERT_DEBUG(( aBitmap ), ThumbnailPanic( EThumbnailNullPointer )); |
316 |
319 |
317 CleanupStack::PushL( aBitmap ); |
320 CleanupStack::PushL( aBitmap ); |
318 iServer.AddBitmapToPoolL( iRequestId.iSession, aBitmap, iRequestId ); |
321 iServer.AddBitmapToPoolL( iRequestId.iSession, aBitmap, iRequestId ); |
319 |
322 |
320 // Keep pointer so we can delete bitmap from pool |
323 // Keep handle so we can delete bitmap from pool |
321 iBitmap = aBitmap; |
324 iBitmapHandle = aBitmap->Handle(); |
322 CleanupStack::Pop( aBitmap ); |
325 CleanupStack::Pop( aBitmap ); |
323 |
326 |
324 // 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 |
325 CThumbnailScaleTask* complTask = NULL; |
328 CThumbnailScaleTask* complTask = NULL; |
326 |
329 |
351 TN_DEBUG2( "*iMissingSizes)[ i ].iHeight == %d", (*iMissingSizes)[ i ].iSize.iHeight ); |
354 TN_DEBUG2( "*iMissingSizes)[ i ].iHeight == %d", (*iMissingSizes)[ i ].iSize.iHeight ); |
352 } |
355 } |
353 } |
356 } |
354 |
357 |
355 CThumbnailScaleTask* scaleTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename, |
358 CThumbnailScaleTask* scaleTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename, |
356 iBitmap, iOriginalSize, (*iMissingSizes)[ i ].iSize, (*iMissingSizes)[ i ].iCrop, iDisplayMode, |
359 aBitmap, iOriginalSize, (*iMissingSizes)[ i ].iSize, (*iMissingSizes)[ i ].iCrop, iDisplayMode, |
357 KMaxPriority, iTargetUri, (*iMissingSizes)[ i ].iType, iModified, iScaledBitmapToPool, iEXIF ); |
360 KMaxPriority, iTargetUri, (*iMissingSizes)[ i ].iType, iModified, iScaledBitmapToPool, iEXIF, |
|
361 iRequestId); |
358 CleanupStack::PushL( scaleTask ); |
362 CleanupStack::PushL( scaleTask ); |
359 |
363 |
360 TInt err1 = KErrNone; |
364 TInt err1 = KErrNone; |
361 TInt err2 = KErrNone; |
365 TInt err2 = KErrNone; |
362 if(iFilename != KNullDesC) |
366 if(iFilename != KNullDesC) |
399 { |
403 { |
400 if ( iThumbnailSize == EFullScreenThumbnailSize || |
404 if ( iThumbnailSize == EFullScreenThumbnailSize || |
401 iThumbnailSize == EVideoFullScreenThumbnailSize || |
405 iThumbnailSize == EVideoFullScreenThumbnailSize || |
402 iThumbnailSize == EAudioFullScreenThumbnailSize || |
406 iThumbnailSize == EAudioFullScreenThumbnailSize || |
403 iThumbnailSize == EImageFullScreenThumbnailSize ) |
407 iThumbnailSize == EImageFullScreenThumbnailSize ) |
404 { |
408 { |
405 TInt width = iSize.iWidth; |
409 TInt width = iSize.iWidth; |
406 iSize.iWidth = iSize.iHeight; |
410 iSize.iWidth = iSize.iHeight; |
407 iSize.iHeight = width; |
411 iSize.iHeight = width; |
408 } |
412 } |
409 } |
413 } |
410 |
414 |
411 complTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename, |
415 complTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename, |
412 iBitmap, iOriginalSize, iSize, iFlags& CThumbnailManager |
416 aBitmap, iOriginalSize, iSize, iFlags& CThumbnailManager |
413 ::ECropToAspectRatio, iDisplayMode, KMaxPriority, iTargetUri, |
417 ::ECropToAspectRatio, iDisplayMode, KMaxPriority, iTargetUri, |
414 iThumbnailSize, iModified, iScaledBitmapToPool, iEXIF ); |
418 iThumbnailSize, iModified, iScaledBitmapToPool, iEXIF, iRequestId ); |
415 CleanupStack::PushL( complTask ); |
419 CleanupStack::PushL( complTask ); |
416 |
420 |
417 TInt err1 = KErrNone; |
421 TInt err1 = KErrNone; |
418 TInt err2 = KErrNone; |
422 TInt err2 = KErrNone; |
419 if(iFilename != KNullDesC) |
423 if(iFilename != KNullDesC) |
441 iProcessor.AddTaskL( complTask ); |
445 iProcessor.AddTaskL( complTask ); |
442 CleanupStack::Pop( complTask ); |
446 CleanupStack::Pop( complTask ); |
443 |
447 |
444 // compTask is now responsible for completing the RMessage and |
448 // compTask is now responsible for completing the RMessage and |
445 // returning the bitmap to the client |
449 // returning the bitmap to the client |
446 complTask->SetMessageData( iRequestId, iMessage ); |
450 complTask->SetMessageData( iRequestId, iMessage, iClientThread ); |
447 ResetMessageData(); |
451 ResetMessageData(); |
448 } |
452 } |
449 |
453 |
450 // Scale tasks now reference the bitmap in the pool |
454 // Scale tasks now reference the bitmap in the pool |
451 iServer.DeleteBitmapFromPool( iBitmap->Handle()); |
455 iServer.DeleteBitmapFromPool( iBitmapHandle ); |
452 iBitmap = NULL; |
456 iBitmapHandle = 0; |
|
457 aBitmap = NULL; |
453 } |
458 } |
454 |
459 |
455 // --------------------------------------------------------------------------- |
460 // --------------------------------------------------------------------------- |
456 // Defines if scaled bitmaps need to be added to pool |
461 // Defines if scaled bitmaps need to be added to pool |
457 // --------------------------------------------------------------------------- |
462 // --------------------------------------------------------------------------- |
509 if (aError == KErrNotFound || |
514 if (aError == KErrNotFound || |
510 aError == KErrNotSupported || |
515 aError == KErrNotSupported || |
511 aError == KErrCorrupt || |
516 aError == KErrCorrupt || |
512 aError == KErrCompletion || |
517 aError == KErrCompletion || |
513 aError == KErrUnderflow || |
518 aError == KErrUnderflow || |
514 aError == KErrNotReady) |
519 aError == KErrNotReady || |
|
520 aError == KErrGeneral ) |
515 { |
521 { |
516 |
522 |
517 if(iMissingSizes) |
523 if(iMissingSizes) |
518 { |
524 { |
519 TN_DEBUG2( "CThumbnailGenerateTask::DoBlacklisting() - blacklist missing sizes count = %d", iMissingSizes->Count() ); |
525 TN_DEBUG2( "CThumbnailGenerateTask::DoBlacklisting() - blacklist missing sizes count = %d", iMissingSizes->Count() ); |