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" |
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 Sk2s dZZ = coeff.fDenom.eval(midTT); | 1022 Sk2s dZZ = coeff.fDenom.eval(midTT); |
1023 Sk2s tt2(t2); | 1023 Sk2s tt2(t2); |
1024 Sk2s cXY = coeff.fNumer.eval(tt2); | 1024 Sk2s cXY = coeff.fNumer.eval(tt2); |
1025 Sk2s cZZ = coeff.fDenom.eval(tt2); | 1025 Sk2s cZZ = coeff.fDenom.eval(tt2); |
1026 Sk2s bXY = times_2(dXY) - (aXY + cXY) * Sk2s(0.5f); | 1026 Sk2s bXY = times_2(dXY) - (aXY + cXY) * Sk2s(0.5f); |
1027 Sk2s bZZ = times_2(dZZ) - (aZZ + cZZ) * Sk2s(0.5f); | 1027 Sk2s bZZ = times_2(dZZ) - (aZZ + cZZ) * Sk2s(0.5f); |
1028 dst->fPts[0] = to_point(aXY / aZZ); | 1028 dst->fPts[0] = to_point(aXY / aZZ); |
1029 dst->fPts[1] = to_point(bXY / bZZ); | 1029 dst->fPts[1] = to_point(bXY / bZZ); |
1030 dst->fPts[2] = to_point(cXY / cZZ); | 1030 dst->fPts[2] = to_point(cXY / cZZ); |
1031 Sk2s ww = bZZ / (aZZ * cZZ).sqrt(); | 1031 Sk2s ww = bZZ / (aZZ * cZZ).sqrt(); |
1032 dst->fW = ww.kth<0>(); | 1032 dst->fW = ww[0]; |
1033 } | 1033 } |
1034 | 1034 |
1035 SkPoint SkConic::evalAt(SkScalar t) const { | 1035 SkPoint SkConic::evalAt(SkScalar t) const { |
1036 return to_point(SkConicCoeff(*this).eval(t)); | 1036 return to_point(SkConicCoeff(*this).eval(t)); |
1037 } | 1037 } |
1038 | 1038 |
1039 SkVector SkConic::evalTangentAt(SkScalar t) const { | 1039 SkVector SkConic::evalTangentAt(SkScalar t) const { |
1040 // The derivative equation returns a zero tangent vector when t is 0 or 1, | 1040 // The derivative equation returns a zero tangent vector when t is 0 or 1, |
1041 // and the control point is equal to the end point. | 1041 // and the control point is equal to the end point. |
1042 // In this case, use the conic endpoints to compute the tangent. | 1042 // In this case, use the conic endpoints to compute the tangent. |
(...skipping 295 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 |