From b6474dd1a530a543ae799c3822e8bc60180761c0 Mon Sep 17 00:00:00 2001 From: caryclark Date: Tue, 19 Jan 2016 08:07:49 -0800 Subject: 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 --- tests/PathMeasureTest.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/PathMeasureTest.cpp') diff --git a/tests/PathMeasureTest.cpp b/tests/PathMeasureTest.cpp index 578f4eb74f..df66578f1b 100644 --- a/tests/PathMeasureTest.cpp +++ b/tests/PathMeasureTest.cpp @@ -201,3 +201,19 @@ DEF_TEST(PathMeasure, reporter) { 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); +} -- cgit v1.2.3