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 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class AffineTransform; | |
14 class GraphicsContext; | 13 class GraphicsContext; |
15 class LayoutObject; | 14 class LayoutObject; |
16 class LayoutSVGResourceClipper; | 15 class LayoutSVGResourceClipper; |
17 | 16 |
18 class SVGClipPainter { | 17 class SVGClipPainter { |
19 public: | 18 public: |
20 enum ClipperState { | 19 enum ClipperState { |
21 ClipperNotApplied, | 20 ClipperNotApplied, |
22 ClipperAppliedPath, | 21 ClipperAppliedPath, |
23 ClipperAppliedMask | 22 ClipperAppliedMask |
24 }; | 23 }; |
25 | 24 |
26 SVGClipPainter(LayoutSVGResourceClipper& clip) : m_clip(clip) { } | 25 SVGClipPainter(LayoutSVGResourceClipper& clip) : m_clip(clip) { } |
27 | 26 |
28 // FIXME: Filters are also stateful resources that could benefit from having
their state managed | 27 // FIXME: Filters are also stateful resources that could benefit from having
their state managed |
29 // on the caller stack instead of the current hashmap. We should look
at refactoring these | 28 // on the caller stack instead of the current hashmap. We should look
at refactoring these |
30 // into a general interface that can be shared. | 29 // into a general interface that can be shared. |
31 bool applyStatefulResource(const LayoutObject&, GraphicsContext*, ClipperSta
te&); | 30 bool prepareEffect(const LayoutObject&, const FloatRect&, const FloatRect&,
GraphicsContext*, ClipperState&); |
32 void postApplyStatefulResource(const LayoutObject&, GraphicsContext*, Clippe
rState&); | 31 void finishEffect(const LayoutObject&, GraphicsContext*, ClipperState&); |
33 | |
34 // clipPath can be clipped too, but don't have a boundingBox or paintInvalid
ationRect. So we can't call | |
35 // applyResource directly and use the rects from the object, since they are
empty for LayoutSVGResources | |
36 // FIXME: We made applyClippingToContext public because we cannot call apply
Resource on HTML elements (it asserts on LayoutObject::objectBoundingBox) | |
37 bool applyClippingToContext(const LayoutObject&, const FloatRect&, const Flo
atRect&, GraphicsContext*, ClipperState&); | |
38 | 32 |
39 private: | 33 private: |
40 void drawClipMaskContent(GraphicsContext*, const LayoutObject&, const FloatR
ect& targetBoundingBox, const FloatRect& targetPaintInvalidationRect); | 34 void drawClipMaskContent(GraphicsContext*, const LayoutObject&, const FloatR
ect& targetBoundingBox, const FloatRect& targetPaintInvalidationRect); |
41 | 35 |
42 LayoutSVGResourceClipper& m_clip; | 36 LayoutSVGResourceClipper& m_clip; |
43 }; | 37 }; |
44 | 38 |
45 } // namespace blink | 39 } // namespace blink |
46 | 40 |
47 #endif // SVGClipPainter_h | 41 #endif // SVGClipPainter_h |
OLD | NEW |