OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SKY_ENGINE_CORE_PAINTING_PATH_H_ |
| 6 #define SKY_ENGINE_CORE_PAINTING_PATH_H_ |
| 7 |
| 8 #include "sky/engine/core/painting/Rect.h" |
| 9 #include "sky/engine/tonic/dart_wrappable.h" |
| 10 #include "sky/engine/wtf/PassRefPtr.h" |
| 11 #include "sky/engine/wtf/RefCounted.h" |
| 12 #include "third_party/skia/include/core/SkPath.h" |
| 13 |
| 14 // Note: There's a very similar class in ../../platform/graphics/Path.h |
| 15 // We should probably rationalise these two. |
| 16 // (The existence of that class is why this is CanvasPath and not just Path.) |
| 17 |
| 18 namespace blink { |
| 19 |
| 20 class CanvasPath : public RefCounted<CanvasPath>, public DartWrappable { |
| 21 DEFINE_WRAPPERTYPEINFO(); |
| 22 public: |
| 23 ~CanvasPath() override; |
| 24 static PassRefPtr<CanvasPath> create() |
| 25 { |
| 26 return adoptRef(new CanvasPath); |
| 27 } |
| 28 |
| 29 void moveTo(float x, float y) |
| 30 { |
| 31 m_path.moveTo(x, y); |
| 32 } |
| 33 |
| 34 void lineTo(float x, float y) |
| 35 { |
| 36 m_path.lineTo(x, y); |
| 37 } |
| 38 |
| 39 void arcTo(const Rect& rect, float startAngle, float sweepAngle, bool forceM
oveTo) |
| 40 { |
| 41 m_path.arcTo(rect.sk_rect, startAngle, sweepAngle, forceMoveTo); |
| 42 } |
| 43 |
| 44 void close() |
| 45 { |
| 46 m_path.close(); |
| 47 } |
| 48 |
| 49 const SkPath& path() const { return m_path; } |
| 50 |
| 51 private: |
| 52 CanvasPath(); |
| 53 |
| 54 SkPath m_path; |
| 55 }; |
| 56 |
| 57 } // namespace blink |
| 58 |
| 59 #endif // SKY_ENGINE_CORE_PAINTING_PATH_H_ |
OLD | NEW |