OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 SVGClipPainter_h | 5 #ifndef SVGClipPainter_h |
6 #define SVGClipPainter_h | 6 #define SVGClipPainter_h |
7 | 7 |
8 #include "platform/geometry/FloatRect.h" | 8 #include "platform/geometry/FloatRect.h" |
9 #include "platform/graphics/paint/DisplayItemClient.h" | 9 #include "platform/graphics/paint/DisplayItemClient.h" |
| 10 #include "wtf/Allocator.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 class GraphicsContext; | 14 class GraphicsContext; |
14 class LayoutObject; | 15 class LayoutObject; |
15 class LayoutSVGResourceClipper; | 16 class LayoutSVGResourceClipper; |
16 | 17 |
17 class SVGClipPainter { | 18 class SVGClipPainter { |
| 19 STACK_ALLOCATED(); |
18 public: | 20 public: |
19 enum ClipperState { | 21 enum ClipperState { |
20 ClipperNotApplied, | 22 ClipperNotApplied, |
21 ClipperAppliedPath, | 23 ClipperAppliedPath, |
22 ClipperAppliedMask | 24 ClipperAppliedMask |
23 }; | 25 }; |
24 | 26 |
25 SVGClipPainter(LayoutSVGResourceClipper& clip) : m_clip(clip) { } | 27 SVGClipPainter(LayoutSVGResourceClipper& clip) : m_clip(clip) { } |
26 | 28 |
27 // FIXME: Filters are also stateful resources that could benefit from having
their state managed | 29 // FIXME: Filters are also stateful resources that could benefit from having
their state managed |
28 // on the caller stack instead of the current hashmap. We should look
at refactoring these | 30 // on the caller stack instead of the current hashmap. We should look
at refactoring these |
29 // into a general interface that can be shared. | 31 // into a general interface that can be shared. |
30 bool prepareEffect(const LayoutObject&, const FloatRect&, const FloatRect&,
GraphicsContext*, ClipperState&); | 32 bool prepareEffect(const LayoutObject&, const FloatRect&, const FloatRect&,
GraphicsContext*, ClipperState&); |
31 void finishEffect(const LayoutObject&, GraphicsContext*, ClipperState&); | 33 void finishEffect(const LayoutObject&, GraphicsContext*, ClipperState&); |
32 | 34 |
33 private: | 35 private: |
34 void drawClipMaskContent(GraphicsContext*, const LayoutObject&, const FloatR
ect& targetBoundingBox, const FloatRect& targetPaintInvalidationRect); | 36 void drawClipMaskContent(GraphicsContext*, const LayoutObject&, const FloatR
ect& targetBoundingBox, const FloatRect& targetPaintInvalidationRect); |
35 | 37 |
36 LayoutSVGResourceClipper& m_clip; | 38 LayoutSVGResourceClipper& m_clip; |
37 }; | 39 }; |
38 | 40 |
39 } // namespace blink | 41 } // namespace blink |
40 | 42 |
41 #endif // SVGClipPainter_h | 43 #endif // SVGClipPainter_h |
OLD | NEW |