mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-13 07:39:37 +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 "_ASPendingState.h"
|
||||||
#import "_ASDisplayView.h"
|
#import "_ASDisplayView.h"
|
||||||
#import "_ASScopeTimer.h"
|
#import "_ASScopeTimer.h"
|
||||||
|
#import "_ASCoreAnimationExtras.h"
|
||||||
#import "ASDisplayNodeExtras.h"
|
#import "ASDisplayNodeExtras.h"
|
||||||
#import "ASEqualityHelpers.h"
|
#import "ASEqualityHelpers.h"
|
||||||
|
|
||||||
@ -615,7 +616,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_placeholderLayer) {
|
if (_placeholderLayer) {
|
||||||
_placeholderLayer.contents = (id)_placeholderImage.CGImage;
|
[self setupPlaceholderLayerContents];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2011,13 +2012,24 @@ static BOOL ShouldUseNewRenderingRange = YES;
|
|||||||
if (_placeholderImage && _placeholderLayer && self.layer.contents == nil) {
|
if (_placeholderImage && _placeholderLayer && self.layer.contents == nil) {
|
||||||
[CATransaction begin];
|
[CATransaction begin];
|
||||||
[CATransaction setDisableActions:YES];
|
[CATransaction setDisableActions:YES];
|
||||||
_placeholderLayer.contents = (id)_placeholderImage.CGImage;
|
[self setupPlaceholderLayerContents];
|
||||||
_placeholderLayer.opacity = 1.0;
|
_placeholderLayer.opacity = 1.0;
|
||||||
[CATransaction commit];
|
[CATransaction commit];
|
||||||
[self.layer addSublayer:_placeholderLayer];
|
[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
|
- (void)displayDidFinish
|
||||||
{
|
{
|
||||||
[self _pendingNodeDidDisplay:self];
|
[self _pendingNodeDidDisplay:self];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user