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

Broaden UIGraphicsRenderer Experiment to Everywhere #1433

Closed
wants to merge 1 commit into from

Conversation

Adlai-Holler
Copy link
Member

@Adlai-Holler Adlai-Holler commented Mar 29, 2019

This gets rid of the ASExperimentalGraphicsContext experiment that was a dud, and replaces ASGraphicsContexts.h with a wrapper. The wrapper calls into either UIGraphicsBeginImageContext or UIGraphicsImageRenderer to build an image.

These graphics renderers seem pretty awesome. https://gist.github.com/NSProgrammer/38f1b4f9b29c3077af3f39a7e98092b1

Want multiple core-team reviews on this since it touches such core code. It's pretty straightforward though. The one case where it wasn't straightforward (__didDisplay…) I just left with UIGraphics.

@Adlai-Holler
Copy link
Member Author

This diff is a pain to review, sorry. Split view makes it a lot easier. One day github's diff will learn to ignore whitespace – it's only Microsoft, after all.

@TextureGroup TextureGroup deleted a comment Mar 29, 2019
@TextureGroup TextureGroup deleted a comment Mar 29, 2019
@wiseoldduck
Copy link
Member

wiseoldduck commented Mar 29, 2019

This diff is a pain to review, sorry. Split view makes it a lot easier. One day github's diff will learn to ignore whitespace – it's only Microsoft, after all.
Screen Shot 2019-03-29 at 4 53 44 PM

FWIW

@TextureGroup TextureGroup deleted a comment Mar 30, 2019
@Adlai-Holler
Copy link
Member Author

There's that old-duck wisdom

@wiseoldduck
Copy link
Member

ASExperimentalGraphicsContexts is gone 🤷 Did we determine it was not helpful, or are we just sure this new experiment is good enough we won't care about that anymore?

LGTM overall

Source/ASImageNode.mm Outdated Show resolved Hide resolved
@Adlai-Holler
Copy link
Member Author

ASExperimentalGraphicsContexts is gone 🤷 Did we determine it was not helpful, or are we just sure this new experiment is good enough we won't care about that anymore?

LGTM overall

It wasn't helpful in the first place. Could be that the options were wrong on some platform, or whatever, but everyone turned it off.

ASExperimentalDrawing = 1 << 11, // exp_drawing
ASExperimentalFixRangeController = 1 << 12, // exp_fix_range_controller
ASExperimentalOOMBackgroundDeallocDisable = 1 << 13, // exp_oom_bg_dealloc_disable
ASExperimentalTransactionOperationRetainCycle = 1 << 14, // exp_transaction_operation_retain_cycle
Copy link
Contributor

Choose a reason for hiding this comment

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

Should re-ordering these be done with a separate diff?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is not re-ordering, it's replacing and it's an essential part of this diff.

@@ -538,64 +538,30 @@ + (UIImage *)displayWithParameters:(id<NSObject>)parameters isCancelled:(NS_NOES
{
ASTextNodeDrawParameter *drawParameter = (ASTextNodeDrawParameter *)parameters;

if (drawParameter->_bounds.size.width <= 0 || drawParameter->_bounds.size.height <= 0) {
if (CGRectIsEmpty(drawParameter->_bounds)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be done with a separate diff?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know. Should it?

if (!renderedWithGraphicsRenderer) {
UIGraphicsBeginImageContextWithOptions(CGSizeMake(drawParameter->_bounds.size.width, drawParameter->_bounds.size.height), drawParameter->_opaque, drawParameter->_contentScale);

return ASGraphicsCreateImageWithOptions(drawParameter->_bounds.size, drawParameter->_opaque, drawParameter->_contentScale, nil, ^{
Copy link
Contributor

Choose a reason for hiding this comment

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

@garrettmoon is still in the midst of rolling this experiment out. Please let him review before landing if possible.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, won't land without Garrett's take. I can break this apart into "TextDrawing" and "NonTextDrawing" if that is useful.

@Adlai-Holler
Copy link
Member Author

Note: don't land until @garrettmoon weighs in. Garrett, it's not a problem to leave your experiment and change this diff to add a separate one for the rest of the drawing. Let me know which way you want to go.

@TextureGroup TextureGroup deleted a comment Apr 12, 2019
@ghost
Copy link

ghost commented Apr 12, 2019

🚫 CI failed with log

@garrettmoon
Copy link
Member

I'd like to get a bit more data from the text experiment before we merge this. Thank you @Adlai-Holler for putting this up!

@Adlai-Holler
Copy link
Member Author

OK let's leave your experiment intact. Reopening as a separate experiment.

@ghost
Copy link

ghost commented Apr 26, 2019

1 Warning
⚠️ This is a big PR, please consider splitting it up to ease code review.

Generated by 🚫 Danger

@ghost
Copy link

ghost commented Apr 26, 2019

🚫 CI failed with log

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.

4 participants