summaryrefslogtreecommitdiffstats
path: root/gallerycommon/src/com/android
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2011-09-06 16:21:15 +0800
committerOwen Lin <owenlin@google.com>2011-09-06 16:21:15 +0800
commite616606914e730cd34e21eada52b54e60aab0e10 (patch)
treef308067fef7f559f6a8e9d3b1e741cb361908607 /gallerycommon/src/com/android
parentace280a70fd1ead67039b9667d3905c85703c094 (diff)
downloadandroid_packages_apps_Snap-e616606914e730cd34e21eada52b54e60aab0e10.tar.gz
android_packages_apps_Snap-e616606914e730cd34e21eada52b54e60aab0e10.tar.bz2
android_packages_apps_Snap-e616606914e730cd34e21eada52b54e60aab0e10.zip
Revert "bug #5252975: guard against null bitmap object, don't NPE."
This reverts commit 7012ebe1c85e538c572e23d4cb98cad88699c782. We would like to know the crash as soon as possible. bug: 5252975
Diffstat (limited to 'gallerycommon/src/com/android')
-rw-r--r--gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java16
1 files changed, 1 insertions, 15 deletions
diff --git a/gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java b/gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java
index ea98c6c19..0686fe8cf 100644
--- a/gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java
+++ b/gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java
@@ -114,8 +114,6 @@ public class BitmapUtils {
public static Bitmap resizeDownToPixels(
Bitmap bitmap, int targetPixels, boolean recycle) {
- if (bitmap == null) return null;
-
int width = bitmap.getWidth();
int height = bitmap.getHeight();
float scale = (float) Math.sqrt(
@@ -140,7 +138,7 @@ public class BitmapUtils {
}
private static Bitmap.Config getConfig(Bitmap bitmap) {
- Bitmap.Config config = (bitmap != null ? bitmap.getConfig() : null);
+ Bitmap.Config config = bitmap.getConfig();
if (config == null) {
config = Bitmap.Config.ARGB_8888;
}
@@ -149,8 +147,6 @@ public class BitmapUtils {
public static Bitmap resizeDownBySideLength(
Bitmap bitmap, int maxLength, boolean recycle) {
- if (bitmap == null) return null;
-
int srcWidth = bitmap.getWidth();
int srcHeight = bitmap.getHeight();
float scale = Math.min(
@@ -161,8 +157,6 @@ public class BitmapUtils {
// Crops a square from the center of the original image.
public static Bitmap cropCenter(Bitmap bitmap, boolean recycle) {
- if (bitmap == null) return null;
-
int width = bitmap.getWidth();
int height = bitmap.getHeight();
if (width == height) return bitmap;
@@ -179,8 +173,6 @@ public class BitmapUtils {
public static Bitmap resizeDownAndCropCenter(Bitmap bitmap, int size,
boolean recycle) {
- if (bitmap == null) return null;
-
int w = bitmap.getWidth();
int h = bitmap.getHeight();
int minSide = Math.min(w, h);
@@ -211,8 +203,6 @@ public class BitmapUtils {
}
public static Bitmap rotateBitmap(Bitmap source, int rotation, boolean recycle) {
- if (source == null) return null;
-
int w = source.getWidth();
int h = source.getHeight();
Matrix m = new Matrix();
@@ -271,8 +261,6 @@ public class BitmapUtils {
}
public static byte[] compressBitmap(Bitmap bitmap) {
- if (bitmap == null) return null;
-
ByteArrayOutputStream os = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG,
COMPRESS_JPEG_QUALITY, os);
@@ -293,8 +281,6 @@ public class BitmapUtils {
}
public static byte[] compressToBytes(Bitmap bitmap, int quality) {
- if (bitmap == null) return null;
-
ByteArrayOutputStream baos = new ByteArrayOutputStream(65536);
bitmap.compress(CompressFormat.JPEG, quality, baos);
return baos.toByteArray();