Chromium Code Reviews| Index: Source/core/layout/svg/LayoutSVGResourcePaintServer.cpp |
| diff --git a/Source/core/layout/svg/LayoutSVGResourcePaintServer.cpp b/Source/core/layout/svg/LayoutSVGResourcePaintServer.cpp |
| index ecb37da91fdaecd5a6847781c4b120e943b964a1..06139332aea67ffc84e4cb4a4037f60f72baaad6 100644 |
| --- a/Source/core/layout/svg/LayoutSVGResourcePaintServer.cpp |
| +++ b/Source/core/layout/svg/LayoutSVGResourcePaintServer.cpp |
| @@ -28,6 +28,7 @@ |
| #include "core/layout/svg/SVGResourcesCache.h" |
| #include "platform/graphics/GraphicsContext.h" |
| #include "platform/graphics/GraphicsContextStateSaver.h" |
| +#include "third_party/skia/include/core/SkPaint.h" |
| namespace blink { |
| @@ -48,6 +49,18 @@ SVGPaintServer::SVGPaintServer(PassRefPtr<Pattern> pattern) |
| { |
| } |
| +void SVGPaintServer::transferToSkPaint(SkPaint& paint, float paintAlpha) |
|
f(malita)
2015/04/02 15:51:12
Naming nit: applyToSkPaint maybe? ("transfer" soun
fs
2015/04/07 12:03:56
Done.
|
| +{ |
| + SkColor baseColor = m_gradient || m_pattern ? SK_ColorBLACK : m_color.rgb(); |
| + paint.setColor(scaleAlpha(baseColor, paintAlpha)); |
| + if (m_pattern) |
| + paint.setShader(m_pattern->shader()); |
| + else if (m_gradient) |
| + paint.setShader(m_gradient->shader()); |
| + else |
| + paint.setShader(nullptr); |
| +} |
| + |
| void SVGPaintServer::apply(GraphicsContext& context, LayoutSVGResourceMode resourceMode, float paintAlpha, GraphicsContextStateSaver& stateSaver) |
| { |
| ASSERT(resourceMode == ApplyToFillMode || resourceMode == ApplyToStrokeMode); |