Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Unified Diff: src/core/SkGeometry.cpp

Issue 1552863005: replace older/slower/scaler version of conic evalAt (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkGeometry.cpp
diff --git a/src/core/SkGeometry.cpp b/src/core/SkGeometry.cpp
index 01b618073ab1741648fc2f0e1fdc5ad9b40b3a43..f7c8f5736e64d0dc87fb83a749bd191b95909bf4 100644
--- a/src/core/SkGeometry.cpp
+++ b/src/core/SkGeometry.cpp
@@ -1146,24 +1146,6 @@ int SkBuildQuadArc(const SkVector& uStart, const SkVector& uStop,
// {t^2 (2 - 2 w), t (-2 + 2 w), 1}
//
-static SkScalar conic_eval_pos(const SkScalar src[], SkScalar w, SkScalar t) {
- SkASSERT(src);
- SkASSERT(t >= 0 && t <= SK_Scalar1);
-
- SkScalar src2w = SkScalarMul(src[2], w);
- SkScalar C = src[0];
- SkScalar A = src[4] - 2 * src2w + C;
- SkScalar B = 2 * (src2w - C);
- SkScalar numer = SkScalarMulAdd(SkScalarMulAdd(A, t, B), t, C);
-
- B = 2 * (w - SK_Scalar1);
- C = SK_Scalar1;
- A = -B;
- SkScalar denom = SkScalarMulAdd(SkScalarMulAdd(A, t, B), t, C);
-
- return numer / denom;
-}
-
// F' = 2 (C t (1 + t (-1 + w)) - A (-1 + t) (t (-1 + w) - w) + B (1 - 2 t) w)
//
// t^2 : (2 P0 - 2 P2 - 2 P0 w + 2 P2 w)
@@ -1230,18 +1212,6 @@ static void ratquad_mapTo3D(const SkPoint src[3], SkScalar w, SkP3D dst[]) {
dst[2].set(src[2].fX * 1, src[2].fY * 1, 1);
}
-void SkConic::evalAt(SkScalar t, SkPoint* pt, SkVector* tangent) const {
- SkASSERT(t >= 0 && t <= SK_Scalar1);
-
- if (pt) {
- pt->set(conic_eval_pos(&fPts[0].fX, fW, t),
- conic_eval_pos(&fPts[0].fY, fW, t));
- }
- if (tangent) {
- *tangent = evalTangentAt(t);
- }
-}
-
void SkConic::chopAt(SkScalar t, SkConic dst[2]) const {
SkP3D tmp[3], tmp2[3];
@@ -1317,6 +1287,17 @@ SkVector SkConic::evalTangentAt(SkScalar t) const {
return to_vector(quad_poly_eval(A, B, C, Sk2s(t)));
}
+void SkConic::evalAt(SkScalar t, SkPoint* pt, SkVector* tangent) const {
+ SkASSERT(t >= 0 && t <= SK_Scalar1);
+
+ if (pt) {
+ *pt = this->evalAt(t);
+ }
+ if (tangent) {
+ *tangent = this->evalTangentAt(t);
+ }
+}
+
static SkScalar subdivide_w_value(SkScalar w) {
return SkScalarSqrt(SK_ScalarHalf + w * SK_ScalarHalf);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698