DO NOT MERGE - merge nativeDecodeFileDescriptor fixes into KLP-MR2
BUG:13191516
Original CLs below:
In nativeDecodeFileDescriptor, use fdopen.
Instead of attempting to mmap the entire file, create an
SkFILEStream from a FILE.
BUG:11669944
BUG:11028218
Cherry-pick from: If67da91484acc79f9f3dde6d05201409c0c75e41
-------------------------------------------------------------------------
Decode file descriptor from the correct offset.
Fix a few bugs in nativeDecodeFileDescriptor:
1. Restore the FD's offset when exiting the function.
2. Copy the data when potentially using an SkImageRef.
The old behavior would have continued to modify the
file descriptor's offset each time a new decode was
required. The copy ensures that the file descriptor
remains unchanged.
3. Buffer the file stream.
Prior to this change, if the image was not a PNG,
the stream would be rewound to the beginning of the
file, even if the file descriptor was passed in with
an offset. Thanks to the buffer, the stream is only
rewound to the original offset.
Depends on https://googleplex-android-review.googlesource.com/#/c/415821/1
in external/skia
BUG:12807677
BUG:12895876
Cherry-pick from: I38b8cf5d210dbbc0107e6562e3884867de57fc4b
1 file changed