| 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 #include "SkGeometry.h" | 8 #include "SkGeometry.h" |
| 9 #include "SkMatrix.h" | 9 #include "SkMatrix.h" |
| 10 #include "SkNx.h" | 10 #include "SkNx.h" |
| 11 | 11 |
| 12 static SkVector to_vector(const Sk2s& x) { | 12 static SkVector to_vector(const Sk2s& x) { |
| 13 SkVector vector; | 13 SkVector vector; |
| 14 x.store(&vector.fX); | 14 x.store(&vector); |
| 15 return vector; | 15 return vector; |
| 16 } | 16 } |
| 17 | 17 |
| 18 /** If defined, this makes eval_quad and eval_cubic do more setup (sometimes | 18 /** If defined, this makes eval_quad and eval_cubic do more setup (sometimes |
| 19 involving integer multiplies by 2 or 3, but fewer calls to SkScalarMul. | 19 involving integer multiplies by 2 or 3, but fewer calls to SkScalarMul. |
| 20 May also introduce overflow of fixed when we compute our setup. | 20 May also introduce overflow of fixed when we compute our setup. |
| 21 */ | 21 */ |
| 22 // #define DIRECT_EVAL_OF_POLYNOMIALS | 22 // #define DIRECT_EVAL_OF_POLYNOMIALS |
| 23 | 23 |
| 24 //////////////////////////////////////////////////////////////////////// | 24 //////////////////////////////////////////////////////////////////////// |
| (...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 | 1053 |
| 1054 Sk2s C = ww * p10; | 1054 Sk2s C = ww * p10; |
| 1055 Sk2s A = ww * p20 - p20; | 1055 Sk2s A = ww * p20 - p20; |
| 1056 Sk2s B = p20 - C - C; | 1056 Sk2s B = p20 - C - C; |
| 1057 | 1057 |
| 1058 return to_vector(SkQuadCoeff(A, B, C).eval(t)); | 1058 return to_vector(SkQuadCoeff(A, B, C).eval(t)); |
| 1059 } | 1059 } |
| 1060 | 1060 |
| 1061 void SkConic::evalAt(SkScalar t, SkPoint* pt, SkVector* tangent) const { | 1061 void SkConic::evalAt(SkScalar t, SkPoint* pt, SkVector* tangent) const { |
| 1062 SkASSERT(t >= 0 && t <= SK_Scalar1); | 1062 SkASSERT(t >= 0 && t <= SK_Scalar1); |
| 1063 | 1063 |
| 1064 if (pt) { | 1064 if (pt) { |
| 1065 *pt = this->evalAt(t); | 1065 *pt = this->evalAt(t); |
| 1066 } | 1066 } |
| 1067 if (tangent) { | 1067 if (tangent) { |
| 1068 *tangent = this->evalTangentAt(t); | 1068 *tangent = this->evalTangentAt(t); |
| 1069 } | 1069 } |
| 1070 } | 1070 } |
| 1071 | 1071 |
| 1072 static SkScalar subdivide_w_value(SkScalar w) { | 1072 static SkScalar subdivide_w_value(SkScalar w) { |
| 1073 return SkScalarSqrt(SK_ScalarHalf + w * SK_ScalarHalf); | 1073 return SkScalarSqrt(SK_ScalarHalf + w * SK_ScalarHalf); |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 matrix.preScale(SK_Scalar1, -SK_Scalar1); | 1338 matrix.preScale(SK_Scalar1, -SK_Scalar1); |
| 1339 } | 1339 } |
| 1340 if (userMatrix) { | 1340 if (userMatrix) { |
| 1341 matrix.postConcat(*userMatrix); | 1341 matrix.postConcat(*userMatrix); |
| 1342 } | 1342 } |
| 1343 for (int i = 0; i < conicCount; ++i) { | 1343 for (int i = 0; i < conicCount; ++i) { |
| 1344 matrix.mapPoints(dst[i].fPts, 3); | 1344 matrix.mapPoints(dst[i].fPts, 3); |
| 1345 } | 1345 } |
| 1346 return conicCount; | 1346 return conicCount; |
| 1347 } | 1347 } |
| OLD | NEW |