Release the constraint on the requested version.

Allowing to request a region that partially outsides the image.
bug: 5884845

Change-Id: I32344930ab9e2a7f22a706914babb165843e8de7
This commit is contained in:
Owen Lin
2012-05-15 09:59:19 -07:00
parent f970c2e6de
commit 3bbcbcd5f9

View File

@@ -180,9 +180,9 @@ public final class BitmapRegionDecoder {
*/
public Bitmap decodeRegion(Rect rect, BitmapFactory.Options options) {
checkRecycled("decodeRegion called on recycled region decoder");
if (rect.left < 0 || rect.top < 0 || rect.right > getWidth()
|| rect.bottom > getHeight())
throw new IllegalArgumentException("rectangle is not inside the image");
if (rect.right <= 0 || rect.bottom <= 0 || rect.left >= getWidth()
|| rect.top >= getHeight())
throw new IllegalArgumentException("rectangle is outside the image");
return nativeDecodeRegion(mNativeBitmapRegionDecoder, rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top, options);
}