summaryrefslogtreecommitdiffstats
path: root/WallpaperPicker/src
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2015-09-22 13:21:20 -0700
committerTony Wickham <twickham@google.com>2015-09-23 00:13:56 +0000
commitff9133f1125865f4e14a92d4b5e661f1ac92524d (patch)
tree94f876b19eb63941277b47b4b7854d1c8115bdcf /WallpaperPicker/src
parent9ae42fff6f481ea2a06f171da43f630ded313b69 (diff)
downloadandroid_packages_apps_Trebuchet-ff9133f1125865f4e14a92d4b5e661f1ac92524d.tar.gz
android_packages_apps_Trebuchet-ff9133f1125865f4e14a92d4b5e661f1ac92524d.tar.bz2
android_packages_apps_Trebuchet-ff9133f1125865f4e14a92d4b5e661f1ac92524d.zip
Adjust cropped bitmap bounds to correctly fit in original bitmap bounds.
Bug: 22631531 Change-Id: Ia0c1bccf4b8af3a8b335b865974c5d08f9836689
Diffstat (limited to 'WallpaperPicker/src')
-rw-r--r--WallpaperPicker/src/com/android/gallery3d/common/BitmapCropTask.java14
1 files changed, 4 insertions, 10 deletions
diff --git a/WallpaperPicker/src/com/android/gallery3d/common/BitmapCropTask.java b/WallpaperPicker/src/com/android/gallery3d/common/BitmapCropTask.java
index cb7090fad..a79fb65c9 100644
--- a/WallpaperPicker/src/com/android/gallery3d/common/BitmapCropTask.java
+++ b/WallpaperPicker/src/com/android/gallery3d/common/BitmapCropTask.java
@@ -293,22 +293,16 @@ public class BitmapCropTask extends AsyncTask<Void, Void, Boolean> {
roundedTrueCrop.right = roundedTrueCrop.left + fullSize.getWidth();
}
if (roundedTrueCrop.right > fullSize.getWidth()) {
- // Adjust the left value
- int adjustment = roundedTrueCrop.left -
- Math.max(0, roundedTrueCrop.right - roundedTrueCrop.width());
- roundedTrueCrop.left -= adjustment;
- roundedTrueCrop.right -= adjustment;
+ // Adjust the left and right values.
+ roundedTrueCrop.offset(-(roundedTrueCrop.right - fullSize.getWidth()), 0);
}
if (roundedTrueCrop.height() > fullSize.getHeight()) {
// Adjust the height
roundedTrueCrop.bottom = roundedTrueCrop.top + fullSize.getHeight();
}
if (roundedTrueCrop.bottom > fullSize.getHeight()) {
- // Adjust the top value
- int adjustment = roundedTrueCrop.top -
- Math.max(0, roundedTrueCrop.bottom - roundedTrueCrop.height());
- roundedTrueCrop.top -= adjustment;
- roundedTrueCrop.bottom -= adjustment;
+ // Adjust the top and bottom values.
+ roundedTrueCrop.offset(0, -(roundedTrueCrop.bottom - fullSize.getHeight()));
}
crop = Bitmap.createBitmap(fullSize, roundedTrueCrop.left,