OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkGeometry_DEFINED | 8 #ifndef SkGeometry_DEFINED |
9 #define SkGeometry_DEFINED | 9 #define SkGeometry_DEFINED |
10 | 10 |
11 #include "SkMatrix.h" | 11 #include "SkMatrix.h" |
12 #include "SkNx.h" | 12 #include "SkNx.h" |
13 | 13 |
14 static inline Sk2s from_point(const SkPoint& point) { | 14 static inline Sk2s from_point(const SkPoint& point) { |
15 return Sk2s::Load(&point.fX); | 15 return Sk2s::Load(&point); |
16 } | 16 } |
17 | 17 |
18 static inline SkPoint to_point(const Sk2s& x) { | 18 static inline SkPoint to_point(const Sk2s& x) { |
19 SkPoint point; | 19 SkPoint point; |
20 x.store(&point.fX); | 20 x.store(&point); |
21 return point; | 21 return point; |
22 } | 22 } |
23 | 23 |
24 static Sk2s times_2(const Sk2s& value) { | 24 static Sk2s times_2(const Sk2s& value) { |
25 return value + value; | 25 return value + value; |
26 } | 26 } |
27 | 27 |
28 /** Given a quadratic equation Ax^2 + Bx + C = 0, return 0, 1, 2 roots for the | 28 /** Given a quadratic equation Ax^2 + Bx + C = 0, return 0, 1, 2 roots for the |
29 equation. | 29 equation. |
30 */ | 30 */ |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 private: | 400 private: |
401 enum { | 401 enum { |
402 kQuadCount = 8, // should handle most conics | 402 kQuadCount = 8, // should handle most conics |
403 kPointCount = 1 + 2 * kQuadCount, | 403 kPointCount = 1 + 2 * kQuadCount, |
404 }; | 404 }; |
405 SkAutoSTMalloc<kPointCount, SkPoint> fStorage; | 405 SkAutoSTMalloc<kPointCount, SkPoint> fStorage; |
406 int fQuadCount; // #quads for current usage | 406 int fQuadCount; // #quads for current usage |
407 }; | 407 }; |
408 | 408 |
409 #endif | 409 #endif |
OLD | NEW |