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_CANVAS_H_ | 5 #ifndef SKY_ENGINE_CORE_PAINTING_CANVAS_H_ |
6 #define SKY_ENGINE_CORE_PAINTING_CANVAS_H_ | 6 #define SKY_ENGINE_CORE_PAINTING_CANVAS_H_ |
7 | 7 |
8 #include "sky/engine/core/painting/CanvasPath.h" | 8 #include "sky/engine/core/painting/CanvasPath.h" |
9 #include "sky/engine/core/painting/Paint.h" | 9 #include "sky/engine/core/painting/Paint.h" |
10 #include "sky/engine/core/painting/Picture.h" | 10 #include "sky/engine/core/painting/Picture.h" |
11 #include "sky/engine/core/painting/Rect.h" | 11 #include "sky/engine/core/painting/Rect.h" |
12 #include "sky/engine/platform/graphics/DisplayList.h" | 12 #include "sky/engine/platform/graphics/DisplayList.h" |
13 #include "sky/engine/tonic/dart_wrappable.h" | 13 #include "sky/engine/tonic/dart_wrappable.h" |
| 14 #include "sky/engine/tonic/float32_list.h" |
14 #include "sky/engine/wtf/PassRefPtr.h" | 15 #include "sky/engine/wtf/PassRefPtr.h" |
15 #include "sky/engine/wtf/RefCounted.h" | 16 #include "sky/engine/wtf/RefCounted.h" |
16 | 17 |
17 namespace blink { | 18 namespace blink { |
18 class Element; | 19 class Element; |
19 class CanvasImage; | 20 class CanvasImage; |
20 | 21 |
21 class Canvas : public RefCounted<Canvas>, public DartWrappable { | 22 class Canvas : public RefCounted<Canvas>, public DartWrappable { |
22 DEFINE_WRAPPERTYPEINFO(); | 23 DEFINE_WRAPPERTYPEINFO(); |
23 public: | 24 public: |
24 Canvas(const FloatSize& size); | 25 Canvas(const FloatSize& size); |
25 ~Canvas() override; | 26 ~Canvas() override; |
26 | 27 |
27 // Width/Height define a culling rect which Skia may use for optimizing | 28 // Width/Height define a culling rect which Skia may use for optimizing |
28 // out draw calls issued outside the rect. | 29 // out draw calls issued outside the rect. |
29 float width() const { return m_size.width(); } | 30 float width() const { return m_size.width(); } |
30 float height() const { return m_size.height(); } | 31 float height() const { return m_size.height(); } |
31 | 32 |
32 void save(); | 33 void save(); |
33 void saveLayer(const Rect& bounds, const Paint* paint); | 34 void saveLayer(const Rect& bounds, const Paint* paint); |
34 void restore(); | 35 void restore(); |
35 | 36 |
36 void translate(float dx, float dy); | 37 void translate(float dx, float dy); |
37 void scale(float sx, float sy); | 38 void scale(float sx, float sy); |
38 void rotateDegrees(float degrees); | 39 void rotateDegrees(float degrees); |
39 void skew(float sx, float sy); | 40 void skew(float sx, float sy); |
40 void concat(const Vector<float>& matrix); | 41 void concat(const Float32List& matrix4); |
41 | 42 |
42 void clipRect(const Rect& rect); | 43 void clipRect(const Rect& rect); |
43 | 44 |
44 void drawPicture(Picture* picture); | 45 void drawPicture(Picture* picture); |
45 void drawPaint(const Paint* paint); | 46 void drawPaint(const Paint* paint); |
46 void drawRect(const Rect& rect, const Paint* paint); | 47 void drawRect(const Rect& rect, const Paint* paint); |
47 void drawOval(const Rect& rect, const Paint* paint); | 48 void drawOval(const Rect& rect, const Paint* paint); |
48 void drawCircle(float x, float y, float radius, const Paint* paint); | 49 void drawCircle(float x, float y, float radius, const Paint* paint); |
49 void drawPath(const CanvasPath* path, const Paint* paint); | 50 void drawPath(const CanvasPath* path, const Paint* paint); |
50 void drawImage(const CanvasImage* image, | 51 void drawImage(const CanvasImage* image, |
(...skipping 10 matching lines...) Expand all Loading... |
61 | 62 |
62 private: | 63 private: |
63 FloatSize m_size; | 64 FloatSize m_size; |
64 RefPtr<DisplayList> m_displayList; | 65 RefPtr<DisplayList> m_displayList; |
65 SkCanvas* m_canvas; | 66 SkCanvas* m_canvas; |
66 }; | 67 }; |
67 | 68 |
68 } // namespace blink | 69 } // namespace blink |
69 | 70 |
70 #endif // SKY_ENGINE_CORE_PAINTING_CANVAS_H_ | 71 #endif // SKY_ENGINE_CORE_PAINTING_CANVAS_H_ |
OLD | NEW |