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

Merge pull request #622 from turoksama/dev-5.3

Attempt to fix an LV_BORDER_RIGHT drawing issue.
This commit is contained in:
Gabor Kiss-Vamosi 2018-12-16 08:32:24 +01:00 committed by GitHub
commit 5e080ad61d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -437,7 +437,6 @@ static bool lv_btnm_design(lv_obj_t * btnm, const lv_area_t * mask, lv_design_mo
lv_area_t area_tmp; lv_area_t area_tmp;
lv_coord_t btn_w; lv_coord_t btn_w;
lv_coord_t btn_h; lv_coord_t btn_h;
bool border_mod = false;
uint16_t btn_i = 0; uint16_t btn_i = 0;
uint16_t txt_i = 0; uint16_t txt_i = 0;
@ -465,21 +464,8 @@ static bool lv_btnm_design(lv_obj_t * btnm, const lv_area_t * mask, lv_design_mo
else if(btn_i == ext->btn_id_pr && btn_i == ext->btn_id_tgl) btn_style = lv_btnm_get_style(btnm, LV_BTNM_STYLE_BTN_TGL_PR); else if(btn_i == ext->btn_id_pr && btn_i == ext->btn_id_tgl) btn_style = lv_btnm_get_style(btnm, LV_BTNM_STYLE_BTN_TGL_PR);
else btn_style = lv_btnm_get_style(btnm, LV_BTNM_STYLE_BTN_REL); /*Not possible option, just to be sure*/ else btn_style = lv_btnm_get_style(btnm, LV_BTNM_STYLE_BTN_REL); /*Not possible option, just to be sure*/
/*On the right buttons clear the border if only right borders are drawn*/
if(ext->map_p[txt_i + 1][0] == '\0' || ext->map_p[txt_i + 1][0] == '\n') {
if(btn_style->body.border.part == LV_BORDER_RIGHT) {
btn_style->body.border.part = LV_BORDER_NONE;
border_mod = true;
}
}
lv_draw_rect(&area_tmp, mask, btn_style, opa_scale); lv_draw_rect(&area_tmp, mask, btn_style, opa_scale);
if(border_mod) {
border_mod = false;
btn_style->body.border.part = LV_BORDER_RIGHT;
}
/*Calculate the size of the text*/ /*Calculate the size of the text*/
if(btn_style->glass) btn_style = bg_style; if(btn_style->glass) btn_style = bg_style;
const lv_font_t * font = btn_style->text.font; const lv_font_t * font = btn_style->text.font;
@ -493,7 +479,6 @@ static bool lv_btnm_design(lv_obj_t * btnm, const lv_area_t * mask, lv_design_mo
area_tmp.x2 = area_tmp.x1 + txt_size.x; area_tmp.x2 = area_tmp.x1 + txt_size.x;
area_tmp.y2 = area_tmp.y1 + txt_size.y; area_tmp.y2 = area_tmp.y1 + txt_size.y;
lv_draw_label(&area_tmp, mask, btn_style, opa_scale, ext->map_p[txt_i], LV_TXT_FLAG_NONE, NULL); lv_draw_label(&area_tmp, mask, btn_style, opa_scale, ext->map_p[txt_i], LV_TXT_FLAG_NONE, NULL);
} }
} }