DO NOT MERGE - Fixed crash for odd image width/height
Due to an internal rounding in the renderer, the calculations for the cropping area could be slightly offset, getting out of the image boundaries. I sanitized the rect by ensuring they are inside the image. Bug: 12174629 Change-Id: Icc37790732ddd479631b898b23c05501d2dcd5be
This commit is contained in:
@ -340,6 +340,13 @@ public class WallpaperCropActivity extends Activity {
|
|||||||
getWindowManager());
|
getWindowManager());
|
||||||
// Get the crop
|
// Get the crop
|
||||||
RectF cropRect = mCropView.getCrop();
|
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();
|
int cropRotation = mCropView.getImageRotation();
|
||||||
float cropScale = mCropView.getWidth() / (float) cropRect.width();
|
float cropScale = mCropView.getWidth() / (float) cropRect.width();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user