Lines Matching refs:SkScalar
24 static int is_not_monotonic(SkScalar a, SkScalar b, SkScalar c) { in is_not_monotonic()
25 SkScalar ab = a - b; in is_not_monotonic()
26 SkScalar bc = b - c; in is_not_monotonic()
35 static int valid_unit_divide(SkScalar numer, SkScalar denom, SkScalar* ratio) { in valid_unit_divide()
47 SkScalar r = numer / denom; in valid_unit_divide()
74 int SkFindUnitQuadRoots(SkScalar A, SkScalar B, SkScalar C, SkScalar roots[2]) { in SkFindUnitQuadRoots()
81 SkScalar* r = roots; in SkFindUnitQuadRoots()
89 SkScalar R = SkDoubleToScalar(dr); in SkFindUnitQuadRoots()
94 SkScalar Q = (B < 0) ? -(B-R)/2 : -(B+R)/2; in SkFindUnitQuadRoots()
111 void SkEvalQuadAt(const SkPoint src[3], SkScalar t, SkPoint* pt, SkVector* tangent) { in SkEvalQuadAt()
123 SkPoint SkEvalQuadAt(const SkPoint src[3], SkScalar t) { in SkEvalQuadAt()
127 SkVector SkEvalQuadTangentAt(const SkPoint src[3], SkScalar t) { in SkEvalQuadTangentAt()
152 void SkChopQuadAt(const SkPoint src[3], SkPoint dst[5], SkScalar t) { in SkChopQuadAt()
179 int SkFindQuadExtrema(SkScalar a, SkScalar b, SkScalar c, SkScalar tValue[1]) { in SkFindQuadExtrema()
186 static inline void flatten_double_quad_extrema(SkScalar coords[14]) { in flatten_double_quad_extrema()
197 SkScalar a = src[0].fY; in SkChopQuadAtYExtrema()
198 SkScalar b = src[1].fY; in SkChopQuadAtYExtrema()
199 SkScalar c = src[2].fY; in SkChopQuadAtYExtrema()
202 SkScalar tValue; in SkChopQuadAtYExtrema()
225 SkScalar a = src[0].fX; in SkChopQuadAtXExtrema()
226 SkScalar b = src[1].fX; in SkChopQuadAtXExtrema()
227 SkScalar c = src[2].fX; in SkChopQuadAtXExtrema()
230 SkScalar tValue; in SkChopQuadAtXExtrema()
258 SkScalar SkFindQuadMaxCurvature(const SkPoint src[3]) { in SkFindQuadMaxCurvature()
259 SkScalar Ax = src[1].fX - src[0].fX; in SkFindQuadMaxCurvature()
260 SkScalar Ay = src[1].fY - src[0].fY; in SkFindQuadMaxCurvature()
261 SkScalar Bx = src[0].fX - src[1].fX - src[1].fX + src[2].fX; in SkFindQuadMaxCurvature()
262 SkScalar By = src[0].fY - src[1].fY - src[1].fY + src[2].fY; in SkFindQuadMaxCurvature()
264 SkScalar numer = -(Ax * Bx + Ay * By); in SkFindQuadMaxCurvature()
265 SkScalar denom = Bx * Bx + By * By; in SkFindQuadMaxCurvature()
276 SkScalar t = numer / denom; in SkFindQuadMaxCurvature()
282 SkScalar t = SkFindQuadMaxCurvature(src); in SkChopQuadAtMaxCurvature()
308 static SkVector eval_cubic_derivative(const SkPoint src[4], SkScalar t) { in eval_cubic_derivative()
321 static SkVector eval_cubic_2ndDerivative(const SkPoint src[4], SkScalar t) { in eval_cubic_2ndDerivative()
332 void SkEvalCubicAt(const SkPoint src[4], SkScalar t, SkPoint* loc, in SkEvalCubicAt()
368 int SkFindCubicExtrema(SkScalar a, SkScalar b, SkScalar c, SkScalar d, in SkFindCubicExtrema()
369 SkScalar tValues[2]) { in SkFindCubicExtrema()
371 SkScalar A = d - a + 3*(b - c); in SkFindCubicExtrema()
372 SkScalar B = 2*(a - b - b + c); in SkFindCubicExtrema()
373 SkScalar C = b - a; in SkFindCubicExtrema()
378 void SkChopCubicAt(const SkPoint src[4], SkPoint dst[7], SkScalar t) { in SkChopCubicAt()
427 const SkScalar tValues[], int roots) { in SkChopCubicAt()
443 SkScalar t = tValues[0]; in SkChopCubicAt()
473 static void flatten_double_cubic_extrema(SkScalar coords[14]) { in flatten_double_cubic_extrema()
486 SkScalar tValues[2]; in SkChopCubicAtYExtrema()
502 SkScalar tValues[2]; in SkChopCubicAtXExtrema()
528 int SkFindCubicInflections(const SkPoint src[4], SkScalar tValues[]) { in SkFindCubicInflections()
529 SkScalar Ax = src[1].fX - src[0].fX; in SkFindCubicInflections()
530 SkScalar Ay = src[1].fY - src[0].fY; in SkFindCubicInflections()
531 SkScalar Bx = src[2].fX - 2 * src[1].fX + src[0].fX; in SkFindCubicInflections()
532 SkScalar By = src[2].fY - 2 * src[1].fY + src[0].fY; in SkFindCubicInflections()
533 SkScalar Cx = src[3].fX + 3 * (src[1].fX - src[2].fX) - src[0].fX; in SkFindCubicInflections()
534 SkScalar Cy = src[3].fY + 3 * (src[1].fY - src[2].fY) - src[0].fY; in SkFindCubicInflections()
543 SkScalar tValues[2]; in SkChopCubicAtInflections()
683 static int collaps_duplicates(SkScalar array[], int count) { in collaps_duplicates()
705 const SkScalar src0[] = { 0 }; in test_collaps_duplicates()
706 const SkScalar src1[] = { 0, 0 }; in test_collaps_duplicates()
707 const SkScalar src2[] = { 0, 1 }; in test_collaps_duplicates()
708 const SkScalar src3[] = { 0, 0, 0 }; in test_collaps_duplicates()
709 const SkScalar src4[] = { 0, 0, 1 }; in test_collaps_duplicates()
710 const SkScalar src5[] = { 0, 1, 1 }; in test_collaps_duplicates()
711 const SkScalar src6[] = { 0, 1, 2 }; in test_collaps_duplicates()
713 const SkScalar* fData; in test_collaps_duplicates()
726 SkScalar dst[3]; in test_collaps_duplicates()
737 static SkScalar SkScalarCubeRoot(SkScalar x) { in SkScalarCubeRoot()
748 static int solve_cubic_poly(const SkScalar coeff[4], SkScalar tValues[3]) { in solve_cubic_poly()
753 SkScalar a, b, c, Q, R; in solve_cubic_poly()
758 SkScalar inva = SkScalarInvert(coeff[0]); in solve_cubic_poly()
766 SkScalar Q3 = Q * Q * Q; in solve_cubic_poly()
767 SkScalar R2MinusQ3 = R * R - Q3; in solve_cubic_poly()
768 SkScalar adiv3 = a / 3; in solve_cubic_poly()
772 SkScalar theta = SkScalarACos(SkScalarPin(R / SkScalarSqrt(Q3), -1, 1)); in solve_cubic_poly()
773 SkScalar neg2RootQ = -2 * SkScalarSqrt(Q); in solve_cubic_poly()
784 SkScalar A = SkScalarAbs(R) + SkScalarSqrt(R2MinusQ3); in solve_cubic_poly()
808 static void formulate_F1DotF2(const SkScalar src[], SkScalar coeff[4]) { in formulate_F1DotF2()
809 SkScalar a = src[2] - src[0]; in formulate_F1DotF2()
810 SkScalar b = src[4] - 2 * src[2] + src[0]; in formulate_F1DotF2()
811 SkScalar c = src[6] + 3 * (src[2] - src[4]) - src[0]; in formulate_F1DotF2()
830 int SkFindCubicMaxCurvature(const SkPoint src[4], SkScalar tValues[3]) { in SkFindCubicMaxCurvature()
831 SkScalar coeffX[4], coeffY[4]; in SkFindCubicMaxCurvature()
848 SkScalar tValues[3]) { in SkChopCubicAtMaxCurvature()
849 SkScalar t_storage[3]; in SkChopCubicAtMaxCurvature()
855 SkScalar roots[3]; in SkChopCubicAtMaxCurvature()
878 static SkScalar calc_cubic_precision(const SkPoint src[4]) { in calc_cubic_precision()
888 SkScalar crosses[2]; in on_same_side()
899 SkScalar SkFindCubicCusp(const SkPoint src[4]) { in SkFindCubicCusp()
917 SkScalar maxCurvature[3]; in SkFindCubicCusp()
920 SkScalar testT = maxCurvature[index]; in SkFindCubicCusp()
928 SkScalar dPtMagnitude = SkPointPriv::LengthSqd(dPt); in SkFindCubicCusp()
929 SkScalar precision = calc_cubic_precision(src); in SkFindCubicCusp()
943 static bool cubic_dchop_at_intercept(const SkPoint src[4], SkScalar intercept, SkPoint dst[7], in cubic_dchop_at_intercept()
958 bool SkChopMonoCubicAtY(SkPoint src[4], SkScalar y, SkPoint dst[7]) { in SkChopMonoCubicAtY()
962 bool SkChopMonoCubicAtX(SkPoint src[4], SkScalar x, SkPoint dst[7]) { in SkChopMonoCubicAtX()
997 static void conic_deriv_coeff(const SkScalar src[], in conic_deriv_coeff()
998 SkScalar w, in conic_deriv_coeff()
999 SkScalar coeff[3]) { in conic_deriv_coeff()
1000 const SkScalar P20 = src[4] - src[0]; in conic_deriv_coeff()
1001 const SkScalar P10 = src[2] - src[0]; in conic_deriv_coeff()
1002 const SkScalar wP10 = w * P10; in conic_deriv_coeff()
1008 static bool conic_find_extrema(const SkScalar src[], SkScalar w, SkScalar* t) { in conic_find_extrema()
1009 SkScalar coeff[3]; in conic_find_extrema()
1012 SkScalar tValues[2]; in conic_find_extrema()
1024 static void p3d_interp(const SkScalar src[7], SkScalar dst[7], SkScalar t) { in p3d_interp()
1025 SkScalar ab = SkScalarInterp(src[0], src[3], t); in p3d_interp()
1026 SkScalar bc = SkScalarInterp(src[3], src[6], t); in p3d_interp()
1032 static void ratquad_mapTo3D(const SkPoint src[3], SkScalar w, SkPoint3 dst[3]) { in ratquad_mapTo3D()
1043 bool SkConic::chopAt(SkScalar t, SkConic dst[2]) const { in chopAt()
1066 SkScalar root = SkScalarSqrt(tmp2[1].fZ); in chopAt()
1069 SkASSERT(sizeof(dst[0]) == sizeof(SkScalar) * 7); in chopAt()
1074 void SkConic::chopAt(SkScalar t1, SkScalar t2, SkConic* dst) const { in chopAt()
1106 SkPoint SkConic::evalAt(SkScalar t) const { in evalAt()
1110 SkVector SkConic::evalTangentAt(SkScalar t) const { in evalTangentAt()
1132 void SkConic::evalAt(SkScalar t, SkPoint* pt, SkVector* tangent) const { in evalAt()
1143 static SkScalar subdivide_w_value(SkScalar w) { in subdivide_w_value()
1149 SkScalar newW = subdivide_w_value(fW); in chop()
1180 SkScalar a = fW - 1; \
1181 SkScalar k = a / (4 * (2 + a)); \
1182 SkScalar x = k * (fPts[0].fX - 2 * fPts[1].fX + fPts[2].fX); \
1183 SkScalar y = k * (fPts[0].fY - 2 * fPts[1].fY + fPts[2].fY);
1190 bool SkConic::asQuadTol(SkScalar tol) const { in asQuadTol()
1198 int SkConic::computeQuadPOW2(SkScalar tol) const { in computeQuadPOW2()
1205 SkScalar error = SkScalarSqrt(x * x + y * y); in computeQuadPOW2()
1215 SkScalar err = SkScalarSqrt(x * x + y * y); in computeQuadPOW2()
1219 SkScalar tol2 = tol * tol; in computeQuadPOW2()
1223 SkScalar fpow2 = SkScalarLog2((x * x + y * y) / tol2) * 0.25f; in computeQuadPOW2()
1235 static bool between(SkScalar a, SkScalar b, SkScalar c) { in between()
1248 const SkScalar startY = src.fPts[0].fY; in subdivide()
1249 SkScalar endY = src.fPts[2].fY; in subdivide()
1253 SkScalar midY = dst[0].fPts[2].fY; in subdivide()
1256 SkScalar closerY = SkTAbs(midY - startY) < SkTAbs(midY - endY) ? startY : endY; in subdivide()
1312 bool SkConic::findXExtrema(SkScalar* t) const { in findXExtrema()
1316 bool SkConic::findYExtrema(SkScalar* t) const { in findYExtrema()
1321 SkScalar t; in chopAtXExtrema()
1329 SkScalar value = dst[0].fPts[2].fX; in chopAtXExtrema()
1339 SkScalar t; in chopAtYExtrema()
1347 SkScalar value = dst[0].fPts[2].fY; in chopAtYExtrema()
1362 SkScalar t; in computeTightBounds()
1377 bool SkConic::findMaxCurvature(SkScalar* t) const {
1383 SkScalar SkConic::TransformW(const SkPoint pts[], SkScalar w, const SkMatrix& matrix) { in TransformW()
1405 SkScalar x = SkPoint::DotProduct(uStart, uStop); in BuildUnitArc()
1406 SkScalar y = SkPoint::CrossProduct(uStart, uStop); in BuildUnitArc()
1408 SkScalar absY = SkScalarAbs(y); in BuildUnitArc()
1447 const SkScalar quadrantWeight = SK_ScalarRoot2Over2; in BuildUnitArc()
1457 const SkScalar dot = SkVector::DotProduct(lastQ, finalP); in BuildUnitArc()
1467 const SkScalar cosThetaOver2 = SkScalarSqrt((1 + dot) / 2); in BuildUnitArc()