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 SVGFilterPainter_h | 5 #ifndef SVGFilterPainter_h |
6 #define SVGFilterPainter_h | 6 #define SVGFilterPainter_h |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include "platform/graphics/GraphicsContext.h" | 9 #include "platform/graphics/GraphicsContext.h" |
10 #include "platform/graphics/paint/PaintController.h" | 10 #include "platform/graphics/paint/PaintController.h" |
11 #include "platform/wtf/Allocator.h" | 11 #include "platform/wtf/Allocator.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class FilterData; | |
16 class LayoutObject; | 15 class LayoutObject; |
17 class LayoutSVGResourceFilter; | 16 class LayoutSVGResourceFilter; |
18 | 17 |
19 class SVGFilterRecordingContext { | 18 class SVGFilterRecordingContext { |
20 USING_FAST_MALLOC(SVGFilterRecordingContext); | 19 USING_FAST_MALLOC(SVGFilterRecordingContext); |
21 WTF_MAKE_NONCOPYABLE(SVGFilterRecordingContext); | 20 WTF_MAKE_NONCOPYABLE(SVGFilterRecordingContext); |
22 | 21 |
23 public: | 22 public: |
24 explicit SVGFilterRecordingContext(GraphicsContext& initial_context) | 23 explicit SVGFilterRecordingContext(GraphicsContext& initial_context) |
25 : initial_context_(initial_context) {} | 24 : initial_context_(initial_context) {} |
26 | 25 |
27 GraphicsContext* BeginContent(FilterData*); | 26 GraphicsContext* BeginContent(); |
28 void EndContent(FilterData*); | 27 sk_sp<PaintRecord> EndContent(const FloatRect&); |
29 | 28 |
30 GraphicsContext& PaintingContext() const { return initial_context_; } | 29 GraphicsContext& PaintingContext() const { return initial_context_; } |
31 | 30 |
32 private: | 31 private: |
33 std::unique_ptr<PaintController> paint_controller_; | 32 std::unique_ptr<PaintController> paint_controller_; |
34 std::unique_ptr<GraphicsContext> context_; | 33 std::unique_ptr<GraphicsContext> context_; |
35 GraphicsContext& initial_context_; | 34 GraphicsContext& initial_context_; |
36 }; | 35 }; |
37 | 36 |
38 class SVGFilterPainter { | 37 class SVGFilterPainter { |
39 STACK_ALLOCATED(); | 38 STACK_ALLOCATED(); |
40 | 39 |
41 public: | 40 public: |
42 SVGFilterPainter(LayoutSVGResourceFilter& filter) : filter_(filter) {} | 41 SVGFilterPainter(LayoutSVGResourceFilter& filter) : filter_(filter) {} |
43 | 42 |
44 // Returns the context that should be used to paint the filter contents, or | 43 // Returns the context that should be used to paint the filter contents, or |
45 // null if the content should not be recorded. | 44 // null if the content should not be recorded. |
46 GraphicsContext* PrepareEffect(const LayoutObject&, | 45 GraphicsContext* PrepareEffect(const LayoutObject&, |
47 SVGFilterRecordingContext&); | 46 SVGFilterRecordingContext&); |
48 void FinishEffect(const LayoutObject&, SVGFilterRecordingContext&); | 47 void FinishEffect(const LayoutObject&, SVGFilterRecordingContext&); |
49 | 48 |
50 private: | 49 private: |
51 LayoutSVGResourceFilter& filter_; | 50 LayoutSVGResourceFilter& filter_; |
52 }; | 51 }; |
53 | 52 |
54 } // namespace blink | 53 } // namespace blink |
55 | 54 |
56 #endif // SVGFilterPainter_h | 55 #endif // SVGFilterPainter_h |
OLD | NEW |