change to AWebP

This commit is contained in:
kinarobin 2021-05-21 14:18:58 +08:00
parent 22cd94d08a
commit 426830d55f
4 changed files with 10 additions and 21 deletions

View File

@ -14,7 +14,6 @@ def all_test_pods
pod 'SDWebImage/MapKit', :path => './'
pod 'Expecta'
pod 'KVOController'
pod 'SDWebImageWebPCoder', :git => 'https://github.com/SDWebImage/SDWebImageWebPCoder.git', :branch => 'master'
end
example_project_path = 'Examples/SDWebImage Demo'

View File

@ -20,7 +20,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDMemoryCacheCostForImage(UIImage *image) {
#if SD_MAC
frameCount = 1;
#elif SD_UIKIT || SD_WATCH
// Filter the same image in `_UIAnimatedImage`.
// Filter the same frame in `_UIAnimatedImage`.
frameCount = image.images.count > 0 ? [NSSet setWithArray:image.images].count : 1;
#endif
NSUInteger cost = bytesPerFrame * frameCount;

View File

@ -562,16 +562,12 @@
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Tests TV/Pods-Tests TV-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/SDWebImage-Core-MapKit-tvOS/SDWebImage.framework",
"${BUILT_PRODUCTS_DIR}/SDWebImageWebPCoder-tvOS/SDWebImageWebPCoder.framework",
"${BUILT_PRODUCTS_DIR}/libwebp-tvOS/libwebp.framework",
"${BUILT_PRODUCTS_DIR}/Expecta-tvOS/Expecta.framework",
"${BUILT_PRODUCTS_DIR}/KVOController-tvOS/KVOController.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImageWebPCoder.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libwebp.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Expecta.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/KVOController.framework",
);
@ -606,16 +602,12 @@
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Tests Mac/Pods-Tests Mac-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/SDWebImage-Core-MapKit-macOS/SDWebImage.framework",
"${BUILT_PRODUCTS_DIR}/SDWebImageWebPCoder-macOS/SDWebImageWebPCoder.framework",
"${BUILT_PRODUCTS_DIR}/libwebp-macOS/libwebp.framework",
"${BUILT_PRODUCTS_DIR}/Expecta-macOS/Expecta.framework",
"${BUILT_PRODUCTS_DIR}/KVOController-macOS/KVOController.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImageWebPCoder.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libwebp.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Expecta.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/KVOController.framework",
);
@ -632,16 +624,12 @@
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Tests iOS/Pods-Tests iOS-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/SDWebImage-Core-MapKit-iOS/SDWebImage.framework",
"${BUILT_PRODUCTS_DIR}/SDWebImageWebPCoder-iOS/SDWebImageWebPCoder.framework",
"${BUILT_PRODUCTS_DIR}/libwebp-iOS/libwebp.framework",
"${BUILT_PRODUCTS_DIR}/Expecta-iOS/Expecta.framework",
"${BUILT_PRODUCTS_DIR}/KVOController-iOS/KVOController.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImageWebPCoder.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libwebp.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Expecta.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/KVOController.framework",
);

View File

@ -10,7 +10,6 @@
#import "SDTestCase.h"
#import "SDInternalMacros.h"
#import <KVOController/KVOController.h>
#import <SDWebImageWebPCoder/SDWebImageWebPCoder.h>
static const NSUInteger kTestGIFFrameCount = 5; // local TestImage.gif loop count
@ -767,12 +766,15 @@ static BOOL _isCalled;
}
- (void)test36AnimatedImageMemoryCost {
[[SDImageCodersManager sharedManager] addCoder:[SDImageWebPCoder sharedCoder]];
UIImage *image = [UIImage sd_imageWithData:[NSData dataWithContentsOfFile:[self testMemotyCostImagePath]]];
NSUInteger cost = [image sd_memoryCost];
expect(image.images.count).equal(5333);
expect(image.scale).equal(1);
expect(cost).equal(16 * image.size.width * image.size.height * 4);
if (@available(iOS 14, tvOS 14, macOS 11, watchOS 7, *)) {
[[SDImageCodersManager sharedManager] addCoder:[SDImageAWebPCoder sharedCoder]];
UIImage *image = [UIImage sd_imageWithData:[NSData dataWithContentsOfFile:[self testMemotyCostImagePath]]];
NSUInteger cost = [image sd_memoryCost];
expect(image.images.count).equal(5333);
expect(image.scale).equal(1);
expect(cost).equal(16 * image.size.width * image.size.height * 4);
[[SDImageCodersManager sharedManager] removeCoder:[SDImageAWebPCoder sharedCoder]];
}
}
#pragma mark - Helper