Intersection work in progress
Review URL: https://codereview.appspot.com/5576043
git-svn-id: http://skia.googlecode.com/svn/trunk@3087 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/Intersection/QuadraticBezierClip.cpp b/experimental/Intersection/QuadraticBezierClip.cpp
index 1114d74..fc3acfe 100644
--- a/experimental/Intersection/QuadraticBezierClip.cpp
+++ b/experimental/Intersection/QuadraticBezierClip.cpp
@@ -48,10 +48,14 @@
maxT = 1;
}
// Find the intersection of distance convex hull and fat line.
- x_at(distance2y[0], distance2y[1], top, bottom, flags, minT, maxT);
- x_at(distance2y[1], distance2y[2], top, bottom, flags, minT, maxT);
- x_at(distance2y[2], distance2y[0], top, bottom, flags, minT, maxT);
-
+ int idx = 0;
+ do {
+ int next = idx + 1;
+ if (next == 3) {
+ next = 0;
+ }
+ x_at(distance2y[idx], distance2y[next], top, bottom, flags, minT, maxT);
+ idx = next;
+ } while (idx);
return minT < maxT; // returns false if distance shows no intersection
}
-