1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

lmeter: fix warning

This commit is contained in:
Gabor Kiss-Vamosi 2019-12-05 12:57:59 +01:00
parent 1f2987a66b
commit d35e09bfcc
2 changed files with 21 additions and 20 deletions

View File

@ -241,7 +241,7 @@ int16_t lv_lmeter_get_max_value(const lv_obj_t * lmeter)
* @param lmeter pointer to a line meter object * @param lmeter pointer to a line meter object
* @return number of the scale units * @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); LV_ASSERT_OBJ(lmeter, LV_OBJX_NAME);

View File

@ -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); 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 * bg_style = lv_obj_get_style(table);
const lv_style_t * cell_style;
lv_coord_t h_row; lv_coord_t h_row;
lv_point_t txt_size; lv_point_t txt_size;
lv_area_t cell_area; 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++) { for(row = 0; row < ext->row_cnt; row++) {
h_row = get_row_height(table, row); h_row = get_row_height(table, row);
cell_area.y1 = cell_area.y2; cell_area.y1 = cell_area.y2 + 1;
cell_area.y2 = cell_area.y1 + h_row; cell_area.y2 = cell_area.y1 + h_row - 1;
cell_area.x2 = table->coords.x1 + bg_style->body.padding.left; 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; format.s.crop = 1;
} }
cell_style = ext->cell_style[format.s.type];
cell_area.x1 = cell_area.x2; lv_style_t cell_style;
cell_area.x2 = cell_area.x1 + ext->col_w[col]; 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; uint16_t col_merge = 0;
for(col_merge = 0; col_merge + col < ext->col_cnt - 1; col_merge++) { 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]) { if(ext->cell_data[cell]) {
txt_area.x1 = cell_area.x1 + cell_style->body.padding.left; txt_area.x1 = cell_area.x1 + cell_style.body.padding.left;
txt_area.x2 = cell_area.x2 - cell_style->body.padding.right; txt_area.x2 = cell_area.x2 - cell_style.body.padding.right;
txt_area.y1 = cell_area.y1 + cell_style->body.padding.top; txt_area.y1 = cell_area.y1 + cell_style.body.padding.top;
txt_area.y2 = cell_area.y2 - cell_style->body.padding.bottom; txt_area.y2 = cell_area.y2 - cell_style.body.padding.bottom;
/*Align the content to the middle if not cropped*/ /*Align the content to the middle if not cropped*/
if(format.s.crop == 0) { if(format.s.crop == 0) {
txt_flags = LV_TXT_FLAG_NONE; 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; txt_flags = LV_TXT_FLAG_EXPAND;
} }
lv_txt_get_size(&txt_size, ext->cell_data[cell] + 1, cell_style->text.font, 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, cell_style.text.letter_space, cell_style.text.line_space,
lv_area_get_width(&txt_area), txt_flags); lv_area_get_width(&txt_area), txt_flags);
/*Align the content to the middle if not cropped*/ /*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; bool label_mask_ok;
label_mask_ok = lv_area_intersect(&label_mask, mask, &cell_area); label_mask_ok = lv_area_intersect(&label_mask, mask, &cell_area);
if(label_mask_ok) { 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)); txt_flags, NULL, NULL, NULL, lv_obj_get_base_dir(table));
} }
/*Draw lines after '\n's*/ /*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++) { for(i = 1; ext->cell_data[cell][i] != '\0'; i++) {
if(ext->cell_data[cell][i] == '\n') { if(ext->cell_data[cell][i] == '\n') {
ext->cell_data[cell][i] = '\0'; ext->cell_data[cell][i] = '\0';
lv_txt_get_size(&txt_size, ext->cell_data[cell] + 1, cell_style->text.font, 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, cell_style.text.letter_space, cell_style.text.line_space,
lv_area_get_width(&txt_area), txt_flags); lv_area_get_width(&txt_area), txt_flags);
p1.y = txt_area.y1 + txt_size.y + cell_style->text.line_space / 2; 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; p2.y = txt_area.y1 + txt_size.y + cell_style.text.line_space / 2;
lv_draw_line(&p1, &p2, mask, cell_style, opa_scale); lv_draw_line(&p1, &p2, mask, &cell_style, opa_scale);
ext->cell_data[cell][i] = '\n'; ext->cell_data[cell][i] = '\n';
} }