From b58194a90ee788f0da8daffcc444ea74237f4b79 Mon Sep 17 00:00:00 2001 From: Chris Dalton Date: Fri, 9 Jun 2017 12:51:56 -0600 Subject: [PATCH] Fix loopIndex in chopCubicAtLoopIntersection A recent change broke the case where the entire bezier is inside the loop segment. Bug: skia:4410 Change-Id: Ib534d459eaa4461d6760e894a8826e3019584ee8 Reviewed-on: https://skia-review.googlesource.com/19333 Reviewed-by: Greg Daniel Commit-Queue: Chris Dalton --- src/gpu/GrPathUtils.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/gpu/GrPathUtils.cpp b/src/gpu/GrPathUtils.cpp index d5a237c361..022d2c63ad 100644 --- a/src/gpu/GrPathUtils.cpp +++ b/src/gpu/GrPathUtils.cpp @@ -837,13 +837,16 @@ int GrPathUtils::chopCubicAtLoopIntersection(const SkPoint src[4], SkPoint dst[1 t[1] /= s[1]; SkASSERT(t[0] <= t[1]); // Technically t0 != t1 in a loop, but there may be FP error. - if (t[0] > 0 && t[0] < 1) { - chops.push_back(t[0]); - *loopIndex = 1; - } - if (t[1] > 0 && t[1] < 1) { - chops.push_back(t[1]); - *loopIndex = chops.count() - 1; + if (t[0] < 1 && t[1] > 0) { + *loopIndex = 0; + if (t[0] > 0) { + chops.push_back(t[0]); + *loopIndex = 1; + } + if (t[1] < 1) { + chops.push_back(t[1]); + *loopIndex = chops.count() - 1; + } } }