Skip to content

Commit d222140

Browse files
committed
Removed the unused options for CGImageSourceCopyPropertiesAtIndex
1 parent a53eb92 commit d222140

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

SDWebImage/Core/SDImageIOAnimatedCoder.m

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,8 @@ + (NSUInteger)imageLoopCountWithSource:(CGImageSourceRef)source {
183183
}
184184

185185
+ (NSTimeInterval)frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source {
186-
NSDictionary *options = @{
187-
(__bridge NSString *)kCGImageSourceShouldCacheImmediately : @(YES),
188-
(__bridge NSString *)kCGImageSourceShouldCache : @(YES) // Always cache to reduce CPU usage
189-
};
190186
NSTimeInterval frameDuration = 0.1;
191-
CFDictionaryRef cfFrameProperties = CGImageSourceCopyPropertiesAtIndex(source, index, (__bridge CFDictionaryRef)options);
187+
CFDictionaryRef cfFrameProperties = CGImageSourceCopyPropertiesAtIndex(source, index, NULL);
192188
if (!cfFrameProperties) {
193189
return frameDuration;
194190
}
@@ -234,9 +230,8 @@ + (UIImage *)createFrameAtIndex:(NSUInteger)index source:(CGImageSourceRef)sourc
234230
};
235231
}
236232
}
237-
// Some options need to pass to `CGImageSourceCopyPropertiesAtIndex` before `CGImageSourceCreateImageAtIndex`, or ImageIO will ignore them because they parse once :)
238233
// Parse the image properties
239-
NSDictionary *properties = (__bridge_transfer NSDictionary *)CGImageSourceCopyPropertiesAtIndex(source, index, (__bridge CFDictionaryRef)options);
234+
NSDictionary *properties = (__bridge_transfer NSDictionary *)CGImageSourceCopyPropertiesAtIndex(source, index, NULL);
240235
CGFloat pixelWidth = [properties[(__bridge NSString *)kCGImagePropertyPixelWidth] doubleValue];
241236
CGFloat pixelHeight = [properties[(__bridge NSString *)kCGImagePropertyPixelHeight] doubleValue];
242237
CGImagePropertyOrientation exifOrientation = (CGImagePropertyOrientation)[properties[(__bridge NSString *)kCGImagePropertyOrientation] unsignedIntegerValue];
@@ -515,11 +510,7 @@ - (void)updateIncrementalData:(NSData *)data finished:(BOOL)finished {
515510
CGImageSourceUpdateData(_imageSource, (__bridge CFDataRef)data, finished);
516511

517512
if (_width + _height == 0) {
518-
NSDictionary *options = @{
519-
(__bridge NSString *)kCGImageSourceShouldCacheImmediately : @(YES),
520-
(__bridge NSString *)kCGImageSourceShouldCache : @(YES) // Always cache to reduce CPU usage
521-
};
522-
CFDictionaryRef properties = CGImageSourceCopyPropertiesAtIndex(_imageSource, 0, (__bridge CFDictionaryRef)options);
513+
CFDictionaryRef properties = CGImageSourceCopyPropertiesAtIndex(_imageSource, 0, NULL);
523514
if (properties) {
524515
CFTypeRef val = CFDictionaryGetValue(properties, kCGImagePropertyPixelHeight);
525516
if (val) CFNumberGetValue(val, kCFNumberLongType, &_height);

0 commit comments

Comments
 (0)