Fix the `maxPixelSize` logic issue will cause a upscale in SDImageIOAnimatedCoder

This commit is contained in:
Henry Huang 2020-06-22 16:15:22 +08:00
parent fe92b7aa3d
commit 4332c29740
1 changed files with 1 additions and 1 deletions

View File

@ -468,7 +468,7 @@ static NSString * kSDCGImageDestinationRequestedFileSize = @"kCGImageDestination
NSUInteger pixelWidth = CGImageGetWidth(imageRef);
NSUInteger pixelHeight = CGImageGetHeight(imageRef);
CGFloat finalPixelSize = 0;
if (maxPixelSize.width > 0 && maxPixelSize.height > 0 && pixelWidth > 0 && pixelHeight > 0) {
if (maxPixelSize.width > 0 && maxPixelSize.height > 0 && pixelWidth > maxPixelSize.width && pixelHeight > maxPixelSize.height) {
CGFloat pixelRatio = pixelWidth / pixelHeight;
CGFloat maxPixelSizeRatio = maxPixelSize.width / maxPixelSize.height;
if (pixelRatio > maxPixelSizeRatio) {