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