Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: sky/engine/core/painting/Canvas.h

Issue 1151673002: Sky: different tack for custom Rect type in the Canvas API. (Closed) Base URL: git@github.com:/domokit/mojo.git@master
Patch Set: Float32List Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/core.gni ('k') | sky/engine/core/painting/Canvas.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/Paint.h" 8 #include "sky/engine/core/painting/Paint.h"
9 #include "sky/engine/core/painting/Picture.h" 9 #include "sky/engine/core/painting/Picture.h"
10 #include "sky/engine/core/painting/Rect.h"
10 #include "sky/engine/platform/graphics/DisplayList.h" 11 #include "sky/engine/platform/graphics/DisplayList.h"
11 #include "sky/engine/tonic/dart_wrappable.h" 12 #include "sky/engine/tonic/dart_wrappable.h"
12 #include "sky/engine/wtf/PassRefPtr.h" 13 #include "sky/engine/wtf/PassRefPtr.h"
13 #include "sky/engine/wtf/RefCounted.h" 14 #include "sky/engine/wtf/RefCounted.h"
14 15
15 namespace blink { 16 namespace blink {
16 class Element; 17 class Element;
17 18
18 class Canvas : public RefCounted<Canvas>, public DartWrappable { 19 class Canvas : public RefCounted<Canvas>, public DartWrappable {
19 DEFINE_WRAPPERTYPEINFO(); 20 DEFINE_WRAPPERTYPEINFO();
20 public: 21 public:
21 Canvas(const FloatSize& size); 22 Canvas(const FloatSize& size);
22 ~Canvas() override; 23 ~Canvas() override;
23 24
24 // Width/Height define a culling rect which Skia may use for optimizing 25 // Width/Height define a culling rect which Skia may use for optimizing
25 // out draw calls issued outside the rect. 26 // out draw calls issued outside the rect.
26 float width() const { return m_size.width(); } 27 float width() const { return m_size.width(); }
27 float height() const { return m_size.height(); } 28 float height() const { return m_size.height(); }
28 29
29 void save(); 30 void save();
30 void saveLayer(const Vector<float>& bounds, const Paint* paint); 31 void saveLayer(const Rect& bounds, const Paint* paint);
31 void restore(); 32 void restore();
32 33
33 void translate(float dx, float dy); 34 void translate(float dx, float dy);
34 void scale(float sx, float sy); 35 void scale(float sx, float sy);
35 void rotateDegrees(float degrees); 36 void rotateDegrees(float degrees);
36 void skew(float sx, float sy); 37 void skew(float sx, float sy);
37 void concat(const Vector<float>& matrix); 38 void concat(const Vector<float>& matrix);
38 39
39 void clipRect(const Vector<float>& rect); 40 void clipRect(const Rect& rect);
40 41
41 void drawPicture(Picture* picture); 42 void drawPicture(Picture* picture);
42 void drawPaint(const Paint* paint); 43 void drawPaint(const Paint* paint);
43 void drawRect(const Vector<float>& rect, const Paint* paint); 44 void drawRect(const Rect& rect, const Paint* paint);
44 void drawOval(const Vector<float>& rect, const Paint* paint); 45 void drawOval(const Rect& rect, const Paint* paint);
45 void drawCircle(float x, float y, float radius, const Paint* paint); 46 void drawCircle(float x, float y, float radius, const Paint* paint);
46 47
47 SkCanvas* skCanvas() { return m_canvas; } 48 SkCanvas* skCanvas() { return m_canvas; }
48 49
49 protected: 50 protected:
50 PassRefPtr<DisplayList> finishRecording(); 51 PassRefPtr<DisplayList> finishRecording();
51 52
52 bool isRecording() const { return m_canvas; } 53 bool isRecording() const { return m_canvas; }
53 54
54 private: 55 private:
55 FloatSize m_size; 56 FloatSize m_size;
56 RefPtr<DisplayList> m_displayList; 57 RefPtr<DisplayList> m_displayList;
57 SkCanvas* m_canvas; 58 SkCanvas* m_canvas;
58 }; 59 };
59 60
60 } // namespace blink 61 } // namespace blink
61 62
62 #endif // SKY_ENGINE_CORE_PAINTING_CANVAS_H_ 63 #endif // SKY_ENGINE_CORE_PAINTING_CANVAS_H_
OLDNEW
« no previous file with comments | « sky/engine/core/core.gni ('k') | sky/engine/core/painting/Canvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698