diff options
author | Chris Dalton <csmartdalton@google.com> | 2017-06-09 12:51:56 -0600 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-06-09 19:21:13 +0000 |
commit | b58194a90ee788f0da8daffcc444ea74237f4b79 (patch) | |
tree | 947767e5bd5c03ae1ac63797e941370a80de0b79 /src/gpu/GrPathUtils.cpp | |
parent | 744d3c59be13f737e182e13a1fd2a12f87d230b2 (diff) |
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 <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/gpu/GrPathUtils.cpp')
-rw-r--r-- | src/gpu/GrPathUtils.cpp | 17 |
1 files 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; + } } } |