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