-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Conversation
I guess we need to add |
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. |
@Adlai-Holler I meant |
// last moment i.e. before actually creating the resulting image. | ||
__block UIImage *image; | ||
NSError *error; | ||
[[[UIGraphicsImageRenderer alloc] initWithSize:size format:format] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree.
Yes; traitCollection was added for dark mode support. |
@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.
20775a1
to
44a1df8
Compare
There was a problem hiding this 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
- Update header file with nullability
- add
isCancelled
parameter toASGraphicsCreateImageWithTraitCollectionAndOptions
- change all places where
ASGraphicsCreateImageWithTraitCollectionAndOptions
is used withoutisCancelled
parameter
There was a problem hiding this 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!
Closing due to #1814 |
This approach is exactly how the convenience function
imageWithActions:
is implemented, except that it supports cancellation just like our UIGraphicsBeginImage path.