Skip to content

Commit

Permalink
Merge pull request #32 from SDWebImage/fix_thumbnail_progressive_size
Browse files Browse the repository at this point in the history
Fix the issue that thumbnail decoding does not works for progressive webp image
  • Loading branch information
dreampiggy authored Jan 18, 2020
2 parents e58c901 + 0cc073a commit 11e4f1a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions SDWebImageWebPCoder/Classes/SDImageWebPCoder.m
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,13 @@ - (UIImage *)incrementalDecodedImageWithOptions:(SDImageCoderOptions *)options {
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];
Expand Down

0 comments on commit 11e4f1a

Please sign in to comment.