Merge pull request #2609 from zhongwuzw/remove_unnecessary_CGImage_check

Remove unnecessary CGImage check when encode first frame
This commit is contained in:
DreamPiggy 2019-01-30 11:42:36 +08:00 committed by GitHub
commit da48dc6f6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;