diff --git a/SDWebImage/SDImageCacheDefine.m b/SDWebImage/SDImageCacheDefine.m index 61e00183..255b860e 100644 --- a/SDWebImage/SDImageCacheDefine.m +++ b/SDWebImage/SDImageCacheDefine.m @@ -17,7 +17,7 @@ UIImage * _Nullable SDImageCacheDecodeImageData(NSData * _Nonnull imageData, NSS BOOL decodeFirstFrame = options & SDWebImageDecodeFirstFrameOnly; NSNumber *scaleValue = context[SDWebImageContextImageScaleFactor]; CGFloat scale = scaleValue.doubleValue >= 1 ? scaleValue.doubleValue : SDImageScaleFactorForKey(cacheKey); - SDImageCoderOptions *coderOptions = @{SDImageCoderDecodeFirstFrameOnly : @(decodeFirstFrame), SDImageCoderDecodeScaleFactor : @(MAX(scale, 1))}; + SDImageCoderOptions *coderOptions = @{SDImageCoderDecodeFirstFrameOnly : @(decodeFirstFrame), SDImageCoderDecodeScaleFactor : @(scale)}; if (context) { SDImageCoderMutableOptions *mutableCoderOptions = [coderOptions mutableCopy]; [mutableCoderOptions setValue:context forKey:SDImageCoderWebImageContext]; diff --git a/SDWebImage/SDImageLoader.m b/SDWebImage/SDImageLoader.m index d8343b50..cb1d8609 100644 --- a/SDWebImage/SDImageLoader.m +++ b/SDWebImage/SDImageLoader.m @@ -31,7 +31,7 @@ UIImage * _Nullable SDImageLoaderDecodeImageData(NSData * _Nonnull imageData, NS BOOL decodeFirstFrame = options & SDWebImageDecodeFirstFrameOnly; NSNumber *scaleValue = context[SDWebImageContextImageScaleFactor]; CGFloat scale = scaleValue.doubleValue >= 1 ? scaleValue.doubleValue : SDImageScaleFactorForKey(cacheKey); - SDImageCoderOptions *coderOptions = @{SDImageCoderDecodeFirstFrameOnly : @(decodeFirstFrame), SDImageCoderDecodeScaleFactor : @(MAX(scale, 1))}; + SDImageCoderOptions *coderOptions = @{SDImageCoderDecodeFirstFrameOnly : @(decodeFirstFrame), SDImageCoderDecodeScaleFactor : @(scale)}; if (context) { SDImageCoderMutableOptions *mutableCoderOptions = [coderOptions mutableCopy]; [mutableCoderOptions setValue:context forKey:SDImageCoderWebImageContext]; @@ -90,7 +90,7 @@ UIImage * _Nullable SDImageLoaderDecodeProgressiveImageData(NSData * _Nonnull im BOOL decodeFirstFrame = options & SDWebImageDecodeFirstFrameOnly; NSNumber *scaleValue = context[SDWebImageContextImageScaleFactor]; CGFloat scale = scaleValue.doubleValue >= 1 ? scaleValue.doubleValue : SDImageScaleFactorForKey(cacheKey); - SDImageCoderOptions *coderOptions = @{SDImageCoderDecodeFirstFrameOnly : @(decodeFirstFrame), SDImageCoderDecodeScaleFactor : @(MAX(scale, 1))}; + SDImageCoderOptions *coderOptions = @{SDImageCoderDecodeFirstFrameOnly : @(decodeFirstFrame), SDImageCoderDecodeScaleFactor : @(scale)}; if (context) { SDImageCoderMutableOptions *mutableCoderOptions = [coderOptions mutableCopy]; [mutableCoderOptions setValue:context forKey:SDImageCoderWebImageContext]; diff --git a/SDWebImage/SDWebImageDefine.m b/SDWebImage/SDWebImageDefine.m index d339020a..c2175264 100644 --- a/SDWebImage/SDWebImageDefine.m +++ b/SDWebImage/SDWebImageDefine.m @@ -39,14 +39,14 @@ inline CGFloat SDImageScaleFactorForKey(NSString * _Nullable key) { NSString *fileScale = [NSString stringWithFormat:@"@%@x.", scaleFactor]; if ([key containsString:fileScale]) { scale = scaleFactor.doubleValue; - return scale; + return MAX(scale, 1); } if (isURL) { // %402x. for url encode NSString *urlScale = [NSString stringWithFormat:@"%%40%@x.", scaleFactor]; if ([key containsString:urlScale]) { scale = scaleFactor.doubleValue; - return scale; + return MAX(scale, 1); } } }