From 08f1ea3e45db6d00814d7fced935d0e53afc9d99 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 1 Sep 2020 19:10:09 +0200 Subject: [PATCH] LibGfx: Make fill_rect_with_dither_pattern() skip transparent colors Maybe this should do full blending, but for now at least skip source pixels that have zero alpha. --- Libraries/LibGfx/Painter.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Libraries/LibGfx/Painter.cpp b/Libraries/LibGfx/Painter.cpp index 38c972ec92..ebafd9c726 100644 --- a/Libraries/LibGfx/Painter.cpp +++ b/Libraries/LibGfx/Painter.cpp @@ -154,6 +154,10 @@ void Painter::fill_rect_with_dither_pattern(const IntRect& a_rect, Color color_a for (int i = 0; i < rect.height(); ++i) { for (int j = 0; j < rect.width(); ++j) { bool checkboard_use_a = (i & 1) ^ (j & 1); + if (checkboard_use_a && !color_a.alpha()) + continue; + if (!checkboard_use_a && !color_b.alpha()) + continue; dst[j] = checkboard_use_a ? color_a.value() : color_b.value(); } dst += dst_skip;