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 ClipPathClipper_h | 5 #ifndef ClipPathClipper_h |
6 #define ClipPathClipper_h | 6 #define ClipPathClipper_h |
7 | 7 |
8 #include "core/paint/SVGClipPainter.h" | |
9 #include "platform/graphics/paint/ClipPathRecorder.h" | 8 #include "platform/graphics/paint/ClipPathRecorder.h" |
10 #include "wtf/Optional.h" | 9 #include "wtf/Optional.h" |
11 | 10 |
12 namespace blink { | 11 namespace blink { |
13 | 12 |
14 class FloatPoint; | 13 class FloatPoint; |
15 class FloatRect; | 14 class FloatRect; |
16 class GraphicsContext; | 15 class GraphicsContext; |
17 class LayoutSVGResourceClipper; | 16 class LayoutSVGResourceClipper; |
18 class LayoutObject; | 17 class LayoutObject; |
19 | 18 |
| 19 enum class ClipperState { |
| 20 NotApplied, |
| 21 AppliedPath, |
| 22 AppliedMask |
| 23 }; |
| 24 |
20 class ClipPathClipper { | 25 class ClipPathClipper { |
21 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 26 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
22 public: | 27 public: |
23 ClipPathClipper( | 28 ClipPathClipper( |
24 GraphicsContext&, | 29 GraphicsContext&, |
25 const LayoutObject&, | 30 const LayoutObject&, |
26 const FloatRect& referenceBox, | 31 const FloatRect& referenceBox, |
27 const FloatPoint& origin); | 32 const FloatPoint& origin); |
28 ~ClipPathClipper(); | 33 ~ClipPathClipper(); |
29 | 34 |
| 35 bool usingMask() const { return m_clipperState == ClipperState::AppliedMask;
} |
| 36 |
30 private: | 37 private: |
31 LayoutSVGResourceClipper* m_resourceClipper; | 38 LayoutSVGResourceClipper* m_resourceClipper; |
32 Optional<ClipPathRecorder> m_clipPathRecorder; | 39 Optional<ClipPathRecorder> m_clipPathRecorder; |
33 SVGClipPainter::ClipperState m_clipperState; | 40 ClipperState m_clipperState; |
34 const LayoutObject& m_layoutObject; | 41 const LayoutObject& m_layoutObject; |
35 GraphicsContext& m_context; | 42 GraphicsContext& m_context; |
36 }; | 43 }; |
37 | 44 |
38 } // namespace blink | 45 } // namespace blink |
39 | 46 |
40 #endif // ClipPathClipper_h | 47 #endif // ClipPathClipper_h |
OLD | NEW |