Index: src/core/SkGeometry.cpp |
diff --git a/src/core/SkGeometry.cpp b/src/core/SkGeometry.cpp |
index 646dfb05b9d4f8eddf59c3e0d8ea694c93fabcd3..7fabbc5d6875aa9fe9b3821ed6381291f0bb994e 100644 |
--- a/src/core/SkGeometry.cpp |
+++ b/src/core/SkGeometry.cpp |
@@ -1004,6 +1004,20 @@ int SkNumXRayCrossingsForCubic(const SkXRay& pt, |
return num_crossings; |
} |
+/** |
+ * Calculate the approximate arc length given a bezier curve's control points. |
+ */ |
+SkScalar approx_arc_length(SkPoint* points, int count) { |
+ if (count < 2) { |
+ return 0; |
+ } |
+ SkScalar arcLength = 0; |
+ for (int i = 0; i < count - 1; i++) { |
+ arcLength += SkPoint::Distance(points[i], points[i + 1]); |
+ } |
+ return arcLength; |
+} |
+ |
/////////////////////////////////////////////////////////////////////////////// |
/* Find t value for quadratic [a, b, c] = d. |