...
|
...
|
@@ -440,11 +440,16 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { |
|
|
}
|
|
|
|
|
|
- (nullable UIImage *)diskImageForKey:(nullable NSString *)key data:(nullable NSData *)data {
|
|
|
return [self diskImageForKey:key data:data options:0];
|
|
|
}
|
|
|
|
|
|
- (nullable UIImage *)diskImageForKey:(nullable NSString *)key data:(nullable NSData *)data options:(SDImageCacheOptions)options {
|
|
|
if (data) {
|
|
|
UIImage *image = [[SDWebImageCodersManager sharedInstance] decodedImageWithData:data];
|
|
|
image = [self scaledImageForKey:key image:image];
|
|
|
if (self.config.shouldDecompressImages) {
|
|
|
image = [[SDWebImageCodersManager sharedInstance] decompressedImageWithImage:image data:&data options:@{SDWebImageCoderScaleDownLargeImagesKey: @(NO)}];
|
|
|
BOOL shouldScaleDown = options & SDImageCacheScaleDownLargeImages;
|
|
|
image = [[SDWebImageCodersManager sharedInstance] decompressedImageWithImage:image data:&data options:@{SDWebImageCoderScaleDownLargeImagesKey: @(shouldScaleDown)}];
|
|
|
}
|
|
|
return image;
|
|
|
} else {
|
...
|
...
|
@@ -495,7 +500,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { |
|
|
cacheType = SDImageCacheTypeMemory;
|
|
|
} else if (diskData) {
|
|
|
// decode image data only if in-memory cache missed
|
|
|
diskImage = [self diskImageForKey:key data:diskData];
|
|
|
diskImage = [self diskImageForKey:key data:diskData options:options];
|
|
|
if (diskImage && self.config.shouldCacheImagesInMemory) {
|
|
|
NSUInteger cost = SDCacheCostForImage(diskImage);
|
|
|
[self.memCache setObject:diskImage forKey:key cost:cost];
|
...
|
...
|
|