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

Unified Diff: third_party/WebKit/Source/platform/graphics/filters/PaintFilterEffect.cpp

Issue 1543593002: Forward fill and stroke styles from 2d canvas to canvas filters (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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: third_party/WebKit/Source/platform/graphics/filters/PaintFilterEffect.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/filters/PaintFilterEffect.cpp b/third_party/WebKit/Source/platform/graphics/filters/PaintFilterEffect.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..90b5c87a571210bcccc041453085582b66fb31c2
--- /dev/null
+++ b/third_party/WebKit/Source/platform/graphics/filters/PaintFilterEffect.cpp
@@ -0,0 +1,55 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "platform/graphics/filters/PaintFilterEffect.h"
+
+#include "platform/graphics/filters/Filter.h"
+#include "platform/text/TextStream.h"
+#include "third_party/skia/include/core/SkShader.h"
+#include "third_party/skia/include/effects/SkRectShaderImageFilter.h"
+
+namespace blink {
+
+PaintFilterEffect::PaintFilterEffect(Filter* filter, PassRefPtr<SkShader> shader)
+ : FilterEffect(filter)
+ , m_shader(shader)
+{
+ setOperatingColorSpace(ColorSpaceDeviceRGB);
+}
+
+PaintFilterEffect::~PaintFilterEffect()
+{
+}
+
+PassRefPtrWillBeRawPtr<PaintFilterEffect> PaintFilterEffect::create(Filter* filter, PassRefPtr<SkShader> shader)
+{
+ return adoptRefWillBeNoop(new PaintFilterEffect(filter, shader));
+}
+
+const AtomicString& PaintFilterEffect::fillEffectName()
+{
+ DEFINE_STATIC_LOCAL(const AtomicString, s_effectName, ("FillPaint", AtomicString::ConstructFromLiteral));
+ return s_effectName;
+}
+
+const AtomicString& PaintFilterEffect::strokeEffectName()
+{
+ DEFINE_STATIC_LOCAL(const AtomicString, s_effectName, ("StrokePaint", AtomicString::ConstructFromLiteral));
+ return s_effectName;
+}
+
+PassRefPtr<SkImageFilter> PaintFilterEffect::createImageFilter(SkiaImageFilterBuilder&)
+{
+ bool dither = true;
+ return adoptRef(SkRectShaderImageFilter::Create(m_shader.get(), nullptr, dither));
+}
+
+TextStream& PaintFilterEffect::externalRepresentation(TextStream& ts, int indent) const
+{
+ writeIndent(ts, indent);
+ ts << "[PaintFilterEffect]\n";
+ return ts;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698