⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 280654 in webkit


Ignore:
Timestamp:
Aug 4, 2021, 1:28:16 PM (5 years ago)
Author:
magomez@igalia.com
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r280648 r280654  
     12021-08-04  Miguel Gomez  <magomez@igalia.com>
     2
     3        [GTK][WPE] Elliptic radial gradients are not working
     4        https://bugs.webkit.org/show_bug.cgi?id=228771
     5
     6        Reviewed by Žan Doberšek.
     7
     8        Transform the radial circular gradients using the aspect ratio to convert
     9        them into the appropriate elliptic gradients.
     10
     11        * platform/graphics/cairo/GradientCairo.cpp:
     12        (WebCore::Gradient::createPattern):
     13
    1142021-08-04  Devin Rousso  <drousso@apple.com>
    215
  • trunk/Source/WebCore/platform/graphics/cairo/GradientCairo.cpp

    r279941 r280654  
    196196RefPtr<cairo_pattern_t> Gradient::createPattern(float globalAlpha, const AffineTransform& gradientSpaceTransform)
    197197{
     198    cairo_matrix_t matrix = toCairoMatrix(gradientSpaceTransform);
     199    cairo_matrix_invert(&matrix);
     200
    198201    auto gradient = WTF::switchOn(m_data,
    199202        [&] (const LinearData& data) {
     
    207210            for (auto& stop : stops())
    208211                addColorStopRGBA(gradient.get(), stop, globalAlpha);
     212
     213            if (data.aspectRatio != 1) {
     214                cairo_matrix_translate(&matrix, data.point0.x(), data.point0.y());
     215                cairo_matrix_scale(&matrix, 1.0, data.aspectRatio);
     216                cairo_matrix_translate(&matrix, -data.point0.x(), -data.point0.y());
     217            }
     218
    209219            return gradient;
    210220        },
     
    231241    }
    232242
    233     cairo_matrix_t matrix = toCairoMatrix(gradientSpaceTransform);
    234     cairo_matrix_invert(&matrix);
    235243    cairo_pattern_set_matrix(gradient.get(), &matrix);
    236244
Note: See TracChangeset for help on using the changeset viewer.