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

Update GraphicsRenderer experiment to support image-formation cancellation #1696

Closed
wants to merge 1 commit into from

Conversation

Adlai-Holler
Copy link
Member

This approach is exactly how the convenience function imageWithActions: is implemented, except that it supports cancellation just like our UIGraphicsBeginImage path.

@vovasty
Copy link
Contributor

vovasty commented Oct 3, 2019

I guess we need to add isCancelled to ASGraphicsCreateImageWithOptions

@Adlai-Holler
Copy link
Member Author

The function already has that argument @vovasty . I'd appreciate some reviews on this, since it's experiment-gated and has shown to impact performance in practice.

@vovasty
Copy link
Contributor

vovasty commented Oct 8, 2019

@Adlai-Holler I meant ASGraphicsCreateImageWithTraitCollectionAndOptions . It should replace ASGraphicsCreateImageWithOptions in #1676. I've removed cancellation parameter cause it wasn't used.

// last moment i.e. before actually creating the resulting image.
__block UIImage *image;
NSError *error;
[[[UIGraphicsImageRenderer alloc] initWithSize:size format:format]
Copy link
Contributor

Choose a reason for hiding this comment

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

ASGraphicsCreateImageWithOptions may return nil in case of error or cancelation. It should be reflected in header.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree.

@bolsinga
Copy link
Contributor

bolsinga commented Oct 8, 2019

@Adlai-Holler I meant ASGraphicsCreateImageWithTraitCollectionAndOptions . It should replace ASGraphicsCreateImageWithOptions in #1676. I've removed cancellation parameter cause it wasn't used.

Yes; traitCollection was added for dark mode support.

@vovasty
Copy link
Contributor

vovasty commented Oct 9, 2019

@Adlai-Holler could you please rebase latest changes from master (it fixes CI) and update nullability?

…tImage" level as well as during the drawing process.
@Adlai-Holler Adlai-Holler force-pushed the AHGraphicsRendererCancel branch from 20775a1 to 44a1df8 Compare October 13, 2019 19:30
Copy link
Contributor

@vovasty vovasty left a comment

Choose a reason for hiding this comment

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

Hi @Adlai-Holler, thank you for the PR.
could you please

  1. Update header file with nullability
  2. add isCancelled parameter to ASGraphicsCreateImageWithTraitCollectionAndOptions
  3. change all places where ASGraphicsCreateImageWithTraitCollectionAndOptions is used without isCancelled parameter

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.

LGTM. Let's merge this and follow up with updating the header/documentation with the returned value when error or cancellation occurs (nil). Thanks, @Adlai-Holler!

@bolsinga
Copy link
Contributor

Closing due to #1814

@bolsinga bolsinga closed this Sep 24, 2020
@bolsinga bolsinga deleted the AHGraphicsRendererCancel branch September 24, 2020 19:02
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