diff options
author | nicolasroard <nicolasroard@google.com> | 2013-10-21 11:45:54 -0700 |
---|---|---|
committer | nicolasroard <nicolasroard@google.com> | 2013-10-21 11:48:38 -0700 |
commit | 97ad2bdcb39c0484dafb08f4a7f45bcd1a3f4f9d (patch) | |
tree | ac1c826dff050f9b0b25c440bde7b2b280b32d18 | |
parent | 4bbcb6da1e94ebd811e97deb1df2133fc0e39ef2 (diff) | |
download | android_packages_apps_Gallery2-97ad2bdcb39c0484dafb08f4a7f45bcd1a3f4f9d.tar.gz android_packages_apps_Gallery2-97ad2bdcb39c0484dafb08f4a7f45bcd1a3f4f9d.tar.bz2 android_packages_apps_Gallery2-97ad2bdcb39c0484dafb08f4a7f45bcd1a3f4f9d.zip |
Handles export size zero
bug:11280447
Change-Id: Ia8758a6d269b4ac9fdc9435b3bcdf9295c3e11a9
-rw-r--r-- | src/com/android/gallery3d/filtershow/tools/SaveImage.java | 4 | ||||
-rw-r--r-- | src/com/android/gallery3d/filtershow/ui/ExportDialog.java | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/filtershow/tools/SaveImage.java b/src/com/android/gallery3d/filtershow/tools/SaveImage.java index 354081ed2..c3cdea8df 100644 --- a/src/com/android/gallery3d/filtershow/tools/SaveImage.java +++ b/src/com/android/gallery3d/filtershow/tools/SaveImage.java @@ -402,6 +402,10 @@ public class SaveImage { // if we have a valid size int w = (int) (bitmap.getWidth() * sizeFactor); int h = (int) (bitmap.getHeight() * sizeFactor); + if (w == 0 || h == 0) { + w = 1; + h = 1; + } bitmap = Bitmap.createScaledBitmap(bitmap, w, h, true); } updateProgress(); diff --git a/src/com/android/gallery3d/filtershow/ui/ExportDialog.java b/src/com/android/gallery3d/filtershow/ui/ExportDialog.java index f6a84cee2..b42c9f367 100644 --- a/src/com/android/gallery3d/filtershow/ui/ExportDialog.java +++ b/src/com/android/gallery3d/filtershow/ui/ExportDialog.java @@ -202,8 +202,8 @@ public class ExportDialog extends DialogFragment implements View.OnClickListener return; } mEditing = true; - int width = 0; - int height = 0; + int width = 1; + int height = 1; if (text.getId() == R.id.editableWidth) { if (mWidthText.getText() != null) { String value = String.valueOf(mWidthText.getText()); @@ -213,6 +213,10 @@ public class ExportDialog extends DialogFragment implements View.OnClickListener width = mOriginalBounds.width(); mWidthText.setText("" + width); } + if (width <= 0) { + width = (int) Math.ceil(mRatio); + mWidthText.setText("" + width); + } height = (int) (width / mRatio); } mHeightText.setText("" + height); @@ -226,6 +230,10 @@ public class ExportDialog extends DialogFragment implements View.OnClickListener height = mOriginalBounds.height(); mHeightText.setText("" + height); } + if (height <= 0) { + height = 1; + mHeightText.setText("" + height); + } width = (int) (height * mRatio); } mWidthText.setText("" + width); |