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