summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/gallery
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/gallery')
-rw-r--r--src/com/android/camera/gallery/BaseImage.java10
-rw-r--r--src/com/android/camera/gallery/IImage.java6
-rw-r--r--src/com/android/camera/gallery/Image.java3
-rw-r--r--src/com/android/camera/gallery/UriImage.java27
-rw-r--r--src/com/android/camera/gallery/VideoObject.java3
5 files changed, 25 insertions, 24 deletions
diff --git a/src/com/android/camera/gallery/BaseImage.java b/src/com/android/camera/gallery/BaseImage.java
index f6b0211..10a0c9f 100644
--- a/src/com/android/camera/gallery/BaseImage.java
+++ b/src/com/android/camera/gallery/BaseImage.java
@@ -159,15 +159,17 @@ public abstract class BaseImage implements IImage {
}
public Bitmap fullSizeBitmap(int targetWidthHeight) {
- return fullSizeBitmap(targetWidthHeight, true);
+ return fullSizeBitmap(targetWidthHeight, IImage.ROTATE_AS_NEEDED,
+ IImage.NO_NATIVE);
}
- protected Bitmap fullSizeBitmap(
- int targetWidthHeight, boolean rotateAsNeeded) {
+ public Bitmap fullSizeBitmap(
+ int targetWidthHeight, boolean rotateAsNeeded, boolean useNative) {
Uri url = mContainer.contentUri(mId);
if (url == null) return null;
- Bitmap b = Util.makeBitmap(targetWidthHeight, url, mContentResolver);
+ Bitmap b = Util.makeBitmap(targetWidthHeight, url, mContentResolver,
+ useNative);
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 7217926..63db330 100644
--- a/src/com/android/camera/gallery/IImage.java
+++ b/src/com/android/camera/gallery/IImage.java
@@ -34,6 +34,12 @@ public interface IImage {
/** Get the bitmap for the full size image. */
public abstract Bitmap fullSizeBitmap(int targetWidthOrHeight);
+ public abstract Bitmap fullSizeBitmap(int targetWidthOrHeight,
+ boolean rotateAsNeeded, boolean useNative);
+ 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 cancelable object for the bitmap of the full size image. */
public abstract Cancelable<Bitmap> fullSizeBitmapCancelable(
diff --git a/src/com/android/camera/gallery/Image.java b/src/com/android/camera/gallery/Image.java
index 4eba5b3..095b0dc 100644
--- a/src/com/android/camera/gallery/Image.java
+++ b/src/com/android/camera/gallery/Image.java
@@ -273,7 +273,8 @@ public class Image extends BaseImage implements IImage {
}
if (bitmap == null) {
- bitmap = fullSizeBitmap(THUMBNAIL_TARGET_SIZE, false);
+ bitmap = fullSizeBitmap(THUMBNAIL_TARGET_SIZE, IImage.NO_ROTATE,
+ IImage.NO_NATIVE);
// No thumbnail found... storing the new one.
bitmap = mContainer.storeThumbnail(bitmap, mId);
}
diff --git a/src/com/android/camera/gallery/UriImage.java b/src/com/android/camera/gallery/UriImage.java
index f793999..88f67f6 100644
--- a/src/com/android/camera/gallery/UriImage.java
+++ b/src/com/android/camera/gallery/UriImage.java
@@ -74,28 +74,19 @@ class UriImage implements IImage {
}
public Bitmap fullSizeBitmap(int targetWidthHeight) {
+ return fullSizeBitmap(targetWidthHeight, IImage.ROTATE_AS_NEEDED,
+ IImage.NO_NATIVE);
+ }
+
+ public Bitmap fullSizeBitmap(int targetWidthHeight, boolean rotateAsNeeded,
+ boolean useNative) {
try {
ParcelFileDescriptor pfdInput = getPFD();
- BitmapFactory.Options options = new BitmapFactory.Options();
- options.inJustDecodeBounds = true;
- BitmapManager.instance().decodeFileDescriptor(
- pfdInput.getFileDescriptor(), options);
-
- if (targetWidthHeight != -1) {
- options.inSampleSize =
- Util.computeSampleSize(options, targetWidthHeight);
- }
-
- options.inJustDecodeBounds = false;
- options.inDither = false;
- options.inPreferredConfig = Bitmap.Config.ARGB_8888;
-
- Bitmap b = BitmapManager.instance().decodeFileDescriptor(
- pfdInput.getFileDescriptor(), options);
- pfdInput.close();
+ Bitmap b = Util.makeBitmap(targetWidthHeight, pfdInput,
+ useNative);
return b;
} catch (Exception ex) {
- Log.e(TAG, "got exception decoding bitmap " + ex.toString());
+ Log.e(TAG, "got exception decoding bitmap ", ex);
return null;
}
}
diff --git a/src/com/android/camera/gallery/VideoObject.java b/src/com/android/camera/gallery/VideoObject.java
index 80c9dfe..a533ae9 100644
--- a/src/com/android/camera/gallery/VideoObject.java
+++ b/src/com/android/camera/gallery/VideoObject.java
@@ -64,7 +64,8 @@ public class VideoObject extends BaseImage implements IImage {
}
@Override
- public Bitmap fullSizeBitmap(int targetWidthHeight) {
+ public Bitmap fullSizeBitmap(int targetWidthHeight, boolean rotateAsNeeded,
+ boolean useNative) {
return Util.createVideoThumbnail(mDataPath);
}