Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePaintServer.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePaintServer.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePaintServer.cpp |
| index eb1b755b54d88a099575ee1897ba75a352cb215c..a77ffb1cfc416533fc7aa3f27d9c6162d3f031c6 100644 |
| --- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePaintServer.cpp |
| +++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourcePaintServer.cpp |
| @@ -35,14 +35,16 @@ SVGPaintServer::SVGPaintServer(Color color) |
| { |
| } |
| -SVGPaintServer::SVGPaintServer(PassRefPtr<Gradient> gradient) |
| +SVGPaintServer::SVGPaintServer(PassRefPtr<Gradient> gradient, const AffineTransform& transform) |
| : m_gradient(gradient) |
| + , m_transform(transform) |
| , m_color(Color::black) |
| { |
| } |
| -SVGPaintServer::SVGPaintServer(PassRefPtr<Pattern> pattern) |
| +SVGPaintServer::SVGPaintServer(PassRefPtr<Pattern> pattern, const AffineTransform& transform) |
| : m_pattern(pattern) |
| + , m_transform(transform) |
| , m_color(Color::black) |
| { |
| } |
| @@ -52,9 +54,11 @@ void SVGPaintServer::applyToSkPaint(SkPaint& paint, float paintAlpha) |
| SkColor baseColor = m_gradient || m_pattern ? SK_ColorBLACK : m_color.rgb(); |
| paint.setColor(scaleAlpha(baseColor, paintAlpha)); |
| if (m_pattern) { |
| - m_pattern->applyToPaint(paint); |
| + const SkMatrix localMatrix = affineTransformToSkMatrix(m_transform); |
| + m_pattern->applyToPaint(paint, &localMatrix); |
| } else if (m_gradient) { |
| - m_gradient->applyToPaint(paint); |
| + const SkMatrix localMatrix = affineTransformToSkMatrix(m_transform); |
| + m_gradient->applyToPaint(paint, &localMatrix); |
| } else { |
| paint.setShader(nullptr); |
| } |
| @@ -63,10 +67,7 @@ void SVGPaintServer::applyToSkPaint(SkPaint& paint, float paintAlpha) |
| void SVGPaintServer::prependTransform(const AffineTransform& transform) |
| { |
| ASSERT(m_gradient || m_pattern); |
| - if (m_pattern) |
| - m_pattern->setPatternSpaceTransform(transform * m_pattern->patternSpaceTransform()); |
| - else |
| - m_gradient->setGradientSpaceTransform(transform * m_gradient->gradientSpaceTransform()); |
| + m_transform = transform * m_transform; |
|
Stephen White
2016/05/26 20:36:26
Is there any danger that this function will be cal
fs
2016/05/26 21:35:43
The semantics are unchanged, maybe easier to see i
Stephen White
2016/05/26 21:38:28
You're right; it's the same as before. Ignore my c
|
| } |
| static SVGPaintDescription requestPaint(const LayoutObject& object, const ComputedStyle& style, LayoutSVGResourceMode mode) |