зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
9b5a8f0398
Коммит
18c7d1c4b0
|
@ -176,15 +176,20 @@ class GeckoSurfaceView
|
||||||
Log.w("GeckoAppJava", "surfaceChanged while mInDrawing is true!");
|
Log.w("GeckoAppJava", "surfaceChanged while mInDrawing is true!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean invalidSize;
|
||||||
|
|
||||||
if (width == 0 || height == 0) {
|
if (width == 0 || height == 0) {
|
||||||
mSoftwareBitmap = null;
|
mSoftwareBitmap = null;
|
||||||
mSoftwareBuffer = null;
|
mSoftwareBuffer = null;
|
||||||
mSoftwareBufferCopy = null;
|
mSoftwareBufferCopy = null;
|
||||||
|
invalidSize = true;
|
||||||
|
} else {
|
||||||
|
invalidSize = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean doSyncDraw =
|
boolean doSyncDraw =
|
||||||
mDrawMode == DRAW_2D &&
|
mDrawMode == DRAW_2D &&
|
||||||
(mSoftwareBitmap != null || mSoftwareBuffer != null) &&
|
!invalidSize &&
|
||||||
GeckoApp.checkLaunchState(GeckoApp.LaunchState.GeckoRunning);
|
GeckoApp.checkLaunchState(GeckoApp.LaunchState.GeckoRunning);
|
||||||
mSyncDraw = doSyncDraw;
|
mSyncDraw = doSyncDraw;
|
||||||
|
|
||||||
|
@ -202,9 +207,6 @@ class GeckoSurfaceView
|
||||||
metrics.widthPixels, metrics.heightPixels);
|
metrics.widthPixels, metrics.heightPixels);
|
||||||
GeckoAppShell.sendEventToGecko(e);
|
GeckoAppShell.sendEventToGecko(e);
|
||||||
|
|
||||||
if (mSoftwareBitmap != null || mSoftwareBuffer != null)
|
|
||||||
GeckoAppShell.scheduleRedraw();
|
|
||||||
|
|
||||||
if (!doSyncDraw) {
|
if (!doSyncDraw) {
|
||||||
if (mDrawMode == DRAW_GLES_2 || mShowingSplashScreen)
|
if (mDrawMode == DRAW_GLES_2 || mShowingSplashScreen)
|
||||||
return;
|
return;
|
||||||
|
@ -212,6 +214,8 @@ class GeckoSurfaceView
|
||||||
c.drawARGB(255, 255, 255, 255);
|
c.drawARGB(255, 255, 255, 255);
|
||||||
holder.unlockCanvasAndPost(c);
|
holder.unlockCanvasAndPost(c);
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
GeckoAppShell.scheduleRedraw();
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
mSurfaceLock.unlock();
|
mSurfaceLock.unlock();
|
||||||
|
@ -219,7 +223,7 @@ class GeckoSurfaceView
|
||||||
|
|
||||||
Object syncDrawObject = null;
|
Object syncDrawObject = null;
|
||||||
try {
|
try {
|
||||||
Object syncObject = mSyncDraws.take();
|
syncDrawObject = mSyncDraws.take();
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
Log.e("GeckoAppJava", "Threw exception while getting sync draw bitmap/buffer: ", ie);
|
Log.e("GeckoAppJava", "Threw exception while getting sync draw bitmap/buffer: ", ie);
|
||||||
}
|
}
|
||||||
|
@ -228,6 +232,8 @@ class GeckoSurfaceView
|
||||||
draw(holder, (Bitmap)syncDrawObject);
|
draw(holder, (Bitmap)syncDrawObject);
|
||||||
else
|
else
|
||||||
draw(holder, (ByteBuffer)syncDrawObject);
|
draw(holder, (ByteBuffer)syncDrawObject);
|
||||||
|
} else {
|
||||||
|
Log.e("GeckoSurfaceViewJava", "Synchronised draw object is null");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче