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

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

Issue 1151753009: Add Sky framework support for drawing images (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Run git cl format once more Created 5 years, 6 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/loader/NewImageLoader.cpp ('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/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/wtf/PassRefPtr.h" 14 #include "sky/engine/wtf/PassRefPtr.h"
15 #include "sky/engine/wtf/RefCounted.h" 15 #include "sky/engine/wtf/RefCounted.h"
16 16
17 namespace blink { 17 namespace blink {
18 class Element; 18 class Element;
19 class CanvasImage;
19 20
20 class Canvas : public RefCounted<Canvas>, public DartWrappable { 21 class Canvas : public RefCounted<Canvas>, public DartWrappable {
21 DEFINE_WRAPPERTYPEINFO(); 22 DEFINE_WRAPPERTYPEINFO();
22 public: 23 public:
23 Canvas(const FloatSize& size); 24 Canvas(const FloatSize& size);
24 ~Canvas() override; 25 ~Canvas() override;
25 26
26 // Width/Height define a culling rect which Skia may use for optimizing 27 // Width/Height define a culling rect which Skia may use for optimizing
27 // out draw calls issued outside the rect. 28 // out draw calls issued outside the rect.
28 float width() const { return m_size.width(); } 29 float width() const { return m_size.width(); }
(...skipping 10 matching lines...) Expand all
39 void concat(const Vector<float>& matrix); 40 void concat(const Vector<float>& matrix);
40 41
41 void clipRect(const Rect& rect); 42 void clipRect(const Rect& rect);
42 43
43 void drawPicture(Picture* picture); 44 void drawPicture(Picture* picture);
44 void drawPaint(const Paint* paint); 45 void drawPaint(const Paint* paint);
45 void drawRect(const Rect& rect, const Paint* paint); 46 void drawRect(const Rect& rect, const Paint* paint);
46 void drawOval(const Rect& rect, const Paint* paint); 47 void drawOval(const Rect& rect, const Paint* paint);
47 void drawCircle(float x, float y, float radius, const Paint* paint); 48 void drawCircle(float x, float y, float radius, const Paint* paint);
48 void drawPath(const CanvasPath* path, const Paint* paint); 49 void drawPath(const CanvasPath* path, const Paint* paint);
50 void drawImage(const CanvasImage* image,
51 float x,
52 float y,
53 const Paint* paint);
49 54
50 SkCanvas* skCanvas() { return m_canvas; } 55 SkCanvas* skCanvas() { return m_canvas; }
51 56
52 protected: 57 protected:
53 PassRefPtr<DisplayList> finishRecording(); 58 PassRefPtr<DisplayList> finishRecording();
54 59
55 bool isRecording() const { return m_canvas; } 60 bool isRecording() const { return m_canvas; }
56 61
57 private: 62 private:
58 FloatSize m_size; 63 FloatSize m_size;
59 RefPtr<DisplayList> m_displayList; 64 RefPtr<DisplayList> m_displayList;
60 SkCanvas* m_canvas; 65 SkCanvas* m_canvas;
61 }; 66 };
62 67
63 } // namespace blink 68 } // namespace blink
64 69
65 #endif // SKY_ENGINE_CORE_PAINTING_CANVAS_H_ 70 #endif // SKY_ENGINE_CORE_PAINTING_CANVAS_H_
OLDNEW
« no previous file with comments | « sky/engine/core/loader/NewImageLoader.cpp ('k') | sky/engine/core/painting/Canvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698