Lines Matching refs:src
146 static SkScalar eval_quad(const SkScalar src[], SkScalar t) in eval_quad() argument
148 SkASSERT(src); in eval_quad()
152 SkScalar C = src[0]; in eval_quad()
153 SkScalar A = src[4] - 2 * src[2] + C; in eval_quad()
154 SkScalar B = 2 * (src[2] - C); in eval_quad()
157 SkScalar ab = SkScalarInterp(src[0], src[2], t); in eval_quad()
158 SkScalar bc = SkScalarInterp(src[2], src[4], t); in eval_quad()
163 static SkScalar eval_quad_derivative(const SkScalar src[], SkScalar t) in eval_quad_derivative() argument
165 SkScalar A = src[4] - 2 * src[2] + src[0]; in eval_quad_derivative()
166 SkScalar B = src[2] - src[0]; in eval_quad_derivative()
171 static SkScalar eval_quad_derivative_at_half(const SkScalar src[]) in eval_quad_derivative_at_half() argument
173 SkScalar A = src[4] - 2 * src[2] + src[0]; in eval_quad_derivative_at_half()
174 SkScalar B = src[2] - src[0]; in eval_quad_derivative_at_half()
178 void SkEvalQuadAt(const SkPoint src[3], SkScalar t, SkPoint* pt, SkVector* tangent) in SkEvalQuadAt()
180 SkASSERT(src); in SkEvalQuadAt()
184 pt->set(eval_quad(&src[0].fX, t), eval_quad(&src[0].fY, t)); in SkEvalQuadAt()
186 tangent->set(eval_quad_derivative(&src[0].fX, t), in SkEvalQuadAt()
187 eval_quad_derivative(&src[0].fY, t)); in SkEvalQuadAt()
190 void SkEvalQuadAtHalf(const SkPoint src[3], SkPoint* pt, SkVector* tangent) in SkEvalQuadAtHalf()
192 SkASSERT(src); in SkEvalQuadAtHalf()
196 SkScalar x01 = SkScalarAve(src[0].fX, src[1].fX); in SkEvalQuadAtHalf()
197 SkScalar y01 = SkScalarAve(src[0].fY, src[1].fY); in SkEvalQuadAtHalf()
198 SkScalar x12 = SkScalarAve(src[1].fX, src[2].fX); in SkEvalQuadAtHalf()
199 SkScalar y12 = SkScalarAve(src[1].fY, src[2].fY); in SkEvalQuadAtHalf()
203 tangent->set(eval_quad_derivative_at_half(&src[0].fX), in SkEvalQuadAtHalf()
204 eval_quad_derivative_at_half(&src[0].fY)); in SkEvalQuadAtHalf()
207 static void interp_quad_coords(const SkScalar* src, SkScalar* dst, SkScalar t) in interp_quad_coords() argument
209 SkScalar ab = SkScalarInterp(src[0], src[2], t); in interp_quad_coords()
210 SkScalar bc = SkScalarInterp(src[2], src[4], t); in interp_quad_coords()
212 dst[0] = src[0]; in interp_quad_coords()
216 dst[8] = src[4]; in interp_quad_coords()
219 void SkChopQuadAt(const SkPoint src[3], SkPoint dst[5], SkScalar t) in SkChopQuadAt()
223 interp_quad_coords(&src[0].fX, &dst[0].fX, t); in SkChopQuadAt()
224 interp_quad_coords(&src[0].fY, &dst[0].fY, t); in SkChopQuadAt()
227 void SkChopQuadAtHalf(const SkPoint src[3], SkPoint dst[5]) in SkChopQuadAtHalf()
229 SkScalar x01 = SkScalarAve(src[0].fX, src[1].fX); in SkChopQuadAtHalf()
230 SkScalar y01 = SkScalarAve(src[0].fY, src[1].fY); in SkChopQuadAtHalf()
231 SkScalar x12 = SkScalarAve(src[1].fX, src[2].fX); in SkChopQuadAtHalf()
232 SkScalar y12 = SkScalarAve(src[1].fY, src[2].fY); in SkChopQuadAtHalf()
234 dst[0] = src[0]; in SkChopQuadAtHalf()
238 dst[4] = src[2]; in SkChopQuadAtHalf()
274 int SkChopQuadAtYExtrema(const SkPoint src[3], SkPoint dst[5]) in SkChopQuadAtYExtrema()
276 SkASSERT(src); in SkChopQuadAtYExtrema()
292 SkScalar a = src[0].fY; in SkChopQuadAtYExtrema()
293 SkScalar b = src[1].fY; in SkChopQuadAtYExtrema()
294 SkScalar c = src[2].fY; in SkChopQuadAtYExtrema()
301 SkChopQuadAt(src, dst, tValue); in SkChopQuadAtYExtrema()
309 dst[0].set(src[0].fX, a); in SkChopQuadAtYExtrema()
310 dst[1].set(src[1].fX, b); in SkChopQuadAtYExtrema()
311 dst[2].set(src[2].fX, c); in SkChopQuadAtYExtrema()
327 int SkChopQuadAtMaxCurvature(const SkPoint src[3], SkPoint dst[5]) in SkChopQuadAtMaxCurvature()
329 SkScalar Ax = src[1].fX - src[0].fX; in SkChopQuadAtMaxCurvature()
330 SkScalar Ay = src[1].fY - src[0].fY; in SkChopQuadAtMaxCurvature()
331 SkScalar Bx = src[0].fX - src[1].fX - src[1].fX + src[2].fX; in SkChopQuadAtMaxCurvature()
332 SkScalar By = src[0].fY - src[1].fY - src[1].fY + src[2].fY; in SkChopQuadAtMaxCurvature()
363 memcpy(dst, src, 3 * sizeof(SkPoint)); in SkChopQuadAtMaxCurvature()
368 SkChopQuadAt(src, dst, t); in SkChopQuadAtMaxCurvature()
395 static SkScalar eval_cubic(const SkScalar src[], SkScalar t) in eval_cubic() argument
397 SkASSERT(src); in eval_cubic()
401 return src[0]; in eval_cubic()
404 SkScalar D = src[0]; in eval_cubic()
405 SkScalar A = src[6] + 3*(src[2] - src[4]) - D; in eval_cubic()
406 SkScalar B = 3*(src[4] - src[2] - src[2] + D); in eval_cubic()
407 SkScalar C = 3*(src[2] - D); in eval_cubic()
411 SkScalar ab = SkScalarInterp(src[0], src[2], t); in eval_cubic()
412 SkScalar bc = SkScalarInterp(src[2], src[4], t); in eval_cubic()
413 SkScalar cd = SkScalarInterp(src[4], src[6], t); in eval_cubic()
429 static SkScalar eval_cubic_derivative(const SkScalar src[], SkScalar t) in eval_cubic_derivative() argument
431 SkScalar A = src[6] + 3*(src[2] - src[4]) - src[0]; in eval_cubic_derivative()
432 SkScalar B = 2*(src[4] - 2 * src[2] + src[0]); in eval_cubic_derivative()
433 SkScalar C = src[2] - src[0]; in eval_cubic_derivative()
438 static SkScalar eval_cubic_2ndDerivative(const SkScalar src[], SkScalar t) in eval_cubic_2ndDerivative() argument
440 SkScalar A = src[6] + 3*(src[2] - src[4]) - src[0]; in eval_cubic_2ndDerivative()
441 SkScalar B = src[4] - 2 * src[2] + src[0]; in eval_cubic_2ndDerivative()
446 void SkEvalCubicAt(const SkPoint src[4], SkScalar t, SkPoint* loc, SkVector* tangent, SkVector* cur… in SkEvalCubicAt()
448 SkASSERT(src); in SkEvalCubicAt()
452 loc->set(eval_cubic(&src[0].fX, t), eval_cubic(&src[0].fY, t)); in SkEvalCubicAt()
454 tangent->set(eval_cubic_derivative(&src[0].fX, t), in SkEvalCubicAt()
455 eval_cubic_derivative(&src[0].fY, t)); in SkEvalCubicAt()
457 curvature->set(eval_cubic_2ndDerivative(&src[0].fX, t), in SkEvalCubicAt()
458 eval_cubic_2ndDerivative(&src[0].fY, t)); in SkEvalCubicAt()
482 static void interp_cubic_coords(const SkScalar* src, SkScalar* dst, SkScalar t) in interp_cubic_coords() argument
484 SkScalar ab = SkScalarInterp(src[0], src[2], t); in interp_cubic_coords()
485 SkScalar bc = SkScalarInterp(src[2], src[4], t); in interp_cubic_coords()
486 SkScalar cd = SkScalarInterp(src[4], src[6], t); in interp_cubic_coords()
491 dst[0] = src[0]; in interp_cubic_coords()
497 dst[12] = src[6]; in interp_cubic_coords()
500 void SkChopCubicAt(const SkPoint src[4], SkPoint dst[7], SkScalar t) in SkChopCubicAt()
504 interp_cubic_coords(&src[0].fX, &dst[0].fX, t); in SkChopCubicAt()
505 interp_cubic_coords(&src[0].fY, &dst[0].fY, t); in SkChopCubicAt()
508 void SkChopCubicAt(const SkPoint src[4], SkPoint dst[], const SkScalar tValues[], int roots) in SkChopCubicAt()
524 memcpy(dst, src, 4*sizeof(SkPoint)); in SkChopCubicAt()
532 SkChopCubicAt(src, dst, t); in SkChopCubicAt()
541 src = tmp; in SkChopCubicAt()
547 void SkChopCubicAtHalf(const SkPoint src[4], SkPoint dst[7]) in SkChopCubicAtHalf()
549 SkScalar x01 = SkScalarAve(src[0].fX, src[1].fX); in SkChopCubicAtHalf()
550 SkScalar y01 = SkScalarAve(src[0].fY, src[1].fY); in SkChopCubicAtHalf()
551 SkScalar x12 = SkScalarAve(src[1].fX, src[2].fX); in SkChopCubicAtHalf()
552 SkScalar y12 = SkScalarAve(src[1].fY, src[2].fY); in SkChopCubicAtHalf()
553 SkScalar x23 = SkScalarAve(src[2].fX, src[3].fX); in SkChopCubicAtHalf()
554 SkScalar y23 = SkScalarAve(src[2].fY, src[3].fY); in SkChopCubicAtHalf()
561 dst[0] = src[0]; in SkChopCubicAtHalf()
567 dst[6] = src[3]; in SkChopCubicAtHalf()
583 int SkChopCubicAtYExtrema(const SkPoint src[4], SkPoint dst[10]) in SkChopCubicAtYExtrema()
586 int roots = SkFindCubicExtrema(src[0].fY, src[1].fY, src[2].fY, src[3].fY, tValues); in SkChopCubicAtYExtrema()
588 SkChopCubicAt(src, dst, tValues, roots); in SkChopCubicAtYExtrema()
610 int SkFindCubicInflections(const SkPoint src[4], SkScalar tValues[]) in SkFindCubicInflections()
612 SkScalar Ax = src[1].fX - src[0].fX; in SkFindCubicInflections()
613 SkScalar Ay = src[1].fY - src[0].fY; in SkFindCubicInflections()
614 SkScalar Bx = src[2].fX - 2 * src[1].fX + src[0].fX; in SkFindCubicInflections()
615 SkScalar By = src[2].fY - 2 * src[1].fY + src[0].fY; in SkFindCubicInflections()
616 SkScalar Cx = src[3].fX + 3 * (src[1].fX - src[2].fX) - src[0].fX; in SkFindCubicInflections()
617 SkScalar Cy = src[3].fY + 3 * (src[1].fY - src[2].fY) - src[0].fY; in SkFindCubicInflections()
643 int SkChopCubicAtInflections(const SkPoint src[], SkPoint dst[10]) in SkChopCubicAtInflections() argument
646 int count = SkFindCubicInflections(src, tValues); in SkChopCubicAtInflections()
651 memcpy(dst, src, 4 * sizeof(SkPoint)); in SkChopCubicAtInflections()
653 SkChopCubicAt(src, dst, tValues, count); in SkChopCubicAtInflections()
799 static void formulate_F1DotF2(const SkScalar src[], SkFP coeff[4]) in formulate_F1DotF2() argument
801 SkScalar a = src[2] - src[0]; in formulate_F1DotF2()
802 SkScalar b = src[4] - 2 * src[2] + src[0]; in formulate_F1DotF2()
803 SkScalar c = src[6] + 3 * (src[2] - src[4]) - src[0]; in formulate_F1DotF2()
831 int SkFindCubicMaxCurvature(const SkPoint src[4], SkScalar tValues[3]) in SkFindCubicMaxCurvature()
836 formulate_F1DotF2(&src[0].fX, coeffX); in SkFindCubicMaxCurvature()
837 formulate_F1DotF2(&src[0].fY, coeffY); in SkFindCubicMaxCurvature()
857 int SkChopCubicAtMaxCurvature(const SkPoint src[4], SkPoint dst[13], SkScalar tValues[3]) in SkChopCubicAtMaxCurvature()
864 int count = SkFindCubicMaxCurvature(src, tValues); in SkChopCubicAtMaxCurvature()
869 memcpy(dst, src, 4 * sizeof(SkPoint)); in SkChopCubicAtMaxCurvature()
871 SkChopCubicAt(src, dst, tValues, count); in SkChopCubicAtMaxCurvature()