mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
A couple performance tweaks for animated images #trivial (#634)
* A couple performance tweaks for animated images * @nguyenhuy's comments * Avoid calling animatedImageData twice. Thanks @maicki. * Fix call to background deallocation * Good catch by @Adlai-Holler
This commit is contained in:
@@ -55,6 +55,7 @@ NSString *const ASAnimatedImageDefaultRunLoopMode = NSRunLoopCommonModes;
|
||||
}
|
||||
|
||||
id <ASAnimatedImageProtocol> previousAnimatedImage = _animatedImage;
|
||||
|
||||
_animatedImage = animatedImage;
|
||||
|
||||
if (animatedImage != nil) {
|
||||
@@ -80,6 +81,11 @@ NSString *const ASAnimatedImageDefaultRunLoopMode = NSRunLoopCommonModes;
|
||||
}
|
||||
|
||||
[self animatedImageSet:_animatedImage previousAnimatedImage:previousAnimatedImage];
|
||||
|
||||
// Animated image can take while to dealloc, do it off the main queue
|
||||
if (previousAnimatedImage != nil) {
|
||||
ASPerformBackgroundDeallocation(&previousAnimatedImage);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)animatedImageSet:(id <ASAnimatedImageProtocol>)newAnimatedImage previousAnimatedImage:(id <ASAnimatedImageProtocol>)previousAnimatedImage
|
||||
|
||||
Reference in New Issue
Block a user