Merge pull request #66 from SDWebImage/fix_encode_maxPixelSize

Fix the encoding maxPixelSize logic (patch)
This commit is contained in:
DreamPiggy 2022-06-22 17:03:13 +08:00 committed by GitHub
commit 2a6c8fac7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -860,7 +860,7 @@ static CGSize SDCalculateThumbnailSize(CGSize fullSize, BOOL preserveAspectRatio
} }
// Check if need to scale pixel size // Check if need to scale pixel size
if (maxPixelSize.width > 0 && maxPixelSize.height > 0 && width > maxPixelSize.width && height > maxPixelSize.height) { if (maxPixelSize.width > 0 && maxPixelSize.height > 0 && (width > maxPixelSize.width || height > maxPixelSize.height)) {
CGSize scaledSize = SDCalculateThumbnailSize(CGSizeMake(width, height), YES, maxPixelSize); CGSize scaledSize = SDCalculateThumbnailSize(CGSizeMake(width, height), YES, maxPixelSize);
result = WebPPictureRescale(&picture, scaledSize.width, scaledSize.height); result = WebPPictureRescale(&picture, scaledSize.width, scaledSize.height);
if (!result) { if (!result) {