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

Conversation

@jonahwilliams
Copy link
Contributor

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
Contributor Author

Choose a reason for hiding this comment

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

Done


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
Contributor 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
Contributor 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
Contributor 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
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