diff --git a/src/core/lv_indev.c b/src/core/lv_indev.c index 30a9e8724..98d0f8704 100644 --- a/src/core/lv_indev.c +++ b/src/core/lv_indev.c @@ -1173,7 +1173,8 @@ static void indev_proc_release(lv_indev_t * indev) lv_obj_t * parent = scroll_obj; while(parent) { angle += lv_obj_get_style_transform_angle(parent, 0); - zoom *= (lv_obj_get_style_transform_zoom(parent, 0) / 256); + int32_t zoom_act = lv_obj_get_style_transform_zoom_safe(parent, 0); + zoom = (zoom * zoom_act) >> 8; parent = lv_obj_get_parent(parent); } diff --git a/src/core/lv_indev_scroll.c b/src/core/lv_indev_scroll.c index a29f24503..80f6249e8 100644 --- a/src/core/lv_indev_scroll.c +++ b/src/core/lv_indev_scroll.c @@ -68,7 +68,8 @@ void _lv_indev_scroll_handler(lv_indev_t * indev) lv_obj_t * parent = scroll_obj; while(parent) { angle += lv_obj_get_style_transform_angle(parent, 0); - zoom *= (lv_obj_get_style_transform_zoom(parent, 0) / 256); + int32_t zoom_act = lv_obj_get_style_transform_zoom_safe(parent, 0); + zoom = (zoom * zoom_act) >> 8; parent = lv_obj_get_parent(parent); } @@ -293,7 +294,7 @@ static lv_obj_t * find_scroll_obj(lv_indev_t * indev) lv_obj_t * parent = obj_act; while(parent) { angle += lv_obj_get_style_transform_angle(parent, 0); - int32_t zoom_act = lv_obj_get_style_transform_zoom(parent, 0); + int32_t zoom_act = lv_obj_get_style_transform_zoom_safe(parent, 0); zoom = (zoom * zoom_act) >> 8; parent = lv_obj_get_parent(parent); } diff --git a/src/core/lv_obj_pos.c b/src/core/lv_obj_pos.c index 6caef1ec9..f49810d49 100644 --- a/src/core/lv_obj_pos.c +++ b/src/core/lv_obj_pos.c @@ -1141,7 +1141,7 @@ static void layout_update_core(lv_obj_t * obj) static void transform_point(const lv_obj_t * obj, lv_point_t * p, bool inv) { int16_t angle = lv_obj_get_style_transform_angle(obj, 0); - int16_t zoom = lv_obj_get_style_transform_zoom(obj, 0); + int16_t zoom = lv_obj_get_style_transform_zoom_safe(obj, 0); if(angle == 0 && zoom == LV_ZOOM_NONE) return; diff --git a/src/core/lv_obj_style.h b/src/core/lv_obj_style.h index b5438d27a..bc6887d15 100644 --- a/src/core/lv_obj_style.h +++ b/src/core/lv_obj_style.h @@ -309,7 +309,11 @@ static inline lv_coord_t lv_obj_get_style_space_bottom(const struct _lv_obj_t * lv_text_align_t lv_obj_calculate_style_text_align(const struct _lv_obj_t * obj, lv_part_t part, const char * txt); - +static inline lv_coord_t lv_obj_get_style_transform_zoom_safe(const struct _lv_obj_t * obj, uint32_t part) +{ + int16_t zoom = lv_obj_get_style_transform_zoom(obj, part); + return zoom != 0 ? zoom : 1; +} /********************** * MACROS **********************/ diff --git a/src/core/lv_refr.c b/src/core/lv_refr.c index 6576bf52d..5ecd2966c 100644 --- a/src/core/lv_refr.c +++ b/src/core/lv_refr.c @@ -771,7 +771,7 @@ void refr_obj(lv_draw_ctx_t * draw_ctx, lv_obj_t * obj) if(draw_dsc.angle > 3600) draw_dsc.angle -= 3600; else if(draw_dsc.angle < 0) draw_dsc.angle += 3600; - draw_dsc.zoom = lv_obj_get_style_transform_zoom(obj, 0); + draw_dsc.zoom = lv_obj_get_style_transform_zoom_safe(obj, 0); draw_dsc.blend_mode = lv_obj_get_style_blend_mode(obj, 0); draw_dsc.antialias = disp_refr->antialiasing;