uigraphics/NVGRenderStage/src/vgigraphicsinterface.cpp
author William Roberts <williamr@symbian.org>
Mon, 04 Jan 2010 21:58:13 +0000
changeset 14 dfd4516c2f08
permissions -rw-r--r--
Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
     1
/*
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
     2
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
     3
* All rights reserved.
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
     8
*
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
     9
* Initial Contributors:
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    11
*
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    12
* Contributors:
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    13
*
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    14
* Description:    CVGIGraphicsInterface implementation.
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    15
*
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    16
*/
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    17
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    18
#include "vgigraphicsinterface.h"
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    19
#include <vgcontext_symbian.h>
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    20
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    21
CVGIGraphicsInterface::CVGIGraphicsInterface()
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    22
    {
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    23
    }
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    24
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    25
CVGIGraphicsInterface::~CVGIGraphicsInterface()
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    26
    {
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    27
    Terminate();
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    28
    }
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    29
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    30
void CVGIGraphicsInterface::InitializeL(TSize aSurfaceSize)
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    31
    {
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    32
        
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    33
    TInt err = VGISymbianInitialize( aSurfaceSize, VGI_COLORSPACE_SRGB );
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    34
    
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    35
    if ((err != KErrNone) && (err != KErrAlreadyExists))
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    36
        {
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    37
        User::Leave(err);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    38
        }
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    39
    VGISymbianResize(aSurfaceSize);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    40
    }
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    41
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    42
void CVGIGraphicsInterface::CopyBitmapL(CFbsBitmap* aPixMap, CFbsBitmap* aMask)
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    43
    {
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    44
    TInt error;
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    45
    if( !aMask )
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    46
        {
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    47
        error = VGISymbianCopyToBitmap(aPixMap, aMask, VGI_SKIP_TRANSPARENT_PIXELS);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    48
        }
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    49
    else
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    50
        {
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    51
        error = VGISymbianCopyToBitmap(aPixMap, aMask, VGI_COPY_TRANSPARENT_PIXELS);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    52
        }
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    53
    User::LeaveIfError(error);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    54
    }
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    55
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    56
void CVGIGraphicsInterface::Terminate()
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    57
    {
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    58
    VGISymbianTerminate();
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    59
    }
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    60
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    61
TInt CVGIGraphicsInterface::BindClientBuffer(TUint aBuffer)
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    62
    {
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    63
        return VGISymbianBindToImage(aBuffer);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    64
    }
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    65
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    66
TInt CVGIGraphicsInterface::UnBindClientBuffer()
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    67
    {
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    68
    return VGISymbianUnBindImage();
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    69
    }