diff --git a/src/lv_objx/lv_lmeter.c b/src/lv_objx/lv_lmeter.c index d5d215770..d1f210149 100644 --- a/src/lv_objx/lv_lmeter.c +++ b/src/lv_objx/lv_lmeter.c @@ -241,7 +241,7 @@ int16_t lv_lmeter_get_max_value(const lv_obj_t * lmeter) * @param lmeter pointer to a line meter object * @return number of the scale units */ -uint8_t lv_lmeter_get_line_count(const lv_obj_t * lmeter) +uint16_t lv_lmeter_get_line_count(const lv_obj_t * lmeter) { LV_ASSERT_OBJ(lmeter, LV_OBJX_NAME); diff --git a/src/lv_objx/lv_table.c b/src/lv_objx/lv_table.c index 79cdc777e..1410cc3a9 100644 --- a/src/lv_objx/lv_table.c +++ b/src/lv_objx/lv_table.c @@ -650,7 +650,6 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_ lv_table_ext_t * ext = lv_obj_get_ext_attr(table); const lv_style_t * bg_style = lv_obj_get_style(table); - const lv_style_t * cell_style; lv_coord_t h_row; lv_point_t txt_size; lv_area_t cell_area; @@ -666,8 +665,8 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_ for(row = 0; row < ext->row_cnt; row++) { h_row = get_row_height(table, row); - cell_area.y1 = cell_area.y2; - cell_area.y2 = cell_area.y1 + h_row; + cell_area.y1 = cell_area.y2 + 1; + cell_area.y2 = cell_area.y1 + h_row - 1; cell_area.x2 = table->coords.x1 + bg_style->body.padding.left; @@ -683,9 +682,11 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_ format.s.crop = 1; } - cell_style = ext->cell_style[format.s.type]; - cell_area.x1 = cell_area.x2; - cell_area.x2 = cell_area.x1 + ext->col_w[col]; + + lv_style_t cell_style; + lv_style_copy(&cell_style, ext->cell_style[format.s.type]); + cell_area.x1 = cell_area.x2 + 1; + cell_area.x2 = cell_area.x1 + ext->col_w[col] - 1; uint16_t col_merge = 0; for(col_merge = 0; col_merge + col < ext->col_cnt - 1; col_merge++) { @@ -701,14 +702,14 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_ } } - lv_draw_rect(&cell_area, mask, cell_style, opa_scale); + lv_draw_rect(&cell_area, mask, &cell_style, opa_scale); if(ext->cell_data[cell]) { - txt_area.x1 = cell_area.x1 + cell_style->body.padding.left; - txt_area.x2 = cell_area.x2 - cell_style->body.padding.right; - txt_area.y1 = cell_area.y1 + cell_style->body.padding.top; - txt_area.y2 = cell_area.y2 - cell_style->body.padding.bottom; + txt_area.x1 = cell_area.x1 + cell_style.body.padding.left; + txt_area.x2 = cell_area.x2 - cell_style.body.padding.right; + txt_area.y1 = cell_area.y1 + cell_style.body.padding.top; + txt_area.y2 = cell_area.y2 - cell_style.body.padding.bottom; /*Align the content to the middle if not cropped*/ if(format.s.crop == 0) { txt_flags = LV_TXT_FLAG_NONE; @@ -716,8 +717,8 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_ txt_flags = LV_TXT_FLAG_EXPAND; } - lv_txt_get_size(&txt_size, ext->cell_data[cell] + 1, cell_style->text.font, - cell_style->text.letter_space, cell_style->text.line_space, + lv_txt_get_size(&txt_size, ext->cell_data[cell] + 1, cell_style.text.font, + cell_style.text.letter_space, cell_style.text.line_space, lv_area_get_width(&txt_area), txt_flags); /*Align the content to the middle if not cropped*/ @@ -737,7 +738,7 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_ bool label_mask_ok; label_mask_ok = lv_area_intersect(&label_mask, mask, &cell_area); if(label_mask_ok) { - lv_draw_label(&txt_area, &label_mask, cell_style, opa_scale, ext->cell_data[cell] + 1, + lv_draw_label(&txt_area, &label_mask, &cell_style, opa_scale, ext->cell_data[cell] + 1, txt_flags, NULL, NULL, NULL, lv_obj_get_base_dir(table)); } /*Draw lines after '\n's*/ @@ -749,13 +750,13 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_ for(i = 1; ext->cell_data[cell][i] != '\0'; i++) { if(ext->cell_data[cell][i] == '\n') { ext->cell_data[cell][i] = '\0'; - lv_txt_get_size(&txt_size, ext->cell_data[cell] + 1, cell_style->text.font, - cell_style->text.letter_space, cell_style->text.line_space, + lv_txt_get_size(&txt_size, ext->cell_data[cell] + 1, cell_style.text.font, + cell_style.text.letter_space, cell_style.text.line_space, lv_area_get_width(&txt_area), txt_flags); - p1.y = txt_area.y1 + txt_size.y + cell_style->text.line_space / 2; - p2.y = txt_area.y1 + txt_size.y + cell_style->text.line_space / 2; - lv_draw_line(&p1, &p2, mask, cell_style, opa_scale); + p1.y = txt_area.y1 + txt_size.y + cell_style.text.line_space / 2; + p2.y = txt_area.y1 + txt_size.y + cell_style.text.line_space / 2; + lv_draw_line(&p1, &p2, mask, &cell_style, opa_scale); ext->cell_data[cell][i] = '\n'; }