Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Conversation

appleguy
Copy link
Contributor

@appleguy appleguy commented Jul 16, 2016

@johnepinterest @maicki @Adlai-Holler @chrisdanford @hannahmbanana

Hey all - this method had grown a bit over time, as features like instance method display were added, and it was time for cleanup.

I took time to do this carefully enough that I feel regressions are unlikely once it has been fully tested with the app, which I'll do over the weekend. I am very familiar with the original state of the code.

I'd like to switch the order of the if / else so that rasterization comes second, but didn't want to move it for now so the diff has a slight element of readability lol.

This should improve efficiency by eliminating several lock acquisitions, and also adding a few strategically relevant isCancelled checks. Particularly on the slowest devices with fast user input / large amounts of content moving (like on iPhone 4 with fast scrolling), I think this could make an incremental difference.

_propertyLock.unlock();

ASDisplayNodeAssert(rasterizing || !(_hierarchyState & ASHierarchyStateRasterized), @"Rasterized descendants should never display unless being drawn into the rasterized container.");
CGRect bounds = self.bounds;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered going straight to the layer for this, could do so I guess.

@ghost ghost added the CLA Signed label Jul 16, 2016
CGRect bounds = self.bounds;
CGFloat contentsScaleForDisplay = _contentsScaleForDisplay;
BOOL opaque = _layer.opaque;
BOOL shouldBeginRasterizing = (rasterizing == NO && flags.shouldRasterizeDescendants);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The most important and subtle thing about this method is the difference between rasterizing and shouldBeginRasterizing. This method may be called by itself with rasterizing == YES, sometime after it's initially called with rasterizing == NO but shouldBeginRasterizing == YES.

@ghost ghost added the CLA Signed label Jul 16, 2016
@appleguy appleguy merged commit d4c5a09 into master Jul 16, 2016
@appleguy appleguy deleted the RefactorAsyncDisplay branch July 16, 2016 23:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant