fix circular dashing
Path measure cannot use the same code approach for quadratics
and cubics. Subdividing cubics repeatedly does not result in
subdivided t values, e.g. a quarter circle cubic divided in
half twice does not have a t value equivalent to 1/4.
Instead, always compute the cubic segment from a pair of
t values.
When finding the length of the cubic through recursive measures,
it is enough to carry the point at a given t to the next
subdivision.
(Chrome suppression has landed already.)
R=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1602153002
Review URL: https://codereview.chromium.org/1602153002
diff --git a/tests/PathMeasureTest.cpp b/tests/PathMeasureTest.cpp
index 578f4eb..df66578 100644
--- a/tests/PathMeasureTest.cpp
+++ b/tests/PathMeasureTest.cpp
@@ -201,3 +201,19 @@
test_small_segment2();
test_small_segment3();
}
+
+DEF_TEST(PathMeasureConic, reporter) {
+ SkPoint stdP, hiP, pts[] = {{0,0}, {100,0}, {100,0}};
+ SkPath p;
+ p.moveTo(0, 0);
+ p.conicTo(pts[1], pts[2], 1);
+ SkPathMeasure stdm(p, false);
+ REPORTER_ASSERT(reporter, stdm.getPosTan(20, &stdP, nullptr));
+ p.reset();
+ p.moveTo(0, 0);
+ p.conicTo(pts[1], pts[2], 10);
+ stdm.setPath(&p, false);
+ REPORTER_ASSERT(reporter, stdm.getPosTan(20, &hiP, nullptr));
+ REPORTER_ASSERT(reporter, 19.5f < stdP.fX && stdP.fX < 20.5f);
+ REPORTER_ASSERT(reporter, 19.5f < hiP.fX && hiP.fX < 20.5f);
+}