summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/data/DecodeUtils.java
diff options
context:
space:
mode:
authorChih-Chung Chang <chihchung@google.com>2012-04-17 20:35:14 +0800
committerChih-Chung Chang <chihchung@google.com>2012-04-18 20:31:10 +0800
commit2eaa2112c460e931ad0261b408213d3d1217d96f (patch)
treee0b9a6e51284ec5e369a3d9926704b1c69190139 /src/com/android/gallery3d/data/DecodeUtils.java
parent146df37d6a6c7ca8686f5934b3d90b16c24a2583 (diff)
downloadandroid_packages_apps_Snap-2eaa2112c460e931ad0261b408213d3d1217d96f.tar.gz
android_packages_apps_Snap-2eaa2112c460e931ad0261b408213d3d1217d96f.tar.bz2
android_packages_apps_Snap-2eaa2112c460e931ad0261b408213d3d1217d96f.zip
Add thumb pool the cache Bitmap used for thumbnails.
Change-Id: Ib710f2a6fc1aa86fe4abdd18d1fa7ac71396a3b4
Diffstat (limited to 'src/com/android/gallery3d/data/DecodeUtils.java')
-rw-r--r--src/com/android/gallery3d/data/DecodeUtils.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/com/android/gallery3d/data/DecodeUtils.java b/src/com/android/gallery3d/data/DecodeUtils.java
index 319458a14..e51dc3fa9 100644
--- a/src/com/android/gallery3d/data/DecodeUtils.java
+++ b/src/com/android/gallery3d/data/DecodeUtils.java
@@ -55,6 +55,15 @@ public class DecodeUtils {
BitmapFactory.decodeFileDescriptor(fd, null, options));
}
+ public static void decodeBounds(JobContext jc, FileDescriptor fd,
+ Options options) {
+ Utils.assertTrue(options != null);
+ options.inJustDecodeBounds = true;
+ jc.setCancelListener(new DecodeCanceller(options));
+ BitmapFactory.decodeFileDescriptor(fd, null, options);
+ options.inJustDecodeBounds = false;
+ }
+
public static Bitmap decode(JobContext jc, byte[] bytes, Options options) {
return decode(jc, bytes, 0, bytes.length, options);
}
@@ -67,6 +76,15 @@ public class DecodeUtils {
BitmapFactory.decodeByteArray(bytes, offset, length, options));
}
+ public static void decodeBounds(JobContext jc, byte[] bytes, int offset,
+ int length, Options options) {
+ Utils.assertTrue(options != null);
+ options.inJustDecodeBounds = true;
+ jc.setCancelListener(new DecodeCanceller(options));
+ BitmapFactory.decodeByteArray(bytes, offset, length, options);
+ options.inJustDecodeBounds = false;
+ }
+
public static Bitmap decodeThumbnail(
JobContext jc, String filePath, Options options, int targetSize, int type) {
FileInputStream fis = null;