Lines Matching refs:SkScalar
22 static int is_not_monotonic(SkScalar a, SkScalar b, SkScalar c) { in is_not_monotonic()
23 SkScalar ab = a - b; in is_not_monotonic()
24 SkScalar bc = b - c; in is_not_monotonic()
33 static bool is_unit_interval(SkScalar x) { in is_unit_interval()
37 static int valid_unit_divide(SkScalar numer, SkScalar denom, SkScalar* ratio) { in valid_unit_divide()
49 SkScalar r = numer / denom; in valid_unit_divide()
67 int SkFindUnitQuadRoots(SkScalar A, SkScalar B, SkScalar C, SkScalar roots[2]) { in SkFindUnitQuadRoots()
74 SkScalar* r = roots; in SkFindUnitQuadRoots()
76 SkScalar R = B*B - 4*A*C; in SkFindUnitQuadRoots()
88 SkScalar Q = (B < 0) ? -(B-R)/2 : -(B+R)/2; in SkFindUnitQuadRoots()
93 SkTSwap<SkScalar>(roots[0], roots[1]); in SkFindUnitQuadRoots()
103 void SkEvalQuadAt(const SkPoint src[3], SkScalar t, SkPoint* pt, SkVector* tangent) { in SkEvalQuadAt()
115 SkPoint SkEvalQuadAt(const SkPoint src[3], SkScalar t) { in SkEvalQuadAt()
119 SkVector SkEvalQuadTangentAt(const SkPoint src[3], SkScalar t) { in SkEvalQuadTangentAt()
144 void SkChopQuadAt(const SkPoint src[3], SkPoint dst[5], SkScalar t) { in SkChopQuadAt()
171 int SkFindQuadExtrema(SkScalar a, SkScalar b, SkScalar c, SkScalar tValue[1]) { in SkFindQuadExtrema()
178 static inline void flatten_double_quad_extrema(SkScalar coords[14]) { in flatten_double_quad_extrema()
189 SkScalar a = src[0].fY; in SkChopQuadAtYExtrema()
190 SkScalar b = src[1].fY; in SkChopQuadAtYExtrema()
191 SkScalar c = src[2].fY; in SkChopQuadAtYExtrema()
194 SkScalar tValue; in SkChopQuadAtYExtrema()
217 SkScalar a = src[0].fX; in SkChopQuadAtXExtrema()
218 SkScalar b = src[1].fX; in SkChopQuadAtXExtrema()
219 SkScalar c = src[2].fX; in SkChopQuadAtXExtrema()
222 SkScalar tValue; in SkChopQuadAtXExtrema()
250 SkScalar SkFindQuadMaxCurvature(const SkPoint src[3]) { in SkFindQuadMaxCurvature()
251 SkScalar Ax = src[1].fX - src[0].fX; in SkFindQuadMaxCurvature()
252 SkScalar Ay = src[1].fY - src[0].fY; in SkFindQuadMaxCurvature()
253 SkScalar Bx = src[0].fX - src[1].fX - src[1].fX + src[2].fX; in SkFindQuadMaxCurvature()
254 SkScalar By = src[0].fY - src[1].fY - src[1].fY + src[2].fY; in SkFindQuadMaxCurvature()
255 SkScalar t = 0; // 0 means don't chop in SkFindQuadMaxCurvature()
262 SkScalar t = SkFindQuadMaxCurvature(src); in SkChopQuadAtMaxCurvature()
288 static SkVector eval_cubic_derivative(const SkPoint src[4], SkScalar t) { in eval_cubic_derivative()
301 static SkVector eval_cubic_2ndDerivative(const SkPoint src[4], SkScalar t) { in eval_cubic_2ndDerivative()
312 void SkEvalCubicAt(const SkPoint src[4], SkScalar t, SkPoint* loc, in SkEvalCubicAt()
348 int SkFindCubicExtrema(SkScalar a, SkScalar b, SkScalar c, SkScalar d, in SkFindCubicExtrema()
349 SkScalar tValues[2]) { in SkFindCubicExtrema()
351 SkScalar A = d - a + 3*(b - c); in SkFindCubicExtrema()
352 SkScalar B = 2*(a - b - b + c); in SkFindCubicExtrema()
353 SkScalar C = b - a; in SkFindCubicExtrema()
358 void SkChopCubicAt(const SkPoint src[4], SkPoint dst[7], SkScalar t) { in SkChopCubicAt()
407 const SkScalar tValues[], int roots) { in SkChopCubicAt()
423 SkScalar t = tValues[0]; in SkChopCubicAt()
453 static void flatten_double_cubic_extrema(SkScalar coords[14]) { in flatten_double_cubic_extrema()
466 SkScalar tValues[2]; in SkChopCubicAtYExtrema()
482 SkScalar tValues[2]; in SkChopCubicAtXExtrema()
508 int SkFindCubicInflections(const SkPoint src[4], SkScalar tValues[]) { in SkFindCubicInflections()
509 SkScalar Ax = src[1].fX - src[0].fX; in SkFindCubicInflections()
510 SkScalar Ay = src[1].fY - src[0].fY; in SkFindCubicInflections()
511 SkScalar Bx = src[2].fX - 2 * src[1].fX + src[0].fX; in SkFindCubicInflections()
512 SkScalar By = src[2].fY - 2 * src[1].fY + src[0].fY; in SkFindCubicInflections()
513 SkScalar Cx = src[3].fX + 3 * (src[1].fX - src[2].fX) - src[0].fX; in SkFindCubicInflections()
514 SkScalar Cy = src[3].fY + 3 * (src[1].fY - src[2].fY) - src[0].fY; in SkFindCubicInflections()
523 SkScalar tValues[2]; in SkChopCubicAtInflections()
697 static int collaps_duplicates(SkScalar array[], int count) { in collaps_duplicates()
719 const SkScalar src0[] = { 0 }; in test_collaps_duplicates()
720 const SkScalar src1[] = { 0, 0 }; in test_collaps_duplicates()
721 const SkScalar src2[] = { 0, 1 }; in test_collaps_duplicates()
722 const SkScalar src3[] = { 0, 0, 0 }; in test_collaps_duplicates()
723 const SkScalar src4[] = { 0, 0, 1 }; in test_collaps_duplicates()
724 const SkScalar src5[] = { 0, 1, 1 }; in test_collaps_duplicates()
725 const SkScalar src6[] = { 0, 1, 2 }; in test_collaps_duplicates()
727 const SkScalar* fData; in test_collaps_duplicates()
740 SkScalar dst[3]; in test_collaps_duplicates()
751 static SkScalar SkScalarCubeRoot(SkScalar x) { in SkScalarCubeRoot()
762 static int solve_cubic_poly(const SkScalar coeff[4], SkScalar tValues[3]) { in solve_cubic_poly()
767 SkScalar a, b, c, Q, R; in solve_cubic_poly()
772 SkScalar inva = SkScalarInvert(coeff[0]); in solve_cubic_poly()
780 SkScalar Q3 = Q * Q * Q; in solve_cubic_poly()
781 SkScalar R2MinusQ3 = R * R - Q3; in solve_cubic_poly()
782 SkScalar adiv3 = a / 3; in solve_cubic_poly()
784 SkScalar* roots = tValues; in solve_cubic_poly()
785 SkScalar r; in solve_cubic_poly()
789 SkScalar theta = SkScalarACos(SkScalarPin(R / SkScalarSqrt(Q3), -1, 1)); in solve_cubic_poly()
790 SkScalar neg2RootQ = -2 * SkScalarSqrt(Q); in solve_cubic_poly()
813 SkScalar A = SkScalarAbs(R) + SkScalarSqrt(R2MinusQ3); in solve_cubic_poly()
841 static void formulate_F1DotF2(const SkScalar src[], SkScalar coeff[4]) { in formulate_F1DotF2()
842 SkScalar a = src[2] - src[0]; in formulate_F1DotF2()
843 SkScalar b = src[4] - 2 * src[2] + src[0]; in formulate_F1DotF2()
844 SkScalar c = src[6] + 3 * (src[2] - src[4]) - src[0]; in formulate_F1DotF2()
863 int SkFindCubicMaxCurvature(const SkPoint src[4], SkScalar tValues[3]) { in SkFindCubicMaxCurvature()
864 SkScalar coeffX[4], coeffY[4]; in SkFindCubicMaxCurvature()
874 SkScalar t[3]; in SkFindCubicMaxCurvature()
890 SkScalar tValues[3]) { in SkChopCubicAtMaxCurvature()
891 SkScalar t_storage[3]; in SkChopCubicAtMaxCurvature()
913 static bool cubic_dchop_at_intercept(const SkPoint src[4], SkScalar intercept, SkPoint dst[7], in cubic_dchop_at_intercept()
928 bool SkChopMonoCubicAtY(SkPoint src[4], SkScalar y, SkPoint dst[7]) { in SkChopMonoCubicAtY()
932 bool SkChopMonoCubicAtX(SkPoint src[4], SkScalar x, SkPoint dst[7]) { in SkChopMonoCubicAtX()
967 static void conic_deriv_coeff(const SkScalar src[], in conic_deriv_coeff()
968 SkScalar w, in conic_deriv_coeff()
969 SkScalar coeff[3]) { in conic_deriv_coeff()
970 const SkScalar P20 = src[4] - src[0]; in conic_deriv_coeff()
971 const SkScalar P10 = src[2] - src[0]; in conic_deriv_coeff()
972 const SkScalar wP10 = w * P10; in conic_deriv_coeff()
978 static bool conic_find_extrema(const SkScalar src[], SkScalar w, SkScalar* t) { in conic_find_extrema()
979 SkScalar coeff[3]; in conic_find_extrema()
982 SkScalar tValues[2]; in conic_find_extrema()
994 static void p3d_interp(const SkScalar src[7], SkScalar dst[7], SkScalar t) { in p3d_interp()
995 SkScalar ab = SkScalarInterp(src[0], src[3], t); in p3d_interp()
996 SkScalar bc = SkScalarInterp(src[3], src[6], t); in p3d_interp()
1002 static void ratquad_mapTo3D(const SkPoint src[3], SkScalar w, SkPoint3 dst[3]) { in ratquad_mapTo3D()
1013 bool SkConic::chopAt(SkScalar t, SkConic dst[2]) const { in chopAt()
1036 SkScalar root = SkScalarSqrt(tmp2[1].fZ); in chopAt()
1039 SkASSERT(sizeof(dst[0]) == sizeof(SkScalar) * 7); in chopAt()
1044 void SkConic::chopAt(SkScalar t1, SkScalar t2, SkConic* dst) const { in chopAt()
1076 SkPoint SkConic::evalAt(SkScalar t) const { in evalAt()
1080 SkVector SkConic::evalTangentAt(SkScalar t) const { in evalTangentAt()
1102 void SkConic::evalAt(SkScalar t, SkPoint* pt, SkVector* tangent) const { in evalAt()
1113 static SkScalar subdivide_w_value(SkScalar w) { in subdivide_w_value()
1119 SkScalar newW = subdivide_w_value(fW); in chop()
1143 SkScalar a = fW - 1; \
1144 SkScalar k = a / (4 * (2 + a)); \
1145 SkScalar x = k * (fPts[0].fX - 2 * fPts[1].fX + fPts[2].fX); \
1146 SkScalar y = k * (fPts[0].fY - 2 * fPts[1].fY + fPts[2].fY);
1153 bool SkConic::asQuadTol(SkScalar tol) const { in asQuadTol()
1161 int SkConic::computeQuadPOW2(SkScalar tol) const { in computeQuadPOW2()
1168 SkScalar error = SkScalarSqrt(x * x + y * y); in computeQuadPOW2()
1178 SkScalar err = SkScalarSqrt(x * x + y * y); in computeQuadPOW2()
1182 SkScalar tol2 = tol * tol; in computeQuadPOW2()
1186 SkScalar fpow2 = SkScalarLog2((x * x + y * y) / tol2) * 0.25f; in computeQuadPOW2()
1198 static bool between(SkScalar a, SkScalar b, SkScalar c) { in between()
1211 const SkScalar startY = src.fPts[0].fY; in subdivide()
1212 const SkScalar endY = src.fPts[2].fY; in subdivide()
1216 SkScalar midY = dst[0].fPts[2].fY; in subdivide()
1219 SkScalar closerY = SkTAbs(midY - startY) < SkTAbs(midY - endY) ? startY : endY; in subdivide()
1275 bool SkConic::findXExtrema(SkScalar* t) const { in findXExtrema()
1279 bool SkConic::findYExtrema(SkScalar* t) const { in findYExtrema()
1284 SkScalar t; in chopAtXExtrema()
1292 SkScalar value = dst[0].fPts[2].fX; in chopAtXExtrema()
1302 SkScalar t; in chopAtYExtrema()
1310 SkScalar value = dst[0].fPts[2].fY; in chopAtYExtrema()
1325 SkScalar t; in computeTightBounds()
1340 bool SkConic::findMaxCurvature(SkScalar* t) const {
1346 SkScalar SkConic::TransformW(const SkPoint pts[], SkScalar w, in TransformW()
1359 SkScalar w0 = dst[0].fZ; in TransformW()
1360 SkScalar w1 = dst[1].fZ; in TransformW()
1361 SkScalar w2 = dst[2].fZ; in TransformW()
1369 SkScalar x = SkPoint::DotProduct(uStart, uStop); in BuildUnitArc()
1370 SkScalar y = SkPoint::CrossProduct(uStart, uStop); in BuildUnitArc()
1372 SkScalar absY = SkScalarAbs(y); in BuildUnitArc()
1411 const SkScalar quadrantWeight = SK_ScalarRoot2Over2; in BuildUnitArc()
1421 const SkScalar dot = SkVector::DotProduct(lastQ, finalP); in BuildUnitArc()
1431 const SkScalar cosThetaOver2 = SkScalarSqrt((1 + dot) / 2); in BuildUnitArc()