mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
[ASDisplayNode] If We Skipped Rendering Due to Zero-Area, Re-Render When We Get a Real Area (#2149)
* Add failing test case * [_ASDisplayLayer] If we skipped render due to being zero-size, enqueue a render when we get a real size * Remove pointless import
This commit is contained in:
@@ -301,7 +301,7 @@ struct ASImageNodeDrawParameters {
|
||||
imageModificationBlock = drawParameter.imageModificationBlock;
|
||||
}
|
||||
|
||||
BOOL hasValidCropBounds = cropEnabled && !CGRectIsNull(cropDisplayBounds) && !CGRectIsEmpty(cropDisplayBounds);
|
||||
BOOL hasValidCropBounds = cropEnabled && !CGRectIsEmpty(cropDisplayBounds);
|
||||
CGRect bounds = (hasValidCropBounds ? cropDisplayBounds : drawParameterBounds);
|
||||
|
||||
ASDisplayNodeContextModifier preContextBlock = self.willDisplayNodeContentWithRenderingContext;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
// We can take this lock when we're setting displaySuspended and in setNeedsDisplay, so to not deadlock, this is recursive
|
||||
ASDN::RecursiveMutex _displaySuspendedLock;
|
||||
BOOL _displaySuspended;
|
||||
BOOL _attemptedDisplayWhileZeroSized;
|
||||
|
||||
struct {
|
||||
BOOL delegateDidChangeBounds:1;
|
||||
@@ -102,6 +103,11 @@
|
||||
[super setBounds:bounds];
|
||||
self.asyncdisplaykit_node.threadSafeBounds = bounds;
|
||||
}
|
||||
|
||||
if (_attemptedDisplayWhileZeroSized && CGRectIsEmpty(bounds) == NO && self.needsDisplayOnBoundsChange == NO) {
|
||||
_attemptedDisplayWhileZeroSized = NO;
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG // These override is strictly to help detect application-level threading errors. Avoid method overhead in release.
|
||||
@@ -189,9 +195,9 @@
|
||||
|
||||
- (void)display
|
||||
{
|
||||
ASDisplayNodeAssertMainThread();
|
||||
[self _hackResetNeedsDisplay];
|
||||
|
||||
ASDisplayNodeAssertMainThread();
|
||||
if (self.isDisplaySuspended) {
|
||||
return;
|
||||
}
|
||||
@@ -201,7 +207,11 @@
|
||||
|
||||
- (void)display:(BOOL)asynchronously
|
||||
{
|
||||
id<_ASDisplayLayerDelegate> __attribute__((objc_precise_lifetime)) strongAsyncDelegate;
|
||||
if (CGRectIsEmpty(self.bounds)) {
|
||||
_attemptedDisplayWhileZeroSized = YES;
|
||||
}
|
||||
|
||||
id<_ASDisplayLayerDelegate> NS_VALID_UNTIL_END_OF_SCOPE strongAsyncDelegate;
|
||||
{
|
||||
_asyncDelegateLock.lock();
|
||||
strongAsyncDelegate = _asyncDelegate;
|
||||
|
||||
Reference in New Issue
Block a user