opacity related bug fixes in draw functions

This commit is contained in:
Gabor Kiss-Vamosi
2018-08-06 15:22:46 +02:00
parent bcba74d0e7
commit 73bc138b70
4 changed files with 17 additions and 9 deletions

View File

@@ -292,7 +292,6 @@ static void lv_refr_area_with_vdb(const lv_area_t * area_p)
/*Round down the lines of VDB if rounding is added*/ /*Round down the lines of VDB if rounding is added*/
if(round_cb) { if(round_cb) {
/**/
lv_area_t tmp; lv_area_t tmp;
tmp.x1 = 0; tmp.x1 = 0;
tmp.x2 = 0; tmp.x2 = 0;
@@ -303,14 +302,14 @@ static void lv_refr_area_with_vdb(const lv_area_t * area_p)
do { do {
tmp.y2 = y_tmp; tmp.y2 = y_tmp;
round_cb(&tmp); round_cb(&tmp);
y_tmp --; /*Decrement the number of line until it is rounded to a smaller value the original. */ y_tmp --; /*Decrement the number of line until it is rounded to a smaller (or equal) value then the original. */
} while(tmp.y2 > max_row && y_tmp != 0); } while(lv_area_get_height(&tmp) > max_row && y_tmp != 0);
if(y_tmp == 0) { if(y_tmp == 0) {
LV_LOG_WARN("Can't set VDB height using the round function. (Wrong round_cb or to small VDB)"); LV_LOG_WARN("Can't set VDB height using the round function. (Wrong round_cb or to small VDB)");
return; return;
} else { } else {
max_row = tmp.y2; max_row = tmp.y2 + 1;
} }
} }

View File

@@ -471,7 +471,7 @@ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area
lv_coord_t width = lv_area_get_width(coords); lv_coord_t width = lv_area_get_width(coords);
lv_coord_t height = lv_area_get_height(coords); lv_coord_t height = lv_area_get_height(coords);
uint16_t bwidth = style->body.border.width; uint16_t bwidth = style->body.border.width;
lv_opa_t opa = (uint16_t)((uint16_t) style->body.border.opa * opa_scale) >> 8; lv_opa_t opa = opa_scale == LV_OPA_COVER ? style->body.border.opa : (uint16_t)((uint16_t) style->body.border.opa * opa_scale) >> 8;
lv_border_part_t part = style->body.border.part; lv_border_part_t part = style->body.border.part;
lv_color_t color = style->body.border.color; lv_color_t color = style->body.border.color;
lv_area_t work_area; lv_area_t work_area;

View File

@@ -62,6 +62,8 @@ static void sw_color_fill(lv_area_t * mem_area, lv_color_t * mem, const lv_area_
*/ */
void lv_vpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t color, lv_opa_t opa) void lv_vpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t color, lv_opa_t opa)
{ {
if(opa == LV_OPA_TRANSP) return;
lv_vdb_t * vdb_p = lv_vdb_get(); lv_vdb_t * vdb_p = lv_vdb_get();
/*Pixel out of the mask*/ /*Pixel out of the mask*/
@@ -100,6 +102,8 @@ void lv_vpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t col
void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p, void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
lv_color_t color, lv_opa_t opa) lv_color_t color, lv_opa_t opa)
{ {
if(opa == LV_OPA_TRANSP) return;
lv_area_t res_a; lv_area_t res_a;
bool union_ok; bool union_ok;
lv_vdb_t * vdb_p = lv_vdb_get(); lv_vdb_t * vdb_p = lv_vdb_get();
@@ -220,6 +224,9 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
204, 221, 238, 255 204, 221, 238, 255
}; };
if(opa == LV_OPA_TRANSP) return;
if(font_p == NULL) { if(font_p == NULL) {
LV_LOG_WARN("Font: character's bitmap not found"); LV_LOG_WARN("Font: character's bitmap not found");
return; return;
@@ -357,6 +364,8 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
lv_color_t recolor, lv_opa_t recolor_opa) lv_color_t recolor, lv_opa_t recolor_opa)
{ {
if(opa == LV_OPA_TRANSP) return;
lv_area_t masked_a; lv_area_t masked_a;
bool union_ok; bool union_ok;
lv_vdb_t * vdb_p = lv_vdb_get(); lv_vdb_t * vdb_p = lv_vdb_get();

View File

@@ -389,14 +389,12 @@ static bool lv_btn_design(lv_obj_t * btn, const lv_area_t * mask, lv_design_mode
} }
else if(mode == LV_DESIGN_DRAW_MAIN) { else if(mode == LV_DESIGN_DRAW_MAIN) {
ancestor_design(btn, mask, mode);
#if USE_LV_ANIMATION #if USE_LV_ANIMATION
if(btn != ink_obj) { if(btn != ink_obj) {
lv_style_t * style = lv_obj_get_style(btn); ancestor_design(btn, mask, mode);
lv_draw_rect(&btn->coords, mask, style, LV_OPA_COVER);
} else { } else {
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
lv_opa_t opa_scale = lv_obj_get_opa_scale(btn); lv_opa_t opa_scale = lv_obj_get_opa_scale(btn);
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
/*Draw the normal button*/ /*Draw the normal button*/
lv_draw_rect(&btn->coords, mask, ext->styles[ink_bg_state], opa_scale); lv_draw_rect(&btn->coords, mask, ext->styles[ink_bg_state], opa_scale);
@@ -436,6 +434,8 @@ static bool lv_btn_design(lv_obj_t * btn, const lv_area_t * mask, lv_design_mode
/*Draw the circle*/ /*Draw the circle*/
lv_draw_rect(&cir_area, mask, &cir_style, opa_scale); lv_draw_rect(&cir_area, mask, &cir_style, opa_scale);
} }
#else
ancestor_design(btn, mask, mode);
#endif #endif
} }
else if(mode == LV_DESIGN_DRAW_POST) { else if(mode == LV_DESIGN_DRAW_POST) {