fix issues: SDWebImageDecodeFirstFrameOnly flag is ignored when image loaded from cache.

This commit is contained in:
vvveiii 2019-05-16 16:41:23 +08:00
parent 28e3ca312b
commit bc2b52007c
No known key found for this signature in database
GPG Key ID: 6F33C997D71C1F64
1 changed files with 10 additions and 0 deletions

View File

@ -15,6 +15,7 @@
#import "SDImageCoderHelper.h"
#import "SDAnimatedImage.h"
#import "UIImage+MemoryCacheCost.h"
#import "UIImage+Metadata.h"
@interface SDImageCache ()
@ -378,6 +379,15 @@
// First check the in-memory cache...
UIImage *image = [self imageFromMemoryCacheForKey:key];
if ((options & SDImageCacheDecodeFirstFrameOnly) && image.sd_isAnimated) {
#if SD_MAC
image = [[NSImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:kCGImagePropertyOrientationUp];
#else
image = [[UIImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:image.imageOrientation];
#endif
}
BOOL shouldQueryMemoryOnly = (image && !(options & SDImageCacheQueryMemoryData));
if (shouldQueryMemoryOnly) {
if (doneBlock) {