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 "platform/graphics/GraphicsContext.h" |
| 9 #include "platform/graphics/paint/DisplayItemList.h" |
| 10 #include "wtf/OwnPtr.h" |
| 11 |
8 namespace blink { | 12 namespace blink { |
9 | 13 |
10 class GraphicsContext; | 14 class FilterData; |
11 class LayoutObject; | 15 class LayoutObject; |
12 class LayoutSVGResourceFilter; | 16 class LayoutSVGResourceFilter; |
13 | 17 |
| 18 class SVGFilterRecordingContext { |
| 19 public: |
| 20 explicit SVGFilterRecordingContext(GraphicsContext* initialContext) : m_init
ialContext(initialContext) { } |
| 21 |
| 22 GraphicsContext* beginContent(FilterData*); |
| 23 void endContent(FilterData*); |
| 24 |
| 25 GraphicsContext* paintingContext() const { return m_initialContext; } |
| 26 |
| 27 private: |
| 28 OwnPtr<DisplayItemList> m_displayItemList; |
| 29 OwnPtr<GraphicsContext> m_context; |
| 30 GraphicsContext* m_initialContext; |
| 31 }; |
| 32 |
14 class SVGFilterPainter { | 33 class SVGFilterPainter { |
15 public: | 34 public: |
16 SVGFilterPainter(LayoutSVGResourceFilter& filter) : m_filter(filter) { } | 35 SVGFilterPainter(LayoutSVGResourceFilter& filter) : m_filter(filter) { } |
17 | 36 |
18 // Returns the context that should be used to paint the filter contents, or | 37 // Returns the context that should be used to paint the filter contents, or |
19 // null if the content should not be recorded. | 38 // null if the content should not be recorded. |
20 GraphicsContext* prepareEffect(LayoutObject&, GraphicsContext*); | 39 GraphicsContext* prepareEffect(LayoutObject&, SVGFilterRecordingContext&); |
21 void finishEffect(LayoutObject&, GraphicsContext*); | 40 void finishEffect(LayoutObject&, SVGFilterRecordingContext&); |
22 | 41 |
23 private: | 42 private: |
24 LayoutSVGResourceFilter& m_filter; | 43 LayoutSVGResourceFilter& m_filter; |
25 }; | 44 }; |
26 | 45 |
27 } // namespace blink | 46 } // namespace blink |
28 | 47 |
29 #endif // SVGFilterPainter_h | 48 #endif // SVGFilterPainter_h |
OLD | NEW |