diff options
| author | 2014-03-25 03:46:27 +0000 | |
|---|---|---|
| committer | 2014-03-25 03:46:27 +0000 | |
| commit | 7290b56b51119070c549d88d3946d61e34f62ba3 (patch) | |
| tree | 90b8725d4de27d6fb2983b54169e0cb6af53ec8f | |
| parent | 8ee4491dc80943429cd79d0c7b87c28056067a58 (diff) | |
| parent | 8ae8689d165299bd0bbd0e04bff987dad352c8f5 (diff) | |
am 8ae8689d: am c41853ce: Fixed wallpaper bug where wrong size was taken when cropping
* commit '8ae8689d165299bd0bbd0e04bff987dad352c8f5':
Fixed wallpaper bug where wrong size was taken when cropping
| -rw-r--r-- | packages/WallpaperCropper/src/com/android/wallpapercropper/WallpaperCropActivity.java | 7 |
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 9c460094260b..757a7a2f0e5c 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 }; |