diff --git a/geometry.cpp b/geometry.cpp index 6818b0b5..e32f2a3e 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -1210,13 +1210,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; } } @@ -1234,7 +1237,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 d90b8cb1..caabae54 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); }