diff options
author | Angus Kong <shkong@google.com> | 2013-06-26 11:25:09 -0700 |
---|---|---|
committer | Angus Kong <shkong@google.com> | 2013-06-26 11:25:09 -0700 |
commit | c285458f6809d43333e3ada8790bddac17912e5a (patch) | |
tree | 5b505b71f636672bc2e8eb8a028edf475f35716f /src/com/android/camera/data/LocalData.java | |
parent | a6d9b6f18770fd279fa8dca994e5f92719350697 (diff) | |
download | android_packages_apps_Snap-c285458f6809d43333e3ada8790bddac17912e5a.tar.gz android_packages_apps_Snap-c285458f6809d43333e3ada8790bddac17912e5a.tar.bz2 android_packages_apps_Snap-c285458f6809d43333e3ada8790bddac17912e5a.zip |
Fix check of failing decoding boundaries calls
Change-Id: I7b7780de9988312f9ce79c2a27132b7f6acb1c4e
Diffstat (limited to 'src/com/android/camera/data/LocalData.java')
-rw-r--r-- | src/com/android/camera/data/LocalData.java | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/com/android/camera/data/LocalData.java b/src/com/android/camera/data/LocalData.java index d509dc8ac..216c25a07 100644 --- a/src/com/android/camera/data/LocalData.java +++ b/src/com/android/camera/data/LocalData.java @@ -272,14 +272,16 @@ public interface LocalData extends FilmStripView.ImageData { d.width = c.getInt(COL_WIDTH); d.height = c.getInt(COL_HEIGHT); if (d.width <= 0 || d.height <= 0) { - Log.v(TAG, "warning! zero dimension for " + Log.w(TAG, "Warning! zero dimension for " + d.path + ":" + d.width + "x" + d.height); - BitmapFactory.Options opts = decodeDimension(d.path); - if (opts != null) { + BitmapFactory.Options opts = new BitmapFactory.Options(); + opts.inJustDecodeBounds = true; + BitmapFactory.decodeFile(d.path, opts); + if (opts.outWidth != -1 && opts.outHeight != -1) { d.width = opts.outWidth; d.height = opts.outHeight; } else { - Log.v(TAG, "warning! dimension decode failed for " + d.path); + Log.w(TAG, "Warning! dimension decode failed for " + d.path); Bitmap b = BitmapFactory.decodeFile(d.path); if (b == null) { return null; @@ -331,16 +333,6 @@ public interface LocalData extends FilmStripView.ImageData { return new PhotoBitmapLoadTask(v, decodeWidth, decodeHeight); } - private static BitmapFactory.Options decodeDimension(String path) { - BitmapFactory.Options opts = new BitmapFactory.Options(); - opts.inJustDecodeBounds = true; - Bitmap b = BitmapFactory.decodeFile(path, opts); - if (b == null) { - return null; - } - return opts; - } - private final class PhotoBitmapLoadTask extends BitmapLoadTask { private int mDecodeWidth; private int mDecodeHeight; |