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_PATH_H_ | 5 #ifndef SKY_ENGINE_CORE_PAINTING_PATH_H_ |
6 #define SKY_ENGINE_CORE_PAINTING_PATH_H_ | 6 #define SKY_ENGINE_CORE_PAINTING_PATH_H_ |
7 | 7 |
| 8 #include "math.h" |
| 9 |
8 #include "sky/engine/core/painting/Rect.h" | 10 #include "sky/engine/core/painting/Rect.h" |
9 #include "sky/engine/tonic/dart_wrappable.h" | 11 #include "sky/engine/tonic/dart_wrappable.h" |
10 #include "sky/engine/wtf/PassRefPtr.h" | 12 #include "sky/engine/wtf/PassRefPtr.h" |
11 #include "sky/engine/wtf/RefCounted.h" | 13 #include "sky/engine/wtf/RefCounted.h" |
12 #include "third_party/skia/include/core/SkPath.h" | 14 #include "third_party/skia/include/core/SkPath.h" |
13 | 15 |
14 // Note: There's a very similar class in ../../platform/graphics/Path.h | 16 // Note: There's a very similar class in ../../platform/graphics/Path.h |
15 // We should probably rationalise these two. | 17 // We should probably rationalise these two. |
16 // (The existence of that class is why this is CanvasPath and not just Path.) | 18 // (The existence of that class is why this is CanvasPath and not just Path.) |
17 | 19 |
(...skipping 13 matching lines...) Expand all Loading... |
31 m_path.moveTo(x, y); | 33 m_path.moveTo(x, y); |
32 } | 34 } |
33 | 35 |
34 void lineTo(float x, float y) | 36 void lineTo(float x, float y) |
35 { | 37 { |
36 m_path.lineTo(x, y); | 38 m_path.lineTo(x, y); |
37 } | 39 } |
38 | 40 |
39 void arcTo(const Rect& rect, float startAngle, float sweepAngle, bool forceM
oveTo) | 41 void arcTo(const Rect& rect, float startAngle, float sweepAngle, bool forceM
oveTo) |
40 { | 42 { |
41 m_path.arcTo(rect.sk_rect, startAngle, sweepAngle, forceMoveTo); | 43 m_path.arcTo(rect.sk_rect, startAngle*180.0/M_PI, sweepAngle*180.0/M_PI,
forceMoveTo); |
42 } | 44 } |
43 | 45 |
44 void close() | 46 void close() |
45 { | 47 { |
46 m_path.close(); | 48 m_path.close(); |
47 } | 49 } |
48 | 50 |
49 const SkPath& path() const { return m_path; } | 51 const SkPath& path() const { return m_path; } |
50 | 52 |
51 private: | 53 private: |
52 CanvasPath(); | 54 CanvasPath(); |
53 | 55 |
54 SkPath m_path; | 56 SkPath m_path; |
55 }; | 57 }; |
56 | 58 |
57 } // namespace blink | 59 } // namespace blink |
58 | 60 |
59 #endif // SKY_ENGINE_CORE_PAINTING_PATH_H_ | 61 #endif // SKY_ENGINE_CORE_PAINTING_PATH_H_ |
OLD | NEW |