diff options
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/view/ThreadedRenderer.java | 15 | ||||
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 19 |
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 2ce43c824e89..e9ca62333daa 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -1080,13 +1080,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); } } } @@ -2556,6 +2559,7 @@ public final class ViewRootImpl implements ViewParent, if (mAttachInfo.mHardwareRenderer != null) { mAttachInfo.mHardwareRenderer.fence(); + mAttachInfo.mHardwareRenderer.setStopped(mStopped); } if (LOCAL_LOGV) { @@ -2705,6 +2709,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) { |
