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

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

Issue 1144483002: Flesh out the Painting API a bit. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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
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_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/Paint.h"
9 #include "sky/engine/platform/graphics/DisplayList.h" 9 #include "sky/engine/platform/graphics/DisplayList.h"
10 #include "sky/engine/tonic/dart_wrappable.h" 10 #include "sky/engine/tonic/dart_wrappable.h"
11 #include "sky/engine/wtf/PassRefPtr.h" 11 #include "sky/engine/wtf/PassRefPtr.h"
12 #include "sky/engine/wtf/RefCounted.h" 12 #include "sky/engine/wtf/RefCounted.h"
13 #include "sky/engine/wtf/Vector.h"
13 14
14 namespace blink { 15 namespace blink {
15 class Element; 16 class Element;
16 17
17 class PaintingContext : public RefCounted<PaintingContext>, public DartWrappable { 18 class PaintingContext : public RefCounted<PaintingContext>, public DartWrappable {
18 DEFINE_WRAPPERTYPEINFO(); 19 DEFINE_WRAPPERTYPEINFO();
19 public: 20 public:
20 ~PaintingContext() override; 21 ~PaintingContext() override;
21 static PassRefPtr<PaintingContext> create(PassRefPtr<Element> element, const FloatSize& size); 22 static PassRefPtr<PaintingContext> create(PassRefPtr<Element> element, const FloatSize& size);
22 23
23 double height() const { return m_size.height(); } 24 double height() const { return m_size.height(); }
24 double width() const { return m_size.width(); } 25 double width() const { return m_size.width(); }
25 26
27 void save();
28 void saveLayer(Vector<float> bounds, Paint* paint);
29 void restore();
30
31 void translate(float dx, float dy);
32 void scale(float sx, float sy);
33 void rotate(float degrees);
34 void skew(float sx, float sy);
35 void concat(Vector<float> matrix);
36
37 void clipRect(Vector<float> rect);
38
39 void drawPaint(Paint* paint);
40 void drawRect(Vector<float> rect, Paint* paint);
41 void drawOval(Vector<float> rect, Paint* paint);
26 void drawCircle(double x, double y, double radius, Paint* paint); 42 void drawCircle(double x, double y, double radius, Paint* paint);
43
27 void commit(); 44 void commit();
28 45
29 private: 46 private:
30 PaintingContext(PassRefPtr<Element> element, const FloatSize& size); 47 PaintingContext(PassRefPtr<Element> element, const FloatSize& size);
31 48
32 RefPtr<Element> m_element; 49 RefPtr<Element> m_element;
33 FloatSize m_size; 50 FloatSize m_size;
34 RefPtr<DisplayList> m_displayList; 51 RefPtr<DisplayList> m_displayList;
35 SkCanvas* m_canvas; 52 SkCanvas* m_canvas;
36 }; 53 };
37 54
38 } // namespace blink 55 } // namespace blink
39 56
40 #endif // SKY_ENGINE_CORE_PAINTING_PAINTINGCONTEXT_H_ 57 #endif // SKY_ENGINE_CORE_PAINTING_PAINTINGCONTEXT_H_
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/painting/PaintingContext.cpp » ('j') | sky/engine/core/painting/PaintingContext.idl » ('J')

Powered by Google App Engine
This is Rietveld 408576698