summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelim Cinek <cinek@google.com>2014-03-27 20:27:48 +0100
committerThe Android Automerger <android-build@google.com>2014-03-27 19:59:07 -0700
commitab4c3f1f91ce82c7b0418473720c1cb0481d53eb (patch)
tree89d17f26fed058a6d0248613a6fde5490416d631
parent45d2c30dec2e646b74b55d97f90b72f67ceb0604 (diff)
downloadbase-ab4c3f1f91ce82c7b0418473720c1cb0481d53eb.tar.gz
Fixed crash when setting wallpaper with built in rotation
If an image had a built in rotation, a crash could occur, when setting it. An example was a panorama image which had a rotation of 90 degrees Change-Id: Iede8226dac3a40f08d39a69162eb388e6aba97ec Bug: 13507421
-rw-r--r--packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java b/packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java
index 757a7a2f0e5c..a070e5ee88b5 100644
--- a/packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java
+++ b/packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java
@@ -348,12 +348,6 @@ public class WallpaperCropActivity extends Activity {
Point inSize = mCropView.getSourceDimensions();
- // 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(inSize.x, cropRect.right);
- cropRect.top = Math.max(0, cropRect.top);
- cropRect.bottom = Math.min(inSize.y, cropRect.bottom);
int cropRotation = mCropView.getImageRotation();
float cropScale = mCropView.getWidth() / (float) cropRect.width();
@@ -364,6 +358,13 @@ public class WallpaperCropActivity extends Activity {
rotatedInSize[0] = Math.abs(rotatedInSize[0]);
rotatedInSize[1] = Math.abs(rotatedInSize[1]);
+ // 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(rotatedInSize[0], cropRect.right);
+ cropRect.top = Math.max(0, cropRect.top);
+ cropRect.bottom = Math.min(rotatedInSize[1], cropRect.bottom);
+
// ADJUST CROP WIDTH
// Extend the crop all the way to the right, for parallax
// (or all the way to the left, in RTL)