summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorMichael Wright <michaelwr@google.com>2015-01-14 21:21:39 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-01-14 21:21:40 +0000
commiteec75faaa25b5da3382cf0925a65e9e6bd90fdc9 (patch)
tree2712c5e85eb835981b0398e63a448ef1a3b4ad7b /packages
parentc8ba2e87a40eb70ad22c62b9768e7691e3ff3bc3 (diff)
parent2ed0513f20dea3ba97d09b528879301c86f31884 (diff)
downloadframeworks_base-eec75faaa25b5da3382cf0925a65e9e6bd90fdc9.zip
frameworks_base-eec75faaa25b5da3382cf0925a65e9e6bd90fdc9.tar.gz
frameworks_base-eec75faaa25b5da3382cf0925a65e9e6bd90fdc9.tar.bz2
Merge "Clean up graphics resources." into lmp-mr1-dev
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/ImageWallpaper.java46
1 files changed, 9 insertions, 37 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
index 0516768..7c725b3 100644
--- a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
+++ b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
@@ -105,10 +105,6 @@ public class ImageWallpaper extends WallpaperService {
static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
static final int EGL_OPENGL_ES2_BIT = 4;
- // TODO: Not currently used, keeping around until we know we don't need it
- @SuppressWarnings({"UnusedDeclaration"})
- private WallpaperObserver mReceiver;
-
Bitmap mBackground;
int mBackgroundWidth = -1, mBackgroundHeight = -1;
int mLastSurfaceWidth = -1, mLastSurfaceHeight = -1;
@@ -151,22 +147,6 @@ public class ImageWallpaper extends WallpaperService {
private static final int TRIANGLE_VERTICES_DATA_POS_OFFSET = 0;
private static final int TRIANGLE_VERTICES_DATA_UV_OFFSET = 3;
- class WallpaperObserver extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
- if (DEBUG) {
- Log.d(TAG, "onReceive");
- }
-
- mLastSurfaceWidth = mLastSurfaceHeight = -1;
- mBackground = null;
- mBackgroundWidth = -1;
- mBackgroundHeight = -1;
- mRedrawNeeded = true;
- drawFrame();
- }
- }
-
public DrawableEngine() {
super();
setFixedSizeAllowed(true);
@@ -194,12 +174,6 @@ public class ImageWallpaper extends WallpaperService {
super.onCreate(surfaceHolder);
- // TODO: Don't need this currently because the wallpaper service
- // will restart the image wallpaper whenever the image changes.
- //IntentFilter filter = new IntentFilter(Intent.ACTION_WALLPAPER_CHANGED);
- //mReceiver = new WallpaperObserver();
- //registerReceiver(mReceiver, filter, null, mHandler);
-
updateSurfaceSize(surfaceHolder);
setOffsetNotificationsEnabled(false);
@@ -208,9 +182,6 @@ public class ImageWallpaper extends WallpaperService {
@Override
public void onDestroy() {
super.onDestroy();
- if (mReceiver != null) {
- unregisterReceiver(mReceiver);
- }
mBackground = null;
mWallpaperManager.forgetLoadedWallpaper();
}
@@ -562,7 +533,7 @@ public class ImageWallpaper extends WallpaperService {
boolean status = mEgl.eglSwapBuffers(mEglDisplay, mEglSurface);
checkEglError();
- finishGL();
+ finishGL(texture, program);
return status;
}
@@ -615,21 +586,18 @@ public class ImageWallpaper extends WallpaperService {
int program = glCreateProgram();
glAttachShader(program, vertexShader);
- checkGlError();
-
glAttachShader(program, fragmentShader);
- checkGlError();
-
glLinkProgram(program);
checkGlError();
+ glDeleteShader(vertexShader);
+ glDeleteShader(fragmentShader);
+
int[] status = new int[1];
glGetProgramiv(program, GL_LINK_STATUS, status, 0);
if (status[0] != GL_TRUE) {
String error = glGetProgramInfoLog(program);
Log.d(GL_LOG_TAG, "Error while linking program:\n" + error);
- glDeleteShader(vertexShader);
- glDeleteShader(fragmentShader);
glDeleteProgram(program);
return 0;
}
@@ -672,7 +640,11 @@ public class ImageWallpaper extends WallpaperService {
}
}
- private void finishGL() {
+ private void finishGL(int texture, int program) {
+ int[] textures = new int[1];
+ textures[0] = texture;
+ glDeleteTextures(1, textures, 0);
+ glDeleteProgram(program);
mEgl.eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
mEgl.eglDestroySurface(mEglDisplay, mEglSurface);
mEgl.eglDestroyContext(mEglDisplay, mEglContext);