Loading packages/SystemUI/src/com/android/systemui/ImageWallpaper.java +13 −6 Original line number Original line Diff line number Diff line Loading @@ -300,7 +300,9 @@ public class ImageWallpaper extends WallpaperService { } } if (mIsHwAccelerated) { if (mIsHwAccelerated) { drawWallpaperWithOpenGL(sh, availw, availh, xPixels, yPixels); if (!drawWallpaperWithOpenGL(sh, availw, availh, xPixels, yPixels)) { drawWallpaperWithCanvas(sh, availw, availh, xPixels, yPixels); } } else { } else { drawWallpaperWithCanvas(sh, availw, availh, xPixels, yPixels); drawWallpaperWithCanvas(sh, availw, availh, xPixels, yPixels); } } Loading Loading @@ -367,8 +369,8 @@ public class ImageWallpaper extends WallpaperService { } } } } private void drawWallpaperWithOpenGL(SurfaceHolder sh, int w, int h, int left, int top) { private boolean drawWallpaperWithOpenGL(SurfaceHolder sh, int w, int h, int left, int top) { initGL(sh); if (!initGL(sh)) return false; final float right = left + mBackgroundWidth; final float right = left + mBackgroundWidth; final float bottom = top + mBackgroundHeight; final float bottom = top + mBackgroundHeight; Loading Loading @@ -423,6 +425,8 @@ public class ImageWallpaper extends WallpaperService { checkEglError(); checkEglError(); finishGL(); finishGL(); return true; } } private FloatBuffer createMesh(int left, int top, float right, float bottom) { private FloatBuffer createMesh(int left, int top, float right, float bottom) { Loading Loading @@ -533,11 +537,12 @@ public class ImageWallpaper extends WallpaperService { } } private void finishGL() { private void finishGL() { mEgl.eglDestroyContext(mEglDisplay, mEglContext); mEgl.eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); mEgl.eglDestroySurface(mEglDisplay, mEglSurface); mEgl.eglDestroySurface(mEglDisplay, mEglSurface); mEgl.eglDestroyContext(mEglDisplay, mEglContext); } } private void initGL(SurfaceHolder surfaceHolder) { private boolean initGL(SurfaceHolder surfaceHolder) { mEgl = (EGL10) EGLContext.getEGL(); mEgl = (EGL10) EGLContext.getEGL(); mEglDisplay = mEgl.eglGetDisplay(EGL_DEFAULT_DISPLAY); mEglDisplay = mEgl.eglGetDisplay(EGL_DEFAULT_DISPLAY); Loading Loading @@ -565,7 +570,7 @@ public class ImageWallpaper extends WallpaperService { int error = mEgl.eglGetError(); int error = mEgl.eglGetError(); if (error == EGL_BAD_NATIVE_WINDOW) { if (error == EGL_BAD_NATIVE_WINDOW) { Log.e(GL_LOG_TAG, "createWindowSurface returned EGL_BAD_NATIVE_WINDOW."); Log.e(GL_LOG_TAG, "createWindowSurface returned EGL_BAD_NATIVE_WINDOW."); return; return false; } } throw new RuntimeException("createWindowSurface failed " + throw new RuntimeException("createWindowSurface failed " + GLUtils.getEGLErrorString(error)); GLUtils.getEGLErrorString(error)); Loading @@ -577,6 +582,8 @@ public class ImageWallpaper extends WallpaperService { } } mGL = mEglContext.getGL(); mGL = mEglContext.getGL(); return true; } } Loading Loading
packages/SystemUI/src/com/android/systemui/ImageWallpaper.java +13 −6 Original line number Original line Diff line number Diff line Loading @@ -300,7 +300,9 @@ public class ImageWallpaper extends WallpaperService { } } if (mIsHwAccelerated) { if (mIsHwAccelerated) { drawWallpaperWithOpenGL(sh, availw, availh, xPixels, yPixels); if (!drawWallpaperWithOpenGL(sh, availw, availh, xPixels, yPixels)) { drawWallpaperWithCanvas(sh, availw, availh, xPixels, yPixels); } } else { } else { drawWallpaperWithCanvas(sh, availw, availh, xPixels, yPixels); drawWallpaperWithCanvas(sh, availw, availh, xPixels, yPixels); } } Loading Loading @@ -367,8 +369,8 @@ public class ImageWallpaper extends WallpaperService { } } } } private void drawWallpaperWithOpenGL(SurfaceHolder sh, int w, int h, int left, int top) { private boolean drawWallpaperWithOpenGL(SurfaceHolder sh, int w, int h, int left, int top) { initGL(sh); if (!initGL(sh)) return false; final float right = left + mBackgroundWidth; final float right = left + mBackgroundWidth; final float bottom = top + mBackgroundHeight; final float bottom = top + mBackgroundHeight; Loading Loading @@ -423,6 +425,8 @@ public class ImageWallpaper extends WallpaperService { checkEglError(); checkEglError(); finishGL(); finishGL(); return true; } } private FloatBuffer createMesh(int left, int top, float right, float bottom) { private FloatBuffer createMesh(int left, int top, float right, float bottom) { Loading Loading @@ -533,11 +537,12 @@ public class ImageWallpaper extends WallpaperService { } } private void finishGL() { private void finishGL() { mEgl.eglDestroyContext(mEglDisplay, mEglContext); mEgl.eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); mEgl.eglDestroySurface(mEglDisplay, mEglSurface); mEgl.eglDestroySurface(mEglDisplay, mEglSurface); mEgl.eglDestroyContext(mEglDisplay, mEglContext); } } private void initGL(SurfaceHolder surfaceHolder) { private boolean initGL(SurfaceHolder surfaceHolder) { mEgl = (EGL10) EGLContext.getEGL(); mEgl = (EGL10) EGLContext.getEGL(); mEglDisplay = mEgl.eglGetDisplay(EGL_DEFAULT_DISPLAY); mEglDisplay = mEgl.eglGetDisplay(EGL_DEFAULT_DISPLAY); Loading Loading @@ -565,7 +570,7 @@ public class ImageWallpaper extends WallpaperService { int error = mEgl.eglGetError(); int error = mEgl.eglGetError(); if (error == EGL_BAD_NATIVE_WINDOW) { if (error == EGL_BAD_NATIVE_WINDOW) { Log.e(GL_LOG_TAG, "createWindowSurface returned EGL_BAD_NATIVE_WINDOW."); Log.e(GL_LOG_TAG, "createWindowSurface returned EGL_BAD_NATIVE_WINDOW."); return; return false; } } throw new RuntimeException("createWindowSurface failed " + throw new RuntimeException("createWindowSurface failed " + GLUtils.getEGLErrorString(error)); GLUtils.getEGLErrorString(error)); Loading @@ -577,6 +582,8 @@ public class ImageWallpaper extends WallpaperService { } } mGL = mEglContext.getGL(); mGL = mEglContext.getGL(); return true; } } Loading