From c08489b16fb2c0b6890d0badb2495a28575d9b41 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Mon, 28 Jan 2019 19:59:03 +0800 Subject: [PATCH 01/10] Revert the `DEFINES_MODULE` of framework. Let the user to specify `modular_headers` instead, to solve some user's build issue. See #2601 --- SDWebImage.podspec | 1 - 1 file changed, 1 deletion(-) diff --git a/SDWebImage.podspec b/SDWebImage.podspec index 19c7af81..0a30ef22 100644 --- a/SDWebImage.podspec +++ b/SDWebImage.podspec @@ -23,7 +23,6 @@ Pod::Spec.new do |s| s.requires_arc = true s.framework = 'ImageIO' - s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } s.default_subspec = 'Core' From b01bbbc5e62d02609da0993fb7a5a8cdddb12a50 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Mon, 28 Jan 2019 20:13:05 +0800 Subject: [PATCH 02/10] Update the readme about the CocoaPods modular headers usage for Swift project --- README.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 24db8487..dce54aa8 100644 --- a/README.md +++ b/README.md @@ -110,19 +110,27 @@ platform :ios, '7.0' pod 'SDWebImage', '~> 4.0' ``` -##### Swift +##### Swift and static framework -If you are using `Swift`, `Xcode 9+` and `CocoaPods` `1.5.0+`, you only need to set your target to `iOS 8+` if you need static library: +Swift project previously have to use `use_frameworks!` to make all Pods into dynamic framework to let CocoaPods works. + +However, start with `CocoaPods 1.5.0+` (with `Xcode 9+`), which supports to build both Objective-C && Swift code into static framework. You can use modular headers to use SDWebImage as static framework, without the need of `use_frameworks!`: ``` platform :ios, '8.0' +# Uncomment the next line when you want Pods as static framework +# use_modular_headers! +pod 'SDWebImage', :modular_headers => true ``` -If not, you still need to add `use_frameworks!` to use dynamic framework: +See more on [CocoaPods 1.5.0 — Swift Static Libraries](http://blog.cocoapods.org/CocoaPods-1.5.0/) + +If not, you still need to add `use_frameworks!` to use SDWebImage as dynamic framework: ``` platform :ios, '8.0' use_frameworks! +pod 'SDWebImage' ``` #### Subspecs @@ -184,3 +192,5 @@ All source code is licensed under the [MIT License](https://raw.github.com/SDWeb

