From 0437759c80e0fc585afa319ef2c69f6e1418b5be Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Thu, 7 Jun 2018 10:59:38 +0800 Subject: [PATCH 1/2] Fix that WebP (including Animated WebP) decoding issue on iOS 12. Using the correct bitmapInfo to avoid `CGImageCreate` failed when the WebP image contains no alpha channel --- SDWebImage/SDWebImageWebPCoder.m | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/SDWebImage/SDWebImageWebPCoder.m b/SDWebImage/SDWebImageWebPCoder.m index 9f5e9bf4..a57a4bad 100644 --- a/SDWebImage/SDWebImageWebPCoder.m +++ b/SDWebImage/SDWebImageWebPCoder.m @@ -73,9 +73,12 @@ int canvasWidth = WebPDemuxGetI(demuxer, WEBP_FF_CANVAS_WIDTH); int canvasHeight = WebPDemuxGetI(demuxer, WEBP_FF_CANVAS_HEIGHT); CGBitmapInfo bitmapInfo; + // `CGBitmapContextCreate` does not support RGB888 on iOS. Where `CGImageCreate` supports. if (!(flags & ALPHA_FLAG)) { + // RGBX8888 bitmapInfo = kCGBitmapByteOrder32Big | kCGImageAlphaNoneSkipLast; } else { + // RGBA8888 bitmapInfo = kCGBitmapByteOrder32Big | kCGImageAlphaPremultipliedLast; } CGContextRef canvas = CGBitmapContextCreate(NULL, canvasWidth, canvasHeight, 8, 0, SDCGColorSpaceGetDeviceRGB(), bitmapInfo); @@ -298,7 +301,15 @@ CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, config.output.u.RGBA.rgba, config.output.u.RGBA.size, FreeImageData); CGColorSpaceRef colorSpaceRef = SDCGColorSpaceGetDeviceRGB(); - CGBitmapInfo bitmapInfo = config.input.has_alpha ? kCGBitmapByteOrder32Big | kCGImageAlphaPremultipliedLast : kCGBitmapByteOrder32Big | kCGImageAlphaNoneSkipLast; + CGBitmapInfo bitmapInfo; + // `CGBitmapContextCreate` does not support RGB888 on iOS. Where `CGImageCreate` supports. + if (!config.input.has_alpha) { + // RGB888 + bitmapInfo = kCGBitmapByteOrder32Big | kCGImageAlphaNone; + } else { + // RGBA8888 + bitmapInfo = kCGBitmapByteOrder32Big | kCGImageAlphaPremultipliedLast; + } size_t components = config.input.has_alpha ? 4 : 3; CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault; CGImageRef imageRef = CGImageCreate(width, height, 8, components * 8, components * width, colorSpaceRef, bitmapInfo, provider, NULL, NO, renderingIntent); From b05959dbcbb9ff34f4356dcec3af8642ddc0dd87 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Thu, 7 Jun 2018 23:11:45 +0800 Subject: [PATCH 2/2] Bumped version to 4.4.1 update CHANGELOG --- CHANGELOG.md | 9 +++++++++ SDWebImage.podspec | 2 +- WebImage/Info.plist | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 454fabd9..5ebf44af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## [4.4.1 - 4.4 patch, on June 7th, 2018](https://github.com/rs/SDWebImage/releases/tag/4.4.1) +See [all tickets marked for the 4.4.1 release](https://github.com/rs/SDWebImage/milestone/26) + +#### Fixes +- Coder + - Fix that WebP (including Animated WebP) decoding issue on iOS 12 #2348 #2347 +- Downloader + - Fix that the downloader operation may not call the completion block when requesting the same image url in race condition #2346 #2344 + ## [4.4.0 - watchOS View Category, on May 31st, 2018](https://github.com/rs/SDWebImage/releases/tag/4.4.0) See [all tickets marked for the 4.4.0 release](https://github.com/rs/SDWebImage/milestone/25) diff --git a/SDWebImage.podspec b/SDWebImage.podspec index 3aa2d9e8..0b6bb6d1 100644 --- a/SDWebImage.podspec +++ b/SDWebImage.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'SDWebImage' - s.version = '4.4.0' + s.version = '4.4.1' s.osx.deployment_target = '10.9' s.ios.deployment_target = '7.0' diff --git a/WebImage/Info.plist b/WebImage/Info.plist index d29940a0..81e2ffa0 100644 --- a/WebImage/Info.plist +++ b/WebImage/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 4.4.0 + 4.4.1 CFBundleSignature ???? CFBundleVersion - 4.4.0 + 4.4.1 NSPrincipalClass