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

[ASTextNode] Move to class method of drawRect:withParameters:isCancelled:isRasterizing: for drawing #232

Merged
merged 1 commit into from
May 9, 2017

Conversation

maicki
Copy link
Contributor

@maicki maicki commented May 3, 2017

In our effort going forward to make the framework safer to work with and to enable future optimizations like lifting up caching into a generalized way out of ASImageNode and ASTextNode specific ways this PR will remove the instance version of drawRect:withParameters:isCancelled:isRasterizing: in favor of using the class method.

@ghost
Copy link

ghost commented May 3, 2017

🚫 CI failed with log

Copy link
Member

@Adlai-Holler Adlai-Holler left a comment

Choose a reason for hiding this comment

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

One thought

if (!UIEdgeInsetsEqualToEdgeInsets(_textContainerInset, UIEdgeInsetsZero)) {
drawParameters[ASTextNodeContainerInsetsDrawParameterKey] = [NSValue valueWithUIEdgeInsets:_textContainerInset];
}
drawParameters[ASTextNodeRendererDrawParameterKey] = [self _rendererWithBoundsSlow:self.bounds];
Copy link
Member

Choose a reason for hiding this comment

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

Getting this renderer is indeed slow so we shouldn't run it on the main thread – can we do one of these two things:

  • Make a bigger change where _rendererWithBoundsSlow: becomes a class method
  • Or make this a smaller change where we return self from this method and use it in +drawRect:withParameters:(self) and update this implementation later.

@maicki maicki changed the title [ASDisplayNode] Remove instance:-drawRect:withParameters:isCancelled:isRasterizing: [ASTextNode] Move to class method of drawRect:withParameters:isCancelled:isRasterizing: for drawing May 5, 2017
@maicki maicki force-pushed the MSStaticDrawing branch 2 times, most recently from 7f75489 to 73416c0 Compare May 9, 2017 18:37
Copy link
Member

@Adlai-Holler Adlai-Holler left a comment

Choose a reason for hiding this comment

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

Nice! One step closer to simpler thread-safety.

@ghost
Copy link

ghost commented May 9, 2017

🚫 CI failed with log

@maicki maicki merged commit 4dbbba7 into master May 9, 2017
@maicki maicki deleted the MSStaticDrawing branch May 9, 2017 21:20
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

2 participants