PolygonBucket: dont test bbox visibility with overzoom > 2

- workaround: seems there can be some overflow in GLMatrix.prj2d()
This commit is contained in:
Hannes Janetzek 2014-11-04 19:20:24 +01:00
parent 3178787954
commit c3ac8a412c

View File

@ -337,38 +337,41 @@ public final class PolygonBucket extends RenderBucket {
if (area.fadeScale > 0 && area.fadeScale > zoom) if (area.fadeScale > 0 && area.fadeScale > zoom)
continue; continue;
/* project bbox of polygon to screen */ if (div > 0.5) {
v.mvp.prj2D(pb.bbox, 0, box, 0, 4); /* project bbox of polygon to screen */
v.mvp.prj2D(pb.bbox, 0, box, 0, 4);
int out = 0; int out = 0;
for (int i = 0; i < 8; i += 2) { for (int i = 0; i < 8; i += 2) {
int o = mScreenClip.outcode(box[i], box[i + 1]); int o = mScreenClip.outcode(box[i], box[i + 1]);
if (o == 0) { if (o == 0) {
/* at least one corner is inside */ /* at least one corner is inside */
out = 0;
break;
}
out |= o;
}
/* Check if any polygon-bucket edge intersects the screen.
* Also check the very unlikely case where the view might
* be
* completly contained within box */
if ((out != 0) && (out != 0xF)) {
mScreenClip.clipStart(box[6], box[7]);
out = 0; out = 0;
break; for (int i = 0; i < 8 && out == 0; i += 2)
} out = mScreenClip.clipNext(box[i], box[i + 1]);
out |= o;
}
/* Check if any polygon-bucket edge intersects the screen. if (out == 0) {
* Also check the very unlikely case where the view might be //log.debug("out {}\n {}\n {}", out, Arrays.toString(pb.bbox), Arrays.toString(box));
* completly contained within box */
if ((out != 0) && (out != 0xF)) {
mScreenClip.clipStart(box[0], box[1]);
if (mScreenClip.clipNext(box[2], box[3]) == 0 && // log.debug("outside {} {} {}", out,
mScreenClip.clipNext(box[4], box[5]) == 0 && // Arrays.toString(box),
mScreenClip.clipNext(box[6], box[7]) == 0 && // Arrays.toString(pb.bbox));
mScreenClip.clipNext(box[0], box[1]) == 0) { continue;
// log.debug("outside {} {} {}", out, }
// Arrays.toString(box),
// Arrays.toString(pb.bbox));
continue;
} }
} }
if (mClear) { if (mClear) {
clearStencilRegion(); clearStencilRegion();
/* op for stencil method polygon drawing */ /* op for stencil method polygon drawing */