Fix clipping of polygons with multiple rings.

This commit is contained in:
Eric Fischer 2014-10-16 15:17:18 -07:00
parent 3bdcc3ca90
commit 151f0c116c

10
tile.cc
View File

@ -487,7 +487,7 @@ drawvec clip_poly(drawvec &geom, int z, int detail) {
if (geom[i].op == VT_MOVETO) {
unsigned j;
for (j = i + 1; j < geom.size(); j++) {
if (geom[j].op == VT_CLOSEPATH) {
if (geom[j].op == VT_CLOSEPATH || geom[j].op == VT_MOVETO) {
break;
}
}
@ -501,8 +501,12 @@ drawvec clip_poly(drawvec &geom, int z, int detail) {
out.push_back(tmp[k]);
}
out.push_back(draw(VT_CLOSEPATH, 0, 0));
i = j;
if (j >= geom.size() || geom[j].op == VT_CLOSEPATH) {
out.push_back(draw(VT_CLOSEPATH, 0, 0));
i = j;
} else {
i = j - 1;
}
} else {
out.push_back(geom[i]);
}