Skip to content

Commit e2c0ce2

Browse files
authored
Merge pull request #197 from favnec5/patch-1
Update rgb_bus_rotation.c
2 parents d3769f8 + df3061b commit e2c0ce2

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

ext_mod/lcd_bus/esp32_src/rgb_bus_rotation.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -344,13 +344,10 @@
344344
y_end = MIN(y_end, d_height);
345345
}
346346

347-
uint16_t src_bytes_per_line = (x_end - x_start) * (uint16_t)bytes_per_pixel;
347+
uint16_t src_bytes_per_line = (x_end - x_start + 1) * (uint16_t)bytes_per_pixel;
348348
uint32_t dst_bytes_per_line = bytes_per_pixel * d_width;
349349
size_t offset = y_start * src_bytes_per_line + x_start * bytes_per_pixel;
350350

351-
uint32_t copy_bytes_per_line = (x_end - x_start) * bytes_per_pixel;
352-
size_t offset = y_start * copy_bytes_per_line + x_start * bytes_per_pixel;
353-
354351
// mp_printf(&mp_plat_print, "x_start=%lu, y_start=%lu, x_end=%lu, y_end=%lu, copy_bytes_per_line=%u, bytes_per_line=%lu, %lu\n",
355352
// x_start, y_start, x_end, y_end, copy_bytes_per_line, bytes_per_line, (uint32_t)((y_start * h_res + x_start) * bytes_per_pixel));
356353

@@ -361,12 +358,10 @@
361358
if (x_start == 0 && x_end == (d_width - 1)) {
362359
memcpy(fb, src, d_width * (y_end - y_start + 1) * bytes_per_pixel);
363360
} else {
364-
src_bytes_per_line = (x_end - x_start + 1) * (uint16_t)bytes_per_pixel;
365-
366361
for (int y = y_start; y < y_end; y++) {
367362
memcpy(fb, src, src_bytes_per_line);
368363
fb += dst_bytes_per_line;
369-
from += src_bytes_per_line;
364+
src += src_bytes_per_line;
370365
}
371366
}
372367

@@ -394,7 +389,7 @@
394389
for (size_t x = x_start; x < x_end; x++) {
395390
func(dst + index, src);
396391
index -= bytes_per_pixel;
397-
from += bytes_per_pixel;
392+
src += bytes_per_pixel;
398393
}
399394
}
400395
break;
@@ -418,4 +413,4 @@
418413
}
419414
}
420415

421-
#endif
416+
#endif

0 commit comments

Comments
 (0)