minor style improvements

This commit is contained in:
Gabor Kiss-Vamosi
2020-01-09 01:37:14 +01:00
parent 621ff4e0f7
commit b5ce3dd25e
4 changed files with 14 additions and 13 deletions

View File

@@ -2037,7 +2037,6 @@ lv_style_int_t lv_obj_get_style_int(const lv_obj_t * obj, uint8_t part, lv_style
lv_style_attr_t attr;
attr.full = prop >> 8;
int16_t weight = -1;
lv_style_int_t value;
lv_res_t res = LV_RES_INV;
const lv_obj_t * parent = obj;
@@ -2670,7 +2669,7 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint8_t part, lv_draw_rect_dsc_t
draw_dsc->border_part = lv_obj_get_style_int(obj, part, LV_STYLE_BORDER_PART);
draw_dsc->border_color = lv_obj_get_style_color(obj, part, LV_STYLE_BORDER_COLOR);
}
draw_dsc->bg_blend_mode = lv_obj_get_style_int(obj, part, LV_STYLE_BORDER_BLEND_MODE);
draw_dsc->border_blend_mode = lv_obj_get_style_int(obj, part, LV_STYLE_BORDER_BLEND_MODE);
}
draw_dsc->pattern_src = lv_obj_get_style_ptr(obj, part, LV_STYLE_PATTERN_IMAGE);
@@ -2713,20 +2712,20 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint8_t part, lv_draw_rect_dsc_t
void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint8_t part, lv_draw_label_dsc_t * draw_dsc)
{
draw_dsc->opa = LV_OPA_50;//lv_obj_get_style_opa(obj, part, LV_STYLE_TEXT_OPA);
draw_dsc->opa = lv_obj_get_style_opa(obj, part, LV_STYLE_TEXT_OPA);
if(draw_dsc->opa <= LV_OPA_MIN) return;
lv_opa_t opa_scale = LV_OPA_COVER;//lv_obj_get_style_opa(obj, part, LV_STYLE_OPA_SCALE);
lv_opa_t opa_scale = lv_obj_get_style_opa(obj, part, LV_STYLE_OPA_SCALE);
if(opa_scale < LV_OPA_MAX) {
draw_dsc->opa = (uint16_t)((uint16_t)draw_dsc->opa * opa_scale) >> 8;
}
if(draw_dsc->opa <= LV_OPA_MIN) return;
draw_dsc->color = LV_COLOR_BLUE; //lv_obj_get_style_color(obj, part, LV_STYLE_TEXT_COLOR);
draw_dsc->letter_space = 0;//lv_obj_get_style_int(obj, part, LV_STYLE_LETTER_SPACE);
draw_dsc->line_space = 0;//lv_obj_get_style_int(obj, part, LV_STYLE_LETTER_SPACE);
draw_dsc->color = lv_obj_get_style_color(obj, part, LV_STYLE_TEXT_COLOR);
draw_dsc->letter_space = lv_obj_get_style_int(obj, part, LV_STYLE_LETTER_SPACE);
draw_dsc->line_space = lv_obj_get_style_int(obj, part, LV_STYLE_LETTER_SPACE);
draw_dsc->font = LV_FONT_DEFAULT;//lv_obj_get_style_ptr(obj, part, LV_STYLE_FONT);
draw_dsc->font = lv_obj_get_style_ptr(obj, part, LV_STYLE_FONT);
if(draw_dsc->sel_start != LV_DRAW_LABEL_NO_TXT_SEL && draw_dsc->sel_end != LV_DRAW_LABEL_NO_TXT_SEL) {
draw_dsc->color = lv_obj_get_style_color(obj, part, LV_STYLE_TEXT_SEL_COLOR);

View File

@@ -437,7 +437,7 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
}
}
/*If no better children check this object*/
/*If no better children use this object*/
if(found_p == NULL) {
if(design_res == LV_DESIGN_RES_COVER) {
found_p = obj;

View File

@@ -372,6 +372,7 @@ uint32_t prop_fooled[256];
lv_res_t lv_style_dsc_get_int(lv_style_dsc_t * dsc, lv_style_property_t prop, lv_style_int_t * value)
{
if(dsc == NULL) return LV_RES_INV;
if(dsc->local.map == NULL && dsc->classes == NULL) return LV_RES_INV;
lv_res_t res = LV_RES_OK;
@@ -470,6 +471,7 @@ lv_res_t lv_style_dsc_get_int(lv_style_dsc_t * dsc, lv_style_property_t prop, lv
lv_res_t lv_style_dsc_get_color(lv_style_dsc_t * dsc, lv_style_property_t prop, lv_color_t * value)
{
if(dsc == NULL) return LV_RES_INV;
if(dsc->local.map == NULL && dsc->classes == NULL) return LV_RES_INV;
lv_res_t res = LV_RES_OK;
@@ -532,6 +534,7 @@ lv_res_t lv_style_dsc_get_color(lv_style_dsc_t * dsc, lv_style_property_t prop,
lv_res_t lv_style_dsc_get_opa(lv_style_dsc_t * dsc, lv_style_property_t prop, lv_opa_t * value)
{
if(dsc == NULL) return LV_RES_INV;
if(dsc->local.map == NULL && dsc->classes == NULL) return LV_RES_INV;
volatile lv_res_t res = LV_RES_OK;
@@ -622,6 +625,7 @@ lv_res_t lv_style_dsc_get_opa(lv_style_dsc_t * dsc, lv_style_property_t prop, lv
lv_res_t lv_style_dsc_get_ptr(lv_style_dsc_t * dsc, lv_style_property_t prop, void ** value)
{
if(dsc == NULL) return LV_RES_INV;
if(dsc->local.map == NULL && dsc->classes == NULL) return LV_RES_INV;
lv_res_t res = LV_RES_OK;
@@ -645,7 +649,7 @@ lv_res_t lv_style_dsc_get_ptr(lv_style_dsc_t * dsc, lv_style_property_t prop, vo
int16_t weight_act;
int16_t weight = -1;
void * value_act;
void * value_act = NULL;
weight_act = lv_style_get_ptr(&dsc->local, prop, &value_act);
/*On perfect match return the value immediately*/

View File

@@ -123,9 +123,7 @@ static void basic_init(void)
lv_style_set_ptr(&btn, LV_STYLE_FONT | LV_STYLE_STATE_PRESSED, &lv_font_roboto_28);
lv_style_set_opa(&btn, LV_STYLE_BG_OPA, LV_OPA_50);
lv_style_set_opa(&btn, LV_STYLE_BORDER_OPA, LV_OPA_70);
// lv_style_set_opa(&btn, LV_STYLE_TEXT_OPA, LV_OPA_50);
// lv_style_set_value(&btn, LV_STYLE_SHADOW_WIDTH, 5);
// lv_style_set_value(&btn, LV_STYLE_SHADOW_OFFSET_Y, 10);
lv_style_set_opa(&btn, LV_STYLE_TEXT_OPA, LV_OPA_50);
lv_style_set_int(&btn, LV_STYLE_BORDER_WIDTH | LV_STYLE_STATE_FOCUS, 6);
lv_style_set_ptr(&btn, LV_STYLE_PATTERN_IMAGE | LV_STYLE_STATE_CHECKED, LV_SYMBOL_OK);
lv_style_set_int(&btn, LV_STYLE_PATTERN_REPEATE | LV_STYLE_STATE_CHECKED, 1);