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 | 12 |
13 /** Given a quadratic equation Ax^2 + Bx + C = 0, return 0, 1, 2 roots for the | 13 /** Given a quadratic equation Ax^2 + Bx + C = 0, return 0, 1, 2 roots for the |
14 equation. | 14 equation. |
15 */ | 15 */ |
16 int SkFindUnitQuadRoots(SkScalar A, SkScalar B, SkScalar C, SkScalar roots[2]); | 16 int SkFindUnitQuadRoots(SkScalar A, SkScalar B, SkScalar C, SkScalar roots[2]); |
17 | 17 |
18 /////////////////////////////////////////////////////////////////////////////// | 18 /////////////////////////////////////////////////////////////////////////////// |
19 | 19 |
| 20 SkPoint SkEvalQuadAt(const SkPoint src[3], SkScalar t); |
| 21 SkPoint SkEvalQuadTangentAt(const SkPoint src[3], SkScalar t); |
| 22 void SkChopQuadAt2(const SkPoint src[3], SkPoint dst[5], SkScalar t); |
| 23 |
20 /** Set pt to the point on the src quadratic specified by t. t must be | 24 /** Set pt to the point on the src quadratic specified by t. t must be |
21 0 <= t <= 1.0 | 25 0 <= t <= 1.0 |
22 */ | 26 */ |
23 void SkEvalQuadAt(const SkPoint src[3], SkScalar t, SkPoint* pt, SkVector* tange
nt = NULL); | 27 void SkEvalQuadAt(const SkPoint src[3], SkScalar t, SkPoint* pt, SkVector* tange
nt = NULL); |
24 SkPoint SkEvalQuadAt(const SkPoint src[3], SkScalar t); | |
25 | 28 |
26 /** Given a src quadratic bezier, chop it at the specified t value, | 29 /** Given a src quadratic bezier, chop it at the specified t value, |
27 where 0 < t < 1, and return the two new quadratics in dst: | 30 where 0 < t < 1, and return the two new quadratics in dst: |
28 dst[0..2] and dst[2..4] | 31 dst[0..2] and dst[2..4] |
29 */ | 32 */ |
30 void SkChopQuadAt(const SkPoint src[3], SkPoint dst[5], SkScalar t); | 33 void SkChopQuadAt(const SkPoint src[3], SkPoint dst[5], SkScalar t); |
31 | 34 |
32 /** Given a src quadratic bezier, chop it at the specified t == 1/2, | 35 /** Given a src quadratic bezier, chop it at the specified t == 1/2, |
33 The new quads are returned in dst[0..2] and dst[2..4] | 36 The new quads are returned in dst[0..2] and dst[2..4] |
34 */ | 37 */ |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 private: | 301 private: |
299 enum { | 302 enum { |
300 kQuadCount = 8, // should handle most conics | 303 kQuadCount = 8, // should handle most conics |
301 kPointCount = 1 + 2 * kQuadCount, | 304 kPointCount = 1 + 2 * kQuadCount, |
302 }; | 305 }; |
303 SkAutoSTMalloc<kPointCount, SkPoint> fStorage; | 306 SkAutoSTMalloc<kPointCount, SkPoint> fStorage; |
304 int fQuadCount; // #quads for current usage | 307 int fQuadCount; // #quads for current usage |
305 }; | 308 }; |
306 | 309 |
307 #endif | 310 #endif |
OLD | NEW |