Loading core/java/android/view/HardwareRenderer.java +14 −24 Original line number Diff line number Diff line Loading @@ -53,8 +53,10 @@ public abstract class HardwareRenderer { /** * Destroys the hardware rendering context. * * @param full If true, destroys all associated resources. */ abstract void destroy(); abstract void destroy(boolean full); /** * Initializes the hardware renderer for the specified surface. Loading Loading @@ -187,7 +189,7 @@ public abstract class HardwareRenderer { } /** * Checks for OpenGL errors. If an error has occured, {@link #destroy()} * Checks for OpenGL errors. If an error has occured, {@link #destroy(boolean)} * is invoked and the requested flag is turned off. The error code is * also logged as a warning. */ Loading @@ -197,7 +199,7 @@ public abstract class HardwareRenderer { if (error != EGL10.EGL_SUCCESS) { // something bad has happened revert to // normal rendering. destroy(); destroy(true); if (error != EGL11.EGL_CONTEXT_LOST) { // we'll try again if it was context lost setRequested(false); Loading @@ -217,13 +219,12 @@ public abstract class HardwareRenderer { if (mGl != null) { int err = sEgl.eglGetError(); if (err != EGL10.EGL_SUCCESS) { destroy(); destroy(true); setRequested(false); } else { if (mCanvas != null) { destroyCanvas(); } if (mCanvas == null) { mCanvas = createCanvas(); } if (mCanvas != null) { setEnabled(true); } else { Loading @@ -237,11 +238,6 @@ public abstract class HardwareRenderer { return false; } private void destroyCanvas() { mCanvas.destroy(); mCanvas = null; } abstract GLES20Canvas createCanvas(); void initializeEgl() { Loading Loading @@ -341,16 +337,16 @@ public abstract class HardwareRenderer { } @Override void destroy() { void destroy(boolean full) { if (full && mCanvas != null) { mCanvas.destroy(); mCanvas = null; } if (!isEnabled() || mDestroyed) return; mDestroyed = true; checkCurrent(); // Destroy the Canvas first in case it needs to use a GL context // to perform its cleanup. destroyCanvas(); sEgl.eglMakeCurrent(sEglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); sEgl.eglDestroySurface(sEglDisplay, mEglSurface); Loading @@ -358,12 +354,6 @@ public abstract class HardwareRenderer { mEglSurface = null; mGl = null; // mEgl.eglDestroyContext(mEglDisplay, mEglContext); // mEglContext = null; // mEgl.eglTerminate(mEglDisplay); // mEgl = null; // mEglDisplay = null; setEnabled(false); } Loading core/java/android/view/ViewRoot.java +11 −11 Original line number Diff line number Diff line Loading @@ -469,7 +469,9 @@ public final class ViewRoot extends Handler implements ViewParent, View.AttachIn if (attrs != null && (attrs.flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) != 0) { final boolean translucent = attrs.format != PixelFormat.OPAQUE; destroyHardwareRenderer(); if (mHwRenderer != null) { mHwRenderer.destroy(true); } mHwRenderer = HardwareRenderer.createGlRenderer(2, translucent); } } Loading Loading @@ -678,7 +680,9 @@ public final class ViewRoot extends Handler implements ViewParent, View.AttachIn attachInfo.mWindowVisibility = viewVisibility; host.dispatchWindowVisibilityChanged(viewVisibility); if (viewVisibility != View.VISIBLE || mNewSurfaceNeeded) { destroyHardwareRenderer(); if (mHwRenderer != null) { mHwRenderer.destroy(false); } } if (viewVisibility == View.GONE) { // After making a window gone, we will count it as being Loading Loading @@ -1597,8 +1601,10 @@ public final class ViewRoot extends Handler implements ViewParent, View.AttachIn mAttachInfo.mRootView = null; mAttachInfo.mSurface = null; destroyHardwareRenderer(); if (mHwRenderer != null) { mHwRenderer.destroy(true); mHwRenderer = null; } mSurface.release(); Loading @@ -1624,12 +1630,6 @@ public final class ViewRoot extends Handler implements ViewParent, View.AttachIn } } private void destroyHardwareRenderer() { if (mHwRenderer != null) { mHwRenderer.destroy(); } } void updateConfiguration(Configuration config, boolean force) { if (DEBUG_CONFIGURATION) Log.v(TAG, "Applying new config to window " Loading Loading
core/java/android/view/HardwareRenderer.java +14 −24 Original line number Diff line number Diff line Loading @@ -53,8 +53,10 @@ public abstract class HardwareRenderer { /** * Destroys the hardware rendering context. * * @param full If true, destroys all associated resources. */ abstract void destroy(); abstract void destroy(boolean full); /** * Initializes the hardware renderer for the specified surface. Loading Loading @@ -187,7 +189,7 @@ public abstract class HardwareRenderer { } /** * Checks for OpenGL errors. If an error has occured, {@link #destroy()} * Checks for OpenGL errors. If an error has occured, {@link #destroy(boolean)} * is invoked and the requested flag is turned off. The error code is * also logged as a warning. */ Loading @@ -197,7 +199,7 @@ public abstract class HardwareRenderer { if (error != EGL10.EGL_SUCCESS) { // something bad has happened revert to // normal rendering. destroy(); destroy(true); if (error != EGL11.EGL_CONTEXT_LOST) { // we'll try again if it was context lost setRequested(false); Loading @@ -217,13 +219,12 @@ public abstract class HardwareRenderer { if (mGl != null) { int err = sEgl.eglGetError(); if (err != EGL10.EGL_SUCCESS) { destroy(); destroy(true); setRequested(false); } else { if (mCanvas != null) { destroyCanvas(); } if (mCanvas == null) { mCanvas = createCanvas(); } if (mCanvas != null) { setEnabled(true); } else { Loading @@ -237,11 +238,6 @@ public abstract class HardwareRenderer { return false; } private void destroyCanvas() { mCanvas.destroy(); mCanvas = null; } abstract GLES20Canvas createCanvas(); void initializeEgl() { Loading Loading @@ -341,16 +337,16 @@ public abstract class HardwareRenderer { } @Override void destroy() { void destroy(boolean full) { if (full && mCanvas != null) { mCanvas.destroy(); mCanvas = null; } if (!isEnabled() || mDestroyed) return; mDestroyed = true; checkCurrent(); // Destroy the Canvas first in case it needs to use a GL context // to perform its cleanup. destroyCanvas(); sEgl.eglMakeCurrent(sEglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); sEgl.eglDestroySurface(sEglDisplay, mEglSurface); Loading @@ -358,12 +354,6 @@ public abstract class HardwareRenderer { mEglSurface = null; mGl = null; // mEgl.eglDestroyContext(mEglDisplay, mEglContext); // mEglContext = null; // mEgl.eglTerminate(mEglDisplay); // mEgl = null; // mEglDisplay = null; setEnabled(false); } Loading
core/java/android/view/ViewRoot.java +11 −11 Original line number Diff line number Diff line Loading @@ -469,7 +469,9 @@ public final class ViewRoot extends Handler implements ViewParent, View.AttachIn if (attrs != null && (attrs.flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) != 0) { final boolean translucent = attrs.format != PixelFormat.OPAQUE; destroyHardwareRenderer(); if (mHwRenderer != null) { mHwRenderer.destroy(true); } mHwRenderer = HardwareRenderer.createGlRenderer(2, translucent); } } Loading Loading @@ -678,7 +680,9 @@ public final class ViewRoot extends Handler implements ViewParent, View.AttachIn attachInfo.mWindowVisibility = viewVisibility; host.dispatchWindowVisibilityChanged(viewVisibility); if (viewVisibility != View.VISIBLE || mNewSurfaceNeeded) { destroyHardwareRenderer(); if (mHwRenderer != null) { mHwRenderer.destroy(false); } } if (viewVisibility == View.GONE) { // After making a window gone, we will count it as being Loading Loading @@ -1597,8 +1601,10 @@ public final class ViewRoot extends Handler implements ViewParent, View.AttachIn mAttachInfo.mRootView = null; mAttachInfo.mSurface = null; destroyHardwareRenderer(); if (mHwRenderer != null) { mHwRenderer.destroy(true); mHwRenderer = null; } mSurface.release(); Loading @@ -1624,12 +1630,6 @@ public final class ViewRoot extends Handler implements ViewParent, View.AttachIn } } private void destroyHardwareRenderer() { if (mHwRenderer != null) { mHwRenderer.destroy(); } } void updateConfiguration(Configuration config, boolean force) { if (DEBUG_CONFIGURATION) Log.v(TAG, "Applying new config to window " Loading