Title: [280654] trunk/Source/WebCore
Revision
280654
Author
mago...@igalia.com
Date
2021-08-04 13:28:16 -0700 (Wed, 04 Aug 2021)

Log Message

[GTK][WPE] Elliptic radial gradients are not working
https://bugs.webkit.org/show_bug.cgi?id=228771

Reviewed by Žan Doberšek.

Transform the radial circular gradients using the aspect ratio to convert
them into the appropriate elliptic gradients.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (280653 => 280654)


--- trunk/Source/WebCore/ChangeLog	2021-08-04 20:20:52 UTC (rev 280653)
+++ trunk/Source/WebCore/ChangeLog	2021-08-04 20:28:16 UTC (rev 280654)
@@ -1,3 +1,16 @@
+2021-08-04  Miguel Gomez  <mago...@igalia.com>
+
+        [GTK][WPE] Elliptic radial gradients are not working
+        https://bugs.webkit.org/show_bug.cgi?id=228771
+
+        Reviewed by Žan Doberšek.
+
+        Transform the radial circular gradients using the aspect ratio to convert
+        them into the appropriate elliptic gradients.
+
+        * platform/graphics/cairo/GradientCairo.cpp:
+        (WebCore::Gradient::createPattern):
+
 2021-08-04  Devin Rousso  <drou...@apple.com>
 
         REGRESSION(?): subtitle text sizing is sometimes inconsistent

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


--- trunk/Source/WebCore/platform/graphics/cairo/GradientCairo.cpp	2021-08-04 20:20:52 UTC (rev 280653)
+++ trunk/Source/WebCore/platform/graphics/cairo/GradientCairo.cpp	2021-08-04 20:28:16 UTC (rev 280654)
@@ -195,6 +195,9 @@
 
 RefPtr<cairo_pattern_t> Gradient::createPattern(float globalAlpha, const AffineTransform& gradientSpaceTransform)
 {
+    cairo_matrix_t matrix = toCairoMatrix(gradientSpaceTransform);
+    cairo_matrix_invert(&matrix);
+
     auto gradient = WTF::switchOn(m_data,
         [&] (const LinearData& data) {
             auto gradient = adoptRef(cairo_pattern_create_linear(data.point0.x(), data.point0.y(), data.point1.x(), data.point1.y()));
@@ -206,6 +209,13 @@
             auto gradient = adoptRef(cairo_pattern_create_radial(data.point0.x(), data.point0.y(), data.startRadius, data.point1.x(), data.point1.y(), data.endRadius));
             for (auto& stop : stops())
                 addColorStopRGBA(gradient.get(), stop, globalAlpha);
+
+            if (data.aspectRatio != 1) {
+                cairo_matrix_translate(&matrix, data.point0.x(), data.point0.y());
+                cairo_matrix_scale(&matrix, 1.0, data.aspectRatio);
+                cairo_matrix_translate(&matrix, -data.point0.x(), -data.point0.y());
+            }
+
             return gradient;
         },
         [&] (const ConicData& data) {
@@ -230,8 +240,6 @@
         break;
     }
 
-    cairo_matrix_t matrix = toCairoMatrix(gradientSpaceTransform);
-    cairo_matrix_invert(&matrix);
     cairo_pattern_set_matrix(gradient.get(), &matrix);
 
     return gradient;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to