OSDN Git Service

DO NOT MERGE - merge nativeDecodeFileDescriptor fixes into KLP-MR2
authorLeon Scroggins III <scroggo@google.com>
Tue, 14 Jan 2014 20:14:57 +0000 (15:14 -0500)
committerBen Murdoch <benm@google.com>
Mon, 17 Mar 2014 14:18:53 +0000 (14:18 +0000)
commit2fd045c092b08772be81a6d58bbb95e5e608403f
tree607b40c86b0594ddf78e5dc1fa4999a6aff756cd
parentf8d8777dddf91c741981b4f795f2fb2b1d81c1b6
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
core/jni/android/graphics/BitmapFactory.cpp