BigW Consortium Gitlab

Commit 1689a121 by Gabor Kiss-Vamosi

label draw bugfix: upscale offset with anti-aliasing

parent a2db424e
...@@ -310,14 +310,18 @@ void lv_draw_label(const lv_area_t * coords,const lv_area_t * mask, const lv_sty ...@@ -310,14 +310,18 @@ void lv_draw_label(const lv_area_t * coords,const lv_area_t * mask, const lv_sty
lv_color_t recolor; lv_color_t recolor;
lv_coord_t letter_w; lv_coord_t letter_w;
lv_coord_t x_ofs = 0;
lv_coord_t y_ofs = 0;
if(offset != NULL) { if(offset != NULL) {
pos.y += offset->y; x_ofs = offset->x << LV_ANTIALIAS << LV_FONT_ANTIALIAS;
y_ofs = offset->y << LV_ANTIALIAS << LV_FONT_ANTIALIAS;
pos.y += y_ofs;
} }
/*Write out all lines*/ /*Write out all lines*/
while(txt[line_start] != '\0') { while(txt[line_start] != '\0') {
if(offset != NULL) { if(offset != NULL) {
pos.x += offset->x; pos.x += x_ofs;
} }
/*Write all letter of a line*/ /*Write all letter of a line*/
cmd_state = CMD_STATE_WAIT; cmd_state = CMD_STATE_WAIT;
...@@ -369,7 +373,7 @@ void lv_draw_label(const lv_area_t * coords,const lv_area_t * mask, const lv_sty ...@@ -369,7 +373,7 @@ void lv_draw_label(const lv_area_t * coords,const lv_area_t * mask, const lv_sty
pos.x += letter_w + (style->text.letter_space << LV_AA); pos.x += letter_w + (style->text.letter_space << LV_AA);
/* Round error occurs in x position /* Round error occurs in x position
* When odd widths are scaled down the last 1 is lost. So the letters seems shorter. * When odd widths are scaled down the last 1 is lost. So the letters seems shorter.
* Now calculate according to is to be consequent */ * Now calculate according to it to be consequent */
if(letter_w & 0x01) pos.x--; if(letter_w & 0x01) pos.x--;
} }
/*Go to next line*/ /*Go to next line*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment