diff options
author | Chih-Chung Chang <chihchung@google.com> | 2010-02-11 14:05:50 -0800 |
---|---|---|
committer | Chih-Chung Chang <chihchung@google.com> | 2010-02-12 09:20:46 -0800 |
commit | ffbbd7f09b8832ce523799eec53753cd3559e53d (patch) | |
tree | 06a4e1c2a6e83cb7d4f3b85206b3086b056334c2 /src | |
parent | e3172febb111f286a37b685938dd930856540d77 (diff) | |
download | LegacyCamera-ffbbd7f09b8832ce523799eec53753cd3559e53d.zip LegacyCamera-ffbbd7f09b8832ce523799eec53753cd3559e53d.tar.gz LegacyCamera-ffbbd7f09b8832ce523799eec53753cd3559e53d.tar.bz2 |
Remove the use of native allocation.
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/ImageGetter.java | 2 | ||||
-rw-r--r-- | src/com/android/camera/Util.java | 23 | ||||
-rw-r--r-- | src/com/android/camera/gallery/BaseImage.java | 6 | ||||
-rw-r--r-- | src/com/android/camera/gallery/IImage.java | 4 | ||||
-rw-r--r-- | src/com/android/camera/gallery/UriImage.java | 10 | ||||
-rw-r--r-- | src/com/android/camera/gallery/VideoObject.java | 2 |
6 files changed, 12 insertions, 35 deletions
diff --git a/src/com/android/camera/ImageGetter.java b/src/com/android/camera/ImageGetter.java index 76b60bf..24c9d98 100644 --- a/src/com/android/camera/ImageGetter.java +++ b/src/com/android/camera/ImageGetter.java @@ -201,7 +201,7 @@ class ImageGetter { int sizeToUse = mCB.fullImageSizeToUse( mCurrentPosition, offset); Bitmap b = image.fullSizeBitmap(sizeToUse, 3 * 1024 * 1024, - IImage.NO_ROTATE, IImage.USE_NATIVE); + IImage.NO_ROTATE); if (b == null) continue; if (mCancel) { diff --git a/src/com/android/camera/Util.java b/src/com/android/camera/Util.java index 362914a..df014cd 100644 --- a/src/com/android/camera/Util.java +++ b/src/com/android/camera/Util.java @@ -171,16 +171,12 @@ public class Util { * @param uri */ public static Bitmap makeBitmap(int minSideLength, int maxNumOfPixels, - Uri uri, ContentResolver cr, boolean useNative) { + Uri uri, ContentResolver cr) { ParcelFileDescriptor input = null; try { input = cr.openFileDescriptor(uri, "r"); - BitmapFactory.Options options = null; - if (useNative) { - options = createNativeAllocOptions(); - } return makeBitmap(minSideLength, maxNumOfPixels, uri, cr, input, - options); + null); } catch (IOException ex) { return null; } finally { @@ -189,13 +185,9 @@ public class Util { } public static Bitmap makeBitmap(int minSideLength, int maxNumOfPixels, - ParcelFileDescriptor pfd, boolean useNative) { - BitmapFactory.Options options = null; - if (useNative) { - options = createNativeAllocOptions(); - } + ParcelFileDescriptor pfd) { return makeBitmap(minSideLength, maxNumOfPixels, null, null, pfd, - options); + null); } public static Bitmap makeBitmap(int minSideLength, int maxNumOfPixels, @@ -281,13 +273,6 @@ public class Util { return intent; } - // Returns Options that set the puregeable flag for Bitmap decode. - public static BitmapFactory.Options createNativeAllocOptions() { - BitmapFactory.Options options = new BitmapFactory.Options(); - options.inNativeAlloc = true; - return options; - } - public static void showFatalErrorAndFinish( final Activity activity, String title, String message) { DialogInterface.OnClickListener buttonListener = diff --git a/src/com/android/camera/gallery/BaseImage.java b/src/com/android/camera/gallery/BaseImage.java index b0eab7a..bbd45f1 100644 --- a/src/com/android/camera/gallery/BaseImage.java +++ b/src/com/android/camera/gallery/BaseImage.java @@ -86,16 +86,16 @@ public abstract class BaseImage implements IImage { public Bitmap fullSizeBitmap(int minSideLength, int maxNumberOfPixels) { return fullSizeBitmap(minSideLength, maxNumberOfPixels, - IImage.ROTATE_AS_NEEDED, IImage.NO_NATIVE); + IImage.ROTATE_AS_NEEDED); } public Bitmap fullSizeBitmap(int minSideLength, int maxNumberOfPixels, - boolean rotateAsNeeded, boolean useNative) { + boolean rotateAsNeeded) { Uri url = mContainer.contentUri(mId); if (url == null) return null; Bitmap b = Util.makeBitmap(minSideLength, maxNumberOfPixels, - url, mContentResolver, useNative); + url, mContentResolver); if (b != null && rotateAsNeeded) { b = Util.rotate(b, getDegreesRotated()); diff --git a/src/com/android/camera/gallery/IImage.java b/src/com/android/camera/gallery/IImage.java index 22e1228..4b72de6 100644 --- a/src/com/android/camera/gallery/IImage.java +++ b/src/com/android/camera/gallery/IImage.java @@ -38,12 +38,10 @@ public interface IImage { public abstract Bitmap fullSizeBitmap(int minSideLength, int maxNumberOfPixels); public abstract Bitmap fullSizeBitmap(int minSideLength, - int maxNumberOfPixels, boolean rotateAsNeeded, boolean useNative); + int maxNumberOfPixels, boolean rotateAsNeeded); public abstract int getDegreesRotated(); public static final boolean ROTATE_AS_NEEDED = true; public static final boolean NO_ROTATE = false; - public static final boolean USE_NATIVE = true; - public static final boolean NO_NATIVE = false; /** Get the input stream associated with a given full size image. */ public abstract InputStream fullSizeImageData(); diff --git a/src/com/android/camera/gallery/UriImage.java b/src/com/android/camera/gallery/UriImage.java index 1d04257..a229f76 100644 --- a/src/com/android/camera/gallery/UriImage.java +++ b/src/com/android/camera/gallery/UriImage.java @@ -78,21 +78,15 @@ class UriImage implements IImage { public Bitmap fullSizeBitmap(int minSideLength, int maxNumberOfPixels) { return fullSizeBitmap(minSideLength, maxNumberOfPixels, - IImage.ROTATE_AS_NEEDED, IImage.NO_NATIVE); + IImage.ROTATE_AS_NEEDED); } public Bitmap fullSizeBitmap(int minSideLength, int maxNumberOfPixels, boolean rotateAsNeeded) { - return fullSizeBitmap(minSideLength, maxNumberOfPixels, - rotateAsNeeded, IImage.NO_NATIVE); - } - - public Bitmap fullSizeBitmap(int minSideLength, int maxNumberOfPixels, - boolean rotateAsNeeded, boolean useNative) { try { ParcelFileDescriptor pfdInput = getPFD(); Bitmap b = Util.makeBitmap(minSideLength, maxNumberOfPixels, - pfdInput, useNative); + pfdInput); return b; } catch (Exception ex) { Log.e(TAG, "got exception decoding bitmap ", ex); diff --git a/src/com/android/camera/gallery/VideoObject.java b/src/com/android/camera/gallery/VideoObject.java index fd759b8..0a72209 100644 --- a/src/com/android/camera/gallery/VideoObject.java +++ b/src/com/android/camera/gallery/VideoObject.java @@ -62,7 +62,7 @@ public class VideoObject extends BaseImage implements IImage { @Override public Bitmap fullSizeBitmap(int minSideLength, int maxNumberOfPixels, - boolean rotateAsNeeded, boolean useNative) { + boolean rotateAsNeeded) { return ThumbnailUtils.createVideoThumbnail(mDataPath); } |