diff options
author | Michael Wright <michaelwr@google.com> | 2015-01-14 21:26:52 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-01-14 21:26:52 +0000 |
commit | 5497e99c4a749a46b8e9f8312d01639987ba81a0 (patch) | |
tree | a0eb496a2be48ef3c389de350023605d67ac8fbc /packages/SystemUI/src | |
parent | f387d3c87a1730605726c48c7b2c2355b50f4935 (diff) | |
parent | eec75faaa25b5da3382cf0925a65e9e6bd90fdc9 (diff) | |
download | frameworks_base-5497e99c4a749a46b8e9f8312d01639987ba81a0.zip frameworks_base-5497e99c4a749a46b8e9f8312d01639987ba81a0.tar.gz frameworks_base-5497e99c4a749a46b8e9f8312d01639987ba81a0.tar.bz2 |
am eec75faa: Merge "Clean up graphics resources." into lmp-mr1-dev
* commit 'eec75faaa25b5da3382cf0925a65e9e6bd90fdc9':
Clean up graphics resources.
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/ImageWallpaper.java | 46 |
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); |