Move the default animated image runloop mode to a constant, and fallback to the constant if the runloop mode is set to nil

This commit is contained in:
Eric Jensen
2016-06-09 10:53:37 -07:00
parent 370e5f1006
commit fdc57410ee
3 changed files with 9 additions and 1 deletions

View File

@@ -18,6 +18,8 @@
#import "ASInternalHelpers.h"
#import "ASWeakProxy.h"
NSString *const ASAnimatedImageDefaultRunLoopMode = NSDefaultRunLoopMode;
@implementation ASImageNode (AnimatedImage)
#pragma mark - GIF support
@@ -95,6 +97,10 @@
{
ASDN::MutexLocker l(_displayLinkLock);
if (runLoopMode == nil) {
runLoopMode = ASAnimatedImageDefaultRunLoopMode;
}
if (_displayLink != nil) {
[_displayLink removeFromRunLoop:[NSRunLoop mainRunLoop] forMode:_animatedImageRunLoopMode];
[_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:runLoopMode];

View File

@@ -105,7 +105,7 @@
_cropRect = CGRectMake(0.5, 0.5, 0, 0);
_cropDisplayBounds = CGRectNull;
_placeholderColor = ASDisplayNodeDefaultPlaceholderColor();
_animatedImageRunLoopMode = NSDefaultRunLoopMode;
_animatedImageRunLoopMode = ASAnimatedImageDefaultRunLoopMode;
return self;
}

View File

@@ -8,6 +8,8 @@
#import "ASThread.h"
extern NSString *const ASAnimatedImageDefaultRunLoopMode;
@interface ASImageNode ()
{
ASDN::RecursiveMutex _animatedImageLock;