Remove unnecessary CGImage check when encode first frame because UIAnimatedImage.CGImage return the first frame's CGImage

This commit is contained in:
DreamPiggy 2019-02-02 11:34:11 +08:00
parent 8ab4c5cd14
commit e54b276e57
1 changed files with 1 additions and 7 deletions

View File

@ -464,13 +464,7 @@
BOOL encodeFirstFrame = [options[SDImageCoderEncodeFirstFrameOnly] boolValue]; BOOL encodeFirstFrame = [options[SDImageCoderEncodeFirstFrameOnly] boolValue];
if (encodeFirstFrame || frames.count == 0) { if (encodeFirstFrame || frames.count == 0) {
// for static single webp image // for static single webp image
CGImageRef imageRef = image.CGImage; data = [self sd_encodedWebpDataWithImage:image.CGImage quality:compressionQuality];
#if SD_UIKIT || SD_WATCH
if (!imageRef) {
imageRef = image.images.firstObject.CGImage;
}
#endif
data = [self sd_encodedWebpDataWithImage:imageRef quality:compressionQuality];
} else { } else {
// for animated webp image // for animated webp image
WebPMux *mux = WebPMuxNew(); WebPMux *mux = WebPMuxNew();