Skip to content

Commit 0cc073a

Browse files
committed
Fix the issue that thumbnail decoding does not works for progressive webp image
1 parent e58c901 commit 0cc073a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

SDWebImageWebPCoder/Classes/SDImageWebPCoder.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,13 @@ - (UIImage *)incrementalDecodedImageWithOptions:(SDImageCoderOptions *)options {
362362
scale = 1;
363363
}
364364
}
365+
CGSize scaledSize = SDCalculateThumbnailSize(CGSizeMake(width, height), _preserveAspectRatio, _thumbnailSize);
366+
// Check whether we need to use thumbnail
367+
if (!CGSizeEqualToSize(CGSizeMake(width, height), scaledSize)) {
368+
CGImageRef scaledImageRef = [SDImageCoderHelper CGImageCreateScaled:newImageRef size:scaledSize];
369+
CGImageRelease(newImageRef);
370+
newImageRef = scaledImageRef;
371+
}
365372

366373
#if SD_UIKIT || SD_WATCH
367374
image = [[UIImage alloc] initWithCGImage:newImageRef scale:scale orientation:UIImageOrientationUp];

0 commit comments

Comments
 (0)