diff options
-rw-r--r-- | core/java/android/view/HardwareRenderer.java | 82 | ||||
-rw-r--r-- | preloaded-classes | 6 |
2 files changed, 46 insertions, 42 deletions
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java index 49673ef..011e44c 100644 --- a/core/java/android/view/HardwareRenderer.java +++ b/core/java/android/view/HardwareRenderer.java @@ -32,8 +32,6 @@ import javax.microedition.khronos.egl.EGLDisplay; import javax.microedition.khronos.egl.EGLSurface; import javax.microedition.khronos.opengles.GL; -import static javax.microedition.khronos.egl.EGL10.*; - /** * Interface for rendering a ViewAncestor using hardware acceleration. * @@ -375,33 +373,33 @@ public abstract class HardwareRenderer { */ static String getEGLErrorString(int error) { switch (error) { - case EGL_SUCCESS: + case EGL10.EGL_SUCCESS: return "EGL_SUCCESS"; - case EGL_NOT_INITIALIZED: + case EGL10.EGL_NOT_INITIALIZED: return "EGL_NOT_INITIALIZED"; - case EGL_BAD_ACCESS: + case EGL10.EGL_BAD_ACCESS: return "EGL_BAD_ACCESS"; - case EGL_BAD_ALLOC: + case EGL10.EGL_BAD_ALLOC: return "EGL_BAD_ALLOC"; - case EGL_BAD_ATTRIBUTE: + case EGL10.EGL_BAD_ATTRIBUTE: return "EGL_BAD_ATTRIBUTE"; - case EGL_BAD_CONFIG: + case EGL10.EGL_BAD_CONFIG: return "EGL_BAD_CONFIG"; - case EGL_BAD_CONTEXT: + case EGL10.EGL_BAD_CONTEXT: return "EGL_BAD_CONTEXT"; - case EGL_BAD_CURRENT_SURFACE: + case EGL10.EGL_BAD_CURRENT_SURFACE: return "EGL_BAD_CURRENT_SURFACE"; - case EGL_BAD_DISPLAY: + case EGL10.EGL_BAD_DISPLAY: return "EGL_BAD_DISPLAY"; - case EGL_BAD_MATCH: + case EGL10.EGL_BAD_MATCH: return "EGL_BAD_MATCH"; - case EGL_BAD_NATIVE_PIXMAP: + case EGL10.EGL_BAD_NATIVE_PIXMAP: return "EGL_BAD_NATIVE_PIXMAP"; - case EGL_BAD_NATIVE_WINDOW: + case EGL10.EGL_BAD_NATIVE_WINDOW: return "EGL_BAD_NATIVE_WINDOW"; - case EGL_BAD_PARAMETER: + case EGL10.EGL_BAD_PARAMETER: return "EGL_BAD_PARAMETER"; - case EGL_BAD_SURFACE: + case EGL10.EGL_BAD_SURFACE: return "EGL_BAD_SURFACE"; case EGL11.EGL_CONTEXT_LOST: return "EGL_CONTEXT_LOST"; @@ -418,7 +416,7 @@ public abstract class HardwareRenderer { void checkEglErrors() { if (isEnabled()) { int error = sEgl.eglGetError(); - if (error != EGL_SUCCESS) { + if (error != EGL10.EGL_SUCCESS) { // something bad has happened revert to // normal rendering. fallback(error != EGL11.EGL_CONTEXT_LOST); @@ -446,7 +444,7 @@ public abstract class HardwareRenderer { if (mGl != null) { int err = sEgl.eglGetError(); - if (err != EGL_SUCCESS) { + if (err != EGL10.EGL_SUCCESS) { destroy(true); setRequested(false); } else { @@ -482,9 +480,9 @@ public abstract class HardwareRenderer { sEgl = (EGL10) EGLContext.getEGL(); // Get to the default display. - sEglDisplay = sEgl.eglGetDisplay(EGL_DEFAULT_DISPLAY); + sEglDisplay = sEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); - if (sEglDisplay == EGL_NO_DISPLAY) { + if (sEglDisplay == EGL10.EGL_NO_DISPLAY) { throw new RuntimeException("eglGetDisplay failed " + getEGLErrorString(sEgl.eglGetError())); } @@ -552,22 +550,22 @@ public abstract class HardwareRenderer { * The window size has changed, so we need to create a new * surface. */ - if (mEglSurface != null && mEglSurface != EGL_NO_SURFACE) { + if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) { /* * Unbind and destroy the old EGL surface, if * there is one. */ - sEgl.eglMakeCurrent(sEglDisplay, EGL_NO_SURFACE, - EGL_NO_SURFACE, EGL_NO_CONTEXT); + sEgl.eglMakeCurrent(sEglDisplay, EGL10.EGL_NO_SURFACE, + EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); sEgl.eglDestroySurface(sEglDisplay, mEglSurface); } // Create an EGL surface we can render into. mEglSurface = sEgl.eglCreateWindowSurface(sEglDisplay, sEglConfig, holder, null); - if (mEglSurface == null || mEglSurface == EGL_NO_SURFACE) { + if (mEglSurface == null || mEglSurface == EGL10.EGL_NO_SURFACE) { int error = sEgl.eglGetError(); - if (error == EGL_BAD_NATIVE_WINDOW) { + if (error == EGL10.EGL_BAD_NATIVE_WINDOW) { Log.e(LOG_TAG, "createWindowSurface returned EGL_BAD_NATIVE_WINDOW."); return null; } @@ -604,9 +602,9 @@ public abstract class HardwareRenderer { } EGLContext createContext(EGL10 egl, EGLDisplay eglDisplay, EGLConfig eglConfig) { - int[] attrib_list = { EGL_CONTEXT_CLIENT_VERSION, mGlVersion, EGL_NONE }; + int[] attrib_list = { EGL_CONTEXT_CLIENT_VERSION, mGlVersion, EGL10.EGL_NONE }; - return egl.eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, + return egl.eglCreateContext(eglDisplay, eglConfig, EGL10.EGL_NO_CONTEXT, mGlVersion != 0 ? attrib_list : null); } @@ -629,8 +627,8 @@ public abstract class HardwareRenderer { mDestroyed = true; - sEgl.eglMakeCurrent(sEglDisplay, EGL_NO_SURFACE, - EGL_NO_SURFACE, EGL_NO_CONTEXT); + sEgl.eglMakeCurrent(sEglDisplay, EGL10.EGL_NO_SURFACE, + EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); sEgl.eglDestroySurface(sEglDisplay, mEglSurface); mEglSurface = null; @@ -643,8 +641,8 @@ public abstract class HardwareRenderer { void invalidate() { // Cancels any existing buffer to ensure we'll get a buffer // of the right size before we call eglSwapBuffers - sEgl.eglMakeCurrent(sEglDisplay, EGL_NO_SURFACE, - EGL_NO_SURFACE, EGL_NO_CONTEXT); + sEgl.eglMakeCurrent(sEglDisplay, EGL10.EGL_NO_SURFACE, + EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); } @Override @@ -755,7 +753,7 @@ public abstract class HardwareRenderer { } if (!sEglContext.equals(sEgl.eglGetCurrentContext()) || - !mEglSurface.equals(sEgl.eglGetCurrentSurface(EGL_DRAW))) { + !mEglSurface.equals(sEgl.eglGetCurrentSurface(EGL10.EGL_DRAW))) { if (!sEgl.eglMakeCurrent(sEglDisplay, mEglSurface, mEglSurface, sEglContext)) { fallback(true); Log.e(LOG_TAG, "eglMakeCurrent failed " + @@ -787,16 +785,16 @@ public abstract class HardwareRenderer { @Override int[] getConfig(boolean dirtyRegions) { return new int[] { - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, - EGL_RED_SIZE, 8, - EGL_GREEN_SIZE, 8, - EGL_BLUE_SIZE, 8, - EGL_ALPHA_SIZE, 8, - EGL_DEPTH_SIZE, 0, - EGL_STENCIL_SIZE, 0, - EGL_SURFACE_TYPE, EGL_WINDOW_BIT | - (dirtyRegions ? EGL_SWAP_BEHAVIOR_PRESERVED_BIT : 0), - EGL_NONE + EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, + EGL10.EGL_RED_SIZE, 8, + EGL10.EGL_GREEN_SIZE, 8, + EGL10.EGL_BLUE_SIZE, 8, + EGL10.EGL_ALPHA_SIZE, 8, + EGL10.EGL_DEPTH_SIZE, 0, + EGL10.EGL_STENCIL_SIZE, 0, + EGL_SURFACE_TYPE, EGL10.EGL_WINDOW_BIT | + (dirtyRegions ? EGL_SWAP_BEHAVIOR_PRESERVED_BIT : 0), + EGL10.EGL_NONE }; } diff --git a/preloaded-classes b/preloaded-classes index c530cd4..1eabe14 100644 --- a/preloaded-classes +++ b/preloaded-classes @@ -671,6 +671,12 @@ android.view.GLES20Canvas android.view.GLES20Canvas$CanvasFinalizer android.view.Gravity android.view.HardwareCanvas +android.view.HardwareRenderer +android.view.HardwareRenderer$Gl20Renderer +android.view.HardwareRenderer$GlRenderer +android.view.HardwareRenderer$GlRenderer$ComponentSizeChooser +android.view.HardwareRenderer$GlRenderer$EglConfigChooser +android.view.HardwareRenderer$HardwareDrawCallbacks android.view.IWindow android.view.IWindow$Stub android.view.IWindowManager |