Skip to content

Commit

Permalink
Revert "Fixed duplicate symbol in RCTAnimatedImage.h"
Browse files Browse the repository at this point in the history
This reverts commit 06de4e6.
  • Loading branch information
janicduplessis committed Aug 25, 2019
1 parent e96b523 commit 1509ed5
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions Libraries/Image/RCTAnimatedImage.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,25 @@ - (instancetype)initWithData:(NSData *)data scale:(CGFloat)scale
if (!imageSource) {
return nil;
}

BOOL framesValid = [self scanAndCheckFramesValidWithSource:imageSource];
if (!framesValid) {
CFRelease(imageSource);
return nil;
}

_imageSource = imageSource;

// grab image at the first index
UIImage *image = [self animatedImageFrameAtIndex:0];
if (!image) {
return nil;
}
self = [super initWithCGImage:image.CGImage scale:MAX(scale, 1) orientation:image.imageOrientation];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
}

return self;
}

Expand All @@ -63,18 +63,18 @@ - (BOOL)scanAndCheckFramesValidWithSource:(CGImageSourceRef)imageSource
NSUInteger frameCount = CGImageSourceGetCount(imageSource);
NSUInteger loopCount = [self imageLoopCountWithSource:imageSource];
NSMutableArray<RCTGIFCoderFrame *> *frames = [NSMutableArray array];

for (size_t i = 0; i < frameCount; i++) {
RCTGIFCoderFrame *frame = [[RCTGIFCoderFrame alloc] init];
frame.index = i;
frame.duration = [self frameDurationAtIndex:i source:imageSource];
[frames addObject:frame];
}

_frameCount = frameCount;
_loopCount = loopCount;
_frames = [frames copy];

return YES;
}

Expand All @@ -101,7 +101,7 @@ - (float)frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source
}
NSDictionary *frameProperties = (__bridge NSDictionary *)cfFrameProperties;
NSDictionary *gifProperties = frameProperties[(NSString *)kCGImagePropertyGIFDictionary];

NSNumber *delayTimeUnclampedProp = gifProperties[(NSString *)kCGImagePropertyGIFUnclampedDelayTime];
if (delayTimeUnclampedProp != nil) {
frameDuration = [delayTimeUnclampedProp floatValue];
Expand All @@ -111,7 +111,7 @@ - (float)frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source
frameDuration = [delayTimeProp floatValue];
}
}

CFRelease(cfFrameProperties);
return frameDuration;
}
Expand Down

0 comments on commit 1509ed5

Please sign in to comment.