Changeset 115385 in webkit


Ignore:
Timestamp:
Apr 26, 2012 4:03:06 PM (12 years ago)
Author:
Martin Robinson
Message:

[Cairo] Wrap cairo surfaces in a class when storing native images
https://bugs.webkit.org/show_bug.cgi?id=83611

Reviewed by Alejandro G. Castro.

Source/WebCore:

No new tests. This is just a refactoring. This shouldn't change
functionality.

Added class that wraps Cairo images surfaces to serve as the "native image"
type for the Cairo platform. This will allow the addition of caching resampled
images as well as versions of the image for non-image Cairo backends. Also
split out BitmapImageCairo.cpp from ImageCairo.cpp since these classes are
defined in two headers.

  • GNUmakefile.list.am: Added new files.
  • platform/graphics/BitmapImage.h: Added a factory method that takes an image surface to

reduce code churn.

  • platform/graphics/ImageSource.h: NativeImagePtr is now NativeImageCairo*.

(WebCore):

  • platform/graphics/cairo/BitmapImageCairo.cpp: Copied from Source/WebCore/platform/graphics/cairo/ImageCairo.cpp.
  • platform/graphics/cairo/GraphicsContext3DCairo.cpp: Updated to reflect use of NativeImageCairo.
  • platform/graphics/cairo/ImageCairo.cpp: Ditto.
  • platform/graphics/cairo/NativeImageCairo.cpp: Added.
  • platform/graphics/cairo/NativeImageCairo.h: Added.
  • platform/graphics/cairo/PatternCairo.cpp: Updated to reflect use of NativeImageCairo.
  • platform/graphics/gtk/ImageGtk.cpp: Ditto.
  • platform/image-decoders/cairo/ImageDecoderCairo.cpp: Ditto.

Source/WebKit/efl:

  • ewk/ewk_history.cpp: Updated to reflect addition of NativeImageCario.
  • ewk/ewk_settings.cpp: Ditto.

Source/WebKit2:

  • Shared/gtk/ArgumentCodersGtk.cpp: Updated to reflect the addition of NativeImageCairo.
