1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

fix(indev): prevent division by zero (#7354)

This commit is contained in:
Paul Vogel 2024-11-27 04:17:27 -06:00 committed by GitHub
parent ecfed6bc07
commit 78be963c22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 0 deletions

View File

@ -1428,6 +1428,14 @@ static void indev_proc_release(lv_indev_t * indev)
parent = lv_obj_get_parent(parent); parent = lv_obj_get_parent(parent);
} }
if(scale_x == 0) {
scale_x = 1;
}
if(scale_y == 0) {
scale_y = 1;
}
if(angle != 0 || scale_y != LV_SCALE_NONE || scale_x != LV_SCALE_NONE) { if(angle != 0 || scale_y != LV_SCALE_NONE || scale_x != LV_SCALE_NONE) {
angle = -angle; angle = -angle;
scale_x = (256 * 256) / scale_x; scale_x = (256 * 256) / scale_x;

View File

@ -76,6 +76,14 @@ void lv_indev_scroll_handler(lv_indev_t * indev)
parent = lv_obj_get_parent(parent); parent = lv_obj_get_parent(parent);
} }
if(scale_x == 0) {
scale_x = 1;
}
if(scale_y == 0) {
scale_y = 1;
}
if(angle != 0 || scale_x != LV_SCALE_NONE || scale_y != LV_SCALE_NONE) { if(angle != 0 || scale_x != LV_SCALE_NONE || scale_y != LV_SCALE_NONE) {
angle = -angle; angle = -angle;
scale_x = (256 * 256) / scale_x; scale_x = (256 * 256) / scale_x;
@ -292,6 +300,14 @@ lv_obj_t * lv_indev_find_scroll_obj(lv_indev_t * indev)
parent = lv_obj_get_parent(parent); parent = lv_obj_get_parent(parent);
} }
if(scale_x == 0) {
scale_x = 1;
}
if(scale_y == 0) {
scale_y = 1;
}
lv_point_t obj_scroll_sum = indev->pointer.scroll_sum; lv_point_t obj_scroll_sum = indev->pointer.scroll_sum;
if(angle != 0 || scale_x != LV_SCALE_NONE || scale_y != LV_SCALE_NONE) { if(angle != 0 || scale_x != LV_SCALE_NONE || scale_y != LV_SCALE_NONE) {
angle = -angle; angle = -angle;