diff --git a/src/lv_widgets/lv_imgbtn.c b/src/lv_widgets/lv_imgbtn.c index 6dc33a8a37..25695f26bf 100644 --- a/src/lv_widgets/lv_imgbtn.c +++ b/src/lv_widgets/lv_imgbtn.c @@ -296,6 +296,10 @@ static lv_design_res_t lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * cli return LV_DESIGN_RES_OK; } + lv_draw_img_dsc_t img_dsc; + lv_draw_img_dsc_init(&img_dsc); + lv_obj_init_draw_img_dsc(imgbtn, LV_IMGBTN_PART_MAIN, &img_dsc); + lv_img_header_t header; lv_area_t coords; lv_coord_t left_w = 0; @@ -308,7 +312,7 @@ static lv_design_res_t lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * cli coords.y1 = imgbtn->coords.y1; coords.x2 = coords.x1 + header.w - 1; coords.y2 = coords.y1 + header.h - 1; - lv_draw_img(&coords, clip_area, src, style, 0, NULL, LV_IMG_ZOOM_NONE, false, opa_scale); + lv_draw_img(&coords, clip_area, src, &img_dsc); } src = ext->img_src_right[state]; @@ -319,7 +323,7 @@ static lv_design_res_t lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * cli coords.y1 = imgbtn->coords.y1; coords.x2 = imgbtn->coords.x2; coords.y2 = imgbtn->coords.y1 + header.h - 1; - lv_draw_img(&coords, clip_area, src, style, 0, NULL, LV_IMG_ZOOM_NONE, false, opa_scale); + lv_draw_img(&coords, clip_area, src, &img_dsc); } src = ext->img_src_mid[state]; @@ -344,7 +348,7 @@ static lv_design_res_t lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * cli coords.y2 = imgbtn->coords.y1 + header.h - 1; for(i = 0; i < obj_w - right_w - left_w; i += header.w) { - lv_draw_img(&coords, &clip_center_area, src, style, 0, NULL, LV_IMG_ZOOM_NONE, false, opa_scale); + lv_draw_img(&coords, clip_area, src, &img_dsc); coords.x1 = coords.x2 + 1; coords.x2 += header.w; } diff --git a/src/lv_widgets/lv_imgbtn.h b/src/lv_widgets/lv_imgbtn.h index a50a8ae6de..87ac781dd3 100644 --- a/src/lv_widgets/lv_imgbtn.h +++ b/src/lv_widgets/lv_imgbtn.h @@ -41,9 +41,9 @@ typedef struct #if LV_IMGBTN_TILED == 0 const void * img_src[_LV_BTN_STATE_LAST]; /*Store images to each state*/ #else - const void * img_src_left[_LV_BTN_STATE_NUM]; /*Store left side images to each state*/ - const void * img_src_mid[_LV_BTN_STATE_NUM]; /*Store center images to each state*/ - const void * img_src_right[_LV_BTN_STATE_NUM]; /*Store right side images to each state*/ + const void * img_src_left[_LV_BTN_STATE_LAST]; /*Store left side images to each state*/ + const void * img_src_mid[_LV_BTN_STATE_LAST]; /*Store center images to each state*/ + const void * img_src_right[_LV_BTN_STATE_LAST]; /*Store right side images to each state*/ #endif lv_img_cf_t act_cf; /*Color format of the currently active image*/ } lv_imgbtn_ext_t;