photosgallery/viewframework/dataprovider/src/glxdrmgiftexturecreator.cpp
branchRCL_3
changeset 27 34937ec34dac
parent 26 5b3385a43d68
equal deleted inserted replaced
26:5b3385a43d68 27:34937ec34dac
    36 // -----------------------------------------------------------------------------
    36 // -----------------------------------------------------------------------------
    37 // NewLC
    37 // NewLC
    38 // -----------------------------------------------------------------------------
    38 // -----------------------------------------------------------------------------
    39 CGlxDrmGifTextureCreator* CGlxDrmGifTextureCreator::NewL(
    39 CGlxDrmGifTextureCreator* CGlxDrmGifTextureCreator::NewL(
    40         const CGlxBinding& aBinding, const TGlxMedia& aMedia,
    40         const CGlxBinding& aBinding, const TGlxMedia& aMedia,
    41         TInt aItemIndex, Alf::IMulModel* aModel)
    41         TInt aItemIndex, Alf::IMulModel* aModel, MGlxMediaList& aMediaList)
    42     {
    42     {
    43     TRACER("CGlxDrmGifTextureCreator* CGlxDrmGifTextureCreator::NewL()");
    43     TRACER("CGlxDrmGifTextureCreator* CGlxDrmGifTextureCreator::NewL()");
    44     CGlxDrmGifTextureCreator* self = new (ELeave) CGlxDrmGifTextureCreator(
    44     CGlxDrmGifTextureCreator* self = new (ELeave) CGlxDrmGifTextureCreator(
    45             aBinding, aMedia, aItemIndex, aModel);
    45             aBinding, aMedia, aItemIndex, aModel, aMediaList);
    46     CleanupStack::PushL(self);
    46     CleanupStack::PushL(self);
    47     self->ConstructL();
    47     self->ConstructL();
    48     CleanupStack::Pop(self);
    48     CleanupStack::Pop(self);
    49     return self;
    49     return self;
    50     }
    50     }
   117 // -----------------------------------------------------------------------------
   117 // -----------------------------------------------------------------------------
   118 // Constructor
   118 // Constructor
   119 // -----------------------------------------------------------------------------
   119 // -----------------------------------------------------------------------------
   120 CGlxDrmGifTextureCreator::CGlxDrmGifTextureCreator(
   120 CGlxDrmGifTextureCreator::CGlxDrmGifTextureCreator(
   121         const CGlxBinding& aBinding, const TGlxMedia& aMedia,
   121         const CGlxBinding& aBinding, const TGlxMedia& aMedia,
   122         TInt aItemIndex, Alf::IMulModel* aModel) :
   122         TInt aItemIndex, Alf::IMulModel* aModel, MGlxMediaList& aMediaList) :
   123     iBinding(&aBinding), iMedia(&aMedia), iModel(aModel), iItemIndex(
   123     iBinding(&aBinding), iMedia(&aMedia), iModel(aModel), iItemIndex(
   124             aItemIndex)
   124             aItemIndex), iMediaList(aMediaList)
   125     {
   125     {
   126     TRACER("CGlxDrmGifTextureCreator::CGlxDrmGifTextureCreator()");
   126     TRACER("CGlxDrmGifTextureCreator::CGlxDrmGifTextureCreator()");
   127     // Implement nothing here
   127     // Implement nothing here
   128     }
   128     }
   129 
   129 
   228     {
   228     {
   229     TRACER("CGlxDrmGifTextureCreator::RefreshL()");
   229     TRACER("CGlxDrmGifTextureCreator::RefreshL()");
   230     GLX_LOG_INFO2("DrmGif: RefreshL() iAnimCount=%d, iFrameShift=%d",
   230     GLX_LOG_INFO2("DrmGif: RefreshL() iAnimCount=%d, iFrameShift=%d",
   231             iAnimCount, iFrameShift);
   231             iAnimCount, iFrameShift);
   232     TInt textureId = KErrNotFound;
   232     TInt textureId = KErrNotFound;
   233     if (iTransparencyPossible && !iFrameShift)
   233     if(iMediaList.Count())
   234         {
   234         {
   235         textureId
   235         const TGlxMedia media = iMediaList.Item(iItemIndex);
   236                 = (iUiUtility->GlxTextureManager().CreateDRMAnimatedGifTextureL(
   236 
   237                         *iMedia, iMedia->IdSpaceId(), iAnimCount,
   237         if (iTransparencyPossible && !iFrameShift)
   238                         iDecodedBitmap[iAnimCount], iDecodedMask[iAnimCount])).Id();
   238             {
   239         }
   239             textureId
   240     else
   240                     = (iUiUtility->GlxTextureManager().CreateDRMAnimatedGifTextureL(
   241         {
   241                             media, media.IdSpaceId(), iAnimCount,
   242         textureId
   242                             iDecodedBitmap[iAnimCount],
   243                 = (iUiUtility->GlxTextureManager().CreateDRMAnimatedGifTextureL(
   243                             iDecodedMask[iAnimCount])).Id();
   244                         *iMedia, iMedia->IdSpaceId(), iAnimCount,
   244             }
   245                         iDecodedBitmap[iAnimCount], NULL)).Id();
   245         else
       
   246             {
       
   247             textureId
       
   248                     = (iUiUtility->GlxTextureManager().CreateDRMAnimatedGifTextureL(
       
   249                             media, media.IdSpaceId(), iAnimCount,
       
   250                             iDecodedBitmap[iAnimCount], NULL)).Id();
       
   251             }
   246         }
   252         }
   247 
   253 
   248     SetTexture(textureId);
   254     SetTexture(textureId);
   249     // Advance animation
   255     // Advance animation
   250     iAnimCount++;
   256     iAnimCount++;
   493 // -----------------------------------------------------------------------------
   499 // -----------------------------------------------------------------------------
   494 void CGlxDrmGifTextureCreator::SetTexture(TInt aTextureId)
   500 void CGlxDrmGifTextureCreator::SetTexture(TInt aTextureId)
   495     {
   501     {
   496     TRACER("CGlxDrmGifTextureCreator::SetTexture()");
   502     TRACER("CGlxDrmGifTextureCreator::SetTexture()");
   497     auto_ptr<MulVisualItem> item(new (EMM) MulVisualItem());
   503     auto_ptr<MulVisualItem> item(new (EMM) MulVisualItem());
   498     iBinding->PopulateT(*item, *iMedia, ETrue, aTextureId);
   504     if (iMediaList.Count())
   499     iModel->SetData(iItemIndex, item);
   505         {
   500     }
   506         iBinding->PopulateT(*item, iMediaList.Item(iItemIndex), ETrue, aTextureId);
       
   507         iModel->SetData(iItemIndex, item);
       
   508         }
       
   509     }