1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

fix(img): increase the size of invalidated area in lv_img_set_zoom

Becasue of the pivot placement there can be some rounding errors
This commit is contained in:
Gabor Kiss-Vamosi 2020-11-28 12:38:48 +01:00
parent dded9b383a
commit 65f7ff66d5

View File

@ -390,20 +390,20 @@ void lv_img_set_zoom(lv_obj_t * img, uint16_t zoom)
lv_coord_t h = lv_obj_get_height(img);
lv_area_t a;
_lv_img_buf_get_transformed_area(&a, w, h, transf_angle, (transf_zoom * ext->zoom) >> 8, &ext->pivot);
a.x1 += img->coords.x1;
a.y1 += img->coords.y1;
a.x2 += img->coords.x1;
a.y2 += img->coords.y1;
a.x1 += img->coords.x1 - 1;
a.y1 += img->coords.y1 - 1;
a.x2 += img->coords.x1 + 1;
a.y2 += img->coords.y1 + 1;
lv_obj_invalidate_area(img, &a);
ext->zoom = zoom;
lv_obj_refresh_ext_draw_pad(img);
_lv_img_buf_get_transformed_area(&a, w, h, transf_angle, (transf_zoom * ext->zoom) >> 8, &ext->pivot);
a.x1 += img->coords.x1;
a.y1 += img->coords.y1;
a.x2 += img->coords.x1;
a.y2 += img->coords.y1;
a.x1 += img->coords.x1 - 1;
a.y1 += img->coords.y1 - 1;
a.x2 += img->coords.x1 + 1;
a.y2 += img->coords.y1 + 1;
lv_obj_invalidate_area(img, &a);
}