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

Commit 7843ae8

Browse files
[Impeller] Correct the ordering of filters in 'Paint::WithFilters' (#37239)
1 parent 2e89bce commit 7843ae8

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

impeller/aiks/paint.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ std::shared_ptr<Contents> Paint::WithFilters(
4545
std::optional<bool> is_solid_color,
4646
const Matrix& effect_transform) const {
4747
bool is_solid_color_val = is_solid_color.value_or(!color_source);
48+
input = WithColorFilter(input);
4849
input = WithMaskBlur(input, is_solid_color_val, effect_transform);
4950
input = WithImageFilter(input, effect_transform);
50-
input = WithColorFilter(input);
5151
return input;
5252
}
5353

impeller/display_list/display_list_unittests.cc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,5 +959,34 @@ TEST_P(DisplayListTest, CanBlendDstOverAndDstCorrectly) {
959959
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
960960
}
961961

962+
TEST_P(DisplayListTest, CanDrawCorrectlyWithColorFilterAndImageFilter) {
963+
flutter::DisplayListBuilder builder;
964+
const float green_color_matrix[20] = {
965+
0, 0, 0, 0, 0, //
966+
0, 0, 0, 0, 1, //
967+
0, 0, 0, 0, 0, //
968+
0, 0, 0, 1, 0, //
969+
};
970+
const float blue_color_matrix[20] = {
971+
0, 0, 0, 0, 0, //
972+
0, 0, 0, 0, 0, //
973+
0, 0, 0, 0, 1, //
974+
0, 0, 0, 1, 0, //
975+
};
976+
auto green_color_filter =
977+
std::make_shared<flutter::DlMatrixColorFilter>(green_color_matrix);
978+
auto blue_color_filter =
979+
std::make_shared<flutter::DlMatrixColorFilter>(blue_color_matrix);
980+
auto blue_image_filter =
981+
std::make_shared<flutter::DlColorFilterImageFilter>(blue_color_filter);
982+
983+
flutter::DlPaint paint;
984+
paint.setColor(flutter::DlColor::kRed());
985+
paint.setColorFilter(green_color_filter);
986+
paint.setImageFilter(blue_image_filter);
987+
builder.drawRect(SkRect::MakeLTRB(100, 100, 500, 500), paint);
988+
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
989+
}
990+
962991
} // namespace testing
963992
} // namespace impeller

0 commit comments

Comments
 (0)