Merge "MediaCodec/Image: handle null cropRect correctly" into lmp-mr1-dev automerge: aab38b7
automerge: e4c7a65
* commit 'e4c7a65140b5523325fd6ca86c196136fe183ee8':
MediaCodec/Image: handle null cropRect correctly
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user