Skip to content

Commit

Permalink
lmeter: fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
kisvegabor committed Dec 5, 2019
1 parent 1f2987a commit d35e09b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/lv_objx/lv_lmeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
39 changes: 20 additions & 19 deletions src/lv_objx/lv_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand All @@ -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++) {
Expand All @@ -701,23 +702,23 @@ 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;
} else {
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*/
Expand All @@ -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*/
Expand All @@ -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';
}
Expand Down

0 comments on commit d35e09b

Please sign in to comment.