diff options
author | Ruben Brunk <rubenbrunk@google.com> | 2013-04-10 17:27:33 -0700 |
---|---|---|
committer | Ruben Brunk <rubenbrunk@google.com> | 2013-04-10 17:27:33 -0700 |
commit | 41185c4fdbccad17b79697306a7f8044b8f7ffd3 (patch) | |
tree | b0b0eb38b13f72f50c1fece93b53f322e6ad7996 /src/com/android/gallery3d | |
parent | 27b9459f3764d45d46092aa541e691ff861e0aff (diff) | |
download | android_packages_apps_Gallery2-41185c4fdbccad17b79697306a7f8044b8f7ffd3.tar.gz android_packages_apps_Gallery2-41185c4fdbccad17b79697306a7f8044b8f7ffd3.tar.bz2 android_packages_apps_Gallery2-41185c4fdbccad17b79697306a7f8044b8f7ffd3.zip |
Fix downsampling check in crop.
Bug: 8586301
Change-Id: I4c5441f779122adb984368609cfea39a60190848
Diffstat (limited to 'src/com/android/gallery3d')
-rw-r--r-- | src/com/android/gallery3d/filtershow/crop/CropLoader.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/filtershow/crop/CropLoader.java b/src/com/android/gallery3d/filtershow/crop/CropLoader.java index d2a681f38..132d6c1dc 100644 --- a/src/com/android/gallery3d/filtershow/crop/CropLoader.java +++ b/src/com/android/gallery3d/filtershow/crop/CropLoader.java @@ -144,14 +144,16 @@ public abstract class CropLoader { // Find best downsampling size int imageSide = Math.max(w, h); + options.inSampleSize = 1; if (imageSide > maxSideLength) { int shifts = 1 + Integer.numberOfLeadingZeros(maxSideLength) - Integer.numberOfLeadingZeros(imageSide); - options.inSampleSize = 1 << shifts; + options.inSampleSize <<= shifts; } // Make sure sample size is reasonable - if (0 >= (int) (Math.min(w, h) / options.inSampleSize)) { + if (options.inSampleSize <= 0 || + 0 >= (int) (Math.min(w, h) / options.inSampleSize)) { return null; } |