fix flickering map (no visible tiles for one frame) in case tiles changed but position does not
This commit is contained in:
parent
42bd0661c1
commit
0f441fc8f3
@ -60,9 +60,6 @@ public class TileRenderLayer extends RenderLayer {
|
|||||||
if (mDrawTiles == null || mDrawTiles.cnt == 0)
|
if (mDrawTiles == null || mDrawTiles.cnt == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (positionChanged)
|
|
||||||
mMapView.getMapViewPosition().getMapViewProjection(mBoxCoords);
|
|
||||||
|
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
//boolean positionChanged = false;
|
//boolean positionChanged = false;
|
||||||
|
|
||||||
@ -76,15 +73,16 @@ public class TileRenderLayer extends RenderLayer {
|
|||||||
int tileCnt = mDrawTiles.cnt;
|
int tileCnt = mDrawTiles.cnt;
|
||||||
MapTile[] tiles = mDrawTiles.tiles;
|
MapTile[] tiles = mDrawTiles.tiles;
|
||||||
|
|
||||||
if (changed || positionChanged)
|
if (changed || positionChanged){
|
||||||
updateTileVisibility();
|
float[] box = mBoxCoords;
|
||||||
|
mMapView.getMapViewPosition().getMapViewProjection(box);
|
||||||
|
|
||||||
|
updateTileVisibility(box);
|
||||||
|
}
|
||||||
tileCnt += mNumTileHolder;
|
tileCnt += mNumTileHolder;
|
||||||
|
|
||||||
/* prepare tile for rendering */
|
/* prepare tile for rendering */
|
||||||
int uploadCnt = compileTileLayers(tiles, tileCnt);
|
compileTileLayers(tiles, tileCnt);
|
||||||
|
|
||||||
//tilesChanged |= (uploadCnt > 0);
|
|
||||||
|
|
||||||
TileRenderer.draw(tiles, tileCnt, pos, m, mFaded);
|
TileRenderer.draw(tiles, tileCnt, pos, m, mFaded);
|
||||||
}
|
}
|
||||||
@ -179,7 +177,7 @@ public class TileRenderLayer extends RenderLayer {
|
|||||||
private final Object tilelock = new Object();
|
private final Object tilelock = new Object();
|
||||||
|
|
||||||
/** set tile isVisible flag true for tiles that intersect view */
|
/** set tile isVisible flag true for tiles that intersect view */
|
||||||
private void updateTileVisibility() {
|
private void updateTileVisibility(float[] box) {
|
||||||
|
|
||||||
// lock tiles while updating isVisible state
|
// lock tiles while updating isVisible state
|
||||||
synchronized (tilelock) {
|
synchronized (tilelock) {
|
||||||
@ -195,7 +193,7 @@ public class TileRenderLayer extends RenderLayer {
|
|||||||
mNumTileHolder = 0;
|
mNumTileHolder = 0;
|
||||||
|
|
||||||
// check visibile tiles
|
// check visibile tiles
|
||||||
mScanBox.scan(pos.x, pos.y, pos.scale, tileZoom, mBoxCoords);
|
mScanBox.scan(pos.x, pos.y, pos.scale, tileZoom, box);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user