summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/ImageWallpaper.java38
1 files changed, 24 insertions, 14 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
index 29b2a5c8dc8c..627235f1e03b 100644
--- a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
+++ b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
@@ -632,6 +632,30 @@ public class ImageWallpaper extends WallpaperService {
GLUtils.getEGLErrorString(mEgl.eglGetError()));
}
+ int attribs[] = {
+ EGL_WIDTH, 1,
+ EGL_HEIGHT, 1,
+ EGL_NONE
+ };
+ EGLSurface tmpSurface = mEgl.eglCreatePbufferSurface(mEglDisplay, mEglConfig, attribs);
+ mEgl.eglMakeCurrent(mEglDisplay, tmpSurface, tmpSurface, mEglContext);
+
+ int[] maxSize = new int[1];
+ Rect frame = surfaceHolder.getSurfaceFrame();
+ glGetIntegerv(GL_MAX_TEXTURE_SIZE, maxSize, 0);
+
+ mEgl.eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ mEgl.eglDestroySurface(mEglDisplay, tmpSurface);
+
+ if(frame.width() > maxSize[0] || frame.height() > maxSize[0]) {
+ mEgl.eglDestroyContext(mEglDisplay, mEglContext);
+ mEgl.eglTerminate(mEglDisplay);
+ Log.e(GL_LOG_TAG, "requested texture size " +
+ frame.width() + "x" + frame.height() + " exceeds the support maximum of " +
+ maxSize[0] + "x" + maxSize[0]);
+ return false;
+ }
+
mEglSurface = mEgl.eglCreateWindowSurface(mEglDisplay, mEglConfig, surfaceHolder, null);
if (mEglSurface == null || mEglSurface == EGL_NO_SURFACE) {
int error = mEgl.eglGetError();
@@ -649,20 +673,6 @@ public class ImageWallpaper extends WallpaperService {
GLUtils.getEGLErrorString(mEgl.eglGetError()));
}
- int[] maxSize = new int[1];
- Rect frame = surfaceHolder.getSurfaceFrame();
- glGetIntegerv(GL_MAX_TEXTURE_SIZE, maxSize, 0);
- if(frame.width() > maxSize[0] || frame.height() > maxSize[0]) {
- mEgl.eglDestroySurface(mEglDisplay, mEglSurface);
- mEgl.eglMakeCurrent(EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
- mEgl.eglDestroyContext(mEglDisplay, mEglContext);
- mEgl.eglTerminate(mEglDisplay);
- Log.e(GL_LOG_TAG, "requested texture size " +
- frame.width() + "x" + frame.height() + " exceeds the support maximum of " +
- maxSize[0] + "x" + maxSize[0]);
- return false;
- }
-
return true;
}