author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:23:59 +0300 | |
branch | RCL_3 |
changeset 83 | 26b2b12093af |
parent 66 | 2455ef1f5bbc |
permissions | -rw-r--r-- |
66 | 1 |
/******************************************************************************* |
2 |
* Copyright (c) 2007, 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 <w32std.h> |
|
14 |
#include <coecntrl.h> |
|
15 |
#include <bitmaptransforms.h> |
|
16 |
#include "swtrotateimage.h" |
|
17 |
#include "eswtwidgetscore.h" |
|
18 |
||
19 |
||
20 |
// ======== MEMBER FUNCTIONS ======== |
|
21 |
||
22 |
||
23 |
CAORotateImage* CAORotateImage::NewL() |
|
24 |
{ |
|
25 |
CAORotateImage* self = new(ELeave) CAORotateImage(); |
|
26 |
CleanupStack::PushL(self); |
|
27 |
self->ConstructL(); |
|
28 |
CleanupStack::Pop(self); |
|
29 |
return self; |
|
30 |
} |
|
31 |
||
32 |
CAORotateImage::CAORotateImage() |
|
33 |
: CActive(CActive::EPriorityHigh) |
|
34 |
{ |
|
35 |
CActiveScheduler::Add(this); |
|
36 |
iStep = -1; |
|
37 |
iIsFinish = EFalse; |
|
38 |
} |
|
39 |
||
40 |
CAORotateImage::~CAORotateImage() |
|
41 |
{ |
|
42 |
Cancel(); |
|
43 |
||
44 |
iImages.Reset(); |
|
45 |
||
46 |
delete iBitmapRotator; |
|
47 |
||
48 |
iControl = NULL; |
|
49 |
} |
|
50 |
||
51 |
void CAORotateImage::ConstructL() |
|
52 |
{ |
|
53 |
iBitmapRotator = CBitmapRotator::NewL(); |
|
54 |
} |
|
55 |
||
56 |
void CAORotateImage::Start(MSwtControl* aControl) |
|
57 |
{ |
|
58 |
Cancel(); |
|
59 |
iIsFinish = EFalse; |
|
60 |
||
61 |
iControl = aControl; |
|
62 |
if (aControl) |
|
63 |
{ |
|
64 |
iRedraw = ETrue; |
|
65 |
} |
|
66 |
||
67 |
iStep = 0; |
|
68 |
Queue(); |
|
69 |
} |
|
70 |
||
71 |
void CAORotateImage::RemoveAllImages() |
|
72 |
{ |
|
73 |
iStep = -1; |
|
74 |
iIsFinish = EFalse; |
|
75 |
iRedraw = EFalse; |
|
76 |
Cancel(); |
|
77 |
||
78 |
iImages.Reset(); |
|
79 |
} |
|
80 |
||
83
26b2b12093af
Revision: v2.2.17
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
81 |
void CAORotateImage::AddImage(CFbsBitmap* aImage) |
66 | 82 |
{ |
83 |
ASSERT(aImage); |
|
84 |
ASSERT(!aImage->IsCompressedInRAM()); |
|
85 |
||
86 |
Cancel(); |
|
87 |
if (!aImage->IsCompressedInRAM()) |
|
88 |
{ |
|
83
26b2b12093af
Revision: v2.2.17
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
89 |
iImages.Append(aImage); |
66 | 90 |
} |
91 |
} |
|
92 |
||
83
26b2b12093af
Revision: v2.2.17
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
93 |
void CAORotateImage::AddImages(const RArray<CFbsBitmap*>& aImages) |
66 | 94 |
{ |
95 |
Cancel(); |
|
96 |
for (TInt i = 0; i < aImages.Count(); i++) |
|
97 |
{ |
|
98 |
if (aImages[i]) |
|
99 |
{ |
|
100 |
ASSERT(!aImages[i]->IsCompressedInRAM()); |
|
101 |
||
102 |
if (!aImages[i]->IsCompressedInRAM()) |
|
103 |
{ |
|
83
26b2b12093af
Revision: v2.2.17
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
104 |
iImages.Append(aImages[i]); |
66 | 105 |
} |
106 |
} |
|
107 |
} |
|
108 |
} |
|
109 |
||
110 |
void CAORotateImage::SetRedrawAfterRotation(TBool aRedrawAfterRotation) |
|
111 |
{ |
|
112 |
iRedraw = aRedrawAfterRotation; |
|
113 |
} |
|
114 |
||
115 |
TBool CAORotateImage::IsFinish() const |
|
116 |
{ |
|
117 |
return iIsFinish; |
|
118 |
} |
|
119 |
||
120 |
void CAORotateImage::DoCancel() |
|
121 |
{ |
|
122 |
iBitmapRotator->Cancel(); |
|
123 |
||
124 |
iImages.Reset(); |
|
125 |
||
126 |
iStep = -1; |
|
127 |
iIsFinish = EFalse; |
|
128 |
} |
|
129 |
||
130 |
void CAORotateImage::Queue() |
|
131 |
{ |
|
132 |
if (iStep < iImages.Count() && iStep != -1) |
|
133 |
{ |
|
134 |
iIsFinish = EFalse; |
|
135 |
iBitmapRotator->Rotate(&iStatus, *iImages[iStep++], |
|
136 |
CBitmapRotator::ERotation270DegreesClockwise); |
|
137 |
||
138 |
SetActive(); |
|
139 |
} |
|
140 |
else |
|
141 |
{ |
|
142 |
iIsFinish = ETrue; |
|
143 |
||
144 |
if (iRedraw && iControl) |
|
145 |
{ |
|
146 |
if (iControl->IsPaintingUrgently()) |
|
147 |
{ |
|
148 |
iControl->PaintUrgently(iControl->CoeControl().Rect()); |
|
149 |
} |
|
150 |
else |
|
151 |
{ |
|
152 |
iControl->Paint(TRect((iControl->CoeControl()).PositionRelativeToScreen(), |
|
153 |
iControl->GetWidgetSize())); |
|
154 |
} |
|
155 |
} |
|
156 |
} |
|
157 |
} |
|
158 |
||
159 |
void CAORotateImage::RunL() |
|
160 |
{ |
|
161 |
Queue(); |
|
162 |
} |