photosgallery/viewframework/dataprovider/src/glxdrmgifactivedecoder.cpp
branchRCL_3
changeset 23 b023a8d2866a
equal deleted inserted replaced
21:f9e827349359 23:b023a8d2866a
       
     1 /*
       
     2  * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:    Gif Decoder Active Object
       
    15  *
       
    16  */
       
    17 
       
    18 #include <glxtracer.h>
       
    19 #include <glxlog.h>
       
    20 #include "glxdrmgifactivedecoder.h"
       
    21 
       
    22 // -----------------------------------------------------------------------------
       
    23 // NewL
       
    24 // -----------------------------------------------------------------------------
       
    25 CGlxDRMgifDecoderAO* CGlxDRMgifDecoderAO::NewL(
       
    26         CGlxDrmGifTextureCreator* aDrmGifTextureCreator)
       
    27     {
       
    28     TRACER("CGlxDRMgifDecoderAO::NewL()");
       
    29     CGlxDRMgifDecoderAO* self = new (ELeave) CGlxDRMgifDecoderAO(
       
    30             aDrmGifTextureCreator);
       
    31     return self;
       
    32     }
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CGlxDRMgifDecoderAO()
       
    36 // -----------------------------------------------------------------------------
       
    37 CGlxDRMgifDecoderAO::CGlxDRMgifDecoderAO(
       
    38         CGlxDrmGifTextureCreator* aDrmGifTextureCreator) :
       
    39     CActive(CActive::EPriorityStandard), iDrmGifTextureCreator(
       
    40             aDrmGifTextureCreator)
       
    41     {
       
    42     TRACER("CGlxDRMgifDecoderAO::CGlxDRMgifDecoderAO()");
       
    43     CActiveScheduler::Add(this);
       
    44     }
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // ~CGlxDRMgifDecoderAO
       
    48 // Cancel the outstanding request
       
    49 // -----------------------------------------------------------------------------
       
    50 CGlxDRMgifDecoderAO::~CGlxDRMgifDecoderAO()
       
    51     {
       
    52     TRACER("CGlxDRMgifDecoderAO::~CGlxDRMgifDecoderAO()");
       
    53     Cancel();
       
    54     }
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // RunL
       
    58 // Calls iDrmGifTextureCreator->HandleRunL() which is expected to handle the call
       
    59 // -----------------------------------------------------------------------------
       
    60 void CGlxDRMgifDecoderAO::RunL()
       
    61     {
       
    62     TRACER("CGlxDRMgifDecoderAO::RunL()");
       
    63     if (iStatus == KErrUnderflow)
       
    64         {
       
    65         GLX_LOG_INFO("CGlxDRMgifDecoderAO::RunL() - call ContinueConvert");
       
    66         iDecoder->ContinueConvert(&iStatus);
       
    67         }
       
    68     else
       
    69         {
       
    70         GLX_LOG_INFO("CGlxDRMgifDecoderAO::RunL() - call HandleRunL");
       
    71         iDrmGifTextureCreator->HandleRunL(iStatus);
       
    72         }
       
    73     }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // DoCancel
       
    77 // -----------------------------------------------------------------------------
       
    78 void CGlxDRMgifDecoderAO::DoCancel()
       
    79     {
       
    80     TRACER("CGlxDRMgifDecoderAO::DoCancel()");
       
    81     iDecoder->Cancel();
       
    82     }
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // ConvertImageL
       
    86 // -----------------------------------------------------------------------------
       
    87 void CGlxDRMgifDecoderAO::ConvertImageL(CFbsBitmap* aBitmap,
       
    88         CFbsBitmap* aBitmapMask, TInt aFrameNum, CImageDecoder* aDecoder)
       
    89     {
       
    90     TRACER("CGlxDRMgifDecoderAO::ConvertImageL()");
       
    91     iDecoder = aDecoder;
       
    92     GLX_LOG_INFO1("CGlxDRMgifDecoderAO::ConvertImageL() aFrameNum=%d", aFrameNum);
       
    93     if (aBitmapMask)
       
    94         {
       
    95         iDecoder->Convert(&iStatus, *aBitmap, *aBitmapMask, aFrameNum);
       
    96         }
       
    97     else
       
    98         {
       
    99         iDecoder->Convert(&iStatus, *aBitmap, aFrameNum);
       
   100         }
       
   101     SetActive();
       
   102     }
       
   103 //end of file