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 SKY_ENGINE_CORE_PAINTING_PAINTINGCONTEXT_H_ | 5 #ifndef SKY_ENGINE_CORE_PAINTING_PAINTINGCONTEXT_H_ |
6 #define SKY_ENGINE_CORE_PAINTING_PAINTINGCONTEXT_H_ | 6 #define SKY_ENGINE_CORE_PAINTING_PAINTINGCONTEXT_H_ |
7 | 7 |
8 #include "sky/engine/core/painting/Paint.h" | 8 #include "sky/engine/core/painting/Canvas.h" |
9 #include "sky/engine/platform/graphics/DisplayList.h" | |
10 #include "sky/engine/tonic/dart_wrappable.h" | |
11 #include "sky/engine/wtf/PassRefPtr.h" | |
12 #include "sky/engine/wtf/RefCounted.h" | |
13 | 9 |
14 namespace blink { | 10 namespace blink { |
15 class Element; | 11 class Element; |
16 | 12 |
17 class PaintingContext : public RefCounted<PaintingContext>, public DartWrappable
{ | 13 class PaintingContext : public Canvas { |
18 DEFINE_WRAPPERTYPEINFO(); | 14 DEFINE_WRAPPERTYPEINFO(); |
19 public: | 15 public: |
20 ~PaintingContext() override; | 16 ~PaintingContext() override; |
21 static PassRefPtr<PaintingContext> create(PassRefPtr<Element> element, const
FloatSize& size); | 17 static PassRefPtr<PaintingContext> create(PassRefPtr<Element> element, const
FloatSize& size); |
22 | 18 |
23 double height() const { return m_size.height(); } | |
24 double width() const { return m_size.width(); } | |
25 | |
26 void drawCircle(double x, double y, double radius, Paint* paint); | |
27 void commit(); | 19 void commit(); |
28 | 20 |
29 private: | 21 private: |
30 PaintingContext(PassRefPtr<Element> element, const FloatSize& size); | 22 PaintingContext(PassRefPtr<Element> element, const FloatSize& size); |
31 | 23 |
32 RefPtr<Element> m_element; | 24 RefPtr<Element> m_element; |
33 FloatSize m_size; | |
34 RefPtr<DisplayList> m_displayList; | |
35 SkCanvas* m_canvas; | |
36 }; | 25 }; |
37 | 26 |
38 } // namespace blink | 27 } // namespace blink |
39 | 28 |
40 #endif // SKY_ENGINE_CORE_PAINTING_PAINTINGCONTEXT_H_ | 29 #endif // SKY_ENGINE_CORE_PAINTING_PAINTINGCONTEXT_H_ |
OLD | NEW |