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..aa189b7018e9e7a96f162bae0c5e0a88b27af6cc 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::applyToSkPaint(SkPaint& paint, float paintAlpha) |
+{ |
+ 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); |