Bug 664996 Fix missing redraw when resuming application r=dougt

Because I'd altered the way surface creation works, it was possible to
have a null buffer in surfaceChanged while having a valid surface size.

Instead of looking at the buffer pointers, I've replaced it with a
boolean that tracks whether the surface size is valid or not.

In addition, there was a typo that meant that synchronised redraws were
being skipped, as the object from mSyncDraws was taken and immediately
discarded.

--HG--
extra : rebase_source : 1b689f7c8cdd10565dea30a4cd65f49371f046d3
This commit is contained in:
Doug Turner 2011-06-25 21:35:52 -07:00
parent 6b1bb79b2a
commit e0a1cd4091

View File

@ -176,15 +176,20 @@ class GeckoSurfaceView
Log.w("GeckoAppJava", "surfaceChanged while mInDrawing is true!");
}
boolean invalidSize;
if (width == 0 || height == 0) {
mSoftwareBitmap = null;
mSoftwareBuffer = null;
mSoftwareBufferCopy = null;
invalidSize = true;
} else {
invalidSize = false;
}
boolean doSyncDraw =
mDrawMode == DRAW_2D &&
(mSoftwareBitmap != null || mSoftwareBuffer != null) &&
!invalidSize &&
GeckoApp.checkLaunchState(GeckoApp.LaunchState.GeckoRunning);
mSyncDraw = doSyncDraw;
@ -202,9 +207,6 @@ class GeckoSurfaceView
metrics.widthPixels, metrics.heightPixels);
GeckoAppShell.sendEventToGecko(e);
if (mSoftwareBitmap != null || mSoftwareBuffer != null)
GeckoAppShell.scheduleRedraw();
if (!doSyncDraw) {
if (mDrawMode == DRAW_GLES_2 || mShowingSplashScreen)
return;
@ -212,6 +214,8 @@ class GeckoSurfaceView
c.drawARGB(255, 255, 255, 255);
holder.unlockCanvasAndPost(c);
return;
} else {
GeckoAppShell.scheduleRedraw();
}
} finally {
mSurfaceLock.unlock();
@ -219,7 +223,7 @@ class GeckoSurfaceView
Object syncDrawObject = null;
try {
Object syncObject = mSyncDraws.take();
syncDrawObject = mSyncDraws.take();
} catch (InterruptedException ie) {
Log.e("GeckoAppJava", "Threw exception while getting sync draw bitmap/buffer: ", ie);
}
@ -228,6 +232,8 @@ class GeckoSurfaceView
draw(holder, (Bitmap)syncDrawObject);
else
draw(holder, (ByteBuffer)syncDrawObject);
} else {
Log.e("GeckoSurfaceViewJava", "Synchronised draw object is null");
}
}