|
1 /******************************************************************************* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. This program and the accompanying materials |
|
4 * are made available under the terms of the Eclipse Public License v1.0 |
|
5 * which accompanies this distribution, and is available at |
|
6 * http://www.eclipse.org/legal/epl-v10.html |
|
7 * |
|
8 * Contributors: |
|
9 * Nokia Corporation - S60 implementation |
|
10 *******************************************************************************/ |
|
11 |
|
12 |
|
13 #include <eikenv.h> |
|
14 #include <bitmaptransforms.h> |
|
15 #include "imagescaler.h" |
|
16 |
|
17 |
|
18 CImageScaler::CImageScaler() |
|
19 : CActive(EPriorityStandard) |
|
20 { |
|
21 CActiveScheduler::Add(this); |
|
22 } |
|
23 |
|
24 CImageScaler::~CImageScaler() |
|
25 { |
|
26 Cancel(); |
|
27 if (iBitmapScaler) |
|
28 iBitmapScaler->Cancel(); |
|
29 delete iBitmapScaler; |
|
30 delete iWait; |
|
31 } |
|
32 |
|
33 CImageScaler* CImageScaler::NewL() |
|
34 { |
|
35 CImageScaler* self = new(ELeave) CImageScaler(); |
|
36 CleanupStack::PushL(self); |
|
37 self->ConstructL(); |
|
38 CleanupStack::Pop(self); |
|
39 return self; |
|
40 } |
|
41 |
|
42 void CImageScaler::ConstructL() |
|
43 { |
|
44 iBitmapScaler = CBitmapScaler::NewL(); |
|
45 iBitmapScaler->SetQualityAlgorithm(CBitmapScaler::EMaximumQuality); |
|
46 iWait = new(ELeave) CActiveSchedulerWait; |
|
47 } |
|
48 |
|
49 void CImageScaler::Scale(CFbsBitmap& aSrcBitmap, CFbsBitmap& aDestBitmap, TBool aKeepAspectRatio) |
|
50 { |
|
51 iBitmapScaler->Scale(&iStatus, aSrcBitmap, aDestBitmap, aKeepAspectRatio); |
|
52 SetActive(); |
|
53 iWait->Start(); |
|
54 } |
|
55 |
|
56 void CImageScaler::RunL() |
|
57 { |
|
58 iWait->AsyncStop(); |
|
59 } |
|
60 |
|
61 void CImageScaler::DoCancel() |
|
62 { |
|
63 } |
|
64 |
|
65 // End of File |