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