aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkGeometry.h
diff options
context:
space:
mode:
authorGravatar reed <reed@chromium.org>2015-04-15 18:23:03 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-15 18:23:03 -0700
commit6983f66d8b3a489133b751e2cef03e72a03bfeae (patch)
tree1c6b10b05372664f53eb0117ba0d41770ccdc197 /src/core/SkGeometry.h
parenta12225bd32d5172d0d07a7b6c75652f758dbb001 (diff)
Speeup hairline curves (quads and cubics) (patchset #7 id:120001 of https://codereview.chromium.org/1078413003/)"
ah ha! Check for the define *after* we pull in SkUserConfig.h (indirectly) This reverts commit 639a82855b94b93c4fa45560e67df8ec4a8bbb3a. BUG=skia: TBR= Review URL: https://codereview.chromium.org/1084283003
Diffstat (limited to 'src/core/SkGeometry.h')
-rw-r--r--src/core/SkGeometry.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/core/SkGeometry.h b/src/core/SkGeometry.h
index bafde61155..9ddd91f750 100644
--- a/src/core/SkGeometry.h
+++ b/src/core/SkGeometry.h
@@ -9,6 +9,22 @@
#define SkGeometry_DEFINED
#include "SkMatrix.h"
+#include "SkNx.h"
+
+static inline Sk2s from_point(const SkPoint& point) {
+ return Sk2s::Load(&point.fX);
+}
+
+static inline SkPoint to_point(const Sk2s& x) {
+ SkPoint point;
+ x.store(&point.fX);
+ return point;
+}
+
+static inline Sk2s sk2s_cubic_eval(const Sk2s& A, const Sk2s& B, const Sk2s& C, const Sk2s& D,
+ const Sk2s& t) {
+ return ((A * t + B) * t + C) * t + D;
+}
/** Given a quadratic equation Ax^2 + Bx + C = 0, return 0, 1, 2 roots for the
equation.
@@ -25,6 +41,16 @@ SkPoint SkEvalQuadTangentAt(const SkPoint src[3], SkScalar t);
*/
void SkEvalQuadAt(const SkPoint src[3], SkScalar t, SkPoint* pt, SkVector* tangent = NULL);
+/**
+ * output is : eval(t) == coeff[0] * t^2 + coeff[1] * t + coeff[2]
+ */
+void SkQuadToCoeff(const SkPoint pts[3], SkPoint coeff[3]);
+
+/**
+ * output is : eval(t) == coeff[0] * t^3 + coeff[1] * t^2 + coeff[2] * t + coeff[3]
+ */
+void SkCubicToCoeff(const SkPoint pts[4], SkPoint coeff[4]);
+
/** Given a src quadratic bezier, chop it at the specified t value,
where 0 < t < 1, and return the two new quadratics in dst:
dst[0..2] and dst[2..4]