fix screen rotation causing 'out of VBOs' issue

This commit is contained in:
Hannes Janetzek 2013-01-11 20:09:53 +01:00
parent 74cf517b15
commit d1388660a1

View File

@ -66,7 +66,7 @@ public class TileManager {
// tiles that have new data to upload, see passTile() // tiles that have new data to upload, see passTile()
private static ArrayList<MapTile> mTilesLoaded; private static ArrayList<MapTile> mTilesLoaded;
private static boolean mInitial; private static boolean mInitialized;
// private static MapPosition mCurPosition, mDrawPosition; // private static MapPosition mCurPosition, mDrawPosition;
private static int mWidth = 0, mHeight = 0; private static int mWidth = 0, mHeight = 0;
@ -160,7 +160,7 @@ public class TileManager {
mTilesSize = 0; mTilesSize = 0;
mUpdateCnt = 0; mUpdateCnt = 0;
mInitial = true; mInitialized = false;
} }
/** /**
@ -176,20 +176,20 @@ public class TileManager {
if (mMapView == null) if (mMapView == null)
return; return;
if (clear || mInitial) { if (clear || !mInitialized) {
// make sure onDrawFrame is not running // make sure onDrawFrame is not running
// - and labeling thread? // - and labeling thread?
GLRenderer.drawlock.lock(); GLRenderer.drawlock.lock();
// clear all tiles references // clear all tiles references
Log.d(TAG, "CLEAR " + mInitial); Log.d(TAG, "CLEAR " + mInitialized);
if (clear) { if (clear) {
// pass VBOs and VertexItems back to pools // pass VBOs and VertexItems back to pools
for (int i = 0; i < mTilesSize; i++) for (int i = 0; i < mTilesSize; i++)
clearTile(mTiles[i]); clearTile(mTiles[i]);
} else { } else {
// mInitial is set when surface changed // mInitialized is set when surface changed
// and VBOs might be lost // and VBOs might be lost
VertexPool.init(); VertexPool.init();
} }
@ -216,7 +216,7 @@ public class TileManager {
// make sure mMapPosition will be updated // make sure mMapPosition will be updated
mMapPosition.zoomLevel = -1; mMapPosition.zoomLevel = -1;
mInitial = false; mInitialized = true;
GLRenderer.drawlock.unlock(); GLRenderer.drawlock.unlock();
} }
@ -686,7 +686,9 @@ public class TileManager {
mWidth = w; mWidth = w;
mHeight = h; mHeight = h;
if (mWidth > 0 && mHeight > 0) // size changed does not mean gl surface was recreated
mInitial = true; // FIXME iirc this was the case before honeycomb
//if (mWidth > 0 && mHeight > 0)
// mInitialized = true;
} }
} }