aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Ruesga <jorge@ruesga.com>2013-07-30 00:34:11 +0200
committerJorge Ruesga <jorge@ruesga.com>2013-07-30 00:34:11 +0200
commitfc76ec47b6a9d20b5ca42052f8e17d04c6b19cb7 (patch)
treec031ec20a90f9168d9dbaafaae7ce26fd221ab85
parenta1feb07bb2866d3d6fccca2fb5ffd2f12e9ff51c (diff)
downloadandroid_packages_wallpapers_PhotoPhase-fc76ec47b6a9d20b5ca42052f8e17d04c6b19cb7.tar.gz
android_packages_wallpapers_PhotoPhase-fc76ec47b6a9d20b5ca42052f8e17d04c6b19cb7.tar.bz2
android_packages_wallpapers_PhotoPhase-fc76ec47b6a9d20b5ca42052f8e17d04c6b19cb7.zip
Improve bitmap loading
- No force to loaded with a specific format (this avoid some bad formats on exif jpegs) - Remove unused comments and imports Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
-rw-r--r--src/org/cyanogenmod/wallpapers/photophase/BitmapUtils.java8
-rw-r--r--src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseWallpaperWorld.java22
-rw-r--r--src/org/cyanogenmod/wallpapers/photophase/transitions/NullTransition.java12
3 files changed, 6 insertions, 36 deletions
diff --git a/src/org/cyanogenmod/wallpapers/photophase/BitmapUtils.java b/src/org/cyanogenmod/wallpapers/photophase/BitmapUtils.java
index 8a2459c..b79db7b 100644
--- a/src/org/cyanogenmod/wallpapers/photophase/BitmapUtils.java
+++ b/src/org/cyanogenmod/wallpapers/photophase/BitmapUtils.java
@@ -56,8 +56,6 @@ public class BitmapUtils {
// First decode with inJustDecodeBounds=true to check dimensions
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
- options.inPreferQualityOverSpeed = false;
- options.inPreferredConfig = Bitmap.Config.RGB_565;
BitmapFactory.decodeFile(file.getAbsolutePath(), options);
// Calculate inSampleSize
@@ -65,12 +63,16 @@ public class BitmapUtils {
// Decode the bitmap with inSampleSize set
options.inJustDecodeBounds = false;
+ options.inPreferQualityOverSpeed = false;
+ options.inPurgeable = true;
+ options.inInputShareable = true;
+ options.inDither = true;
Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath(), options);
if (bitmap == null) {
return null;
}
- //Test if the file has exif format
+ // Test if the bitmap has exif format, and decode properly
return decodeExifBitmap(file, bitmap);
}
diff --git a/src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseWallpaperWorld.java b/src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseWallpaperWorld.java
index 9b13c4b..6e96c68 100644
--- a/src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseWallpaperWorld.java
+++ b/src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseWallpaperWorld.java
@@ -327,28 +327,6 @@ public class PhotoPhaseWallpaperWorld {
1.0f - (y * cellh),
0.0f
};
-// return new float[]
-// {
-// // top left
-// -1.0f,
-// -1.0f,
-// 0.0f,
-//
-// // bottom left
-// -1.0f,
-// 1.0f,
-// 0.0f,
-//
-// // bottom right
-// 1.0f,
-// 1.0f,
-// 0.0f,
-//
-// // top right
-// 1.0f,
-// -1.0f,
-// 0.0f
-// };
}
/**
diff --git a/src/org/cyanogenmod/wallpapers/photophase/transitions/NullTransition.java b/src/org/cyanogenmod/wallpapers/photophase/transitions/NullTransition.java
index 3087a38..0332bc5 100644
--- a/src/org/cyanogenmod/wallpapers/photophase/transitions/NullTransition.java
+++ b/src/org/cyanogenmod/wallpapers/photophase/transitions/NullTransition.java
@@ -27,9 +27,6 @@ import org.cyanogenmod.wallpapers.photophase.TextureManager;
import org.cyanogenmod.wallpapers.photophase.transitions.Transitions.TRANSITIONS;
import java.nio.FloatBuffer;
-
-import javax.microedition.khronos.opengles.GL10;
-
/**
* A special transition that does nothing other than draw the {@link PhotoFrame}
* on the screen continually. No transition is done.
@@ -164,14 +161,7 @@ public class NullTransition extends Transition {
GLESUtil.glesCheckError("glUniformMatrix4fv");
// Draw the photo frame
-// ShortBuffer vertexOrderBuffer = target.getVertexOrderBuffer();
-// vertexOrderBuffer.position(0);
-// GLES20.glDrawElements(
-// GLES20.GL_TRIANGLE_FAN,
-// 6,
-// GLES20.GL_UNSIGNED_SHORT,
-// vertexOrderBuffer);
- GLES20.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);
+ GLES20.glDrawArrays(GLES20.GL_TRIANGLE_FAN, 0, 4);
GLESUtil.glesCheckError("glDrawElements");
// Disable attributes