Remove unnecessary CGImage check when encode first frame

This commit is contained in:
zhongwuzw 2019-01-29 22:07:43 +08:00
parent b8bb954213
commit 403820f89e
2 changed files with 2 additions and 4 deletions

View File

@ -208,8 +208,7 @@ const CFStringRef kCGImagePropertyAPNGUnclampedDelayTime = (__bridge CFStringRef
BOOL encodeFirstFrame = [options[SDImageCoderEncodeFirstFrameOnly] boolValue];
if (encodeFirstFrame || frames.count == 0) {
// for static single PNG images
CGImageRef imageRef = frames.firstObject.image.CGImage ?: image.CGImage;
CGImageDestinationAddImage(imageDestination, imageRef, (__bridge CFDictionaryRef)properties);
CGImageDestinationAddImage(imageDestination, image.CGImage, (__bridge CFDictionaryRef)properties);
} else {
// for animated APNG images
NSUInteger loopCount = image.sd_imageLoopCount;

View File

@ -293,8 +293,7 @@
BOOL encodeFirstFrame = [options[SDImageCoderEncodeFirstFrameOnly] boolValue];
if (encodeFirstFrame || frames.count == 0) {
// for static single GIF images
CGImageRef imageRef = frames.firstObject.image.CGImage ?: image.CGImage;
CGImageDestinationAddImage(imageDestination, imageRef, (__bridge CFDictionaryRef)properties);
CGImageDestinationAddImage(imageDestination, image.CGImage, (__bridge CFDictionaryRef)properties);
} else {
// for animated GIF images
NSUInteger loopCount = image.sd_imageLoopCount;