svgtopt/VGRenderer/SWVG/src/SWVGSurfaceImpl.cpp
changeset 0 d46562c3d99d
child 10 baacd33d915b
equal deleted inserted replaced
-1:000000000000 0:d46562c3d99d
       
     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:  CSWVGSurfaceImpl source file
       
    15  *
       
    16 */
       
    17 
       
    18 #include "SWVGSurfaceImpl.h"
       
    19     
       
    20 #include <platform/vg/vgcontext_symbian.h>
       
    21 
       
    22 
       
    23 CSWVGSurfaceImpl::CSWVGSurfaceImpl()
       
    24     {
       
    25     }
       
    26 
       
    27 CSWVGSurfaceImpl::~CSWVGSurfaceImpl()
       
    28     {
       
    29     }
       
    30 
       
    31 CSWVGSurfaceImpl* CSWVGSurfaceImpl::NewL()
       
    32     {
       
    33     CSWVGSurfaceImpl* self = CSWVGSurfaceImpl::NewLC();
       
    34     CleanupStack::Pop();
       
    35     return self;
       
    36     }
       
    37 
       
    38 CSWVGSurfaceImpl* CSWVGSurfaceImpl::NewLC()
       
    39     {
       
    40     CSWVGSurfaceImpl* self = new (ELeave)CSWVGSurfaceImpl();
       
    41     CleanupStack::PushL(self);
       
    42     self->ConstructL();
       
    43     return self;
       
    44     }
       
    45 
       
    46 inline void CSWVGSurfaceImpl::ConstructL()
       
    47     {
       
    48     }
       
    49 
       
    50 TInt CSWVGSurfaceImpl::InitializeSurface(TSize aSize, TInt aColorSpace)
       
    51     {
       
    52     iSize = aSize;
       
    53     return ::VGISymbianInitialize(aSize, (VGIColorSpace)aColorSpace);
       
    54     }
       
    55 
       
    56 void CSWVGSurfaceImpl::SetConfiguration(TInt /*aOption*/, const TAny* /*aValue*/)
       
    57     {    
       
    58     }
       
    59 
       
    60 TInt CSWVGSurfaceImpl::CreateSurface(TInt /*aDisplayMode*/, RWindow */*aSurface*/, CFbsBitmap */*aBitmap*/)
       
    61     {
       
    62     return KErrNone;
       
    63     }
       
    64 
       
    65 TInt CSWVGSurfaceImpl::ResizeSurface(TSize aSize)
       
    66     {
       
    67     iSize = aSize;
       
    68     return ::VGISymbianResize(aSize);
       
    69     }
       
    70 
       
    71 TInt CSWVGSurfaceImpl::CopyBitmap(TInt aDisplayMode,TInt aMaskMode,CFbsBitmap *aBitmap, CFbsBitmap *aMask, TSize aSize)
       
    72     {
       
    73     int ret = KErrNone;
       
    74     
       
    75     if (aBitmap->Handle() == 0)
       
    76         {
       
    77         ret = aBitmap->Create(aSize, (TDisplayMode)aDisplayMode);
       
    78         }
       
    79     
       
    80     if (ret != KErrNone)
       
    81         {
       
    82         return ret;
       
    83         }
       
    84     
       
    85     if (aMask)
       
    86         {
       
    87         if (aMask->Handle() == 0)
       
    88             {
       
    89             ret = aMask->Create(aSize, (TDisplayMode)aMaskMode);
       
    90             }
       
    91         }
       
    92 
       
    93     if (ret != KErrNone)
       
    94         {
       
    95         return ret;
       
    96         }
       
    97 
       
    98     if(aMask) 
       
    99         {
       
   100         ret = ::VGISymbianCopyToBitmap(aBitmap, aMask, VGI_SKIP_TRANSPARENT_PIXELS);
       
   101         }
       
   102     else
       
   103         {
       
   104         ret = ::VGISymbianCopyToBitmap(aBitmap, aMask, VGI_COPY_TRANSPARENT_PIXELS);
       
   105         }
       
   106         
       
   107     return KErrNone;
       
   108     }
       
   109 
       
   110 TInt CSWVGSurfaceImpl::PrepareToBindClientBuffer()
       
   111     {
       
   112     return KErrNone;
       
   113     }
       
   114 
       
   115 TInt CSWVGSurfaceImpl::BindClientBuffer(TInt buffer)
       
   116     {
       
   117     return ::VGISymbianBindToImage(buffer);
       
   118     }
       
   119   
       
   120 TInt CSWVGSurfaceImpl::UnBindClientBuffer()
       
   121     {
       
   122     return ::VGISymbianUnBindImage();
       
   123     }
       
   124 
       
   125 void CSWVGSurfaceImpl::TerminateSurface()
       
   126     {
       
   127     ::VGISymbianTerminate();
       
   128     }