Skip to content

Commit

Permalink
fix(draw) underflow in subpixel font drawing
Browse files Browse the repository at this point in the history
Fixes: #2273
  • Loading branch information
kisvegabor committed Jun 15, 2021
1 parent 3abe517 commit 6d5ac70
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/draw/lv_draw_label.c
Original file line number Diff line number Diff line change
@@ -664,6 +664,14 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
int32_t col_bit;
col_bit = bit_ofs & 0x7; /*"& 0x7" equals to "% 8" just faster*/

lv_area_t map_area;
map_area.x1 = col_start / 3 + pos_x;
map_area.x2 = col_end / 3 + pos_x - 1;
map_area.y1 = row_start + pos_y;
map_area.y2 = map_area.y1;

if(map_area.x2 <= map_area.x1) return;

int32_t mask_buf_size = box_w * box_h > _LV_MASK_BUF_MAX_SIZE ? _LV_MASK_BUF_MAX_SIZE : g->box_w * g->box_h;
lv_opa_t * mask_buf = lv_mem_buf_get(mask_buf_size);
int32_t mask_p = 0;
@@ -682,12 +690,6 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
/*If the letter is partially out of mask the move there on draw_buf*/
disp_buf_buf_tmp += (row_start * disp_buf_width) + col_start / 3;

lv_area_t map_area;
map_area.x1 = col_start / 3 + pos_x;
map_area.x2 = col_end / 3 + pos_x - 1;
map_area.y1 = row_start + pos_y;
map_area.y2 = map_area.y1;

uint8_t other_mask_cnt = lv_draw_mask_get_cnt();

uint8_t font_rgb[3];

0 comments on commit 6d5ac70

Please sign in to comment.