From 7c989e90e84b29f4762abaf2c80ecafc1a9e99d4 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Mon, 24 Mar 2014 14:13:20 +0100 Subject: 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: I0b40711c04f3d3b5929e7bb037d6cf21d4bb5bcb --- .../src/com/android/launcher3/WallpaperCropActivity.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'WallpaperPicker/src') diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java index 1f35622af..08913b67f 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java @@ -367,17 +367,19 @@ 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 }; -- cgit v1.2.3