diff options
author | Selim Cinek <cinek@google.com> | 2014-03-14 18:19:35 +0100 |
---|---|---|
committer | Selim Cinek <cinek@google.com> | 2014-03-14 18:27:23 +0100 |
commit | e04e8b2a142f22bfeb8729e542f51d5510327eb9 (patch) | |
tree | 03c9535619882e7eee0cc976839b9845531c423d /WallpaperPicker | |
parent | 04960cd2e5968e83b26f4fbab23713a5d62af2fc (diff) | |
download | packages_apps_Trebuchet-e04e8b2a142f22bfeb8729e542f51d5510327eb9.tar.gz packages_apps_Trebuchet-e04e8b2a142f22bfeb8729e542f51d5510327eb9.tar.bz2 packages_apps_Trebuchet-e04e8b2a142f22bfeb8729e542f51d5510327eb9.zip |
Fixed a crash when an image with an odd width/height was selected
Due to an internal rounding in the renderer, the calculations
for the cropping area could be slightly offset, getting out
of the image boundaries. I sanitized the rect by ensuring they
are inside the image.
Bug: 12174629
Change-Id: I5e08c83fe3e9cd48254fa6c8ba9cef77ab8a51a6
Diffstat (limited to 'WallpaperPicker')
-rw-r--r-- | WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java index bbbd9105c..1f35622af 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java @@ -366,6 +366,14 @@ public class WallpaperCropActivity extends Activity { getWindowManager()); // Get the crop RectF cropRect = mCropView.getCrop(); + + // due to rounding errors in the cropview renderer the edges can be slightly offset + // therefore we ensure that the boundaries are sanely defined + cropRect.left = Math.max(0, cropRect.left); + cropRect.right = Math.min(mCropView.getWidth(), cropRect.right); + cropRect.top = Math.max(0, cropRect.top); + cropRect.bottom = Math.min(mCropView.getHeight(), cropRect.bottom); + int cropRotation = mCropView.getImageRotation(); float cropScale = mCropView.getWidth() / (float) cropRect.width(); |