81 iIconList.Close(); |
81 iIconList.Close(); |
82 |
82 |
83 iThumbnailList.Close(); |
83 iThumbnailList.Close(); |
84 |
84 |
85 iAnimatedTnmList.Close(); |
85 iAnimatedTnmList.Close(); |
|
86 |
|
87 // delete DRM GIF textures |
|
88 count = iDRMGifAnimatedTnmList.Count(); |
|
89 GLX_LOG_INFO1("CGlxTextureManagerImpl iDRMGifAnimatedTnmList.Count=%d",count); |
|
90 for(TInt i = count - 1; i >= 0; i--) |
|
91 { |
|
92 GLX_LOG_INFO1("CGlxTextureManagerImpl DRM Gif Texture deleted i=%d",i); |
|
93 for(TInt texCnt = KGlxMaxFrameCount - 1; texCnt >= 0; texCnt--) |
|
94 { |
|
95 delete iDRMGifAnimatedTnmList[i].iTexture[texCnt]; |
|
96 } |
|
97 } |
|
98 iDRMGifAnimatedTnmList.Close(); |
86 |
99 |
87 // delete zoom textures |
100 // delete zoom textures |
88 count = iZoomedList.Count(); |
101 count = iZoomedList.Count(); |
89 GLX_LOG_INFO1("CGlxTextureManagerImpl iZoomedList.Count=%d",count); |
102 GLX_LOG_INFO1("CGlxTextureManagerImpl iZoomedList.Count=%d",count); |
90 for(TInt i = count - 1; i >= 0; i--) |
103 for(TInt i = count - 1; i >= 0; i--) |
561 } |
574 } |
562 iAnimatedTnmList.Remove(i); |
575 iAnimatedTnmList.Remove(i); |
563 iAlfTextureManager.UnloadTexture(aTexture ); |
576 iAlfTextureManager.UnloadTexture(aTexture ); |
564 } |
577 } |
565 } |
578 } |
|
579 |
|
580 i = iDRMGifAnimatedTnmList.Count(); |
|
581 |
|
582 while(i > 0) |
|
583 { |
|
584 --i; |
|
585 if (iDRMGifAnimatedTnmList[i].iMediaId == aMediaId) |
|
586 { |
|
587 GLX_LOG_INFO("RemoveTexture 2 iDRMGifAnimatedTnmList MediaId found"); |
|
588 for(TInt textureCnt=0;textureCnt<KGlxMaxFrameCount;textureCnt++) |
|
589 { |
|
590 TInt textureId = iDRMGifAnimatedTnmList[i].iTextureId[textureCnt]; |
|
591 iAlfTextureManager.UnloadTexture(textureId); |
|
592 } |
|
593 iDRMGifAnimatedTnmList.Remove(i); |
|
594 } |
|
595 } |
566 } |
596 } |
567 |
597 |
568 // ----------------------------------------------------------------------------- |
598 // ----------------------------------------------------------------------------- |
569 // FlushTextures Removes All Textures |
599 // FlushTextures Removes All Textures |
570 // ----------------------------------------------------------------------------- |
600 // ----------------------------------------------------------------------------- |
612 GLX_LOG_INFO("FlushTextures iAnimatedTnmList Stop animation"); |
642 GLX_LOG_INFO("FlushTextures iAnimatedTnmList Stop animation"); |
613 (iAnimatedTnmList[i].iTexture)->StopAnimation(); |
643 (iAnimatedTnmList[i].iTexture)->StopAnimation(); |
614 } |
644 } |
615 iAlfTextureManager.UnloadTexture(textureID); |
645 iAlfTextureManager.UnloadTexture(textureID); |
616 iAnimatedTnmList[i].iTexture = NULL; |
646 iAnimatedTnmList[i].iTexture = NULL; |
|
647 } |
|
648 |
|
649 i = iDRMGifAnimatedTnmList.Count(); |
|
650 while(i > 0) |
|
651 { |
|
652 --i; |
|
653 GLX_LOG_INFO("RemoveTexture 2 iDRMGifAnimatedTnmList MediaId found"); |
|
654 for (TInt textureCnt = 0; textureCnt < KGlxMaxFrameCount; textureCnt++) |
|
655 { |
|
656 TInt aTexture = iDRMGifAnimatedTnmList[i].iTextureId[textureCnt]; |
|
657 iAlfTextureManager.UnloadTexture(aTexture); |
|
658 iDRMGifAnimatedTnmList[i].iTexture[textureCnt] = NULL; |
|
659 } |
617 } |
660 } |
618 } |
661 } |
619 |
662 |
620 // ----------------------------------------------------------------------------- |
663 // ----------------------------------------------------------------------------- |
621 // GetThumbnailAttributeAndIndexL |
664 // GetThumbnailAttributeAndIndexL |
944 // the bitmap once the texture's been created. |
987 // the bitmap once the texture's been created. |
945 aBitmap = CreateDuplicateBitmapL( *iThumbnailList[i].iBitmap ); |
988 aBitmap = CreateDuplicateBitmapL( *iThumbnailList[i].iBitmap ); |
946 return; |
989 return; |
947 } |
990 } |
948 } |
991 } |
|
992 |
|
993 // add loop to search the iDRMGifAnimatedTnmList for the aTextureId |
|
994 i = iDRMGifAnimatedTnmList.Count(); |
|
995 while (i > 0) |
|
996 { |
|
997 --i; |
|
998 for(TInt textureCnt=0;textureCnt<KGlxMaxFrameCount;textureCnt++) |
|
999 { |
|
1000 if (iDRMGifAnimatedTnmList[i].iBitmap[textureCnt] && |
|
1001 (iDRMGifAnimatedTnmList[i].iTextureId[textureCnt] == aTextureId)) |
|
1002 { |
|
1003 // We have found the texture, create a duplicate as alf destroys |
|
1004 // the bitmap once the texture's been created. |
|
1005 aBitmap = CreateDuplicateBitmapL(*iDRMGifAnimatedTnmList[i].iBitmap[textureCnt]); |
|
1006 if(iDRMGifAnimatedTnmList[i].iBitmapMask[textureCnt]) |
|
1007 { |
|
1008 aMaskBitmap = CreateDuplicateBitmapL(*iDRMGifAnimatedTnmList[i].iBitmapMask[textureCnt]); |
|
1009 } |
|
1010 return; |
|
1011 } |
|
1012 } |
|
1013 } |
|
1014 |
949 // find in iIconList |
1015 // find in iIconList |
950 i = iIconList.Count(); |
1016 i = iIconList.Count(); |
951 TBool found = EFalse; |
1017 TBool found = EFalse; |
952 TGlxIcon icon; |
1018 TGlxIcon icon; |
953 while(i > 0 && !found) |
1019 while(i > 0 && !found) |
1364 } |
1430 } |
1365 } |
1431 } |
1366 } |
1432 } |
1367 } |
1433 } |
1368 |
1434 |
|
1435 // ----------------------------------------------------------------------------- |
|
1436 // CreateDRMAnimatedGifTextureL |
|
1437 // ----------------------------------------------------------------------------- |
|
1438 // |
|
1439 CAlfTexture& CGlxTextureManagerImpl::CreateDRMAnimatedGifTextureL(const TGlxMedia& aMedia, |
|
1440 TGlxIdSpaceId aIdSpaceId,TInt aFrameNumber, CFbsBitmap* aBitmap, CFbsBitmap* aBitmapMask) |
|
1441 { |
|
1442 TRACER("CGlxTextureManagerImpl::CreateDRMAnimatedGifTextureL"); |
|
1443 TInt thumbnailIndex = KErrNotFound; |
|
1444 |
|
1445 // If the current thumbnail matches what is required then return the current texture otherwise |
|
1446 // create a new one. |
|
1447 if (!GetDRMAnimatedGifThumbnailIndex( aMedia, aIdSpaceId,thumbnailIndex)) |
|
1448 { |
|
1449 GLX_LOG_INFO("CreateDRMAnimatedGifTextureL Texture already present"); |
|
1450 // only texture is missing. |
|
1451 if ((NULL == iDRMGifAnimatedTnmList[thumbnailIndex].iTexture[aFrameNumber])) |
|
1452 { |
|
1453 if(NULL == iDRMGifAnimatedTnmList[thumbnailIndex].iBitmap[aFrameNumber]) |
|
1454 { |
|
1455 iDRMGifAnimatedTnmList[thumbnailIndex].iTextureId[aFrameNumber] = NextTextureId(); |
|
1456 iDRMGifAnimatedTnmList[thumbnailIndex].iBitmap[aFrameNumber] = aBitmap; |
|
1457 iDRMGifAnimatedTnmList[thumbnailIndex].iBitmapMask[aFrameNumber] = aBitmapMask; |
|
1458 } |
|
1459 CAlfTexture* newTexture = &iAlfTextureManager.CreateTextureL( |
|
1460 iDRMGifAnimatedTnmList[thumbnailIndex].iTextureId[aFrameNumber], |
|
1461 this, |
|
1462 EAlfTextureFlagDefault); |
|
1463 iDRMGifAnimatedTnmList[thumbnailIndex].iTexture[aFrameNumber] = newTexture; |
|
1464 } |
|
1465 return *iDRMGifAnimatedTnmList[thumbnailIndex].iTexture[aFrameNumber]; |
|
1466 } |
|
1467 |
|
1468 TGlxDRMGifThumbnailIcon thumbData; |
|
1469 thumbData.iTextureId[aFrameNumber] = NextTextureId(); |
|
1470 thumbData.iMediaId = aMedia.Id(); |
|
1471 thumbData.iIdSpaceId = aIdSpaceId; |
|
1472 for(TInt i=0;i<KGlxMaxFrameCount;i++) |
|
1473 { |
|
1474 thumbData.iTexture[i] = NULL; |
|
1475 thumbData.iBitmap[i] = NULL; |
|
1476 thumbData.iBitmapMask[i] = NULL; |
|
1477 } |
|
1478 thumbData.iBitmap[aFrameNumber] = aBitmap; |
|
1479 thumbData.iBitmapMask[aFrameNumber] = aBitmapMask; |
|
1480 |
|
1481 iDRMGifAnimatedTnmList.ReserveL( iDRMGifAnimatedTnmList.Count() + 1 ); |
|
1482 |
|
1483 iDRMGifAnimatedTnmList.AppendL(thumbData); |
|
1484 |
|
1485 CAlfTexture* newTexture = &iAlfTextureManager.CreateTextureL( |
|
1486 thumbData.iTextureId[aFrameNumber], |
|
1487 this, |
|
1488 EAlfTextureFlagDefault); |
|
1489 |
|
1490 TInt index = iDRMGifAnimatedTnmList.Count()-1; |
|
1491 iDRMGifAnimatedTnmList[index].iTexture[aFrameNumber] = newTexture; |
|
1492 |
|
1493 return *newTexture; |
|
1494 } |
|
1495 |
|
1496 |
|
1497 // ----------------------------------------------------------------------------- |
|
1498 // GetAnimatedGifThumbnailIndex |
|
1499 // ----------------------------------------------------------------------------- |
|
1500 // |
|
1501 TBool CGlxTextureManagerImpl::GetDRMAnimatedGifThumbnailIndex(const TGlxMedia& aMedia, const TGlxIdSpaceId& aIdSpaceId, |
|
1502 TInt& aThumbnailIndex) |
|
1503 { |
|
1504 TRACER("CGlxTextureManagerImpl::GetDRMAnimatedGifThumbnailIndex"); |
|
1505 aThumbnailIndex = KErrNotFound; |
|
1506 |
|
1507 TInt i = iDRMGifAnimatedTnmList.Count(); |
|
1508 |
|
1509 while (i > 0 && aThumbnailIndex == KErrNotFound) |
|
1510 { |
|
1511 --i; |
|
1512 if ((iDRMGifAnimatedTnmList[i].iMediaId == aMedia.Id()) |
|
1513 && (iDRMGifAnimatedTnmList[i].iIdSpaceId == aIdSpaceId)) |
|
1514 { |
|
1515 aThumbnailIndex = i; |
|
1516 GLX_LOG_INFO( "GetDRMAnimatedGifThumbnailIndex textureid present" ); |
|
1517 // We have found that the best match already exists |
|
1518 // No need to do anything |
|
1519 return EFalse; |
|
1520 } |
|
1521 } |
|
1522 return ETrue; |
|
1523 } |