uigraphics/NVGRenderStage/src/vgigraphicsinterface.cpp
author William Roberts <williamr@symbian.org>
Mon, 23 Aug 2010 14:34:16 +0100
changeset 117 a07b4f57fa97
permissions -rw-r--r--
Add NVGRenderStage and update the *.ini files accordingly
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
117
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
     1
/*
a07b4f57fa97 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).
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
     3
* All rights reserved.
a07b4f57fa97 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
a07b4f57fa97 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"
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
a07b4f57fa97 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".
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
     8
*
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
     9
* Initial Contributors:
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    11
*
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    12
* Contributors:
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    13
*
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    14
* Description:    CVGIGraphicsInterface implementation.
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    15
*
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    16
*/
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    17
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    18
#include "vgigraphicsinterface.h"
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    19
#include <vgcontext_symbian.h>
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    20
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    21
CVGIGraphicsInterface::CVGIGraphicsInterface()
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    22
    {
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    23
    }
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    24
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    25
CVGIGraphicsInterface::~CVGIGraphicsInterface()
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    26
    {
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    27
    Terminate();
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    28
    }
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    29
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    30
void CVGIGraphicsInterface::InitializeL(TSize aSurfaceSize)
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    31
    {
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    32
        
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    33
    TInt err = VGISymbianInitialize( aSurfaceSize, VGI_COLORSPACE_SRGB );
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    34
    
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    35
    if ((err != KErrNone) && (err != KErrAlreadyExists))
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    36
        {
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    37
        User::Leave(err);
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    38
        }
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    39
    VGISymbianResize(aSurfaceSize);
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    40
    }
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    41
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    42
void CVGIGraphicsInterface::CopyBitmapL(CFbsBitmap* aPixMap, CFbsBitmap* aMask)
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    43
    {
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    44
    TInt error;
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    45
    if( !aMask )
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    46
        {
a07b4f57fa97 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);
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    48
        }
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    49
    else
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    50
        {
a07b4f57fa97 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);
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    52
        }
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    53
    User::LeaveIfError(error);
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    54
    }
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    55
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    56
void CVGIGraphicsInterface::Terminate()
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    57
    {
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    58
    VGISymbianTerminate();
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    59
    }
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    60
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    61
TInt CVGIGraphicsInterface::BindClientBuffer(TUint aBuffer)
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    62
    {
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    63
        return VGISymbianBindToImage(aBuffer);
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    64
    }
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    65
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    66
TInt CVGIGraphicsInterface::UnBindClientBuffer()
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    67
    {
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    68
    return VGISymbianUnBindImage();
a07b4f57fa97 Add NVGRenderStage and update the *.ini files accordingly
William Roberts <williamr@symbian.org>
parents:
diff changeset
    69
    }