webengine/osswebengine/WebCore/page/symbian/WebCoreGraphicsContext.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 19 Aug 2010 10:58:56 +0300
branchRCL_3
changeset 47 e1bea15f9a39
parent 1 7c90e6132015
child 48 79859ed3eea9
permissions -rw-r--r--
Revision: 201032 Kit: 201033

/*
* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  
*
*/


#include "config.h"
#include "WebCoreGraphicsContext.h"

WebCoreGraphicsContext* WebCoreGraphicsContext::NewL(CFbsBitmapDevice *aBitmapDevice, CFbsBitmap* aBitmap, MScrollView* aView)
    {
    WebCoreGraphicsContext *self = new (ELeave) WebCoreGraphicsContext(aBitmap, aView);
    CleanupStack::PushL(self);
    self->ConstructL(aBitmapDevice);
    CleanupStack::Pop();
    return self;
    }

WebCoreGraphicsContext* WebCoreGraphicsContext::NewL(CFbsBitGc& aGc, CFbsBitmap* aBitmap, MScrollView* aView)
    {
    WebCoreGraphicsContext *self = new (ELeave) WebCoreGraphicsContext(aBitmap, aView);
    CleanupStack::PushL(self);
    self->ConstructL(aGc);
    CleanupStack::Pop();
    return self;
    }


void WebCoreGraphicsContext::ConstructL(CFbsBitmapDevice *aBitmapDevice)
    {
    User::LeaveIfError(aBitmapDevice->CreateContext(iBitmapContext));
    iGcOwned = ETrue;
    }

void WebCoreGraphicsContext::ConstructL(CFbsBitGc& aGc)
    {
    iBitmapContext = &aGc;
    iGcOwned = EFalse;
    }

WebCoreGraphicsContext::WebCoreGraphicsContext(CFbsBitmap* aBitmap, MScrollView* aView)
    {
    iScrollView = aView;
    iOffscreenBitmap = aBitmap;
    iOpacity = 1.0f; // default 1.0f i.e. fully opaque
    }

WebCoreGraphicsContext::~WebCoreGraphicsContext()
    {
    if (iGcOwned)
        delete iBitmapContext;
    }