From a8bb13b5c19fea1e711f260fbbfa2245e422e08f Mon Sep 17 00:00:00 2001 From: kaiyiz Date: Thu, 27 Feb 2014 17:34:55 +0800 Subject: Gallery2: fix can not crop large *.bmp picture It returns an equivalent scaled cropBounds as true crop bounds, then it set the rounded rect by rounding "out" the true crop rect, this make the rounded crop rect may out range of the original bitmap, then an error will happen. We change to check the rounded crop rect, if it is out the range of original bitmap, we set the original bitmap bounds as rounded crop bounds. CRs-Fixed: 621889 Change-Id: Ifb63754255b618fe65a4064663dfb4962bfdf8b8 --- src/com/android/gallery3d/filtershow/crop/CropActivity.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/com/android/gallery3d/filtershow/crop/CropActivity.java b/src/com/android/gallery3d/filtershow/crop/CropActivity.java index f06886b0a..9a691f4a8 100644 --- a/src/com/android/gallery3d/filtershow/crop/CropActivity.java +++ b/src/com/android/gallery3d/filtershow/crop/CropActivity.java @@ -478,6 +478,14 @@ public class CropActivity extends Activity { failure = true; return false; } + if (roundedTrueCrop.right > mOrig.right) { + roundedTrueCrop.set(roundedTrueCrop.left, roundedTrueCrop.top, + (int) mOrig.right, roundedTrueCrop.bottom); + } + if (roundedTrueCrop.bottom > mOrig.bottom) { + roundedTrueCrop.set(roundedTrueCrop.left, roundedTrueCrop.top, + roundedTrueCrop.right, (int) mOrig.bottom); + } // Attempt to open a region decoder BitmapRegionDecoder decoder = null; -- cgit v1.2.3