summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSelim Cinek <cinek@google.com>2014-03-14 17:45:16 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-03-14 17:45:16 +0000
commit3f3a79a2fdc3cd4c765ee967fe0c6b7fc87c4a23 (patch)
tree03c9535619882e7eee0cc976839b9845531c423d
parent47bc68d27dcafd58dd5ff06b5858c3e3fe089d91 (diff)
parente04e8b2a142f22bfeb8729e542f51d5510327eb9 (diff)
downloadandroid_packages_apps_Trebuchet-3f3a79a2fdc3cd4c765ee967fe0c6b7fc87c4a23.tar.gz
android_packages_apps_Trebuchet-3f3a79a2fdc3cd4c765ee967fe0c6b7fc87c4a23.tar.bz2
android_packages_apps_Trebuchet-3f3a79a2fdc3cd4c765ee967fe0c6b7fc87c4a23.zip
am e04e8b2a: Fixed a crash when an image with an odd width/height was selected
* commit 'e04e8b2a142f22bfeb8729e542f51d5510327eb9': Fixed a crash when an image with an odd width/height was selected
-rw-r--r--WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java8
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();