webengine/osswebengine/WebCore/page/symbian/WebCoreGraphicsContext.cpp
author Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
Fri, 08 May 2009 08:25:06 +0300
changeset 1 7c90e6132015
parent 0 dd21522fd290
child 47 e1bea15f9a39
permissions -rw-r--r--
Revision: 200915 Kit: 200918

/*
* 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;
    }

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