Adopt SDAnimatedImage for `sd_imageFrameCount`
This commit is contained in:
parent
4ae33983e0
commit
7f078d21ba
|
@ -314,6 +314,10 @@ static CGFloat SDImageScaleFromPath(NSString *string) {
|
|||
return;
|
||||
}
|
||||
|
||||
- (NSUInteger)sd_imageFrameCount {
|
||||
return self.animatedImageFrameCount;
|
||||
}
|
||||
|
||||
- (SDImageFormat)sd_imageFormat {
|
||||
return self.animatedImageFormat;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDMemoryCacheCostForImage(UIImage *image) {
|
|||
frameCount = 1;
|
||||
#elif SD_UIKIT || SD_WATCH
|
||||
// Filter the same frame in `_UIAnimatedImage`.
|
||||
frameCount = image.images.count > 0 ? [NSSet setWithArray:image.images].count : 1;
|
||||
frameCount = image.images.count > 1 ? [NSSet setWithArray:image.images].count : 1;
|
||||
#endif
|
||||
NSUInteger cost = bytesPerFrame * frameCount;
|
||||
return cost;
|
||||
|
|
|
@ -410,9 +410,7 @@ withLocalImageURL:(NSURL *)imageUrl
|
|||
UIImage *outputImage = [coder decodedImageWithData:outputImageData options:nil];
|
||||
expect(outputImage.size).to.equal(inputImage.size);
|
||||
expect(outputImage.scale).to.equal(inputImage.scale);
|
||||
#if SD_UIKIT
|
||||
expect(outputImage.images.count).to.equal(inputImage.images.count);
|
||||
#endif
|
||||
expect(outputImage.sd_imageLoopCount).to.equal(inputImage.sd_imageLoopCount);
|
||||
|
||||
// check max pixel size encoding with scratch
|
||||
CGFloat maxWidth = 50;
|
||||
|
@ -429,9 +427,7 @@ withLocalImageURL:(NSURL *)imageUrl
|
|||
// Image/IO's thumbnail API does not always use round to preserve precision, we check ABS <= 1
|
||||
expect(ABS(outputMaxImage.size.width - maxPixelSize.width)).beLessThanOrEqualTo(1);
|
||||
expect(ABS(outputMaxImage.size.height - maxPixelSize.height)).beLessThanOrEqualTo(1);
|
||||
#if SD_UIKIT
|
||||
expect(outputMaxImage.images.count).to.equal(inputImage.images.count);
|
||||
#endif
|
||||
expect(outputMaxImage.sd_imageLoopCount).to.equal(inputImage.sd_imageLoopCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue