Update the behavior for `SDScaledImageForScaleFactor` on animated image
This commit is contained in:
parent
fb7ded8066
commit
7bf6a59524
|
@ -84,7 +84,11 @@ inline UIImage * _Nullable SDScaledImageForScaleFactor(CGFloat scale, UIImage *
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!scaledImage && image.sd_isAnimated) {
|
||||
if (scaledImage) {
|
||||
SDImageCopyAssociatedObject(image, scaledImage);
|
||||
return scaledImage;
|
||||
}
|
||||
if (image.sd_isAnimated) {
|
||||
UIImage *animatedImage;
|
||||
#if SD_UIKIT || SD_WATCH
|
||||
// `UIAnimatedImage` images share the same size and scale.
|
||||
|
@ -120,9 +124,12 @@ inline UIImage * _Nullable SDScaledImageForScaleFactor(CGFloat scale, UIImage *
|
|||
scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:kCGImagePropertyOrientationUp];
|
||||
#endif
|
||||
}
|
||||
SDImageCopyAssociatedObject(image, scaledImage);
|
||||
if (scaledImage) {
|
||||
SDImageCopyAssociatedObject(image, scaledImage);
|
||||
return scaledImage;
|
||||
}
|
||||
|
||||
return scaledImage;
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark - Context option
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
* Returns the underlaying `NSBitmapImageRep` or `SDAnimatedImageRep` frame count.
|
||||
* Returns 1 for static image.
|
||||
* SDAnimatedImage:
|
||||
* Returns `animatedImageFrameCount`
|
||||
* Returns `animatedImageFrameCount` for animated image, 1 for static image.
|
||||
*/
|
||||
@property (nonatomic, assign, readonly) NSUInteger sd_imageFrameCount;
|
||||
|
||||
|
|
Loading…
Reference in New Issue