fix: dont let TextureBuckets interfere with other bucket 'levels'

- make TextureLayer.textures protected
This commit is contained in:
Hannes Janetzek 2014-09-11 18:14:45 +02:00
parent 3a30476f7e
commit 66653df3dc
2 changed files with 10 additions and 9 deletions

View File

@ -20,9 +20,11 @@ import static org.oscim.renderer.MapRenderer.COORD_SCALE;
import org.oscim.backend.CanvasAdapter; import org.oscim.backend.CanvasAdapter;
import org.oscim.backend.canvas.Canvas; import org.oscim.backend.canvas.Canvas;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TextBucket extends TextureBucket { public class TextBucket extends TextureBucket {
//static final Logger log = LoggerFactory.getLogger(TextureLayer.class); static final Logger log = LoggerFactory.getLogger(TextBucket.class);
protected final static int LBIT_MASK = 0xfffffffe; protected final static int LBIT_MASK = 0xfffffffe;
@ -44,6 +46,7 @@ public class TextBucket extends TextureBucket {
super(RenderBucket.SYMBOL); super(RenderBucket.SYMBOL);
mCanvas = CanvasAdapter.newCanvas(); mCanvas = CanvasAdapter.newCanvas();
fixed = true; fixed = true;
level = -1;
} }
public void addText(TextItem item) { public void addText(TextItem item) {
@ -82,7 +85,6 @@ public class TextBucket extends TextureBucket {
public void prepare() { public void prepare() {
short numIndices = 0; short numIndices = 0;
short offsetIndices = 0; short offsetIndices = 0;
numVertices = 0;
int advanceY = 0; int advanceY = 0;
float x = 0; float x = 0;

View File

@ -51,7 +51,7 @@ public abstract class TextureBucket extends RenderBucket {
} }
/** holds textures and offset in vbo */ /** holds textures and offset in vbo */
public TextureItem textures; protected TextureItem textures;
/** scale mode */ /** scale mode */
public boolean fixed; public boolean fixed;
@ -66,14 +66,10 @@ public abstract class TextureBucket extends RenderBucket {
compileVertexItems(vboData); compileVertexItems(vboData);
} }
protected void clear() { protected void clear() {
while (textures != null) while (textures != null)
textures = textures.dispose(); textures = textures.dispose();
super.clear();
vertexItems.dispose();
numVertices = 0;
} }
static class Shader extends GLShader { static class Shader extends GLShader {
@ -132,7 +128,6 @@ public abstract class TextureBucket extends RenderBucket {
1f / (t.width * COORD_SCALE), 1f / (t.width * COORD_SCALE),
1f / (t.height * COORD_SCALE)); 1f / (t.height * COORD_SCALE));
t.bind(); t.bind();
int maxIndices = MapRenderer.maxQuads * INDICES_PER_SPRITE; int maxIndices = MapRenderer.maxQuads * INDICES_PER_SPRITE;
/* draw up to maxVertices in each iteration */ /* draw up to maxVertices in each iteration */
@ -164,4 +159,8 @@ public abstract class TextureBucket extends RenderBucket {
return l.next; return l.next;
} }
} }
public TextureItem getTextures() {
return textures;
}
} }