summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Selim Cinek <cinek@google.com> 2014-03-14 22:03:09 +0000
committer Android Git Automerger <android-git-automerger@android.com> 2014-03-14 22:03:09 +0000
commit93d279f562e0fa41be11c25e16df483fd8093b88 (patch)
treeece595253d218c8c31d0dbe613d28820cc989053
parent17586ce7a60d4f3e71ec34cdb3903a915290e527 (diff)
parent1470883e0716af4e3f4014e2ef427aae67286fc8 (diff)
am 1470883e: am 149fd6d8: am 9c3fc0cc: am eb95e74e: DO NOT MERGE - Fixed crash for odd image width/height
* commit '1470883e0716af4e3f4014e2ef427aae67286fc8': DO NOT MERGE - Fixed crash for odd image width/height
-rw-r--r--packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java b/packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java
index 57c0581b8f87..7b3f112ff8c6 100644
--- a/packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java
+++ b/packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java
@@ -340,6 +340,13 @@ 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();