From e0a1cd4091df05fd65462ac887ae7e1f6269e904 Mon Sep 17 00:00:00 2001 From: Doug Turner Date: Sat, 25 Jun 2011 21:35:52 -0700 Subject: [PATCH] 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 --- embedding/android/GeckoSurfaceView.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/embedding/android/GeckoSurfaceView.java b/embedding/android/GeckoSurfaceView.java index 0f1679d8ae6..65778f84171 100644 --- a/embedding/android/GeckoSurfaceView.java +++ b/embedding/android/GeckoSurfaceView.java @@ -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"); } }