Merge pull request #71 from SDWebImage/perf/avoid_unused_copy
Avoid unused extra copy of MutableData
This commit is contained in:
commit
e3c34ac58b
|
@ -307,8 +307,7 @@ else OSSpinLockUnlock(&lock##_deprecated);
|
||||||
_finished = finished;
|
_finished = finished;
|
||||||
// check whether we can detect Animated WebP or Static WebP, they need different codec (Demuxer or IDecoder)
|
// check whether we can detect Animated WebP or Static WebP, they need different codec (Demuxer or IDecoder)
|
||||||
if (!_hasAnimation) {
|
if (!_hasAnimation) {
|
||||||
_imageData = [data copy];
|
VP8StatusCode status = WebPIUpdate(_idec, data.bytes, data.length);
|
||||||
VP8StatusCode status = WebPIUpdate(_idec, _imageData.bytes, _imageData.length);
|
|
||||||
// For Static WebP, all things done.
|
// For Static WebP, all things done.
|
||||||
// For Animated WebP (currently use `VP8_STATUS_UNSUPPORTED_FEATURE` to check), continue to create demuxer
|
// For Animated WebP (currently use `VP8_STATUS_UNSUPPORTED_FEATURE` to check), continue to create demuxer
|
||||||
if (status != VP8_STATUS_UNSUPPORTED_FEATURE) {
|
if (status != VP8_STATUS_UNSUPPORTED_FEATURE) {
|
||||||
|
@ -324,7 +323,7 @@ else OSSpinLockUnlock(&lock##_deprecated);
|
||||||
WebPDemuxDelete(_demux);
|
WebPDemuxDelete(_demux);
|
||||||
_demux = NULL;
|
_demux = NULL;
|
||||||
}
|
}
|
||||||
_imageData = [data copy];
|
_imageData = data;
|
||||||
WebPData webpData;
|
WebPData webpData;
|
||||||
WebPDataInit(&webpData);
|
WebPDataInit(&webpData);
|
||||||
webpData.bytes = _imageData.bytes;
|
webpData.bytes = _imageData.bytes;
|
||||||
|
|
Loading…
Reference in New Issue