Skip to content

Commit 9af76a2

Browse files
committed
bitmaptools dither: Fix off-by-one error filling row data
1 parent 6191696 commit 9af76a2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

shared-module/bitmaptools/__init__.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -761,13 +761,13 @@ void common_hal_bitmaptools_dither(displayio_bitmap_t *dest_bitmap, displayio_bi
761761
rows[1] = rows[2];
762762
rows[2] = tmp;
763763

764-
fill_row(source_bitmap, swap, rows[2], y + 2, info->mx);
765-
766764
y++;
767765
if (y == height) {
768766
break;
769767
}
770768

769+
fill_row(source_bitmap, swap, rows[2], y + 2, info->mx);
770+
771771
// Serpentine dither. Going right-to-left...
772772
for (int x = width; x--;) {
773773
int16_t pixel_in = rows[0][x] + err;
@@ -790,7 +790,7 @@ void common_hal_bitmaptools_dither(displayio_bitmap_t *dest_bitmap, displayio_bi
790790
rows[1] = rows[2];
791791
rows[2] = tmp;
792792

793-
fill_row(source_bitmap, swap, rows[2], y + 2, info->mx);
793+
fill_row(source_bitmap, swap, rows[2], y + 3, info->mx);
794794
}
795795

796796
displayio_area_t a = { 0, 0, width, height, NULL };

0 commit comments

Comments
 (0)