Fix the animated image for sd_imageFormat

This commit is contained in:
DreamPiggy 2020-01-05 20:39:44 +08:00
parent 0b0c0d2840
commit ae4aa3f848
1 changed files with 7 additions and 3 deletions

View File

@ -499,12 +499,16 @@
- (UIImage *)animatedImageFrameAtIndex:(NSUInteger)index { - (UIImage *)animatedImageFrameAtIndex:(NSUInteger)index {
UIImage *image = [self.class createFrameAtIndex:index source:_imageSource scale:_scale preserveAspectRatio:_preserveAspectRatio thumbnailSize:_thumbnailSize]; UIImage *image = [self.class createFrameAtIndex:index source:_imageSource scale:_scale preserveAspectRatio:_preserveAspectRatio thumbnailSize:_thumbnailSize];
if (!image) {
return nil;
}
// Image/IO create CGImage does not decode, so we do this because this is called background queue, this can avoid main queue block when rendering(especially when one more imageViews use the same image instance) // Image/IO create CGImage does not decode, so we do this because this is called background queue, this can avoid main queue block when rendering(especially when one more imageViews use the same image instance)
UIImage *decodedImage = [SDImageCoderHelper decodedImageWithImage:image]; UIImage *decodedImage = [SDImageCoderHelper decodedImageWithImage:image];
if (!decodedImage) { if (decodedImage) {
return image; image = decodedImage;
} }
return decodedImage; image.sd_imageFormat = self.class.imageFormat;
return image;
} }
@end @end