aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkGeometry.cpp3
-rw-r--r--src/core/SkGeometry.h2
-rw-r--r--src/core/SkPath.cpp12
3 files changed, 12 insertions, 5 deletions
diff --git a/src/core/SkGeometry.cpp b/src/core/SkGeometry.cpp
index 2ea3095198..04e396c377 100644
--- a/src/core/SkGeometry.cpp
+++ b/src/core/SkGeometry.cpp
@@ -951,6 +951,7 @@ bool SkChopMonoCubicAtX(SkPoint src[4], SkScalar x, SkPoint dst[7]) {
///////////////////////////////////////////////////////////////////////////////
+#ifdef SK_SUPPORT_LEGACY_ARCTO
/* Find t value for quadratic [a, b, c] = d.
Return 0 if there is no solution within [0, 1)
*/
@@ -1120,7 +1121,7 @@ int SkBuildQuadArc(const SkVector& uStart, const SkVector& uStop,
matrix.mapPoints(quadPoints, pointCount);
return pointCount;
}
-
+#endif
///////////////////////////////////////////////////////////////////////////////
//
diff --git a/src/core/SkGeometry.h b/src/core/SkGeometry.h
index 0fd5a61711..6a8546a67b 100644
--- a/src/core/SkGeometry.h
+++ b/src/core/SkGeometry.h
@@ -194,6 +194,7 @@ enum SkRotationDirection {
kCCW_SkRotationDirection
};
+#ifdef SK_SUPPORT_LEGACY_ARCTO
/** Maximum number of points needed in the quadPoints[] parameter for
SkBuildQuadArc()
*/
@@ -207,6 +208,7 @@ enum SkRotationDirection {
*/
int SkBuildQuadArc(const SkVector& unitStart, const SkVector& unitStop,
SkRotationDirection, const SkMatrix*, SkPoint quadPoints[]);
+#endif
struct SkConic {
SkConic() {}
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 4c148c5e4a..c77a25b4aa 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -1301,13 +1301,16 @@ void SkPath::arcTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar
return;
}
- SkScalar dist = SkScalarMulDiv(radius, SK_Scalar1 - cosh, sinh);
- if (dist < 0) {
- dist = -dist;
- }
+ SkScalar dist = SkScalarAbs(SkScalarMulDiv(radius, SK_Scalar1 - cosh, sinh));
SkScalar xx = x1 - SkScalarMul(dist, before.fX);
SkScalar yy = y1 - SkScalarMul(dist, before.fY);
+#ifndef SK_SUPPORT_LEGACY_ARCTO
+ after.setLength(dist);
+ this->lineTo(xx, yy);
+ SkScalar weight = SkScalarSqrt(SK_ScalarHalf + cosh * SK_ScalarHalf);
+ this->conicTo(x1, y1, x1 + after.fX, y1 + after.fY, weight);
+#else
SkRotationDirection arcDir;
// now turn before/after into normals
@@ -1336,6 +1339,7 @@ void SkPath::arcTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar
for (int i = 1; i < count; i += 2) {
this->quadTo(pts[i], pts[i+1]);
}
+#endif
}
///////////////////////////////////////////////////////////////////////////////