aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/cyanogenmod/wallpapers/photophase
diff options
context:
space:
mode:
authorJorge Ruesga <jorge@ruesga.com>2013-08-20 04:30:46 +0200
committerJorge Ruesga <jorge@ruesga.com>2013-08-20 04:30:46 +0200
commited09bbd4f29dc28dcfb98147143dfcdc3291f52d (patch)
tree2dea3018a2bf7a0ec0fad37b4c6a2458ac31a141 /src/org/cyanogenmod/wallpapers/photophase
parent3b5593668c83fc9990c7c2c9bd3d576c66a0e9d5 (diff)
downloadandroid_packages_wallpapers_PhotoPhase-ed09bbd4f29dc28dcfb98147143dfcdc3291f52d.tar.gz
android_packages_wallpapers_PhotoPhase-ed09bbd4f29dc28dcfb98147143dfcdc3291f52d.tar.bz2
android_packages_wallpapers_PhotoPhase-ed09bbd4f29dc28dcfb98147143dfcdc3291f52d.zip
More recycle stuff (#26)
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Diffstat (limited to 'src/org/cyanogenmod/wallpapers/photophase')
-rw-r--r--src/org/cyanogenmod/wallpapers/photophase/TextureManager.java3
-rw-r--r--src/org/cyanogenmod/wallpapers/photophase/shapes/OopsShape.java9
-rw-r--r--src/org/cyanogenmod/wallpapers/photophase/utils/BitmapUtils.java13
-rw-r--r--src/org/cyanogenmod/wallpapers/photophase/utils/GLESUtil.java2
4 files changed, 20 insertions, 7 deletions
diff --git a/src/org/cyanogenmod/wallpapers/photophase/TextureManager.java b/src/org/cyanogenmod/wallpapers/photophase/TextureManager.java
index 8f17162..4d4414c 100644
--- a/src/org/cyanogenmod/wallpapers/photophase/TextureManager.java
+++ b/src/org/cyanogenmod/wallpapers/photophase/TextureManager.java
@@ -100,6 +100,7 @@ public class TextureManager implements OnMediaPictureDiscoveredListener {
}
if (oldTextureInfo.bitmap != null) {
oldTextureInfo.bitmap.recycle();
+ oldTextureInfo.bitmap = null;
}
}
} else {
@@ -287,6 +288,7 @@ public class TextureManager implements OnMediaPictureDiscoveredListener {
}
// Return the bitmap
info.bitmap.recycle();
+ info.bitmap = null;
}
} catch (EmptyQueueException eqex) {
// Ignore
@@ -294,6 +296,7 @@ public class TextureManager implements OnMediaPictureDiscoveredListener {
// Recycle the bitmaps
for (GLESTextureInfo ti : sRecycledBitmaps) {
ti.bitmap.recycle();
+ ti.bitmap = null;
}
sRecycledBitmaps.clear();
diff --git a/src/org/cyanogenmod/wallpapers/photophase/shapes/OopsShape.java b/src/org/cyanogenmod/wallpapers/photophase/shapes/OopsShape.java
index 838acd9..ad69687 100644
--- a/src/org/cyanogenmod/wallpapers/photophase/shapes/OopsShape.java
+++ b/src/org/cyanogenmod/wallpapers/photophase/shapes/OopsShape.java
@@ -136,10 +136,17 @@ public class OopsShape implements DrawableShape {
mMessage = ctx.getString(resourceMessageId);
// Load the textures
- mOopsImageTexture = GLESUtil.loadTexture(ctx, R.drawable.bg_cid_oops, null, null, true);
+ mOopsImageTexture = GLESUtil.loadTexture(ctx, R.drawable.bg_cid_oops, null, null, false);
Bitmap textBitmap = text2Bitmap(ctx, mMessage);
mOopsTextTexture = GLESUtil.loadTexture(textBitmap, null, null);
+
+ // Recycle
+ mOopsImageTexture.bitmap.recycle();
+ mOopsImageTexture.bitmap = null;
textBitmap.recycle();
+ textBitmap = null;
+ mOopsTextTexture.bitmap.recycle();
+ mOopsTextTexture.bitmap = null;
}
/**
diff --git a/src/org/cyanogenmod/wallpapers/photophase/utils/BitmapUtils.java b/src/org/cyanogenmod/wallpapers/photophase/utils/BitmapUtils.java
index 81b0bcf..f7b32b5 100644
--- a/src/org/cyanogenmod/wallpapers/photophase/utils/BitmapUtils.java
+++ b/src/org/cyanogenmod/wallpapers/photophase/utils/BitmapUtils.java
@@ -77,7 +77,12 @@ public class BitmapUtils {
}
// Test if the bitmap has exif format, and decode properly
- return decodeExifBitmap(file, bitmap);
+ Bitmap out = decodeExifBitmap(file, bitmap);
+ if (!out.equals(bitmap)) {
+ bitmap.recycle();
+ bitmap = null;
+ }
+ return out;
}
/**
@@ -104,11 +109,7 @@ public class BitmapUtils {
matrix.postRotate(270);
}
// Rotate the bitmap
- Bitmap out = Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), matrix, true);
- if (!out.equals(src)) {
- src.recycle();
- }
- return out;
+ return Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), matrix, true);
} catch (IOException e) {
// Ignore
}
diff --git a/src/org/cyanogenmod/wallpapers/photophase/utils/GLESUtil.java b/src/org/cyanogenmod/wallpapers/photophase/utils/GLESUtil.java
index ec5834f..a62afe7 100644
--- a/src/org/cyanogenmod/wallpapers/photophase/utils/GLESUtil.java
+++ b/src/org/cyanogenmod/wallpapers/photophase/utils/GLESUtil.java
@@ -341,6 +341,7 @@ public final class GLESUtil {
// Recycle the bitmap
if (bitmap != null && recycle) {
bitmap.recycle();
+ bitmap = null;
}
}
}
@@ -390,6 +391,7 @@ public final class GLESUtil {
// Recycle the bitmap
if (bitmap != null && recycle) {
bitmap.recycle();
+ bitmap = null;
}
}
}