aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pathops
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@skia.org>2018-02-02 15:09:49 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-02 20:39:09 +0000
commit4efcb7d100e824926e03f598d616f6bda5682e14 (patch)
tree83f8fb9ec7d81801d08e64eecb1867b4159b7a05 /src/pathops
parent27738e043a8eeeb8045397b7e1140a0b1bcb04a3 (diff)
handle degenerate cubic loops
fuzzer generated a cubic with a very tiny loop at one end. Breaking the cubic in two generated a piece so small it was discarded, passing the original along. Instead, use the loop detection as a hint that passing the original may fail further along. Keep the big piece, which is more linear than the original; and change its end to match the original input if the small piece isn't worth keeping. R=kjlubick Bug: skia:7480 Change-Id: If4c5cd46dbf7e16526269f2854e4f2278f427461 Reviewed-on: https://skia-review.googlesource.com/103100 Reviewed-by: Kevin Lubick <kjlubick@google.com> Commit-Queue: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'src/pathops')
-rw-r--r--src/pathops/SkOpEdgeBuilder.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/pathops/SkOpEdgeBuilder.cpp b/src/pathops/SkOpEdgeBuilder.cpp
index 572942dab4..cda6850701 100644
--- a/src/pathops/SkOpEdgeBuilder.cpp
+++ b/src/pathops/SkOpEdgeBuilder.cpp
@@ -307,6 +307,7 @@ bool SkOpEdgeBuilder::walk() {
}
if (prior < index) {
split->fT[0] = splits[prior].fT[0];
+ split->fPts[0] = splits[prior].fPts[0];
}
int next = index;
int breakLimit = SkTMin(breaks, (int) SK_ARRAY_COUNT(splits) - 1);
@@ -315,17 +316,9 @@ bool SkOpEdgeBuilder::walk() {
}
if (next > index) {
split->fT[1] = splits[next].fT[1];
+ split->fPts[3] = splits[next].fPts[3];
}
if (prior < index || next > index) {
- if (0 == split->fT[0] && 1 == split->fT[1]) {
- fContourBuilder.addCubic(pointsPtr);
- break;
- }
- SkDCubic part = SkDCubic::SubDivide(pointsPtr, split->fT[0],
- split->fT[1]);
- if (!part.toFloatPoints(split->fPts)) {
- return false;
- }
split->fVerb = SkReduceOrder::Cubic(split->fPts, split->fReduced);
}
SkPoint* curve = SkPath::kCubic_Verb == split->fVerb