[Impeller] Color matrix color filter implementation.#35284
[Impeller] Color matrix color filter implementation.#35284auto-submit[bot] merged 12 commits intoflutter:mainfrom
Conversation
impeller/entity/entity_unittests.cc
Outdated
|
|
||
| // Define the ImGui | ||
| ImGui::Begin("Color Matrix"); | ||
| char label[4] = "##1"; |
There was a problem hiding this comment.
nit: use std::string label = "##1"; label.c_str(); // next line, makes it easier to change in the future.
|
|
||
| color = frag_info.color_m * color + frag_info.color_v; | ||
|
|
||
| // color = clamp(color); |
There was a problem hiding this comment.
drive by nit: commented out code
There was a problem hiding this comment.
Yes, just updated it. Thanks for catching that :)
|
bdero
left a comment
There was a problem hiding this comment.
LGTM.
I haven't actually tried the playground -- a screenshot or video of the test would be nice to see (but by no means required). :)
impeller/entity/entity_unittests.cc
Outdated
|
|
||
| // Set the color matrix filter. | ||
| FilterContents::ColorMatrix matrix = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; |
There was a problem hiding this comment.
Nit: For these and all of the other matrices, maybe lay these out in a 5x4 grid for easy reading? Often we use comments to coerce the formatter in situations like this. For example
FilterContents::ColorMatrix matrix = {
1, 1, 1, 1, 1, //
1, 1, 1, 1, 1, //
1, 1, 1, 1, 1, //
1, 1, 1, 1, 1, //
};
There was a problem hiding this comment.
Nice! I edited the matrices now.
|
@betrevisan could you please fix the formatting errors? |
The changes proposed in this PR implement the color matrix color filter in Impeller alongside accompanying tests. One of the added tests allows developers to play around with the behavior of the color filter as they change the values of the matrix.
The PR also fixes flutter/flutter#107358.
This PR was developed on top of the changes proposed earlier in #34483.
Below is a Demo of what the playground looks like for this filter.

Pre-launch Checklist
writing and running engine tests.
///).