mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Fix retain cycle in basic, cache-less ASNetworkImageNodes
This should not directly affect more complex apps that don't use the ASBasicImageDownloader. Also disables the default-on text placeholders, as they churn memory during the measurement pass. These were intended to be written with pure layers (without using backing stores), so I don't think it is a reasonable default-on behavior until that is fixed.
This commit is contained in:
@@ -131,7 +131,8 @@ static NSString *ASTextNodeTruncationTokenAttributeName = @"ASTextNodeTruncation
|
||||
_constrainedSize = CGSizeMake(-INFINITY, -INFINITY);
|
||||
|
||||
// Placeholders
|
||||
self.placeholderEnabled = YES;
|
||||
// Disabled by default in ASDisplayNode, but add a few options for those who toggle
|
||||
// on the special placeholder behavior of ASTextNode.
|
||||
_placeholderColor = ASDisplayNodeDefaultPlaceholderColor();
|
||||
_placeholderInsets = UIEdgeInsetsMake(1.0, 0.0, 1.0, 0.0);
|
||||
}
|
||||
@@ -747,6 +748,8 @@ static NSString *ASTextNodeTruncationTokenAttributeName = @"ASTextNodeTruncation
|
||||
|
||||
- (UIImage *)placeholderImage
|
||||
{
|
||||
// FIXME: Replace this implementation with reusable CALayers that have .backgroundColor set.
|
||||
// This would completely eliminate the memory and performance cost of the backing store.
|
||||
CGSize size = self.calculatedSize;
|
||||
UIGraphicsBeginImageContext(size);
|
||||
[self.placeholderColor setFill];
|
||||
|
||||
Reference in New Issue
Block a user