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 #ifndef BoxReflection_h | 5 #ifndef BoxReflection_h |
6 #define BoxReflection_h | 6 #define BoxReflection_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "platform/graphics/paint/PaintRecord.h" | 9 #include "platform/graphics/paint/PaintRecord.h" |
10 #include "third_party/skia/include/core/SkRefCnt.h" | 10 #include "third_party/skia/include/core/SkRefCnt.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 HorizontalReflection, | 30 HorizontalReflection, |
31 }; | 31 }; |
32 | 32 |
33 BoxReflection(ReflectionDirection direction, | 33 BoxReflection(ReflectionDirection direction, |
34 float offset, | 34 float offset, |
35 sk_sp<PaintRecord> mask = nullptr) | 35 sk_sp<PaintRecord> mask = nullptr) |
36 : m_direction(direction), m_offset(offset), m_mask(std::move(mask)) {} | 36 : m_direction(direction), m_offset(offset), m_mask(std::move(mask)) {} |
37 | 37 |
38 ReflectionDirection direction() const { return m_direction; } | 38 ReflectionDirection direction() const { return m_direction; } |
39 float offset() const { return m_offset; } | 39 float offset() const { return m_offset; } |
40 PaintRecord* mask() const { return m_mask.get(); } | 40 const sk_sp<PaintRecord>& mask() const { return m_mask; } |
41 | 41 |
42 // Returns a matrix which maps points between the original content and its | 42 // Returns a matrix which maps points between the original content and its |
43 // reflection. Reflections are self-inverse, so this matrix can be used to | 43 // reflection. Reflections are self-inverse, so this matrix can be used to |
44 // map in either direction. | 44 // map in either direction. |
45 SkMatrix reflectionMatrix() const; | 45 SkMatrix reflectionMatrix() const; |
46 | 46 |
47 // Maps a source rectangle to the destination rectangle it can affect, | 47 // Maps a source rectangle to the destination rectangle it can affect, |
48 // including this reflection. Due to the symmetry of reflections, this can | 48 // including this reflection. Due to the symmetry of reflections, this can |
49 // also be used to map from a destination rectangle to the source rectangle | 49 // also be used to map from a destination rectangle to the source rectangle |
50 // which contributes to it. | 50 // which contributes to it. |
(...skipping 10 matching lines...) Expand all Loading... |
61 a.mask() == b.mask(); | 61 a.mask() == b.mask(); |
62 } | 62 } |
63 | 63 |
64 inline bool operator!=(const BoxReflection& a, const BoxReflection& b) { | 64 inline bool operator!=(const BoxReflection& a, const BoxReflection& b) { |
65 return !(a == b); | 65 return !(a == b); |
66 } | 66 } |
67 | 67 |
68 } // namespace blink | 68 } // namespace blink |
69 | 69 |
70 #endif // BoxReflection_h | 70 #endif // BoxReflection_h |
OLD | NEW |