svgtopt/nvgdecoder/inc/OpenVGHandleStore.h
changeset 46 88edb906c587
equal deleted inserted replaced
-1:000000000000 46:88edb906c587
       
     1 /*
       
     2 * Copyright (c) 2003 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 header file
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef OPENVGHANDLESTORE_H_
       
    20 #define OPENVGHANDLESTORE_H_
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <openvg.h>
       
    24 
       
    25 class COpenVGHandleStore : public CBase
       
    26     {
       
    27 public:
       
    28     struct TLVVGHandlePair
       
    29         {
       
    30         enum THandleType
       
    31             {
       
    32             EVGPath,
       
    33             EVGPaint,
       
    34             EVGImage
       
    35             };
       
    36         VGHandle    iVGHandle;
       
    37         THandleType  iHandleType;
       
    38         
       
    39         explicit TLVVGHandlePair(VGHandle aVGHandle,  THandleType aHandleType = EVGPath)
       
    40             : iVGHandle(aVGHandle),
       
    41               iHandleType(aHandleType)
       
    42                 {
       
    43                 }
       
    44         };
       
    45 
       
    46     virtual ~COpenVGHandleStore();
       
    47     
       
    48     static COpenVGHandleStore * NewL();
       
    49 
       
    50     static COpenVGHandleStore * NewLC();
       
    51 
       
    52     void AddPathDHL(VGPath aHandle)
       
    53         {
       
    54         TInt error = AddPath(aHandle);
       
    55         if (error != KErrNone)
       
    56             {
       
    57             vgDestroyPath(aHandle);
       
    58             User::Leave(error);
       
    59             }
       
    60         }
       
    61 
       
    62     void AddPaintDHL(VGPaint aHandle)
       
    63         {
       
    64         TInt error = AddPaint(aHandle);
       
    65         if (error != KErrNone)
       
    66             {
       
    67             vgDestroyPaint(aHandle);
       
    68             User::Leave(error);
       
    69             }
       
    70         }
       
    71 
       
    72     void AddImageDHL(VGImage aHandle)
       
    73         {
       
    74         TInt error = AddImage(aHandle);
       
    75         if (error != KErrNone)
       
    76             {
       
    77             vgDestroyImage(aHandle);
       
    78             User::Leave(error);
       
    79             }
       
    80         }
       
    81     
       
    82     TInt AddPath(VGPath aHandle)
       
    83         {
       
    84         return iHandles.Append(TLVVGHandlePair(aHandle, TLVVGHandlePair::EVGPath));
       
    85         }
       
    86 
       
    87     TInt AddPaint(VGPaint aHandle)
       
    88         {
       
    89         return iHandles.Append(TLVVGHandlePair(aHandle, TLVVGHandlePair::EVGPaint));
       
    90         }
       
    91 
       
    92     TInt AddImage(VGImage aHandle)
       
    93         {
       
    94         return iHandles.Append(TLVVGHandlePair(aHandle, TLVVGHandlePair::EVGImage));
       
    95         }
       
    96 
       
    97     TInt AddHandle(VGHandle aHandle, TLVVGHandlePair::THandleType aType)
       
    98         {
       
    99         return iHandles.Append(TLVVGHandlePair(aHandle, aType));
       
   100         }
       
   101     
       
   102 private:
       
   103     COpenVGHandleStore();
       
   104 
       
   105     void ConstructL();
       
   106 
       
   107     RArray<TLVVGHandlePair> iHandles;
       
   108     };
       
   109 
       
   110 #endif
       
   111 //--------------------------------EndOfFile------------------------------------