Skip to content

Commit

Permalink
Use ColorFilter::Matrix() instead of ColorFilter::Luma(). (#2523)
Browse files Browse the repository at this point in the history
  • Loading branch information
domchen authored Oct 10, 2024
1 parent 8aab41f commit 8af2d07
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/rendering/graphics/Modifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,10 @@ void MaskModifier::applyToGraphic(Canvas* canvas, std::shared_ptr<Graphic> graph
canvas->concat(matrix);
tgfx::Paint paint;
if (useLuma) {
shader = shader->makeWithColorFilter(tgfx::ColorFilter::Luma());
auto lumaFilter = tgfx::ColorFilter::Matrix(
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.21260000000000001, 0.71519999999999995,
0.0722, 0, 0});
shader = shader->makeWithColorFilter(lumaFilter);
}
paint.setMaskFilter(tgfx::MaskFilter::MakeShader(std::move(shader), inverted));
canvas->drawImage(image, &paint);
Expand Down
4 changes: 2 additions & 2 deletions test/baseline/version.json
Original file line number Diff line number Diff line change
Expand Up @@ -8337,7 +8337,7 @@
"GradientOverlayFilter_Star": "3c6e493e",
"HueSaturation": "4429f09f",
"LevelsIndividualFilter": "bd2ee44f",
"LogoMipmap": "4b7f3114",
"LogoMipmap": "8aab41f8",
"Mosaic": "48a897dd",
"MotionBlur_200000": "28826fb2",
"MotionBlur_600000": "c75e4d74",
Expand Down Expand Up @@ -8409,7 +8409,7 @@
"nextFrame": "6a420423",
"preFrame": "48a897dd",
"trackMatte": "088c7e93",
"trackMatte_luma": "30dab356",
"trackMatte_luma": "8aab41f8",
"visible": "7f7435d6f"
},
"PAGPlayerTest": {
Expand Down

0 comments on commit 8af2d07

Please sign in to comment.