From b6f4692439ffc8af19f0a792a5616c43ff8b2d68 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Sat, 18 Jan 2020 18:43:56 +0800 Subject: [PATCH] Supports the UIImageView to show Prorgessive Animated Image's first poster frame, match the behavior of built-in coders --- SDWebImageWebPCoder/Classes/SDImageWebPCoder.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m b/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m index e068073..5412ee4 100644 --- a/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m +++ b/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m @@ -347,6 +347,14 @@ static CGSize SDCalculateThumbnailSize(CGSize fullSize, BOOL preserveAspectRatio - (UIImage *)incrementalDecodedImageWithOptions:(SDImageCoderOptions *)options { UIImage *image; + // For Animated WebP Images, progressive decoding only return the first frame. + // If you want progressive animation, use the SDAniamtedCoder protocol method instead. + if (_demux) { + SD_LOCK(_lock); + image = [self safeStaticImageFrame]; + SD_UNLOCK(_lock); + } + // For Static WebP images int width = 0; int height = 0; int last_y = 0;