Location:
trunk/Source
Files:
2 added
17 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r115383 r115385  
     12012-04-26  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [Cairo] Wrap cairo surfaces in a class when storing native images
     4        https://bugs.webkit.org/show_bug.cgi?id=83611
     5
     6        Reviewed by Alejandro G. Castro.
     7
     8        No new tests. This is just a refactoring. This shouldn't change
     9        functionality.
     10
     11        Added class that wraps Cairo images surfaces to serve as the "native image"
     12        type for the Cairo platform. This will allow the addition of caching resampled
     13        images as well as versions of the image for non-image Cairo backends. Also
     14        split out BitmapImageCairo.cpp from ImageCairo.cpp since these classes are
     15        defined in two headers.
     16
     17        * GNUmakefile.list.am: Added new files.
     18        * platform/graphics/BitmapImage.h: Added a factory method that takes an image surface to
     19        reduce code churn.
     20        * platform/graphics/ImageSource.h: NativeImagePtr is now NativeImageCairo*.
     21        (WebCore):
     22        * platform/graphics/cairo/BitmapImageCairo.cpp: Copied from Source/WebCore/platform/graphics/cairo/ImageCairo.cpp.
     23        * platform/graphics/cairo/GraphicsContext3DCairo.cpp: Updated to reflect use of NativeImageCairo.
     24        * platform/graphics/cairo/ImageCairo.cpp: Ditto.
     25        * platform/graphics/cairo/NativeImageCairo.cpp: Added.
     26        * platform/graphics/cairo/NativeImageCairo.h: Added.
     27        * platform/graphics/cairo/PatternCairo.cpp: Updated to reflect use of NativeImageCairo.
     28        * platform/graphics/gtk/ImageGtk.cpp: Ditto.
     29        * platform/image-decoders/cairo/ImageDecoderCairo.cpp: Ditto.
     30
    1312012-04-26  Mark Hahnenberg  <mhahnenberg@apple.com>
    232
  • trunk/Source/WebCore/GNUmakefile.list.am

    r115274 r115385  
    31093109        Source/WebCore/platform/graphics/DashArray.h \
    31103110        Source/WebCore/platform/graphics/Extensions3D.h \
     3111        Source/WebCore/platform/graphics/cairo/BitmapImageCairo.cpp \
    31113112        Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp \
    31123113        Source/WebCore/platform/graphics/cairo/CairoUtilities.h \
     
    31193120        Source/WebCore/platform/graphics/cairo/ImageCairo.cpp \
    31203121        Source/WebCore/platform/graphics/cairo/IntRectCairo.cpp \
     3122        Source/WebCore/platform/graphics/cairo/NativeImageCairo.cpp \
     3123        Source/WebCore/platform/graphics/cairo/NativeImageCairo.h \
    31213124        Source/WebCore/platform/graphics/cairo/OwnPtrCairo.cpp \
    31223125        Source/WebCore/platform/graphics/cairo/OwnPtrCairo.h \
  • trunk/Source/WebCore/PlatformEfl.cmake

    r114269 r115385  
    120120  LIST(APPEND WebCore_SOURCES
    121121    platform/cairo/WidgetBackingStoreCairo.cpp
     122    platform/graphics/cairo/BitmapImageCairo.cpp
    122123    platform/graphics/cairo/CairoUtilities.cpp
    123124    platform/graphics/cairo/FontCairo.cpp
     
    126127    platform/graphics/cairo/ImageBufferCairo.cpp
    127128    platform/graphics/cairo/ImageCairo.cpp
     129    platform/graphics/cairo/NativeImageCairo.cpp
    128130    platform/graphics/cairo/OwnPtrCairo.cpp
    129131    platform/graphics/cairo/PathCairo.cpp
  • trunk/Source/WebCore/platform/graphics/BitmapImage.h

    r113624 r115385  
    161161#endif
    162162
     163#if USE(CAIRO)
     164    static PassRefPtr<BitmapImage> create(cairo_surface_t*);
     165#endif
     166
    163167#if PLATFORM(GTK)
    164168    virtual GdkPixbuf* getGdkPixbuf();
  • trunk/Source/WebCore/platform/graphics/ImageSource.h

    r114683 r115385  
    4747QT_END_NAMESPACE
    4848#elif USE(CAIRO)
    49 struct _cairo_surface;
    50 typedef struct _cairo_surface cairo_surface_t;
     49#include "NativeImageCairo.h"
    5150#elif USE(SKIA)
    5251namespace WebCore {
     
    9190#endif
    9291#elif USE(CAIRO)
    93 typedef cairo_surface_t* NativeImagePtr;
     92typedef WebCore::NativeImageCairo* NativeImagePtr;
    9493#elif USE(SKIA)
    9594typedef WebCore::NativeImageSkia* NativeImagePtr;
  • trunk/Source/WebCore/platform/graphics/cairo/BitmapImageCairo.cpp

    r115383 r115385  
    2929#include "BitmapImage.h"
    3030
    31 #if USE(CAIRO)
    32 
    33 #include "AffineTransform.h"
    34 #include "CairoUtilities.h"
    35 #include "Color.h"
    36 #include "FloatRect.h"
    37 #include "GraphicsContext.h"
     31#include "ImageObserver.h"
     32#include "NativeImageCairo.h"
    3833#include "PlatformContextCairo.h"
    39 #include "ImageBuffer.h"
    40 #include "ImageObserver.h"
    41 #include "RefPtrCairo.h"
    4234#include <cairo.h>
    43 #include <math.h>
    44 #include <wtf/OwnPtr.h>
    4535
    4636namespace WebCore {
    4737
    48 bool FrameData::clear(bool clearMetadata)
     38PassRefPtr<BitmapImage> BitmapImage::create(cairo_surface_t* surface)
    4939{
    50     if (clearMetadata)
    51         m_haveMetadata = false;
    52 
    53     if (m_frame) {
    54         cairo_surface_destroy(m_frame);
    55         m_frame = 0;
    56         return true;
    57     }
    58     return false;
     40    return BitmapImage::create(new NativeImageCairo(surface));
    5941}
    6042
    61 BitmapImage::BitmapImage(cairo_surface_t* surface, ImageObserver* observer)
     43BitmapImage::BitmapImage(NativeImageCairo* nativeImage, ImageObserver* observer)
    6244    : Image(observer)
    6345    , m_currentFrame(0)
     
    7961    initPlatformData();
    8062
    81     // TODO: check to be sure this is an image surface
    82 
     63    cairo_surface_t* surface = nativeImage->surface();
    8364    int width = cairo_image_surface_get_width(surface);
    8465    int height = cairo_image_surface_get_height(surface);
     
    8768
    8869    m_frames.grow(1);
    89     m_frames[0].m_frame = surface;
     70    m_frames[0].m_frame = nativeImage;
    9071    m_frames[0].m_hasAlpha = cairo_surface_get_content(surface) != CAIRO_CONTENT_COLOR;
    9172    m_frames[0].m_haveMetadata = true;
     
    9879    FloatRect dstRect(dst);
    9980
    100     if (dstRect.width() == 0.0f || dstRect.height() == 0.0f ||
    101         srcRect.width() == 0.0f || srcRect.height() == 0.0f)
     81    if (!dstRect.width() || !dstRect.height() || !srcRect.width() || !srcRect.height())
    10282        return;
    10383
    10484    startAnimation();
    10585
    106     cairo_surface_t* image = frameAtIndex(m_currentFrame);
    107     if (!image) // If it's too early we won't have an image yet.
     86    NativeImageCairo* nativeImage = frameAtIndex(m_currentFrame);
     87    if (!nativeImage) // If it's too early we won't have an image yet.
    10888        return;
    10989
     
    120100    else
    121101        context->setCompositeOperation(op);
    122     context->platformContext()->drawSurfaceToContext(image, dstRect, srcRect, context);
     102    context->platformContext()->drawSurfaceToContext(nativeImage->surface(), dstRect, srcRect, context);
    123103
    124104    context->restore();
    125 
    126     if (imageObserver())
    127         imageObserver()->didDraw(this);
    128 }
    129 
    130 void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, const AffineTransform& patternTransform,
    131                         const FloatPoint& phase, ColorSpace colorSpace, CompositeOperator op, const FloatRect& destRect)
    132 {
    133     cairo_surface_t* image = nativeImageForCurrentFrame();
    134     if (!image) // If it's too early we won't have an image yet.
    135         return;
    136 
    137     cairo_t* cr = context->platformContext()->cr();
    138     drawPatternToCairoContext(cr, image, size(), tileRect, patternTransform, phase, toCairoOperator(op), destRect);
    139105
    140106    if (imageObserver())
     
    150116        return;
    151117
    152     cairo_surface_t* frameSurface = frameAtIndex(0);
    153     if (!frameSurface)
     118    NativeImageCairo* nativeImage = frameAtIndex(m_currentFrame);
     119    if (!nativeImage) // If it's too early we won't have an image yet.
    154120        return;
    155121
    156     ASSERT(cairo_surface_get_type(frameSurface) == CAIRO_SURFACE_TYPE_IMAGE);
     122    cairo_surface_t* surface = nativeImage->surface();
     123    ASSERT(cairo_surface_get_type(surface) == CAIRO_SURFACE_TYPE_IMAGE);
    157124
    158     int width = cairo_image_surface_get_width(frameSurface);
    159     int height = cairo_image_surface_get_height(frameSurface);
     125    int width = cairo_image_surface_get_width(surface);
     126    int height = cairo_image_surface_get_height(surface);
    160127
    161128    if (width != 1 || height != 1)
    162129        return;
    163130
    164     unsigned* pixelColor = reinterpret_cast<unsigned*>(cairo_image_surface_get_data(frameSurface));
     131    unsigned* pixelColor = reinterpret_cast<unsigned*>(cairo_image_surface_get_data(surface));
    165132    m_solidColor = colorFromPremultipliedARGB(*pixelColor);
    166133
     
    168135}
    169136
     137bool FrameData::clear(bool clearMetadata)
     138{
     139    if (clearMetadata)
     140        m_haveMetadata = false;
     141
     142    if (m_frame) {
     143        delete m_frame;
     144        m_frame = 0;
     145        return true;
     146    }
     147    return false;
    170148}
    171149
    172 #endif // USE(CAIRO)
     150} // namespace WebCore
     151
  • trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp

    r109609 r115385  
    158158        if (!decoder.frameCount() || !decoder.frameIsCompleteAtIndex(0))
    159159            return false;
    160         imageSurface = decoder.createFrameAtIndex(0);
     160        imageSurface = decoder.createFrameAtIndex(0)->surface();
    161161    } else {
    162         imageSurface = image->nativeImageForCurrentFrame();
     162        imageSurface = image->nativeImageForCurrentFrame()->surface();
    163163        if (!premultiplyAlpha)
    164164            alphaOp = AlphaDoUnmultiply;
  • trunk/Source/WebCore/platform/graphics/cairo/ImageCairo.cpp

    r102404 r115385  
    2727
    2828#include "config.h"
    29 #include "BitmapImage.h"
     29#include "Image.h"
    3030
    3131#if USE(CAIRO)
     
    3434#include "CairoUtilities.h"
    3535#include "Color.h"
    36 #include "FloatRect.h"
    3736#include "GraphicsContext.h"
     37#include "ImageObserver.h"
     38#include "NativeImageCairo.h"
    3839#include "PlatformContextCairo.h"
    39 #include "ImageBuffer.h"
    40 #include "ImageObserver.h"
    41 #include "RefPtrCairo.h"
    4240#include <cairo.h>
    4341#include <math.h>
    44 #include <wtf/OwnPtr.h>
    4542
    4643namespace WebCore {
    4744
    48 bool FrameData::clear(bool clearMetadata)
     45void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, const AffineTransform& patternTransform,
     46                        const FloatPoint& phase, ColorSpace colorSpace, CompositeOperator op, const FloatRect& destRect)
    4947{
    50     if (clearMetadata)
    51         m_haveMetadata = false;
    52 
    53     if (m_frame) {
    54         cairo_surface_destroy(m_frame);
    55         m_frame = 0;
    56         return true;
    57     }
    58     return false;
    59 }
    60 
    61 BitmapImage::BitmapImage(cairo_surface_t* surface, ImageObserver* observer)
    62     : Image(observer)
    63     , m_currentFrame(0)
    64     , m_frames(0)
    65     , m_frameTimer(0)
    66     , m_repetitionCount(cAnimationNone)
    67     , m_repetitionCountStatus(Unknown)
    68     , m_repetitionsComplete(0)
    69     , m_decodedSize(0)
    70     , m_frameCount(1)
    71     , m_isSolidColor(false)
    72     , m_checkedForSolidColor(false)
    73     , m_animationFinished(true)
    74     , m_allDataReceived(true)
    75     , m_haveSize(true)
    76     , m_sizeAvailable(true)
    77     , m_haveFrameCount(true)
    78 {
    79     initPlatformData();
    80 
    81     // TODO: check to be sure this is an image surface
    82 
    83     int width = cairo_image_surface_get_width(surface);
    84     int height = cairo_image_surface_get_height(surface);
    85     m_decodedSize = width * height * 4;
    86     m_size = IntSize(width, height);
    87 
    88     m_frames.grow(1);
    89     m_frames[0].m_frame = surface;
    90     m_frames[0].m_hasAlpha = cairo_surface_get_content(surface) != CAIRO_CONTENT_COLOR;
    91     m_frames[0].m_haveMetadata = true;
    92     checkForSolidColor();
    93 }
    94 
    95 void BitmapImage::draw(GraphicsContext* context, const FloatRect& dst, const FloatRect& src, ColorSpace styleColorSpace, CompositeOperator op)
    96 {
    97     FloatRect srcRect(src);
    98     FloatRect dstRect(dst);
    99 
    100     if (dstRect.width() == 0.0f || dstRect.height() == 0.0f ||
    101         srcRect.width() == 0.0f || srcRect.height() == 0.0f)
    102         return;
    103 
    104     startAnimation();
    105 
    106     cairo_surface_t* image = frameAtIndex(m_currentFrame);
     48    NativeImageCairo* image = nativeImageForCurrentFrame();
    10749    if (!image) // If it's too early we won't have an image yet.
    10850        return;
    10951
    110     if (mayFillWithSolidColor()) {
    111         fillWithSolidColor(context, dstRect, solidColor(), styleColorSpace, op);
    112         return;
    113     }
    114 
    115     context->save();
    116 
    117     // Set the compositing operation.
    118     if (op == CompositeSourceOver && !frameHasAlphaAtIndex(m_currentFrame))
    119         context->setCompositeOperation(CompositeCopy);
    120     else
    121         context->setCompositeOperation(op);
    122     context->platformContext()->drawSurfaceToContext(image, dstRect, srcRect, context);
    123 
    124     context->restore();
     52    cairo_t* cr = context->platformContext()->cr();
     53    drawPatternToCairoContext(cr, image->surface(), size(), tileRect, patternTransform, phase, toCairoOperator(op), destRect);
    12554
    12655    if (imageObserver())
     
    12857}
    12958
    130 void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, const AffineTransform& patternTransform,
    131                         const FloatPoint& phase, ColorSpace colorSpace, CompositeOperator op, const FloatRect& destRect)
    132 {
    133     cairo_surface_t* image = nativeImageForCurrentFrame();
    134     if (!image) // If it's too early we won't have an image yet.
    135         return;
    136 
    137     cairo_t* cr = context->platformContext()->cr();
    138     drawPatternToCairoContext(cr, image, size(), tileRect, patternTransform, phase, toCairoOperator(op), destRect);
    139 
    140     if (imageObserver())
    141         imageObserver()->didDraw(this);
    142 }
    143 
    144 void BitmapImage::checkForSolidColor()
    145 {
    146     m_isSolidColor = false;
    147     m_checkedForSolidColor = true;
    148 
    149     if (frameCount() > 1)
    150         return;
    151 
    152     cairo_surface_t* frameSurface = frameAtIndex(0);
    153     if (!frameSurface)
    154         return;
    155 
    156     ASSERT(cairo_surface_get_type(frameSurface) == CAIRO_SURFACE_TYPE_IMAGE);
    157 
    158     int width = cairo_image_surface_get_width(frameSurface);
    159     int height = cairo_image_surface_get_height(frameSurface);
    160 
    161     if (width != 1 || height != 1)
    162         return;
    163 
    164     unsigned* pixelColor = reinterpret_cast<unsigned*>(cairo_image_surface_get_data(frameSurface));
    165     m_solidColor = colorFromPremultipliedARGB(*pixelColor);
    166 
    167     m_isSolidColor = true;
    168 }
    169 
    17059}
    17160
  • trunk/Source/WebCore/platform/graphics/cairo/PatternCairo.cpp

    r95901 r115385  
    2929#include "AffineTransform.h"
    3030#include "GraphicsContext.h"
    31 
    3231#include <cairo.h>
    3332
     
    3635cairo_pattern_t* Pattern::createPlatformPattern(const AffineTransform&) const
    3736{
    38     cairo_surface_t* surface = tileImage()->nativeImageForCurrentFrame();
    39     if (!surface)
     37    NativeImageCairo* image = tileImage()->nativeImageForCurrentFrame();
     38    if (!image)
    4039        return 0;
    4140
    42     cairo_pattern_t* pattern = cairo_pattern_create_for_surface(surface);
     41    cairo_pattern_t* pattern = cairo_pattern_create_for_surface(image->surface());
    4342
    4443    // cairo merges patter space and user space itself
  • trunk/Source/WebCore/platform/graphics/gtk/ImageGtk.cpp

    r108206 r115385  
    113113GdkPixbuf* BitmapImage::getGdkPixbuf()
    114114{
    115     cairo_surface_t* frame = frameAtIndex(currentFrame());
    116     if (!frame)
    117         return 0;
    118     return cairoImageSurfaceToGdkPixbuf(frame);
     115    NativeImageCairo* image = nativeImageForCurrentFrame();
     116    return image ? cairoImageSurfaceToGdkPixbuf(image->surface()) : 0;
    119117}
    120118
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp

    r114992 r115385  
    490490    bytesPerLine = qtImage.bytesPerLine();
    491491#elif USE(CAIRO)
    492     imageData = reinterpret_cast<const char*>(cairo_image_surface_get_data(frameImage));
    493     bytesPerLine = cairo_image_surface_get_stride(frameImage);
     492    cairo_surface_t* surface = frameImage->surface();
     493    imageData = reinterpret_cast<const char*>(cairo_image_surface_get_data(surface));
     494    bytesPerLine = cairo_image_surface_get_stride(surface);
    494495#endif
    495496
  • trunk/Source/WebCore/platform/gtk/DragImageGtk.cpp

    r113486 r115385  
    7676DragImageRef createDragImageFromImage(Image* image, RespectImageOrientationEnum)
    7777{
    78     return cairo_surface_reference(image->nativeImageForCurrentFrame());
     78    NativeImageCairo* nativeImage = image->nativeImageForCurrentFrame();
     79    return nativeImage ? cairo_surface_reference(nativeImage->surface()) : 0;
    7980}
    8081
  • trunk/Source/WebCore/platform/image-decoders/cairo/ImageDecoderCairo.cpp

    r95901 r115385  
    3333NativeImagePtr ImageFrame::asNewNativeImage() const
    3434{
    35     return cairo_image_surface_create_for_data(
    36         reinterpret_cast<unsigned char*>(const_cast<PixelData*>(
    37             m_bytes)), CAIRO_FORMAT_ARGB32, width(), height(),
    38         width() * sizeof(PixelData));
     35    return new NativeImageCairo(cairo_image_surface_create_for_data(
     36        reinterpret_cast<unsigned char*>(const_cast<PixelData*>(m_bytes)),
     37        CAIRO_FORMAT_ARGB32, width(), height(), width() * sizeof(PixelData)));
    3938}
    4039
  • trunk/Source/WebKit/efl/ChangeLog

    r115341 r115385  
     12012-04-26  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [Cairo] Wrap cairo surfaces in a class when storing native images
     4        https://bugs.webkit.org/show_bug.cgi?id=83611
     5
     6        Reviewed by Alejandro G. Castro.
     7
     8        * ewk/ewk_history.cpp: Updated to reflect addition of NativeImageCario.
     9        * ewk/ewk_settings.cpp: Ditto.
     10
    1112012-04-26  Christophe Dumez  <christophe.dumez@intel.com>
    212
  • trunk/Source/WebKit/efl/ewk/ewk_history.cpp

    r109205 r115385  
    342342        return 0;
    343343    }
    344     return icon->nativeImageForCurrentFrame();
     344
     345    WebCore::NativeImageCairo* nativeImage = icon->nativeImageForCurrentFrame();
     346    return nativeImage ? nativeImage->surface() : 0;
    345347}
    346348
     
    350352    EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
    351353    WebCore::Image* icon = WebCore::iconDatabase().synchronousIconForPageURL(core->url(), WebCore::IntSize(16, 16));
    352     cairo_surface_t* surface;
    353354
    354355    if (!icon) {
     
    357358    }
    358359
    359     surface = icon->nativeImageForCurrentFrame();
    360     return ewk_util_image_from_cairo_surface_add(canvas, surface);
     360    WebCore::NativeImageCairo* nativeImage = icon->nativeImageForCurrentFrame();
     361    return nativeImage ? ewk_util_image_from_cairo_surface_add(canvas, nativeImage->surface()) : 0;
    361362}
    362363
  • trunk/Source/WebKit/efl/ewk/ewk_settings.cpp

    r113173 r115385  
    226226    }
    227227
    228     return icon->nativeImageForCurrentFrame();
     228    WebCore::NativeImageCairo* nativeImage = icon->nativeImageForCurrentFrame();
     229    return nativeImage ? nativeImage->surface() : 0;
    229230}
    230231
     
    236237    WebCore::KURL kurl(WebCore::KURL(), WTF::String::fromUTF8(url));
    237238    WebCore::Image* icon = WebCore::iconDatabase().synchronousIconForPageURL(kurl.string(), WebCore::IntSize(16, 16));
    238     cairo_surface_t* surface;
    239239
    240240    if (!icon) {
     
    243243    }
    244244
    245     surface = icon->nativeImageForCurrentFrame();
    246     return ewk_util_image_from_cairo_surface_add(canvas, surface);
     245    WebCore::NativeImageCairo* nativeImage = icon->nativeImageForCurrentFrame();
     246    return nativeImage ? ewk_util_image_from_cairo_surface_add(canvas, nativeImage->surface()) : 0;
    247247}
    248248
  • trunk/Source/WebKit2/ChangeLog

    r115369 r115385  
     12012-04-26  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [Cairo] Wrap cairo surfaces in a class when storing native images
     4        https://bugs.webkit.org/show_bug.cgi?id=83611
     5
     6        Reviewed by Alejandro G. Castro.
     7
     8        * Shared/gtk/ArgumentCodersGtk.cpp: Updated to reflect the addition of NativeImageCairo.
     9
    1102012-04-26  Jon Lee  <jonlee@apple.com>
    211
  • trunk/Source/WebKit2/Shared/gtk/ArgumentCodersGtk.cpp

    r106117 r115385  
    7272        return false;
    7373
    74     cairo_surface_t* surface = image->nativeImageForCurrentFrame();
    75     if (!surface)
    76         return false;
    77 
     74    NativeImageCairo* nativeImage = image->nativeImageForCurrentFrame();
     75    if (!nativeImage)
     76        return false;
     77
     78    cairo_surface_t* surface = nativeImage->surface();
    7879    pixbuf = adoptGRef(gdk_pixbuf_get_from_surface(surface, 0, 0,
    7980                                                   cairo_image_surface_get_width(surface),
Note: See TracChangeset for help on using the changeset viewer.