فهرست منبع

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 5 سال پیش
والد
کامیت
08f1ea3e45
1فایلهای تغییر یافته به همراه4 افزوده شده و 0 حذف شده
  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 i = 0; i < rect.height(); ++i) {
         for (int j = 0; j < rect.width(); ++j) {
         for (int j = 0; j < rect.width(); ++j) {
             bool checkboard_use_a = (i & 1) ^ (j & 1);
             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[j] = checkboard_use_a ? color_a.value() : color_b.value();
         }
         }
         dst += dst_skip;
         dst += dst_skip;