From e54b276e5727e2eda8f6f4d7b777ae356a12ad88 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Sat, 2 Feb 2019 11:34:11 +0800 Subject: [PATCH] Remove unnecessary CGImage check when encode first frame because UIAnimatedImage.CGImage return the first frame's CGImage --- SDWebImageWebPCoder/Classes/SDImageWebPCoder.m | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m b/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m index 9e335c3..99116fd 100644 --- a/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m +++ b/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m @@ -464,13 +464,7 @@ BOOL encodeFirstFrame = [options[SDImageCoderEncodeFirstFrameOnly] boolValue]; if (encodeFirstFrame || frames.count == 0) { // for static single webp image - CGImageRef imageRef = image.CGImage; -#if SD_UIKIT || SD_WATCH - if (!imageRef) { - imageRef = image.images.firstObject.CGImage; - } -#endif - data = [self sd_encodedWebpDataWithImage:imageRef quality:compressionQuality]; + data = [self sd_encodedWebpDataWithImage:image.CGImage quality:compressionQuality]; } else { // for animated webp image WebPMux *mux = WebPMuxNew();