Changeset 225775 in webkit


Ignore:
Timestamp:
Dec 11, 2017, 11:06:16 PM (8 years ago)
Author:
zandobersek@gmail.com
Message:

[Cairo] Cairo::clipToImageBuffer() should operate on a cairo_surface_t
https://bugs.webkit.org/show_bug.cgi?id=180665

Reviewed by Michael Catanzaro.

Have the Cairo::clipToImageBuffer() function in the CairoUtilities code
operate on a cairo_surface_t object, instead of an Image object.

Call site in GraphicsContext::clipToImageBuffer() is adjusted to first
ensure a non-null Image object, and then retrieve a cairo_surface_t
object from that, passing it on to Cairo::clipToImageBuffer().

No new tests -- no change in functionality.

  • platform/graphics/cairo/CairoOperations.cpp:

(WebCore::Cairo::clipToImageBuffer):

  • platform/graphics/cairo/CairoOperations.h:
  • platform/graphics/cairo/GraphicsContextCairo.cpp:

(WebCore::GraphicsContext::clipToImageBuffer):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r225774 r225775  
     12017-12-11  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        [Cairo] Cairo::clipToImageBuffer() should operate on a cairo_surface_t
     4        https://bugs.webkit.org/show_bug.cgi?id=180665
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Have the Cairo::clipToImageBuffer() function in the CairoUtilities code
     9        operate on a cairo_surface_t object, instead of an Image object.
     10
     11        Call site in GraphicsContext::clipToImageBuffer() is adjusted to first
     12        ensure a non-null Image object, and then retrieve a cairo_surface_t
     13        object from that, passing it on to Cairo::clipToImageBuffer().
     14
     15        No new tests -- no change in functionality.
     16
     17        * platform/graphics/cairo/CairoOperations.cpp:
     18        (WebCore::Cairo::clipToImageBuffer):
     19        * platform/graphics/cairo/CairoOperations.h:
     20        * platform/graphics/cairo/GraphicsContextCairo.cpp:
     21        (WebCore::GraphicsContext::clipToImageBuffer):
     22
    1232017-12-11  Zan Dobersek  <zdobersek@igalia.com>
    224
  • trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp

    r225091 r225775  
    10051005}
    10061006
    1007 void clipToImageBuffer(PlatformContextCairo& platformContext, Image& image, const FloatRect& destRect)
    1008 {
    1009     RefPtr<cairo_surface_t> surface = image.nativeImageForCurrentFrame();
    1010     if (surface)
    1011         platformContext.pushImageMask(surface.get(), destRect);
     1007void clipToImageBuffer(PlatformContextCairo& platformContext, cairo_surface_t* image, const FloatRect& destRect)
     1008{
     1009    platformContext.pushImageMask(image, destRect);
    10121010}
    10131011
  • trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.h

    r225077 r225775  
    4848class FloatSize;
    4949class GraphicsContext;
    50 class Image;
    5150class Path;
    5251class PlatformContextCairo;
     
    124123void clipPath(PlatformContextCairo&, const Path&, WindRule);
    125124
    126 void clipToImageBuffer(PlatformContextCairo&, Image&, const FloatRect&);
     125void clipToImageBuffer(PlatformContextCairo&, cairo_surface_t*, const FloatRect&);
    127126
    128127} // namespace Cairo
  • trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp

    r225077 r225775  
    268268
    269269    RefPtr<Image> image = buffer.copyImage(DontCopyBackingStore);
    270 
    271     ASSERT(hasPlatformContext());
    272     Cairo::clipToImageBuffer(*platformContext(), *image, destRect);
     270    if (!image)
     271        return;
     272
     273    ASSERT(hasPlatformContext());
     274    if (auto surface = image->nativeImageForCurrentFrame())
     275        Cairo::clipToImageBuffer(*platformContext(), surface.get(), destRect);
    273276}
    274277
Note: See TracChangeset for help on using the changeset viewer.