aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pathops/SkPathWriter.cpp
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@skia.org>2018-07-10 10:57:54 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-10 15:25:35 +0000
commit1d314433ffd5a5149438dd82d10c04736325004d (patch)
tree618f7311c51690a0a624be89f8e95bae508691e4 /src/pathops/SkPathWriter.cpp
parent3be2e10ce534a9bf8eb008d3704be26b2ba04437 (diff)
fix line intersect divide by zero
Test filinmangust14 exposes two problems: - finding top of contour can expose divide by zero - joining partial contour results can add diagonal The latter makes the test return the wrong result, and has not been seen in other tests. The fix is to join disconnected contours by only following the contours provided as input. Working on that. The former bug is more straight-forward; just don't try to compute axis-aligned intersection if the denominator is zero. All existing tests prior to the new one work with this change. R=caryclark@google.com Bug: skia:8125 Change-Id: Ic878d090066708d9baca8475f27d4d5aba2294cc Reviewed-on: https://skia-review.googlesource.com/140121 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org> Auto-Submit: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'src/pathops/SkPathWriter.cpp')
-rw-r--r--src/pathops/SkPathWriter.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/pathops/SkPathWriter.cpp b/src/pathops/SkPathWriter.cpp
index 7291002593..950f8fbce5 100644
--- a/src/pathops/SkPathWriter.cpp
+++ b/src/pathops/SkPathWriter.cpp
@@ -301,6 +301,22 @@ void SkPathWriter::assemble() {
#endif
do {
const SkPath& contour = fPartials[rIndex];
+ if (!first) {
+ SkPoint prior, next;
+ SkAssertResult(fPathPtr->getLastPt(&prior));
+ if (forward) {
+ next = contour.getPoint(0);
+ } else {
+ SkAssertResult(contour.getLastPt(&next));
+ }
+ if (prior != next) {
+ /* TODO: if there is a gap between open path written so far and path to come,
+ connect by following segments from one to the other, rather than introducing
+ a diagonal to connect the two.
+ */
+ SkDebugf("");
+ }
+ }
if (forward) {
fPathPtr->addPath(contour,
first ? SkPath::kAppend_AddPathMode : SkPath::kExtend_AddPathMode);