LibGfx: Fix color opacity regression in Canvas2D

The color alpha was being overwritten by the global alpha instead of
being multiplied.
This commit is contained in:
Lucien Fiorini 2024-12-19 12:10:08 +01:00 committed by Alexander Kalenik
parent 61755b29c9
commit 26970201bd
Notes: github-actions[bot] 2024-12-19 12:32:16 +00:00

View file

@ -195,7 +195,8 @@ void PainterSkia::stroke_path(Gfx::Path const& path, Gfx::PaintStyle const& pain
auto sk_path = to_skia_path(path);
auto paint = to_skia_paint(paint_style, filters);
paint.setAntiAlias(true);
paint.setAlphaf(global_alpha);
float alpha = paint.getAlphaf();
paint.setAlphaf(alpha * global_alpha);
paint.setStyle(SkPaint::Style::kStroke_Style);
paint.setStrokeWidth(thickness);
impl().canvas()->drawPath(sk_path, paint);
@ -228,7 +229,8 @@ void PainterSkia::fill_path(Gfx::Path const& path, Gfx::PaintStyle const& paint_
sk_path.setFillType(to_skia_path_fill_type(winding_rule));
auto paint = to_skia_paint(paint_style, filters);
paint.setAntiAlias(true);
paint.setAlphaf(global_alpha);
float alpha = paint.getAlphaf();
paint.setAlphaf(alpha * global_alpha);
impl().canvas()->drawPath(sk_path, paint);
}