polygon geometry: holes do not need a 0 index separator

This commit is contained in:
Hannes Janetzek 2013-06-15 16:51:10 +02:00
parent dce0507d36
commit 2933ca7b57

View File

@ -7,7 +7,8 @@ public class GeometryBuffer {
NONE(0), NONE(0),
POINT(1), POINT(1),
LINE(2), LINE(2),
POLY(3); POLY(3),
TRIS(4);
private GeometryType(int type) { private GeometryType(int type) {
nativeInt = type; nativeInt = type;
@ -109,14 +110,10 @@ public class GeometryBuffer {
if (CHECK_STATE) if (CHECK_STATE)
setOrCheckMode(GeometryType.POLY); setOrCheckMode(GeometryType.POLY);
if ((indexPos + 4) > index.length) if ((indexPos + 3) > index.length)
ensureIndexSize(indexPos + 3, true); ensureIndexSize(indexPos + 2, true);
if (!start) { if (!start) {
// end ring
index[++indexPos] = 0;
// end polygon // end polygon
index[++indexPos] = 0; index[++indexPos] = 0;
@ -136,11 +133,8 @@ public class GeometryBuffer {
if (CHECK_STATE) if (CHECK_STATE)
checkMode(GeometryType.POLY); checkMode(GeometryType.POLY);
if ((indexPos + 3) > index.length) if ((indexPos + 2) > index.length)
ensureIndexSize(indexPos + 2, true); ensureIndexSize(indexPos + 1, true);
// end ring
index[++indexPos] = 0;
// initialize with zero points // initialize with zero points
index[++indexPos] = 0; index[++indexPos] = 0;