svgtopt/nvgdecoder/src/TLVIconRenderer.cpp
changeset 46 88edb906c587
equal deleted inserted replaced
-1:000000000000 46:88edb906c587
       
     1 /*
       
     2 * Copyright (c) 2008 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:  NVG Decoder source file
       
    15 *
       
    16 */
       
    17 
       
    18 #include <openvg.h>
       
    19 
       
    20 #include "TLVIconRenderer.h"
       
    21 #include "MVGImageBinder.h"
       
    22 #include "NVGUtil.h"
       
    23 #include "NVGIconData.h"
       
    24 #include "NVGTLVIcon.h"
       
    25 
       
    26 CTLVIconRenderer::CTLVIconRenderer(TInt aWidth, TInt aHeight)
       
    27     : CTLVRenderer(aWidth, aHeight)
       
    28     {
       
    29     }
       
    30 
       
    31 CTLVIconRenderer * CTLVIconRenderer::NewL(const TDesC8& aBuf, TInt aWidth, TInt aHeight)
       
    32     {
       
    33     CTLVIconRenderer* self = CTLVIconRenderer::NewLC(aBuf,aWidth, aHeight);
       
    34     CleanupStack::Pop(self);
       
    35     return self;
       
    36     }
       
    37 
       
    38 CTLVIconRenderer * CTLVIconRenderer::NewLC(const TDesC8& aBuf, TInt aWidth, TInt aHeight)
       
    39     {
       
    40     CTLVIconRenderer* self = new (ELeave) CTLVIconRenderer(aWidth, aHeight);
       
    41     CleanupStack::PushL(self);
       
    42     self->ConstructL(aBuf);
       
    43     return self;
       
    44     }
       
    45 
       
    46 CTLVIconRenderer::~CTLVIconRenderer()
       
    47     {
       
    48     }
       
    49 
       
    50 TInt CTLVIconRenderer::ExecuteL(TInt aIndex)
       
    51     {
       
    52     TInt ret = KErrNone;
       
    53     
       
    54     if (aIndex == CNVGTLVIcon::EPath)
       
    55         {
       
    56         ret = DrawPathL();
       
    57         }
       
    58     else
       
    59         {
       
    60         ret = CTLVRenderer::ExecuteL(aIndex);
       
    61         }
       
    62     
       
    63     return ret;
       
    64     }
       
    65 
       
    66 TInt CTLVIconRenderer::DrawPathL()
       
    67     {
       
    68     VGPath path = (VGPath)iNVGIconData->ReadInt32L();
       
    69     VGPaintMode paintMode = (VGPaintMode)iNVGIconData->ReadInt32L();
       
    70     vgDrawPath(path, paintMode);
       
    71 
       
    72     NVG_DEBUGSTMT(LogvgDrawPath(path, paintMode));
       
    73 
       
    74     return KErrNone;
       
    75     }