imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailscaletask.cpp
changeset 54 48dd0f169f0d
parent 42 2e2a89493e2b
equal deleted inserted replaced
42:2e2a89493e2b 54:48dd0f169f0d
     1 /*
       
     2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Task for scaling thumbnails.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <fbs.h>
       
    21 #include <e32math.h>
       
    22 #include <bitdev.h>
       
    23 #include <bitstd.h>
       
    24 
       
    25 #include "thumbnailscaletask.h"
       
    26 #include "thumbnailprovider.h"
       
    27 #include "thumbnailserver.h"
       
    28 #include "thumbnailmanagerconstants.h"
       
    29 #include "thumbnaillog.h"
       
    30 #include "thumbnailpanic.h"
       
    31 #include "OstTraceDefinitions.h"
       
    32 #ifdef OST_TRACE_COMPILER_IN_USE
       
    33 #include "thumbnailscaletaskTraces.h"
       
    34 #endif
       
    35 
       
    36 
       
    37 
       
    38 // ======== MEMBER FUNCTIONS ========
       
    39 
       
    40 // ---------------------------------------------------------------------------
       
    41 // CThumbnailScaleTask::NewL()
       
    42 // Two-phased constructor.
       
    43 // ---------------------------------------------------------------------------
       
    44 //
       
    45 CThumbnailScaleTask* CThumbnailScaleTask::NewL( CThumbnailTaskProcessor&
       
    46     aProcessor, CThumbnailServer& aServer, const TDesC& aFilename, CFbsBitmap*
       
    47     aBitmap, const TSize& aOriginalSize, const TSize& aTargetSize, TBool aCrop,
       
    48     TDisplayMode aDisplayMode, TInt aPriority, const TDesC& aTargetUri,
       
    49     const TThumbnailSize aThumbnailSize, const TInt64 aModified,
       
    50     TBool aBitmapToPool, const TBool aEXIF, const TThumbnailServerRequestId aRequestId,
       
    51     const TBool aImportVirtual)
       
    52     {
       
    53     // We take ownership of aBitmap
       
    54     CleanupStack::PushL( aBitmap );
       
    55     CThumbnailScaleTask* self = new( ELeave )CThumbnailScaleTask( aProcessor,
       
    56         aServer, aFilename, aBitmap, aOriginalSize, aTargetSize, aCrop,
       
    57         aDisplayMode, aPriority, aTargetUri, aThumbnailSize, aModified,
       
    58         aBitmapToPool, aEXIF, aRequestId, aImportVirtual);
       
    59     CleanupStack::Pop( aBitmap );
       
    60     CleanupStack::PushL( self );
       
    61     self->ConstructL();
       
    62     CleanupStack::Pop( self );
       
    63     return self;
       
    64     }
       
    65 
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // CThumbnailScaleTask::CThumbnailScaleTask()
       
    69 // C++ default constructor can NOT contain any code, that might leave.
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 CThumbnailScaleTask::CThumbnailScaleTask( CThumbnailTaskProcessor& aProcessor,
       
    73     CThumbnailServer& aServer, const TDesC& aFilename, CFbsBitmap* aBitmap,
       
    74     const TSize& aOriginalSize, const TSize& aTargetSize, TBool aCrop,
       
    75     TDisplayMode aDisplayMode, TInt aPriority, const TDesC& aTargetUri,
       
    76     const TThumbnailSize aThumbnailSize, const TInt64 aModified,
       
    77     TBool aBitmapToPool, const TBool aEXIF, const TThumbnailServerRequestId aRequestId,
       
    78     const TBool aVirtualUri):
       
    79     CThumbnailTask( aProcessor, aPriority ), iServer( aServer ), iOwnBitmap( aBitmap ),
       
    80     iOriginalSize( aOriginalSize ), iTargetSize(aTargetSize), iTargetSizeTN( aTargetSize ), iCrop( aCrop ),
       
    81     iDisplayMode( aDisplayMode ), iFilename( aFilename ), iTargetUri( aTargetUri ),
       
    82     iThumbnailSize(aThumbnailSize), iModified(aModified),
       
    83     iBitmapToPool(aBitmapToPool), iEXIF(aEXIF), iVirtualUri( aVirtualUri )
       
    84     {
       
    85     TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::CThumbnailScaleTask()", this );
       
    86     OstTrace1( TRACE_NORMAL, CTHUMBNAILSCALETASK_CTHUMBNAILSCALETASK, "CThumbnailScaleTask::CThumbnailScaleTask;this=%o", this );
       
    87     
       
    88     iRequestId = aRequestId;
       
    89     }
       
    90 
       
    91 
       
    92 // ---------------------------------------------------------------------------
       
    93 // CThumbnailScaleTask::ConstructL()
       
    94 // Symbian 2nd phase constructor can leave.
       
    95 // ---------------------------------------------------------------------------
       
    96 //
       
    97 void CThumbnailScaleTask::ConstructL()
       
    98     {
       
    99     iServer.AddBitmapToPoolL( iRequestId.iSession, iOwnBitmap, iRequestId );
       
   100 
       
   101     // Successfully added bitmap to pool, we are no longer responsible for
       
   102     // deleting it directly.
       
   103     iBitmap = iOwnBitmap;
       
   104     iOwnBitmap = NULL;
       
   105     iBitmapInPool = ETrue;
       
   106     
       
   107     iScaledBitmap = NULL;
       
   108     }
       
   109 
       
   110 
       
   111 // ---------------------------------------------------------------------------
       
   112 // CThumbnailScaleTask::~CThumbnailScaleTask()
       
   113 // Destructor.
       
   114 // ---------------------------------------------------------------------------
       
   115 //
       
   116 CThumbnailScaleTask::~CThumbnailScaleTask()
       
   117     {
       
   118     iServer.CancelScale();
       
   119     
       
   120     if ( iBitmapInPool && iBitmap )
       
   121         {
       
   122         TN_DEBUG1("CThumbnailScaleTask()::~CThumbnailScaleTask() delete original bitmap from pool");
       
   123         OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSCALETASK_CTHUMBNAILSCALETASK, "CThumbnailScaleTask::~CThumbnailScaleTask - delete original bitmap from pool" );
       
   124         
       
   125         // Original bitmap is owned by server, decrease reference count
       
   126         iServer.DeleteBitmapFromPool( iBitmap->Handle());
       
   127         }
       
   128 
       
   129     // Scaled bitmap is owned by us, delete now
       
   130     delete iScaledBitmap;
       
   131     iScaledBitmap = NULL;
       
   132     }
       
   133 
       
   134 
       
   135 // ---------------------------------------------------------------------------
       
   136 // CThumbnailScaleTask::StartL()
       
   137 // ---------------------------------------------------------------------------
       
   138 //
       
   139 void CThumbnailScaleTask::StartL()
       
   140     {
       
   141     TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::StartL()", this );
       
   142     OstTrace1( TRACE_NORMAL, CTHUMBNAILSCALETASK_STARTL, "CThumbnailScaleTask::StartL;this=%o", this );
       
   143 
       
   144     CThumbnailTask::StartL();
       
   145 
       
   146     if ( !iCrop )
       
   147         {
       
   148         TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::StartL() - cropping OFF", this );
       
   149         OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSCALETASK_STARTL, "CThumbnailScaleTask::StartL - cropping OFF;this=%o", this );
       
   150     
       
   151         // target size at max, keep aspect ratio
       
   152         CalculateTargetSize();
       
   153         }
       
   154     else
       
   155         {
       
   156         TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::StartL() - cropping ON", this );
       
   157         OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSCALETASK_STARTL, "CThumbnailScaleTask::StartL - cropping ON;this=%o", this );
       
   158     
       
   159         // exact target size, crop excess
       
   160         CalculateCropRectangle();
       
   161         }
       
   162     
       
   163     TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::StartL() - sizes calculated", this );
       
   164     OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILSCALETASK_STARTL, "CThumbnailScaleTask::StartL - sizes calculated;this=%o", this );
       
   165     
       
   166 #ifdef _DEBUG
       
   167     aStart.UniversalTime();
       
   168 #endif
       
   169     
       
   170     delete iScaledBitmap;
       
   171     iScaledBitmap = NULL;
       
   172     iScaledBitmap = new( ELeave )CFbsBitmap();
       
   173     
       
   174     TSize bitmapSize = iBitmap->SizeInPixels();
       
   175     
       
   176     if(bitmapSize.iHeight == iTargetSize.iHeight && bitmapSize.iWidth == iTargetSize.iWidth)
       
   177         {
       
   178         TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::StartL() - no need for scaling", this);
       
   179         OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILSCALETASK_STARTL, "CThumbnailScaleTask::StartL - no need for scaling;this=%o", this );
       
   180     
       
   181         // copy bitmap 1:1
       
   182         User::LeaveIfError( iScaledBitmap->Create( bitmapSize, iBitmap->DisplayMode() ));
       
   183         CFbsBitmapDevice* device = CFbsBitmapDevice::NewL(iScaledBitmap);
       
   184         CleanupStack::PushL(device);
       
   185         CFbsBitGc* gc = NULL;
       
   186         User::LeaveIfError(device->CreateContext(gc));
       
   187         CleanupStack::PushL(gc);
       
   188         gc->BitBlt(TPoint(0, 0), iBitmap);
       
   189         CleanupStack::PopAndDestroy(2, device); // gc
       
   190         
       
   191         TRAPD( err, StoreAndCompleteL());
       
   192         Complete( err );
       
   193         ResetMessageData();
       
   194         }
       
   195     else
       
   196         {
       
   197         TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::StartL() - scaling", this);
       
   198         OstTrace1( TRACE_NORMAL, DUP5_CTHUMBNAILSCALETASK_STARTL, "CThumbnailScaleTask::StartL - scaling;this=%o", this );
       
   199         
       
   200         User::LeaveIfError( iScaledBitmap->Create( iTargetSize, iBitmap->DisplayMode() ));
       
   201         iServer.ScaleBitmapL( iStatus, * iBitmap, * iScaledBitmap, iCropRectangle );
       
   202         SetActive();
       
   203         }  
       
   204     
       
   205     TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::StartL() end", this );
       
   206     OstTrace1( TRACE_NORMAL, DUP6_CTHUMBNAILSCALETASK_STARTL, "CThumbnailScaleTask::StartL - end;this=%o", this );
       
   207     }
       
   208 
       
   209 
       
   210 // ---------------------------------------------------------------------------
       
   211 // CThumbnailScaleTask::RunL()
       
   212 // ---------------------------------------------------------------------------
       
   213 //
       
   214 void CThumbnailScaleTask::RunL()
       
   215     {
       
   216     TInt err = iStatus.Int();
       
   217 
       
   218     TN_DEBUG3( "CThumbnailScaleTask(0x%08x)::RunL() err=%d)", this, err );
       
   219     OstTrace1( TRACE_NORMAL, CTHUMBNAILSCALETASK_RUNL, "CThumbnailScaleTask::RunL;this=%o", this );
       
   220     OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSCALETASK_RUNL, "CThumbnailScaleTask::RunL;err=%d", err );
       
   221 
       
   222     #ifdef _DEBUG
       
   223     aStop.UniversalTime();
       
   224     TInt tookTime = (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000;
       
   225     TN_DEBUG2( "CThumbnailScaleTask::RunL() scale took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000);
       
   226     OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSCALETASK_RUNL, "CThumbnailScaleTask::RunL - scale took ms;tookTime=%d", tookTime );
       
   227     #endif
       
   228 
       
   229     if ( !err )
       
   230         {
       
   231         TRAP( err, StoreAndCompleteL());
       
   232         }
       
   233     
       
   234     Complete( err );
       
   235     ResetMessageData();
       
   236     }
       
   237 
       
   238 
       
   239 // ---------------------------------------------------------------------------
       
   240 // CThumbnailScaleTask::DoCancel()
       
   241 // ---------------------------------------------------------------------------
       
   242 //
       
   243 void CThumbnailScaleTask::DoCancel()
       
   244     {
       
   245     TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::DoCancel()", this );
       
   246     OstTrace1( TRACE_NORMAL, CTHUMBNAILSCALETASK_DOCANCEL, "CThumbnailScaleTask::DoCancel;this=%o", this );
       
   247     iServer.CancelScale();
       
   248     }
       
   249 
       
   250 
       
   251 // ---------------------------------------------------------------------------
       
   252 // Calculates target size to be used for the thumbnail
       
   253 // ---------------------------------------------------------------------------
       
   254 //
       
   255 void CThumbnailScaleTask::CalculateTargetSize()
       
   256     {
       
   257     __ASSERT_DEBUG( iOriginalSize.iHeight && iTargetSize.iHeight,
       
   258         ThumbnailPanic( EThumbnailBadSize ));
       
   259     
       
   260     if ( (iThumbnailSize == EFullScreenThumbnailSize ||
       
   261           iThumbnailSize == EImageFullScreenThumbnailSize ||
       
   262           iThumbnailSize == EVideoFullScreenThumbnailSize ||
       
   263           iThumbnailSize == EAudioFullScreenThumbnailSize ||
       
   264           iThumbnailSize == EContactFullScreenThumbnailSize) &&
       
   265           iOriginalSize.iHeight < iTargetSize.iHeight && 
       
   266           iOriginalSize.iWidth < iTargetSize.iWidth )
       
   267         {
       
   268         // do not upscale fullscreen thumbs
       
   269         iTargetSize = iOriginalSize;
       
   270         }
       
   271     else if ( iOriginalSize.iHeight && iTargetSize.iHeight )
       
   272         {
       
   273         const TReal32 srcAspect = static_cast < TReal32 > (
       
   274             iOriginalSize.iWidth ) / iOriginalSize.iHeight;
       
   275 
       
   276         // scale to maximum size within target size 
       
   277         if ( (iTargetSize.iHeight * srcAspect) <= iTargetSize.iWidth )
       
   278             {
       
   279             TReal trg = 0;
       
   280             TReal src( iTargetSize.iHeight * srcAspect );
       
   281             Math::Round( trg, src, 0 );
       
   282             iTargetSize.SetSize( trg, iTargetSize.iHeight );
       
   283             }
       
   284         else
       
   285             {
       
   286             TReal trg;
       
   287             TReal src( iTargetSize.iWidth / srcAspect );
       
   288             Math::Round( trg, src, 0 );
       
   289             iTargetSize.SetSize( iTargetSize.iWidth, trg );
       
   290             }
       
   291         }
       
   292     else
       
   293         {
       
   294         iTargetSize.SetSize( 0, 0 );
       
   295         }
       
   296     iCropRectangle.SetRect( TPoint(), iBitmap->SizeInPixels());
       
   297     }
       
   298 
       
   299 
       
   300 // ---------------------------------------------------------------------------
       
   301 // Calculates target size to be used for the thumbnail
       
   302 // ---------------------------------------------------------------------------
       
   303 //
       
   304 void CThumbnailScaleTask::CalculateCropRectangle()
       
   305     {
       
   306     const TSize srcSize = iBitmap->SizeInPixels();
       
   307 
       
   308     __ASSERT_DEBUG( srcSize.iHeight && iTargetSize.iHeight, ThumbnailPanic(
       
   309         EThumbnailBadSize ));
       
   310 
       
   311     if ( srcSize.iHeight && iTargetSize.iHeight )
       
   312         {
       
   313         const TReal32 srcAspect = static_cast < TReal32 > ( srcSize.iWidth ) /
       
   314             srcSize.iHeight;
       
   315         const TReal32 reqAspect = static_cast < TReal32 > ( iTargetSize.iWidth )
       
   316             / iTargetSize.iHeight;
       
   317 
       
   318         if ( (iTargetSize.iHeight * srcAspect) > iTargetSize.iWidth )
       
   319             {
       
   320             // Thumbnail is wider than requested and we crop
       
   321             // some of the right and left parts.
       
   322             TReal trg;
       
   323             TReal src( srcSize.iHeight* reqAspect );
       
   324             Math::Round( trg, src, 0 );
       
   325             const TSize cropSize( trg, srcSize.iHeight );
       
   326             iCropRectangle.iTl.SetXY(( srcSize.iWidth - cropSize.iWidth ) / 2, 0 );
       
   327             iCropRectangle.SetSize( cropSize );
       
   328             }
       
   329         else
       
   330             {
       
   331             // Thumbnail is taller than requested and we crop
       
   332             // some of the top and bottom parts.
       
   333             TReal trg;
       
   334             TReal src( srcSize.iWidth / reqAspect );
       
   335             Math::Round( trg, src, 0 );
       
   336             const TSize cropSize( srcSize.iWidth, trg );
       
   337             iCropRectangle.iTl.SetXY(0, ( srcSize.iHeight - cropSize.iHeight ) / 2 );
       
   338             iCropRectangle.SetSize( cropSize );
       
   339             }
       
   340 
       
   341         }
       
   342     else
       
   343         {
       
   344         iTargetSize.SetSize( 0, 0 );
       
   345         }
       
   346     }
       
   347 
       
   348 // ---------------------------------------------------------------------------
       
   349 // CThumbnailScaleTask::StoreAndCompleteL()
       
   350 // ---------------------------------------------------------------------------
       
   351 //
       
   352 void CThumbnailScaleTask::StoreAndCompleteL()
       
   353     {
       
   354     TN_DEBUG6( "CThumbnailScaleTask(0x%08x)::StoreAndCompleteL() iFilename=%S, iThumbnailSize=%d, iBitmap=0x%08x, iScaledBitmap=0x%08x)", 
       
   355                this, &iFilename, iThumbnailSize, iBitmap, iScaledBitmap );
       
   356     OstTrace1( TRACE_NORMAL, CTHUMBNAILSCALETASK_STOREANDCOMPLETEL, "CThumbnailScaleTask::StoreAndCompleteL;this=%o", this );
       
   357 	OstTraceExt1( TRACE_NORMAL, DUP1_CTHUMBNAILSCALETASK_STOREANDCOMPLETEL, "CThumbnailScaleTask::StoreAndCompleteL;iFilename=%S", iFilename );
       
   358 	OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSCALETASK_STOREANDCOMPLETEL, "CThumbnailScaleTask::StoreAndCompleteL;iBitmap=%o", iBitmap );
       
   359 	
       
   360 		 
       
   361     // do not store TN if quality is too low eg. orignal size of image is smaller than requested size
       
   362     // (do not store upscaled images)
       
   363     if ( (iTargetSizeTN.iWidth > iOriginalSize.iWidth || iTargetSizeTN.iHeight > iOriginalSize.iHeight) && iEXIF)
       
   364         {
       
   365         TN_DEBUG1("CThumbnailScaleTask()::StoreAndCompleteL() too low quality");
       
   366         OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILSCALETASK_STOREANDCOMPLETEL, "CThumbnailScaleTask::StoreAndCompleteL - too low quality" );
       
   367         iDoStore = EFalse;
       
   368         }
       
   369     
       
   370     TN_DEBUG3("CThumbnailScaleTask(0x%08x)::StoreAndCompleteL() iDoStore = %d", this, iDoStore);
       
   371     OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILSCALETASK_STOREANDCOMPLETEL, "CThumbnailScaleTask::StoreAndCompleteL;this=%o", this );
       
   372     
       
   373     if ( iDoStore )
       
   374         {
       
   375         if (iTargetUri != KNullDesC)
       
   376             {
       
   377             if (iFilename != KNullDesC && iFilename.CompareF(iTargetUri) == 0)
       
   378                 {
       
   379                 // filename and target URI match, so thumb created from associated path
       
   380                 iServer.StoreThumbnailL( iTargetUri, iScaledBitmap, iOriginalSize, iCrop, 
       
   381                                          iThumbnailSize, iModified, !iVirtualUri, !iVirtualUri );
       
   382                 }
       
   383             else
       
   384                 {
       
   385                 // thumb not created from associated path
       
   386                 iServer.StoreThumbnailL( iTargetUri, iScaledBitmap, iOriginalSize, iCrop, 
       
   387                                          iThumbnailSize, iModified, !iVirtualUri, EFalse );
       
   388                 }  
       
   389             }
       
   390         else if (iFilename != KNullDesC)
       
   391             {
       
   392             iServer.StoreThumbnailL( iFilename, iScaledBitmap, iOriginalSize, iCrop, 
       
   393                                      iThumbnailSize, iModified, !iVirtualUri, !iVirtualUri );
       
   394             }
       
   395         }    
       
   396     
       
   397     if ( ClientThreadAlive() )
       
   398         {
       
   399         TThumbnailRequestParams& params = iParamsBuf();
       
   400         iMessage.ReadL( 0, iParamsBuf );
       
   401                     
       
   402         // if need to add scaled bitmap to pool
       
   403         if (iBitmapToPool)
       
   404             {
       
   405             TN_DEBUG1("CThumbnailScaleTask()::StoreAndCompleteL() scaled bitmap handle to params");
       
   406             OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILSCALETASK_STOREANDCOMPLETEL, "CThumbnailScaleTask::StoreAndCompleteL" );
       
   407             
       
   408             params.iBitmapHandle = iScaledBitmap->Handle();
       
   409             }    
       
   410 		
       
   411 	    if( params.iQualityPreference == CThumbnailManager::EOptimizeForQualityWithPreview
       
   412 	        && iEXIF && !iDoStore)
       
   413 	        {
       
   414             TN_DEBUG1("CThumbnailScaleTask()::StoreAndCompleteL() EThumbnailPreviewThumbnail");
       
   415             OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILSCALETASK_STOREANDCOMPLETEL, "CThumbnailScaleTask::StoreAndCompleteL - EThumbnailPreviewThumbnail" );
       
   416             
       
   417 		    // this is upscaled preview image
       
   418 	        params.iControlFlags = EThumbnailPreviewThumbnail;
       
   419 	        }
       
   420 	    
       
   421         TN_DEBUG1("CThumbnailScaleTask()::StoreAndCompleteL() write params to message");
       
   422         OstTrace0( TRACE_NORMAL, DUP7_CTHUMBNAILSCALETASK_STOREANDCOMPLETEL, "CThumbnailScaleTask::StoreAndCompleteL - write params to message" );
       
   423         
       
   424 	    // pass bitmap handle to client
       
   425 	    iMessage.WriteL( 0, iParamsBuf );
       
   426 	    
       
   427         if (iBitmapToPool)
       
   428             {
       
   429             TN_DEBUG1("CThumbnailScaleTask()::StoreAndCompleteL() scaled bitmap to pool");
       
   430             OstTrace0( TRACE_NORMAL, DUP8_CTHUMBNAILSCALETASK_STOREANDCOMPLETEL, "CThumbnailScaleTask::StoreAndCompleteL - scaled bitmap to pool" );
       
   431             
       
   432             iServer.AddBitmapToPoolL( iRequestId.iSession, iScaledBitmap, iRequestId );
       
   433             iScaledBitmap = NULL; // Server owns the bitmap now
       
   434             }
       
   435         }
       
   436     
       
   437     TN_DEBUG1("CThumbnailScaleTask()::StoreAndCompleteL() - end");
       
   438     OstTrace0( TRACE_NORMAL, DUP9_CTHUMBNAILSCALETASK_STOREANDCOMPLETEL, "CThumbnailScaleTask::StoreAndCompleteL - end" );
       
   439     }
       
   440 
       
   441 
       
   442 // ---------------------------------------------------------------------------
       
   443 // CThumbnailScaleTask::StoreAndCompleteL()
       
   444 // Changes priority of the task.
       
   445 // ---------------------------------------------------------------------------
       
   446 //
       
   447 void CThumbnailScaleTask::ChangeTaskPriority( TInt /*aNewPriority*/ )
       
   448     {
       
   449     // The priority of scale tasks is fixed. Do nothing.
       
   450     }
       
   451 
       
   452 // ---------------------------------------------------------------------------
       
   453 // CThumbnailScaleTask::SetDoStore()
       
   454 // Changes the store flag
       
   455 // ---------------------------------------------------------------------------
       
   456 //
       
   457 void CThumbnailScaleTask::SetDoStore( TBool aDoStore )
       
   458     {
       
   459     iDoStore = aDoStore;
       
   460     }