Changeset 83932 in webkit


Ignore:
Timestamp:
Apr 14, 2011 7:12:11 PM (13 years ago)
Author:
joone.hur@collabora.co.uk
Message:

2011-04-14 Joone Hur <joone.hur@collabora.co.uk>

Reviewed by Martin Robinson.

Convert use of raw pointers to RefPtr in using Cairo
https://bugs.webkit.org/show_bug.cgi?id=57717

No new tests added becaue of just replacing raw pointers with smart pointers.

  • platform/graphics/cairo/ContextShadowCairo.cpp: Use a RefPtr<cairo_surface_t> instead of raw pointer. (WebCore::purgeScratchBuffer): (WebCore::getScratchBuffer):
  • platform/graphics/cairo/ImageBufferCairo.cpp: Use a RefPtr<cairo_t> instead of raw pointer. (copySurface):
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r83930 r83932  
     12011-04-14  Joone Hur  <joone.hur@collabora.co.uk>
     2
     3        Reviewed by Martin Robinson.
     4
     5        Convert use of raw pointers to RefPtr in using Cairo
     6        https://bugs.webkit.org/show_bug.cgi?id=57717
     7
     8        No new tests added becaue of just replacing raw pointers with smart pointers.
     9
     10        * platform/graphics/cairo/ContextShadowCairo.cpp: Use a RefPtr<cairo_surface_t> instead of raw pointer.
     11        (WebCore::purgeScratchBuffer):
     12        (WebCore::getScratchBuffer):
     13        * platform/graphics/cairo/ImageBufferCairo.cpp: Use a RefPtr<cairo_t> instead of raw pointer.
     14        (copySurface):
     15
    1162011-04-14  Naoki Takano  <takano.naoki@gmail.com>
    217
  • trunk/Source/WebCore/platform/graphics/cairo/ContextShadowCairo.cpp

    r82962 r83932  
    4343namespace WebCore {
    4444
    45 static cairo_surface_t* scratchBuffer = 0;
     45static RefPtr<cairo_surface_t> gScratchBuffer;
    4646static void purgeScratchBuffer()
    4747{
    48     cairo_surface_destroy(scratchBuffer);
    49     scratchBuffer = 0;
     48    gScratchBuffer.clear();
    5049}
    5150
     
    6968    int width = size.width();
    7069    int height = size.height();
    71     int scratchWidth = scratchBuffer ? cairo_image_surface_get_width(scratchBuffer) : 0;
    72     int scratchHeight = scratchBuffer ? cairo_image_surface_get_height(scratchBuffer) : 0;
     70    int scratchWidth = gScratchBuffer.get() ? cairo_image_surface_get_width(gScratchBuffer.get()) : 0;
     71    int scratchHeight = gScratchBuffer.get() ? cairo_image_surface_get_height(gScratchBuffer.get()) : 0;
    7372
    7473    // We do not need to recreate the buffer if the current buffer is large enough.
    75     if (scratchBuffer && scratchWidth >= width && scratchHeight >= height)
    76         return scratchBuffer;
     74    if (gScratchBuffer.get() && scratchWidth >= width && scratchHeight >= height)
     75        return gScratchBuffer.get();
    7776
    7877    purgeScratchBuffer();
     
    8180    width = (1 + (width >> 5)) << 5;
    8281    height = (1 + (height >> 5)) << 5;
    83     scratchBuffer = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
    84     return scratchBuffer;
     82    gScratchBuffer = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height));
     83    return gScratchBuffer.get();
    8584}
    8685
  • trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp

    r83044 r83932  
    5656    cairo_surface_t* newsurface = cairo_image_surface_create(format, width, height);
    5757
    58     cairo_t* cr = cairo_create(newsurface);
    59     cairo_set_source_surface(cr, surface, 0, 0);
    60     cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
    61     cairo_paint(cr);
    62     cairo_destroy(cr);
     58    RefPtr<cairo_t> cr = adoptRef(cairo_create(newsurface));
     59    cairo_set_source_surface(cr.get(), surface, 0, 0);
     60    cairo_set_operator(cr.get(), CAIRO_OPERATOR_SOURCE);
     61    cairo_paint(cr.get());
    6362
    6463    return newsurface;
Note: See TracChangeset for help on using the changeset viewer.