Skip to content

Commit f029837

Browse files
committed
Hopefully fixes black lines in RGB driver
1 parent 15c8f92 commit f029837

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ext_mod/lcd_bus/esp32_src/rgb_bus_rotation.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@
344344
y_end = MIN(y_end, v_res);
345345
}
346346

347-
uint16_t copy_bytes_per_line = (x_end - x_start + 1) * (uint16_t)bytes_per_pixel;
347+
uint16_t copy_bytes_per_line = (x_end - x_start) * (uint16_t)bytes_per_pixel;
348348
int pixels_per_line = h_res;
349349
uint32_t bytes_per_line = bytes_per_pixel * pixels_per_line;
350350
size_t offset = y_start * copy_bytes_per_line + x_start * bytes_per_pixel;
@@ -357,7 +357,7 @@
357357
uint8_t *fb = to + ((y_start * h_res + x_start) * bytes_per_pixel);
358358

359359
if (x_start == 0 && x_end == (h_res - 1)) {
360-
memcpy(fb, from, bytes_per_line * (y_end - y_start + 1));
360+
memcpy(fb, from, h_res * (y_end - y_start + 1) * bytes_per_pixel);
361361
} else {
362362
for (int y = y_start; y < y_end; y++) {
363363
memcpy(fb, from, copy_bytes_per_line);
@@ -400,7 +400,7 @@
400400
for (int y = y_start; y < y_end; y++) {
401401
for (int x = x_start; x < x_end; x++) {
402402
jj = y * copy_bytes_per_line + x * bytes_per_pixel - offset;
403-
ii = ((v_res - 1 - x) * h_res + y) * bytes_per_pixel;
403+
ii = (x * h_res + h_res - 1 - y) * bytes_per_pixel;
404404
func(to + ii, from + jj);
405405
}
406406
}

0 commit comments

Comments
 (0)