Title: [229796] trunk/Source/WebCore
Revision
229796
Author
[email protected]
Date
2018-03-21 00:17:23 -0700 (Wed, 21 Mar 2018)

Log Message

[Cairo] Draw Cairo patterns with cairo_paint_with_alpha()
https://bugs.webkit.org/show_bug.cgi?id=183774

Reviewed by Carlos Garcia Campos.

In the drawPatternToCairoContext() helper in CairoOperations.cpp source
file, always clip the painting region to the specified rectangle and
then use cairo_paint_with_alpha() to paint the passed-in pattern object,
not relaying rasterization to cairo_fill() when using opaque alpha. We
still clamp the alpha value to the 0.0 - 1.0 range.

No new tests -- no change in behavior.

* platform/graphics/cairo/CairoOperations.cpp:
(WebCore::Cairo::drawPatternToCairoContext):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (229795 => 229796)


--- trunk/Source/WebCore/ChangeLog	2018-03-21 07:16:46 UTC (rev 229795)
+++ trunk/Source/WebCore/ChangeLog	2018-03-21 07:17:23 UTC (rev 229796)
@@ -1,5 +1,23 @@
 2018-03-21  Zan Dobersek  <[email protected]>
 
+        [Cairo] Draw Cairo patterns with cairo_paint_with_alpha()
+        https://bugs.webkit.org/show_bug.cgi?id=183774
+
+        Reviewed by Carlos Garcia Campos.
+
+        In the drawPatternToCairoContext() helper in CairoOperations.cpp source
+        file, always clip the painting region to the specified rectangle and
+        then use cairo_paint_with_alpha() to paint the passed-in pattern object,
+        not relaying rasterization to cairo_fill() when using opaque alpha. We
+        still clamp the alpha value to the 0.0 - 1.0 range.
+
+        No new tests -- no change in behavior.
+
+        * platform/graphics/cairo/CairoOperations.cpp:
+        (WebCore::Cairo::drawPatternToCairoContext):
+
+2018-03-21  Zan Dobersek  <[email protected]>
+
         [TexMap] Have TextureMapperLayer::applyAnimationsRecursively() return running animation status
         https://bugs.webkit.org/show_bug.cgi?id=183771
 

Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp (229795 => 229796)


--- trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp	2018-03-21 07:16:46 UTC (rev 229795)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp	2018-03-21 07:17:23 UTC (rev 229796)
@@ -151,12 +151,8 @@
     cairo_translate(cr, destRect.x(), destRect.y());
     cairo_set_source(cr, pattern);
     cairo_rectangle(cr, 0, 0, destRect.width(), destRect.height());
-
-    if (alpha < 1) {
-        cairo_clip(cr);
-        cairo_paint_with_alpha(cr, alpha);
-    } else
-        cairo_fill(cr);
+    cairo_clip(cr);
+    cairo_paint_with_alpha(cr, std::max<float>(0, std::min<float>(1.0, alpha)));
 }
 
 static inline void fillRectWithColor(cairo_t* cr, const FloatRect& rect, const Color& color)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to