diff --git a/Example/SDWebImageWebPCoderExample.xcodeproj/project.pbxproj b/Example/SDWebImageWebPCoderExample.xcodeproj/project.pbxproj index a8dc532..46b02e1 100644 --- a/Example/SDWebImageWebPCoderExample.xcodeproj/project.pbxproj +++ b/Example/SDWebImageWebPCoderExample.xcodeproj/project.pbxproj @@ -169,15 +169,11 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${PODS_PODFILE_DIR_PATH}/Podfile.lock", "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); outputPaths = ( "$(DERIVED_FILE_DIR)/Pods-SDWebImageWebPCoderExample-checkManifestLockResult.txt", ); @@ -191,8 +187,6 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${SRCROOT}/Pods/Target Support Files/Pods-SDWebImageWebPCoderExample/Pods-SDWebImageWebPCoderExample-frameworks.sh", "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", @@ -200,8 +194,6 @@ "${BUILT_PRODUCTS_DIR}/libwebp/libwebp.framework", ); name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - ); outputPaths = ( "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImageWebPCoder.framework", diff --git a/SDWebImageWebPCoder.xcodeproj/project.pbxproj b/SDWebImageWebPCoder.xcodeproj/project.pbxproj index 75adeec..125c01d 100644 --- a/SDWebImageWebPCoder.xcodeproj/project.pbxproj +++ b/SDWebImageWebPCoder.xcodeproj/project.pbxproj @@ -485,8 +485,6 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${SRCROOT}/SDWebImageWebPCoderTests/Pods/Target Support Files/Pods-SDWebImageWebPCoderTests/Pods-SDWebImageWebPCoderTests-frameworks.sh", "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", @@ -494,8 +492,6 @@ "${BUILT_PRODUCTS_DIR}/libwebp/libwebp.framework", ); name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - ); outputPaths = ( "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImageWebPCoder.framework", @@ -511,15 +507,11 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${PODS_PODFILE_DIR_PATH}/Podfile.lock", "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); outputPaths = ( "$(DERIVED_FILE_DIR)/Pods-SDWebImageWebPCoderTests-checkManifestLockResult.txt", ); @@ -624,11 +616,16 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", - "SD_WEBP=1", "$(inherited)", ); - "GCC_PREPROCESSOR_DEFINITIONS[sdk=watchos*]" = "WEBP_USE_INTRINSICS=1 $(inherited)"; - "GCC_PREPROCESSOR_DEFINITIONS[sdk=watchsimulator*]" = "WEBP_USE_INTRINSICS=1 $(inherited)"; + "GCC_PREPROCESSOR_DEFINITIONS[sdk=watchos*]" = ( + "WEBP_USE_INTRINSICS=1", + "$(inherited)", + ); + "GCC_PREPROCESSOR_DEFINITIONS[sdk=watchsimulator*]" = ( + "WEBP_USE_INTRINSICS=1", + "$(inherited)", + ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -695,12 +692,15 @@ ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; - GCC_PREPROCESSOR_DEFINITIONS = ( - "SD_WEBP=1", + GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; + "GCC_PREPROCESSOR_DEFINITIONS[sdk=watchos*]" = ( + "WEBP_USE_INTRINSICS=1", + "$(inherited)", + ); + "GCC_PREPROCESSOR_DEFINITIONS[sdk=watchsimulator*]" = ( + "WEBP_USE_INTRINSICS=1", "$(inherited)", ); - "GCC_PREPROCESSOR_DEFINITIONS[sdk=watchos*]" = "WEBP_USE_INTRINSICS=1 $(inherited)"; - "GCC_PREPROCESSOR_DEFINITIONS[sdk=watchsimulator*]" = "WEBP_USE_INTRINSICS=1 $(inherited)"; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; diff --git a/SDWebImageWebPCoder.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/SDWebImageWebPCoder.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/SDWebImageWebPCoder.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/SDWebImageWebPCoder/Classes/SDImageWebPCoder.h b/SDWebImageWebPCoder/Classes/SDImageWebPCoder.h index 839cc55..7729681 100644 --- a/SDWebImageWebPCoder/Classes/SDImageWebPCoder.h +++ b/SDWebImageWebPCoder/Classes/SDImageWebPCoder.h @@ -6,8 +6,6 @@ * file that was distributed with this source code. */ -#ifdef SD_WEBP - #import #import @@ -19,5 +17,3 @@ @property (nonatomic, class, readonly, nonnull) SDImageWebPCoder *sharedCoder; @end - -#endif diff --git a/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m b/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m index 8dbabe1..aa98199 100644 --- a/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m +++ b/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m @@ -6,8 +6,6 @@ * file that was distributed with this source code. */ -#ifdef SD_WEBP - #import "SDImageWebPCoder.h" #import #if __has_include() @@ -30,6 +28,14 @@ #import +#ifndef SD_LOCK +#define SD_LOCK(lock) dispatch_semaphore_wait(lock, DISPATCH_TIME_FOREVER); +#endif + +#ifndef SD_UNLOCK +#define SD_UNLOCK(lock) dispatch_semaphore_signal(lock); +#endif + @interface SDWebPCoderFrame : NSObject @property (nonatomic, assign) NSUInteger index; // Frame index (zero based) @@ -748,9 +754,9 @@ static void FreeImageData(void *info, const void *data, size_t size) { if (index >= _frameCount) { return nil; } - LOCKBLOCK({ - image = [self safeAnimatedImageFrameAtIndex:index]; - }); + SD_LOCK(_lock); + image = [self safeAnimatedImageFrameAtIndex:index]; + SD_UNLOCK(_lock); return image; } @@ -826,6 +832,3 @@ static void FreeImageData(void *info, const void *data, size_t size) { } @end - -#endif - diff --git a/SDWebImageWebPCoder/Classes/UIImage+WebP.h b/SDWebImageWebPCoder/Classes/UIImage+WebP.h index 8d6c456..b127c34 100644 --- a/SDWebImageWebPCoder/Classes/UIImage+WebP.h +++ b/SDWebImageWebPCoder/Classes/UIImage+WebP.h @@ -6,8 +6,6 @@ * file that was distributed with this source code. */ -#ifdef SD_WEBP - #import // This category is just use as a convenience method. For more detail control, use methods in `UIImage+MultiFormat.h` or directlly use `SDImageCoder` @@ -23,5 +21,3 @@ + (nullable UIImage *)sd_imageWithWebPData:(nullable NSData *)data; @end - -#endif diff --git a/SDWebImageWebPCoder/Classes/UIImage+WebP.m b/SDWebImageWebPCoder/Classes/UIImage+WebP.m index 011b8ad..e0ab8f8 100644 --- a/SDWebImageWebPCoder/Classes/UIImage+WebP.m +++ b/SDWebImageWebPCoder/Classes/UIImage+WebP.m @@ -6,8 +6,6 @@ * file that was distributed with this source code. */ -#ifdef SD_WEBP - #import "UIImage+WebP.h" #import "SDImageWebPCoder.h" @@ -21,5 +19,3 @@ } @end - -#endif