From 0cc073a435db357939e580f4e9ad8d7c03dbb600 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Sat, 18 Jan 2020 18:21:45 +0800 Subject: [PATCH] Fix the issue that thumbnail decoding does not works for progressive webp image --- SDWebImageWebPCoder/Classes/SDImageWebPCoder.m | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m b/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m index 8855bf7..8b602aa 100644 --- a/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m +++ b/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m @@ -362,6 +362,13 @@ static CGSize SDCalculateThumbnailSize(CGSize fullSize, BOOL preserveAspectRatio scale = 1; } } + CGSize scaledSize = SDCalculateThumbnailSize(CGSizeMake(width, height), _preserveAspectRatio, _thumbnailSize); + // Check whether we need to use thumbnail + if (!CGSizeEqualToSize(CGSizeMake(width, height), scaledSize)) { + CGImageRef scaledImageRef = [SDImageCoderHelper CGImageCreateScaled:newImageRef size:scaledSize]; + CGImageRelease(newImageRef); + newImageRef = scaledImageRef; + } #if SD_UIKIT || SD_WATCH image = [[UIImage alloc] initWithCGImage:newImageRef scale:scale orientation:UIImageOrientationUp];