WebKit Bugzilla
Attachment 371944 Details for
Bug 198746
: [cairo][SVG] If clipPath has multiple elements, clip-path doesn't work with transform
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
WIP
wk-clip-to-image.diff (text/plain), 3.18 KB, created by
Carlos Garcia Campos
on 2019-06-12 05:15:03 PDT
(
hide
)
Description:
WIP
Filename:
MIME Type:
Creator:
Carlos Garcia Campos
Created:
2019-06-12 05:15:03 PDT
Size:
3.18 KB
patch
obsolete
>diff --git a/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp b/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp >index 7f242fdbecb..62e517431df 100644 >--- a/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp >+++ b/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp >@@ -30,41 +30,20 @@ > > #if USE(CAIRO) > >-#include "CairoUtilities.h" >-#include "Gradient.h" >-#include "GraphicsContext.h" >-#include "Pattern.h" > #include <cairo.h> > > namespace WebCore { > >-// In Cairo image masking is immediate, so to emulate image clipping we must save masking >-// details as part of the context state and apply them during platform restore. >-class ImageMaskInformation { >-public: >- void update(cairo_surface_t* maskSurface, const FloatRect& maskRect) >- { >- m_maskSurface = maskSurface; >- m_maskRect = maskRect; >- } >- >- bool isValid() const { return m_maskSurface; } >- cairo_surface_t* maskSurface() const { return m_maskSurface.get(); } >- const FloatRect& maskRect() const { return m_maskRect; } >- >-private: >- RefPtr<cairo_surface_t> m_maskSurface; >- FloatRect m_maskRect; >-}; >- >- > // Encapsulates the additional painting state information we store for each > // pushed graphics state. > class PlatformContextCairo::State { > public: > State() = default; > >- ImageMaskInformation m_imageMaskInformation; >+ struct { >+ RefPtr<cairo_pattern_t> pattern; >+ cairo_matrix_t matrix; >+ } m_mask; > }; > > PlatformContextCairo::PlatformContextCairo(cairo_t* cr) >@@ -76,11 +55,14 @@ PlatformContextCairo::PlatformContextCairo(cairo_t* cr) > > void PlatformContextCairo::restore() > { >- const ImageMaskInformation& maskInformation = m_state->m_imageMaskInformation; >- if (maskInformation.isValid()) { >- const FloatRect& maskRect = maskInformation.maskRect(); >+ if (m_state->m_mask.pattern) { > cairo_pop_group_to_source(m_cr.get()); >- cairo_mask_surface(m_cr.get(), maskInformation.maskSurface(), maskRect.x(), maskRect.y()); >+ >+ cairo_matrix_t matrix; >+ cairo_get_matrix(m_cr.get(), &matrix); >+ cairo_set_matrix(m_cr.get(), &m_state->m_mask.matrix); >+ cairo_mask(m_cr.get(), m_state->m_mask.pattern.get()); >+ cairo_set_matrix(m_cr.get(), &matrix); > } > > m_stateStack.removeLast(); >@@ -105,11 +87,13 @@ void PlatformContextCairo::pushImageMask(cairo_surface_t* surface, const FloatRe > // We must call savePlatformState at least once before we can use image masking, > // since we actually apply the mask in restorePlatformState. > ASSERT(!m_stateStack.isEmpty()); >- m_state->m_imageMaskInformation.update(surface, rect); >+ m_state->m_mask.pattern = adoptRef(cairo_pattern_create_for_surface(surface)); >+ cairo_get_matrix(m_cr.get(), &m_state->m_mask.matrix); >+ >+ cairo_matrix_t matrix; >+ cairo_matrix_init_translate(&matrix, -rect.x(), -rect.y()); >+ cairo_pattern_set_matrix(m_state->m_mask.pattern.get(), &matrix); > >- // Cairo doesn't support the notion of an image clip, so we push a group here >- // and then paint it to the surface with an image mask (which is an immediate >- // operation) during restorePlatformState. > cairo_push_group(m_cr.get()); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198746
:
371826
|
371938
|
371942
|
371944
|
371946
|
372014
|
372015