mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
fix(imgbtn) displayed incorrect when the coordinate is negative (#2501)
* refactor(img) the function name spelling error * fix(imgbtn) imgbtn display incorrect when the coordinate is negative * imgbtn is ok now * fix the potential bug that maybe it can not run into the "for" loop correctly
This commit is contained in:
parent
df6cbfe866
commit
9ed265e890
@ -260,8 +260,7 @@ static void draw_main(lv_event_t * e)
|
||||
coords_part.x2 = coords_part.x1 + header.w - 1;
|
||||
coords_part.y2 = coords_part.y1 + header.h - 1;
|
||||
|
||||
for(i = 0; i < clip_center_area.x2 + header.w - 1; i += header.w) {
|
||||
|
||||
for(i = coords_part.x1; i < (lv_coord_t)(clip_center_area.x2 + header.w - 1); i += header.w) {
|
||||
lv_draw_img(&coords_part, &clip_center_area, src, &img_dsc);
|
||||
coords_part.x1 = coords_part.x2 + 1;
|
||||
coords_part.x2 += header.w;
|
||||
|
@ -417,7 +417,7 @@ static void lv_img_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj)
|
||||
}
|
||||
}
|
||||
|
||||
static lv_point_t lv_img_get_tranformed_size(lv_obj_t* obj)
|
||||
static lv_point_t lv_img_get_transformed_size(lv_obj_t* obj)
|
||||
{
|
||||
lv_img_t * img = (lv_img_t *)obj;
|
||||
|
||||
@ -513,7 +513,7 @@ static void lv_img_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
else if(code == LV_EVENT_GET_SELF_SIZE) {
|
||||
lv_point_t * p = lv_event_get_param(e);
|
||||
if (img->obj_size_mode == LV_IMG_SIZE_MODE_REAL){
|
||||
*p = lv_img_get_tranformed_size(obj);
|
||||
*p = lv_img_get_transformed_size(obj);
|
||||
}
|
||||
else {
|
||||
p->x = img->w;
|
||||
@ -637,7 +637,7 @@ static void draw_img(lv_event_t * e)
|
||||
lv_area_t img_max_area;
|
||||
lv_area_copy(&img_max_area, &obj->coords);
|
||||
|
||||
lv_point_t img_size_final = lv_img_get_tranformed_size(obj);
|
||||
lv_point_t img_size_final = lv_img_get_transformed_size(obj);
|
||||
|
||||
if(img->obj_size_mode == LV_IMG_SIZE_MODE_REAL){
|
||||
img_max_area.x1 -= ((img->w - img_size_final.x) + 1) / 2;
|
||||
|
Loading…
x
Reference in New Issue
Block a user