diff options
author | Chris Dalton <csmartdalton@google.com> | 2018-07-24 01:08:31 -0600 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-25 17:29:26 +0000 |
commit | 1d474dd1941bfdfec7a5a005b37ddc96482a7706 (patch) | |
tree | b26b635b3953b6030aef0acef6927c6f17848d55 /src/core/SkStroke.cpp | |
parent | 4014ba6ec7a7825495ac0a6ed591c5dadd30751d (diff) |
Pin max curvature solutions to 0..1
Pins out-of-range solutions for cubic/quad max curvature instead of
throwing them out. Code that wants to know the endpoint(s) closest to
max curvature now has the information. Code not interested in these
values can just ignore 0 and 1.
Bug: skia:
Change-Id: I8e7e2ef236b4ab963865dc049ac3e09d5396757d
Reviewed-on: https://skia-review.googlesource.com/143041
Reviewed-by: Cary Clark <caryclark@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/core/SkStroke.cpp')
-rw-r--r-- | src/core/SkStroke.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/SkStroke.cpp b/src/core/SkStroke.cpp index b880c152da..92390a38dd 100644 --- a/src/core/SkStroke.cpp +++ b/src/core/SkStroke.cpp @@ -612,13 +612,13 @@ SkPathStroker::ReductionType SkPathStroker::CheckCubicLinear(const SkPoint cubic } SkScalar tValues[3]; int count = SkFindCubicMaxCurvature(cubic, tValues); - if (count == 0) { - return kLine_ReductionType; - } int rCount = 0; // Now loop over the t-values, and reject any that evaluate to either end-point for (int index = 0; index < count; ++index) { SkScalar t = tValues[index]; + if (0 >= t || t >= 1) { + continue; + } SkEvalCubicAt(cubic, t, &reduction[rCount], nullptr, nullptr); if (reduction[rCount] != cubic[0] && reduction[rCount] != cubic[3]) { ++rCount; @@ -679,7 +679,7 @@ SkPathStroker::ReductionType SkPathStroker::CheckQuadLinear(const SkPoint quad[3 return kQuad_ReductionType; } SkScalar t = SkFindQuadMaxCurvature(quad); - if (0 == t) { + if (0 == t || 1 == t) { return kLine_ReductionType; } *reduction = SkEvalQuadAt(quad, t); |