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

Unified Diff: src/core/SkGeometry.cpp

Issue 424663006: SkCanvas interface for drawing a patch. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Renamed static functions Created 6 years, 5 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
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.
« src/core/SkGeometry.h ('K') | « src/core/SkGeometry.h ('k') | src/core/SkPatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698