Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(490)

Unified Diff: Source/core/layout/svg/LayoutSVGResourcePaintServer.cpp

Issue 1052873003: Explicitly use SkPaint(s) in SVGShapePainter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use GC::draw*; transfer->apply. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/layout/svg/LayoutSVGResourcePaintServer.h ('k') | Source/core/paint/SVGShapePainter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « Source/core/layout/svg/LayoutSVGResourcePaintServer.h ('k') | Source/core/paint/SVGShapePainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698