Fix the compile issue on macOS. Fix the animated frame force decode issue on macOS
This commit is contained in:
parent
6bb8641783
commit
c9dffc64dc
|
@ -20,12 +20,14 @@ UIImage * _Nullable SDImageCacheDecodeImageData(NSData * _Nonnull imageData, NSS
|
||||||
CGFloat scale = scaleValue.doubleValue >= 1 ? scaleValue.doubleValue : SDImageScaleFactorForKey(cacheKey);
|
CGFloat scale = scaleValue.doubleValue >= 1 ? scaleValue.doubleValue : SDImageScaleFactorForKey(cacheKey);
|
||||||
NSNumber *preserveAspectRatioValue = context[SDWebImageContextImagePreserveAspectRatio];
|
NSNumber *preserveAspectRatioValue = context[SDWebImageContextImagePreserveAspectRatio];
|
||||||
NSValue *thumbnailSizeValue;
|
NSValue *thumbnailSizeValue;
|
||||||
|
#if SD_UIKIT || SD_WATCH
|
||||||
BOOL shouldScaleDown = SD_OPTIONS_CONTAINS(options, SDWebImageScaleDownLargeImages);
|
BOOL shouldScaleDown = SD_OPTIONS_CONTAINS(options, SDWebImageScaleDownLargeImages);
|
||||||
if (shouldScaleDown) {
|
if (shouldScaleDown) {
|
||||||
CGFloat thumbnailPixels = SDImageCoderHelper.defaultScaleDownLimitBytes / 4;
|
CGFloat thumbnailPixels = SDImageCoderHelper.defaultScaleDownLimitBytes / 4;
|
||||||
CGFloat dimension = ceil(sqrt(thumbnailPixels));
|
CGFloat dimension = ceil(sqrt(thumbnailPixels));
|
||||||
thumbnailSizeValue = @(CGSizeMake(dimension, dimension));
|
thumbnailSizeValue = @(CGSizeMake(dimension, dimension));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (context[SDWebImageContextImageThumbnailPixelSize]) {
|
if (context[SDWebImageContextImageThumbnailPixelSize]) {
|
||||||
thumbnailSizeValue = context[SDWebImageContextImageThumbnailPixelSize];
|
thumbnailSizeValue = context[SDWebImageContextImageThumbnailPixelSize];
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#import "NSData+ImageContentType.h"
|
#import "NSData+ImageContentType.h"
|
||||||
#import "SDImageCoderHelper.h"
|
#import "SDImageCoderHelper.h"
|
||||||
#import "SDAnimatedImageRep.h"
|
#import "SDAnimatedImageRep.h"
|
||||||
|
#import "UIImage+ForceDecode.h"
|
||||||
|
|
||||||
@interface SDImageIOCoderFrame : NSObject
|
@interface SDImageIOCoderFrame : NSObject
|
||||||
|
|
||||||
|
@ -502,11 +503,19 @@
|
||||||
if (!image) {
|
if (!image) {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
image.sd_imageFormat = self.class.imageFormat;
|
||||||
// Image/IO create CGImage does not decode, so we do this because this is called background queue, this can avoid main queue block when rendering(especially when one more imageViews use the same image instance)
|
// Image/IO create CGImage does not decode, so we do this because this is called background queue, this can avoid main queue block when rendering(especially when one more imageViews use the same image instance)
|
||||||
UIImage *decodedImage = [SDImageCoderHelper decodedImageWithImage:image];
|
CGImageRef imageRef = [SDImageCoderHelper CGImageCreateDecoded:image.CGImage];
|
||||||
if (decodedImage) {
|
if (!imageRef) {
|
||||||
image = decodedImage;
|
return image;
|
||||||
}
|
}
|
||||||
|
#if SD_MAC
|
||||||
|
image = [[UIImage alloc] initWithCGImage:imageRef scale:_scale orientation:kCGImagePropertyOrientationUp];
|
||||||
|
#else
|
||||||
|
image = [[UIImage alloc] initWithCGImage:imageRef scale:_scale orientation:image.imageOrientation];
|
||||||
|
#endif
|
||||||
|
CGImageRelease(imageRef);
|
||||||
|
image.sd_isDecoded = YES;
|
||||||
image.sd_imageFormat = self.class.imageFormat;
|
image.sd_imageFormat = self.class.imageFormat;
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,12 +34,14 @@ UIImage * _Nullable SDImageLoaderDecodeImageData(NSData * _Nonnull imageData, NS
|
||||||
CGFloat scale = scaleValue.doubleValue >= 1 ? scaleValue.doubleValue : SDImageScaleFactorForKey(cacheKey);
|
CGFloat scale = scaleValue.doubleValue >= 1 ? scaleValue.doubleValue : SDImageScaleFactorForKey(cacheKey);
|
||||||
NSNumber *preserveAspectRatioValue = context[SDWebImageContextImagePreserveAspectRatio];
|
NSNumber *preserveAspectRatioValue = context[SDWebImageContextImagePreserveAspectRatio];
|
||||||
NSValue *thumbnailSizeValue;
|
NSValue *thumbnailSizeValue;
|
||||||
|
#if SD_UIKIT || SD_WATCH
|
||||||
BOOL shouldScaleDown = SD_OPTIONS_CONTAINS(options, SDWebImageScaleDownLargeImages);
|
BOOL shouldScaleDown = SD_OPTIONS_CONTAINS(options, SDWebImageScaleDownLargeImages);
|
||||||
if (shouldScaleDown) {
|
if (shouldScaleDown) {
|
||||||
CGFloat thumbnailPixels = SDImageCoderHelper.defaultScaleDownLimitBytes / 4;
|
CGFloat thumbnailPixels = SDImageCoderHelper.defaultScaleDownLimitBytes / 4;
|
||||||
CGFloat dimension = ceil(sqrt(thumbnailPixels));
|
CGFloat dimension = ceil(sqrt(thumbnailPixels));
|
||||||
thumbnailSizeValue = @(CGSizeMake(dimension, dimension));
|
thumbnailSizeValue = @(CGSizeMake(dimension, dimension));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (context[SDWebImageContextImageThumbnailPixelSize]) {
|
if (context[SDWebImageContextImageThumbnailPixelSize]) {
|
||||||
thumbnailSizeValue = context[SDWebImageContextImageThumbnailPixelSize];
|
thumbnailSizeValue = context[SDWebImageContextImageThumbnailPixelSize];
|
||||||
}
|
}
|
||||||
|
@ -109,12 +111,14 @@ UIImage * _Nullable SDImageLoaderDecodeProgressiveImageData(NSData * _Nonnull im
|
||||||
CGFloat scale = scaleValue.doubleValue >= 1 ? scaleValue.doubleValue : SDImageScaleFactorForKey(cacheKey);
|
CGFloat scale = scaleValue.doubleValue >= 1 ? scaleValue.doubleValue : SDImageScaleFactorForKey(cacheKey);
|
||||||
NSNumber *preserveAspectRatioValue = context[SDWebImageContextImagePreserveAspectRatio];
|
NSNumber *preserveAspectRatioValue = context[SDWebImageContextImagePreserveAspectRatio];
|
||||||
NSValue *thumbnailSizeValue;
|
NSValue *thumbnailSizeValue;
|
||||||
|
#if SD_UIKIT || SD_WATCH
|
||||||
BOOL shouldScaleDown = SD_OPTIONS_CONTAINS(options, SDWebImageScaleDownLargeImages);
|
BOOL shouldScaleDown = SD_OPTIONS_CONTAINS(options, SDWebImageScaleDownLargeImages);
|
||||||
if (shouldScaleDown) {
|
if (shouldScaleDown) {
|
||||||
CGFloat thumbnailPixels = SDImageCoderHelper.defaultScaleDownLimitBytes / 4;
|
CGFloat thumbnailPixels = SDImageCoderHelper.defaultScaleDownLimitBytes / 4;
|
||||||
CGFloat dimension = ceil(sqrt(thumbnailPixels));
|
CGFloat dimension = ceil(sqrt(thumbnailPixels));
|
||||||
thumbnailSizeValue = @(CGSizeMake(dimension, dimension));
|
thumbnailSizeValue = @(CGSizeMake(dimension, dimension));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (context[SDWebImageContextImageThumbnailPixelSize]) {
|
if (context[SDWebImageContextImageThumbnailPixelSize]) {
|
||||||
thumbnailSizeValue = context[SDWebImageContextImageThumbnailPixelSize];
|
thumbnailSizeValue = context[SDWebImageContextImageThumbnailPixelSize];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue