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

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: Created 5 years, 9 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
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);

Powered by Google App Engine
This is Rietveld 408576698