use one TexturePool per BitmapTileLayer
- dispose textures onDetach()
This commit is contained in:
parent
b45e38ef4d
commit
a37b503628
@ -104,10 +104,16 @@ public class BitmapTileLayer extends TileLayer {
|
|||||||
return new BitmapTileLoader(this, mTileSource);
|
return new BitmapTileLoader(this, mTileSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDetach() {
|
||||||
|
super.onDetach();
|
||||||
|
pool.clear();
|
||||||
|
}
|
||||||
|
|
||||||
final static int POOL_FILL = 40;
|
final static int POOL_FILL = 40;
|
||||||
|
|
||||||
/** pool shared by TextLayers */
|
/** pool shared by TextLayers */
|
||||||
final static TexturePool pool = new TexturePool(POOL_FILL) {
|
final TexturePool pool = new TexturePool(POOL_FILL) {
|
||||||
|
|
||||||
// int sum = 0;
|
// int sum = 0;
|
||||||
//
|
//
|
||||||
|
@ -21,7 +21,6 @@ import static org.oscim.layers.tile.MapTile.State.CANCEL;
|
|||||||
import org.oscim.backend.canvas.Bitmap;
|
import org.oscim.backend.canvas.Bitmap;
|
||||||
import org.oscim.core.Tile;
|
import org.oscim.core.Tile;
|
||||||
import org.oscim.layers.tile.MapTile;
|
import org.oscim.layers.tile.MapTile;
|
||||||
import org.oscim.layers.tile.TileLayer;
|
|
||||||
import org.oscim.layers.tile.TileLoader;
|
import org.oscim.layers.tile.TileLoader;
|
||||||
import org.oscim.renderer.elements.BitmapLayer;
|
import org.oscim.renderer.elements.BitmapLayer;
|
||||||
import org.oscim.renderer.elements.ElementLayers;
|
import org.oscim.renderer.elements.ElementLayers;
|
||||||
@ -35,10 +34,12 @@ public class BitmapTileLoader extends TileLoader {
|
|||||||
protected static final Logger log = LoggerFactory.getLogger(BitmapTileLoader.class);
|
protected static final Logger log = LoggerFactory.getLogger(BitmapTileLoader.class);
|
||||||
|
|
||||||
private final ITileDataSource mTileDataSource;
|
private final ITileDataSource mTileDataSource;
|
||||||
|
private final BitmapTileLayer mLayer;
|
||||||
|
|
||||||
public BitmapTileLoader(TileLayer tileLayer, TileSource tileSource) {
|
public BitmapTileLoader(BitmapTileLayer tileLayer, TileSource tileSource) {
|
||||||
super(tileLayer.getManager());
|
super(tileLayer.getManager());
|
||||||
mTileDataSource = tileSource.getDataSource();
|
mTileDataSource = tileSource.getDataSource();
|
||||||
|
mLayer = tileLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -58,7 +59,7 @@ public class BitmapTileLoader extends TileLoader {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
BitmapLayer l = new BitmapLayer(false);
|
BitmapLayer l = new BitmapLayer(false);
|
||||||
l.setBitmap(bitmap, Tile.SIZE, Tile.SIZE, BitmapTileLayer.pool);
|
l.setBitmap(bitmap, Tile.SIZE, Tile.SIZE, mLayer.pool);
|
||||||
|
|
||||||
ElementLayers layers = new ElementLayers();
|
ElementLayers layers = new ElementLayers();
|
||||||
layers.setTextureLayers(l);
|
layers.setTextureLayers(l);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user