Skip to content

Fix the case when SDWebImageFirstFrameOnly hit memory cache, the animated image still been provided #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- Expecta (1.0.6)
- SDWebImage/Core (5.0.0)
- SDWebImage/Core (5.0.2)
- SDWebImageYYPlugin (0.2.0):
- SDWebImage/Core (~> 5.0)
- SDWebImageYYPlugin/YYCache (= 0.2.0)
Expand Down Expand Up @@ -34,7 +34,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
Expecta: 3b6bd90a64b9a1dcb0b70aa0e10a7f8f631667d5
SDWebImage: 5de80a0302de9e377e62f47d2fa1304efff0e55f
SDWebImage: 6764b5fa0f73c203728052955dbefa2bf1f33282
SDWebImageYYPlugin: 3398b1f1016cd30d8fdb857226c254a0da8b1a11
YYCache: 8105b6638f5e849296c71f331ff83891a4942952
YYImage: 1e1b62a9997399593e4b9c4ecfbbabbf1d3f3b54
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ @implementation YYCache (SDAdditions)

// First check the in-memory cache...
UIImage *image = [self.memoryCache objectForKey: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) {
Expand Down