Skip to content

Commit e54b276

Browse files
committed
Remove unnecessary CGImage check when encode first frame because UIAnimatedImage.CGImage return the first frame's CGImage
1 parent 8ab4c5c commit e54b276

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

SDWebImageWebPCoder/Classes/SDImageWebPCoder.m

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -464,13 +464,7 @@ - (NSData *)encodedDataWithImage:(UIImage *)image format:(SDImageFormat)format o
464464
BOOL encodeFirstFrame = [options[SDImageCoderEncodeFirstFrameOnly] boolValue];
465465
if (encodeFirstFrame || frames.count == 0) {
466466
// for static single webp image
467-
CGImageRef imageRef = image.CGImage;
468-
#if SD_UIKIT || SD_WATCH
469-
if (!imageRef) {
470-
imageRef = image.images.firstObject.CGImage;
471-
}
472-
#endif
473-
data = [self sd_encodedWebpDataWithImage:imageRef quality:compressionQuality];
467+
data = [self sd_encodedWebpDataWithImage:image.CGImage quality:compressionQuality];
474468
} else {
475469
// for animated webp image
476470
WebPMux *mux = WebPMuxNew();

0 commit comments

Comments
 (0)