aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/cyanogenmod/wallpapers/photophase/TextureManager.java
diff options
context:
space:
mode:
authorJorge Ruesga <jorge@ruesga.com>2013-08-15 00:18:57 +0200
committerJorge Ruesga <jorge@ruesga.com>2013-08-15 00:18:57 +0200
commit0539d1a6b4425d60b71ebe5d003f09472ae72814 (patch)
tree58465ae899cbde0a0ce9ce0357ae07d1dab83418 /src/org/cyanogenmod/wallpapers/photophase/TextureManager.java
parentbbeefc54e76e80f6c776813c80ab6e58dd4eddc1 (diff)
downloadandroid_packages_wallpapers_PhotoPhase-0539d1a6b4425d60b71ebe5d003f09472ae72814.tar.gz
android_packages_wallpapers_PhotoPhase-0539d1a6b4425d60b71ebe5d003f09472ae72814.tar.bz2
android_packages_wallpapers_PhotoPhase-0539d1a6b4425d60b71ebe5d003f09472ae72814.zip
Fix queue image effect when aspect ratio isn't select
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Diffstat (limited to 'src/org/cyanogenmod/wallpapers/photophase/TextureManager.java')
-rw-r--r--src/org/cyanogenmod/wallpapers/photophase/TextureManager.java21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/org/cyanogenmod/wallpapers/photophase/TextureManager.java b/src/org/cyanogenmod/wallpapers/photophase/TextureManager.java
index d15632b..501ed25 100644
--- a/src/org/cyanogenmod/wallpapers/photophase/TextureManager.java
+++ b/src/org/cyanogenmod/wallpapers/photophase/TextureManager.java
@@ -74,7 +74,7 @@ public class TextureManager implements OnMediaPictureDiscoveredListener {
*/
/*package*/ class PictureDispatcher implements Runnable {
File mImage;
- GLESTextureInfo ti;
+ GLESTextureInfo ti = null;
final Object mWait = new Object();
/**
@@ -96,9 +96,14 @@ public class TextureManager implements OnMediaPictureDiscoveredListener {
}
} else {
// Load and bind to the GLES context. The effect is applied when the image
- // is associated to the destination target
- ti = GLESUtil.loadTexture(mImage, mDimensions, null, null, false);
- ti.effect = effect;
+ // is associated to the destination target (only if aspect ratio will be applied)
+ if (!Preferences.General.isFixAspectRatio()) {
+ ti = GLESUtil.loadTexture(
+ mImage, mDimensions, effect, mScreenDimensions, false);
+ } else {
+ ti = GLESUtil.loadTexture(mImage, mDimensions, null, null, false);
+ ti.effect = effect;
+ }
}
synchronized (mSync) {
@@ -419,17 +424,17 @@ public class TextureManager implements OnMediaPictureDiscoveredListener {
// Create a thumbnail of the image
Bitmap thumb = ThumbnailUtils.extractThumbnail(
ti.bitmap,
- (int)pixels.width(),
- (int)pixels.height(),
+ pixels.width(),
+ pixels.height(),
ThumbnailUtils.OPTIONS_RECYCLE_INPUT);
GLESTextureInfo dst = GLESUtil.loadTexture(
- thumb, ti == null ? null : ti.effect, mScreenDimensions);
+ thumb, ti.effect == null ? null : ti.effect, mScreenDimensions);
// Destroy references
int[] textures = new int[]{ti.handle};
GLES20.glDeleteTextures(1, textures, 0);
GLESUtil.glesCheckError("glDeleteTextures");
- if (ti != null && ti.effect != null) {
+ if (ti.effect != null) {
ti.effect.release();
}