diff options
Diffstat (limited to 'src/org/cyanogenmod/wallpapers/photophase/PhotoFrame.java')
-rw-r--r-- | src/org/cyanogenmod/wallpapers/photophase/PhotoFrame.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/org/cyanogenmod/wallpapers/photophase/PhotoFrame.java b/src/org/cyanogenmod/wallpapers/photophase/PhotoFrame.java index e1ddea7..78fc265 100644 --- a/src/org/cyanogenmod/wallpapers/photophase/PhotoFrame.java +++ b/src/org/cyanogenmod/wallpapers/photophase/PhotoFrame.java @@ -136,10 +136,16 @@ public class PhotoFrame implements TextureRequestor { */ private void setTextureHandle(GLESTextureInfo ti, final float[] textureCoords) { // Recycle the previous handle - if (mTextureInfo != null && mTextureInfo.handle != 0) { - int[] textures = new int[]{mTextureInfo.handle}; - GLES20.glDeleteTextures(1, textures, 0); - GLESUtil.glesCheckError("glDeleteTextures"); + if (mTextureInfo != null) { + if (GLES20.glIsTexture(mTextureInfo.handle)) { + int[] textures = new int[]{mTextureInfo.handle}; + GLES20.glDeleteTextures(1, textures, 0); + GLESUtil.glesCheckError("glDeleteTextures"); + } + if (mTextureInfo.bitmap != null) { + mTextureInfo.bitmap.recycle(); + mTextureInfo.bitmap = null; + } } // Initialize vertex byte buffer for shape coordinates |