OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "platform/graphics/filters/FEBoxReflect.h" | 5 #include "platform/graphics/filters/FEBoxReflect.h" |
6 | 6 |
7 #include "platform/geometry/FloatRect.h" | 7 #include "platform/geometry/FloatRect.h" |
8 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" | 8 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" |
9 #include "wtf/Assertions.h" | 9 #include "wtf/Assertions.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 FEBoxReflect::FEBoxReflect(Filter* filter, const BoxReflection& reflection) | 13 FEBoxReflect::FEBoxReflect(Filter* filter, const BoxReflection& reflection) |
14 : FilterEffect(filter) | 14 : FilterEffect(filter) |
15 , m_reflection(reflection) | 15 , m_reflection(reflection) |
16 { | 16 { |
17 } | 17 } |
18 | 18 |
19 FEBoxReflect::~FEBoxReflect() | 19 FEBoxReflect::~FEBoxReflect() |
20 { | 20 { |
21 } | 21 } |
22 | 22 |
23 FloatRect FEBoxReflect::mapRect(const FloatRect& rect, bool forward) const | 23 FloatRect FEBoxReflect::mapEffect(const FloatRect& rect) const |
24 { | 24 { |
25 // Reflection about any line is self-inverse, so this for both forward and | |
26 // reverse mapping. | |
27 return m_reflection.mapRect(rect); | 25 return m_reflection.mapRect(rect); |
28 } | 26 } |
29 | 27 |
30 TextStream& FEBoxReflect::externalRepresentation(TextStream& ts, int indent) con
st | 28 TextStream& FEBoxReflect::externalRepresentation(TextStream& ts, int indent) con
st |
31 { | 29 { |
32 // Only called for SVG layout tree printing. | 30 // Only called for SVG layout tree printing. |
33 ASSERT_NOT_REACHED(); | 31 ASSERT_NOT_REACHED(); |
34 return ts; | 32 return ts; |
35 } | 33 } |
36 | 34 |
37 sk_sp<SkImageFilter> FEBoxReflect::createImageFilter() | 35 sk_sp<SkImageFilter> FEBoxReflect::createImageFilter() |
38 { | 36 { |
39 return SkiaImageFilterBuilder::buildBoxReflectFilter(m_reflection, SkiaImage
FilterBuilder::build(inputEffect(0), operatingColorSpace())); | 37 return SkiaImageFilterBuilder::buildBoxReflectFilter(m_reflection, SkiaImage
FilterBuilder::build(inputEffect(0), operatingColorSpace())); |
40 } | 38 } |
41 | 39 |
42 } // namespace blink | 40 } // namespace blink |
OLD | NEW |