summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2015-01-10 01:12:31 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-01-10 01:12:33 +0000
commit7f94b52fc7c66bc40702b46f59b3929c076cbbfb (patch)
tree02c8de67dc15ced1426581ad01650c2143f67fe0 /media
parent98840f2bd2fb96225ed5c95644937d55d4189ca6 (diff)
parent24ffac013578c1367c4c8d763889348c95d63547 (diff)
downloadframeworks_base-7f94b52fc7c66bc40702b46f59b3929c076cbbfb.zip
frameworks_base-7f94b52fc7c66bc40702b46f59b3929c076cbbfb.tar.gz
frameworks_base-7f94b52fc7c66bc40702b46f59b3929c076cbbfb.tar.bz2
Merge "MediaCodec/Image: handle null cropRect correctly"
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/Image.java6
-rw-r--r--media/java/android/media/MediaCodec.java10
2 files changed, 10 insertions, 6 deletions
diff --git a/media/java/android/media/Image.java b/media/java/android/media/Image.java
index 522e45d..0d6b91a 100644
--- a/media/java/android/media/Image.java
+++ b/media/java/android/media/Image.java
@@ -146,8 +146,10 @@ public abstract class Image implements AutoCloseable {
* using coordinates in the largest-resolution plane.
*/
public void setCropRect(Rect cropRect) {
- cropRect = new Rect(cropRect); // make a copy
- cropRect.intersect(0, 0, getWidth(), getHeight());
+ if (cropRect != null) {
+ cropRect = new Rect(cropRect); // make a copy
+ cropRect.intersect(0, 0, getWidth(), getHeight());
+ }
mCropRect = cropRect;
}
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java
index 74fc2c5..8985b52 100644
--- a/media/java/android/media/MediaCodec.java
+++ b/media/java/android/media/MediaCodec.java
@@ -1778,10 +1778,6 @@ final public class MediaCodec {
mIsValid = true;
mIsReadOnly = buffer.isReadOnly();
mBuffer = buffer.duplicate();
- if (cropRect != null) {
- cropRect.offset(-xOffset, -yOffset);
- }
- super.setCropRect(cropRect);
// save offsets and info
mXOffset = xOffset;
@@ -1833,6 +1829,12 @@ final public class MediaCodec {
throw new UnsupportedOperationException(
"unsupported info length: " + info.remaining());
}
+
+ if (cropRect == null) {
+ cropRect = new Rect(0, 0, mWidth, mHeight);
+ }
+ cropRect.offset(-xOffset, -yOffset);
+ super.setCropRect(cropRect);
}
private class MediaPlane extends Plane {