webengine/osswebengine/WebCore/page/symbian/WebCoreGraphicsContext.cpp
changeset 0 dd21522fd290
child 8 7c90e6132015
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2  * Copyright (c) 2005 Nokia Corporation, Inc. All rights reserved.
       
     3  *
       
     4  * Redistribution and use in source and binary forms, with or without
       
     5  * modification, are permitted provided that the following conditions
       
     6  * are met:
       
     7  * 1. Redistributions of source code must retain the above copyright
       
     8  *    notice, this list of conditions and the following disclaimer.
       
     9  * 2. Redistributions in binary form must reproduce the above copyright
       
    10  *    notice, this list of conditions and the following disclaimer in the
       
    11  *    documentation and/or other materials provided with the distribution.
       
    12  * 3. Neither the name of the Nokia Corporation nor the names of its
       
    13  *    contributors may be used to endorse or promote products derived
       
    14  *    from this software without specific prior written permission.
       
    15  *
       
    16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
       
    17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
       
    18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
       
    19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
       
    20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
       
    21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
       
    22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
       
    23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
       
    24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
       
    25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
       
    26  * POSSIBILITY OF SUCH DAMAGE.
       
    27  */
       
    28 
       
    29 #include "config.h"
       
    30 #include "WebCoreGraphicsContext.h"
       
    31 
       
    32 WebCoreGraphicsContext* WebCoreGraphicsContext::NewL(CFbsBitmapDevice *aBitmapDevice, CFbsBitmap* aBitmap, MScrollView* aView)
       
    33     {
       
    34     WebCoreGraphicsContext *self = new (ELeave) WebCoreGraphicsContext(aBitmap, aView);
       
    35     CleanupStack::PushL(self);
       
    36     self->ConstructL(aBitmapDevice);
       
    37     CleanupStack::Pop();
       
    38     return self;
       
    39     }
       
    40 
       
    41 WebCoreGraphicsContext* WebCoreGraphicsContext::NewL(CFbsBitGc& aGc, CFbsBitmap* aBitmap, MScrollView* aView)
       
    42     {
       
    43     WebCoreGraphicsContext *self = new (ELeave) WebCoreGraphicsContext(aBitmap, aView);
       
    44     CleanupStack::PushL(self);
       
    45     self->ConstructL(aGc);
       
    46     CleanupStack::Pop();
       
    47     return self;
       
    48     }
       
    49 
       
    50 
       
    51 void WebCoreGraphicsContext::ConstructL(CFbsBitmapDevice *aBitmapDevice)
       
    52     {
       
    53     User::LeaveIfError(aBitmapDevice->CreateContext(iBitmapContext));
       
    54     iGcOwned = ETrue;
       
    55     }
       
    56 
       
    57 void WebCoreGraphicsContext::ConstructL(CFbsBitGc& aGc)
       
    58     {
       
    59     iBitmapContext = &aGc;
       
    60     iGcOwned = EFalse;
       
    61     }
       
    62 
       
    63 WebCoreGraphicsContext::WebCoreGraphicsContext(CFbsBitmap* aBitmap, MScrollView* aView)
       
    64     {
       
    65     iScrollView = aView;
       
    66     iOffscreenBitmap = aBitmap;
       
    67     }
       
    68 
       
    69 WebCoreGraphicsContext::~WebCoreGraphicsContext()
       
    70     {
       
    71     if (iGcOwned)
       
    72         delete iBitmapContext;
       
    73     }
       
    74 
       
    75