Changeset 246354 in webkit


Ignore:
Timestamp:
Jun 12, 2019 9:21:20 AM (5 years ago)
Author:
Truitt Savell
Message:

Unreviewed, rolling out r246350.

r246350 Introduced a failing and timing out test svg/clip-path
/clip-hidpi.svg

Reverted changeset:

"[cairo][SVG] Putting multiple path elements in clippath
causes rendering artifacts"
https://bugs.webkit.org/show_bug.cgi?id=198701
https://trac.webkit.org/changeset/246350

Location:
trunk
Files:
4 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r246350 r246354  
     12019-06-12  Truitt Savell  <tsavell@apple.com>
     2
     3        Unreviewed, rolling out r246350.
     4
     5        r246350 Introduced a failing and timing out test svg/clip-path
     6        /clip-hidpi.svg
     7
     8        Reverted changeset:
     9
     10        "[cairo][SVG] Putting multiple path elements in clippath
     11        causes rendering artifacts"
     12        https://bugs.webkit.org/show_bug.cgi?id=198701
     13        https://trac.webkit.org/changeset/246350
     14
    1152019-06-12  Carlos Garcia Campos  <cgarcia@igalia.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r246350 r246354  
     12019-06-12  Truitt Savell  <tsavell@apple.com>
     2
     3        Unreviewed, rolling out r246350.
     4
     5        r246350 Introduced a failing and timing out test svg/clip-path
     6        /clip-hidpi.svg
     7
     8        Reverted changeset:
     9
     10        "[cairo][SVG] Putting multiple path elements in clippath
     11        causes rendering artifacts"
     12        https://bugs.webkit.org/show_bug.cgi?id=198701
     13        https://trac.webkit.org/changeset/246350
     14
    1152019-06-12  Carlos Garcia Campos  <cgarcia@igalia.com>
    216
  • trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp

    r246350 r246354  
    3131#if USE(CAIRO)
    3232
     33#include "CairoUtilities.h"
     34#include "Gradient.h"
     35#include "GraphicsContext.h"
     36#include "Pattern.h"
    3337#include <cairo.h>
    3438
    3539namespace WebCore {
     40
     41// In Cairo image masking is immediate, so to emulate image clipping we must save masking
     42// details as part of the context state and apply them during platform restore.
     43class ImageMaskInformation {
     44public:
     45    void update(cairo_surface_t* maskSurface, const FloatRect& maskRect)
     46    {
     47        m_maskSurface = maskSurface;
     48        m_maskRect = maskRect;
     49    }
     50
     51    bool isValid() const { return m_maskSurface; }
     52    cairo_surface_t* maskSurface() const { return m_maskSurface.get(); }
     53    const FloatRect& maskRect() const { return m_maskRect; }
     54
     55private:
     56    RefPtr<cairo_surface_t> m_maskSurface;
     57    FloatRect m_maskRect;
     58};
     59
    3660
    3761// Encapsulates the additional painting state information we store for each
     
    4165    State() = default;
    4266
    43     struct {
    44         RefPtr<cairo_pattern_t> pattern;
    45         cairo_matrix_t matrix;
    46     } m_mask;
     67    ImageMaskInformation m_imageMaskInformation;
    4768};
    4869
     
    5677void PlatformContextCairo::restore()
    5778{
    58     if (m_state->m_mask.pattern) {
     79    const ImageMaskInformation& maskInformation = m_state->m_imageMaskInformation;
     80    if (maskInformation.isValid()) {
     81        const FloatRect& maskRect = maskInformation.maskRect();
    5982        cairo_pop_group_to_source(m_cr.get());
    60 
    61         cairo_matrix_t matrix;
    62         cairo_get_matrix(m_cr.get(), &matrix);
    63         cairo_set_matrix(m_cr.get(), &m_state->m_mask.matrix);
    64         cairo_mask(m_cr.get(), m_state->m_mask.pattern.get());
    65         cairo_set_matrix(m_cr.get(), &matrix);
     83        cairo_mask_surface(m_cr.get(), maskInformation.maskSurface(), maskRect.x(), maskRect.y());
    6684    }
    6785
     
    88106    // since we actually apply the mask in restorePlatformState.
    89107    ASSERT(!m_stateStack.isEmpty());
    90     m_state->m_mask.pattern = adoptRef(cairo_pattern_create_for_surface(surface));
    91     cairo_get_matrix(m_cr.get(), &m_state->m_mask.matrix);
     108    m_state->m_imageMaskInformation.update(surface, rect);
    92109
    93     cairo_matrix_t matrix;
    94     cairo_matrix_init_translate(&matrix, -rect.x(), -rect.y());
    95     cairo_pattern_set_matrix(m_state->m_mask.pattern.get(), &matrix);
    96 
     110    // Cairo doesn't support the notion of an image clip, so we push a group here
     111    // and then paint it to the surface with an image mask (which is an immediate
     112    // operation) during restorePlatformState.
    97113    cairo_push_group(m_cr.get());
    98114}
Note: See TracChangeset for help on using the changeset viewer.