| 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_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/core/painting/CanvasColor.h" |
| 9 #include "sky/engine/core/painting/PaintingStyle.h" |
| 9 #include "sky/engine/core/painting/TransferMode.h" | 10 #include "sky/engine/core/painting/TransferMode.h" |
| 10 #include "sky/engine/tonic/dart_wrappable.h" | 11 #include "sky/engine/tonic/dart_wrappable.h" |
| 11 #include "sky/engine/wtf/PassRefPtr.h" | 12 #include "sky/engine/wtf/PassRefPtr.h" |
| 12 #include "sky/engine/wtf/RefCounted.h" | 13 #include "sky/engine/wtf/RefCounted.h" |
| 13 #include "third_party/skia/include/core/SkPaint.h" | 14 #include "third_party/skia/include/core/SkPaint.h" |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 | 17 |
| 17 class DrawLooper; | 18 class DrawLooper; |
| 18 class ColorFilter; | 19 class ColorFilter; |
| 19 class MaskFilter; | 20 class MaskFilter; |
| 20 | 21 |
| 21 class Paint : public RefCounted<Paint>, public DartWrappable { | 22 class Paint : public RefCounted<Paint>, public DartWrappable { |
| 22 DEFINE_WRAPPERTYPEINFO(); | 23 DEFINE_WRAPPERTYPEINFO(); |
| 23 public: | 24 public: |
| 24 ~Paint() override; | 25 ~Paint() override; |
| 25 static PassRefPtr<Paint> create() | 26 static PassRefPtr<Paint> create() |
| 26 { | 27 { |
| 27 return adoptRef(new Paint); | 28 return adoptRef(new Paint); |
| 28 } | 29 } |
| 29 | 30 |
| 30 bool isAntiAlias() const { return m_paint.isAntiAlias(); } | 31 bool isAntiAlias() const { return m_paint.isAntiAlias(); } |
| 31 void setIsAntiAlias(bool value) { m_paint.setAntiAlias(value); } | 32 void setIsAntiAlias(bool value) { m_paint.setAntiAlias(value); } |
| 32 | 33 |
| 33 SkColor color() const { return m_paint.getColor(); } | 34 SkColor color() const { return m_paint.getColor(); } |
| 34 void setColor(SkColor color) { m_paint.setColor(color); } | 35 void setColor(SkColor color) { m_paint.setColor(color); } |
| 35 | 36 |
| 36 unsigned short style() const { return m_paint.getStyle(); } | |
| 37 void setStyle(unsigned short style) { m_paint.setStyle(static_cast<SkPaint::
Style>(style)); } | |
| 38 | |
| 39 SkScalar strokeWidth() const { return m_paint.getStrokeWidth(); } | 37 SkScalar strokeWidth() const { return m_paint.getStrokeWidth(); } |
| 40 void setStrokeWidth(SkScalar strokeWidth) { m_paint.setStrokeWidth(strokeWid
th); } | 38 void setStrokeWidth(SkScalar strokeWidth) { m_paint.setStrokeWidth(strokeWid
th); } |
| 41 | 39 |
| 42 void setARGB(unsigned a, unsigned r, unsigned g, unsigned b) | 40 void setARGB(unsigned a, unsigned r, unsigned g, unsigned b) |
| 43 { | 41 { |
| 44 m_paint.setARGB(a, r, g, b); | 42 m_paint.setARGB(a, r, g, b); |
| 45 } | 43 } |
| 46 void setDrawLooper(DrawLooper* looper); | 44 void setDrawLooper(DrawLooper* looper); |
| 47 void setColorFilter(ColorFilter* filter); | 45 void setColorFilter(ColorFilter* filter); |
| 48 void setMaskFilter(MaskFilter* filter); | 46 void setMaskFilter(MaskFilter* filter); |
| 47 void setStyle(SkPaint::Style style); |
| 48 void setTransferMode(SkXfermode::Mode transfer_mode); |
| 49 | 49 |
| 50 const SkPaint& paint() const { return m_paint; } | 50 const SkPaint& paint() const { return m_paint; } |
| 51 void setPaint(const SkPaint& paint) { m_paint = paint; } | 51 void setPaint(const SkPaint& paint) { m_paint = paint; } |
| 52 | 52 |
| 53 void setTransferMode(SkXfermode::Mode transfer_mode); | |
| 54 | |
| 55 private: | 53 private: |
| 56 Paint(); | 54 Paint(); |
| 57 | 55 |
| 58 SkPaint m_paint; | 56 SkPaint m_paint; |
| 59 }; | 57 }; |
| 60 | 58 |
| 61 } // namespace blink | 59 } // namespace blink |
| 62 | 60 |
| 63 #endif // SKY_ENGINE_CORE_PAINTING_PAINT_H_ | 61 #endif // SKY_ENGINE_CORE_PAINTING_PAINT_H_ |
| OLD | NEW |