Merge pull request #2725 from cntrump/master
fix issues: SDWebImageDecodeFirstFrameOnly flag is ignored when image loaded from cache
This commit is contained in:
commit
daad5338e2
|
@ -15,6 +15,7 @@
|
||||||
#import "SDImageCoderHelper.h"
|
#import "SDImageCoderHelper.h"
|
||||||
#import "SDAnimatedImage.h"
|
#import "SDAnimatedImage.h"
|
||||||
#import "UIImage+MemoryCacheCost.h"
|
#import "UIImage+MemoryCacheCost.h"
|
||||||
|
#import "UIImage+Metadata.h"
|
||||||
|
|
||||||
@interface SDImageCache ()
|
@interface SDImageCache ()
|
||||||
|
|
||||||
|
@ -378,6 +379,15 @@
|
||||||
|
|
||||||
// First check the in-memory cache...
|
// First check the in-memory cache...
|
||||||
UIImage *image = [self imageFromMemoryCacheForKey:key];
|
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));
|
BOOL shouldQueryMemoryOnly = (image && !(options & SDImageCacheQueryMemoryData));
|
||||||
if (shouldQueryMemoryOnly) {
|
if (shouldQueryMemoryOnly) {
|
||||||
if (doneBlock) {
|
if (doneBlock) {
|
||||||
|
|
Loading…
Reference in New Issue