Merge pull request #2414 from dreampiggy/bugfix_downloader_options
Fix that downloader options about image decoding is not correctly set
This commit is contained in:
commit
d1d43aad5b
|
@ -33,13 +33,13 @@ UIImage * _Nullable SDImageCacheDecodeImageData(NSData * _Nonnull imageData, NSS
|
|||
}
|
||||
}
|
||||
if (!image) {
|
||||
SDImageCoderOptions *options = @{SDImageCoderDecodeFirstFrameOnly : @(decodeFirstFrame), SDImageCoderDecodeScaleFactor : @(scale)};
|
||||
SDImageCoderOptions *coderOptions = @{SDImageCoderDecodeFirstFrameOnly : @(decodeFirstFrame), SDImageCoderDecodeScaleFactor : @(scale)};
|
||||
if (context) {
|
||||
SDImageCoderMutableOptions *mutableOptions = [options mutableCopy];
|
||||
[mutableOptions setValue:context forKey:SDImageCoderWebImageContext];
|
||||
options = [mutableOptions copy];
|
||||
SDImageCoderMutableOptions *mutableCoderOptions = [coderOptions mutableCopy];
|
||||
[mutableCoderOptions setValue:context forKey:SDImageCoderWebImageContext];
|
||||
coderOptions = [mutableCoderOptions copy];
|
||||
}
|
||||
image = [[SDImageCodersManager sharedManager] decodedImageWithData:imageData options:options];
|
||||
image = [[SDImageCodersManager sharedManager] decodedImageWithData:imageData options:coderOptions];
|
||||
}
|
||||
if (image) {
|
||||
BOOL shouldDecode = (options & SDWebImageAvoidDecodeImage) == 0;
|
||||
|
|
|
@ -47,13 +47,13 @@ UIImage * _Nullable SDImageLoaderDecodeImageData(NSData * _Nonnull imageData, NS
|
|||
}
|
||||
}
|
||||
if (!image) {
|
||||
SDImageCoderOptions *options = @{SDImageCoderDecodeFirstFrameOnly : @(decodeFirstFrame), SDImageCoderDecodeScaleFactor : @(scale)};
|
||||
SDImageCoderOptions *coderOptions = @{SDImageCoderDecodeFirstFrameOnly : @(decodeFirstFrame), SDImageCoderDecodeScaleFactor : @(scale)};
|
||||
if (context) {
|
||||
SDImageCoderMutableOptions *mutableOptions = [options mutableCopy];
|
||||
[mutableOptions setValue:context forKey:SDImageCoderWebImageContext];
|
||||
options = [mutableOptions copy];
|
||||
SDImageCoderMutableOptions *mutableCoderOptions = [coderOptions mutableCopy];
|
||||
[mutableCoderOptions setValue:context forKey:SDImageCoderWebImageContext];
|
||||
coderOptions = [mutableCoderOptions copy];
|
||||
}
|
||||
image = [[SDImageCodersManager sharedManager] decodedImageWithData:imageData options:options];
|
||||
image = [[SDImageCodersManager sharedManager] decodedImageWithData:imageData options:coderOptions];
|
||||
}
|
||||
if (image) {
|
||||
BOOL shouldDecode = (options & SDWebImageAvoidDecodeImage) == 0;
|
||||
|
@ -125,13 +125,13 @@ UIImage * _Nullable SDImageLoaderDecodeProgressiveImageData(NSData * _Nonnull im
|
|||
}
|
||||
}
|
||||
if (!image) {
|
||||
SDImageCoderOptions *options = @{SDImageCoderDecodeFirstFrameOnly : @(decodeFirstFrame), SDImageCoderDecodeScaleFactor : @(scale)};
|
||||
SDImageCoderOptions *coderOptions = @{SDImageCoderDecodeFirstFrameOnly : @(decodeFirstFrame), SDImageCoderDecodeScaleFactor : @(scale)};
|
||||
if (context) {
|
||||
SDImageCoderMutableOptions *mutableOptions = [options mutableCopy];
|
||||
[mutableOptions setValue:context forKey:SDImageCoderWebImageContext];
|
||||
options = [mutableOptions copy];
|
||||
SDImageCoderMutableOptions *mutableCoderOptions = [coderOptions mutableCopy];
|
||||
[mutableCoderOptions setValue:context forKey:SDImageCoderWebImageContext];
|
||||
coderOptions = [mutableCoderOptions copy];
|
||||
}
|
||||
image = [progressiveCoder incrementalDecodedImageWithOptions:options];
|
||||
image = [progressiveCoder incrementalDecodedImageWithOptions:coderOptions];
|
||||
}
|
||||
if (image) {
|
||||
BOOL shouldDecode = (options & SDWebImageAvoidDecodeImage) == 0;
|
||||
|
|
|
@ -488,6 +488,9 @@ didReceiveResponse:(NSURLResponse *)response
|
|||
if (options & SDWebImageAllowInvalidSSLCertificates) downloaderOptions |= SDWebImageDownloaderAllowInvalidSSLCertificates;
|
||||
if (options & SDWebImageHighPriority) downloaderOptions |= SDWebImageDownloaderHighPriority;
|
||||
if (options & SDWebImageScaleDownLargeImages) downloaderOptions |= SDWebImageDownloaderScaleDownLargeImages;
|
||||
if (options & SDWebImageAvoidDecodeImage) downloaderOptions |= SDWebImageDownloaderAvoidDecodeImage;
|
||||
if (options & SDWebImageDecodeFirstFrameOnly) downloaderOptions |= SDWebImageDownloaderDecodeFirstFrameOnly;
|
||||
if (options & SDWebImagePreloadAllFrames) downloaderOptions |= SDWebImageDownloaderPreloadAllFrames;
|
||||
|
||||
if (cachedImage && options & SDWebImageRefreshCached) {
|
||||
// force progressive off if image already cached but forced refreshing
|
||||
|
|
Loading…
Reference in New Issue