1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:07:34 +00:00

LibGfx: Eliminate conditional branch in dither

In theory, this should make dithering a teensy bit faster.
This commit is contained in:
Ben Wiederhake 2020-05-11 00:14:31 +02:00 committed by Andreas Kling
parent c88c883f44
commit ebe47de0b2

View file

@ -147,10 +147,8 @@ void Painter::fill_rect_with_dither_pattern(const Rect& a_rect, Color color_a, C
for (int i = 0; i < rect.height(); ++i) {
for (int j = 0; j < rect.width(); ++j) {
if (i & 1)
dst[j] = (j & 1) ? color_a.value() : color_b.value();
else
dst[j] = (j & 1) ? color_b.value() : color_a.value();
bool checkboard_use_a = (i & 1) ^ (j & 1);
dst[j] = checkboard_use_a ? color_a.value() : color_b.value();
}
dst += dst_skip;
}