webengine/osswebengine/WebCore/page/symbian/WebCoreGraphicsContext.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 31 Aug 2010 16:17:46 +0300
branchRCL_3
changeset 48 79859ed3eea9
parent 47 e1bea15f9a39
child 49 919f36ff910f
permissions -rw-r--r--
Revision: 201034 Kit: 201035

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