Based on the previous change, we now can avoid the memory cache for GIFs, as the memory cache only holds UIImage instances and we need the NSData. Forced to load from disk if the image is a GIF
This commit is contained in:
parent
9ea1602157
commit
ada86ab939
|
@ -10,6 +10,7 @@
|
|||
#import "SDWebImageDecoder.h"
|
||||
#import "UIImage+MultiFormat.h"
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
#import "UIImage+GIF.h"
|
||||
|
||||
// See https://github.com/rs/SDWebImage/pull/1141 for discussion
|
||||
@interface AutoPurgeCache : NSCache
|
||||
|
@ -398,7 +399,11 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
|
|||
// First check the in-memory cache...
|
||||
UIImage *image = [self imageFromMemoryCacheForKey:key];
|
||||
if (image) {
|
||||
doneBlock(image, nil, SDImageCacheTypeMemory);
|
||||
NSData *diskData = nil;
|
||||
if ([image isGIF]) {
|
||||
diskData = [self diskImageDataBySearchingAllPathsForKey:key];
|
||||
}
|
||||
doneBlock(image, diskData, SDImageCacheTypeMemory);
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue