diff options
author | caryclark <caryclark@google.com> | 2016-01-19 08:07:49 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-19 08:07:50 -0800 |
commit | b6474dd1a530a543ae799c3822e8bc60180761c0 (patch) | |
tree | 2e42f77ea502e31ac7473806437adb6be680bd33 /tests/PathMeasureTest.cpp | |
parent | a913275bda105fd545af471b724d7e8c1dacb9ae (diff) |
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
Diffstat (limited to 'tests/PathMeasureTest.cpp')
-rw-r--r-- | tests/PathMeasureTest.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
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); +} |