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

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

Issue 1161273004: Add a Color class to dart:sky. (Closed) Base URL: git@github.com:/domokit/mojo.git@master
Patch Set: 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
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_PAINT_H_ 5 #ifndef SKY_ENGINE_CORE_PAINTING_PAINT_H_
6 #define SKY_ENGINE_CORE_PAINTING_PAINT_H_ 6 #define SKY_ENGINE_CORE_PAINTING_PAINT_H_
7 7
8 #include "sky/engine/core/painting/CanvasColor.h"
8 #include "sky/engine/tonic/dart_wrappable.h" 9 #include "sky/engine/tonic/dart_wrappable.h"
9 #include "sky/engine/wtf/PassRefPtr.h" 10 #include "sky/engine/wtf/PassRefPtr.h"
10 #include "sky/engine/wtf/RefCounted.h" 11 #include "sky/engine/wtf/RefCounted.h"
11 #include "third_party/skia/include/core/SkPaint.h" 12 #include "third_party/skia/include/core/SkPaint.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 class DrawLooper; 16 class DrawLooper;
16 class ColorFilter; 17 class ColorFilter;
17 18
18 class Paint : public RefCounted<Paint>, public DartWrappable { 19 class Paint : public RefCounted<Paint>, public DartWrappable {
19 DEFINE_WRAPPERTYPEINFO(); 20 DEFINE_WRAPPERTYPEINFO();
20 public: 21 public:
21 ~Paint() override; 22 ~Paint() override;
22 static PassRefPtr<Paint> create() 23 static PassRefPtr<Paint> create()
23 { 24 {
24 return adoptRef(new Paint); 25 return adoptRef(new Paint);
25 } 26 }
26 27
27 bool isAntiAlias() const { return m_paint.isAntiAlias(); } 28 bool isAntiAlias() const { return m_paint.isAntiAlias(); }
28 void setIsAntiAlias(bool value) { m_paint.setAntiAlias(value); } 29 void setIsAntiAlias(bool value) { m_paint.setAntiAlias(value); }
29 30
30 unsigned color() const { return m_paint.getColor(); } 31 unsigned color() const { return m_paint.getColor(); }
31 void setColor(unsigned color) { m_paint.setColor(color); } 32 void setColor(unsigned color) { m_paint.setColor(color); }
33 void setColor(CanvasColor color) { m_paint.setColor(color.sk_color); }
32 34
33 void setARGB(unsigned a, unsigned r, unsigned g, unsigned b) 35 void setARGB(unsigned a, unsigned r, unsigned g, unsigned b)
34 { 36 {
35 m_paint.setARGB(a, r, g, b); 37 m_paint.setARGB(a, r, g, b);
36 } 38 }
37 void setDrawLooper(DrawLooper* looper); 39 void setDrawLooper(DrawLooper* looper);
38 void setColorFilter(ColorFilter* filter); 40 void setColorFilter(ColorFilter* filter);
39 41
40 const SkPaint& paint() const { return m_paint; } 42 const SkPaint& paint() const { return m_paint; }
41 void setPaint(const SkPaint& paint) { m_paint = paint; } 43 void setPaint(const SkPaint& paint) { m_paint = paint; }
42 44
43 private: 45 private:
44 Paint(); 46 Paint();
45 47
46 SkPaint m_paint; 48 SkPaint m_paint;
47 }; 49 };
48 50
49 } // namespace blink 51 } // namespace blink
50 52
51 #endif // SKY_ENGINE_CORE_PAINTING_PAINT_H_ 53 #endif // SKY_ENGINE_CORE_PAINTING_PAINT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698