Merge pull request #2406 from dreampiggy/fix_gif_rotation_after_exif_image

Fix the bug when FLAnimatedImageView firstly show one EXIF rotation JPEG `UIImage`, later animated GIF `FLAnimatedImage` will also be rotated
This commit is contained in:
Bogdan Poplauschi 2018-07-29 21:39:46 +03:00 committed by GitHub
commit 8f187477c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -127,8 +127,9 @@ static inline FLAnimatedImage * SDWebImageCreateFLAnimatedImage(FLAnimatedImageV
FLAnimatedImage *associatedAnimatedImage = image.sd_FLAnimatedImage;
if (associatedAnimatedImage) {
// Asscociated animated image exist
// FLAnimatedImage framework contains a bug that cause GIF been rotated if previous rendered image orientation is not Up. We have to call `setImage:` with non-nil image to reset the state. See `https://github.com/rs/SDWebImage/issues/2402`
strongSelf.image = associatedAnimatedImage.posterImage;
strongSelf.animatedImage = associatedAnimatedImage;
strongSelf.image = nil;
return;
}
// Step 2. Check if original compressed image data is "GIF"
@ -150,11 +151,11 @@ static inline FLAnimatedImage * SDWebImageCreateFLAnimatedImage(FLAnimatedImageV
if (strongSelf.sd_cacheFLAnimatedImage) {
image.sd_FLAnimatedImage = animatedImage;
}
strongSelf.image = animatedImage.posterImage;
strongSelf.animatedImage = animatedImage;
strongSelf.image = nil;
} else {
strongSelf.animatedImage = nil;
strongSelf.image = image;
strongSelf.animatedImage = nil;
}
}
progress:progressBlock