bitmaptools dither: Fix off-by-one error filling row data

This commit is contained in:
Jeff Epler 2021-11-24 09:15:17 -06:00
parent 6191696232
commit 9af76a2f03
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE

View File

@ -761,13 +761,13 @@ void common_hal_bitmaptools_dither(displayio_bitmap_t *dest_bitmap, displayio_bi
rows[1] = rows[2]; rows[1] = rows[2];
rows[2] = tmp; rows[2] = tmp;
fill_row(source_bitmap, swap, rows[2], y + 2, info->mx);
y++; y++;
if (y == height) { if (y == height) {
break; break;
} }
fill_row(source_bitmap, swap, rows[2], y + 2, info->mx);
// Serpentine dither. Going right-to-left... // Serpentine dither. Going right-to-left...
for (int x = width; x--;) { for (int x = width; x--;) {
int16_t pixel_in = rows[0][x] + err; int16_t pixel_in = rows[0][x] + err;
@ -790,7 +790,7 @@ void common_hal_bitmaptools_dither(displayio_bitmap_t *dest_bitmap, displayio_bi
rows[1] = rows[2]; rows[1] = rows[2];
rows[2] = tmp; rows[2] = tmp;
fill_row(source_bitmap, swap, rows[2], y + 2, info->mx); fill_row(source_bitmap, swap, rows[2], y + 3, info->mx);
} }
displayio_area_t a = { 0, 0, width, height, NULL }; displayio_area_t a = { 0, 0, width, height, NULL };