Title: [225775] trunk/Source/WebCore
- Revision
- 225775
- Author
- [email protected]
- Date
- 2017-12-11 23:06:16 -0800 (Mon, 11 Dec 2017)
Log 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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (225774 => 225775)
--- trunk/Source/WebCore/ChangeLog 2017-12-12 07:05:30 UTC (rev 225774)
+++ trunk/Source/WebCore/ChangeLog 2017-12-12 07:06:16 UTC (rev 225775)
@@ -1,5 +1,27 @@
2017-12-11 Zan Dobersek <[email protected]>
+ [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):
+
+2017-12-11 Zan Dobersek <[email protected]>
+
[Cairo] Don't use a static cairo_surface_t object for CairoPath contexts
https://bugs.webkit.org/show_bug.cgi?id=180663
Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp (225774 => 225775)
--- trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp 2017-12-12 07:05:30 UTC (rev 225774)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp 2017-12-12 07:06:16 UTC (rev 225775)
@@ -1004,11 +1004,9 @@
graphicsContextPrivate->clip(path);
}
-void clipToImageBuffer(PlatformContextCairo& platformContext, Image& image, const FloatRect& destRect)
+void clipToImageBuffer(PlatformContextCairo& platformContext, cairo_surface_t* image, const FloatRect& destRect)
{
- RefPtr<cairo_surface_t> surface = image.nativeImageForCurrentFrame();
- if (surface)
- platformContext.pushImageMask(surface.get(), destRect);
+ platformContext.pushImageMask(image, destRect);
}
} // namespace Cairo
Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.h (225774 => 225775)
--- trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.h 2017-12-12 07:05:30 UTC (rev 225774)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.h 2017-12-12 07:06:16 UTC (rev 225775)
@@ -47,7 +47,6 @@
class FloatRoundedRect;
class FloatSize;
class GraphicsContext;
-class Image;
class Path;
class PlatformContextCairo;
@@ -123,7 +122,7 @@
void clipOut(PlatformContextCairo&, const Path&);
void clipPath(PlatformContextCairo&, const Path&, WindRule);
-void clipToImageBuffer(PlatformContextCairo&, Image&, const FloatRect&);
+void clipToImageBuffer(PlatformContextCairo&, cairo_surface_t*, const FloatRect&);
} // namespace Cairo
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp (225774 => 225775)
--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp 2017-12-12 07:05:30 UTC (rev 225774)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp 2017-12-12 07:06:16 UTC (rev 225775)
@@ -267,9 +267,12 @@
return;
RefPtr<Image> image = buffer.copyImage(DontCopyBackingStore);
+ if (!image)
+ return;
ASSERT(hasPlatformContext());
- Cairo::clipToImageBuffer(*platformContext(), *image, destRect);
+ if (auto surface = image->nativeImageForCurrentFrame())
+ Cairo::clipToImageBuffer(*platformContext(), surface.get(), destRect);
}
IntRect GraphicsContext::clipBounds() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes