47 CleanupStack::Pop(self); |
48 CleanupStack::Pop(self); |
48 return self; |
49 return self; |
49 } |
50 } |
50 |
51 |
51 // ----------------------------------------------------------------------------- |
52 // ----------------------------------------------------------------------------- |
52 // destructor |
53 // Destructor |
53 // ----------------------------------------------------------------------------- |
54 // ----------------------------------------------------------------------------- |
54 CGlxDrmGifTextureCreator::~CGlxDrmGifTextureCreator() |
55 CGlxDrmGifTextureCreator::~CGlxDrmGifTextureCreator() |
55 { |
56 { |
56 TRACER("CGlxDrmGifTextureCreator::~CGlxDrmGifTextureCreator()"); |
57 TRACER("CGlxDrmGifTextureCreator::~CGlxDrmGifTextureCreator()"); |
57 ReleaseContent(); |
58 ReleaseContent(); |
58 |
59 |
59 // Delete the animation timer |
60 // Delete the animation timer |
60 if (iAnimationTimer) |
61 if (iAnimationTimer) |
61 { |
62 { |
62 iAnimationTimer->Cancel(); |
63 iAnimationTimer->Cancel(); |
63 delete iAnimationTimer; |
64 delete iAnimationTimer; |
64 } |
65 } |
65 |
66 |
66 iUiUtility->Close(); |
67 iUiUtility->Close(); |
67 |
68 |
68 delete iGlxDecoderAO; |
69 delete iGlxDecoderAO; |
69 |
70 |
70 iFsSession.Close(); |
71 iFsSession.Close(); |
71 } |
72 } |
72 |
73 |
73 // ----------------------------------------------------------------------------- |
74 // ----------------------------------------------------------------------------- |
74 // ReleaseContent |
75 // ReleaseContent |
75 // ----------------------------------------------------------------------------- |
76 // ----------------------------------------------------------------------------- |
76 void CGlxDrmGifTextureCreator::ReleaseContent() |
77 void CGlxDrmGifTextureCreator::ReleaseContent() |
77 { |
78 { |
78 TRACER("void CGlxDrmGifTextureCreator::ReleaseContent()"); |
79 TRACER("void CGlxDrmGifTextureCreator::ReleaseContent()"); |
|
80 iBitmapReady = EFalse; |
|
81 iAnimCount = 0; |
|
82 iAnimateFlag = EFalse; |
|
83 iTransparencyPossible = EFalse; |
|
84 iFrameShift = EFalse; |
|
85 |
79 if (iGlxDecoderAO) |
86 if (iGlxDecoderAO) |
80 { |
87 { |
81 iGlxDecoderAO->Cancel(); |
88 iGlxDecoderAO->Cancel(); |
82 } |
89 } |
83 |
90 |
|
91 if (iAnimationTimer) |
|
92 { |
|
93 iAnimationTimer->Cancel(); |
|
94 } |
|
95 |
84 for (TInt i = 0; i < iFrameCount; i++) |
96 for (TInt i = 0; i < iFrameCount; i++) |
85 { |
97 { |
86 GLX_LOG_INFO1("CGlxDrmGifTextureCreator::ReleaseContent(). Releasing AnimBitmaps %d", i); |
98 GLX_LOG_INFO1("DrmGif: ReleaseContent() Releasing AnimBitmaps %d", i); |
87 delete (iDecodedBitmap[i]); |
99 delete (iDecodedBitmap[i]); |
88 iDecodedBitmap[i] = NULL; |
100 iDecodedBitmap[i] = NULL; |
89 delete (iDecodedMask[i]); |
101 delete (iDecodedMask[i]); |
90 iDecodedMask[i] = NULL; |
102 iDecodedMask[i] = NULL; |
91 } |
103 } |
92 |
104 |
93 if (iUiUtility && iMedia) |
105 if (iUiUtility && iMedia) |
94 { |
106 { |
95 iUiUtility->GlxTextureManager().RemoveTexture(iMedia->Id()); |
107 iUiUtility->GlxTextureManager().RemoveTexture(iMedia->Id()); |
96 } |
108 } |
97 |
109 |
98 if (iImageDecoder) |
110 if (iImageDecoder) |
99 { |
111 { |
100 delete iImageDecoder; |
112 delete iImageDecoder; |
101 iImageDecoder = NULL; |
113 iImageDecoder = NULL; |
102 } |
114 } |
143 // ----------------------------------------------------------------------------- |
157 // ----------------------------------------------------------------------------- |
144 void CGlxDrmGifTextureCreator::UpdateNewImageL(const TGlxMedia& aMedia, |
158 void CGlxDrmGifTextureCreator::UpdateNewImageL(const TGlxMedia& aMedia, |
145 TInt aItemIndex) |
159 TInt aItemIndex) |
146 { |
160 { |
147 TRACER("CGlxDrmGifTextureCreator::UpdateNewImageL()"); |
161 TRACER("CGlxDrmGifTextureCreator::UpdateNewImageL()"); |
148 GLX_LOG_INFO1("CGlxDrmGifTextureCreator::UpdateNewImageL() aItemIndex=%d", aItemIndex); |
162 GLX_LOG_INFO1("DrmGif: UpdateNewImageL() aItemIndex=%d", aItemIndex); |
149 if(aItemIndex == iItemIndex) |
163 if (aItemIndex == iItemIndex) |
150 { |
164 { |
151 return; |
165 return; |
152 } |
166 } |
153 iTransparencyPossible = EFalse; |
167 |
154 iItemIndex = aItemIndex; |
|
155 iMedia = &aMedia; |
|
156 // First release the contents before proceeding further |
168 // First release the contents before proceeding further |
157 ReleaseContent(); |
169 ReleaseContent(); |
|
170 |
|
171 iItemIndex = aItemIndex; |
|
172 iMedia = &aMedia; |
158 |
173 |
159 iBitmapReady = EFalse; |
174 iBitmapReady = EFalse; |
160 iAnimCount = 0; |
175 iAnimCount = 0; |
161 iAnimateFlag = EFalse; |
176 iAnimateFlag = EFalse; |
|
177 iTransparencyPossible = EFalse; |
|
178 iFrameShift = EFalse; |
|
179 |
162 //Set the initial texture, it could be default or the FS texture |
180 //Set the initial texture, it could be default or the FS texture |
163 SetTexture(); |
181 SetTexture(); |
164 #ifdef _DEBUG |
182 #ifdef _DEBUG |
165 iStartTime.HomeTime(); |
183 iStartTime.HomeTime(); |
166 #endif |
184 #endif |
176 TRACER("CGlxDrmGifTextureCreator::AnimateDRMGifItem()"); |
194 TRACER("CGlxDrmGifTextureCreator::AnimateDRMGifItem()"); |
177 if (!iAnimationTimer) |
195 if (!iAnimationTimer) |
178 { |
196 { |
179 return; |
197 return; |
180 } |
198 } |
181 |
199 |
182 if (aAnimate && iBitmapReady) |
200 if (aAnimate && iBitmapReady) |
183 { |
201 { |
184 if (!iAnimationTimer->IsActive()) |
202 if (!iAnimationTimer->IsActive()) |
185 { |
203 { |
186 GLX_LOG_INFO1("CGlxDrmGifTextureCreator::AnimateDRMGifItem() - Gif iAnimCount =%d", iAnimCount); |
204 GLX_LOG_INFO1("DrmGif: AnimateDRMGifItem() - iAnimCount=%d", iAnimCount); |
187 GLX_LOG_INFO1("=>CGlxDrmGifTextureCreator::AnimateDRMGifItem() - Gif Frame Interval <%d> us", |
205 GLX_LOG_INFO1("DrmGif: AnimateDRMGifItem() - Frame Interval <%d> us", |
188 (TInt)iFrameInfo.iDelay.Int64()); |
206 (TInt)iFrameInfo.iDelay.Int64()); |
189 TInt interval =((TInt)iFrameInfo.iDelay.Int64())?((TInt)iFrameInfo.iDelay.Int64()) |
207 TInt interval =((TInt)iFrameInfo.iDelay.Int64()) ? |
190 :KTimerInterval; |
208 ((TInt)iFrameInfo.iDelay.Int64()) : KDefaultFrameInterval; |
|
209 GLX_LOG_INFO1("DrmGif: AnimateDRMGifItem() interval=<%d> us", interval); |
191 iAnimationTimer->Start(interval, interval, TCallBack(TimerCallbackL, this)); |
210 iAnimationTimer->Start(interval, interval, TCallBack(TimerCallbackL, this)); |
192 } |
211 } |
193 iAnimateFlag = ETrue; |
212 iAnimateFlag = ETrue; |
194 } |
213 } |
195 else |
214 else |
206 // RefreshL |
225 // RefreshL |
207 // ----------------------------------------------------------------------------- |
226 // ----------------------------------------------------------------------------- |
208 void CGlxDrmGifTextureCreator::RefreshL() |
227 void CGlxDrmGifTextureCreator::RefreshL() |
209 { |
228 { |
210 TRACER("CGlxDrmGifTextureCreator::RefreshL()"); |
229 TRACER("CGlxDrmGifTextureCreator::RefreshL()"); |
211 GLX_LOG_INFO1("CGlxDrmGifTextureCreator::RefreshL() iAnimCount = %d",iAnimCount); |
230 GLX_LOG_INFO2("DrmGif: RefreshL() iAnimCount=%d, iFrameShift=%d", |
|
231 iAnimCount, iFrameShift); |
212 TInt textureId = KErrNotFound; |
232 TInt textureId = KErrNotFound; |
213 if (iTransparencyPossible) |
233 if (iTransparencyPossible && !iFrameShift) |
214 { |
234 { |
215 textureId |
235 textureId |
216 = (iUiUtility->GlxTextureManager().CreateDRMAnimatedGifTextureL( |
236 = (iUiUtility->GlxTextureManager().CreateDRMAnimatedGifTextureL( |
217 *iMedia, iMedia->IdSpaceId(), iAnimCount, |
237 *iMedia, iMedia->IdSpaceId(), iAnimCount, |
218 iDecodedBitmap[iAnimCount], iDecodedMask[iAnimCount])).Id(); |
238 iDecodedBitmap[iAnimCount], iDecodedMask[iAnimCount])).Id(); |
224 *iMedia, iMedia->IdSpaceId(), iAnimCount, |
244 *iMedia, iMedia->IdSpaceId(), iAnimCount, |
225 iDecodedBitmap[iAnimCount], NULL)).Id(); |
245 iDecodedBitmap[iAnimCount], NULL)).Id(); |
226 } |
246 } |
227 |
247 |
228 SetTexture(textureId); |
248 SetTexture(textureId); |
|
249 // Advance animation |
229 iAnimCount++; |
250 iAnimCount++; |
230 // Advance animation if the animation count is becoming maximum, |
251 // if animation count is becoming maximum, then reset to animate again |
231 // then set it to zero, such that it can animate again frm begining |
|
232 if (iAnimCount >= iFrameCount) |
252 if (iAnimCount >= iFrameCount) |
233 { |
253 { |
234 GLX_LOG_INFO("CGlxDrmGifTextureCreator::RefreshL() Reset iAnimCount"); |
254 GLX_LOG_INFO("DrmGif: RefreshL() Reset iAnimCount"); |
235 iAnimCount = 0; |
255 iAnimCount = 0; |
236 } |
256 } |
237 } |
257 } |
238 |
258 |
239 // ----------------------------------------------------------------------------- |
259 // ----------------------------------------------------------------------------- |
240 // CreateBitmapAndStartDecodingL |
260 // CreateBitmapAndStartDecodingL |
241 // ----------------------------------------------------------------------------- |
261 // ----------------------------------------------------------------------------- |
242 void CGlxDrmGifTextureCreator::CreateBitmapAndStartDecodingL() |
262 void CGlxDrmGifTextureCreator::CreateBitmapAndStartDecodingL() |
243 { |
263 { |
244 TRACER("CGlxDrmGifTextureCreator::CreateBitmapAndStartDecodingL()"); |
264 TRACER("CGlxDrmGifTextureCreator::CreateBitmapAndStartDecodingL()"); |
245 TSize scrnSize = AlfUtil::ScreenSize(); |
265 GLX_LOG_INFO1("CreateBitmapAndDecodingL() iAnimCount=%d", iAnimCount); |
246 TSize targetBitmapSize; |
266 // Create the bitmap and mask as of original image size, and let the |
247 |
267 // coverflow widget do the scaling, if required. |
248 GLX_LOG_INFO2("CGlxDrmGifTextureCreator::CreateBitmapAndDecodingL() - bitmapsize=%d, %d", |
268 // This is needed for the transparent gifs frames as the |
249 iOrigImageDimensions.iWidth,iOrigImageDimensions.iHeight); |
269 // frame co-ordinates would mismatch if downscaling is applied. |
250 TReal32 scaleFactor = 0.0f; |
270 TSize frameSize = iImageDecoder->FrameInfo(iAnimCount).iFrameSizeInPixels; |
251 if (scrnSize.iWidth * iOrigImageDimensions.iHeight > scrnSize.iHeight |
271 GLX_LOG_INFO3("DrmGif: CreateBitmapAndStartDecodingL() - Frame[%d] size=%d,%d", |
252 * iOrigImageDimensions.iWidth) |
272 iAnimCount, frameSize.iWidth, frameSize.iHeight); |
253 { |
273 |
254 scaleFactor = (TReal32) scrnSize.iHeight |
|
255 / (TReal32) iOrigImageDimensions.iHeight; |
|
256 } |
|
257 else |
|
258 { |
|
259 scaleFactor = (TReal32) scrnSize.iWidth |
|
260 / (TReal32) iOrigImageDimensions.iWidth; |
|
261 } |
|
262 GLX_LOG_INFO1("CGlxDrmGifTextureCreator::CreateBitmapAndDecodingL() - scaleFactor=%f",scaleFactor); |
|
263 targetBitmapSize.iHeight = iOrigImageDimensions.iHeight * scaleFactor; |
|
264 targetBitmapSize.iWidth = iOrigImageDimensions.iWidth * scaleFactor; |
|
265 GLX_LOG_INFO2("CGlxDrmGifTextureCreator::CreateBitmapAndDecodingL() - targetBitmapSize=%d, %d", |
|
266 targetBitmapSize.iWidth,targetBitmapSize.iHeight); |
|
267 GLX_LOG_INFO1("CGlxDrmGifTextureCreator::CreateBitmapAndDecodingL() iAnimCount =%d", iAnimCount); |
|
268 |
|
269 //create the bitmap for the required size |
|
270 iDecodedBitmap[iAnimCount] = new (ELeave) CFbsBitmap(); |
274 iDecodedBitmap[iAnimCount] = new (ELeave) CFbsBitmap(); |
271 iDecodedBitmap[iAnimCount]->Create(ReCalculateSizeL(targetBitmapSize), |
275 iDecodedBitmap[iAnimCount]->Create(frameSize, |
272 iFrameInfo.iFrameDisplayMode); |
276 iFrameInfo.iFrameDisplayMode); |
273 User::LeaveIfNull(iDecodedBitmap[iAnimCount]); |
277 User::LeaveIfNull(iDecodedBitmap[iAnimCount]); |
274 |
278 |
275 if (iFrameInfo.iFlags & TFrameInfo::ETransparencyPossible) |
279 if (iFrameInfo.iFlags & TFrameInfo::ETransparencyPossible) |
276 { |
280 { |
277 iDecodedMask[iAnimCount] = new (ELeave) CFbsBitmap(); |
281 iDecodedMask[iAnimCount] = new (ELeave) CFbsBitmap(); |
278 iDecodedMask[iAnimCount]->Create(ReCalculateSizeL( |
282 iDecodedMask[iAnimCount]->Create(frameSize, iFrameInfo.iFlags |
279 targetBitmapSize), iFrameInfo.iFlags |
|
280 & TFrameInfo::EAlphaChannel ? EGray256 : EGray2); |
283 & TFrameInfo::EAlphaChannel ? EGray256 : EGray2); |
281 User::LeaveIfNull(iDecodedMask[iAnimCount]); |
284 User::LeaveIfNull(iDecodedMask[iAnimCount]); |
282 |
285 |
283 // decoding the image |
286 // decoding the image |
284 iGlxDecoderAO->ConvertImageL(iDecodedBitmap[iAnimCount], |
287 iGlxDecoderAO->ConvertImageL(iDecodedBitmap[iAnimCount], |
285 iDecodedMask[iAnimCount], iAnimCount, iImageDecoder); |
288 iDecodedMask[iAnimCount], iAnimCount, iImageDecoder); |
286 iTransparencyPossible = ETrue; |
289 iTransparencyPossible = ETrue; |
287 } |
290 } |
289 { |
292 { |
290 // decoding the image |
293 // decoding the image |
291 iGlxDecoderAO->ConvertImageL(iDecodedBitmap[iAnimCount], NULL, |
294 iGlxDecoderAO->ConvertImageL(iDecodedBitmap[iAnimCount], NULL, |
292 iAnimCount, iImageDecoder); |
295 iAnimCount, iImageDecoder); |
293 } |
296 } |
294 iAnimCount++; |
|
295 } |
297 } |
296 |
298 |
297 // ----------------------------------------------------------------------------- |
299 // ----------------------------------------------------------------------------- |
298 // HandleRunL |
300 // HandleRunL |
299 // ----------------------------------------------------------------------------- |
301 // ----------------------------------------------------------------------------- |
300 void CGlxDrmGifTextureCreator::HandleRunL(TRequestStatus& aStatus) |
302 void CGlxDrmGifTextureCreator::HandleRunL(TRequestStatus& aStatus) |
301 { |
303 { |
302 TRACER("CGlxDrmGifTextureCreator::HandleRunL()"); |
304 TRACER("CGlxDrmGifTextureCreator::HandleRunL()"); |
303 GLX_LOG_INFO2("CGlxDrmGifTextureCreator::HandleRunL() - gif image frame=%d/%d", |
305 TInt err = aStatus.Int(); |
304 iAnimCount,iFrameCount); |
306 GLX_LOG_INFO1("DrmGif: HandleRunL : err=%d", err); |
305 |
307 if (err != KErrNone) |
306 if (iAnimCount < iFrameCount ) |
308 { |
|
309 ReleaseContent(); |
|
310 return; |
|
311 } |
|
312 |
|
313 GLX_LOG_INFO2("DrmGif: HandleRunL() - Frame=%d/%d", |
|
314 iAnimCount, iFrameCount-1); |
|
315 if (iAnimCount > 0 && iAnimCount < iFrameCount) |
|
316 { |
|
317 TPoint point = |
|
318 iImageDecoder->FrameInfo(iAnimCount).iFrameCoordsInPixels.iTl; |
|
319 GLX_LOG_INFO2("DrmGif: HandleRunL() point=(%d, %d)", |
|
320 point.iX, point.iY ); |
|
321 TSize frameSize = iImageDecoder->FrameInfo(iAnimCount).iFrameSizeInPixels; |
|
322 GLX_LOG_INFO2("DrmGif: HandleRunL() - frameSize(%d, %d)", |
|
323 frameSize.iWidth, frameSize.iHeight); |
|
324 // Frame shift is checked, |
|
325 // 1) If the subsequent frame sizes differ from the first frame (or) |
|
326 // 2) If the subsequent frame co-ordinates differ from the first frame |
|
327 if (point != iFrameInfo.iFrameCoordsInPixels.iTl |
|
328 || iFrameInfo.iFrameSizeInPixels != frameSize) |
|
329 { |
|
330 iFrameShift = ETrue; |
|
331 } |
|
332 |
|
333 if (iFrameShift) |
|
334 { |
|
335 TSize firstFrameSize = iDecodedBitmap[0]->SizeInPixels(); |
|
336 GLX_LOG_INFO2("DrmGif: HandleRunL() - first bitmap size (%d, %d)", |
|
337 firstFrameSize.iWidth, firstFrameSize.iHeight); |
|
338 |
|
339 TDisplayMode dispMode = iDecodedBitmap[0]->DisplayMode(); |
|
340 TInt scanLineLength = CFbsBitmap::ScanLineLength( |
|
341 firstFrameSize.iWidth, dispMode); |
|
342 |
|
343 CFbsBitmap* bitmap = new (ELeave) CFbsBitmap(); |
|
344 CleanupStack::PushL(bitmap); |
|
345 User::LeaveIfError(bitmap->Create(firstFrameSize, dispMode)); |
|
346 bitmap->LockHeap(); |
|
347 iDecodedBitmap[0]->LockHeap(); |
|
348 if (bitmap && bitmap->DataAddress()) |
|
349 { |
|
350 memcpy((void*) bitmap->DataAddress(), |
|
351 (void*) iDecodedBitmap[0]->DataAddress(), |
|
352 scanLineLength * firstFrameSize.iHeight); |
|
353 } |
|
354 iDecodedBitmap[0]->UnlockHeap(); |
|
355 bitmap->UnlockHeap(); |
|
356 |
|
357 CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL(bitmap); |
|
358 CleanupStack::PushL(bitmapDevice); |
|
359 |
|
360 CFbsBitGc* bitmapGc = CFbsBitGc::NewL(); |
|
361 CleanupStack::PushL(bitmapGc); |
|
362 bitmapGc->Activate(bitmapDevice); |
|
363 |
|
364 if (iTransparencyPossible) |
|
365 { |
|
366 GLX_LOG_INFO("DrmGif: HandleRunL() BitBltMasked"); |
|
367 bitmapGc->BitBltMasked(point, iDecodedBitmap[iAnimCount], |
|
368 iOrigImageDimensions, iDecodedMask[iAnimCount], |
|
369 EFalse); |
|
370 } |
|
371 else |
|
372 { |
|
373 GLX_LOG_INFO("DrmGif: HandleRunL() BitBlt"); |
|
374 bitmapGc->BitBlt(point, iDecodedBitmap[iAnimCount]); |
|
375 } |
|
376 |
|
377 delete iDecodedBitmap[iAnimCount]; |
|
378 iDecodedBitmap[iAnimCount] = bitmap; |
|
379 CleanupStack::PopAndDestroy(bitmapGc); |
|
380 CleanupStack::PopAndDestroy(bitmapDevice); |
|
381 CleanupStack::Pop(bitmap); |
|
382 } |
|
383 } |
|
384 |
|
385 if (iAnimCount < iFrameCount - 1) |
307 { |
386 { |
308 if (!iGlxDecoderAO->IsActive()) |
387 if (!iGlxDecoderAO->IsActive()) |
309 { |
388 { |
|
389 iAnimCount++; |
310 CreateBitmapAndStartDecodingL(); |
390 CreateBitmapAndStartDecodingL(); |
311 } |
391 } |
312 } |
392 } |
313 else |
393 else |
314 { |
394 { |
315 #ifdef _DEBUG |
395 #ifdef _DEBUG |
316 iStopTime.HomeTime(); |
396 iStopTime.HomeTime(); |
317 GLX_LOG_INFO1("CGlxDrmGifTextureCreator::HandleRunL() ConvertImageL took" |
397 GLX_LOG_INFO1("DrmGif: HandleRunL() ConvertImageL took <%d> us", |
318 " <%d> us", (TInt)iStopTime.MicroSecondsFrom(iStartTime).Int64()); |
398 (TInt)iStopTime.MicroSecondsFrom(iStartTime).Int64()); |
319 #endif |
399 #endif |
320 TInt err = aStatus.Int(); |
400 iBitmapReady = ETrue; |
321 GLX_LOG_INFO1("CGlxDrmGifTextureCreator::HandleRunL : err=%d", err); |
401 iAnimateFlag = ETrue; |
322 |
402 iAnimCount = 0; |
323 if (err == KErrNone) |
403 ProcessImageL(); |
324 { |
404 |
325 iBitmapReady = ETrue; |
|
326 iAnimateFlag = ETrue; |
|
327 iAnimCount = 0; |
|
328 ProcessImageL(); |
|
329 } |
|
330 |
|
331 //release imagedecoder after the conversion is over |
405 //release imagedecoder after the conversion is over |
332 if (iImageDecoder) |
406 if (iImageDecoder) |
333 { |
407 { |
334 delete iImageDecoder; |
408 delete iImageDecoder; |
335 iImageDecoder = NULL; |
409 iImageDecoder = NULL; |
342 // ----------------------------------------------------------------------------- |
416 // ----------------------------------------------------------------------------- |
343 void CGlxDrmGifTextureCreator::ProcessImageL() |
417 void CGlxDrmGifTextureCreator::ProcessImageL() |
344 { |
418 { |
345 TRACER("CGlxDrmGifTextureCreator::ProcessImageL()"); |
419 TRACER("CGlxDrmGifTextureCreator::ProcessImageL()"); |
346 RefreshL(); |
420 RefreshL(); |
347 |
|
348 GLX_LOG_INFO1("CGlxDrmGifTextureCreator::ProcessImageL() iAnimCount =%d", iAnimCount); |
|
349 GLX_LOG_INFO1("=>CGlxDrmGifTextureCreator::ProcessImageL() - Gif Frame Interval <%d> us", |
|
350 (TInt)iFrameInfo.iDelay.Int64()); |
|
351 iAnimationTimer->Cancel(); |
421 iAnimationTimer->Cancel(); |
352 if (iAnimateFlag) |
422 if (iAnimateFlag) |
353 { |
423 { |
354 // Next frame |
424 GLX_LOG_INFO1("DrmGif: ProcessImageL() - Frame Interval <%d> us", |
355 TInt interval =((TInt)iFrameInfo.iDelay.Int64())?((TInt)iFrameInfo.iDelay.Int64()) |
425 (TInt)iFrameInfo.iDelay.Int64()); |
356 :KTimerInterval; |
426 TInt interval =((TInt)iFrameInfo.iDelay.Int64()) ? |
357 iAnimationTimer->Start(interval,interval, TCallBack(TimerCallbackL, this)); |
427 ((TInt)iFrameInfo.iDelay.Int64()) : KDefaultFrameInterval; |
|
428 GLX_LOG_INFO1("DrmGif: ProcessImageL() interval=<%d> us", interval); |
|
429 iAnimationTimer->Start(interval, interval, TCallBack(TimerCallbackL, |
|
430 this)); |
358 } |
431 } |
359 } |
432 } |
360 |
433 |
361 // ----------------------------------------------------------------------------- |
434 // ----------------------------------------------------------------------------- |
362 // CreateImageDecoderL |
435 // CreateImageDecoderL |
363 // ----------------------------------------------------------------------------- |
436 // ----------------------------------------------------------------------------- |
364 void CGlxDrmGifTextureCreator::CreateImageDecoderL(const TDesC& aImageFile) |
437 void CGlxDrmGifTextureCreator::CreateImageDecoderL(const TDesC& aImageFile) |
365 { |
438 { |
366 TRACER("CGlxDrmGifTextureCreator::CreateImageDecoderL()"); |
439 TRACER("CGlxDrmGifTextureCreator::CreateImageDecoderL()"); |
367 GLX_LOG_URI("CGlxDrmGifTextureCreator::CreateImageDecoderL(%S)", &aImageFile); |
440 GLX_LOG_URI("DrmGif::CreateImageDecoderL(%S)", &aImageFile); |
368 |
441 |
369 CImageDecoder::TOptions options = |
442 CImageDecoder::TOptions options = |
370 (CImageDecoder::TOptions) (CImageDecoder::EOptionNoDither |
443 (CImageDecoder::TOptions) (CImageDecoder::EOptionNoDither |
371 | CImageDecoder::EOptionAlwaysThread); |
444 | CImageDecoder::EOptionAlwaysThread); |
372 // Create a decoder for the image in the named file |
445 // Create a decoder for the image in the named file |
376 { |
449 { |
377 User::Leave(error); |
450 User::Leave(error); |
378 } |
451 } |
379 iFrameInfo = iImageDecoder->FrameInfo(); |
452 iFrameInfo = iImageDecoder->FrameInfo(); |
380 iOrigImageDimensions = iImageDecoder->FrameInfo().iOverallSizeInPixels; |
453 iOrigImageDimensions = iImageDecoder->FrameInfo().iOverallSizeInPixels; |
381 GLX_LOG_INFO1("=>CGlxDrmGifTextureCreator::CreateImageDecoderL() - Gif Frame Interval <%d> us", |
454 GLX_LOG_INFO1("DrmGif::CreateImageDecoderL() - Gif Frame Interval <%d> us", |
382 (TInt)iFrameInfo.iDelay.Int64()); |
455 (TInt)iFrameInfo.iDelay.Int64()); |
383 iFrameCount = iImageDecoder->FrameCount(); |
456 iFrameCount = iImageDecoder->FrameCount(); |
384 |
457 |
385 // We are creating array of KGlxMaxFrameCount frames |
458 // We are creating array of KGlxMaxFrameCount frames |
386 // So re-setting the array-count with the no. |
459 // So re-setting the array-count with the no. |
387 // It will animate till that no. of frames. |
460 // It will animate till that no. of frames. |
388 if (iFrameCount > KGlxMaxFrameCount) |
461 if (iFrameCount > KGlxMaxFrameCount) |
389 { |
462 { |
390 iFrameCount = KGlxMaxFrameCount; |
463 iFrameCount = KGlxMaxFrameCount; |
391 } |
464 } |
392 //dont create the timer if it is a singleframe.no need to animate |
465 //dont create the timer if it is a singleframe.no need to animate |
393 if (iFrameCount > 1) |
466 if (iFrameCount > 1) |
394 { |
467 { |
395 iAnimationTimer = CPeriodic::NewL(CActive::EPriorityLow); |
468 iAnimationTimer = CPeriodic::NewL(CActive::EPriorityLow); |
396 } |
469 } |
397 } |
470 } |
398 |
471 |
411 // ----------------------------------------------------------------------------- |
484 // ----------------------------------------------------------------------------- |
412 void CGlxDrmGifTextureCreator::ProcessTimerEventL() |
485 void CGlxDrmGifTextureCreator::ProcessTimerEventL() |
413 { |
486 { |
414 TRACER("CGlxDrmGifTextureCreator::ProcessTimerEventL()"); |
487 TRACER("CGlxDrmGifTextureCreator::ProcessTimerEventL()"); |
415 ProcessImageL(); |
488 ProcessImageL(); |
416 } |
|
417 |
|
418 // ----------------------------------------------------------------------------- |
|
419 // ReCalculateSize |
|
420 // ----------------------------------------------------------------------------- |
|
421 TSize CGlxDrmGifTextureCreator::ReCalculateSizeL(TSize& aTargetBitmapSize) |
|
422 { |
|
423 TRACER("CGlxDrmGifTextureCreator::ReCalculateSizeL()"); |
|
424 // calculate the reduction factor on what size we need |
|
425 TInt reductionFactor = iImageDecoder->ReductionFactor(iOrigImageDimensions, |
|
426 aTargetBitmapSize); |
|
427 // get the reduced size onto destination size |
|
428 TSize destSize; |
|
429 User::LeaveIfError(iImageDecoder->ReducedSize(iOrigImageDimensions, |
|
430 reductionFactor, destSize)); |
|
431 GLX_LOG_INFO2("CGlxDrmGifTextureCreator::ReCalculateSizeL() destSize=%d, %d", |
|
432 destSize.iWidth,destSize.iHeight); |
|
433 return destSize; |
|
434 } |
489 } |
435 |
490 |
436 // ----------------------------------------------------------------------------- |
491 // ----------------------------------------------------------------------------- |
437 // SetTexture |
492 // SetTexture |
438 // ----------------------------------------------------------------------------- |
493 // ----------------------------------------------------------------------------- |