bitmaptools: dither: get rid of shifts
this happens to make the occasional FS dither artifact disappear. I guess `a * b >> 8` and `(a * b) / 256` are not identical. I'm not sure if it was just the parens or not, but write the clearer code and rely on the compiler to substitute an appropriate shift if possible.
This commit is contained in:
parent
9af76a2f03
commit
30c07a772f
|
@ -749,9 +749,9 @@ void common_hal_bitmaptools_dither(displayio_bitmap_t *dest_bitmap, displayio_bi
|
|||
int x1 = x + info->terms[i].dx;
|
||||
int dy = info->terms[i].dy;
|
||||
|
||||
rows[dy][x1] = ((info->terms[i].dl * err) >> 8) + rows[dy][x1];
|
||||
rows[dy][x1] = ((info->terms[i].dl * err) / 256) + rows[dy][x1];
|
||||
}
|
||||
err = err * info->dl >> 8;
|
||||
err = (err * info->dl) / 256;
|
||||
}
|
||||
write_pixels(dest_bitmap, y, out);
|
||||
|
||||
|
@ -779,9 +779,9 @@ void common_hal_bitmaptools_dither(displayio_bitmap_t *dest_bitmap, displayio_bi
|
|||
int x1 = x - info->terms[i].dx;
|
||||
int dy = info->terms[i].dy;
|
||||
|
||||
rows[dy][x1] = ((info->terms[i].dl * err) >> 8) + rows[dy][x1];
|
||||
rows[dy][x1] = ((info->terms[i].dl * err) / 256) + rows[dy][x1];
|
||||
}
|
||||
err = err * info->dl >> 8;
|
||||
err = (err * info->dl) / 256;
|
||||
}
|
||||
write_pixels(dest_bitmap, y, out);
|
||||
|
||||
|
|
Loading…
Reference in New Issue