In convexity checker don't advance last vector when x-product isn't significant.
BUG=skia:2235
R=caryclark@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/298973004
git-svn-id: http://skia.googlecode.com/svn/trunk@14845 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 3de10cb..e265d31 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -1151,6 +1151,23 @@
dent.close();
check_convexity(reporter, dent, SkPath::kConcave_Convexity);
check_direction(reporter, dent, SkPath::kCW_Direction);
+
+ // http://skbug.com/2235
+ SkPath strokedSin;
+ for (int i = 0; i < 2000; i++) {
+ SkScalar x = SkIntToScalar(i) / 2;
+ SkScalar y = 500 - (x + SkScalarSin(x / 100) * 40) / 3;
+ if (0 == i) {
+ strokedSin.moveTo(x, y);
+ } else {
+ strokedSin.lineTo(x, y);
+ }
+ }
+ SkStrokeRec stroke(SkStrokeRec::kFill_InitStyle);
+ stroke.setStrokeStyle(2 * SK_Scalar1);
+ stroke.applyToPath(&strokedSin, strokedSin);
+ check_convexity(reporter, strokedSin, SkPath::kConcave_Convexity);
+ check_direction(reporter, strokedSin, kDontCheckDir);
}
static void check_convex_bounds(skiatest::Reporter* reporter, const SkPath& p,