mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-11 23:14:48 +00:00
Merge pull request #1152 from garrettmoon/allowPlaceholderNodesToBeStretchable
Allow images returned by placeholderImage to be stretchable
This commit is contained in:
commit
279a04cfa6
@ -18,6 +18,7 @@
|
||||
#import "_ASPendingState.h"
|
||||
#import "_ASDisplayView.h"
|
||||
#import "_ASScopeTimer.h"
|
||||
#import "_ASCoreAnimationExtras.h"
|
||||
#import "ASDisplayNodeExtras.h"
|
||||
#import "ASEqualityHelpers.h"
|
||||
|
||||
@ -615,7 +616,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
||||
}
|
||||
|
||||
if (_placeholderLayer) {
|
||||
_placeholderLayer.contents = (id)_placeholderImage.CGImage;
|
||||
[self setupPlaceholderLayerContents];
|
||||
}
|
||||
}
|
||||
|
||||
@ -2011,13 +2012,24 @@ static BOOL ShouldUseNewRenderingRange = YES;
|
||||
if (_placeholderImage && _placeholderLayer && self.layer.contents == nil) {
|
||||
[CATransaction begin];
|
||||
[CATransaction setDisableActions:YES];
|
||||
_placeholderLayer.contents = (id)_placeholderImage.CGImage;
|
||||
[self setupPlaceholderLayerContents];
|
||||
_placeholderLayer.opacity = 1.0;
|
||||
[CATransaction commit];
|
||||
[self.layer addSublayer:_placeholderLayer];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setupPlaceholderLayerContents
|
||||
{
|
||||
BOOL stretchable = !UIEdgeInsetsEqualToEdgeInsets(_placeholderImage.capInsets, UIEdgeInsetsZero);
|
||||
if (stretchable) {
|
||||
ASDisplayNodeSetupLayerContentsWithResizableImage(_placeholderLayer, _placeholderImage);
|
||||
} else {
|
||||
_placeholderLayer.contentsScale = self.contentsScale;
|
||||
_placeholderLayer.contents = (id)_placeholderImage.CGImage;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)displayDidFinish
|
||||
{
|
||||
[self _pendingNodeDidDisplay:self];
|
||||
|
Loading…
x
Reference in New Issue
Block a user