Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ASDisplayNode] Notify rasterized subnodes that render pass has completed #532

Conversation

smeis
Copy link
Contributor

@smeis smeis commented Aug 25, 2017

After the rendering pass of an ASDisplayNode has completed the didDisplayAsyncLayer: method is invoked which will trigger displayDidFinish. However, in a hierarchy that is rasterized the rendering of the subnodes is done by rasterizing them, hence didDisplayAsyncLayer: and displayDidFinish will only be invoked on the root node and not on the subnodes.

So subnodes that are in a rasterized hierarchy will not be notified that the rendering pass has completed. I came across this issue when working with ASNetworkImageNode. Both ASNetworkImageNode and ASMultiplexImageNode depend on displayDidFinish to notify their delegates that they finished displaying their image, which won't happen if they're in a rasterized tree.

@CLAassistant
Copy link

CLAassistant commented Aug 25, 2017

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@nguyenhuy nguyenhuy left a comment

Choose a reason for hiding this comment

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

Thanks for submitting this diff, especially with a unit test!

One question for you. Should displayWillStart be called on rasterized subnodes as well, probably here? If not, I think we'll have imbalance calls on the two delegations (e.g displayWillStart and displayDidFinish).

While this change looks good to me, I'd like to have another review from a core member before merging.

@@ -347,6 +349,12 @@ - (void)displayAsyncLayer:(_ASDisplayLayer *)asyncLayer asynchronously:(BOOL)asy
layer.contents = (id)image.CGImage;
}
[self didDisplayAsyncLayer:self.asyncLayer];

if (_flags.rasterizesSubtree) {
Copy link
Member

Choose a reason for hiding this comment

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

Since we no longer hold the instance lock by the time this completionBlock is executed, I think we should either grab this flag at the beginning of this method and use it here, or call self.rasterizesSubtree here.

@smeis
Copy link
Contributor Author

smeis commented Aug 29, 2017

Thanks for your review @nguyenhuy ! I've added a commit to grab the flag with the instance lock held.

I agree that we should balance the delegate calls. While updating the unit test for this I noticed that displayWillStart will be invoked twice on a node when the display process starts. It's called directly from willDisplayAsyncLayer:asynchronously:, this is followed by a call to displayWillStartAsynchronously: which will also call displayWillStart here. Is this intended behavior?

@nguyenhuy
Copy link
Member

Awesome, looking forward to the tests!

To answer your question, no it's not expected. I submitted a PR yesterday to address it: #536.

@smeis
Copy link
Contributor Author

smeis commented Aug 29, 2017

Ah yes I see! I've added a call to -willDisplayAsyncLayer: and extended the test.

Copy link
Contributor

@maicki maicki left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@nguyenhuy nguyenhuy merged commit 0bd18c8 into TextureGroup:master Sep 7, 2017
bernieperez pushed a commit to AtomTickets/Texture that referenced this pull request Apr 25, 2018
…eted (TextureGroup#532)

* Notify rasterized subsides that render pass has completed

* Traverse entire subnode tree notifying all subnodes

* Add entry in changelog

* Retrieve rasterizesSubtree flag while holding instance lock

* Balance display delegate calls for rasterized subnodes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants