summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndi Gallo <andigallo@proton.me>2023-06-01 07:04:39 +0000
committerAndreas Kling <kling@serenityos.org>2023-06-01 09:22:41 +0200
commit62c7fcd836a78599a772ba5dec4982e4cadd0cd3 (patch)
tree7f76e35bcf512067bc0880f0f84151e323929a3f /Userland
parent966058d693625928abbc5b87ff9d8447bfe50541 (diff)
downloadserenity-62c7fcd836a78599a772ba5dec4982e4cadd0cd3.zip
LibGfx: Multiply alpha channels for vector fonts, when necessary
When the background color has an alpha < 255, we can't copy over the pixel alpha.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibGfx/Painter.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGfx/Painter.cpp b/Userland/Libraries/LibGfx/Painter.cpp
index cec2980fe0..51cc01e099 100644
--- a/Userland/Libraries/LibGfx/Painter.cpp
+++ b/Userland/Libraries/LibGfx/Painter.cpp
@@ -1430,6 +1430,10 @@ FLATTEN void Painter::draw_glyph(FloatPoint point, u32 code_point, Font const& f
FloatRect rect(point.x(), point.y(), scaled_width, scaled_height);
draw_scaled_bitmap(rect.to_rounded<int>(), *glyph.bitmap(), glyph.bitmap()->rect(), 1.0f, ScalingMode::BilinearBlend);
+ } else if (color.alpha() != 255) {
+ blit_filtered(glyph_position.blit_position, *glyph.bitmap(), glyph.bitmap()->rect(), [color](Color pixel) -> Color {
+ return pixel.multiply(color);
+ });
} else {
blit_filtered(glyph_position.blit_position, *glyph.bitmap(), glyph.bitmap()->rect(), [color](Color pixel) -> Color {
return color.with_alpha(pixel.alpha());