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