+ + From 05d3c7fdcbcd0277903a06ebaa10a06b494c4724 Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Tue, 29 Jan 2019 16:23:37 +0800 Subject: [PATCH 03/10] Fix shouldDecode check when image format is GIF --- SDWebImage/SDWebImageDownloaderOperation.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SDWebImage/SDWebImageDownloaderOperation.m b/SDWebImage/SDWebImageDownloaderOperation.m index ae369997..83a074c3 100644 --- a/SDWebImage/SDWebImageDownloaderOperation.m +++ b/SDWebImage/SDWebImageDownloaderOperation.m @@ -10,6 +10,7 @@ #import "SDWebImageManager.h" #import "NSImage+WebCache.h" #import "SDWebImageCodersManager.h" +#import "UIImage+MultiFormat.h" #define LOCK(lock) dispatch_semaphore_wait(lock, DISPATCH_TIME_FOREVER); #define UNLOCK(lock) dispatch_semaphore_signal(lock); @@ -419,7 +420,7 @@ didReceiveResponse:(NSURLResponse *)response image = [self scaledImageForKey:key image:image]; // Do not force decoding animated images - BOOL shouldDecode = !image.images; + BOOL shouldDecode = !image.images && image.sd_imageFormat != SDImageFormatGIF; if (shouldDecode) { if (self.shouldDecompressImages) { BOOL shouldScaleDown = self.options & SDWebImageDownloaderScaleDownLargeImages; From 5199c0560644772490561da653e06db70df4d78b Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Tue, 29 Jan 2019 17:29:09 +0800 Subject: [PATCH 04/10] Fix modify data pointer if webp image scaled down --- SDWebImage/SDWebImageWebPCoder.m | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/SDWebImage/SDWebImageWebPCoder.m b/SDWebImage/SDWebImageWebPCoder.m index d1811e54..81f37543 100644 --- a/SDWebImage/SDWebImageWebPCoder.m +++ b/SDWebImage/SDWebImageWebPCoder.m @@ -230,10 +230,15 @@ - (UIImage *)decompressedImageWithImage:(UIImage *)image data:(NSData *__autoreleasing _Nullable *)data options:(nullable NSDictionary*)optionsDict { - // Decompress can help pre-draw the image and transfer the backing store to render process. - // Well, it can reduce the `App process memory usage` from Xcode, because the backing store is in `Other process` (render process). But it does not help for total memory usage for device. - // This logic is actually the same as Image/IO, reuse the code. The refactory has already done in 5.x - return [[SDWebImageImageIOCoder sharedCoder] decompressedImageWithImage:image data:data options:optionsDict]; + UIImage *decompressedImage = [[SDWebImageImageIOCoder sharedCoder] decompressedImageWithImage:image data:data options:optionsDict]; + // if the image is scaled down, need to modify the data pointer as well + if (decompressedImage && !CGSizeEqualToSize(decompressedImage.size, image.size) && [NSData sd_imageFormatForImageData:*data] == SDImageFormatWebP) { + NSData *imageData = [self encodedDataWithImage:decompressedImage format:SDImageFormatWebP]; + if (imageData) { + *data = imageData; + } + } + return decompressedImage; } - (nullable UIImage *)sd_drawnWebpImageWithCanvas:(CGContextRef)canvas iterator:(WebPIterator)iter colorSpace:(nonnull CGColorSpaceRef)colorSpaceRef { From 5dab8f0973e7e54633c7b2f91101f7979666e8ca Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Tue, 29 Jan 2019 18:17:49 +0800 Subject: [PATCH 05/10] Fix wrong decompression scale calculation --- SDWebImage/SDWebImageImageIOCoder.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SDWebImage/SDWebImageImageIOCoder.m b/SDWebImage/SDWebImageImageIOCoder.m index 95b25b08..f1fdfd8a 100644 --- a/SDWebImage/SDWebImageImageIOCoder.m +++ b/SDWebImage/SDWebImageImageIOCoder.m @@ -267,14 +267,14 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over CGSize sourceResolution = CGSizeZero; sourceResolution.width = CGImageGetWidth(sourceImageRef); sourceResolution.height = CGImageGetHeight(sourceImageRef); - float sourceTotalPixels = sourceResolution.width * sourceResolution.height; + CGFloat sourceTotalPixels = sourceResolution.width * sourceResolution.height * image.scale * image.scale; // Determine the scale ratio to apply to the input image // that results in an output image of the defined size. // see kDestImageSizeMB, and how it relates to destTotalPixels. - float imageScale = kDestTotalPixels / sourceTotalPixels; + CGFloat imageScale = sqrt(kDestTotalPixels / sourceTotalPixels); CGSize destResolution = CGSizeZero; - destResolution.width = (int)(sourceResolution.width*imageScale); - destResolution.height = (int)(sourceResolution.height*imageScale); + destResolution.width = (int)(sourceResolution.width * imageScale); + destResolution.height = (int)(sourceResolution.height * imageScale); // device color space CGColorSpaceRef colorspaceRef = SDCGColorSpaceGetDeviceRGB(); From ed8c80551ad111d24e29409bf4192f8115d180a2 Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Tue, 29 Jan 2019 19:42:09 +0800 Subject: [PATCH 06/10] Remove redundancy scale calculation --- SDWebImage/SDWebImageImageIOCoder.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SDWebImage/SDWebImageImageIOCoder.m b/SDWebImage/SDWebImageImageIOCoder.m index f1fdfd8a..8f31e974 100644 --- a/SDWebImage/SDWebImageImageIOCoder.m +++ b/SDWebImage/SDWebImageImageIOCoder.m @@ -267,7 +267,7 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over CGSize sourceResolution = CGSizeZero; sourceResolution.width = CGImageGetWidth(sourceImageRef); sourceResolution.height = CGImageGetHeight(sourceImageRef); - CGFloat sourceTotalPixels = sourceResolution.width * sourceResolution.height * image.scale * image.scale; + CGFloat sourceTotalPixels = sourceResolution.width * sourceResolution.height; // Determine the scale ratio to apply to the input image // that results in an output image of the defined size. // see kDestImageSizeMB, and how it relates to destTotalPixels. From 5facf00f34217b078fbaf5e6f94640e1e155504f Mon Sep 17 00:00:00 2001 From: iliaskarim Date: Wed, 30 Jan 2019 10:05:42 -0500 Subject: [PATCH 07/10] Fix typo in PULL_REQUEST_TEMPLATE.md --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index aba68f86..cbe7e161 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -10,7 +10,7 @@ * [ ] I have run the tests and they pass * [ ] I have run the lint and it passes (`pod lib lint`) -This merge request fixes / reffers to the following issues: ... +This merge request fixes / refers to the following issues: ... ### Pull Request Description From f0a4014aa95f0bbf538ed9eae6333d7a887e1484 Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Thu, 31 Jan 2019 12:01:04 +0800 Subject: [PATCH 08/10] Update the comment to show why we need filter GIF --- SDWebImage/SDWebImageDownloaderOperation.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SDWebImage/SDWebImageDownloaderOperation.m b/SDWebImage/SDWebImageDownloaderOperation.m index 83a074c3..445dbc44 100644 --- a/SDWebImage/SDWebImageDownloaderOperation.m +++ b/SDWebImage/SDWebImageDownloaderOperation.m @@ -419,7 +419,8 @@ didReceiveResponse:(NSURLResponse *)response NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:self.request.URL]; image = [self scaledImageForKey:key image:image]; - // Do not force decoding animated images + // Do not force decoding animated images or GIF, + // because there has imageCoder which can change `image` or `imageData` to static image, lose the animated feature totally. BOOL shouldDecode = !image.images && image.sd_imageFormat != SDImageFormatGIF; if (shouldDecode) { if (self.shouldDecompressImages) { From 50847380b15f3269321b5648676cd86c2cfbb817 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Thu, 31 Jan 2019 18:35:33 +0800 Subject: [PATCH 09/10] Update the CHANGELOG and README --- CHANGELOG.md | 9 +++++++++ README.md | 9 ++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7240cc39..50dfe69a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## [4.4.5 - 4.4 patch, on Jan 31st, 2019](https://github.com/SDWebImage/SDWebImage/releases/tag/4.4.5) +See [all tickets marked for the 4.4.5 release](https://github.com/SDWebImage/SDWebImage/milestone/31) + +#### Fixes +- Revert the modular framework, try to fix some user's install issue when using SDWebImage in prefix header #2604 +- Fix wrong decompression scale calculation #2608 +- Fix shouldDecode check when image format is GIF #2606 +- Fix modify data pointer if webp image scaled down #2607 + ## [4.4.4 - 4.4 patch, on Jan 26th, 2019](https://github.com/SDWebImage/SDWebImage/releases/tag/4.4.4) See [all tickets marked for the 4.4.4 release](https://github.com/SDWebImage/SDWebImage/milestone/29) diff --git a/README.md b/README.md index dce54aa8..3328f5de 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,13 @@ This library provides an async image downloader with cache support. For convenie - Image formats supported by UIImage (JPEG, PNG, ...), including GIF - WebP format, including animated WebP (use the `WebP` subspec) +- Support extendable coder plugins for new image formats. Like APNG, BPG, HFIF, SVG, etc. See all the list in [Image coder plugin List](https://github.com/SDWebImage/SDWebImage/wiki/Coder-Plugin-List) + +## Beta version + +SDWebImage's 5.0 version is nearing completion. Which introduce many new features like Animated ImageView and Transformer. We also provide a more modularized design used for advanced user customization. + +You can check the latest [5.x branch](https://github.com/SDWebImage/SDWebImage/tree/5.x) to know about the current status. We'd love you to have a try with the beta version and provide any feedback. If you'd love, check [SDWebImage 5.0 Migration Guide](https://github.com/SDWebImage/SDWebImage/wiki/5.0-Migration-guide) and prepare for the migration. ## Requirements @@ -118,7 +125,7 @@ However, start with `CocoaPods 1.5.0+` (with `Xcode 9+`), which supports to buil ``` platform :ios, '8.0' -# Uncomment the next line when you want Pods as static framework +# Uncomment the next line when you want all Pods as static framework # use_modular_headers! pod 'SDWebImage', :modular_headers => true ``` From ccb8b533c65a0e6dde9e8b34129c3c6fb73b11f4 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Thu, 31 Jan 2019 18:37:25 +0800 Subject: [PATCH 10/10] Bumped version to 4.4.5 --- SDWebImage.podspec | 2 +- WebImage/Info.plist | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SDWebImage.podspec b/SDWebImage.podspec index 0a30ef22..75c4c58d 100644 --- a/SDWebImage.podspec +++ b/SDWebImage.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'SDWebImage' - s.version = '4.4.4' + s.version = '4.4.5' s.osx.deployment_target = '10.9' s.ios.deployment_target = '7.0' diff --git a/WebImage/Info.plist b/WebImage/Info.plist index 728fc363..b509536f 100644 --- a/WebImage/Info.plist +++ b/WebImage/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 4.4.4 + 4.4.5 CFBundleSignature ???? CFBundleVersion - 4.4.4 + 4.4.5 NSPrincipalClass