From e9f4cbd8b3729d7f4a0374940f622aff37954f0d Mon Sep 17 00:00:00 2001 From: Erica Fischer Date: Thu, 27 Jul 2023 14:34:44 -0700 Subject: [PATCH] The discrepancy seems to be introduced in reordering. No obvious bug --- geometry.cpp | 7 ++++++- tile.cpp | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/geometry.cpp b/geometry.cpp index e088ab76a..48526a031 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -1194,13 +1194,16 @@ drawvec reorder_lines(drawvec &geom) { for (size_t i = 0; i < geom.size(); i++) { if (geom[i].op == VT_MOVETO) { if (i != 0) { + // moveto is not at the start, so it is not simple return geom; } } else if (geom[i].op == VT_LINETO) { if (i == 0) { + // lineto is at the start: can't happen return geom; } } else { + // something other than moveto or lineto: can't happen return geom; } } @@ -1218,7 +1221,9 @@ drawvec reorder_lines(drawvec &geom) { out.push_back(geom[geom.size() - 1 - i]); } out[0].op = VT_MOVETO; - out[out.size() - 1].op = VT_LINETO; + if (out.size() > 1) { + out[out.size() - 1].op = VT_LINETO; + } return out; } diff --git a/tile.cpp b/tile.cpp index 61222ff67..efa741864 100644 --- a/tile.cpp +++ b/tile.cpp @@ -587,6 +587,7 @@ double simplify_partial(partial *p, drawvec &shared_nodes) { } if (t == VT_LINE && additional[A_REVERSE]) { + geom = remove_noop(geom, t, 0); geom = reorder_lines(geom); }