| Index: src/core/SkGeometry.cpp
|
| diff --git a/src/core/SkGeometry.cpp b/src/core/SkGeometry.cpp
|
| index 50af22de37d1acc968676bd581f90fe9cf5696b5..02b9eb9aa131cc45ad8820bb3218f83cabda795b 100644
|
| --- a/src/core/SkGeometry.cpp
|
| +++ b/src/core/SkGeometry.cpp
|
| @@ -9,6 +9,7 @@
|
| #include "SkMatrix.h"
|
| #include "SkNx.h"
|
|
|
| +#if 0
|
| static Sk2s from_point(const SkPoint& point) {
|
| return Sk2s::Load(&point.fX);
|
| }
|
| @@ -18,6 +19,7 @@ static SkPoint to_point(const Sk2s& x) {
|
| x.store(&point.fX);
|
| return point;
|
| }
|
| +#endif
|
|
|
| static SkVector to_vector(const Sk2s& x) {
|
| SkVector vector;
|
| @@ -452,6 +454,32 @@ void SkChopCubicAt(const SkPoint src[4], SkPoint dst[7], SkScalar t) {
|
| dst[6] = src[3];
|
| }
|
|
|
| +void SkCubicToPoly(const SkPoint pts[4], SkPoint coeff[4]) {
|
| + Sk2s p0 = from_point(pts[0]);
|
| + Sk2s p1 = from_point(pts[1]);
|
| + Sk2s p2 = from_point(pts[2]);
|
| + Sk2s p3 = from_point(pts[3]);
|
| +
|
| + const Sk2s three(3);
|
| + Sk2s p1minusp2 = p1 - p2;
|
| +
|
| + Sk2s D = p0;
|
| + Sk2s A = p3 + three * p1minusp2 - D;
|
| + Sk2s B = three * (D - p1minusp2 - p1);
|
| + Sk2s C = three * (p1 - D);
|
| +
|
| + coeff[0] = to_point(A);
|
| + coeff[1] = to_point(B);
|
| + coeff[2] = to_point(C);
|
| + coeff[3] = to_point(D);
|
| +}
|
| +
|
| +SkPoint SkEvalCubicPolyAt(const SkPoint coeff[4], SkScalar t) {
|
| + Sk2s pt = sk2s_cubic_eval(from_point(coeff[0]), from_point(coeff[1]),
|
| + from_point(coeff[2]), from_point(coeff[3]), Sk2s(t));
|
| + return to_point(pt);
|
| +}
|
| +
|
| /* http://code.google.com/p/skia/issues/detail?id=32
|
|
|
| This test code would fail when we didn't check the return result of
|
|
|