From 9bf1f55044de986d0dd4435332e8dbcfe0ffa591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Costa?= Date: Thu, 17 Sep 2026 14:09:32 +0200 Subject: [PATCH] refactor(indev): use generic lv_point_rotate instead of lv_display_rotate_point --- src/indev/lv_indev.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/indev/lv_indev.c b/src/indev/lv_indev.c index 9a310c0396..336c32aaf8 100644 --- a/src/indev/lv_indev.c +++ b/src/indev/lv_indev.c @@ -752,12 +752,17 @@ static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data) i->pointer.last_raw_point.x = data->point.x; i->pointer.last_raw_point.y = data->point.y; - if(lv_indev_get_ccw(i)) { - lv_display_rotate_point_ccw(i->disp, &data->point); - } - else { - lv_display_rotate_point(i->disp, &data->point); - } + /* The point travels from the panel to the screen, the opposite way to the rendering*/ + const lv_rotation_t inverse = lv_rotation_invert(lv_display_get_rotation(i->disp)); + + /* Handle the case where the indev rotation direction is ccw. + * This is a essentially a no-op in the default case*/ + const lv_rotation_t rotation = lv_rotation_resolve(inverse, indev_rotation_dir(i)); + + const int32_t display_width = lv_display_get_original_horizontal_resolution(i->disp); + const int32_t display_height = lv_display_get_original_vertical_resolution(i->disp); + + lv_point_rotate(&data->point, rotation, display_width, display_height); /*Simple sanity check*/ if(data->point.x < 0) {