diff options
author | Chih-Chung Chang <chihchung@google.com> | 2009-07-24 10:58:40 +0800 |
---|---|---|
committer | Chih-Chung Chang <chihchung@google.com> | 2009-07-24 15:42:52 +0800 |
commit | 4250e214f539a3caee1434889c5660d594b45dfd (patch) | |
tree | 58a11701ddcec57d12091c94b8ccc549a89a5a32 /src/com/android/camera/Util.java | |
parent | d06aa697fb037b92b40b8e1ae6ab7db5c5b64d13 (diff) | |
download | packages_apps_LegacyCamera-4250e214f539a3caee1434889c5660d594b45dfd.zip packages_apps_LegacyCamera-4250e214f539a3caee1434889c5660d594b45dfd.tar.gz packages_apps_LegacyCamera-4250e214f539a3caee1434889c5660d594b45dfd.tar.bz2 |
Simplify ImageGetter.
Diffstat (limited to 'src/com/android/camera/Util.java')
-rw-r--r-- | src/com/android/camera/Util.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/com/android/camera/Util.java b/src/com/android/camera/Util.java index 356426f..cefc6d8 100644 --- a/src/com/android/camera/Util.java +++ b/src/com/android/camera/Util.java @@ -302,10 +302,19 @@ public class Util { */ public static Bitmap makeBitmap(int targetWidthOrHeight, Uri uri, ContentResolver cr) { + return makeBitmap(targetWidthOrHeight, uri, cr, false); + } + + public static Bitmap makeBitmap(int targetWidthOrHeight, Uri uri, + ContentResolver cr, boolean useNative) { ParcelFileDescriptor input = null; try { input = cr.openFileDescriptor(uri, "r"); - return makeBitmap(targetWidthOrHeight, uri, cr, input, null); + BitmapFactory.Options options = null; + if (useNative) { + options = createNativeAllocOptions(); + } + return makeBitmap(targetWidthOrHeight, uri, cr, input, options); } catch (IOException ex) { return null; } finally { @@ -313,6 +322,15 @@ public class Util { } } + public static Bitmap makeBitmap(int targetWidthHeight, + ParcelFileDescriptor pfd, boolean useNative) { + BitmapFactory.Options options = null; + if (useNative) { + options = createNativeAllocOptions(); + } + return makeBitmap(targetWidthHeight, null, null, pfd, options); + } + public static Bitmap makeBitmap(int targetWidthHeight, Uri uri, ContentResolver cr, ParcelFileDescriptor pfd, BitmapFactory.Options options) { |