diff options
author | Doris Liu <tianliu@google.com> | 2015-06-01 13:42:04 -0700 |
---|---|---|
committer | Doris Liu <tianliu@google.com> | 2015-06-02 15:01:48 -0700 |
commit | 942bc58518a82bc3dbeffe4d64f9a5d2d2d8cf43 (patch) | |
tree | b918ecc26a1fb1cfe730dbe6e0ee28fc0fcfb92f /media | |
parent | c5ff0020a2467e0b7aed590d790b5a1b4b082f56 (diff) | |
download | frameworks_base-942bc58518a82bc3dbeffe4d64f9a5d2d2d8cf43.zip frameworks_base-942bc58518a82bc3dbeffe4d64f9a5d2d2d8cf43.tar.gz frameworks_base-942bc58518a82bc3dbeffe4d64f9a5d2d2d8cf43.tar.bz2 |
Fix calls to Rect.intersect(Rect)
This CL checks for the return value for Rect.intersect(Rect) for whether
there is actually an intersection before taking the calling rect as the
intersection. In the case of no intersection (Rect.intersect(Rect) returns
false), the calling rect would not have been changed, so here in this CL
it will be manually set empty.
Bug: 7368679
Change-Id: I7494c1a1649eca09e34412f0a59b795e8b3a82aa
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/Image.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/media/java/android/media/Image.java b/media/java/android/media/Image.java index e18e9a3..045216b 100644 --- a/media/java/android/media/Image.java +++ b/media/java/android/media/Image.java @@ -228,7 +228,9 @@ public abstract class Image implements AutoCloseable { if (cropRect != null) { cropRect = new Rect(cropRect); // make a copy - cropRect.intersect(0, 0, getWidth(), getHeight()); + if (!cropRect.intersect(0, 0, getWidth(), getHeight())) { + cropRect.setEmpty(); + } } mCropRect = cropRect; } |