-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] support many colors/stops on Linear/Radial/SweepGradient #35782
Conversation
|
This pull request was opened against a branch other than main. Since Flutter pull requests should not normally be opened against branches other than main, I have changed the base to main. If this was intended, you may modify the base back to master. See the Release Process for information about how other branches get updated. Reviewers: Use caution before merging pull requests to branches other than main, unless this is an intentional hotfix/cherrypick. |
This comment was marked as off-topic.
This comment was marked as off-topic.
| auto gradient_snapshot = | ||
| gradient_generator_->RenderToSnapshot(renderer, placeholder); |
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.
Should we try to elide this if there are only two colors? This will mean we're always doing a RT switch even when we wouldn't otherwise need to, right?
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.
I added special two color versions. From some cursory searching in google3, almost all linear gradients are two color
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
This is hitting flutter/flutter#110800, but that repro's at ToT |
|
Debugging in the wonders app, this may have some issues with certain stop values. Investigating |
|
and fixed .. classic off by one. The shimmer effect in the wonders app now functions as expected |
dnfield
left a comment
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.
This is awesome. Nits about the include paths.
|
|
||
| #include <algorithm> | ||
|
|
||
| #include "gradient_generator.h" |
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.
nit: impeller/renderer/gradient_generator.h
| #include "flutter/impeller/renderer/context.h" | ||
| #include "flutter/impeller/renderer/texture.h" |
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.
| #include "flutter/impeller/renderer/context.h" | |
| #include "flutter/impeller/renderer/texture.h" | |
| #include "impeller/renderer/context.h" | |
| #include "impeller/renderer/texture.h" |
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.
(and elsewhere)


Create a texture for linear/radial/sweep gradients. Currently the size of this texture is capped at 1024, which was arbitrarily chosen. At runtime we sample from this texture, which means for non-uniform stops we must compute the texture color lerping on the CPU
fixes flutter/flutter#109728