-
Notifications
You must be signed in to change notification settings - Fork 6k
colorFilter as imageFilter for web #37522
colorFilter as imageFilter for web #37522
Conversation
Gold has detected about 6 new digest(s) on patchset 1. |
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. |
Gold has detected about 6 new digest(s) on patchset 2. |
Gold has detected about 1 new digest(s) on patchset 3. |
Gold has detected about 2 new digest(s) on patchset 4. |
Golden file changes are available for triage from new commit, Click here to view. |
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 seems to be moving things generally in the right direction, but I do still find the type hierarchy and the identity semantics of color filters to be pretty confusing here.
It seems as though you have two things that are sort of masquerading as each other in different situations. The EngineColorFilter
, which is basically a plain old data object that doesn't do any real rendering, and then the "renderer color filters" which you can convert them to, which actually do renderer-specific logic. But it looks like that conversion somehow implicitly happens when you round trip it through the Paint
object's colorFilter
getter/setter. I find that to be really surprising behavior.
One question I have is, do the "renderer color filter" objects and the EngineColorFilter
actually have to share a common base class? It feels wrong for them to be passed around interchangeably. It seems like the object using the "renderer color filter" should be aware that it isn't actually an EngineColorFilter
and so doesn't have to implement/extend ui.ColorFilter
. Perhaps the best thing is to make the "renderer color filter" a separate type of object that is like a ColorFilterProcessor
(or something like that) which can be produced from the EngineColorFilter
object by the renderer. That way the identity of the EngineColorFilter
and the filter processor object are clearly separated and not confused with each other.
I also suggest that instead of having four separate createXXXColorFilter
methods on the Renderer class, you just have one that is called createProcessorForColorFilter
which takes the color filter and passes back the processor class. And to avoid dynamic return values, you can create a base class for all the color filter processors.
9d8e51a
to
90ee21e
Compare
Gold has detected about 2 new digest(s) on patchset 6. |
Golden file changes are available for triage from new commit, Click here to view. |
Thanks for the comment and review! With the commit "removed Instead, there are two separate functions, A follow up PR will be necessary to further simplify the type hierarchy of imageFilter and colorFilter. Specifically, the "renderer colorFilters" don't need to implement the "renderer imageFilters". This is going to be another decently sized refactor (especially on the canvaskit side where we have Hopefully for now, these changes are good while fixing the original compiler error. If not, any suggestions for additional changes to clean up the current flow of things are welcome! |
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 with some formatting nits
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.
Looks awesome! A huge improvement. A couple small formatting things but this otherwise looks good to merge.
Gold has detected about 2 new digest(s) on patchset 8. |
…115406) * 6563c5843 Remove felt snapshotting behavior. (flutter/engine#37639) * c6e556489 Update language version in flutter_frontend_server/test/fixtures (flutter/engine#37643) * eedb93eb7 Update text editing tests (flutter/engine#37642) * a1dd33540 colorFilter as imageFilter for web (flutter/engine#37522) * b74c2c57a Remove usage of deprecated Fuchsia event source (flutter/engine#37641) * e56ed93fa Revert "Update text editing tests (#37642)" (flutter/engine#37653)
* colorFilter as imageFilter * misplaced early return in backdrop filter * fixed test that did not make sense * addressed comments * removed creator and toRendererColorFilter method * fixed typo and comment * formatting * more formatting
…lutter#115406) * 6563c5843 Remove felt snapshotting behavior. (flutter/engine#37639) * c6e556489 Update language version in flutter_frontend_server/test/fixtures (flutter/engine#37643) * eedb93eb7 Update text editing tests (flutter/engine#37642) * a1dd33540 colorFilter as imageFilter for web (flutter/engine#37522) * b74c2c57a Remove usage of deprecated Fuchsia event source (flutter/engine#37641) * e56ed93fa Revert "Update text editing tests (flutter#37642)" (flutter/engine#37653)
…lutter#115406) * 6563c5843 Remove felt snapshotting behavior. (flutter/engine#37639) * c6e556489 Update language version in flutter_frontend_server/test/fixtures (flutter/engine#37643) * eedb93eb7 Update text editing tests (flutter/engine#37642) * a1dd33540 colorFilter as imageFilter for web (flutter/engine#37522) * b74c2c57a Remove usage of deprecated Fuchsia event source (flutter/engine#37641) * e56ed93fa Revert "Update text editing tests (flutter#37642)" (flutter/engine#37653)
Previously, colorFilter on the web sdk was not a subtype of imageFilter. Therefore, when passing in a colorFilter as an imageFilter for any widget that accepts an imageFIlter (BackdropFilter, ImageFiltered, etc.), you would get a compiler error.
The web sdk before:
The web sdk after:
A refactor of the type hierarchy for colorFIlter was made with the change.
fixes: flutter/flutter#82637
Pre-launch Checklist
///
).