imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoderv2.cpp
branchRCL_3
changeset 15 f0aa341a25bf
parent 9 dea39715fc05
child 20 2b4b06654caa
equal deleted inserted replaced
14:ad31f4183ddc 15:f0aa341a25bf
    31 //------------------------------------------------------------------------
    31 //------------------------------------------------------------------------
    32 // CThumbnailImageDecoder::CThumbnailImageDecoder()
    32 // CThumbnailImageDecoder::CThumbnailImageDecoder()
    33 // C++ default constructor can NOT contain any code, that might leave.
    33 // C++ default constructor can NOT contain any code, that might leave.
    34 // ---------------------------------------------------------------------------
    34 // ---------------------------------------------------------------------------
    35 //
    35 //
    36 CThumbnailImageDecoderv2::CThumbnailImageDecoderv2( RFs& aFs): CActive(
    36 CThumbnailImageDecoderv2::CThumbnailImageDecoderv2( RFs& aFs): 
    37     EPriorityStandard ), iFs( aFs )
    37     CActive(EPriorityStandard ), iBitmap( NULL ), iFs( aFs ), iBuffer( NULL )
    38     {
    38     {
    39     CActiveScheduler::Add( this );
    39     CActiveScheduler::Add( this );
    40     }
    40     }
    41 
    41 
    42 
    42 
    91         iBitmap = NULL;
    91         iBitmap = NULL;
    92         User::Leave(err);
    92         User::Leave(err);
    93         }
    93         }
    94     
    94     
    95     iDecoder->Convert( &iStatus, * iBitmap );
    95     iDecoder->Convert( &iStatus, * iBitmap );
    96     while ( iStatus == KErrUnderflow )
    96 
    97         {
       
    98         iDecoder->ContinueConvert( &iStatus );
       
    99         }
       
   100     SetActive();  
    97     SetActive();  
   101     
    98     
   102     TN_DEBUG1( "CThumbnailImageDecoderv2::DecodeL() end" );
    99     TN_DEBUG1( "CThumbnailImageDecoderv2::DecodeL() end" );
   103     }
   100     }
   104 
   101 
   109 // -----------------------------------------------------------------------------
   106 // -----------------------------------------------------------------------------
   110 //
   107 //
   111 void CThumbnailImageDecoderv2::Release()
   108 void CThumbnailImageDecoderv2::Release()
   112     {
   109     {
   113     Cancel();
   110     Cancel();
       
   111     
   114     delete iDecoder;
   112     delete iDecoder;
   115     iDecoder = NULL;
   113     iDecoder = NULL;
       
   114     
       
   115     delete iBitmap;
       
   116     iBitmap = NULL;
       
   117     
       
   118     iBuffer = NULL; // we don't own the buffer
   116     }
   119     }
   117 
   120 
   118 
   121 
   119 // -----------------------------------------------------------------------------
   122 // -----------------------------------------------------------------------------
   120 // CThumbnailImageDecoder::DoCancel()
   123 // CThumbnailImageDecoder::DoCancel()
   126         {
   129         {
   127         iDecoder->Cancel();
   130         iDecoder->Cancel();
   128         delete iDecoder;
   131         delete iDecoder;
   129         iDecoder = NULL;
   132         iDecoder = NULL;
   130         }
   133         }
       
   134     
       
   135     delete iBitmap;
       
   136     iBitmap = NULL;
       
   137     
       
   138     iBuffer = NULL; // we don't own the buffer
   131     }
   139     }
   132 
   140 
   133 
   141 
   134 // -----------------------------------------------------------------------------
   142 // -----------------------------------------------------------------------------
   135 // CThumbnailImageDecoder::RunL()
   143 // CThumbnailImageDecoder::RunL()
   141     // EXIF always false
   149     // EXIF always false
   142     // Rotated always false
   150     // Rotated always false
   143     iObserver->ThumbnailProviderReady( iStatus.Int(), iBitmap, iOriginalSize, EFalse, EFalse);
   151     iObserver->ThumbnailProviderReady( iStatus.Int(), iBitmap, iOriginalSize, EFalse, EFalse);
   144 
   152 
   145     iBitmap = NULL; // owned by server now
   153     iBitmap = NULL; // owned by server now
   146     iBuffer = NULL;
   154     iBuffer = NULL; // we don't own the buffer
       
   155     
   147     Release();
   156     Release();
   148     }
   157     }
   149 
   158 
   150 
   159 
   151 // -----------------------------------------------------------------------------
   160 // -----------------------------------------------------------------------------