|
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // SCALING.CPP |
|
15 // |
|
16 // |
|
17 |
|
18 #include <mdaimageconverter.h> |
|
19 #include "MdaImageConverterPriv.h" |
|
20 |
|
21 // |
|
22 // CMdaBitmapScalerPriv for Image Utility |
|
23 // |
|
24 |
|
25 CMdaBitmapScalerPriv* CMdaBitmapScalerPriv::NewL() |
|
26 { |
|
27 CMdaBitmapScalerPriv* self = new(ELeave) CMdaBitmapScalerPriv; |
|
28 CleanupStack::PushL(self); |
|
29 self->ConstructL(); |
|
30 CleanupStack::Pop(); // self |
|
31 return self; |
|
32 } |
|
33 |
|
34 CMdaBitmapScalerPriv::CMdaBitmapScalerPriv(): |
|
35 CActive(CActive::EPriorityStandard) |
|
36 { |
|
37 CActiveScheduler::Add(this); |
|
38 } |
|
39 |
|
40 void CMdaBitmapScalerPriv::ConstructL() |
|
41 { |
|
42 iBitmapScaler = CBitmapScaler::NewL(); |
|
43 } |
|
44 |
|
45 CMdaBitmapScalerPriv::~CMdaBitmapScalerPriv() |
|
46 { |
|
47 Cancel(); |
|
48 delete iBitmapScaler; |
|
49 } |
|
50 |
|
51 void CMdaBitmapScalerPriv::ScaleL(MMdaImageUtilObserver& aObserver,CFbsBitmap& aSrcBitmap,CFbsBitmap& aTgtBitmap,TBool aMaintainAspectRatio) |
|
52 { |
|
53 CancelScaling(); |
|
54 |
|
55 iObserver = &aObserver; |
|
56 iBitmapScaler->Scale(&iStatus, aSrcBitmap, aTgtBitmap, aMaintainAspectRatio); |
|
57 SetActive(); |
|
58 } |
|
59 |
|
60 void CMdaBitmapScalerPriv::ScaleL(MMdaImageUtilObserver& aObserver,CFbsBitmap& aBitmap,TSize aDestSize,TBool aMaintainAspectRatio) |
|
61 { |
|
62 // Cancel any scaling operation currently in progress |
|
63 CancelScaling(); |
|
64 |
|
65 iObserver = &aObserver; |
|
66 iBitmapScaler->Scale(&iStatus, aBitmap, aDestSize, aMaintainAspectRatio); |
|
67 SetActive(); |
|
68 } |
|
69 |
|
70 void CMdaBitmapScalerPriv::CancelScaling() |
|
71 { |
|
72 Cancel(); |
|
73 } |
|
74 |
|
75 void CMdaBitmapScalerPriv::RunL() |
|
76 { |
|
77 ASSERT(iObserver); |
|
78 iObserver->MiuoConvertComplete(iStatus.Int()); |
|
79 } |
|
80 |
|
81 void CMdaBitmapScalerPriv::DoCancel() |
|
82 { |
|
83 iBitmapScaler->Cancel(); |
|
84 } |