summaryrefslogtreecommitdiffstats
path: root/packages/WallpaperCropper
diff options
context:
space:
mode:
authorSelim Cinek <cinek@google.com>2014-03-24 13:53:06 +0100
committerSelim Cinek <cinek@google.com>2014-03-24 13:53:06 +0100
commitc41853cee89b391cd2d4d93205ea69c746ccfa4c (patch)
tree1bf2ead79e1b6c14b11436a8b50bf6c7fa66515a /packages/WallpaperCropper
parent83da75d938d519bbcffb9c3b52802fd2daad4aee (diff)
downloadframeworks_base-c41853cee89b391cd2d4d93205ea69c746ccfa4c.zip
frameworks_base-c41853cee89b391cd2d4d93205ea69c746ccfa4c.tar.gz
frameworks_base-c41853cee89b391cd2d4d93205ea69c746ccfa4c.tar.bz2
Fixed wallpaper bug where wrong size was taken when cropping
When cropping, the selected area of the image was incorrectly cropped to the size of the view instead of the size of the image Bug: 13617446 Change-Id: If54a0891fa2cdeee70ba63752874f1543d401701
Diffstat (limited to 'packages/WallpaperCropper')
-rw-r--r--packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java b/packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java
index 9c4600942..757a7a2 100644
--- a/packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java
+++ b/packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java
@@ -346,16 +346,17 @@ public class WallpaperCropActivity extends Activity {
// Get the crop
RectF cropRect = mCropView.getCrop();
+ 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(mCropView.getWidth(), cropRect.right);
+ cropRect.right = Math.min(inSize.x, cropRect.right);
cropRect.top = Math.max(0, cropRect.top);
- cropRect.bottom = Math.min(mCropView.getHeight(), cropRect.bottom);
+ cropRect.bottom = Math.min(inSize.y, cropRect.bottom);
int cropRotation = mCropView.getImageRotation();
float cropScale = mCropView.getWidth() / (float) cropRect.width();
- Point inSize = mCropView.getSourceDimensions();
Matrix rotateMatrix = new Matrix();
rotateMatrix.setRotate(cropRotation);
float[] rotatedInSize = new float[] { inSize.x, inSize.y };