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