mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-06 04:32:06 +00:00
Merge pull request #635 from garrettmoon/fixShouldRasterizeSubnodes
Fix should rasterize subnodes
This commit is contained in:
commit
de795d577a
@ -630,10 +630,10 @@ void ASDisplayNodeRespectThreadAffinityOfNode(ASDisplayNode *node, void (^block)
|
|||||||
{
|
{
|
||||||
ASDisplayNodeAssertMainThread();
|
ASDisplayNodeAssertMainThread();
|
||||||
ASDN::MutexLocker l(_propertyLock);
|
ASDN::MutexLocker l(_propertyLock);
|
||||||
if (CGRectEqualToRect(_layer.bounds, CGRectZero)) {
|
if (CGRectEqualToRect(self.bounds, CGRectZero)) {
|
||||||
return; // Performing layout on a zero-bounds view often results in frame calculations with negative sizes after applying margins, which will cause measureWithSizeRange: on subnodes to assert.
|
return; // Performing layout on a zero-bounds view often results in frame calculations with negative sizes after applying margins, which will cause measureWithSizeRange: on subnodes to assert.
|
||||||
}
|
}
|
||||||
_placeholderLayer.frame = _layer.bounds;
|
_placeholderLayer.frame = self.bounds;
|
||||||
[self layout];
|
[self layout];
|
||||||
[self layoutDidFinish];
|
[self layoutDidFinish];
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,13 @@ static void __ASDisplayLayerDecrementConcurrentDisplayCount(BOOL displayIsAsync,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL rasterizingFromAscendent = [self __rasterizedContainerNode] != nil;
|
||||||
|
|
||||||
|
// if super node is rasterizing descendents, subnodes will not have had layout calls becase they don't have layers
|
||||||
|
if (rasterizingFromAscendent) {
|
||||||
|
[self __layout];
|
||||||
|
}
|
||||||
|
|
||||||
// Capture these outside the display block so they are retained.
|
// Capture these outside the display block so they are retained.
|
||||||
UIColor *backgroundColor = self.backgroundColor;
|
UIColor *backgroundColor = self.backgroundColor;
|
||||||
CGRect bounds = self.bounds;
|
CGRect bounds = self.bounds;
|
||||||
@ -121,6 +128,11 @@ static void __ASDisplayLayerDecrementConcurrentDisplayCount(BOOL displayIsAsync,
|
|||||||
|
|
||||||
CGContextTranslateCTM(context, frame.origin.x, frame.origin.y);
|
CGContextTranslateCTM(context, frame.origin.x, frame.origin.y);
|
||||||
|
|
||||||
|
//support cornerRadius
|
||||||
|
if (rasterizingFromAscendent && self.cornerRadius && self.clipsToBounds) {
|
||||||
|
[[UIBezierPath bezierPathWithRoundedRect:bounds cornerRadius:self.cornerRadius] addClip];
|
||||||
|
}
|
||||||
|
|
||||||
// Fill background if any.
|
// Fill background if any.
|
||||||
CGColorRef backgroundCGColor = backgroundColor.CGColor;
|
CGColorRef backgroundCGColor = backgroundColor.CGColor;
|
||||||
if (backgroundColor && CGColorGetAlpha(backgroundCGColor) > 0.0) {
|
if (backgroundColor && CGColorGetAlpha(backgroundCGColor) > 0.0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user