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

lv_img: fix invalidation area when angle or zoom changes

This commit is contained in:
Gabor Kiss-Vamosi 2020-06-24 10:02:45 +02:00
parent 916f5b343a
commit 8864cd87ee
2 changed files with 6 additions and 7 deletions

View File

@ -13,10 +13,11 @@
- In `lv_init` test if the the strings are UTF-8 encoded.
### Bugfixes
- None
- `lv_img` fix invalidation area when angle or zoom changes
## v7.0.2 (16.06.2020)
### Bugfixes
- `lv_textarea` fix wrong cursor position when clicked after the last character
- Change all text related indices from 16-bit to 32-bit integers throughout whole library. #1545
- Fix gestures

View File

@ -340,10 +340,9 @@ void lv_img_set_angle(lv_obj_t * img, int16_t angle)
transf_zoom = (transf_zoom * ext->zoom) >> 8;
lv_style_int_t transf_angle = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
transf_angle += ext->angle;
lv_area_t a;
_lv_img_buf_get_transformed_area(&a, ext->w, ext->h, transf_angle, transf_zoom, &ext->pivot);
_lv_img_buf_get_transformed_area(&a, ext->w, ext->h, transf_angle + ext->angle, transf_zoom, &ext->pivot);
a.x1 += img->coords.x1;
a.y1 += img->coords.y1;
a.x2 += img->coords.x1;
@ -353,7 +352,7 @@ void lv_img_set_angle(lv_obj_t * img, int16_t angle)
ext->angle = angle;
lv_obj_refresh_ext_draw_pad(img);
_lv_img_buf_get_transformed_area(&a, ext->w, ext->h, transf_angle, transf_zoom, &ext->pivot);
_lv_img_buf_get_transformed_area(&a, ext->w, ext->h, transf_angle + ext->angle, transf_zoom, &ext->pivot);
a.x1 += img->coords.x1;
a.y1 += img->coords.y1;
a.x2 += img->coords.x1;
@ -379,13 +378,12 @@ void lv_img_set_zoom(lv_obj_t * img, uint16_t zoom)
if(zoom == 0) zoom = 1;
lv_style_int_t transf_zoom = lv_obj_get_style_transform_zoom(img, LV_IMG_PART_MAIN);
transf_zoom = (transf_zoom * ext->zoom) >> 8;
lv_style_int_t transf_angle = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
transf_angle += ext->angle;
lv_area_t a;
_lv_img_buf_get_transformed_area(&a, ext->w, ext->h, transf_angle, transf_zoom, &ext->pivot);
_lv_img_buf_get_transformed_area(&a, ext->w, ext->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;
@ -395,7 +393,7 @@ void lv_img_set_zoom(lv_obj_t * img, uint16_t zoom)
ext->zoom = zoom;
lv_obj_refresh_ext_draw_pad(img);
_lv_img_buf_get_transformed_area(&a, ext->w, ext->h, transf_angle, transf_zoom, &ext->pivot);
_lv_img_buf_get_transformed_area(&a, ext->w, ext->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;