Title: [216121] trunk/Source/WebCore
Revision
216121
Author
[email protected]
Date
2017-05-03 10:06:37 -0700 (Wed, 03 May 2017)

Log Message

[Cairo] Handle extended colors in gradients
https://bugs.webkit.org/show_bug.cgi?id=171596

Reviewed by Michael Catanzaro.

Check if every gradient color step is an extended color and use asExtended() instead of getRGBA() in such case.

Fixes: css3/color/gradients.html

* platform/graphics/cairo/GradientCairo.cpp:
(WebCore::Gradient::platformGradient):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (216120 => 216121)


--- trunk/Source/WebCore/ChangeLog	2017-05-03 16:58:04 UTC (rev 216120)
+++ trunk/Source/WebCore/ChangeLog	2017-05-03 17:06:37 UTC (rev 216121)
@@ -1,3 +1,17 @@
+2017-05-03  Carlos Garcia Campos  <[email protected]>
+
+        [Cairo] Handle extended colors in gradients
+        https://bugs.webkit.org/show_bug.cgi?id=171596
+
+        Reviewed by Michael Catanzaro.
+
+        Check if every gradient color step is an extended color and use asExtended() instead of getRGBA() in such case.
+
+        Fixes: css3/color/gradients.html
+
+        * platform/graphics/cairo/GradientCairo.cpp:
+        (WebCore::Gradient::platformGradient):
+
 2017-05-03  Daniel Bates  <[email protected]>
 
         Abandon the current load once the provisional loader detaches from the frame

Modified: trunk/Source/WebCore/platform/graphics/cairo/GradientCairo.cpp (216120 => 216121)


--- trunk/Source/WebCore/platform/graphics/cairo/GradientCairo.cpp	2017-05-03 16:58:04 UTC (rev 216120)
+++ trunk/Source/WebCore/platform/graphics/cairo/GradientCairo.cpp	2017-05-03 17:06:37 UTC (rev 216121)
@@ -61,15 +61,15 @@
     else
         m_gradient = cairo_pattern_create_linear(m_p0.x(), m_p0.y(), m_p1.x(), m_p1.y());
 
-    // FIXME: Add support for ExtendedColor.
     for (const auto& stop : m_stops) {
-        float r;
-        float g;
-        float b;
-        float a;
-        stop.color.getRGBA(r, g, b, a);
-        cairo_pattern_add_color_stop_rgba(m_gradient, stop.offset,
-            r, g, b, a * globalAlpha);
+        if (stop.color.isExtended()) {
+            cairo_pattern_add_color_stop_rgba(m_gradient, stop.offset, stop.color.asExtended().red(), stop.color.asExtended().green(), stop.color.asExtended().blue(),
+                stop.color.asExtended().alpha() * globalAlpha);
+        } else {
+            float r, g, b, a;
+            stop.color.getRGBA(r, g, b, a);
+            cairo_pattern_add_color_stop_rgba(m_gradient, stop.offset, r, g, b, a * globalAlpha);
+        }
     }
 
     switch (m_spreadMethod) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to