workaround OpenJDK quirks - bytecode missing an implicit cast
This commit is contained in:
parent
ae414292c1
commit
4eae1575a3
@ -18,8 +18,6 @@ import java.nio.ShortBuffer;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GLAdapter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.oscim.backend.canvas.Paint.Cap;
|
||||
import org.oscim.core.GeometryBuffer;
|
||||
import org.oscim.core.MapPosition;
|
||||
@ -30,6 +28,8 @@ import org.oscim.renderer.MapRenderer;
|
||||
import org.oscim.renderer.MapRenderer.Matrices;
|
||||
import org.oscim.theme.renderinstruction.Line;
|
||||
import org.oscim.utils.FastMath;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -109,8 +109,10 @@ public final class LineLayer extends RenderElement {
|
||||
else if (line.cap == Cap.SQUARE)
|
||||
squared = true;
|
||||
|
||||
if (vertexItems == null)
|
||||
curItem = vertexItems = VertexItem.pool.get();
|
||||
if (vertexItems == null) {
|
||||
vertexItems = VertexItem.pool.get();
|
||||
curItem = vertexItems;
|
||||
}
|
||||
|
||||
VertexItem si = curItem;
|
||||
short v[] = si.vertices;
|
||||
@ -204,7 +206,7 @@ public final class LineLayer extends RenderElement {
|
||||
boolean outside = (x < tmin || x > tmax || y < tmin || y > tmax);
|
||||
|
||||
if (opos == VertexItem.SIZE) {
|
||||
si = si.next = VertexItem.pool.get();
|
||||
si = VertexItem.pool.getNext(si);
|
||||
v = si.vertices;
|
||||
opos = 0;
|
||||
}
|
||||
@ -222,7 +224,7 @@ public final class LineLayer extends RenderElement {
|
||||
v[opos++] = dy;
|
||||
|
||||
if (opos == VertexItem.SIZE) {
|
||||
si = si.next = VertexItem.pool.get();
|
||||
si = VertexItem.pool.getNext(si);
|
||||
v = si.vertices;
|
||||
opos = 0;
|
||||
}
|
||||
@ -233,7 +235,7 @@ public final class LineLayer extends RenderElement {
|
||||
v[opos++] = dy;
|
||||
|
||||
if (opos == VertexItem.SIZE) {
|
||||
si = si.next = VertexItem.pool.get();
|
||||
si = VertexItem.pool.getNext(si);
|
||||
v = si.vertices;
|
||||
opos = 0;
|
||||
}
|
||||
@ -247,7 +249,7 @@ public final class LineLayer extends RenderElement {
|
||||
v[opos++] = (short) (2 | ddy & DIR_MASK);
|
||||
|
||||
if (opos == VertexItem.SIZE) {
|
||||
si = si.next = VertexItem.pool.get();
|
||||
si = VertexItem.pool.getNext(si);
|
||||
v = si.vertices;
|
||||
opos = 0;
|
||||
}
|
||||
@ -262,7 +264,7 @@ public final class LineLayer extends RenderElement {
|
||||
v[opos++] = (short) (1 | ddy & DIR_MASK);
|
||||
|
||||
if (opos == VertexItem.SIZE) {
|
||||
si = si.next = VertexItem.pool.get();
|
||||
si = VertexItem.pool.getNext(si);
|
||||
v = si.vertices;
|
||||
opos = 0;
|
||||
}
|
||||
@ -302,7 +304,7 @@ public final class LineLayer extends RenderElement {
|
||||
v[opos++] = dy;
|
||||
|
||||
if (opos == VertexItem.SIZE) {
|
||||
si = si.next = VertexItem.pool.get();
|
||||
si = VertexItem.pool.getNext(si);
|
||||
v = si.vertices;
|
||||
opos = 0;
|
||||
}
|
||||
@ -313,7 +315,7 @@ public final class LineLayer extends RenderElement {
|
||||
v[opos++] = dy;
|
||||
|
||||
if (opos == VertexItem.SIZE) {
|
||||
si = si.next = VertexItem.pool.get();
|
||||
si = VertexItem.pool.getNext(si);
|
||||
v = si.vertices;
|
||||
opos = 0;
|
||||
}
|
||||
@ -395,7 +397,7 @@ public final class LineLayer extends RenderElement {
|
||||
ddy = -ddy;
|
||||
}
|
||||
if (opos == VertexItem.SIZE) {
|
||||
si = si.next = VertexItem.pool.get();
|
||||
si = VertexItem.pool.getNext(si);
|
||||
v = si.vertices;
|
||||
opos = 0;
|
||||
}
|
||||
@ -406,7 +408,7 @@ public final class LineLayer extends RenderElement {
|
||||
v[opos++] = (short) (1 | ddy & DIR_MASK);
|
||||
|
||||
if (opos == VertexItem.SIZE) {
|
||||
si = si.next = VertexItem.pool.get();
|
||||
si = VertexItem.pool.getNext(si);
|
||||
v = si.vertices;
|
||||
opos = 0;
|
||||
}
|
||||
@ -430,8 +432,7 @@ public final class LineLayer extends RenderElement {
|
||||
outside = (x < tmin || x > tmax || y < tmin || y > tmax);
|
||||
|
||||
if (opos == VertexItem.SIZE) {
|
||||
si.next = VertexItem.pool.get();
|
||||
si = si.next;
|
||||
si = VertexItem.pool.getNext(si);
|
||||
opos = 0;
|
||||
v = si.vertices;
|
||||
}
|
||||
@ -454,7 +455,7 @@ public final class LineLayer extends RenderElement {
|
||||
v[opos++] = (short) (1 | ddy & DIR_MASK);
|
||||
|
||||
if (opos == VertexItem.SIZE) {
|
||||
si = si.next = VertexItem.pool.get();
|
||||
si = VertexItem.pool.getNext(si);
|
||||
v = si.vertices;
|
||||
opos = 0;
|
||||
}
|
||||
@ -465,7 +466,7 @@ public final class LineLayer extends RenderElement {
|
||||
v[opos++] = (short) (1 | -ddy & DIR_MASK);
|
||||
|
||||
if (opos == VertexItem.SIZE) {
|
||||
si = si.next = VertexItem.pool.get();
|
||||
si = VertexItem.pool.getNext(si);
|
||||
v = si.vertices;
|
||||
opos = 0;
|
||||
}
|
||||
@ -483,7 +484,7 @@ public final class LineLayer extends RenderElement {
|
||||
v[opos++] = dy;
|
||||
|
||||
if (opos == VertexItem.SIZE) {
|
||||
si = si.next = VertexItem.pool.get();
|
||||
si = VertexItem.pool.getNext(si);
|
||||
v = si.vertices;
|
||||
opos = 0;
|
||||
}
|
||||
@ -500,7 +501,7 @@ public final class LineLayer extends RenderElement {
|
||||
v[opos++] = dy;
|
||||
|
||||
if (opos == VertexItem.SIZE) {
|
||||
si = si.next = VertexItem.pool.get();
|
||||
si = VertexItem.pool.getNext(si);
|
||||
v = si.vertices;
|
||||
opos = 0;
|
||||
}
|
||||
@ -531,7 +532,7 @@ public final class LineLayer extends RenderElement {
|
||||
v[opos++] = (short) (1 | (flip ? -ddy : ddy) & DIR_MASK);
|
||||
|
||||
if (opos == VertexItem.SIZE) {
|
||||
si = si.next = VertexItem.pool.get();
|
||||
si = VertexItem.pool.getNext(si);
|
||||
v = si.vertices;
|
||||
opos = 0;
|
||||
}
|
||||
@ -548,7 +549,7 @@ public final class LineLayer extends RenderElement {
|
||||
v[opos++] = dy;
|
||||
|
||||
if (opos == VertexItem.SIZE) {
|
||||
si = si.next = VertexItem.pool.get();
|
||||
si = VertexItem.pool.getNext(si);
|
||||
v = si.vertices;
|
||||
opos = 0;
|
||||
}
|
||||
|
@ -107,8 +107,8 @@ public final class LineTexLayer extends RenderElement {
|
||||
public void addLine(float[] points, short[] index) {
|
||||
|
||||
if (vertexItems == null) {
|
||||
curItem = vertexItems = VertexItem.pool.get();
|
||||
|
||||
vertexItems = VertexItem.pool.get();
|
||||
curItem = vertexItems;
|
||||
// HACK add one vertex offset when compiling
|
||||
// buffer otherwise one cant use the full
|
||||
// VertexItem (see Layers.compile)
|
||||
@ -187,7 +187,7 @@ public final class LineTexLayer extends RenderElement {
|
||||
short dy = (short) (uy * DIR_SCALE);
|
||||
|
||||
if (opos == VertexItem.SIZE) {
|
||||
si = si.next = VertexItem.pool.get();
|
||||
si = VertexItem.pool.getNext(si);
|
||||
v = si.vertices;
|
||||
opos = 0;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public final class PolygonLayer extends RenderElement {
|
||||
int inPos = pos;
|
||||
|
||||
if (outPos == VertexItem.SIZE) {
|
||||
si = si.next = VertexItem.pool.get();
|
||||
si = VertexItem.pool.getNext(si);
|
||||
v = si.vertices;
|
||||
outPos = 0;
|
||||
}
|
||||
@ -91,7 +91,7 @@ public final class PolygonLayer extends RenderElement {
|
||||
|
||||
for (int j = 0; j < length; j += 2) {
|
||||
if (outPos == VertexItem.SIZE) {
|
||||
si = si.next = VertexItem.pool.get();
|
||||
si = VertexItem.pool.getNext(si);
|
||||
v = si.vertices;
|
||||
outPos = 0;
|
||||
}
|
||||
@ -100,7 +100,7 @@ public final class PolygonLayer extends RenderElement {
|
||||
}
|
||||
|
||||
if (outPos == VertexItem.SIZE) {
|
||||
si = si.next = VertexItem.pool.get();
|
||||
si = VertexItem.pool.getNext(si);
|
||||
v = si.vertices;
|
||||
outPos = 0;
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ public final class TextLayer extends TextureLayer {
|
||||
|
||||
if (pos == VertexItem.SIZE) {
|
||||
vi.used = VertexItem.SIZE;
|
||||
vi = vi.next = VertexItem.pool.get();
|
||||
vi = VertexItem.pool.getNext(vi);
|
||||
buf = vi.vertices;
|
||||
pos = 0;
|
||||
}
|
||||
|
@ -21,7 +21,10 @@ public class VertexItem extends Inlist<VertexItem> {
|
||||
|
||||
private static final int MAX_POOL = 500;
|
||||
|
||||
public final static SyncPool<VertexItem> pool = new SyncPool<VertexItem>(MAX_POOL) {
|
||||
public final static class Pool extends SyncPool<VertexItem> {
|
||||
public Pool() {
|
||||
super(MAX_POOL);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected VertexItem createItem() {
|
||||
@ -33,7 +36,14 @@ public class VertexItem extends Inlist<VertexItem> {
|
||||
it.used = 0;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
public VertexItem getNext(VertexItem it) {
|
||||
it.next = get();
|
||||
return it.next;
|
||||
}
|
||||
}
|
||||
|
||||
public final static Pool pool = new Pool();
|
||||
|
||||
public int getSize() {
|
||||
int size = used;
|
||||
|
@ -46,10 +46,8 @@ public class Tessellator {
|
||||
int cnt;
|
||||
int numIndices = 0;
|
||||
|
||||
if (outTris.used == VertexItem.SIZE) {
|
||||
outTris.next = VertexItem.pool.get();
|
||||
outTris = outTris.next;
|
||||
}
|
||||
if (outTris.used == VertexItem.SIZE)
|
||||
outTris = VertexItem.pool.getNext(outTris);
|
||||
|
||||
while ((cnt = Tessellator.tessGetIndicesWO(ctx,
|
||||
outTris.vertices,
|
||||
@ -87,8 +85,7 @@ public class Tessellator {
|
||||
numIndices += cnt;
|
||||
|
||||
if (outTris.used == VertexItem.SIZE) {
|
||||
outTris.next = VertexItem.pool.get();
|
||||
outTris = outTris.next;
|
||||
outTris = VertexItem.pool.getNext(outTris);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -208,8 +205,7 @@ public class Tessellator {
|
||||
}
|
||||
|
||||
if (outPoints.used == VertexItem.SIZE) {
|
||||
outPoints.next = VertexItem.pool.get();
|
||||
outPoints = outPoints.next;
|
||||
outPoints = VertexItem.pool.getNext(outPoints);
|
||||
}
|
||||
|
||||
int cnt;
|
||||
@ -221,8 +217,7 @@ public class Tessellator {
|
||||
outPoints.used += cnt;
|
||||
|
||||
if (outPoints.used == VertexItem.SIZE) {
|
||||
outPoints.next = VertexItem.pool.get();
|
||||
outPoints = outPoints.next;
|
||||
outPoints = VertexItem.pool.getNext(outPoints);
|
||||
continue;
|
||||
}
|
||||
// no more points to get.
|
||||
@ -232,8 +227,7 @@ public class Tessellator {
|
||||
int numIndices = 0;
|
||||
|
||||
if (outTris.used == VertexItem.SIZE) {
|
||||
outTris.next = VertexItem.pool.get();
|
||||
outTris = outTris.next;
|
||||
outTris = VertexItem.pool.getNext(outTris);
|
||||
}
|
||||
|
||||
while ((cnt = Tessellator.tessGetIndicesWO(ctx,
|
||||
@ -247,8 +241,7 @@ public class Tessellator {
|
||||
numIndices += cnt;
|
||||
|
||||
if (outTris.used == VertexItem.SIZE) {
|
||||
outTris.next = VertexItem.pool.get();
|
||||
outTris = outTris.next;
|
||||
outTris = VertexItem.pool.getNext(outTris);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user