Replace setValue:forKey with syntactic sugar
This commit is contained in:
parent
05889b6b9c
commit
532a4d8229
|
@ -203,7 +203,7 @@ const CFStringRef kCGImagePropertyAPNGUnclampedDelayTime = (__bridge CFStringRef
|
||||||
if (options[SDImageCoderEncodeCompressionQuality]) {
|
if (options[SDImageCoderEncodeCompressionQuality]) {
|
||||||
compressionQuality = [options[SDImageCoderEncodeCompressionQuality] doubleValue];
|
compressionQuality = [options[SDImageCoderEncodeCompressionQuality] doubleValue];
|
||||||
}
|
}
|
||||||
[properties setValue:@(compressionQuality) forKey:(__bridge NSString *)kCGImageDestinationLossyCompressionQuality];
|
properties[(__bridge NSString *)kCGImageDestinationLossyCompressionQuality] = @(compressionQuality);
|
||||||
|
|
||||||
BOOL encodeFirstFrame = [options[SDImageCoderEncodeFirstFrameOnly] boolValue];
|
BOOL encodeFirstFrame = [options[SDImageCoderEncodeFirstFrameOnly] boolValue];
|
||||||
if (encodeFirstFrame || frames.count == 0) {
|
if (encodeFirstFrame || frames.count == 0) {
|
||||||
|
@ -213,7 +213,7 @@ const CFStringRef kCGImagePropertyAPNGUnclampedDelayTime = (__bridge CFStringRef
|
||||||
// for animated APNG images
|
// for animated APNG images
|
||||||
NSUInteger loopCount = image.sd_imageLoopCount;
|
NSUInteger loopCount = image.sd_imageLoopCount;
|
||||||
NSDictionary *pngProperties = @{(__bridge NSString *)kCGImagePropertyAPNGLoopCount : @(loopCount)};
|
NSDictionary *pngProperties = @{(__bridge NSString *)kCGImagePropertyAPNGLoopCount : @(loopCount)};
|
||||||
[properties setValue:pngProperties forKey:(__bridge NSString *)kCGImagePropertyPNGDictionary];
|
properties[(__bridge NSString *)kCGImagePropertyPNGDictionary] = pngProperties;
|
||||||
CGImageDestinationSetProperties(imageDestination, (__bridge CFDictionaryRef)properties);
|
CGImageDestinationSetProperties(imageDestination, (__bridge CFDictionaryRef)properties);
|
||||||
|
|
||||||
for (size_t i = 0; i < frames.count; i++) {
|
for (size_t i = 0; i < frames.count; i++) {
|
||||||
|
|
|
@ -288,7 +288,7 @@
|
||||||
if (options[SDImageCoderEncodeCompressionQuality]) {
|
if (options[SDImageCoderEncodeCompressionQuality]) {
|
||||||
compressionQuality = [options[SDImageCoderEncodeCompressionQuality] doubleValue];
|
compressionQuality = [options[SDImageCoderEncodeCompressionQuality] doubleValue];
|
||||||
}
|
}
|
||||||
[properties setValue:@(compressionQuality) forKey:(__bridge NSString *)kCGImageDestinationLossyCompressionQuality];
|
properties[(__bridge NSString *)kCGImageDestinationLossyCompressionQuality] = @(compressionQuality);
|
||||||
|
|
||||||
BOOL encodeFirstFrame = [options[SDImageCoderEncodeFirstFrameOnly] boolValue];
|
BOOL encodeFirstFrame = [options[SDImageCoderEncodeFirstFrameOnly] boolValue];
|
||||||
if (encodeFirstFrame || frames.count == 0) {
|
if (encodeFirstFrame || frames.count == 0) {
|
||||||
|
@ -298,7 +298,7 @@
|
||||||
// for animated GIF images
|
// for animated GIF images
|
||||||
NSUInteger loopCount = image.sd_imageLoopCount;
|
NSUInteger loopCount = image.sd_imageLoopCount;
|
||||||
NSDictionary *gifProperties = @{(__bridge NSString *)kCGImagePropertyGIFLoopCount : @(loopCount)};
|
NSDictionary *gifProperties = @{(__bridge NSString *)kCGImagePropertyGIFLoopCount : @(loopCount)};
|
||||||
[properties setValue:gifProperties forKey:(__bridge NSString *)kCGImagePropertyGIFDictionary];
|
properties[(__bridge NSString *)kCGImagePropertyGIFDictionary] = gifProperties;
|
||||||
CGImageDestinationSetProperties(imageDestination, (__bridge CFDictionaryRef)properties);
|
CGImageDestinationSetProperties(imageDestination, (__bridge CFDictionaryRef)properties);
|
||||||
|
|
||||||
for (size_t i = 0; i < frames.count; i++) {
|
for (size_t i = 0; i < frames.count; i++) {
|
||||||
|
|
|
@ -221,12 +221,12 @@
|
||||||
#else
|
#else
|
||||||
CGImagePropertyOrientation exifOrientation = kCGImagePropertyOrientationUp;
|
CGImagePropertyOrientation exifOrientation = kCGImagePropertyOrientationUp;
|
||||||
#endif
|
#endif
|
||||||
[properties setValue:@(exifOrientation) forKey:(__bridge NSString *)kCGImagePropertyOrientation];
|
properties[(__bridge NSString *)kCGImagePropertyOrientation] = @(exifOrientation);
|
||||||
double compressionQuality = 1;
|
double compressionQuality = 1;
|
||||||
if (options[SDImageCoderEncodeCompressionQuality]) {
|
if (options[SDImageCoderEncodeCompressionQuality]) {
|
||||||
compressionQuality = [options[SDImageCoderEncodeCompressionQuality] doubleValue];
|
compressionQuality = [options[SDImageCoderEncodeCompressionQuality] doubleValue];
|
||||||
}
|
}
|
||||||
[properties setValue:@(compressionQuality) forKey:(__bridge NSString *)kCGImageDestinationLossyCompressionQuality];
|
properties[(__bridge NSString *)kCGImageDestinationLossyCompressionQuality] = @(compressionQuality);
|
||||||
|
|
||||||
// Add your image to the destination.
|
// Add your image to the destination.
|
||||||
CGImageDestinationAddImage(imageDestination, image.CGImage, (__bridge CFDictionaryRef)properties);
|
CGImageDestinationAddImage(imageDestination, image.CGImage, (__bridge CFDictionaryRef)properties);
|
||||||
|
|
|
@ -233,7 +233,7 @@ static id<SDImageLoader> _defaultImageLoader;
|
||||||
} else {
|
} else {
|
||||||
mutableContext = [NSMutableDictionary dictionary];
|
mutableContext = [NSMutableDictionary dictionary];
|
||||||
}
|
}
|
||||||
[mutableContext setValue:cachedImage forKey:SDWebImageContextLoaderCachedImage];
|
mutableContext[SDWebImageContextLoaderCachedImage] = cachedImage;
|
||||||
context = [mutableContext copy];
|
context = [mutableContext copy];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue