-
Notifications
You must be signed in to change notification settings - Fork 6k
[impeller] change input order in ColorFilterContents::MakeBlend #39038
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ std::shared_ptr<ColorFilterContents> ColorFilterContents::MakeBlend( | |
std::shared_ptr<BlendFilterContents> new_blend; | ||
for (auto in_i = inputs.begin() + 1; in_i < inputs.end(); in_i++) { | ||
new_blend = std::make_shared<BlendFilterContents>(); | ||
new_blend->SetInputs({*in_i, blend_input}); | ||
new_blend->SetInputs({blend_input, *in_i}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was the bug. We start with input 0, and input 1, and but we shifted input 1 and input 0. This was worked around in entity_pass.cc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (This re-arranging doesn't happen for pipeline blends which exit above. We could also change this code to not do the re-arranging for advanced blends with 2 inputs, but that has consistency implications |
||
new_blend->SetBlendMode(blend_mode); | ||
if (in_i < inputs.end() - 1 || foreground_color.has_value()) { | ||
blend_input = FilterInput::Make( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -856,7 +856,7 @@ TEST_P(EntityTest, Filters) { | |
|
||
auto blend1 = ColorFilterContents::MakeBlend( | ||
BlendMode::kScreen, | ||
{fi_bridge, FilterInput::Make(blend0), fi_bridge, fi_bridge}); | ||
{FilterInput::Make(blend0), fi_bridge, fi_bridge, fi_bridge}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This changes the output of this test. I think that is what we want, the way the previous algorithm worked for 2+ inputs was given the following filter inputs: N0 N1 N2 N3 First N1 becomes dst and N0 becomes src to produce F1 Now this is changed (and this output looks different), first N0 becomes dst and N1 becomes src to produce F1 I think the latter is more intuitive initially, but the former also sort of makes sense as a kind of polish notation (or reverse, I don't remember which). But of course this ends up with inconsistencies for the most common 2 input case since that works differently if you're just using the pipeline blends. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we could retain the old behavior if desired with a new constructor, since you can't really express one in terms of the other directly There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we don't rely on more then 2 inputs anywhere right now (I think the filter graph has bigger dreams, so maybe someday we will), changing the behavior now SGTM. I agree the latter seems more intuitive. |
||
|
||
Entity entity; | ||
entity.SetTransformation(Matrix::MakeScale(GetContentScale()) * | ||
|
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.
No change here, just renaming a bit for clarity