diff options
author | Wei-Ta Chen <weita@google.com> | 2009-07-29 17:24:50 +0800 |
---|---|---|
committer | Wei-Ta Chen <weita@google.com> | 2009-07-29 17:34:05 +0800 |
commit | f2c7e983fafaf7639a6ad090a93d1892015777ed (patch) | |
tree | 416f68aef3d460ebea78a027874543ea501a5e73 | |
parent | d12ae2098b491bb55798758da8b698ffc625d62c (diff) | |
download | LegacyCamera-f2c7e983fafaf7639a6ad090a93d1892015777ed.zip LegacyCamera-f2c7e983fafaf7639a6ad090a93d1892015777ed.tar.gz LegacyCamera-f2c7e983fafaf7639a6ad090a93d1892015777ed.tar.bz2 |
Fix http://b/2017388 by handling the corner case in computeSampleSize().
-rw-r--r-- | src/com/android/camera/ImageGetter.java | 1 | ||||
-rw-r--r-- | src/com/android/camera/ReviewImage.java | 9 | ||||
-rw-r--r-- | src/com/android/camera/Util.java | 10 | ||||
-rw-r--r-- | src/com/android/camera/ViewImage.java | 10 |
4 files changed, 11 insertions, 19 deletions
diff --git a/src/com/android/camera/ImageGetter.java b/src/com/android/camera/ImageGetter.java index 078db2c..b7d47e9 100644 --- a/src/com/android/camera/ImageGetter.java +++ b/src/com/android/camera/ImageGetter.java @@ -23,7 +23,6 @@ import com.android.camera.gallery.VideoObject; import android.graphics.Bitmap; import android.os.Handler; import android.os.Message; -import android.util.Log; /* * Here's the loading strategy. For any given image, load the thumbnail diff --git a/src/com/android/camera/ReviewImage.java b/src/com/android/camera/ReviewImage.java index 68370ab..f92b249 100644 --- a/src/com/android/camera/ReviewImage.java +++ b/src/com/android/camera/ReviewImage.java @@ -16,7 +16,6 @@ package com.android.camera; -import com.android.camera.gallery.Cancelable; import com.android.camera.gallery.IImage; import com.android.camera.gallery.IImageList; import com.android.camera.gallery.VideoObject; @@ -29,8 +28,6 @@ import android.graphics.Bitmap; import android.graphics.Matrix; import android.net.Uri; import android.os.Bundle; -import android.os.Handler; -import android.os.Message; import android.preference.PreferenceManager; import android.provider.MediaStore; import android.util.AttributeSet; @@ -43,7 +40,6 @@ import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; -import android.view.WindowManager.LayoutParams; import android.view.Window; import android.view.WindowManager; import android.view.animation.AlphaAnimation; @@ -54,8 +50,6 @@ import android.widget.Toast; import android.widget.ZoomButtonsController; import java.util.Random; -import java.util.concurrent.CancellationException; -import java.util.concurrent.ExecutionException; // This activity can display a whole picture and navigate them in a specific // gallery. It has two modes: normal mode and slide show mode. In normal mode @@ -454,7 +448,8 @@ public class ReviewImage extends Activity implements View.OnClickListener { // need to get fancier and read in the fuller size image as the // user starts to zoom. // Originally the value is set to 480 in order to avoid OOM. - // Now we set it to 2048 because of using purgeable Bitmaps. + // Now we set it to 2048 because of using + // native memory allocation for Bitmaps. final int imageViewSize = 2048; return imageViewSize; } diff --git a/src/com/android/camera/Util.java b/src/com/android/camera/Util.java index 761b6e3..7c4420b 100644 --- a/src/com/android/camera/Util.java +++ b/src/com/android/camera/Util.java @@ -20,7 +20,6 @@ import com.android.camera.gallery.IImage; import android.app.ProgressDialog; import android.content.ContentResolver; -import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; @@ -96,6 +95,11 @@ public class Util { (int) Math.min(Math.floor(w / minSideLength), Math.floor(h / minSideLength)); + if (upperBound < lowerBound) { + // return the larger one when there is no overlapping zone. + return lowerBound; + } + if ((maxNumOfPixels == IImage.UNCONSTRAINED) && (minSideLength == IImage.UNCONSTRAINED)) { return 1; @@ -309,7 +313,7 @@ public class Util { return makeBitmap(minSideLength, maxNumOfPixels, uri, cr, IImage.NO_NATIVE); } - + public static Bitmap makeBitmap(int minSideLength, int maxNumOfPixels, Uri uri, ContentResolver cr, boolean useNative) { ParcelFileDescriptor input = null; @@ -337,7 +341,7 @@ public class Util { return makeBitmap(minSideLength, maxNumOfPixels, null, null, pfd, options); } - + public static Bitmap makeBitmap(int minSideLength, int maxNumOfPixels, Uri uri, ContentResolver cr, ParcelFileDescriptor pfd, BitmapFactory.Options options) { diff --git a/src/com/android/camera/ViewImage.java b/src/com/android/camera/ViewImage.java index 7a6e863..02ef981 100644 --- a/src/com/android/camera/ViewImage.java +++ b/src/com/android/camera/ViewImage.java @@ -16,7 +16,6 @@ package com.android.camera; -import com.android.camera.gallery.Cancelable; import com.android.camera.gallery.IImage; import com.android.camera.gallery.IImageList; import com.android.camera.gallery.VideoObject; @@ -27,11 +26,8 @@ import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Bitmap; import android.graphics.Matrix; -import android.graphics.PixelFormat; import android.net.Uri; import android.os.Bundle; -import android.os.Handler; -import android.os.Message; import android.preference.PreferenceManager; import android.provider.MediaStore; import android.util.AttributeSet; @@ -44,7 +40,6 @@ import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; -import android.view.WindowManager.LayoutParams; import android.view.Window; import android.view.WindowManager; import android.view.animation.AlphaAnimation; @@ -55,8 +50,6 @@ import android.widget.Toast; import android.widget.ZoomButtonsController; import java.util.Random; -import java.util.concurrent.CancellationException; -import java.util.concurrent.ExecutionException; // This activity can display a whole picture and navigate them in a specific // gallery. It has two modes: normal mode and slide show mode. In normal mode @@ -494,7 +487,8 @@ public class ViewImage extends Activity implements View.OnClickListener { // need to get fancier and read in the fuller size image as the // user starts to zoom. // Originally the value is set to 480 in order to avoid OOM. - // Now we set it to 2048 because of using purgeable Bitmaps. + // Now we set it to 2048 because of using + // native memory allocation for Bitmaps. final int imageViewSize = 2048; return imageViewSize; } |