summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Ruesga <jorge@ruesga.com>2015-09-06 12:38:32 +0200
committerJorge Ruesga <jorge@ruesga.com>2015-09-13 11:32:45 +0200
commitfb2b30bf479dc85cd9b50d4b4fe7cd3c6a60c5e6 (patch)
treef7ecc4a5b34d7d9776c1f285f17bb76464cee07b
parent92bdfc02cafed456319960584a9dfc462d2e0934 (diff)
downloadandroid_packages_apps_Trebuchet-fb2b30bf479dc85cd9b50d4b4fe7cd3c6a60c5e6.tar.gz
android_packages_apps_Trebuchet-fb2b30bf479dc85cd9b50d4b4fe7cd3c6a60c5e6.tar.bz2
android_packages_apps_Trebuchet-fb2b30bf479dc85cd9b50d4b4fe7cd3c6a60c5e6.zip
trebuchet: ensure crop bounds
Ensure that crop rect is not bigger than original bitmap size Change-Id: Ifb2b261411a75c9792d34b925e3ff3d3c2bde59d JIRA: BUGDUMP-3529433 Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
-rw-r--r--WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java
index d5c7cd93d..b571e7124 100644
--- a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java
+++ b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java
@@ -698,10 +698,10 @@ public class WallpaperCropActivity extends Activity {
// Adjust the width
roundedTrueCrop.right = roundedTrueCrop.left + fullSize.getWidth();
}
- if (roundedTrueCrop.right > fullSize.getWidth()) {
+ if (roundedTrueCrop.right >= fullSize.getWidth()) {
// Adjust the left value
- int adjustment = roundedTrueCrop.left -
- Math.max(0, roundedTrueCrop.right - roundedTrueCrop.width());
+ int adjustment = Math.max(0,
+ roundedTrueCrop.right - fullSize.getWidth());
roundedTrueCrop.left -= adjustment;
roundedTrueCrop.right -= adjustment;
}
@@ -709,10 +709,10 @@ public class WallpaperCropActivity extends Activity {
// Adjust the height
roundedTrueCrop.bottom = roundedTrueCrop.top + fullSize.getHeight();
}
- if (roundedTrueCrop.bottom > fullSize.getHeight()) {
+ if (roundedTrueCrop.bottom >= fullSize.getHeight()) {
// Adjust the top value
- int adjustment = roundedTrueCrop.top -
- Math.max(0, roundedTrueCrop.bottom - roundedTrueCrop.height());
+ int adjustment = Math.max(0,
+ roundedTrueCrop.bottom - fullSize.getHeight());
roundedTrueCrop.top -= adjustment;
roundedTrueCrop.bottom -= adjustment;
}