Merge pull request #3039 from henry2423/master

Fix the `maxPixelSize` logic issue will cause a upscale in SDImageIOAnimatedCoder
This commit is contained in:
DreamPiggy 2020-06-23 11:13:03 +08:00 committed by GitHub
commit 28898e23fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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) {