summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2016-04-13 10:24:06 -0700
committerJohn Reck <jreck@google.com>2016-04-14 10:39:03 -0700
commit8afcc76920499d0a384dba1470c5a377f80ed768 (patch)
treed6c10ca146b7b28daaf18544ed3d338b9ed08946 /core/java
parent5352dda479452c248f87521d6c69c9dd8399ebb7 (diff)
Revert "Revert "Make stopped state a first-class thing""
This reverts commit eab3f2658aa41d37c3b05d49a2ce4e3f4ed85399. Fixes first-frame issue, mReportNextDraw needs to override mStopped Fixes: 28118961 Fixes: 27286867 Change-Id: I5c811759637d08ba9f3b342016d1b3006986d5a2
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/view/ThreadedRenderer.java15
-rw-r--r--core/java/android/view/ViewRootImpl.java19
2 files changed, 28 insertions, 6 deletions
diff --git a/core/java/android/view/ThreadedRenderer.java b/core/java/android/view/ThreadedRenderer.java
index c4ed94f6184d..206ba1664407 100644
--- a/core/java/android/view/ThreadedRenderer.java
+++ b/core/java/android/view/ThreadedRenderer.java
@@ -485,15 +485,25 @@ public final class ThreadedRenderer {
}
/**
- * Stops any rendering into the surface. Use this if it is unclear whether
+ * Halts any current rendering into the surface. Use this if it is unclear whether
* or not the surface used by the HardwareRenderer will be changing. It
- * Suspends any rendering into the surface, but will not do any destruction
+ * Suspends any rendering into the surface, but will not do any destruction.
+ *
+ * Any subsequent draws will override the pause, resuming normal operation.
*/
boolean pauseSurface(Surface surface) {
return nPauseSurface(mNativeProxy, surface);
}
/**
+ * Hard stops or resumes rendering into the surface. This flag is used to
+ * determine whether or not it is safe to use the given surface *at all*
+ */
+ void setStopped(boolean stopped) {
+ nSetStopped(mNativeProxy, stopped);
+ }
+
+ /**
* Destroys all hardware rendering resources associated with the specified
* view hierarchy.
*
@@ -992,6 +1002,7 @@ public final class ThreadedRenderer {
private static native void nInitialize(long nativeProxy, Surface window);
private static native void nUpdateSurface(long nativeProxy, Surface window);
private static native boolean nPauseSurface(long nativeProxy, Surface window);
+ private static native void nSetStopped(long nativeProxy, boolean stopped);
private static native void nSetup(long nativeProxy, int width, int height,
float lightRadius, int ambientShadowAlpha, int spotShadowAlpha);
private static native void nSetLightCenter(long nativeProxy,
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 44b92e18144e..b6d2160632f7 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -1079,13 +1079,16 @@ public final class ViewRootImpl implements ViewParent,
void setWindowStopped(boolean stopped) {
if (mStopped != stopped) {
mStopped = stopped;
+ final ThreadedRenderer renderer = mAttachInfo.mHardwareRenderer;
+ if (renderer != null) {
+ if (DEBUG_DRAW) Log.d(mTag, "WindowStopped on " + getTitle() + " set to " + mStopped);
+ renderer.setStopped(mStopped);
+ }
if (!mStopped) {
scheduleTraversals();
} else {
- if (mAttachInfo.mHardwareRenderer != null) {
- if (DEBUG_DRAW) Log.d(mTag, "WindowStopped on " + getTitle());
- mAttachInfo.mHardwareRenderer.updateSurface(null);
- mAttachInfo.mHardwareRenderer.destroyHardwareResources(mView);
+ if (renderer != null) {
+ renderer.destroyHardwareResources(mView);
}
}
}
@@ -2555,6 +2558,7 @@ public final class ViewRootImpl implements ViewParent,
if (mAttachInfo.mHardwareRenderer != null) {
mAttachInfo.mHardwareRenderer.fence();
+ mAttachInfo.mHardwareRenderer.setStopped(mStopped);
}
if (LOCAL_LOGV) {
@@ -2704,6 +2708,13 @@ public final class ViewRootImpl implements ViewParent,
// shortly before the draw commands get send to the renderer.
final boolean updated = updateContentDrawBounds();
+ if (mReportNextDraw) {
+ // report next draw overrides setStopped()
+ // This value is re-sync'd to the value of mStopped
+ // in the handling of mReportNextDraw post-draw.
+ mAttachInfo.mHardwareRenderer.setStopped(false);
+ }
+
mAttachInfo.mHardwareRenderer.draw(mView, mAttachInfo, this);
if (updated) {