Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] make color source a variant instead of a closure. #51853

Merged
merged 3 commits into from
Apr 3, 2024

Conversation

jonahwilliams
Copy link
Member

This would also me to create a type safe visitor to pull out the data required for #51778

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

LGTM modulo moving the visitor to the cc file and naming it apropos what it does, not what it is. Thanks.

RuntimeEffectData,
std::monostate>;

struct ColorSourceDataVisitor {
Copy link
Member

Choose a reason for hiding this comment

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

This should be moved into the .cc file in an anonymous namespace.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@@ -25,6 +25,90 @@ namespace impeller {

struct Paint;

struct LinearGradientData {
Copy link
Member

Choose a reason for hiding this comment

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

If we had Clone() calls for these contents, you wouldn't have to duplicate the data they need in structs. So the variant would just be std::variant<LinearGradientContents, RadialGradientContents, ...>.

GetContents would then just call Clone(), but storing it in a variant would allow you to visit the actual type.

Just a suggestion, feel free to punt since this is good.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, so rather than have the data at all, just make color source contents cloneable. That makes sense but would also require more refactors, since we store this on paint and do a lot of type based dispatching.

Copy link
Member Author

Choose a reason for hiding this comment

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

Though we could also change ColorSourceContents to remove the inheritance and change its behavior based on the variant its given.

RuntimeEffectData,
std::monostate>;

struct ColorSourceDataVisitor {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
struct ColorSourceDataVisitor {
struct CreateContentsVisitor {

Since that's what it does.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@jonahwilliams jonahwilliams marked this pull request as ready for review April 2, 2024 22:39
Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

LGTM!

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 3, 2024
@auto-submit auto-submit bot merged commit 5fc83bc into flutter:main Apr 3, 2024
@jonahwilliams jonahwilliams deleted the make_variant branch April 3, 2024 03:45
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 3, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Apr 3, 2024
…146180)

flutter/engine@0da1b2e...5fc83bc

2024-04-03 [email protected] [Impeller] make color source a variant instead of a closure. (flutter/engine#51853)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants