Browse Source

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.
Andreas Kling 4 năm trước cách đây
mục cha
commit
08f1ea3e45
1 tập tin đã thay đổi với 4 bổ sung0 xóa
  1. 4 0
      Libraries/LibGfx/Painter.cpp

+ 4 - 0
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;