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

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

Issue 1870793004: Move common logic between BoxReflectFilterOperation and FEBoxReflect into BoxReflection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no-filter-outsets-2
Patch Set: merge with master Created 4 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
Index: third_party/WebKit/Source/platform/graphics/filters/FEBoxReflect.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/filters/FEBoxReflect.cpp b/third_party/WebKit/Source/platform/graphics/filters/FEBoxReflect.cpp
index bd73ca8750cef603ad66aeb7ed6aee7508d4341b..456932579b7067c07b64c7e5cb0b6e50e73583c9 100644
--- a/third_party/WebKit/Source/platform/graphics/filters/FEBoxReflect.cpp
+++ b/third_party/WebKit/Source/platform/graphics/filters/FEBoxReflect.cpp
@@ -10,15 +10,9 @@
namespace blink {
-FEBoxReflect* FEBoxReflect::create(Filter* filter, ReflectionDirection direction, float offset)
-{
- return new FEBoxReflect(filter, direction, offset);
-}
-
-FEBoxReflect::FEBoxReflect(Filter* filter, ReflectionDirection direction, float offset)
+FEBoxReflect::FEBoxReflect(Filter* filter, const BoxReflection& reflection)
: FilterEffect(filter)
- , m_reflectionDirection(direction)
- , m_offset(offset)
+ , m_reflection(reflection)
{
}
@@ -28,17 +22,9 @@ FEBoxReflect::~FEBoxReflect()
FloatRect FEBoxReflect::mapRect(const FloatRect& rect, bool forward) const
{
- // Reflection about any line is self-inverse, so this matrix works for both
- // forward and reverse mapping.
- SkMatrix flipMatrix = SkiaImageFilterBuilder().matrixForBoxReflectFilter(
- m_reflectionDirection, m_offset);
-
- SkRect reflection(rect);
- flipMatrix.mapRect(&reflection);
-
- FloatRect result = rect;
- result.unite(reflection);
- return result;
+ // Reflection about any line is self-inverse, so this for both forward and
+ // reverse mapping.
+ return m_reflection.mapRect(rect);
}
TextStream& FEBoxReflect::externalRepresentation(TextStream& ts, int indent) const
@@ -51,7 +37,7 @@ TextStream& FEBoxReflect::externalRepresentation(TextStream& ts, int indent) con
PassRefPtr<SkImageFilter> FEBoxReflect::createImageFilter(SkiaImageFilterBuilder& builder)
{
RefPtr<SkImageFilter> input(builder.build(inputEffect(0), operatingColorSpace()));
- return builder.buildBoxReflectFilter(m_reflectionDirection, m_offset, nullptr, input.get());
+ return SkiaImageFilterBuilder().buildBoxReflectFilter(m_reflection, input.release());
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698