engine/src/ImageHandler.cpp
author teknolog
Sat, 27 Feb 2010 16:41:36 +0000
changeset 20 c92d8384952c
parent 2 29cda98b007e
child 32 26a3f2dfba08
permissions -rw-r--r--
Fix so only actually added feeds are counted during import
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     1
/*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     2
* Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     3
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     4
* All rights reserved.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     5
* This component and the accompanying materials are made available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     6
* under the terms of the License "Eclipse Public License v1.0"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     7
* which accompanies this distribution, and is available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     8
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     9
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    10
* Initial Contributors:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    11
* EmbedDev AB - initial contribution.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    12
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    13
* Contributors:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    14
* Example code from OcrExample Copyright (c) 2006 Nokia Corporation.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    15
* Description:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    16
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    17
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    18
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    19
#include "ImageHandler.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    20
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    21
// =============================================================================
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    22
// CImageHandler, a utility class for loading images.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    23
// =============================================================================
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    24
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    25
// ============================= MEMBER FUNCTIONS ===============================
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    26
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    27
// -----------------------------------------------------------------------------
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    28
// CImageHandler::CImageHandler
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    29
// C++ constructor can NOT contain any code, that
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    30
// might leave.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    31
// -----------------------------------------------------------------------------
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    32
//
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    33
CImageHandler::CImageHandler( RFs& aFs )
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    34
    : CActive(CActive::EPriorityStandard)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    35
    , iDecoder(NULL)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    36
    , iScaler(NULL)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    37
    , iFs(aFs)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    38
    , iSize(0,0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    39
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    40
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    41
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    42
// -----------------------------------------------------------------------------
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    43
// CImageHandler::ConstructL
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    44
// Symbian 2nd phase constructor can leave.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    45
// -----------------------------------------------------------------------------
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    46
//
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    47
void CImageHandler::ConstructL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    48
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    49
    CActiveScheduler::Add(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    50
    iBitmap = new (ELeave) CFbsBitmap;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    51
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    52
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    53
// -----------------------------------------------------------------------------
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    54
// CImageHandler::NewLC
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    55
// Two-phased constructor.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    56
// -----------------------------------------------------------------------------
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    57
//
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    58
EXPORT_C CImageHandler* CImageHandler::NewL(RFs& aFs)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    59
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    60
    CImageHandler* self = NewLC(aFs);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    61
    CleanupStack::Pop();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    62
    return self;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    63
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    64
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    65
// -----------------------------------------------------------------------------
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    66
// CImageHandler::NewLC
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    67
// Two-phased constructor.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    68
// -----------------------------------------------------------------------------
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    69
//
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    70
EXPORT_C CImageHandler* CImageHandler::NewLC(RFs& aFs)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    71
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    72
    CImageHandler* self = new (ELeave) CImageHandler(aFs);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    73
    CleanupStack::PushL( self );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    74
    self->ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    75
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    76
    return self;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    77
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    78
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    79
// Destructor
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    80
EXPORT_C CImageHandler::~CImageHandler()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    81
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    82
	// Cancel any outstanding request
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    83
	Cancel();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    84
	Deque();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    85
    delete iDecoder;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    86
    delete iScaler;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    87
	delete iBitmap;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    88
    iCallbackQue.Close(); 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    89
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    90
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    91
// -----------------------------------------------------------------------------
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    92
// CImageHandler::LoadFileL
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    93
// Loads a selected frame from a named file
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    94
// -----------------------------------------------------------------------------
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    95
//
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    96
void CImageHandler::LoadFileL(const TFileName& aFileName, TInt aSelectedFrame)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    97
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    98
    __ASSERT_ALWAYS(!IsActive(),User::Invariant());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    99
    if ( iDecoder )
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   100
        {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   101
        delete iDecoder;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   102
        iDecoder = NULL;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   103
        }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   104
   
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   105
    iDecoder = CImageDecoder::FileNewL(iFs, aFileName);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   106
    // Get image information
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   107
    iFrameInfo = iDecoder->FrameInfo(aSelectedFrame);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   108
    // Resize to fit.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   109
    TRect bitmap = iFrameInfo.iFrameCoordsInPixels;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   110
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   111
    // release possible previous image
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   112
    iBitmap->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   113
    iBitmap->Create(bitmap.Size(), EColor16M);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   114
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   115
    // Decode as bitmap.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   116
    iDecoder->Convert(&iStatus, *iBitmap, aSelectedFrame);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   117
    SetActive();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   118
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   119
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   120
EXPORT_C void CImageHandler::LoadFileAndScaleL(CFbsBitmap* aScaledBitmap, 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   121
								      const TFileName& aFileName,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   122
                                      const TSize &aSize,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   123
                                      MImageHandlerCallback& aCallback,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   124
                                      TInt aSelectedFrame)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   125
    {        
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   126
    if(!IsActive())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   127
    	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   128
    	__ASSERT_ALWAYS(!IsActive(),User::Invariant());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   129
    	iSize = aSize;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   130
    	iScaledBitmap = aScaledBitmap;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   131
    	iScaledBitmap->Reset();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   132
    	iScaledBitmap->Create(aSize, EColor16M);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   133
    	iCallback = &aCallback; 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   134
    	LoadFileL(aFileName, aSelectedFrame);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   135
    	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   136
    else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   137
    	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   138
    	TImageStruct imageStruct;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   139
    	imageStruct.iCallBack = &aCallback;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   140
    	imageStruct.iScaledImage = aScaledBitmap;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   141
    	imageStruct.iScaledSize = aSize;    
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   142
    	imageStruct.iFileName = aFileName;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   143
    	iCallbackQue.Append(imageStruct);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   144
    	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   145
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   146
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   147
EXPORT_C CFbsBitmap* CImageHandler::ScaledBitmap()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   148
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   149
	return iScaledBitmap;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   150
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   151
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   152
void CImageHandler::ScaleL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   153
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   154
    __ASSERT_ALWAYS(!IsActive(),User::Invariant());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   155
    if ( iScaler )
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   156
        {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   157
        delete iScaler;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   158
        }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   159
    iScaler = NULL;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   160
    iScaler = CBitmapScaler::NewL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   161
    iScaler->Scale(&iStatus, *iBitmap, *iScaledBitmap, ETrue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   162
    SetActive();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   163
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   164
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   165
// -----------------------------------------------------------------------------
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   166
// CImageHandler::FrameInfo
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   167
// Get the current frame information.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   168
// -----------------------------------------------------------------------------
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   169
//
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   170
const TFrameInfo& CImageHandler::FrameInfo() const
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   171
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   172
    return iFrameInfo;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   173
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   174
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   175
// -----------------------------------------------------------------------------
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   176
// CImageHandler::RunL
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   177
// CActive::RunL() implementation. Called on image load success/failure.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   178
// -----------------------------------------------------------------------------
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   179
//
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   180
void CImageHandler::RunL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   181
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   182
    if ((! iStatus.Int()) && (iSize.iWidth != 0) && (iSize.iHeight != 0))
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   183
        {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   184
        ScaleL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   185
        iSize.SetSize(0,0);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   186
        }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   187
    else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   188
        {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   189
        // Invoke callback.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   190
        iCallback->ImageOperationCompleteL(iStatus.Int());        
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   191
        if(iCallbackQue.Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   192
        	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   193
        	TInt loaderror = KErrNotFound;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   194
        	while(loaderror != KErrNone && iCallbackQue.Count())
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   195
        		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   196
        		TImageStruct imageStruct= iCallbackQue[0];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   197
        		iCallbackQue.Remove(0);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   198
        		TRAP(loaderror, LoadFileAndScaleL(imageStruct.iScaledImage, imageStruct.iFileName, imageStruct.iScaledSize, *imageStruct.iCallBack));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   199
        		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   200
        	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   201
        }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   202
 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   203
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   204
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   205
// -----------------------------------------------------------------------------
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   206
// CImageHandler::DoCancel
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   207
// CActive::Cancel() implementation. Stops decoding.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   208
// -----------------------------------------------------------------------------
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   209
//
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   210
void CImageHandler::DoCancel()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   211
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   212
    if ( iDecoder )
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   213
        {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   214
        iDecoder->Cancel();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   215
        }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   216
    if ( iScaler )
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   217
        {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   218
        iScaler->Cancel();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   219
        }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   220
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   221
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   222
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   223